.viz-root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface-1: #fcfcfb;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --done: #2a78d6;          /* blue 450 */
  --next: #2a78d6;
  --path-future: #b7d3f6;   /* blue 150 */
  --meter-track: #e1e0d9;
  --good: #0ca30c;
  --critical: #d03b3b;
  --hover: rgba(42, 120, 214, 0.08);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .viz-root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface-1: #1a1a19;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --done: #3987e5;
    --next: #3987e5;
    --path-future: #184f95;
    --meter-track: #383835;
    --hover: rgba(57, 135, 229, 0.14);
  }
}
:root[data-theme="dark"] .viz-root {
  color-scheme: dark;
  --page: #0d0d0d; --surface-1: #1a1a19; --text-primary: #ffffff; --text-secondary: #c3c2b7;
  --text-muted: #898781; --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, 0.10);
  --done: #3987e5; --next: #3987e5; --path-future: #184f95; --meter-track: #383835; --hover: rgba(57, 135, 229, 0.14);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
.viz-root { background: var(--page); color: var(--text-primary); min-height: 100vh; padding: 24px clamp(12px, 3vw, 40px) 60px; line-height: 1.45; }
header h1 { font-size: 22px; margin: 0 0 4px; font-weight: 650; }
.sub { color: var(--text-secondary); margin: 0 0 16px; max-width: 70ch; }
a { color: var(--done); }

.filters { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-bottom: 10px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface-1); }
.seg button { font: inherit; font-size: 13px; padding: 6px 12px; border: 0; background: transparent; color: var(--text-secondary); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button[aria-pressed="true"] { color: var(--text-primary); font-weight: 650; background: var(--hover); }
.check { font-size: 13px; color: var(--text-secondary); display: inline-flex; gap: 6px; align-items: center; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: var(--text-secondary); margin: 4px 0 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

.chart-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 8px 0 4px; overflow-x: auto; }
.chart-card svg { display: block; }
svg text { fill: var(--text-primary); font-family: inherit; }
.t-sec { fill: var(--text-secondary); }
.t-muted { fill: var(--text-muted); }
.t-group { font-weight: 650; font-size: 12px; letter-spacing: .02em; text-transform: uppercase; fill: var(--text-secondary); }
.grid { stroke: var(--grid); stroke-width: 1; }
.axis { stroke: var(--axis); stroke-width: 1; }
.today { stroke: var(--text-muted); stroke-width: 1; }
.path-done { stroke: var(--done); stroke-width: 2; stroke-linecap: round; }
.path-future { stroke: var(--path-future); stroke-width: 2; stroke-linecap: round; }
.m-done { fill: var(--done); stroke: var(--surface-1); stroke-width: 2; }
.m-next { fill: var(--surface-1); stroke: var(--next); stroke-width: 2; }
.m-eff { fill: var(--surface-1); stroke: var(--good); stroke-width: 2; }
.m-eff.past { fill: var(--good); }
.m-force { stroke: var(--good); stroke-width: 2; stroke-linecap: round; }
.m-die { stroke: var(--critical); stroke-width: 2; stroke-linecap: round; fill: none; }
.row-bg { fill: transparent; cursor: pointer; }
.row:hover .row-bg, .row:focus .row-bg { fill: var(--hover); }
.row.selected .row-bg { fill: var(--hover); }
.row:focus { outline: none; }
.row:focus-visible .row-bg { stroke: var(--done); stroke-width: 1.5; }
.hit { fill: transparent; cursor: pointer; }
.meter-track { fill: var(--meter-track); }
.meter-fill { fill: var(--done); }

.tip { position: fixed; z-index: 10; pointer-events: none; background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12px; max-width: 320px; box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.tip .v { font-weight: 700; font-size: 14px; }
.tip .l { color: var(--text-secondary); }
.tip .n { color: var(--text-secondary); margin-top: 4px; }

.detail { margin-top: 18px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.detail:empty { display: none; }
.detail h2 { font-size: 18px; margin: 0 0 2px; }
.detail .meta { color: var(--text-secondary); font-size: 13px; margin-bottom: 8px; }
.detail p { margin: 6px 0; max-width: 80ch; }
.funnel { margin-top: 12px; display: grid; grid-template-columns: minmax(180px, 2.2fr) 110px minmax(140px, 1.2fr) minmax(140px, 1.2fr); gap: 4px 12px; align-items: center; font-size: 13px; }
.funnel .h { color: var(--text-muted); font-size: 12px; }
.funnel .basis { grid-column: 1 / -1; color: var(--text-secondary); font-size: 12px; margin: -2px 0 8px; }
.bar { position: relative; height: 10px; background: var(--meter-track); border-radius: 4px; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--done); border-radius: 4px; }
.bar.cum > i { opacity: .55; }
.pct { font-variant-numeric: tabular-nums; }
.funnel .pct { display: inline-block; min-width: 3.5em; }
.done-list { font-size: 13px; color: var(--text-secondary); margin: 6px 0 0; padding-left: 18px; }
.links { font-size: 13px; margin-top: 8px; }

.tableview { margin-top: 18px; }
.tableview summary { cursor: pointer; font-weight: 600; }
table { border-collapse: collapse; width: 100%; font-size: 13px; margin-top: 8px; background: var(--surface-1); }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--grid); vertical-align: top; }
th { color: var(--text-secondary); font-weight: 600; }
td.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

.method { margin-top: 24px; max-width: 85ch; font-size: 14px; }
.method h2 { font-size: 16px; }
.method li { margin-bottom: 4px; }
