@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/manrope/Manrope-Variable.ttf") format("truetype");
}
:root {
  color-scheme: light;
  --bg: #f4f3ee;
  --surface: #fffefa;
  --surface-2: #eeeee7;
  --sidebar: #1e302b;
  --text: #242d28;
  --muted: #646b62;
  --line: #dedfd5;
  --primary: #285345;
  --primary-dark: #1d4034;
  --primary-soft: #e7eee5;
  --teal: #35745b;
  --blue: #476378;
  --amber: #896023;
  --red: #a7463c;
  --success-bg: #eaf0e6;
  --warning-bg: #f7efd9;
  --info-bg: #eaf0f3;
  --danger-bg: #f7eae6;
  --radius: 5px;
  --sidebar-width: 248px;
  --page-gutter: 36px;
  --font-sans: "Manrope", "Manrope Fallback", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141d2b;
  --surface: #1c283a;
  --surface-2: #263449;
  --sidebar: #193b72;
  --text: #e3e9f2;
  --muted: #a8b6ca;
  --line: #3b4d66;
  --primary: #a5c2ed;
  --primary-dark: #c0d5f3;
  --primary-soft: #2a405f;
  --teal: #a4cbb8;
  --blue: #a5c2ed;
  --amber: #e5c386;
  --red: #f0aca0;
  --success-bg: #293d38;
  --warning-bg: #3a3222;
  --info-bg: #2a3b54;
  --danger-bg: #402b26;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 14px; scrollbar-gutter: stable; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-sans); font-weight: 500; line-height: 1.55; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
a, button { touch-action: manipulation; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font: 700 clamp(28px, 2.8vw, 38px)/1.2 var(--font-sans); letter-spacing: -.035em; overflow-wrap: anywhere; }
h2 { margin-bottom: 0; font-size: 15px; font-weight: 700; letter-spacing: -.02em; }
h3 { font-size: 14px; }
svg.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; }
::selection { background: var(--primary-soft); color: var(--text); }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 60; padding: 10px 16px; background: var(--surface); border: 1px solid var(--primary); transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.eyebrow, .section-index { display: block; margin-bottom: 12px; font: 500 11px/1.4 var(--font-sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* The navigation follows the numbering of an archive index. */
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--sidebar-width); padding: 30px 18px 16px; background: var(--sidebar); color: #dce3d8; display: flex; flex-direction: column; overflow-y: auto; }
.sidebar-heading { display: flex; align-items: center; }
.brand { display: flex; align-items: center; gap: 11px; color: #f5f4ea; }
.brand-mark { width: 38px; height: 42px; display: grid; place-items: center; border: 1px solid #6f8473; border-radius: 3px; color: #d3dfb9; }
.brand-mark .icon { width: 25px; height: 25px; }
.brand strong { display: block; font-size: 24px; font-weight: 700; letter-spacing: -.07em; line-height: 1.1; }
.brand-period { color: #bdce9f; }
.brand small { display: block; margin-top: 6px; font: 500 8px var(--font-sans); letter-spacing: .13em; color: #b1bfae; }
.workspace-label { display: flex; gap: 10px; align-items: center; margin: 30px 0 13px; padding: 15px 0; border-block: 1px solid #3b4c3f; font-size: 11px; }
.workspace-label small { display: block; color: #a9b6a4; font-size: 10px; }
.workspace-monogram { display: grid; place-items: center; width: 28px; height: 28px; background: #34463a; font: 500 10px var(--font-sans); }
.primary-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-label { padding: 22px 12px 8px; font: 500 9px var(--font-sans); letter-spacing: .15em; text-transform: uppercase; color: #a6b4a2; }
.primary-nav a { display: flex; align-items: center; gap: 11px; min-height: 44px; padding: 11px 12px; border-radius: 3px; color: #bec9b8; font-size: 12px; }
.primary-nav a small { margin-left: auto; font: 500 9px var(--font-sans); opacity: .65; }
.primary-nav a:hover { background: #2b4033; color: #fff; }
.primary-nav a.active { background: #dce5cc; color: #203b2c; }
.primary-nav .icon { width: 18px; height: 18px; }
.user-card { margin-top: auto; display: flex; align-items: center; gap: 9px; padding: 17px 3px 0; border-top: 1px solid #3b4c3f; }
.avatar { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface-2); color: var(--text); font-size: 12px; font-weight: 650; }
.sidebar .avatar { border-color: #526248; background: #34463a; color: #dce5cc; }
.user-meta { min-width: 0; flex: 1; }
.user-meta strong, .user-meta small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta strong { font-size: 10px; font-weight: 600; }
.user-meta small { margin-top: 2px; color: #aebca5; font-size: 10px; }
.logout-button { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 5px; border: 0; background: transparent; color: inherit; }
.logout-button:hover { color: var(--red); }
.sidebar .logout-button:hover { color: #fff; }
.sidebar :focus-visible { outline-color: #dce5cc; }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 25; border: 0; background: rgb(12 23 17 / 55%); }
.app-shell { display: flex; flex-direction: column; margin-left: var(--sidebar-width); min-height: 100dvh; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; min-height: 72px; padding: 14px var(--page-gutter); border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar-title { display: flex; align-items: center; gap: 13px; min-width: 0; font-size: 12px; color: var(--muted); }
.topbar-title .icon { width: 17px; height: 17px; }
.topbar-title strong { font-weight: 600; color: var(--text); }
.breadcrumb-divider { color: var(--line); }
.topbar-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; flex: none; }
.icon-button { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: var(--radius); background: transparent; color: var(--muted); }
.icon-button:hover { background: var(--surface-2); color: var(--text); }
.mobile-menu, .theme-sun { display: none; }
[data-theme="dark"] .theme-moon { display: none; }
[data-theme="dark"] .theme-sun { display: block; }
.page-content { width: 100%; max-width: 1600px; padding: 38px var(--page-gutter) 44px; margin-inline: auto; flex: 1; }
.page-content:focus { outline: none; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.page-heading > div:first-child { min-width: 0; }
.page-heading p { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.page-date { text-align: right; flex: none; font: 500 11px/1.6 var(--font-sans); color: var(--muted); }
.page-date span { display: block; font: 500 11px var(--font-sans); margin-top: 5px; }
.page-footer { display: flex; justify-content: space-between; gap: 20px; margin: 0 var(--page-gutter); padding: 17px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.page-footer span span { margin-inline: 8px; }

/* Flat surfaces, tabular numbers and fine rules keep documents prominent. */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 9px 15px; border: 1px solid transparent; border-radius: var(--radius); font-size: 12px; font-weight: 650; line-height: 1.5; }
.button .icon { width: 16px; height: 16px; }
.button-primary { background: var(--primary); color: var(--surface); }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary { background: var(--surface); border-color: var(--line); color: var(--text); }
.button-secondary:hover { border-color: var(--muted); background: var(--surface-2); }
.button-danger { background: var(--danger-bg); color: var(--red); border-color: var(--danger-bg); }
.button-danger:hover { border-color: var(--red); }
.button-small { min-height: 32px; padding: 6px 10px; font-size: 11px; }
.text-link { display: inline-flex; align-items: center; gap: 7px; color: var(--primary); font-size: 12px; font-weight: 650; }
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.text-link .icon { width: 16px; height: 16px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.stat-card { padding: 22px 24px; border-right: 1px solid var(--line); min-width: 0; }
.stat-card:last-child { border-right: 0; }
.stat-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.stat-index { font: 500 10px var(--font-sans); color: var(--muted); }
.stat-value { margin-top: 15px; font-size: 36px; font-weight: 600; line-height: 1.15; letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.stat-caption { margin-top: 9px; color: var(--muted); font-size: 10px; }
.stat-card.attention .stat-value { color: var(--amber); }
.stat-card.verified .stat-value { color: var(--teal); }
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, .42fr); gap: 22px; align-items: start; }
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding: 19px 22px; border-bottom: 1px solid var(--line); }
.panel-header .eyebrow { margin-bottom: 5px; font-size: 9px; }
.panel-header > .muted { font-size: 11px; }
.panel-body { padding: 22px; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; }
.data-table caption { padding: 12px 22px; color: var(--muted); text-align: left; }
.data-table th { padding: 13px 20px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 10px; font-weight: 600; color: var(--muted); }
.data-table td { padding: 17px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; font-variant-numeric: tabular-nums; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table td > .muted { font-size: 11px; }
.document-cell { display: flex; align-items: center; gap: 12px; }
.file-icon { display: grid; place-items: center; width: 34px; height: 40px; flex: none; border: 1px solid var(--line); border-radius: 3px; background: var(--bg); color: var(--primary); font: 500 9px var(--font-sans); }
.document-cell > span:last-child { min-width: 0; }
.document-cell strong, .document-cell small { display: block; }
.document-cell strong { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 650; }
.document-cell small { margin-top: 4px; font-size: 10px; color: var(--muted); }
.record-owner { display: block; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-error { max-width: 260px; color: var(--red); font-size: 11px; overflow-wrap: anywhere; }
a.document-cell:hover strong { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 3px; font-size: 10px; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; flex: none; border-radius: 50%; background: currentColor; }
.status-Approved, .status-Succeeded, .status-Recognized { background: var(--success-bg); color: var(--teal); }
.status-NeedsReview { background: var(--warning-bg); color: var(--amber); }
.status-Pending, .status-Queued, .status-Leased, .status-Processing { background: var(--info-bg); color: var(--blue); }
.status-Failed, .status-DeadLetter { background: var(--danger-bg); color: var(--red); }
.status-Uploaded, .status-Deleted, .status-Cancelled { background: var(--surface-2); color: var(--muted); }
.panel-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 13px 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.queue-summary { display: flex; align-items: baseline; gap: 10px; margin-bottom: 24px; }
.queue-summary strong { font-size: 32px; line-height: 1; font-weight: 600; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.queue-summary span { color: var(--muted); font-size: 11px; }
.queue-list { display: grid; gap: 18px; }
.queue-row-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 7px; font-size: 11px; color: var(--muted); }
.queue-row-label strong { color: var(--text); font: 500 11px var(--font-sans); }
.queue-track { height: 5px; background: var(--surface-2); }
.queue-track span { display: block; height: 100%; background: var(--primary); }
.queue-track .queue-warning { background: var(--amber); }
.queue-track .queue-error { background: var(--red); }
.review-notice { display: flex; align-items: center; gap: 14px; margin-top: 22px; padding: 17px 20px; border: 1px solid var(--line); border-left: 3px solid var(--amber); background: var(--surface); }
.review-notice > .icon { color: var(--amber); }
.review-notice strong { display: block; font-size: 12px; font-weight: 650; }
.review-notice p { margin: 3px 0 0; font-size: 11px; color: var(--muted); }
.review-notice .text-link { margin-left: auto; flex: none; }
.toolbar { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; padding: 17px 20px; margin-bottom: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.toolbar .field { margin: 0; min-width: 150px; flex: 1; }
.toolbar .search-field { flex: 2; min-width: 220px; }
.toolbar .field label { font-size: 10px; color: var(--muted); font-weight: 600; }
.search-input { position: relative; }
.search-input .icon { position: absolute; top: 11px; left: 12px; width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.search-input .input { padding-left: 38px; }
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 20px; }
.field label, .field legend { font-size: 12px; font-weight: 650; }
fieldset.field { min-width: 0; padding: 0; border: 0; }
.field legend { padding: 0; margin-bottom: 10px; }
.field small, .help-text { color: var(--muted); font-size: 11px; line-height: 1.65; }
.input, select, textarea { width: 100%; min-height: 40px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); font-size: 12px; }
.input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: 2px solid var(--primary-soft); outline-offset: 0; }
textarea { resize: vertical; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }
.validation-summary-errors, .field-validation-error, .login-error { color: var(--red); font-size: 12px; }
.validation-summary-errors ul, .login-error ul { padding-left: 18px; }
.form-card { max-width: 740px; }
.upload-layout { grid-template-columns: minmax(0, 740px) minmax(230px, 1fr); }
.upload-zone { position: relative; display: block; padding: 34px 20px; border: 1px dashed var(--muted); border-radius: var(--radius); background: var(--surface-2); text-align: center; cursor: pointer; }
.upload-zone.dragging { border-color: var(--primary); background: var(--primary-soft); }
.upload-zone:focus-within { outline: 2px solid var(--primary); outline-offset: 3px; }
.upload-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-glyph { display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto 14px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); color: var(--primary); }
.upload-zone strong { display: block; font-size: 13px; font-weight: 650; }
.upload-zone .upload-help { display: block; margin-top: 7px; font-size: 11px; color: var(--muted); }
.upload-file-list { max-height: 220px; overflow-y: auto; margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.upload-file-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.upload-file-row:last-child { border-bottom: 0; }
.upload-file-row strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 600; }
.upload-file-row span { flex: none; color: var(--muted); font: 500 10px var(--font-sans); }
.mode-grid { display: grid; gap: 8px; }
.mode-option { display: flex; align-items: flex-start; gap: 11px; padding: 13px 14px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.mode-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.mode-option input { margin: 4px 0 0; flex: none; }
.mode-option strong, .mode-option small { display: block; }
.mode-option strong { font-size: 12px; font-weight: 650; }
.mode-option small { margin-top: 3px; font-weight: 500; }
.upload-notes { padding: 25px 0 0 12px; color: var(--muted); }
.upload-notes h2 { margin: 12px 0; color: var(--text); font: 650 25px/1.25 var(--font-sans); }
.upload-notes p { font-size: 12px; }
.format-list { display: flex; gap: 8px; margin-block: 22px; }
.format-list span { padding: 7px 9px; border: 1px solid var(--line); font: 500 10px var(--font-sans); }
.upload-rules { margin: 0; }
.upload-rules > div { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.upload-rules dd { margin: 0; color: var(--text); font: 500 11px var(--font-sans); }
.details-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; }
.metadata-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.metadata-item { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); overflow-wrap: anywhere; }
.metadata-item label { display: block; color: var(--muted); font-size: 10px; }
.metadata-item strong { display: block; margin-top: 7px; font-size: 14px; font-weight: 650; }
.metadata-item small { font-size: 10px; }
.confidence { height: 3px; margin-block: 12px 7px; background: var(--line); }
.confidence span { display: block; height: 100%; background: var(--teal); }
.review-shell { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr); min-height: 650px; height: calc(100dvh - 180px); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.document-preview { display: flex; flex-direction: column; min-width: 0; padding: 20px; background: #35413a; }
.preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 18px; color: #e1e6d8; font-size: 11px; }
.preview-toolbar strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.preview-toolbar .button { flex: none; }
.preview-frame, .image-preview { flex: 1; min-height: 0; width: 100%; height: 100%; border: 0; border-radius: 2px; background: #fff; }
.image-preview { object-fit: contain; }
.processing-preview { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 24px; scroll-margin-top: 90px; }
.processing-document { position: relative; min-width: 0; background: #1d2d45; padding: 16px; }
.processing-document .preview-toolbar { margin-bottom: 12px; }
.preview-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px; background: var(--surface); border-radius: var(--radius); margin-bottom: 12px; font-size: 11px; }
.preview-controls label { display: flex; align-items: center; gap: 5px; }
.preview-controls input[type="number"] { width: 64px; padding: 5px; }
.preview-controls select { width: auto; padding: 5px; }
.preview-controls input[type="checkbox"] { width: auto; }
.preview-scroll { overflow: auto; height: 66dvh; min-height: 350px; padding: 16px; }
.preview-page { position: relative; margin: 0 auto; background: white; box-shadow: 0 2px 12px #0003; }
.preview-page canvas, .preview-page img { display: block; width: 100%; height: auto; }
.preview-boxes { position: absolute; inset: 0; pointer-events: none; }
.preview-field-box { position: absolute; pointer-events: auto; border: 2px solid #25806b; background: #32b68b26; padding: 0; cursor: pointer; min-width: 6px; min-height: 6px; border-radius: 2px; }
.preview-field-box.low-confidence { border-color: #ab6f08; background: #e9b53033; }
.preview-field-box.selected { border-color: #1954dd; background: #4c84ff40; z-index: 2; box-shadow: 0 0 0 2px #fff; }
.preview-field-box span { position: absolute; bottom: 100%; left: -2px; padding: 2px 5px; background: #1b5145; color: #fff; white-space: nowrap; font-size: 10px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.preview-field-box.selected span { background: #1954dd; }
.preview-field-box:focus-visible { outline: 3px solid #1954dd; outline-offset: 3px; }
.preview-notice { color: #fff; font-size: 12px; }
.processing-panel { min-width: 0; max-height: 85dvh; overflow-y: auto; padding: 24px; background: var(--surface); }
.processing-panel h2 { margin-block: 8px; font-size: 20px; }
.processing-panel h3 { margin-top: 24px; font-size: 14px; }
.processing-panel p { font-size: 12px; }
.processing-panel { --process-accent: #3268b6; }
[data-theme="dark"] .processing-panel { --process-accent: #a5c2ed; }
.processing-hero { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 16px; padding: 20px 16px 14px; border: 1px solid var(--line); border-radius: 16px; background: radial-gradient(circle at 12% 20%, color-mix(in srgb, var(--process-accent) 12%, transparent), transparent 70%), var(--surface); }
.processing-orbit { position: relative; width: 96px; height: 96px; color: var(--process-accent); }
.processing-ring { width: 100%; height: 100%; transform: rotate(-90deg); fill: none; stroke-width: 3; }
.ring-track { stroke: var(--line); }
.ring-value { stroke: currentColor; stroke-linecap: round; stroke-dasharray: 0 100; transition: stroke-dasharray .5s ease; }
.processing-file { position: absolute; width: 32px; height: 40px; top: 28px; left: 32px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.processing-orbit::after { content: ""; position: absolute; inset: 0; border: 2px solid transparent; border-top-color: currentColor; border-radius: 50%; opacity: 0; }
.processing-hero[data-state="active"] .processing-orbit::after { opacity: 1; animation: processing-spin 2s linear infinite; }
.processing-orbit-mark { position: absolute; right: 4px; bottom: 4px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 2px solid currentColor; font-size: 13px; font-weight: 800; }
.processing-orbit-mark:empty { display: none; }
.processing-hero-copy { min-width: 0; }
.processing-hero .eyebrow { font-size: 9px; letter-spacing: .12em; }
.processing-hero h2 { margin: 5px 0 7px; font-size: clamp(18px, 1.5vw, 22px); line-height: 1.25; font-weight: 750; }
.processing-phase { display: block; color: var(--muted); font-size: 11px; line-height: 1.6; }
.processing-meta { grid-column: 1 / -1; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; font-weight: 650; font-variant-numeric: tabular-nums; }
.processing-hero[data-state="review"] .processing-orbit { color: var(--amber); }
.processing-hero[data-state="error"] .processing-orbit { color: var(--red); }
.processing-hero[data-state="offline"] .processing-orbit { color: var(--muted); }
.processing-message { margin: 14px 2px 0; color: var(--muted); line-height: 1.7; }
.processing-steps { display: grid; padding: 0; list-style: none; margin: 22px 0; }
.processing-step { position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 13px; padding: 0 0 19px; }
.processing-step:last-child { padding-bottom: 0; }
.processing-step:not(:last-child)::before { content: ""; position: absolute; left: 15px; top: 36px; bottom: 4px; width: 2px; background: var(--line); }
.processing-step.done::before { background: color-mix(in srgb, var(--process-accent) 55%, var(--line)); }
.step-marker { position: relative; display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 750; font-variant-numeric: tabular-nums; }
.step-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; min-height: 28px; }
.step-heading strong { font-size: 12px; font-weight: 700; }
.step-state { color: var(--muted); font-size: 9px; font-weight: 650; }
.step-body small { display: block; color: var(--muted); font-size: 10px; line-height: 1.6; }
.processing-step.done .step-marker { background: color-mix(in srgb, var(--process-accent) 12%, var(--surface)); color: var(--process-accent); border-color: color-mix(in srgb, var(--process-accent) 35%, var(--line)); }
.processing-step.active .step-marker { color: var(--surface); background: var(--process-accent); border-color: var(--process-accent); animation: processing-pulse 2s ease-in-out infinite; }
.processing-step.active .step-heading strong, .processing-step.active .step-state { color: var(--process-accent); }
.processing-step.review .step-marker { color: var(--amber); background: var(--warning-bg); border-color: var(--amber); }
.processing-step.error .step-marker { color: var(--red); background: var(--danger-bg); border-color: var(--red); }
.processing-step.pending .step-heading strong, .processing-step.skipped .step-heading strong { color: var(--muted); }
.processing-step.skipped .step-marker { background: transparent; border-style: dashed; }
.connection-lost .step-marker { animation: none; }
.preview-work-indicator { position: absolute; right: 28px; bottom: 28px; display: flex; align-items: center; gap: 10px; max-width: calc(100% - 56px); padding: 11px 16px; border: 1px solid #a5c2ed66; border-radius: 100px; background: #193b72f2; color: #fff; box-shadow: 0 8px 24px #0003; font-size: 12px; font-weight: 650; pointer-events: none; }
.working-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #c1dcff; animation: working-pulse 1.6s ease-in-out infinite; }
.preview-scan { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.preview-scan span { position: absolute; inset: 0 0 auto; height: 48px; border-bottom: 2px solid #558be2a6; background: linear-gradient(transparent, #558be21c); animation: document-scan 4s ease-in-out infinite alternate; }
@keyframes processing-spin { to { transform: rotate(360deg); } }
@keyframes processing-pulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--process-accent) 12%, transparent); } }
@keyframes working-pulse { 50% { opacity: .4; } }
@keyframes document-scan { from { top: -48px; } to { top: 100%; } }
@media (prefers-reduced-motion: reduce) { .processing-orbit::after, .step-marker, .working-dot { animation: none !important; } .preview-scan { display: none; } .ring-value { transition: none; } }
@media (max-width: 480px) { .processing-panel { padding: 18px; } .processing-hero { grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 16px 12px 12px; } .processing-orbit { width: 76px; height: 76px; } .processing-file { top: 18px; left: 22px; } }
.preview-field-list { display: grid; gap: 8px; }
.preview-field-row { width: 100%; text-align: left; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); cursor: pointer; }
.preview-field-row strong, .preview-field-row span, .preview-field-row small { display: block; overflow-wrap: anywhere; }
.preview-field-row strong { font-size: 12px; }
.preview-field-row span { font-size: 13px; margin-block: 6px; }
.preview-field-row small { color: var(--muted); font-size: 10px; }
.preview-field-row.low-confidence { border-color: var(--amber); }
.preview-field-row.selected { border-color: #1954dd; box-shadow: inset 3px 0 #1954dd; }
@media (max-width: 1000px) { .processing-preview { grid-template-columns: minmax(0, 1fr); } .processing-panel { max-height: none; } }
.review-panel { min-width: 0; padding: 25px; overflow-y: auto; background: var(--surface); }
.review-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.review-heading .eyebrow { font-size: 9px; }
.review-heading p { margin: 8px 0 0; font-size: 11px; }
.review-field { padding: 15px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.review-field.low-confidence { border-color: var(--amber); background: var(--warning-bg); }
.review-field-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 12px; }
.confidence-chip { flex: none; font: 500 10px var(--font-sans); color: var(--muted); }
[data-repeat-group] .input + .input { margin-top: 7px; }
.evidence { padding-left: 10px; margin: 12px 0 0; border-left: 2px solid var(--line); color: var(--muted); font-size: 11px; }
.empty-state { padding: 48px 24px; text-align: center; color: var(--muted); font-size: 12px; }
.empty-state > .icon { width: 32px; height: 32px; margin-bottom: 15px; color: var(--primary); }
.empty-state strong { display: block; margin-bottom: 7px; color: var(--text); font: 650 23px var(--font-sans); }
.empty-state span { display: block; }
.timeline { display: grid; gap: 18px; }
.timeline-item { display: grid; grid-template-columns: 8px minmax(0, 1fr); gap: 12px; font-size: 12px; }
.timeline-dot { width: 6px; height: 6px; margin-top: 7px; background: var(--primary); }
.timeline-item strong, .timeline-item small { display: block; overflow-wrap: anywhere; }
.timeline-item strong { font-weight: 600; }
.timeline-item small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.keyword-list { display: flex; flex-wrap: wrap; gap: 8px; }
.keyword-chip { display: inline-flex; align-items: center; gap: 9px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface-2); font-size: 11px; }
.keyword-chip form { display: inline; }
.keyword-chip button { min-width: 26px; min-height: 26px; padding: 0; border: 0; background: transparent; color: var(--red); font-size: 16px; }
.ocr-text { max-height: 360px; overflow: auto; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); white-space: pre-wrap; overflow-wrap: anywhere; font: 500 12px/1.7 var(--font-sans); }
summary { cursor: pointer; color: var(--primary); font-size: 12px; }
hr { height: 1px; margin-block: 24px; border: 0; background: var(--line); }
.split-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.split-actions form { margin: 0; }
.page-heading .split-actions { justify-content: flex-end; flex: none; max-width: 55%; }
.mt-3 { margin-top: 20px; }
.muted { color: var(--muted); }
.numeric { font-family: var(--font-sans); font-size: 11px; font-variant-numeric: tabular-nums; }
.toast { position: fixed; top: 88px; right: 24px; z-index: 40; display: flex; align-items: center; gap: 10px; max-width: min(560px, calc(100vw - 32px)); padding: 12px 16px; border: 1px solid var(--line); border-left: 3px solid var(--teal); border-radius: var(--radius); background: var(--surface); box-shadow: 0 4px 16px rgb(0 0 0 / 8%); font-size: 12px; }
.toast > .icon { color: var(--teal); }

/* Operations overview */
.operations-overview { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; padding: 20px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.operations-overview h2 { font-size: 16px; }
.operations-overview p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.operations-overview > .badge { margin-left: auto; flex: none; }
.operations-status-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 6px var(--success-bg); flex: none; }
.operations-overview.needs-attention .operations-status-dot { background: var(--amber); box-shadow: 0 0 0 6px var(--warning-bg); }
.operations-stats a:hover { background: var(--surface-2); }
.operations-stat-total { font-size: 20px; color: var(--muted); letter-spacing: 0; }
.operations-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.operations-wide { grid-column: 1 / -1; }
.operations-service { display: flex; align-items: start; justify-content: space-between; gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.operations-service:last-child { border-bottom: 0; }
.operations-service > div { min-width: 0; }
.operations-service h3 { margin: 0; font-size: 13px; }
.operations-service p { margin: 5px 0 8px; color: var(--muted); font-size: 12px; }
.operations-service summary { font-size: 11px; }
.operations-grid code { font-family: var(--font-sans); font-size: 12px; overflow-wrap: anywhere; }
.operations-service code { display: block; margin-top: 8px; color: var(--muted); }
.operations-storage-value { display: flex; align-items: baseline; gap: 10px; font-size: 44px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.operations-storage-value span { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.operations-capacity { display: block; appearance: none; width: 100%; height: 10px; margin: 18px 0 24px; border: 0; border-radius: 5px; overflow: hidden; background: var(--surface-2); accent-color: var(--primary); }
.operations-capacity::-webkit-progress-bar { background: var(--surface-2); }
.operations-capacity::-webkit-progress-value { background: var(--primary); border-radius: 5px; }
.operations-capacity::-moz-progress-bar { background: var(--primary); border-radius: 5px; }
.operations-facts { margin: 0; }
.operations-facts > div { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.operations-facts > div:first-child { padding-top: 0; }
.operations-facts > div:last-child { border-bottom: 0; padding-bottom: 0; }
.operations-facts dt { color: var(--muted); font-weight: 500; }
.operations-facts dd { margin: 0; text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.operations-note { margin: 22px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.operations-table tbody th { background: transparent; color: var(--text); font-size: 12px; }
.operations-table tbody tr:last-child th { border-bottom: 0; }
@media (max-width: 1000px) { .operations-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .operations-overview { flex-wrap: wrap; padding: 18px; }
  .operations-overview > div { flex: 1; min-width: 180px; }
  .operations-overview > .badge { margin-left: 28px; }
  .operations-service { padding: 18px; flex-wrap: wrap; }
  .operations-service > div { flex: 1; min-width: 160px; }
  .operations-facts > div { flex-wrap: wrap; gap: 6px 16px; }
}

/* Sign-in page */
.auth-shell { min-height: 100dvh; }
.auth-shell > .page-content { max-width: none; padding: 0; }
.login-layout { display: grid; grid-template-columns: 1.08fr 1fr; min-height: 100dvh; }
.login-intro { display: flex; flex-direction: column; padding: 48px clamp(36px, 6vw, 90px); background: #203b30; color: #f0f1e5; }
.login-intro-copy { margin-block: auto; padding-block: 60px 40px; }
.login-intro .eyebrow { color: #b7c5a3; font-size: 10px; }
.login-intro h2 { margin: 22px 0; font: 700 clamp(35px, 4vw, 56px)/1.13 var(--font-sans); letter-spacing: -.04em; }
.login-intro-copy > p { max-width: 340px; margin-bottom: 38px; color: #c0cbbb; font-size: 13px; line-height: 1.8; }
.archive-cabinet { max-width: 380px; padding: 10px; border: 1px solid #71816a; border-radius: 4px; }
.archive-drawer { display: flex; align-items: center; gap: 20px; padding: 19px; margin-bottom: 6px; border: 1px solid #d2d7c3; background: #e1e4d2; color: #2a4031; }
.archive-drawer:last-child { margin-bottom: 0; }
.archive-drawer > span { min-width: 130px; padding: 7px 15px; border: 1px solid #c4c9b6; background: #f4f3e8; font: 500 12px var(--font-sans); }
.archive-drawer small { margin-left: auto; font: 500 10px var(--font-sans); letter-spacing: .1em; }
.archive-drawer::after { content: ""; width: 32px; height: 6px; border: 1px solid #819174; border-top-width: 2px; }
.login-intro-footer { display: flex; gap: 20px; justify-content: space-between; padding-top: 25px; border-top: 1px solid #50634e; font: 500 9px var(--font-sans); letter-spacing: .06em; color: #b5c3a1; }
.login-form-side { display: grid; place-items: center; padding: 60px 40px; }
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { font-size: 33px; line-height: 1.2; }
.login-card > p { margin: 15px 0 30px; color: var(--muted); font-size: 12px; }
.login-card form { padding-top: 26px; border-top: 1px solid var(--line); }
.login-card .input { min-height: 45px; }
.remember-me { display: flex; align-items: center; gap: 9px; margin: 5px 0 24px; font-size: 12px; cursor: pointer; }
.remember-me input { width: 15px; height: 15px; margin: 0; }
.login-button { width: 100%; min-height: 45px; justify-content: space-between; }
.login-footnote { padding-top: 20px; margin-top: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; line-height: 1.7; }
.login-mobile-brand { display: none; }
[data-theme="dark"] .sidebar { color: var(--text); }
[data-theme="dark"] .brand { color: #e3e9f2; }
[data-theme="dark"] .brand-mark { border-color: #718bb0; color: #c0d5f3; }
[data-theme="dark"] .brand-period { color: #a5c2ed; }
[data-theme="dark"] :is(.brand small, .workspace-label small, .nav-label, .user-meta small) { color: #b6c6dc; }
[data-theme="dark"] :is(.workspace-label, .user-card) { border-color: #4a6389; }
[data-theme="dark"] .workspace-monogram,
[data-theme="dark"] .sidebar .avatar { background: #2a4a79; color: #e3e9f2; border-color: #718bb0; }
[data-theme="dark"] .primary-nav a { color: #d0dced; }
[data-theme="dark"] .primary-nav a:hover { background: #2a4a79; color: #fff; }
[data-theme="dark"] .primary-nav a.active { background: #c0d5f3; color: #193b72; }
[data-theme="dark"] .sidebar :focus-visible { outline-color: #c0d5f3; }
[data-theme="dark"] .sidebar .sidebar-close { border-color: #718bb0; color: #e3e9f2; }
[data-theme="dark"] .sidebar .sidebar-close:hover { background: #2a4a79; }
[data-theme="dark"] .sidebar-backdrop { background: rgb(10 18 31 / 55%); }
[data-theme="dark"] .login-intro { background: var(--sidebar); color: var(--text); }
[data-theme="dark"] .login-intro :is(.eyebrow, .login-intro-copy > p, .login-intro-footer) { color: #c0d5f3; }
[data-theme="dark"] :is(.archive-cabinet, .login-intro-footer) { border-color: #718bb0; }
[data-theme="dark"] .archive-drawer { border-color: #718bb0; background: #263f63; color: #e3e9f2; }
[data-theme="dark"] .archive-drawer > span { border-color: #718bb0; background: #1c3050; }
[data-theme="dark"] .archive-drawer::after { border-color: #a5c2ed; }
.error-panel { max-width: 700px; margin: 10vh auto; }
.auth-shell .error-panel { margin-inline: max(20px, calc((100% - 700px) / 2)); }

@media (min-width: 761px) {
  .sidebar-backdrop { display: none; }
}
@media (max-width: 1200px) {
  :root { --sidebar-width: 224px; --page-gutter: 26px; }
  .content-grid { grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; }
  .stat-card { padding: 20px 17px; }
  .data-table th, .data-table td { padding-inline: 15px; }
  .document-cell strong { max-width: 200px; }
  .details-grid { grid-template-columns: minmax(0, 1fr) 260px; }
  .page-heading { align-items: start; }
  .page-heading .split-actions { max-width: 48%; }
}
@media (max-width: 1000px) {
  .content-grid, .details-grid, .upload-layout { grid-template-columns: minmax(0, 1fr); }
  .upload-notes { padding: 8px 0; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card:nth-child(2) { border-right: 0; }
  .stat-card:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .review-shell { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 0; }
  .document-preview { height: 65dvh; min-height: 320px; }
  .review-panel { overflow-y: visible; }
  .page-heading { flex-wrap: wrap; }
  .page-heading .split-actions { max-width: 100%; justify-content: flex-start; }
  .login-intro { padding-inline: 35px; }
  .login-intro h2 { font-size: 42px; }
  .archive-drawer { padding: 15px 10px; gap: 10px; }
  .archive-drawer > span { min-width: 115px; }
}
@media (max-width: 760px) {
  :root { --page-gutter: 20px; --sidebar-width: 260px; }
  .sidebar { transform: translateX(-100%); transition: transform 160ms ease-out; visibility: hidden; }
  .sidebar.open { transform: translateX(0); visibility: visible; }
  .sidebar-heading { justify-content: space-between; }
  .sidebar .sidebar-close { width: 30px; height: 34px; border-color: #526248; color: #dce5cc; }
  .sidebar .sidebar-close:hover { background: #34463a; }
  .sidebar-open { overflow: hidden; }
  .app-shell { margin-left: 0; }
  .mobile-menu { display: inline-grid; }
  .topbar { min-height: 66px; gap: 10px; padding-block: 12px; }
  .topbar-title { font-size: 11px; }
  .topbar-title > .icon, .topbar-title > span { display: none; }
  .topbar-actions { gap: 8px; }
  .topbar-actions .button { min-height: 38px; padding-inline: 11px; font-size: 11px; }
  .page-content { padding-block: 28px 36px; }
  .page-heading { gap: 17px; margin-bottom: 24px; }
  .page-heading p { font-size: 12px; }
  .page-date { text-align: left; }
  .section-index { font-size: 9px; }
  .stat-card { padding: 18px 16px; }
  .stat-top { font-size: 11px; }
  .stat-value { font-size: 31px; }
  .stat-caption { font-size: 9px; }
  .stats-grid { margin-bottom: 22px; }
  .panel-header, .panel-body { padding: 18px; }
  .toolbar { gap: 14px; padding: 16px; }
  .toolbar .search-field { flex-basis: 100%; min-width: 0; }
  .toolbar .field { min-width: 110px; }
  .toolbar > .button { width: 100%; }
  .review-notice { flex-wrap: wrap; padding: 16px; }
  .review-notice .text-link { margin-left: 34px; }
  .page-footer { font-size: 9px; }
  .page-footer > span:last-child { display: none; }
  .login-layout { grid-template-columns: minmax(0, 1fr); }
  .login-intro { display: none; }
  .login-form-side { min-height: 100dvh; padding: 40px 24px; }
  .login-mobile-brand { display: flex; margin-bottom: 64px; color: var(--text); }
  .login-mobile-brand .brand-mark { border-color: var(--primary); color: var(--primary); }
  .login-mobile-brand .brand-period { color: var(--primary); }
  .login-mobile-brand small { color: var(--muted); }
}
@media (max-width: 440px) {
  :root { --page-gutter: 16px; }
  .topbar-title { display: none; }
  .metadata-grid { grid-template-columns: minmax(0, 1fr); }
  .stat-index { display: none; }
  .stat-top { font-size: 10px; }
  .panel-footer { flex-wrap: wrap; padding-inline: 16px; }
  .review-heading { flex-wrap: wrap; }
  .preview-toolbar { flex-wrap: wrap; }
  .preview-toolbar strong { max-width: 100%; }
  .review-panel { padding: 18px; }
  .toolbar .field { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}
@media print {
  :root { color-scheme: light; --bg: #fff; --surface: #fff; --surface-2: #f5f5f5; --text: #111; --muted: #555; --line: #ccc; }
  .sidebar, .topbar, .page-footer, .skip-link, .toast, .sidebar-backdrop { display: none !important; }
  .app-shell { margin: 0; }
  .page-content { padding: 0; max-width: none; }
  .panel, .stat-card, .metadata-item { break-inside: avoid; }
  .table-wrap { overflow: visible; }
  .review-shell { height: auto; overflow: visible; }
  .review-panel { overflow: visible; }
}
