/* tagboard — a laboratory notebook turned into an instrument.
 *
 * The day is literally an experiment: hypothesis first, then measurement. The
 * notebook lives in the palette, the type and the annotation structure — never in
 * imitation materials. No paper textures, no torn edges, no tape.
 *
 * Four rules hold the whole thing together. Breaking any of them turns this back
 * into a generic dark dashboard:
 *
 *   1. No border defines a container. A panel is a fill one tonal step above its
 *      parent. The only rule permitted is a dashed hairline between table rows.
 *   2. Emphasis comes from fill step and font weight. Never a glow, shadow or
 *      gradient.
 *   3. Brass is structure and never means state. Moss, rust and ochre are the only
 *      carriers of meaning, and they mean the same thing on every screen.
 *   4. The serif is reserved for hypotheses and article text. Nowhere else.
 *
 * Single theme by intent: the projection only ever exists in a darkened room and
 * the laptops are read beside it all day.
 */

/* ========================================================================== */
/* fonts                                                                      */
/* ========================================================================== */

@font-face {
  font-family: "Iosevka"; font-style: normal; font-weight: 400;
  src: url("/static/fonts/iosevka-regular.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Iosevka"; font-style: normal; font-weight: 600;
  src: url("/static/fonts/iosevka-semibold.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Iosevka"; font-style: normal; font-weight: 700;
  src: url("/static/fonts/iosevka-bold.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Iosevka"; font-style: normal; font-weight: 800;
  src: url("/static/fonts/iosevka-extrabold.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Archivo"; font-style: normal; font-weight: 400 800;
  src: url("/static/fonts/archivo-variable.woff2") format("woff2-variations");
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4"; font-style: normal; font-weight: 400;
  src: url("/static/fonts/sourceserif-regular.woff2") format("woff2-variations");
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4"; font-style: italic; font-weight: 400;
  src: url("/static/fonts/sourceserif-italic.woff2") format("woff2-variations");
  font-display: swap;
}

/* ========================================================================== */
/* tokens                                                                     */
/* ========================================================================== */

:root {
  /* ground and tonal steps — warm charcoal-brown, never blue or slate */
  --ground:      #211D17;
  --panel:       #2A251D;
  --panel-2:     #332C22;
  --panel-3:     #3D3529;

  /* ink */
  --ink:         #F0E9DC;   /* 14.8:1 on ground */
  --ink-2:       #C9BEA8;   /*  9.4:1 */
  --ink-dim:     #A2977F;   /*  6.2:1 — AA at 13px and up */

  /* structure: labels, column heads, the phase chip, the primary action */
  --brass:       #B8A67E;   /*  8.1:1 */
  --brass-deep:  #8A7A57;   /*  4.6:1 — large or bold text only */

  /* the three states, identical in meaning everywhere */
  --moss:        #8DA46F;   /* pass, positive, scored, on target */
  --rust:        #C0653F;   /* fail, negative, rejected, stale */
  --ochre:       #D9A441;   /* uncertain, running, waiting, warning */
  --moss-fill:   #3C4831;
  --rust-fill:   #4E2E20;
  --ochre-fill:  #453820;

  /* the only rule permitted anywhere */
  --hairline:    1px dashed #3A3327;

  --mono: "Iosevka", ui-monospace, "SF Mono", Menlo, monospace;
  --grot: "Archivo", "Helvetica Neue", Helvetica, system-ui, sans-serif;
  --humanist: "Source Serif 4", Charter, "Iowan Old Style", Georgia, serif;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px;
}

/* ========================================================================== */
/* base                                                                       */
/* ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 15px/1.55 var(--grot);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0 0 var(--s3); }
a { color: var(--brass); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }

:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

/* every figure, everywhere — columns line up and refreshes never reflow */
.mono, .num, td.num, th.num, .score, .rank, .delta, input.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums slashed-zero;
}

.dim { color: var(--ink-dim); }
.ok { color: var(--moss); }
.warn { color: var(--ochre); }
.bad { color: var(--rust); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ========================================================================== */
/* chrome                                                                     */
/* ========================================================================== */

header.top {
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: var(--s3) var(--s5);
  background: var(--panel);
}
header.top h1 {
  font: 800 19px/1 var(--grot);
  letter-spacing: -0.02em;
}
header.top h1 .mark { color: var(--brass); }
header.top nav { display: flex; gap: var(--s4); margin-left: var(--s2); }
header.top nav a {
  font: 600 13px/1 var(--grot);
  color: var(--ink-dim);
  text-decoration: none;
  letter-spacing: 0.04em;
}
header.top nav a:hover, header.top nav a.on { color: var(--brass); }
header.top .who {
  margin-left: auto;
  font: 500 13px/1 var(--grot);
  color: var(--ink-dim);
}
header.top .who b { color: var(--ink-2); font-weight: 600; }

.wrap { max-width: 1180px; margin: 0 auto; padding: var(--s4) var(--s5) var(--s7); }
.wrap.wide { max-width: 1420px; }

/* ========================================================================== */
/* panels                                                                     */
/* ========================================================================== */

section.panel {
  background: var(--panel);
  padding: var(--s5);
  margin-bottom: var(--s4);
}
section.panel > h2 {
  font: 800 12px/1 var(--grot);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: var(--s4);
}
.panel-head {
  display: flex;
  align-items: baseline;
  gap: var(--s3);
  margin-bottom: var(--s4);
}
.panel-head > h2 { margin-bottom: 0; }
.panel-note {
  margin-left: auto;
  font: 500 13px/1 var(--grot);
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}

/* ========================================================================== */
/* phase progress — the day's ten stages, on every page that has a phase      */
/* ========================================================================== */

.phases {
  display: flex;
  gap: 3px;
  margin-bottom: var(--s4);
  list-style: none;
  padding: 0;
}
.phases li { flex: 1 1 0; min-width: 0; }
.phase-step {
  display: block;
  background: var(--panel);
  padding: var(--s2) var(--s3) var(--s3);
  border-top: 3px solid var(--panel-3);
}
.phase-step .t {
  display: block;
  font: 600 11px/1 var(--mono);
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.phase-step .n {
  display: block;
  font: 700 12.5px/1.3 var(--grot);
  letter-spacing: 0.02em;
  color: var(--ink-dim);
  margin-top: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* done: the day has passed through here */
.phase-step.done { border-top-color: var(--brass-deep); }
.phase-step.done .n { color: var(--ink-2); }
/* now: filled, and the only step that carries its description */
.phase-step.now {
  background: var(--panel-2);
  border-top-color: var(--brass);
}
.phase-step.now .t { color: var(--brass); }
.phase-step.now .n { color: var(--ink); font-weight: 800; }
.phase-now-desc {
  background: var(--panel-2);
  padding: var(--s3) var(--s4);
  margin: -12px 0 var(--s4);
  font: 400 14px/1.45 var(--grot);
  color: var(--ink-2);
}
.phase-now-desc b { color: var(--brass); font-weight: 700; }

/* my job, right under the rail: position, or training with its progress */
.job-strip {
  display: flex;
  align-items: center;
  gap: var(--s3);
  flex-wrap: wrap;
  background: var(--panel);
  padding: var(--s3) var(--s4);
  margin-bottom: var(--s4);
  font-size: 14px;
}
.job-strip b { color: var(--ink); }

/* ========================================================================== */
/* tables                                                                     */
/* ========================================================================== */

table { width: 100%; border-collapse: collapse; }
th {
  font: 700 11.5px/1 var(--grot);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--brass-deep);
  text-align: left;
  padding: 0 var(--s3) var(--s2) 0;
}
td {
  padding: var(--s3) var(--s3) var(--s3) 0;
  border-top: var(--hairline);
  vertical-align: top;
}
/* Right-aligned cells keep their gutter — without it a figure butts straight
   into the next column and reads as one value ("0CfhLts1COgI"). Only the last
   cell in a row goes flush. */
th.num, td.num { text-align: right; }
table tr > *:last-child { padding-right: 0; }
tbody tr:hover td { background: var(--panel-2); }

.score { font: 700 17px/1.25 var(--mono); }
.seq   { font: 700 17px/1.25 var(--mono); color: var(--ink-2); }
.when  { font: 500 13px/1.25 var(--mono); color: var(--ink-dim); }

/* My submissions reads as a run of dated journal entries, so the columns are
   pinned: without widths the short headers collide into "ROWSSOURCES". */
#submissions th:nth-child(1), #submissions td:nth-child(1) { width: 56px; }
#submissions th:nth-child(2), #submissions td:nth-child(2) { width: 82px; }
#submissions th:nth-child(3), #submissions td:nth-child(3) { width: 74px; }
#submissions th:nth-child(5), #submissions td:nth-child(5) { width: 104px; }
#submissions th:nth-child(6), #submissions td:nth-child(6) { width: 104px; }
#submissions th:nth-child(7), #submissions td:nth-child(7) { width: 100px; }
#submissions th:nth-child(8), #submissions td:nth-child(8) { width: 116px; }
#submissions th:nth-child(9), #submissions td:nth-child(9) { width: 154px; text-align: right; }
#submissions td:nth-child(4) { font-size: 12.5px; }

/* ========================================================================== */
/* pills and badges — state, never structure                                  */
/* ========================================================================== */

.pill {
  display: inline-block;
  font: 700 11px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 8px;
  background: var(--panel-3);
  color: var(--ink-dim);
}
.pill.ok   { background: var(--moss-fill);  color: var(--moss); }
.pill.bad  { background: var(--rust-fill);  color: var(--rust); }
.pill.run  { background: var(--ochre-fill); color: var(--ochre); }
.pill.baseline { background: var(--panel-3); color: var(--brass); }

.badge {
  display: inline-block;
  font: 600 11px/1 var(--mono);
  letter-spacing: 0.06em;
  padding: 4px 7px;
  background: var(--panel-3);
  color: var(--brass);
}

/* ========================================================================== */
/* forms                                                                      */
/* ========================================================================== */

input[type=text], input[type=number], input[type=password], textarea, select {
  width: 100%;
  background: var(--panel-2);
  color: var(--ink);
  border: none;
  padding: 11px var(--s3);
  font: 500 14px/1.2 var(--mono);
}
input[type=file] {
  width: 100%;
  background: var(--panel-2);
  color: var(--ink-2);
  border: none;
  padding: 10px var(--s3);
  font: 500 13px/1.2 var(--grot);
}
/* the native button is the one piece of browser chrome that would break the
   palette, so it gets the quiet-button treatment */
input[type=file]::file-selector-button {
  background: var(--panel-3);
  color: var(--ink);
  border: none;
  font: 700 12px/1 var(--grot);
  letter-spacing: 0.04em;
  padding: 8px 11px;
  margin-right: var(--s3);
  cursor: pointer;
}
input[type=file]::file-selector-button:hover { background: var(--brass); color: var(--ground); }
textarea { resize: vertical; min-height: 72px; font-family: var(--grot); font-size: 15px; line-height: 1.5; }
select { appearance: none; }
input::placeholder { color: #6F6553; }

.field { margin-bottom: var(--s4); }
.field label {
  display: block;
  font: 600 12px/1 var(--grot);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: var(--s2);
}
.row { display: flex; gap: var(--s4); flex-wrap: wrap; align-items: flex-start; }
.row > * { flex: 1 1 200px; }
.row.tight > * { flex: 0 0 auto; }
.hint { font: 400 12.5px/1.5 var(--grot); color: var(--ink-dim); }

button, .button {
  display: inline-block;
  background: var(--brass);
  color: #201B14;
  border: none;
  font: 700 14px/1 var(--grot);
  letter-spacing: 0.02em;
  padding: 12px 18px;
  cursor: pointer;
  text-decoration: none;
}
button:hover, .button:hover { background: var(--ink); color: var(--ground); }
button.secondary, .button.secondary { background: var(--panel-3); color: var(--ink); }
button.secondary:hover { background: var(--panel-2); color: var(--brass); }
button.danger { background: var(--rust); color: #1C1109; }
button.danger:hover { background: #D0764F; color: #1C1109; }
button.mini { font-size: 11.5px; padding: 7px 10px; letter-spacing: 0.06em; }
button:disabled, button:disabled:hover {
  background: var(--panel-2);
  color: #6F6553;
  cursor: not-allowed;
}

/* ========================================================================== */
/* notices — the three states again                                           */
/* ========================================================================== */

.notice {
  background: var(--ochre-fill);
  padding: var(--s3) var(--s4);
  margin: var(--s3) 0;
  font: 400 14px/1.5 var(--grot);
  color: var(--ink-2);
}
.notice b, .notice strong { color: var(--ochre); font-weight: 700; }
.notice.bad { background: var(--rust-fill); }
.notice.bad b, .notice.bad strong { color: var(--rust); }
.notice.ok { background: var(--moss-fill); }
.notice.ok b, .notice.ok strong { color: var(--moss); }

/* a guarded action: the fill says what the button will do */
.guard { background: var(--rust-fill); padding: var(--s4) var(--s5); margin-top: var(--s4); }
.guard-text { font: 400 14px/1.5 var(--grot); color: var(--ink-2); max-width: 64ch; }
.guard-text b { color: var(--rust); font-weight: 700; }
.guard-row { display: flex; align-items: center; gap: var(--s4); margin-top: var(--s4); flex-wrap: wrap; }
.checkline { display: flex; align-items: center; gap: var(--s2); font: 500 13px/1 var(--grot); color: var(--ink-2); }
.checkline input { width: 16px; height: 16px; accent-color: var(--rust); }

/* multi-select lists: overlap assignment, merge candidates */
.checks { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); }
.check {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font: 500 14px/1.3 var(--grot);
  color: var(--ink);
  background: var(--panel-2);
  padding: 7px 10px;
}
.check input { width: 15px; height: 15px; accent-color: var(--brass); flex: none; }
.check .dim { font-family: var(--mono); font-size: 12px; }
/* inside a table the flags must stay on one line, or every row doubles in height */
td .checks { flex-wrap: nowrap; gap: var(--s2); }
td .check { padding: 5px 8px; font-size: 13px; }

/* ========================================================================== */
/* the one warm voice: hypotheses and article text                            */
/* ========================================================================== */

.hypothesis-text {
  font: italic 400 26px/1.42 var(--humanist);
  color: var(--ink);
  max-width: 30em;
  margin: var(--s4) 0 0;
}
.hyp-annotation {
  font: italic 400 13.5px/16px var(--humanist);
  color: var(--ink-dim);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hyp-cell {
  font: italic 400 13.5px/1.4 var(--humanist);
  color: var(--ink-dim);
  max-width: 34ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.article-text {
  font: 400 15.5px/1.62 var(--humanist);
  color: var(--ink-2);
  max-width: 62ch;
}
.lock-state {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font: 500 13px/1 var(--mono);
  color: var(--ink-dim);
  margin-top: var(--s4);
}
.lock-state .lock {
  color: var(--brass-deep);
  font-weight: 700;
  letter-spacing: 0.08em;
}

/* ========================================================================== */
/* progress                                                                   */
/* ========================================================================== */

.progress-bar {
  display: inline-block;
  width: 220px;
  height: 7px;
  background: var(--panel-3);
  vertical-align: middle;
  overflow: hidden;
}
.progress-bar > i { display: block; height: 100%; background: var(--moss); }
.progress-bar.wide { width: 100%; }

/* ========================================================================== */
/* validation report                                                          */
/* ========================================================================== */

.report { margin-top: var(--s5); background: var(--panel-2); }
.report-head {
  display: flex;
  align-items: center;
  gap: var(--s3);
  flex-wrap: wrap;
  background: var(--rust-fill);
  padding: var(--s3) var(--s4);
}
.report-head.ok { background: var(--moss-fill); }
.report-verdict {
  font: 800 13px/1 var(--grot);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rust);
}
.report-head.ok .report-verdict { color: var(--moss); }
.report-detail { font: 500 13px/1.4 var(--mono); color: var(--ink-2); }
.finding { padding: var(--s4); }
.finding + .finding { border-top: var(--hairline); }
.finding-top { display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap; }
.code {
  font: 700 12px/1 var(--mono);
  letter-spacing: 0.06em;
  color: var(--rust);
  background: var(--rust-fill);
  padding: 5px 8px;
}
.code.warn { color: var(--ochre); background: var(--ochre-fill); }
.finding-msg { font: 400 14px/1.5 var(--grot); color: var(--ink); flex: 1 1 320px; }
.finding-rows {
  font: 500 12.5px/1.6 var(--mono);
  color: var(--ink-dim);
  margin-top: var(--s2);
  font-variant-numeric: tabular-nums;
}
.finding-rows b { color: var(--ink-2); font-weight: 600; }

/* ========================================================================== */
/* the build.py editor — the primary object on the entrant's page              */
/* ========================================================================== */

.editor-shell { background: #191510; }
.editor-shell textarea#buildpy {
  width: 100%;
  min-height: 460px;
  background: #191510;
  color: var(--ink-2);
  border: none;
  padding: var(--s4);
  font: 500 13px/1.6 var(--mono);
  resize: vertical;
  tab-size: 4;
}
.cm-shell { min-height: 460px; max-height: 70vh; overflow: auto; }
.cm-shell .cm-editor { min-height: 460px; }
.editor-actions { margin-top: var(--s4); align-items: center; }
.editor-actions .spacer { flex: 1 1 auto; }

h3.subhead {
  font: 700 11px/1 var(--grot);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass-deep);
  margin: var(--s4) 0 var(--s2);
}

button.linklike {
  background: none;
  color: var(--brass);
  padding: 0;
  font: 500 13px/1.3 var(--mono);
  text-decoration: underline;
  text-underline-offset: 2px;
}
button.linklike:hover { background: none; color: var(--ink); }

/* ========================================================================== */
/* dataset inspector                                                          */
/* ========================================================================== */

.facets {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: var(--s5);
  background: var(--panel-2);
  padding: var(--s4);
  margin-bottom: var(--s4);
}
.facet-label {
  font: 700 11px/1 var(--grot);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass-deep);
  margin-bottom: var(--s2);
}
.facet-bar { display: flex; height: 10px; background: var(--ground); overflow: hidden; }
.facet-bar > i { display: block; height: 100%; }
.facet-bar .pos { background: var(--moss); }
.facet-bar .neg { background: var(--brass-deep); }
.facet-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s4);
  margin-top: var(--s2);
  font: 500 13px/1.4 var(--grot);
}
.facet-legend a { color: var(--ink-2); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.facet-legend a:hover { color: var(--brass); }
.facet-legend a.on { color: var(--brass); font-weight: 700; }
.facet-legend a.clear { color: var(--ink-dim); }
.facet-legend b { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.facet-legend .swatch { width: 12px; height: 12px; display: inline-block; }
.facet-legend .swatch.pos { background: var(--moss); }
.facet-legend .swatch.neg { background: var(--brass-deep); }
.facet-legend.srcs a { background: var(--panel-3); padding: 5px 9px; }

.slideover {
  background: var(--panel-2);
  padding: var(--s4);
  margin-top: var(--s4);
}
.slideover-head { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s2); }
.slideover-head .mono { font-weight: 700; color: var(--brass); }
.slideover-head button { margin-left: auto; }
.slideover-tags { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s3); }

/* ========================================================================== */
/* logs and code                                                              */
/* ========================================================================== */

pre.log, pre.code {
  background: #191510;
  padding: var(--s4);
  max-height: 340px;
  overflow: auto;
  font: 500 12.5px/1.55 var(--mono);
  white-space: pre-wrap;
  color: var(--ink-2);
  margin: 0;
}
pre.code, .code pre { white-space: pre; max-height: 520px; }
/* Pygments wraps its output in <div class="code"><pre>; the fallback path emits a
   bare <pre class="code">. Both are styled, so a missing Pygments only costs the
   colours. */
.code pre {
  background: #191510;
  padding: var(--s4);
  overflow: auto;
  font: 500 12.5px/1.55 var(--mono);
  color: var(--ink-2);
  margin: 0;
}
.code .k, .code .kn, .code .kd, .code .ow { color: var(--brass); font-weight: 700; }
.code .s, .code .s1, .code .s2, .code .sd { color: var(--moss); }
.code .c, .code .c1, .code .cm { color: #6F6553; font-style: italic; }
.code .n, .code .nn, .code .nb { color: var(--ink-2); }
.code .nf, .code .nc { color: var(--ink); font-weight: 700; }
.code .mi, .code .mf { color: var(--ochre); }
.code .o, .code .p { color: var(--ink-dim); }

/* ========================================================================== */
/* leaderboard                                                                */
/* ========================================================================== */

/* Column widths are declared so the rank cannot collapse into the name, and so
   the row height stays put when the numbers change under a refresh. */
table.board td { vertical-align: middle; }
table.board th:nth-child(1), table.board td:nth-child(1) { width: 54px; padding-right: var(--s4); }
table.board th:nth-child(3), table.board td:nth-child(3) { width: 92px; }
table.board th:nth-child(4), table.board td:nth-child(4) { width: 118px; }
table.board th:nth-child(5), table.board td:nth-child(5) { width: 104px; }
table.board td:nth-child(1) { font: 700 22px/1 var(--mono); color: var(--ink-2); }
table.board tr.baseline td { color: var(--brass); }
table.board tr.baseline td:nth-child(1) { font-size: 15px; color: var(--brass-deep); }
table.board tr.baseline td.dim { color: var(--brass-deep); }
table.board .name { font: 700 16px/1.25 var(--grot); }

/* ========================================================================== */
/* adjudication                                                               */
/* ========================================================================== */

ul.cases { list-style: none; margin: var(--s4) 0 0; padding: 0; }
.case { background: var(--panel-2); padding: var(--s5); margin-bottom: var(--s3); }
.case.judged { opacity: 0.55; }
.case-head { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3); }
.case-claim { font: 700 17px/1.2 var(--mono); color: var(--brass); }
.case-score { margin-left: auto; text-align: right; }
.case-score .lead {
  display: block;
  font: 700 11px/1 var(--grot);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.case-score .val {
  font: 700 24px/1.2 var(--mono);
  color: var(--ochre);
  font-variant-numeric: tabular-nums;
}
.verdict-row { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s4); flex-wrap: wrap; }
.verdict-row .reason { flex: 1 1 280px; }
button.yes { background: var(--moss); color: #16190F; }
button.yes:hover { background: #A3B884; color: #16190F; }
button.no { background: var(--panel-3); color: var(--ink); }
.required-note { font: 500 12px/1 var(--grot); color: var(--ochre); margin-top: var(--s2); }

tr.split td { background: rgba(217, 164, 65, 0.07); }
.verdict-line { display: flex; gap: var(--s2); align-items: baseline; padding: 1px 0; font-size: 13px; }

/* ========================================================================== */
/* login                                                                      */
/* ========================================================================== */

.login { max-width: 400px; margin: 14vh auto; }
.login h2 { margin-bottom: var(--s4); }

/* ========================================================================== */
/* printable token slips                                                      */
/* ========================================================================== */

.slips { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4); }
.slip { background: var(--panel); padding: var(--s5); break-inside: avoid; }
.slip .who { font: 700 19px/1.2 var(--grot); }
.slip .team { font: 600 12px/1 var(--mono); color: var(--brass); letter-spacing: 0.1em; margin-top: 6px; }
.slip .token {
  font: 700 24px/1.2 var(--mono);
  color: var(--ink);
  background: var(--panel-2);
  padding: var(--s3);
  margin-top: var(--s3);
  letter-spacing: 0.04em;
  word-break: break-all;
}
.slip .url { font: 500 12px/1.4 var(--mono); color: var(--ink-dim); margin-top: var(--s2); }

@media print {
  body { background: #fff; color: #000; }
  header.top, .no-print { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .slips { grid-template-columns: repeat(2, 1fr); gap: 10mm; }
  .slip { background: #fff; border-bottom: 1px dashed #999; padding: 6mm 0 8mm; }
  .slip .who { color: #000; }
  .slip .team { color: #444; }
  .slip .token { background: #f2f2f2; color: #000; }
  .slip .url { color: #444; }
}

/* ========================================================================== */
/* projection — 1920×1080, read from six metres, redrawn every 10s            */
/* ========================================================================== */

body.projection { overflow: hidden; height: 100vh; display: flex; flex-direction: column; }

.proj-top {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  gap: var(--s5);
  padding: var(--s3) var(--s5);
  background: var(--panel);
}
.proj-top h1 { font: 800 22px/1 var(--grot); letter-spacing: -0.02em; }
.proj-phase {
  font: 700 16px/1 var(--mono);
  letter-spacing: 0.1em;
  color: var(--ground);
  background: var(--brass);
  padding: 7px 11px;
}
.proj-desc { font: 400 16px/1 var(--grot); color: var(--ink-2); }
.proj-next {
  margin-left: auto;
  font: 600 13px/1 var(--grot);
  letter-spacing: 0.08em;
  color: var(--ink-dim);
}
.proj-next b { color: var(--ochre); font-family: var(--mono); font-weight: 700; }
.proj-clock {
  font: 700 30px/1 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* the rail sits between the header and the panels, full width */
body.projection > .phases { margin: var(--s3) var(--s5) 0; }
body.projection > .phase-now-desc { display: none; }

.proj-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1.32fr 1fr;
  grid-template-rows: 1fr auto;
  grid-template-areas: "board matrix" "board queue";
  gap: var(--s4);
  padding: var(--s4) var(--s5) var(--s5);
}
.proj-board  { grid-area: board; }
.proj-matrix { grid-area: matrix; }
.proj-queue  { grid-area: queue; }

.proj-panel { background: var(--panel); padding: var(--s4) var(--s5) var(--s5); overflow: hidden; }
.proj-head { display: flex; align-items: baseline; gap: var(--s3); margin-bottom: var(--s3); }
.proj-head h2 {
  font: 800 14px/1 var(--grot);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
}
.proj-note { font: 500 14px/1 var(--grot); color: var(--ink-dim); }
.proj-body { height: calc(100% - 34px); overflow: hidden; }
/* the queue row is grid `auto`, so its body sizes to content instead */
.proj-queue .proj-body { height: auto; }

/* leaderboard: fixed row height is what keeps the redraw still */
table.proj-lb { width: 100%; border-collapse: collapse; }
table.proj-lb th {
  font: 700 12px/1 var(--grot);
  letter-spacing: 0.13em;
  color: var(--brass-deep);
  padding-bottom: var(--s2);
}
/* 15 entrants plus two baselines have to fit 1080px without scrolling, so the
   row height is derived from that, not chosen: 15×50 + 2×34 + header ≈ 830. */
table.proj-lb td {
  border-top: var(--hairline);
  padding: 4px var(--s3) 4px 0;
  height: 50px;
  vertical-align: middle;
}
table.proj-lb tr:first-child td { border-top: none; }
/* header cells must claim the same widths as the body, or the rank column
   collapses into the name and the whole row shifts on the first redraw */
table.proj-lb th:nth-child(1) { width: 52px; }
table.proj-lb th:nth-child(3) { width: 92px; }
table.proj-lb th:nth-child(4) { width: 128px; }
table.proj-lb th:nth-child(5) { width: 92px; }
table.proj-lb .rank { font: 700 26px/1 var(--mono); color: var(--ink-2); width: 52px; }
table.proj-lb .who-name { font: 700 18px/21px var(--grot); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.proj-lb .hyp-annotation { font-size: 13px; line-height: 15px; }
table.proj-lb .team { font: 600 13px/1 var(--mono); width: 92px; }
table.proj-lb .f1 { font: 700 30px/1 var(--mono); width: 128px; }
table.proj-lb .delta { font: 500 17px/1 var(--mono); width: 92px; }
table.proj-lb tr.baseline td { background: var(--panel-2); height: 38px; color: var(--brass); }
table.proj-lb tr.baseline .who-name { font-size: 15px; color: var(--brass); }
table.proj-lb tr.baseline .f1 { font-size: 18px; color: var(--ink-2); }
table.proj-lb tr:first-child:not(.baseline) .rank { color: var(--brass); }

/* matrix */
table.proj-mx { width: 100%; border-collapse: collapse; }
table.proj-mx th {
  font: 700 12px/1 var(--grot);
  letter-spacing: 0.12em;
  color: var(--brass-deep);
  padding-bottom: var(--s2);
}
table.proj-mx td {
  border-top: var(--hairline);
  padding: 7px var(--s3) 7px 0;
  font: 600 17px/1 var(--mono);
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}
table.proj-mx .cat { font: 500 16px/1.2 var(--grot); color: var(--ink-2); }
/* the worst category carries the argument: fill and weight, never an outline */
table.proj-mx tr.dominant td { background: var(--rust-fill); }
table.proj-mx tr.dominant .cat { color: var(--ink); font-weight: 700; }
.share-bar {
  display: inline-block;
  width: 70px; height: 9px;
  background: var(--ground);
  vertical-align: middle;
  margin-right: var(--s2);
  overflow: hidden;
}
.share-bar > i { display: block; height: 100%; background: var(--ochre); }
.share-num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* queue */
.proj-stats { display: flex; gap: var(--s2); margin-bottom: var(--s3); }
.proj-stats .stat { flex: 1; background: var(--panel-2); padding: var(--s2) var(--s3); text-align: center; }
.proj-stats .stat b {
  display: block;
  font: 800 30px/1.1 var(--mono);
  font-variant-numeric: tabular-nums;
}
.proj-stats .stat span {
  font: 600 11px/1 var(--grot);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.proj-stats .stat.lead b { color: var(--ochre); }
.proj-stats .stat.bad b { color: var(--rust); }
.proj-workers { font: 500 13px/1.4 var(--grot); margin: 0 0 var(--s2); }
.proj-jobs { list-style: none; margin: 0; padding: 0; font-size: 15px; }
.proj-jobs li {
  display: flex;
  gap: var(--s2);
  align-items: baseline;
  padding: 5px 0;
  border-top: var(--hairline);
  height: 30px;
}
.proj-jobs li.bad { color: var(--rust); }
.proj-jobs .st { color: var(--ink-dim); font-size: 13px; }
.proj-jobs .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ========================================================================== */
/* htmx                                                                       */
/* ========================================================================== */

/* refusals from a guarded action, surfaced where the operator is looking */
#toasts {
  position: fixed;
  right: var(--s5);
  bottom: var(--s5);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  max-width: 520px;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  background: var(--panel-3);
  padding: var(--s3) var(--s4);
  font: 400 14px/1.5 var(--grot);
  color: var(--ink);
}
.toast.warn { background: var(--ochre-fill); }
.toast.bad { background: var(--rust-fill); }
.toast b { font-family: var(--mono); font-weight: 700; flex: none; }
.toast.warn b { color: var(--ochre); }
.toast.bad b { color: var(--rust); }
.toast button {
  background: none;
  color: var(--ink-dim);
  padding: 0 0 0 var(--s2);
  font: 700 18px/1 var(--grot);
  flex: none;
}
.toast button:hover { background: none; color: var(--ink); }

.htmx-indicator { opacity: 0; transition: opacity 120ms; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
