/* ============================================================================
   CEREBRO — root frontend (landing "/" + dashboard "/app").
   "Editorial dark mode" design (approved blueprint). NEW stylesheet, separate
   from the admin: does NOT import/duplicate admin.css, not used by /sitemanager.
   Every color goes through the custom properties below — no hardcoded colors.
   ========================================================================== */

:root {
    /* -- blueprint palette (DARK = default; the landing is always dark) -- */
    --cb-bg: #0F1623;            /* night-blue background */
    --cb-bg-deep: #0A101B;       /* gradient backdrop */
    --cb-card: #141D2D;          /* card surface */
    --cb-card-hi: #1A2536;       /* raised surface (hover/topbar) */
    --cb-border: #22304A;
    --cb-border-strong: #35486B;
    --cb-text: #E2E8F0;          /* off-white */
    --cb-text-muted: #94A3B8;
    --cb-text-faint: #5D6B84;
    --cb-green: #22C55E;         /* revenue / hero */
    --cb-green-soft: rgba(34, 197, 94, .12);
    --cb-cyan: #38BDF8;          /* traffic */
    --cb-cyan-soft: rgba(56, 189, 248, .12);
    --cb-violet: #A78BFA;        /* accent / priority */
    --cb-violet-soft: rgba(167, 139, 250, .14);
    --cb-amber: #F59E0B;         /* AI / warnings */
    --cb-amber-soft: rgba(245, 158, 11, .12);
    --cb-red: #F87171;           /* negative deltas */
    /* -- theme-dependent surfaces (all colors go through tokens, no hardcodes) -- */
    --cb-on-accent: #0F1623;                     /* text on violet/accent fills */
    --cb-topbar-bg: rgba(15, 22, 35, .86);
    --cb-row-hover: rgba(56, 189, 248, .05);
    --cb-hero-border: rgba(34, 197, 94, .45);
    --cb-red-soft: rgba(248, 113, 113, .10);
    --cb-red-border: rgba(248, 113, 113, .30);
    /* -- typography / shapes -- */
    --cb-font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --cb-radius: 16px;
    --cb-radius-sm: 10px;
    --cb-radius-full: 999px;
    --cb-shadow: 0 10px 34px rgba(4, 9, 18, .55);
    --cb-glow-green: 0 0 0 1px rgba(34, 197, 94, .22), 0 8px 30px rgba(34, 197, 94, .10);
    color-scheme: dark; /* native controls (date inputs, scrollbars) follow the theme */
}

/* ----------------------------------------------------------------------------
   LIGHT THEME — full token override, applied via [data-theme="light"] on <html>
   (set before first paint by the no-flash script in _LayoutApp; persisted in
   localStorage "cb-theme"; default = dark). The landing never sets the
   attribute, so it always keeps the dark brand look. Semantic hues are the
   same families re-tuned for AA contrast on a light background.
   -------------------------------------------------------------------------- */
[data-theme="light"] {
    --cb-bg: #F4F6FA;
    --cb-bg-deep: #E7ECF3;
    --cb-card: #FFFFFF;
    --cb-card-hi: #F8FAFD;
    --cb-border: #DFE5EF;
    --cb-border-strong: #B9C4D8;
    --cb-text: #1A2332;
    --cb-text-muted: #46536B;
    --cb-text-faint: #66738A;
    --cb-green: #15803D;
    --cb-green-soft: rgba(21, 128, 61, .10);
    --cb-cyan: #0E7490;
    --cb-cyan-soft: rgba(14, 116, 144, .10);
    --cb-violet: #7C3AED;
    --cb-violet-soft: rgba(124, 58, 237, .10);
    --cb-amber: #B45309;
    --cb-amber-soft: rgba(180, 83, 9, .10);
    --cb-red: #DC2626;
    --cb-on-accent: #FFFFFF;
    --cb-topbar-bg: rgba(255, 255, 255, .86);
    --cb-row-hover: rgba(14, 116, 144, .06);
    --cb-hero-border: rgba(21, 128, 61, .38);
    --cb-red-soft: rgba(220, 38, 38, .07);
    --cb-red-border: rgba(220, 38, 38, .25);
    --cb-shadow: 0 8px 26px rgba(23, 35, 50, .08);
    --cb-glow-green: 0 0 0 1px rgba(21, 128, 61, .16), 0 8px 24px rgba(21, 128, 61, .07);
    color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--cb-bg);
    color: var(--cb-text);
    font: 400 15px/1.5 var(--cb-font);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--cb-cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- micro-animations (CSS only) ---------- */
