/* Hallmark · shape: app screen · genre: modern-minimal · theme: Rim (deal 2/3, seed internal-live-stream-clipping-ops-02f1·fe76b382·2026-11-17·r0)
 * nav: a top bar, wordmark, six links, live count and log out · signature: the spike trace (chat bars under the firing line, detections pinned to their clips) · states: loading, empty, error, full
 * axes: dark/grotesk-sans/warm · posture: restrained · modes: light+dark · data: sample · contrast: pass · v2.0.0 */
/* Hallmark · pre-emit critique: P4 H4 E4 S4 R5 V4 · weakest: P and H, an ops dashboard argues little; the trace and the review queue carry the screen, figures stay small and mono */
/* Hallmark · waive 49b · clip titles wrap to two lines in the review grid · a clip title is Denis's own label for a moment and is never shortened by the UI */
/* Hallmark · dismissed 3 · alerts, form errors and the recording-rights box carry a 3px left edge in their severity colour · the edge is the status signal, not card decoration */
/* Hallmark · dismissed 41 · stream cards sit on paper-2, which is dark only in the night colourway where body ink is already light · checked in both modes */
/* Hallmark · dismissed F25 · on phones the latest-candidates grid shows six of twelve clips · the rest are one tap away in the clips list linked above it */
/* Hallmark · waive 72 · tool cards in the agent transcript are closed details elements whose hidden JSON body is measured as overflow · the visible summary row has 8px of padding on every side */

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { scrollbar-color: var(--color-muted-2) var(--color-paper); scroll-padding-top: var(--space-2xl); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--color-paper); color: var(--color-ink); font-family: var(--font-body); font-size: var(--text-md); line-height: 1.5; font-synthesis: none; -webkit-font-smoothing: antialiased; caret-color: var(--color-accent); }
::selection { background: color-mix(in oklab, var(--color-accent) 35%, transparent); color: var(--color-ink); }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; text-decoration-color: var(--color-muted-2); }
a:hover { text-decoration-color: var(--color-accent); }
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: var(--display-weight); line-height: 1.15; letter-spacing: var(--tracking-display); overflow-wrap: break-word; min-width: 0; text-wrap: balance; }
h1 { font-size: var(--text-display); max-width: 30ch; }
h2 { font-size: var(--text-section); letter-spacing: -0.01em; }
h3 { font-size: var(--text-title); letter-spacing: 0; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }
dl, dd { margin: 0; }
img, video { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
code, kbd, pre { font-family: var(--font-outlier); font-size: 0.9em; }
code { overflow-wrap: anywhere; }
kbd { border: 1px solid var(--color-rule); padding: 0 var(--space-2xs); font-size: var(--text-xs); }
[hidden] { display: none !important; }
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.measure, .num { font-variant-numeric: tabular-nums; }
.measure { font-family: var(--font-outlier); font-size: 0.92em; letter-spacing: 0; }
.unit { color: var(--color-muted); font-size: var(--text-sm); }
.muted { color: var(--color-muted); }
.js .js-hide { display: none; }
.skip { position: absolute; left: var(--space-md); top: -100px; background: var(--color-ink); color: var(--color-paper); padding: var(--space-xs) var(--space-md); z-index: var(--z-modal); }
.skip:focus-visible { top: var(--space-md); }
.stack { display: grid; gap: var(--space-md); align-content: start; }

/* ---------- top bar ---------- */
.topbar { border-bottom: var(--rule-hair) solid var(--color-rule); background: var(--color-paper); }
.topbar__in { display: flex; align-items: center; gap: var(--space-xl); min-height: 56px; }
.wordmark { font-weight: 500; font-size: var(--text-lg); letter-spacing: -0.02em; text-decoration: none; }
.nav { display: flex; gap: var(--space-2xs); flex: 1; min-width: 0; }
.nav a { padding: var(--space-xs) var(--space-sm); text-decoration: none; color: var(--color-muted); white-space: nowrap; border-bottom: 2px solid transparent; transition: color var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out); }
.nav a:hover { color: var(--color-ink); }
.nav a[aria-current="page"] { color: var(--color-ink); border-bottom-color: var(--color-accent); }
.topbar__end { display: flex; align-items: center; gap: var(--space-sm); }
.live-count { font-family: var(--font-outlier); font-size: var(--text-sm); padding: var(--space-2xs) var(--space-xs); border: 1px solid var(--color-rule); text-decoration: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.live-count:hover { border-color: var(--color-muted); }
.topbar__logout { margin: 0; }

.main { padding-block: var(--space-xl) var(--space-3xl); }
.alerts { display: grid; gap: var(--space-xs); }
.alerts:not(:empty) { padding-top: var(--space-md); }
.alert { padding: var(--space-sm) var(--space-md); border-left: 3px solid var(--color-accent-2); background: var(--color-paper-2); max-width: 75ch; }
.alert--warn { border-left-color: var(--color-accent); }
.alert--error { border-left-color: var(--color-error); }
.alert--info { border-left-color: var(--color-accent-2); }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs); min-height: var(--control-h); padding: 0 var(--space-md); border: 1px solid var(--color-rule); background: transparent; color: var(--color-ink); font-weight: 500; font-size: var(--text-sm); text-decoration: none; white-space: nowrap; cursor: pointer; position: relative; transition: background-color var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out); }
.btn::before { content: ""; position: absolute; inset: -4px 0; }
.btn:hover { border-color: var(--color-muted); background: var(--color-paper-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn--primary { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-accent-ink); }
.btn--primary:hover { background: color-mix(in oklab, var(--color-accent) 88%, var(--color-ink)); border-color: color-mix(in oklab, var(--color-accent) 88%, var(--color-ink)); }
.btn--quiet { border-color: transparent; color: var(--color-muted); }
.btn--quiet:hover { color: var(--color-ink); border-color: var(--color-rule); background: transparent; }
.btn--danger { border-color: var(--color-error); color: var(--color-error); }
.btn--danger:hover { background: color-mix(in oklab, var(--color-error) 10%, var(--color-paper)); border-color: var(--color-error); }
.btn--danger-text { color: var(--color-error); padding-inline: 0; }
.btn--danger-text:hover { color: var(--color-error); text-decoration: underline; border-color: transparent; }
.btn--sm { min-height: var(--control-h-sm); padding: 0 var(--space-sm); }
.btn--wide { width: 100%; }
.htmx-request .btn[type="submit"], .btn.htmx-request { opacity: 0.7; cursor: progress; }
.link-btn { display: inline-flex; align-items: center; min-height: var(--control-h-sm); background: none; border: 0; padding: 0; color: var(--color-muted); font-size: var(--text-sm); text-decoration: underline; text-decoration-color: var(--color-rule); text-underline-offset: 0.18em; cursor: pointer; }
.link-btn:hover { color: var(--color-ink); text-decoration-color: var(--color-accent); }
.link-btn:active { color: var(--color-accent-text); }
.link-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.field { display: grid; gap: var(--space-2xs); min-width: 0; align-content: start; }
.field__label { font-size: var(--text-sm); font-weight: 500; color: var(--color-muted); }
.field__help { font-size: var(--text-xs); color: var(--color-muted); min-height: 1lh; }
.field--error .field__help, .field__help--error { color: var(--color-error); }
.field--error .input { border-color: var(--color-error); }
.field--inline { grid-auto-flow: column; align-items: center; gap: var(--space-xs); }
.field--narrow { max-width: 9rem; }
.field__row { display: flex; gap: var(--space-xs); align-items: center; }
.field__row .input { flex: 1; min-width: 0; }
.field__unit-wrap { display: flex; align-items: center; gap: var(--space-xs); }
.field__unit { color: var(--color-muted); font-size: var(--text-sm); }
.field__static { display: flex; gap: var(--space-xs); align-items: center; min-height: var(--control-h); }
.input { min-height: var(--control-h); width: 100%; padding: var(--space-2xs) var(--space-sm); border: 1px solid var(--color-muted-2); background: var(--color-paper); color: var(--color-ink); border-radius: 0; outline: 2px solid transparent; outline-offset: -2px; transition: background-color var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out); }
.input:hover { background: var(--color-paper-2); }
.input:focus-visible { outline-color: var(--color-focus); border-color: var(--color-ink-2); }
.input:disabled { opacity: 0.55; cursor: not-allowed; }
.input::placeholder { color: var(--color-muted-2); }
.input[aria-invalid="true"] { border-color: var(--color-error); }
select.input { padding-right: var(--space-lg); }
textarea.input { resize: vertical; min-height: 6rem; line-height: 1.45; padding-block: var(--space-xs); }
.input--num { width: 7rem; font-family: var(--font-outlier); font-variant-numeric: tabular-nums; }
.input--mono { font-family: var(--font-outlier); font-size: var(--text-sm); }
.input--code { font-family: var(--font-outlier); font-size: var(--text-lg); letter-spacing: 0.08em; width: 9rem; }
.check { display: flex; align-items: flex-start; gap: var(--space-xs); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: var(--space-2xs) 0 0; accent-color: var(--color-accent); flex-shrink: 0; }
.check input:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

