/* Preclear Observe — the operator's instrument panel.
   Signet brand kit: monochrome ink on paper (paper on ink in dark), Lexend + IBM
   Plex Mono, hairlines. The one semantic red marks what must not be missed. */

:root {
  --bg: #FAFAF8; --bg-2: #f1f1ee; --card: #ffffff;
  --ink: #050505; --ink-2: #454545; --muted: #7d7d7a; --faint: #b9b9b5;
  --hair: rgba(5,5,5,.11); --hair-2: rgba(5,5,5,.06);
  --tint: rgba(5,5,5,.04); --tint-2: rgba(5,5,5,.08);
  --red: #b3261e; --red-tint: rgba(179,38,30,.08);
  --series-2: #9a9a96;
  --shadow: 0 1px 2px rgba(5,5,5,.04), 0 10px 30px rgba(5,5,5,.06);
  --sans: "Lexend", -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", monospace;
  --r: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b0a; --bg-2: #151514; --card: #121211;
    --ink: #FAFAF8; --ink-2: #c9c9c5; --muted: #8d8d89; --faint: #4a4a47;
    --hair: rgba(250,250,248,.12); --hair-2: rgba(250,250,248,.06);
    --tint: rgba(250,250,248,.04); --tint-2: rgba(250,250,248,.08);
    --red: #ef6b62; --red-tint: rgba(239,107,98,.12);
    --series-2: #7a7a76;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) .mark { filter: invert(1); }
}
:root[data-theme="dark"] {
  --bg: #0b0b0a; --bg-2: #151514; --card: #121211;
  --ink: #FAFAF8; --ink-2: #c9c9c5; --muted: #8d8d89; --faint: #4a4a47;
  --hair: rgba(250,250,248,.12); --hair-2: rgba(250,250,248,.06);
  --tint: rgba(250,250,248,.04); --tint-2: rgba(250,250,248,.08);
  --red: #ef6b62; --red-tint: rgba(239,107,98,.12);
  --series-2: #7a7a76;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
  color-scheme: dark;
}
:root[data-theme="dark"] .mark { filter: invert(1); }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--sans); font-weight: 300;
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }
.kicker { font-family: var(--mono); font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.red { color: var(--red); }

/* ── buttons ── */
.btn { border: 1px solid var(--hair); background: transparent; border-radius: 999px; padding: 6px 14px; cursor: pointer; font-weight: 400; }
.btn:hover { background: var(--tint); }
.btn:focus-visible, .seg button:focus-visible, .tabs a:focus-visible, tr[tabindex]:focus-visible, .check:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); padding: 10px 18px; }
.btn.primary:hover { opacity: .88; }
.btn.ghost { border-color: transparent; }
.btn.icon { padding: 6px 10px; }
.btn.small { padding: 3px 10px; font-size: 12px; }

