/* Ref dashboard: Ref the referee making calls. WinSync blue owns the rail; referee stripes are the
   one material (rail band, blocked hatch); penalty cards are the state vocabulary (yellow = needs
   a fix, blue = approved and ready, red = rejected, outline = waiting for your call); gold is for
   winners. Archivo (condensed for figures) + Inter + JetBrains Mono for links and codes. */

:root {
  color-scheme: light;
  --ref-blue: #004dbf;
  --ref-blue-deep: #003a92;
  --on-rail: #ffffff;
  --on-rail-2: hsl(216 100% 92%);
  --on-rail-3: hsl(216 70% 82%);
  --stripe-a: #121417;
  --stripe-b: #f4f5f7;

  --bg: hsl(216 30% 96.5%);
  --surface: #ffffff;
  --surface-2: hsl(216 30% 98%);
  --sunken: hsl(216 25% 93.5%);
  --line: hsl(216 20% 88%);
  --line-strong: hsl(216 16% 79%);
  --ink: hsl(220 25% 11%);
  --ink-2: hsl(220 12% 30%);
  --ink-3: hsl(220 9% 42%);
  --accent: #004dbf;
  --accent-ink: #0047b3;
  --accent-hover: #003d9c;
  --accent-soft: hsl(216 100% 37% / .09);
  --accent-line: hsl(216 100% 37% / .3);
  --on-accent: #ffffff;
  --mark: #1f63d6;
  --mark-muted: hsl(216 14% 80%);
  --gold: #f2bd1d;
  --gold-ink: #7a5600;
  --gold-soft: hsl(45 93% 52% / .16);
  --card-yellow: #ffcf1f;
  --card-red: #e3282e;
  --card-blue: #0a58e0;
  --good: hsl(152 62% 28%);
  --good-soft: hsl(152 62% 30% / .1);
  --warn: hsl(32 92% 32%);
  --warn-soft: hsl(45 100% 50% / .16);
  --bad: hsl(358 72% 42%);
  --bad-soft: hsl(358 72% 45% / .09);
  --shadow: 0 1px 2px hsl(220 30% 10% / .05), 0 6px 20px -10px hsl(220 30% 10% / .14);
  --shadow-pop: 0 14px 36px -12px hsl(220 30% 10% / .32);
  --radius: 14px;
  --radius-s: 9px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Archivo", "Inter", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --stripes: repeating-linear-gradient(90deg, var(--stripe-a) 0 7px, var(--stripe-b) 7px 14px);
  --hatch: repeating-linear-gradient(-45deg, var(--stripe-a) 0 5px, var(--card-yellow) 5px 10px);
}

