/* The Refinery's "Tactical Bridge" theme (~/the-refinery/src/Refinery.Web/wwwroot/app.css) - Sean,
   2026-09-26: "build the look and feel of the refinery FARS". FARS Manifest plugs into the Refinery and
   an analyst moves between them, so it wears the same skin: same palette, same full-width shell, same
   top nav, same controls. The old token names are kept (mapped onto the Refinery's values) so the
   NHTSA-only screens - case coding, gap-field admin - pick the theme up without a rewrite. */
:root {
    color-scheme: dark;
    --bg-matte-carbon: #0d0d0d;
    --bg-dark-armor: #1a1a1a;
    --bg-dark-armor-raised: #232323;
    --text-brushed-aluminum: #d1d5db;
    --text-dim: #8b93a1;
    --accent-cyan-glow: #00e5ff;
    --danger: #ef4444;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.18);

    --bg: var(--bg-matte-carbon);
    --surface: var(--bg-dark-armor);
    --surface-2: var(--bg-dark-armor-raised);
    --line: var(--border-strong);
    --text: var(--text-brushed-aluminum);
    --muted: var(--text-dim);
    --muted-2: #6b7280;
    --accent: var(--accent-cyan-glow);
    --accent-glow: #67f0ff;
    --accent-ink: #001a1f;
    --accent-dim: #0e4f58;
    --good: #34d399;
    --warn: #f59e0b;
    --radius: 8px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; height: 100%; }

body {
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    background: var(--bg-matte-carbon);
    color: var(--text-brushed-aluminum);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent-cyan-glow); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { color: #f3f4f6; font-weight: 600; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
code { color: var(--accent-cyan-glow); background: rgba(0, 229, 255, 0.07); padding: 0 .25em; border-radius: 3px; }
code, .mono { font-family: Consolas, "SFMono-Regular", Menlo, monospace; }

button, input, select, textarea {
    font-family: inherit;
    font-size: 0.95em;
    background: var(--bg-dark-armor-raised);
    color: var(--text-brushed-aluminum);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 0.45em 0.8em;
}
button { cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .05s ease; }
button:hover:not(:disabled) { border-color: var(--accent-cyan-glow); }
button:active:not(:disabled) { transform: scale(0.97); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
input::placeholder, textarea::placeholder { color: #6b7280; }

/* --- shell: the Refinery's top-row nav, full-width content --- */
.top-row {
    background: var(--bg-dark-armor);
    border-bottom: 1px solid var(--border-strong);
    padding: 0.55rem 1rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex: 0 0 auto;
}
.top-row .brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; letter-spacing: .04em; color: #fff; }
.top-row .brand:hover { text-decoration: none; }
.top-row .brand img { height: 30px; width: 30px; }
.top-row nav { display: inline-flex; gap: 1rem; }
.top-row nav a { color: var(--text-brushed-aluminum); }
.top-row nav a:hover { color: var(--accent-cyan-glow); text-decoration: none; }
.top-row nav a.active { color: var(--accent-cyan-glow); }

main {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
    width: 100%;
}

/* The case-review IDE workspace opts out of main's centered/padded/scrolling column - it manages
   its own locked-viewport, dual-pane layout instead (2026-09-12 density redesign). */
main:has(.case-workspace) {
    max-width: none;
    padding: 0;
    overflow: hidden;
    display: flex;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.panel h2, .panel h3 { margin-top: 0; }

table { border-collapse: collapse; width: 100%; margin: .5rem 0; }
th, td { text-align: left; padding: .4rem .6rem; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
th { color: var(--text-dim); font-weight: 600; border-bottom: 1px solid var(--border-strong); }
tbody tr:hover { background: rgba(255, 255, 255, 0.03); }

/* The Refinery's two button shapes (.rf-btn-primary / .rf-btn-outline). .btn / .btn-secondary are
   kept as aliases so every existing screen follows along. */
.btn, .rf-btn-primary {
    display: inline-block;
    background: #475569; border: 1px solid #475569; color: #fff; font-weight: 600;
    border-radius: 8px; padding: .45em .9em; cursor: pointer; text-decoration: none; font-size: .95em;
}
.btn:hover:not(:disabled), .rf-btn-primary:hover:not(:disabled) { background: #64748b; border-color: #64748b; text-decoration: none; }
.btn:disabled, .rf-btn-primary:disabled { opacity: .4; cursor: not-allowed; }
.btn-secondary, .rf-btn-outline {
    background: transparent; color: var(--text-brushed-aluminum); border: 1px solid var(--border-strong); font-weight: 400;
}
.btn-secondary:hover:not(:disabled), .rf-btn-outline:hover:not(:disabled) { background: transparent; border-color: var(--accent-cyan-glow); color: var(--text-brushed-aluminum); }

.badge {
    display: inline-block;
    border-radius: 999px;
    padding: .15rem .6rem;
    font-size: .8rem;
    font-weight: 600;
}
.badge-ready { background: rgba(51, 199, 245, .15); color: var(--accent-glow); }
.badge-sent { background: rgba(57, 217, 138, .15); color: var(--good); }
.badge-open { background: rgba(245, 185, 66, .15); color: var(--warn); }
.possible-match-hint { color: var(--good); font-size: .8rem; margin-top: .3rem; max-width: 22rem; }

.pre-report-form .form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: .5rem;
}
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
}
.pre-report-form label { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; color: var(--muted); }
.pre-report-form input, .pre-report-form select, .pre-report-form textarea {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    padding: .4rem .55rem;
    font: inherit;
}
.pre-report-form h3 { margin: .5rem 0 .25rem; font-size: .95rem; }

.muted { color: var(--muted); }

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
@media (max-width: 800px) {
    .two-col { grid-template-columns: 1fr; }
}

.report-image-placeholder {
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    color: var(--muted);
}

.section-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: .75rem;
    padding-bottom: .5rem;
}
.section-tabs .tab {
    background: var(--surface-2);
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .35rem .9rem;
    font-size: .85rem;
    cursor: pointer;
}
.section-tabs .tab:hover { color: var(--text); border-color: var(--accent-dim); }
.section-tabs .tab.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.section-tabs .tab-count { opacity: .75; font-size: .8em; margin-left: .15rem; }

.entity-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .75rem;
    margin-bottom: .75rem;
    background: var(--surface-2);
}
.entity-subcard {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .6rem .75rem;
    margin: .5rem 0 .5rem 1.25rem;
    background: var(--surface);
}
.entity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .35rem;
}

.submission-preview {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: .75rem;
    margin-top: .5rem;
    max-height: 24rem;
    overflow: auto;
    font-size: .8rem;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--muted);
}

.gap-cluster { border-bottom: 1px solid var(--line); padding: .6rem 0; }
.gap-cluster:last-child { border-bottom: none; }
.gap-cluster > summary { cursor: pointer; }
.gap-cluster .elements { color: var(--accent-glow); font-size: .85rem; }
.gap-cluster .section { color: var(--muted-2); font-size: .8rem; }

