/* status.ezo.dev — layered on the shared EZO Labs theme.
 *
 * This is an instrument, not a landing page. The shared theme's vocabulary
 * (pure black, hairline rules, mono eyebrows, no rounded corners) is kept
 * intact; what changes is the budget. Marketing pages spend vertical space to
 * slow you down — here every band of pixels either carries a number or
 * separates two that would otherwise run together.
 *
 * Reading order is fixed and shallow: verdict, incidents, chart, table, log. */

:root {
  --ok: #3fb950;
  --warn: #d29922;
  --bad: #e06c75;
  --unknown: #5f646d;
  --row-hover: rgba(255, 255, 255, 0.028);
  /* Wider than the marketing pages: a ten-column table at 1180px forces
   * either truncated model names or a horizontal scroll on a desktop. */
  --maxw: 1400px;
  /* The page edge, notch included. Identical to --gutter everywhere the insets
   * are zero — which is every desktop and every phone in portrait — so this can
   * be used unconditionally, and only starts doing work when a landscape phone
   * puts a camera cutout over the left rule of the table. Named because the
   * phone's full-bleed strips have to cancel it exactly. */
  --edge-l: max(var(--gutter), env(safe-area-inset-left, 0px));
  --edge-r: max(var(--gutter), env(safe-area-inset-right, 0px));
}

/* Same property as the shared sheet's rule, not the physical longhand, so the
 * two cascade against each other unambiguously. */
.wrap { padding-inline: var(--edge-l) var(--edge-r); }

body {
  background: var(--bg);
  /* Digits must not reflow when the 60s refresh lands. */
  font-variant-numeric: tabular-nums;
}

/* A modal that lets the page scroll behind it is the tell that it is a web
 * modal. Paired with overscroll-behavior on the sheet itself, which stops the
 * scroll chaining the moment the sheet's own content runs out. */
body.drawer-open { overflow: hidden; }

/* Nothing here wants the grey flash iOS paints over a tapped control, and every
 * one of them is a tap target rather than something to double-tap-zoom. */
button,
summary,
select,
.grid tbody tr,
.legend tbody tr,
.incident {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  /* Static, not fixed: this page is scrolled to read rows, and a floating bar
   * costs 56px of table on every laptop for a link nobody clicks mid-scan. */
  position: static;
  background: rgba(0, 0, 0, 0.6);
  border-bottom: 1px solid var(--hairline-soft);
}
.site-header .wrap { height: 54px; }

/* Third child of a space-between row. The auto margin eats the free space to
 * its right, so the freshness stays welded to the wordmark instead of drifting
 * into the middle of the header. */
.header-live {
  margin-right: auto;
  margin-left: clamp(16px, 2vw, 26px);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted-dim);
  white-space: nowrap;
}

/* ---------- summary ---------- */
.summary { padding-block: clamp(22px, 3vw, 34px) clamp(16px, 2.2vw, 24px); }

/* The banner is the whole answer for a visitor who reads one thing. Tone is
 * carried by a left rule and a wash rather than by tinting the words, so the
 * headline stays at full contrast while the strip still reads green or amber
 * from across a room. */
.banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 22px;
  padding: clamp(16px, 2vw, 22px) clamp(16px, 2.2vw, 26px);
  border: 1px solid var(--hairline-soft);
  border-left: 2px solid var(--ok);
  background: rgba(63, 185, 80, 0.05);
}
.banner[data-tone="warn"] { border-left-color: var(--warn); background: rgba(210, 153, 34, 0.06); }
.banner[data-tone="bad"] { border-left-color: var(--bad); background: rgba(224, 108, 117, 0.06); }

.banner-glyph { font-size: 12px; color: var(--ok); line-height: 1; }
.banner[data-tone="warn"] .banner-glyph { color: var(--warn); }
.banner[data-tone="bad"] .banner-glyph { color: var(--bad); }

/* The headline is a fixed question now, so the colour is what answers it. That
 * reverses the old rule here — tone deliberately stayed off the words while
 * they were the verdict, to keep the verdict at full contrast. A constant
 * question has no contrast to protect, and tinting it is the only way the
 * largest thing on the page carries any state at all. */
.banner h1 {
  font-size: clamp(20px, 2.6vw, 30px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 500;
  margin: 0;
  color: var(--heading);
}
.banner h1[data-tone="ok"] { color: var(--ok); }
.banner h1[data-tone="warn"] { color: var(--warn); }
.banner h1[data-tone="bad"] { color: var(--bad); }

.tally {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-left: auto;
}
.tally-chip { font-size: 11.5px; letter-spacing: 0.045em; }

/* The one moving thing on the page. */
.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  margin-right: 8px;
  vertical-align: middle;
  animation: livepulse 2.6s ease-in-out infinite;
}
@keyframes livepulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

.kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 8px clamp(24px, 3vw, 44px);
  margin: 0;
}
.kpis div { min-width: 74px; }
.kpis dt {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted-dim);
}
.kpis dd {
  margin: 5px 0 0;
  font-size: clamp(20px, 2.2vw, 27px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--heading);
}
.kpis dd[data-tone="warn"] { color: var(--warn); }
.kpis dd[data-tone="bad"] { color: var(--bad); }
/* The two named-model KPIs take the same scale as the column they point at, so
 * the headline and its row are never two colours for one measurement. */
.kpis dd[data-band="fast-3"] { color: #3fb950; }
.kpis dd[data-band="fast-2"] { color: #5fcf7a; }
.kpis dd[data-band="fast-1"] { color: #86c9a0; }
.kpis dd[data-band="even"] { color: var(--heading); }
.kpis dd[data-band="slow-1"] { color: #cbb26a; }
.kpis dd[data-band="slow-2"] { color: var(--warn); }
.kpis dd[data-band="slow-3"] { color: var(--bad); }

/* The one KPI that names a model is a way into that model. Styled as the text
 * it replaced rather than as a button, because a chrome-heavy control in a row
 * of plain figures reads as the odd one out — the mark, the underline on hover
 * and the pointer are enough to say it is clickable. */
.kpi-open {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  text-align: left;
}
.kpi-open:hover span { border-bottom: 1px solid currentColor; }
.kpi-open:focus-visible { outline: 1px solid var(--accent-soft); outline-offset: 3px; }
/* Optically matched to the figure beside it rather than to the table's 8px
 * swatch: this sits against 27px type, where the row mark's size disappears. */
.kpi-open .swatch-mark,
.kpi-open .swatch { width: 17px; height: 17px; flex: none; }
/* The deviation reads under the name, not beside it. Inline, a long model name
 * and its multiple made one 40-character line at display size that wrapped
 * mid-phrase on anything narrower than a laptop, and the eye had to find where
 * the name stopped and the claim about it started. Stacked, the name is the
 * headline and the multiple is its caption, which is the order they are read in
 * anyway. Left-aligned with the label above rather than indented past the mark:
 * three left edges in a column beat two. */
.kpis dd small {
  display: block;
  margin-top: 6px;
  font-size: 0.55em;
  font-weight: 400;
  line-height: 1.25;
  color: var(--muted-dim);
  letter-spacing: 0;
}

/* ---------- footer stats ---------- */
/* Where the three fleet-wide aggregates went. One mono line at the weight of
 * the copyright beside it: label in the dim uppercase the KPI terms use, figure
 * a step brighter so the pairs still read as pairs, and nothing sized to catch
 * an eye on the way past. */
.footer-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 7px;
  margin: 0;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
}
.footer-stats dt {
  color: var(--muted-dim);
  text-transform: uppercase;
}
/* Right margin, not a gap, so the pair stays tighter to itself than to the next
 * one — and the unit on "2.9s" keeps its case. */
.footer-stats dd {
  margin: 0 clamp(14px, 2.5vw, 30px) 0 0;
  color: var(--muted);
}
.footer-stats dd:last-of-type { margin-right: 0; }

/* ---------- open incidents ---------- */
/* One row: model, the fault, how long it has been open. Recovering models are
 * omitted in status.js — they are currently OK, and this strip is for what is
 * wrong right now. */
.incidents { padding-block: clamp(6px, 1vw, 12px) clamp(18px, 2.4vw, 28px); }
.incidents:empty { display: none; }

.section-label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-dim);
  font-weight: 500;
  margin: 0 0 12px;
}

.incidents-clear {
  margin: 0;
  padding-block: 4px;
  font-size: 13.5px;
  color: var(--muted);
}

.incident {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px 14px;
  border: 1px solid var(--hairline-soft);
  border-left: 2px solid var(--warn);
  padding: 10px 14px;
  margin-bottom: 1px;
}
.incident[data-severity="down"] { border-left-color: var(--bad); }
.incident[data-severity="unknown"] { border-left-color: var(--unknown); }

.incident .sev { font-size: 11.5px; letter-spacing: 0.05em; flex: none; }

/* The model is the headline; the chip, the fault and the age qualify it. */
.incident-model {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--heading);
  flex: none;
}

