/* ═══════════════════════════════════════════════════════════════════════
   Kovely Control v3 — avionics instrument panel.
   Engineered, not decorated: dark panel, engraved 1px lines, phosphor-amber
   readouts. Green = OK only. Red = fault/kill only. Type IS the design:
   Archivo (variable, expanded for display) + IBM Plex Mono for data.
   Fonts are SELF-HOSTED (public/fonts) — the Mini App tunnel must never
   depend on a CDN at runtime.
   ═══════════════════════════════════════════════════════════════════════ */

@font-face {
    font-family: 'Archivo';
    src: url('fonts/archivo-var.woff2') format('woff2-variations');
    font-weight: 100 900;
    font-stretch: 62.5% 125%;
    font-display: swap;
}
@font-face { font-family: 'Plex Mono'; src: url('fonts/plexmono-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url('fonts/plexmono-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url('fonts/plexmono-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }

:root {
    --panel: #101418;
    --raised: #171D23;
    --line: #232B33;
    --amber: #FFB454;
    --amber-dim: rgba(255, 180, 84, 0.14);
    --green: #4ADE80;
    --red: #F0564A;
    --text: #E8E4DC;
    --dim: #8B949E;
    --display: 'Archivo', system-ui, sans-serif;
    --mono: 'Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
    --rail-w: 208px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    background: var(--panel);
    color: var(--text);
    font-family: var(--display);
    font-size: 14px;
    line-height: 1.45;
    min-height: 100vh;
    overflow-x: hidden;
}
img, video { max-width: 100%; }
a { color: var(--amber); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); }

/* Every interactive control shows amber focus. */
button:focus-visible, a:focus-visible, textarea:focus-visible, input:focus-visible, select:focus-visible {
    outline: 2px solid var(--amber);
    outline-offset: 2px;
}

/* ── Shell: fixed rail + stage ─────────────────────────────────────────── */
.cockpit { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; }

.rail {
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column;
    border-right: 1px solid var(--line);
    background: var(--panel);
}
.rail-brand { padding: 18px 16px 14px; border-bottom: 1px solid var(--line); }
.wordmark {
    display: block;
    font-family: var(--display);
    font-weight: 900; font-stretch: 125%;
    font-size: 19px; letter-spacing: 0.16em;
    color: var(--text);
}
.wordmark-sub { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: 0.3em; color: var(--dim); margin-top: 3px; }
.wordmark-sub b { color: var(--amber); font-weight: 600; }

.rail-nav { display: flex; flex-direction: column; padding: 8px 0; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 16px;
    background: none; border: 0; border-left: 2px solid transparent;
    color: var(--dim);
    font-family: var(--mono); font-size: 12px; font-weight: 500;
    letter-spacing: 0.08em; text-transform: uppercase;
    cursor: pointer; text-align: left;
}
.nav-item:hover { color: var(--text); background: var(--raised); }
.nav-item.active { color: var(--amber); border-left-color: var(--amber); background: var(--amber-dim); }
.nav-led { width: 6px; height: 6px; border-radius: 50%; background: var(--line); flex: none; }
.nav-item.active .nav-led { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.nav-led.warn { background: var(--red); box-shadow: 0 0 6px var(--red); }

.rail-systems { margin-top: auto; border-top: 1px solid var(--line); padding: 12px 16px 16px; }
.rail-systems-title { font-family: var(--mono); font-size: 10px; letter-spacing: 0.3em; color: var(--dim); margin-bottom: 8px; }
.rail-leds { display: flex; flex-direction: column; gap: 5px; }
.sys-led { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11px; color: var(--dim); }
.sys-led .val { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }
.led { width: 7px; height: 7px; border-radius: 50%; background: var(--line); flex: none; }
.led.ok { background: var(--green); }
.led.on { background: var(--amber); }
.led.bad { background: var(--red); box-shadow: 0 0 6px var(--red); }
/* Page-load: LEDs warm up in sequence. */
.leds-armed .led { animation: lamp-warm 0.45s ease-out backwards; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes lamp-warm { from { filter: brightness(0.2); } }
.rail-fault {
    margin-top: 10px; padding: 8px 9px;
    border: 1px solid var(--red); border-radius: 2px;
    font-size: 12px; color: var(--text); line-height: 1.4;
}
.rail-fault::before { content: 'FAULT'; display: block; font-family: var(--mono); font-size: 9px; letter-spacing: 0.25em; color: var(--red); margin-bottom: 3px; }

.stage { min-width: 0; padding: 20px 22px 40px; }
.view { display: none; }
.view.active { display: block; }

/* ── Panels: instrument cards separated by engraved lines ─────────────── */
.panel { border: 1px solid var(--line); border-radius: 3px; background: var(--panel); margin-bottom: 18px; }
.panel-title {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
    padding: 9px 14px;
    border-bottom: 1px solid var(--line);
    font-family: var(--mono); font-size: 11px; font-weight: 600;
    letter-spacing: 0.22em; color: var(--text);
}
.panel-note { font-weight: 400; letter-spacing: 0.04em; color: var(--dim); text-transform: none; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel-sub { padding: 10px 14px 0; color: var(--dim); font-size: 13px; }
.dim-note { color: var(--dim); font-family: var(--mono); font-size: 11px; padding: 12px 14px; display: inline-block; }

/* A row of instruments sharing engraved 1px separators (the grid's background
   is the line colour; cells are panel colour — always-crisp 1px). */
.panel-row {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px; background: var(--line);
    border: 1px solid var(--line); border-radius: 3px; overflow: hidden;
    margin-bottom: 18px;
}
.instrument { background: var(--raised); padding: 14px 16px 16px; min-width: 0; }
.inst-label { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: 0.24em; color: var(--dim); }
.inst-big {
    display: block; margin-top: 6px;
    font-family: var(--display); font-weight: 800; font-stretch: 115%;
    font-size: clamp(26px, 3vw, 36px); line-height: 1.05;
    color: var(--amber); font-variant-numeric: tabular-nums;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.inst-unit { display: block; margin-top: 4px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; color: var(--dim); text-transform: uppercase; }
.inst-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.burn-bar { margin-top: 10px; height: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 1px; overflow: hidden; }
.burn-bar i { display: block; height: 100%; width: 0; background: var(--amber); transition: width 0.9s cubic-bezier(0.2, 0.8, 0.2, 1); }

/* Big-numeral sweep on load. */
.sweep-in { animation: sweep-in 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
@keyframes sweep-in { from { opacity: 0; transform: translateY(4px); } }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
    font-family: var(--mono); font-size: 11px; font-weight: 600;
    letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--panel); background: var(--amber);
    border: 1px solid var(--amber); border-radius: 2px;
    padding: 6px 12px; cursor: pointer;
    min-height: 30px;
}
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.quiet { background: transparent; color: var(--amber); }
.btn.quiet:hover { background: var(--amber-dim); filter: none; }
.btn.danger { background: transparent; color: var(--red); border-color: var(--red); position: relative; overflow: hidden; }
.btn.danger:hover { background: rgba(240, 86, 74, 0.1); }
/* Hold-to-confirm: the fill sweeps across during the 800ms press. */
.btn.danger .hold-fill { position: absolute; inset: 0; width: 0; background: rgba(240, 86, 74, 0.35); pointer-events: none; }
.btn.danger.holding .hold-fill { width: 100%; transition: width 0.8s linear; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
a.btn:hover { text-decoration: none; }

/* ── TEST COMMAND: the signature launch-sequence track ─────────────────── */
.tc-track {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px; background: var(--line);
}
.tc-slot {
    background: var(--raised); padding: 12px 14px 14px;
    border: 0; border-top: 2px solid transparent; text-align: left; cursor: pointer;
    color: var(--text); font-family: inherit; min-width: 0; display: block; width: 100%;
}
.tc-slot:hover { background: #1B222A; }
.tc-slot.open { border-top-color: var(--amber); background: #1B222A; }
.tc-slot-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tc-lamp { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--line); }
.tc-lamp.live { background: var(--amber); box-shadow: 0 0 8px var(--amber); animation: lamp-pulse 2.4s ease-in-out infinite; }
.tc-lamp.killed { background: var(--red); }
/* LIVE with £0 ever logged: the campaign may not exist — amber question, not green calm. */
.tc-lamp.warn { background: var(--red); box-shadow: 0 0 8px var(--red); animation: lamp-pulse 1.2s ease-in-out infinite; }
.panel-note.warn-note { color: var(--red); }
@keyframes lamp-pulse { 50% { box-shadow: 0 0 3px var(--amber); } }
.tc-name {
    font-family: var(--display); font-weight: 900; font-stretch: 120%;
    font-size: 15px; letter-spacing: 0.06em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.tc-status { margin-left: auto; font-family: var(--mono); font-size: 9px; letter-spacing: 0.2em; color: var(--dim); flex: none; }
.tc-status.live { color: var(--amber); }
.tc-status.killed { color: var(--red); }
.tc-spend { display: block; margin-top: 10px; }
.tc-spend-nums { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10px; color: var(--dim); font-variant-numeric: tabular-nums; }
.tc-spend-nums b { color: var(--text); font-weight: 600; }
.tc-bar { display: block; margin-top: 4px; height: 5px; background: var(--panel); border: 1px solid var(--line); border-radius: 1px; overflow: hidden; }
.tc-bar i { display: block; height: 100%; width: 0; background: var(--amber); transition: width 0.9s cubic-bezier(0.2, 0.8, 0.2, 1); }
.tc-bar i.over { background: var(--red); }
.tc-cps { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-family: var(--mono); font-size: 10px; color: var(--dim); font-variant-numeric: tabular-nums; }
.tc-cps b { font-weight: 600; color: var(--text); }
.tc-cps b.bad { color: var(--red); }
.tc-cps b.good { color: var(--green); }

/* Expanded slot: readouts + day log + verdict stamp. */
.tc-detail { padding: 14px; border-top: 1px solid var(--line); }
.tc-detail-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; }
.tc-readouts { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 12px; }
.tc-readout .inst-big { font-size: 30px; margin-top: 3px; }
.tc-log-table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.tc-log-table th { text-align: right; font-weight: 500; font-size: 10px; letter-spacing: 0.15em; color: var(--dim); padding: 4px 8px; border-bottom: 1px solid var(--line); text-transform: uppercase; }
.tc-log-table th:first-child, .tc-log-table td:first-child { text-align: left; padding-left: 0; }
.tc-log-table td { text-align: right; padding: 5px 8px; border-bottom: 1px solid var(--line); color: var(--text); }
.tc-log-table td.bad { color: var(--red); }
.tc-log-table td.good { color: var(--green); }
.tc-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; }
.tc-form label { display: flex; flex-direction: column; gap: 4px; font-family: var(--mono); font-size: 9px; letter-spacing: 0.2em; color: var(--dim); text-transform: uppercase; }
.tc-form input {
    background: var(--panel); border: 1px solid var(--line); border-radius: 2px;
    color: var(--text); font-family: var(--mono); font-size: 13px;
    padding: 6px 8px; width: 116px; min-height: 30px;
}
.tc-form input[type="date"] { width: 148px; }
.tc-form input:focus { border-color: var(--amber); outline: none; }

/* Rubber-stamped verdict. */
.stamp-zone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px 12px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel); }
.stamp {
    font-family: var(--display); font-weight: 900; font-stretch: 125%;
    font-size: 23px; letter-spacing: 0.1em; text-transform: uppercase;
    padding: 7px 16px; border: 3px solid currentColor; border-radius: 4px;
    transform: rotate(-2deg); white-space: nowrap;
    animation: stamp-thunk 0.15s cubic-bezier(0.2, 0.8, 0.3, 1.2) backwards;
}
@keyframes stamp-thunk { from { transform: rotate(-2deg) scale(1.5); opacity: 0; } }
.stamp.keep { color: var(--amber); }
.stamp.scale { color: var(--green); }
.stamp.kill { color: var(--red); }
.stamp-why { font-size: 12px; color: var(--dim); text-align: center; max-width: 300px; }
.stamp-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ── Ledger rows (command picks, history) ──────────────────────────────── */
.ledger { display: flex; flex-direction: column; }
.ledger-row {
    display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center;
    padding: 8px 14px; border-bottom: 1px solid var(--line);
    color: var(--text); font-size: 13px;
}
.ledger-row:last-child { border-bottom: 0; }
a.ledger-row:hover { background: var(--raised); text-decoration: none; }
.ledger-row .score { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--amber); font-variant-numeric: tabular-nums; }
.ledger-row .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ledger-row .net { font-family: var(--mono); font-size: 12px; color: var(--green); font-variant-numeric: tabular-nums; }

/* ── Picks: one collapsible panel per scan day ─────────────────────────── */
.picks-summary-bar { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; color: var(--dim); padding: 0 2px 14px; }
.pick-day { margin-bottom: 12px; }
.pick-day-head {
    display: flex; width: 100%;
    background: none; border: 0; border-bottom: 1px solid var(--line);
    color: var(--text); text-align: left; cursor: pointer;
}
.pick-day-head:hover { background: var(--raised); }
.pick-day-when { font-family: var(--mono); font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; }
.pick-day-count { color: var(--amber); font-variant-numeric: tabular-nums; }
.pick-day-chevron { display: inline-block; color: var(--dim); transition: transform 0.2s ease; }
.pick-day.collapsed .pick-day-head { border-bottom: 0; }
.pick-day.collapsed .pick-day-chevron { transform: rotate(-90deg); }
.pick-day.collapsed .pick-day-body { display: none; }

/* ── Instrument cards (picks / products) ───────────────────────────────── */
.card-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
    gap: 1px; background: var(--line);
}
.icard { background: var(--panel); padding: 14px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.icard-top { display: flex; gap: 12px; align-items: flex-start; }
.icard-img { width: 64px; height: 64px; object-fit: cover; border: 1px solid var(--line); border-radius: 2px; flex: none; background: var(--raised); }
.icard-id { min-width: 0; }
.icard-name { font-weight: 600; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.icard-name a { color: var(--text); }
.icard-cat { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; color: var(--dim); text-transform: uppercase; margin-top: 3px; }
.icard-readouts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
.icard-readouts .cell { background: var(--raised); padding: 8px 10px; min-width: 0; }
.icard-readouts .cell b {
    display: block; font-family: var(--display); font-weight: 800; font-stretch: 112%;
    font-size: 19px; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.icard-readouts .cell b.amber { color: var(--amber); }
.icard-readouts .cell small { display: block; font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.14em; color: var(--dim); text-transform: uppercase; margin-top: 2px; }
.icard-facts { display: flex; gap: 6px; flex-wrap: wrap; }
.fact { font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; color: var(--dim); border: 1px solid var(--line); border-radius: 2px; padding: 2px 7px; text-transform: uppercase; }
.fact.up { color: var(--green); border-color: rgba(74, 222, 128, 0.35); }
.fact.down { color: var(--red); border-color: rgba(240, 86, 74, 0.35); }
.fact.hot { color: var(--amber); border-color: rgba(255, 180, 84, 0.4); }
.icard-links { display: flex; gap: 10px; flex-wrap: wrap; font-family: var(--mono); font-size: 11px; }
.icard-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }

/* Status pills (live/draft/etc). */
.pill { font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; border: 1px solid var(--line); border-radius: 2px; padding: 2px 7px; color: var(--dim); }
.pill.live { color: var(--green); border-color: rgba(74, 222, 128, 0.4); }
.pill.amber { color: var(--amber); border-color: rgba(255, 180, 84, 0.4); }

/* ── Creative bay ──────────────────────────────────────────────────────── */
.creative-card { border-bottom: 1px solid var(--line); padding: 14px; }
.creative-card:last-child { border-bottom: 0; }
.creative-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.creative-head h3 { font-family: var(--display); font-weight: 800; font-stretch: 115%; font-size: 15px; letter-spacing: 0.04em; }
.creative-count { font-family: var(--mono); font-size: 10px; color: var(--dim); letter-spacing: 0.1em; }
.filmstrip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.filmstrip figure { flex: none; width: 132px; }
.filmstrip video { width: 132px; height: 234px; object-fit: cover; border: 1px solid var(--line); border-radius: 2px; background: var(--raised); display: block; }
.filmstrip img { width: 132px; height: 165px; object-fit: cover; border: 1px solid var(--line); border-radius: 2px; display: block; }
.filmstrip figcaption { font-family: var(--mono); font-size: 9px; color: var(--dim); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ask-claude { padding: 14px; }
.ask-claude textarea {
    width: 100%; background: var(--raised); border: 1px solid var(--line); border-radius: 2px;
    color: var(--text); font-family: inherit; font-size: 13px; padding: 10px; resize: vertical;
}
.ask-claude textarea:focus { border-color: var(--amber); outline: none; }
.ask-row { display: flex; gap: 12px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.ask-row .dim-note { padding: 0; }

/* ── Ads view ──────────────────────────────────────────────────────────── */
.ad-card { border-bottom: 1px solid var(--line); padding: 14px; }
.ad-card:last-child { border-bottom: 0; }
.ad-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; font-weight: 600; }
.copy-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--line); }
.copy-row:last-child { border-bottom: 0; }
.copy-row .k { font-family: var(--mono); font-size: 9px; letter-spacing: 0.18em; color: var(--dim); text-transform: uppercase; }
.copy-row code { font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 6px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.rank-row .pos { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--amber); font-variant-numeric: tabular-nums; }
.rank-row .r-net { font-family: var(--mono); font-size: 12px; color: var(--green); font-variant-numeric: tabular-nums; }
.steps { padding: 12px 14px 12px 32px; color: var(--text); font-size: 13px; }
.steps li { margin: 4px 0; }

/* ── ROAS view ─────────────────────────────────────────────────────────── */
.roas-tbl { margin: 0; }
.roas-tbl th, .roas-tbl td { padding-left: 14px; padding-right: 14px; }
.roas-tbl td:first-child { font-weight: 600; color: var(--text); }
.roas-verdict { font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: 0.1em; }
.roas-verdict.kill { color: var(--red); }
.roas-verdict.scale { color: var(--green); }
.roas-verdict.keep { color: var(--amber); }

/* ── Import a winner ───────────────────────────────────────────────────── */
.import-form { display: flex; flex-direction: column; gap: 12px; padding: 14px; }
.import-form label { display: flex; flex-direction: column; gap: 5px; font-family: var(--mono); font-size: 9px; letter-spacing: 0.16em; color: var(--dim); text-transform: uppercase; }
.import-form input, .import-form textarea { background: var(--raised); border: 1px solid var(--line); border-radius: 2px; color: var(--text); font-family: inherit; font-size: 14px; padding: 9px 10px; }
.import-form textarea { font-family: var(--mono); font-size: 12px; resize: vertical; }
.import-form input:focus, .import-form textarea:focus { border-color: var(--amber); outline: none; }
.import-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.import-actions { display: flex; gap: 10px; margin-top: 2px; }
#import-result { padding: 0 14px 14px; }
.import-out { padding: 12px 14px; border: 1px solid var(--line); border-radius: 2px; font-size: 14px; line-height: 1.5; }
.import-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
@media (max-width: 880px) { .import-row { grid-template-columns: minmax(0, 1fr); } }

/* ── Systems view ──────────────────────────────────────────────────────── */
.sys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 185px), 1fr)); gap: 1px; background: var(--line); }
.sys-cell { background: var(--raised); padding: 12px 14px; min-width: 0; }
.sys-cell .inst-big { font-size: 24px; }
.agents-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: 4px 14px; padding: 12px 14px; border-top: 1px solid var(--line); }
.agent-row { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11px; color: var(--dim); }
.agent-row .nm { color: var(--text); }
.issue-line { padding: 9px 14px; border-top: 1px solid var(--line); color: var(--text); font-size: 13px; display: flex; gap: 10px; align-items: baseline; }
.issue-line::before { content: '▲'; color: var(--red); font-size: 10px; flex: none; }
.ok-line { padding: 9px 14px; border-top: 1px solid var(--line); color: var(--dim); font-size: 13px; }
/* ── Energy view ───────────────────────────────────────────────────────────
   Same instrument grammar as Systems: amber is the readout, green ONLY for
   plugged-in, red ONLY for the genuine low-and-unplugged fault. */