.seg { display: inline-flex; border: 1px solid var(--color-rule); margin: 0; padding: 0; }
.seg__opt { position: relative; }
.seg__opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg__opt span { display: inline-flex; align-items: center; min-height: var(--control-h-sm); padding: 0 var(--space-sm); font-size: var(--text-sm); color: var(--color-muted); white-space: nowrap; }
.seg__opt + .seg__opt span { border-left: 1px solid var(--color-rule); }
.seg__opt input:hover + span { color: var(--color-ink); background: var(--color-paper-2); }
.seg__opt input:checked + span { color: var(--color-ink); background: var(--color-paper-3); box-shadow: inset 0 -2px 0 var(--color-accent); }
.seg__opt input:focus-visible + span { outline: 2px solid var(--color-focus); outline-offset: -2px; }

.disclosure > summary { cursor: pointer; font-weight: 500; font-size: var(--text-sm); padding-block: var(--space-xs); list-style: none; display: flex; align-items: center; gap: var(--space-xs); }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before { content: "+"; font-family: var(--font-outlier); color: var(--color-muted); width: 1ch; }
.disclosure[open] > summary::before { content: "\2212"; }
.disclosure > summary:hover { color: var(--color-accent-text); }

/* ---------- tags, pills, badges ---------- */
.tag, .badge, .pill { display: inline-flex; align-items: center; font-size: var(--text-xs); line-height: 1.3; padding: 1px var(--space-xs); border: 1px solid var(--color-rule); color: var(--color-muted); white-space: nowrap; font-weight: 500; }
.badge { color: var(--color-ink-2); }
.tag--queued { border-color: var(--color-accent-2); color: var(--color-accent-2); }
.tag--term { font-family: var(--font-outlier); font-weight: 400; color: var(--color-ink-2); }
.pill--live { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-accent-ink); }
.pill--starting, .pill--degraded { border-color: var(--color-accent); color: var(--color-accent-text); }
.pill--idle { color: var(--color-muted); }
.pill--off { color: var(--color-muted); border-style: dashed; }
.pill--error, .pill--failed, .pill--job-failed { border-color: var(--color-error); color: var(--color-error); }
.pill--candidate, .pill--job-queued { border-color: var(--color-accent-2); color: var(--color-accent-2); }
.pill--job-running { border-color: var(--color-accent); color: var(--color-accent-text); }
.pill--approved, .pill--job-done { border-color: var(--color-success); color: var(--color-success); }
.pill--rejected, .pill--job-cancelled { color: var(--color-muted); }
.review-count { font-size: var(--text-sm); font-weight: 500; color: var(--color-accent-text); text-decoration: none; margin-right: auto; white-space: nowrap; }
.review-count:hover { text-decoration: underline; }
.score { display: inline-flex; align-items: baseline; gap: var(--space-2xs); }
.score__label { font-size: var(--text-xs); color: var(--color-muted); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--color-rule); border-top-color: var(--color-accent); border-radius: 50%; animation: spin 0.9s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(1turn); } }

/* ---------- page heads ---------- */
.page-head { display: grid; gap: var(--space-xs); margin-bottom: var(--space-xl); }
.page-head__line { color: var(--color-muted); max-width: 70ch; }
.page-head--split { grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: var(--space-lg); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-md); flex-wrap: wrap; padding-top: var(--space-md); border-top: 1px solid var(--color-rule); margin-bottom: var(--space-lg); }
.section-head__link { font-size: var(--text-sm); color: var(--color-accent-text); }
.empty { color: var(--color-muted); max-width: 60ch; padding: var(--space-lg) 0; }
.note:empty, .panel-head__note:empty { display: none; }
.note { color: var(--color-muted); margin-bottom: var(--space-md); }
.crumbs { display: flex; gap: var(--space-xs); font-size: var(--text-sm); color: var(--color-muted); margin-bottom: var(--space-sm); }
.form-alert { border-left: 3px solid var(--color-error); background: var(--color-paper-2); padding: var(--space-sm) var(--space-md); display: grid; gap: var(--space-xs); }
.form-alert ul { display: grid; gap: var(--space-2xs); font-size: var(--text-sm); }
.form-alert a { color: var(--color-error); }
.form-ok { border-left: 3px solid var(--color-success); background: var(--color-paper-2); padding: var(--space-sm) var(--space-md); }

/* ---------- dashboard ---------- */
.streams { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap-columns); margin-bottom: var(--space-2xl); }
.stream-card { display: flex; flex-direction: column; gap: var(--space-sm); padding: var(--space-md); background: var(--color-paper-2); min-width: 0; }
.stream-card--live { grid-column: span 2; grid-row: span 2; }
.stream-card__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-sm); }
.stream-card__name { font-size: var(--text-lg); }
.stream-card__name a { text-decoration: none; }
.stream-card__name a:hover { text-decoration: underline; text-decoration-color: var(--color-accent); }
.stream-card__channel { display: flex; gap: var(--space-xs); align-items: center; color: var(--color-muted); font-size: var(--text-sm); }
.stream-card__frame { margin: 0; position: relative; aspect-ratio: 16 / 9; background: var(--color-paper-3); }
.stream-card__frame img { width: 100%; height: 100%; object-fit: cover; }
.stream-card__frame figcaption { position: absolute; left: 0; bottom: 0; padding: var(--space-2xs) var(--space-xs); background: color-mix(in oklab, var(--color-paper) 82%, transparent); font-size: var(--text-xs); color: var(--color-ink); }
.stream-card__trace { height: 56px; border-bottom: 1px solid var(--color-rule); }
.trace { width: 100%; height: 100%; display: block; }
.stream-card__note { color: var(--color-muted); font-size: var(--text-sm); flex: 1; }
.figures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-sm) var(--space-md); }
.stream-card--live .figures { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.figures > div { display: grid; gap: 0; border-top: 1px solid var(--color-rule); padding-top: var(--space-2xs); }
.figures dt { font-size: var(--text-xs); color: var(--color-muted); }
.figures dd { display: flex; align-items: baseline; gap: var(--space-2xs); flex-wrap: wrap; }
.stream-card--live .figures .measure { font-size: var(--text-xl); }
.stream-card__actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-xs); margin-top: auto; flex-wrap: wrap; }
.stream-card__actions form { margin: 0; }
.add-card { display: grid; align-content: center; gap: var(--space-xs); padding: var(--space-md); border: 1px dashed var(--color-muted-2); text-decoration: none; color: var(--color-muted); transition: border-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out); }
.add-card:hover { border-color: var(--color-accent); color: var(--color-ink); }
.add-card__title { font-weight: 500; color: var(--color-ink); }
.add-card__title::before { content: "+ "; color: var(--color-accent-text); }
.add-card__line { font-size: var(--text-sm); }

