:root {
  color-scheme: light;
  --plane: #f9f9f9; --surface: #ffffff; --ink: #191919; --ink2: #666666;
  --hair: #e7e7e7; --axis: #c2c2c2; --ring: rgba(11,11,11,.10);
  --accent: #257de0; --accent-wash: rgba(37,125,224,.10); --accent-ink: #1757ac;
  --good: #0aac23; --warn: #fbb315; --crit: #dc3c3d;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --plane: #0b0b0b; --surface: #191919; --ink: #efefef; --ink2: #9c9c9c;
    --hair: #303030; --axis: #474747; --ring: rgba(255,255,255,.10);
    --accent: #338ced; --accent-wash: rgba(51,140,237,.16); --accent-ink: #84b9f3;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--plane); color: var(--ink); font: 16px/1.5 var(--font); }
a { color: inherit; }
button { font: inherit; color: inherit; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.quiet { color: var(--ink2); }
h1, h2, h3, p { margin: 0; }

/* top bar */
.top { position: sticky; top: 0; z-index: 20; background: var(--plane); border-bottom: 1px solid var(--hair); }
.bar { display: flex; align-items: center; gap: 20px; height: 52px; }
.mark { font-weight: 700; letter-spacing: .02em; text-decoration: none; }
#tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
#tabs::-webkit-scrollbar { display: none; }
#tabs a { padding: 6px 10px; border-radius: 6px; text-decoration: none; color: var(--ink2); font-size: 14px; white-space: nowrap; }
#tabs a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: 0 0 0 1px var(--ring); }
.stamp { font-size: 12px; color: var(--ink2); white-space: nowrap; }
@media (max-width: 640px) { .stamp { display: none; } .bar { gap: 10px; } }

main.wrap { padding-top: 28px; padding-bottom: 48px; min-height: 70vh; }
section + section { margin-top: 36px; }
.h { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink2); margin-bottom: 12px; }
.card { background: var(--surface); border-radius: 10px; box-shadow: 0 0 0 1px var(--ring); padding: 16px; }
.stack > * + * { margin-top: 10px; }

/* brief */
.lede { max-width: 760px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13px; color: var(--ink2); margin-bottom: 12px; }
.badge { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--axis); color: var(--ink2); }
.badge.notable { box-shadow: none; background: var(--accent); color: #fff; }
.badge.major { box-shadow: none; background: var(--ink); color: var(--surface); }
.lede h1 { font-size: clamp(24px, 4.4vw, 36px); line-height: 1.18; font-weight: 650; letter-spacing: -.01em; text-wrap: balance; }
.lede .sum { margin-top: 14px; font-size: 17px; color: var(--ink); max-width: 68ch; }
.run { margin-top: 14px; font-size: 13px; color: var(--ink2); }
.cols { display: grid; gap: 36px; }
@media (min-width: 900px) { .cols { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 40px; } .cols > div > section:first-child { margin-top: 0; } }

.kind { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink2); }
.kind i { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; }
.kind.opportunity i { background: var(--good); }
.kind.warning i { background: var(--warn); border-radius: 1px; transform: rotate(45deg); }
.kind.guidance i { background: var(--accent); border-radius: 2px; }