.issue-detail {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.issue-when {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-dim);
  white-space: nowrap;
  flex: none;
  margin-left: auto;
}

.incident-open {
  background: none;
  border: 1px solid var(--hairline-soft);
  color: var(--muted-dim);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 5px 10px;
  cursor: pointer;
  flex: none;
  transition: color 0.18s ease, border-color 0.18s ease;
}
.incident-open:hover { color: var(--heading); border-color: var(--accent-soft); }
.incident-open:focus-visible { outline: 1px solid var(--accent-soft); outline-offset: 1px; }

/* ---------- board sections ---------- */
/* The incident log's heading was the only .board-title on the page; it is now a
 * <summary> and styled as .fold-title, so the old rule went with it. */
.board { padding-block: clamp(22px, 3vw, 34px); border-top: 1px solid var(--hairline-soft); }

/* ---------- disclosure folds ----------
 *
 * A section that is shut has to say what it is holding, or nobody opens it. The
 * summary is the whole hit target and carries the count; the chevron is
 * generated off [open] rather than written into the markup, so it cannot drift
 * out of step with the state the browser owns. */
.fold > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  padding-block: 4px;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary:focus-visible { outline: 1px solid var(--accent-soft); outline-offset: 3px; }
.fold[open] > summary { margin-bottom: 12px; }

.fold-title {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-dim);
  font-weight: 500;
  transition: color 0.18s ease;
}
.fold-count {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  color: var(--muted-dim);
  opacity: 0.75;
}
.fold > summary::after {
  content: "";
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--muted-dim);
  border-bottom: 1.5px solid var(--muted-dim);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.fold[open] > summary::after { transform: translateY(2px) rotate(225deg); }
.fold > summary:hover .fold-title { color: var(--heading); }
.fold > summary:hover::after { border-color: var(--heading); }

/* ---------- toolbar ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-bottom: 18px;
}
.pillset { display: flex; border: 1px solid var(--hairline-soft); }
/* `display: flex` outranks the UA rule for [hidden], and the scale switch is
 * hidden outright on metrics where a log axis is meaningless. */
.pillset[hidden] { display: none; }
.pillset button {
  background: none;
  border: 0;
  border-left: 1px solid var(--hairline-soft);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  padding: 8px 13px;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}
.pillset button:first-child { border-left: 0; }
.pillset button:hover { color: var(--heading); background: var(--row-hover); }
.pillset button.on {
  color: #fff;
  background: rgba(59, 110, 246, 0.16);
  box-shadow: inset 0 -1px 0 var(--accent-soft);
}
.pillset button:focus-visible { outline: 1px solid var(--accent-soft); outline-offset: -2px; }

.filter input {
  background: none;
  border: 1px solid var(--hairline-soft);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  padding: 8px 12px;
  width: 190px;
  transition: border-color 0.18s ease;
}
.filter input::placeholder { color: var(--muted-dim); letter-spacing: 0.045em; text-transform: uppercase; }
.filter input:focus { outline: none; border-color: var(--accent-soft); }
.filter input::-webkit-search-cancel-button { filter: invert(0.5); }

.toolbar-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted-dim);
}
.toolbar-end a { color: var(--muted-dim); }
.toolbar-end a:hover { color: var(--accent-soft); }

/* The plot's disclosure, standing where the plot would be.
 *
 * Sized and tinted to be found without being looked for: with the chart folded
 * there is nothing else on screen to suggest one exists, so a quiet link in the
 * toolbar's corner would hide the page's best feature behind an act of faith.
 * Full width, accent-tinted, with a caret that turns — the three signals that
 * say "there is more here" without a word of instruction. */
.chart-fold {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 4px 0 0;
  padding: 15px 18px;
  background: rgba(59, 110, 246, 0.07);
  border: 1px solid rgba(59, 110, 246, 0.34);
  color: var(--heading);
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease;
}
.chart-fold:hover {
  background: rgba(59, 110, 246, 0.14);
  border-color: var(--accent);
}
.chart-fold:focus-visible { outline: 1px solid var(--accent-soft); outline-offset: 2px; }

/* Points down at the thing it will reveal, and up at the thing it will fold. */
.chart-fold-caret {
  width: 0;
  height: 0;
  flex: none;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--accent-soft);
  transition: transform 0.18s ease;
}
.chart-fold[aria-expanded="true"] .chart-fold-caret { transform: rotate(180deg); }