/* ---------- clips ---------- */
.clip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: var(--space-lg) var(--gap-columns); }
.clip-grid--latest { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.clip-grid--latest > :nth-child(n + 13) { display: none; }
.clip { position: relative; min-width: 0; }
.clip__in { display: flex; flex-direction: column; gap: var(--space-xs); height: 100%; }
.clip__frame { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--color-paper-3); overflow: hidden; }
.clip__frame img { width: 100%; height: 100%; object-fit: cover; }
.clip__frame--busy, .clip__frame--failed { display: flex; align-items: center; justify-content: center; gap: var(--space-xs); padding: var(--space-md); text-align: center; font-size: var(--text-sm); color: var(--color-muted); border: 1px dashed var(--color-rule); }
.clip__frame--failed { color: var(--color-error); border-color: color-mix(in oklab, var(--color-error) 50%, var(--color-rule)); }
.clip__dur { position: absolute; right: 0; bottom: 0; padding: 1px var(--space-xs); background: color-mix(in oklab, var(--color-paper) 85%, transparent); font-size: var(--text-xs); }
.clip__body { display: grid; gap: var(--space-2xs); }
.clip__title { font-size: var(--text-md); font-weight: 500; line-height: 1.3; }
.clip__title a { text-decoration: none; }
.clip__title a:hover { text-decoration: underline; text-decoration-color: var(--color-accent); }
.clip__meta { display: flex; gap: var(--space-sm); flex-wrap: wrap; font-size: var(--text-sm); color: var(--color-muted); }
.clip__state { display: flex; align-items: center; gap: var(--space-sm); font-size: var(--text-sm); }
.clip__actions { display: flex; gap: var(--space-xs); margin-top: auto; padding-top: var(--space-2xs); }
.clip__actions form { margin: 0; }
.clip:has(.pill--rejected) .clip__frame img { opacity: 0.55; }
.clip__pick { position: absolute; top: var(--space-xs); left: var(--space-xs); z-index: var(--z-raised); width: 20px; height: 20px; margin: 0; accent-color: var(--color-accent); }
.clip__pick:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.clip:has(.clip__pick:checked) .clip__frame { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.results-line { color: var(--color-muted); font-size: var(--text-sm); margin-bottom: var(--space-md); }
.more { margin-top: var(--space-xl); }
.filters { display: flex; flex-wrap: wrap; gap: var(--space-md); align-items: end; padding-bottom: var(--space-lg); margin-bottom: var(--space-lg); border-bottom: 1px solid var(--color-rule); }
.filters .field { min-width: 10rem; }
.filters .field--narrow { min-width: 0; }
.bulk { display: flex; align-items: center; gap: var(--space-xs); flex-wrap: wrap; margin-bottom: var(--space-md); }
.bulk__label { font-size: var(--text-sm); color: var(--color-muted); margin-right: var(--space-xs); }

/* ---------- stream detail ---------- */
.stream-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-lg); flex-wrap: wrap; margin-bottom: var(--space-lg); }
.stream-head__id { display: grid; gap: var(--space-xs); min-width: 0; }
.stream-head__meta { display: flex; align-items: center; gap: var(--space-sm); flex-wrap: wrap; color: var(--color-muted); font-size: var(--text-sm); }
.stream-head__reason { color: var(--color-error); font-size: var(--text-sm); }
.stream-head__controls { display: flex; gap: var(--space-xs); flex-wrap: wrap; }
.stream-head__controls form { margin: 0; }
.tabs { display: flex; gap: var(--space-2xs); border-bottom: 1px solid var(--color-rule); margin-bottom: var(--space-xl); overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: var(--space-xs) var(--space-md); text-decoration: none; color: var(--color-muted); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out); }
.tabs a:hover { color: var(--color-ink); }
.tabs a[aria-current="page"] { color: var(--color-ink); border-bottom-color: var(--color-accent); }
.tabs--quiet { margin-bottom: var(--space-lg); }
.panel-head { display: flex; gap: var(--space-md); align-items: center; flex-wrap: wrap; margin-bottom: var(--space-lg); }
.panel-head__line { color: var(--color-muted); flex: 1; min-width: 16rem; }
.panel-head__note { flex-basis: 100%; color: var(--color-success); font-size: var(--text-sm); }

.activity { margin-bottom: var(--space-2xl); }
.activity .section-head { border-top: 0; padding-top: 0; }
.activity__controls { display: flex; gap: var(--space-md); align-items: center; flex-wrap: wrap; }
.chart { margin: 0; display: grid; gap: var(--space-sm); }
.chart__svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart__svg--narrow { display: none; }
.chart text { font-family: var(--font-outlier); fill: var(--color-muted); }
.chart .grid { stroke: var(--color-rule-2); stroke-width: 1; }
.chart .baseline { stroke: var(--color-rule); stroke-width: 1; }
.chart .tick { stroke: var(--color-rule); }
.bars .bar, .trace .bar { fill: var(--color-muted-2); }
.bars .bar--hot, .trace .bar--hot { fill: var(--color-accent); }
.threshold { fill: none; stroke: var(--color-accent-2); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.trace .threshold { stroke-width: 1.5; }
.pin { stroke: var(--color-ink-2); stroke-width: 1; }
.pin__head { fill: var(--color-ink); }
.pin-link:hover .pin__head, .pin-link:focus-visible .pin__head { fill: var(--color-accent); }
.pin-link:hover .pin { stroke: var(--color-accent); }
.pin-link:focus-visible { outline: none; }
.spike { stroke: var(--color-accent-2); stroke-width: 1.5; stroke-dasharray: none; }
.chart .axis--spike { fill: var(--color-accent-2); }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-lg); font-size: var(--text-xs); color: var(--color-muted); }
.legend__item { display: inline-flex; align-items: center; gap: var(--space-xs); }
.swatch { display: inline-block; width: 10px; height: 10px; background: var(--color-muted-2); }
.swatch--hot { background: var(--color-accent); }
.swatch--line { height: 2px; width: 14px; background: var(--color-accent-2); }
.swatch--pin { width: 8px; height: 8px; background: var(--color-ink); }

.overview-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--space-2xl); margin-bottom: var(--space-2xl); }
.overview-grid h2, .logs h2 { margin-bottom: var(--space-md); }
.latency { display: grid; gap: var(--space-xs); align-content: start; align-self: start; padding: var(--space-md); background: var(--color-paper-2); }
.latency h2 { margin-bottom: 0; }
.latency__figure { display: flex; align-items: baseline; gap: var(--space-2xs); }
.latency__figure .measure { font-size: var(--text-figure); letter-spacing: -0.03em; line-height: 1.1; }
.latency__mode { display: flex; gap: var(--space-xs); align-items: center; flex-wrap: wrap; font-size: var(--text-sm); color: var(--color-muted); }
.latency__help { font-size: var(--text-sm); color: var(--color-muted); }
.calibrate__video { width: 100%; background: var(--color-paper-3); }
.logs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap-columns); }
.log { margin: 0; padding: var(--space-sm) var(--space-md); background: var(--color-paper-3); font-size: var(--text-xs); line-height: 1.6; color: var(--color-ink-2); max-height: 20rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }

