/* Sheetsa's shared stylesheet — the visual language of the "Sheetsa UI
   Mockups" brand board (2026-09-20), applied to the three PWAs and the
   static pages. Tokens first, so a page never hard-codes a color;
   the dark scheme redefines the same tokens rather than restyling
   elements. Per-app accent comes from <body data-app="split|archive|
   specs">, the mockups' own three accents. */

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url("./vendor/fonts/ibm-plex-sans-latin.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./vendor/fonts/ibm-plex-mono-latin-500.woff2") format("woff2");
}

:root {
  color-scheme: light dark;
  /* Brand constants (the icons and logo use these too). */
  --vermillion: #e14b2d;
  --ochre: #f4a261;
  --cobalt: #2f6690;
  /* Surface tokens, light. */
  --paper: #f4f1ea;
  --panel: #ffffff;
  --ink: #1f1d1a;
  --muted: #5c574f;
  --border: #ddd7cb;
  --rule: #e8e4dc;
  --chip: #e8e4dc;
  --selected: #fdf3e7;
  --link: #b3391f;
  --link-hover: #8f2d18;
  /* Field-state palette — the one compliance element on screen, the
     same on every page (see the brand board's note). Observed is a
     quiet neutral, Confirmed blue (two engines agreed), Inferred ochre
     (a guess, please check), Verified green (a person's answer). */
  --state-observed-bg: var(--chip);
  --state-observed-fg: var(--ink);
  --state-confirmed-bg: #2b5c8a;
  --state-confirmed-fg: #ffffff;
  --state-inferred-bg: #f4a261;
  --state-inferred-fg: #3a2306;
  --state-verified-bg: #2f6f4f;
  --state-verified-fg: #ffffff;
  /* Per-app accent; Split's is the default. --accent-ink is the text
     color that clears 4.5:1 on a filled accent button. */
  --accent: #e14b2d;
  --accent-fill: #c93f22;
  --accent-ink: #ffffff;
  --accent-soft: rgba(225, 75, 45, 0.1);
  --danger-bg: #fbe4de;
  --danger-fg: #8f2d18;
  --warn-bg: #fdf3e7;
  --warn-fg: #6b3a0b;
  --ok-fg: #2f6f4f;
  --sans: "IBM Plex Sans", system-ui, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Consolas, monospace;
  --bg: var(--paper);
  --fg: var(--ink);
}
body[data-app="archive"] {
  --accent: #c9782a;
  --accent-fill: #c9782a;
  --accent-ink: #2b1a05;
  --accent-soft: rgba(201, 120, 42, 0.12);
}
body[data-app="specs"] {
  --accent: #2f6690;
  --accent-fill: #2f6690;
  --accent-ink: #ffffff;
  --accent-soft: rgba(47, 102, 144, 0.12);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1b1917;
    --panel: #24211e;
    --ink: #f0ece4;
    --muted: #b1a99d;
    --border: #3d3832;
    --rule: #2f2b27;
    --chip: #3d3832;
    --selected: #3a2b1c;
    --link: #f08a72;
    --link-hover: #f6a893;
    --state-confirmed-bg: #3c76ad;
    --state-verified-bg: #3a8a62;
    --danger-bg: #4a1f17;
    --danger-fg: #f6b3a4;
    --warn-bg: #3a2b1c;
    --warn-fg: #f4c99a;
    --ok-fg: #7fc9a0;
  }
  body[data-app="split"] {
    --accent-fill: #e14b2d;
  }
}

