/* CABIN components — docs/design.md §4.1–4.16.
 *
 * Every component lists its canonical selector and the legacy selectors it
 * absorbs, so JS templates keep working unchanged (restyle, never rename).
 * Loads after tokens.css and base.css; before the
 * area files. Colour only through tokens; no gradients, glows or pills except
 * the switch track and status dots.
 *
 * LOAD-ORDER DEPENDENCY (§11.1): the special buttons
 * .dub-pill, .dub-chip, .dub-score, .scene-jump, .seg,
 * .dock-tab, #rateChip and .menu-item are excluded from the bare-button base look below
 * (via :where(:not(…)), which adds no specificity) and are styled by the
 * tab/chip rules here or by their area file, which loads after this sheet.
 */

/* ════════════════════════════════════════════════════════════════════
 * §4.1 Button — one block serves bare <button> and .btn
 * emitted by: index.html/admin.html headers, js/views/*.js, js/*.js templates
 * ════════════════════════════════════════════════════════════════════ */
button:where(:not(.dub-pill, .dub-chip, .dub-score, .scene-jump, .seg, .dock-tab, #rateChip, .menu-item)),
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: var(--ctl-h);
    padding: 0 12px;
    margin: 0;
    border: 1px solid var(--rule-2);
    border-radius: var(--r-2);
    background: var(--surface-raised);
    color: var(--ink);
    font: 500 13px/1 var(--font-ui);
    letter-spacing: -.005em;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
    -webkit-appearance: none;
    appearance: none;
    transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
button:where(:not(.dub-pill, .dub-chip, .dub-score, .scene-jump, .seg, .dock-tab, #rateChip, .menu-item)):hover:not(:disabled),
.btn:hover:not(:disabled) {
    background: var(--hover);
    border-color: var(--ink-2);
    text-decoration: none;
}
button:where(:not(.dub-pill, .dub-chip, .dub-score, .scene-jump, .seg, .dock-tab, #rateChip, .menu-item)):active:not(:disabled),
.btn:active:not(:disabled) {
    background: var(--surface);
    transform: none;
}
button:disabled, .btn:disabled, button[aria-disabled="true"], .btn[aria-disabled="true"] {
    opacity: .5;
    cursor: not-allowed;
}

/* primary — one filled primary per pane/tab (D3) */
button.primary, .btn.primary, .inline-edit button.save {
    background: var(--accent-fill);
    border-color: var(--accent-fill);
    color: var(--accent-ink);
}
button.primary:hover:not(:disabled), .btn.primary:hover:not(:disabled), .inline-edit button.save:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: var(--accent-ink);
}
button.primary:active:not(:disabled), .btn.primary:active:not(:disabled), .inline-edit button.save:active:not(:disabled) {
    background: var(--accent-fill);
    border-color: var(--accent-fill);
}

/* ghost — bordered, quiet */
.btn.ghost, .btn-link {
    background: transparent;
    border-color: var(--rule-2);
    color: var(--ink-2);
}
.btn.ghost:hover:not(:disabled), .btn-link:hover:not(:disabled) {
    color: var(--ink);
    border-color: var(--ink-2);
    background: var(--hover);
}
/* icon tool buttons (transport, edit strip, timeline) are borderless until hovered — pro-tool toolbars */
.btn.ghost.icon { border-color: transparent; }
.btn.ghost.icon:hover:not(:disabled) { border-color: transparent; background: var(--hover); }
.btn-link { border-color: transparent; padding: 0 4px; }
/* a link inside a sentence (a sheet's intro, a menu's note): the text's own size, underlined */
.btn-link.btn-link--text { display: inline; height: auto; padding: 0; font: inherit; color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; vertical-align: baseline; white-space: normal; }
.btn-link.btn-link--text:hover:not(:disabled) { color: var(--ink); background: transparent; border-color: transparent; }

/* danger — outline style; the filled err exists only inside .dlg confirm buttons */
button.danger, .btn.danger {
    background: transparent;
    border-color: var(--err);
    color: var(--err);
}
button.danger:hover:not(:disabled), .btn.danger:hover:not(:disabled) {
    background: var(--err-tint);
    border-color: var(--err);
    color: var(--err);
}
button.danger:active:not(:disabled), .btn.danger:active:not(:disabled) { background: var(--err-tint); }

/* rainbow classes — intentionally identical to the default look; removed from templates in step 9 */

/* sizes */
button.sm, .btn.sm,
.timeline-controls button, .qe-nudge button, .nudge-grid button, .nav-row button,
.inline-edit .nudge-row button, .trim-actions .btn, .dub-row .btn, .dub-row-groups .btn,
.dub-job-head button, .dub-muxed .btn, .qc-suggestion .btn, .qc-jump-btn,
.side-section .btn-row button, .header-actions button, .transport button,
.dock-tabs button:not(.dock-tab) {
    height: var(--ctl-h-sm);
    padding: 0 10px;
    font-size: 12px;
}
.qc-jump-btn { font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
button.lg, .btn.lg {
    height: var(--ctl-h-lg);
    padding: 0 20px;
    font-size: 14px;
}
button.icon, .btn.icon { width: var(--ctl-h); padding: 0; }
button.sm.icon, .btn.sm.icon { width: var(--ctl-h-sm); }
button.wide, .btn.wide, button.block, .btn.block { width: 100%; }
button .ic, .btn .ic { width: 16px; height: 16px; }

/* ════════════════════════════════════════════════════════════════════
 * §4.2 Text input, textarea, select
 * emitted by: login.html, js/views/pipeline.js, js/sidebar.js, js/quick_edit.js,
 * js/dub_panel.js, js/burn.js, js/admin_*.js
 * ════════════════════════════════════════════════════════════════════ */
input:where(:not([type="checkbox"], [type="radio"], [type="range"], [type="file"])),
textarea,
select,
.dub-row .dub-ls-engine {
    height: var(--ctl-h);
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0 8px;
    border: 1px solid var(--edge-control);
    border-radius: var(--r-1);
    background: var(--surface-raised);
    color: var(--ink);
    font: 400 13px/normal var(--font-ui);
    letter-spacing: 0;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: none;
    transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
textarea {
    height: auto;
    min-height: 64px;
    padding: 6px 8px;
    line-height: 1.5;
    resize: vertical;
}
select, .dub-row .dub-ls-engine {
    padding-right: 28px;
    background: var(--surface-raised) var(--icon-chevron) no-repeat right 8px center / 16px;
    cursor: pointer;
}
select[multiple], select[size]:not([size="1"]) { height: auto; background-image: none; padding-right: 8px; }
select option { background: var(--surface-raised); color: var(--ink); }

/* mono variant — machine data (§3.3) */
input[type="number"], input.mono, textarea.mono, #shiftVal, #shiftFrom, #mergeThresh, #burn_font_val, #presetName, .key-actions input {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:where(:not([type="checkbox"], [type="radio"], [type="range"], [type="file"])):hover:not(:disabled),
textarea:hover:not(:disabled),
select:hover:not(:disabled) { border-color: var(--ink-2); }
input:user-invalid, textarea:user-invalid, select:user-invalid { border-color: var(--err); }
input:where(:not([type="checkbox"], [type="radio"], [type="range"], [type="file"])):disabled,
textarea:disabled,
select:disabled {
    opacity: .5;
    cursor: not-allowed;
    background-color: var(--surface);
}

/* dense */
input.sm, select.sm, select.dub-ls-engine, .dub-row .dub-ls-engine, .dub-row-groups select {
    height: var(--ctl-h-sm);
    font-size: 12px;
}

/* read-only display (admin one-time password) */
code.pw-reveal { user-select: all; padding: 4px 8px; font-size: 13px; color: var(--ink); }

/* ════════════════════════════════════════════════════════════════════
 * §4.3 Checkbox, radio, range, switch
 * ════════════════════════════════════════════════════════════════════ */
input[type="checkbox"], input[type="radio"] {
    accent-color: var(--accent-fill);
    width: 16px;
    height: 16px;
    margin: 0;
    flex: none;
    cursor: pointer;
}
/* label rows — the hit area is the row, not the 16 px box */
label.radio, label.inline, label.inline-toggle, label.form-row--inline, label.dub-ls-gate {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: var(--ctl-h-sm);
    font: 400 13px var(--font-ui);
    color: var(--ink);
    cursor: pointer;
}
.chip input, .inline-toggle input, .form-row--inline input, .dub-ls-gate input { width: auto; }

/* range — #burn_font, .trim-thumb, #scrub */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 24px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}
input[type="range"].trim-thumb { height: 36px; }   /* the trim slider keeps its 36 px strip */
input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: var(--rule-2); border: 0; border-radius: 0; }
input[type="range"]::-moz-range-track { height: 2px; background: var(--rule-2); border: 0; border-radius: 0; }
/* the two trim thumbs share the .trim-track/.trim-fill drawn by the area */
input[type="range"].trim-thumb::-webkit-slider-runnable-track { background: transparent; }
input[type="range"].trim-thumb::-moz-range-track { background: transparent; }
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    margin-top: -5px;               /* centre a 12 px thumb on the 2 px track */
    border-radius: var(--r-1);
    background: var(--accent);
    border: 1px solid var(--surface-raised);
    box-shadow: none;
    cursor: grab;
}
input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: var(--r-1);
    background: var(--accent);
    border: 1px solid var(--surface-raised);
    box-shadow: none;
    cursor: grab;
}
input[type="range"]:active::-webkit-slider-thumb { cursor: grabbing; }
input[type="range"]:active::-moz-range-thumb { cursor: grabbing; }
input[type="range"]:focus-visible { outline: 0; }   /* the ring moves to the thumb */
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px var(--focus-halo); }
input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 2px var(--focus-halo); }

/* switch — the one permitted pill (28 × 16 track, 12 px knob) */
.inline-toggle > input[type="checkbox"], input#autoRefresh {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    width: 28px;
    height: 16px;
    margin: 0;
    border: 1px solid var(--rule-2);
    border-radius: var(--r-pill);
    background: var(--surface-raised);
    cursor: pointer;
    flex: none;
    vertical-align: middle;
    transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.inline-toggle > input[type="checkbox"]::before, input#autoRefresh::before {
    content: "";
    position: absolute;
    top: 1px;
    left: 1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--ink-2);
    transition: transform var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.inline-toggle > input[type="checkbox"]:checked, input#autoRefresh:checked {
    background: var(--accent-fill);
    border-color: var(--accent-fill);
}
.inline-toggle > input[type="checkbox"]:checked::before, input#autoRefresh:checked::before {
    transform: translateX(12px);
    background: var(--accent-ink);
}