.table-wrap { overflow-x: auto; position: relative; }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th { text-align: left; font-weight: 500; color: var(--color-muted); padding: var(--space-xs) var(--space-sm) var(--space-xs) 0; border-bottom: 1px solid var(--color-rule); white-space: nowrap; }
.table td, .table tbody th { padding: var(--space-xs) var(--space-sm) var(--space-xs) 0; border-bottom: 1px solid var(--color-rule-2); vertical-align: top; }
.table tbody th { color: var(--color-ink); font-weight: 500; }
.table .num { text-align: right; }
.table tbody tr:hover { background: var(--color-paper-2); }

/* ---------- config ---------- */
.config { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 22rem); gap: var(--space-2xl); align-items: start; }
.config-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-xl); }
.stream-new .config-form, .main > .config-form { grid-template-columns: minmax(0, 1fr) minmax(0, 22rem); align-items: start; }
.cform { display: grid; gap: var(--space-xl); }
.cform__group { border: 0; border-top: 1px solid var(--color-rule); padding: var(--space-md) 0 0; margin: 0; display: grid; gap: var(--space-md); min-width: 0; }
.cform__group > legend, .cform__group > summary { font-weight: 500; font-size: var(--text-md); padding: 0; display: flex; gap: var(--space-sm); align-items: baseline; }
.cform__group > legend { float: left; width: 100%; margin-bottom: var(--space-xs); }
.cform__group > legend + * { clear: both; }
.next-session { font-size: var(--text-xs); font-weight: 400; color: var(--color-accent-2); }
.cform__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: var(--space-md) var(--space-lg); }
.cform__row--nums { grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); }
.rights { padding: var(--space-sm) var(--space-md); background: var(--color-paper-2); border-left: 3px solid var(--color-accent); }
.rights--error { border-left-color: var(--color-error); }
.cform__save { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-md); align-items: start; padding-top: var(--space-md); border-top: 1px solid var(--color-rule); }
.cform__save .btn { margin-top: calc(var(--space-lg) - var(--space-3xs)); }
.toml { position: sticky; top: var(--space-md); display: grid; gap: var(--space-xs); }
.toml__head { font-size: var(--text-sm); color: var(--color-muted); font-weight: 500; letter-spacing: 0; }
.toml__body { margin: 0; padding: var(--space-sm) var(--space-md); background: var(--color-paper-3); font-size: var(--text-xs); line-height: 1.55; max-height: 70vh; overflow: auto; white-space: pre; }
.config__versions { display: grid; gap: var(--space-md); align-content: start; }
.versions { display: grid; }
.version { padding: var(--space-sm) 0; border-top: 1px solid var(--color-rule-2); display: grid; gap: var(--space-2xs); }
.version--current { border-top-color: var(--color-accent); }
.version__line { display: flex; gap: var(--space-sm); align-items: baseline; flex-wrap: wrap; font-size: var(--text-sm); }
.version__n { font-weight: 500; color: var(--color-ink); }
.version__reason { font-size: var(--text-sm); color: var(--color-ink-2); }
.version__keys { display: flex; gap: var(--space-2xs); flex-wrap: wrap; font-size: var(--text-xs); color: var(--color-muted); }
.version__actions { display: flex; gap: var(--space-md); align-items: center; font-size: var(--text-sm); }
.version__actions form { margin: 0; }
.author { font-size: var(--text-xs); padding: 0 var(--space-2xs); border: 1px solid var(--color-rule); color: var(--color-muted); }
.author--agent { border-color: var(--color-accent-2); color: var(--color-accent-2); }
.author--user { color: var(--color-ink-2); }
.diff-pick { display: flex; gap: var(--space-sm); align-items: end; flex-wrap: wrap; }
.diff { margin: 0; display: grid; gap: var(--space-xs); }
.diff__head { display: flex; justify-content: space-between; gap: var(--space-sm); font-size: var(--text-sm); color: var(--color-muted); }
.diff__count { display: inline-flex; gap: var(--space-xs); }
.diff__add { color: var(--color-success); }
.diff__del { color: var(--color-error); }
.diff__body { margin: 0; background: var(--color-paper-3); font-size: var(--text-xs); line-height: 1.6; max-height: 28rem; overflow: auto; padding: var(--space-xs) 0; }
.diff__line { display: inline; padding-inline: var(--space-sm); }
.diff__line--same { color: var(--color-muted); }
.diff__line--add { background: color-mix(in oklab, var(--color-success) 16%, transparent); color: var(--color-ink); }
.diff__line--del { background: color-mix(in oklab, var(--color-error) 14%, transparent); color: var(--color-ink); }
.diff__sign { display: inline-block; width: 2ch; color: var(--color-muted); }