@keyframes cb-fade-up {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes cb-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.cb-anim   { animation: cb-fade-up .6s cubic-bezier(.22,.7,.3,1) both; }
.cb-anim-2 { animation-delay: .12s; }
.cb-anim-3 { animation-delay: .24s; }
.cb-anim-4 { animation-delay: .36s; }
@media (prefers-reduced-motion: reduce) {
    .cb-anim, .cb-anim-2, .cb-anim-3, .cb-anim-4 { animation: none; }
}

/* ============================================================================
   LANDING "/"
   ========================================================================== */
.cb-landing {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(900px 520px at 50% -10%, rgba(56, 189, 248, .16), transparent 62%),
        radial-gradient(760px 480px at 84% 78%, rgba(167, 139, 250, .13), transparent 60%),
        radial-gradient(680px 420px at 10% 86%, rgba(34, 197, 94, .10), transparent 58%),
        linear-gradient(180deg, var(--cb-bg) 0%, var(--cb-bg-deep) 100%);
}
/* very light editorial grid on the backdrop */
.cb-landing::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(226, 232, 240, .028) 1px, transparent 1px),
        linear-gradient(90deg, rgba(226, 232, 240, .028) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(ellipse 88% 68% at 50% 42%, #000 35%, transparent 78%);
    -webkit-mask-image: radial-gradient(ellipse 88% 68% at 50% 42%, #000 35%, transparent 78%);
    pointer-events: none;
}
.cb-hero { position: relative; text-align: center; max-width: 640px; }
.cb-mark {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    justify-content: center;
}
.cb-mark-badge {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--cb-green);
    background: linear-gradient(160deg, var(--cb-card-hi), var(--cb-card));
    border: 1px solid var(--cb-border-strong);
    box-shadow: var(--cb-glow-green);
}
.cb-wordmark {
    margin: 0;
    font-size: 56px;
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.05;
    background: linear-gradient(92deg, var(--cb-text) 30%, var(--cb-cyan) 72%, var(--cb-violet) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--cb-text); /* fallback */
}
.cb-tagline {
    margin: 14px 0 0;
    font-size: 19px;
    color: var(--cb-text-muted);
    letter-spacing: .01em;
}
.cb-tagline b { color: var(--cb-green); font-weight: 600; }
.cb-cta { margin-top: 44px; display: flex; flex-direction: column; align-items: center; gap: 16px; }

/* "Sign in with Google" button (official-badge-like, inline G SVG) */
.cb-google-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 13px 26px 13px 16px;
    border-radius: var(--cb-radius-full);
    background: #FFFFFF;
    color: #1F2937;
    font: 600 16px/1 var(--cb-font);
    letter-spacing: .01em;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 34px rgba(56, 189, 248, .16);
    border: 1px solid rgba(255, 255, 255, .9);
    transition: transform .18s ease, box-shadow .18s ease;
}
.cb-google-btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, .35), 0 16px 44px rgba(56, 189, 248, .26);
}
.cb-google-btn svg { flex: 0 0 auto; }
.cb-cta-hint { font-size: 13px; color: var(--cb-text-faint); }
.cb-cta-hint a { color: var(--cb-violet); }
.cb-sso-note {
    margin-top: 6px;
    font-size: 13px;
    color: var(--cb-red);
    background: rgba(248, 113, 113, .10);
    border: 1px solid rgba(248, 113, 113, .28);
    border-radius: var(--cb-radius-sm);
    padding: 8px 14px;
}
.cb-landing-foot {
    position: relative;
    margin-top: 72px;
    font-size: 12.5px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--cb-text-faint);
}

/* ============================================================================
   APP SHELL "/app" (dedicated layout, no admin)
   ========================================================================== */