/* ════════════════════════════════════════════════════════════════════
 * §4.4 Tabs — underline, never pills
 * canonical .tabs > button[role=tab]; absorbs .dock-tab (review.js), .seg-control > .seg
 * (admin_presets.js), #adminTabs button (admin.html)
 * ════════════════════════════════════════════════════════════════════ */
.tabs, [role="tablist"], .seg-control, #adminTabs, .dock-tabs {
    display: flex;
    gap: 0;
    height: 32px;
    align-items: stretch;
    padding: 0;
    border: 0;
    border-bottom: 1px solid var(--rule);
    border-radius: 0;
    background: transparent;
    overflow: visible;
}
.tabs > button, .tabs > [role="tab"], [role="tablist"] > [role="tab"], .dock-tab, .seg-control > .seg, #adminTabs > button, .tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 10px;
    margin: 0 0 -1px;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: none;
    color: var(--ink-2);
    font: 500 13px/1 var(--font-ui);
    letter-spacing: -.005em;
    white-space: nowrap;
    cursor: pointer;
    transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.seg-control > .seg:not(:first-child) { border-left: 0; }
/* Segmented control — .seg-group > button.seg[role=radio][aria-checked]: a boxed
   one-of-n choice (pipeline.js model preset). The checked segment is raised,
   not accent-filled: the accent is for the current *selection mark* only. */
.seg-group {
    display: inline-flex;
    height: var(--ctl-h);
    padding: 2px;
    gap: 2px;
    border: 1px solid var(--rule-2);
    border-radius: var(--r-2);
    background: var(--paper);
}
.seg-group > .seg {
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 3px;
    background: transparent;
    color: var(--ink-2);
    font: 500 13px/1 var(--font-ui);
    white-space: nowrap;
    cursor: pointer;
    transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.seg-group > .seg:hover:not(:disabled) { color: var(--ink); }
.seg-group > .seg[aria-checked="true"] {
    background: var(--surface-raised);
    border-color: var(--rule-2);
    color: var(--ink);
}
.seg-group > .seg:focus-visible { outline: 2px solid var(--focus-halo); outline-offset: 0; }
.tabs > button:hover:not(:disabled), .tabs > [role="tab"]:hover:not(:disabled), [role="tablist"] > [role="tab"]:hover:not(:disabled),
.dock-tab:hover:not(:disabled), .seg-control > .seg:hover:not(:disabled), #adminTabs > button:hover:not(:disabled), .tab:hover:not(:disabled) {
    color: var(--ink);
    background: none;
    border-color: transparent;
}
.tabs > .active, .tabs > [aria-selected="true"], .tabs > [aria-pressed="true"],
[role="tablist"] > [aria-selected="true"], [role="tablist"] > [aria-pressed="true"],
.dock-tab.active, .dock-tab[aria-selected="true"], .dock-tab[aria-pressed="true"],
.seg-control > .seg.active, .seg-control > .seg[aria-pressed="true"],
#adminTabs > button.active, #adminTabs > button[aria-selected="true"], .tab.active {
    color: var(--ink);
    background: none;
    border-bottom-color: var(--accent);
    font-weight: 500;
}
.tabs > button:disabled, .dock-tab:disabled, .seg-control > .seg:disabled, #adminTabs > button:disabled, .tab:disabled {
    color: var(--faint);
    cursor: default;
    opacity: 1;
}
.tabs .count, .dock-tab .count, #adminTabs .count {
    font: 500 12px var(--font-ui);
    color: var(--muted);
    margin-left: 6px;
}
.dock-tab[data-count]::after {
    content: attr(data-count);
    font: 500 12px var(--font-ui);
    color: var(--muted);
    margin-left: 6px;
}

/* ════════════════════════════════════════════════════════════════════
 * §4.5 Table rows
 * canonical .table > .row; absorbs .sub-list > .row(.header) (subtitle_list.js),
 * .activity-row/.visitor-row/.proc-row/.error-row (admin.js), .project-row (projects.js),
 * Row-with-body items are in §4.6.
 * ════════════════════════════════════════════════════════════════════ */