/* ---------- agent ---------- */
.agent { display: grid; grid-template-columns: minmax(0, 16rem) minmax(0, 1fr); gap: var(--space-xl); align-items: start; }
.agent__sessions { display: grid; gap: var(--space-md); }
.agent__sessions-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-sm); }
.agent__sessions-head form { margin: 0; }
.sessions { display: grid; }
.session { display: grid; gap: var(--space-3xs); padding: var(--space-sm); text-decoration: none; border-left: 2px solid transparent; }
.session:hover { background: var(--color-paper-2); }
.session--current { background: var(--color-paper-2); border-left-color: var(--color-accent); }
.session__title { font-size: var(--text-sm); font-weight: 500; }
.session__meta { display: flex; gap: var(--space-sm); font-size: var(--text-xs); color: var(--color-muted); }
.agent__toggle { font-size: var(--text-sm); color: var(--color-muted); }
.chat { display: flex; flex-direction: column; min-width: 0; background: var(--color-paper-2); min-height: 34rem; }
.chat--empty { justify-content: center; padding: var(--space-xl); height: auto; min-height: 20rem; }
.chat__head { display: flex; gap: var(--space-md) var(--space-lg); align-items: center; flex-wrap: wrap; padding: var(--space-sm) var(--space-md); border-bottom: 1px solid var(--color-rule); }
.chat__title { flex: 1; min-width: 12rem; display: grid; gap: 0; }
.chat__title h2 { font-size: var(--text-md); }
.chat__sub { font-size: var(--text-xs); color: var(--color-muted); }
.chat__backend { display: flex; align-items: center; gap: var(--space-sm); margin: 0; }
.chat__backend .input { min-height: var(--control-h-sm); width: auto; }
.chat__model { font-size: var(--text-xs); color: var(--color-muted); }
.chat__archive { margin: 0; }
.usage { display: flex; gap: var(--space-md); }
.usage > div { display: grid; }
.usage dt { font-size: var(--text-xs); color: var(--color-muted); }
.usage dd { font-size: var(--text-sm); }
.chat__scroll { flex: 1; padding: var(--space-lg) var(--space-md); display: grid; align-content: start; gap: var(--space-md); }
.chat__dock { position: sticky; bottom: 0; z-index: var(--z-sticky); background: var(--color-paper-2); }
.transcript { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-md); }
.chat__scroll { grid-template-columns: minmax(0, 1fr); }
.msg--tool, .tool { min-width: 0; max-width: 100%; }
.msg { display: grid; gap: var(--space-2xs); max-width: 72ch; min-width: 0; }
.msg__body { overflow-wrap: anywhere; }
.msg__meta { display: flex; gap: var(--space-md); align-items: center; font-size: var(--text-xs); color: var(--color-muted); }
.msg__meta form { margin: 0; }
.msg__meta .link-btn { font-size: var(--text-xs); }
.msg--user { justify-self: end; max-width: 60ch; }
.msg--user .msg__body { background: var(--color-paper-3); padding: var(--space-sm) var(--space-md); white-space: pre-wrap; border-right: 2px solid var(--color-ink-2); }
.msg--user .msg__meta { justify-content: flex-end; }
.msg--assistant .msg__body { padding-left: var(--space-md); border-left: 2px solid var(--color-accent); }
.msg--streaming:empty { display: none; }
.msg--streaming { padding-left: var(--space-md); border-left: 2px solid var(--color-accent); white-space: pre-wrap; color: var(--color-ink-2); }
.msg--streaming::after { content: ""; display: inline-block; width: 0.5ch; height: 1em; vertical-align: text-bottom; background: var(--color-accent); margin-left: 1px; }
.msg--note { justify-self: center; font-size: var(--text-xs); color: var(--color-muted); text-align: center; max-width: 60ch; border-block: 1px solid var(--color-rule); padding: var(--space-2xs) var(--space-md); }
.msg--tool { max-width: 72ch; }
.tool { border: 1px solid var(--color-rule); background: var(--color-paper); }
.tool__summary { display: flex; gap: var(--space-sm); align-items: center; padding: var(--space-xs) var(--space-sm); cursor: pointer; font-size: var(--text-sm); list-style: none; min-width: 0; }
.tool__summary::-webkit-details-marker { display: none; }
.tool__summary::before { content: "+"; font-family: var(--font-outlier); color: var(--color-muted); }
.tool[open] .tool__summary::before { content: "\2212"; }
.tool__summary:hover { background: var(--color-paper-3); }
.tool__name { color: var(--color-ink); white-space: nowrap; }
.tool__args { color: var(--color-muted); font-family: var(--font-outlier); font-size: var(--text-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.tool__state { font-size: var(--text-xs); margin-left: auto; white-space: nowrap; }
.tool__state--ok { color: var(--color-success); }
.tool__state--err { color: var(--color-error); }
.tool__state--run { color: var(--color-accent-text); }
.tool__body { padding: var(--space-sm); border-top: 1px solid var(--color-rule); display: grid; gap: var(--space-xs); }
.tool__label { font-size: var(--text-xs); color: var(--color-muted); }
.code { margin: 0; padding: var(--space-xs) var(--space-sm); background: var(--color-paper-3); font-size: var(--text-xs); line-height: 1.55; overflow: auto; max-height: 18rem; white-space: pre; }
.approval { padding: var(--space-md); border: 1px solid var(--color-accent); background: var(--color-paper); display: grid; gap: var(--space-sm); }
.approval--done { border-color: var(--color-rule); }
.approval__head { font-size: var(--text-md); }
.approval__summary { color: var(--color-ink-2); }
.approval__args > summary { cursor: pointer; font-size: var(--text-xs); color: var(--color-muted); }
.approval__actions { display: flex; gap: var(--space-xs); align-items: center; flex-wrap: wrap; }
.approval__actions form { margin: 0; }
.approval__expiry { font-size: var(--text-xs); color: var(--color-muted); margin-left: var(--space-xs); }
.chat__error:empty { display: none; }
.chat__error { color: var(--color-error); font-size: var(--text-sm); }
.chat__statusbar { padding: var(--space-xs) var(--space-md); border-top: 1px solid var(--color-rule); min-height: 2.75rem; display: flex; align-items: center; }
.chat__status { display: flex; align-items: center; gap: var(--space-sm); font-size: var(--text-sm); color: var(--color-muted); }
.chat__status form { margin: 0; }
.chat__state { display: inline-flex; align-items: center; gap: var(--space-xs); }
.chat__state--busy { color: var(--color-ink); }
.composer { display: grid; gap: var(--space-xs); padding: var(--space-sm) var(--space-md) var(--space-md); }
.composer__text { min-height: 4.5rem; background: var(--color-paper); }
.composer__bar { display: flex; gap: var(--space-md); align-items: center; justify-content: space-between; }
.composer__hint { font-size: var(--text-xs); color: var(--color-muted); }

.prose { line-height: 1.6; }
.prose > * + * { margin-top: var(--space-sm); }
.prose h1, .prose h2, .prose h3 { margin-top: var(--space-lg); }
.prose h1 { font-size: var(--text-xl); }
.prose h2 { font-size: var(--text-lg); }
.prose ul, .prose ol { padding-left: var(--space-lg); }
.prose ul { list-style: square; }
.prose ol { list-style: decimal; }
.prose li + li { margin-top: var(--space-2xs); }
.prose li::marker { color: var(--color-muted); }
.prose code { background: var(--color-paper-3); padding: 0 var(--space-2xs); }
.prose pre { background: var(--color-paper-3); padding: var(--space-sm); overflow: auto; }
.prose table { border-collapse: collapse; font-size: var(--text-sm); width: 100%; }
.prose th, .prose td { text-align: left; padding: var(--space-2xs) var(--space-sm) var(--space-2xs) 0; border-bottom: 1px solid var(--color-rule-2); }
.prose th { font-weight: 500; color: var(--color-muted); border-bottom-color: var(--color-rule); }
.prose blockquote { margin: 0; padding-left: var(--space-md); border-left: 2px solid var(--color-rule); color: var(--color-ink-2); }
.prose a { text-decoration-color: var(--color-accent); }

/* ---------- memory ---------- */
.memory { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: var(--space-2xl); align-items: start; }
.wiki-tree { font-size: var(--text-sm); position: sticky; top: var(--space-md); }
.wiki-tree__item a { display: block; padding: var(--space-2xs) var(--space-xs); text-decoration: none; color: var(--color-ink-2); border-left: 2px solid transparent; }
.wiki-tree__item a:hover { background: var(--color-paper-2); }
.wiki-tree__item a[aria-current="page"] { border-left-color: var(--color-accent); background: var(--color-paper-2); color: var(--color-ink); }
.wiki-tree__dir { display: block; padding: var(--space-sm) var(--space-xs) var(--space-2xs); color: var(--color-muted); font-family: var(--font-outlier); font-size: var(--text-xs); }
.wiki-tree__item--d1 { padding-left: var(--space-sm); }
.wiki-tree__item--d2 { padding-left: var(--space-lg); }
.wiki-tree__item--d3 { padding-left: calc(var(--space-lg) + var(--space-sm)); }
.wiki-main { display: grid; gap: var(--space-lg); min-width: 0; }
.wiki-head { display: flex; justify-content: space-between; gap: var(--space-md); align-items: flex-start; flex-wrap: wrap; padding-bottom: var(--space-md); border-bottom: 1px solid var(--color-rule); }
.wiki-head__id { display: grid; gap: var(--space-xs); }
.wiki-head__title { font-size: var(--text-xl); }
.wiki-head__meta { display: flex; gap: var(--space-md); flex-wrap: wrap; align-items: center; font-size: var(--text-sm); color: var(--color-muted); }
.wiki-head__views { display: flex; gap: var(--space-2xs); }
.wiki-head__views a { padding: var(--space-2xs) var(--space-sm); font-size: var(--text-sm); text-decoration: none; color: var(--color-muted); border-bottom: 2px solid transparent; }
.wiki-head__views a:hover { color: var(--color-ink); }
.wiki-head__views a[aria-current="page"] { color: var(--color-ink); border-bottom-color: var(--color-accent); }
.tags { display: flex; gap: var(--space-2xs); flex-wrap: wrap; }
.wiki-page { max-width: 72ch; }
.wiki-sources { font-size: var(--text-xs); color: var(--color-muted); }
.commits { display: grid; }
.commit { display: grid; grid-template-columns: 6rem minmax(0, 1fr) auto auto auto; gap: var(--space-md); align-items: baseline; padding: var(--space-xs) 0; border-bottom: 1px solid var(--color-rule-2); font-size: var(--text-sm); }
.commit--current { background: var(--color-paper-2); }
.commit__who, .commit__when { color: var(--color-muted); font-size: var(--text-xs); }
.commit__actions { display: flex; gap: var(--space-sm); }
.commit__actions form { margin: 0; }
.schema-edit__text { min-height: 24rem; }

/* ---------- clip detail ---------- */
.clip-head { display: grid; gap: var(--space-xs); margin-bottom: var(--space-lg); }
.clip-head__meta { display: flex; gap: var(--space-md); align-items: center; flex-wrap: wrap; color: var(--color-muted); font-size: var(--text-sm); }
.clip-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--space-2xl); align-items: start; margin-bottom: var(--space-2xl); }
.player { display: grid; gap: var(--space-md); }
.player__frame { aspect-ratio: 16 / 9; background: var(--color-paper-3); display: grid; }
.player__frame video { width: 100%; height: 100%; background: var(--color-paper-3); }
.player__swap { display: contents; }
.player__busy { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-sm); padding: var(--space-lg); text-align: center; color: var(--color-muted); }
.player__bar { display: flex; gap: var(--space-md); align-items: center; flex-wrap: wrap; }
.player__bar form { margin: 0; display: flex; gap: var(--space-xs); align-items: center; }
.player__ver { font-family: var(--font-outlier); font-size: var(--text-sm); color: var(--color-muted); }
.side-head { font-size: var(--text-md); }
.trim { display: grid; gap: var(--space-md); padding: var(--space-md); background: var(--color-paper-2); }
.trim__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-lg); }
.trim__row .field { grid-template-columns: auto auto 1fr; align-items: center; column-gap: var(--space-sm); }
.trim__row .field__label, .trim__row .field__help { grid-column: 1 / -1; }
.trim__note { font-size: var(--text-xs); color: var(--color-muted); }
.trim .btn--primary { justify-self: start; }
.clip-side { display: grid; gap: var(--space-xl); }
.clip-status { display: grid; gap: var(--space-sm); }
.clip-status__now { display: flex; gap: var(--space-sm); align-items: center; flex-wrap: wrap; }
.clip-status__reason { font-size: var(--text-sm); color: var(--color-muted); }
.clip-status__actions { display: flex; gap: var(--space-xs); flex-wrap: wrap; }
.clip-status__actions form { margin: 0; }
.reject { margin: 0; }
.meta-form { padding-top: var(--space-lg); border-top: 1px solid var(--color-rule); }
.meta-form .btn { justify-self: start; }
.facts { display: grid; gap: 0; font-size: var(--text-sm); }
.facts > div { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: var(--space-sm); padding: var(--space-xs) 0; border-top: 1px solid var(--color-rule-2); }
.facts dt { color: var(--color-muted); }
.why { padding-top: var(--space-lg); border-top: 1px solid var(--color-rule); display: grid; gap: var(--space-lg); }
.why__grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--space-2xl); align-items: start; }
.why__words { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--space-2xl); }
.why__words h3 { margin-bottom: var(--space-xs); }
.why__untrusted { font-size: var(--text-xs); color: var(--color-muted); margin-bottom: var(--space-xs); }
.chatlines { display: grid; font-size: var(--text-sm); }
.chatlines li { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: var(--space-sm); padding: var(--space-2xs) 0; border-bottom: 1px solid var(--color-rule-2); }
.chatlines time { color: var(--color-muted); font-size: var(--text-xs); }

