/*
  The operator console: a strip board.

  Command and control, not the game's brand. The model is the air-traffic flight-strip board: a
  cool grey board, light strips on it, and on each strip a block whose colour says what state it
  is in. Colour on this console means state and nothing else:
    red    convicts or removes: diverged, banned, the destructive buttons, automatic bans on
    amber  needs a person or is held: review, paused, the dry run, on-the-name-only bans
    green  fine: clean, open, connected
    blue   where to go and what to do next: links, the main action of a form
  Public Sans for everything a person reads; JetBrains Mono only for what is literally code (match
  ids, addresses, packet bytes, zone clocks). Numbers are tabular. Labels are sentence case.
*/
:root {
  --board: #dde2e8;
  --strip: #f7f9fb;
  --strip-hi: #ffffff;
  --ink: #16202e;
  --ink-2: #536074;
  --line: #bcc5d1;
  --line-soft: #d6dce4;
  --rail: #1e2a3a;
  --rail-ink: #c9d3e0;
  --rail-hi: #2b3a4f;

  /* State colours. Red is a clean signal red with white on it; amber is a caution amber with dark
     ink on it (white on any amber light enough to read as amber is too faint, and a darker one
     reads as mud); each has a text tone for writing the state on the light board, and a wash. */
  --red: #d92d20;
  --red-text: #b42318;
  --red-wash: #fdecea;
  --red-line: #f2b8b2;
  --amber: #f5a300;
  --amber-ink: #2b1d00;
  --amber-text: #8a5400;
  --amber-wash: #fff4d6;
  --green: #1f7a4d;
  --green-wash: #def3e7;
  --grey: #667085;
  --grey-wash: #e8ebef;
  --blue: #1d5bb8;
  --brand-gold: #f4c64e; /* web/src/lib/palette.css --gold: the brand, and nothing else here */

  --rail-w: 212px;
  --gap: 20px;
  --radius: 3px;
  --sans: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--board); }
body { margin: 0; color: var(--ink); font: 14px/1.5 var(--sans); font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 2px;
}
code, .code, .id { font-family: var(--mono); font-size: 12.5px; }
.quiet { color: var(--ink-2); }
.red { color: var(--red-text); }
.amber { color: var(--amber-text); }
.green { color: var(--green); }
.sub { display: block; color: var(--ink-2); font-size: 12.5px; }
a.sub { color: var(--blue); width: max-content; }

/* ---- the shell: rail + work area ---------------------------------------------------------- */
.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px;
  padding: 18px 14px; background: var(--rail); color: var(--rail-ink);
}
/* The brand: the game's own wordmark (gold, its black backing dropped into the slate by
   `lighten`, as web/ does), and centred under it OPERATIONS in the brand's display face (Chakra
   Petch bold italic, the website's headline type) at its natural spacing. The rail and the
   sign-in card set it at two sizes. Gold is the brand's alone: no state on the console is ever gold. */