.table .row, .sub-list .row {
    display: grid;
    align-items: center;
    gap: 8px;
    min-height: var(--row-h);
    padding: 0 8px;
    border-bottom: 1px solid var(--rule);
    font: 400 13px/1.4 var(--font-ui);
    color: var(--ink);
    background: transparent;
}
.activity-row, .visitor-row, .proc-row, .error-row, .project-row {
    align-items: center;
    min-height: var(--row-h);
    border-bottom: 1px solid var(--rule);
    font: 400 13px/1.4 var(--font-ui);
    color: var(--ink);
    background: transparent;
}
/* header row — sticky, 12 px label */
.row.header, .sub-list .row.header, .proc-row.header, .table__head {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    background: var(--surface);
    font: 500 12px/1.4 var(--font-ui);
    color: var(--muted);
    border-bottom: 1px solid var(--rule-2);
    cursor: default;
}
/* hover — rows without a click affordance opt out with .static */
.table .row:hover, .sub-list .row:hover, .activity-row:hover, .visitor-row:hover, .proc-row:hover, .error-row:hover, .project-row:hover {
    background: var(--hover);
}
.row.static:hover, .row.header:hover, .sub-list .row.header:hover, .proc-row.header:hover, .proc-row.static:hover,
.activity-row.static:hover, .visitor-row.static:hover, .error-row.static:hover { background: transparent; }
.row.header:hover, .sub-list .row.header:hover, .proc-row.header:hover { background: var(--surface); }
/* selected — 2 px accent left bar without extra markup */
.row.selected, .sub-list .row.selected, .scene-item.active, .nav-item.active {
    background: var(--sel);
    box-shadow: inset 2px 0 0 var(--accent);
}
.row[tabindex]:focus-visible { outline-offset: -2px; }
/* numeric / time cells (the list's fourth cell is the duration or the speaker; with neither column it is the text) */
.row .num, .row .tc, .row .idx, .health-latency, .row .count, .row .time, .row .ip, .scene-ts,
.activity-row .time, .activity-row .ip, .visitor-row .ip, .visitor-row .count, .error-row .time,
.sub-list .row > :nth-child(2), .sub-list .row > :nth-child(3), .sub-list .row > :nth-child(4):where(:not(.text)) {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    text-align: right;
    color: var(--ink-2);
}
/* counts and indexes are numbers, not machine data: UI face, tabular figures */
.row .num, .row .idx, .row .count, .visitor-row .count { font-family: var(--font-ui); }
.row .idx, .sub-list .idx, .row .time, .activity-row .time, .error-row .time { color: var(--muted); }
.sub-list .row.header > * { text-align: left; color: var(--muted); font-family: var(--font-ui); }
/* truncating cells */
:is(.table .row, .sub-list .row, .activity-row, .visitor-row, .error-row, .project-row, .preset-row) :is(.text, .path, .ua, .status, .p-title, .preset-models) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* ════════════════════════════════════════════════════════════════════
 * §4.6 Pane, pane header, intro, bordered surfaces, row-with-body, well
 * ════════════════════════════════════════════════════════════════════ */
.pane { background: var(--surface); border: 0; border-radius: 0; }
/* pane header — absorbs .qe-title (quick_edit.js), .qc-col h3 (qc_panel.js),
 * .scenes-col h3 (scenes_panel.js), .dub-col h3 (dub_panel.js), .lipsync-col h3 (lipsync_panel.js), .burn-col h3 (burn.js),
 * .side-section h3 (sidebar.js) */
.pane-head, .qe-title, .qc-col h3, .scenes-col h3, .dub-col h3, .lipsync-col h3, .burn-col h3, .side-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    margin: 0 0 12px;
    padding: 0 12px;
    border-bottom: 1px solid var(--rule);
    font: 500 12px/1.4 var(--font-ui);
    color: var(--muted);
}
.pane-head .meta, .qe-title .qe-count, .scenes-col h3 .muted, .qc-col h3 .muted, .dub-col h3 .muted, .lipsync-col h3 .muted, .burn-col h3 .muted {
    margin-left: auto;
    font: 400 12px var(--font-ui);
    text-transform: none;
    letter-spacing: 0;
    color: var(--ink-2);
}
.pane-body { padding: 12px; }
/* pane intro — one sentence */
.pane-intro, .qc-intro, .scenes-intro, .dub-intro, .burn-intro {
    font: 400 12px/1.5 var(--font-ui);
    color: var(--ink-2);
    max-width: 64ch;
    margin: 0 0 8px;
}
/* bordered surfaces — the only ones */
.login-card {
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--r-2);
    box-shadow: none;
}
.panel {
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--r-2);
    padding: 12px;
}
/* row-with-body — .qc-item (qc_panel.js), .scene-item (scenes_panel.js), .dub-row/.dub-job
 * (dub_panel.js), .preset-row (admin_presets.js), .key-row (admin_keys.js), .health-row (admin.js) */
.qc-item, .scene-item, .dub-row, .dub-job, .preset-row, .key-row, .health-row {
    padding: 8px 12px;
    border-top: 1px solid var(--rule);
    border-bottom: 0;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font-size: 13px;
    color: var(--ink);
}
.qc-item:first-child, .scene-item:first-child, .dub-row:first-child, .dub-job:first-child, .preset-row:first-child, .key-row:first-child, .health-row:first-child { border-top: 0; }
.qc-item--high, .qc-item--error { box-shadow: inset 2px 0 0 var(--err); }
.qc-item--medium { box-shadow: inset 2px 0 0 var(--warn); }
.qc-item--low, .qc-item--none { box-shadow: none; }
.scene-item.active { background: var(--sel); box-shadow: inset 2px 0 0 var(--accent); }
.qc-head, .dub-row-head, .scene-jump, .dub-job-head {
    display: flex;
    gap: 10px;
    align-items: center;
    min-height: 24px;
}
/* well — .log-tail (pipeline.js), .diff-box (sidebar.js), .dub-report (dub_panel.js),
 * .qc-suggestion (qc_panel.js), pre */