.cb-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 26px;
    background: var(--cb-topbar-bg);
    backdrop-filter: blur(9px);
    border-bottom: 1px solid var(--cb-border);
}
.cb-topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 18px;
    letter-spacing: -.02em;
    color: var(--cb-text);
}
.cb-topbar-brand:hover { text-decoration: none; }
.cb-topbar-brand .dot { color: var(--cb-green); }
.cb-topbar-ctx {
    flex: 1 1 auto;
    text-align: center;
    font-size: 13.5px;
    color: var(--cb-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cb-topbar-ctx b { color: var(--cb-text); font-weight: 600; }
.cb-topbar-user { font-size: 13px; color: var(--cb-text-faint); }
@media (max-width: 940px) { .cb-topbar-ctx, .cb-topbar-user { display: none; } }

/* ---------- section nav (Dashboard | Code performance | Tools) ---------- */
.cb-nav { display: inline-flex; align-items: center; gap: 4px; margin-left: 4px; }
.cb-nav a,
.cb-nav .is-soon {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    border-radius: var(--cb-radius-full);
    font: 600 13.5px/1.1 var(--cb-font);
    color: var(--cb-text-muted);
    transition: background .15s ease, color .15s ease;
}
.cb-nav a:hover { color: var(--cb-text); background: var(--cb-violet-soft); text-decoration: none; }
.cb-nav a.is-active { color: var(--cb-text); background: var(--cb-card-hi); box-shadow: inset 0 0 0 1px var(--cb-border-strong); }
.cb-nav .is-soon { color: var(--cb-text-faint); cursor: default; }
.cb-chip {
    font: 700 9.5px/1 var(--cb-font);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--cb-violet);
    background: var(--cb-violet-soft);
    border-radius: var(--cb-radius-full);
    padding: 3px 8px;
}

/* ---------- theme toggle (sun/moon, icon follows the current theme) ---------- */
.cb-theme-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--cb-border-strong);
    color: var(--cb-text-muted);
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.cb-theme-btn:hover { color: var(--cb-text); background: var(--cb-card-hi); border-color: var(--cb-violet); }
.cb-theme-btn .ic-moon { display: none; }
[data-theme="light"] .cb-theme-btn .ic-sun { display: none; }
[data-theme="light"] .cb-theme-btn .ic-moon { display: block; }
.cb-signout {
    font-size: 13px;
    font-weight: 600;
    color: var(--cb-text-muted);
    border: 1px solid var(--cb-border-strong);
    border-radius: var(--cb-radius-full);
    padding: 7px 16px;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.cb-signout:hover { text-decoration: none; color: var(--cb-text); background: var(--cb-card-hi); border-color: var(--cb-violet); }

.cb-shell {
    max-width: 1220px;
    margin: 0 auto;
    padding: 30px 26px 60px;
}
.cb-page-head { margin: 0 0 20px; }
.cb-page-head h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.cb-page-head p { margin: 5px 0 0; color: var(--cb-text-faint); font-size: 13.5px; }

/* ---------- pill filters ---------- */
.cb-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 20px; }
.cb-seg {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: var(--cb-card);
    border: 1px solid var(--cb-border);
    border-radius: var(--cb-radius-full);
    padding: 4px;
}
.cb-seg .lbl {
    font-size: 11px;
    color: var(--cb-text-faint);
    text-transform: uppercase;
    letter-spacing: .09em;
    padding: 0 9px 0 13px;
}
.cb-seg a,
.cb-seg summary {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: var(--cb-radius-full);
    font: 600 13.5px/1.1 var(--cb-font);
    color: var(--cb-text-muted);
    transition: background .15s ease, color .15s ease;
}
.cb-seg a:hover, .cb-seg summary:hover { color: var(--cb-text); background: var(--cb-violet-soft); text-decoration: none; }
.cb-seg a.is-active, .cb-seg summary.is-active { color: var(--cb-on-accent); background: var(--cb-violet); }
.cb-periodnote { font-size: 13px; color: var(--cb-text-muted); }
.cb-periodnote b { color: var(--cb-text); font-variant-numeric: tabular-nums; }

