/* Design tokens, read off the reference screenshot.
 *
 * Cream, warm ink, sage/dusty-red/tan, monospace everywhere, small-caps
 * labels with wide tracking. The big numbers are canvas dot-matrix, not text,
 * so the type scale here governs everything else.
 */
:root {
  --bg:        #efebe3;
  --bg-2:      #e8e3d9;
  --panel:     #f7f5f0;
  --panel-2:   #fbfaf6;
  --line:      #d8d3c8;
  --line-2:    #c6bfb0;
  --ink:       #2a2723;
  --ink-2:     #5d574c;
  /* Text tones. The palette was read off the reference, where these are used
   * for fills, and the same values were then used for 8-9px labels. Measured
   * on --panel (#f7f5f0) that gave: muted 3.2:1, sage 3.4:1, rust 3.8:1,
   * gold 1.7:1. All below the 4.5:1 WCAG AA floor for body text, which is
   * why most of the page was unreadable. These are the darkened variants. */
  --muted:     #6e6a5f;
  --muted-2:   #736f66;

  --sage:      #4c7350;
  --sage-2:    #7a9b76;
  --sage-bg:   #e4ebe1;
  --rust:      #a94e43;
  --rust-2:    #b5645a;
  --rust-bg:   #f2e2de;
  --tan:       #7a6a46;
  --tan-bg:    #efe7d6;
  /* --gold is a fill colour: bars, rules, decorative rules. It is never used
   * for text, because 1.7:1 is not text in any sense. */
  --gold:      #d4b87a;
  --violet:    #786a89;
  --violet-bg: #e8e3ec;

  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
          "Roboto Mono", monospace;

  --r: 4px;
  --pad: 14px;
  /* 8-9px is below the point where a monospace face stays legible, and these
   * labels carry the actual state of the system. */
  --label: 600 10.5px/1.3 var(--mono);
  --label-ls: 0.16em;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  background-image:
    radial-gradient(var(--line) 0.6px, transparent 0.6px);
  background-size: 22px 22px;
  color: var(--ink);
  font: 12px/1.55 var(--mono);
  padding: 0;
  min-height: 100vh;
}

.wrap { max-width: 1680px; margin: 0 auto; padding: 14px 18px 40px; }

/* ---------- type ---------- */
.lbl {
  font: var(--label);
  letter-spacing: var(--label-ls);
  color: var(--muted);
  text-transform: uppercase;
}
.lbl.on { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--sage); }
.neg { color: var(--rust); }
.mut { color: var(--muted); }
.tiny { font-size: 10.5px; line-height: 1.4; }
.sm { font-size: 11px; }
.bold { font-weight: 700; }

