/* ============================================================================
   ClickCard Design System — final cascade layer
   Loaded after platform-ui.css. Modern-polish pass: clearer hierarchy, calmer
   surfaces, bigger touch targets, and components that never truncate or
   overflow. Scoped to .cc-app (the dashboard shell) unless noted.
   ============================================================================ */

:root {
    /* Brand blue, kept — just given a fuller ramp */
    --cc-blue-50:  #EFF6FF;
    --cc-blue-100: #DBEAFE;
    --cc-blue-200: #BFDBFE;
    --cc-blue-500: #3B82F6;
    --cc-blue-600: #2563EB;
    --cc-blue-700: #1D4ED8;
    --cc-blue-800: #1E40AF;

    /* Neutrals */
    --cc-n-0:   #FFFFFF;
    --cc-n-25:  #FCFDFE;
    --cc-n-50:  #F7F9FC;
    --cc-n-100: #EEF2F7;
    --cc-n-200: #E3E9F0;
    --cc-n-300: #CBD5E1;
    --cc-n-400: #94A3B8;
    --cc-n-500: #64748B;
    --cc-n-600: #475569;
    --cc-n-700: #334155;
    --cc-n-900: #0F172A;

    /* Semantic */
    --cc-success: #059669;
    --cc-success-soft: #ECFDF5;
    --cc-amber: #D97706;
    --cc-amber-soft: #FFFBEB;
    --cc-red: #DC2626;
    --cc-red-soft: #FEF2F2;

    /* Spacing scale */
    --cc-s1: 0.25rem;
    --cc-s2: 0.5rem;
    --cc-s3: 0.75rem;
    --cc-s4: 1rem;
    --cc-s5: 1.5rem;
    --cc-s6: 2rem;
    --cc-s7: 3rem;

    /* Radii — slightly larger reads more modern */
    --cc-r-sm: 8px;
    --cc-r-md: 12px;
    --cc-r-lg: 16px;
    --cc-r-pill: 999px;

    /* Layered, soft shadows */
    --cc-sh-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --cc-sh-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --cc-sh-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
    --cc-sh-lg: 0 12px 32px rgba(15, 23, 42, 0.10), 0 4px 8px rgba(15, 23, 42, 0.04);

    --cc-ring: 0 0 0 3px rgba(37, 99, 235, 0.18);

    /* Re-point legacy tokens so older rules inherit the refresh */
    --cc-bg: var(--cc-n-50);
    --cc-surface: var(--cc-n-0);
    --cc-border: var(--cc-n-200);
    --cc-muted: var(--cc-n-500);
    --cc-radius: var(--cc-r-md);
}

/* ---------------------------------------------------------------- Base type */

.cc-app {
    font-size: 15px;
}

.cc-app,
.cc-app p,
.cc-app li,
.cc-app td,
.cc-app label {
    line-height: 1.6;
}

.cc-app h1 { font-size: 1.6rem !important; letter-spacing: -0.02em !important; }
.cc-app h2 { font-size: 1.35rem !important; letter-spacing: -0.015em !important; }
.cc-app h3 { font-size: 1.15rem !important; letter-spacing: -0.01em !important; }
.cc-app h4 { font-size: 1.05rem !important; }
.cc-app h5 { font-size: 0.98rem !important; }
.cc-app h6 { font-size: 0.9rem !important; }

.cc-app h1, .cc-app h2, .cc-app h3,
.cc-app h4, .cc-app h5, .cc-app h6 {
    font-weight: 700 !important;
    color: var(--cc-n-900);
}

.cc-app .text-muted,
.cc-app small {
    color: var(--cc-n-500) !important;
}

/* ============================== Grid restore ==============================
   platform-ui.css ships a minimal Bootstrap fallback whose `.row > *` sets
   `width: 100%`. It has the same specificity as Bootstrap's own `.col-md-6`
   etc. but loads later, so it silently won every column class except the
   handful it re-declares (col-6, col-12, col-xl-3/4/8). Everything else —
   col-md-6, col-lg-3, col-md-4 … — collapsed to full width and stacked.
   Re-declaring the standard grid here (loaded last) restores it everywhere. */

.cc-app .row > .col { flex: 1 0 0%; width: auto; }
.cc-app .row > .col-auto { flex: 0 0 auto; width: auto; }

.cc-app .row > .col-1  { flex: 0 0 auto; width: 8.33333333%; }
.cc-app .row > .col-2  { flex: 0 0 auto; width: 16.66666667%; }
.cc-app .row > .col-3  { flex: 0 0 auto; width: 25%; }
.cc-app .row > .col-4  { flex: 0 0 auto; width: 33.33333333%; }
.cc-app .row > .col-5  { flex: 0 0 auto; width: 41.66666667%; }
.cc-app .row > .col-6  { flex: 0 0 auto; width: 50%; }
.cc-app .row > .col-7  { flex: 0 0 auto; width: 58.33333333%; }
.cc-app .row > .col-8  { flex: 0 0 auto; width: 66.66666667%; }
.cc-app .row > .col-9  { flex: 0 0 auto; width: 75%; }
.cc-app .row > .col-10 { flex: 0 0 auto; width: 83.33333333%; }
.cc-app .row > .col-11 { flex: 0 0 auto; width: 91.66666667%; }
.cc-app .row > .col-12 { flex: 0 0 auto; width: 100%; }

