/* ===========================================================================
   Palette: the Deutsches Schallplattenmuseum's own colours.

   Their theme defines `--color-0: #e66735` (the orange of the navigation, the
   wide band, the "weiterlesen" links) and `--color-1: #d8672e`. Alongside it
   they use near-black content blocks (#212529), a slate footer and off-white
   page backgrounds. An earlier reading of their stylesheet picked up a
   Bootstrap default blue that the theme overrides — this is the visible brand.

   Contrast is the reason the orange appears at three strengths rather than one.
   Measured against WCAG AA (4.5:1 for normal text):

     #e66735 on white ................ 3.30  too low for text
     #e66735 with #21160c text ....... 5.36  so it carries dark text instead
     #b8501d on white ................ 5.00  the light-theme text/link orange
     #ef7f4a on #212529 .............. 5.73  the dark-theme text/link orange

   The brand orange therefore stays exactly itself wherever it is a *surface*
   (buttons, badges, the accent band) and is darkened or lightened only where it
   has to be *text*. Nothing in the interface uses it below 4.5:1.
   =========================================================================== */

/* Shape and depth do not change with the theme. */
:root {
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgb(0 0 0 / 35%);
}

:root,
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #1a1d20;
  --surface: #212529;
  --surface-raised: #2b3035;
  --border: #3c4247;
  --border-strong: #4d5459;

  --text: #e9ecef;
  --text-strong: #ffffff;
  --muted: #adb5bd;

  --accent: #ef7f4a;
  --accent-hover: #f59d72;
  --accent-solid: #e66735;
  --accent-solid-hover: #d8672e;
  --accent-contrast: #1a1208;
  --accent-wash: #2a1b12;

  --ok-bg: #10251a;
  --ok-text: #75b798;
  --error-bg: #2c1416;
  --error-text: #ff9d9d;
  --danger: #ff9d9d;
  --danger-solid: #a12a2a;
  --danger-contrast: #ffffff;

  --footer-bg: #15181a;
  --footer-text: #9aa1a8;
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f4f5f6;
  --surface: #ffffff;
  --surface-raised: #fbfbfc;
  --border: #dee2e6;
  --border-strong: #c3c9cf;

  --text: #212529;
  --text-strong: #0f1113;
  --muted: #6c757d;

  --accent: #b8501d;
  --accent-hover: #9c4415;
  --accent-solid: #e66735;
  --accent-solid-hover: #d8672e;
  --accent-contrast: #21160c;
  --accent-wash: #fdf1ec;

  --ok-bg: #d1e7dd;
  --ok-text: #146c43;
  --error-bg: #f8d7da;
  --error-text: #b02a37;
  --danger: #b02a37;
  --danger-solid: #b02a37;
  --danger-contrast: #ffffff;

  /* Their footer is a slate block under a light page; keeping it makes the
     bottom of the app look like the bottom of their site. */
  --footer-bg: #5f6772;
  --footer-text: #eceff1;
}

* { box-sizing: border-box; }

/* `hidden` has to win over any layout rule. A flex or grid `display` silently
   overrides it, which is how a "reveal this later" element ends up on screen
   from the start. */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* --- type ---------------------------------------------------------------- */

h1, h2, h3 {
  color: var(--text-strong);
  letter-spacing: -0.011em;
  line-height: 1.25;
}
h1 { font-size: 1.6rem; font-weight: 650; margin: 0 0 0.4rem; }
h2 { font-size: 1.1rem; font-weight: 650; margin: 0 0 0.5rem; }
h3 { font-size: 1rem; font-weight: 650; margin: 0 0 0.4rem; }
p { margin: 0 0 0.75rem; }
code { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; }

.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.lead { color: var(--muted); max-width: 62ch; }

/* --- top bar ------------------------------------------------------------- */

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem 1.75rem;
  padding: 0.7rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

/* 1100px, not 820: German labels are reliably longer than their English
   counterparts ("Einstellungen" against "Settings"), so a breakpoint tuned on
   the English wording puts the navigation into three ragged lines the moment
   someone switches language. */