.nodebtn { display: inline-block; padding: 1px 8px; border: 0; border-radius: 999px; background: var(--accent-wash); color: var(--ink); font-size: 13px; cursor: pointer; text-align: left; }
.nodebtn:hover { box-shadow: 0 0 0 1px var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.moved .title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.moved .title b { font-size: 16px; }
.shift { font-size: 13px; color: var(--ink2); }
.shift strong { color: var(--ink); }
.note { font-size: 15px; }
.src { font-size: 13px; color: var(--ink2); }
.src a { text-decoration-color: var(--axis); text-underline-offset: 2px; }
.src li { margin: 2px 0; }
.src ul { margin: 6px 0 0; padding: 0 0 0 18px; }

.chain h3 { font-size: 16px; margin: 6px 0 12px; }
.hops { list-style: none; margin: 0; padding: 0; position: relative; }
.hops li { position: relative; padding: 0 0 14px 22px; }
.hops li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 2px var(--ink2); }
.hops li::after { content: ""; position: absolute; left: 8px; top: 20px; bottom: 0; width: 1px; background: var(--axis); }
.hops li:last-child::after { display: none; }
.hops .pair { font-size: 14px; font-weight: 600; }
.hops .order { font-size: 12px; color: var(--ink2); font-weight: 400; margin-left: 6px; }
.hops p { font-size: 14px; margin-top: 2px; }
.hops .sign { color: var(--ink2); }
.sowhat { border-top: 1px solid var(--hair); padding-top: 10px; font-size: 15px; }

.signal p { margin-top: 6px; font-size: 15px; }
.signal .hz { font-size: 12px; color: var(--ink2); margin-left: 8px; }
.pred .row { display: flex; gap: 12px; align-items: baseline; }
.pct { font-size: 20px; font-weight: 650; min-width: 54px; }
.pred p { font-size: 15px; }
.pred .sub { font-size: 13px; color: var(--ink2); margin-top: 4px; }
.empty { color: var(--ink2); font-size: 15px; }

/* level meter */
.meter { display: inline-flex; gap: 2px; vertical-align: middle; }
.meter i { width: 12px; height: 6px; background: var(--hair); border-radius: 1px; }
.meter i.on { background: var(--accent); }

/* map */
.maphead { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.maphead p { font-size: 14px; color: var(--ink2); max-width: 70ch; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--ink2); margin-bottom: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend svg { flex: none; }
.lg-bar { width: 22px; height: 3px; background: var(--accent); border-radius: 2px; }
.lg-moved { width: 14px; height: 10px; border-radius: 3px; background: var(--accent-wash); box-shadow: inset 0 0 0 1.5px var(--accent); }
.grid { position: relative; display: grid; grid-template-columns: 104px repeat(6, minmax(0, 1fr)); background: var(--surface); border-radius: 10px; box-shadow: 0 0 0 1px var(--ring); }
.grid > .cell, .grid > .lane, .grid > .col { padding: 10px 8px; border-top: 1px solid var(--hair); }
.grid > .col { border-top: 0; font-size: 12px; color: var(--ink2); padding-bottom: 8px; }
.grid > .col b { display: block; color: var(--ink); font-weight: 600; font-size: 12px; }
.grid > .lane { font-size: 12px; font-weight: 600; color: var(--ink2); letter-spacing: .03em; padding-left: 12px; }
.grid > .cell { display: flex; flex-direction: column; gap: 6px; align-items: stretch; border-left: 1px solid var(--hair); min-height: 46px; }
#wires { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.chip { position: relative; z-index: 2; display: block; width: 100%; text-align: left; padding: 5px 8px 8px; font-size: 12.5px; line-height: 1.25; background: var(--surface); border: 0; border-radius: 6px; box-shadow: 0 0 0 1px var(--axis); cursor: pointer; overflow: hidden; }
.chip:hover, .chip:focus-visible { box-shadow: 0 0 0 1.5px var(--ink); outline: 0; }
.chip .lev { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); border-radius: 0 2px 0 0; }
.chip.moved { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); box-shadow: 0 0 0 1.5px var(--accent); }
.chip .delta { display: block; font-size: 11px; color: var(--ink2); margin-top: 2px; }
.chip .risk { display: inline-block; width: 7px; height: 7px; margin-right: 5px; background: var(--ink2); transform: rotate(45deg) translateY(-1px); }
.grid.focus .chip:not(.hot) { color: color-mix(in srgb, var(--ink2) 50%, var(--surface)); box-shadow: 0 0 0 1px var(--hair); }
.grid.focus .chip:not(.hot) .lev, .grid.focus .chip:not(.hot) .risk { opacity: .3; }
.chip.sel { box-shadow: 0 0 0 2px var(--ink); }
.chip .m-meter { display: none; }
@media (max-width: 899px) {
  .grid { display: block; background: none; box-shadow: none; }
  .grid > .col, #wires { display: none; }
  .grid > .lane { border: 0; padding: 18px 0 6px; font-size: 13px; }
  .grid > .cell { border: 0; padding: 0; min-height: 0; gap: 6px; margin-bottom: 6px; }
  .grid > .cell:empty { display: none; }
  .chip { display: flex; align-items: center; gap: 10px; padding: 10px 12px 12px; font-size: 15px; }
  .chip .nm { flex: 1; }
  .chip .m-meter { display: inline-flex; }
  .chip .delta { margin: 0; }
  .legend .wide { display: none; }
}

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink2); padding: 8px 10px; border-bottom: 1px solid var(--axis); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--hair); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.tbl .rank { color: var(--ink2); width: 28px; }
.barcell { min-width: 120px; }
.hbar { display: flex; align-items: center; gap: 8px; }
.hbar i { display: block; height: 10px; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar span { font-size: 12px; color: var(--ink2); font-variant-numeric: tabular-nums; }
.trip { font-size: 13px; color: var(--ink2); margin: 0; padding-left: 16px; }
.linkbtn { background: none; border: 0; padding: 0; cursor: pointer; text-align: left; font-weight: 600; text-decoration: underline; text-decoration-color: var(--axis); text-underline-offset: 3px; }
.scroll { overflow-x: auto; }
@media (max-width: 760px) { .hide-s { display: none; } }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile .lab { font-size: 13px; color: var(--ink2); }
.tile .val { font-size: 30px; font-weight: 650; line-height: 1.2; }
.tile .sub { font-size: 12px; color: var(--ink2); }
.conf { display: inline-block; width: 64px; height: 6px; background: var(--hair); border-radius: 3px; overflow: hidden; vertical-align: middle; margin-left: 8px; }
.conf i { display: block; height: 100%; background: var(--accent); }
.out { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }

/* archive */
.arch { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--hair); padding: 12px 4px; cursor: pointer; }
.arch:hover { background: var(--accent-wash); }
.arch .d { font-size: 13px; color: var(--ink2); margin-right: 10px; font-variant-numeric: tabular-nums; }
.archbody { padding: 20px 4px 28px; border-bottom: 1px solid var(--hair); }