.well, .log-tail, .diff-box, .dub-report, .qc-suggestion, pre {
    background: var(--tl-bg);
    color: var(--tl-fg);
    border: 1px solid var(--rule);
    border-radius: var(--r-1);
    padding: 8px 10px;
    margin: 0;
    font: 400 12px/1.5 var(--font-mono);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.qc-suggestion, .dub-report { font-family: var(--font-ui); color: var(--ink); white-space: normal; }
pre code { background: none; border: 0; padding: 0; font-size: inherit; }
/* empty panes hide */
.qc-col:empty, .burn-col:empty, .scenes-col:empty, .dub-col:empty { display: none; }

/* ════════════════════════════════════════════════════════════════════
 * §4.7 Tag (read-only) and chip (selectable)
 * ════════════════════════════════════════════════════════════════════ */
/* tag — absorbs .p-badge (projects.js), .preset-chip (admin_presets.js), .qc-pill/.qc-sev/.qc-lbl
 * (qc_panel.js, dub_panel.js), .dub-stale/.dub-issue-type (dub_panel.js), .activity-row .status
 * (admin.js), .scene-flag (timeline.js), .key-status (admin_keys.js), .dub-chip > b */
.tag, .p-badge, .preset-chip, .qc-pill, .qc-sev, .qc-lbl, .dub-stale, .dub-issue-type, .activity-row .status, .scene-flag, .key-status, .dub-chip > b {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 20px;
    padding: 0 6px;
    border: 1px solid var(--rule-2);
    border-radius: var(--r-1);
    background: transparent;
    color: var(--ink-2);
    font: 500 12px/1 var(--font-ui);
    font-style: normal;
    white-space: nowrap;
    vertical-align: middle;
    margin: 0;
}
.dub-chip > b { margin-left: 6px; }
/* semantic variants — text + border colour and a leading 6 px dot, never a fill */
.tag.err, .tag.warn, .tag.ok,
.qc-pill--high, .qc-pill--err, .qc-pill--medium, .qc-pill--ok,
.qc-item--high .qc-sev, .qc-item--error .qc-sev, .qc-item--medium .qc-sev,
.dub-stale, .dub-issue-type--mistranslation, .dub-issue-type--untranslated, .dub-issue-type--omission, .dub-issue-type--addition,
.activity-row .status.s2, .activity-row .status.s4, .activity-row .status.s5,
.key-status.is-set, .dub-chip--dub > b, .dub-chip--mute > b {
    padding-left: 5px;
}
.tag.err::before, .tag.warn::before, .tag.ok::before,
.qc-pill--high::before, .qc-pill--err::before, .qc-pill--medium::before, .qc-pill--ok::before,
.qc-item--high .qc-sev::before, .qc-item--error .qc-sev::before, .qc-item--medium .qc-sev::before,
.dub-stale::before, .dub-issue-type--mistranslation::before, .dub-issue-type--untranslated::before, .dub-issue-type--omission::before, .dub-issue-type--addition::before,
.activity-row .status.s2::before, .activity-row .status.s4::before, .activity-row .status.s5::before,
.key-status.is-set::before, .dub-chip--dub > b::before, .dub-chip--mute > b::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
}
.tag.err, .qc-pill--high, .qc-pill--err, .qc-item--high .qc-sev, .qc-item--error .qc-sev,
.dub-issue-type--mistranslation, .dub-issue-type--untranslated, .activity-row .status.s5, .dub-chip--mute > b {
    color: var(--err);
    border-color: var(--err);
}
.tag.warn, .qc-pill--medium, .qc-item--medium .qc-sev, .dub-stale,
.dub-issue-type--omission, .dub-issue-type--addition, .activity-row .status.s4 {
    color: var(--warn);
    border-color: var(--warn);
}
.tag.ok, .qc-pill--ok, .activity-row .status.s2, .key-status.is-set, .dub-chip--dub > b {
    color: var(--ok);
    border-color: var(--ok);
}
/* neutral: low/info/s3/keep/other/pipeline/standalone/is-api — the base look */
.qc-pill--low, .qc-item--low .qc-sev, .qc-item--none .qc-sev, .activity-row .status.s3, .dub-chip--keep > b,
.dub-issue-type--other, .p-badge.pipeline, .p-badge.standalone, .preset-chip.is-api {
    color: var(--ink-2);
    border-color: var(--rule-2);
}

/* chip — absorbs label.chip (pipeline.js target languages), .dub-chip/.dub-score/.dub-pill (dub_panel.js).
 * Not a pill. */
.chip, .dub-chip, .dub-score, .dub-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: var(--ctl-h-sm);
    padding: 0 10px;
    border: 1px solid var(--rule-2);
    border-radius: var(--r-1);
    background: var(--surface-raised);
    color: var(--ink);
    font: 400 12px/1 var(--font-ui);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.dub-chip, .dub-score { font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
.chip:hover, .dub-chip:hover:not(:disabled), .dub-score:hover:not(:disabled), .dub-pill:hover:not(:disabled) { border-color: var(--ink-2); background: var(--surface-raised); }
.chip.active, .chip[aria-pressed="true"], .dub-pill.active, .dub-pill[aria-pressed="true"], .dub-chip.active, .dub-score.active {
    background: var(--sel);
    border-color: var(--accent);
    color: var(--ink);
    font-weight: 500;
}
.chip:has(input:checked) { background: var(--sel); border-color: var(--accent); color: var(--ink); font-weight: 500; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.chip input:checked + span { color: var(--ink); font-weight: 500; }
.chip:focus-within { outline: 2px solid var(--focus-halo); outline-offset: -2px; border-color: var(--focus); }
.chip[aria-disabled="true"], .chip:has(input:disabled), .dub-chip:disabled, .dub-score:disabled, .dub-pill:disabled { opacity: .5; cursor: not-allowed; }
/* verdict on the dot only */
.dub-score::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); flex: none; }
.dub-score--excellent, .dub-score--good, .dub-score--fair, .dub-score--poor { color: var(--ink); }
.dub-score--excellent::before, .dub-score--good::before { background: var(--ok); }
.dub-score--fair::before { background: var(--warn); }
.dub-score--poor::before { background: var(--err); }

/* ════════════════════════════════════════════════════════════════════
 * §4.8 Status dot — absorbs .health-dot (admin.js), .details-badge (pipeline.js)
 * ════════════════════════════════════════════════════════════════════ */
.status-dot, .health-dot, .details-badge {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--faint);
    vertical-align: middle;
    flex: none;
    box-shadow: none;
    margin: 0;
}
.health-dot { margin-right: 6px; }
.status-dot.ok, .health-dot.ok { background: var(--ok); }
.status-dot.warn, .health-dot.warn { background: var(--warn); }
.status-dot.err, .health-dot.err, .health-dot.bad { background: var(--err); }
.status-dot.accent { background: var(--accent); }
.details-badge { width: 6px; height: 6px; background: var(--accent); }

/* ════════════════════════════════════════════════════════════════════
 * §4.9 Status line — the box is written on the ids (several get className=
 * 'ok'|'err'|'muted' wholesale); colour comes from the bare utilities in base.css.
 * Do not add any other class to these nodes.
 * ════════════════════════════════════════════════════════════════════ */
