:root {
  --bg: #fbfbfa;
  --ink: #1b1b19;
  --muted: #6b6b66;
  --rule: #e2e2dd;
  --halt-bg: #fdf1ef;
  --halt-ink: #8c2f20;
  --halt-rule: #e7c3bc;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16161a;
    --ink: #e8e8e4;
    --muted: #9a9a94;
    --rule: #2c2c31;
    --halt-bg: #2a1a18;
    --halt-ink: #f0b4a8;
    --halt-rule: #533029;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 24px;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 20px; }
h1 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.meta { margin: 0; color: var(--muted); font: 12px/1.4 var(--mono); }

/* A halt is the one thing that must be impossible to miss, and readable without interaction. */
.banner {
  border: 1px solid var(--halt-rule);
  background: var(--halt-bg);
  color: var(--halt-ink);
  padding: 12px 14px;
  border-radius: 6px;
  margin-bottom: 18px;
}
.banner .banner-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.banner .banner-reason { font: 13px/1.5 var(--mono); white-space: pre-wrap; }

table.desk { width: 100%; border-collapse: collapse; }
table.desk th, table.desk td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
table.desk thead th {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--ink);
}
table.desk .num { text-align: right; font-family: var(--mono); white-space: nowrap; }
table.desk td.sleeve { font-family: var(--mono); font-weight: 500; }
table.desk td.positions { font-family: var(--mono); font-size: 13px; color: var(--muted); }
table.desk td.when { font-family: var(--mono); font-size: 13px; color: var(--muted); white-space: nowrap; }

.state { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.state-running { color: var(--ink); }
.state-halted { color: var(--halt-ink); }
.state-stale { color: #8a6212; }
.state-empty { color: var(--muted); }

.empty { color: var(--muted); font-style: italic; }

section.orders { margin-top: 32px; }
section.orders h2 { font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
table.orders { width: 100%; border-collapse: collapse; }
table.orders th, table.orders td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--rule); font-size: 13px; }
table.orders td.id { font-family: var(--mono); color: var(--muted); }

.foot { margin-top: 28px; color: var(--muted); font-size: 12px; }
.foot p { margin: 0; }

/* Forward record: a ranked table where "why not ranked" is a column, not a footnote. */
section.record { margin-top: 32px; }
section.record h2 {
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}
table.record-table { width: 100%; border-collapse: collapse; }
table.record-table th, table.record-table td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
  vertical-align: top;
}
table.record-table td.num, table.record-table th.num { text-align: right; font-family: var(--mono); }
table.record-table td.rank { font-family: var(--mono); color: var(--muted); width: 2em; }

/* A section label for the record grid. Styled here rather than in record.css so that file stays
   the designer's single responsibility. */
.record-heading {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin: 28px 0 10px;
}
