/* ════════════════════════════════════════════════════════════
   Sales Monthly Report — ALPHA design system
   Parchment (light) primary · Espresso (dark) toggle
   Unified with the Stock Aging dashboard
   ════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing:border-box; margin:0; padding:0; }
a, button { cursor:pointer; }
button:focus-visible,
select:focus-visible,
input:focus-visible,
[role="button"]:focus-visible {
  outline:3px solid rgba(20,184,166,.35);
  outline-offset:2px;
}

/* ─── Theme tokens ─── */
:root, [data-theme="light"] {
  --bg-0:#eceae5; --bg-1:#f7f6f3; --surface:#ffffff; --surface-hi:#fafaf9;
  --surface-2:#f3f4f6;
  --line:#e5e7eb; --line-hi:#d1d5db;
  --text:#111827; --text-mute:#6b7280; --text-dim:#9ca3af;
  --gold:#0d9488; --gold-soft:#14b8a6; --gold-ink:#ffffff;
  --insight-detail:#0f766e;
  --gold-wash:rgba(13,148,136,.10);
  --green:#16a34a; --green-bg:#dcfce7;
  --red:#dc2626; --red-bg:#fee2e2;
  --amber:#f59e0b; --amber-bg:#fef3c7;
  --grid:rgba(17,24,39,.06);
  --zebra:rgba(17,24,39,.018);
  --shadow:0 1px 2px rgba(17,24,39,.04), 0 1px 3px rgba(17,24,39,.06);
  --noise:0;
}
[data-theme="dark"] {
  --bg-0:#0b1120; --bg-1:#0f172a; --surface:#1e293b; --surface-hi:#243044;
  --surface-2:#334155;
  --line:rgba(255,255,255,.08); --line-hi:rgba(255,255,255,.16);
  --text:#f1f5f9; --text-mute:#94a3b8; --text-dim:#64748b;
  --gold:#2dd4bf; --gold-soft:#5eead4; --gold-ink:#04201c;
  --insight-detail:#5eead4;
  --gold-wash:rgba(45,212,191,.12);
  --green:#4ade80; --green-bg:rgba(74,222,128,.15);
  --red:#f87171; --red-bg:rgba(248,113,113,.15);
  --amber:#fbbf24; --amber-bg:rgba(251,191,36,.15);
  --grid:rgba(255,255,255,.06);
  --zebra:rgba(255,255,255,.018);
  --shadow:0 1px 2px rgba(0,0,0,.4), 0 10px 24px -16px rgba(0,0,0,.7);
  --noise:0;
}

/* fixed espresso "ink" tokens — sidebar + table headers in both themes */
:root {
  --ink-0:#111827; --ink-1:#1f2937; --ink-2:#374151; --ink-3:#4b5563;
  --ink-line:rgba(255,255,255,.07); --ink-line-hi:rgba(255,255,255,.14);
  --ink-text:#f9fafb; --ink-mute:#9ca3af; --ink-dim:#6b7280;
  --ink-gold:#2dd4bf; --ink-gold-soft:#5eead4;
}

html { background:var(--bg-0); }
body {
  font-family:'Inter', system-ui, -apple-system, sans-serif;
  background:var(--bg-1);
  color:var(--text);
  font-size:13.5px; line-height:1.5;
  -webkit-font-smoothing:antialiased;
  position:relative;
}
[data-theme="dark"] body {
  background:radial-gradient(ellipse at 50% -8%, #16213a 0%, #0f172a 48%, #0b1120 100%);
}
body::after {
  content:""; position:fixed; inset:0; pointer-events:none; z-index:9999;
  opacity:var(--noise); mix-blend-mode:overlay;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/></svg>");
}
.mono { font-family:'JetBrains Mono', ui-monospace, monospace; }

/* ════════ Sidebar (Overview-page look, applied to every page) ════════ */
.sb {
  width:228px; min-height:100vh; position:fixed; left:0; top:0; overflow-y:auto; z-index:100;
  display:flex; flex-direction:column;
  background:linear-gradient(180deg,#0e171e 0%,#13222d 100%);
  border-right:1px solid rgba(255,255,255,.08);
  transition:width .22s ease, opacity .18s ease;
}
.sb.collapsed { width:0; opacity:0; pointer-events:none; overflow:hidden; }
.sb-logo {
  display:block;
  padding:22px 18px 18px;
  border-bottom:1px solid var(--ink-line);
  background:transparent;
}
.sb-brand-row {
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
  margin-bottom:12px;
}
.sb-mark { width:36px; height:auto; flex:0 0 auto; }
.sb-title {
  color:var(--ink-text);
  font-family:'Plus Jakarta Sans',Inter,sans-serif;
  font-size:15px;
  font-weight:700;
  line-height:1.2;
  letter-spacing:-.015em;
  white-space:nowrap;
}
.sb-report {
  color:#14b8a6;
  font-family:'IBM Plex Sans',Inter,sans-serif;
  font-size:9.5px;
  font-weight:700;
  line-height:1.2;
  letter-spacing:.1em;
  text-transform:uppercase;
  margin-top:4px;
  white-space:nowrap;
}
.sb-sub {
  margin-top:0; color:rgba(255,255,255,.45); font-family:'IBM Plex Sans',Inter,sans-serif;
  font-size:10px; line-height:1.45; letter-spacing:0;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  text-transform:none;
}
.sb-sub + .sb-sub { margin-top:2px; }
.sb-grp {
  padding:16px 20px 6px; font-family:'IBM Plex Sans',Inter,sans-serif;
  font-size:9px; font-weight:600; color:rgba(255,255,255,.32);
  text-transform:uppercase; letter-spacing:.12em;
}
.nav {
  display:flex; align-items:center; gap:10px; padding:9px 20px;
  color:rgba(255,255,255,.6); transition:all .15s;
  border-left:3px solid transparent; font-size:13px; font-family:'IBM Plex Sans',Inter,sans-serif; user-select:none;
}
.nav svg {
  width:16px; height:16px; flex:0 0 auto; fill:none; stroke:currentColor;
  stroke-width:2; stroke-linecap:round; stroke-linejoin:round;
}
.nav:hover { background:rgba(239,230,216,.05); color:var(--ink-text); }
.nav.on {
  background:rgba(0,168,132,.14); color:#fff;
  border-left-color:#00a884; font-weight:600;
}
.bottom-nav { display:none; }
.bottom-nav-item { border:0; background:transparent; font-family:'Inter',sans-serif; }
.sb-foot {
  padding:14px 20px; border-top:1px solid var(--ink-line); margin-top:auto;
  color:var(--ink-dim); font-family:'IBM Plex Sans',Inter,sans-serif;
  font-size:9.5px; letter-spacing:.05em; text-transform:uppercase;
}

/* ════════ Main ════════ */
.main { margin-left:228px; min-height:100vh; transition:margin-left .22s ease; }
.main.sb-collapsed { margin-left:0; }
.topbar {
  background:var(--surface); border-bottom:1px solid var(--line);
  padding:13px 28px; display:flex; justify-content:space-between; align-items:center;
  position:sticky; top:0; z-index:50; box-shadow:0 1px 0 var(--line);
}
.tb-title {
  font-family:'Fraunces', Georgia, serif; font-size:20px; font-weight:500;
  color:var(--text); letter-spacing:-.01em;
}
.tb-left { display:flex; align-items:center; gap:14px; }
.tb-right { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.tb-right label { font-size:11px; color:var(--text-mute); display:flex; align-items:center; gap:5px; }
.sb-toggle-btn {
  display:flex; align-items:center; justify-content:center; width:32px; height:32px;
  border-radius:7px; border:1px solid var(--line-hi); background:var(--surface-hi);
  color:var(--text-mute); font-size:14px; cursor:pointer; transition:all .12s; flex-shrink:0;
}
.sb-toggle-btn:hover { color:var(--gold); border-color:var(--gold-soft); background:var(--gold-wash); }
.pad { width:100%; max-width:1640px; margin:0 auto; padding:24px 28px 44px; }

/* ════════ Filters ════════ */
select.fs {
  font-family:'Inter', sans-serif; padding:6px 22px 6px 10px; border:1px solid var(--line-hi);
  border-radius:7px; font-size:11px; font-weight:600; color:var(--text-mute); background:var(--surface-hi);
  appearance:none; -webkit-appearance:none; -moz-appearance:none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-mute) 50%),
    linear-gradient(135deg, var(--text-mute) 50%, transparent 50%);
  background-position: right 14px top 55%, right 9px top 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
select.fs:focus { outline:none; border-color:var(--gold); }
select.ssd-native { display:none; }
.fbar {
  display:flex; gap:10px; flex-wrap:wrap; align-items:center;
  background:var(--surface); border:1px solid var(--line); border-radius:12px;
  padding:13px 16px; margin-bottom:20px; box-shadow:var(--shadow);
}
.fbar label { font-size:11px; font-weight:600; color:var(--text-mute); display:flex; align-items:center; gap:5px; }
.cb-field-label { font-size:11px; font-weight:600; color:var(--text-mute); }
.fbar .fbrk { flex-basis:100%; height:0; margin:0; padding:0; }
.fbar select.fs, .fbar .cb-drop { max-width:240px; }
.mobile-filter-toggle { display:none; }

/* ════════ Sections / Tabs ════════ */
.sec { display:none; } .sec.on { display:block; }
.tabs { display:inline-flex; gap:2px; margin-bottom:20px; flex-wrap:wrap; background:var(--surface-hi); border:1px solid var(--line); border-radius:999px; padding:3px; }
.tb {
  font-family:'Inter', sans-serif; padding:7px 14px; font-size:11.5px; font-weight:500;
  border-radius:999px; border:0; background:transparent;
  color:var(--text-mute); transition:all .15s;
}
.tb:hover { color:var(--text); }
.tb.on { background:#111827; color:#fff; font-weight:600; }
.tp { display:none; } .tp.on { display:block; }
.tabs-row { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:8px; margin-bottom:10px; }
.tabs-row .tabs { margin-bottom:0; }
.metric-switch-head { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:10px; }
.metric-switch-head .tabs { margin-bottom:0; }
.compare-layout { display:grid; grid-template-columns:1fr auto 1fr; gap:1rem; align-items:start; }
.compare-filter-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:.5rem; align-items:end; }
/* Every filter in the Comparison grid is a framed, full-width box: label on top,
   control filling the cell — the cb-drop chips used to shrink to "All" width. */
.compare-filter-grid > .cb-drop { display:flex; flex-direction:column; align-items:stretch; gap:.2rem; min-width:0; max-width:none; }
.compare-filter-grid > .cb-drop .cb-field-label { font-size:0.75rem; font-weight:600; color:var(--text-mute); }
.compare-filter-grid > .cb-drop .cb-btn {
  width:100%; box-sizing:border-box; justify-content:space-between;
  padding:0.35rem 0.5rem; font-size:0.8rem; border-radius:0.4rem;
}
.compare-filter-grid > .cb-drop .cb-lbl { max-width:none; flex:1 1 auto; text-align:left; }
/* ponytail: no min-width:100% on the panel — toggleCBD makes it position:fixed on
   desktop, so a percentage there resolves against the viewport, not the button. */
.compare-divider { display:flex; flex-direction:column; align-items:center; justify-content:center; padding:1rem .5rem; gap:.4rem; }
.chart-head { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; margin-bottom:12px; }
.chart-title-block { min-width:0; }
.chart-title-block .ct { margin-bottom:3px; }
.chart-subtitle {
  font-family:'JetBrains Mono', ui-monospace, monospace;
  font-size:10px; font-weight:600; color:var(--text-dim);
  text-transform:uppercase; letter-spacing:0;
}
.chart-toolbar { display:flex; align-items:center; justify-content:flex-end; gap:8px; flex-wrap:wrap; }
.chart-toolbar .tabs { margin-bottom:0; flex-wrap:nowrap; }
.chart-select-field {
  display:inline-flex; align-items:center; gap:7px; min-height:35px;
  padding:3px 4px 3px 10px; border:1px solid var(--line);
  border-radius:999px; background:var(--surface-hi);
  font-family:'JetBrains Mono', ui-monospace, monospace;
  font-size:9.5px; font-weight:700; color:var(--text-dim);
  text-transform:uppercase; letter-spacing:0;
}
.chart-select-field select.fs {
  min-width:96px; border:0; border-left:1px solid var(--line);
  border-radius:0 999px 999px 0; background-color:transparent;
  padding:6px 24px 6px 10px; font-size:11px; color:var(--text);
  text-transform:none; letter-spacing:0;
}
.chart-select-field:focus-within { border-color:var(--gold); box-shadow:0 0 0 3px var(--gold-wash); }
.chart-select-field select.fs:focus { box-shadow:none; }
/* S-5: one shared shell keeps every Overview chart header and plot aligned. */
.overview-chart-card {
  --overview-chart-height:280px;
  --overview-chart-head-min-height:42px;
}
.overview-chart-head {
  align-items:center;
  min-height:var(--overview-chart-head-min-height);
  margin-bottom:12px;
}
.overview-chart-head .chart-title-block .ct { margin-bottom:3px; }
.overview-chart-body {
  height:var(--overview-chart-height);
  flex:0 0 var(--overview-chart-height);
}
/* S-10: Overview-only spacing tokens keep cards dense without changing other sections. */
#sec-home {
  --overview-space-xs:4px;
  --overview-space-sm:8px;
  --overview-space-md:12px;
  --overview-space-lg:16px;
  --overview-card-pad-y:14px;
  --overview-card-pad-x:16px;
}
#sec-home .home-hero-split,
#sec-home .g21 { gap:var(--overview-space-md); }
#sec-home .mb14 { margin-bottom:var(--overview-space-md); }
#sec-home .card { padding:var(--overview-card-pad-y) var(--overview-card-pad-x); }
#sec-home .overview-chart-card { --overview-chart-head-min-height:36px; }
#sec-home .overview-chart-head {
  gap:var(--overview-space-md);
  margin-bottom:var(--overview-space-sm);
}
#sec-home .chart-toolbar { gap:var(--overview-space-sm); }
#sec-home .chart-select-field { min-height:32px; }
#sec-home .chart-select-field select.fs { padding-top:5px; padding-bottom:5px; }
#sec-home .scope-table-title { margin-bottom:var(--overview-space-sm); }
#sec-home .home-right-intel { gap:var(--overview-space-sm); }
#sec-home .home-performance-grid,
#sec-home .home-key-grid { gap:var(--overview-space-sm); }
#sec-home .home-section-title { margin-bottom:var(--overview-space-sm); }
@media(max-width:768px){
  .chart-head { display:block; }
  .chart-toolbar { justify-content:flex-start; margin-top:10px; }
  .chart-toolbar .tabs, .chart-select-field { width:100%; }
  .chart-toolbar .tabs .tb { flex:1 1 0; }
  .chart-select-field select.fs { flex:1; min-width:0; }
  .overview-chart-card { --overview-chart-height:200px; }
}