/* node panel */
#scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 30; }
#panel { position: fixed; z-index: 31; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); background: var(--surface); box-shadow: -1px 0 0 var(--ring); overflow-y: auto; padding: 20px 20px 60px; }
#panel h2 { font-size: 22px; line-height: 1.2; margin: 6px 40px 8px 0; }
#panel .x { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border: 0; border-radius: 8px; background: none; font-size: 22px; cursor: pointer; color: var(--ink2); }
#panel .x:hover { background: var(--accent-wash); }
#panel .facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; margin: 14px 0; }
#panel .facts dt { color: var(--ink2); }
#panel .facts dd { margin: 0; }
#panel h3 { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink2); margin: 22px 0 8px; }
#panel p { font-size: 15px; }
#panel ul { margin: 0; padding-left: 18px; font-size: 14px; }
#panel li { margin: 6px 0; }
.mech { display: block; color: var(--ink2); font-size: 13px; }
#panel .ev { border-left: 2px solid var(--hair); padding-left: 12px; margin: 10px 0; font-size: 14px; }
#panel .ev .when { font-size: 12px; color: var(--ink2); }
.seed { font-size: 13px; color: var(--ink2); }

#tip { position: fixed; z-index: 40; max-width: 280px; background: var(--ink); color: var(--surface); font-size: 12.5px; line-height: 1.35; padding: 8px 10px; border-radius: 6px; pointer-events: none; }
#tip b { display: block; }

.foot { padding-top: 0; padding-bottom: 40px; font-size: 12px; color: var(--ink2); }