/* ------------------------------------------------------------------ */
/* Page basics                                                         */
/* ------------------------------------------------------------------ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--fg);
}
a { color: var(--link); }
a:hover { color: var(--link-hover); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.005em; }
h2 { font-size: 18px; margin: 28px 0 8px; }
p { margin: 0 0 12px; }
code, .mono { font-family: var(--mono); font-weight: 500; }
button, input, select { font: inherit; color: inherit; }
img { max-width: 100%; }

.page { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; }
.page-wide { max-width: none; padding: 0; }

.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.subtitle { color: var(--muted); margin: 4px 0 16px; font-size: 15px; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.legal { color: var(--muted); font-size: 12px; margin: 32px 0 0; padding-top: 12px; border-top: 1px solid var(--border); }
.legal.page { margin: 32px auto 0; padding: 12px 16px 32px; }

/* ------------------------------------------------------------------ */
/* The app bar: brand, steps or sections, autosave note, actions.      */
/* ------------------------------------------------------------------ */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 56px;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand img { width: 24px; height: 24px; flex-shrink: 0; }
.brand h1, .brand .brand-name { font-size: 16px; font-weight: 600; letter-spacing: 0.01em; margin: 0; white-space: nowrap; }
.brand .brand-name a { color: inherit; text-decoration: none; }
.app-bar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.app-bar nav a {
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--muted);
  border: 1px solid transparent;
}
.app-bar nav a:hover { color: var(--fg); background: var(--paper); }
.app-bar nav a[aria-current="page"], .app-bar nav a[aria-current="step"] {
  color: var(--fg);
  font-weight: 600;
  background: var(--paper);
  border-color: var(--border);
}
.app-bar .spacer { flex-grow: 1; }
.bar-note { font-size: 13px; color: var(--muted); white-space: nowrap; }
.bar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bar-actions:empty { display: none; }

/* Buttons and chips */
.btn, .download-link, .resume-banner button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--fg);
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover, .download-link:hover { background: var(--paper); color: var(--fg); }
.btn.primary, .download-link, .resume-banner button.primary {
  background: var(--accent-fill);
  border-color: var(--accent-fill);
  color: var(--accent-ink);
  font-weight: 600;
}
.btn.primary:hover, .download-link:hover, .resume-banner button.primary:hover { filter: brightness(0.94); color: var(--accent-ink); }
.btn.verify { background: var(--state-verified-bg); border-color: var(--state-verified-bg); color: var(--state-verified-fg); font-weight: 600; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.small { min-height: 30px; padding: 0 10px; font-size: 13px; }

.chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chips-label { font-size: 13px; color: var(--muted); }
.chip {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--fg);
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 600; }
.chip:disabled { opacity: 0.5; cursor: default; }

.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--panel); }
.segmented button { min-height: 32px; padding: 0 14px; border: none; background: transparent; color: var(--fg); font-size: 13px; cursor: pointer; }
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--paper); font-weight: 600; }

/* Badges: field states, classifications, and the small facts. */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--fg);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
}
.badge.state-observed { background: var(--state-observed-bg); color: var(--state-observed-fg); }
.badge.state-confirmed { background: var(--state-confirmed-bg); color: var(--state-confirmed-fg); }
.badge.state-inferred { background: var(--state-inferred-bg); color: var(--state-inferred-fg); font-weight: 600; }
.badge.state-verified { background: var(--state-verified-bg); color: var(--state-verified-fg); }
.badge.state-archive, .badge.unmatched { background: transparent; border: 1px solid var(--accent); color: var(--link); font-weight: 600; }
.badge.state-none { background: transparent; color: var(--muted); padding-left: 0; }
.badge.matched { background: var(--chip); color: var(--muted); }
.badge.discipline { background: var(--chip); color: var(--fg); }
.badge.edited { background: var(--state-verified-bg); color: var(--state-verified-fg); }
.badge.optimized { background: var(--chip); color: var(--muted); }
/* Agreement between OCR passes (Archive): all passes agree is quiet,
   a split vote is ochre, a lone pass is the accent's outline. */
.badge.confidence-high { background: var(--chip); color: var(--muted); }
.badge.confidence-medium { background: var(--state-inferred-bg); color: var(--state-inferred-fg); }
.badge.confidence-low { background: transparent; border: 1px solid var(--accent); color: var(--link); }

