:root {
  --page: #f9f9f7; --surface: #fcfcfb; --ink: #0b0b0b; --ink2: #52514e; --muted: #898781;
  --grid: #e1e0d9; --axis: #c3c2b7; --neutral: #d9d8d2;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7;
  --other: #a3a29b; --seq-lo: #cde2fb; --seq-hi: #104281;
  --warn-bg: #fdf0d2; --warn-ink: #6b4a00;
  --div-neg: #e34948; --div-mid: #f0efec; --div-pos: #2a78d6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0d0d0d; --surface: #1a1a19; --ink: #ffffff; --ink2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --neutral: #383835;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9;
    --other: #6b6a65; --seq-lo: #184f95; --seq-hi: #b7d3f6;
    --warn-bg: #3d2f08; --warn-ink: #fad98a;
    --div-neg: #e66767; --div-mid: #383835; --div-pos: #3987e5;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.top { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--grid); padding: 12px 0 0; }
.titlebar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
h1 { font-size: 18px; margin: 0; font-weight: 650; }
h2 { font-size: 17px; margin: 0 0 4px; font-weight: 650; text-wrap: balance; }
.tabs { display: flex; gap: 4px; }
.tabs button, .seg button { font: inherit; font-size: 14px; border: 1px solid var(--axis); background: transparent; color: var(--ink2); padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.tabs button[aria-selected="true"], .seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.seg { display: flex; gap: 4px; flex-wrap: wrap; }
.seg button { font-size: 13px; padding: 4px 10px; }
.status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 10px 0; }
.status .big { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
.spacer { flex: 1; }
.muted { color: var(--ink2); font-size: 13px; font-variant-numeric: tabular-nums; }
.btn { font: inherit; font-weight: 600; background: var(--s1); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer; }
.btn:disabled { opacity: .6; cursor: default; }
.badge { background: var(--warn-bg); color: var(--warn-ink); font-size: 12.5px; padding: 3px 8px; border-radius: 6px; }
.progress { height: 4px; background: var(--grid); }
#progress-fill { height: 100%; width: 0; background: var(--ink); transition: width .5s; }
main { padding-top: 16px; padding-bottom: 40px; }
.card { background: var(--surface); border: 1px solid var(--grid); border-radius: 12px; padding: 16px; margin-bottom: 16px; min-width: 0; }
.cardhead { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.sub { color: var(--ink2); font-size: 13.5px; margin: 0 0 12px; max-width: 75ch; }
.note { color: var(--ink2); font-size: 13.5px; margin: 12px 0 0; max-width: 85ch; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }

.cand { display: grid; grid-template-columns: 250px minmax(0, 1fr) 150px; gap: 10px; align-items: center; padding: 5px 0; }
.cand .who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cand .who b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cand .who small { color: var(--muted); white-space: nowrap; }
.sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.track { position: relative; height: 18px; }
.track .bar { position: absolute; left: 0; top: 3px; height: 12px; border-radius: 0 4px 4px 0; }
.track .fifty { position: absolute; top: -3px; bottom: -3px; width: 0; border-left: 1px dashed var(--ink2); }
.track .band { position: absolute; top: 7px; height: 4px; background: var(--ink); opacity: .35; border-radius: 2px; }
.track .proj { position: absolute; top: 0; width: 3px; height: 18px; background: var(--ink); border-radius: 1px; box-shadow: 0 0 0 2px var(--surface); }
.cand .val { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cand .val b { font-size: 16px; }
.cand .val small { color: var(--ink2); margin-left: 6px; }
@media (max-width: 640px) {
  .cand { grid-template-columns: minmax(0, 1fr) auto; }
  .cand .track { grid-column: 1 / -1; grid-row: 2; }
}
.legendline { color: var(--ink2); font-size: 12.5px; margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.mk-proj { display: inline-block; width: 3px; height: 14px; background: var(--ink); }
.mk-band { display: inline-block; width: 18px; height: 4px; background: var(--ink); opacity: .35; border-radius: 2px; margin-left: 10px; }
.mk-50 { display: inline-block; width: 0; height: 14px; border-left: 1px dashed var(--ink2); margin-left: 10px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-top: 8px; }
.tile { border: 1px solid var(--grid); border-radius: 10px; padding: 12px; }
.tile .k { color: var(--ink2); font-size: 12.5px; }
.tile .v { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; margin: 2px 0; }
.tile .d { color: var(--ink2); font-size: 12.5px; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--ink2); margin: 6px 0; align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 16px; height: 3px; border-radius: 2px; }
.legend i.sq { width: 10px; height: 10px; border-radius: 3px; }
.legend i.dash { background: none !important; border-top: 2px dashed; height: 0; }
.legend i.ramp { display: inline-block; width: 110px; height: 10px; border-radius: 3px; }

svg { display: block; width: 100%; height: auto; overflow: visible; }
svg text { fill: var(--ink2); font-size: 12px; font-variant-numeric: tabular-nums; }
svg .lbl { fill: var(--ink); }
.unit { stroke: var(--surface); stroke-width: 1; cursor: pointer; }
.unit:hover { stroke: var(--ink); stroke-width: 1.5; }

.tablewrap { overflow-x: auto; max-height: 520px; overflow-y: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; 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, th.l, td.l { text-align: left; }
th { position: sticky; top: 0; background: var(--surface); color: var(--ink2); font-weight: 600; cursor: pointer; user-select: none; }
td .sw { display: inline-block; margin-right: 6px; }

.tip { position: fixed; z-index: 20; pointer-events: none; background: var(--ink); color: var(--surface); padding: 8px 10px; border-radius: 8px; font-size: 12.5px; line-height: 1.4; max-width: 280px; font-variant-numeric: tabular-nums; }
.tip b { font-weight: 650; }
.tip .row { display: flex; justify-content: space-between; gap: 14px; }
.tip .row i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.foot { color: var(--muted); font-size: 12.5px; max-width: 90ch; }

.cols2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 24px; }
[hidden] { display: none !important; }