#qcStatus, .dub-status, #burn_status, #pipelineMsg, #progressMsg, #uploadMsg, #frCount, #lastUpdate,
#resetResult, #presetMsg, #keyMsg, #userMsg, #saveBadge, #wsStatus, #errMsg {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 20px;
    margin: 0;
    font: 400 12px/1.4 var(--font-ui);
    font-variant-numeric: tabular-nums;
}
:where(#qcStatus, .dub-status, #burn_status, #pipelineMsg, #progressMsg, #uploadMsg, #frCount, #lastUpdate,
#resetResult, #presetMsg, #keyMsg, #userMsg, #saveBadge, #wsStatus, #errMsg) { color: var(--muted); }
:where(#qcStatus, .dub-status, #burn_status, #pipelineMsg, #progressMsg, #uploadMsg, #frCount, #lastUpdate,
#resetResult, #presetMsg, #keyMsg, #userMsg, #saveBadge, #wsStatus, #errMsg):is(.ok, .warn, .err):not(:empty)::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
}
/* "Loading…" placeholders render as a status line — no spinners */
p.loading, .loading, .qc-empty, .empty-msg {
    min-height: 20px;
    font: 400 12px/1.4 var(--font-ui);
    color: var(--muted);
}
.empty-msg.ok { color: var(--ok); }

/* ════════════════════════════════════════════════════════════════════
 * §4.10 Progress — pipeline.js progress panel, dub_panel.js .dub-job
 * ════════════════════════════════════════════════════════════════════ */
.progress {
    height: 2px;
    background: var(--rule-2);
    border-radius: 0;
    overflow: hidden;
}
.dub-job .progress { height: 2px; }
.progress__fill {
    height: 100%;
    background: var(--accent);
    transition: none;
}
.progress-row {
    display: flex;
    gap: 12px;
    align-items: baseline;
    font: 400 12px/1.4 var(--font-ui);
    color: var(--ink-2);
}
/* an upload in parts (upload.js uploadVideo): the bar over "sent of total · time left",
   in a form's message line (some are flex rows, so it takes the row's width itself) */
.upload-progress { flex: 1 1 100%; min-width: 0; display: grid; gap: 6px; }
.upload-progress .progress { height: 4px; }
.progress-percent, #progressPercent { font: 400 20px/1.2 var(--font-ui); font-variant-numeric: tabular-nums; color: var(--ink); }
#progressStage { color: var(--muted); }

/* ════════════════════════════════════════════════════════════════════
 * §4.11 Disclosure — details.form-section--details (pipeline.js) and the progress "Log" details
 * ════════════════════════════════════════════════════════════════════ */
details.form-section--details, .progress-panel details, details.log-disclosure { padding: 0; overflow: hidden; }
details.form-section--details[open] { padding: 0; }
details.form-section--details > summary, .progress-panel details > summary, details.log-disclosure > summary {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 40px;
    margin: 0;
    padding: 0 12px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    font: 500 13px/1 var(--font-ui);
    color: var(--ink);
    background: transparent;
    border-bottom: 1px solid transparent;
    transition: background-color var(--dur) var(--ease);
}
details.form-section--details > summary::-webkit-details-marker, .progress-panel details > summary::-webkit-details-marker, details.log-disclosure > summary::-webkit-details-marker { display: none; }
details.form-section--details > summary::marker, .progress-panel details > summary::marker, details.log-disclosure > summary::marker { content: ""; }
details.form-section--details > summary::after, .progress-panel details > summary::after, details.log-disclosure > summary::after { content: none; }
/* chevron — the select chevron token, turned to point right until [open] */
details.form-section--details > summary::before, .progress-panel details > summary::before, details.log-disclosure > summary::before {
    content: "";
    width: 16px;
    height: 16px;
    flex: none;
    background: var(--icon-chevron) center / 16px no-repeat;
    transform: rotate(-90deg);
    transition: transform var(--dur) var(--ease);
}
details.form-section--details[open] > summary::before, .progress-panel details[open] > summary::before, details.log-disclosure[open] > summary::before { transform: none; }
details.form-section--details > summary:hover, .progress-panel details > summary:hover, details.log-disclosure > summary:hover { background: var(--hover); }
details.form-section--details[open] > summary, .progress-panel details[open] > summary, details.log-disclosure[open] > summary {
    border-bottom-color: var(--rule);
    margin: 0;
    background: transparent;
}
details.form-section--details .details-title { flex: none; font: 500 13px/1 var(--font-ui); color: var(--ink); }
details.form-section--details .details-summary {
    margin-left: auto;
    margin-right: 0;
    min-width: 0;
    max-width: none;
    font: 400 12px/1.4 var(--font-ui);
    font-weight: 400;
    color: var(--muted);
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
details.form-section--details[open] .details-summary { display: none; }
/* content inset once */
details.form-section--details[open] > :not(summary) { padding-left: 12px; padding-right: 12px; }
details.form-section--details[open] > summary + * { padding-top: 12px; }
details.form-section--details[open] > :not(summary):last-child { padding-bottom: 16px; }
details.form-section--details.is-disabled { opacity: 1; }
details.form-section--details.is-disabled > summary { cursor: default; }
details.form-section--details.is-disabled .details-title { color: var(--faint); }
details.form-section--details.is-disabled .details-summary::before {
    content: "LOCKED · ";
    color: var(--muted);
    font-family: var(--font-ui);
    margin: 0;
}

/* ════════════════════════════════════════════════════════════════════
 * §4.12 Form ledger — label.form-row (pipeline.js, admin_presets.js); stacked variant for the
 * narrow columns: .qc-controls (qc_panel.js), .dub-controls (dub_panel.js), .burn-col label.field
 * (burn.js), .quick-col .field (quick_edit.js), .login-card label (login.html), .side-section label (sidebar.js)
 * ════════════════════════════════════════════════════════════════════ */
.ledger, .form-row {
    display: grid;
    grid-template-columns: var(--ledger-w) minmax(0, 1fr);
    column-gap: 16px;
    row-gap: 4px;
    align-items: center;
    min-height: var(--ctl-h);
    margin: 0 0 12px;
}
.ledger > .form-label, .form-row > .form-label, .ledger > span:first-child, .form-row > span:first-child {
    grid-column: 1;
    font: 400 13px/1.4 var(--font-ui);
    color: var(--ink-2);
    text-transform: none;
    letter-spacing: 0;
}
.ledger > :not(.form-label):not(.form-help), .form-row > :not(.form-label):not(.form-help) { grid-column: 2; }
.form-help, .ledger > .form-help, .form-row > .form-help {
    grid-column: 2;
    font: 400 12px/1.45 var(--font-ui);
    color: var(--muted);
}
/* inline row inside a ledger form: the checkbox aligns with the control column */
.form-section .form-row--inline, .form-section label.inline, .form-section label.radio,
.ledger--form .form-row--inline, .ledger--form label.inline, .ledger--form label.radio {
    padding-left: calc(var(--ledger-w) + 16px);
}
.form-row--inline > .form-label { font: 400 13px/1.4 var(--font-ui); color: var(--ink); }
.form-row--inline > .form-help { flex-basis: 100%; }
/* two-up (D14) */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 32px;
    --ledger-w: 140px;
}
.preset-grid { --ledger-w: 160px; }
@media (max-width: 720px) { .form-grid-2 { grid-template-columns: 1fr; } }
/* stacked — label above control */
.ledger--stack, .ledger--stack .form-row, .login-card label, .side-section label, .quick-col .field, .burn-col label.field, .qc-controls > label, .dub-controls > label {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    row-gap: 4px;
    min-height: 0;
    margin: 0 0 12px;
}
.qc-controls > label, .dub-controls > label { margin: 0; }
.ledger--stack > span:first-child, .ledger--stack .form-row > .form-label, .login-card label > span, .side-section label > span,
.quick-col .field > span, .burn-col label.field > span, .qc-controls > label > span, .dub-controls > label > span {
    display: block;
    grid-column: 1;
    font: 400 12px/1.4 var(--font-ui);
    color: var(--ink-2);
    margin: 0;
}
.ledger--stack > *, .ledger--stack .form-row > *, .login-card label > *, .side-section label > *, .quick-col .field > *, .burn-col label.field > *,
.qc-controls > label > *, .dub-controls > label > * { grid-column: 1; }
.ledger--stack .form-row--inline, .ledger--stack label.inline, .ledger--stack label.radio { padding-left: 0; }
/* narrow */
@media (max-width: 640px) {
    .ledger, .form-row { grid-template-columns: minmax(0, 1fr); }
    /* the base rule's :not() pair outranks a bare `> *`: name it here too, or the
       controls stay in a second column that is not there (2026-11-05) */
    .ledger > *, .form-row > *, .ledger > .form-help, .form-row > .form-help,
    .ledger > :not(.form-label):not(.form-help), .form-row > :not(.form-label):not(.form-help) { grid-column: 1; }
    .form-section .form-row--inline, .form-section label.inline, .form-section label.radio,
    .ledger--form .form-row--inline, .ledger--form label.inline, .ledger--form label.radio { padding-left: 0; }
}

/* ════════════════════════════════════════════════════════════════════
 * §4.13 Dialog — js/components/dialog.js (step 10); toast for sidebar.js
 * ════════════════════════════════════════════════════════════════════ */
dialog.dlg {
    width: min(440px, calc(100vw - 32px));
    padding: 0;
    margin: auto;
    border: 1px solid var(--rule-2);
    border-radius: var(--r-2);
    background: var(--surface-raised);
    color: var(--ink);
    box-shadow: var(--shadow-pop);
    font: 400 14px/1.55 var(--font-ui);
}
dialog.dlg::backdrop { background: var(--scrim); }
.dlg__head {
    padding: 16px;
    border-bottom: 1px solid var(--rule);
    font: 500 20px/1.3 var(--font-ui);
    letter-spacing: -.01em;
    color: var(--ink);
}
.dlg__body { padding: 16px; font-size: 14px; color: var(--ink); }
.dlg__body p { margin: 0 0 12px; }
.dlg__body p:last-child { margin-bottom: 0; }
.dlg__body input { margin-top: 8px; }
.dlg__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid var(--rule);
}
.dlg .btn.danger, .dlg button.danger {
    background: var(--err);
    border-color: var(--err);
    color: var(--accent-ink);
}
.dlg .btn.danger:hover:not(:disabled), .dlg button.danger:hover:not(:disabled) { background: var(--err); border-color: var(--err); color: var(--accent-ink); opacity: .9; }
/* ════════════════════════════════════════════════════════════════════
 * Sheet (§0.1 phase 3) — js/components/sheet.js: dialog.dlg.sheet(.sheet--wide, .sheet--table)
 * > .dlg__head.sheet__head (> .sheet__title + .sheet__close) + .sheet__body.
 * Find and replace, batch edits, speakers, changes, shortcuts, export.
 * ════════════════════════════════════════════════════════════════════ */