/* ---------- jobs, settings, audit ---------- */
.job__by { display: block; font-size: var(--text-xs); color: var(--color-muted); }
.job__err { color: var(--color-error); max-width: 32ch; }
.job__actions { display: flex; gap: var(--space-xs); justify-content: flex-end; }
.job__actions form { margin: 0; }
.settings { display: grid; grid-template-columns: minmax(0, 12rem) minmax(0, 1fr); gap: var(--space-2xl); align-items: start; }
.settings__nav { display: grid; position: sticky; top: var(--space-md); font-size: var(--text-sm); }
.settings__nav a { padding: var(--space-2xs) var(--space-sm); text-decoration: none; color: var(--color-muted); border-left: 2px solid var(--color-rule-2); }
.settings__nav a:hover { color: var(--color-ink); border-left-color: var(--color-accent); }
.settings__body { display: grid; gap: var(--space-2xl); min-width: 0; }
.settings__section { display: grid; gap: var(--space-md); padding-top: var(--space-md); border-top: 1px solid var(--color-rule); scroll-margin-top: var(--space-md); }
.settings__cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2xl); align-items: start; }
.settings__cols .btn { justify-self: start; }
.settings__line { color: var(--color-muted); font-size: var(--text-sm); max-width: 70ch; }
.settings__sub { margin-top: var(--space-md); }
.twitch-conn { display: grid; gap: var(--space-md); align-content: start; }
.device-code { font-size: var(--text-figure); letter-spacing: 0.06em; }
.keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: var(--space-lg); }
.key { margin: 0; }
.qr { width: 11rem; padding: var(--space-xs); background: var(--color-paper-2); }
.qr__svg { width: 100%; height: auto; }
.qr__bg { fill: var(--color-qr-light); }
.qr__dark { fill: var(--color-qr-dark); }
.secret { font-size: var(--text-sm); overflow-wrap: anywhere; color: var(--color-ink-2); }
.audit__details code { font-size: var(--text-xs); color: var(--color-muted); }
.table--audit td:first-child { white-space: nowrap; }

/* ---------- public pages ---------- */
.public__main { min-height: 100dvh; display: grid; place-items: center; padding: var(--space-xl) var(--gutter); }
.gate { width: min(100%, 24rem); display: grid; gap: var(--space-md); }
.gate--wide { width: min(100%, 44rem); }
.gate__mark { font-weight: 500; font-size: var(--text-lg); letter-spacing: -0.02em; padding-bottom: var(--space-md); border-bottom: 1px solid var(--color-rule); }
.gate__line { color: var(--color-muted); }
.gate__note { font-size: var(--text-xs); color: var(--color-muted); border-top: 1px solid var(--color-rule); padding-top: var(--space-sm); }
.setup { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 13rem); gap: var(--space-xl); align-items: start; }

/* ---------- dialog ---------- */
.confirm { border: 1px solid var(--color-rule); background: var(--color-paper); color: var(--color-ink); padding: 0; max-width: min(30rem, calc(100% - 2 * var(--space-md))); position: fixed; inset: 0; margin: auto; height: fit-content; }
.confirm::backdrop { background: var(--color-scrim); }
.confirm__in { display: grid; gap: var(--space-lg); padding: var(--space-lg); }
.confirm__actions { display: flex; justify-content: flex-end; gap: var(--space-xs); }