@media (max-width: 1100px) {
  .topbar { grid-template-columns: 1fr auto; }
  .nav { grid-column: 1 / -1; grid-row: 2; }
  /* The signed-out bar holds only the brand and the two switches, so it stays
     on one line however narrow the window gets. */
  .topbar-anonymous { grid-template-columns: auto 1fr auto; }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text-strong);
  text-decoration: none;
  white-space: nowrap;
}
.brand-mark { width: 22px; height: 22px; flex: none; }

.nav { display: flex; gap: 1.1rem; flex-wrap: wrap; align-items: center; }
.nav-item { color: var(--accent); text-decoration: none; white-space: nowrap; }
a.nav-item:hover { color: var(--accent-hover); text-decoration: underline; }
.nav-item.is-current {
  color: var(--text-strong);
  font-weight: 650;
  text-decoration: none;
}
.nav-item.is-pending { color: var(--muted); opacity: 0.7; cursor: default; }

.account { display: flex; align-items: center; gap: 0.85rem; white-space: nowrap; }
.who { color: var(--muted); font-size: 0.9rem; }
.inline { display: inline; margin: 0; }

/* --- second-level navigation --------------------------------------------
   Only the admin area has enough screens to need it. Rendered as a strip of
   links above the heading rather than as tabs: tabs imply the content below
   belongs to one thing, and account management and price editing do not. */

.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  padding-bottom: 0.9rem;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.subnav-item { color: var(--accent); text-decoration: none; white-space: nowrap; }
.subnav-item:hover { color: var(--accent-hover); text-decoration: underline; }
.subnav-item.is-current { color: var(--text-strong); font-weight: 650; }

/* --- page frame ---------------------------------------------------------- */

main { flex: 1; padding: 1.75rem 1.5rem 2.5rem; }
main.centered { display: grid; place-items: center; align-content: center; gap: 0.75rem; }
main.centered .flash { width: min(27rem, 92vw); }
main.shell { max-width: 1120px; width: 100%; margin: 0 auto; }

.page-head { margin-bottom: 1.25rem; }
.section-heading { margin: 2rem 0 0.35rem; }

/* --- cards and grids ----------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 0.9rem; }

.grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  margin-top: 1rem;
}
.area p:last-child { margin-bottom: 0; }
/* A left edge in the brand orange, the way their content blocks are marked. */
.area-live { border-left: 4px solid var(--accent-solid); }
/* The whole card is the link, not just its heading: a heading-sized target is
   one you have to aim at, and this app has non-expert users. */
a.card { display: block; text-decoration: none; color: inherit; }
a.card:hover { border-color: var(--accent-solid); }
a.card h3 { color: var(--accent); }
a.card:hover h3 { color: var(--accent-hover); }

/* --- forms --------------------------------------------------------------- */

.form { width: min(27rem, 92vw); display: flex; flex-direction: column; gap: 0.3rem; }
.form label { font-size: 0.86rem; color: var(--muted); margin-top: 0.55rem; }

input[type="text"],
input[type="email"],
input[type="password"],
select {
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  width: 100%;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent-solid);
  outline-offset: 2px;
}

button.primary {
  margin-top: 1rem;
  padding: 0.6rem 1rem;
  border: 0;
  border-radius: var(--radius-sm);
  /* The brand orange itself, carrying dark text: 5.36:1, where white on the
     same orange would be 3.30:1. */
  background: var(--accent-solid);
  color: var(--accent-contrast);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
button.primary:hover { background: var(--accent-solid-hover); }
button.primary.danger-button { background: var(--danger-solid); color: var(--danger-contrast); }

.link, button.link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}
.link:hover, button.link:hover { color: var(--accent-hover); }
.link.danger, button.link.danger { color: var(--danger); }

/* Horizontal on a wide screen, stacked on a narrow one — same markup. */
.row-form { display: flex; flex-wrap: wrap; gap: 0.85rem; align-items: flex-end; }
.row-form > div { display: flex; flex-direction: column; gap: 0.25rem; min-width: 12rem; flex: 1; }
.row-form label { font-size: 0.86rem; color: var(--muted); }
.row-form button { margin-top: 0; }

textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  /* Prompts are read as text but edited as data: a fixed pitch makes a stray
     space at the end of a line visible. */
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  resize: vertical;
}

/* Money lines up on the decimal point or it cannot be compared at a glance. */
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* The per-row editor belongs to the row above it, so the two are not separated.
   The row above drops its bottom border rather than the editor dropping its top
   one: `.actions` is a flex container, whose box is shorter than the row, so its
   border paints as a stray line across part of the width. */
.table tbody tr:has(+ .edit-row) td { border-bottom: 0; }
.edit-row > td { padding-top: 0; }

.stack { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.6rem; }
/* Not stretched: a full-width orange bar reads as the page's main action, and
   "save this key" is not more important than everything else on the screen. */
.stack button { margin-top: 0; align-self: flex-start; }

/* Baseline-aligned: a row pairs a button with a text link, and without this
   the link sits at the top of its own stretched form instead of level with
   the button it is the alternative to. */
.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem;
  margin: 0.6rem 0 0.2rem;
}

/* --- badges, chips, states ---------------------------------------------- */

.badge {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 650;
  padding: 0.12rem 0.45rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--muted);
  white-space: nowrap;
}
.badge-required { border-color: var(--accent-solid); color: var(--accent); }

.chip-button {
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 999px;
  padding: 0.22rem 0.65rem;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  line-height: 1.5;
}
.chip-button:hover { border-color: var(--accent-solid); color: var(--accent); }
.chip-button[aria-pressed="true"] {
  background: var(--accent-solid);
  border-color: var(--accent-solid);
  color: var(--accent-contrast);
  font-weight: 650;
}
.toolbar-controls { display: flex; align-items: center; gap: 0.4rem; }
.lang-group { display: inline-flex; gap: 0.2rem; }

.state-on { color: var(--ok-text); font-weight: 600; }
.state-off { color: var(--muted); }
.key-status { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.key-status .working { color: var(--ok-text); font-weight: 650; }
.key-status .failing { color: var(--danger); font-weight: 650; }
.key-status .untested { color: var(--muted); font-weight: 650; }
.key-status .missing { color: var(--muted); }
.key-status code {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

/* --- flashes ------------------------------------------------------------- */

.flash {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border-left: 4px solid transparent;
  margin-bottom: 1rem;
}
.flash-error { background: var(--error-bg); color: var(--error-text); border-left-color: var(--danger); }
.flash-success { background: var(--ok-bg); color: var(--ok-text); border-left-color: var(--ok-text); }
.flash-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-solid);
  color: var(--text);
}

/* --- tables -------------------------------------------------------------- */

/* Horizontal scroll beats ragged wrapping: "Regular user" split over two lines
   in a 90-pixel column is harder to read than a table you nudge sideways. */
.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin: 1rem 0;
}

.table { width: 100%; border-collapse: collapse; }
.table th,
.table td {
  text-align: left;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: var(--surface-raised);
  white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: 0; }
.nowrap, .table td.cell-tight, .table th.cell-tight { white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; gap: 0.45rem 0.9rem; }

/* --- working on several at once ------------------------------------------
   The bar sits above the table rather than below it: the actions have to be
   visible before somebody starts ticking boxes, or they tick twenty and then
   go looking for the verb. */

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 1.1rem;
  padding: 0.6rem 0.85rem;
  margin: 1rem 0 -0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
}
.bulk-bar #record-count, .bulk-bar #batch-count { margin-right: auto; }
.bulk-scope { margin: 0.9rem 0 0; font-size: 0.86rem; }

/* A marked row is a selection the user made and has to be able to see at a
   glance — a word in the second line is not enough on a list of fifty. */
.table tbody tr.is-marked { background: var(--accent-wash); }
.table tbody tr.is-marked td:first-child { box-shadow: inset 3px 0 0 var(--accent-solid); }

.plain-list { list-style: none; margin: 0.4rem 0 0.8rem; padding: 0; }
.plain-list li { padding: 0.25rem 0; }