/* Compact multi-column field grid (2026-09-12 density redesign) - small fields (a code dropdown,
   a short free-text box) pack several per row; a "select all that apply" checklist spans the full
   row width via .gap-field-wide so a long list never gets awkwardly squeezed into one column. */
.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .6rem 1rem;
    padding: .5rem 0;
}
.gap-field { display: flex; flex-direction: column; gap: .3rem; }
.gap-field.gap-field-wide { grid-column: 1 / -1; }
.gap-field label { color: var(--text); font-size: .85rem; font-weight: 500; }
.gap-field select, .gap-field input[type="text"] {
    width: 100%;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: .35rem .5rem;
}
.gap-field select:focus, .gap-field input[type="text"]:focus { outline: 1px solid var(--accent); }

/* Long narrative text (cluster notes, coded-field format hints) lives in a hover tooltip instead of
   a permanent paragraph - "strip text walls" density rule. Native title attribute - no JS needed. */
.info-icon { color: var(--muted-2); cursor: help; font-size: .85em; margin-left: .3rem; }
.info-icon:hover { color: var(--accent-glow); }

.multi-coded {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem 1.25rem;
    max-height: 12rem;
    overflow-y: auto;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: .5rem;
}
.multi-option { font-size: .85rem; display: flex; align-items: center; gap: .35rem; white-space: nowrap; }

/* ---------- IDE workspace: locked-viewport split screen (2026-09-12) ---------- */

.case-workspace {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
    min-height: 0;
}

