:root {
  --paper: #f4f7fa;
  --ink: #172c46;
  --blue: #285bd4;
  --pale-blue: #e7efff;
  --muted: #66788c;
  --white: #fff;
  --line: #dce4ed;
  --danger: #a0333e;
  --success: #26705b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.55; }
a { color: var(--blue); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
button, input, select { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(28px, 3vw, 36px); font-weight: 650; letter-spacing: -.04em; line-height: 1.2; }
h2 { font-size: 17px; font-weight: 650; letter-spacing: -.02em; }
h3 { font-size: 15px; font-weight: 600; }
.muted { color: var(--muted); }
.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; }
.skip-link { position: absolute; top: -100px; left: 16px; z-index: 10; background: white; padding: 12px 20px; }
.skip-link:focus { top: 12px; }
.site-header { background: var(--white); border-bottom: 1px solid var(--line); }
.header-inner, .shell { max-width: 1360px; margin-inline: auto; padding-inline: 40px; }
.header-inner { display: flex; align-items: center; gap: 28px; min-height: 78px; }
.header-inner > form { margin-left: auto; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-size: 27px; font-weight: 750; letter-spacing: -.06em; line-height: 1; }
.brand-mark { position: relative; display: inline-block; width: 25px; height: 30px; background: var(--blue); border-radius: 2px 7px 2px 2px; transform: rotate(-5deg); }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; left: 6px; height: 2px; background: var(--white); }
.brand-mark::before { top: 10px; width: 13px; }
.brand-mark::after { top: 16px; width: 9px; }
.header-label { border-left: 1px solid var(--line); padding-left: 26px; color: var(--muted); }
.text-button { border: 0; background: transparent; color: var(--muted); padding: 10px 0 10px 12px; }
.text-button:hover { color: var(--ink); text-decoration: underline; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 38px 0 28px; }
.page-heading p { margin-top: 8px; }
.workspace-label { color: var(--muted); font-size: 13px; }
.archive-layout { display: grid; grid-template-columns: 282px minmax(0, 1fr); gap: 28px; align-items: start; }
.upload-panel { padding: 24px; background: var(--white); border: 1px solid var(--line); border-top: 3px solid var(--blue); border-radius: 5px; }
.upload-panel > p { margin: 7px 0 22px; font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; }
label { font-size: 13px; font-weight: 600; }
input:not([type="file"]):not([type="hidden"]), select { min-width: 0; width: 100%; border: 1px solid #bdcbdc; border-radius: 5px; background: var(--white); padding: 10px 12px; color: var(--ink); min-height: 43px; }
input::placeholder { color: var(--muted); opacity: 1; }
.field-hint { font-size: 12px; color: var(--muted); line-height: 1.5; }
.file-well { border: 1px dashed #b7c8e3; background: #f8faff; border-radius: 5px; padding: 18px 12px; }
.upload-icon { display: block; color: var(--blue); margin-bottom: 12px; }
.file-well label { display: block; margin-bottom: 8px; }
.file-well input { width: 100%; font-size: 12px; color: var(--muted); }
input::file-selector-button { font: inherit; font-weight: 600; color: var(--blue); background: var(--pale-blue); border: 0; border-radius: 3px; padding: 8px; margin-right: 6px; cursor: pointer; }
[data-folder-control] { margin-top: 16px; padding-top: 15px; border-top: 1px solid var(--line); }
.selection-summary { font-size: 12px; color: var(--muted); margin-top: -8px; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 42px; gap: 8px; padding: 9px 15px; border: 1px solid transparent; border-radius: 5px; font-size: 13px; font-weight: 600; line-height: 1.5; text-decoration: none; white-space: nowrap; }
.primary { color: var(--white); background: var(--blue); border-color: var(--blue); }
.primary:hover:not(:disabled) { background: #204bb5; }
.secondary { color: var(--ink); background: var(--white); border-color: #cbd6e4; }
.secondary:hover { border-color: var(--blue); background: #f8faff; text-decoration: none; }
.archive-panel { min-width: 0; }
.archive-toolbar { min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.search-form { display: flex; gap: 8px; width: min(100%, 365px); }
.search-form input { flex: 1; }
.search-context { margin-bottom: 16px; color: var(--muted); overflow-wrap: anywhere; }
.document-list { background: var(--white); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.list-heading, .document-row { display: grid; grid-template-columns: minmax(0, 1fr) 128px 130px; gap: 16px; padding: 17px 20px; align-items: center; }
.list-heading { background: #f9fbfd; color: var(--muted); font-size: 12px; padding-block: 11px; border-bottom: 1px solid var(--line); }
.document-row + .document-row { border-top: 1px solid var(--line); }
.document-row:hover { background: #fcfdff; }
.document-identity { display: flex; align-items: center; gap: 14px; min-width: 0; }
.file-symbol { color: var(--blue); background: var(--pale-blue); width: 41px; height: 48px; flex-shrink: 0; display: grid; place-items: center; border-radius: 3px; }
.document-name { min-width: 0; }
.document-name a { color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.document-name a:hover { color: var(--blue); text-decoration: underline; }
.document-name p { font-size: 12px; color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
.meta-divider { color: #b0bdcd; padding-inline: 8px; }
.status { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 4px; color: var(--muted); background: #eef2f6; white-space: nowrap; }
.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-processing { color: #2854b5; background: var(--pale-blue); }
.status-complete { color: var(--success); background: #eaf5f0; }
.status-failed { color: var(--danger); background: #fceef0; }
.progress-caption { display: block; color: var(--muted); font-size: 11px; margin-top: 5px; }
.error-caption { color: var(--danger); }
.document-date { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; margin-top: 22px; font-size: 12px; }
.pagination > :first-child { justify-self: start; }
.pagination > :last-child { justify-self: end; }
.notice { background: var(--pale-blue); border: 1px solid #cbdaf8; color: #274d93; border-radius: 5px; padding: 13px 16px; margin-bottom: 20px; overflow-wrap: anywhere; }
.notice-error { background: #fff4f5; color: var(--danger); border-color: #efcbd0; }
.notice-warning { background: #fff9ec; color: #76581b; border-color: #ecdcb7; }
.stack .notice { margin-bottom: 0; }
.upload-panel .notice { font-size: 12px; }
.poll-notice { margin-top: 18px; }
.empty-state { padding: 64px 28px; text-align: center; border: 1px solid var(--line); border-radius: 5px; background: var(--white); }
.empty-state h3 { font-size: 20px; letter-spacing: -.025em; }
.empty-state p { max-width: 360px; margin: 10px auto 20px; color: var(--muted); }
.empty-paper { display: block; position: relative; margin: 0 auto 25px; width: 55px; height: 68px; background: var(--white); border: 1px solid #b7c9e4; border-radius: 3px; box-shadow: -7px 5px 0 var(--pale-blue); transform: rotate(5deg); }
.empty-paper::after { content: ""; position: absolute; top: 23px; left: 12px; width: 29px; height: 1px; background: #b7c9e4; box-shadow: 0 8px 0 #b7c9e4, 0 16px 0 #b7c9e4; }
.site-footer { display: flex; justify-content: space-between; gap: 20px; padding-block: 34px; color: var(--muted); font-size: 12px; margin-top: 30px; }
.back-link { display: inline-block; margin-top: 27px; text-decoration: none; font-size: 13px; }
.document-heading { margin-top: 20px; margin-bottom: 23px; align-items: flex-start; }
.document-heading h1 { overflow-wrap: anywhere; font-size: clamp(25px, 3vw, 34px); }
.document-heading > div { min-width: 0; }
.document-heading > .status { margin-top: 4px; }
.document-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 26px; }
.retry-form { display: flex; gap: 8px; flex-wrap: wrap; }
.retry-form select { width: auto; max-width: 100%; }
.source-details { border-block: 1px solid var(--line); padding: 14px 0; margin-bottom: 30px; }
summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.metadata { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 32px; margin: 20px 0 5px; }
.metadata dt { font-size: 12px; color: var(--muted); }
.metadata dd { margin: 3px 0 0; font-size: 13px; overflow-wrap: anywhere; }
.checksum { font-family: ui-monospace, monospace; font-size: 11px !important; }
.pages-heading { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 15px; }
.pages-heading > span { font-size: 12px; }
.page-pair { margin-bottom: 28px; border: 1px solid var(--line); background: var(--white); border-radius: 5px; overflow: hidden; }
.page-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.page-provenance { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; min-width: 0; }
.page-provenance > span:last-child { min-width: 0; }
.page-columns { display: grid; grid-template-columns: 1fr 1fr; }
.scan-pane { background: #eaf0f6; padding: 16px 22px 25px; min-width: 0; }
.pane-label { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 16px; }
.scan-link { display: block; }
.scan-link img { display: block; max-width: 100%; width: 100%; height: auto; color: var(--muted); font-size: 13px; box-shadow: 0 3px 12px #172c4610; }
.text-pane { min-width: 0; border-left: 1px solid var(--line); padding: 16px 26px 28px; }
.extracted-text { font-family: Georgia, "Times New Roman", serif; font-size: 16px; line-height: 1.85; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; tab-size: 4; }
.text-placeholder { color: var(--muted); font-size: 14px; padding-top: 20px; max-width: 40ch; }
.login-body { min-height: 100svh; display: grid; place-items: center; padding: 32px 20px; }
.login-panel { width: 100%; max-width: 420px; padding: 38px; border: 1px solid var(--line); border-top: 3px solid var(--blue); border-radius: 6px; background: var(--white); }
.login-intro { margin: 42px 0 28px; }
.login-intro h1 { font-size: 32px; }
.login-intro p { margin-top: 12px; }
.login-footnote { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); margin-top: 28px; padding-top: 20px; }
.transcription-policy { color: var(--muted); max-width: 85ch; margin: -8px 0 22px; }
.export-hint { margin-top: -16px; margin-bottom: 24px; }
.reader-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 16px 24px; padding: 16px 0; border-top: 1px solid var(--line); }
.page-navigation { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.page-navigation select { width: auto; max-width: 290px; }
.page-navigation input[type="number"] { width: 100px; }
.check-label { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.check-label input[type="checkbox"] { width: 18px; height: 18px; min-height: 18px; padding: 0; accent-color: var(--blue); margin: 0; }
.live-status { min-height: 20px; margin: 2px 0 16px; }
.editor-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.block-editor { border: 0; margin: 0 0 20px; padding: 0; min-width: 0; }
.transcript-block { border: 1px solid var(--line); border-radius: 5px; margin-bottom: 16px; overflow: hidden; background: var(--white); }
.transcript-block:focus-within { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.block-toolbar { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; padding: 8px; background: #f4f7fc; border-bottom: 1px solid var(--line); }
.block-toolbar select { width: auto; flex: 1; min-width: 110px; font-size: 12px; min-height: 36px; padding: 6px; }
.block-button { padding: 7px 6px; min-height: 36px; border: 1px solid transparent; border-radius: 3px; background: transparent; color: var(--ink); font-size: 12px; }
.block-button:hover:not(:disabled) { background: var(--pale-blue); border-color: #cbdaf8; }
.block-button[data-action="remove"] { color: var(--danger); }
.block-text { width: 100%; display: block; resize: vertical; border: 0; border-radius: 0; padding: 15px; margin: 0; min-height: 110px; background: var(--white); color: var(--ink); font-family: Georgia, "Times New Roman", serif; font-size: 16px; line-height: 1.8; }
.block-text:focus-visible { outline-offset: -3px; }
.block-text:disabled { opacity: 1; color: var(--muted); }
.transcript-block[data-block-type="quote"] .block-text { border-left: 3px solid #b7c8e3; padding-left: 18px; }
.transcript-block[data-block-type="heading"] .block-text { font-size: 20px; font-weight: 600; }
.transcript-block[data-block-type="footnote"] .block-text { font-size: 14px; }
.editor-actions, .page-review-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.page-review-actions { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 20px; }
.danger-button { color: var(--danger); }
.status-deleted { color: var(--danger); background: #fceef0; }
.archive-filter { margin-bottom: 18px; }
.revision-history { border-top: 1px solid var(--line); padding-top: 16px; margin: 22px 0; }
.revision-history > label { display: block; margin: 18px 0 6px; }
.revision-history > .field-hint { margin: 10px 0 16px; overflow-wrap: anywhere; }
.revision-block { margin-bottom: 20px; padding-top: 10px; border-top: 1px solid var(--line); }
.block-type-label { display: inline-block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
#history-count { color: var(--muted); font-weight: 400; }
#page-metadata { grid-template-columns: 1fr; }
#page-reader .scan-pane { align-self: start; position: sticky; top: 16px; }
#page-reader .page-columns { align-items: start; background: #eaf0f6; }
#page-reader .text-pane { background: var(--white); }
#page-reader .text-placeholder { padding: 0 0 20px; }
@media (min-width: 1500px) { .document-workbench { max-width: 1500px; } }
@media (max-width: 1100px) {
  .header-inner, .shell { padding-inline: 24px; }
  .archive-layout { grid-template-columns: 250px minmax(0, 1fr); gap: 20px; }
  .upload-panel { padding: 20px; }
  .list-heading, .document-row { grid-template-columns: minmax(0, 1fr) 115px; gap: 12px; padding-inline: 16px; }
  .list-heading > :last-child { display: none; }
  .document-date { grid-column: 1 / -1; margin-left: 55px; margin-top: -7px; }
  .archive-toolbar { align-items: stretch; flex-direction: column; }
  .search-form { width: 100%; }
}
@media (max-width: 760px) {
  .header-inner { min-height: 68px; gap: 18px; }
  .header-label { font-size: 12px; padding-left: 18px; }
  .page-heading { margin-block: 28px 22px; }
  .workspace-label { display: none; }
  .archive-layout { grid-template-columns: 1fr; gap: 28px; }
  .upload-panel { padding: 20px; }
  .file-well { padding: 14px; }
  .upload-icon { display: none; }
  .page-columns { grid-template-columns: 1fr; }
  .text-pane { border-left: 0; border-top: 1px solid var(--line); }
  .scan-link img { max-height: 650px; width: auto; margin: auto; object-fit: contain; }
  #page-reader .scan-pane { position: static; }
  .reader-controls { align-items: flex-start; gap: 14px; }
  .page-navigation { width: 100%; }
  .page-navigation select { max-width: 100%; }
  .page-navigation > label { flex-basis: 100%; order: -2; }
  .page-navigation > select { flex: 1; min-width: 150px; order: -1; }
  .page-navigation > button { flex: 1; }
  .page-bar { flex-wrap: wrap; gap: 8px; padding-inline: 16px; }
  .page-provenance { flex-wrap: wrap; gap: 8px; }
  .pages-heading { align-items: baseline; }
  .pages-heading > span { text-align: right; }
  .metadata { grid-template-columns: 1fr; gap: 14px; }
  .document-heading { gap: 12px; }
  .document-heading > .status { flex-shrink: 0; }
  .document-actions { gap: 8px; }
}
@media (max-width: 420px) {
  .header-inner, .shell { padding-inline: 16px; }
  .header-label { display: none; }
  .brand { font-size: 25px; }
  .document-row { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding-inline: 12px; }
  .document-identity { gap: 10px; grid-column: 1 / -1; }
  .document-state { grid-column: 1; }
  .file-symbol { width: 30px; height: 40px; }
  .document-date { margin: 0; grid-column: 2; text-align: right; }
  .list-heading { display: none; }
  .progress-caption { font-size: 10px; }
  .status { padding-inline: 6px; }
  .site-footer { align-items: flex-start; }
  .site-footer span { text-align: right; max-width: 190px; }
  .login-panel { padding: 28px; }
  .text-pane, .scan-pane { padding-inline: 16px; }
  .document-heading { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