/* ---------- custom date-range popover (details/summary = works without JS too) ---------- */
.cb-custom { position: relative; display: inline-flex; }
.cb-custom > summary { list-style: none; cursor: pointer; user-select: none; }
.cb-custom > summary::-webkit-details-marker { display: none; }
.cb-custom[open] > summary:not(.is-active) { color: var(--cb-text); background: var(--cb-violet-soft); }
.cb-pop {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 30;
    min-width: 300px;
    background: var(--cb-card);
    border: 1px solid var(--cb-border-strong);
    border-radius: var(--cb-radius-sm);
    box-shadow: var(--cb-shadow);
    padding: 14px 16px;
}
.cb-pop-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--cb-text-faint);
    margin-bottom: 10px;
}
.cb-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.cb-presets a {
    font: 600 12.5px/1 var(--cb-font);
    color: var(--cb-text-muted);
    background: var(--cb-bg);
    border: 1px solid var(--cb-border);
    border-radius: var(--cb-radius-full);
    padding: 7px 12px;
}
.cb-presets a:hover { color: var(--cb-text); border-color: var(--cb-violet); text-decoration: none; }
.cb-pop-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.cb-pop-form label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--cb-text-faint);
}
.cb-pop-form input[type="date"] {
    background: var(--cb-bg);
    color: var(--cb-text);
    border: 1px solid var(--cb-border-strong);
    border-radius: 8px;
    padding: 7px 9px;
    font: 500 13px var(--cb-font);
}
.cb-apply {
    background: var(--cb-violet);
    color: var(--cb-on-accent);
    border: 0;
    border-radius: var(--cb-radius-full);
    padding: 9px 18px;
    font: 700 13px var(--cb-font);
    cursor: pointer;
}
.cb-apply:hover { filter: brightness(1.08); }
.cb-pop-hint { margin-top: 10px; font-size: 11.5px; color: var(--cb-text-faint); }