.command-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: .6rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    flex: 0 0 auto;
}
.command-bar-info { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.command-bar-actions { display: flex; gap: .5rem; flex: 0 0 auto; }

.alert-banner {
    padding: .4rem 1rem;
    font-size: .85rem;
    border-bottom: 1px solid var(--line);
    flex: 0 0 auto;
}
.alert-banner.ok { color: var(--good); background: rgba(57, 217, 138, .08); }
.alert-banner.err { color: #f2a6a8; background: rgba(229, 72, 77, .08); }

.split-panes {
    flex: 1 1 auto;
    display: flex;
    overflow: hidden;
    min-height: 0;
}
.pane { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.pane-left { flex: 0 0 42%; width: 42%; border-right: 1px solid var(--line); background: var(--surface); }
.pane-right { flex: 1 1 auto; background: var(--bg); }

.pane-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
    flex: 0 0 auto;
    font-size: .85rem;
    flex-wrap: wrap;
}

.pane-scroll { flex: 1 1 auto; overflow: auto; padding: 1rem; min-height: 0; }
.pane-image-scroll { padding: 0; background: #0c0d10; }
/* "100%" (the default) means "fits the pane width," not the image's native pixel size - a real
   scanned form is typically wider than a 42%-viewport pane, so rendering it at native size caused a
   surprise horizontal scrollbar and cut-off content out of the box. width:100% establishes that
   fit-to-pane baseline; the zoom transform then scales up/down FROM it, not from native size. */
.pane-image-scroll img { display: block; width: 100%; transition: transform .1s ease; transform-origin: top left; }
.pane-image-scroll .report-image-placeholder { margin: 1rem; }
.report-pdf-canvas-host { display: flex; justify-content: center; padding: 1rem; }
.report-pdf-canvas-host canvas { display: block; max-width: none; box-shadow: 0 0 0 1px var(--line); }

.zoom-controls, .page-controls { display: flex; align-items: center; gap: .35rem; }
.zoom-controls button, .page-controls button {
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 4px;
    min-width: 1.6rem;
    height: 1.6rem;
    cursor: pointer;
    font-size: .85rem;
}
.zoom-controls button:disabled, .page-controls button:disabled { opacity: .4; cursor: not-allowed; }

@media (max-width: 900px) {
    .split-panes { flex-direction: column; overflow: auto; }
    .pane-left { width: 100%; flex: 0 0 auto; max-height: 40vh; border-right: none; border-bottom: 1px solid var(--line); }
    .pane-right { flex: 1 1 auto; }
}

/* Vault data - compact grid instead of a single-column key/value table */
.vault-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: .5rem .75rem;
    margin-bottom: 1rem;
}
.vault-cell { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: .4rem .6rem; }
.vault-label { display: block; color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .03em; }
.vault-value { display: block; font-size: .88rem; margin-top: .15rem; word-break: break-word; }

/* Entity pill selector - switch between Vehicle 1/2/... (or Occupant 1/2/...) instead of stacking
   every entity's fields open at once. Inline remove (x) is the muted-destructive control - compact,
   not a separate full-width "Remove" button cluttering the screen. */
.entity-pills { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: .5rem 0 .75rem; }
.entity-pills-sub { margin-left: .5rem; padding-left: .75rem; border-left: 2px solid var(--line); }
.entity-pill { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.entity-pill.active { border-color: var(--accent); background: rgba(51, 199, 245, .12); }
.entity-pill .pill-label { background: transparent; border: none; color: var(--text); padding: .3rem .85rem; cursor: pointer; font-size: .85rem; }
.entity-pill.active .pill-label { color: var(--accent-glow); font-weight: 600; }
.entity-pill .pill-remove {
    background: transparent;
    border: none;
    border-left: 1px solid var(--line);
    color: #b56b6d;
    padding: .3rem .55rem;
    cursor: pointer;
    font-size: .85rem;
    line-height: 1;
}
.entity-pill .pill-remove:hover { background: rgba(229, 72, 77, .16); color: #f2a6a8; }

.btn-sm { padding: .3rem .7rem; font-size: .85rem; }

/* ---- 2026-09-26: Refinery /fars parity - dashboard, work queue, match page, pills ---- */
.dash-header { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.dash-header h2 { margin: 0; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 38fr) minmax(0, 62fr); gap: 1rem; align-items: start; }
@media (max-width: 1000px) { .dash-grid { grid-template-columns: 1fr; } }
.dash-left .panel { position: sticky; top: 1rem; }
.form-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .75rem; }
.pre-report-form .form-grid2 input, .pre-report-form .form-grid2 select, .pre-report-form textarea { width: 100%; box-sizing: border-box; }
.person-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: .4rem; margin: .3rem 0; }
.person-row input, .person-row select {
    background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px;
    color: var(--text); padding: .35rem .5rem; font: inherit; min-width: 0;
}
.ghost-x { background: none; border: none; color: #f2a6a8; font-size: 1.1rem; cursor: pointer; padding: 0 .3rem; }
.form-error { color: #f2a6a8; font-size: .85rem; margin-top: .35rem; }
td.small, .small { font-size: .88rem; }

.help-tip {
    display: inline-flex; align-items: center; justify-content: center; width: 1.1rem; height: 1.1rem;
    border-radius: 50%; border: 1px solid var(--line); color: var(--muted); font-size: .72rem;
    font-weight: 700; cursor: help; vertical-align: middle;
}

.pill { display: inline-block; border-radius: 999px; padding: .12rem .6rem; font-size: .78rem; font-weight: 600; }
.pill-open { background: rgba(245, 185, 66, .15); color: var(--warn); }
.pill-matched { background: rgba(57, 217, 138, .15); color: var(--good); }
.pill-transmitted { background: rgba(51, 199, 245, .15); color: var(--accent); }
.pill-dismissed { background: rgba(229, 72, 77, .15); color: #f2a6a8; }

.tab-btn {
    background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 999px;
    padding: .25rem .8rem; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
}
.tab-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(51, 199, 245, .08); }
.filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: .6rem; margin-bottom: .75rem; font-size: .85rem; color: var(--muted); }
.filter-bar label { display: flex; flex-direction: column; gap: .2rem; }
.filter-bar input {
    background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; color: var(--text); padding: .3rem .45rem; font: inherit;
}
.filter-bar input:disabled { opacity: .45; }
details > summary { cursor: pointer; font-weight: 600; }
.pager { display: flex; align-items: center; gap: .75rem; justify-content: flex-end; margin-top: .6rem; font-size: .85rem; }

/* match page */
.pane-half { flex: 0 0 50%; width: 50%; }
.match-banner {
    background: rgba(57, 217, 138, .1); border: 1px solid rgba(57, 217, 138, .35); color: var(--good);
    border-radius: 6px; padding: .5rem .75rem; margin-bottom: .6rem; font-size: .9rem;
}
.detail-card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: .75rem; margin-top: .75rem; font-size: .9rem; }
.meta-table { margin-top: .4rem; }
.meta-table td { padding: .25rem .5rem; border-bottom: 1px solid var(--line); }
.meta-table td:first-child { color: var(--muted); width: 9rem; }
.decision-zone { margin-top: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.reject-zone { border: 1px solid rgba(229, 72, 77, .35); background: rgba(229, 72, 77, .06); border-radius: 6px; padding: .75rem; }
.reject-zone label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .35rem; }
.reject-zone input {
    background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; color: var(--text); padding: .35rem .5rem; font: inherit;
}
.btn-danger { background: rgba(229, 72, 77, .85); color: #fff; }
.btn-danger:hover { background: var(--danger); }
.btn-danger:disabled { background: rgba(229, 72, 77, .3); color: var(--muted); }
.dismissed-banner { border: 1px solid rgba(229, 72, 77, .35); background: rgba(229, 72, 77, .08); border-radius: 6px; padding: .75rem; font-size: .9rem; }

/* candidate report on the pre-report page */
.report-box { display: flex; flex-direction: column; height: 70vh; margin-top: 1rem; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }

/* search: sticky filter bar + empty state */
.search-sticky { position: sticky; top: 0; z-index: 5; }
.empty-state { text-align: center; padding: 2rem 1rem; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
td .btn-sm, td a.btn { white-space: nowrap; }
.pane-right select {
    background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px;
    color: var(--text); padding: .45rem .55rem; font: inherit;
}


/* ==== Copied from the Refinery (2026-09-26, Sean: "build the look and feel of the refinery FARS") ====
   app.css .rf-helptip, and the <style> blocks of FarsWorklist.razor (.rf-fars-*), FarsCaseMatch.razor
   (.rf-fcm-*) and FarsSearch.razor (.rf-fs-*). Kept verbatim so the two apps stay in step - re-copy
   rather than hand-edit when the Refinery's screens change. */
.rf-helptip { position: relative; display: inline-flex; align-items: center; }
.rf-helptip-btn {
    width: 1.15rem; height: 1.15rem; border-radius: 50%; padding: 0; line-height: 1;
    font-size: .7rem; display: inline-flex; align-items: center; justify-content: center;
    background: transparent; color: var(--text-dim); border: 1px solid var(--border-strong);
    cursor: help;
}
.rf-helptip-btn:hover, .rf-helptip-btn:focus-visible { border-color: var(--accent-cyan-glow); color: var(--accent-cyan-glow); }
.rf-helptip-text {
    display: none; position: absolute; z-index: 30; top: 140%; left: 0;
    background: var(--bg-dark-armor-raised); border: 1px solid var(--border-strong); border-radius: 6px;
    padding: .55rem .7rem; width: max-content; max-width: 22rem; font-size: .82em; font-weight: normal;
    color: var(--text-brushed-aluminum); box-shadow: 0 6px 18px rgba(0, 0, 0, .5);
}
.rf-helptip:hover .rf-helptip-text, .rf-helptip:focus-within .rf-helptip-text { display: block; }
.rf-fars-header { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.rf-fars-header h1 { margin: 0; }

/* Day / night for the page content - the Refinery's Validation screen palette (ReviewRecord.razor's
   .rf-shell[data-theme="day"]). The top bar keeps the dark chrome, as in the Refinery. */
main[data-theme="day"] {
    color-scheme: light;
    --bg-matte-carbon: #f7f7f5; --bg-dark-armor: #ffffff; --bg-dark-armor-raised: #eef0f2;
    --text-brushed-aluminum: #16181d; --text-dim: #55606e;
    --border-subtle: rgba(0, 0, 0, 0.10); --border-strong: rgba(0, 0, 0, 0.22);
    --accent-cyan-glow: #007c91; --accent-glow: #0090a8; --accent-dim: #cfe8f0;
    --bg: var(--bg-matte-carbon); --surface: var(--bg-dark-armor); --surface-2: var(--bg-dark-armor-raised);
    --line: var(--border-strong); --text: var(--text-brushed-aluminum); --muted: var(--text-dim);
    --accent: var(--accent-cyan-glow);
    background: var(--bg-matte-carbon); color: var(--text-brushed-aluminum);
}
main[data-theme="day"] h1, main[data-theme="day"] h2, main[data-theme="day"] h3, main[data-theme="day"] .studio-title { color: #16181d; }
main[data-theme="day"] input, main[data-theme="day"] select, main[data-theme="day"] textarea {
    background: #ffffff; color: #16181d; border-color: rgba(0, 0, 0, .25);
}
main[data-theme="day"] code { color: var(--accent-cyan-glow); background: rgba(0, 124, 145, .08); }
main[data-theme="day"] .btn-primary { background: #007c91; border-color: #007c91; color: #fff; }
main[data-theme="day"] .btn-primary:hover:not(:disabled) { background: #0090a8; border-color: #0090a8; }
.rf-theme-btn {
    padding: .3rem .75rem; border-radius: 999px; font-size: .85em; cursor: pointer;
    background: var(--bg-dark-armor-raised); color: var(--text-brushed-aluminum); border: 1px solid var(--border-strong);
}
.rf-theme-btn[aria-pressed="true"] { border-color: var(--accent-cyan-glow); color: var(--accent-cyan-glow); }

.rf-fars-grid { display: flex; gap: 1rem; align-items: flex-start; }
.rf-fars-left { flex: 0 0 38%; min-width: 0; }
.rf-fars-right { flex: 1 1 62%; min-width: 0; }

.rf-fars-card {
    background: var(--bg-dark-armor); border: 1px solid var(--border-strong); border-radius: 8px;
    padding: 1rem;
}
.rf-fars-card h2 { margin: 0 0 .75rem; font-size: 1em; }
.rf-fars-field { display: flex; flex-direction: column; gap: .2rem; margin-bottom: .6rem; }
.rf-fars-field label, .rf-fars-field-label { font-size: .8em; color: var(--text-dim); }
.rf-fars-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.rf-fars-person-row { display: flex; gap: .4rem; margin-bottom: .35rem; align-items: center; }
.rf-fars-person-row input, .rf-fars-person-row select { flex: 1 1 0; min-width: 0; }

.rf-fars-section { margin-bottom: 1.25rem; }
.rf-fars-section h2 { display: flex; align-items: center; gap: .4rem; font-size: 1em; margin: 0 0 .5rem; }
.rf-fars-table-wrap { width: 100%; overflow-x: auto; }
.rf-fars-table { width: 100%; border-collapse: collapse; font-size: .9em; }
.rf-fars-table thead th {
    text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border-strong);
    color: var(--text-dim); font-size: .8em; text-transform: uppercase; letter-spacing: .04em;
}
.rf-fars-table td { padding: .5rem .6rem; border-bottom: 1px solid var(--border-strong); }
.rf-fars-table tbody tr:hover { background: var(--bg-dark-armor-raised); }

.rf-fars-pill {
    display: inline-flex; align-items: center; padding: .1rem .55rem; border-radius: 999px;
    font-size: .8em; font-weight: 600; white-space: nowrap; border: 1px solid transparent;
}
.rf-fars-pill-open { background: rgba(217,119,6,.15); color: #f59e0b; border-color: rgba(217,119,6,.4); }
.rf-fars-pill-matched { background: rgba(16,185,129,.12); color: #34d399; border-color: rgba(16,185,129,.4); }
.rf-fars-pill-transmitted { background: rgba(0,229,255,.1); color: var(--accent-cyan-glow); border-color: rgba(0,229,255,.35); }

.rf-fars-ghost-btn {
    border: 1px solid var(--border-strong); background: transparent; color: var(--text-brushed-aluminum);
    font-size: .8em; padding: .2rem .6rem; border-radius: 6px; cursor: pointer;
}
.rf-fars-ghost-btn:hover:not(:disabled) { background: var(--bg-dark-armor-raised); }

/* Pre-reports / Transmitted tab strip - same visual language as the Work Zone tabs, own class
   names since a Razor page's style block isn't shared with another page. */
.rf-fars-tab {
    border: 1px solid var(--border-strong); border-radius: 999px; background: var(--bg-dark-armor);
    color: var(--text-brushed-aluminum); padding: .3rem .8rem; font-size: .85em; cursor: pointer;
}
.rf-fars-tab:hover { border-color: var(--accent-cyan-glow); }
.rf-fars-tab.active { border-color: var(--accent-cyan-glow); background: rgba(0,229,255,.08); color: var(--accent-cyan-glow); font-weight: 600; }
.rf-fars-filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: .6rem 0; font-size: .9em; }
.rf-fars-filterbar label { color: var(--text-dim); }
/* Locked 100vh command center, same shape as /workzone/{id} - the image pane and the match/
   disposition panel both size off one fixed height instead of the page growing past the
   viewport. */
.rf-fcm-shell { height: calc(100vh - 9rem); display: flex; gap: 1rem; align-items: stretch; }
.rf-fcm-image { flex: 0 0 50%; min-width: 0; height: 100%; }
/* Mirrors ReportImagePanel's own label-line layout (see the Work Zone redesign's own fix for
   this exact top-alignment issue, 2026-09-14) so the two panes' bordered boxes start level. */
.rf-fcm-side-wrap { flex: 1 1 50%; min-width: 0; height: 100%; display: flex; flex-direction: column; }
.rf-fcm-side-spacer { flex: 0 0 auto; font-size: .85em; margin-bottom: .25rem; visibility: hidden; }
.rf-fcm-side {
    flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
    background: var(--bg-dark-armor); border: 1px solid var(--border-strong); border-radius: 8px;
    overflow: hidden;
}
.rf-fcm-scroll { flex: 1 1 auto; overflow-y: auto; padding: 1rem; }

.rf-fcm-meta { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.rf-fcm-meta tr { border-bottom: 1px solid var(--border-strong); }
.rf-fcm-meta tr:last-child { border-bottom: none; }
.rf-fcm-meta td { padding: .4rem .1rem; vertical-align: top; }
.rf-fcm-meta td:first-child { width: 40%; color: var(--text-dim); font-size: .85em; }

.rf-fcm-banner {
    border: 1px solid rgba(16,185,129,.4); background: rgba(16,185,129,.1); color: #34d399;
    border-radius: 6px; padding: .5rem .7rem; margin-bottom: .75rem; font-size: .9em;
}
.rf-fcm-detail-card {
    border: 1px solid var(--border-strong); border-radius: 6px; padding: .75rem; margin-top: .5rem;
    background: var(--bg-dark-armor-raised);
}

.rf-fcm-command { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border-strong); }
.rf-fcm-confirm {
    display: block; width: 100%; padding: .55rem; border-radius: 8px; font-weight: 600;
    background: #475569; border: 1px solid #475569; color: #fff; cursor: pointer;
}
.rf-fcm-confirm:hover:not(:disabled) { background: #64748b; }
.rf-fcm-confirm:disabled { opacity: .5; cursor: default; }

.rf-fcm-reject {
    margin-top: 1rem; padding: .75rem; border: 1px solid rgba(244,63,94,.35);
    background: rgba(244,63,94,.06); border-radius: 8px;
}
.rf-fcm-reject input { width: 100%; margin-bottom: .5rem; }
.rf-fcm-reject button {
    width: 100%; padding: .5rem; border-radius: 6px; font-weight: 600;
    background: transparent; border: 1px solid rgba(244,63,94,.6); color: #fb7185; cursor: pointer;
}
.rf-fcm-reject button:hover:not(:disabled) { background: rgba(244,63,94,.12); }
.rf-fcm-reject button:disabled { opacity: .5; cursor: default; }

/* No button anywhere used to reverse a wrong "not a fatal" click (Sean, 2026-09-14) - the
   backend always supported it, this just gives it a face. */
.rf-fcm-dismissed-banner {
    padding: .9rem; border: 1px solid rgba(244,63,94,.35); background: rgba(244,63,94,.06);
    border-radius: 8px; font-size: .95em;
}
.rf-fcm-undo {
    width: 100%; padding: .5rem; border-radius: 6px; font-weight: 600; cursor: pointer;
    background: transparent; border: 1px solid var(--accent-cyan-glow); color: var(--accent-cyan-glow);
}
.rf-fcm-undo:hover:not(:disabled) { background: rgba(0,229,255,.08); }
.rf-fcm-undo:disabled { opacity: .5; cursor: default; }
.rf-fs-header { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.rf-fs-header h1 { margin: 0; }

.rf-fs-filterbar {
    position: sticky; top: 0; z-index: 2; background: var(--bg-matte-carbon);
    border: 1px solid var(--border-strong); border-radius: 8px; padding: .75rem;
    margin-bottom: .75rem;
}
.rf-fs-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; }
.rf-fs-field { display: flex; flex-direction: column; gap: .2rem; }
.rf-fs-field label { font-size: .8em; color: var(--text-dim); }
.rf-fs-actions { display: flex; gap: .5rem; margin-top: .6rem; }

.rf-fs-table-wrap { width: 100%; overflow-x: auto; }
.rf-fs-table { width: 100%; border-collapse: collapse; font-size: .92em; }
.rf-fs-table thead th {
    text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--border-strong);
    color: var(--text-dim); font-size: .8em; text-transform: uppercase; letter-spacing: .04em;
    background: var(--bg-dark-armor-raised);
}
.rf-fs-table td { padding: .55rem .7rem; border-bottom: 1px solid var(--border-strong); }
.rf-fs-table tbody tr:hover { background: var(--bg-dark-armor-raised); }

.rf-fs-empty { padding: 2rem 1rem; text-align: center; color: var(--text-dim); }

@media (max-width: 900px) { .rf-fs-grid { grid-template-columns: repeat(2, 1fr); } }
/* ==== end of the Refinery copy ==== */

/* FARS Manifest's own header differs from the Refinery's (no dev-auth strip), so the locked match
   view gets a little more height. */
.rf-fcm-shell { height: calc(100vh - 8.5rem); }
.rf-report-label { flex: 0 0 auto; font-size: .85em; margin-bottom: .25rem; color: var(--accent-cyan-glow); }
.rf-report-label span { color: var(--text-dim); }
.rf-report-frame { flex: 1 1 auto; min-height: 0; width: 100%; border: 1px solid var(--border-strong); overflow: hidden; background: #fff; }
.rf-report-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.rf-report-frame.rf-report-empty { background: var(--bg-dark-armor); color: var(--text-dim); display: flex; align-items: center; justify-content: center; padding: 1rem; text-align: center; }
.rf-report-frame.rf-report-image { overflow: auto; background: #0c0d10; }
.rf-report-frame.rf-report-image img { display: block; width: 100%; }
h1:focus, h1:focus-visible { outline: none; }

/* ==== FARS Data Studio (/case/{id}) - Sean, 2026-09-26 UI spec ====
   100vh locked below the top-row: the page never scrolls; the document pane and the coding pane each
   scroll on their own. Semantic classes only, on the Refinery theme's tokens. */
:root {
    --studio-card-bg: #1e1e1e;
    --studio-card-border: #2a2d33;
    --studio-derived: #8b93a1;
    --studio-gap: #f59e0b;
}
main:has(.fars-studio) { padding: 0; overflow: hidden; display: flex; }
.fars-studio { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; height: 100%; width: 100%; }

.studio-bar {
    flex: 0 0 auto; display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
    padding: .55rem 1rem; background: var(--bg-dark-armor); border-bottom: 1px solid var(--border-strong);
    position: sticky; top: 0; z-index: 5;
}
.studio-title { font-weight: 600; color: #f3f4f6; }
.studio-status { font-size: .85em; color: var(--good); }
.studio-status.is-error { color: var(--danger); }
.studio-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.btn-primary {
    background: var(--accent-cyan-glow); border: 1px solid var(--accent-cyan-glow); color: #001a1f;
    font-weight: 700; border-radius: 8px; padding: .45em 1em; cursor: pointer;
}
.btn-primary:hover:not(:disabled) { background: #67f0ff; border-color: #67f0ff; }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }
.studio-warning {
    flex: 0 0 auto; padding: .35rem 1rem; font-size: .85em; color: #fca5a5;
    background: rgba(239, 68, 68, .08); border-bottom: 1px solid rgba(239, 68, 68, .3);
}

.studio-body { flex: 1 1 auto; min-height: 0; display: flex; }
.document-pane {
    flex: 0 0 44%; width: 44%; min-width: 0; padding: .6rem; display: flex; flex-direction: column;
    border-right: 1px solid var(--border-strong); background: var(--bg-matte-carbon);
}
.coding-pane { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; background: var(--bg-matte-carbon); }

.studio-tabs {
    flex: 0 0 auto; display: flex; gap: .25rem; padding: .5rem .75rem 0; overflow-x: auto;
    border-bottom: 1px solid var(--border-strong); background: var(--bg-dark-armor);
}
.studio-tab {
    background: transparent; border: 1px solid transparent; border-bottom: none; border-radius: 8px 8px 0 0;
    color: var(--text-dim); padding: .45rem .85rem; font-size: .9em; white-space: nowrap;
}
.studio-tab:hover:not(:disabled) { color: var(--text-brushed-aluminum); border-color: transparent; }
.studio-tab.active {
    color: var(--accent-cyan-glow); background: var(--bg-matte-carbon);
    border-color: var(--border-strong); font-weight: 600; margin-bottom: -1px;
}
/* The FARS work happens on this tab - make it findable (Sean, 2026-09-28: "i don't see that tab"). */
.studio-tab.studio-tab-gap { color: var(--accent-cyan-glow); border: 1px solid var(--accent-cyan-glow); border-bottom: none; font-weight: 600; }
.studio-tab.studio-tab-gap:not(.active) { background: rgba(0, 229, 255, .08); }
.studio-tab.studio-tab-gap:hover:not(:disabled) { color: var(--accent-cyan-glow); border-color: var(--accent-cyan-glow); background: rgba(0, 229, 255, .14); }
.coding-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: .9rem 1rem 2rem; }
.studio-empty { color: var(--text-dim); font-style: italic; padding: .75rem 0; }

.studio-pills { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; align-items: center; }
.studio-pills-sub { margin-top: -.25rem; padding-left: .75rem; border-left: 2px solid var(--border-strong); }
.studio-pill {
    display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--border-strong);
    border-radius: 999px; background: var(--bg-dark-armor); color: var(--text-brushed-aluminum);
    padding: .25rem .75rem; font-size: .85em;
}
.studio-pill.active { border-color: var(--accent-cyan-glow); color: var(--accent-cyan-glow); background: rgba(0, 229, 255, .08); }
.studio-pill-label, .studio-pill-x { background: none; border: none; padding: 0; color: inherit; font-size: 1em; }
.studio-pill-x { color: #fb7185; font-size: 1.05em; line-height: 1; }
.studio-pill-sub { color: var(--text-dim); font-size: .85em; }

.field-card {
    background: var(--studio-card-bg); border: 1px solid var(--studio-card-border); border-radius: 6px;
    padding: .85rem 1rem; margin-bottom: .75rem;
}
.field-card-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.field-card-head h2 { margin: 0; font-size: .95em; }
.derived-badge, .gap-badge {
    margin-left: auto; font-size: .7em; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
    border-radius: 4px; padding: .1rem .45rem; white-space: nowrap;
}
.derived-badge { color: var(--studio-derived); border: 1px solid var(--border-strong); }
.gap-badge { color: var(--studio-gap); border: 1px solid rgba(245, 158, 11, .45); background: rgba(245, 158, 11, .08); }
.gap-elements { font-size: .78em; color: var(--accent-cyan-glow); font-family: Consolas, "SFMono-Regular", Menlo, monospace; }

.kv-grid { display: grid; grid-template-columns: minmax(10rem, 38%) 1fr; margin: 0; }
.kv-grid dt, .kv-grid dd { margin: 0; padding: .32rem .25rem; border-bottom: 1px solid var(--border-subtle); font-size: .9em; }
.kv-grid dt { color: var(--text-dim); }
.kv-grid dd { color: var(--text-brushed-aluminum); display: flex; align-items: baseline; gap: .45rem; flex-wrap: wrap; }
.kv-grid dt:nth-last-child(2), .kv-grid dd:last-child { border-bottom: none; }
.code-badge {
    display: inline-block; min-width: 1.6rem; text-align: center; font-family: Consolas, "SFMono-Regular", Menlo, monospace;
    font-size: .82em; color: var(--accent-cyan-glow); background: rgba(0, 229, 255, .08);
    border: 1px solid rgba(0, 229, 255, .25); border-radius: 4px; padding: 0 .35rem;
}
.code-unknown { color: var(--warn); font-size: .85em; font-style: italic; }

.gap-header { display: flex; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.gap-sections { display: flex; flex-wrap: wrap; gap: .4rem; }
.gap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: .6rem .9rem; }
.gap-field { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.gap-field-wide { grid-column: 1 / -1; }
.gap-field > label, .gap-field > .gap-label { font-size: .8em; color: var(--text-dim); display: flex; align-items: center; gap: .3rem; }
.gap-field select, .gap-field input[type=text] { width: 100%; box-sizing: border-box; font-size: .88em; }
.gap-card .multi-coded { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: .2rem .8rem; }
.gap-card .multi-option { display: flex; align-items: baseline; gap: .35rem; font-size: .85em; color: var(--text-brushed-aluminum); }
.gap-card .multi-option-retired, .gap-retired-note { color: var(--warn); font-style: italic; }
.gap-retired-note { font-size: .78em; }

.studio-copy { margin-left: auto; padding: .25rem .7rem; font-size: .85em; }
.wire-xml {
    margin: 0; max-height: none; overflow: auto; white-space: pre; font-size: .78em; line-height: 1.45;
    background: #111; border: 1px solid var(--studio-card-border); border-radius: 4px; padding: .75rem; color: #cbd5e1;
}

/* ---- Case file: every document in the fatal case (Sean, 2026-09-26) ---- */
.case-file { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.case-file-bar { flex: 0 0 auto; display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; flex-wrap: wrap; }
.case-file-title { font-size: .85em; color: var(--accent-cyan-glow); white-space: nowrap; }
.case-file-picker { flex: 1 1 14rem; min-width: 0; font-size: .85em; padding: .3rem .5rem; }
.case-file-msg { flex: 0 0 auto; font-size: .82em; color: var(--good); margin-bottom: .35rem; }
.case-file-msg.is-error { color: var(--danger); }
.case-file-view { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.report-box .case-file { height: 100%; padding: .5rem; }

.gap-badge-update { color: var(--accent-cyan-glow); border-color: rgba(0, 229, 255, .4); background: rgba(0, 229, 255, .08); }

/* new-document notice strip in the Data Studio */
.studio-notice {
    flex: 0 0 auto; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .4rem 1rem; font-size: .88em;
    color: #fcd34d; background: rgba(245, 158, 11, .08); border-bottom: 1px solid rgba(245, 158, 11, .35);
}
.studio-notice strong { color: #fbbf24; font-weight: 600; }
.studio-notice-actions { margin-left: auto; display: flex; gap: .4rem; }

/* signed-in user, top-right (dev: Switch user) */
.top-user { margin-left: auto; display: inline-flex; align-items: center; gap: .5rem; font-size: .85em; color: var(--text-dim); }
.top-user-dev { font-size: .7em; text-transform: uppercase; letter-spacing: .05em; color: #f59e0b; border: 1px solid rgba(245,158,11,.45); border-radius: 4px; padding: 0 .3rem; }
.top-user-switch { font-size: .9em; padding: .2rem .4rem; }
/* Demo "Try it as" (Sean, 2026-09-28: "slide it left about two inches and make it stand out"). */
.top-user-switch.demo-try {
    margin-right: 2in; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent-glow);
    font-weight: 700; padding: .35rem .7rem; border-radius: 6px; cursor: pointer;
    box-shadow: 0 0 0 2px rgba(0, 229, 255, .25), 0 0 14px rgba(0, 229, 255, .55);
}
.top-user-switch.demo-try:hover { background: var(--accent-glow); }
.top-user-switch.demo-try option { background: var(--bg-dark-armor); color: var(--text-brushed-aluminum); font-weight: 400; }
@media (max-width: 800px) { .top-user-switch.demo-try { margin-right: 0; } }

/* ---- Reading tools + highlight / magnify (Sean, 2026-09-26) ---- */
.studio-readbar { flex: 0 0 auto; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-bottom: .45rem; font-size: .82em; }
.studio-readbar button, .studio-readbar select { padding: .25rem .55rem; font-size: 1em; }
.studio-readbar button[aria-pressed="true"] { border-color: var(--accent-cyan-glow); color: var(--accent-cyan-glow); }
.studio-popout { display: inline-flex; align-items: center; gap: .3rem; color: var(--text-dim); cursor: pointer; }
.studio-popout input { width: auto; margin: 0; }
.rv-frame { background: #0d0d0d; }

/* state-derived rows (grid rows so the reading guide can dim / lift one at a time) */
.kv-grid { display: block; }
.kv-row { display: grid; grid-template-columns: minmax(10rem, 38%) 1fr 2rem; align-items: baseline; border-bottom: 1px solid var(--border-subtle); }
.kv-row:last-child { border-bottom: none; }
.kv-label, .kv-value { padding: .32rem .25rem; font-size: .9em; }
.kv-label { color: var(--text-dim); }
.kv-value { color: var(--text-brushed-aluminum); display: flex; align-items: baseline; gap: .45rem; flex-wrap: wrap; }
.kv-locate { text-align: right; }
.kv-active { background: rgba(0, 229, 255, .07); box-shadow: inset 3px 0 0 var(--accent-cyan-glow); }
.locate-btn { background: none; border: 1px solid transparent; padding: .05rem .3rem; font-size: .9em; cursor: pointer; border-radius: 5px; line-height: 1.2; }
.locate-btn:hover:not(:disabled) { border-color: var(--accent-cyan-glow); }
.field-card-head .locate-btn { font-size: .8em; color: var(--accent-cyan-glow); }

/* reading guide: everything dims, the row you're on (hover or the one you jumped to) stays full */
.fars-studio.rv-guide .kv-row, .fars-studio.rv-guide .gap-field { opacity: .5; transition: opacity .15s ease; }
.fars-studio.rv-guide .kv-row:hover, .fars-studio.rv-guide .kv-row.kv-active,
.fars-studio.rv-guide .gap-field:hover, .fars-studio.rv-guide .gap-field:focus-within { opacity: 1; }

/* scan filters reach the inline report iframe here (a popped-out window colors itself) */
.fars-studio.rv-scan-inverted .rv-frame iframe { filter: invert(1); }
.fars-studio.rv-scan-boosted .rv-frame iframe { filter: contrast(1.6) brightness(1.05); }
.fars-studio.rv-scan-grayscale .rv-frame iframe { filter: grayscale(1) contrast(1.15); }

/* day mode for the Data Studio (the Refinery's review screens have the same choice) */
.fars-studio[data-theme="day"] {
    --bg-matte-carbon: #f7f7f5; --bg-dark-armor: #eef0f2; --bg-dark-armor-raised: #ffffff;
    --text-brushed-aluminum: #16181d; --text-dim: #55606e; --accent-cyan-glow: #007c91;
    --border-subtle: rgba(0,0,0,.08); --border-strong: rgba(0,0,0,.18);
    --studio-card-bg: #ffffff; --studio-card-border: #d7dbe0;
    background: var(--bg-matte-carbon); color: var(--text-brushed-aluminum);
}
.fars-studio[data-theme="day"] h1, .fars-studio[data-theme="day"] h2, .fars-studio[data-theme="day"] h3, .fars-studio[data-theme="day"] .studio-title { color: #16181d; }
.fars-studio[data-theme="day"] button, .fars-studio[data-theme="day"] input, .fars-studio[data-theme="day"] select, .fars-studio[data-theme="day"] textarea {
    background: #ffffff; color: #16181d; border-color: rgba(0,0,0,.25);
}
.fars-studio[data-theme="day"] .btn-primary { background: #007c91; border-color: #007c91; color: #fff; }
.fars-studio[data-theme="day"] .wire-xml { background: #f3f4f6; color: #1f2937; }
.fars-studio[data-theme="day"] .rv-frame { background: #f7f7f5; }

/* public demo banner */
.demo-banner { flex: 0 0 auto; padding: .35rem 1rem; font-size: .85em; color: #fcd34d; background: rgba(245, 158, 11, .1); border-bottom: 1px solid rgba(245, 158, 11, .35); }
.demo-banner strong { color: #fbbf24; }
.demo-reset { margin-left: .75rem; padding: .1rem .6rem; font-size: .95em; background: transparent; color: #fcd34d; border: 1px solid rgba(245,158,11,.5); border-radius: 6px; }
.demo-reset:hover:not(:disabled) { border-color: #fbbf24; }
.demo-manual { margin-left: .5rem; padding: .1rem .7rem; font-size: .95em; font-weight: 600; color: #1a1300; background: #fcd34d; border: 1px solid #fbbf24; border-radius: 6px; text-decoration: none; }
.demo-manual:hover { background: #fde68a; text-decoration: none; }

/* ---- 2026-10-03 break pass, batch 2 ---- */
/* A help tip closed by a second click stays closed until the pointer leaves it (page-theme.js). */
.rf-helptip.rf-helptip-shut .rf-helptip-text { display: none; }

.studio-unsaved { font-size: .85em; font-weight: 600; color: var(--warn); white-space: nowrap; }
.studio-notice-hint { font-size: .85em; color: var(--text-dim); font-style: italic; }
.gap-field input.gap-invalid, .gap-field select.gap-invalid { border-color: var(--danger); }
.gap-field .multi-coded.gap-invalid { outline: 1px solid var(--danger); outline-offset: 3px; border-radius: 4px; }
.gap-invalid-note { font-size: .78em; color: var(--danger); }
/* A repeating result row inside a gap card (drug toxicology), and the text box of a "[Specify:]" code. */
.gap-row { border-top: 1px solid var(--border-strong); margin-top: .7rem; padding-top: .5rem; }
.gap-row-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .35rem; font-size: .85em; }
.gap-row-btn { font-size: .8em; margin-top: .5rem; }
.gap-row-head .gap-row-btn { margin-top: 0; }
.gap-specify { margin-top: .3rem; }
.manual-link { font-size: .8em; white-space: nowrap; text-decoration: none; }
.manual-link-row { font-size: .85em; color: var(--text-dim); margin-bottom: .5rem; display: flex; align-items: center; gap: .4rem; }
/* The manual's checks on the coding: "must" (stops Send) and "should / unlikely" (review only). */
.fars-checks { margin: .5rem 0; padding: .45rem .7rem; border: 1px solid var(--border-strong); border-radius: 6px; font-size: .85em; }
.fars-checks summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: .8rem; align-items: baseline; }
.fars-checks ul { margin: .4rem 0 .2rem 1.1rem; padding: 0; }
.fars-checks li { margin: .15rem 0; }
.fars-checks-must { color: var(--danger); }
.fars-checks-review { color: var(--warn); }
.fars-checks-note { margin-top: .4rem; color: var(--text-dim); }
.fars-studio[data-theme="day"] .fars-checks-must { color: #991b1b; }
.fars-studio[data-theme="day"] .fars-checks-review { color: #92400e; }
/* All five tabs stay on screen at 1366 wide - they wrap instead of running off the right edge. */
.studio-tabs { flex-wrap: wrap; overflow-x: visible; row-gap: .25rem; }
/* Admin: the result of an edit stays in view however far down the row is. */
.admin-msg { position: sticky; top: 0; z-index: 20; background: var(--bg-matte-carbon); padding: .15rem 0; }
.admin-msg p { margin: .25rem 0; }

/* Day mode: status colours dark enough to read on a light page (the night-mode ones measured
   1.7:1 - 3.1:1 there). Each of these is at least 4.5:1 on white. */
main[data-theme="day"], .fars-studio[data-theme="day"] {
    --good: #047857; --warn: #92400e; --danger: #b91c1c;
    --studio-derived: #4b5563; --studio-gap: #92400e;
}
main[data-theme="day"] .rf-fars-pill-open, .fars-studio[data-theme="day"] .rf-fars-pill-open { color: #92400e; background: rgba(217,119,6,.14); border-color: rgba(146,64,14,.5); }
main[data-theme="day"] .rf-fars-pill-matched, .fars-studio[data-theme="day"] .rf-fars-pill-matched { color: #065f46; background: rgba(16,185,129,.14); border-color: rgba(6,95,70,.5); }
main[data-theme="day"] .rf-fars-pill-transmitted, .fars-studio[data-theme="day"] .rf-fars-pill-transmitted { color: #075985; background: rgba(2,132,199,.1); border-color: rgba(7,89,133,.45); }
main[data-theme="day"] .rf-fcm-banner { color: #065f46; border-color: rgba(6,95,70,.5); }
main[data-theme="day"] .rf-fcm-reject button { color: #be123c; border-color: rgba(190,18,60,.6); }
main[data-theme="day"] .gap-badge, .fars-studio[data-theme="day"] .gap-badge { border-color: rgba(146,64,14,.5); }
main[data-theme="day"] .gap-badge-update, .fars-studio[data-theme="day"] .gap-badge-update { color: #075985; border-color: rgba(7,89,133,.45); background: rgba(2,132,199,.08); }
main[data-theme="day"] .studio-tab.studio-tab-gap, .fars-studio[data-theme="day"] .studio-tab.studio-tab-gap { color: #075985; border-color: #075985; }
.fars-studio[data-theme="day"] .studio-warning { color: #991b1b; }
.studio-management {
    flex: 0 0 auto; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .45rem 1rem;
    font-size: .85em; background: var(--bg-dark-armor-raised); border-bottom: 1px solid var(--border-strong);
}
.studio-management textarea { flex: 1 1 22rem; min-width: 14rem; }

/* ---- 2026-10-03 break pass, batch 4 ---- */
.rf-helptip.rf-helptip-left .rf-helptip-text { left: auto; right: 0; }
.date-invalid { border-color: var(--danger) !important; }
.date-invalid-note { font-size: .78em; color: var(--danger); }
/* A long unbroken name wraps instead of pushing the next columns off the card. */
.panel td, .rf-fcm-detail-card li, .rf-fars-table td, .rf-fs-table td { overflow-wrap: anywhere; }
/* The scan filter also applies to case-file documents shown in the browser's own viewer. */
.fars-studio.rv-scan-inverted .document-pane .rf-report-frame:not(.rv-frame) :is(iframe, img) { filter: invert(1); }
.fars-studio.rv-scan-boosted .document-pane .rf-report-frame:not(.rv-frame) :is(iframe, img) { filter: contrast(1.6) brightness(1.05); }
.fars-studio.rv-scan-grayscale .document-pane .rf-report-frame:not(.rv-frame) :is(iframe, img) { filter: grayscale(1) contrast(1.15); }
.fars-studio[data-theme="day"] .studio-notice { color: #7c2d12; background: rgba(217, 119, 6, .12); border-bottom-color: rgba(146, 64, 14, .4); }
.fars-studio[data-theme="day"] .studio-notice strong { color: #7c2d12; }
.studio-status.studio-working { color: var(--text-dim); font-style: italic; }

/* ---- FARS Manifest's own fixes on top of the copied Refinery styles (kept apart so a re-copy of the
   blocks above doesn't lose them). Tester, 2026-10-04: at 768-1100 px the New pre-report card's
   dropdowns stuck out of the card and worklist buttons were cut off or wrapped out of their border. */
.rf-fars-row2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.rf-fars-field { min-width: 0; }
.rf-fars-field input, .rf-fars-field select, .rf-fars-field textarea { width: 100%; min-width: 0; box-sizing: border-box; }
.rf-fars-ghost-btn { display: inline-block; white-space: nowrap; text-decoration: none; }
form.rf-fcm-reject { margin: 1rem 0 0; }   /* a form now, but still the box below Confirm match - keep its gap */
@media (max-width: 1100px) {
    .rf-fars-grid { flex-direction: column; align-items: stretch; }
    .rf-fars-left, .rf-fars-right { flex: 1 1 auto; width: 100%; }
}

/* Batch 7 (blind round 4). */
h1.studio-title { margin: 0; font-size: 1em; }
.gap-field input.gap-upper { text-transform: uppercase; }
.gap-field input.gap-upper::placeholder { text-transform: none; }
/* Long unbroken text (a pasted note with no spaces) wraps inside its card. */
.panel p, .panel h1, .rf-fcm-detail-card, .rf-fcm-detail-card div, .studio-warning, .studio-notice { overflow-wrap: anywhere; }
/* A crash key or FARS code never breaks mid-number. */
.rf-fars-table code, .rf-fs-table code { white-space: nowrap; }
.fars-code-edit { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-size: .9em; }
.fars-code-edit label { color: var(--text-dim); }

/* Batch 8 (blind round 5). */
h1.page-h1 { font-size: 1.15rem; margin-top: 0; }
.rf-fcm-dismissed-banner, .rf-fcm-dismissed-banner div { overflow-wrap: anywhere; }
#rv-status button { font: inherit; }

/* Batch 9: the two searches. */
.rf-fs-scope { display: flex; flex-wrap: wrap; align-items: center; gap: .9rem; margin-bottom: .6rem; font-size: .9em; }
.rf-fs-scope > span { color: var(--text-dim); }
.rf-fs-scope label { display: inline-flex; align-items: center; gap: .3rem; cursor: pointer; }
.rf-fs-notqueue { color: var(--warn); font-size: .85em; }
.rf-fs-toggle { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 999px; overflow: hidden; }
.rf-fs-toggle button { border: 0; border-radius: 0; background: transparent; color: var(--text-brushed-aluminum); padding: .3rem .9rem; font-size: 1em; cursor: pointer; }
.rf-fs-toggle button.on { background: rgba(0,229,255,.12); color: var(--accent-cyan-glow); font-weight: 600; }
.rf-fs-toggle button:focus-visible { outline: 2px solid var(--accent-cyan-glow); outline-offset: -2px; }
main[data-theme="day"] .rf-fs-toggle button.on { background: rgba(2,132,199,.12); color: #075985; }

/* Batch 10 (blind round 6). */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.rf-fars-tabs-head { display: flex; align-items: center; gap: .4rem; font-size: 1em; margin: 0 0 .5rem; }
/* A link styled as an outline button looks like the button: it had no padding of its own. */
a.rf-btn-outline { display: inline-block; padding: .35rem .8rem; border-radius: 8px; text-decoration: none; line-height: 1.2; }
a.rf-btn-outline.manual-link { padding: .25rem .6rem; }
.demo-manual, .demo-reset { white-space: nowrap; display: inline-block; }
.field-card-head h2, .gap-label, .gap-label label, .gap-elements, .studio-pill, .studio-pill-label { overflow-wrap: anywhere; min-width: 0; }
.alert-banner { overflow-wrap: anywhere; }
/* A select-all group's name looks like any other field's label. */
.gap-field .gap-label > span[id] { color: var(--text); font-size: .85rem; font-weight: 500; }

/* Batch 11 (blind round 7): the search table scrolls sideways on a narrow screen instead of clipping
   its last column or breaking words mid-way. */
.rf-fs-table { min-width: 62rem; }
.rf-fs-table td { overflow-wrap: break-word; }

/* Batch 12 (blind round 8). A phone-width window (390 px): the top bar wraps instead of pushing the
   user switcher off the right edge (the whole page scrolled sideways), and the case page stacks the
   report above the coding instead of squeezing both into two narrow columns. */
@media (max-width: 700px) {
    .top-row { flex-wrap: wrap; gap: .35rem .9rem; }
    .top-row nav { flex-wrap: wrap; gap: .35rem .9rem; }
    .top-user { margin-left: 0; flex: 1 1 100%; flex-wrap: wrap; min-width: 0; }
    .top-user-switch { max-width: 100%; }
    main:has(.fars-studio) { overflow-y: auto; display: block; }
    .fars-studio { height: auto; }
    .studio-bar { position: static; }
    .studio-actions { margin-left: 0; flex-wrap: wrap; }
    .studio-body { flex-direction: column; }
    .document-pane { flex: 0 0 auto; width: auto; height: 70vh; border-right: 0; border-bottom: 1px solid var(--border-strong); }
    .coding-pane { flex: 0 0 auto; }
}
/* A column of buttons has a heading only a screen reader hears. The hidden text is absolutely placed, so
   its cell anchors it - otherwise, in a table scrolled sideways, it sat outside the scroll box and
   widened the whole page. */
th:has(> .sr-only) { position: relative; }
