:root {
  color-scheme: dark;
  --bg: #111519;
  --panel: #1a2025;
  --panel-hi: #20282e;
  --line: #343d44;
  --text: #f0f3f4;
  --muted: #a5b0b6;
  --soft: #77848b;
  --accent: #e2593a;
  --accent-hi: #f06b4b;
  --green: #65c99b;
  --yellow: #e7bd5a;
  --red: #ef7c70;
  --blue: #6faee4;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; color: var(--text); background: var(--bg); min-height: 100vh; font-size: 15px; line-height: 1.45; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { display: none !important; }
a { color: inherit; }

.app-shell { min-height: 100vh; }
.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px clamp(16px, 3vw, 42px); border-bottom: 1px solid #2b3338; background: #151a1e; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: 0; }
.brand-mark { display: grid; place-items: center; width: 43px; height: 43px; flex: 0 0 43px; border-radius: 12px; background: #b94730; color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .02em; box-shadow: inset 0 1px 0 #ffffff36; }
.brand-copy { display: grid; min-width: 0; }
.brand-copy strong { font-size: 15px; line-height: 1.2; }
.brand-copy small { color: var(--muted); margin-top: 3px; font-size: 12px; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.connection-state { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; margin-right: 7px; white-space: nowrap; }
.connection-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 0 3px #e7bd5a19; }
.connection-state.ready i { background: var(--green); box-shadow: 0 0 0 3px #65c99b19; }
.connection-state.error i { background: var(--red); box-shadow: 0 0 0 3px #ef7c7019; }

.button, .icon-button, .text-button, .back-button, .zoom-label { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 9px 14px; border: 1px solid transparent; border-radius: 10px; text-decoration: none; cursor: pointer; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.button { background: var(--panel-hi); border-color: #3b464d; color: var(--text); font-weight: 650; }
.button:hover, .icon-button:hover, .zoom-label:hover { background: #2a343b; border-color: #617078; }
.button:active, .icon-button:active { transform: translateY(1px); }
.button.primary { background: var(--accent); border-color: var(--accent); color: white; }
.button.primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
.button.subtle { background: #20262b; border-color: #394249; }
.button.success { background: #26684d; border-color: #377b5d; }
.button.success:hover { background: #2d7858; }
.button.text-danger { border-color: transparent; background: transparent; color: var(--red); }
.button.small { min-height: 36px; padding: 6px 10px; font-size: 13px; }
.button.full { width: 100%; }
.button:disabled, button:disabled { cursor: not-allowed; opacity: .46; transform: none; }
.text-button { min-height: 36px; border: 0; background: transparent; padding: 5px 7px; color: #ef937e; font-weight: 600; }
.text-button:hover { color: #ffb19c; background: #e2593a18; }
.back-button { min-width: 86px; border-color: #364149; background: #1a2025; color: var(--muted); }
.back-button:hover { color: var(--text); border-color: #687780; }
.icon-button { width: 40px; padding: 0; background: #20272c; border-color: #38434a; font-size: 23px; line-height: 1; }
.zoom-label { min-width: 52px; background: transparent; border-color: transparent; color: var(--muted); font-size: 12px; }

.home-view { width: min(1150px, calc(100% - 32px)); margin: 0 auto; padding: clamp(28px, 5vw, 62px) 0 72px; }
.home-intro { max-width: 700px; margin: 0 auto 34px; text-align: center; }
.eyebrow { margin: 0 0 7px; color: #e98b73; font-size: 11px; line-height: 1.3; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.home-intro h1 { margin: 0; font-size: clamp(32px, 5vw, 54px); line-height: 1.04; letter-spacing: -.035em; }
.home-intro h1 span { color: #b5c1c7; }
.intro-copy { max-width: 600px; margin: 16px auto 0; color: var(--muted); font-size: 16px; }
.upload-card, .panel, .projects-section { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: 0 12px 35px #00000012; }
.upload-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; padding: 22px 24px; }
.upload-copy { display: flex; align-items: center; gap: 14px; min-width: 0; }
.upload-icon { display: grid; place-items: center; width: 48px; height: 48px; flex: 0 0 48px; border-radius: 14px; background: #e2593a21; color: #ff9d84; font-size: 28px; }
.upload-copy h2, .projects-section h2 { margin: 0; font-size: 19px; }
.upload-copy p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.upload-zone { min-width: 225px; display: inline-flex; align-items: center; justify-content: flex-end; gap: 12px; cursor: pointer; }
.upload-progress-panel { display: grid; flex: 1 0 100%; gap: 6px; padding: 12px; border: 1px solid #3a454d; border-radius: 10px; background: #171e22; }
.upload-progress-heading { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.upload-progress-heading span { color: #ef9a81; font-variant-numeric: tabular-nums; }
.upload-progress-panel progress { width: 100%; height: 9px; overflow: hidden; border: 0; border-radius: 999px; accent-color: var(--accent); }
.upload-progress-panel progress::-webkit-progress-bar { border-radius: 999px; background: #343d44; }
.upload-progress-panel progress::-webkit-progress-value { border-radius: 999px; background: linear-gradient(90deg, #e2593a, #efaa75); }
.upload-progress-panel progress::-moz-progress-bar { border-radius: 999px; background: linear-gradient(90deg, #e2593a, #efaa75); }
.upload-progress-detail { font-size: 11px; }
.upload-zone.dragging { border-radius: 13px; outline: 2px dashed var(--accent); outline-offset: 8px; }
.upload-note { color: var(--muted); font-size: 12px; }
.projects-section { margin-top: 30px; padding: 21px 23px 23px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 15px; }
.section-heading .eyebrow { margin-bottom: 3px; }
.project-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.project-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; padding: 14px; border: 1px solid #374149; border-radius: 12px; background: #20272c; cursor: pointer; text-align: left; }
.project-card:hover { border-color: #74848c; background: #252e34; }
.project-card .project-details { min-width: 0; }
.project-card strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.project-card small { display: block; margin-top: 4px; color: var(--muted); }
.project-card .project-arrow { flex: 0 0 auto; color: #f18d73; font-size: 21px; }
.empty-message { padding: 24px; color: var(--muted); text-align: center; border: 1px dashed #46525a; border-radius: 12px; }

.workspace { padding: 22px clamp(12px, 2vw, 28px) 50px; }
.workspace-heading { display: flex; align-items: center; gap: 15px; max-width: 1800px; margin: 0 auto 17px; }
.document-heading { min-width: 0; flex: 1; }
.document-heading .eyebrow { margin-bottom: 2px; color: var(--muted); }
.document-heading h1 { overflow: hidden; margin: 0; font-size: clamp(18px, 2vw, 25px); text-overflow: ellipsis; white-space: nowrap; }
.coverage-badge, .model-badge, .status-pill { display: inline-flex; align-items: center; min-height: 26px; padding: 4px 9px; border: 1px solid #48545c; border-radius: 999px; background: #222a30; color: #c0cbd0; font-size: 11px; font-weight: 700; white-space: nowrap; }
.coverage-badge.done, .status-pill.pass { color: var(--green); border-color: #3f805f; background: #204333; }
.coverage-badge.pending, .status-pill.working { color: var(--yellow); border-color: #826d35; background: #453b22; }
.status-pill.fail { color: var(--red); border-color: #81423d; background: #462925; }
.model-badge { border-color: #725346; background: #3a2b25; color: #f0ac91; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(390px, .9fr); align-items: start; gap: 16px; max-width: 1800px; margin: 0 auto; }
.viewer-column, .controls-column { display: grid; align-content: start; gap: 14px; min-width: 0; }
.panel { min-width: 0; padding: 16px; }
.viewer-panel { overflow: hidden; padding: 0; }
.viewer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #343d44; background: #1d2429; }
.page-controls, .zoom-controls { display: flex; align-items: center; gap: 7px; }
.page-preview-button { margin-left: auto; }
.page-input-label { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; }
.page-input-label input { width: 64px; height: 38px; padding: 5px 8px; border: 1px solid #48535a; border-radius: 8px; outline: 0; background: #11161a; color: var(--text); text-align: center; }
.page-input-label input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: #e98972; box-shadow: 0 0 0 3px #e2593a20; }
.page-input-label b { color: var(--text); }
.viewer-scroll { position: relative; display: flex; align-items: flex-start; justify-content: center; min-height: 390px; max-height: min(72vh, 920px); overflow: auto; padding: 18px; background: #0c1013; scrollbar-color: #56646b #151a1e; }
.page-image-shell { position: relative; flex: 0 0 auto; width: 100%; max-width: none; margin: auto; line-height: 0; box-shadow: 0 5px 20px #0009; }
.page-image-shell img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-drag: none; touch-action: none; }
.page-image-shell img:not([src]) { visibility: hidden; }
.selection-box { position: absolute; z-index: 3; border: 2px solid #ff845f; background: #ff845f30; box-shadow: 0 0 0 9999px #0004; pointer-events: none; }
.page-image-shell.selecting { cursor: crosshair; }
.selection-panel { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 9px 14px; border-top: 1px solid #343d44; background: #1d2429; }
.selection-panel > span { flex: 1 1 auto; color: var(--muted); font-size: 12px; }
.queue-selected-button { margin: 0 0 9px; }
.viewer-message { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); pointer-events: none; }
.viewer-help { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid #343d44; color: var(--muted); font-size: 12px; }
.viewer-help > span:nth-child(2) { flex: 1 1 180px; }
.drag-icon { color: #ef957b; font-size: 18px; }
.restore-settings { margin: 12px 0; border: 1px solid #38434a; border-radius: 9px; background: #171d21; }
.restore-settings > summary { min-height: 42px; padding: 12px; color: #e2e8ea; font-size: 12px; font-weight: 700; cursor: pointer; }
.restore-settings[open] > summary { border-bottom: 1px solid #38434a; }
.restore-settings .prompt-controls { padding: 12px; }
.crop-editor { border-color: #64463d; background: #211e1d; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.panel-heading .eyebrow { margin-bottom: 3px; }
.panel-heading h2, .page-review-copy h2 { margin: 0; font-size: 17px; line-height: 1.25; }
.text-button, .text-link { color: #ef9a81; font-size: 13px; }
.crop-fields { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; }
.field { display: grid; align-content: start; gap: 5px; min-width: 0; color: var(--muted); font-size: 12px; }
.field > span { color: #d4dcdf; font-weight: 650; }
.field small { color: var(--soft); font-weight: 450; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; min-height: 40px; padding: 9px 10px; border: 1px solid #465159; border-radius: 9px; outline: 0; background: #11171a; color: var(--text); }
.field textarea { min-height: 126px; resize: vertical; font-size: 13px; line-height: 1.45; }
.field select { appearance: auto; }
.crop-actions, .page-review-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.page-review-panel { display: grid; gap: 12px; }
.page-review-copy p:not(.eyebrow) { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.check-row { display: flex; align-items: flex-start; gap: 9px; color: #d6dddf; font-size: 12px; line-height: 1.4; cursor: pointer; }
.check-row input { width: 18px; height: 18px; flex: 0 0 18px; margin: 0; accent-color: #e2593a; }
.page-review-actions { margin-top: 0; }
.muted { color: var(--muted); }
.restore-panel { padding: 16px; }
.panel-copy { margin: 0 0 13px; color: var(--muted); font-size: 12px; }
.warning-message { margin: 10px 0; padding: 10px 12px; border: 1px solid #805a31; border-radius: 9px; background: #3a2f1e; color: #f2d38f; font-size: 12px; }
.full-manual-button { width: 100%; margin: 4px 0 0; }
.manual-batch-note { margin: 6px 0 12px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.page-proof-note { margin: 8px 0 0; font-size: 11px; line-height: 1.45; }
.prompt-controls { display: grid; gap: 9px; }
.prompt-controls .field textarea { min-height: 132px; }
.prompt-save-row { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.prompt-save-row .muted { min-width: 0; flex: 1; font-size: 11px; }
.settings-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.settings-actions { display: flex; align-items: center; justify-content: space-between; min-height: 30px; margin-top: -6px; font-size: 11px; }
.prompt-memo { border-top: 1px solid #354049; padding-top: 8px; color: var(--muted); font-size: 12px; }
.prompt-memo summary { color: #d5dfe2; cursor: pointer; font-weight: 650; }
.prompt-memo p { margin: 7px 0 2px; }
.prompt-memo pre { margin: 8px 0 2px; max-height: 280px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); background: #101519; border: 1px solid #313b43; border-radius: 8px; padding: 10px; font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }
.queue-start-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 13px; padding-top: 12px; border-top: 1px solid #364048; }
.queue-start-row > div { display: grid; align-content: center; gap: 0; }
.queue-start-row strong { font-size: 13px; }
.queue-start-row .text-button { justify-content: flex-start; padding-left: 0; font-size: 11px; }
.queue-panel { margin-top: 13px; padding: 11px; border: 1px solid #47545b; border-radius: 10px; background: #20282d; }
.queue-status-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.queue-status-row > div { display: grid; gap: 3px; }
.queue-status-row strong { font-size: 13px; }
.queue-status-row .muted { font-size: 11px; }
.queue-progress { height: 7px; overflow: hidden; margin-top: 10px; border-radius: 999px; background: #374148; }
.queue-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #e2593a, #efaa75); transition: width .25s ease; }
.queue-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px 12px; margin-top: 8px; color: var(--muted); font-size: 11px; }
.queue-actions { display: flex; gap: 7px; margin-top: 9px; }
.figure-list-heading { display: flex; align-items: center; justify-content: space-between; margin-top: 17px; margin-bottom: 7px; }
.figure-list-heading h3 { margin: 0; font-size: 14px; }
.figure-list { display: grid; gap: 7px; max-height: 300px; overflow: auto; padding-right: 2px; }
.figure-row { display: grid; grid-template-columns: 18px 49px minmax(0, 1fr) auto; align-items: center; gap: 9px; min-height: 62px; padding: 6px 8px; border: 1px solid #3a454d; border-radius: 10px; background: #20272c; cursor: pointer; }
.figure-row.selected { border-color: #cc7058; background: #302723; }
.figure-row > input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }
.figure-row img { width: 49px; height: 49px; border: 1px solid #465159; border-radius: 6px; background: #f1f1ed; object-fit: contain; }
.figure-row-copy { min-width: 0; }
.figure-row-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.figure-row-copy small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.figure-status { color: #c7d0d3; font-size: 10px; font-weight: 700; white-space: nowrap; }
.figure-status.approved { color: var(--green); }
.figure-status.needs-review { color: var(--yellow); }
.figure-status.failed { color: var(--red); }
.figure-empty { padding: 14px 10px; border: 1px dashed #465159; border-radius: 10px; color: var(--muted); font-size: 12px; text-align: center; }

.review-panel { border-color: #594b40; }
.review-panel > .panel-heading { align-items: center; }
.review-panel .panel-heading select { max-width: 155px; min-height: 36px; padding: 5px 7px; border: 1px solid #465159; border-radius: 8px; background: #11171a; color: var(--text); font-size: 11px; }
.review-comparison-hint { margin: 0 0 7px; color: var(--muted); font-size: 11px; }
.candidate-view-controls { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 7px; }
.candidate-view-controls[hidden] { display: none; }
.candidate-view-button { min-height: 34px; padding: 6px 10px; border: 1px solid #465159; border-radius: 7px; background: #1c2327; color: #c5d0d3; font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; }
.candidate-view-button:hover { border-color: #9b624e; color: var(--text); }
.candidate-view-button.selected, .candidate-view-button[aria-pressed="true"] { border-color: #c76d53; background: #3a2923; color: #ffb398; }
.raw-flux-warning { margin: 0 0 7px; padding: 7px 9px; border: 1px solid #80663a; border-radius: 7px; background: #30291d; color: #f0d99e; font-size: 11px; line-height: 1.4; }
.raw-flux-warning[hidden] { display: none; }
.comparison-image { display: grid; grid-template-rows: auto minmax(120px, 220px); align-content: start; gap: 6px; min-width: 0; padding: 7px; border: 1px solid #424e55; border-radius: 9px; background: #13181b; cursor: zoom-in; }
.comparison-image span { color: var(--muted); font-size: 11px; font-weight: 700; text-align: left; }
.comparison-image img { display: block; width: 100%; height: 100%; object-fit: contain; background: #eeefed; }
.candidate-comparison img { background: #20262a; }
.candidate-comparison { width: 100%; grid-template-rows: auto minmax(270px, min(58vh, 680px)); }
.candidate-comparison img { min-height: 0; }
.review-tabs { display: flex; gap: 5px; margin: 11px 0 0; border-bottom: 1px solid #354049; }
.review-tab { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; margin-bottom: -1px; padding: 7px 11px; border: 0; border-bottom: 2px solid transparent; border-radius: 7px 7px 0 0; background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.review-tab:hover { background: #222a30; color: var(--text); }
.review-tab.selected, .review-tab[aria-selected="true"] { border-bottom-color: var(--accent); color: #f2a28a; }
.review-tab-count { display: inline-grid; min-width: 19px; min-height: 19px; place-items: center; padding: 0 5px; border: 1px solid #65513a; border-radius: 999px; background: #30291e; color: #efd29b; font-size: 10px; }
.review-tabpanel[hidden], .text-review-panel[hidden] { display: none; }
.attempt-details { margin-top: 8px; border-top: 1px solid #354049; padding-top: 7px; color: var(--muted); font-size: 11px; }
.attempt-details summary { color: #d5dfe2; cursor: pointer; font-weight: 650; }
.attempt-meta { min-height: 18px; margin: 8px 0; color: var(--muted); font-size: 10px; }
.text-review-panel { display: grid; gap: 9px; margin: 10px 0; padding: 11px; border: 1px solid #3c4a50; border-radius: 10px; background: #171e22; }
.preview-only-note { margin: 0; padding: 8px 9px; border: 1px solid #80663a; border-radius: 7px; background: #30291d; color: #f0d99e; font-size: 11px; }
.text-review-panel h3 { margin: 0; font-size: 14px; }
.text-review-panel .eyebrow { margin: 0 0 3px; }
.text-review-panel p.muted { margin: 5px 0 0; font-size: 11px; }
.text-line-details { border-top: 1px solid #354049; padding-top: 8px; color: var(--muted); font-size: 12px; }
.text-line-details summary { cursor: pointer; color: #d5dfe2; font-weight: 650; }
.text-line-details summary span { color: var(--muted); font-weight: 450; }
.text-line-help { margin: 7px 0; font-size: 11px; }
.text-line-list { display: grid; gap: 7px; max-height: 330px; overflow: auto; padding: 2px 3px 2px 0; }
.text-line-row { display: grid; gap: 4px; padding: 8px; border: 1px solid #364149; border-radius: 8px; background: #20272c; }
.text-line-row.mismatch { border-color: #795a38; background: #2b261e; }
.text-line-source, .text-line-generated { display: block; overflow-wrap: anywhere; color: #d4dcdf; font-size: 11px; line-height: 1.35; }
.text-line-generated { color: #c1ccd0; }
.text-line-row.edited { border-color: #6b906f; }
.text-line-editor { display: grid; grid-template-columns: minmax(0, 1fr); align-items: stretch; gap: 7px; }
.text-line-correction-label { color: var(--muted); font-size: 10px; font-weight: 700; }
.text-line-input { width: 100%; min-width: 0; min-height: 40px; padding: 7px 9px; border: 1px solid #465159; border-radius: 7px; background: #11171a; color: var(--text); font-size: 13px; }
.text-review-panel > .check-row { padding-top: 8px; border-top: 1px solid #354049; }
.text-review-panel #applyTextCorrections { min-height: 36px; margin-top: 8px; font-size: 12px; }
.approval-checks { display: grid; gap: 7px; padding: 9px 0; border-top: 1px solid #354049; }
.approval-blocked-note { margin: 8px 0; padding: 9px 10px; border: 1px solid #80663a; border-radius: 7px; background: #30291d; color: #f0d99e; font-size: 12px; line-height: 1.4; }
.review-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 5px; }
.master-panel { border-color: #3f594c; }
.master-panel > .panel-heading { align-items: center; }
.master-panel .panel-copy { margin-top: 0; }
.master-counts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.master-counts > div { display: grid; gap: 2px; padding: 10px 11px; border: 1px solid #39474a; border-radius: 9px; background: #1e2728; }
.master-counts strong { font-size: 17px; }
.master-counts span { color: var(--muted); font-size: 11px; }
.master-progress-panel { margin-top: 10px; }
.master-progress-panel p { margin: 6px 0; color: var(--muted); font-size: 11px; }
.master-checks { display: grid; gap: 6px; margin: 12px 0 5px; padding: 0; list-style: none; }
.master-checks li { display: flex; align-items: flex-start; gap: 7px; color: #cdd5d7; font-size: 11px; }
.master-checks li::before { content: "✓"; color: var(--green); font-weight: 900; }
.proof-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.proof-list button { border: 1px solid #45524e; border-radius: 7px; padding: 6px 8px; background: #202a28; color: #c8d5ce; font-size: 10px; cursor: pointer; }
.text-link { display: inline-block; margin-top: 11px; text-decoration: underline; text-underline-offset: 3px; }

.login-screen { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 18px; background: radial-gradient(ellipse at 50% 0%, #2c2926 0%, var(--bg) 55%); }
.login-card { width: min(420px, 100%); padding: 28px; border: 1px solid #454e53; border-radius: 18px; background: #1b2125; box-shadow: 0 28px 90px #0008; }
.login-card .brand-mark { margin-bottom: 17px; }
.login-card h1 { margin: 0; font-size: 25px; }
.login-card .muted { margin: 7px 0 20px; font-size: 13px; }
.login-card .field { margin-bottom: 12px; }
.error-text { min-height: 18px; margin: 9px 0 0; color: #f39a8d; font-size: 12px; }
.lightbox { position: fixed; z-index: 80; inset: 0; display: grid; place-items: center; padding: clamp(12px, 4vw, 48px); background: #07090beF; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 20px 70px #000a; }
.lightbox-close { position: absolute; top: 12px; right: 14px; display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid #68737a; border-radius: 50%; background: #20272c; font-size: 30px; cursor: pointer; }
.toast { position: fixed; z-index: 120; right: 18px; bottom: max(18px, env(safe-area-inset-bottom)); width: min(430px, calc(100% - 36px)); padding: 13px 16px; border: 1px solid #506059; border-radius: 12px; background: #23352c; color: #e2f5e9; box-shadow: 0 12px 35px #0008; font-size: 13px; }
.toast.error { border-color: #804843; background: #3b2422; color: #ffe6e2; }
.toast.info { border-color: #46525a; background: #20282e; color: #e9eff1; }

@media (max-width: 1050px) {
  .workspace-grid { grid-template-columns: minmax(0, 1fr) minmax(360px, .95fr); gap: 12px; }
  .panel { padding: 13px; }
  .crop-fields { grid-template-columns: 1fr 1fr; }
  .crop-fields .field:first-child { grid-column: 1 / -1; }
}
@media (max-width: 850px) {
  .workspace-grid { grid-template-columns: minmax(0, 1fr); }
  .viewer-scroll { max-height: 68vh; min-height: 300px; }
  .controls-column { grid-template-columns: minmax(0, 1fr); }
  .figure-list { max-height: 360px; }
}
@media (max-width: 620px) {
  .topbar { min-height: 62px; padding: 8px 12px; gap: 8px; }
  .brand { gap: 8px; }
  .brand-mark { width: 37px; height: 37px; flex-basis: 37px; border-radius: 10px; }
  .brand-copy strong { max-width: 190px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
  .brand-copy small { font-size: 10px; }
  .top-actions { gap: 5px; }
  .viewer-help { flex-wrap: wrap; }
  .viewer-help > span:nth-child(2) { flex-basis: 100%; }
  .selection-panel { flex-wrap: wrap; }
  .selection-panel > span { flex-basis: 100%; }
  .connection-state { margin-right: 0; font-size: 0; }
  .connection-state i { width: 9px; height: 9px; }
  .legacy-link { display: none; }
  .top-actions .button { min-height: 36px; padding: 6px 9px; font-size: 11px; }
  .home-view { width: calc(100% - 24px); padding-top: 34px; }
  .home-intro { margin-bottom: 24px; }
  .home-intro h1 { font-size: clamp(31px, 10vw, 43px); }
  .intro-copy { font-size: 14px; }
  .upload-card { display: grid; gap: 17px; padding: 16px; }
  .upload-zone { min-width: 0; justify-content: flex-start; }
  .project-list { grid-template-columns: minmax(0, 1fr); }
  .projects-section { padding: 16px; }
  .workspace { padding: 13px 9px 35px; }
  .workspace-heading { gap: 8px; margin-bottom: 12px; }
  .back-button { min-width: 45px; padding: 6px; font-size: 20px; }
  .back-button span { display: none; }
  .document-heading h1 { font-size: 17px; }
  .coverage-badge { padding: 4px 7px; font-size: 9px; }
  .workspace-grid { gap: 10px; }
  .viewer-toolbar { flex-wrap: wrap; padding: 8px; }
  .viewer-toolbar .page-preview-button { flex: 1 0 100%; margin-left: 0; }
  .viewer-scroll { min-height: 270px; max-height: 63vh; padding: 10px; }
  .page-input-label input { width: 53px; }
  .zoom-controls { gap: 4px; }
  .icon-button { width: 38px; }
  .viewer-help { font-size: 11px; }
  .viewer-help { align-items: flex-start; flex-wrap: wrap; }
  .panel { border-radius: 13px; padding: 12px; }
  .viewer-panel { padding: 0; }
  .crop-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .settings-row { grid-template-columns: 1fr 1fr; }
  .comparison-image { grid-template-rows: auto minmax(100px, 175px); padding: 5px; }
  .candidate-comparison { grid-template-rows: auto minmax(230px, 52vh); }
  .review-panel .panel-heading select { max-width: 120px; }
  .queue-start-row { align-items: flex-end; }
  .queue-start-row .button { max-width: 165px; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