/* ---------- card ---------- */
.cb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cb-card {
    background: linear-gradient(175deg, var(--cb-card-hi) 0%, var(--cb-card) 26%);
    border: 1px solid var(--cb-border);
    border-radius: var(--cb-radius);
    box-shadow: var(--cb-shadow);
    padding: 20px 22px;
    min-width: 0;
}
.cb-card h3 {
    margin: 0 0 14px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--cb-text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.cb-span2 { grid-column: span 2; }
@media (max-width: 940px) { .cb-grid { grid-template-columns: 1fr; } .cb-span2 { grid-column: span 1; } }

/* ---------- KPI ---------- */
.cb-kpis { display: grid; grid-template-columns: minmax(320px, 1.5fr) 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 940px) { .cb-kpis { grid-template-columns: 1fr; } }
.cb-kpi .num {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1.08;
    color: var(--cb-text);
}
.cb-kpi.hero { border-color: var(--cb-hero-border); box-shadow: var(--cb-shadow), var(--cb-glow-green); }
.cb-kpi.hero .num { font-size: 46px; color: var(--cb-green); }
.cb-kpi.hero h3 { color: var(--cb-green); }
.cb-delta { margin-top: 8px; font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cb-delta .vs { font-weight: 400; color: var(--cb-text-faint); }
.cb-up { color: var(--cb-green); }
.cb-down { color: var(--cb-red); }
.cb-flat { color: var(--cb-text-faint); }

/* ---------- countries table ---------- */
.cb-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.cb-table th, .cb-table td {
    text-align: left;
    padding: 9px 8px;
    border-bottom: 1px solid var(--cb-border);
    font-variant-numeric: tabular-nums;
}
.cb-table th {
    color: var(--cb-text-faint);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10.5px;
    letter-spacing: .06em;
}
.cb-table tbody tr { transition: background .12s ease; }
.cb-table tbody tr:hover td { background: var(--cb-row-hover); }
.cb-table tr.is-active td { background: var(--cb-violet-soft); }
.cb-table tr.cb-dim td { color: var(--cb-text-faint); border-top: 2px solid var(--cb-border-strong); }
.cb-table tr.cb-dim .cb-track i { background: var(--cb-border-strong); }
.cb-table th.r, .cb-table td.r { text-align: right; }
.cb-cc {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    color: var(--cb-cyan);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.cb-commcell { min-width: 190px; }
.cb-commcell .val { font-weight: 700; color: var(--cb-text); }
.cb-track { height: 6px; border-radius: 4px; background: var(--cb-bg-deep); overflow: hidden; margin-top: 6px; }
.cb-track i {
    display: block;
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--cb-green), var(--cb-cyan));
}

/* ---------- trend chart (server-side SVG + vanilla-JS hover layer) ---------- */
.cb-chart { display: flex; gap: 10px; height: 200px; }
.cb-chart .yax {
    position: relative;
    width: 56px;
    flex: 0 0 auto;
    font-size: 10.5px;
    color: var(--cb-text-faint);
    font-variant-numeric: tabular-nums;
}
.cb-chart .yax span { position: absolute; right: 0; transform: translateY(-50%); }
.cb-plotwrap { position: relative; flex: 1 1 auto; min-width: 0; cursor: crosshair; }
.cb-plotwrap .plot { height: 100%; border-left: 1px solid var(--cb-border); }
.cb-plotwrap .plot svg { width: 100%; height: 100%; display: block; }
/* x axis: tick labels absolutely positioned under the plot (sensible date intervals) */
.cb-xaxw {
    position: relative;
    height: 16px;
    margin: 6px 0 0 66px;
    font-size: 10.5px;
    color: var(--cb-text-faint);
    font-variant-numeric: tabular-nums;
}
.cb-xaxw span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.cb-xaxw span.t0 { transform: none; }
.cb-xaxw span.t100 { transform: translateX(-100%); }
@media (max-width: 700px) { .cb-xaxw span:nth-child(even) { display: none; } }
/* grid + series */
.cb-gl { stroke: var(--cb-border); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; opacity: .6; }
.cb-glb { stroke: var(--cb-border-strong); stroke-width: 1; vector-effect: non-scaling-stroke; opacity: .8; }
.cb-glv { stroke: var(--cb-border); stroke-width: 1; stroke-dasharray: 2 4; vector-effect: non-scaling-stroke; opacity: .5; }
.cb-line { fill: none; stroke: var(--cb-green); stroke-width: 2; vector-effect: non-scaling-stroke; }
.cb-area { fill: var(--cb-green); fill-opacity: .10; stroke: none; }
.cb-dots { fill: none; stroke: var(--cb-green); stroke-linecap: round; vector-effect: non-scaling-stroke; }
.cb-vbar { fill: var(--cb-green); fill-opacity: .7; }
.cb-vbar.is-hot, .cb-vbar:hover { fill-opacity: 1; }
/* no-JS fallback: invisible hit columns with native <title>; disabled once JS boots */
.cb-hit { fill: transparent; }
.cb-hit:hover { fill: var(--cb-cyan); fill-opacity: .10; }
.is-js .cb-hit { pointer-events: none; }
/* hover layer (JS): vertical crosshair + point dot + styled HTML tooltip */
.cb-cross {
    position: absolute;
    top: 5%;
    height: 90%;
    width: 0;
    border-left: 1px dashed var(--cb-border-strong);
    display: none;
    pointer-events: none;
}
.cb-hoverdot {
    position: absolute;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--cb-card);
    border: 2.5px solid var(--cb-green);
    box-shadow: 0 0 0 4px var(--cb-green-soft);
    transform: translate(-50%, -50%);
    display: none;
    pointer-events: none;
}
.cb-tip {
    position: absolute;
    display: none;
    pointer-events: none;
    z-index: 5;
    min-width: 170px;
    background: var(--cb-card-hi);
    border: 1px solid var(--cb-border-strong);
    border-radius: var(--cb-radius-sm);
    box-shadow: var(--cb-shadow);
    padding: 10px 13px;
    font-size: 12.5px;
    white-space: nowrap;
    transform: translate(14px, -115%);
}
.cb-tip.flip-x { transform: translate(calc(-100% - 14px), -115%); }
.cb-tip.flip-y { transform: translate(14px, 18%); }
.cb-tip.flip-x.flip-y { transform: translate(calc(-100% - 14px), 18%); }
.cb-tip .t { font-weight: 700; color: var(--cb-text); margin-bottom: 2px; }
.cb-tip .v { font-size: 16px; font-weight: 800; color: var(--cb-green); font-variant-numeric: tabular-nums; }
.cb-tip .p { margin-top: 4px; color: var(--cb-text-muted); font-size: 11.5px; }

/* ---------- channels ---------- */
.cb-chrow {
    display: grid;
    grid-template-columns: 200px 1fr 230px;
    gap: 14px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed var(--cb-border);
}
.cb-chrow:last-child { border-bottom: 0; }
@media (max-width: 700px) { .cb-chrow { grid-template-columns: 130px 1fr; } .cb-chval { display: none; } }
.cb-chname { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 600; color: var(--cb-text); }
.cb-chdot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex: 0 0 auto; }
.cb-chtrack { height: 13px; border-radius: 7px; background: var(--cb-bg-deep); overflow: hidden; }
.cb-chtrack i { display: block; height: 100%; border-radius: 7px; opacity: .92; }
.cb-chval { font-size: 13px; color: var(--cb-text-muted); text-align: right; font-variant-numeric: tabular-nums; }
.cb-chval b { color: var(--cb-text); }