h1 {
  font: 700 15px/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
h2 {
  font: var(--label);
  letter-spacing: var(--label-ls);
  /* Headers were --muted, which made the structure of the page as faint as its
   * captions. They carry the hierarchy, so they get ink-2 (6.6:1). */
  color: var(--ink-2);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ---------- header ---------- */
header.top {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 9px 0 11px;
  border-bottom: 1px solid var(--line-2);
  margin-bottom: 12px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 600 9.5px/1 var(--mono);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  padding: 5px 9px;
  border: 1px solid var(--line-2);
  border-radius: 100px;
  background: var(--panel-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.pill.live { background: var(--sage-bg); border-color: var(--sage-2); color: var(--sage); }
.pill.warn { background: var(--tan-bg); border-color: var(--gold); color: var(--tan); }
.pill.bad  { background: var(--rust-bg); border-color: var(--rust-2); color: var(--rust); }
.pill.info { background: var(--violet-bg); border-color: var(--violet); color: var(--violet); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.dot.live { background: var(--sage); box-shadow: 0 0 0 3px var(--sage-bg); }
.dot.warn { background: var(--gold); box-shadow: 0 0 0 3px var(--tan-bg); }
.dot.bad  { background: var(--rust); box-shadow: 0 0 0 3px var(--rust-bg); }
.spacer { flex: 1; }

/* ---------- layout ---------- */
.row { display: grid; gap: 12px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); margin-bottom: 12px; }
.split { grid-template-columns: 1.55fr 1fr; }
@media (max-width: 1180px) { .split { grid-template-columns: 1fr; } }
.stack { display: grid; gap: 12px; align-content: start; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: var(--pad);
  min-width: 0;
}
.card.flush { padding: 0; overflow: hidden; }

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 18px;
  align-items: start;
}
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } }
#pnlHero { width: 100%; height: 118px; display: block; }

/* The realised line under the headline. Type, not dot-matrix: a 5x7 grid at
 * canvas height divided by seven rows resolves to about 1.6px per dot, which
 * is a smudge rather than a number. */
.real-row {
  display: flex; align-items: baseline; gap: 10px;
  padding: 9px 10px 0; margin-top: 4px;
  border-top: 1px solid var(--line-2);
}
.real-row .big { font: 700 16px/1 var(--mono); }
.real-row .tiny { margin-left: auto; }
.hero-sub {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 9px;
  font-size: 11.5px;
}
.hero-sub b { font-weight: 700; }

.callout {
  background: var(--tan-bg);
  border: 1px solid var(--gold);
  border-radius: var(--r);
  padding: 11px 13px;
}
.callout .big { font: 700 19px/1.1 var(--mono); margin: 5px 0 3px; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
th {
  text-align: left;
  font: var(--label);
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 7px 9px;
  border-bottom: 1px solid var(--line-2);
  text-transform: uppercase;
  white-space: nowrap;
}
td { padding: 6px 9px; border-bottom: 1px solid var(--bg-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--panel-2); }
.tw { overflow-x: auto; }

/* ---------- feed ---------- */
.feed { max-height: 460px; overflow-y: auto; }
.feed::-webkit-scrollbar { width: 6px; }
.feed::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }
.ev {
  display: grid;
  grid-template-columns: 62px 96px 1fr;
  gap: 10px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--bg-2);
  font-size: 11.5px;
  align-items: baseline;
}
.ev .t { color: var(--muted-2); font-size: 10.5px; }
.ev .k { font-weight: 700; letter-spacing: 0.06em; }
.k-fill { color: var(--sage); }
.k-veto { color: var(--tan); }
.k-nosig { color: var(--muted-2); }
.k-rveto { color: var(--violet); }

/* ---------- bars ---------- */
.bar { display: grid; grid-template-columns: 108px 1fr 46px; gap: 9px; align-items: center; margin-bottom: 6px; font-size: 11px; }
.track { height: 8px; background: var(--bg-2); border-radius: 2px; overflow: hidden; }
.fillbar { height: 100%; background: var(--tan); }
.fillbar.sage { background: var(--sage-2); }
.fillbar.rust { background: var(--rust-2); }
.fillbar.gold { background: var(--gold); }

/* ---------- decision chip ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  padding: 5px 9px;
  background: var(--panel-2);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.04em;
}
.chip.long  { background: var(--sage-bg); border-color: var(--sage-2); color: var(--sage); }
.chip.short { background: var(--rust-bg); border-color: var(--rust-2); color: var(--rust); }
.chip.flat  { background: var(--bg-2); color: var(--muted); }

/* ---------- notice ---------- */
.notice {
  border-radius: var(--r);
  padding: 10px 13px;
  margin-bottom: 12px;
  font-size: 11.5px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
}
.notice.warn { background: var(--tan-bg); border-color: var(--gold); color: var(--tan); }
.notice.bad  { background: var(--rust-bg); border-color: var(--rust-2); color: var(--rust); }
.notice.ok   { background: var(--sage-bg); border-color: var(--sage-2); color: var(--sage); }
.notice b { font-weight: 700; }

/* ---------- charts ---------- */
canvas.chart { display: block; width: 100%; }
.empty {
  padding: 22px 12px;
  text-align: center;
  color: var(--muted-2);
  font-size: 11px;
  line-height: 1.7;
}

/* ---------- ticker ---------- */
footer.tick {
  margin-top: 14px;
  padding: 9px 0 0;
  border-top: 1px solid var(--line-2);
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted);
}
footer.tick b { color: var(--ink-2); font-weight: 700; }

/* ---------- venue card ---------- */
.venue {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--bg-2);
}
.venue:last-child { border-bottom: 0; }