/* Dark is declared twice: for the OS setting, and for the theme toggle (which wins both ways). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ref-blue: #0048b4;
    --ref-blue-deep: #00327f;
    --bg: hsl(222 28% 7%);
    --surface: hsl(222 22% 10.5%);
    --surface-2: hsl(222 20% 12.5%);
    --sunken: hsl(222 26% 6%);
    --line: hsl(222 16% 17%);
    --line-strong: hsl(222 14% 25%);
    --ink: hsl(216 30% 96%);
    --ink-2: hsl(216 16% 76%);
    --ink-3: hsl(216 11% 62%);
    --accent: #1a62e0;
    --accent-ink: #7fa9ff;
    --accent-hover: #2a70ee;
    --accent-soft: hsl(216 100% 62% / .13);
    --accent-line: hsl(216 100% 62% / .38);
    --mark: #4d8bff;
    --mark-muted: hsl(220 12% 30%);
    --gold: #f5c534;
    --gold-ink: #f7cf55;
    --gold-soft: hsl(45 93% 55% / .14);
    --good: hsl(152 58% 54%);
    --good-soft: hsl(152 58% 54% / .12);
    --warn: hsl(42 98% 60%);
    --warn-soft: hsl(45 100% 55% / .12);
    --bad: hsl(358 86% 70%);
    --bad-soft: hsl(358 86% 70% / .12);
    --shadow: 0 1px 2px hsl(0 0% 0% / .35), 0 8px 24px -12px hsl(0 0% 0% / .6);
    --shadow-pop: 0 16px 40px -12px hsl(0 0% 0% / .75);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ref-blue: #0048b4;
  --ref-blue-deep: #00327f;
  --bg: hsl(222 28% 7%);
  --surface: hsl(222 22% 10.5%);
  --surface-2: hsl(222 20% 12.5%);
  --sunken: hsl(222 26% 6%);
  --line: hsl(222 16% 17%);
  --line-strong: hsl(222 14% 25%);
  --ink: hsl(216 30% 96%);
  --ink-2: hsl(216 16% 76%);
  --ink-3: hsl(216 11% 62%);
  --accent: #1a62e0;
  --accent-ink: #7fa9ff;
  --accent-hover: #2a70ee;
  --accent-soft: hsl(216 100% 62% / .13);
  --accent-line: hsl(216 100% 62% / .38);
  --mark: #4d8bff;
  --mark-muted: hsl(220 12% 30%);
  --gold: #f5c534;
  --gold-ink: #f7cf55;
  --gold-soft: hsl(45 93% 55% / .14);
  --good: hsl(152 58% 54%);
  --good-soft: hsl(152 58% 54% / .12);
  --warn: hsl(42 98% 60%);
  --warn-soft: hsl(45 100% 55% / .12);
  --bad: hsl(358 86% 70%);
  --bad-soft: hsl(358 86% 70% / .12);
  --shadow: 0 1px 2px hsl(0 0% 0% / .35), 0 8px 24px -12px hsl(0 0% 0% / .6);
  --shadow-pop: 0 16px 40px -12px hsl(0 0% 0% / .75);
}

/* --- base ---------------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.5 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; border-radius: 4px; }
a { color: var(--accent-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -.015em; text-wrap: balance; }
h1 { font-size: 1.75rem; font-weight: 800; line-height: 1.15; font-stretch: 92%; }
h2 { font-size: 1.0625rem; font-weight: 750; line-height: 1.3; }
h3 { font-size: .875rem; font-weight: 700; }
.sub-head { margin-bottom: 6px; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: .86em; letter-spacing: -.01em; }
.num, .fig { font-variant-numeric: tabular-nums; }
.fig { font-family: var(--display); font-stretch: 75%; font-weight: 800; letter-spacing: 0; }
.muted { color: var(--ink-3); }
.soft { color: var(--ink-2); }
.small { font-size: .8125rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.i.s { width: 16px; height: 16px; }
.glyph svg.i { width: 24px; height: 24px; }
svg.i.fill { fill: currentColor; stroke: none; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

/* --- penalty cards (the state vocabulary) -------------------------------------------------- */

.pcard {
  display: inline-block; flex: none; width: 15px; height: 20px; border-radius: 2.5px;
  transform: rotate(-9deg); box-shadow: 0 1px 1px hsl(0 0% 0% / .18), 0 2px 6px -2px hsl(0 0% 0% / .3);
  vertical-align: -4px;
}
.pcard.yellow { background: var(--card-yellow); }
.pcard.blue { background: var(--card-blue); }
.pcard.red { background: var(--card-red); }
.pcard.open { background: transparent; border: 1.5px dashed var(--ink-3); box-shadow: none; }
.pcard.done { background: var(--line-strong); box-shadow: none; transform: rotate(0); }
.pcard.lg { width: 22px; height: 30px; border-radius: 3.5px; }

/* --- shell --------------------------------------------------------------------------------- */

