:root {
  color-scheme: light dark;
  --accent: #3d6be0;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --border: #d6dae2;
  --text: #14181f;
  --text-dim: #5b6472;
  --ok: #1f7a4d;
  --warn: #9a6400;
  --bad: #b3261e;
  --busy: #2f5fb3;
  --idle: #6b7280;
  /*
   * The series palette (Phase 37) — a fixed order, assigned by position and never cycled.
   *
   * ★ Separate tokens from the status colours above, and that separation is a rule rather than
   * tidiness: a status colour means good/stale/broken, and reusing one as "series 4" makes a line
   * on a chart look like a verdict about it. These six are also kept clear of the status hues for
   * the same reason in the other direction.
   *
   * Validated rather than chosen by eye: every adjacent pair clears the deuteranopia and
   * tritanopia separation floors, every step sits inside the light mode lightness band with enough
   * chroma not to read as grey, and all six clear 3:1 against this surface. A seventh is not a
   * generated hue — seriesColour() folds the tail instead, because a generated seventh is
   * indistinguishable from one of these under colour-vision deficiency.
   */
  --series-1: #1b63c4;
  --series-2: #c05621;
  --series-3: #0a9396;
  --series-4: #8338ec;
  --series-5: #b07d00;
  --series-6: #d81b7a;
  /* Gridlines and axes: one step off the surface, hairline, solid, recessive. */
  --grid: #e3e7ee;
  --radius: 10px;
  --gutter: 16px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #101318;
    --surface: #171b22;
    --surface-2: #1f242d;
    --border: #2c333e;
    --text: #e7eaf0;
    --text-dim: #99a3b3;
    --ok: #4cc38a;
    --warn: #e0a458;
    --bad: #ff6b60;
    --busy: #7aa2f7;
    --series-1: #5a8ae0;
    --series-2: #d1702f;
    --series-3: #1b9f97;
    --series-4: #9d66dd;
    --series-5: #ad8828;
    --series-6: #db5a90;
    --grid: #2a303a;
    --idle: #8b95a5;
  }
}

:root[data-theme='dark'] {
  --bg: #101318;
  --surface: #171b22;
  --surface-2: #1f242d;
  --border: #2c333e;
  --text: #e7eaf0;
  --text-dim: #99a3b3;
  --ok: #4cc38a;
  --warn: #e0a458;
  --bad: #ff6b60;
  --busy: #7aa2f7;
  --series-1: #5a8ae0;
  --series-2: #d1702f;
  --series-3: #1b9f97;
  --series-4: #9d66dd;
  --series-5: #ad8828;
  --series-6: #db5a90;
  --grid: #2a303a;
  --idle: #8b95a5;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

header.top {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 12px var(--gutter);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
header.top .mark { font-weight: 650; letter-spacing: 0.01em; }
header.top .workspace { color: var(--text-dim); font-size: 13px; }
header.top nav { display: flex; gap: 14px; flex-wrap: wrap; }
header.top .who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; }

main { max-width: 1080px; margin: 0 auto; padding: 20px var(--gutter) 64px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 28px 0 10px; }
p.lede { color: var(--text-dim); margin: 0 0 20px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.card h3 { margin: 0 0 8px; font-size: 15px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid currentColor;
}
.pill.ok { color: var(--ok); }
.pill.warn { color: var(--warn); }
.pill.bad { color: var(--bad); }
.pill.busy { color: var(--busy); }
.pill.idle { color: var(--idle); }

.banner {
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 14px;
}
.banner.warn { border-color: var(--warn); }
.banner.bad { border-color: var(--bad); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-dim); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: 0; }
.wrap { overflow-x: auto; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; font-size: 14px; }
dl.facts dt { color: var(--text-dim); }
dl.facts dd { margin: 0; }

form.inline { display: inline; }
button, .button {
  font: inherit;
  padding: 7px 13px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--bad); border-color: var(--bad); }
button[disabled] { opacity: 0.5; cursor: not-allowed; }

