:root {
  color-scheme: light;
  --page: #f9f9f7; --surface: #fcfcfb; --ink: #0b0b0b; --ink-2: #52514e; --muted: #6f6d68;
  --grid: #e1e0d9; --axis: #c3c2b7; --ring: rgba(11, 11, 11, .10);
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --shade: rgba(11, 11, 11, .06); --shade-2: rgba(42, 120, 214, .09);
  --accent: #2a78d6; --up-bad: #b3261e; --up-good: #006300;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --ink: #ffffff; --ink-2: #c3c2b7; --muted: #9a9890;
    --grid: #2c2c2a; --axis: #383835; --ring: rgba(255, 255, 255, .10);
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --shade: rgba(255, 255, 255, .06); --shade-2: rgba(57, 135, 229, .14);
    --accent: #3987e5; --up-bad: #f0645a; --up-good: #0ca30c;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --ink: #ffffff; --ink-2: #c3c2b7; --muted: #9a9890;
  --grid: #2c2c2a; --axis: #383835; --ring: rgba(255, 255, 255, .10);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --shade: rgba(255, 255, 255, .06); --shade-2: rgba(57, 135, 229, .14);
  --accent: #3987e5; --up-bad: #f0645a; --up-good: #0ca30c;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 16px/1.55 var(--font); }
a { color: var(--accent); }
a:focus-visible, button:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap { max-width: 1080px; margin: 0 auto; padding-inline: 16px; }
@media (min-width: 720px) { .wrap { padding-inline: 28px; } }

header.masthead { padding-block: 40px 20px; }
.kicker { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.08; letter-spacing: -.02em; margin: 0 0 12px; font-weight: 700; text-wrap: balance; }
.dek { font-size: 19px; color: var(--ink-2); max-width: 62ch; margin: 0; text-wrap: pretty; }

.controls { position: sticky; top: 0; z-index: 5; background: var(--page); border-bottom: 1px solid var(--grid); }
.controls .wrap { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding-block: 10px; }
.seg { display: inline-flex; border: 1px solid var(--axis); border-radius: 8px; overflow: hidden; }
.seg button { font: inherit; font-size: 14px; background: transparent; color: var(--ink-2); border: 0; padding: 6px 12px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--axis); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--page); }
.ctl-label { font-size: 13px; color: var(--muted); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-block: 24px 8px; }
.tile { background: var(--surface); border: 1px solid var(--ring); border-radius: 12px; padding: 14px 16px; }
.tile .label { font-size: 14px; color: var(--ink-2); margin: 0; }
.tile .value { font-size: 34px; font-weight: 600; line-height: 1.15; margin: 4px 0 2px; }
.tile .value small { font-size: 16px; font-weight: 500; color: var(--ink-2); margin-left: 2px; }
.tile .delta { font-size: 13px; color: var(--muted); margin: 0; font-variant-numeric: tabular-nums; }
.tile .delta b { font-weight: 600; }
.tile .delta .bad { color: var(--up-bad); } .tile .delta .good { color: var(--up-good); }

section.block { margin-block: 44px; }
section.block > h2 { font-size: 24px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -.01em; }
.lede { color: var(--ink-2); max-width: 70ch; margin: 0 0 16px; text-wrap: pretty; }
.lede b { color: var(--ink); font-weight: 600; }