/* Online report: story-led layout scoped to S6 so other Sales pages stay unchanged. */
#sec-s6 {
  --online-space-xs:4px;
  --online-space-sm:8px;
  --online-space-md:12px;
  --online-space-lg:18px;
}
#sec-s6 > .fbar { margin-bottom:var(--online-space-md); }
.online-page-intro {
  display:flex;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:var(--online-space-lg);
  margin:0 0 var(--online-space-md);
}
.online-intro-copy { min-width:0; max-width:560px; }
/* Mockup parity: eyebrows are Plus Jakarta Sans, not mono. */
.online-kicker {
  font-family:'Plus Jakarta Sans',Inter,sans-serif;
  font-size:10.5px; font-weight:700; letter-spacing:.06em; text-transform:uppercase;
  color:var(--gold); margin-bottom:var(--online-space-xs);
}
.online-section-head span {
  font-family:'Plus Jakarta Sans',Inter,sans-serif;
  font-size:12px; font-weight:700; letter-spacing:.04em; text-transform:uppercase;
}
.online-page-title {
  color:var(--text);
  font-family:'Plus Jakarta Sans',Inter,sans-serif;
  font-size:19px;
  font-weight:700;
  letter-spacing:-.01em;
  line-height:1.2;
}
.online-page-intro p {
  max-width:520px;
  margin-top:6px;
  color:var(--text-mute);
  font-size:11.5px;
  line-height:1.55;
}
.online-hero-stats {
  display:flex;
  flex:0 0 auto;
  gap:26px;
  flex-wrap:wrap;
}
.online-hero-stats > div { min-width:0; }
.online-hero-stats span {
  display:block;
  color:var(--text-mute);
  font-size:11px;
}
.online-hero-stats strong {
  display:block;
  margin-top:2px;
  color:var(--text);
  font-family:'Plus Jakarta Sans',Inter,sans-serif;
  font-size:22px;
  font-weight:800;
  font-variant-numeric:tabular-nums;
  letter-spacing:-.01em;
  line-height:1.15;
}
.online-hero-stats em {
  display:block;
  margin-top:2px;
  color:var(--text-mute);
  font-size:11px;
  font-style:normal;
  font-weight:700;
}
.online-section-head { margin:18px 2px var(--online-space-sm); }
.online-section-head span { color:var(--gold); }
.online-trend-grid,
.online-brand-grid,
.online-table-grid {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:var(--online-space-md);
}
.online-brand-grid { grid-template-columns:minmax(230px,.8fr) minmax(280px,1fr) minmax(300px,1fr); }
.online-account-grid {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:var(--online-space-md);
  align-items:start;
}
/* Mockup parity: group mix as share bars, category share as highlight cards. */
.online-share-bars { display:flex; flex-direction:column; gap:9px; padding-top:2px; }
.online-share-top {
  display:flex; justify-content:space-between; align-items:baseline;
  color:var(--text-mute); font-size:11.5px; margin-bottom:3px;
}
.online-share-top b { color:var(--text); font-weight:700; font-variant-numeric:tabular-nums; }
/* Compact: the baht figure rides the % line instead of a third row. */
.online-share-top b em { margin-left:7px; color:var(--text-dim); font-style:normal; font-weight:400; font-size:10.5px; }
.online-share-track {
  height:6px; border-radius:4px; background:var(--surface-2); overflow:hidden;
}
.online-share-track i { display:block; height:100%; border-radius:4px; }
.online-share-meta { margin-top:4px; color:var(--text-dim); font-size:10.5px; }
.online-hl-list { display:flex; flex-direction:column; gap:8px; }
.online-hl-card {
  padding:9px 11px;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--surface-hi);
}
.online-hl-lbl {
  color:var(--text-dim);
  font-size:10px; font-weight:600;
  letter-spacing:.05em; text-transform:uppercase;
}
.online-hl-val {
  margin-top:2px;
  color:var(--text);
  font-family:'Plus Jakarta Sans',Inter,sans-serif;
  font-size:13px; font-weight:700; font-variant-numeric:tabular-nums;
}
.online-hl-meta { margin-top:2px; color:var(--text-mute); font-size:10.5px; }
.online-chart-card,
.online-table-card { min-width:0; padding:16px; }
/* Mockup parity: the card head is the title, nothing else. */
.online-card-head { margin-bottom:14px; }
.online-card-head .ct {
  margin:0;
  font-family:'Plus Jakarta Sans',Inter,sans-serif;
  font-size:14px; font-weight:700; letter-spacing:0;
}
.online-table-card .scrolly { max-height:420px; }
.online-account-grid .online-table-card .scrolly { height:280px; max-height:280px; }
.online-product-card .scrolly { max-height:470px; }
.online-brand-table-card .scrolly { max-height:300px; }

@media (max-width:1180px) {
}
@media (max-width:768px) {
  .online-hero-stats { gap:18px; margin-top:14px; }
  .online-hero-stats strong { font-size:19px; }
  .online-trend-grid,
  .online-brand-grid,
  .online-table-grid,
  .online-account-grid { grid-template-columns:1fr; }
  .online-chart-card,
  .online-table-card { padding:14px; }
}