/* --- one import, one step ------------------------------------------------
   The panel that says what to do now. It is the page's subject, so it is the
   biggest thing on it — the version before this had the same information as an
   underlined link under a progress bar, and people missed it. */

.step { border-left: 4px solid var(--border-strong); }
.step h2 { margin-top: 0; }
.step-say { max-width: 62ch; }
.step-ask { border-left-color: var(--accent-solid); background: var(--accent-wash); }
.step-good { border-left-color: var(--ok-text); }
.step-bad { border-left-color: var(--danger-solid); }
.step-busy { border-left-color: var(--muted); }
.step-second { margin: 0.7rem 0 0; }

/* A target, not a text link: this is the one control on the screen. */
.big, a.button-link.big, button.primary.big {
  font-size: 1.05rem;
  padding: 0.7rem 1.4rem;
}

/* What was found, as records rather than log lines: the answer to "did it
   work?" is pictures and names, not timestamps. */
.found {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.8rem;
  margin: 1rem 0;
}
.found-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
}
.found-card:hover { border-color: var(--accent-solid); }
.found-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 0.35rem;
}
.found-name { font-weight: 650; color: var(--text-strong); }

/* The machine's own account of itself: available, not in the way. */
.machine { margin: 1.5rem 0; }
.machine > summary { margin-bottom: 0.8rem; }
.rename { margin-top: 0.6rem; }

/* --- where am I: the crumb strip on an import --------------------------- */

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: baseline;
  margin: 0 0 0.9rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.crumb + .crumb::before { content: "→"; margin-right: 0.5rem; color: var(--border-strong); }
.crumb.is-done { color: var(--text); }
.crumb.is-here { color: var(--accent); font-weight: 650; }
.crumb.is-later { opacity: 0.55; font-style: italic; }

.next-step {
  margin: 0 0 1rem;
  padding: 0.55rem 0.85rem;
  border-left: 4px solid var(--accent-solid);
  background: var(--accent-wash);
  border-radius: var(--radius-sm);
}
.next-step.tone-waiting { border-left-color: var(--border-strong); background: var(--surface-raised); }

/* The worked example on the enrichment page: what actually goes to the model.
   Monospaced and scrollable, because it is a request rather than prose. */
.preview { margin-top: 1rem; }
.preview-label { margin: 0.9rem 0 0.2rem; font-size: 0.95rem; }
.preview-text {
  margin: 0.3rem 0 0;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-x: auto;
  max-height: 22rem;
}

/* A researched value carries its evidence: how sure the model was, and the page
   it used. The confidence is coloured because "unsure" is the one worth
   noticing. */
.prov-confidence { border-color: var(--border-strong); }
.prov-confidence.conf-low { border-color: var(--accent-solid); color: var(--accent); }
.prov-source { text-decoration: underline; color: var(--accent); }
.prov-source:hover { color: var(--accent-hover); }

/* Choosing the columns: a grid of checkboxes, folded away. Not in the settings
   page — it is a decision about the screen you are looking at. */
.columns-panel { margin: 1rem 0 0; }
.columns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 0.2rem 1rem;
  margin: 0.6rem 0;
}
.columns-grid .checkbox { margin: 0; }

/* The whole picture enlarges it. The magnifier is a hint in the corner, not the
   target: a 14-pixel control is something you have to aim at, and a sleeve is a
   72-pixel one you cannot miss. */
.row-zoom { position: relative; display: inline-block; text-decoration: none; cursor: zoom-in; }
.row-zoom-badge {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 1.2rem;
  height: 1.2rem;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--accent);
  font-size: 0.75rem;
  line-height: 1;
  /* Decoration: the link around it is what gets clicked. */
  pointer-events: none;
}
.row-zoom:hover .row-thumb { border-color: var(--accent-solid); }
.row-zoom:hover .row-zoom-badge { border-color: var(--accent-solid); color: var(--accent-hover); }
.row-zoom:focus-visible { outline: 2px solid var(--accent-solid); outline-offset: 2px; }

/* The inventory number is read off a shelf label and compared by eye, so it is
   set in the fixed-pitch face like the other identifiers. */