/* Legend for the four states */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 12px 24px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--border); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }
.legend .dot-observed { background: var(--state-observed-bg); border: 1px solid var(--border); }
.legend .dot-confirmed { background: var(--state-confirmed-bg); }
.legend .dot-inferred { background: var(--state-inferred-bg); }
.legend .dot-verified { background: var(--state-verified-bg); }

/* ------------------------------------------------------------------ */
/* Forms, drop zone, status                                            */
/* ------------------------------------------------------------------ */
label { display: block; margin: 16px 0 8px; font-weight: 600; }
.checkbox-label { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0; font-weight: normal; font-size: 14px; }
.checkbox-label input { margin: 4px 0 0; flex-shrink: 0; }
input[type="text"], input[type="number"], input[type="search"], select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--fg);
}
input:focus-visible, button:focus-visible, a:focus-visible, select:focus-visible, summary:focus-visible, .chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
#dropzone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  background: var(--panel);
  color: var(--muted);
}
#dropzone:hover { border-color: var(--accent); color: var(--fg); }
#dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); color: var(--fg); }
#status { margin-top: 16px; font-size: 14px; color: var(--muted); min-height: 1.2em; }
.save-status { font-size: 13px; color: var(--muted); min-height: 1.2em; }

details {
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 14px;
  background: var(--panel);
}
details[open] { padding-bottom: 14px; }
summary { cursor: pointer; padding: 10px 0; font-weight: 600; font-size: 14px; }
.region-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.region-grid label { margin: 0 0 4px; font-size: 12px; font-weight: 600; }
.region-grid input, #pattern { width: 100%; font-family: var(--mono); }
.inline-field { margin: -4px 0 12px 26px; }
.inline-field label { display: inline; margin: 0 8px 0 0; font-weight: normal; font-size: 13px; }
.inline-field input { width: 76px; padding: 4px 6px; }

.resume-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--warn-bg);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 0 0 16px;
  font-size: 13px;
}
/* An author `display` rule otherwise beats the UA stylesheet's own
   `[hidden] { display: none }` (same specificity tier, author wins),
   so `hidden` alone would stop hiding this element. Caught by a real
   screenshot of an empty banner, not assumed from the code. */
.resume-banner[hidden] { display: none; }
.resume-banner button { flex-shrink: 0; min-height: 30px; padding: 0 10px; font-size: 13px; }

/* Validate/optimize results lists */
#results ul { list-style: none; padding: 0; margin: 12px 0; }
#results li { padding: 8px 12px; border-radius: 6px; margin-bottom: 6px; font-size: 14px; background: var(--panel); border: 1px solid var(--rule); }
#results li.error { background: var(--danger-bg); color: var(--danger-fg); border-color: transparent; }
#results li.warn { background: var(--warn-bg); color: var(--warn-fg); border-color: transparent; }
#results li.detail { background: none; border: none; color: var(--muted); padding: 2px 12px; font-size: 13px; }
.clean { color: var(--ok-fg); font-weight: 600; }
#downloadArea:empty { display: none; }

/* ------------------------------------------------------------------ */
/* Split: the review screen                                            */
/* ------------------------------------------------------------------ */
.drop-step { max-width: 760px; margin: 0 auto; padding: 24px 16px 8px; }
.drop-step .intro { font-size: 15px; color: var(--muted); margin: 0 0 16px; }
.drop-step.compact { padding-top: 12px; }
.drop-step.compact .intro, .drop-step.compact .hint-lead { display: none; }
.drop-step.compact #dropzone { padding: 12px; font-size: 13px; }
.drop-step.compact details, .drop-step.compact .checkbox-label, .drop-step.compact .inline-field, .drop-step.compact #status, .drop-step.compact .size-guidance { display: none; }
.size-guidance { margin: 8px 0 0; }
.drop-step.compact .options-toggle { display: inline-block; }
.options-toggle { display: none; margin: 8px 0 0; }
.drop-step.show-options details, .drop-step.show-options .checkbox-label, .drop-step.show-options .inline-field { display: revert; }
.drop-step.show-options .checkbox-label { display: flex; }