@media (min-width: 576px) {
    .cc-app .row > .col-sm-1  { flex: 0 0 auto; width: 8.33333333%; }
    .cc-app .row > .col-sm-2  { flex: 0 0 auto; width: 16.66666667%; }
    .cc-app .row > .col-sm-3  { flex: 0 0 auto; width: 25%; }
    .cc-app .row > .col-sm-4  { flex: 0 0 auto; width: 33.33333333%; }
    .cc-app .row > .col-sm-5  { flex: 0 0 auto; width: 41.66666667%; }
    .cc-app .row > .col-sm-6  { flex: 0 0 auto; width: 50%; }
    .cc-app .row > .col-sm-7  { flex: 0 0 auto; width: 58.33333333%; }
    .cc-app .row > .col-sm-8  { flex: 0 0 auto; width: 66.66666667%; }
    .cc-app .row > .col-sm-9  { flex: 0 0 auto; width: 75%; }
    .cc-app .row > .col-sm-10 { flex: 0 0 auto; width: 83.33333333%; }
    .cc-app .row > .col-sm-11 { flex: 0 0 auto; width: 91.66666667%; }
    .cc-app .row > .col-sm-12 { flex: 0 0 auto; width: 100%; }
}

@media (min-width: 768px) {
    .cc-app .row > .col-md-1  { flex: 0 0 auto; width: 8.33333333%; }
    .cc-app .row > .col-md-2  { flex: 0 0 auto; width: 16.66666667%; }
    .cc-app .row > .col-md-3  { flex: 0 0 auto; width: 25%; }
    .cc-app .row > .col-md-4  { flex: 0 0 auto; width: 33.33333333%; }
    .cc-app .row > .col-md-5  { flex: 0 0 auto; width: 41.66666667%; }
    .cc-app .row > .col-md-6  { flex: 0 0 auto; width: 50%; }
    .cc-app .row > .col-md-7  { flex: 0 0 auto; width: 58.33333333%; }
    .cc-app .row > .col-md-8  { flex: 0 0 auto; width: 66.66666667%; }
    .cc-app .row > .col-md-9  { flex: 0 0 auto; width: 75%; }
    .cc-app .row > .col-md-10 { flex: 0 0 auto; width: 83.33333333%; }
    .cc-app .row > .col-md-11 { flex: 0 0 auto; width: 91.66666667%; }
    .cc-app .row > .col-md-12 { flex: 0 0 auto; width: 100%; }
}

@media (min-width: 992px) {
    .cc-app .row > .col-lg-1  { flex: 0 0 auto; width: 8.33333333%; }
    .cc-app .row > .col-lg-2  { flex: 0 0 auto; width: 16.66666667%; }
    .cc-app .row > .col-lg-3  { flex: 0 0 auto; width: 25%; }
    .cc-app .row > .col-lg-4  { flex: 0 0 auto; width: 33.33333333%; }
    .cc-app .row > .col-lg-5  { flex: 0 0 auto; width: 41.66666667%; }
    .cc-app .row > .col-lg-6  { flex: 0 0 auto; width: 50%; }
    .cc-app .row > .col-lg-7  { flex: 0 0 auto; width: 58.33333333%; }
    .cc-app .row > .col-lg-8  { flex: 0 0 auto; width: 66.66666667%; }
    .cc-app .row > .col-lg-9  { flex: 0 0 auto; width: 75%; }
    .cc-app .row > .col-lg-10 { flex: 0 0 auto; width: 83.33333333%; }
    .cc-app .row > .col-lg-11 { flex: 0 0 auto; width: 91.66666667%; }
    .cc-app .row > .col-lg-12 { flex: 0 0 auto; width: 100%; }
}

@media (min-width: 1200px) {
    .cc-app .row > .col-xl-1  { flex: 0 0 auto; width: 8.33333333%; }
    .cc-app .row > .col-xl-2  { flex: 0 0 auto; width: 16.66666667%; }
    .cc-app .row > .col-xl-3  { flex: 0 0 auto; width: 25%; }
    .cc-app .row > .col-xl-4  { flex: 0 0 auto; width: 33.33333333%; }
    .cc-app .row > .col-xl-5  { flex: 0 0 auto; width: 41.66666667%; }
    .cc-app .row > .col-xl-6  { flex: 0 0 auto; width: 50%; }
    .cc-app .row > .col-xl-7  { flex: 0 0 auto; width: 58.33333333%; }
    .cc-app .row > .col-xl-8  { flex: 0 0 auto; width: 66.66666667%; }
    .cc-app .row > .col-xl-9  { flex: 0 0 auto; width: 75%; }
    .cc-app .row > .col-xl-10 { flex: 0 0 auto; width: 83.33333333%; }
    .cc-app .row > .col-xl-11 { flex: 0 0 auto; width: 91.66666667%; }
    .cc-app .row > .col-xl-12 { flex: 0 0 auto; width: 100%; }
}