#energy-battery .inst-big.ok { color: var(--green); }
#energy-battery .inst-big.bad { color: var(--red); }

.trace-wrap { padding: 12px 14px; }
.trace-svg { width: 100%; height: 130px; display: block; background: var(--panel); border: 1px solid var(--line); }
.trace-axis { display: flex; justify-content: space-between; margin-top: 6px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; color: var(--dim); text-transform: uppercase; }

/* The verdict: the answer up front, before the reader has to read a table. */
.nrg-verdict { background: var(--raised); border: 1px solid var(--line); border-left: 2px solid var(--amber); padding: 11px 14px; margin-bottom: 10px; }
.nrg-verdict.bad { border-left-color: var(--red); }
.nrg-verdict b { display: block; font-size: 14px; margin-bottom: 3px; }
.nrg-verdict.bad b { color: var(--red); }
.nrg-verdict span { color: var(--dim); font-size: 12.5px; line-height: 1.5; }
.nrg-verdict code { display: block; margin-top: 7px; font-family: var(--mono); font-size: 11px; color: var(--amber); background: var(--panel); border: 1px solid var(--line); padding: 6px 8px; overflow-x: auto; }

.nrg-tools { display: flex; align-items: center; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.nrg-tools input[type="search"] { flex: 1; min-width: 120px; background: var(--panel); border: 1px solid var(--line); color: var(--text); font-family: var(--mono); font-size: 12px; padding: 6px 9px; border-radius: 0; }
.nrg-tools input[type="search"]:focus { outline: none; border-color: var(--amber); }
.nrg-toggle { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.1em; cursor: pointer; }
.nrg-toggle input { accent-color: var(--amber); }

/* Product-ledger filter bar — same instrument language as the Energy tools. */
.ledger-tools { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; position: sticky; top: 0; background: var(--bg); z-index: 3; }
.ledger-tools input[type="search"] { flex: 1; min-width: 150px; background: var(--panel); border: 1px solid var(--line); color: var(--text); font-family: var(--mono); font-size: 12px; padding: 7px 10px; border-radius: 0; }
.ledger-tools input[type="search"]:focus { outline: none; border-color: var(--amber); }
.ledger-tools select { background: var(--panel); border: 1px solid var(--line); color: var(--dim); font-family: var(--mono); font-size: 11px; padding: 7px 8px; border-radius: 0; text-transform: uppercase; letter-spacing: 0.06em; }
.ledger-tools select:focus { outline: none; border-color: var(--amber); }
.nrg-count { font-family: var(--mono); font-size: 11px; color: var(--dim); margin-left: auto; }

/* Rows are a fixed grid; the bar is an underlay on its own baseline so a long
   app name can't shove the numbers out of alignment. */
.nrg-head, .nrg-row { display: grid; grid-template-columns: minmax(0, 1fr) 54px 60px 54px 54px 54px 84px; align-items: center; gap: 8px; padding: 7px 14px; font-size: 13px; }
.nrg-head { border-bottom: 1px solid var(--line); }
.nrg-h { background: none; border: 0; padding: 0; cursor: pointer; font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; color: var(--dim); text-align: right; white-space: nowrap; }
.nrg-h.nm { text-align: left; }
.nrg-h:hover { color: var(--text); }
.nrg-h.on { color: var(--amber); }
.nrg-row { position: relative; border-bottom: 1px solid var(--line); cursor: pointer; }
.nrg-row:last-of-type { border-bottom: 0; }
.nrg-row:hover, .nrg-row:focus-visible { background: var(--raised); outline: none; }
.nrg-row.open { background: var(--raised); }
.nrg-row.idle .nm, .nrg-row.idle .v { opacity: 0.55; }
.nrg-row .nm { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; z-index: 1; display: flex; align-items: center; gap: 6px; }
.nrg-caret { font-style: normal; color: var(--dim); font-size: 9px; flex: none; width: 8px; }
.nrg-row .v { font-family: var(--mono); font-size: 12px; color: var(--dim); text-align: right; position: relative; z-index: 1; }
.nrg-row .v.strong { color: var(--amber); }
.nrg-row .v.u { font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nrg-tag { font-family: var(--mono); font-size: 8px; letter-spacing: 0.1em; padding: 1px 4px; border: 1px solid var(--line); color: var(--dim); font-weight: 400; flex: none; }
.nrg-tag.awake { color: var(--red); border-color: var(--red); }
.nrg-bar { position: absolute; left: 0; bottom: 0; height: 2px; width: var(--w); background: var(--amber); opacity: 0.5; }

/* Blocker rows reuse .hrow, whose .note is `flex: none` — fine for the short
   integration notes it was built for, but an assertion name like
   "com.apple.audio.AudioTap-A5FDF604…" then refuses to shrink and pushes the
   whole page into a horizontal scroll on a phone. Let it shrink and ellipsis. */
#energy-blockers .hrow { min-width: 0; }
#energy-blockers .hrow .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#energy-blockers .hrow .note { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nrg-procs { background: var(--panel); border-bottom: 1px solid var(--line); padding: 4px 0; }
.nrg-proc { display: grid; grid-template-columns: minmax(0, 1fr) 76px 54px 54px; gap: 8px; padding: 4px 14px 4px 28px; font-family: var(--mono); font-size: 11px; color: var(--dim); }
.nrg-proc .nm { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nrg-proc .v { text-align: right; }
.nrg-proc.dim { display: block; color: var(--dim); }
.nrg-foot { padding: 10px 14px; border-top: 1px solid var(--line); color: var(--dim); font-size: 11px; line-height: 1.5; }

/* Phone: drop CPU/wakes/mem/user, keep the two that answer the question. The
   full set is a tap away on the desktop dash. */
/* nth-of-type counts EVERY span, not just .v ones: the row's spans are
   1=name 2=now 3=avg 4=cpu 5=wakes 6=mem 7=user, so hiding starts at 4.
   (n+3 would have eaten the AVG column.) */
@media (max-width: 720px) {
    .nrg-head, .nrg-row { grid-template-columns: minmax(0, 1fr) 52px 58px; gap: 6px; }
    .nrg-h:nth-child(n+4), .nrg-row .v:nth-of-type(n+4) { display: none; }
    .nrg-proc { grid-template-columns: minmax(0, 1fr) 60px 46px; }
    .nrg-proc .v:nth-of-type(n+4) { display: none; }
}

.hrow { display: flex; align-items: center; gap: 10px; padding: 7px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.hrow:last-child { border-bottom: 0; }
.hrow .nm { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hrow .note { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--dim); text-align: right; flex: none; }

/* ── Brain: night tape — a filmstrip of nightly grade frames ───────────── */
/* Grade colour scale: A green (good) → D red (bad). Reused by the KPI. */
:root { --grade-c: #E0A23C; }
.g-A { color: var(--green); } .g-B { color: var(--amber); }
.g-C { color: var(--grade-c); } .g-D { color: var(--red); }
.tape {
    display: flex; gap: 1px; background: var(--line);
    /* padding-block gives the amber focus ring room so overflow doesn't clip it */
    overflow-x: auto; scrollbar-width: thin; padding-block: 3px;
    justify-content: flex-start;
}
.tape::-webkit-scrollbar { height: 6px; }
.tape::-webkit-scrollbar-thumb { background: var(--line); }
.night {
    /* grow to share width, but cap so a lone night keeps filmstrip proportions */
    flex: 1 1 132px; max-width: 220px; background: var(--panel);
    border: 0; border-top: 2px solid transparent;
    padding: 14px 14px 12px; text-align: left; cursor: pointer; min-width: 0;
    display: flex; flex-direction: column; gap: 9px; color: var(--text); font-family: inherit;
}
.night:hover { background: var(--raised); }
.night.sel { background: var(--raised); border-top-color: var(--amber); }
.night-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.night-grade {
    font-family: var(--display); font-weight: 900; font-stretch: 120%;
    font-size: 40px; line-height: 0.9; font-variant-numeric: tabular-nums;
}
.night-when { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; color: var(--dim); text-align: right; }
.night-when b { display: block; color: var(--text); font-weight: 600; font-size: 11px; }
/* Win / maybe / reject as a single stacked strip. */
.night-bar { display: flex; height: 6px; border-radius: 2px; overflow: hidden; background: var(--line); }
.night-bar i { display: block; height: 100%; }
.night-bar .win { background: var(--green); }
.night-bar .maybe { background: var(--amber); }
.night-bar .rej { background: var(--red); }
.night-legend { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.04em; color: var(--dim); font-variant-numeric: tabular-nums; }
.night-legend b { color: var(--text); font-weight: 600; }
.night.tonight .night-grade::after {
    content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
    background: var(--amber); margin-left: 6px; vertical-align: middle;
    animation: lamp-pulse 2.4s ease-in-out infinite;
}
.tape-empty { padding: 22px 14px; color: var(--dim); font-family: var(--mono); font-size: 12px; }

.tape-readout { padding: 12px 14px 14px; border-top: 1px solid var(--line); display: flex; gap: 26px; flex-wrap: wrap; align-items: flex-start; }
.tape-readout .cell { min-width: 0; }
.tape-readout .k { color: var(--dim); font-family: var(--mono); font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase; display: block; margin-bottom: 3px; }
.tape-readout .v { font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }
.tape-readout .v b { font-weight: 700; }
.readout-fault { flex-basis: 100%; display: flex; gap: 9px; align-items: baseline; padding: 9px 11px; border: 1px solid var(--red); border-radius: 3px; color: var(--text); font-size: 13px; }
.readout-fault::before { content: 'FAULT'; font-family: var(--mono); font-size: 9px; letter-spacing: 0.2em; color: var(--red); flex: none; }

/* Learned keywords ledger. */
.kw-row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px 12px; align-items: center;
    padding: 9px 14px; border-bottom: 1px solid var(--line);
}
.kw-row:last-child { border-bottom: 0; }
.kw-term { font-weight: 600; font-size: 14px; }
.kw-aka { display: block; font-family: var(--mono); font-size: 10px; color: var(--dim); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kw-meta { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; color: var(--dim); text-transform: uppercase; text-align: right; white-space: nowrap; }
.kw-meta b { color: var(--amber); font-weight: 600; }
@media (max-width: 880px) { .kw-row { grid-template-columns: minmax(0, 1fr) auto; } .kw-meta { display: none; } }

/* ── Overlay + toast ───────────────────────────────────────────────────── */
.ov-backdrop { position: fixed; inset: 0; background: rgba(6, 8, 10, 0.82); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.ov-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 3px; max-width: 720px; width: 100%; max-height: 84vh; display: flex; flex-direction: column; }
.ov-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; }
.ov-head span { display: flex; gap: 8px; }
.ov-panel pre { padding: 14px; overflow: auto; font-family: var(--mono); font-size: 12px; line-height: 1.55; white-space: pre-wrap; color: var(--text); }
.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px);
    background: var(--raised); border: 1px solid var(--amber); border-radius: 2px;
    color: var(--text); font-family: var(--mono); font-size: 12px;
    padding: 10px 16px; opacity: 0; pointer-events: none; z-index: 60;
    transition: opacity 0.2s, transform 0.2s; max-width: min(92vw, 480px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: var(--red); }

.skel { min-height: 72px; background: var(--raised); border-radius: 2px; animation: skel 1.1s ease-in-out infinite alternate; margin: 10px 14px; }
@keyframes skel { to { opacity: 0.45; } }

/* ── Mobile: rail becomes a bottom tab bar; everything single-column ───── */
@media (max-width: 880px) {
    .cockpit { grid-template-columns: minmax(0, 1fr); }
    .rail {
        position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 40;
        flex-direction: row; align-items: stretch;
        border-right: 0; border-top: 1px solid var(--line);
        background: var(--panel);
        padding-bottom: env(safe-area-inset-bottom);
    }
    .rail-brand, .rail-systems { display: none; }
    .rail-nav { flex-direction: row; padding: 0; overflow-x: auto; width: 100%; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .rail-nav::-webkit-scrollbar { display: none; }
    .nav-item {
        flex: 1 0 auto; flex-direction: column; gap: 4px; justify-content: center; align-items: center;
        padding: 9px 12px 10px; font-size: 10px; letter-spacing: 0.06em;
        border-left: 0; border-top: 2px solid transparent;
    }
    .nav-item.active { border-top-color: var(--amber); background: none; }
    .stage { padding: 14px 12px 92px; }
    .panel-row, .tc-track { grid-template-columns: minmax(0, 1fr); }
    .tc-detail-grid { grid-template-columns: minmax(0, 1fr); }
    .inst-big { font-size: 30px; }
    .card-grid { grid-template-columns: minmax(0, 1fr); }
    .tc-form input { width: 100px; }
    .tc-log-table th:nth-child(5), .tc-log-table td:nth-child(5) { display: none; }
}

/* ── Reduced motion: everything static ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── Plan tab ─────────────────────────────────────────────────────────── */
.plan-ta { width: 100%; background: var(--raised); border: 1px solid var(--line); border-radius: 2px; color: var(--text); font-family: var(--mono); font-size: 13px; line-height: 1.55; padding: 10px 12px; resize: vertical; }
.plan-ta:focus { border-color: var(--amber); outline: none; }
.plan-actions { margin-top: 10px; display: flex; gap: 8px; justify-content: flex-end; }
.plan-suggested { border: 1px dashed var(--line); border-radius: 2px; padding: 10px 12px; margin-bottom: 10px; background: rgba(255, 176, 0, 0.04); }
.plan-suggested-head { font-size: 10px; letter-spacing: 0.15em; color: var(--amber); margin-bottom: 6px; }
.plan-suggested pre { white-space: pre-wrap; font-family: var(--mono); font-size: 12px; line-height: 1.5; color: var(--text); margin: 0; }
.inst-small-text { font-size: 1rem !important; line-height: 1.3; }

/* ── Intel tab ────────────────────────────────────────────────────────── */
.intel-sub { font-size: 11px; color: var(--dim); margin-top: 2px; }
.intel-evidence { max-width: 320px; font-size: 11px; color: var(--dim); text-align: left !important; white-space: normal; }
.intel-evidence a { color: var(--amber); text-decoration: none; }
.intel-headline { font-family: var(--mono); font-size: 13px; color: var(--text); border-left: 2px solid var(--amber); padding-left: 10px; margin-bottom: 12px; }
.intel-tbl td:first-child { white-space: normal; }

/* ── On-the-clock schedule ────────────────────────────────────────────── */
.sched-row { display: flex; gap: 10px; align-items: baseline; font-family: var(--mono); font-size: 13px; padding: 5px 8px; border-bottom: 1px solid var(--line); }
.sched-row:last-child { border-bottom: none; }
.sched-marker { width: 14px; color: var(--dim); flex: none; }
.sched-time { color: var(--dim); flex: none; font-variant-numeric: tabular-nums; }
.sched-activity { color: var(--text); }
.sched-done .sched-activity, .sched-done .sched-time { color: var(--dim); text-decoration: line-through; text-decoration-color: rgba(255,255,255,0.2); }
.sched-now { background: rgba(255, 176, 0, 0.07); border-left: 2px solid var(--amber); }
.sched-now .sched-marker { color: var(--amber); }
.sched-now .sched-activity { color: var(--amber); font-weight: 600; }

/* ═══════════════ v4 pass (20 Aug): legible, alive, app-grade ═══════════════
   Five moves: mobile readability, power-on motion, radar vitals strip,
   skeleton loading, dock polish. Identity unchanged — avionics, sharpened. */

/* 1 · READABILITY — the panel is an instrument, not microfiche. */
:root { --dim: #9AA7B4; }
.panel-title span:first-child { font-size: 12px; letter-spacing: 0.14em; }
.dim-note { font-size: 13px; }
@media (max-width: 880px) {
    body { font-size: 16px; }
    .stage { padding: 12px 12px 96px; }
    .panel-title { flex-wrap: wrap; }
    .panel-title .panel-note { font-size: 11px; }
    .inst-big { font-size: 34px; }
    .btn { min-height: 44px; }
    .nav-item { font-size: 11px; font-weight: 600; padding: 11px 14px 12px; }
}

/* 2 · POWER-ON — panels boot in sequence on every view switch. */
.view.active .panel { animation: kv-boot .4s cubic-bezier(.2, .75, .3, 1) backwards; }
.view.active .panel:nth-of-type(2) { animation-delay: .05s; }
.view.active .panel:nth-of-type(3) { animation-delay: .10s; }
.view.active .panel:nth-of-type(4) { animation-delay: .15s; }
.view.active .panel:nth-of-type(5) { animation-delay: .20s; }
.view.active .panel:nth-of-type(n+6) { animation-delay: .25s; }
@keyframes kv-boot { from { opacity: 0; transform: translateY(12px); } }
.btn, .nav-item { transition: transform .12s ease, background .15s ease; }
.btn:active { transform: scale(.96); }
.nav-item:active { transform: scale(.94); }
.nav-led { animation: kv-led 3s ease-in-out infinite; }
@keyframes kv-led { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.inst-big { transition: color .2s ease; }
.inst-big.ticking { color: var(--amber); }

/* 3 · VITALS STRIP — the signature: live store state under a radar sweep. */
.vitals {
    position: relative; overflow: hidden;
    display: flex; gap: 18px; align-items: baseline; flex-wrap: wrap;
    font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em;
    color: var(--dim);
    border: 1px solid var(--line); background: var(--raised);
    padding: 9px 14px; margin-bottom: 14px;
}
.vitals b { color: var(--amber); font-weight: 600; font-variant-numeric: tabular-nums; }
.vitals .v-ok b { color: var(--green); }
.vitals::after {
    content: ''; position: absolute; top: 0; bottom: 0; width: 34%;
    left: -40%; pointer-events: none;
    background: linear-gradient(100deg, transparent, rgba(255, 180, 84, 0.07), transparent);
    animation: kv-sweep 7s linear infinite;
}
@keyframes kv-sweep { to { left: 130%; } }
@media (max-width: 880px) { .vitals { gap: 12px; font-size: 11px; } }

/* 4 · SKELETON loading — shimmer bars, never the word "loading". */
.skel { display: grid; gap: 9px; padding: 4px 0; }
.skel i {
    display: block; height: 13px; border-radius: 2px;
    background: linear-gradient(90deg, var(--line) 25%, #2C3640 45%, var(--line) 65%);
    background-size: 220% 100%;
    animation: kv-shimmer 1.3s linear infinite;
}
.skel i:nth-child(2) { width: 82%; } .skel i:nth-child(3) { width: 64%; }
@keyframes kv-shimmer { to { background-position: -120% 0; } }

/* 5 · DOCK polish — active tab glows; edges hint at more tabs. */
@media (max-width: 880px) {
    .nav-item.active { color: var(--amber); text-shadow: 0 0 14px rgba(255, 180, 84, 0.45); }
    .rail::before, .rail::after {
        content: ''; position: absolute; top: 0; bottom: 0; width: 18px; z-index: 41; pointer-events: none;
    }
    .rail::before { left: 0; background: linear-gradient(90deg, var(--panel), transparent); }
    .rail::after { right: 0; background: linear-gradient(270deg, var(--panel), transparent); }
}

/* ═══════════════ v5: operator-grade tracking (research 20 Aug) ═══════════
   Shared grammar for every tracking page: RAG states, verdict chips,
   gate strips, funnel bars, spark lines. Rule: no naked numbers —
   value + target + trend + state, state never colour-alone. */
.rag { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; padding: 2px 8px; border: 1px solid var(--line); border-radius: 2px; text-transform: uppercase; }
.rag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.rag.g { color: var(--green); } .rag.g::after { content: ' OK'; }
.rag.a { color: var(--amber); } .rag.a::after { content: ' WATCH'; }
.rag.r { color: var(--red); } .rag.r::after { content: ' ACT'; }
.rag.n { color: var(--dim); } .rag.n::after { content: ' —'; }
.verdict { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; padding: 3px 9px; border-radius: 2px; font-weight: 600; }
.verdict.testing { background: var(--amber-dim); color: var(--amber); }
.verdict.watch { background: rgba(154, 167, 180, 0.15); color: var(--dim); }
.verdict.kill { background: rgba(240, 86, 74, 0.15); color: var(--red); }
.verdict.scale { background: rgba(74, 222, 128, 0.14); color: var(--green); }
.gates { display: inline-flex; gap: 5px; align-items: center; }
.gates i { width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--line); background: transparent; }
.gates i.pass { background: var(--green); border-color: var(--green); }
.gates i.fail { background: var(--red); border-color: var(--red); }
.gates i.next { border-color: var(--amber); }
.spark { display: inline-block; vertical-align: -3px; }
.funnel-row { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 12px; }
.funnel-row .fl { flex: 0 0 150px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.08em; font-size: 10px; }
.funnel-row .fb { height: 14px; background: var(--amber-dim); border-left: 2px solid var(--amber); min-width: 2px; transition: width .6s cubic-bezier(.2,.75,.3,1); }
.funnel-row .fn { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.funnel-row .fd { color: var(--dim); font-size: 10px; }
.headline-num { font-family: var(--display); font-stretch: 115%; font-weight: 700; font-size: 40px; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }
.headline-wrap { padding: 16px 14px 12px; border-bottom: 1px solid var(--line); display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.headline-wrap .hl { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); width: 100%; }
.action-chip { display: inline-flex; gap: 6px; align-items: center; font-family: var(--mono); font-size: 11px; padding: 5px 11px; border: 1px solid var(--amber); color: var(--amber); background: none; border-radius: 2px; cursor: pointer; }
.action-chip:active { transform: scale(.95); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); }
.cal-cell { background: var(--raised); min-height: 52px; padding: 4px 5px; font-family: var(--mono); font-size: 10px; color: var(--dim); }
.cal-cell .d { font-size: 9px; }
.cal-cell.today { outline: 1px solid var(--amber); outline-offset: -1px; }
.cal-evt { margin-top: 3px; padding: 2px 4px; background: var(--amber-dim); color: var(--amber); border-radius: 2px; font-size: 9px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lights { display: inline-flex; gap: 4px; }
.lights i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.lights i.on { background: var(--green); }
.streak { display: flex; gap: 3px; }
.streak i { width: 12px; height: 18px; border-radius: 2px; background: var(--line); }
.streak i.hit { background: var(--green); }
.streak i.today { outline: 1px solid var(--amber); }
