/* fizzwizz: chart roles from a validated palette (blue line, blue/red diverging, fixed status colors). */
.viz-root {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface-1: #1a1a19;
  --surface-2: #232321;
  --text-primary: #f0efec;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --series-1: #3987e5;
  --ref: #898781;
  --wash: rgba(57, 135, 229, 0.12);
  --good-text: #0ca30c;
  --bad-text: #e66767;
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --hover: rgba(255, 255, 255, 0.05);
  --glow: radial-gradient(1200px 400px at 15% -10%, rgba(57, 135, 229, 0.16), transparent 60%);
}
@media (prefers-color-scheme: light) {
  .viz-root {
    color-scheme: light;
    --page: #f9f9f7; --surface-1: #fcfcfb; --surface-2: #f3f3f0;
    --text-primary: #0b0b0b; --text-secondary: #52514e; --text-muted: #6f6e69;
    --grid: #e1e0d9; --axis: #c3c2b7; --border: rgba(11, 11, 11, 0.10);
    --series-1: #2a78d6; --ref: #898781; --wash: rgba(42, 120, 214, 0.10);
    --good-text: #006300; --bad-text: #c42e2e; --hover: rgba(11, 11, 11, 0.04);
    --glow: radial-gradient(1200px 400px at 15% -10%, rgba(42, 120, 214, 0.10), transparent 60%);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
html, body { margin: 0; }
body {
  background: var(--glow), var(--page);
  background-repeat: no-repeat;
  color: var(--text-primary);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; border-radius: 4px; }

.demo-banner {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--status-warning); color: #0b0b0b; padding: 8px 16px; font-size: 13.5px; text-align: center;
}
.demo-icon {
  display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  background: #0b0b0b; color: var(--status-warning); font-weight: 800; font-size: 12px; flex: none;
}

.top {
  max-width: 1120px; margin: 0 auto; padding: 18px 24px;
  display: flex; align-items: center; gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 28px; height: 28px; }
.brand-mark rect { fill: var(--surface-2); stroke: var(--border); }
.brand-mark path { fill: none; stroke: var(--series-1); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.brand-name { font-weight: 680; letter-spacing: -0.01em; font-size: 16px; }
.nav { display: flex; gap: 18px; font-size: 14px; }
.nav a { color: var(--text-secondary); text-decoration: none; }
.nav a:hover { color: var(--text-primary); }
.status {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-secondary); background: var(--surface-1);
  padding: 6px 11px; border-radius: 99px; box-shadow: inset 0 0 0 1px var(--border);
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); flex: none; }
.status.ok .status-dot { background: var(--status-good); }
.status.stale .status-dot { background: var(--status-warning); }
.status.stale { color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--status-warning); }
.status.demo .status-dot { background: var(--status-warning); }

main { max-width: 1120px; margin: 0 auto; padding: 0 24px 40px; display: grid; gap: 22px; }