@media (min-width: 1400px) {
    .cc-app .row > .col-xxl-3  { flex: 0 0 auto; width: 25%; }
    .cc-app .row > .col-xxl-4  { flex: 0 0 auto; width: 33.33333333%; }
    .cc-app .row > .col-xxl-6  { flex: 0 0 auto; width: 50%; }
    .cc-app .row > .col-xxl-8  { flex: 0 0 auto; width: 66.66666667%; }
    .cc-app .row > .col-xxl-9  { flex: 0 0 auto; width: 75%; }
    .cc-app .row > .col-xxl-12 { flex: 0 0 auto; width: 100%; }
}

/* --------------------------------------------------------------- Flex grid */
/* Flex items default to min-width:auto, so a wide table inside a column can
   refuse to shrink and force the whole row to wrap (dropping the right column
   below the left). Letting columns shrink keeps side-by-side layouts intact —
   the inner .table-responsive scrolls instead. */

.cc-app .row > [class*="col-"] {
    min-width: 0;
}

/* ------------------------------------------------------------------- Shell */

.cc-app .cc-content {
    padding: var(--cc-s5);
    max-width: 1560px;
    margin: 0 auto;
}

.cc-topbar {
    padding: 0.85rem 1.5rem !important;
    min-height: 60px;
    box-shadow: var(--cc-sh-xs);
}

.cc-topbar-title {
    font-size: 1rem !important;
    font-weight: 700 !important;
    color: var(--cc-n-700) !important;
}

/* Sidebar: calmer, roomier, clearer active state */

.cc-sidebar {
    background: var(--cc-n-0);
    border-right: 1px solid var(--cc-n-200);
}

.cc-sidebar .nav-link {
    align-items: center;
    border-radius: var(--cc-r-sm);
    color: var(--cc-n-600) !important;
    display: flex;
    font-size: 0.9rem;
    font-weight: 550;
    gap: 0.7rem;
    margin: 1px 0.6rem;
    padding: 0.55rem 0.7rem !important;
    transition: background 0.14s ease, color 0.14s ease;
}

.cc-sidebar .nav-link i {
    color: var(--cc-n-400);
    font-size: 0.95rem;
    flex: 0 0 18px;
    text-align: center;
    transition: color 0.14s ease;
}

.cc-sidebar .nav-link:hover {
    background: var(--cc-n-50);
    color: var(--cc-n-900) !important;
}

.cc-sidebar .nav-link:hover i {
    color: var(--cc-n-600);
}

.cc-sidebar .nav-link.active {
    background: var(--cc-blue-50) !important;
    color: var(--cc-blue-700) !important;
    font-weight: 650;
}

.cc-sidebar .nav-link.active i {
    color: var(--cc-blue-600);
}

.cc-nav-group-label {
    color: var(--cc-n-400) !important;
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.08em !important;
    padding: 0.9rem 1.3rem 0.35rem !important;
    text-transform: uppercase;
}

/* --------------------------------------------------------------- Page head */

.cc-page-head {
    align-items: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: var(--cc-s4);
    justify-content: space-between;
    margin-bottom: var(--cc-s5);
}

.cc-page-head__text { min-width: 0; }

.cc-page-head h1,
.cc-page-head .cc-page-title {
    font-size: 1.55rem !important;
    font-weight: 750 !important;
    letter-spacing: -0.02em;
    margin: 0 0 0.3rem;
}

.cc-page-head .cc-page-sub {
    color: var(--cc-n-500);
    font-size: 0.94rem;
    margin: 0;
    max-width: 68ch;
}

.cc-page-head__actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: var(--cc-s2);
}

/* ------------------------------------------------------------------- Cards */

/* :not([class*="bg-"]) — never repaint a card that deliberately carries a
   Bootstrap background utility, or its white-on-colour text goes invisible. */
.cc-app .card:not([class*="bg-"]),
.cc-app .cc-card:not([class*="bg-"]) {
    background: var(--cc-n-0);
}

.cc-app .card,
.cc-app .cc-card {
    border: 1px solid var(--cc-n-200) !important;
    border-radius: var(--cc-r-md) !important;
    box-shadow: var(--cc-sh-sm) !important;
    transition: box-shadow 0.16s ease, border-color 0.16s ease;
}

/* Cards that carry their own colour keep a matching border rather than a
   mismatched grey one. */
.cc-app .card[class*="bg-"] { border-color: transparent !important; }

/* platform-ui.css paints `.card { background: ... !important }`, which also
   repainted cards that deliberately carry a Bootstrap bg-* utility — on
   Analytics that left white `text-white-50` labels on a white card, i.e.
   invisible. Restore the intended colour for those. */