.summary-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.summary-bar[hidden] { display: none; }
.summary-title { font-size: 18px; font-weight: 600; word-break: break-all; }
.summary-facts { font-size: 13px; color: var(--muted); }
.summary-bar .spacer { flex-grow: 1; }

.review { display: grid; grid-template-columns: minmax(0, 1fr); }
.review[hidden] { display: none; }
.sheet-list { min-width: 0; }
#sheetPanel.sheet-list { padding: 0 16px; }
@media (min-width: 1100px) { #sheetPanel.sheet-list { padding: 0; } }
.sheet-table-head { display: none; }

/* Specs groups its section cards under one heading per discipline
   (#43); the heading is a quiet eyebrow in the shared tokens. */
.discipline-heading {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 20px 0 8px;
}
.discipline-heading:first-child { margin-top: 0; }
#sectionPanel:not(:empty) { margin-top: 12px; }

/* Cards (narrow screens, and every non-Split page that reuses them). */
.sheet-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 0 0 8px;
  font-size: 13px;
  background: var(--panel);
}
.sheet-card.unmatched { border-color: var(--accent); }
.sheet-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.sheet-card-head .page-label { color: var(--muted); font-weight: 600; }
.sheet-card-head .badges { display: flex; gap: 6px; flex-wrap: wrap; }
.sheet-card-fields { display: grid; grid-template-columns: 1fr 1.6fr; gap: 8px; margin-bottom: 6px; }
.sheet-card-fields-secondary { grid-template-columns: 1.6fr 1fr; }
.sheet-card-field input { width: 100%; padding: 6px 8px; font-size: 13px; }
.sheet-card-field.field-number input, .sheet-card-field.field-rev input { font-family: var(--mono); }
/* One per field, not one per sheet — Observed/Inferred/Verified is a
   per-FIELD trust state (resolver.js). Empty renders nothing but keeps
   its height so the input above never jumps. */
