/* The web app's pages. Colours, type, spacing, corners, motion and target sizes come from the shared tokens
   (companion/tokens.css, linked first by base.html): this file only arranges them. */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font: var(--type-body);
}

main { max-width: 1040px; margin: 0 auto; padding: var(--space-5) var(--space-4) var(--space-4); }

/* The app shell (redesign phase 2): a rail on the left with the four places people work in, Settings at its foot and who
   is signed in; on a phone a top bar and a tab bar along the bottom (templates/base.html). */
body.with-shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
header.shell { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 22px;
  padding: 18px 12px 14px; background: var(--surface); border-right: 1px solid var(--border); }
header.shell .brand { display: block; padding: 2px 10px; }
/* Centred in its column, at full width up to its limit (a grid item with auto margins would shrink to its content). */
body.with-shell > main { width: 100%; min-width: 0; }
.rail-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; }
.rail-gap { flex: 1; }
.rail-link { display: flex; align-items: center; gap: var(--space-3); min-height: var(--target-min); padding: 0 var(--space-3);
  border-radius: var(--radius-control); color: var(--text-muted); font-weight: 600; text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.rail-link svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.rail-link:hover { background: var(--hover); color: var(--text); }
/* The current place fills with the accent tint and carries an accent edge: never colour alone. */
.rail-link[aria-current="page"] { background: var(--accent-tint); color: var(--text); box-shadow: inset 3px 0 0 var(--accent-fill); }
.rail-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px 4px 0; border-top: 1px solid var(--border); }
.rail-foot form { margin: 0; }
.rail-who { flex: 1 1 120px; min-width: 0; min-height: var(--target-min); display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.rail-who:hover .who-name { text-decoration: underline; }
.avatar { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-fill); color: var(--on-accent); font: 700 13px/1 var(--font-body); }
.who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: var(--type-body-sm); font-weight: 600; }
button.link.sign-out { color: var(--text-muted); font: var(--type-body-sm); }
/* The theme, always at the rail's foot (owner 2026-10-27): its icon shows the theme in use, and a tap offers Light, Dark
   and High contrast (owner 2026-10-29). */
.theme-toggle { width: 36px; height: 36px; min-height: 0; padding: 0; border-radius: var(--radius-pill); background: transparent; border-color: var(--border); color: var(--text-muted); }
.theme-toggle:hover { color: var(--text); background: var(--hover); }
.theme-toggle svg, .theme-menu svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle svg { display: none; }
:root:not([data-theme]) .theme-toggle .icon-light, :root[data-theme="dark"] .theme-toggle .icon-dark,
:root[data-theme="contrast"] .theme-toggle .icon-contrast { display: block; }
/* The theme choices open beside the toggle (base.html places them), over the page. Closed, the menu is not drawn, in every
   browser: one that does not know `popover` (Safari 16) would otherwise always show it. Open is the browser's own popover,
   in a rule of its own because a browser without `:popover-open` drops the whole rule, or the class base.html sets there. */
.theme-menu { display: none; position: fixed; inset: auto; margin: 0; padding: var(--space-2); width: 220px; color: var(--text); background: var(--surface-raised);
  border: 1px solid var(--border-control); border-radius: var(--radius-card); box-shadow: var(--shadow-overlay); }
.theme-menu:popover-open { display: block; }
.theme-menu.open { display: block; z-index: 30; }
.theme-menu p { margin: var(--space-1) var(--space-2) var(--space-2); font: var(--type-label); color: var(--text-muted); }
.theme-menu button { display: flex; width: 100%; justify-content: flex-start; gap: var(--space-3); background: transparent; border-color: transparent; font-weight: 400; }
.theme-menu button:hover { background: var(--hover); border-color: transparent; }
.theme-menu hr { margin: var(--space-2) 0; border: 0; border-top: 1px solid var(--border); }
.theme-menu .technical-switch { justify-content: space-between; }
.switch { position: relative; flex: none; width: 36px; height: 22px; border-radius: var(--radius-pill); background: var(--surface-sunken); border: 1px solid var(--border-control);
  transition: background-color var(--dur-fast) var(--ease); }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-muted);
  transition: transform var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease); }
[aria-checked="true"] > .switch { background: var(--accent-fill); border-color: var(--accent-fill); }
[aria-checked="true"] > .switch::after { transform: translateX(14px); background: var(--on-accent); }
/* Technical details (ids, hashes, raw records, internal field names) show only when the display menu's switch is on. */
:root:not([data-technical="on"]) .technical { display: none !important; }
.theme-menu button[aria-pressed="true"] { background: var(--accent-tint); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent-fill); }
/* Small-looking controls take a 44 x 44 px tap (WCAG 2.5.5, --target-min) from the invisible hit area with button.link,
   so nothing around them moves: Sign out, the theme toggle, the logo, every text button ("Hide", "Edit list") and every
   section heading that opens (audit 2026-11-03 web F10). */
button.link, .theme-toggle, details.section > summary, details.card > summary, .pick-models > summary, header.shell .brand, .crumbs a { position: relative; --hit: 44px; }
/* The DatumAR lockup (templates/_brand_lockup.html): ink and accent follow the theme (brand/datumar-lockup-horizontal*.svg). */
.lockup { display: block; height: 26px; width: auto; aspect-ratio: 814.81 / 168; }
.lockup .lk-ink { fill: var(--lockup-ink); }
.lockup .lk-accent { fill: var(--lockup-accent); }
.brand-title { margin: 0 0 12px; line-height: 0; }
.brand-title .lockup { height: 34px; }
.go .brand-title .lockup { margin: 0 auto; }
a { color: var(--accent-text); text-underline-offset: 2px; }
/* Links set in text are at least 24 px tall to tap (WCAG 2.5.8): padding on an inline link grows its hit area, not its line. */
.job-main h2 a, .crumbs a, main > p > a, dl.facts dd a { padding-block: 3px; }
.crumbs a { margin-block: -3px; }
/* A model's jobs can wrap onto several lines: lines taller than a padded link keep each one's tap clear of the next. */
dl.facts dd:has(a) { line-height: 26px; }