/* ── login ── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(360px, 100%); display: grid; gap: 16px; padding: 36px 32px; background: var(--card); border: 1px solid var(--hair); border-radius: 18px; box-shadow: var(--shadow); }
.login-card .mark { margin: 0 auto; display: block; }
.login-card .kicker { text-align: center; margin-bottom: 8px; }
.login-card label { display: grid; gap: 6px; font-size: 12px; color: var(--ink-2); font-weight: 400; }
.login-card input { border: 1px solid var(--hair); border-radius: 10px; padding: 10px 12px; background: var(--bg); font-size: 15px; outline: none; }
.login-card input:focus { border-color: var(--ink); }
#login-code { font-family: var(--mono); letter-spacing: .3em; }
.login-error { min-height: 1.5em; margin: 0; color: var(--red); font-size: 13px; text-align: center; }

/* ── shell ── */
.app { max-width: 1380px; margin: 0 auto; padding: 0 24px 64px; }
.top { display: flex; align-items: center; gap: 24px; padding: 18px 0 14px; border-bottom: 1px solid var(--hair); position: sticky; top: 0; background: var(--bg); z-index: 5; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.env { font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; border: 1px solid var(--hair); border-radius: 999px; padding: 1px 8px; color: var(--muted); }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.tabs a { text-decoration: none; padding: 6px 12px; border-radius: 999px; color: var(--ink-2); font-weight: 400; }
.tabs a:hover { background: var(--tint); }
.tabs a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.tabs a .badge { margin-left: 6px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.updated { font-size: 12px; color: var(--muted); margin-right: 6px; }
.filters { display: flex; align-items: center; gap: 16px; padding: 16px 0 6px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--hair); border-radius: 999px; padding: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 14px; border-radius: 999px; cursor: pointer; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.range { font-size: 12px; color: var(--muted); }
.view { transition: opacity .2s; }
.view.loading { opacity: .55; }

/* ── layout blocks ── */
.section { margin-top: 28px; }
.section h2 { font-size: 13px; font-weight: 500; margin: 0 0 12px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.section h2 .muted { font-weight: 300; font-size: 12px; }
.drawer h3 { font-size: 13px; font-weight: 500; margin: 0 0 8px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .g2, .g3, .g6 { grid-template-columns: minmax(0, 1fr); } .app { padding: 0 16px 48px; } .top-right { margin-left: 0; } .verdict { flex-wrap: wrap; gap: 4px 12px; } .verdict .big { font-size: 20px; } .top { gap: 12px; } }
.card { background: var(--card); border: 1px solid var(--hair); border-radius: var(--r); padding: 16px 18px; min-width: 0; }
.card h3 { margin: 0 0 2px; font-size: 13px; font-weight: 500; }
.card .sub { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.empty { color: var(--muted); font-size: 13px; padding: 18px 0; }

/* ── health ── */
.verdict { display: flex; align-items: center; gap: 14px; margin-top: 22px; }
.verdict .big { font-size: 26px; font-weight: 300; letter-spacing: -.01em; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: 14px; }
.check { text-align: left; background: var(--card); border: 1px solid var(--hair); border-radius: var(--r); padding: 12px 14px; cursor: pointer; display: grid; gap: 4px; }
.check:hover { background: var(--tint); }
.check .row { display: flex; align-items: center; gap: 8px; }
.check .title { font-weight: 400; font-size: 13px; }
.check .value { margin-left: auto; font-family: var(--mono); font-size: 12px; }
.check .detail { font-size: 12px; color: var(--ink-2); display: none; line-height: 1.45; }
.check.open .detail { display: block; }
.check.crit { border-color: var(--red); background: var(--red-tint); }
.check.warn { border-color: var(--ink-2); }
.glyph { width: 14px; text-align: center; font-size: 11px; line-height: 1; flex: none; }
.glyph.ok { color: var(--muted); }
.glyph.warn { color: var(--ink); }
.glyph.crit { color: var(--red); }
.glyph.unknown { color: var(--faint); }

/* ── stat tiles ── */
.tile .label { font-size: 12px; color: var(--ink-2); }
.tile .value { font-size: 28px; font-weight: 300; letter-spacing: -.01em; margin: 2px 0; }
.tile .delta { font-size: 12px; color: var(--muted); }
.tile .delta.bad { color: var(--red); }
.tile svg { display: block; margin-top: 8px; }

/* ── charts ── */
.chart { position: relative; width: 100%; }
.chart svg { display: block; overflow: visible; }
.axis text, .chart text { font-family: var(--sans); font-size: 10.5px; fill: var(--muted); }
.gridline { stroke: var(--hair-2); stroke-width: 1; }
.baseline { stroke: var(--hair); stroke-width: 1; }
.s-ink { stroke: var(--ink); } .f-ink { fill: var(--ink); }
.s-2 { stroke: var(--series-2); } .f-2 { fill: var(--series-2); }
.s-red { stroke: var(--red); } .f-red { fill: var(--red); }
.f-wash { fill: var(--ink); opacity: .08; }
.line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.deploy { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 2 3; opacity: .55; }
.deploy-label { font-family: var(--mono) !important; font-size: 9.5px !important; fill: var(--ink-2) !important; }
.cross { stroke: var(--ink); stroke-width: 1; opacity: .35; }
.dot { stroke: var(--card); stroke-width: 2; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); margin: 2px 0 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 14px; height: 2px; vertical-align: middle; margin-right: 6px; border-radius: 1px; }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--card); border: 1px solid var(--hair); border-radius: 10px; padding: 8px 10px; box-shadow: var(--shadow); font-size: 12px; min-width: 120px; }
.tip .t { color: var(--muted); margin-bottom: 4px; }
.tip .r { display: flex; align-items: center; gap: 8px; }
.tip .r b { font-weight: 500; font-variant-numeric: tabular-nums; }
.tip .r i { width: 12px; height: 2px; border-radius: 1px; display: inline-block; }
.tip .r span { color: var(--ink-2); }

/* ── tables ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--hair); border-radius: var(--r); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 400; font-size: 11.5px; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--hair); white-space: nowrap; cursor: default; user-select: none; }
th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--ink); }
th.num, td.num { text-align: right; }
td { padding: 9px 12px; border-bottom: 1px solid var(--hair-2); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--tint); }
td.route { font-family: var(--mono); font-size: 12px; word-break: break-all; }
td.nowrap { white-space: nowrap; word-break: normal; }
.method { font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-right: 6px; }
.feature { display: block; font-family: var(--sans); font-size: 11.5px; color: var(--muted); }
.tag { display: inline-block; font-size: 11px; border: 1px solid var(--hair); border-radius: 999px; padding: 0 8px; margin: 1px 4px 1px 0; white-space: nowrap; color: var(--ink-2); }
.tag.red { border-color: var(--red); color: var(--red); background: var(--red-tint); }
.tag.solid { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.badge { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; text-align: center; font-weight: 500; }
.pips { display: inline-flex; gap: 3px; vertical-align: middle; margin-right: 6px; }
.pips i { width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--ink-2); display: inline-block; }
.pips i.on { background: var(--ink); border-color: var(--ink); }
.meter { height: 6px; border-radius: 3px; background: var(--tint-2); overflow: hidden; min-width: 80px; }
.meter > span { display: block; height: 100%; background: var(--ink); border-radius: 3px; }
.meter.hot > span { background: var(--red); }
.searchbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.searchbar input { border: 1px solid var(--hair); border-radius: 999px; padding: 8px 14px; background: var(--card); min-width: min(360px, 100%); outline: none; }
.searchbar input:focus { border-color: var(--ink); }
.chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chips button { border: 1px solid var(--hair); background: transparent; border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: 12px; color: var(--ink-2); }
.chips button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ── errors ── */
.err { border: 1px solid var(--hair); border-radius: var(--r); background: var(--card); margin-bottom: 8px; }
.err > button { width: 100%; text-align: left; background: none; border: 0; padding: 12px 14px; cursor: pointer; display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.err > button:hover { background: var(--tint); }
.err .msg { font-family: var(--mono); font-size: 12.5px; word-break: break-word; }
.err .meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.err .count { font-family: var(--mono); font-size: 13px; text-align: right; white-space: nowrap; }
.err .body { border-top: 1px solid var(--hair-2); padding: 12px 14px 14px 40px; font-size: 12.5px; }
.frames { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); background: var(--bg-2); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; margin: 6px 0 12px; }

/* ── bars (funnel / lists) ── */
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 160px) minmax(0, 1fr) 90px; gap: 12px; align-items: center; font-size: 13px; }
.bar-row .track { height: 12px; position: relative; }
.bar-row .fill { height: 100%; background: var(--ink); border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-row .v { text-align: right; font-variant-numeric: tabular-nums; }
.bar-row .v small { color: var(--muted); margin-left: 4px; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── drawer ── */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--bg); border-left: 1px solid var(--hair); box-shadow: var(--shadow); z-index: 20; display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--hair); }
.drawer-body { overflow-y: auto; padding: 18px 20px 40px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; margin: 12px 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.journey { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 10px 0 4px; }
.journey div { font-size: 10.5px; color: var(--muted); text-align: center; border-top: 3px solid var(--tint-2); padding-top: 5px; }
.journey div.on { border-color: var(--ink); color: var(--ink); }
.timeline { list-style: none; padding: 0; margin: 0; font-size: 12.5px; }
.timeline li { display: grid; grid-template-columns: 92px 16px minmax(0, 1fr); gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--hair-2); }
.timeline .when { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11.5px; }
.timeline .what { word-break: break-word; }
.timeline .what code { font-family: var(--mono); font-size: 11.5px; }