/* ---------- states / footer ---------- */
.cb-err {
    padding: 13px 16px;
    background: var(--cb-red-soft);
    border: 1px solid var(--cb-red-border);
    color: var(--cb-red);
    border-radius: var(--cb-radius-sm);
    font-size: 13.5px;
    margin-bottom: 16px;
}
.cb-empty { padding: 28px; text-align: center; color: var(--cb-text-muted); font-size: 13.5px; }
.cb-foot {
    margin-top: 18px;
    font-size: 12px;
    color: var(--cb-text-faint);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.cb-foot b { color: var(--cb-text-muted); }
.cb-clampnote { color: var(--cb-amber); font-weight: 600; }

/* ---------- channel recovery card ---------- */
.cb-rec-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.cb-rec-num {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--cb-violet);
    font-variant-numeric: tabular-nums;
    line-height: 1.08;
}
.cb-rec-txt { color: var(--cb-text-muted); font-size: 14px; }
.cb-rec-txt b { color: var(--cb-text); font-variant-numeric: tabular-nums; }
.cb-rec-sub { margin: 4px 0 14px; color: var(--cb-text-faint); font-size: 12.5px; }
.cb-rec-seo {
    margin-top: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--cb-green-soft);
    border-radius: var(--cb-radius-sm);
    font-size: 13.5px;
    color: var(--cb-text-muted);
}
.cb-rec-seo b { color: var(--cb-text); font-variant-numeric: tabular-nums; }
.cb-rec-seo b.after { color: var(--cb-green); }
.cb-rec-seo .arr { color: var(--cb-text-faint); }
.cb-rec-ccs { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.cb-rec-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font: 600 12.5px/1 var(--cb-font);
    color: var(--cb-text-muted);
    background: var(--cb-bg);
    border: 1px solid var(--cb-border);
    border-radius: var(--cb-radius-full);
    padding: 6px 12px;
    font-variant-numeric: tabular-nums;
}
a.cb-rec-chip:hover { color: var(--cb-text); border-color: var(--cb-violet); text-decoration: none; }
.cb-rec-chip b { color: var(--cb-cyan); text-transform: uppercase; letter-spacing: .04em; }

/* ============================================================================
   CODE PERFORMANCE "/app/codes" — per-code drill-down (same token system;
   every color still goes through the --cb-* custom properties -> light theme ok)
   ========================================================================== */

/* 4 compact KPIs (modifier on .cb-kpis) */
.cb-kpis4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 940px) { .cb-kpis4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .cb-kpis4 { grid-template-columns: 1fr; } }

/* data-reality note (month-grain clicks) */
.cb-note {
    margin: 0 0 16px;
    padding: 11px 15px;
    background: var(--cb-amber-soft);
    border-left: 3px solid var(--cb-amber);
    border-radius: var(--cb-radius-sm);
    color: var(--cb-text-muted);
    font-size: 13px;
}
.cb-note b { color: var(--cb-text); }
.cb-note a { color: var(--cb-amber); font-weight: 700; }

/* search pill (pure GET form) */
.cb-search { display: inline-flex; align-items: center; gap: 8px; }
.cb-search input[type="search"] {
    background: var(--cb-card);
    border: 1px solid var(--cb-border-strong);
    color: var(--cb-text);
    border-radius: var(--cb-radius-full);
    padding: 8px 16px;
    font: 500 13.5px var(--cb-font);
    min-width: 210px;
}
.cb-search input[type="search"]::placeholder { color: var(--cb-text-faint); }
.cb-search input[type="search"]:focus { outline: none; border-color: var(--cb-violet); }
.cb-clearq { font-size: 12.5px; color: var(--cb-text-faint); }
.cb-clearq:hover { color: var(--cb-text); }

