/* Temple1 stats — visual brief, stated so the next edit can stay consistent.
 *
 * Reference: a printed analytics page (FT / Economist data pages). Carried forward from the
 *   force-context HTML report this replaces, because that look was a deliberate choice and
 *   swapping it for a fresher default would be churn, not design. The page is a ranked-data
 *   document with a control strip on top — not a tile dashboard, not a hero + three cards.
 *   Structure follows the question it answers: what is used, where, and what should I delete.
 *
 * Colour: paper/ink neutrals carry everything except meaning. Exactly one categorical pair
 *   exists — steel #2F79B5 (sole) vs brick #C43D2E (redundant, bypassed, over budget) —
 *   validated on the #f6f5f1 surface at ΔE 20.4 protan / 31.7 tritan / 27.8 normal vision.
 *   Machines are deliberately NOT a third hue: they are a filter dimension and a single-hue
 *   magnitude panel, so the two semantic colours never have to compete for attention.
 *   Red always means "worth noticing", never just "series two".
 *
 * Type: grotesque via system Helvetica/Arial — an editorial workhorse, chosen over the
 *   Inter/Geist reflex and over the serif-display look that currently reads as generated.
 *   Every number is monospace with tabular figures so columns align down the page.
 *
 * Light only, on purpose: this is a document you read, not an IDE you live in.
 */

:root {
  --paper:#f6f5f1; --ink:#1b1b1a; --muted:#8f8b82; --faint:#b7b2a7;
  --line:#e2e0d8; --track:#ece9e1; --neutral:#3a3a37; --hover:#efece4;
  --sole:#2F79B5; --alert:#C43D2E;
  --sans:"Helvetica Neue",Helvetica,Arial,sans-serif;
  --mono:ui-monospace,"SF Mono","Cascadia Mono","Segoe UI Mono",Consolas,Menlo,monospace;
}
* { box-sizing:border-box; }
body { margin:0; background:var(--paper); color:var(--ink);
       font:15px/1.55 var(--sans); -webkit-font-smoothing:antialiased; }
main { max-width:1200px; margin:0 auto; padding:40px 28px 72px; }
.num { font-family:var(--mono); font-variant-numeric:tabular-nums; }
[hidden] { display:none !important; }

/* ── login gate ──────────────────────────────────────────────────────────── */
#gate { min-height:100vh; display:grid; place-items:center; padding:24px; }
#login { width:100%; max-width:320px; }
#login h1 { font-size:28px; letter-spacing:-0.02em; margin:0; }
.gate-sub { color:var(--muted); font-size:13px; margin:6px 0 28px;
            border-bottom:1px solid var(--line); padding-bottom:20px; }
#login label { display:block; font-size:11px; text-transform:uppercase;
               letter-spacing:0.09em; color:var(--muted); margin-bottom:6px; }
#login input { width:100%; font:15px var(--mono); padding:9px 10px; color:var(--ink);
               background:#fff; border:1px solid var(--line); border-radius:4px; }
#login input:focus { outline:2px solid var(--ink); outline-offset:-1px; }
#login button { margin-top:14px; width:100%; font:600 13px var(--sans); padding:10px;
                background:var(--ink); color:var(--paper); border:0; border-radius:4px;
                cursor:pointer; letter-spacing:0.02em; }
#login button:hover { background:#000; }
.gate-error { color:var(--alert); font-size:13px; margin-top:12px; }

/* ── masthead ────────────────────────────────────────────────────────────── */
header { display:flex; align-items:baseline; justify-content:space-between; gap:16px;
         border-bottom:2px solid var(--ink); padding-bottom:10px; }
header h1 { font-size:30px; font-weight:700; letter-spacing:-0.02em; margin:0; }
.linkish { background:none; border:0; padding:0; cursor:pointer; color:var(--muted);
           font:12px var(--sans); text-decoration:underline; text-underline-offset:3px; }
.linkish:hover { color:var(--ink); }

.standfirst { display:flex; flex-wrap:wrap; gap:6px 18px; margin:12px 0 26px;
              font-size:13px; color:var(--muted); border-bottom:1px solid var(--line);
              padding-bottom:12px; }
.standfirst b { color:var(--ink); font-weight:600; }
.standfirst .num { color:var(--ink); }
.dot { color:var(--faint); }
.stale { color:var(--alert); }