.chart-fold-label { color: #fff; }
/* What is behind the fold, in the words of the pills that decide it. Pushed to
 * the far end so the label stays the thing the eye lands on. */
.chart-fold-hint {
  margin-left: auto;
  color: var(--muted-dim);
  letter-spacing: 0.045em;
  text-align: right;
}
/* Once the plot is open the bar has done its job and should stop competing with
 * it — the chart above is the loudest thing in the section, not its handle. */
.chart-fold[aria-expanded="true"] {
  margin: 0 0 14px;
  padding: 9px 14px;
  background: none;
  border-color: var(--hairline-soft);
}
.chart-fold[aria-expanded="true"] .chart-fold-label { color: var(--muted); }
.chart-fold[aria-expanded="true"]:hover {
  background: var(--row-hover);
  border-color: var(--accent-soft);
}

@media (max-width: 560px) {
  /* The hint drops rather than wrapping the bar onto two ragged lines. */
  .chart-fold-hint { display: none; }
}

/* The scope row sits between the metric toolbar and the plot, so it reads as
 * narrowing everything below it rather than as a second, competing toolbar. */
.toolbar-scope {
  padding-top: 2px;
  margin-bottom: 16px;
}
.toolbar-scope .count { white-space: nowrap; }

/* ---------- chart ---------- */
.chart-host { position: relative; }
.chart-wrap { position: relative; }
.chart { width: 100%; height: auto; display: block; touch-action: pan-y; }
.chart-grid { stroke: rgba(255, 255, 255, 0.06); stroke-width: 1; }
/* The 1.00 line on a ratio plot. Brighter than a gridline because it is not one
 * tick among four — it is the line every series is being compared against, and
 * "above it" is the whole reading. */
.chart-rule { stroke: rgba(255, 255, 255, 0.34); stroke-width: 1; stroke-dasharray: 2 4; }
.chart-rule { stroke: rgba(255, 255, 255, 0.28); stroke-width: 1; }
.chart-tick {
  fill: var(--muted-dim);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
}
.chart-empty { fill: var(--muted-dim); font-family: var(--mono); font-size: 12.5px; }
.chart-series { transition: opacity 0.18s ease; }
.chart-series.muted { opacity: 0.12; }

/* Hover readout. Anchored to a percentage of the plot width so it tracks the
 * crosshair without a second layout read per pointer event. */
.readout {
  position: absolute;
  top: 8px;
  z-index: 2;
  pointer-events: none;
  min-width: 190px;
  /* Deliberately unclipped. This panel exists to rank every model at one
   * instant, and a max-height would drop the fastest ones off the bottom with
   * no indication — reading as "12 models" on a 14-model board. When the
   * roster outgrows the plot it overlaps the legend instead, which is
   * recoverable in a way that missing rows is not. */
  background: rgba(4, 5, 8, 0.94);
  border: 1px solid var(--hairline);
  padding: 9px 11px;
}
.readout[data-flip="left"] { transform: translateX(calc(-100% - 14px)); }
.readout[data-flip="right"] { transform: translateX(14px); }
.readout-when {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted-dim);
  margin-bottom: 7px;
}
.readout-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
.readout-row i { width: 7px; height: 7px; flex: none; }
.readout-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.readout-row b {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--heading);
}

/* The row for the line the cursor is actually on. The negative margin cancels
 * the panel's own padding so the band runs edge to edge — inset it would read
 * as a nested control rather than as a highlight over the whole row.
 *
 * Deliberately a lift in contrast rather than a colour: every row already
 * carries the series colour in its swatch, and tinting the text would put two
 * colour codings on the same line. */
.readout-row[data-near] {
  color: var(--heading);
  background: rgba(255, 255, 255, 0.07);
  margin-inline: -11px;
  padding-inline: 11px;
}
.readout-row[data-near] i { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22); }

/* ---------- legend ---------- */
/* Chart and legend share a row. The legend column is fixed rather than
 * fractional: it holds two number columns whose width does not change with the
 * viewport, and letting it flex would make the plot jump on every resize. */
.plot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px;
  gap: clamp(14px, 1.6vw, 26px);
  align-items: start;
}
/* Same trap as .pillset above: `display: grid` outranks the UA rule for
 * [hidden], and the plot is folded away until it is asked for. Without this the
 * legend keeps its column beside an empty gap where the chart used to be. */
.plot[hidden] { display: none; }

.legend {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.legend th {
  text-align: left;
  padding: 0 0 7px;
  border-bottom: 1px solid var(--hairline-soft);
  font-weight: 400;
}
.legend th.num { text-align: right; }
.legend th button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted-dim);
  transition: color 0.18s ease;
}
.legend th button:hover { color: var(--heading); }
.legend th[aria-sort="ascending"] button::after { content: " \2191"; color: var(--accent-soft); }
.legend th[aria-sort="descending"] button::after { content: " \2193"; color: var(--accent-soft); }

.legend tbody tr {
  cursor: pointer;
  transition: background 0.16s ease, opacity 0.16s ease;
}
.legend tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
.legend tbody tr:focus-visible { outline: 1px solid var(--accent-soft); outline-offset: -1px; }
.legend tbody tr.off { opacity: 0.35; }
.legend tbody tr.off i { background: var(--muted-dim) !important; }
.legend td {
  padding: 5px 0;
  border-bottom: 1px solid var(--hairline-soft);
  color: var(--muted);
  white-space: nowrap;
}
.legend td:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 150px;
}
.legend td:first-child span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.legend td i { width: 8px; height: 8px; flex: none; }
.legend td.num {
  text-align: right;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--heading);
  padding-left: 12px;
}
.legend td.num.dim { color: var(--muted-dim); }

/* The legend ranks a measurement, which says nothing about health — a degraded
 * model can post the fastest p95 on the board. Beside the chart that is
 * harmless, because the status column is a glance away; on a phone this table
 * is a full-width block read on its own, several screens above the table, so
 * anything not green is marked here too. Drawn at every width and revealed only
 * on the phone, where there is room for it. */
.legend-state { display: none; }

/* ---------- table ---------- */
.table-scroll { overflow-x: auto; }

/* A phone affordance living in a shared table. The desktop grid keeps every row
 * in sort position and never draws this. */
.ok-fold { display: none; }

/* A column sliced by the viewport edge reads as a rendering bug. The mask fades
 * the cut instead, which says "there is more to the right" without a scrollbar
 * — and it resolves to nothing once the table fits, so the wide layout is
 * untouched. */
.table-scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--hairline) transparent;
  mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%);
}
.table-scroll[data-scrolled="end"],
.table-scroll[data-scrolled="none"] {
  mask-image: none;
  -webkit-mask-image: none;
}
.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.grid th, .grid td {
  padding: 0;
  text-align: left;
  white-space: nowrap;
}
.grid thead th {
  border-bottom: 1px solid var(--hairline);
  font-weight: 400;
}
.grid thead th > button,
.grid thead th > span {
  display: block;
  width: 100%;
  background: none;
  border: 0;
  color: var(--muted-dim);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: inherit;
  padding: 0 14px 9px;
  cursor: pointer;
  transition: color 0.18s ease;
}
.grid thead th > span { cursor: default; }
.grid thead th:first-child > button { padding-left: 0; }
.grid thead th > button:hover { color: var(--heading); }
.grid thead th[aria-sort] > button { color: var(--accent-soft); }
/* The caret is generated rather than markup so the sort state cannot drift
 * out of sync with aria-sort. */
.grid thead th[aria-sort="descending"] > button::after { content: " ↓"; }
.grid thead th[aria-sort="ascending"] > button::after { content: " ↑"; }
.grid th.num, .grid td.num { text-align: right; font-variant-numeric: tabular-nums; }

.grid tbody tr {
  border-bottom: 1px solid var(--hairline-soft);
  cursor: pointer;
  transition: background 0.16s ease;
}
.grid tbody tr:hover { background: var(--row-hover); }
.grid tbody tr:focus-visible { outline: 1px solid var(--accent-soft); outline-offset: -1px; }
.grid tbody td { padding: 11px 14px; color: var(--text); }
.grid tbody td:first-child { padding-left: 0; }
.grid tbody td:last-child { padding-right: 0; }