.mark, .gate-brand { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mark { padding: 2px 0 16px; border-bottom: 1px solid var(--rail-hi); }
a.mark:hover { text-decoration: none; }
.mark img, .gate-brand img { display: block; max-width: 100%; height: auto; mix-blend-mode: lighten; }
.brand-word {
  font-family: 'Chakra Petch', var(--sans); font-style: italic; font-weight: 700; text-transform: uppercase;
  line-height: 1; color: var(--brand-gold); font-size: 14px;
}
.gate-brand .brand-word { font-size: 18px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 8px; border-radius: var(--radius); color: var(--rail-ink); font-weight: 600;
}
.nav a:hover { background: var(--rail-hi); text-decoration: none; color: #fff; }
.nav a[aria-current="page"] { background: var(--strip); color: var(--ink); }
.count {
  min-width: 22px; padding: 0 6px; border-radius: 10px; text-align: center; font-size: 12px; font-weight: 700;
  line-height: 20px; background: var(--rail-hi); color: #fff;
}
.count.signal { background: var(--red); color: #fff; }
.nav a[aria-current="page"] .count:not(.signal) { background: var(--grey-wash); color: var(--ink); }
.find { display: flex; flex-direction: column; gap: 6px; padding: 0 8px; }
.find label { font-size: 12.5px; }
.find input { background: var(--rail-hi); border-color: #3b4d66; color: #fff; }
.find input::placeholder { color: #8d9bb0; }
.who { margin-top: auto; padding: 0 8px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.who form { margin: 0; }
.who button.link { color: var(--rail-ink); padding: 0; text-align: left; }

.work { min-width: 0; }
main { padding: 20px 28px 64px; max-width: 1600px; }

/* The status strip: the system's state on every page. */
.status {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 28px; background: var(--board); border-bottom: 1px solid var(--line);
}
.pills { display: flex; flex-wrap: wrap; gap: 8px; }

/* The bell: the notifications, at the strip's right end, its unread count on its shoulder. */
.bell {
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 38px; height: 34px; border-radius: var(--radius); color: var(--ink);
}
.bell:hover, .bell.current { background: var(--strip-hi); text-decoration: none; }
.bell.current { box-shadow: inset 0 0 0 1px var(--line); }
.bell .count { position: absolute; top: 0; right: -2px; min-width: 18px; line-height: 16px; padding: 0 4px; font-size: 11px; border: 2px solid var(--board); }
.pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px; border-radius: 12px;
  font-size: 13px; font-weight: 600; background: var(--grey-wash); color: var(--ink-2);
}
.pill i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.pill.green { background: var(--green-wash); color: var(--green); }
.pill.amber { background: var(--amber-wash); color: var(--amber-text); }
.pill.amber i { background: var(--amber); }
.pill.red { background: var(--red-wash); color: var(--red-text); }
.pill.red i { background: var(--red); }

/* ---- headings ------------------------------------------------------------------------------ */
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h1.id-title { font-family: var(--mono); font-size: 20px; font-weight: 600; }
h1.id-title .tag { font-family: var(--sans); }
h2 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 14px; font-weight: 700; }
.sub-head { margin: 18px 0 6px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 16px; }
.page-head form { margin: 0; }
.lede { margin: 4px 0 0; color: var(--ink-2); max-width: 72ch; }
.crumb { margin: 0 0 4px; font-size: 13px; }

/* ---- panels and the evidence / decision split ---------------------------------------------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--gap); align-items: start; }
.evidence, .decision { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.decision { position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow: auto; }
@media (max-width: 1080px) {
  .split { grid-template-columns: 1fr; }
  .decision { position: static; max-height: none; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .find, .who { display: none; }
  .status, main { padding-left: 14px; padding-right: 14px; }
}
.panel { background: var(--strip); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: -2px 0 10px; }
.decide + .decide { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.decide h3 { margin-bottom: 6px; }

/* ---- state tags ---------------------------------------------------------------------------- */
.tag {
  display: inline-block; padding: 1px 8px; border-radius: var(--radius); font-size: 12.5px; font-weight: 700;
  line-height: 20px; vertical-align: middle; white-space: nowrap;
}
.tag.red { background: var(--red); color: #fff; }
.tag.amber { background: var(--amber); color: var(--amber-ink); }
.tag.green { background: var(--green-wash); color: var(--green); }
.tag.grey { background: var(--grey-wash); color: var(--grey); }

/* ---- tables -------------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 8px 10px; vertical-align: top; overflow-wrap: anywhere; }
.num { text-align: right; white-space: nowrap; }
.act { text-align: right; white-space: nowrap; }
.act form { display: inline; margin: 0; }
.empty td { color: var(--ink-2); padding: 16px 10px; }

/* A grid: rows on a panel, separated by soft lines. */
.grid tbody tr { border-bottom: 1px solid var(--line-soft); }
.grid tbody tr:last-child { border-bottom: 0; }
.grid tr.hit td { background: var(--red-wash); }
table.narrow { max-width: 420px; }

/* The board: one strip per row, its state block on the left. */
.board { border-collapse: separate; border-spacing: 0 4px; }
.board thead th { border-bottom: 0; padding-bottom: 2px; }
.board .flag-col { width: 96px; }
.strip td { background: var(--strip-hi); border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.strip td:last-child { border-right: 1px solid var(--line-soft); border-radius: 0 var(--radius) var(--radius) 0; }
.strip td.flag { width: 96px; padding: 0; border: 0; border-radius: var(--radius) 0 0 var(--radius); height: 1px; }
.strip td.flag span {
  display: flex; align-items: center; height: 100%; min-height: 38px; padding: 0 10px;
  font-size: 12.5px; font-weight: 700; color: #fff; border-radius: var(--radius) 0 0 var(--radius);
}
/* Only the exceptions are loud: a fine state (clean, open) is a pale block, so a board of open
   queues reads quiet and the paused one stands out. */
.strip.tone-red td.flag span { background: var(--red); }
.strip.tone-amber td.flag span { background: var(--amber); color: var(--amber-ink); }
.strip.tone-green td.flag span { background: var(--green-wash); color: var(--green); }
.strip.tone-grey td.flag span { background: var(--grey); }
.id { white-space: nowrap; overflow-wrap: normal; }
.strip.unread td:not(.flag) { font-weight: 600; }
.strip.done td:not(.flag) { color: var(--ink-2); }
/* Each strip's state colour, for its hover outline and a reviewed row's stripe. */
.strip.tone-red { --tone: var(--red); }
.strip.tone-amber { --tone: var(--amber); }
.strip.tone-green { --tone: var(--green); }
.strip.tone-grey { --tone: var(--grey); }
.strip.done td.flag span { background: var(--grey-wash); color: var(--grey); box-shadow: inset 4px 0 0 var(--tone, var(--grey)); }
/* Hover outlines the whole strip, state block included, in its state's colour. */
.strip:hover td:not(.flag) { border-color: var(--tone, var(--line)); }
.strip:hover td.flag span { box-shadow: inset 0 1px 0 var(--tone), inset 1px 0 0 var(--tone), inset 0 -1px 0 var(--tone); }
.strip.done:hover td.flag span { box-shadow: inset 4px 0 0 var(--tone), inset 0 1px 0 var(--tone), inset 0 -1px 0 var(--tone); }
/* A row that leads somewhere: the whole row is the target (ops.js), so it says so on hover. */
tr.link-row { cursor: pointer; }
tr.link-row:hover td:not(.flag) { background: var(--strip); }
.new { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 9px; background: var(--blue); color: #fff; font-size: 11.5px; font-weight: 700; line-height: 18px; font-family: var(--sans); }
.board.compact .flag-col, .board.compact td.flag { width: 82px; }
.board.compact td.flag span { min-height: 32px; }
tr.section th { padding: 14px 10px 2px; font-size: 13px; color: var(--ink); border: 0; }

/* ---- facts ---------------------------------------------------------------------------------- */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; }
.facts dt { color: var(--ink-2); }
.facts dd { margin: 0; }
.facts.inline { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 6px; }
.facts.inline dt::after { content: ':'; }
.facts.inline dt { margin-right: -12px; }
.reasons { margin: 8px 0; padding-left: 18px; }
.note { margin: 8px 0; padding: 8px 10px; border-radius: var(--radius); background: var(--grey-wash); }
.note.red { background: var(--red-wash); color: var(--red-text); font-weight: 600; }
.note.amber { background: var(--amber-wash); color: var(--amber-text); }
.ban.standing { border-left: 4px solid var(--red); padding: 2px 0 2px 12px; }
.ban.standing > p { margin: 0 0 8px; }
.ban.standing form { margin-top: 10px; }
blockquote { margin: 8px 0 0; padding: 6px 10px; border-left: 3px solid var(--line); white-space: pre-wrap; color: var(--ink-2); }
.log { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.log li { display: grid; grid-template-columns: 128px 1fr; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line-soft); }
.log li:last-child { border-bottom: 0; }
.log time { color: var(--ink-2); font-size: 12px; }

/* ---- forms --------------------------------------------------------------------------------- */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; height: 32px; padding: 0 12px;
  font: 600 13px var(--sans); color: var(--ink); background: var(--strip-hi);
  border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; white-space: nowrap;
}
button:hover, .button:hover { border-color: var(--ink-2); text-decoration: none; }
button.primary, .button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
button.danger { color: var(--red-text); border-color: var(--red-line); }
button.danger:hover { background: var(--red); border-color: var(--red); color: #fff; }
button.link { background: none; border: 0; height: auto; font-weight: 400; color: var(--blue); }
input, select, textarea {
  font: 14px var(--sans); color: var(--ink); background: var(--strip-hi);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 0 9px; height: 32px; width: 100%;
}
textarea { height: auto; padding: 7px 9px; resize: vertical; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
.stack button { align-self: flex-start; }
.inline-form { display: flex; gap: 6px; margin: 6px 0 0; }
.inline-form input { flex: 1; width: auto; min-width: 0; }
.inline-form button { flex: none; }
/* Pause and Resume are the same button in the same place: a row reads the same open or paused,
   and only the confirmation inside the panel ("Pause queue") is red. */
.queues td.act button, details.pause > summary { min-width: 84px; }
details.pause { display: inline-block; }
details.pause > summary { list-style: none; }
details.pause > summary::-webkit-details-marker { display: none; }
details.pause[open] > summary { background: var(--grey-wash); border-color: var(--ink-2); }

/* The pause panel: drops under its own row, anchored to the cell's right edge, so it never pushes
   the table wider. Its table lets it overflow rather than clip it. */
td.act { position: relative; }
.table-wrap:has(.queues) { overflow: visible; }
/* `td.act form.popover`, not `.popover`: the cell's own `.act form { display: inline }` would win. */
td.act form.popover {
  position: absolute; right: 10px; top: calc(100% + 2px); z-index: 4; width: 340px;
  display: flex; flex-direction: column; gap: 12px; padding: 16px;
  background: var(--strip-hi); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(22, 32, 46, 0.18); text-align: left; white-space: normal;
}
.popover-title { margin: 0; font-weight: 700; font-size: 15px; }
.popover-text { margin: 0; color: var(--ink-2); font-size: 13px; line-height: 1.45; }
.popover label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.popover label .quiet { font-weight: 400; }
.popover-actions { display: flex; justify-content: flex-end; gap: 8px; }
button.danger.solid { background: var(--red); border-color: var(--red); color: #fff; }
button.danger.solid:hover { background: #a42814; border-color: #a42814; }

/* The line an action leaves behind. */
.flash { margin: 0 0 16px; padding: 10px 14px; border-radius: var(--radius); background: var(--green-wash); color: var(--green); font-weight: 600; }
.flash.bad { background: var(--red-wash); color: var(--red-text); }

/* ---- evidence ------------------------------------------------------------------------------ */
.replay { position: relative; aspect-ratio: 16 / 9; margin: 12px 0; background: #000; border-radius: var(--radius); overflow: hidden; }
.replay iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
tr.bytes td { padding-top: 0; }
.hex { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: baseline; font-size: 12.5px; }
.hex > span { color: var(--ink-2); }
.hex code { word-break: break-all; color: var(--ink-2); }
.hex mark { background: var(--red-wash); color: var(--red-text); font-weight: 600; padding: 0 1px; border-radius: 2px; }
details.more { margin-top: 10px; }
details.more > summary { cursor: pointer; color: var(--blue); font-weight: 600; }
.report-fold { background: var(--strip); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 16px; }
.report { font: 12px/1.55 var(--mono); color: var(--ink-2); white-space: pre; overflow-x: auto; margin: 10px 0 0; }
.aside-note { font-size: 13px; max-width: 80ch; margin: 0; }

/* ---- the zone's figures --------------------------------------------------------------------- */
.figures { display: flex; gap: 40px; flex-wrap: wrap; margin: 2px 0 8px; }
.figures > div { display: flex; flex-direction: column; }
.figure { font-size: 30px; font-weight: 700; line-height: 1.1; }
.figures > div > span:last-child { color: var(--ink-2); font-size: 13px; }

/* ---- sign in --------------------------------------------------------------------------------- */
body.bare { min-height: 100vh; display: grid; place-items: center; }
.gate-wrap { padding: 24px; }
.gate { width: min(420px, 100%); background: var(--strip); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
/* On the light card the wordmark sits on a slate band, where its black backing blends away. */
.gate { overflow: hidden; }
/* On the sign-in card the lockup sits centred in a slate band, where the wordmark's black backing
   blends away. */
.gate-brand { gap: 8px; margin: -28px -28px 22px; padding: 26px 28px 24px; background: var(--rail); }
.gate h1 { margin-bottom: 6px; }
.gate .note { background: none; padding: 0; color: var(--ink-2); }
.error { color: var(--red-text); font-weight: 600; }