/* ── type tabs ───────────────────────────────────────────────────────────── */
.tabs { display:flex; flex-wrap:wrap; gap:22px; border-bottom:1px solid var(--ink);
        margin-bottom:18px; }
.tabs button { background:none; border:0; cursor:pointer; padding:0 0 9px;
               font:600 13px var(--sans); color:var(--muted); letter-spacing:0.02em;
               border-bottom:2px solid transparent; margin-bottom:-1px; }
.tabs button:hover { color:var(--ink); }
.tabs button[aria-current="true"] { color:var(--ink); border-bottom-color:var(--ink); }
.tabs .badge { font-family:var(--mono); font-size:11px; color:var(--faint); margin-left:5px; }

/* ── filter strip — one row above the data, per the interaction spec ─────── */
.controls { display:flex; flex-wrap:wrap; align-items:flex-end; gap:14px 18px; margin-bottom:8px; }
.control { display:flex; flex-direction:column; gap:4px; }
.control.grow { flex:1 1 220px; }
.controls label { font-size:10px; text-transform:uppercase; letter-spacing:0.09em;
                  color:var(--muted); }
.controls select, .controls input {
  font:13px var(--sans); color:var(--ink); background:#fff;
  border:1px solid var(--line); border-radius:4px; padding:5px 8px; min-width:130px; }
.controls input { width:100%; }
.controls select:focus, .controls input:focus { outline:2px solid var(--ink); outline-offset:-1px; }
.blurb { flex-basis:100%; margin:2px 0 0; font-size:12.5px; color:var(--muted); max-width:74ch; }

.chips { flex-basis:100%; display:flex; flex-wrap:wrap; gap:6px; margin-top:2px; }
.chip { font:11px var(--sans); border:1px solid var(--line); background:#fff;
        border-radius:999px; padding:3px 9px; cursor:pointer; color:var(--muted); }
.chip:hover { border-color:var(--ink); color:var(--ink); }
.chip[aria-pressed="true"] { background:var(--ink); border-color:var(--ink); color:var(--paper); }
.chip .num { font-size:10.5px; opacity:.75; margin-left:4px; }

/* ── sections ────────────────────────────────────────────────────────────── */
section { margin:34px 0 0; }
h2 { font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:0.09em;
     margin:0 0 2px; display:flex; align-items:baseline; justify-content:space-between; gap:12px; }
.hr { border-bottom:1px solid var(--ink); margin:6px 0 16px; }
.legend { display:inline-flex; gap:16px; font:400 11px var(--sans); color:var(--muted);
          text-transform:none; letter-spacing:0; }
.legend i { display:inline-block; width:9px; height:9px; border-radius:2px; margin-right:5px; }
.empty { color:var(--muted); font-size:13px; }

/* ── the ranked table (the page's centre of gravity) ─────────────────────── */
.scroll { overflow-x:auto; }
table { border-collapse:collapse; width:100%; font-size:13px; }
th, td { padding:7px 10px; text-align:right; white-space:nowrap; }
th:first-child, td:first-child { text-align:left; }
/* The name column wraps (a long skill name should not force a horizontal scroll), but a
   min-width stops it collapsing into a two-character-per-line ribbon when the other
   columns compete for space. */
td:first-child, th:first-child { white-space:normal; min-width:200px; max-width:320px; }
/* Matcher fingerprint under the name — one line, clipped, full text on hover. It exists to
   identify an anon rule at a glance, not to be read in full here. */