h1, h2 { letter-spacing: 0.005em; }
h1 { font: var(--type-page); margin: 0 0 var(--space-1); }
h2 { font: var(--type-title); margin-top: 0; }
h3 { font: var(--type-title-sm); }

/* Cards lift off the page with tone and, in light, one soft shadow. */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-raised);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}
.narrow { max-width: 360px; margin: 48px auto; }

label { display: block; margin-bottom: 10px; }
label[hidden] { display: none; }
label.check { display: flex; gap: 8px; align-items: center; min-height: var(--target-min); }
/* Fields are 44 px tall, with an edge that holds up in a bright shop (3:1 or more on every surface). Their 16 px text also
   keeps iOS from zooming in on a focused field. */
input, select, textarea {
  font: var(--type-body);
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--border-control);
  border-radius: var(--radius-control);
  padding: 9px 12px;
}
input:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"]), select { min-height: var(--target-min); }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; margin: 0; accent-color: var(--accent-fill); }
input[type="file"] { padding: 5px; min-height: var(--target-min); }
input:disabled, select:disabled, textarea:disabled { color: var(--text-muted); background: var(--surface-sunken); border-color: var(--border); }

/* One button family. A button is secondary unless it says otherwise: .primary is the page's one main action in Signal
   Orange, .ghost a quiet one on a card, .danger a destructive confirmation (.ghost.danger a quiet one), and .link a text
   button. Every one but .link is at least 44 px tall. */
button, a.button, label.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--target-min);
  margin: 0;
  padding: 0 var(--space-4);
  font: var(--type-body-sm);
  font-weight: 600;
  color: var(--text);
  background: var(--control);
  border: 1px solid var(--border-control);
  border-radius: var(--radius-control);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
button:hover, a.button:hover, label.button:hover { background: var(--control-hover); }
button.primary, a.button.primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
button.primary:hover, a.button.primary:hover { background: var(--accent-fill-hover); border-color: var(--accent-fill-hover); }
button.ghost, a.button.ghost { background: transparent; border-color: var(--border); }
button.ghost:hover, a.button.ghost:hover { background: var(--hover); border-color: var(--border-control); }
button.ghost.danger { color: var(--danger); }
button.ghost.danger:hover { border-color: var(--danger); background: var(--danger-tint); }
button.danger:not(.ghost) { background: var(--danger-fill); border-color: var(--danger-fill); color: var(--on-danger); }
button.danger:not(.ghost):hover { background: var(--danger-fill-hover); border-color: var(--danger-fill-hover); }
/* A button that cannot be used yet is plainly flat: never a faded orange or red. */
button:disabled, button:disabled:hover { cursor: not-allowed; color: var(--text-muted); background: var(--surface-sunken); border-color: var(--border); }
label.button:focus-within { outline: 2px solid var(--accent-text); outline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; }
button.link { position: relative; display: inline; min-height: 0; background: none; border: none; color: var(--text); padding: 0; font: var(--type-body-sm); white-space: normal; }
/* A text button or a section's heading takes at least a 24 px tap (WCAG 2.5.8) from a centred, invisible hit area, so
   nothing around it moves. */
button.link::after, .theme-toggle::after, details.section > summary::after, details.card > summary::after, .pick-models > summary::after, header.shell .brand::after, .crumbs a::after { content: ""; position: absolute; top: 50%; left: 50%;
  width: max(100%, var(--hit, 24px)); height: max(100%, var(--hit, 24px)); transform: translate(-50%, -50%); }
button.link:hover, button.link:disabled { background: none; }
button.link:hover { text-decoration: underline; }

/* A shared, centered entrance for the admin and tablet companion. */
.auth-page { background: var(--surface); }
.auth-page main {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}
.auth-card { width: min(100%, 360px); padding: 24px 8px; transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease); }
.auth-card .brand-title { margin: 0 0 36px; }
.auth-card .lockup { height: 40px; margin: auto; }
.auth-card h1 { text-align: center; margin: 0 0 6px; font-size: 28px; }
.auth-intro { text-align: center; margin: 0 0 28px; font-size: 16px; }
.auth-card label { margin: 0 0 6px; font-weight: 600; }
.auth-card input { display: block; width: 100%; min-height: 48px; padding: 11px 13px; margin: 0 0 18px; background: var(--canvas); }
.auth-card button { width: 100%; min-height: 48px; margin-top: 6px; background: var(--accent-fill); color: var(--on-accent); border-color: var(--accent-fill); font: var(--type-body); font-weight: 600; }
.auth-card button:hover { background: var(--accent-fill-hover); border-color: var(--accent-fill-hover); }
.auth-error { margin: 0 0 12px; }
.auth-error[hidden] { display: none; }
.auth-splash { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: 0; transition: opacity var(--dur-slow) var(--ease) 140ms; }
.auth-splash .lockup { width: min(62vw, 300px); height: auto; }
.auth-success .auth-card { opacity: 0; transform: translateY(-12px) scale(0.97); }
.auth-success .auth-splash { opacity: 1; }
@media (max-height: 480px) and (min-width: 620px) {
  .auth-card { width: min(100%, 700px); display: grid; grid-template-columns: 1fr 1.15fr; column-gap: 44px; padding: 8px; }
  .auth-card .brand-title { grid-column: 1; align-self: end; margin: 0 0 20px; }
  .auth-card h1, .auth-intro { grid-column: 1; }
  .auth-card h1 { grid-row: 2; }
  .auth-intro { grid-row: 3; margin-bottom: 0; }
  .auth-card form { grid-column: 2; grid-row: 1 / 5; align-self: center; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-card, .auth-splash { transition: none; }
}

.row { border-top: 1px solid var(--border); padding: 12px 0; }
.row:first-of-type { border-top: none; }

dl { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 8px 0; }
dl div { display: flex; gap: 6px; }
dt { color: var(--text-muted); }
dd { margin: 0; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.actions .spacer { flex: 1; }
.note { color: var(--text-muted); font: var(--type-body-sm); }
.warn { color: var(--warning); }
.error { color: var(--danger); }
.mono { font: var(--type-mono); }
.break { word-break: break-all; }

/* One badge for every status, count and tag: a tinted pill with its words in the status colour, so the words carry the
   meaning and the colour only repeats it. A badge is never a control. */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--badge-line, var(--border));
  border-radius: var(--radius-pill);
  background: var(--badge-fill, var(--surface-sunken));
  color: var(--badge-ink, var(--text-muted));
  font: var(--type-label);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  vertical-align: 2px;
}
.badge.state-checked, .badge.state-preview, .badge.resolved, .badge.issued {
  --badge-ink: var(--success); --badge-fill: var(--success-tint); --badge-line: var(--success-line); }