/* top-codes table (9 columns -> horizontal scroll inside the card, never the page) */
.cb-tablewrap { overflow-x: auto; }
.cb-codetable { min-width: 960px; }
.cb-codetable td { vertical-align: middle; }
.cb-storecell { white-space: nowrap; }
.cb-storecell b { color: var(--cb-text); font-weight: 600; }
.cb-ccmini {
    color: var(--cb-cyan);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: .06em;
    margin-right: 8px;
}
.cb-tier {
    font: 700 9.5px/1 var(--cb-font);
    letter-spacing: .05em;
    color: var(--cb-text-muted);
    border: 1px solid var(--cb-border-strong);
    border-radius: var(--cb-radius-full);
    padding: 2px 6px;
    margin-left: 7px;
}
.cb-code {
    font: 600 12px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    color: var(--cb-text);
    background: var(--cb-bg-deep);
    border: 1px solid var(--cb-border);
    border-radius: 6px;
    padding: 3px 8px;
    letter-spacing: .02em;
    white-space: nowrap;
}
.cb-deal { font-size: 12px; color: var(--cb-text-faint); font-style: italic; }
.cb-titlecell {
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--cb-text-muted);
}
.cb-typecell { color: var(--cb-text-faint); white-space: nowrap; }
.cb-status {
    display: inline-block;
    font: 700 10px/1 var(--cb-font);
    text-transform: uppercase;
    letter-spacing: .07em;
    border-radius: var(--cb-radius-full);
    padding: 4px 9px;
    white-space: nowrap;
}
/* 4-state status chips (active / expiring soon / expired / unknown end date) */
.cb-status.active { color: var(--cb-green); background: var(--cb-green-soft); }
.cb-status.expiring { color: var(--cb-amber); background: var(--cb-amber-soft); }
.cb-status.expired { color: var(--cb-red); background: var(--cb-red-soft); }
.cb-status.na { color: var(--cb-text-faint); border: 1px solid var(--cb-border); }
/* sortable metric headers: link + arrow on the active one; in-cell bar on the sorted column */
.cb-thsort a { color: var(--cb-text-faint); }
.cb-thsort a:hover { color: var(--cb-text); text-decoration: none; }
.cb-thsort.is-sorted a { color: var(--cb-violet); }
.cb-metriccell { min-width: 110px; }
.cb-metriccell .cb-track { margin-top: 5px; }

/* ============================================================================
   MARKET SPOKE "/app/market/{cc}" — per-market zoom of the hub (same tokens;
   every color goes through the --cb-* custom properties -> light theme ok)
   ========================================================================== */

/* back link above the page title */
.cb-back {
    display: inline-block;
    margin-bottom: 6px;
    font: 600 12.5px/1 var(--cb-font);
    color: var(--cb-text-faint);
    letter-spacing: .02em;
}
.cb-back:hover { color: var(--cb-cyan); text-decoration: none; }

/* top-brands table details */
.cb-rankcell { width: 30px; color: var(--cb-text-faint); font-size: 11.5px; }
.cb-brandcell { font-weight: 600; color: var(--cb-text); max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* market top-codes table: fewer columns than the full drill-down */
.cb-codetable-sm { min-width: 820px; }

/* "View all" link under a card table */
.cb-viewall { margin-top: 12px; text-align: right; }
.cb-viewall a { font: 600 12.5px/1 var(--cb-font); color: var(--cb-violet); }
.cb-viewall a:hover { color: var(--cb-text); text-decoration: none; }

/* ============================================================================
   FETTA 0 (2026-07-03): global channel filter, YoY ghost overlay, code status
   facets, unattributed toggle, honesty badges. All colors via --cb-* tokens.
   ========================================================================== */

/* hero KPI pill: share of the filtered channel on the period total */
.cb-chshare {
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--cb-text-muted);
    background: var(--cb-violet-soft);
    border-radius: var(--cb-radius-full);
    padding: 5px 12px;
    font-variant-numeric: tabular-nums;
}
.cb-chshare b { color: var(--cb-violet); }

/* channels card with the global filter on: highlight the selected row, dim the rest */
.cb-chrow.is-selected {
    background: var(--cb-violet-soft);
    border-radius: var(--cb-radius-sm);
    padding-left: 8px;
    padding-right: 8px;
    border-bottom-color: transparent;
}
.cb-chrow.is-dimmed { opacity: .45; }
.cb-chsel { color: var(--cb-violet); }
.cb-chna { color: var(--cb-amber); font-weight: 700; }