dialog.dlg.sheet { width: min(540px, calc(100vw - 32px)); max-height: calc(100vh - 64px); }
dialog.dlg.sheet[open] { display: flex; flex-direction: column; }
dialog.dlg.sheet--wide { width: min(780px, calc(100vw - 32px)); }
dialog.dlg.sheet--table { width: min(1180px, calc(100vw - 32px)); }   /* a table with a column per language (the KNP sheet) */
.sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 10px 10px 16px;
    font: 600 15px/1.3 var(--font-ui);
    letter-spacing: 0;
}
.sheet__body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
    padding: 16px;
    overflow-y: auto;
}
.sheet__body > p { margin: 0; }
.sheet__body h3 { margin: 0 0 6px; font: 600 13px/1.4 var(--font-ui); color: var(--ink); }
.sheet__body .field { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.sheet__body .field > span { font: 500 12px/1.4 var(--font-ui); color: var(--ink-2); }
.sheet__body .cluster .field { flex: 1 1 140px; }
.sheet__body .cluster > .btn { align-self: flex-end; }
.sheet__body .spacer { flex: 1; }
/* §4.13b The sync sheets (js/sync_dialogs.js): a change made here and by
 * someone else, one row each with the two versions; edits to place by hand. */
.sync-intro { color: var(--ink-2); font: 400 13px/1.5 var(--font-ui); }
.sync-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.sync-row { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--r-2); }
.sync-row__label { font: 600 12px/1.4 var(--font-ui); color: var(--ink-2); }
.sync-row__was { font: 400 12px/1.4 var(--font-ui); color: var(--ink-2); overflow-wrap: anywhere; }
.sync-pick { display: grid; grid-template-columns: auto 52px minmax(0, 1fr); gap: 8px; align-items: baseline; margin: 0; cursor: pointer; }
.sync-pick__who { font: 500 12px/1.4 var(--font-ui); color: var(--ink-2); }
.sync-pick__text { font: 400 13px/1.5 var(--font-ui); color: var(--ink); overflow-wrap: anywhere; white-space: pre-wrap; }
.sync-actions { align-items: center; }
.sheet__body section + section { padding-top: 14px; border-top: 1px solid var(--rule); }
.sheet__body .burn-col { padding: 0; background: transparent; container-type: inline-size; }
/* project details sheet — emitted by js/project_details.js openProjectDetails():
   form.wf-form > .wf-grid (fields, .wf-pair) + .field (notes) + section.wf-tracks
   (> .wf-track-grid > .wf-track-row ×n) + .cluster.wf-actions */
.wf-form { display: flex; flex-direction: column; gap: 14px; }
.wf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.wf-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wf-tracks h3 { margin: 0 0 8px; }
.wf-track-grid { display: flex; flex-direction: column; border: 1px solid var(--rule); border-radius: var(--r-2); }
.wf-track-row {
    display: grid;
    grid-template-columns: minmax(120px, 1.2fr) 1fr 1.2fr 150px;
    gap: 8px;
    align-items: center;
    padding: 6px 10px;
    border-bottom: 1px solid var(--rule);
}
.wf-track-row:last-child { border-bottom: 0; }
/* a language's sign-off, the second approval and the send-back reason: full-width lines under its row */
.wf-track-row > .wf-signoff { grid-column: 1 / -1; font: 400 12px/1.45 var(--font-ui); }
.wf-track-row > .wf-note input { width: 100%; }
.wf-track-row.header { font: 500 12px/1.4 var(--font-ui); color: var(--muted); }
.wf-lang { font: 400 13px/1.4 var(--font-ui); color: var(--ink); }
.wf-actions { align-items: center; }
.wf-status.err { color: var(--err); }
.tag.is-mine { border-color: var(--accent); }     /* a language assigned to the signed-in user */
@media (max-width: 640px) {
    .wf-grid, .wf-track-row { grid-template-columns: 1fr; }
    .wf-track-row.header { display: none; }
}
/* people sheet (project membership) — js/project_details.js openShareSheet():
   .share-sheet > p + .share-grid (> .share-row ×n: .share-who, role, .share-langs
   chips, .share-acts) + form.share-add + dl.share-help + .cluster.wf-actions.
   The header's role badge (.role-badge, views/review.js) is a .tag. */
.share-sheet { display: flex; flex-direction: column; gap: 14px; }
.share-grid { display: flex; flex-direction: column; border: 1px solid var(--rule); border-radius: var(--r-2); }
.share-row {
    display: grid;
    grid-template-columns: minmax(140px, 1.1fr) 130px minmax(0, 2fr) 32px;
    gap: 8px;
    align-items: center;
    padding: 6px 10px;
    border-bottom: 1px solid var(--rule);
}
.share-row:last-child { border-bottom: 0; }
.share-row.header { font: 500 12px/1.4 var(--font-ui); color: var(--muted); }
.share-row--empty { grid-template-columns: 1fr; }
.share-who { display: flex; flex-direction: column; min-width: 0; font: 400 13px/1.4 var(--font-ui); color: var(--ink); }
.share-who > b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-who > .muted { font-size: 12px; }
.share-langs { display: flex; flex-wrap: wrap; gap: 4px; }
.share-acts { display: flex; justify-content: flex-end; }
.share-add { align-items: flex-end; }
.share-add .field { flex: 0 1 220px; }
.share-help { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 16px; margin: 0; font: 400 12px/1.4 var(--font-ui); color: var(--muted); }
.share-help dt { display: inline; color: var(--ink-2); font-weight: 500; }
.share-help dt::after { content: ": "; }
.share-help dd { display: inline; margin: 0; }
.share-tag { text-transform: none; letter-spacing: 0; }
/* review links (app/review_links.py): section.share-links > h4 + p.muted + .share-link-list
   (> .share-link-row[.is-ended] ×n: .share-who, when, used, .share-acts) + form.share-link-add
   + .share-link-new (the link, once: input + Copy) */