.number-cell code { font-size: 0.9rem; }

/* One dialogue for the whole table. A native <dialog>: Esc closes it, focus is
   trapped, and the close button works with no script at all. */
.image-modal {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 1rem;
  max-width: min(92vw, 900px);
  box-shadow: 0 10px 40px rgb(0 0 0 / 45%);
}
.image-modal::backdrop { background: rgb(0 0 0 / 65%); }
.image-modal figure { margin: 0 0 0.8rem; }
.image-modal img {
  display: block;
  max-width: 100%;
  /* Room for the caption and the button on a laptop screen. */
  max-height: 74vh;
  margin: 0 auto 0.5rem;
  border-radius: var(--radius-sm);
}
.image-modal button { margin-top: 0; }

/* The tick a volunteer presses to say "I have looked at this one". Sized like a
   target rather than a label: it is the most-pressed control on the screen. */
.tick {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
}
.tick:hover { border-color: var(--accent-solid); color: var(--text); }
.tick.is-on {
  background: var(--ok-bg);
  border-color: var(--ok-text);
  color: var(--ok-text);
  font-weight: 650;
}
.hidden-form { display: none; }

/* Folded by default: six verbs across the top of the list were the loudest
   thing on a screen used to work through a box one record at a time. */
.bulk-details { margin: 1rem 0 0; }
.bulk-details .bulk-bar { margin-top: 0.5rem; }

/* A record's Excel state, in the list: "changed since" is the one worth
   noticing, so it is the one that gets a colour. */
.excel-exported { color: var(--muted); }
.excel-modified { color: var(--accent); font-weight: 650; }

/* --- what needs attention ------------------------------------------------ */

.attention-card { border-left: 4px solid var(--accent-solid); }
.attention-list { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.attention-item { padding: 0.3rem 0 0.3rem 1.1rem; position: relative; }
/* A dot rather than a bullet, coloured by urgency: blocked and attention read
   as "act", waiting reads as "leave it alone". */
.attention-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.75rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent-solid);
}
.attention-item.tone-blocked::before { background: var(--danger-solid); }
.attention-item.tone-waiting::before { background: var(--muted); }
.attention-item.tone-normal::before { background: var(--border-strong); }

/* --- the journey strip --------------------------------------------------- */

.journey {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 1.75rem;
  padding: 0;
  counter-reset: none;
}
.journey-stage { display: flex; }
.journey-link {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "step name" "step hint" "step extra";
  gap: 0.1rem 0.6rem;
  flex: 1;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
}
a.journey-link:hover { border-color: var(--accent-solid); }
.journey-step {
  grid-area: step;
  align-self: start;
  width: 1.5rem;
  height: 1.5rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-solid);
  color: var(--accent-contrast);
  font-size: 0.8rem;
  font-weight: 650;
}
.journey-stage.is-pending .journey-step { background: var(--border-strong); color: var(--text); }
.journey-name { grid-area: name; font-weight: 650; color: var(--text-strong); }
.journey-hint { grid-area: hint; font-size: 0.82rem; color: var(--muted); }
.journey-count, .journey-later { grid-area: extra; font-size: 0.82rem; margin-top: 0.25rem; }
.journey-count { color: var(--accent); font-weight: 650; }
.journey-later { color: var(--muted); }

/* --- overview: recent imports and the spend figure ---------------------- */

.grid.two { grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); }
.recent-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 0.8rem; }
.recent-row .chip-link { margin-left: auto; }
.chip-link {
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-size: 0.8rem;
  text-decoration: none;
  color: var(--accent);
  white-space: nowrap;
}
.chip-link:hover { border-color: var(--accent-solid); }
.chip-link.tone-attention { border-color: var(--accent-solid); color: var(--accent); }
.chip-link.tone-waiting { color: var(--muted); }
.big-number { font-size: 2rem; font-weight: 650; color: var(--text-strong); margin: 0.3rem 0; }

/* --- handover panel ------------------------------------------------------ */