.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
  background:
    radial-gradient(120% 60% at 30% 0%, hsl(216 100% 50% / .55), transparent 70%),
    var(--ref-blue);
  color: var(--on-rail);
}
.rail::before { content: ""; display: block; height: 10px; flex: none; background: var(--stripes); }
.rail-head { display: flex; align-items: center; gap: 12px; padding: 20px 20px 22px; color: inherit; text-decoration: none; }
.rail-head img { width: 52px; height: 52px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px hsl(0 0% 100% / .9), 0 6px 16px -6px hsl(220 100% 10% / .7); }
.rail-head strong { display: block; font: 800 1.25rem/1 var(--display); letter-spacing: -.01em; }
.rail-head span { display: block; margin-top: 4px; font-size: .8125rem; color: var(--on-rail-2); }
.nav { display: grid; gap: 2px; padding: 0 12px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--on-rail-2); text-decoration: none; font-weight: 550;
  transition: background-color .15s, color .15s;
}
.nav a:hover { background: hsl(0 0% 100% / .1); color: var(--on-rail); }
.nav a[aria-current="page"] { background: #fff; color: var(--ref-blue-deep); box-shadow: 0 6px 16px -8px hsl(220 100% 8% / .6); }
.nav .count {
  margin-left: auto; min-width: 24px; padding: 1px 8px; border-radius: 99px;
  background: var(--card-yellow); color: #1b1600;
  font: 750 .75rem/1.55 var(--font); text-align: center; font-variant-numeric: tabular-nums;
}
.rail-foot { margin-top: auto; display: grid; gap: 12px; padding: 16px 16px 18px; border-top: 1px solid hsl(0 0% 100% / .14); }
.status { display: flex; align-items: center; gap: 9px; padding: 0 4px; font-size: .8125rem; color: var(--on-rail-2); text-decoration: none; }
.status:hover { color: var(--on-rail); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.dot.on { background: #3ee08f; box-shadow: 0 0 0 3px hsl(150 75% 55% / .25); }
.dot.off { background: #ff5a5f; box-shadow: 0 0 0 3px hsl(358 100% 65% / .25); }
.checks .dot.on { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.me { display: flex; align-items: center; gap: 8px; min-width: 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: .75rem; background: hsl(0 0% 100% / .18); color: #fff; object-fit: cover; }
.me-name { font-weight: 600; font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.me form { display: contents; }
.rail .btn.icon { color: var(--on-rail-2); width: 32px; min-height: 32px; border: 0; background: transparent; }
.rail .btn.icon:hover { background: hsl(0 0% 100% / .12); color: #fff; }
.theme-sun { display: none; }
:root[data-theme="dark"] .theme-moon { display: none; }
:root[data-theme="dark"] .theme-sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-moon { display: none; }
  :root:not([data-theme="light"]) .theme-sun { display: block; }
}

.main { padding: 30px clamp(18px, 2.6vw, 48px) 72px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head p { margin-top: 6px; color: var(--ink-3); max-width: 70ch; }

/* --- panels and grids ---------------------------------------------------------------------- */

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 18px 22px 0; flex-wrap: wrap; }
.panel-head p { color: var(--ink-3); font-size: .8125rem; }
.panel-body { padding: 14px 22px 20px; }
.section { margin-top: 28px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.board { display: grid; gap: 18px; grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: start; }
.board > .chart-panel { align-self: stretch; display: flex; flex-direction: column; }
.chart-panel > .panel-body { flex: 1; display: flex; flex-direction: column; }
.chart-panel .hchart { flex: 1; grid-template-rows: minmax(220px, 1fr) auto; }
.span-12 { grid-column: span 12; }
.span-7 { grid-column: span 7; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.split { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); align-items: start; }
.split > .side { position: sticky; top: 24px; display: grid; gap: 18px; }
.split.narrow-side { grid-template-columns: minmax(0, 1fr) minmax(280px, 330px); }
.nowrap td { white-space: nowrap; }
@media (max-width: 1500px) { .hide-m { display: none; } }
.stack { display: grid; gap: 18px; align-content: start; }

/* --- calls (to-dos) ------------------------------------------------------------------------ */

.calls-head { display: flex; align-items: baseline; gap: 12px; padding: 18px 22px 14px; }
.calls { list-style: none; margin: 0; padding: 0 0 4px; }
.call { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 4px 16px; padding: 14px 22px; }
.call + .call { border-top: 1px solid var(--line); }
.call.blocked .glyph { border-radius: 8px; background: var(--hatch); }
.call.blocked .glyph .pcard { box-shadow: 0 0 0 2px var(--surface), 0 2px 6px -2px hsl(0 0% 0% / .4); }
.glyph .dot { width: 10px; height: 10px; }
.glyph { display: grid; place-items: center; width: 34px; height: 34px; flex: none; }
.whistle { color: var(--ink-2); }
.call strong { font-weight: 650; }
.call .sub { display: block; color: var(--ink-3); font-size: .8125rem; }
.call details { margin-top: 6px; }
.call summary { cursor: pointer; color: var(--accent-ink); font-size: .8125rem; width: fit-content; }
.questions { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.questions li { padding: 8px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-s); }
.questions q { quotes: "“" "”"; }
.play-on { display: flex; align-items: center; gap: 18px; padding: 20px 22px; }
.play-on img { width: 64px; height: 64px; border-radius: 50%; flex: none; }
.play-on strong { display: block; font: 800 1.25rem/1.2 var(--display); }

/* --- controls ------------------------------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 15px; border-radius: var(--radius-s);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: 600 .875rem/1 var(--font); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
}
.btn:hover { background: var(--sunken); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--on-accent); box-shadow: inset 0 -1px 0 hsl(0 0% 0% / .22), 0 4px 12px -6px hsl(216 100% 30% / .6); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--bad); border-color: transparent; background: transparent; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--sunken); color: var(--ink); }
.btn.small { min-height: 30px; padding: 0 10px; font-size: .8125rem; }
.btn.icon { padding: 0; width: 36px; min-height: 36px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .42; cursor: not-allowed; transform: none; box-shadow: none; }
.btn[data-busy-state] { opacity: .7; cursor: progress; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--sunken); border: 1px solid var(--line); max-width: 100%; overflow-x: auto; }
.seg a {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px; border-radius: 8px; color: var(--ink-2); text-decoration: none;
  font-weight: 600; font-size: .8125rem; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.seg a:hover { color: var(--ink); }
.seg a[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg .n { color: var(--ink-3); font-weight: 500; }

label.field { display: block; font-size: .8125rem; font-weight: 600; color: var(--ink-2); }
label.field > input, label.field > select, label.field > textarea { margin-top: 7px; }
label.field .hint { font-weight: 400; color: var(--ink-3); margin-left: 4px; }
input[type="text"], input:not([type]), select, textarea {
  width: 100%; min-height: 40px; padding: 9px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  background: var(--surface); color: var(--ink);
  font: 400 .875rem/1.45 var(--font);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-ink); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 96px; }
textarea.code { font: 400 .8125rem/1.65 var(--mono); }
select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
.form-row { display: grid; gap: 14px; }
.form-row > .btn { justify-self: start; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.switch-row { display: flex; align-items: center; gap: 16px; padding: 16px 22px; }
.switch-row + .switch-row { border-top: 1px solid var(--line); }
.switch-row .text { flex: 1; min-width: 0; }
.switch-row .text strong { font-weight: 650; }
.switch-row .text > span { display: block; color: var(--ink-3); font-size: .8125rem; margin-top: 2px; }
.switch {
  position: relative; width: 46px; height: 27px; flex: none; border-radius: 99px; border: 0; padding: 0; cursor: pointer;
  background: var(--line-strong); transition: background-color .2s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px hsl(0 0% 0% / .3); transition: transform .22s cubic-bezier(.16, 1, .3, 1);
}
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(19px); }
.switch.warn[aria-checked="true"] { background: var(--card-yellow); }

/* --- badges, flashes, banner --------------------------------------------------------------- */

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px;
  font: 650 .75rem/1.55 var(--font); white-space: nowrap;
  background: var(--sunken); color: var(--ink-2); border: 1px solid var(--line);
}
.badge.blue { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-line); }
.badge.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.gold { background: var(--gold-soft); color: var(--gold-ink); border-color: transparent; }
.badge .pcard { width: 9px; height: 12px; border-radius: 1.5px; vertical-align: -1px; }

.flashes { display: grid; gap: 8px; margin-bottom: 20px; }
.flash {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px;
  border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow);
  animation: rise .28s cubic-bezier(.16, 1, .3, 1);
}
.flash > svg, .flash > .pcard { margin-top: 1px; }
.flash.ok > svg { color: var(--good); }
.flash.warn { background: var(--warn-soft); border-color: transparent; }
.flash.error { background: var(--bad-soft); border-color: transparent; }
.flash.error > svg { color: var(--bad); }
.flash-body { flex: 1; min-width: 0; display: grid; gap: 8px; }
.copy-box { display: flex; gap: 8px; align-items: flex-start; }
.copy-box pre {
  flex: 1; margin: 0; padding: 9px 11px; border-radius: 7px; background: var(--sunken); border: 1px solid var(--line);
  font: .8125rem/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; max-height: 240px; overflow: auto;
}
.banner { display: flex; align-items: center; gap: 12px; padding: 0 16px 0 0; margin-bottom: 20px; border-radius: var(--radius-s); background: var(--warn-soft); color: var(--warn); font-weight: 600; overflow: hidden; }
.banner::before { content: ""; align-self: stretch; width: 18px; flex: none; background: var(--hatch); }
.banner span { padding: 10px 0; }
.banner a { color: inherit; }

@keyframes rise { from { opacity: 0; transform: translateY(4px); } }

/* --- funnel -------------------------------------------------------------------------------- */

.funnel { list-style: none; margin: 0; padding: 10px 0 8px; display: grid; }
.funnel li {
  display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr) 76px 80px; align-items: center; gap: 16px;
  padding: 8px 22px;
}
.funnel .label { color: var(--ink-2); font-weight: 550; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.track { position: relative; height: 26px; }
.track .fill { position: absolute; inset: 0 auto 0 0; border-radius: 0 6px 6px 0; background: var(--mark); min-width: 0; }
.track::before { content: ""; position: absolute; left: 0; top: -4px; bottom: -4px; width: 2px; background: var(--ink); opacity: .7; }
.funnel .goal .fill { background: var(--gold); }
.funnel .count { font-size: 1.75rem; line-height: 1; text-align: right; }
.delta { font-size: .75rem; font-weight: 650; text-align: right; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.foot-note { margin: 0 22px 18px; color: var(--ink-3); font-size: .8125rem; max-width: 80ch; }

/* --- chart --------------------------------------------------------------------------------- */

.tip {
  position: fixed; z-index: 50; pointer-events: none; padding: 6px 10px; border-radius: 7px;
  background: var(--ink); color: var(--bg); font: 600 .75rem/1.3 var(--font); white-space: nowrap;
  box-shadow: var(--shadow-pop); opacity: 0; transform: translate(-50%, calc(-100% - 10px)); transition: opacity .1s;
}
.tip.show { opacity: 1; }
.hchart { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 220px auto; column-gap: 10px; }
.hchart-axis { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; margin: -7px 0; font: 800 .75rem/14px var(--display); font-stretch: 75%; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.hchart-plot { position: relative; display: flex; align-items: flex-end; gap: clamp(2px, .8vw, 10px); border-bottom: 1.5px solid color-mix(in srgb, var(--ink) 60%, transparent); }
.hchart-grid { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.hchart-grid i { display: block; height: 1px; background: var(--line); }
.hchart-grid i:last-child { visibility: hidden; }
.hcol { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; border-radius: 6px 6px 0 0; }
.hcol:hover { background: var(--accent-soft); }
.hbar { display: block; width: 100%; min-height: 0; border-radius: 4px 4px 0 0; background: var(--mark); transition: background-color .12s; }
.hcol:hover .hbar { background: var(--accent-ink); }
.hchart-x { grid-column: 2; display: flex; gap: clamp(2px, .8vw, 10px); padding-top: 7px; }
.hchart-x span { flex: 1; min-width: 0; text-align: center; font-size: .75rem; color: var(--ink-3); white-space: nowrap; overflow: visible; }
details.table-view { margin-top: 10px; }
details.table-view summary { cursor: pointer; color: var(--ink-3); font-size: .8125rem; width: fit-content; }

/* --- tables -------------------------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th {
  text-align: left; font-weight: 600; font-size: .75rem; color: var(--ink-3);
  padding: 12px 12px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color .12s; }
tbody tr:hover { background: var(--surface-2); }
th:first-child, td:first-child { padding-left: 22px; }
th:last-child, td:last-child { padding-right: 22px; }
th.r, td.r { text-align: right; }
tr:target { background: var(--accent-soft); }
.bar-cell { display: flex; align-items: center; gap: 12px; min-width: 120px; }
.bar-cell .track { flex: 1; height: 8px; }
.bar-cell .track .fill { border-radius: 0 4px 4px 0; }
.bar-cell .track::before { display: none; }
.bar-cell .track.muted .fill { background: var(--mark-muted); }
.bar-cell .v { min-width: 30px; text-align: right; font: 800 1rem/1 var(--display); font-stretch: 75%; }
.rank { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--sunken); font: 800 .8125rem/1 var(--display); color: var(--ink-2); }
tr.winner .rank { background: var(--gold); color: #241a00; }
tr.winner .track .fill { background: var(--gold); }
.link-cell { display: flex; align-items: center; gap: 6px; min-width: 0; }
.link-cell code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { display: grid; justify-items: center; gap: 4px; padding: 30px 22px; text-align: center; color: var(--ink-3); }
.empty strong { color: var(--ink-2); font-weight: 650; }
.empty img { width: 56px; height: 56px; border-radius: 50%; margin-bottom: 6px; }

/* --- drafts -------------------------------------------------------------------------------- */

.drafts { display: grid; gap: 14px; }
.draft { position: relative; scroll-margin-top: 20px; overflow: hidden; }
.draft:target { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.draft.blocked::before { content: ""; display: block; height: 6px; background: var(--hatch); }
.draft-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 16px 22px 0; }
.draft-head h2 { font-size: 1rem; }
.draft-head .meta { margin-left: auto; color: var(--ink-3); font-size: .8125rem; }
.draft-body {
  margin: 12px 22px 0; padding: 14px 16px; border-radius: var(--radius-s);
  background: var(--surface-2); border: 1px solid var(--line);
  white-space: pre-wrap; word-break: break-word; font-size: .9375rem; line-height: 1.6; max-width: 76ch;
}
.problems { margin: 12px 22px 0; padding: 10px 14px; border-radius: var(--radius-s); background: var(--warn-soft); color: var(--ink); font-size: .8125rem; max-width: 76ch; }
.problems ul { margin: 4px 0 0; padding-left: 18px; color: var(--ink-2); }
.problems strong { font-weight: 700; }
.draft-target { margin: 10px 22px 0; font-size: .8125rem; color: var(--ink-3); display: flex; gap: 6px; align-items: center; min-width: 0; }
.draft-target a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draft-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 14px 22px 18px; }
.draft-actions form { display: contents; }
.draft-actions .spacer { flex: 1; }
.draft details.edit[open] { order: 10; flex-basis: 100%; }
.draft details.edit > summary { list-style: none; }
.draft details.edit > summary::-webkit-details-marker { display: none; }
.draft details.edit[open] > summary { display: none; }
.edit-form { display: grid; gap: 10px; margin-top: 4px; max-width: 76ch; }
.edit-form textarea { min-height: 180px; font-size: .9375rem; line-height: 1.6; }
/* The one authored moment: the card Ref holds goes up when you approve (once, right after). */
.pcard.raise { animation: raise-card .2s cubic-bezier(.16, 1, .3, 1) .15s forwards; }
@keyframes raise-card { to { transform: translateY(-4px) rotate(-17deg) scale(1.12); box-shadow: 0 6px 14px -4px hsl(216 100% 30% / .55); } }
.writer .panel-body { display: grid; gap: 14px; }
.kind-picker { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0; }
.kind-picker legend { font-size: .8125rem; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.kind-picker label { position: relative; }
.kind-picker input { position: absolute; opacity: 0; pointer-events: none; }
.kind-picker span {
  display: inline-flex; padding: 7px 12px; border-radius: 99px; border: 1px solid var(--line-strong);
  font-weight: 600; font-size: .8125rem; color: var(--ink-2); cursor: pointer; transition: background-color .15s, border-color .15s, color .15s;
}
.kind-picker input:checked + span { background: var(--accent); border-color: transparent; color: #fff; }
.kind-picker input:focus-visible + span { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.reply-only[hidden] { display: none; }
.legend-cards { list-style: none; margin: 0; padding: 14px 22px 18px; display: grid; gap: 10px; font-size: .8125rem; color: var(--ink-2); }
.legend-cards li { display: flex; align-items: center; gap: 12px; }

/* --- integrations -------------------------------------------------------------------------- */

.checks { list-style: none; margin: 0; padding: 4px 0; }
.checks li { display: flex; align-items: center; gap: 12px; padding: 11px 22px; }
.checks li + li { border-top: 1px solid var(--line); }
.checks .what { flex: 1; min-width: 0; }
.checks .what span { display: block; color: var(--ink-3); font-size: .8125rem; }

/* --- login --------------------------------------------------------------------------------- */

.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.login-art {
  position: relative; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(70% 60% at 50% 45%, hsl(216 100% 50%), var(--ref-blue) 70%);
}
.login-art::before { content: ""; position: absolute; inset: 0 0 auto; height: 12px; background: var(--stripes); }
.login-art img { width: min(440px, 70%); height: auto; border-radius: 50%; box-shadow: 0 30px 80px -30px hsl(220 100% 8% / .8); }
.login-side { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.login-card { width: min(380px, 100%); display: grid; gap: 22px; }
.login-card .brand { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-weight: 600; font-size: .875rem; }
.login-card .brand img { width: 28px; height: 28px; border-radius: 7px; }
.login-card h1 { font-size: 2.25rem; }
.login-card p { color: var(--ink-3); }
.btn.discord { min-height: 46px; font-size: .9375rem; width: 100%; }
.login-error { padding: 10px 12px; border-radius: var(--radius-s); background: var(--bad-soft); color: var(--bad); font-size: .875rem; }
.login-foot { font-size: .8125rem; color: var(--ink-3); }

/* --- responsive ---------------------------------------------------------------------------- */

@media (max-width: 1280px) {
  .span-7, .span-5 { grid-column: span 12; }
  /* stacked: calls, then the funnel, then the chart and the tables */
  .board > .chart-panel { order: 1; }
  .board > .chart-panel ~ :not(.span-7) { order: 2; }
}
@media (max-width: 1180px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .split > .side { position: static; }
  .span-6 { grid-column: span 12; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .rail { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center; gap: 4px; padding: 0 8px 0 0; overflow: visible; }
  .rail::before { width: 8px; height: auto; align-self: stretch; background: repeating-linear-gradient(0deg, var(--stripe-a) 0 6px, var(--stripe-b) 6px 12px); }
  .rail-head { padding: 8px 4px 8px 10px; }
  .rail-head img { width: 34px; height: 34px; }
  .rail-head div { display: none; }
  .nav { display: flex; overflow-x: auto; gap: 2px; flex: 1; min-width: 0; padding: 8px 0; scrollbar-width: none; }
  .nav a { padding: 7px 10px; white-space: nowrap; }
  .nav a .label { display: none; }
  .nav a[aria-current="page"] .label { display: inline; }
  .rail-foot { margin: 0 0 0 4px; padding: 0 0 0 8px; border: 0; border-left: 1px solid hsl(0 0% 100% / .22); display: flex; align-items: center; gap: 2px; }
  .rail-foot .status span, .me-name, .me .avatar { display: none; }
  .main { padding-top: 20px; }
  .login { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .login-art { padding: 40px 0 28px; }
  .login-art img { width: 180px; }
  .login-side { place-items: start center; padding-top: 32px; }
}
@media (max-width: 600px) {
  .funnel li { grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 12px; padding: 9px 16px; }
  .funnel .label { grid-column: 1 / -1; }
  .funnel .track { grid-column: 1; height: 18px; }
  .funnel .count { font-size: 1.375rem; }
  .call { grid-template-columns: 28px minmax(0, 1fr); padding: 12px 16px; }
  .call > .btn { grid-column: 2; justify-self: start; }
  .switch-row, .checks li { padding-left: 16px; padding-right: 16px; }
  .panel-head, .calls-head { padding: 16px 16px 0; }
  .panel-body { padding: 12px 16px 16px; }
  .draft-head, .draft-actions { padding-left: 16px; padding-right: 16px; }
  .draft-body, .problems, .draft-target { margin-left: 16px; margin-right: 16px; }
  th:first-child, td:first-child { padding-left: 16px; }
  th:last-child, td:last-child { padding-right: 16px; }
  .foot-note { margin: 0 16px 16px; }
  h1 { font-size: 1.5rem; }
  .hide-s { display: none; }
  .nav a[aria-current="page"] .label { display: none; }
  .nav a { padding: 8px 9px; }
  .hchart, .chart-panel .hchart { grid-template-rows: 160px auto; }
}
@media (prefers-reduced-motion: reduce) {
  .flash { animation: none; }
  .pcard.raise { animation: none; transform: translateY(-4px) rotate(-17deg) scale(1.12); }
  .btn, .switch, .switch::after, .nav a { transition: none; }
}