/* YoY ghost overlay (dashed previous-year line on monthly bars) + toggle + legend */
.cb-ghost {
    fill: none;
    stroke: var(--cb-cyan);
    stroke-width: 1.6;
    stroke-dasharray: 5 4;
    vector-effect: non-scaling-stroke;
    opacity: .75;
    pointer-events: none;
}
.cb-ghostbtn {
    font: 700 10px/1 var(--cb-font);
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--cb-text-faint);
    background: transparent;
    border: 1px solid var(--cb-border-strong);
    border-radius: var(--cb-radius-full);
    padding: 4px 10px;
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.cb-ghostbtn.is-on { color: var(--cb-cyan); border-color: var(--cb-cyan); background: var(--cb-cyan-soft); }
.cb-ghostbtn:hover { color: var(--cb-text); }
.cb-ghostlegend {
    margin-top: 8px;
    font-size: 11.5px;
    color: var(--cb-text-faint);
    display: flex;
    align-items: center;
    gap: 8px;
}
.cb-ghostline {
    display: inline-block;
    width: 26px;
    height: 0;
    border-top: 2px dashed var(--cb-cyan);
    opacity: .75;
}

/* partial current-month badge on the last monthly bar */
.cb-partial {
    position: absolute;
    top: 2px;
    transform: translateX(-100%);
    font: 700 9.5px/1 var(--cb-font);
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--cb-amber);
    background: var(--cb-amber-soft);
    border: 1px solid var(--cb-amber);
    border-radius: var(--cb-radius-full);
    padding: 3px 8px;
    white-space: nowrap;
    pointer-events: none;
}
.cb-vbar.is-partial { fill-opacity: .35; stroke: var(--cb-amber); stroke-width: 1; stroke-dasharray: 3 2; vector-effect: non-scaling-stroke; }

/* honesty notes */
.cb-fxnote { color: var(--cb-amber); font-weight: 600; }
.cb-facetnote {
    margin: -6px 0 12px;
    font-size: 12px;
    color: var(--cb-text-faint);
}
.cb-facetnote b { color: var(--cb-text-muted); }
.cb-seghint {
    font-size: 10.5px;
    color: var(--cb-text-faint);
    padding: 0 10px 0 4px;
    letter-spacing: .03em;
}

/* wasted clicks radar */
.cb-radar { border-left: 3px solid var(--cb-amber); }
.cb-radar h3 { color: var(--cb-amber); }

/* "expired & still clicked" radar variant (red accent, same layout) */
.cb-radar-exp { border-left-color: var(--cb-red); }
.cb-radar-exp h3 { color: var(--cb-red); }
.cb-radar-exp .cb-radar-track i { background: linear-gradient(90deg, var(--cb-red), var(--cb-amber)); }
.cb-radar-exp .cb-radar-val b { color: var(--cb-red); }
.cb-radar-exp .cb-radar-name .cb-status { margin-left: 4px; }
.cb-radar-sub { color: var(--cb-text-faint); font-size: 12.5px; margin: -4px 0 12px; }
.cb-radar-sub b { color: var(--cb-text-muted); }
.cb-radar-row {
    display: grid;
    grid-template-columns: 24px minmax(230px, 1.3fr) 1fr 150px;
    gap: 14px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed var(--cb-border);
}
.cb-radar-row:last-child { border-bottom: 0; }
.cb-radar-rank { color: var(--cb-text-faint); font-size: 11.5px; font-variant-numeric: tabular-nums; text-align: right; }
.cb-radar-info { min-width: 0; }
.cb-radar-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cb-radar-name b { color: var(--cb-text); font-weight: 600; white-space: nowrap; }
.cb-radar-title {
    margin-top: 2px;
    font-size: 11.5px;
    color: var(--cb-text-faint);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cb-radar-track { height: 10px; border-radius: 5px; background: var(--cb-bg-deep); overflow: hidden; }
.cb-radar-track i {
    display: block;
    height: 100%;
    border-radius: 5px;
    background: linear-gradient(90deg, var(--cb-amber), var(--cb-red));
    opacity: .92;
}
.cb-radar-val { text-align: right; font-size: 12.5px; color: var(--cb-text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cb-radar-val b { color: var(--cb-amber); font-size: 15px; }
@media (max-width: 700px) {
    .cb-radar-row { grid-template-columns: 20px 1fr 110px; }
    .cb-radar-track { display: none; }
}