.cell-model { display: flex; align-items: baseline; gap: 10px; }
.cell-model .swatch { width: 8px; height: 8px; flex: none; align-self: center; }
.cell-model .name { color: var(--heading); font-weight: 500; letter-spacing: -0.01em; }
.cell-model .provider {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  color: var(--muted-dim);
}
.grid td.num { color: var(--heading); }
/* An absent reading is a fact, not a zero — it is dimmed and marked, never
 * rendered as a figure that could be compared against a real one. */
.grid td.num.dim { color: var(--muted-dim); }

/* ---------- verdict + drift, merged ----------
 *
 * One cell carrying both: the chip is the status (colour and glyph), the number
 * inside it is where the model sits against its OWN trailing baseline. Above
 * 1.00 is better than usual, below is worse.
 *
 * The chip takes its colour from the status alone, so the two can never argue —
 * the verdict owns the hue, and the number is left to speak for itself. A green
 * chip reading 0.50x says exactly what it should: the board has not called this
 * yet, and it is still half its usual speed. */
.grid td.col-drift { text-align: right; }
.grid td.col-drift .state { font-variant-numeric: tabular-nums; }

/* ---------- the fast/slow scale ----------
 *
 * Seven steps, diverging about 1.00. Above and below are different hue families
 * rather than two intensities of one, so the sign of the movement lands before
 * the digits are read; within a family the intensity carries the size, so 1.9x
 * and 1.2x are not the same green.
 *
 * The status glyph is still in the chip and still carries the verdict, which is
 * what keeps this readable in greyscale and to a colourblind reader — the
 * colour here is about magnitude, and magnitude alone.
 *
 * `--speed-fg` is set per band and consumed once, so a band is one line to add
 * and impossible to set half of. */
.grid td.col-drift .state[data-band] {
  color: var(--speed-fg);
  background: color-mix(in srgb, var(--speed-fg) 13%, transparent);
  border-color: color-mix(in srgb, var(--speed-fg) 42%, transparent);
}
/* Comfortably quicker than its own normal — as far above 1 as a called
 * incident is below it. */
.grid td.col-drift .state[data-band="fast-3"] { --speed-fg: #3fb950; }
.grid td.col-drift .state[data-band="fast-2"] { --speed-fg: #5fcf7a; }
.grid td.col-drift .state[data-band="fast-1"] { --speed-fg: #86c9a0; }
/* On its own form. Deliberately the quietest thing in the column: a model doing
 * exactly what it always does is not news, and should not compete for the eye
 * with the rows that are. */
.grid td.col-drift .state[data-band="even"] { --speed-fg: #9aa3ad; }
.grid td.col-drift .state[data-band="slow-1"] { --speed-fg: #cbb26a; }
.grid td.col-drift .state[data-band="slow-2"] { --speed-fg: #d29922; }
/* Past the ratio health.js would open an incident at. */
.grid td.col-drift .state[data-band="slow-3"] { --speed-fg: #e06c75; }
/* No reading at all: not a position on the scale, so it takes none of it. */
.grid td.col-drift .state[data-band="none"] { --speed-fg: #5f646d; }

/* State is never colour alone: every state also carries a glyph and a word,
 * so it survives colourblindness and a greyscale screenshot. */
/* A status is the fastest thing on the page to find, so it is a filled chip
 * rather than coloured text: a tinted block with a border survives peripheral
 * vision, a greyscale screenshot and a 200ms glance. The glyph and the word
 * both stay, so colour is never the only carrier. */
.state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
  white-space: nowrap;
  padding: 4px 10px;
  border: 1px solid currentColor;
  border-radius: 2px;
  line-height: 1.25;
}
.state[data-status="operational"] { color: var(--ok); background: rgba(63, 185, 80, 0.12); }
.state[data-status="degraded"] { color: var(--warn); background: rgba(210, 153, 34, 0.14); }
.state[data-status="down"] { color: var(--bad); background: rgba(224, 108, 117, 0.14); }
.state[data-status="unknown"] { color: var(--unknown); background: rgba(255, 255, 255, 0.05); }
.state[data-status="recovering"] { color: var(--ok); background: rgba(63, 185, 80, 0.12); }

/* The tally and the incident header use the same vocabulary at a smaller
 * weight — a chip inside a chip would be noise. */
.tally-chip, .incident .sev { border-radius: 2px; }

.col-bar { width: 1%; }
.uptime {
  display: flex;
  gap: 2px;
  align-items: stretch;
  min-width: 164px;
  height: 26px;
}
.uptime-cell {
  flex: 1 1 0;
  min-width: 3px;
  background: var(--unknown);
  border-radius: 1px;
  transition: transform 0.12s ease;
}
.uptime:hover .uptime-cell { opacity: 0.55; }
.uptime .uptime-cell:hover { opacity: 1; transform: scaleY(1.18); }
.uptime-cell[data-tone="ok"] { background: var(--ok); }
.uptime-cell[data-tone="warn"] { background: var(--warn); }
.uptime-cell[data-tone="bad"] { background: var(--bad); }
.uptime-cell[data-tone="none"] { background: rgba(255, 255, 255, 0.075); }

.legend-note {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 16px 0 0;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  color: var(--muted-dim);
}
.uptime-key { display: inline-flex; align-items: center; gap: 8px; }
.uptime-key .uptime-cell { width: 14px; height: 9px; flex: none; }

.count { font-variant-numeric: tabular-nums; }
.empty-row td {
  color: var(--muted-dim);
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  padding-block: 26px;
}

/* ---------- history ---------- */
.history { list-style: none; margin: 0; padding: 0; }
.history li {
  padding: 10px 0;
  border-top: 1px solid var(--hairline-soft);
  font-size: 13.5px;
  color: var(--muted);
  display: flex;
  gap: 12px;
  align-items: baseline;
}
.history li:first-child { border-top: 0; }
.history .when {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  color: var(--muted-dim);
  white-space: nowrap;
}
.history .empty {
  color: var(--muted-dim);
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

/* ---------- detail drawer ---------- */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: clamp(12px, 3vw, 40px);
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.drawer[hidden] { display: none; }
/* Density over drama. The panel is a working readout, not a hero: the earlier
 * poster-sized title and 38px gutters pushed the second chart below the fold on
 * a 1080p screen, so a visitor had to zoom out to compare two of the four
 * series this panel exists to show side by side. */
.drawer-panel {
  width: min(100%, 1180px);
  max-height: min(880px, 92svh);
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--hairline);
  padding: clamp(16px, 1.8vw, 24px);
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--hairline-soft);
}
/* The vendor mark, where the "[ DETAIL ]" eyebrow used to sit. It says whose
 * model this is and, tinted with the series colour, which line in the chart
 * behind the panel it is — two jobs the word "detail" did neither of.
 *
 * Larger than the 15px mark in a table row: standing alone beside a 21px title
 * rather than in a column of its own kind, it read as a stray bullet at row
 * size. min-width:0 so a long model name truncates rather than shoving the
 * close button off the panel edge. */
/* Top-aligned, not centred. The provider line under the title wraps to two lines
 * on a phone, and centring against the whole block dropped the mark to sit
 * beside "openrouter · 1,048,576k context" instead of beside the name it
 * belongs to. Anchored to the title, it stays put however the line below wraps. */
.drawer-ident {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  min-width: 0;
}
.drawer-mark { display: flex; flex: none; }
.drawer-mark:empty { display: none; }
.drawer-mark .swatch-mark,
.drawer-mark .swatch { width: 27px; height: 27px; flex: none; }
.drawer-head h2 {
  font-size: clamp(17px, 1.7vw, 21px);
  font-weight: 500;
  color: var(--heading);
  letter-spacing: -0.012em;
  margin: 0;
}
.drawer-provider {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  color: var(--muted-dim);
  margin-top: 4px;
}
.drawer-close {
  background: none;
  border: 1px solid var(--hairline);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 7px 12px;
  cursor: pointer;
  flex: none;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.drawer-close:hover { color: var(--heading); border-color: var(--accent-soft); }

/* ---------- drawer hero ----------
 *
 * Every measurement against this model's own baseline, before any chart. The
 * charts show the shape of the last day; this answers the question that opened
 * the panel — "worse than usual, and by how much" — in one pass of the eye.
 *
 * Auto-fit rather than a fixed count, so six stats become three-and-three on a
 * laptop and two-and-two on a phone without a breakpoint for each. */
.drawer-hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 16px 24px;
  margin: 0 0 26px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--hairline-soft);
}
.drawer-hero dt {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted-dim);
}
.drawer-hero dd {
  margin: 5px 0 0;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--heading);
}
.drawer-hero dd.dim { color: var(--muted-dim); }
/* The comparison, not the headline: it carries the tone, the figure above it
 * stays at full contrast so the reading itself is never hard to make out. */
.drawer-hero small {
  display: block;
  margin-top: 4px;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--muted);
}
.drawer-hero small[data-tone="ok"] { color: var(--ok); }
.drawer-hero small[data-tone="warn"] { color: var(--warn); }
.drawer-hero small[data-tone="bad"] { color: var(--bad); }
.drawer-hero small.dim { color: var(--muted-dim); }

/* Two charts per row above 900px: four stacked plots is four screens of
 * scrolling for a comparison that fits in one. */
.drawer-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 22px;
  margin-bottom: 18px;
}
@media (max-width: 900px) {
  .drawer-charts { grid-template-columns: minmax(0, 1fr); }
}
/* A plot that takes the row rather than a column. Round trip is the one reading
 * in this grid that compares across models rather than against this model's own
 * history, so it is worth the width — and at half a row beside p95 it would read
 * as a second latency plot. Below the stacking breakpoint every cell is already
 * full width and the rule is a no-op. */
.drawer-charts .drawer-chart-wide { grid-column: 1 / -1; }

.drawer-section { margin-bottom: 18px; }
/* The lead chart: the composite the four plots below it are the evidence for.
 * Extra air underneath, because the grid that follows reads as one block and
 * without the gap this looks like the first cell of it rather than the summary
 * of all four. */
.drawer-lead { margin-bottom: 28px; }
.drawer-section > h3 {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted-dim);
  margin: 0 0 8px;
  font-weight: 500;
}