/* ---------- audio lane, shorts, facecam ---------- */
.abars .abar { fill: var(--color-muted-2); }
.abars .abar--loud { fill: var(--color-accent-2); }
.athreshold { stroke: var(--color-accent-2); stroke-width: 1; }
.swatch--audio { background: var(--color-accent-2); width: 10px; height: 10px; }
.swatch--spike { height: 10px; width: 2px; background: var(--color-accent-2); }
.btn--approve { border-color: var(--color-accent); color: var(--color-accent-text); }
.btn--approve:hover { background: color-mix(in oklab, var(--color-accent) 14%, var(--color-paper)); border-color: var(--color-accent); }
.section-head__note { font-size: var(--text-sm); color: var(--color-muted); }
.shorts { padding-top: var(--space-lg); margin-bottom: var(--space-2xl); }
.shorts .section-head { border-top: 1px solid var(--color-rule); }
.shorts__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--space-2xl); align-items: start; }
.short-form, .post-form { align-content: start; }
.short-form .btn, .post-form .btn { justify-self: start; }
.field--plain { border: 0; margin: 0; padding: 0; min-width: 0; }
.field--plain > legend { padding: 0; margin-bottom: var(--space-2xs); }
.short-list { display: grid; gap: var(--space-md); align-content: start; }
.shorts-list { display: grid; gap: var(--space-md); }
.short { display: grid; gap: var(--space-xs); padding: var(--space-sm) var(--space-md); background: var(--color-paper-2); }
.short__head { display: flex; gap: var(--space-sm); align-items: center; flex-wrap: wrap; font-size: var(--text-sm); }
.short__what { color: var(--color-ink-2); }
.short__when { margin-left: auto; color: var(--color-muted); font-size: var(--text-xs); }
.short__window, .short__hook { font-size: var(--text-sm); color: var(--color-muted); }
.short__error { font-size: var(--text-sm); color: var(--color-error); }
.short__warnings { font-size: var(--text-xs); color: var(--color-muted); display: grid; gap: var(--space-3xs); }
.short__warnings li::before { content: "! "; color: var(--color-accent-text); font-family: var(--font-outlier); }
.short__ready { display: grid; grid-template-columns: minmax(0, 9rem) minmax(0, 1fr); gap: var(--space-md); align-items: end; }
.short__video { width: 100%; aspect-ratio: 9 / 16; height: auto; background: var(--color-paper-3); }
.short__links { display: grid; gap: var(--space-xs); font-size: var(--text-sm); }
.pill--short-queued { border-color: var(--color-accent-2); color: var(--color-accent-2); }
.pill--short-running { border-color: var(--color-accent); color: var(--color-accent-text); gap: var(--space-2xs); }
.pill--short-running .spinner, .pill--short-queued .spinner { width: 10px; height: 10px; border-width: 1.5px; }
.pill--short-ready { border-color: var(--color-success); color: var(--color-success); }
.pill--short-failed { border-color: var(--color-error); color: var(--color-error); }
.facecam { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--space-xl); align-items: start; }
.facecam__lead { font-size: var(--text-sm); color: var(--color-muted); margin-bottom: var(--space-sm); }
.facecam__preview { display: grid; grid-template-columns: minmax(0, 1fr) 5.5rem; gap: var(--space-md); align-items: start; }
.facecam__stage, .facecam__stack { margin: 0; display: grid; gap: var(--space-2xs); }
.facecam__stage { position: relative; }
.facecam__stage img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; grid-area: 1 / 1; }
.facecam__overlay { grid-area: 1 / 1; aspect-ratio: 16 / 9; background: color-mix(in oklab, var(--color-paper-3) 50%, transparent); }
.facecam__stage:has(img) .facecam__overlay { background: transparent; }
.facecam__svg { width: 100%; height: 100%; display: block; }
.facecam__dim { fill: var(--color-scrim); }
.facecam__rect { fill: none; stroke: var(--color-accent); stroke-width: 4; vector-effect: non-scaling-stroke; }
.facecam__stage figcaption, .facecam__stack figcaption { font-size: var(--text-xs); color: var(--color-muted); }
.stack__svg { width: 100%; height: auto; display: block; border: 1px solid var(--color-rule); }
.stack__cam { fill: color-mix(in oklab, var(--color-accent) 30%, var(--color-paper-2)); }
.stack__game { fill: var(--color-paper-3); }
.stack__label { font-family: var(--font-outlier); font-size: 10px; fill: var(--color-ink-2); }
@media (max-width: 75rem) { .shorts__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .shorts__grid .post-form { grid-column: 1 / -1; } }
@media (max-width: 60rem) { .shorts__grid, .facecam { grid-template-columns: minmax(0, 1fr); } }