.share-links { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--rule); }
.share-links h4 { margin: 0; font: 600 13px/1.4 var(--font-ui); color: var(--ink); }
.share-links > p { margin: 0; }
.share-link-list { display: flex; flex-direction: column; border: 1px solid var(--rule); border-radius: var(--r-2); }
.share-link-row {
    display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1.2fr) auto; gap: 12px;
    align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--rule);
    font: 400 13px/1.4 var(--font-ui); color: var(--ink-2);
}
.share-link-row:last-child { border-bottom: 0; }
.share-link-row.is-ended { color: var(--muted); }
.share-link-row.is-ended .share-who { color: var(--muted); }
.share-link-add { align-items: flex-end; }
.share-link-add .field { flex: 0 1 220px; }
.share-link-new {
    display: flex; flex-direction: column; gap: 8px; padding: 12px;
    border: 1px solid var(--accent); border-radius: var(--r-2); background: var(--surface-raised);
    font: 400 13px/1.4 var(--font-ui); color: var(--ink);
}
.share-link-new .cluster { flex-wrap: nowrap; }
.share-link-new input { flex: 1 1 auto; min-width: 0; font-family: var(--font-mono); font-size: 12px; }
@media (max-width: 640px) {
    .share-link-row { grid-template-columns: 1fr auto; }
    .share-link-row > :nth-child(2), .share-link-row > :nth-child(3) { grid-column: 1 / -1; }
}
.role-badge { flex: none; text-transform: none; letter-spacing: 0; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) {
    .share-row { grid-template-columns: 1fr 1fr; }
    .share-row.header { display: none; }
    .share-row > :nth-child(3) { grid-column: 1 / -1; }
}
.sheet__body .burn-col > h3 { display: none; }   /* the sheet's own section heading names it */

/* ════════════════════════════════════════════════════════════════════
 * Search by meaning — js/search.js (the review page's sheet), js/views/projects.js
 * (the Projects page's box; its layout is in shell.css), rows by js/search_hits.js
 * hitHtml(): .search-hits > .search-hit (a button on the review page, a link on
 * Projects) > .search-hit__time + .search-hit__body (__text, __src) + .tag.
 * ════════════════════════════════════════════════════════════════════ */
.search-form { display: flex; margin: 0; }
.search-status { min-height: 20px; font: 400 12px/1.4 var(--font-ui); color: var(--muted); }
.search-hits { display: flex; flex-direction: column; min-width: 0; }
.search-hit {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) max-content;
    align-items: start;
    gap: 10px;
    width: 100%;
    height: auto;                   /* a button: the control height would clip the source line */
    min-height: var(--row-h);
    padding: 6px 8px;
    border: 0;
    border-bottom: 1px solid var(--rule);
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    font: 400 13px/1.5 var(--font-ui);
    text-align: left;
    cursor: pointer;
}
.search-hit:hover:not(:disabled) { background: var(--hover); text-decoration: none; }
.search-hit:focus-visible { outline: 2px solid var(--focus-halo); outline-offset: -2px; }
.search-hit__time {
    font: 400 12px/1.6 var(--font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    text-align: right;
}
.search-hit__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.search-hit__text { overflow-wrap: anywhere; }
.search-hit__src { font-size: 12px; color: var(--ink-2); overflow-wrap: anywhere; }
.search-hit__kind { margin-top: 1px; }
.sheet__body .search-filters { justify-content: space-between; }
/* the sheet's Style control (store.editMode) drives the burn; burn.js keeps its
   radios in sync from the store, so they stay in the DOM but out of sight */
.sheet__body .burn-col > label.radio { display: none; }
/* "Heard in the selection" sheet (span.js openChoice) */
.span-choices { display: flex; flex-direction: column; }
.span-choice { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--rule); font-size: 13px; }
.span-choice > span { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.span-choice .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet__body .burn-col > * { margin-left: 0; margin-right: 0; }
.export-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.export-row .btn .ic, .add-lang .ic { margin-right: 6px; }
/* Add language: the languages to tick (review_tools.js renderAddLanguage) */
.add-lang__list { display: flex; flex-direction: column; max-height: 260px; overflow: auto; }
/* Add language: a translation file the client already has (review_tools.js renderImportTrack) */
.add-lang__import { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--rule); }
.add-lang__import > .btn { align-self: flex-start; }
/* a short window caps the menu (pop_place.js) and it scrolls: its parts keep their size */
.add-lang > .menu--form > * { flex-shrink: 0; }
/* the export sheet's timing facts (review_tools.js paintExportMeta) and its
   frame-rate / start-timecode fields */