/* ── Online pass 4 ────────────────────────────────────────────────────────── */
/* Leaders panel now owns the row on its own (channel-pulse panel removed). */
.online-leaders-row { display:block; }
.online-leaders-row .insight-leader-panel { width:100%; }
.online-leaders-row .online-signal-grid { grid-template-columns:repeat(4,minmax(0,1fr)); grid-template-rows:auto; }
/* Quarterly card keeps its period note without borrowing the generic chart head. */
.online-card-sub { margin-top:3px; color:var(--text-mute); font-size:11px; font-weight:400; }
.online-card-head > div { min-width:0; }
/* Category Share is a sub-block of Net Sales by Group. */
.online-subhead {
  margin:12px 0 8px; padding-top:10px; border-top:1px solid var(--line);
  font-family:'Plus Jakarta Sans',Inter,sans-serif;
  font-size:12.5px; font-weight:700; color:var(--text);
}
.online-group-card .online-hl-list {
  display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:8px;
}
.online-brand-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
/* One typeface family across the whole page: Inter for text and figures,
   Plus Jakarta Sans for titles, eyebrows and headline numbers. No mono, no serif. */
#sec-s6, #sec-s6 table, #sec-s6 thead th, #sec-s6 td.r,
#sec-s6 tfoot tr.tbl-total td, #sec-s6 .totrow td,
#sec-s6 .mono, #sec-s6 .nu, #sec-s6 .bdg, #sec-s6 .l6-trend,
#sec-s6 input, #sec-s6 select, #sec-s6 button,
#sec-s6 .sales-identity-mark, #sec-s6 .sales-identity-mark span,
#sec-s6 .insight-signal, #sec-s6 .insight-signal span,
#sec-s6 .insight-signal small, #sec-s6 .insight-signal b {
  font-family:'IBM Plex Sans',Inter,system-ui,sans-serif;
}
#sec-s6 thead th { font-size:10px; letter-spacing:.05em; }
#sec-s6 .ct, #sec-s6 .online-page-title,
#sec-s6 .online-section-head span, #sec-s6 .online-hero-stats strong,
#sec-s6 .online-hl-val, #sec-s6 .insight-panel-title, #sec-s6 .insight-signal strong {
  font-family:'Plus Jakarta Sans',Inter,sans-serif;
}
#sec-s6 .online-kicker, #sec-s6 .insight-eyebrow {
  font-family:'IBM Plex Sans',Inter,system-ui,sans-serif;
}
/* Text columns read left; only the numeric (.r) columns stay right. */
#sec-s6 thead th, #sec-s6 tbody td, #sec-s6 tfoot td { text-align:left; }
#sec-s6 thead th.r, #sec-s6 tbody td.r, #sec-s6 tfoot td.r { text-align:right; }
#sec-s6 tbody td:has(.bdg) { text-align:left; }
@media (max-width:768px) {
  .online-group-card .online-hl-list { grid-template-columns:1fr; }
  .online-brand-grid { grid-template-columns:1fr; }
  .online-leaders-row .online-signal-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

/* ════════ Cards / KPI ════════ */
.card {
  background:var(--surface); border-radius:13px; padding:18px 20px;
  border:1px solid var(--line); box-shadow:var(--shadow);
}
.kpi {
  background:var(--surface); border-radius:13px; padding:16px 20px;
  border:1px solid var(--line); box-shadow:var(--shadow);
  position:relative; overflow:hidden;
}
.kpi::before {
  content:""; position:absolute; left:0; top:0; bottom:0; width:3px;
  background:var(--gold-soft);
}
.kpi-lbl {
  font-family:'JetBrains Mono', monospace; font-size:9.5px; font-weight:600;
  color:var(--text-mute); text-transform:uppercase; letter-spacing:.1em;
}
.kpi-val {
  font-family:'Fraunces', Georgia, serif; font-size:28px; font-weight:600;
  color:var(--text); margin:7px 0 5px; letter-spacing:-.01em; line-height:1;
}
.kpi-sub { font-size:11px; line-height:1.5; }
.kpi-sub + .kpi-sub { margin-top:3px; }
.row-hd { font-size:9.5px; font-weight:600; color:var(--text-mute); text-transform:uppercase; letter-spacing:.1em; margin-bottom:7px; font-family:'JetBrains Mono',monospace; padding-left:2px; }
.row-hd.cur { color:var(--gold); }
.s1-impact-grid {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
}
.s1-impact-card {
  background:linear-gradient(180deg,var(--surface) 0%,var(--surface-hi) 100%);
  border:1px solid var(--line);
  border-radius:12px;
  box-shadow:var(--shadow);
  padding:14px 15px;
  min-height:126px;
  position:relative;
  overflow:hidden;
}
.s1-impact-card::before {
  content:"";
  position:absolute;
  inset:0 0 auto;
  height:3px;
  background:linear-gradient(90deg,var(--gold),var(--gold-soft));
}
.s1-impact-top {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin-bottom:10px;
}
.s1-impact-label {
  color:var(--text-mute);
  font-family:'JetBrains Mono', ui-monospace, monospace;
  font-size:9.5px;
  font-weight:700;
  letter-spacing:.1em;
  text-transform:uppercase;
}
.s1-impact-chip {
  border:1px solid var(--line-hi);
  border-radius:999px;
  color:var(--gold);
  background:var(--gold-wash);
  font-family:'JetBrains Mono', ui-monospace, monospace;
  font-size:9.5px;
  font-weight:700;
  padding:2px 7px;
  white-space:nowrap;
}
.s1-impact-value {
  color:var(--text);
  font-family:'Fraunces', Georgia, serif;
  font-size:23px;
  font-weight:600;
  letter-spacing:-.02em;
  line-height:1.05;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.s1-impact-sub {
  color:var(--text-mute);
  font-size:11px;
  line-height:1.35;
  margin-top:7px;
  min-height:30px;
}
.s1-impact-meter {
  background:var(--surface-2);
  border-radius:999px;
  height:6px;
  margin-top:11px;
  overflow:hidden;
}
.s1-impact-meter span {
  background:linear-gradient(90deg,var(--gold),var(--gold-soft));
  border-radius:999px;
  display:block;
  height:100%;
  transition:width .2s ease;
  width:0%;
}
.insight-hero-split {
  display:grid;
  grid-template-columns:minmax(330px,.88fr) minmax(0,1.42fr);
  grid-template-rows:minmax(0,1fr);
  gap:14px;
  height:250px;
}
.insight-kpi-panel,
.insight-leader-panel {
  border-radius:14px;
  box-shadow:0 16px 34px -26px rgba(15,23,42,.9);
  min-height:0;
  min-width:0;
  overflow:hidden;
}
.insight-kpi-panel {
  display:grid;
  grid-template-rows:auto auto auto;
  gap:5px;
  padding:14px 22px;
  border:1px solid var(--ink-line-hi);
  background:
    radial-gradient(circle at 88% -30%, rgba(45,212,191,.22), transparent 42%),
    linear-gradient(135deg,var(--ink-1),var(--ink-0));
  color:var(--ink-text);
}
.insight-leader-panel {
  display:flex;
  flex-direction:column;
  padding:16px 18px 18px;
  border:1px solid var(--line);
  background:var(--surface);
}
.insight-eyebrow,
.insight-section-head span,
.insight-signal > span,
.insight-primary-kpi > span,
.insight-support-kpi > span {
  font-family:'JetBrains Mono',ui-monospace,monospace;
  font-size:9.5px;
  font-weight:700;
  letter-spacing:.1em;
  text-transform:uppercase;
}
.insight-eyebrow { color:var(--ink-gold-soft); margin-bottom:4px; }
.insight-kpi-panel h2 {
  font-family:'Fraunces',Georgia,serif;
  font-size:22px;
  font-weight:600;
  line-height:1.12;
  letter-spacing:-.02em;
}
.insight-filter-summary {
  margin-top:4px;
  overflow:hidden;
  color:var(--ink-mute);
  font-size:9.5px;
  line-height:1.3;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.insight-primary-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:22px; }
.insight-primary-kpi { min-width:0; }
.insight-primary-kpi > span,
.insight-support-kpi > span { display:block; color:var(--ink-mute); line-height:1.2; margin-bottom:6px; }
.insight-primary-kpi strong {
  display:block;
  overflow:hidden;
  color:var(--ink-text);
  font-family:'Fraunces',Georgia,serif;
  font-size:30px;
  font-weight:600;
  letter-spacing:-.02em;
  line-height:1.05;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.insight-primary-kpi small,
.insight-support-kpi small { display:block; margin-top:3px; color:var(--ink-gold-soft); font-size:9.5px; line-height:1.3; }
.insight-total-meta { display:flex !important; align-items:center; flex-wrap:wrap; gap:4px 10px; }
.insight-ytd-inline { display:inline-flex; align-items:center; gap:4px; color:var(--ink-mute); white-space:nowrap; }
.insight-ytd-inline > strong { display:inline; overflow:visible; font-family:inherit; font-size:inherit; letter-spacing:normal; white-space:normal; }
.insight-ytd-inline .bdg { font-size:9.5px; }
.insight-latest-kpi { display:grid; grid-template-columns:auto minmax(0,1fr); align-items:center; column-gap:10px; }
.insight-latest-kpi > span { grid-column:1/-1; }
.insight-latest-kpi > strong { color:var(--ink-gold-soft); font-size:28px; }
.insight-latest-comparisons { display:flex !important; flex-direction:column; flex-wrap:nowrap; gap:4px; margin-top:0 !important; }
.insight-kpi-change { display:inline-flex; align-items:center; gap:3px; color:var(--ink-mute); white-space:nowrap; }
.insight-kpi-change .bdg { font-size:10px; }
.insight-support-grid {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
  padding-top:7px;
  border-top:1px solid var(--ink-line-hi);
}
.insight-support-kpi { min-width:0; }
.insight-support-kpi > span {
  display:block;
  margin:0 0 3px;
  font-family:'Inter',system-ui,sans-serif;
  font-size:9.5px;
  font-weight:700;
  letter-spacing:.07em;
  line-height:1.15;
}
.insight-support-kpi strong {
  display:block;
  overflow:hidden;
  color:var(--ink-text);
  font-family:'Fraunces',Georgia,serif;
  font-size:17px;
  font-weight:600;
  letter-spacing:-.01em;
  line-height:1.1;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.insight-support-kpi small {
  margin:3px 0 0;
  color:var(--ink-mute);
  font-family:'Inter',system-ui,sans-serif;
  font-size:10px;
  font-weight:500;
  line-height:1.2;
  text-align:left;
}
.insight-panel-title {
  margin-bottom:8px;
  color:var(--text);
  font-family:'Fraunces',Georgia,serif;
  font-size:16px;
  font-weight:600;
  letter-spacing:-.01em;
}
.insight-signal-grid { display:grid; flex:1; grid-template-columns:repeat(3,minmax(0,1fr)); grid-template-rows:repeat(2,minmax(0,1fr)); gap:10px; }
.online-signal-grid { grid-template-columns:repeat(2,minmax(0,1fr)); grid-template-rows:repeat(2,minmax(0,1fr)); }
.insight-signal {
  display:flex;
  min-width:0;
  flex-direction:column;
  padding:9px 10px;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--surface-2);
}
.insight-signal > span {
  display:block;
  margin-bottom:2px;
  color:var(--text-mute);
  font-family:'Inter',system-ui,sans-serif;
  font-size:10px;
  font-weight:700;
  letter-spacing:.07em;
  line-height:1.2;
}
.insight-signal strong {
  display:block;
  overflow:hidden;
  color:var(--text);
  font-family:'Fraunces',Georgia,serif;
  font-size:17px;
  font-weight:600;
  letter-spacing:-.01em;
  line-height:1.25;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.insight-signal-kpis {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:5px;
  margin-top:auto;
  padding-top:5px;
}
.insight-signal-kpis > span { min-width:0; }
.insight-signal-kpis small {
  display:block;
  overflow:hidden;
  color:var(--text-mute);
  font-family:'Inter',system-ui,sans-serif;
  font-size:8.5px;
  font-weight:700;
  letter-spacing:.05em;
  line-height:1.15;
  text-overflow:ellipsis;
  text-transform:uppercase;
  white-space:nowrap;
}
.insight-signal-kpis b {
  display:block;
  overflow:hidden;
  margin-top:2px;
  color:var(--insight-detail);
  font-family:'Inter',system-ui,sans-serif;
  font-size:10px;
  font-weight:700;
  line-height:1.2;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.insight-signal-kpis .bdg { font-size:9px; }
.insight-story-block { padding-top:2px; }
.insight-section-head {
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:18px;
  margin:0 2px 10px;
  padding-top:12px;
  border-top:1px solid var(--line);
}
.insight-section-head span { color:var(--gold); }
.insight-section-head h3 { margin-top:3px; color:var(--text); font-family:'Fraunces',Georgia,serif; font-size:20px; font-weight:600; line-height:1.2; }
.insight-section-head p { max-width:390px; color:var(--text-mute); font-size:11px; text-align:right; }
.insight-product-head { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; margin-bottom:8px; }
.insight-product-head .ct { margin-bottom:3px; }
.insight-product-head .tabs { flex-wrap:nowrap; margin-bottom:0; }
.insight-card-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:4px; }
.insight-card-head .tabs { flex-wrap:nowrap; margin-bottom:0; }
.insight-table-medium { max-height:330px; }
.insight-table-remark { padding:7px 4px 0; color:var(--text-dim); font-size:10px; line-height:1.45; }
.channel-contribution { max-height:280px; margin-top:10px; overflow-y:auto; }
.channel-contribution-row {
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:12px;
  padding:8px 4px;
  border-bottom:1px solid var(--line);
}
.channel-contribution-row.parent { cursor:pointer; }
.channel-contribution-row.child { padding-left:24px; background:var(--surface-2); }
.channel-contribution-name { min-width:0; }
.channel-contribution-label { display:flex; align-items:center; gap:7px; min-width:0; color:var(--text); font-size:12px; font-weight:600; }
.channel-contribution-row.child .channel-contribution-label { color:var(--text-mute); font-weight:500; }
.channel-contribution-label .trunc { flex:1; }
.channel-contribution-value { color:var(--text); font-family:'JetBrains Mono',monospace; font-size:12.5px; font-weight:700; text-align:right; white-space:nowrap; }
.channel-contribution-value small { display:block; margin-top:3px; font-size:11.5px; font-weight:600; color:var(--text-mute); }
.channel-contribution-track { height:8px; margin-top:6px; overflow:hidden; border-radius:5px; background:var(--surface-2); }
.channel-contribution-track span { display:block; height:100%; border-radius:999px; background:linear-gradient(90deg,var(--gold),var(--gold-soft)); }
.channel-contribution-row.child .channel-contribution-track span { background:var(--text-dim); }
.insight-driver-grid { display:grid; grid-template-columns:minmax(0,1.25fr) minmax(390px,.95fr); gap:14px; align-items:stretch; }
.insight-catbrk-grid { display:grid; grid-template-columns:minmax(0,.8fr) minmax(0,1.5fr); gap:14px; align-items:stretch; }
.insight-catbrk-grid > .card { display:flex; flex-direction:column; }
.insight-catbrk-grid .channel-contribution { flex:1 1 auto; max-height:none; min-height:280px; }
.insight-catbrk-grid .tbl-wrap.scrolly { flex:1 1 auto; max-height:none; min-height:330px; }
.insight-catbrk-grid .tbl-wrap.scrolly table { height:100%; }
@media (max-width:900px) { .insight-catbrk-grid { grid-template-columns:1fr; } }
.insight-brand-mix-card { min-width:0; }
/* S-3: height:auto + JS-computed inline height (per brand count, see mk('c-s2-br',...)
   call site) keeps the bar chart from stretching to fill the frame when the Brand
   filter narrows to one or a few brands; max-height/max-width + centering bound it. */
.insight-brand-mix-chart { height:auto; min-height:200px; max-height:360px; max-width:min(100%, 880px); margin-inline:auto; }
.insight-performance-stack { display:grid; grid-template-rows:repeat(2,minmax(0,1fr)); gap:14px; min-width:0; }
.insight-performance-stack .card { min-height:0; }
.insight-performance-stack .insight-table-medium { max-height:270px; }
/* Task 2.6 — Category Breakdown hierarchy. Parent (Category) reads as the heading
   row; Sub Cat and Brand step in behind a left guide rail so the depth is obvious
   with several categories expanded at once. */
#tb-s2-cat > tr:not(.row-child-1):not(.row-child-2):not(.totrow) td:first-child { font-weight:700; color:var(--text); }
#tb-s2-cat > tr.open:not(.row-child-1):not(.row-child-2) td { background:var(--gold-wash); }
#tb-s2-cat .row-child-1 td:first-child { padding-left:34px; color:var(--text-mute); font-weight:600; box-shadow:inset 14px 0 0 -13px var(--line); }
#tb-s2-cat .row-child-2 td:first-child { padding-left:58px; color:var(--text-dim); font-weight:400; box-shadow:inset 38px 0 0 -37px var(--line); }
.s3-channel-board {
  display:grid;
  grid-template-columns:minmax(0,1.35fr) minmax(320px,.9fr);
  gap:14px;
}
.s3-channel-main,
.s3-channel-side {
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:12px;
  box-shadow:var(--shadow);
  min-width:0;
  padding:16px 18px;
}
.s3-channel-title {
  color:var(--text);
  font-family:'Fraunces', Georgia, serif;
  font-size:15px;
  font-weight:500;
  letter-spacing:-.01em;
  margin-bottom:4px;
}
.s3-channel-note {
  color:var(--text-mute);
  font-size:10.5px;
  margin-bottom:8px;
}
.s3-mini-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px 14px;
}
.s3-mini-grid > div { min-width:0; }
.s3-mini-title {
  color:var(--text);
  font-size:11px;
  font-weight:700;
  margin-bottom:5px;
}
.s3-mini-chart { height:116px; min-width:0; position:relative; }
.s3-mini-chart canvas { width:100% !important; }
.dim-trend-board .card { min-width:0; }
.dim-mini-row {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
}
.dim-mini-card {
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:10px;
  box-shadow:var(--shadow);
  min-width:0;
  padding:12px 14px;
}

/* ════════ Grids ════════ */
.g5 { display:grid; grid-template-columns:repeat(5,1fr); gap:16px; }
.g4 { display:grid; grid-template-columns:repeat(4,1fr); gap:16px; }
.g3 { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }
.g2 { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.g21 { display:grid; grid-template-columns:1.5fr 1fr; gap:16px; }
.g12 { display:grid; grid-template-columns:1fr 2fr; gap:16px; }
.g5>*, .g4>*, .g3>*, .g2>*, .g21>*, .g12>* { min-width:0; }
.mb14 { margin-bottom:16px; } .mb10 { margin-bottom:12px; }
.ct {
  font-family:'Fraunces', Georgia, serif; font-size:15px; font-weight:500;
  color:var(--text); margin-bottom:14px; letter-spacing:-.01em;
}
/* ════════ Chart wrappers ════════ */
/* S-13 (2026-08-18): overflow:hidden guards against Chart.js canvases that
   briefly report a taller size than their fixed-height wrapper (e.g. before
   the ResizeObserver settles, or when a legend wraps to an extra line) —
   was visually overlapping the card/table directly below the chart. */
.cw { position:relative; overflow:hidden; }
.h220 { height:220px; } .h260 { height:260px; } .h280 { height:280px; }
.h300 { height:300px; } .h320 { height:320px; }
.h340 { height:340px; } .h380 { height:380px; }

/* ════════ Tables ════════ */
.tbl-wrap { overflow-x:auto; border-radius:10px; }
.dash-brand-label { display:inline-flex; align-items:center; gap:7px; min-width:0; vertical-align:middle; }
.dash-brand-label img { width:28px; height:20px; flex:0 0 28px; object-fit:contain; background:#fff; border:1px solid var(--border-soft); border-radius:4px; }
table { width:100%; border-collapse:separate; border-spacing:0; font-size:11.5px; }
thead th {
  background:var(--ink-1); color:var(--ink-mute);
  font-family:'JetBrains Mono', monospace; font-weight:600; font-size:9.5px;
  letter-spacing:.06em; text-transform:uppercase;
  padding:9px 11px; text-align:center; white-space:nowrap;
  border-bottom:1px solid var(--ink-line-hi); position:sticky; top:0; z-index:3;
}
tbody tr { border-bottom:1px solid var(--line); }
tbody tr:nth-child(even) td { background:var(--zebra); }
tbody tr:hover td { background:var(--gold-wash); }
tfoot tr.tbl-total td { padding:8px 11px; background:var(--ink-1); color:var(--ink-text) !important; font-weight:700; border-top:2px solid var(--ink-line-hi); font-variant-numeric:tabular-nums; font-family:'JetBrains Mono',monospace; font-size:11px; position:sticky; bottom:0; z-index:1; }
tbody td {
  padding:8px 11px; color:var(--text); border-bottom:1px solid var(--line);
  font-variant-numeric:tabular-nums; text-align:center;
}
td.r { font-family:'JetBrains Mono', monospace; font-variant-numeric:tabular-nums; }
td.c { text-align:center; }
/* Product Insight "All Products — Ranked by Net Sales": numeric cells use the body
   sans-serif (IBM Plex Sans) with tabular-nums, matching the DeepDive.dc.html mockup
   (table.vt .vn) instead of the global monospace td.r. Scoped to #tb-s2-prod so the
   change doesn't leak into other tables that rely on td.r's monospace. */
#tb-s2-prod td.r { font-family:'IBM Plex Sans',Inter,sans-serif; }
td:has(.bdg) { text-align:center; }
.scope-table th,
.scope-table td,
.scope-table td.r { text-align:center; }
.scope-table th:nth-child(2),
.scope-table td:nth-child(2) { text-align:left; }
.trunc { max-width:170px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:left; }
tbody tr td:first-child { text-align:left; }
.l6-trend-cell { min-width:120px; vertical-align:middle; }
.l6-trend {
  display:grid; grid-template-columns:46px 66px; align-items:center; justify-content:end; gap:8px; min-height:22px;
  font-family:'JetBrains Mono', monospace; white-space:nowrap;
}
.l6-spark { width:46px; height:18px; flex-shrink:0; }
.l6-spark path { fill:none; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.l6-spark.up path { stroke:var(--green); }
.l6-spark.dn path { stroke:var(--red); }
.l6-spark.nu path { stroke:var(--text-dim); }
.l6-trend .bdg { padding:2px 7px; text-align:center; }

/* ════════ Badges ════════ */
.bdg {
  display:inline-block; padding:2px 8px; border-radius:6px;
  font-family:'JetBrains Mono', monospace; font-size:9.5px; font-weight:600; letter-spacing:.02em;
}
.up { background:var(--green-bg); color:var(--green); }
.dn { background:var(--red-bg); color:var(--red); }
.nu { background:var(--surface-2); color:var(--text-mute); }

/* ════════ Misc ════════ */
.scrolly { overflow-y:auto; max-height:360px; }
.no-data {
  display:flex; align-items:center; justify-content:center; height:160px;
  color:var(--text-dim); font-size:12px; font-family:'JetBrains Mono', monospace;
}
.totrow { border-top:2px solid var(--ink-line-hi); background:var(--ink-1); }
.totrow td { padding:8px 11px; color:var(--ink-text) !important; font-weight:600; }
.scrolly .totrow td { position:sticky; bottom:0; background:var(--ink-1); z-index:5; box-shadow:0 -2px 0 var(--ink-line-hi); }
.totrow:hover td { background:var(--ink-1) !important; }
.section-divider {
  font-family:'JetBrains Mono', monospace; font-size:10px; font-weight:600;
  color:var(--text-mute); text-transform:uppercase; letter-spacing:.12em;
  padding:10px 0 6px; border-bottom:1px solid var(--line); margin:16px 0 12px;
  display:flex; align-items:center; gap:9px;
}
.section-divider::before { content:""; width:16px; height:2px; background:var(--gold-soft); border-radius:2px; }

/* YTD detail tabs — one shared table, with the active tab sitting on its edge. */
.ytd-tabbar,
.detail-tabbar {
  display:flex; align-items:flex-end; gap:2px; overflow-x:auto;
  padding:0 10px; border-bottom:1px solid var(--line-hi); background:var(--surface);
}
.ytd-tab,
.detail-tab {
  appearance:none; flex:0 0 auto; margin-bottom:-1px; padding:9px 15px 8px;
  border:1px solid var(--line-hi); border-bottom:0; border-radius:8px 8px 0 0;
  background:transparent; color:var(--text-mute); font-family:'Inter',sans-serif;
  font-size:11px; font-weight:500; white-space:nowrap; cursor:pointer;
  transition:color .12s, background .12s, border-color .12s;
}
.ytd-tab:hover,
.detail-tab:hover { color:var(--text); background:var(--surface-hi); }
.ytd-tab.on,
.detail-tab.on {
  color:var(--gold); background:var(--surface-hi); border-color:var(--gold);
  font-weight:600; position:relative; z-index:1;
}
.ytd-tab:focus-visible,
.detail-tab:focus-visible { outline:2px solid var(--gold); outline-offset:1px; }

/* ════════ Expandable tree rows ════════ */
.row-expand { cursor:pointer; user-select:none; }
.row-expand:hover td { background:var(--gold-wash) !important; }
.expand-icon { font-size:9px; margin-right:6px; display:inline-block; color:var(--gold-soft); }
.row-child-1 td:first-child { padding-left:24px; color:var(--text-mute); }
.row-child-1 td { background:var(--surface-hi); }
.row-child-2 td:first-child { padding-left:42px; color:var(--text-dim); font-size:10.5px; }
.row-child-2 td { background:var(--surface-2); font-size:10.5px; }

/* ════════ Pill toggles ════════ */
.fl { display:flex; align-items:center; gap:5px; font-size:11px; color:var(--text-mute); }
.pillbar {
  display:inline-flex; flex-wrap:wrap; gap:5px; padding:5px;
  border:1px solid var(--line-hi); border-radius:8px; background:var(--surface);
}
.pill {
  font-family:'Inter', sans-serif; padding:4px 11px; font-size:11px; border-radius:13px;
  border:1px solid var(--line-hi); background:var(--surface-hi); color:var(--text-mute);
  cursor:pointer; user-select:none; transition:all .12s;
}
.pill:hover { background:var(--gold-wash); color:var(--text); }
.pill.on { background:var(--gold); color:var(--gold-ink); border-color:var(--gold); font-weight:600; }
.pill.compare-hint {
  border-color:var(--green);
  background:var(--green-bg);
  color:var(--green);
  box-shadow:0 0 0 4px rgba(22,163,74,.16), 0 0 18px rgba(22,163,74,.42);
  animation:compareHintPulse 1.5s ease-in-out 2;
}
@keyframes compareHintPulse {
  0%,100% { transform:translateY(0); box-shadow:0 0 0 3px rgba(22,163,74,.12), 0 0 10px rgba(22,163,74,.30); }
  50% { transform:translateY(-1px); box-shadow:0 0 0 6px rgba(22,163,74,.22), 0 0 22px rgba(22,163,74,.55); }
}
.pillbar-sm { max-height:58px; overflow-y:auto; min-width:120px; max-width:200px; }
.rst {
  font-family:'Inter', sans-serif; padding:6px 11px; font-size:11px; font-weight:500;
  border-radius:7px; border:1px solid var(--line-hi); background:var(--surface);
  color:var(--text-mute); transition:all .15s; cursor:pointer;
}
.rst:hover { background:var(--red-bg); color:var(--red); border-color:var(--red); }

/* ════════ Checkbox dropdown (PowerBI-style) ════════ */
.cb-drop { position:relative; display:inline-block; }
.cb-btn {
  display:flex; align-items:center; gap:5px; padding:6px 10px; font-size:11px;
  font-family:'Inter', sans-serif; border:1px solid var(--line-hi); border-radius:7px;
  background:var(--surface-hi); color:var(--text-mute); cursor:pointer; white-space:nowrap; line-height:normal;
}
.cb-btn:hover, .cb-btn.open { border-color:var(--gold); color:var(--gold); }
/* Product filter: the trigger itself is the search input (one box, no nested one) */
input.cb-btn.ssd-search { width:100%; outline:none; -webkit-appearance:none; appearance:none; }
input.cb-btn.ssd-search::-webkit-search-cancel-button { -webkit-appearance:none; appearance:none; }
input.cb-btn.ssd-search::placeholder { color:inherit; opacity:.85; }
.cb-lbl { font-weight:600; max-width:120px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cb-arrow {
  width:9px; height:9px; flex-shrink:0;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-mute) 50%),
    linear-gradient(135deg, var(--text-mute) 50%, transparent 50%);
  background-position: right 4px top 2px, right -1px top 2px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.cb-panel {
  display:none; position:absolute; top:calc(100% + 5px); left:0; min-width:210px; max-width:280px;
  background:var(--surface); border:1px solid var(--line-hi); border-radius:10px;
  box-shadow:0 12px 32px -12px rgba(42,29,8,.4); z-index:200; padding:7px 0;
}
[data-theme="dark"] .cb-panel { box-shadow:0 16px 40px -16px rgba(0,0,0,.7); }
.cb-panel.open { display:block; }
.cb-search { padding:5px 9px 7px; }
.cb-search input {
  width:100%; padding:5px 9px; font-size:11px; border:1px solid var(--line-hi);
  border-radius:6px; outline:none; box-sizing:border-box; background:var(--surface-hi); color:var(--text);
}
.cb-search input:focus { border-color:var(--gold); }
.cb-all-row {
  display:flex; align-items:center; gap:7px; padding:5px 13px 7px; font-size:11px; font-weight:600;
  color:var(--text); border-bottom:1px solid var(--line); cursor:pointer;
}
.cb-all-row:hover { background:var(--surface-hi); }
.cb-list { max-height:230px; overflow-y:auto; }
.cb-item { display:flex; align-items:center; gap:7px; padding:5px 13px; font-size:11px; color:var(--text); cursor:pointer; }
.cb-item:hover, .cb-item.active { background:var(--gold-wash); }
.cb-item.sel { background:var(--gold-wash); color:var(--gold); font-weight:700; }
.cb-item input, .cb-all-row input { cursor:pointer; accent-color:var(--gold); }
.cb-hint { padding:0 13px 5px; font-size:10px; color:#94a3b8; min-height:12px; }

/* Shared brand/customer identities are visual labels only; the filter controls
   keep their original plain-text values and textContent search behaviour. */
.sales-identity{display:inline-flex;align-items:center;gap:6px;min-width:0;max-width:100%;vertical-align:middle;}
.sales-identity-mark{display:grid;place-items:center;position:relative;flex:0 0 24px;width:24px;height:24px;border:1px solid color-mix(in srgb,var(--identity-color) 45%,var(--line));border-radius:6px;background:color-mix(in srgb,var(--identity-color) 12%,var(--surface));color:var(--identity-color);font-family:'JetBrains Mono',monospace;font-size:8px;font-weight:800;overflow:hidden;}
.sales-identity-mark img{position:absolute;inset:3px;width:calc(100% - 6px);height:calc(100% - 6px);object-fit:contain;border-radius:4px;background:var(--surface);}
.sales-identity-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
@media (max-width:768px){.sales-identity{gap:5px}.sales-identity-mark{flex-basis:20px;width:20px;height:20px;border-radius:5px;font-size:7px}.sales-identity-mark img{inset:2px;width:calc(100% - 4px);height:calc(100% - 4px);border-radius:3px;}}

/* Desktop filter compaction (G-1). The <=768px/mobile behavior stays untouched. */
@media (min-width:769px) {
  /* Match the compact selector bar in the approved mockup: each selected
     value reads as a quiet outlined control, while the existing row/cue
     structure continues to own desktop overflow. */
  .sec .fbar { gap:8px; padding:9px; border-radius:9px; box-shadow:0 5px 14px -12px rgba(15,23,42,.28); }
  .fbar { row-gap:6px; column-gap:8px; align-items:center; }
  .fbar label { gap:6px; font-family:'JetBrains Mono',ui-monospace,monospace; font-size:9.5px; font-weight:600; }
  .fbar > label:not(.fl) { flex:0 1 auto; min-width:120px; flex-direction:row; align-items:center; }
  .fbar select.fs { width:auto; min-width:120px; min-height:28px; padding:5px 20px 5px 8px; border-color:var(--line); border-radius:6px; background-color:var(--surface-hi); background-position: right 12px top 52%, right 7px top 52%; box-shadow:inset 0 1px 0 rgba(255,255,255,.42); }
  .fbar select.fs.prod { min-width:200px; }
  .fbar .cb-drop.prod { min-width:200px; }
  .cb-drop.prod .cb-panel { min-width:320px; max-width:420px; }
  .fbar .cb-drop { flex:0 1 auto; min-width:120px; max-width:240px; display:flex; flex-direction:row; align-items:center; gap:6px; }
  .cb-field-label { font-family:'JetBrains Mono',ui-monospace,monospace; font-size:9.5px; font-weight:600; }
  .fbar .cb-btn { width:auto; min-width:120px; min-height:28px; padding:5px 8px; border-color:var(--line); border-radius:6px; background:var(--surface-hi); box-shadow:inset 0 1px 0 rgba(255,255,255,.42); }
  .fbar .cb-lbl { max-width:96px; }
  .fbar .fl { flex:0 1 auto; min-width:140px; align-items:center; flex-direction:row; flex-wrap:wrap; gap:4px 6px; }
  .fl-label { flex:0 0 auto; white-space:nowrap; font-weight:600; }
  .fbar .pillbar { width:auto; min-width:0; gap:3px; padding:0; border:none; background:transparent; }
  .fbar .pill { min-height:26px; padding:3px 6px; border-radius:999px; font-family:'JetBrains Mono',ui-monospace,monospace; font-size:9.5px; }
  .fbar .pillbar-sm { min-width:90px; max-width:170px; }
  .fbar .rst, .fbar .tb { flex:0 0 auto; padding:5px 8px !important; border-radius:999px; background:transparent; }
}

/* ════════ Password Modal ════════ */
dialog.pw-modal {
  position:fixed; top:50%; left:50%; transform:translate(-50%,-50%);
  border:none; border-radius:14px; padding:0; background:transparent; box-shadow:none;
  max-width:380px; width:90%;
}
dialog.pw-modal::backdrop { background:rgba(14,10,8,.92); backdrop-filter:blur(7px); }
.pw-box { background:#1d1612; border-radius:14px; padding:36px; border:1px solid rgba(239,230,216,.18); box-shadow:0 30px 70px -30px rgba(0,0,0,.85); }
.pw-brand { font-family:'Fraunces', Georgia, serif; font-size:23px; font-weight:600; color:#f4ecdd; letter-spacing:-.02em; margin-bottom:5px; }
.pw-sub { font-family:'JetBrains Mono', monospace; font-size:10px; color:#ffd27a; margin-bottom:24px; line-height:1.5; text-transform:uppercase; letter-spacing:.12em; }
.pw-box input { width:100%; padding:11px 14px; border-radius:8px; border:1px solid rgba(239,230,216,.18); background:#0e0a08; color:#f4ecdd; font-size:13px; outline:none; margin-bottom:12px; font-family:'Inter', sans-serif; }
.pw-box input:focus { border-color:#f0b340; }
.pw-box button { width:100%; padding:11px; border-radius:8px; border:none; background:#f0b340; color:#2a1d08; font-size:13px; font-weight:700; cursor:pointer; transition:background .15s; font-family:'Inter', sans-serif; }
.pw-box button:hover:not(:disabled) { background:#ffd27a; }
.pw-box button:disabled { opacity:.5; cursor:not-allowed; }
.pw-err { color:#f08a8a; font-family:'JetBrains Mono', monospace; font-size:10.5px; margin-bottom:10px; min-height:1.3em; }

/* ── Light-mode password modal ── */
[data-theme="light"] .pw-box {
  background:#f6ecd6; border-color:#e2d2b1;
  box-shadow:0 30px 70px -30px rgba(42,29,8,.22);
}
[data-theme="light"] .pw-brand { color:#2a1d08; }
[data-theme="light"] .pw-sub { color:#8c6418; }
[data-theme="light"] .pw-box input {
  background:#fffaf0; border-color:#e2d2b1; color:#2a1d08;
}
[data-theme="light"] .pw-box input::placeholder { color:#b8a98f; }
[data-theme="light"] .pw-box input:focus { border-color:#c79433; }
[data-theme="light"] .pw-box button { background:#c79433; color:#2a1d08; }
[data-theme="light"] .pw-box button:hover:not(:disabled) { background:#8c6418; color:#fff8ed; }
[data-theme="light"] .pw-err { color:#b91c1c; }

/* ════════ Responsive ════════ */
@media (max-width:1180px) {
  .g5 { grid-template-columns:repeat(3,1fr); }
  .g4 { grid-template-columns:repeat(2,1fr); }
  .g21, .g12 { grid-template-columns:1fr; }
  .s3-channel-board { grid-template-columns:1fr; }
  .dim-mini-row { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .s1-impact-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .insight-hero-split, .insight-driver-grid { grid-template-columns:1fr; }
  .insight-hero-split { height:auto; }
  .insight-kpi-panel, .insight-leader-panel { overflow:visible; }
  .insight-brand-mix-chart { height:auto; min-height:200px; max-height:480px; }
}
@media (max-width:768px) {
  html, body { overflow-x:hidden; }
  .g5, .g4, .g3, .g2, .g7 { grid-template-columns:1fr; }
  .s1-impact-grid {
    display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px;
  }
  .s1-impact-card { min-height:112px; padding:13px 12px; }
  .insight-kpi-panel, .insight-leader-panel { padding:15px; }
  .insight-kpi-panel h2 { font-size:23px; }
  .insight-primary-grid { grid-template-columns:1fr; gap:12px; }
  .insight-latest-kpi { display:block; }
  .insight-latest-comparisons { flex-direction:row; flex-wrap:wrap; gap:5px 8px; margin-top:6px !important; }
  .insight-support-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; }
  .insight-support-kpi small { display:none; }
  .insight-signal-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); grid-template-rows:none; gap:8px; overflow:visible; padding:0; }
  .insight-signal { min-height:108px; padding:9px; }
  .insight-signal-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .insight-signal-kpis > span:first-child { grid-column:1 / -1; }
  .insight-section-head { display:block; }
  .insight-section-head p { margin-top:5px; text-align:left; }
  .insight-product-head { display:block; }
  .insight-product-head .tabs { display:flex; width:100%; margin-top:10px; }
  .insight-product-head .tb { flex:1 1 0; }
  .insight-card-head { display:block; }
  .insight-card-head .tabs { display:flex; width:100%; margin-top:10px; }
  .insight-card-head .tb { flex:1 1 0; }
  .insight-brand-mix-chart { height:auto; min-height:180px; max-height:430px; }
  .insight-performance-stack { grid-template-rows:none; }
  .metric-switch-head { display:grid; grid-template-columns:1fr; align-items:start; gap:7px; }
  .metric-switch-head .tabs { width:100%; }
  .metric-switch-head .tb { flex:1 1 0; }
  .compare-layout { grid-template-columns:1fr !important; gap:10px !important; }
  .compare-filter-grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
  .compare-divider {
    display:grid !important; grid-template-columns:auto 1fr 1fr; align-items:center;
    justify-items:center; padding:4px 0 !important; gap:8px !important;
  }
  .compare-divider > :nth-child(2) { grid-row:1; grid-column:1; }
  .compare-divider > :first-child { grid-row:1; grid-column:2 / -1; }
  .s3-mini-grid { grid-template-columns:1fr; }
  .s3-channel-main, .s3-channel-side { padding:14px; }
  .dim-mini-row { grid-template-columns:1fr; }
  .dim-mini-card { padding:12px; }
  .g7:has(> .kpi),
  .g5:has(> .kpi),
  .g4:has(> .kpi),
  .g3:has(> .kpi) {
    display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; padding:0;
  }
  .g7:has(> .kpi) > .kpi,
  .g5:has(> .kpi) > .kpi,
  .g4:has(> .kpi) > .kpi,
  .g3:has(> .kpi) > .kpi {
    min-width:0; min-height:92px; padding:13px 12px 11px;
  }
  .g7:has(> .kpi) > .kpi:first-child,
  .g5:has(> .kpi) > .kpi:first-child,
  .g4:has(> .kpi) > .kpi:first-child,
  .g3:has(> .kpi) > .kpi:first-child { margin-left:0; }
  .pad { padding:12px 12px 30px; }
  .topbar {
    min-height:54px; align-items:center; flex-wrap:nowrap;
    padding:9px 12px; gap:8px;
  }
  .tb-left { flex:1 1 auto; min-width:0; gap:9px; }
  .tb-title {
    min-width:0; overflow:hidden; font-size:16px; line-height:1.2;
    text-overflow:ellipsis; white-space:nowrap;
  }
  .tb-right { width:auto; flex:0 0 auto; justify-content:flex-end; flex-wrap:nowrap; gap:6px; }
  .sb-toggle-btn { width:36px; height:36px; min-height:36px; }
  #numfmt-btn { max-width:66px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .tabs {
    display:flex; width:100%; max-width:100%; flex-wrap:nowrap;
    overflow-x:auto; overflow-y:hidden; margin-bottom:14px;
    border-radius:10px; scrollbar-width:none; -webkit-overflow-scrolling:touch;
  }
  .tabs::-webkit-scrollbar { display:none; }
  .tabs .tb { flex:0 0 auto; min-height:36px; padding:8px 13px; white-space:nowrap; }
  /* Task 3-1 (2026-09-17 pass) — icon toggle (a "+" glyph that rotates 45deg into a "×", not a
     text pill) replacing the old "Filters (n) /" pill. Company (row 1's first control, tagged by
     setupMobileFilterToggles() in sales_dashboard.html) and the whole Year/Month row (fbar-row2)
     stay always visible; only the other row-1 filters (tagged .fbar-collapsible-item) collapse. */
  .mobile-filter-toggle {
    display:inline-flex; align-items:center; justify-content:center;
    position:relative; flex:0 0 auto; width:34px; height:34px; padding:0;
    border-radius:8px; border:1px solid var(--line-hi); background:var(--surface-hi);
    color:var(--text-mute); cursor:pointer;
  }
  .mobile-filter-toggle .mft-icon {
    display:inline-block; font-size:19px; line-height:1; font-weight:600; transition:transform .15s;
  }
  .mobile-filter-shell.open .mobile-filter-toggle .mft-icon { transform:rotate(45deg); }
  .mobile-filter-toggle .mft-badge {
    position:absolute; top:-6px; right:-6px; min-width:16px; height:16px; padding:0 3px;
    border-radius:999px; background:var(--gold); color:var(--gold-ink);
    font-family:'JetBrains Mono',monospace; font-size:9.5px; font-weight:700; line-height:16px; text-align:center;
  }
  .mobile-filter-toggle .mft-badge:empty { display:none; }
  /* Overview's rows are .home-filter-primary / .home-filter-period; everywhere else
     they are .fbar-row1 / .fbar-row2. Same collapse, two sets of row names. */
  .mobile-filter-shell:not(.open) .fbar-row1 > .fbar-collapsible-item,
  .mobile-filter-shell:not(.open) .home-filter-primary > .fbar-collapsible-item { display:none !important; }
  .fbar {
    align-items:stretch; padding:8px; margin-bottom:14px; border-radius:10px;
    max-height:calc(100dvh - 76px); overflow-y:auto; overscroll-behavior:contain;
  }
  .fbar-row1, .fbar-row2 {
    display:grid; grid-template-columns:repeat(2,minmax(0,1fr));
    align-items:start; gap:9px; width:100%;
  }
  .fbar-row2 { grid-template-columns:1fr; padding-top:2px; }
  .fbar label, .fl { width:100%; min-width:0; align-items:flex-start; flex-direction:column; gap:4px; }
  .cb-drop { display:flex; flex-direction:column; align-items:flex-start; gap:4px; }
  select.fs, .fbar select.fs, .pillbar, .pillbar-sm, .cb-drop, .fbar .cb-drop, .cb-btn { width:100%; max-width:none; }
  select.fs, .cb-btn, .rst, .pill { min-height:40px; }
  .fbar .rst { width:100%; }
  .fbar .pillbar { display:flex; flex-wrap:nowrap; overflow-x:auto; padding:4px; }
  .fbar .pill { flex:0 0 auto; display:inline-flex; align-items:center; justify-content:center; }
  .pillbar-sm { max-height:96px; }
  .cb-panel { position:fixed; left:12px; right:12px; bottom:14px; top:auto; min-width:0; max-width:none; max-height:70vh; overflow:auto; z-index:400; }
  .card { padding:13px; border-radius:11px; }
  .tbl-wrap {
    overflow-x:auto; overscroll-behavior-inline:contain;
    -webkit-overflow-scrolling:touch; border:1px solid var(--line);
  }
  table { width:max-content; min-width:100%; }
  th, td { padding:7px 8px; }
  body { padding-bottom:70px; }
  .bottom-nav {
    position:fixed; left:0; right:0; bottom:0; z-index:260;
    display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:4px;
    overflow:hidden; padding:6px 8px calc(7px + env(safe-area-inset-bottom));
    background:var(--ink-0); border-top:1px solid var(--ink-line-hi);
    box-shadow:0 -10px 24px -18px rgba(0,0,0,.65); max-width:100vw; contain:paint;
  }
  .bottom-nav-item {
    min-width:0; min-height:50px; padding:5px 4px; border-radius:8px;
    color:var(--ink-mute); font-size:9px; font-weight:600; text-align:center;
    display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px;
    white-space:nowrap;
  }
  .bottom-nav-item .bi { font-size:16px; line-height:1; }
  .bottom-nav-item.on { color:var(--ink-gold-soft); background:rgba(45,212,191,.12); }
  /* On mobile the sidebar becomes a full-height overlay (off-canvas) */
  .sb {
    position:fixed; left:0; top:0; z-index:300;
    transform:translateX(-100%); transition:transform .22s ease, opacity .18s ease;
    width:228px; opacity:1; pointer-events:auto;
    box-shadow:4px 0 24px rgba(0,0,0,.35);
  }
  /* When NOT collapsed (= open), slide in */
  .sb:not(.collapsed) { transform:translateX(0); }
  /* When collapsed, stay off-screen */
  .sb.collapsed { transform:translateX(-100%); opacity:0; pointer-events:none; }
  /* Main always takes full width on mobile */
  .main { margin-left:0 !important; }
  .main.sb-collapsed { margin-left:0; }
  /* Overlay backdrop when sidebar open */
  .sb-backdrop {
    display:none; position:fixed; inset:0; z-index:299;
    background:rgba(0,0,0,.45);
  }
  .sb-backdrop.on { display:block; }
}
@media (max-width:480px) {
  /* Analytical tables and charts need the full phone width. KPI groups are
     still converted to horizontal carousels by the :has(> .kpi) rules above. */
  .g3 { grid-template-columns:1fr; }
  .compare-filter-grid { grid-template-columns:1fr !important; }
  .kpi-lbl { font-size:9px; letter-spacing:.1em; }
  .kpi-val { font-size:22px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .kpi-sub { font-size:10px; }
  .pad { padding:10px 10px 26px; }
  .topbar { padding:8px 10px; }
  .tb-title { font-size:15px; }
  .fbar-row1 { grid-template-columns:1fr; }
  /* Tap-friendly */
  .pw-box input { min-height:44px; }
  .pw-box button { min-height:44px; }
  /* Table horizontal scroll */
  .tbl-wrap { overflow-x:auto; -webkit-overflow-scrolling:touch; }
  /* Chart height on phone */
  .h220 { height:180px; } .h240 { height:180px; } .h260 { height:200px; }
  .h280 { height:200px; } .h300 { height:220px; } .h320 { height:220px; }
  .h340 { height:240px; } .h380 { height:240px; }
}

/* ════════ S-2: Peek panel (right-side slide-in product detail) ════════
   Reusable component — also used by Mall's M-9 with its own palette override
   (espresso/gold) via [data-peek-theme="mall"] on .peek-panel. */
/* Detail and Online leaders deliberately sit on the page canvas, like the
   Overview highlights. The tinted signal cards keep their own border/tone. */
.insight-leader-panel {
  padding:0;
  border:0;
  background:transparent;
  box-shadow:none;
  overflow:visible;
}

/* Task 3-1 mockup correction: the wireframe's chrome is one compact dark
   letterhead plus a single white selector tray. Keep the real controls and
   handlers; only compose their existing label/value pieces as one pill. */
.topbar {
  height:36px;
  min-height:36px;
  padding:6px 12px;
  background:#1d1612;
  border-bottom:1px solid rgba(239,230,216,.14);
  box-shadow:none;
  color:#f4ecdd;
}
.tb-left { gap:6px; }
.tb-title {
  font-family:'JetBrains Mono',ui-monospace,monospace;
  font-size:10px;
  font-weight:700;
  line-height:1.2;
  letter-spacing:.04em;
  color:#f4ecdd;
}
.tb-right { gap:3px; }
.topbar .sb-toggle-btn {
  width:auto;
  min-width:24px;
  height:24px;
  min-height:24px;
  padding:0 3px;
  border:0;
  border-radius:4px;
  background:transparent;
  color:#f4ecdd;
  font-family:'JetBrains Mono',ui-monospace,monospace;
  font-size:10px;
  font-weight:700;
}
.topbar .sb-toggle-btn:hover {
  color:#ffd27a;
  border-color:transparent;
  background:rgba(255,255,255,.06);
}
.topbar .sb-toggle-btn:focus-visible {
  outline:2px solid #ffd27a;
  outline-offset:1px;
}

@media (min-width:769px) {
  .sec .fbar {
    /* Filter-bar pill tokens map to this dashboard's own theme tokens (defined
       above in :root / [data-theme]) — not the design mockup's parchment/gold
       palette. This keeps light/dark switching automatic with no per-theme
       override block needed here. */
    --fbar-surface:var(--surface);
    --fbar-control:var(--surface-hi);
    --fbar-line:var(--line-hi);
    --fbar-text:var(--text-mute);
    --fbar-active:var(--gold);
    --fbar-active-ink:var(--gold-ink);
    display:flex;
    flex-direction:row;
    flex-wrap:nowrap;
    align-items:center;
    gap:8px;
    padding:9px;
    background:var(--fbar-surface);
    border:1px solid var(--line);
    border-radius:9px;
    box-shadow:none;
  }
  .sec .fbar > .filter-scroll-shell {
    width:100%;
    flex:1 1 auto;
    min-width:0;
    display:flex;
    align-items:center;
    gap:8px;
  }
  .sec .fbar > .filter-scroll-shell[data-scrollable="true"]::after {
    display:none;
  }
  .sec .fbar > .filter-scroll-shell[data-scrollable="true"] .fbar-row1,
  .sec .fbar > .filter-scroll-shell[data-scrollable="true"] .fbar-row2 {
    padding-right:0;
  }
  .sec .fbar:has(> .filter-scroll-shell[data-scrollable="true"])::after {
    content:'Scroll \2194';
    position:absolute;
    top:1px;
    right:1px;
    bottom:1px;
    width:58px;
    display:flex;
    align-items:center;
    justify-content:flex-end;
    padding-right:6px;
    border-radius:0 8px 8px 0;
    background:linear-gradient(90deg,rgba(255,255,255,0),var(--fbar-surface) 62%);
    box-shadow:-12px 0 10px -9px rgba(15,23,42,.28);
    color:var(--fbar-text);
    font-family:'JetBrains Mono',ui-monospace,monospace;
    font-size:8.5px;
    font-weight:700;
    pointer-events:none;
    z-index:2;
  }
  .fbar-row1,
  .fbar-row2 {
    width:auto;
    gap:8px;
  }
  .fbar-row1 > label,
  .fbar-row1 > .cb-drop {
    min-width:0;
    min-height:28px;
    padding:0 7px;
    border:1px solid var(--fbar-line);
    border-radius:6px;
    background:var(--fbar-control);
    box-shadow:inset 0 1px 0 rgba(255,255,255,.42);
    display:inline-flex;
    align-items:center;
    flex-direction:row;
    gap:2px;
    white-space:nowrap;
    font-family:'JetBrains Mono',ui-monospace,monospace;
    font-size:9.5px;
    font-weight:500;
    color:var(--fbar-text);
  }
  .fbar-row1 > label:focus-within,
  .fbar-row1 > .cb-drop:focus-within {
    border-color:var(--fbar-active);
    outline:2px solid color-mix(in srgb,var(--fbar-active) 32%,transparent);
    outline-offset:1px;
  }
  .fbar-row1 > label > select.fs {
    width:auto;
    min-width:42px;
    max-width:90px;
    min-height:26px;
    padding:0 14px 0 2px;
    border:0;
    border-radius:0;
    background-color:transparent;
    background-position:right 8px top 52%,right 3px top 52%;
    box-shadow:none;
    font-family:inherit;
    font-size:inherit;
    font-weight:inherit;
  }
  .fbar-row1 > label > select.fs.prod { max-width:150px; }
  .fbar-row1 > .cb-drop.prod { max-width:190px; }
  .fbar-row1 > .cb-drop .cb-field-label {
    font-family:inherit;
    font-size:inherit;
    font-weight:inherit;
  }
  .fbar-row1 > .cb-drop .cb-btn {
    width:auto;
    min-width:32px;
    min-height:26px;
    padding:0;
    border:0;
    border-radius:0;
    background:transparent;
    box-shadow:none;
    font-family:inherit;
    font-size:inherit;
  }
  .fbar-row1 > .cb-drop .cb-lbl { max-width:100px; }
  .fbar-row2 .fl-label { display:none; }
  .fbar-row2 .fl { min-width:0; gap:4px; flex-wrap:nowrap; }
  .fbar-row2 .pillbar { flex-wrap:nowrap; overflow-x:auto; }
  .fbar-row2 .pill { min-height:26px; padding:3px 7px; }
  .fbar-row2 .pill.on,
  .fbar-row2 .pill-all.on { background:var(--fbar-active); border-color:var(--fbar-active); color:var(--fbar-active-ink); }
}

@media (max-width:768px) {
  .topbar { height:36px; min-height:36px; padding:6px 10px; }
  .tb-left { gap:5px; }
  .tb-title { font-size:10px; }
  .tb-right { gap:2px; }
  .topbar .sb-toggle-btn { width:auto; min-width:24px; height:24px; min-height:24px; padding:0 3px; }
  #numfmt-btn { display:none; }
  .sec .fbar {
    --fbar-control:var(--surface-hi);
    --fbar-line:var(--line-hi);
    --fbar-text:var(--text-mute);
    display:block;
  }
  .sec .fbar > .filter-scroll-shell {
    display:grid;
    grid-template-columns:minmax(96px,1fr) minmax(140px,1.55fr) 34px;
    align-items:center;
    gap:8px;
    width:100%;
    overflow:visible;
  }
  .fbar-row1,
  .fbar-row2 { display:contents; }
  .fbar-row1 > :first-child {
    grid-column:1;
    grid-row:1;
    display:flex;
    flex-direction:row;
    align-items:center;
    gap:2px;
    width:auto;
    min-width:0;
    min-height:34px;
    padding:0 7px;
    border:1px solid var(--fbar-line);
    border-radius:6px;
    background:var(--fbar-control);
    color:var(--fbar-text);
  }
  .fbar-row1 > :first-child .cb-field-label {
    font-family:'JetBrains Mono',ui-monospace,monospace;
    font-size:9.5px;
    font-weight:500;
  }
  .fbar-row1 > :first-child .cb-btn {
    width:auto;
    min-width:30px;
    min-height:32px;
    padding:0;
    border:0;
    border-radius:0;
    background:transparent;
  }
  .fbar-row1 > .mobile-filter-toggle {
    grid-column:3;
    grid-row:1;
    width:34px;
    min-width:34px;
  }
  .fbar-row2 > .fl:first-child {
    grid-column:2;
    grid-row:1;
    display:flex;
    flex-direction:row;
    align-items:center;
    gap:0;
    width:auto;
    min-width:0;
  }
  .fbar-row2 > .fl:first-child .fl-label { display:none; }
  .fbar-row2 > .fl:first-child .pillbar {
    width:100%;
    padding:0;
    border:0;
    background:transparent;
    flex-wrap:nowrap;
    overflow-x:auto;
  }
  .fbar-row2 > .fl:first-child .pill { min-height:30px; padding:4px 8px; }
  /* .fbar-actions has no placement in the 3-column mobile grid above, so it auto
     placed into the Year row's first cell and the Reset button rendered on top of
     the year pills (measured on s4: Reset 138-188px over pills 140-268px). Give it
     its own full-width row. Sections are listed rather than using a bare
     .fbar-row2 > .fbar-actions because #sec-s3 is a do-not-touch zone. */
  #sec-s1 .fbar-row2 > .fbar-actions,
  #sec-s2 .fbar-row2 > .fbar-actions,
  #sec-s4 .fbar-row2 > .fbar-actions,
  #sec-s5 .fbar-row2 > .fbar-actions,
  #sec-cat .fbar-row2 > .fbar-actions,
  #sec-s6 .fbar-row2 > .fbar-actions { grid-column:1 / -1; }
  .mobile-filter-shell:not(.open) .fbar-row2 > .fl:not(:first-child),
  .mobile-filter-shell:not(.open) .home-filter-period > .fl:not(:first-child) { display:none; }
  .mobile-filter-shell.open .fbar-row1 > .fbar-collapsible-item,
  .mobile-filter-shell.open .fbar-row2 > .fl:not(:first-child) {
    grid-column:1 / -1;
    width:100%;
  }
  /* Home's rows are flex, not the shared grid, so the reopened controls only need
     to go full width. grid-column would be inert here. */
  .mobile-filter-shell.open .home-filter-primary > .fbar-collapsible-item,
  .mobile-filter-shell.open .home-filter-period > .fl:not(:first-child) { width:100%; }
}
.peek-backdrop {
  display:none; position:fixed; inset:0; z-index:400;
  background:rgba(11,17,32,.45); backdrop-filter:blur(2px);
}
.peek-backdrop.on { display:block; }
.peek-panel {
  position:fixed; top:0; right:0; bottom:0; z-index:401;
  width:420px; max-width:92vw;
  background:
    radial-gradient(circle at 88% -30%, rgba(45,212,191,.22), transparent 42%),
    linear-gradient(135deg,var(--ink-1),var(--ink-0));
  border-left:1px solid var(--ink-line-hi);
  color:var(--ink-text);
  box-shadow:-24px 0 60px -20px rgba(0,0,0,.35);
  transform:translateX(100%); transition:transform .22s ease;
  display:flex; flex-direction:column; overflow:hidden;
}
.peek-panel.on { transform:translateX(0); }
.peek-head {
  display:flex; justify-content:space-between; align-items:flex-start;
  gap:12px; padding:20px 20px 14px; border-bottom:1px solid var(--ink-line-hi);
  flex-shrink:0;
}
.peek-title { font-family:'Fraunces', Georgia, serif; font-size:17px; font-weight:600; color:var(--ink-text); line-height:1.3; }
.peek-sub { font-size:11px; color:var(--ink-mute); margin-top:4px; font-family:'JetBrains Mono', monospace; }
.peek-close {
  flex-shrink:0; width:28px; height:28px; border-radius:8px; border:1px solid var(--ink-line-hi);
  background:rgba(255,255,255,.08); color:var(--ink-mute); font-size:14px; line-height:1; cursor:pointer;
  display:flex; align-items:center; justify-content:center; transition:all .12s;
}
.peek-close:hover { color:var(--ink-text); border-color:var(--ink-gold-soft); background:rgba(45,212,191,.14); }
.peek-body { flex:1; overflow-y:auto; padding:18px 20px 28px; display:flex; flex-direction:column; gap:16px; }
.peek-kpi-row { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.peek-kpi { background:rgba(255,255,255,.07); border:1px solid var(--ink-line-hi); border-radius:10px; padding:11px 13px; }
.peek-kpi-lbl { font-size:9.5px; color:var(--ink-mute); text-transform:uppercase; letter-spacing:.08em; font-family:'JetBrains Mono', monospace; margin-bottom:5px; }
.peek-kpi-val { font-family:'JetBrains Mono', monospace; font-size:17px; font-weight:700; color:var(--ink-text); }
.peek-section-title { font-size:11px; font-weight:700; color:var(--ink-gold-soft); text-transform:uppercase; letter-spacing:.06em; margin-bottom:8px; }
.peek-chart-wrap { position:relative; height:150px; }
.peek-mini-tbl { width:100%; border-collapse:collapse; font-size:11.5px; }
.peek-mini-tbl th { text-align:left; padding:6px 4px; font-size:9.5px; color:var(--ink-mute); text-transform:uppercase; letter-spacing:.05em; border-bottom:1px solid var(--ink-line-hi); font-family:'JetBrains Mono', monospace; }
.peek-mini-tbl th.r, .peek-mini-tbl td.r { text-align:right; }
.peek-mini-tbl td { padding:6px 4px; border-bottom:1px solid var(--ink-line); color:var(--ink-text); }
.peek-mini-tbl tr:last-child td { border-bottom:none; }
.peek-row { cursor:pointer; }
.peek-row:hover td { background:rgba(45,212,191,.12); }
@media (max-width:480px) {
  .peek-panel { width:100vw; max-width:100vw; }
}
