:root {
  --bg: #0b1116;
  --panel: #141c23;
  --panel-2: #1b252e;
  --line: #26333e;
  --text: #e6edf3;
  --muted: #8b9aa8;
  --accent: #00b4a0;
  --accent-dim: #0e6c62;
  --measured: #4c8bf5;
  --warn: #e0a030;
  --bad: #e0574a;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 16px; margin: 0; letter-spacing: 0.2px; }
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
nav button:hover { color: var(--text); background: var(--panel-2); }
nav button.active { color: var(--text); background: var(--panel-2); border-color: var(--line); }

.who { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.who a { color: var(--muted); }

main { padding: 24px; max-width: 1400px; margin: 0 auto; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.panel h2 { font-size: 14px; margin: 0 0 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; }
.panel.center { text-align: center; padding: 48px; }

.hint { color: var(--muted); font-size: 13px; margin: -4px 0 14px; max-width: 76ch; }

/* Explicit breakpoints rather than auto-fit. auto-fit packs as many columns as fit,
   which at intermediate widths produced a 3+1 layout with one card orphaned on its own
   row. Four, two or one is always balanced. */
.cards { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 18px; }
@media (min-width: 560px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .cards { grid-template-columns: repeat(4, 1fr); } }
/* Without this a long value inside a card stretches the track past its share. */
.cards > * { min-width: 0; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 4px;
}
.card .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; display: flex; align-items: center; gap: 6px; }
.card strong { font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; }
.card .sub { color: var(--muted); font-size: 12px; }
.card.accent { border-color: var(--accent-dim); }
.card.accent strong { color: var(--accent); }
.card.measured strong { color: var(--measured); }

.badge {
  background: var(--measured); color: #06101f;
  font-size: 10px; padding: 1px 6px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.6px; font-weight: 700;
}

.info {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
  width: 17px; height: 17px; border-radius: 50%; cursor: pointer;
  font-size: 11px; line-height: 1; padding: 0;
}
.info:hover { color: var(--text); }

.note {
  background: var(--panel-2); border: 1px solid var(--line);
  border-left: 3px solid var(--warn);
  border-radius: 6px; padding: 12px 14px; margin-bottom: 18px;
  color: var(--muted); font-size: 13px; max-width: 90ch;
}

.split { display: grid; grid-template-columns: 1fr; gap: 18px; }
/* Three panels, so the only balanced layouts are three columns or one. Two would
   leave one panel alone on the second row. */
@media (min-width: 1000px) { .split { grid-template-columns: repeat(3, 1fr); } }
/* Grid items default to min-width:auto, so a table wider than its share pushes the
   track open and the last column is clipped by the panel. This is what cut off the
   AVOIDED column. */
.split > * { min-width: 0; }

/* A table can still be wider than its panel on a narrow window, for instance the key
   list with its long identifiers. Scrolling the table is the honest fallback: shrinking
   the font or hiding a column loses information the page exists to show. */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
/* Model ids have no spaces and are long, so they need an explicit break opportunity or
   they define the column width on their own. */
td { overflow-wrap: anywhere; }
/* Numbers must never wrap: a figure split across two lines is unreadable, and these
   columns are narrow anyway. */
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
.empty { color: var(--muted); font-size: 13px; padding: 8px 0; }

.chart { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding-top: 8px; }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; min-width: 6px; position: relative; }
.bar .baseline-fill { background: var(--panel-2); border-top: 2px solid var(--muted); }
.bar .actual-fill { background: var(--accent); border-radius: 2px 2px 0 0; }
.bar:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  background: #000; color: var(--text); font-size: 11px; padding: 5px 8px;
  border-radius: 5px; white-space: pre; z-index: 5; border: 1px solid var(--line);
}
.legend { color: var(--muted); font-size: 12px; margin: 10px 0 0; display: flex; gap: 16px; align-items: center; }
.swatch { width: 11px; height: 11px; border-radius: 3px; display: inline-block; margin-right: 5px; vertical-align: -1px; }
.swatch.actual { background: var(--accent); }
.swatch.baseline { background: var(--panel-2); border: 1px solid var(--muted); }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
input, select, textarea {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 8px 10px; border-radius: 6px; font: inherit; font-size: 14px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-dim); }
textarea { width: 100%; min-height: 260px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

button, .button {
  background: var(--accent); color: #04120f; border: none;
  padding: 8px 16px; border-radius: 6px; cursor: pointer;
  font: inherit; font-weight: 600; font-size: 14px; text-decoration: none;
  display: inline-block;
}
button:hover, .button:hover { filter: brightness(1.1); }
button.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
button.danger { background: transparent; color: var(--bad); border: 1px solid var(--line); }

code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.secret {
  background: #000; border: 1px solid var(--accent-dim); border-radius: 6px;
  padding: 12px; word-break: break-all; margin: 10px 0;
}
.warn-text { color: var(--warn); }
.bad-text { color: var(--bad); }
.muted { color: var(--muted); }

.pill { font-size: 11px; padding: 2px 7px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel-2); }
.pill.eu { border-color: var(--accent-dim); color: var(--accent); }
.pill.us { border-color: var(--warn); color: var(--warn); }
.pill.off { color: var(--muted); }

#toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 11px 18px; border-radius: 8px; font-size: 14px; z-index: 50;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
#toast.bad { border-color: var(--bad); }