.field-state { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; min-height: 12px; color: var(--muted); }
.field-state-inferred { color: #8a4a12; font-weight: 600; }
.field-state-confirmed { color: var(--state-confirmed-bg); font-weight: 600; }
.field-state-verified { color: var(--state-verified-bg); font-weight: 600; }
@media (prefers-color-scheme: dark) {
  .field-state-inferred { color: var(--ochre); }
  .field-state-confirmed { color: #8cb8e3; }
  .field-state-verified { color: #7fc9a0; }
}
.sheet-card-filename { color: var(--muted); font-size: 12px; font-family: var(--mono); word-break: break-all; }
.sheet-card-reason { color: var(--muted); font-size: 12px; margin-top: 4px; }
.sheet-card .read-as { margin-top: 6px; }
.sheet-card .read-as a { font-weight: 600; font-size: 13px; }
.sheet-card.selected { border-color: var(--ochre); background: var(--selected); }
.sheet-list[data-filter="needs-look"] .sheet-card:not(.needs-look),
.sheet-list[data-filter="needs-archive"] .sheet-card:not(.needs-archive) { display: none; }

/* The wide layout: the mockup's table plus the selected-sheet panel. */
@media (min-width: 1100px) {
  .review { grid-template-columns: minmax(0, 1fr) 360px; }
  .review.no-detail { grid-template-columns: minmax(0, 1fr); }
  .sheet-table {
    --cols: 48px 104px minmax(0, 1fr) 116px 64px 104px 128px;
  }
  .sheet-table .sheet-table-head {
    display: grid;
    grid-template-columns: var(--cols);
    column-gap: 10px;
    padding: 0 20px;
    height: 40px;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
  }
  .sheet-table .sheet-card {
    display: grid;
    grid-template-columns: var(--cols);
    grid-template-areas:
      "page num title disc rev date state"
      "page num meta disc rev date state";
    column-gap: 10px;
    align-items: center;
    min-height: 60px;
    padding: 8px 20px;
    margin: 0;
    border: none;
    border-bottom: 1px solid var(--rule);
    border-radius: 0;
    background: var(--panel);
    font-size: 14px;
    cursor: pointer;
  }
  .sheet-table .sheet-card:hover { background: var(--paper); }
  .sheet-table .sheet-card.selected { background: var(--selected); box-shadow: inset 4px 0 0 var(--ochre); }
  .sheet-table .sheet-card.unmatched { border-color: var(--rule); }
  .sheet-table .sheet-card-head { display: contents; }
  .sheet-table .sheet-card-head .page-label { grid-area: page; font-size: 13px; color: var(--muted); font-weight: 400; }
  .sheet-table .sheet-card-head .badges { grid-area: disc; }
  .sheet-table .sheet-card-fields { display: contents; }
  .sheet-table .field-number { grid-area: num; }
  .sheet-table .field-title { grid-area: title; }
  .sheet-table .field-date { grid-area: date; }
  .sheet-table .field-rev { grid-area: rev; }
  .sheet-table .sheet-card-field input { width: 100%; padding: 5px 8px; font-size: 14px; background: transparent; border-color: transparent; }
  .sheet-table .sheet-card-field input:hover, .sheet-table .sheet-card-field input:focus { background: var(--panel); border-color: var(--border); }
  .sheet-table .sheet-card.selected .sheet-card-field input { border-color: var(--border); background: var(--panel); }
  .sheet-table .sheet-card-meta { grid-area: meta; display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: -2px; }
  .sheet-table .sheet-card-meta:empty { display: none; }
  /* The output filename lives in the selected-sheet panel on a wide
     screen (the mockup's table has no filename column); the card layout
     keeps showing it. The reason line stays: it says why a row is empty. */
  .sheet-table .sheet-card-filename { display: none; }
  /* Observed is the quiet default; only a state that asks for attention
     is labelled under its own field here. The word stays in the DOM. */
  .sheet-table .field-state-observed { visibility: hidden; }
  .sheet-table .badge.state-none { white-space: normal; line-height: 1.3; }
  .sheet-table .sheet-card-reason { margin-top: 0; }
  .sheet-table .read-as { grid-area: state; margin: 0; }
  .sheet-table .badges .badge.edited, .sheet-table .badges .badge.optimized { display: none; }
  .sheet-table .badges .badge.edited.always, .sheet-table .badges .badge.optimized.always { display: inline-block; }
  .sheet-table .badges { display: flex; gap: 6px; flex-wrap: wrap; }
}

/* The selected-sheet panel */
.detail-panel {
  background: var(--panel);
  border-left: 1px solid var(--border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 14px;
}
.detail-panel[hidden] { display: none; }
@media (min-width: 1100px) {
  .detail-panel { position: sticky; top: 56px; align-self: start; max-height: calc(100vh - 56px); overflow: auto; }
}
@media (max-width: 1099px) {
  .detail-panel { border-left: none; border-top: 1px solid var(--border); margin: 8px 16px 0; border: 1px solid var(--border); border-radius: 8px; }
}
.detail-panel h3 { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.detail-crop {
  min-height: 120px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: repeating-linear-gradient(135deg, var(--paper) 0 10px, var(--rule) 10px 20px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.detail-crop img { display: block; max-width: 100%; max-height: 260px; }
.detail-crop .placeholder { font-size: 13px; color: var(--muted); padding: 24px; text-align: center; }
.detail-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; }
.detail-facts dt { color: var(--muted); }
.detail-facts dd { margin: 0; }
.detail-panel .reason { font-size: 14px; line-height: 1.5; }
.suggestion { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 10px; background: var(--paper); }
.suggestion .value { font-family: var(--mono); font-size: 16px; }
.suggestion .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.detail-close { align-self: flex-end; }

/* ------------------------------------------------------------------ */
/* Archive: the restore view                                           */
/* ------------------------------------------------------------------ */
.layer-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 16px 0 8px; }
.layer-bar .hint { margin: 0; }
.preview-pair { display: flex; gap: 12px; margin: 8px 0 16px; }
.preview-col { flex: 1; min-width: 0; }
.preview-caption { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.preview-col img { width: 100%; height: auto; border: 1px solid var(--border); border-radius: 8px; display: block; background: var(--panel); }
.preview-pair[data-layer="original"] .preview-col.restored, .preview-pair[data-layer="restored"] .preview-col.original { display: none; }
.stat-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.stat-chips .badge { font-size: 12px; }
.recognized-line {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 6px;
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  background: var(--panel);
}
.recognized-line-text { font-weight: 600; font-family: var(--mono); }
.recognized-line-candidates { color: var(--muted); font-size: 12px; margin-top: 4px; flex-basis: 100%; }

/* ------------------------------------------------------------------ */
/* Landing page                                                        */
/* ------------------------------------------------------------------ */
.hero { padding: 40px 0 24px; }
.hero h2 { font-size: 30px; line-height: 1.2; margin: 0 0 12px; letter-spacing: -0.01em; }
.hero p { font-size: 16px; color: var(--muted); max-width: 56ch; }
.app-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 16px 0 24px; }
.app-card { display: flex; flex-direction: column; gap: 8px; padding: 18px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); color: inherit; text-decoration: none; }
.app-card:hover { border-color: var(--ink); color: inherit; }
.app-card .mark { width: 28px; height: 28px; }
.app-card h3 { font-size: 16px; }
.app-card p { margin: 0; font-size: 13px; color: var(--muted); }
.app-card .cta { font-weight: 600; font-size: 13px; color: var(--link); }
.fact-list { display: grid; gap: 10px; margin: 8px 0 16px; padding: 0; list-style: none; }
.fact-list li { padding: 12px 14px; border-radius: 8px; background: var(--panel); border: 1px solid var(--rule); }
.fact-list strong { display: block; margin-bottom: 2px; }

/* Print: no bar, no controls. */
@media print {
  .app-bar, #dropzone, .drop-step, .legend, .detail-close { display: none !important; }
}

/* ---- Library (hosted v0, 2026-09-22) --------------------------------
   The hosted page reuses the shell, the summary bar, the badges and the
   field states above. What is new is small: a stacked form, a list of
   rows that are buttons, search results, and a sheet row laid out as a
   plain grid rather than the Split page's review table. */
.library-step { padding: 20px; max-width: 1100px; margin: 0 auto; }
.library-form { display: grid; gap: 8px; max-width: 480px; margin: 12px 0; }
.library-form label { font-size: 13px; color: var(--muted); }
.library-form input[type="text"], .library-form input[type="email"], .library-form input[type="password"], .library-form select, .library-search input {
  font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--fg);
}
.library-form .btn { justify-self: start; }
.library-alt { margin: 12px 0; max-width: 480px; }
.library-list { display: grid; gap: 6px; margin: 8px 0 16px; }
.library-row {
  font: inherit; text-align: left; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel); color: var(--fg); cursor: pointer; display: grid; gap: 2px;
}
.library-row:hover { border-color: var(--accent); }
.library-row-facts { font-size: 12px; color: var(--muted); }
.library-search { display: flex; gap: 6px; align-items: center; min-width: 320px; }
.library-search input { flex: 1; }
.library-results { padding: 8px 20px; }
.library-result { padding: 6px 0; border-bottom: 1px solid var(--rule); }
.library-columns { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
@media (min-width: 900px) { .library-columns { grid-template-columns: 420px minmax(0, 1fr); } }
#status.error { color: var(--danger-fg); }
.library-sheet { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 10px 12px; }
.library-sheet input { width: 100%; font: inherit; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--fg); }
.library-discipline { font-size: 12px; color: var(--muted); align-self: center; }
@media (min-width: 900px) {
  .library-sheet { grid-template-columns: 120px 1.1fr 2fr 1fr 0.8fr 1fr 1fr; align-items: start; }
}