/* A one-time password has to be impossible to miss and easy to read out. */
.handover { border-left: 4px solid var(--accent-solid); background: var(--accent-wash); }
.handover-values {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem 1rem;
  margin: 0 0 0.75rem;
}
.handover-values dt { color: var(--muted); }
.handover-values dd { margin: 0; }
.handover code {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}
.handover code.big { font-size: 1.15rem; letter-spacing: 0.06em; }
.copy-button { margin-left: 0.5rem; }

/* --- settings appearance ------------------------------------------------- */

.appearance-rows { display: flex; flex-direction: column; gap: 0.55rem; }
.appearance-row { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.appearance-label { min-width: 6.5rem; color: var(--muted); font-size: 0.86rem; }

details summary { cursor: pointer; margin-top: 0.6rem; color: var(--accent); }
details[open] summary { margin-bottom: 0.2rem; }

/* --- footer -------------------------------------------------------------- */

/* Slate, like theirs, in both themes. */
.footer {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--footer-bg);
  color: var(--footer-text);
  font-size: 0.8rem;
}
.footer .badge { color: var(--footer-text); border-color: var(--footer-text); }

/* --- M3: batches, progress, records ------------------------------------- */

.page-head.with-action {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.head-actions { display: flex; gap: 0.9rem; align-items: center; }

/* A link that carries the weight of a button, for "start here" actions. */
.button-link {
  display: inline-block;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-sm);
  background: var(--accent-solid);
  color: var(--accent-contrast);
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}
.button-link:hover { background: var(--accent-solid-hover); }

.field-label { display: block; font-size: 0.86rem; color: var(--muted); margin-bottom: 0.3rem; }
input[type="file"] {
  padding: 0.6rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--text);
  font: inherit;
  width: 100%;
}
input[type="search"] {
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  width: 100%;
}
.checkbox { display: flex; align-items: center; gap: 0.5rem; margin: 0.7rem 0 0; }
.checkbox input { width: auto; }
.batch-options { margin-top: 0.9rem; }
/* Four controls and a button, evenly on one row when there is space and in two
   tidy rows when there is not — rather than one control stretching across the
   full width because it happened to wrap. */
.filters { margin-bottom: 1rem; }
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.75rem;
  align-items: end;
}
.filter-grid > div { display: flex; flex-direction: column; gap: 0.25rem; }
.filter-grid label { font-size: 0.86rem; color: var(--muted); }
.filter-grid button { margin-top: 0; align-self: end; }

.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  overflow: hidden;
  margin: 0.4rem 0 0.6rem;
}
.progress-bar {
  height: 100%;
  background: var(--accent-solid);
  transition: width 0.3s ease;
}
.progress-bar.is-done { background: var(--ok-text); }
.progress-bar.is-failed { background: var(--danger-solid); }

.log-heading { margin-top: 1.1rem; }
.activity {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 16rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.activity-line {
  display: flex;
  gap: 0.6rem;
  padding: 0.3rem 0.6rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.activity-line:last-child { border-bottom: 0; }
.activity-line.level-error { color: var(--error-text); }
.activity-line.level-warning { color: var(--accent); }

.thumb-grid {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
  margin-top: 0.75rem;
}
.thumb { margin: 0; position: relative; }
.thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-raised);
}
.thumb figcaption { position: absolute; bottom: 0.35rem; left: 0.35rem; background: var(--surface); }

.row-thumb {
  /* A sleeve at 44px was a grey square. Big enough to recognise the record
     without opening it, which is what makes ticking one off from the list
     possible at all. */
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  display: block;
}
.record-title { font-weight: 600; font-size: 1.02rem; }

.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1rem 0; }

.empty { text-align: center; }
.empty p { color: var(--muted); }

/* The detail panel: photo beside the form on a wide screen, stacked below it on
   a narrow one — the photo is reference material, the form is the work. */