.matrix {
  display: grid;
  /* auto-fit, not auto-fill: the task list rarely divides evenly into the row,
     and an unfilled auto-fill track shows through as a bordered empty cell. */
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 1px;
  background: var(--hairline-soft);
  border: 1px solid var(--hairline-soft);
}
.matrix-cell { background: var(--bg); padding: 9px 11px; }
.matrix-cell .task {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  color: var(--muted-dim);
}
.matrix-cell .rate { font-size: 15px; font-weight: 500; margin-top: 4px; }
.matrix-cell .rate[data-tone="ok"] { color: var(--ok); }
.matrix-cell .rate[data-tone="warn"] { color: var(--warn); }
.matrix-cell .rate[data-tone="bad"] { color: var(--bad); }
.matrix-cell .rate[data-tone="none"] { color: var(--muted-dim); }

.note {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.65;
  max-width: 66ch;
  padding-block: clamp(24px, 3vw, 36px);
  border-top: 1px solid var(--hairline-soft);
  margin: 0;
}
.note a { color: var(--accent-soft); }

/* ---------- responsive ---------- */
/* The shared theme collapses its nav into a hamburger below 900px. This page
 * has three links and no menu button, so it wraps them instead. */
@media (max-width: 780px) {
  .site-header .wrap {
    height: auto;
    flex-wrap: wrap;
    gap: 4px 16px;
    padding-block: 11px;
  }
  .brand { font-size: 12.5px; letter-spacing: 0.055em; }
  .nav { gap: 18px; }
  .nav a { font-size: 12px; letter-spacing: 0.05em; }
  /* The wrapping row supplies its own gap, and the auto margin is what would
   * push the nav onto a second line on a narrow phone. */
  .header-live { margin-inline: 0; font-size: 11.5px; }
}

/* Incident log rows: component and impact are their own columns so the eye can
 * run down "which model" without reading through each measurement. */
.log-component {
  min-width: 148px;
  color: var(--heading);
}
.log-detail {
  color: var(--muted);
  flex: 1;
  min-width: 0;
}

@media (max-width: 1080px) {
  /* Below this the plot is too narrow to read a full roster of lines against a fixed
   * 268px column, so the legend goes under the chart and spreads its rows. */
  .plot { grid-template-columns: minmax(0, 1fr); }
  .legend { margin-top: 6px; }
  .legend td:first-child { max-width: none; }
}