.fp { color:var(--muted); font-size:11px; margin-top:2px;
      overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
thead th { color:var(--muted); font-weight:600; font-size:11px; text-transform:uppercase;
           letter-spacing:0.05em; border-bottom:1px solid var(--ink); cursor:pointer;
           user-select:none; }
thead th:hover { color:var(--ink); }
thead th[aria-sort] { color:var(--ink); }
thead th[aria-sort]::after { content:" ↓"; font-family:var(--mono); }
thead th[aria-sort="ascending"]::after { content:" ↑"; }
tbody td { border-bottom:1px solid var(--line); }
tbody tr { cursor:pointer; }
tbody tr:hover td { background:var(--hover); }
tbody tr.dead td:not(:first-child) { color:var(--faint); }  /* grey the zeros, keep the name inked */
tbody tr[aria-selected="true"] td { background:var(--hover); box-shadow:inset 2px 0 0 var(--ink); }
.key { font-family:var(--mono); font-size:12.5px; }
.sub { color:var(--muted); font-size:11px; }
.tag { font-size:10px; padding:1px 5px; border-radius:3px; margin-left:6px;
       border:1px solid var(--line); color:var(--muted); }
.tag.warn { color:var(--alert); border-color:var(--alert); }

/* Magnitude bar — length is fires vs the busiest row, so every bar shares a left baseline.
   Split into sole / redundant where the type co-fires; a single neutral fill where it
   doesn't, because one series must never borrow a categorical hue. 2px surface gap. */
td.mag { width:132px; text-align:left; }
.bar { display:flex; gap:2px; width:120px; height:12px; background:var(--track); border-radius:3px; }
.seg { height:100%; border-radius:3px; min-width:0; }
.seg.sole { background:var(--sole); }
.seg.alert { background:var(--alert); }
.seg.solid { background:var(--neutral); }

/* Bypass — its OWN 0-100% scale (this row's fires), not vs the busiest row: a rule escaped
   9 times out of 10 matters even at tiny volume. Smaller than the magnitude bar; it is a
   secondary signal. */
td.byp { width:104px; text-align:left; }
.byppct { color:var(--alert); font-weight:600; font-family:var(--mono); }
.bypbar { width:48px; height:6px; background:var(--track); border-radius:2px;
          overflow:hidden; display:inline-block; vertical-align:middle; margin-left:6px; }
.bypfill { display:block; height:100%; background:var(--alert); }

.spark { display:block; }
.sparkbar { fill:var(--neutral); }

/* ── timeline ────────────────────────────────────────────────────────────── */
.tlbar { fill:var(--neutral); }
.tlbar:hover { fill:#000; }
.axis { fill:var(--faint); font-size:10px; font-family:var(--mono); }

/* ── machines ────────────────────────────────────────────────────────────── */
.machine-row { display:grid; grid-template-columns:180px 1fr 90px; gap:12px;
               align-items:center; padding:7px 0; border-bottom:1px solid var(--line); }
.machine-row .name { font-family:var(--mono); font-size:12.5px; }
.machine-row .name .sub { display:block; font-family:var(--sans); }
.mtrack { height:10px; background:var(--track); border-radius:3px; }
.mfill { height:100%; background:var(--neutral); border-radius:3px; }
.machine-row .when { text-align:right; font-size:11.5px; color:var(--muted); }
.machine-row.silent .mfill { background:var(--faint); }
.machine-row.silent .when { color:var(--alert); }

/* ── drilldown ───────────────────────────────────────────────────────────── */
.facet-grid { display:flex; flex-wrap:wrap; gap:28px; margin-bottom:20px; }
.facet h3 { font-size:10px; text-transform:uppercase; letter-spacing:0.09em;
            color:var(--muted); margin:0 0 6px; font-weight:600; }
.facet-row { display:grid; grid-template-columns:130px 70px 46px; gap:8px; align-items:center;
             font-size:12.5px; padding:2px 0; }
.facet-row .ftrack { height:8px; background:var(--track); border-radius:2px; }
.facet-row .ffill { height:100%; background:var(--neutral); border-radius:2px; }
.events td { font-size:12px; }
.events .detail { font-family:var(--mono); font-size:11.5px; color:var(--muted);
                  white-space:normal; word-break:break-all; max-width:420px; text-align:left; }

footer { margin-top:40px; padding-top:12px; border-top:1px solid var(--line);
         font-size:11.5px; color:var(--muted); }

/* ── shared tooltip ──────────────────────────────────────────────────────── */
#tip { position:fixed; pointer-events:none; z-index:10; background:var(--ink);
       color:var(--paper); font:12px var(--sans); padding:5px 8px; border-radius:4px;
       opacity:0; transition:opacity .08s; max-width:280px; }
#tip .num { color:#fff; }

@media (max-width:720px) {
  main { padding:28px 16px 56px; }
  .machine-row { grid-template-columns:1fr 80px; }
  .machine-row .mtrack { display:none; }
}