.export-meta { margin: 8px 0 0; font-size: 12px; line-height: 1.5; }
.export-fields { flex-wrap: wrap; align-items: flex-end; }
.export-fields .field { flex: 0 1 180px; }
.export-fields input { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.export-fields select { font-variant-numeric: tabular-nums; }
/* the file formats (review_tools.js EXPORT_FORMATS): a segmented choice that wraps on a narrow sheet */
.seg-group.seg-group--sm.export-fmt { flex-wrap: wrap; height: auto; max-width: 100%; }
.seg-group.seg-group--sm.export-fmt > .seg { height: calc(var(--ctl-h-sm) - 6px); }
.export-fmt-note { margin: 6px 0 0; font-size: 12px; line-height: 1.5; }
/* the export sheet's delivery QC verdict (review_tools.js paintQcVerdict) */
.export-qc { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--r-2); }
.export-qc__verdict { margin: 0; font: 600 14px/1.4 var(--font-ui); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.export-qc__verdict .muted { font-weight: 400; font-size: 12px; }
.export-qc__pass { color: var(--ok); }
.export-qc__fail { color: var(--err); margin: 0; }
.export-qc__rules { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; }
.export-qc__rule { display: inline-flex; gap: 6px; align-items: baseline; padding-left: 12px; position: relative; }
.export-qc__rule::before { content: ""; position: absolute; left: 0; top: .45em; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.export-qc__rule--error::before { background: var(--err); }
.export-qc__rule--warn::before { background: var(--warn); }
.export-qc__rule b { font-variant-numeric: tabular-nums; }
/* Speakers sheet: swatch · label · name · voice · line count */
.spk-table { display: flex; flex-direction: column; }
.spk-row {
    display: grid;
    grid-template-columns: 12px 96px minmax(0, 1fr) 132px 64px;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    margin: 0;
    border-bottom: 1px solid var(--rule);
}
.spk-swatch { width: 10px; height: 10px; border-radius: var(--r-pill); background: var(--spk, var(--faint)); }
.spk-label { font: 400 12px/1.4 var(--font-mono); color: var(--muted); }
.spk-lines { font: 400 12px/1.4 var(--font-ui); font-variant-numeric: tabular-nums; color: var(--muted); text-align: right; }
.spk-gender { width: 100%; }
@media (max-width: 560px) {
    .spk-row { grid-template-columns: 12px minmax(0, 1fr) 132px; }
    .spk-row .spk-label, .spk-row .spk-lines { display: none; }
}
/* Names and terms (KNP) sheet (review_tools.js openKnp): term · category ·
   voice · first appearance · description · treatment · one column per
   language · notes · remove. The column track list is set by the script
   (--knp-cols: the languages vary). */
.knp-table { display: flex; flex-direction: column; overflow-x: auto; }
.knp-row {
    display: grid;
    grid-template-columns: var(--knp-cols, minmax(120px, 1.2fr) 118px 96px 92px minmax(140px, 1.6fr) 104px minmax(140px, 1.4fr) 32px);
    gap: 8px;
    align-items: center;
    padding: 5px 0;
    margin: 0;
    border-bottom: 1px solid var(--rule);
    min-width: 760px;
}
.knp-row--head > span { font: 500 12px/1.4 var(--font-ui); color: var(--ink-2); }
/* the remove button (and its header cell) stays at the table's right edge when
   the language columns make the table wider than the sheet */
.knp-row > :last-child { position: sticky; right: 0; background: var(--surface-raised); box-shadow: -8px 0 0 var(--surface-raised); }
.knp-row input, .knp-row select { width: 100%; min-width: 0; }
/* a language: the written rendering over how the dubbed voice says it */
.knp-lang { display: grid; gap: 4px; min-width: 0; }
.knp-lang input[data-say] { font-size: 12px; }
.knp-first { font: 400 12px/1.4 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--muted); }
.knp-row--auto .knp-term { font-style: italic; }
.knp-count { font-size: 12px; }
.knp-addcol { width: auto; max-width: 220px; }
.knp-new { display: block; font-weight: 400; font-size: 11px; }
/* Export sheet, Scripts and lists (review_tools.js): a label, then the files */
.export-scripts__row { flex-wrap: wrap; }
.export-scripts__k { flex: 0 0 128px; font: 500 12px/1.4 var(--font-ui); color: var(--ink-2); }
.export-scripts__lang { max-width: 160px; }
/* The Media sheet's audio tracks (review_tools.js openMedia) */
.media-tracks { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.media-tracks__title { font: 500 12px/1.4 var(--font-ui); color: var(--ink-2); }
.media-tracks .tag { margin-left: 6px; }
.shortcut-list { margin: 0; }
.shortcut-list > div { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--rule); }
.shortcut-list dt { color: var(--ink-2); }
.shortcut-list dd { margin: 0; color: var(--ink); }
kbd {
    display: inline-block;
    min-width: 20px;
    padding: 1px 5px;
    border: 1px solid var(--rule-2);
    border-bottom-width: 2px;
    border-radius: var(--r-1);
    background: var(--surface-raised);
    font: 400 11px/1.4 var(--font-mono);
    color: var(--ink);
    text-align: center;
}

/* ════════════════════════════════════════════════════════════════════
 * Popover menu (§0.1 phase 3) — details.pop > summary + .menu(.menu--up
 * .menu--end .menu--form) > .menu-item / .menu-check / .menu-label / .menu-sep.
 * Emitted by js/review_tools.js (project, View, Add language, Fix all) and the
 * header's account menu (shell.css adds its position only).
 * ════════════════════════════════════════════════════════════════════ */
details.pop { position: relative; display: inline-flex; }
details.pop > summary { list-style: none; cursor: pointer; }
details.pop > summary::-webkit-details-marker { display: none; }
details.pop[open] > summary { color: var(--ink); background: var(--hover); }
details.pop > .menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: var(--z-popover); }
details.pop > .menu--up { top: auto; bottom: calc(100% + 4px); }
details.pop > .menu--end { left: auto; right: 0; }
.menu {
    display: flex;
    flex-direction: column;
    min-width: 232px;
    padding: 4px;
    background: var(--surface-raised);
    border: 1px solid var(--rule-2);
    border-radius: var(--r-3);
    box-shadow: var(--shadow-pop);
}
.menu.menu--form { gap: 10px; padding: 12px; min-width: 280px; }
.menu--form .field { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.menu--form .field > span { font: 500 12px/1.4 var(--font-ui); color: var(--ink-2); }
.menu--form > p { margin: 0; }
.menu .menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: 32px;
    padding: 0 10px;
    border: 0;
    border-radius: var(--r-2);
    background: transparent;
    color: var(--ink-2);
    font: 400 13px/1 var(--font-ui);
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}
.menu .menu-item:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.menu .menu-item:disabled { color: var(--faint); cursor: default; }
.menu .menu-item[data-danger] { color: var(--err); }
.menu .menu-item[hidden] { display: none; }
.menu-label { padding: 8px 10px 4px; font: 500 12px/1.4 var(--font-ui); color: var(--muted); }
.menu-check {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    padding: 0 10px;
    margin: 0;
    border-radius: var(--r-2);
    color: var(--ink-2);
    font: 400 13px/1.3 var(--font-ui);
    white-space: nowrap;
    cursor: pointer;
}
.menu-check:hover { background: var(--hover); color: var(--ink); }
.menu-check input { width: auto; margin: 0; }
.menu-check:has(input:disabled) { color: var(--faint); cursor: default; }
/* a note at the right of a check ("none in this project") */
.menu-check .menu-note { margin-left: auto; padding-left: 16px; color: var(--muted); font-size: 11px; }
.menu-sep { height: 1px; margin: 4px 0; background: var(--rule); }

/* Small segmented control (language bar, export format) */
.seg-group.seg-group--sm { height: var(--ctl-h-sm); }
.seg-group.seg-group--sm > .seg { padding: 0 9px; font-size: 12px; }

/* Speaker colours — [data-spk="1…6"] sets --spk (and --spk-stage for text on
   the picture); 0 = no speaker. Used by the list, timeline, overlay, edit strip. */
[data-spk="1"] { --spk: var(--spk-1); --spk-stage: var(--spk-stage-1); }
[data-spk="2"] { --spk: var(--spk-2); --spk-stage: var(--spk-stage-2); }
[data-spk="3"] { --spk: var(--spk-3); --spk-stage: var(--spk-stage-3); }
[data-spk="4"] { --spk: var(--spk-4); --spk-stage: var(--spk-stage-4); }
[data-spk="5"] { --spk: var(--spk-5); --spk-stage: var(--spk-stage-5); }
[data-spk="6"] { --spk: var(--spk-6); --spk-stage: var(--spk-stage-6); }

.toast {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: var(--z-dialog);
    max-width: min(360px, calc(100vw - 32px));
    padding: 8px 12px;
    border: 1px solid var(--rule-2);
    border-radius: var(--r-3);
    background: var(--surface-raised);
    color: var(--ink);
    box-shadow: var(--shadow-pop);
    font: 400 12px/1.4 var(--font-ui);
}

/* ════════════════════════════════════════════════════════════════════
 * §4.14 Drop zone — label.upload-zone-big (pipeline.js #videoZone, new_project.js)
 * ════════════════════════════════════════════════════════════════════ */
label.upload-zone-big {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 24px 16px;
    border: 1px dashed var(--edge-control);
    border-radius: var(--r-2);
    background: var(--surface);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
label.upload-zone-big .cloud {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 20px;
    line-height: 1;
    color: var(--ink-2);
}
label.upload-zone-big .cloud .ic { width: 20px; height: 20px; }
label.upload-zone-big .label { margin: 0; font: 500 14px/1.4 var(--font-ui); color: var(--ink); }
label.upload-zone-big .sublabel { margin: 0; font: 400 12px/1.4 var(--font-ui); color: var(--muted); }
label.upload-zone-big:hover, label.upload-zone-big.dragover, label.upload-zone-big:focus-within {
    border: 1px solid var(--accent);
    background: var(--surface-raised);
}
.sublabel.file-picked, label.upload-zone-big .sublabel.file-picked {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ok);
}
.sublabel.file-picked:not(:empty)::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

/* ════════════════════════════════════════════════════════════════════
 * §4.15 Empty state — router.js, projects.js, review.js, pipeline.js
 * ════════════════════════════════════════════════════════════════════ */
.empty-state {
    max-width: 480px;
    margin: 48px auto;
    padding: 0 16px;
    text-align: left;
    color: var(--ink-2);
}
.empty-state h2 { margin: 0 0 8px; font: 500 20px/1.3 var(--font-ui); letter-spacing: -.01em; color: var(--ink); }
.empty-state p { margin: 0; font: 400 14px/1.55 var(--font-ui); color: var(--ink-2); }
.empty-state button, .empty-state .btn { margin-top: 16px; }

/* ════════════════════════════════════════════════════════════════════
 * §7 Icon — 16 px sprite symbol, stroke = currentColor (js/util.js icon())
 * ════════════════════════════════════════════════════════════════════ */
.ic {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    flex: none;
    vertical-align: -3px;
}

/* ── Legacy .muted size re-supply (§4.0) — places that relied on .muted for 12 px
 * and have no component size yet; each moves into its area file. ──────── */
.qc-summary-meta, .key-id .muted, .dub-muxed span.muted { font-size: 12px; }