.hero { padding: 28px 0 6px; }
.eyebrow { margin: 0 0 14px; color: var(--text-muted); font-size: 12.5px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; }
.hero-grid { display: grid; grid-template-columns: minmax(280px, 1fr) 1.6fr; gap: 28px; align-items: end; }
.hero-value { font-size: clamp(44px, 7vw, 72px); font-weight: 680; letter-spacing: -0.035em; line-height: 1; margin: 8px 0 10px; }
.hero-sub { color: var(--text-secondary); font-size: 14px; }
.hero-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi { background: var(--surface-1); border-radius: 12px; padding: 14px 16px; box-shadow: inset 0 0 0 1px var(--border); min-width: 0; }
.kpi-value { font-size: 22px; font-weight: 640; letter-spacing: -0.01em; margin-top: 4px; }
.label { color: var(--text-secondary); font-size: 13px; font-weight: 520; }
.caption { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.pos { color: var(--good-text); }
.neg { color: var(--bad-text); }

.perf { display: grid; gap: 14px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.dates { display: flex; gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; box-shadow: inset 0 0 0 1px var(--border); flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  font-size: 13px; font-weight: 560; color: var(--text-secondary); min-height: 32px;
}
.seg button:hover { background: var(--hover); }
.seg button[aria-pressed="true"] { background: var(--surface-1); color: var(--text-primary); box-shadow: 0 0 0 1px var(--border); }
.field { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 13px; }
.field input { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; font-size: 13px; min-height: 32px; }

.card { background: var(--surface-1); border-radius: 16px; padding: 20px 22px; box-shadow: inset 0 0 0 1px var(--border); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
h2 { margin: 0; font-size: 16px; font-weight: 640; }
.sub { margin: 3px 0 0; color: var(--text-muted); font-size: 13px; }

.legend { display: flex; gap: 16px; margin: 12px 0 2px; font-size: 12.5px; color: var(--text-secondary); min-height: 18px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 16px; height: 2px; border-radius: 1px; display: inline-block; }

.chart { position: relative; margin-top: 6px; }
.chart svg { display: block; width: 100%; overflow: visible; touch-action: pan-y; }
.chart .empty { color: var(--text-muted); text-align: center; padding: 80px 0; }
.axis-text { fill: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.grid-line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.base-line { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.series-line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ref-line { fill: none; stroke: var(--ref); stroke-width: 1.5; stroke-linejoin: round; }
.series-area { fill: var(--wash); }
.dot { fill: var(--series-1); stroke: var(--surface-1); stroke-width: 2; }
.dot.ref { fill: var(--ref); }
.cross { stroke: var(--text-muted); stroke-width: 1; shape-rendering: crispEdges; }
.value-text { fill: var(--text-primary); font-size: 12px; font-weight: 640; font-variant-numeric: tabular-nums; }
.watermark { fill: var(--text-primary); opacity: 0.06; font-weight: 800; letter-spacing: 0.2em; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tile { background: var(--surface-1); border-radius: 12px; padding: 14px 16px; box-shadow: inset 0 0 0 1px var(--border); min-width: 0; }
.tile-value { font-size: 20px; font-weight: 640; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.method h2 { font-size: 18px; }
.method-lede { color: var(--text-secondary); margin: 6px 0 18px; max-width: 70ch; }
.defs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 28px; margin: 0; }
.defs dt { font-weight: 640; font-size: 14px; margin-bottom: 3px; }
.defs dd { margin: 0; color: var(--text-secondary); font-size: 13.5px; }
.policy { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--grid); color: var(--text-secondary); font-size: 13.5px; display: grid; gap: 4px; }
.policy strong { color: var(--text-primary); font-weight: 600; }

.foot { max-width: 1120px; margin: 0 auto; padding: 8px 24px 40px; color: var(--text-muted); font-size: 12.5px; }
.foot p { margin: 0 0 4px; }

.tooltip {
  position: fixed; z-index: 40; pointer-events: none; min-width: 160px; max-width: 280px;
  background: var(--surface-2); border-radius: 10px; padding: 9px 11px; font-size: 12.5px;
  box-shadow: 0 0 0 1px var(--border), 0 10px 28px rgba(0, 0, 0, 0.3);
}
.tt-head { color: var(--text-muted); margin-bottom: 4px; }
.tt-row { display: flex; align-items: center; gap: 8px; }
.tt-row + .tt-row { margin-top: 2px; }
.tt-key { width: 12px; height: 2px; border-radius: 1px; flex: none; }
.tt-val { font-weight: 660; font-size: 14px; font-variant-numeric: tabular-nums; }
.tt-name { color: var(--text-secondary); }

@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; align-items: start; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .defs { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  body { font-size: 14px; }
  .top { padding: 14px 16px; gap: 12px; flex-wrap: wrap; }
  .nav { display: none; }
  .status { margin-left: 0; order: 3; width: 100%; justify-content: center; }
  main { padding: 0 16px 32px; gap: 18px; }
  .hero { padding-top: 12px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .defs { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .kpi-value { font-size: 19px; }
  .tile-value { font-size: 17px; }
  .foot { padding: 4px 16px 32px; }
}

.notfound { padding-top: 18vh; text-align: center; }