.badge.state-failed, .badge.open { --badge-ink: var(--danger); --badge-fill: var(--danger-tint); --badge-line: var(--danger-line); }
.badge.sev-major { --badge-ink: var(--warning); --badge-fill: var(--warning-tint); --badge-line: var(--warning-line); }
.badge.sev-critical { --badge-ink: var(--on-danger); --badge-fill: var(--danger-fill); --badge-line: var(--danger-fill); }
/* A count beside a heading or a link: a number in a small neutral pill. */
.badge.count { min-width: 1.9em; padding: 0 7px; text-align: center; }

table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
th { text-align: left; color: var(--text-muted); font: var(--type-label); }
td, th { padding: 3px 4px; }
td input { width: 100%; min-width: 80px; }
/* A payload is the code's identity; keep it readable rather than squeezed by the numeric columns. */
td input.payload { min-width: 15ch; font-family: var(--font-mono); }

pre { overflow-x: auto; }

#diagram svg { width: 100%; height: auto; max-height: 60vh; background: var(--diagram); border-radius: var(--radius-card); }
/* Drawings sit on their dark panel in both themes, so they keep the dark theme's colours. */
#diagram svg, svg.plan { --text: #f8f4ef; --text-muted: #b3bcc5; --accent-text: #fe9856; --warning: #f2c94e; --danger: #fb8278; --success: #46ce83; }
.footprint { fill: #1d2b3f; stroke: #46688f; stroke-width: 2; vector-effect: non-scaling-stroke; }
.datum { stroke: var(--accent-text); stroke-width: 2; vector-effect: non-scaling-stroke; }
.code { fill: rgba(255, 193, 77, 0.22); stroke: var(--warning); stroke-width: 2; vector-effect: non-scaling-stroke; }
.code-origin { fill: var(--danger); }
.code-label { fill: var(--text); text-anchor: middle; dominant-baseline: middle; }
.domino-piece { fill: #f4f6f7; stroke: var(--accent-text); stroke-width: 2; vector-effect: non-scaling-stroke; }
.domino-code { fill: #1a2329; }
.domino-label { fill: #f4f6f7; text-anchor: middle; dominant-baseline: middle; font-weight: 700; }
.code.retired { fill: none; stroke: var(--text-muted); stroke-dasharray: 6 4; opacity: 0.7; }
.retired .code-label { fill: var(--text-muted); }

details.companion { margin-top: 8px; }
details.companion summary { cursor: pointer; color: var(--accent-text); }
.qr-box {
  display: inline-block;
  background: #e8edf5;
  border-radius: var(--radius-card);
  padding: 6px;
  line-height: 0;
}
.qr-box img { width: 180px; height: 180px; }

footer.note { max-width: 1040px; margin: 0 auto; padding: 8px 16px 32px; }

/* Headset status tone (D17): green only at VISUAL_REVIEW_READY; text carries the meaning. */
.tone { font-weight: 600; }
.tone::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-right: 6px; vertical-align: 1px; background: var(--text-muted); }
.tone-ready::before { background: var(--success); }
.tone-check::before { background: var(--warning); }
.tone-not::before { background: var(--danger); }
.tone-unknown { color: var(--text-muted); }
td.dims { font-size: 12px; color: var(--text-muted); }

/* Survey import (F01, S02). */
.card h3 { font: var(--type-body); font-weight: 600; margin: 18px 0 6px; }
table.numeric td { white-space: nowrap; }
table.numeric tr.failed td { background: var(--danger-tint); }
#history tr.selected td { background: var(--info-tint); }
.rejections ul, ul.warnings { margin: 4px 0 8px; padding-left: 20px; }
.plan-box { overflow-x: auto; }
svg.plan { display: block; width: 100%; min-width: 560px; height: auto; max-height: 70vh; background: var(--diagram); border-radius: var(--radius-card); }
.plan-ring { fill: none; stroke: #3a4658; }
.plan-ring-label, .plan-label { fill: var(--text-muted); }
.plan-label { fill: var(--text); }
.plan-ref, .plan-axes { stroke: var(--accent-text); fill: none; }
.plan-code { fill: rgba(255, 193, 77, 0.2); stroke: var(--warning); }
.plan-sat { fill: rgba(111, 179, 255, 0.2); stroke: var(--accent-text); }
.plan-control { fill: var(--success); }
.plan-control.failed { fill: var(--danger); }
.plan-residual { stroke: var(--danger); }
.plan-check { fill: none; stroke: var(--success); }

/* Discrepancy reports and review photos (F03). */
.table-wrap { overflow-x: auto; }
.table-wrap table { display: table; min-width: 100%; }
.sessions-table td, .reports-table td { padding: 5px 6px; vertical-align: top; }
.sessions-table th, .reports-table th { padding: 4px 6px; white-space: nowrap; }
.sessions-table tr.excluded td { color: var(--text-muted); }
.sessions-table tr.reason td, .reports-table tr.reason td { padding-top: 0; }
.reports-table td.links { white-space: nowrap; }
/* One line per report: ids, times, units and names never break; the table's wrapper scrolls when it is too wide. */
.reports-table td { white-space: nowrap; }
.reports-table td.links a + a { margin-left: 10px; }
fieldset.sessions { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 8px 12px 10px; margin: 4px 0 12px; }
fieldset.sessions legend { color: var(--text-muted); padding: 0 6px; }
.report-form label, .photo-form label { max-width: 420px; }
.report-form input:not([type="checkbox"]), .photo-form input:not([type="file"]), .photo-form select { width: 100%; }
.photo-grid { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.photo-grid li { background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; }
.photo-grid li.deleted { opacity: 0.5; }
.photo-grid img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface-sunken); }
.photo-meta { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; font-size: 14px; }
.photo-meta button.link { align-self: flex-start; color: var(--danger); margin-top: 4px; }

/* ------------------------------------------------------------------ admin pages: shared parts */

/* The title sits at the same height on every page, whatever is on the right: the actions line up with its top. */
.lede { color: var(--text-muted); margin: 0 0 16px; }
/* The page header (design step 3, templates/_crumbs.html): breadcrumbs on a row of their own, kept even when empty, then the
   title and its line with the page's actions beside them, so the title sits at the same height on every page whatever is
   on the right. */
.page-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-1) var(--space-5); align-items: start; margin: 0 0 var(--space-5); }
.page-head > .crumbs { grid-column: 1 / -1; min-height: 20px; margin: 0; }
.page-head .page-title { min-width: 0; display: grid; gap: var(--space-1); }
.page-head h1 { margin: 0; overflow-wrap: anywhere; }
.page-head .lede { margin: 0; }
.page-head > .page-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: flex-end; align-items: center; min-height: 36px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 6px; font: var(--type-body-sm); color: var(--text-muted); }
.crumbs [aria-current="page"] { color: var(--text); }
.crumbs a { color: var(--text-muted); }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--border-control); }
.subnav { display: flex; flex-wrap: wrap; gap: 4px; margin: 12px 0 18px; border-bottom: 1px solid var(--border); }
.subnav a { display: inline-flex; align-items: center; min-height: var(--target-min); color: var(--text-muted); text-decoration: none; padding: 0 12px; font-weight: 600; margin-bottom: -1px; border-bottom: 2px solid transparent; }
.subnav a:hover { color: var(--text); }
.subnav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent-text); }
/* A model's units on its reports page: each unit has its own checks, photos and reports. */
.unit-switch { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.unit-switch a { color: var(--text-muted); text-decoration: none; padding: 5px 12px; border: 1px solid var(--border); border-radius: var(--radius-pill); font-weight: 600; }
.unit-switch a:hover { color: var(--text); }
.unit-switch a[aria-current="page"] { color: var(--text); border-color: var(--accent-text); }
.banner { border: 1px solid var(--border); border-left: 3px solid currentColor; border-radius: var(--radius-control); padding: 10px 14px; margin: 0 0 16px; background: var(--warning-tint); font-size: 14px; }
.small { font-size: 14px; }
.card.empty { text-align: center; padding: 32px 16px; }
/* A job's point cloud scans (docs/POINT_CLOUDS.md). */
.scan-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.scan-list .scan { border-top: 1px solid var(--border); padding-top: 12px; overflow-wrap: anywhere; }
.scan-list .scan:first-child { border-top: 0; padding-top: 0; }
.scan-list .scan p { margin: 4px 0; }
.scan-list .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 8px; }
.scan-list .actions select { flex: 0 1 auto; min-width: 0; max-width: min(100%, 24em); text-overflow: ellipsis; }
.scan-list .model-head h3 { margin: 0; }
/* Placing a scan by picked points (templates/scan_place.html): the 3D view beside its panel, above it on a narrow screen. */
.place-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); gap: 16px; align-items: start; }
.place-stage-box { position: relative; height: min(70vh, 640px); min-height: 320px; border-radius: var(--radius-control); overflow: hidden; background: #0b1318; }
.place-stage-box canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.place-stage-box .check-stage-msg { position: absolute; left: 12px; bottom: 8px; margin: 0; color: #e9eef1; font: var(--type-body-sm); }
.place-panel { display: grid; gap: 10px; min-width: 0; }
.place-panel p { margin: 0; }
.place-step { font-weight: 600; }
.place-pairs { margin: 0; padding-left: 1.4em; display: grid; gap: 2px; }
.place-panel .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.place-panel .actions[hidden], .place-panel button[hidden] { display: none; }
@media (max-width: 900px) {
  .place-card { grid-template-columns: minmax(0, 1fr); }
  .place-stage-box { height: 60vh; }
}
.card.empty p { margin: 6px auto 18px; max-width: 46ch; }

/* A label above its control. */
.field { display: grid; gap: 4px; margin: 0 0 12px; }
.field > span { font: var(--type-label); color: var(--text-muted); }
/* A field's label with a small action beside it (the Issues page's "Edit list"). */
.field > .field-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.field-head label { margin: 0; }
.field-head button.link { color: var(--accent-text); font-size: inherit; font-weight: 600; line-height: inherit; white-space: nowrap; }
.field input, .field select { width: 100%; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.inline-form .field { margin: 0; }

/* Facts as a responsive grid of small labelled values. */
dl.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 20px; margin: 12px 0; }
dl.facts div { display: block; }
dl.facts dt { font-size: 13px; letter-spacing: 0.02em; }
dl.facts dd { overflow-wrap: break-word; min-width: 0; }
dl.facts div.wide { grid-column: span 2; }

details.section { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 10px; }
details.section > summary, details.card > summary { cursor: pointer; font-weight: 600; color: var(--text); list-style: none; }
/* A section's one-line heading takes a 24 px tap from the hit area with button.link. */
details.section > summary { position: relative; }
details.section > summary::-webkit-details-marker, details.card > summary::-webkit-details-marker { display: none; }
details.section > summary::before, details.card > summary::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin: 0 10px 2px 2px;
  border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(-45deg); transition: transform var(--dur-fast) var(--ease);
}
details[open].section > summary::before, details[open].card > summary::before { transform: rotate(45deg); }
details.section[open] > summary { margin-bottom: 8px; }
details.card > summary h2 { display: inline; margin: 0; }
details.card[open] > summary { margin-bottom: 8px; }

/* Sheets (dialogs). */
dialog.sheet {
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-control);
  border-radius: var(--radius-sheet);
  box-shadow: var(--shadow-overlay);
}
dialog.sheet.wide { width: min(720px, calc(100vw - 32px)); }
dialog.sheet::backdrop { background: var(--backdrop); }
.dialog-body { padding: 20px; }
.dialog-body h2 { font-size: 18px; margin: 0 0 14px; }
.dialog-body p { margin: 0 0 10px; }
.dialog-body .error:empty { display: none; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.dialog-actions [hidden] { display: none; }
.dialog-actions .spacer { flex: 1; }
/* On a phone the action before the spacer takes its own row, so Cancel and the dialog's own action stay together. */
@media (max-width: 480px) {
  .dialog-actions .spacer { flex-basis: 100%; height: 0; }
  .dialog-actions > :has(+ .spacer) { margin-right: auto; }
}
/* Delete model's safer choice on a job's page: take it out of this job only, which keeps it on the server. */
.delete-instead { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--border-control); border-radius: var(--radius-card); }
.delete-instead[hidden] { display: none; }
.dialog-body .delete-instead p { flex: 1 1 220px; min-width: 0; margin: 0; }
/* Part names: a common prefix taken off every name, then each part's name, indented under its assembly. */
.remove-text { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.remove-text .field { flex: 1 1 260px; min-width: 0; margin: 0; }
.part-names { list-style: none; margin: 8px 0 12px; padding: 0; max-height: min(50vh, 520px); overflow: auto; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.part-names:empty { display: none; }
.part-name { padding: 8px 2px 8px calc(2px + var(--depth, 0) * 14px); border-bottom: 1px solid var(--border); }
.part-name:last-child { border-bottom: 0; }
.part-name input { width: 100%; box-sizing: border-box; }
.dialog-body .part-name .note { margin: 4px 0 0; overflow-wrap: anywhere; }
.part-name .note[hidden] { display: none; }

/* ------------------------------------------------------------------ devices */

.device-list { display: grid; gap: 16px; margin-bottom: 16px; }
.device-list:empty { display: none; }
.card.device { margin: 0; }
.device-head { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; justify-content: space-between; }
.device-title { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.device-title h2 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.assign-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.assign-row .field { margin: 0; flex: 0 1 320px; min-width: 200px; }
.assign-row .msg { align-self: center; }
.fixture-line { margin: 8px 0 0; }
.device-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.revoked-list .plain-list { list-style: none; margin: 8px 0 0; padding: 0; }
.revoked-list li { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--border); }
.revoked-list li .device-tools { margin: 0; }
.help dl.addresses { display: grid; gap: 10px; margin: 12px 0; }
.help dl.addresses div { display: block; }
.help dl.addresses dt { color: var(--text); font-weight: 600; }
.help p { margin: 8px 0; }
code.address { overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ models */

.model-list { list-style: none; margin: 0; padding: 0; }
.model { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 16px; padding: 16px 0; border-top: 1px solid var(--border); }
.model:first-child { border-top: none; padding-top: 4px; }
.thumb-frame { width: 112px; height: 84px; border-radius: var(--radius-card); background: var(--surface-sunken); border: 1px solid var(--border); overflow: hidden; display: grid; place-items: center; }
.thumb-frame img { width: 100%; height: 100%; object-fit: contain; }
.thumb-frame.thumb-none::after { content: "No picture"; color: var(--text-muted); font-size: 12px; }
.model-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.model-head h2 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.model .facts { margin: 8px 0; }
.model-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.model-links .spacer { flex: 1; }
.model-links .move-job { display: inline-flex; gap: 6px; align-items: center; color: var(--text-muted); font-size: 14px; max-width: 100%; min-width: 0; white-space: nowrap; }
/* A select is as wide as its longest option: a long job name must shrink it, not push the page sideways. */
.model-links .move-job select { min-width: 0; max-width: 100%; flex: 0 1 auto; text-overflow: ellipsis; }

/* Units (docs/JOBS.md, JB2): one physical fab of a model. */
.units { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 8px; }
.units-label { color: var(--text-muted); font-size: 13px; font-weight: 600; margin-right: 4px; }
.unit-chip { padding: 0 14px; border-radius: var(--radius-pill); background: var(--surface); border-color: var(--border); }
.unit-chip:hover { border-color: var(--border-control); }
/* The setup a unit drops with, beside its number (docs/JOBS.md "Setups per unit"). */
.unit-chip .unit-setup { color: var(--text-muted); margin-left: 4px; }
.add-units { display: inline-flex; gap: 6px; align-items: center; margin-left: 4px; }
.add-units input { width: 5.5em; }

/* Jobs (docs/JOBS.md): the folders models are filed under. */
.field textarea { width: 100%; min-height: 4.5em; resize: vertical; }
.job-list { list-style: none; margin: 0; padding: 0; }
.job { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 14px 0; border-top: 1px solid var(--border); }
.job:first-child { border-top: none; padding-top: 4px; }
/* An empty status takes no gap, so the actions end at the row's edge; a message (an Archive error) still shows after them. */
.job > .note:empty { display: none; }
/* The text keeps a readable width; on a narrow screen the actions wrap beneath it instead of squeezing it. */
.job-main { flex: 1 1 200px; min-width: 0; }
.job-main h2 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.job-main h2 a { color: var(--text); text-decoration: none; }
.job-main h2 a:hover { text-decoration: underline; }
.job-meta { margin: 3px 0 0; color: var(--text-muted); font-size: 14px; overflow-wrap: anywhere; }
.job-description { margin: 3px 0 0; overflow-wrap: anywhere; }
.job-photo { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin: 4px 0 12px; }
.job-photo .thumb-frame { width: 160px; height: 120px; }
.job-photo .thumb-frame img { object-fit: cover; }
.job .thumb-frame img { object-fit: cover; }
.job-notes { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ activity */

.activity-table td { padding: 8px; border-top: 1px solid var(--border); vertical-align: top; }
.activity-table th { padding: 6px 8px; }
.activity-table td.when { white-space: nowrap; color: var(--text-muted); }
.activity-table .what { font-weight: 600; white-space: nowrap; }
.activity-table .detail { color: var(--text-muted); font-size: 14px; overflow-wrap: anywhere; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 12px; }
.filter-row .field { margin: 0; flex: 0 1 320px; }

@media (max-width: 640px) {
  main { padding: 14px 12px 12px; }
  .card { padding: 14px; border-radius: var(--radius-card); }
  .page-head { grid-template-columns: minmax(0, 1fr); margin-bottom: var(--space-4); }
  .page-head > .page-actions { justify-content: flex-start; }
  .device-tools > button { flex: 1 1 40%; }
  .assign-row .field { flex-basis: 100%; }
  .model { grid-template-columns: 72px minmax(0, 1fr); gap: 12px; }
  .thumb-frame { width: 72px; height: 54px; }
  dl.facts { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px 14px; }
  dl.facts div.wide { grid-column: 1 / -1; }
  .dialog-body { padding: 16px; }
  footer.note { padding: 8px 12px 24px; }
}

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.upload-form { margin-top: 4px; }
/* The Profile field carries a line under its select; its neighbours keep their own height instead of stretching to match. */
.upload-form .field { align-content: start; }
/* A note inside a label (Quantity's "units to make") keeps the label's line, and the file picker matches the other controls'
   44 px, so the row's controls share one top and bottom. */
.upload-form .field > span .note { font-size: inherit; line-height: inherit; }
.upload-form input[type="file"] { min-height: 44px; }
.upload-form fieldset.sessions { padding: 10px 14px 4px; }
.empty { text-align: center; padding: 24px 8px; }
.empty h2 { margin-bottom: 6px; }
details.card.upload > summary h2 { color: var(--accent-text); }
[tabindex="-1"]:focus { outline: none; }

/* On a phone each event is a short stack instead of a wide table row. */
@media (max-width: 640px) {
  .activity-table thead { display: none; }
  .activity-table, .activity-table tbody, .activity-table tr, .activity-table td { display: block; }
  .activity-table tr { border-top: 1px solid var(--border); padding: 10px 0; }
  .activity-table td { border: 0; padding: 1px 0; }
  .activity-table td.when { font-size: 14px; }
  .activity-table td.who { color: var(--text-muted); font-size: 14px; }
  .activity-table td.who::before { content: "by "; }
  .activity-table td.detail:empty { display: none; }
}
.activity-table tr[hidden] { display: none; }

/* The New job form's models from other jobs, and a job's "Add a model already on the server" (owner 2026-10-18). */
.pick-models { margin: 4px 0 12px; }
.pick-models > summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.check-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 16px; max-height: 260px; overflow: auto; }
.check-list label { display: flex; align-items: flex-start; gap: 10px; min-height: var(--target-min); padding: 6px 0; cursor: pointer; }
/* A long model name never squeezes its checkbox (it was 13 px wide beside "North mezzanine handrail ... revision C"). */
.check-list input { flex: none; margin-top: 3px; }
.check-list .pick-name { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.check-list .pick-name .note { font-size: 12px; }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-form select { min-width: 260px; }

/* ------------------------------------------------------------------ Issues (docs/PARTS.md "Resolving issues") */
.units-issues { display: inline-flex; align-items: center; min-height: var(--target-min); min-width: var(--target-min); padding: 0 8px; font-size: 14px; margin-left: 4px; }
.issue-filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.issue-filters .field { margin: 0; flex: 1 1 170px; max-width: 240px; min-width: 0; }
.issue-states { display: flex; gap: 4px; margin-left: auto; padding: 3px; border: 1px solid var(--border); border-radius: var(--radius-card); }
.issue-states a { display: inline-flex; align-items: center; gap: 6px; min-height: var(--target-min); padding: 0 12px; border-radius: var(--radius-control); color: var(--text-muted); text-decoration: none; font-size: 14px; white-space: nowrap; }
.issue-states a[aria-current="page"] { background: var(--accent-tint); color: var(--text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent-fill); }
.issue-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.issue-card { display: grid; grid-template-columns: 136px minmax(0, 1fr); gap: 14px; align-items: start; margin: 0; border-left: 3px solid var(--danger); }
.issue-card.resolved { border-left-color: var(--success); }
.issue-thumb { display: block; width: 136px; border-radius: var(--radius-card); overflow: hidden; border: 1px solid var(--border); background: var(--surface-sunken); }
.issue-thumb.none { height: 96px; background: repeating-linear-gradient(135deg, var(--surface-sunken) 0 6px, var(--canvas) 6px 12px); }
.issue-thumb .marked { position: relative; display: block; width: 100%; }
.issue-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.issue-thumb svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.issue-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.issue-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.issue-title strong { overflow-wrap: anywhere; }
.issue-part { font-family: var(--font-mono, ui-monospace, monospace); font-size: 14px; color: var(--text-muted); }
.issue-state { margin-left: auto; }
.issue-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
/* Measurements the device attached (docs/MEASURE.md stage 6): one line each, in the mono face as numbers are elsewhere. */
.issue-measured { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font: 500 13px/1.35 var(--font-mono, monospace); overflow-wrap: anywhere; }
.issue-measured .note { font-family: inherit; font-size: 12px; }
/* Category and severity (docs/PARTS.md "Categories and severity"): tags that are their own pickers, a quiet category and a
   severity that gets louder; an empty one is a dashed slot to fill. */
select.tag-select {
  min-height: 28px; appearance: none; -webkit-appearance: none; field-sizing: content; max-width: 100%; padding: 1px 24px 1px 10px; border: 1px solid var(--border); border-radius: var(--radius-pill);
  font: var(--type-label); color: var(--text-muted); cursor: pointer; background-color: transparent;
  /* The caret is drawn in the text's own colour, so it follows the theme and the severity. */
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 13px center, right 9px center; background-size: 4px 4px, 4px 4px; background-repeat: no-repeat;
}
select.tag-select:hover, select.tag-select:focus-visible { border-color: var(--border-control); color: var(--text); }
select.tag-select.empty { border-style: dashed; font-weight: 500; }
/* A select takes no invisible hit area, so on a touch screen the tag is the full 44 px tap itself (WCAG 2.5.5); a mouse
   keeps the compact tag (found by webapp_targets.cjs once the layout server listed issues, 2026-11-05). */
@media (pointer: coarse) { select.tag-select { min-height: var(--target-min); } }
select.tag-select.sev-major { color: var(--warning); border-color: var(--warning-line); }
select.tag-select.sev-critical { color: var(--on-danger); border-color: var(--danger-fill); background-color: var(--danger-fill); }
select.tag-select option { color: var(--text); background: var(--surface); font-weight: 400; }
.category-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.category-list li { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 12px; border: 1px solid var(--border); border-radius: var(--radius-card); }
.category-list li.note { border-style: dashed; padding: 10px 12px; }
.category-list li > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.category-list button.icon { width: var(--target-min); padding: 0; }
.category-add { display: flex; gap: 8px; }
.category-add input { flex: 1; min-width: 0; }
.issue-card .note { margin: 0; }
.issue-resolution { margin: 2px 0 0; font-size: 14px; color: var(--text); overflow-wrap: anywhere; }
.issue-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
/* The photos added beside the first, as a row of small thumbnails under the text. */
.issue-photos { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 6px; padding: 0; list-style: none; }
.issue-photos a { display: block; width: 72px; height: 54px; border-radius: var(--radius-control); overflow: hidden; border: 1px solid var(--border); background: var(--surface-sunken); }
.issue-photos img { display: block; width: 100%; height: 100%; object-fit: cover; }
.issue-note { flex: 1 1 220px; min-width: 0; max-width: 460px; }
.proof-preview { display: block; width: 59px; height: 44px; object-fit: cover; border-radius: var(--radius-control); border: 1px solid var(--border); background: var(--surface-sunken); }
.proof-preview[hidden] { display: none; }
.issue-photos .proof-caption { align-self: center; margin: 0; }
@media (max-width: 640px) {
  .issue-card { grid-template-columns: 96px minmax(0, 1fr); gap: 10px; }
  .issue-thumb { width: 96px; }
  .issue-states { margin-left: 0; }
  .issue-filters .field { flex-basis: 100%; max-width: none; }
}

/* People and Account (docs/ACCOUNTS.md): long email addresses fit a phone. */
.card input:not([type="hidden"]), .card select { max-width: 100%; }
.card p, dl.facts dd { overflow-wrap: anywhere; }
/* The fields share one height, so the Role select lines up with the inputs beside it rather than sitting 2 px lower. */
.person-form { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) minmax(0, 1fr) auto; gap: 12px; align-items: stretch; }
.person-form .field { margin: 0; grid-template-rows: auto 1fr; }
.person-form > button { align-self: end; }
.card.person { margin: 0; }
/* The Operator page (docs/HOSTED_TEAMS.md): three equal fields and the button; each team's rename and suspend fields
   wide enough for a full shop name. */
.operator-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 12px; align-items: end; }
.operator-form .field { margin: 0; }
.card.team-card { margin: 0; }
.team-actions .inline-form { flex: 1 1 300px; flex-wrap: nowrap; }
.team-actions .inline-form .field { flex: 1 1 auto; min-width: 0; }
.team-actions .inline-form input { width: 100%; }
.notice { margin: 0 0 16px; padding: 10px 14px; border: 1px solid var(--border); border-left: 4px solid var(--accent-fill); border-radius: 6px; background: var(--surface, transparent); }
.offboard { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); display: grid; gap: 10px; }
.offboard h3 { margin: 0; font-size: 16px; }
.offboard .note { margin: 0; }
.offboard .team-actions { align-items: center; }
.purge-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.purge-form .field { margin: 0; flex: 1 1 220px; min-width: 0; }
.purge-form .field input { width: 100%; }
@media (max-width: 640px) { .operator-form { grid-template-columns: minmax(0, 1fr); } }
.person-role select { min-width: 0; width: auto; }
.one-time-password code { font-size: 18px; letter-spacing: 0.04em; user-select: all; }
.removed-people { margin: 8px 0 0; padding-left: 0; list-style: none; }
.removed-people li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 4px 0; }
.removed-people form { margin: 0; }
.account-form { max-width: 520px; }
@media (max-width: 720px) {
  .person-form { grid-template-columns: minmax(0, 1fr); }
}