.grid2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 820px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.card { background: var(--surface); border: 1px solid var(--ring); border-radius: 12px; padding: 14px 14px 10px; min-width: 0; }
.card h3 { font-size: 15px; margin: 0; font-weight: 600; }
.card .sub { font-size: 13px; color: var(--muted); margin: 2px 0 6px; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { font-family: var(--font); }
.axis text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.axis path, .axis line { stroke: none; }
.gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.series-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.end-label { font-size: 12px; fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.end-label .v { fill: var(--ink); font-weight: 600; }
.shade-rec { fill: var(--shade); }
.shade-pol { fill: var(--shade-2); }
.crosshair { stroke: var(--muted); stroke-width: 1; shape-rendering: crispEdges; pointer-events: none; }
.dot { stroke: var(--surface); stroke-width: 2; pointer-events: none; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--ink-2); margin: 0 0 6px; padding: 0; list-style: none; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.key-line { width: 16px; height: 2px; border-radius: 1px; display: inline-block; }
.key-box { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.key-box.rec { background: var(--shade); border: 1px solid var(--grid); }
.key-box.pol { background: var(--shade-2); border: 1px solid var(--grid); }

.tip { position: absolute; pointer-events: none; z-index: 4; background: var(--surface); color: var(--ink); border: 1px solid var(--ring);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12); border-radius: 8px; padding: 8px 10px; font-size: 13px; min-width: 150px; white-space: nowrap; }
.tip .when { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.tip .row { display: flex; align-items: center; gap: 8px; }
.tip .row b { font-weight: 600; font-variant-numeric: tabular-nums; }
.tip .row span.n { color: var(--ink-2); }
.tip .note { color: var(--muted); font-size: 12px; margin-top: 4px; }

.state-pick { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 0 0 12px; }
.state-pick select { font: inherit; font-size: 15px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--axis); background: var(--surface); color: var(--ink); max-width: 100%; }
.chip { font: inherit; font-size: 13px; border: 1px solid var(--axis); background: transparent; color: var(--ink-2); padding: 4px 10px; border-radius: 999px; cursor: pointer; }
.chip[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); font-weight: 600; }

.stack-group { margin-bottom: 14px; }
.stack-group h3 { font-size: 15px; margin: 0 0 2px; }
.stack-group .sub { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.stack-row { display: grid; grid-template-columns: 92px 1fr; gap: 10px; align-items: center; margin-bottom: 8px; }
.stack-row .rl { font-size: 13px; color: var(--ink-2); line-height: 1.25; }
.stack-row .rl small { display: block; color: var(--muted); font-size: 11px; }
.bar { display: flex; height: 28px; gap: 2px; }
.seg-fill { height: 100%; position: relative; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 0; outline: none; }
.seg-fill:first-child { border-radius: 4px 0 0 4px; } .seg-fill:last-child { border-radius: 0 4px 4px 0; }
.seg-fill:hover, .seg-fill:focus-visible { filter: brightness(1.12); }
.seg-fill.c1 { background: var(--s1); color: #fff; } .seg-fill.c2 { background: var(--s2); color: #0b0b0b; } .seg-fill.c3 { background: var(--s3); color: #0b0b0b; }

details.table-view { margin-top: 10px; font-size: 14px; }
details.table-view summary { cursor: pointer; color: var(--ink-2); }
.tbl-wrap { max-height: 320px; overflow: auto; margin-top: 8px; border: 1px solid var(--ring); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 6px 10px; text-align: right; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { position: sticky; top: 0; background: var(--surface); color: var(--ink-2); font-weight: 600; }

.note { font-size: 13px; color: var(--muted); max-width: 80ch; }
.methods h3 { font-size: 17px; margin: 24px 0 6px; }
.methods p, .methods li { max-width: 75ch; color: var(--ink-2); }
.methods .tbl-wrap { max-height: none; }
footer { border-top: 1px solid var(--grid); margin-top: 48px; padding-block: 20px 40px; font-size: 13px; color: var(--muted); }
footer p { margin: 4px 0; }
.empty { color: var(--muted); font-size: 14px; padding: 24px 0; }

.dumbbell-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.dumbbell-head .legend { margin: 0; }
.key-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--s1); }
.key-dot.hollow { background: var(--surface); border: 2px solid var(--muted); width: 10px; height: 10px; }
.db-col-title { font-size: 13px; font-weight: 600; fill: var(--ink); }
.db-label { font-size: 13px; fill: var(--ink-2); }
.db-row.total .db-label { fill: var(--ink); font-weight: 600; }
.db-row { cursor: pointer; outline: none; }
.db-row .band { fill: transparent; }
.db-row:hover .band, .db-row:focus-visible .band { fill: var(--shade); }
.db-row.selected .band { fill: var(--shade-2); }
.db-row.selected .db-label { fill: var(--ink); font-weight: 600; }
.db-link { stroke: var(--axis); stroke-width: 2; }
.db-base { fill: var(--surface); stroke: var(--muted); stroke-width: 2; }
.db-now { fill: var(--s1); stroke: var(--surface); stroke-width: 2; }
.db-val { font-size: 12px; fill: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.detail-title { font-size: 17px; margin: 20px 0 8px; }
.ref-line { stroke: var(--muted); stroke-width: 1; shape-rendering: crispEdges; }