@media (max-width: 900px) {
  .summary { align-items: flex-start; }
  .kpis { gap: 8px 26px; }
  .toolbar-end { margin-left: 0; width: 100%; }
  .filter input { width: 100%; }
  .filter { flex: 1 1 160px; }
  /* Below this width the table always scrolls, so the model name is pinned:
   * a latency figure with no model beside it is unreadable. */
  .grid td:first-child, .grid th:first-child {
    position: sticky;
    left: 0;
    background: var(--bg);
    padding-right: 16px;
  }
  .grid tbody tr:hover td:first-child { background: #0a0b0d; }
}

@media (max-width: 640px) {
  .drawer-panel { max-height: 94svh; }
  .readout { min-width: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; opacity: 1; }
  .grid tbody tr, .pillset button, .legend tbody tr, .chart-series { transition: none; }
  .drawer { backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* ---------- interaction ----------
 *
 * Everything clickable has to look clickable before it is hovered, and confirm
 * the hover the instant it happens. The board is dense enough that a reader
 * scanning it needs the row under the pointer to separate itself from the
 * the rest around it — a background tint alone does not do that at this row
 * height, so the active row also grows a coloured edge. */

.grid tbody tr[data-model],
.incident,
.legend tbody tr {
  transition: background 0.14s ease, box-shadow 0.14s ease, opacity 0.14s ease;
}

/* Table rows: an inset left edge in the model's own series colour, so the row
 * you are pointing at is the line you are looking at in the chart. */
.grid tbody tr[data-model] { cursor: pointer; }
.grid tbody tr[data-model]:hover { background: var(--row-hover); }
.grid tbody tr[data-model]:hover td:first-child { box-shadow: inset 2px 0 0 var(--accent-soft); }
.grid tbody tr[data-model]:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: -2px;
}
.grid tbody tr[data-model]:active { background: rgba(255, 255, 255, 0.05); }

/* Incident cards are the whole hit target, so they lift as one. */
.incident { cursor: pointer; }
.incident:hover { background: rgba(255, 255, 255, 0.028); }
.incident:hover .incident-open { color: var(--heading); border-color: var(--accent-soft); }
.incident:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; }

.incident-open {
  transition: color 0.16s ease, border-color 0.16s ease;
  pointer-events: none;
}

/* Legend rows already fade the other series on hover; this is the local half
 * of that feedback. */
.legend tbody tr:hover td { color: var(--heading); }

/* Pills and links get a real pressed state rather than only a hover colour. */
.pillset button:active { transform: translateY(1px); }
.toolbar-end a { transition: color 0.16s ease; }

/* The crosshair and its dots must never eat the pointermove they exist to
 * follow — without this the readout flickers as the cursor crosses a marker. */
.chart-rule, .chart-markers circle { pointer-events: none; }

/* The dot on the line under the cursor. Ringed in the page background so the
 * size step survives a series colour that sits close to its neighbours. */
.chart-marker-near { stroke: var(--bg); stroke-width: 1.4; }

@media (prefers-reduced-motion: reduce) {
  .grid tbody tr[data-model],
  .incident,
  .legend tbody tr,
  .chart-series,
  .uptime-cell,
  .incident-open { transition: none; }
  .pillset button:active { transform: none; }
  .uptime .uptime-cell:hover { transform: none; }
}

/* ---------- deviation layer ----------
 *
 * Netdata's idiom: the band is where this model normally lives, the vertical
 * block is when it left. Both sit under the line and both are deliberately
 * low-contrast — they are the backdrop the line is read against, and a fill
 * loud enough to compete with the series would defeat the point.
 *
 * Tone is amber, not red: crossing the threshold is what *opens* an incident,
 * and hysteresis means a single breaching bucket is not yet a verdict. */
.chart-band { fill: rgba(210, 153, 34, 0.055); }
.chart-baseline {
  stroke: rgba(255, 255, 255, 0.28);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.chart-limit {
  stroke: rgba(210, 153, 34, 0.5);
  stroke-width: 1;
  stroke-dasharray: 2 4;
}
/* The "this is normal" strip on the composite. Green rather than the amber of
 * a deviation band: this one marks the range a model is SUPPOSED to be in, and
 * borrowing the warning colour for it would invert the meaning of the only
 * shading on the plot. Kept fainter than the gridlines so a line crossing it
 * still reads as the brightest thing in the frame. */
.chart-zone { fill: rgba(63, 185, 80, 0.07); }
.chart-zone-edge {
  stroke: rgba(63, 185, 80, 0.3);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}
.chart-zone-label {
  fill: rgba(63, 185, 80, 0.55);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
}

.chart-flag { fill: rgba(210, 153, 34, 0.13); }
.chart-flag[data-tone="bad"] { fill: rgba(224, 108, 117, 0.15); }

.deviation-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin-top: 8px;
  font-size: 11.5px;
  line-height: 1.4;
}
.deviation-note:empty { display: none; }
.deviation-scale { color: var(--muted-dim); }
.deviation-clear { color: var(--ok); }
.deviation-chip {
  color: var(--warn);
  border: 1px solid rgba(210, 153, 34, 0.35);
  background: rgba(210, 153, 34, 0.08);
  border-radius: 2px;
  padding: 2px 8px;
}
/* The deviation chips under the four metric plots only ever report a breach, so
 * warn is the right default. The composite's chip reports wherever the score
 * landed — including a good day — and a green reading in an amber chip is the
 * one way this caption could contradict itself. */
.deviation-chip[data-tone="ok"] {
  color: var(--ok);
  border-color: rgba(63, 185, 80, 0.32);
  background: rgba(63, 185, 80, 0.08);
}
.deviation-chip[data-tone="bad"] {
  color: var(--bad);
  border-color: rgba(224, 108, 117, 0.35);
  background: rgba(224, 108, 117, 0.09);
}

/* Vendor mark doubling as the series swatch. Sized a touch larger than the
 * square it replaced — a logo needs the extra pixels to stay recognisable,
 * and simple-icons marks are drawn to read at this size. */
.swatch-mark {
  width: 15px;
  height: 15px;
  flex: none;
  display: block;
}

/* Provider filter pills carry the provider's mark. Every pill is a flex row,
 * not just the ones with a glyph — scoping this with :has() left the "All" pill
 * laying out as a block beside flex siblings, which is a vertical-alignment bug
 * waiting for a font change to expose. `currentColor` means the mark brightens
 * with its label on hover and on the selected pill, with no second rule to keep
 * in step. */
.pillset button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.pill-mark {
  width: 13px;
  height: 13px;
  flex: none;
  display: block;
  opacity: 0.85;
}
.pillset button.on .pill-mark,
.pillset button:hover .pill-mark { opacity: 1; }

/* Double-click solos a series, so the row must not also select its own text —
 * user-select stops the flash of highlight across the name and both numbers. */
.legend tbody tr {
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- phones ----------
 *
 * The board is a dense instrument and stays one on a phone; what changes is
 * the chrome around the numbers. Three real problems, measured rather than
 * assumed: the provider pillset was 549px against a 390px viewport and could
 * not wrap, every control was a 32px tap target against the 44px guideline,
 * and the log rows kept desktop column widths that forced a sideways scroll. */
@media (max-width: 700px) {
  /* A segmented control that does not fit is not a segmented control. Below
   * this width the pills become individually bordered chips on one
   * horizontally-scrolling line — the phone idiom, and the reason six
   * providers, five metrics and four ranges cost four rows here instead of
   * seven. The shared border of the desktop treatment cannot survive either a
   * line break or a scroll, so it is dropped and each chip carries its own.
   *
   * The strip runs to both screen edges rather than stopping at the gutter, so
   * the chip the fold cuts in half is the thing that announces there is more —
   * a row of chips ending in whitespace reads as a row of chips that ended.
   *
   * Deliberately not scroll-snapped. Snapping resolves against the scrollport
   * rather than the padding, so it parked the leading chip flush against the
   * screen edge while every strip too short to scroll kept its gutter — one row
   * of controls aligned two different ways down a single screen. */
  .pillset {
    border: 0;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    /* Stops a sideways flick on a strip turning into the browser's back
     * gesture, which on iOS it otherwise does the moment the strip runs out. */
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    /* The width has to be stated. As a stretched item in the column toolbar the
     * strip would size to max-content instead — six unshrinkable chips, 572px
     * against a 390px screen — and a box wider than the viewport cannot scroll
     * its own overflow, because it has none. Stated as the container's content
     * box plus the two gutters it then cancels with negative margins, which is
     * the bleed. */
    width: calc(100% + var(--edge-l) + var(--edge-r));
    min-width: 0;
    margin-inline: calc(-1 * var(--edge-l)) calc(-1 * var(--edge-r));
    padding-inline: var(--edge-l) var(--edge-r);
  }
  .pillset::-webkit-scrollbar { display: none; }
  .pillset button {
    flex: none;
    border: 1px solid var(--hairline-soft);
    min-height: 44px;
    padding: 10px 14px;
  }
  .pillset button:first-child { border-left: 1px solid var(--hairline-soft); }
  .pillset button.on { border-color: var(--accent-soft); }

  /* One control per line. A wrapping row cannot hold a full-bleed strip — the
   * strip is wider than its own row — and stacking is what lets each pillset
   * scroll independently rather than as one queue of eighteen chips. */
  .toolbar,
  .toolbar-scope {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  /* Kills the desktop `flex: 1 1 100%` on .filter, which in a column means
   * "as tall as the toolbar". */
  .toolbar > *,
  .toolbar-scope > * { flex: none; }
  .toolbar-end { margin-left: 0; width: 100%; }
  /* The definite width and the min-width are both load-bearing: an <input>
   * refuses to be stretched below the width of its `size` attribute — twenty
   * characters, 532px at 16px mono — so without them the search box hung 180px
   * past the right edge of a 390px screen.
   *
   * 16px exactly, because anything smaller and iOS zooms the viewport on focus,
   * which leaves the visitor scrolled sideways on a page that has no sideways. */
  .filter { width: 100%; min-width: 0; }
  .filter input { width: 100%; min-width: 0; min-height: 44px; font-size: 16px; }

  /* Thumb-sized rows. The table was already 49px; the legend was not, and it
   * is the one a reader taps repeatedly to isolate a line. */
  .legend td { padding: 11px 0; }
  .legend th button { min-height: 40px; }

  /* Not colour alone, and not a glyph alone: the chip carries both plus the
   * word, so it survives a greyscale screenshot and says which of degraded,
   * down and unconfirmed it means. The name beside it keeps the ellipsis it
   * already had — a long model name gives way to the fact that it is broken. */
  .legend td:first-child .legend-state {
    display: inline-flex;
    align-items: center;
    flex: none;
    overflow: visible;
    gap: 5px;
    padding: 2px 7px;
    border: 1px solid currentColor;
    border-radius: 2px;
    font-family: var(--sans);
    font-size: 11px;
    line-height: 1.35;
    white-space: nowrap;
  }
  .legend-state[data-status="degraded"] { color: var(--warn); background: rgba(210, 153, 34, 0.14); }
  .legend-state[data-status="down"] { color: var(--bad); background: rgba(224, 108, 117, 0.14); }
  .legend-state[data-status="unknown"] { color: var(--unknown); background: rgba(255, 255, 255, 0.05); }

  /* Taller than the desktop floor: on a narrow plot a full roster of lines needs the
   * vertical room more, not less, and there is no legend beside it competing
   * for the space.
   *
   * Scoped to the board. The drawer's plots share the .chart-host class and were
   * being stretched to the same floor — but an SVG scales its viewBox uniformly,
   * so a 150-tall chart forced to 260 does not get a taller plot, it gets the
   * same plot letterboxed inside 110px of dead space. Each drawer chart already
   * asks for the height it wants. */
  #chart svg { min-height: 260px; }

  /* The readout is anchored to a percentage of plot width; at 390px a 190px
   * panel plus its 14px offset runs off whichever edge it flips toward. */
  .readout { min-width: 0; max-width: 74vw; }
  .readout-row { font-size: 12px; }

  /* Desktop column minimums here forced the log itself to scroll sideways. */
  .history li { flex-wrap: wrap; gap: 2px 10px; }
  .log-component { min-width: 0; flex: 1 1 100%; }
  .log-detail { flex: 1 1 100%; }
  .history .when { margin-left: 0; }

  /* One line still, minus the Detail chip — the whole row is the hit target. */
  .incident { padding: 10px 12px; gap: 6px 10px; }
  .incident-open { display: none; }
  .incident-model { font-size: 14px; }

  .banner { gap: 10px 14px; }
  .tally { margin-left: 0; width: 100%; }
  .kpis { gap: 12px 22px; }
  .kpis div { min-width: 0; flex: 1 1 40%; }
}

@media (max-width: 480px) {
  /* Two per row rather than four cramped ones. */
  .kpis div { flex: 1 1 44%; }
  .drawer-panel { padding: 18px 16px; }
}

/* ---------- the table, on a phone ----------
 *
 * Nine columns cannot be a table at 390px. Sideways-scrolling it kept the
 * shape but destroyed the job: you could see a model name or its numbers,
 * never both, and comparing two models meant scrolling, remembering, scrolling
 * back. Below this width each row becomes a card — name and status on one
 * line, the 24h history under it, then the measurements as a labelled grid.
 *
 * Done in CSS off the existing markup rather than by rendering a second
 * component: one table stays the source of truth, so a column added to the
 * desktop view cannot go missing here. The labels come from data-label, set in
 * cell_num(). */
.sort-mobile { display: none; }

@media (max-width: 700px) {
  /* The scroller and its edge mask exist to manage overflow that no longer
   * happens; left on, the mask fades the bottom card for no reason. */
  .table-scroll {
    overflow-x: visible;
    mask-image: none;
    -webkit-mask-image: none;
  }

  /* Pinned while the cards scroll under it. The header on this page is static
   * precisely so a bar like this can own the top edge — and the control that
   * orders a list is the one you want back without scrolling to the top of it,
   * which is the whole reason a phone list has a section header at all. */
  .sort-mobile {
    display: flex;
    align-items: center;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 4;
    background: var(--bg);
    padding-block: 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--hairline-soft);
  }
  .sort-mobile label {
    font-family: var(--mono);
    font-size: 11.5px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted-dim);
  }
  /* The platform's own select arrow is drawn in the platform's own colour,
   * which on a black page is a light-grey wedge floating in a dark field. The
   * chevron below is the same one the folds use, at the same weight. 16px for
   * the same reason the filter is: iOS zooms anything smaller on focus. */
  .sort-mobile select {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    appearance: none;
    -webkit-appearance: none;
    background-color: transparent;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%235f646d' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    background-size: 11px 7px;
    color: var(--text);
    border: 1px solid var(--hairline-soft);
    border-radius: 0;
    font: inherit;
    font-size: 16px;
    padding: 0 34px 0 12px;
  }
  .sort-mobile button {
    min-width: 44px;
    min-height: 44px;
    background: transparent;
    border: 1px solid var(--hairline-soft);
    color: var(--muted);
    font-size: 15px;
    cursor: pointer;
  }
  .sort-mobile button:hover { color: var(--heading); border-color: var(--accent-soft); }

  .grid { display: block; width: 100%; }
  /* Flex, not block: it is what lets the fold below reorder rows in CSS, so the
   * render can keep emitting them in sort order for everyone else. */
  .grid tbody { display: flex; flex-direction: column; width: 100%; }
  /* The header carried the sort affordance, which #sort-mobile now owns. */
  .grid thead { display: none; }

  /* ---------- the healthy models, folded ----------
   *
   * A full roster of cards is several screens, nearly all of which say "fine". The list
   * opens on whatever is not fine and puts the rest behind one tap, wherever
   * the sort would otherwise have scattered them — a phone list is read top
   * down, so grouping beats ranking here. Rows keep their sort order inside
   * each group, and the DOM keeps it outright: this is `order` and `display`,
   * so the desktop table, the tab order and the CSV are all untouched. */
  .grid:not([data-ok-open]) tbody tr[data-ok] { display: none; }
  .grid tbody tr[data-ok] { order: 2; }
  .ok-fold { display: block; order: 1; }
  .ok-fold td { display: block; padding: 0; border: 0; }
  .ok-fold-button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 46px;
    margin-block: 10px 2px;
    padding: 0 14px;
    background: none;
    border: 1px solid var(--hairline-soft);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
  }
  .ok-fold-button:focus-visible { outline: 1px solid var(--accent-soft); outline-offset: -2px; }
  .ok-fold-dot {
    width: 8px;
    height: 8px;
    flex: none;
    border-radius: 50%;
    background: var(--ok);
  }
  /* Same chevron as the incident-log fold, pointing the same way for the same
   * state, so the two disclosures on this page are one control. */
  .ok-fold-button::after {
    content: "";
    margin-left: auto;
    width: 8px;
    height: 8px;
    border-right: 1.5px solid var(--muted-dim);
    border-bottom: 1.5px solid var(--muted-dim);
    transform: translateY(-2px) rotate(45deg);
    transition: transform 0.18s ease;
  }
  .ok-fold-button[aria-expanded="true"]::after { transform: translateY(2px) rotate(225deg); }

  /* Three number columns, so six measurements are two rows rather than three.
   * A card of six stacked pairs was 385px tall, and a full roster of those is a
   * scroll nobody finishes. */
  .grid tbody tr[data-model] {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px 8px;
    padding: 13px 0 14px;
    border-bottom: 1px solid var(--hairline-soft);
  }
  .grid tbody tr[data-model]:hover td:first-child { box-shadow: none; }

  /* `.grid tbody td` sets 11px 14px at specificity (0,1,2); resetting through
   * `.grid td` lost to it and left 27px of dead padding in every cell. */
  .grid tbody td {
    display: block;
    padding: 0;
    border: 0;
    min-width: 0;
  }

  /* Name and status share the top line. */
  .grid td:first-child { grid-column: 1 / 3; }
  .grid td:nth-child(2) { grid-column: 3 / 4; justify-self: end; align-self: start; }

  /* Explicit span AND width: as a stretched grid item the cell should fill its
   * tracks on its own, but the bar inside is a flex row of 24 zero-basis cells,
   * so without a definite width to resolve against it collapses to the sum of
   * their min-widths — 14px, not the 350 it looks like it should be. */
  .grid td.col-bar {
    grid-column: 1 / -1;
    width: 100%;
  }
  .grid td.col-bar .uptime {
    min-width: 0;
    width: 100%;
    height: 20px;
  }

  /* Three headline numbers, not seven. p50, time-to-first-token, round trip and
   * output tokens are secondary on a phone and every one of them costs a whole
   * row of a card a full roster deep — they are one tap away in the drawer. The
   * column being sorted on is always shown, so sorting by a hidden metric can
   * never reorder the list by something invisible.
   *
   * Round trip is in here rather than in the visible three despite being the
   * one figure that compares models directly: the grid is three across, so a
   * fourth number is a whole second row on every card in the roster, and p95 is
   * already answering "is this one slow" in the slot it would take. The drawer
   * and the round-trip sort both put it back in one tap. */
  .grid tbody td.num[data-label="p50"],
  .grid tbody td.num[data-label="TTFT"],
  .grid tbody td.num[data-label="Round trip"],
  .grid tbody td.num[data-label="Out tok"] { display: none; }
  .grid[data-sort="p50_ms"] tbody td.num[data-label="p50"],
  .grid[data-sort="mean_ttft_ms"] tbody td.num[data-label="TTFT"],
  .grid[data-sort="mean_roundtrip_ms"] tbody td.num[data-label="Round trip"],
  .grid[data-sort="mean_output_tokens"] tbody td.num[data-label="Out tok"] { display: block; }

  /* The merged cell rides the slot the status chip already had — top right,
   * beside the model name — so a phone answers "is it OK, and is it worse than
   * usual" on one line without costing the card a row of its own.
   *
   * It keeps its data-label, unlike the chip it replaced. A bare "1.26x" up
   * there is cryptic where the word "OK" was self-evident, and the label is the
   * only thing on the card that says which metric the multiple is OF — the
   * desktop header that would otherwise answer that is gone at this width. */
  .grid td.col-drift { text-align: right; }

  /* Each measurement labels itself, because the header that used to is gone. */
  .grid td.num {
    text-align: left;
    font-size: 14.5px;
  }
  .grid td.num[data-label]::before {
    content: attr(data-label);
    display: block;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted-dim);
    margin-bottom: 1px;
  }

  .cell-model { flex-wrap: wrap; }
  .cell-model .name { font-size: 15px; }
  .cell-model .provider { width: 100%; }
}