/* ---------- compliance: stream form, pre-flight, policy pages ---------- */
.cnote { font-size: var(--text-sm); color: var(--color-ink-2); padding: var(--space-xs) var(--space-sm); border-left: 3px solid var(--color-rule); background: var(--color-paper-2); max-width: 75ch; }
.cnote--warn { border-left-color: var(--color-accent); }
.cnote--info { border-left-color: var(--color-accent-2); }
.checks { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-lg); min-height: var(--control-h); align-items: center; }
.seg--wrap { flex-wrap: wrap; }
.field--plain > .seg { justify-self: start; }
.input--date { width: 11rem; font-family: var(--font-outlier); }
.input--sm { min-height: var(--control-h-sm); font-size: var(--text-sm); }
.cform .only-third, .cform .only-own-streamlink, .cform .only-track { display: none; }
.cform:has(input[name="rights_ownership"][value="third_party"]:checked) .only-third { display: grid; }
.cform:has(input[name="rights_ownership"][value="third_party"]:checked) .only-own { display: none; }
.cform:has(input[name="rights_ownership"][value="self"]:checked):has(select[name="source_kind"] option[value="streamlink"]:checked) .only-own-streamlink { display: block; }
.cform:has(select[name="shorts_audio_mode"] option[value="track"]:checked) .only-track { display: block; }
.banners { display: grid; gap: var(--space-xs); margin-bottom: var(--space-xl); }
.banner { display: flex; flex-wrap: wrap; gap: var(--space-2xs) var(--space-md); align-items: baseline; max-width: none; }
.banner__link { font-size: var(--text-sm); color: var(--color-accent-text); white-space: nowrap; }
.additions { display: grid; gap: var(--space-3xs); padding: var(--space-xs) var(--space-sm); background: var(--color-paper-2); font-size: var(--text-xs); color: var(--color-ink-2); }
.additions__head { color: var(--color-muted); }
.short__pf { display: inline-flex; gap: var(--space-xs); align-items: center; }
.pill--pf-blocked { border-color: var(--color-error); color: var(--color-error); }
.pill--pf-needs_review { border-color: var(--color-accent); color: var(--color-accent-text); }
.pill--pf-ok { border-color: var(--color-success); color: var(--color-success); }
.preflight { margin-bottom: var(--space-2xl); scroll-margin-top: var(--space-md); }
.pf-status { display: flex; gap: var(--space-sm); align-items: baseline; flex-wrap: wrap; padding: var(--space-sm) var(--space-md); border-left: 3px solid var(--color-accent); background: var(--color-paper-2); margin-bottom: var(--space-lg); }
.pf-status--blocked { border-left-color: var(--color-error); }
.pf-status--ok { border-left-color: var(--color-success); }
.pf-status__line { flex: 1; min-width: 16rem; }
.pf-blocking { flex-basis: 100%; display: grid; gap: var(--space-2xs); font-size: var(--text-sm); padding-left: var(--space-md); list-style: square; }
.pf-blocking li::marker { color: var(--color-error); }
.pf-blocking a { color: var(--color-ink); text-decoration-color: var(--color-error); }
.preflight__grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: var(--space-2xl); align-items: start; }
.pf-items { display: grid; gap: var(--space-xs); min-width: 0; }
.pf-group { font-size: var(--text-sm); color: var(--color-muted); font-weight: 500; padding-top: var(--space-sm); }
.pf-group:first-child { padding-top: 0; }
.pf-list { display: grid; }
.pf-item { display: grid; grid-template-columns: 4.25rem minmax(0, 1fr); gap: var(--space-sm); padding: var(--space-sm) 0; border-top: 1px solid var(--color-rule-2); }
.pf-item__body { display: grid; gap: var(--space-2xs); min-width: 0; }
.pf-item__msg { overflow-wrap: anywhere; }
.pf-item--done .pf-item__msg { color: var(--color-muted); }
.pf-item__meta { display: flex; gap: var(--space-md); flex-wrap: wrap; font-size: var(--text-xs); color: var(--color-muted); }
.pf-item__meta a { color: var(--color-muted); }
.pf-item__meta a:hover { color: var(--color-ink); }
.pf-item__fix { font-size: var(--text-sm); color: var(--color-error); }
.pf-item__tick { font-size: var(--text-xs); color: var(--color-success); }
.sev { justify-self: start; align-self: start; font-family: var(--font-outlier); font-size: var(--text-xs); line-height: 1.3; padding: 1px var(--space-xs); border: 1px solid currentColor; }
.sev--block { color: var(--color-error); }
.sev--warn { color: var(--color-accent-text); }
.sev--info { color: var(--color-accent-2); }
.sev--hard { background: var(--color-error); border-color: var(--color-error); color: var(--color-paper); }
.pf-item:target { background: var(--color-paper-2); box-shadow: inset 3px 0 0 var(--color-error); padding-left: var(--space-sm); }
.tick { display: flex; gap: var(--space-xs) var(--space-md); align-items: center; flex-wrap: wrap; margin: 0; }
.tick .check { align-items: center; font-size: var(--text-sm); }
.tick .check input { margin: 0; }
.tick__note { flex: 1; min-width: 10rem; max-width: 22rem; }
.pf-side { display: grid; gap: var(--space-xl); align-content: start; min-width: 0; }
.pf-side .facts > div { grid-template-columns: 7.5rem minmax(0, 1fr); }
.pf-form { margin: 0; }
.pf-form .btn { justify-self: start; }
.pf-post { padding: var(--space-md); background: var(--color-paper-2); }
.pf-post h3 { font-size: var(--text-md); }
.pf-post__gate { font-size: var(--text-sm); color: var(--color-muted); }
.ledger { display: grid; font-size: var(--text-sm); border-top: 1px solid var(--color-rule); }
.ledger li { display: flex; gap: var(--space-sm); flex-wrap: wrap; align-items: baseline; padding: var(--space-2xs) 0; border-bottom: 1px solid var(--color-rule-2); }
.risk { font-family: var(--font-outlier); font-size: var(--text-sm); }
.risk--high { color: var(--color-error); }
.risk--medium { color: var(--color-accent-text); }
.risk--low { color: var(--color-success); }
.stack--tight { gap: var(--space-xs); }
.figures--rules { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: var(--space-2xl); }
.figures--rules .measure { font-size: var(--text-xl); }
.changes, .watches { margin-bottom: var(--space-2xl); scroll-margin-top: var(--space-md); }
.changes__list { display: grid; }
.change { display: grid; gap: var(--space-2xs); padding: var(--space-sm) 0; border-top: 1px solid var(--color-rule-2); }
.change--open { border-top-color: var(--color-accent); }
.change__head { display: flex; gap: var(--space-sm); align-items: center; flex-wrap: wrap; }
.change__title { font-weight: 500; font-family: var(--font-outlier); font-size: var(--text-sm); }
.change__when { margin-left: auto; color: var(--color-muted); font-size: var(--text-xs); }
.change__links { display: flex; gap: var(--space-md); font-size: var(--text-sm); }
.pill--change-new, .pill--change-summarised { border-color: var(--color-accent); color: var(--color-accent-text); }
.pill--change-reviewed, .pill--change-rules_updated { border-color: var(--color-success); color: var(--color-success); }
.pill--watch-ok, .pill--watch-unchanged { border-color: var(--color-success); color: var(--color-success); }
.pill--watch-changed { border-color: var(--color-accent); color: var(--color-accent-text); }
.pill--watch-needs_manual_check { border-color: var(--color-accent-2); color: var(--color-accent-2); }
.pill--watch-error { border-color: var(--color-error); color: var(--color-error); }
.table--watches th[scope="row"] a { font-family: var(--font-outlier); font-weight: 400; }
.watch__what { display: block; font-size: var(--text-xs); color: var(--color-muted); font-weight: 400; max-width: 48ch; white-space: normal; }
.watch__open { font-size: var(--text-xs); margin-left: var(--space-xs); }
.watch__err { display: block; font-size: var(--text-xs); color: var(--color-error); max-width: 36ch; }
.facts--change { max-width: 60rem; margin-bottom: var(--space-xl); }
.facts--change a { overflow-wrap: anywhere; }
.change-diff { display: grid; gap: var(--space-xs); }
@media (max-width: 60rem) { .preflight__grid { grid-template-columns: minmax(0, 1fr); } .figures--rules { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 40rem) {
  .pf-item { grid-template-columns: minmax(0, 1fr); gap: var(--space-2xs); }
  .table--watches thead { display: none; }
  .table--watches tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2xs) var(--space-sm); padding: var(--space-xs) 0; border-bottom: 1px solid var(--color-rule-2); }
  .table--watches th, .table--watches td { border: 0; padding: 0; }
  .table--watches th[scope="row"] { grid-column: 1 / -1; }
  .table--watches td[data-label="Status"] { grid-column: 1 / -1; }
}

/* ---------- responsive ---------- */
@media (max-width: 75rem) {
  .streams { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stream-card--live { grid-row: auto; }
  .clip-grid--latest { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .clip-grid--latest > :nth-child(n + 10) { display: none; }
}
@media (max-width: 60rem) {
  .topbar__in { flex-wrap: wrap; gap: 0 var(--space-md); padding-top: var(--space-xs); }
  .nav { order: 3; flex-basis: 100%; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .topbar__end { margin-left: auto; }
  .overview-grid, .config, .clip-layout, .why__grid, .why__words, .settings, .settings__cols, .memory, .agent, .logs, .setup { grid-template-columns: minmax(0, 1fr); }
  .main > .config-form { grid-template-columns: minmax(0, 1fr); }
  .toml { position: static; }
  .settings__nav, .wiki-tree { position: static; }
  .settings__nav { display: flex; flex-wrap: wrap; gap: var(--space-2xs); }
  .settings__nav a { border-left: 0; border-bottom: 1px solid var(--color-rule); }
  .agent__sessions .sessions { display: flex; overflow-x: auto; gap: var(--space-xs); }
  .agent__sessions .session { min-width: 14rem; border-left: 0; border-bottom: 2px solid transparent; }
  .agent__sessions .session--current { border-bottom-color: var(--color-accent); }
  .chat { min-height: 28rem; }
  .commit { grid-template-columns: 5rem minmax(0, 1fr); }
  .commit__who, .commit__when, .commit__actions { grid-column: 2; }
}
@media (max-width: 40rem) {
  body { font-size: var(--text-md); }
  h1 { font-size: var(--text-xl); }
  .streams, .clip-grid--latest { grid-template-columns: minmax(0, 1fr); }
  .stream-card--live { grid-column: auto; }
  .stream-card--live .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .clip-grid--latest > :nth-child(n + 7) { display: none; }
  .chart__svg--wide { display: none; }
  .chart__svg--narrow { display: block; }
  .trim__row { grid-template-columns: minmax(0, 1fr); }
  .page-head--split { grid-template-columns: minmax(0, 1fr); }
  .filters .field { min-width: 0; flex: 1 1 9rem; }
  .composer__hint { display: none; }
  .usage { gap: var(--space-sm); }
  .facts > div { grid-template-columns: 7rem minmax(0, 1fr); }
  .table--jobs thead { display: none; }
  .table--jobs tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; padding: var(--space-xs) 0; border-bottom: 1px solid var(--color-rule-2); }
  .table--jobs td { border: 0; padding: var(--space-3xs) 0; }
  .table--jobs td[data-label="Target"] { grid-column: 1 / -1; }
  .table--jobs .job__actions { justify-content: flex-start; }
}
@media (hover: none) { .btn:hover { background: transparent; } .btn--primary:hover { background: var(--color-accent); } }
@media (prefers-reduced-motion: reduce) {
  *:not(.keep-motion), *:not(.keep-motion)::before, *:not(.keep-motion)::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .btn:active { transform: none; }
}