.auth-card input[type="checkbox"] { width: 20px; min-height: 20px; height: 20px; margin: 0; padding: 0; flex-shrink: 0; }

/* Issue reports (docs/PARTS.md "Issue reports"): the list, the team's cover branding, and a draft beside its PDF. */
.report-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-left: auto; }
.report-rows { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.report-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0; }
.report-link { flex: 1 1 320px; min-width: 0; display: grid; gap: 1px; color: var(--text); text-decoration: none; }
.report-link:hover strong { text-decoration: underline; }
.report-link strong { overflow-wrap: anywhere; }
.report-label { font-family: var(--font-mono); font-size: 13px; color: var(--accent-text); letter-spacing: 0.02em; }
.report-when { white-space: nowrap; }
.brand-row { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-start; }
.brand-logo { flex: none; width: 200px; height: 96px; display: flex; align-items: center; justify-content: center; padding: 12px;
  border-radius: var(--radius-card); background: var(--paper); border: 1px solid var(--border); }
.brand-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.brand-logo.none { background: repeating-linear-gradient(135deg, var(--surface-sunken) 0 6px, var(--canvas) 6px 12px); color: var(--text-muted); font-size: 14px; }
.brand-form { flex: 1 1 320px; min-width: 0; }
.brand-form .field { max-width: 420px; }
.brand-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.brand-name { margin: 0; font: 700 18px/24px var(--font-display); }
/* Kept for keyboards and screen readers, not drawn. */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* Two widths: 1040 px for reading and forms, 1280 px for wide tables and the report editor beside its preview. */
.wide-page main { max-width: 1280px; }
.report-error:empty { display: none; }
.report-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 560px); gap: 16px; align-items: start; }
.report-edit { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.report-edit .card { margin: 0; }
.report-fields .field:last-of-type { margin-bottom: 4px; }
.report-saved { margin: 0; min-height: 1.4em; }
.report-issues-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 8px; }
.report-issues-head h2 { margin: 0; }
.pick-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pick { display: grid; grid-template-columns: auto 22px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 8px 8px 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
.pick:not(:has(input)) { grid-template-columns: 22px minmax(0, 1fr) auto; }
.pick.out { opacity: 0.55; background: transparent; border-style: dashed; }
.pick input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent-fill); }
.pick-n { font-family: var(--font-mono); color: var(--accent-text); text-align: right; }
.pick-body { min-width: 0; display: grid; }
.pick-body strong, .pick-body .note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.pick-tags .issue-state { margin-left: 0; }
.pick-move { display: flex; gap: 4px; }
.pick-move button.icon { width: var(--target-min); padding: 0; }
.revision-list { margin: 0; padding-left: 18px; }
.report-preview { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 6px; }
.preview-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.preview-head a { font-size: 14px; white-space: nowrap; }
.report-preview iframe { width: 100%; aspect-ratio: 210 / 297; max-height: calc(100dvh - 60px); border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--paper); }
@media (max-width: 960px) {
  .report-layout { grid-template-columns: minmax(0, 1fr); }
  .report-preview { position: static; }
}
@media (max-width: 640px) {
  .pick { grid-template-columns: auto 22px minmax(0, 1fr) auto; }
  .pick-tags { grid-column: 3 / -1; justify-content: flex-start; }
}