@media (max-width: 360px) {
  /* Only on the narrowest phones does a third column stop fitting. */
  .grid tbody tr[data-model] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid td:first-child { grid-column: 1 / 2; }
  .grid td:nth-child(2) { grid-column: 2 / 3; }
}

/* ---------- portrait chrome ----------
 *
 * The numbers were already right on a phone; the frame around them still
 * behaved like a desktop page shrunk down. What is left is the chrome a hand
 * touches: the header links, the panel that opens over the board, and the two
 * edges a modern phone does not actually own. */

@media (max-width: 780px) {
  /* 17px of text is not a tap target. Padding rather than height so the links
   * keep their spacing and the row simply gets taller, and the header's own
   * padding gives most of it back. */
  .site-header .wrap { padding-block: 8px 3px; gap: 0 18px; }
  .nav a { padding-block: 12px; }
  /* Same guideline the pills and the sort bar already meet: a 12px mono line is
   * a 27px target, and this one is the whole section's only control. */
  .fold > summary { min-height: 44px; }
}

@media (max-width: 700px) {
  /* A centred card with a margin on all four sides is a desktop dialog that
   * happened to be resized. This is a sheet: it arrives from the bottom edge,
   * it is as wide as the screen, and it ends where the thumb already is rather
   * than floating above it. Square corners — the shared theme has no rounded
   * ones and a modal is not the place to introduce them — so the grab handle
   * does the work of saying which edge this came from. */
  .drawer {
    place-items: end stretch;
    padding: 0;
  }
  .drawer-panel {
    width: 100%;
    max-height: 90svh;
    border: 0;
    border-top: 1px solid var(--hairline);
    padding: 10px var(--edge-r) calc(22px + env(safe-area-inset-bottom, 0px)) var(--edge-l);
    /* Without this the board behind carries on scrolling the moment the
     * sheet's own content runs out, which is the tell of a web modal. The body
     * lock in status.js is the other half. */
    overscroll-behavior: contain;
    animation: sheet-up 0.26s cubic-bezier(0.2, 0.7, 0.2, 1);
  }
  .drawer-panel::before {
    content: "";
    display: block;
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: var(--hairline);
    margin: 0 auto 12px;
  }
  /* The close button has to stay reachable through four charts and a task
   * matrix; on a sheet that means pinned, not scrolled past. */
  .drawer-head {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg);
  }
  /* A sticky head on a sheet is a header bar, and a 27px logo makes it tall
   * enough to cost a visible slice of the four charts under it. */
  .drawer-ident { gap: 10px; }
  .drawer-mark .swatch-mark,
  .drawer-mark .swatch { width: 22px; height: 22px; }

  .site-footer { padding-bottom: max(36px, calc(20px + env(safe-area-inset-bottom, 0px))); }
}

@keyframes sheet-up {
  from { transform: translateY(100%); }
  to { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .fold > summary::after,
  .ok-fold-button::after { transition: none; }
  .drawer-panel { animation: none; }
}