.detail-layout {
  display: grid;
  grid-template-columns: minmax(13rem, 20rem) 1fr;
  gap: 0.9rem;
  align-items: start;
}
@media (max-width: 860px) {
  /* The form comes first when the two cannot sit side by side: the photo is
     reference material, the form is the work. Stacked photo-first, a
     full-width sleeve pushed every field below the fold. */
  .detail-layout { grid-template-columns: 1fr; }
  .detail-image { order: 2; }
  .detail-form { order: 1; }
}
.detail-image img {
  width: 100%;
  /* Contained and capped: a tall photo must not become the page. */
  max-height: 16rem;
  object-fit: contain;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-raised);
}
.sibling-list { margin: 0.35rem 0 0; padding-left: 1.1rem; }

.field-row { display: flex; flex-direction: column; gap: 0.25rem; margin-bottom: 0.65rem; }
.field-row label {
  font-size: 0.88rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.provenance-key { margin: 0.6rem 0 1rem; }

/* Where a value came from, at a glance: yours, AI-completed, or read off the
   photo. The distinction is the whole point of keeping three layers. */
.prov {
  font-size: 0.7rem;
  padding: 0.02rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.prov-yours { border-color: var(--ok-text); color: var(--ok-text); }
.prov-enriched { border-color: var(--accent-solid); color: var(--accent); }
.prov-extracted { color: var(--muted); }

.record-actions { margin-top: 0.9rem; }

/* --- M4: video upload, frame selection ---------------------------------- */

.frame-gate { border-left: 4px solid var(--accent-solid); }
.frame-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0;
  flex-wrap: wrap;
}
.frame-count { margin-left: auto; }

.frame-grid {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  margin-bottom: 1rem;
}

/* The whole tile is the control: a checkbox this size is a target you can hit
   without aiming, which matters more than the checkbox being visible. */
.frame {
  position: relative;
  display: block;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  background: var(--surface-raised);
}
.frame img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; opacity: 0.55; }
.frame.is-chosen { border-color: var(--accent-solid); }
.frame.is-chosen img { opacity: 1; }
.frame input {
  position: absolute;
  top: 0.4rem;
  left: 0.4rem;
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent-solid);
  z-index: 1;
}
.frame-zoom {
  position: absolute;
  top: 0.3rem;
  right: 0.35rem;
  z-index: 2;
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  background: var(--surface);
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  line-height: 1.3;
}
.frame-zoom:hover { color: var(--accent-hover); }

.frame-time {
  position: absolute;
  bottom: 0.35rem;
  right: 0.4rem;
  font-size: 0.72rem;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
}

.algo-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.6rem;
  border: 0;
  padding: 0;
  margin: 0.5rem 0 0.75rem;
}
.algo {
  display: grid;
  gap: 0.15rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface-raised);
}
.algo.is-chosen { border-color: var(--accent-solid); background: var(--accent-wash); }
.algo-name { font-weight: 650; }
.algo input { width: auto; margin-bottom: 0.2rem; }

/* One import form rather than two cards, so the file input is the first thing
   the eye lands on. */
.import-form { display: flex; flex-direction: column; gap: 0.45rem; max-width: 46rem; }
.import-form button { align-self: flex-start; }

/* "or" between the two ways of starting an import: a rule with the word sitting
   in a gap in it, so the second way reads as an alternative rather than as one
   more field to fill in. */
.or-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.9rem 0 0.35rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.or-divider::before,
.or-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
/* The options sit in a row of their own; the column rule that used to apply to
   every direct child of the form turned that row back into a column. */
.import-options { margin-top: 0.6rem; }
.upload-progress { margin-top: 0.75rem; }

/* --- storage pressure and the cleanup page (M8) -------------------------- */

/* On every page, above the flash: a flash is about what just happened, this is
   about what is going to stop working. Two levels because the advice differs. */
.volume-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 1rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
.volume-warn {
  background: var(--accent-wash);
  border-color: var(--accent-solid);
  color: var(--text);
}
.volume-critical {
  background: var(--error-bg);
  border-color: var(--danger-solid);
  color: var(--error-text);
}

/* Numbers line up on the right or they cannot be compared down a column. Used
   by the cost table too, which had been asking for this class all along. */
.align-right, .table td.align-right, .table th.align-right { text-align: right; }

/* A label a screen reader announces and a sighted user does not need: the
   checkbox beside a named row already says what it selects. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