label { display: block; font-size: 13px; color: var(--text-dim); margin: 10px 0 4px; }
input, select, textarea {
  font: inherit;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
textarea { min-height: 96px; resize: vertical; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 0; margin: 10px 0 0; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend .swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.legend .count { color: var(--text-dim); }

.empty { color: var(--text-dim); font-size: 14px; margin: 0; }

/*
 * SOOPER Observe's charts (Phase 37).
 *
 * ★ The four states are distinguished here by more than colour: the state line carries a glyph and a
 * word, and a panel with no measurement has no plot element at all. The rules below only tint what
 * the markup has already said in text — so a stylesheet that fails to load costs the colour and keeps
 * the meaning.
 */
.chart { margin: 0; }
.chart figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  font-size: 13px;
  margin-bottom: 8px;
}
.chart .state { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.chart .state.ok { color: var(--ok); }
.chart .state.warn { color: var(--warn); }
.chart .state.bad { color: var(--bad); }
.chart .state.idle { color: var(--text-dim); }
.chart .detail { color: var(--text-dim); }
.chart .plot { display: block; overflow: visible; }

/*
 * The no-plot box. It keeps the panel's height so a grid does not reflow when one tile loses its
 * data, and holds words rather than geometry — there is deliberately no line, no axis and no
 * baseline that could be read as a measured nought.
 */
.chart .noplot {
  height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 14px;
}
.chart.warn .noplot { border-color: var(--warn); }
.chart.bad .noplot { border-color: var(--bad); }
.chart .noplot .glyph { font-size: 22px; line-height: 1; }

.chart .axis {
  list-style: none;
  display: flex;
  justify-content: space-between;
  padding: 0;
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--text-dim);
  /* Columns of numbers align; a lone display value does not — see the stat tile below. */
  font-variant-numeric: tabular-nums;
}
.chart .legend .folded { color: var(--text-dim); font-style: italic; }
.chart .notes {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--text-dim);
}
.chart .values { margin-top: 8px; font-size: 12px; }
.chart .values summary { color: var(--text-dim); cursor: pointer; }
.chart .values table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.chart .values th, .chart .values td {
  text-align: left;
  padding: 3px 6px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

/*
 * The stat tile. A measured value gets the big proportional figure; a tile with nothing measured
 * puts the glyph and the word in the number's place, at the number's size — so a row of tiles shows
 * a shape that is not a digit, which is the fastest signal that it is not a measurement.
 */
.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.stat.warn { border-color: var(--warn); }
.stat.bad { border-color: var(--bad); }
.stat .label { font-size: 13px; color: var(--text-dim); }
.stat .value { font-size: 30px; font-weight: 600; line-height: 1.1; }
.stat .value.unmeasured {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  color: var(--text-dim);
}
.stat.warn .value.unmeasured, .stat.warn .state { color: var(--warn); }
.stat.bad .value.unmeasured { color: var(--bad); }
.stat .state { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.stat .detail { font-size: 12px; color: var(--text-dim); }
.stat .spark { display: block; margin-top: 2px; }

.panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--gutter);
}

/*
 * ⚠ Forced colours: the system supplies every colour and the hatch and series hues are gone. The
 * glyphs and words survive, which is the reason they are in the markup rather than in a ::before rule.
 */
@media (forced-colors: active) {
  .chart .noplot { border: 1px dashed CanvasText; }
  .chart .plot path { stroke: CanvasText; }
}
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.events { max-height: 340px; overflow-y: auto; list-style: none; padding: 0; margin: 0; }
.events li { display: flex; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.events .seq { color: var(--text-dim); min-width: 4ch; text-align: right; }

footer.bottom {
  border-top: 1px solid var(--border);
  padding: 16px var(--gutter);
  color: var(--text-dim);
  font-size: 13px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px; z-index: 10; }

@media (max-width: 560px) {
  header.top { gap: 8px; }
  header.top .who { margin-left: 0; width: 100%; }
  main { padding-top: 14px; }
}