/* The shell on a tablet held upright and on a phone: a top bar with the brand and who is signed in, and the four places
   and Settings as a tab bar along the bottom, clear of the home indicator. */
@media (max-width: 860px) {
  body.with-shell { display: block; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  header.shell { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center; gap: 12px;
    padding: 8px max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)); border-right: 0; border-bottom: 1px solid var(--border); }
  header.shell .brand { padding: 0; margin-right: auto; }
  .rail-foot { flex-wrap: nowrap; padding: 0; border-top: 0; }
  .rail-who { flex: none; min-width: var(--target-min); justify-content: center; }
  .who-name { display: none; }
  .rail-nav { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; flex-direction: row; gap: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--border); }
  .rail-gap { display: none; }
  .rail-link { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 3px; padding: 6px 2px; font-size: 12px; }
  .rail-link[aria-current="page"] { box-shadow: inset 0 2px 0 var(--accent-text); }
}

/* Settings (redesign phase 2): each card opens the page that changes it. */
.settings-group { margin: 22px 0 10px; font: var(--type-label); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
/* Cards in a row share its height; the title and description stay together at the top. */
a.card.setting { display: grid; gap: 4px; align-content: start; margin: 0; color: var(--text); text-decoration: none; }
a.card.setting:hover { border-color: var(--border-control); background: var(--hover); }
a.card.setting strong { font-size: 16px; }
button.card.setting { display: grid; gap: 4px; align-content: start; justify-content: stretch; justify-items: start; margin: 0; width: 100%; height: auto; min-height: 0;
  text-align: left; font: inherit; color: var(--text); cursor: pointer; }
button.card.setting:hover { border-color: var(--border-control); background: var(--hover); }
button.card.setting strong { font-size: 16px; }
/* Getting started (templates/jobs.html): a numbered list whose steps tick themselves off; the next one leads. */
.getting-started .gs-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.getting-started .gs-head h2 { margin: 0; }
.getting-started .gs-head .link { margin-left: auto; }
.gs-steps { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 2px; counter-reset: gs; }
.gs-step { counter-increment: gs; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.gs-step:first-child { border-top: 0; }
.gs-mark { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 600 13px/1 var(--font-body);
  border: 1.5px solid var(--border-control); color: var(--text-muted); }
.gs-mark::before { content: counter(gs); }
.gs-step.next .gs-mark { border-color: var(--accent-fill); color: var(--accent-text); }
.gs-step.done .gs-mark { background: var(--success); border-color: var(--success); color: var(--surface); }
.gs-step.done .gs-mark::before { content: "\2713"; }
.gs-step.done .gs-text strong { color: var(--text-muted); font-weight: 500; }
.gs-text { display: grid; gap: 2px; }
.gs-text strong { font-weight: 600; }
@media (max-width: 560px) {
  .gs-step { grid-template-columns: 28px minmax(0, 1fr); }
  .gs-step > .button { grid-column: 2; justify-self: start; }
}
.review-retry[hidden] { display: none; }