.cc-app .card.bg-primary   { background: var(--cc-blue-600) !important; }
.cc-app .card.bg-success   { background: var(--cc-success) !important; }
.cc-app .card.bg-info      { background: #0369A1 !important; }
.cc-app .card.bg-warning   { background: #F59E0B !important; }
.cc-app .card.bg-danger    { background: var(--cc-red) !important; }
.cc-app .card.bg-dark      { background: var(--cc-n-900) !important; }
.cc-app .card.bg-secondary { background: var(--cc-n-500) !important; }
.cc-app .card.bg-light     { background: var(--cc-n-100) !important; }

.cc-app .card.bg-primary,
.cc-app .card.bg-success,
.cc-app .card.bg-info,
.cc-app .card.bg-danger,
.cc-app .card.bg-dark,
.cc-app .card.bg-secondary {
    color: #fff;
}

.cc-app .card[class*="bg-"] .card-title,
.cc-app .card[class*="bg-"] h1,
.cc-app .card[class*="bg-"] h2,
.cc-app .card[class*="bg-"] h3,
.cc-app .card[class*="bg-"] h4,
.cc-app .card[class*="bg-"] h5,
.cc-app .card[class*="bg-"] h6 {
    color: inherit;
}

.cc-app .card.bg-warning,
.cc-app .card.bg-light,
.cc-app .card.bg-warning .card-title,
.cc-app .card.bg-light .card-title {
    color: var(--cc-n-900);
}

/* Sub-labels inside coloured tiles: readable, not washed out. */
.cc-app .card.bg-primary .text-white-50,
.cc-app .card.bg-success .text-white-50,
.cc-app .card.bg-info .text-white-50,
.cc-app .card.bg-danger .text-white-50,
.cc-app .card.bg-dark .text-white-50,
.cc-app .card.bg-secondary .text-white-50 {
    color: rgba(255, 255, 255, 0.88) !important;
}

.cc-app .card.bg-primary small,
.cc-app .card.bg-success small,
.cc-app .card.bg-info small,
.cc-app .card.bg-danger small,
.cc-app .card.bg-dark small,
.cc-app .card.bg-secondary small,
.cc-app .card.bg-primary .text-muted,
.cc-app .card.bg-success .text-muted,
.cc-app .card.bg-info .text-muted,
.cc-app .card.bg-danger .text-muted,
.cc-app .card.bg-dark .text-muted,
.cc-app .card.bg-secondary .text-muted {
    color: rgba(255, 255, 255, 0.85) !important;
}

/* Light-background tiles need dark sub-labels, not white ones. */
.cc-app .card.bg-warning .text-white-50,
.cc-app .card.bg-light .text-white-50,
.cc-app .card.bg-warning small,
.cc-app .card.bg-light small,
.cc-app .card.bg-warning .text-muted,
.cc-app .card.bg-light .text-muted {
    color: rgba(15, 23, 42, 0.72) !important;
}

.cc-app .card[class*="bg-"] .bg-white-20 { background: rgba(255, 255, 255, 0.2); }

.cc-app .card-body { padding: var(--cc-s5); }

.cc-app .card-header {
    background: transparent !important;
    border-bottom: 1px solid var(--cc-n-200);
    font-weight: 650;
    padding: var(--cc-s4) var(--cc-s5);
}

.cc-app .card-header h5,
.cc-app .card-header h6 { margin: 0; }

/* ------------------------------------------------------- Stat tiles (KPIs) */
/* Auto-fit grid: tiles reflow instead of squeezing into col-md-2 and breaking
   words like "Templat es". Use .cc-stat-grid > .cc-stat. */

.cc-stat-grid {
    display: grid;
    gap: var(--cc-s3);
    grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
    margin-bottom: var(--cc-s5);
}

.cc-stat {
    background: var(--cc-n-0);
    border: 1px solid var(--cc-n-200);
    border-radius: var(--cc-r-md);
    box-shadow: var(--cc-sh-xs);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: var(--cc-s4);
    transition: box-shadow 0.16s ease, transform 0.16s ease;
}

.cc-stat:hover {
    box-shadow: var(--cc-sh-md);
}

.cc-stat__label {
    color: var(--cc-n-500);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.3;
    /* never break a word mid-way */
    overflow-wrap: normal;
    word-break: keep-all;
    hyphens: none;
}

.cc-stat__value {
    color: var(--cc-n-900);
    font-size: 1.6rem;
    font-weight: 750;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.cc-stat__meta {
    color: var(--cc-n-500);
    font-size: 0.76rem;
    margin-top: 0.15rem;
}

.cc-stat__meta .up { color: var(--cc-success); font-weight: 600; }
.cc-stat__meta .down { color: var(--cc-red); font-weight: 600; }

/* Safety net: stop ANY narrow bootstrap column from hyphen-breaking labels */
.cc-app .card-body .small,
.cc-app .card-body .text-muted {
    overflow-wrap: normal;
    word-break: keep-all;
    hyphens: none;
}

/* ------------------------------------------------------------------ Tables */

.cc-app .table {
    margin-bottom: 0;
    --bs-table-bg: transparent;
}

.cc-app .table > thead > tr > th {
    background: var(--cc-n-50);
    border-bottom: 1px solid var(--cc-n-200);
    color: var(--cc-n-500);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 0.7rem 0.9rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.cc-app .table > tbody > tr > td {
    border-bottom: 1px solid var(--cc-n-100);
    color: var(--cc-n-700);
    padding: 0.8rem 0.9rem;
    vertical-align: middle;
    /* Wrap between words, never inside one — otherwise amounts and IDs split
       mid-token ("₹150.0 / 0", "PVC2026…RYL / S"). */
    overflow-wrap: normal;
    word-break: keep-all;
    hyphens: none;
}

.cc-app .table > tbody > tr:last-child > td { border-bottom: 0; }

.cc-app .table > tbody > tr {
    transition: background 0.12s ease;
}

.cc-app .table > tbody > tr:hover {
    background: var(--cc-n-25);
}

/* Scroll container: only shows a scrollbar when it genuinely overflows, and
   fades the right edge so it's obvious there's more to see. */
.cc-app .table-responsive,
.cc-app .cc-table-wrap {
    border-radius: var(--cc-r-sm);
    scrollbar-width: thin;
}

.cc-app .table-responsive::-webkit-scrollbar,
.cc-app .cc-table-wrap::-webkit-scrollbar { height: 8px; }

.cc-app .table-responsive::-webkit-scrollbar-thumb,
.cc-app .cc-table-wrap::-webkit-scrollbar-thumb {
    background: var(--cc-n-300);
    border-radius: var(--cc-r-pill);
}

.cc-app .table-responsive::-webkit-scrollbar-track,
.cc-app .cc-table-wrap::-webkit-scrollbar-track { background: transparent; }

/* -------------------------------------------------------------------- List */
/* Use instead of a <table> inside narrow/half-width cards — truncates
   gracefully rather than forcing a horizontal scrollbar. */

.cc-list {
    display: flex;
    flex-direction: column;
}

.cc-list__item {
    align-items: center;
    border-bottom: 1px solid var(--cc-n-100);
    color: inherit;
    display: flex;
    gap: 0.85rem;
    padding: 0.8rem 0;
    text-decoration: none;
    transition: background 0.12s ease;
}

a.cc-list__item:hover {
    background: var(--cc-n-25);
    border-radius: var(--cc-r-sm);
    box-shadow: 0 0 0 8px var(--cc-n-25);
}

.cc-list__item:first-child { padding-top: 0; }
.cc-list__item:last-child { border-bottom: 0; padding-bottom: 0; }

.cc-list__avatar {
    align-items: center;
    background: var(--cc-blue-50);
    border-radius: var(--cc-r-sm);
    color: var(--cc-blue-600);
    display: flex;
    flex: 0 0 38px;
    font-size: 0.9rem;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.cc-list__avatar.is-neutral { background: var(--cc-n-100); color: var(--cc-n-500); }
.cc-list__avatar.is-success { background: var(--cc-success-soft); color: var(--cc-success); }

.cc-list__main {
    flex: 1 1 auto;
    min-width: 0;
}

.cc-list__title {
    color: var(--cc-n-900);
    font-size: 0.9rem;
    font-weight: 650;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cc-list__sub {
    color: var(--cc-n-500);
    font-size: 0.79rem;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cc-list__meta {
    align-items: flex-end;
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 0.2rem;
    text-align: right;
}

.cc-list__meta .cc-list__sub { white-space: nowrap; }

/* ------------------------------------------------------------ Card actions */
/* Labelled actions beat a row of mystery icons — a first-time user should be
   able to read what each button does without hovering. */

.cc-card-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.cc-card-actions .btn { white-space: nowrap; }

.cc-card-actions .dropdown { margin-left: auto; }

/* -------------------------------------------------------------- Empty state */

.cc-empty {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: var(--cc-s6) var(--cc-s4);
    text-align: center;
}

.cc-empty__icon {
    align-items: center;
    background: var(--cc-blue-50);
    border-radius: var(--cc-r-lg);
    color: var(--cc-blue-600);
    display: flex;
    font-size: 1.25rem;
    height: 52px;
    justify-content: center;
    margin-bottom: var(--cc-s2);
    width: 52px;
}

.cc-empty__icon.is-neutral {
    background: var(--cc-n-100);
    color: var(--cc-n-500);
}

.cc-empty__title {
    color: var(--cc-n-900);
    font-size: 1rem;
    font-weight: 700;
}

.cc-empty__text {
    color: var(--cc-n-500);
    font-size: 0.9rem;
    margin: 0;
    max-width: 46ch;
}

.cc-empty__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--cc-s2);
    justify-content: center;
    margin-top: var(--cc-s3);
}

/* ----------------------------------------------------------------- Buttons */

.cc-app .btn {
    border-radius: var(--cc-r-sm);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0;
    padding: 0.55rem 1rem;
    transition: background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, transform 0.08s ease;
}

.cc-app .btn:active { transform: translateY(1px); }

.cc-app .btn:focus-visible { box-shadow: var(--cc-ring); outline: none; }

.cc-app .btn-sm { font-size: 0.82rem; padding: 0.38rem 0.7rem; }
.cc-app .btn-lg { font-size: 1rem; padding: 0.75rem 1.4rem; }

.cc-app .btn-primary {
    background: var(--cc-blue-600);
    border-color: var(--cc-blue-600);
    box-shadow: var(--cc-sh-xs);
    color: #fff;
}

.cc-app .btn-primary:hover {
    background: var(--cc-blue-700);
    border-color: var(--cc-blue-700);
    box-shadow: var(--cc-sh-sm);
}

.cc-app .btn-outline-primary {
    border-color: var(--cc-n-300);
    color: var(--cc-blue-700);
}

.cc-app .btn-outline-primary:hover {
    background: var(--cc-blue-50);
    border-color: var(--cc-blue-200);
    color: var(--cc-blue-800);
}

.cc-app .btn-outline-secondary {
    border-color: var(--cc-n-300);
    color: var(--cc-n-600);
}

.cc-app .btn-outline-secondary:hover {
    background: var(--cc-n-50);
    border-color: var(--cc-n-400);
    color: var(--cc-n-900);
}

.cc-app .btn-light {
    background: var(--cc-n-100);
    border-color: transparent;
    color: var(--cc-n-700);
}

/* ------------------------------------------------------------------- Forms */

.cc-app .form-label {
    color: var(--cc-n-700);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.cc-app .form-control,
.cc-app .form-select {
    background: var(--cc-n-0);
    border: 1px solid var(--cc-n-300) !important;
    border-radius: var(--cc-r-sm) !important;
    color: var(--cc-n-900);
    font-size: 0.92rem;
    min-height: 42px;
    padding: 0.55rem 0.8rem !important;
    transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.cc-app .form-control::placeholder { color: var(--cc-n-400); }

.cc-app .form-control:focus,
.cc-app .form-select:focus {
    border-color: var(--cc-blue-500) !important;
    box-shadow: var(--cc-ring) !important;
    outline: none;
}

.cc-app .form-control-sm,
.cc-app .form-select-sm {
    font-size: 0.85rem;
    min-height: 36px;
    padding: 0.35rem 0.65rem !important;
}

.cc-app .form-text {
    color: var(--cc-n-500);
    font-size: 0.8rem;
    margin-top: 0.3rem;
}

.cc-app .form-check-input:checked {
    background-color: var(--cc-blue-600);
    border-color: var(--cc-blue-600);
}

.cc-app .form-check-input:focus {
    box-shadow: var(--cc-ring);
}

/* ------------------------------------------------------ Tabs / pills / nav */
/* Never wrap onto a second line — scroll horizontally instead. */

.cc-app .nav-tabs,
.cc-app .nav-pills {
    flex-wrap: nowrap;
    gap: 0.25rem;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.cc-app .nav-tabs::-webkit-scrollbar,
.cc-app .nav-pills::-webkit-scrollbar { display: none; }

.cc-app .nav-tabs { border-bottom: 1px solid var(--cc-n-200); }

.cc-app .nav-tabs .nav-link {
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    color: var(--cc-n-500);
    font-size: 0.88rem;
    font-weight: 600;
    padding: 0.6rem 0.9rem;
    white-space: nowrap;
}

.cc-app .nav-tabs .nav-link:hover {
    background: transparent;
    color: var(--cc-n-900);
}

.cc-app .nav-tabs .nav-link.active {
    background: transparent;
    border-bottom-color: var(--cc-blue-600);
    color: var(--cc-blue-700);
}

.cc-app .nav-pills .nav-link {
    background: transparent;
    border-radius: var(--cc-r-sm);
    color: var(--cc-n-600);
    font-size: 0.86rem;
    font-weight: 600;
    padding: 0.45rem 0.8rem;
    white-space: nowrap;
}

.cc-app .nav-pills .nav-link:hover {
    background: var(--cc-n-100);
    color: var(--cc-n-900);
}

.cc-app .nav-pills .nav-link.active {
    background: var(--cc-blue-600);
    color: #fff;
}

/* Segmented control look for pill groups that act as a switch */
.cc-app .nav-pills.cc-segmented {
    background: var(--cc-n-100);
    border-radius: var(--cc-r-sm);
    display: inline-flex;
    padding: 3px;
}

.cc-app .nav-pills.cc-segmented .nav-link.active {
    box-shadow: var(--cc-sh-xs);
}

/* ------------------------------------------------------------------ Badges */

.cc-app .badge {
    border-radius: var(--cc-r-pill);
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.01em;
    padding: 0.32em 0.7em;
}

.cc-app .badge.bg-success { background: var(--cc-success-soft) !important; color: #047857 !important; }
.cc-app .badge.bg-danger  { background: var(--cc-red-soft) !important; color: #B91C1C !important; }
.cc-app .badge.bg-warning { background: var(--cc-amber-soft) !important; color: #B45309 !important; }
.cc-app .badge.bg-primary { background: var(--cc-blue-50) !important; color: var(--cc-blue-700) !important; }
.cc-app .badge.bg-secondary { background: var(--cc-n-100) !important; color: var(--cc-n-600) !important; }
.cc-app .badge.bg-info { background: #F0F9FF !important; color: #0369A1 !important; }

.cc-badge {
    align-items: center;
    background: var(--cc-n-100);
    border-radius: var(--cc-r-pill);
    color: var(--cc-n-600);
    display: inline-flex;
    font-size: 0.75rem;
    font-weight: 600;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
}

/* ------------------------------------------------------------------ Alerts */

.cc-app .alert {
    border: 1px solid transparent;
    border-radius: var(--cc-r-md);
    font-size: 0.9rem;
    padding: 0.85rem 1.1rem;
}

.cc-app .alert-success { background: var(--cc-success-soft); border-color: #A7F3D0; color: #065F46; }
.cc-app .alert-danger  { background: var(--cc-red-soft); border-color: #FECACA; color: #991B1B; }
.cc-app .alert-warning { background: var(--cc-amber-soft); border-color: #FDE68A; color: #92400E; }
.cc-app .alert-info    { background: var(--cc-blue-50); border-color: var(--cc-blue-200); color: var(--cc-blue-800); }

/* --------------------------------------------------------- Helper surfaces */

.cc-hint {
    align-items: flex-start;
    background: var(--cc-blue-50);
    border: 1px solid var(--cc-blue-100);
    border-radius: var(--cc-r-md);
    color: var(--cc-blue-800);
    display: flex;
    font-size: 0.86rem;
    gap: 0.6rem;
    line-height: 1.55;
    padding: 0.8rem 1rem;
}

.cc-hint i { margin-top: 0.15rem; }

.cc-divider {
    background: var(--cc-n-200);
    border: 0;
    height: 1px;
    margin: var(--cc-s5) 0;
}

/* ------------------------------------------------- Collapsible setup panel */
/* <details>-based so it works with no JS. Closed by default keeps a long
   technical page from reading as a wall of fields. */

.cc-section {
    background: var(--cc-n-0);
    border: 1px solid var(--cc-n-200);
    border-radius: var(--cc-r-md);
    box-shadow: var(--cc-sh-sm);
    margin-bottom: 0.7rem;
    overflow: hidden;
}

.cc-section > summary {
    align-items: center;
    cursor: pointer;
    display: flex;
    gap: 0.9rem;
    list-style: none;
    padding: 1rem 1.2rem;
    transition: background 0.14s ease;
}

.cc-section > summary::-webkit-details-marker { display: none; }
.cc-section > summary::marker { content: ""; }
.cc-section > summary:hover { background: var(--cc-n-25); }

.cc-section__icon {
    align-items: center;
    background: var(--cc-blue-50);
    border-radius: var(--cc-r-sm);
    color: var(--cc-blue-600);
    display: flex;
    flex: 0 0 38px;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.cc-section__text { flex: 1 1 auto; min-width: 0; }

.cc-section__title {
    color: var(--cc-n-900);
    display: block;
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.3;
}

.cc-section__desc {
    color: var(--cc-n-500);
    display: block;
    font-size: 0.84rem;
    line-height: 1.45;
    margin-top: 0.15rem;
}

/* The legacy .setup-grid is a 2-column grid; accordions read better as one
   full-width stack. */
.cc-app .setup-grid {
    display: block;
}

.cc-section__chev {
    color: var(--cc-n-400);
    flex: 0 0 auto;
    transition: transform 0.18s ease;
}

.cc-section[open] .cc-section__chev { transform: rotate(180deg); }

.cc-section__body {
    border-top: 1px solid var(--cc-n-100);
    padding: 1.2rem;
}

/* Status chips */

.cc-chip {
    align-items: center;
    border-radius: var(--cc-r-pill);
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 0.72rem;
    font-weight: 650;
    gap: 0.35rem;
    padding: 0.28rem 0.65rem;
    white-space: nowrap;
}

.cc-chip::before {
    border-radius: 50%;
    content: "";
    height: 6px;
    width: 6px;
}

.cc-chip.is-ready { background: var(--cc-success-soft); color: #047857; }
.cc-chip.is-ready::before { background: var(--cc-success); }

.cc-chip.is-todo { background: var(--cc-amber-soft); color: #B45309; }
.cc-chip.is-todo::before { background: var(--cc-amber); }

.cc-chip.is-optional { background: var(--cc-n-100); color: var(--cc-n-500); }
.cc-chip.is-optional::before { background: var(--cc-n-400); }

/* Group heading between stacks of sections */

.cc-group-head {
    align-items: baseline;
    display: flex;
    gap: 0.6rem;
    margin: 1.6rem 0 0.7rem;
}

.cc-group-head__title {
    color: var(--cc-n-900);
    font-size: 1rem;
    font-weight: 700;
}

.cc-group-head__hint {
    color: var(--cc-n-500);
    font-size: 0.84rem;
}

/* ------------------------------------------------------- Tool launcher grid */

.cc-tools {
    display: grid;
    gap: 0.7rem;
    grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
}

.cc-tool {
    align-items: center;
    background: var(--cc-n-0);
    border: 1px solid var(--cc-n-200);
    border-radius: var(--cc-r-md);
    box-shadow: var(--cc-sh-xs);
    color: inherit;
    display: flex;
    gap: 0.7rem;
    padding: 0.85rem 0.95rem;
    text-decoration: none;
    transition: border-color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}

.cc-tool:hover {
    border-color: var(--cc-blue-200);
    box-shadow: var(--cc-sh-md);
    color: inherit;
    transform: translateY(-1px);
}

.cc-tool__icon {
    align-items: center;
    background: var(--cc-blue-50);
    border-radius: var(--cc-r-sm);
    color: var(--cc-blue-600);
    display: flex;
    flex: 0 0 36px;
    height: 36px;
    justify-content: center;
    width: 36px;
}

.cc-tool__text { min-width: 0; }

.cc-tool__name {
    color: var(--cc-n-900);
    font-size: 0.88rem;
    font-weight: 650;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cc-tool__meta {
    color: var(--cc-n-500);
    font-size: 0.76rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ------------------------------------------------------- Bot flow wire map */

.cc-bot-map {
    background:
        radial-gradient(circle, var(--cc-n-200) 1px, transparent 1px) 0 0 / 18px 18px,
        var(--cc-n-25);
    border: 1px solid var(--cc-n-200);
    border-radius: var(--cc-r-md);
    margin-bottom: var(--cc-s5);
    overflow: hidden;
}

.cc-bot-map__canvas {
    overflow-x: auto;
    padding: var(--cc-s3);
    scrollbar-width: thin;
}

/* Nodes are links; kill the underline/blue that inherits from anchor styles. */
.cc-bot-map a,
.cc-bot-map a:hover {
    text-decoration: none !important;
}

/* Draggable step boxes */
.cc-bot-node {
    cursor: grab;
    -webkit-user-select: none;
    user-select: none;
}

.cc-bot-node:hover rect:first-of-type { filter: brightness(0.985); }

.cc-bot-node.is-dragging {
    cursor: grabbing;
    opacity: 0.9;
}

.cc-bot-node.is-dragging rect:first-of-type {
    stroke-width: 3;
}

/* Flash the matching editor card when a node is clicked */
.cc-bot-step-flash {
    box-shadow: 0 0 0 3px var(--cc-blue-200) !important;
    transition: box-shadow 0.2s ease;
}

.cc-bot-legend {
    align-items: center;
    background: var(--cc-n-0);
    border-top: 1px solid var(--cc-n-200);
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    padding: 0.55rem 0.9rem;
}

.cc-bot-legend__item {
    align-items: center;
    color: var(--cc-n-600);
    display: inline-flex;
    font-size: 0.76rem;
    font-weight: 600;
    gap: 0.35rem;
}

.cc-bot-legend__item i {
    border-radius: 3px;
    display: inline-block;
    height: 10px;
    width: 10px;
}

.cc-bot-legend__hint {
    color: var(--cc-n-400);
    font-size: 0.76rem;
    margin-left: auto;
}

/* ------------------------------------------------------------- Responsive */

@media (max-width: 991.98px) {
    .cc-app .cc-content { padding: var(--cc-s4); }
    .cc-page-head h1,
    .cc-page-head .cc-page-title { font-size: 1.35rem !important; }
    .cc-stat-grid { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }
}

@media (max-width: 575.98px) {
    .cc-app .card-body { padding: var(--cc-s4); }
    .cc-stat__value { font-size: 1.35rem; }
    .cc-page-head__actions { width: 100%; }
    .cc-page-head__actions .btn { flex: 1 1 auto; }

    /* KPI tiles: two per row and no forced height, so the dashboard doesn't
       become an endless scroll of mostly-empty boxes on a phone. */
    .cc-app .card-stats,
    .cc-app .dashboard-insight {
        min-height: 0 !important;
    }

    .cc-app .card-stats .card-body,
    .cc-app .dashboard-insight { padding: 0.85rem !important; }

    .cc-app .card-stats h3 { font-size: 1.35rem !important; }

    .cc-app .card-stats .stats-icon,
    .cc-app .dashboard-insight .insight-icon {
        height: 34px;
        width: 34px;
        font-size: 0.85rem;
    }

    /* Full-width primary actions are easier to hit than right-aligned ones. */
    .cc-app .cc-card-actions .btn { flex: 1 1 auto; justify-content: center; }
}
