/* Standard theme tokens: the Tonal look, light (docs/SCANNER_STANDARD_TONAL.md §2). Dark is
   html[data-appearance="dark"] near the end. 9X redefines every token its rules read. */
:root {
  color-scheme: light;
  --shell: #1f2d3a;
  --shell-muted: #b8c7d5;
  --page: #edf1f4;
  --surface: #ffffff;
  --surface-alt: #f4f7f9;
  --line: #d3dbe2;
  --line-strong: #b9c5cf;
  --ink: #1b2935;
  --muted: #566878;
  --accent: #1d5f96;
  --accent-hover: #174f7d;
  --accent-soft: #e2edf6;
  --on-accent: #ffffff;
  --success: #1b7743;
  --success-soft: #e2f1e7;
  --warning: #8a5a00;
  --warning-soft: #fbf0d9;
  --warning-bg: var(--warning-soft);
  /* Caution (a duplicate rescan): bright yellow for the mark, a dark olive for text on the lemon tint. */
  --caution: #f2c200;
  --caution-ink: #5e4d00;
  --caution-soft: #fff3a8;
  --caution-edge: #8a6d00;
  --caution-mark: #2a2100;
  --danger: #a52f29;
  --danger-soft: #fae9e7;
  --danger-bg: var(--danger-soft);
  --plants: #1d7344;
  --plants-soft: #ddf0e3;
  --care: #0c6a85;
  --care-soft: #dcf0f6;
  --supplies: #8a5800;
  --supplies-soft: #f7ecd3;
  --dock: rgb(237 241 244 / .94);
  --shadow-tile: 0 1px 3px rgb(16 32 48 / .08), 0 4px 12px rgb(16 32 48 / .04);
  --shadow-card: 0 1px 3px rgb(16 32 48 / .07);
  --shadow-button: 0 1px 3px rgb(16 32 48 / .1);
  --focus: #ffd166;
  --logo-red: #dc1a24;
  --camera: #050708;
  font-family: Roboto, "Arial", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
  background: var(--page);
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body, #app { margin: 0; min-height: 100%; width: 100%; }
body { min-height: 100vh; min-height: 100dvh; }
/* A definite viewport height is required for the 9X shell's absolute work area. */
html[data-theme="9x"], html[data-theme="9x"] body, html[data-theme="9x"] #app {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}
html[data-theme="9x"] body { overflow: hidden; }
html[data-theme="9x"] #app { padding: 0; overflow: hidden; }
html[data-theme="9x"] {
  color-scheme: light;
  --shell: #000080;
  --shell-muted: #ffffff;
  --page: #c0c0c0;
  --surface: #c0c0c0;
  --surface-alt: #c0c0c0;
  --line: #808080;
  --ink: #000000;
  --muted: #202020;
  --accent: #000080;
  --accent-hover: #000080;
  --disabled-text: #808080;
  --tertiary: #008080;
  --success: #008080;
  --warning: #808000;
  --warning-bg: #c0c0c0;
  --danger: #800000;
  --danger-bg: #c0c0c0;
  --focus: #000080;
  --camera: #c0c0c0;
  --surface-tint: transparent;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px;
}
button:disabled { opacity: .55; cursor: not-allowed; }
.loading-page { min-height: 100vh; min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.scanner-app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
.topbar { min-height: 56px; padding: calc(8px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-left)) 8px; padding-right: max(16px, env(safe-area-inset-right)); display: flex; align-items: center; gap: 12px; background: var(--shell); color: white; box-shadow: 0 2px 7px #0b141c33; position: relative; z-index: 3; }
.topbar-title { min-width: 0; flex: 1; font-size: 1.15rem; line-height: 1.25; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.brand img { display: block; width: 141px; height: 32px; object-fit: contain; }
.brand-name { font-size: .96rem; font-weight: 850; letter-spacing: -.02em; white-space: nowrap; }
.scanner-mark { display: inline-flex; align-items: center; gap: 5px; font-size: .73rem; font-weight: 900; letter-spacing: .17em; white-space: nowrap; }
.barcode-glyph { position: relative; display: inline-block; height: 20px; width: 18px; background: repeating-linear-gradient(90deg, currentColor 0 2px, transparent 2px 4px, currentColor 4px 6px, transparent 6px 8px); }
.barcode-glyph::after { content: ""; position: absolute; left: -2px; right: -2px; top: 50%; height: 2px; background: var(--logo-red); }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.icon-button { border: 0; background: transparent; color: inherit; width: 48px; height: 48px; display: inline-grid; place-items: center; border-radius: 8px; cursor: pointer; }
.icon-button:hover { background: #ffffff1a; }
.scanner-icon { display: block; flex: 0 0 auto; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.scanner-icon-torch { stroke: none; }
.page { width: min(100%, 1120px); margin: 0 auto; padding: 20px; display: flex; flex: 1; min-height: 0; flex-direction: column; gap: 12px; }
.page.compact { padding: 12px; gap: 8px; }
.page-body { min-height: 0; flex: 1; }
.scroll-body { overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.success { color: var(--success); }
.eyebrow { margin: 0 0 4px; color: #465a6b; text-transform: uppercase; font-size: .76rem; font-weight: 800; letter-spacing: .1em; display: flex; gap: 12px; align-items: center; justify-content: space-between; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.35rem, 2.4vw, 1.8rem); line-height: 1.18; letter-spacing: -.025em; }
h2 { font-size: 1.3rem; line-height: 1.2; }
p { line-height: 1.45; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: 0 2px 5px #2637460b; }
.card.compact-card { padding: 12px; }
.form-card { width: min(100%, 520px); margin: 0 auto; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field-label { font-size: .9rem; font-weight: 650; }
.field input, .field select, .field textarea, .text-input {
  width: 100%; min-height: 48px; border: 1px solid #9eacb8; border-radius: 8px; padding: 10px 12px; color: var(--ink); background: white;
}
.field input[type="checkbox"], .check-row input { width: 22px; height: 22px; accent-color: var(--accent); }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.button { min-height: 48px; border: 1px solid var(--accent); border-radius: 9px; padding: 10px 16px; background: var(--accent); color: white; font-weight: 700; cursor: pointer; text-align: center; }
.button:hover { background: var(--accent-hover); }
.button.secondary { color: var(--accent); background: white; }
.button.secondary:hover { background: #f1f6fa; }
.button.danger { background: var(--danger); border-color: var(--danger); }
.button.block { width: 100%; }
.button.task { min-height: 76px; display: grid; place-items: center; font-size: 1.04rem; line-height: 1.25; }
.button-row { display: flex; gap: 8px; }
.button-row > * { flex: 1; }
.server-picks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.server-pick { white-space: nowrap; }
.task-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.task-card { width: 100%; }
.session-list { display: flex; flex-direction: column; gap: 8px; }
.session-row { position: relative; overflow: hidden; background: var(--danger); border: 1px solid var(--line); border-left: 5px solid var(--success); border-radius: 12px; min-height: 60px; touch-action: pan-y; }
.session-title { position: absolute; inset: 0; width: 100%; min-width: 0; min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 0; border-radius: 0; padding: 8px 14px; font-weight: 700; text-align: left; transition: transform 180ms ease; touch-action: pan-y; }
.session-copy { display: grid; gap: 1px; min-width: 0; }
.session-title .session-title-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-subtitle { color: var(--muted); font-size: .75rem; font-weight: 500; white-space: nowrap; }
.session-title .scanner-icon { color: var(--accent); }
.session-row.is-swiped .session-title { transform: translateX(-104px); }
.session-swipe-close { position: absolute; inset: 0 0 0 auto; width: 104px; display: grid; place-content: center; justify-items: center; gap: 2px; border: 0; color: #fff; background: var(--danger); font-weight: 750; cursor: pointer; }
.session-swipe-close .scanner-icon { color: #fff; width: 21px; height: 21px; }
.session-row.is-removing { animation: session-row-shrink 240ms ease-in forwards; pointer-events: none; }
@keyframes session-row-shrink { to { min-height: 0; height: 0; opacity: 0; margin-block: -4px; border-width: 0; } }
.status-line { min-height: 24px; color: var(--muted); font-size: .84rem; padding: 2px 4px; }
.queue-banner { min-height: 24px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.queue-pills { align-items: center; }
.queue-plain { display: block; color: var(--muted); font-size: .84rem; padding: 2px 4px; }
.queue-plain.error { color: var(--danger); }
.placement-notice { margin: 0; padding: 8px 10px; border-radius: 8px; background: #e8edf1; color: #52616d; font-size: .9rem; }
.update-ready { margin: 0; padding: 8px 8px 8px 12px; border-radius: 8px; background: var(--accent-soft); color: var(--ink); display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .9rem; }
.update-ready .button { flex: none; min-height: 40px; padding: 6px 14px; }
html:not([data-theme="9x"]) .update-ready { border-radius: 12px; }
html[data-theme="9x"] .update-ready { border: 1px solid #000; border-radius: 0; background: #ffffe1; }
.session-count-line { margin: 0; min-height: 24px; color: var(--muted); font-size: .84rem; padding: 2px 4px; }
.task-overflow { position: relative; }
.task-overflow summary { width: 48px; height: 48px; border-radius: 8px; list-style: none; display: grid; place-items: center; cursor: pointer; }
.task-overflow summary::-webkit-details-marker { display: none; }
.task-overflow[open] > button { position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; width: min(240px, 80vw); box-shadow: 0 4px 16px #0003; }
.stale-item-row { display: flex; gap: 10px; align-items: center; padding: 8px; background: var(--danger-bg); border-radius: 8px; }
.stale-item-row p { margin: 3px 0 0; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { border-radius: 999px; padding: 6px 11px; font-size: .85rem; background: #e4eaef; color: var(--ink); }
.pill.warning { background: var(--warning-bg); color: var(--warning); }
.pill.danger { background: var(--danger-bg); color: var(--danger); }
.task-description { color: var(--muted); }
.destination-banner, .question-banner { background: #fff; border-left: 4px solid var(--accent); border-radius: 8px; padding: 10px 12px; }
.camera-box { position: relative; background: var(--camera); border: 1px solid var(--line); border-radius: 12px; width: min(100%, 620px); height: 230px; overflow: hidden; }
.camera-box video { width: 100%; height: 100%; object-fit: cover; }
/* CameraSource paints the decoded crop here, over the video: Safari misplaces an object-fit camera stream (camera.ts). */
.camera-box .camera-preview { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.camera-box .viewfinder { position: absolute; inset: 24px max(24px, calc((100% - 240px) / 2)); border: 0; pointer-events: none; }
.camera-box .viewfinder::before, .camera-box .viewfinder::after { content: ""; position: absolute; inset: 0; }
.camera-box .viewfinder::before { border: 2px solid #ffffff88; clip-path: polygon(0 0, 24px 0, 24px 3px, 3px 3px, 3px 24px, 0 24px, 0 0, 100% 0, 100% 24px, calc(100% - 3px) 24px, calc(100% - 3px) 3px, calc(100% - 24px) 3px, calc(100% - 24px) 0, 100% 0, 100% 100%, calc(100% - 24px) 100%, calc(100% - 24px) calc(100% - 3px), calc(100% - 3px) calc(100% - 3px), calc(100% - 3px) calc(100% - 24px), 100% calc(100% - 24px), 100% 100%, 0 100%, 0 calc(100% - 24px), 3px calc(100% - 24px), 3px calc(100% - 3px), 24px calc(100% - 3px), 24px 100%, 0 100%); }
.camera-pill { position: absolute; left: 10px; top: 10px; border-radius: 999px; padding: 6px 10px; color: #fff; background: #0009; font-size: .8rem; }
.torch-button { position: absolute; width: 48px; height: 48px; right: 10px; bottom: 10px; border: 0; border-radius: 50%; background: #0009; color: #fff; display: grid; place-items: center; }
.torch-button .scanner-icon { color: #fff; }
.torch-button.torch-enabled { background: #ffffff44; box-shadow: 0 0 0 2px #fff8; }
/* CameraSource outlines every code in view on this canvas (colours are drawn, so they read on any picture and in every theme). It takes taps only in pick mode. */
.camera-box .camera-overlay { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.camera-box.is-picking .camera-overlay { pointer-events: auto; touch-action: manipulation; cursor: pointer; }
/* Pick mode's controls live in a row BELOW the camera box, never over the picture, so nothing can cover a barcode: the hint, one real button per candidate (a number and the value when every outline is exact, and the picture carries the matching small badge; when any outline is an estimate the picture carries no badges and the button is the value with its last four characters emphasised, to match the number printed on the tag) and Cancel. The buttons wear the theme's own secondary button in every theme. The row pushes the content under it down; the picture does not move. */
.camera-pick-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: min(100%, 620px); margin: 8px 0 0; }
.camera-pick-row[hidden] { display: none; }
.camera-pick-row:not([hidden]) + * { margin-top: 8px; }
.camera-pick-hint { flex: 1 1 100%; min-width: 0; font-size: .9rem; font-weight: 600; line-height: 1.3; color: var(--ink); }
.camera-pick-choices { display: contents; }
.camera-pick-choice { display: inline-flex; align-items: center; gap: 8px; min-width: 44px; max-width: 100%; padding: 0 14px 0 8px; text-align: left; }
.camera-pick-n { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--on-accent, #ffffff); font-size: .8rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.camera-pick-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.camera-pick-split { display: inline-flex; align-items: baseline; max-width: 100%; }
.camera-pick-head { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; font-size: .85rem; }
.camera-pick-tail { flex: none; margin-left: 2px; font-size: 1.35rem; font-weight: 800; line-height: 1.1; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.camera-pick-cancel { flex: none; min-width: 44px; }
/* With Reduce Motion a tap on the picture that chooses nothing cannot pulse the buttons, so CameraSource outlines the row for a moment instead (no animation). */
.camera-pick-row.is-nudged .camera-pick-choice { outline: 3px solid var(--focus); outline-offset: 2px; }
.camera-box.is-picking .torch-button, .camera-box.is-picking .camera-pill { display: none; }
.camera-box .viewfinder { inset: 24px max(24px, calc((100% - 240px) / 2)); }
.camera-box .viewfinder::before, .camera-box .viewfinder::after { display: none; }
.camera-box .viewfinder .scanner-icon { width: 100%; height: 100%; color: #ffffffb8; stroke-width: 3; }
.scan-results { display: flex; flex-direction: column; gap: 6px; }
.scan-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; min-height: 48px; background: white; border: 1px solid var(--line); border-radius: 8px; }
.scan-item.committed { border-left: 4px solid var(--success); }
.scan-item.refused { border-left: 4px solid var(--danger); }
.task-banner { display: grid; gap: 4px; }
.task-banner p { margin: 0; white-space: pre-line; }
.task-banner.success { border-left-color: var(--success); }
.task-banner.warning { border-left-color: var(--warning); }
.task-banner.danger { border-left-color: var(--danger); }
.scan-in-plant { display: grid; gap: 4px; min-height: 48px; padding: 8px 10px; background: white; border: 1px solid var(--line); border-radius: 8px; }
.scan-in-plant p { margin: 0; }
.sticky-strain { display: flex; align-items: center; gap: 10px; }
.sticky-strain strong { flex: 1; min-width: 0; }
.harvest-panel { display: grid; gap: 8px; }
.strain-picker-list { max-height: 55dvh; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.strain-picker-list h3 { margin: 8px 0 0; }
.group-choice { width: 100%; min-height: 48px; display: flex; align-items: center; gap: 10px; border: 0; border-radius: 8px; padding: 6px 8px; background: transparent; text-align: left; cursor: pointer; }
.group-choice:hover, .group-choice.selected { background: #eaf0f4; }
.group-choice .grow { display: grid; gap: 2px; }
.group-radio { position: relative; width: 24px; height: 24px; flex: 0 0 24px; border: 2px solid #738493; border-radius: 50%; }
.group-radio.selected { border-color: var(--accent); }
.group-radio.selected::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--accent); }
.greeting { position: relative; min-height: 1.25em; }
.greeting-full { visibility: hidden; }
.greeting-animated { position: absolute; inset: 0 auto auto 0; width: 100%; }
.greeting-fade .greeting-animated { animation: greeting-fade 620ms ease both; }
.greeting-slide .greeting-animated { animation: greeting-slide 520ms ease both; }
.greeting-lift .greeting-animated { animation: greeting-lift 520ms ease both; }
@keyframes greeting-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes greeting-slide { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: translateX(0); } }
@keyframes greeting-lift { from { opacity: 0; transform: translateY(9px) scale(.992); } to { opacity: 1; transform: translateY(0) scale(1); } }
.cuttings-picker-list { max-height: 55dvh; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.cutting-choice { margin-top: 6px; }
.cuttings-picker-list p { margin-bottom: 0; }
/* Cuts > Clone "Your printed trays" (contract 26.3): one tick row per labelled cutting, then the one Place button. */
.printed-trays { display: grid; gap: 4px; }
.printed-trays > p { margin: 0; }
.printed-trays > .button { margin-top: 6px; }
.printed-tray { gap: 12px; padding: 4px 0; }
.printed-tray .grow { display: grid; gap: 1px; }
.printed-tray-title { font-weight: 650; overflow-wrap: anywhere; }
.printed-tray-detail { font-size: .85rem; }
.link-button { justify-self: start; min-height: 44px; border: 0; padding: 0 2px; background: transparent; color: var(--accent); font: inherit; font-weight: 650; text-decoration: underline; cursor: pointer; }
html[data-theme="9x"] .link-button { color: #0000ff; font-weight: 400; }
.compact-task .task-description { display: none; }
.task-controls { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
.task-controls > button { flex: 1; min-width: 150px; }
.overlay { position: fixed; inset: 0; z-index: 20; background: #07121db3; display: grid; place-items: center; padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
.dialog { width: min(100%, 620px); max-height: min(92dvh, 820px); overflow: auto; background: white; color: var(--ink); border-radius: 16px; padding: 20px; box-shadow: 0 14px 50px #0005; }
.dialog h2 { margin: 0 0 8px; }
.dialog-actions { display: flex; gap: 8px; margin-top: 16px; }
.dialog-actions > * { flex: 1; }
.choices { display: grid; gap: 8px; max-height: 45dvh; overflow: auto; }
/* The Mother slot map takes 46% of the screen by itself (contract 2.1): the dialog's own column scrolls, not a 45dvh box inside it. */
/* minmax(0, 1fr): a grid item is as wide as its contents by default, which would stretch the map's viewport to the whole room instead of scrolling it. */
.choices:has(> [data-testid="mother-slot-picker"]) { max-height: none; overflow: visible; grid-template-columns: minmax(0, 1fr); }
.choice { min-height: 56px; width: 100%; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 10px 14px; cursor: pointer; }
.choice:hover { border-color: var(--accent); background: #f5f9fc; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 44px; min-width: 44px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); cursor: pointer; }
.chip.selected { border-color: var(--accent); background: var(--accent); color: #fff; }
.number-pad { display: flex; flex-direction: column; gap: 8px; }
.number-pad-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.number-key { min-width: 0; min-height: 68px; padding: 8px 4px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 1.35rem; font-weight: 650; }
.number-key.utility-key { font-size: 1rem; }
.keypad-frame { gap: 10px; }
.keypad-question { margin: 0; font-size: 1.12rem; font-weight: 700; }
.keypad-subject { margin: 0; font-weight: 650; white-space: pre-line; }
.keypad-display { display: grid; gap: 4px; justify-items: center; }
.keypad-readout { display: block; min-height: 48px; max-width: 100%; overflow-wrap: anywhere; font-size: clamp(1.7rem, 9vw, 2.25rem); font-weight: 750; text-align: center; }
.keypad-hint, .keypad-note, .keypad-live-note { margin: 0; text-align: center; }
.keypad-display .is-hidden, .keypad-live-note.is-hidden { display: none; }
.keypad-all { min-height: 60px; }
.page-transition-in { position: relative; z-index: 3; animation: page-enter 260ms cubic-bezier(.2,.7,.25,1) 30ms both; }
.page-transition-ghost { position: fixed; inset: 0; z-index: 2; pointer-events: none; animation: page-exit 130ms ease-out both; }
@keyframes page-enter { from { opacity: 0; transform: translateY(3.57vh) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes page-exit { to { opacity: 0; } }
.stagger-in { animation: stagger-enter 300ms cubic-bezier(.2,.7,.25,1) both; animation-delay: min(calc(var(--stagger-index, 0) * 35ms), 420ms); }
@keyframes stagger-enter { from { opacity: 0; transform: translateY(20%); } to { opacity: 1; transform: translateY(0); } }
.hold-confirm { position: relative; overflow: hidden; min-height: 52px; width: 100%; border: 1.5px solid var(--danger); border-radius: 9px; background: #fff; color: var(--danger); font-weight: 750; touch-action: none; }
.hold-confirm .hold-fill-label { position: absolute; inset: 0; display: grid; place-items: center; background: var(--danger); color: #fff; clip-path: inset(0 calc(100% - var(--hold-width, 0%)) 0 0); transition: clip-path 220ms ease; pointer-events: none; }
.hold-confirm.is-holding .hold-fill-label { transition: none; }
.hold-confirm .hold-base-label { display: block; }
.calendar-row { display: flex; gap: 8px; align-items: center; }
.map-grid { display: grid; grid-template-columns: repeat(6, minmax(42px, 1fr)); gap: 5px; overflow: auto; }
.map-cell { min-height: 48px; border: 1px solid var(--line); border-radius: 6px; background: white; }
.map-cell.available { border-color: var(--success); color: var(--success); }
.map-cell.current { outline: 3px solid var(--warning); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Home: the thin Switch worker card above the greeting; its face slides right over an accent back. */
.switch-card { position: relative; overflow: hidden; height: 32px; border: 1px solid var(--line); border-radius: 10px; background: var(--accent); touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab; }
.switch-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch-card-back, .switch-card-face { position: absolute; inset: 0; display: flex; align-items: center; gap: 8px; padding: 0 12px; font-size: .8rem; }
.switch-card-back { gap: 6px; color: #fff; font-weight: 700; }
.switch-card-back .scanner-icon { color: #fff; width: 16px; height: 16px; }
.switch-card-face { background: var(--surface-alt); color: var(--ink); transition: transform 180ms ease; }
.switch-card.is-dragging .switch-card-face { transition: none; }
.switch-card-label { flex: 1; min-width: 0; font-weight: 700; }
.switch-card-hint { color: var(--muted); font-size: .74rem; }
.switch-card-face .scanner-icon { color: var(--muted); width: 14px; height: 14px; }
/* Worker page: the top block and Sign out stay put, only the name list scrolls. */
.scanner-app.worker-frame { height: 100vh; height: 100dvh; min-height: 0; }
.page.worker-page { overflow: auto; }
.worker-page > .card { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.worker-screen { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.worker-top { display: flex; flex-direction: column; gap: 8px; }
.worker-top .error { margin: 0; }
.worker-selected { margin: 0; font-size: 1.2rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.worker-picker { position: relative; flex: 1; min-height: 132px; display: flex; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-alt); overflow: hidden; }
.worker-list { position: relative; flex: 1; min-width: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.worker-empty { padding: 12px; margin: 0; }
.worker-option { width: 100%; height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 8px 0 12px; border: 0; border-bottom: 1px solid var(--line); border-left: 4px solid transparent; background: transparent; color: var(--ink); font-size: 1rem; text-align: left; cursor: pointer; }
.worker-option-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.worker-option-note { flex: 0 0 auto; font-size: .75rem; }
.worker-option.no-pin { color: var(--muted); opacity: .6; }
.worker-option.selected { border-left-color: var(--accent); background: #dbe9f5; font-weight: 700; }
.worker-option.no-pin.selected { opacity: .85; }
.worker-rail { flex: 0 0 28px; display: flex; flex-direction: column; justify-content: center; padding: 4px 0; background: var(--surface); border-left: 1px solid var(--line); touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; }
.worker-rail-letter { flex: 1 1 0; max-height: 28px; min-height: 0; display: grid; place-items: center; font-size: .72rem; font-weight: 800; color: var(--accent); }
.worker-rail-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 72px; height: 72px; display: grid; place-items: center; border-radius: 16px; background: var(--shell); color: #fff; font-size: 2.4rem; font-weight: 800; pointer-events: none; box-shadow: 0 4px 16px #0004; }
.worker-rail-hint[hidden] { display: none; }
@media (max-height: 520px) { .worker-page > .card { min-height: 420px; } }

@media (max-width: 760px) and (orientation: portrait), (max-height: 599px) and (pointer: coarse) {
  .topbar { min-height: 48px; padding-top: calc(4px + env(safe-area-inset-top)); }
  .topbar-title { font-size: 1rem; }
  .page { padding: 12px; gap: 8px; }
  .button.task { min-height: 60px; padding: 8px 10px; font-size: .95rem; }
  .card { border-radius: 10px; padding: 12px; }
  .dialog { border-radius: 12px; padding: 14px; max-height: 96dvh; }
  .camera-box { width: min(100%, 520px); height: 230px; }
  .brand img { width: 112px; height: 26px; }
  .scan-results { overflow: auto; }
}

@media (max-height: 480px) and (pointer: coarse) {
  .topbar { min-height: 44px; padding-top: calc(2px + env(safe-area-inset-top)); padding-bottom: 2px; }
  .page { padding-top: 6px; padding-bottom: 6px; }
  .page-body { overflow: auto; }
  .card { padding: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .page-transition-in, .page-transition-ghost, .stagger-in, .session-row.is-removing { animation: none !important; }
  .greeting-animated { animation: none !important; }
  .session-title { transition: none !important; }
  .hold-confirm .hold-fill-label { transition: none !important; }
}

/* Windows 95 shell tokens are loaded by the retro lane kit. */
html[data-theme="9x"] body { background: #008080; color: #000; font-family: Tahoma, Arial, sans-serif; }
html[data-theme="9x"] .topbar { display: none; }
html:not([data-theme="9x"]) .settings-back { display: none; }
html[data-theme="9x"] .scanner-app { width: 100%; height: 100%; min-height: 0; flex: 1 1 auto; }
html[data-theme="9x"] .page { width: 100%; margin: 0; }
html[data-theme="9x"] .page-body { overflow: auto; }
html[data-theme="9x"] .retro-app-page { min-width: 0; min-height: 0; height: 100%; }
html[data-theme="9x"] .x9-managed-window .x9-window-content-slot { background: var(--page); }
html[data-theme="9x"] .scanner-app,
html[data-theme="9x"] .page,
html[data-theme="9x"] .card,
html[data-theme="9x"] .field input,
html[data-theme="9x"] .field select,
html[data-theme="9x"] .field textarea,
html[data-theme="9x"] .text-input,
html[data-theme="9x"] .dialog,
html[data-theme="9x"] .choice,
html[data-theme="9x"] .number-key,
html[data-theme="9x"] .scan-item,
html[data-theme="9x"] .scan-in-plant,
html[data-theme="9x"] .map-cell,
html[data-theme="9x"] .destination-banner,
html[data-theme="9x"] .question-banner,
html[data-theme="9x"] .hold-confirm {
  background-color: var(--surface);
  color: var(--ink);
}
html[data-theme="9x"] .scanner-app,
html[data-theme="9x"] .scanner-app *,
html[data-theme="9x"] .overlay,
html[data-theme="9x"] .overlay * {
  border-radius: 0;
}
html[data-theme="9x"] .card { border-color: var(--line); box-shadow: none; }
html[data-theme="9x"] .button { border-color: var(--accent); }
html[data-theme="9x"] .x9-shell .scanner-app .button:not(.secondary):not(:disabled),
html[data-theme="9x"] .x9-shell .overlay .button:not(.secondary):not(:disabled) {
  color: #ffffff;
}
html[data-theme="9x"] .x9-shell .scanner-app .button:not(.secondary):not(:disabled) .scanner-icon,
html[data-theme="9x"] .x9-shell .overlay .button:not(.secondary):not(:disabled) .scanner-icon {
  color: #ffffff;
}
html[data-theme="9x"] .x9-shell .scanner-app .button:not(.secondary):disabled,
html[data-theme="9x"] .x9-shell .overlay .button:not(.secondary):disabled {
  color: var(--disabled-text);
  opacity: 1;
}
html[data-theme="9x"] .x9-shell .scanner-app .button:not(.secondary):disabled .scanner-icon,
html[data-theme="9x"] .x9-shell .overlay .button:not(.secondary):disabled .scanner-icon {
  color: var(--disabled-text);
}
html[data-theme="9x"] .button.secondary {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface);
}
html[data-theme="9x"] .button.secondary:hover,
html[data-theme="9x"] .choice:hover,
html[data-theme="9x"] .group-choice:hover,
html[data-theme="9x"] .group-choice.selected { background: #dfdfdf; }
html[data-theme="9x"] .field input,
html[data-theme="9x"] .field select,
html[data-theme="9x"] .field textarea,
html[data-theme="9x"] .text-input,
html[data-theme="9x"] .choice,
html[data-theme="9x"] .number-key,
html[data-theme="9x"] .scan-item,
html[data-theme="9x"] .scan-in-plant,
html[data-theme="9x"] .map-cell { border-color: var(--line); }
html[data-theme="9x"] .camera-box { background: var(--camera); border-color: var(--line); }
html[data-theme="9x"] .session-row { background: var(--surface); border-color: var(--line); }
html[data-theme="9x"] .session-title { background: var(--surface); color: var(--ink); }
html[data-theme="9x"] .pill { background: var(--surface-alt); color: var(--ink); }
html[data-theme="9x"] .pill.warning { background: var(--warning-bg); color: var(--warning); }
html[data-theme="9x"] .pill.danger { background: var(--danger-bg); color: var(--danger); }
/* These controls deliberately use circles/capsules rather than a Material shape token. */
html[data-theme="9x"] .spinner,
html[data-theme="9x"] .group-radio,
html[data-theme="9x"] .group-radio::after,
html[data-theme="9x"] .torch-button { border-radius: 50%; }
html[data-theme="9x"] .pill,
html[data-theme="9x"] .camera-pill { border-radius: 999px; }
html[data-theme="9x"] .worker-picker, html[data-theme="9x"] .worker-rail { background: var(--surface); }
html[data-theme="9x"] .worker-option.selected { background: var(--accent); color: #fff; }
html[data-theme="9x"] .worker-rail-letter { color: var(--ink); }

/* "Is this table in the right place?" and the pool buttons in the slot picker. */
.table-check-location { margin: 0; font-weight: 750; }
.table-check-contents { margin: 0; padding-left: 20px; display: grid; gap: 2px; }
.table-check-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.table-check-answer { min-height: 64px; font-size: 1.3rem; }
/* The Place picker's list step (contract 2.3, 2.4): Wash / Staging and one button per room, each full width on one line. */
.slot-step-list, .pool-targets, .slot-room-list { gap: 8px; }
.pool-target, .slot-room-choice { min-height: 52px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-room-choice { display: flex; align-items: center; justify-content: center; }
.slot-room-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.slot-room-sep, .slot-room-meta { flex: none; white-space: pre; }
/* A name too long to share the line with its count (DialogViews measures it): the count goes under the name. */
.slot-room-choice.stacked { flex-direction: column; gap: 1px; padding-top: 6px; padding-bottom: 6px; }
.slot-room-choice.stacked .slot-room-name { max-width: 100%; }
.slot-room-choice.stacked .slot-room-sep { display: none; }
.slot-room-choice.stacked .slot-room-meta { font-size: .86em; }
.pool-target.current, .slot-room-choice.current { outline: 3px solid var(--warning); }
/* Above a picker's map: the one back button ("‹ Rooms" or "‹ <room>") and the place's name beside it. */
.slot-map-header { display: flex; align-items: center; gap: 10px; min-width: 0; }
.floor-map-back { flex: 0 1 auto; max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-map-place { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 750; }

/* ===== Standard theme: the Tonal look (docs/SCANNER_STANDARD_TONAL.md) =====
   Every rule below is scoped to html:not([data-theme="9x"]), and the dark set to data-appearance,
   which 9X never carries, so the 9X Like theme renders exactly as it did before. */
html[data-appearance="dark"]:not([data-theme="9x"]) {
  color-scheme: dark;
  --shell: #0a1015;
  --page: #0c1318;
  --surface: #16212a;
  --surface-alt: #1a2631;
  --line: #263542;
  --line-strong: #344656;
  --ink: #d6e1ea;
  --muted: #8fa3b4;
  --accent: #5f9fd9;
  --accent-hover: #4f8fca;
  --accent-soft: #19324a;
  --on-accent: #0c1318;
  --success: #5cbf86;
  --success-soft: #15301f;
  --warning: #e0b35b;
  --warning-soft: #33280f;
  --caution: #ffd23f;
  --caution-ink: #ffdc5c;
  --caution-soft: #383008;
  --caution-edge: #ffd23f;
  --danger: #ee8a80;
  --danger-soft: #3a1b19;
  --plants: #6cc893;
  --plants-soft: #14301f;
  --care: #6cc4dd;
  --care-soft: #0f2e38;
  --supplies: #e2b45c;
  --supplies-soft: #33270f;
  --camera: #05080a;
  --dock: rgb(12 19 24 / .94);
  /* Dark has no shadows: surfaces separate by tone. */
  --shadow-tile: none;
  --shadow-card: none;
  --shadow-button: none;
}
html:not([data-theme="9x"]) { font-family: system-ui, -apple-system, "SF Pro Text", Roboto, "Noto Sans", sans-serif; }
html:not([data-theme="9x"]) .topbar { box-shadow: none; }

/* Buttons: radius 12. Primary is accent with on-accent text; secondary is a borderless surface. */
html:not([data-theme="9x"]) .button { border-color: transparent; border-radius: 12px; color: var(--on-accent); font-weight: 650; }
html:not([data-theme="9x"]) .button.secondary { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-button); }
html:not([data-theme="9x"]) .button.secondary:hover { background: var(--surface-alt); }
html[data-appearance="dark"]:not([data-theme="9x"]) :is(.card, .dialog, .question-banner, .destination-banner) .button.secondary { background: var(--surface-alt); }
html[data-appearance="dark"]:not([data-theme="9x"]) .button.danger { color: var(--page); }

/* Cards, banners, inputs: radius 16 and no border; inputs radius 12 on a line-strong border. */
html:not([data-theme="9x"]) .card { border: 0; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-card); }
html:not([data-theme="9x"]) .field input,
html:not([data-theme="9x"]) .field select,
html:not([data-theme="9x"]) .field textarea,
html:not([data-theme="9x"]) .text-input { border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--ink); }
html:not([data-theme="9x"]) .destination-banner,
html:not([data-theme="9x"]) .question-banner { border: 0; border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card); padding: 11px 14px; }
html:not([data-theme="9x"]) .destination-banner { display: grid; gap: 8px; }
html:not([data-theme="9x"]) .destination-banner > p { margin: 0; }
html:not([data-theme="9x"]) .place-line { display: grid; gap: 1px; }
html:not([data-theme="9x"]) .place-label { font-size: .78rem; font-weight: 700; color: var(--muted); }
html:not([data-theme="9x"]) .place-name { font-size: 1.28rem; font-weight: 800; line-height: 1.15; letter-spacing: -.01em; overflow-wrap: break-word; }
html:not([data-theme="9x"]) .place-detail { font-size: .85rem; color: var(--muted); }
html:not([data-theme="9x"]) .eyebrow { color: var(--muted); }
html:not([data-theme="9x"]) .section-heading { margin: 0; font-size: .92rem; font-weight: 700; line-height: 1.25; color: var(--muted); text-transform: none; letter-spacing: 0; }
html:not([data-theme="9x"]) .section-heading .button { min-height: 44px; padding: 6px 14px; font-size: .9rem; }
html:not([data-theme="9x"]) .placement-notice { border-radius: 12px; background: var(--surface-alt); color: var(--muted); }
html:not([data-theme="9x"]) .pill { background: var(--surface-alt); color: var(--ink); }
html:not([data-theme="9x"]) .pill.warning { background: var(--warning-soft); color: var(--warning); }
html:not([data-theme="9x"]) .pill.danger { background: var(--danger-soft); color: var(--danger); }
html:not([data-theme="9x"]) .status-line:empty { display: none; }
html:not([data-theme="9x"]) :where(.map-cell) { background: var(--surface); color: var(--ink); border-color: var(--line); }
html:not([data-theme="9x"]) .hold-confirm { border-radius: 12px; background: var(--surface); }
html[data-appearance="dark"]:not([data-theme="9x"]) .hold-confirm .hold-fill-label { color: var(--page); }

/* Home: Switch worker card, greeting, open sessions, then the task groups. */
html:not([data-theme="9x"]) .switch-card { height: 36px; border-radius: 10px; border-color: var(--line); background: var(--accent); }
html:not([data-theme="9x"]) .switch-card-back, html:not([data-theme="9x"]) .switch-card-back .scanner-icon { color: var(--on-accent); }
html:not([data-theme="9x"]) .switch-card-face { background: var(--surface); }
html:not([data-theme="9x"]) h1.greeting { margin: 2px 0 0; font-size: 1.3rem; line-height: 1.25; font-weight: 750; letter-spacing: -.012em; }
html:not([data-theme="9x"]) .session-row { border: 0; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-card); }
/* The red reveal sits a pixel inside the rounded row so none of it shows at the corners. */
html:not([data-theme="9x"]) .session-swipe-close { inset: 1px 1px 1px auto; border-radius: 0 15px 15px 0; }
html[data-appearance="dark"]:not([data-theme="9x"]) .session-swipe-close,
html[data-appearance="dark"]:not([data-theme="9x"]) .session-swipe-close .scanner-icon { color: var(--page); }
html:not([data-theme="9x"]) .session-row .button.session-title { justify-content: flex-start; gap: 12px; padding: 10px 14px; border-radius: 0; background: var(--surface); color: var(--ink); box-shadow: none; }
html:not([data-theme="9x"]) .session-title::before { content: ""; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
html:not([data-theme="9x"]) .session-title > .scanner-icon { margin-left: auto; color: var(--accent); }
html:not([data-theme="9x"]) .session-subtitle { color: var(--muted); }
html:not([data-theme="9x"]) .task-groups { display: grid; gap: 18px; }
html:not([data-theme="9x"]) .task-group { display: grid; gap: 8px; --group: var(--accent); --group-soft: var(--accent-soft); }
html:not([data-theme="9x"]) .task-group.group-plants { --group: var(--plants); --group-soft: var(--plants-soft); }
html:not([data-theme="9x"]) .task-group.group-care { --group: var(--care); --group-soft: var(--care-soft); }
html:not([data-theme="9x"]) .task-group.group-supplies { --group: var(--supplies); --group-soft: var(--supplies-soft); }
html:not([data-theme="9x"]) .task-group-title { margin: 0; display: flex; align-items: center; gap: 8px; font-size: .92rem; font-weight: 700; line-height: 1.25; color: var(--group); }
html:not([data-theme="9x"]) .task-group-title::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
html:not([data-theme="9x"]) .task-group-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
html:not([data-theme="9x"]) .task-tile { width: 100%; min-height: 70px; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; padding: 10px 12px 10px 10px; border: 0; border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-tile); font-size: .98rem; font-weight: 650; line-height: 1.2; text-align: left; cursor: pointer; }
html:not([data-theme="9x"]) .task-tile:active { background: var(--group-soft); }
html:not([data-theme="9x"]) .task-tile-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--group-soft); color: var(--group); }
html:not([data-theme="9x"]) .task-tile-icon .scanner-icon { width: 24px; height: 24px; stroke-width: 1.8; }
html:not([data-theme="9x"]) .task-tile-label { min-width: 0; overflow-wrap: break-word; }

/* Task screen: banner, last scan, description until the first scan, task controls, camera, counts,
   earlier scans, queue status, and the action bar docked to the bottom edge. */
html:not([data-theme="9x"]) .task-screen { gap: 10px; }
html:not([data-theme="9x"]) .task-screen > [hidden] { display: none; }
html:not([data-theme="9x"]) .tone-ok { --tone: var(--success); --tone-soft: var(--success-soft); }
html:not([data-theme="9x"]) .tone-staged { --tone: var(--accent); --tone-soft: var(--accent-soft); }
html:not([data-theme="9x"]) .tone-caution { --tone: var(--caution-ink); --tone-soft: var(--caution-soft); }
html:not([data-theme="9x"]) .tone-asks { --tone: var(--warning); --tone-soft: var(--warning-soft); }
html:not([data-theme="9x"]) .tone-refused { --tone: var(--danger); --tone-soft: var(--danger-soft); }
html:not([data-theme="9x"]) .tone-pending,
html:not([data-theme="9x"]) .tone-muted { --tone: var(--muted); --tone-soft: var(--surface-alt); }
html:not([data-theme="9x"]) .last-scan { display: grid; gap: 4px; padding: 14px 16px; border-radius: 16px; background: var(--tone-soft); color: var(--ink); }
html:not([data-theme="9x"]) .last-scan.is-changeable { cursor: pointer; }
html:not([data-theme="9x"]) .last-scan-head { display: flex; align-items: center; gap: 10px; }
html:not([data-theme="9x"]) .last-scan-mark { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--tone); color: #fff; }
html[data-appearance="dark"]:not([data-theme="9x"]) .last-scan-mark { color: var(--page); }
html:not([data-theme="9x"]) .last-scan-mark .scanner-icon { width: 18px; height: 18px; stroke-width: 2.6; }
html:not([data-theme="9x"]) .last-scan-word { flex: 1; min-width: 0; font-size: 1.25rem; font-weight: 750; line-height: 1.2; color: var(--tone); }
html:not([data-theme="9x"]) .last-scan-time { flex: none; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
html:not([data-theme="9x"]) .last-scan-value { font-size: 1.1rem; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
html:not([data-theme="9x"]) .last-scan-msg { margin: 0; color: var(--muted); }
html:not([data-theme="9x"]) .last-scan > .button { margin-top: 6px; justify-self: start; }
html:not([data-theme="9x"]) .last-scan > .button.block { justify-self: stretch; }
html:not([data-theme="9x"]) .camera-box { height: 168px; border: 0; border-radius: 12px; }
html:not([data-theme="9x"]) .count-chips { display: flex; gap: 6px; }
html:not([data-theme="9x"]) .count-chip { flex: 1 1 0; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; column-gap: 6px; padding: 6px 8px; border-radius: 12px; background: var(--surface); color: var(--muted); font-size: .82rem; line-height: 1.3; text-align: center; }
html:not([data-theme="9x"]) .count-chip b { font-size: 1.05rem; font-variant-numeric: tabular-nums; color: var(--tone); }
/* Four chips do not fit a phone's width on one line each: stack every number over its label alike. */
html:not([data-theme="9x"]) .page.compact .count-chips.has-duplicates .count-chip { flex-direction: column; align-items: center; }
html:not([data-theme="9x"]) .earlier-scans { margin: 4px 0 0; }
html:not([data-theme="9x"]) .scan-item { grid-template-columns: auto minmax(0, 1fr) auto; padding: 9px 12px; border: 0; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-card); }
html:not([data-theme="9x"]) .scan-in-plant { grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 10px; padding: 9px 12px; border: 0; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-card); }
html:not([data-theme="9x"]) .scan-in-plant > .grow { display: grid; gap: 4px; }
/* A barcode wraps inside the narrowed text column rather than running under the answer button. */
html:not([data-theme="9x"]) .scan-item > .grow strong { overflow-wrap: anywhere; }
/* An unknown tag's lines (message, "New tag · strain from GrowFlow") wrap in the 360 px column instead of pushing the tag or the Undo action off-screen. */
.scan-item > .grow .muted, .last-scan-msg, .scan-strain-note { overflow-wrap: anywhere; }
/* Undo: a scan card swipes left like the Home session row. The red action is the card's own last child, laid
   against its right edge, so it travels with the card; the two lists clip it while the card is at rest. */
html:not([data-theme="9x"]) .tone-undone { --tone: var(--muted); --tone-soft: var(--surface-alt); }
html:not([data-theme="9x"]) .last-scan-host,
html:not([data-theme="9x"]) .scan-results { overflow-x: clip; overflow-y: visible; overflow-clip-margin: 6px; }
html:not([data-theme="9x"]) .swipe-card { position: relative; touch-action: pan-y; transition: transform 180ms ease; }
html:not([data-theme="9x"]) .swipe-card.is-swiped { transform: translateX(-104px); }
html:not([data-theme="9x"]) .swipe-card.is-dragging { transition: none; }
html:not([data-theme="9x"]) .swipe-card.is-swiped,
html:not([data-theme="9x"]) .swipe-card.is-dragging { border-top-right-radius: 0; border-bottom-right-radius: 0; }
html:not([data-theme="9x"]) .swipe-undo { position: absolute; top: 0; bottom: 0; left: 100%; width: 104px; display: grid; place-content: center; justify-items: center; gap: 2px; margin: 0; padding: 0; border: 0; border-radius: 0 16px 16px 0; color: #fff; background: var(--danger); font: inherit; font-weight: 750; cursor: pointer; visibility: hidden; }
html:not([data-theme="9x"]) .scan-item .swipe-undo { border-radius: 0 12px 12px 0; }
html:not([data-theme="9x"]) .swipe-card.is-swiped > .swipe-undo,
html:not([data-theme="9x"]) .swipe-card.is-dragging > .swipe-undo { visibility: visible; }
html:not([data-theme="9x"]) .swipe-undo .scanner-icon { color: #fff; width: 21px; height: 21px; }
html[data-appearance="dark"]:not([data-theme="9x"]) .swipe-undo,
html[data-appearance="dark"]:not([data-theme="9x"]) .swipe-undo .scanner-icon { color: var(--page); }
/* An undone scan stays on the list, muted, its value struck through. */
html:not([data-theme="9x"]) .scan-item.is-undone { opacity: .78; }
html:not([data-theme="9x"]) .is-undone .last-scan-value,
html:not([data-theme="9x"]) .scan-item.is-undone > .grow strong { text-decoration: line-through; text-decoration-thickness: 1px; }
html:not([data-theme="9x"]) .row-mark { display: grid; color: var(--tone); }
html:not([data-theme="9x"]) .row-mark .scanner-icon { width: 20px; height: 20px; stroke-width: 2.2; }
/* The caution mark is a filled yellow triangle with a dark "!", with no disc behind it. */
html:not([data-theme="9x"]) .result-mark-caution path:first-child { fill: var(--caution); stroke: var(--caution-edge); stroke-linejoin: round; }
html:not([data-theme="9x"]) .result-mark-caution path:not(:first-child) { stroke: var(--caution-mark); }
html:not([data-theme="9x"]) .tone-caution .last-scan-mark { background: transparent; }
html:not([data-theme="9x"]) .tone-caution .last-scan-mark .scanner-icon { width: 30px; height: 30px; stroke-width: 2; }
/* 9X: a caution row keeps its green committed edge out of sight and carries the classic triangle before its word. */
html[data-theme="9x"] .scan-item.caution { border-left-color: var(--warning); }
html[data-theme="9x"] .x9-caution-mark { display: inline-block; vertical-align: -3px; margin-right: 6px; }
/* The docked bar: the page's own padding variables let it reach the edges of the page. */
html:not([data-theme="9x"]) .page.task-page { --pad-x: 20px; --pad-b: 20px; }
html:not([data-theme="9x"]) .page.task-page.compact { --pad-x: 12px; --pad-b: 12px; }
html:not([data-theme="9x"]) .scanner-app.task-frame { padding-bottom: 0; }
html:not([data-theme="9x"]) .task-page > .task-screen { flex: 1 0 auto; }
html:not([data-theme="9x"]) .task-controls.action-bar { position: sticky; bottom: 0; z-index: 4; flex-wrap: nowrap; margin: auto calc(-1 * var(--pad-x)) calc(-1 * var(--pad-b)); padding: 10px var(--pad-x) calc(12px + env(safe-area-inset-bottom)); background: var(--dock); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
html:not([data-theme="9x"]) .task-controls.action-bar > button { min-width: 0; }
@media (max-height: 480px) and (pointer: coarse) {
  /* The short-landscape page scrolls with the document, so the bar can stick to the viewport. */
  html:not([data-theme="9x"]) .page.task-page { --pad-b: 6px; overflow: visible; }
}

/* Dialogs and keypads. */
html:not([data-theme="9x"]) .overlay { background: rgb(8 16 24 / .6); }
html:not([data-theme="9x"]) .dialog { border-radius: 22px; background: var(--surface); color: var(--ink); }
html:not([data-theme="9x"]) .number-key { border: 0; border-radius: 14px; background: var(--surface-alt); color: var(--ink); font-weight: 600; }
html:not([data-theme="9x"]) .choice { border-color: var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); }
html:not([data-theme="9x"]) .choice:hover { border-color: var(--accent); background: var(--surface-alt); }
html:not([data-theme="9x"]) .chip { border-color: var(--line); background: var(--surface); color: var(--ink); }
html:not([data-theme="9x"]) .chip.selected { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
html:not([data-theme="9x"]) .group-choice:hover,
html:not([data-theme="9x"]) .group-choice.selected { background: var(--surface-alt); }
html:not([data-theme="9x"]) .group-radio { border-color: var(--muted); }
html:not([data-theme="9x"]) .group-radio.selected { border-color: var(--accent); }

/* Settings, sign-in and worker pages. */
html:not([data-theme="9x"]) .appearance-choice { display: grid; margin-top: 6px; }
html:not([data-theme="9x"]) .appearance-choice .field-label { margin: 0; }
html:not([data-theme="9x"]) .worker-picker { border-color: var(--line); border-radius: 12px; background: var(--surface-alt); }
html:not([data-theme="9x"]) .worker-rail { border-left-color: var(--line); background: var(--surface); }
html:not([data-theme="9x"]) .worker-option.selected { background: var(--accent-soft); }

/* The scanner floor map is rendered as a room SVG; its pixel geometry stays readable at every fit. */
html:not([data-theme="9x"]) select { appearance: none; -webkit-appearance: none; min-height: 48px; padding: 10px 40px 10px 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23566878' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 18px 18px; color: var(--ink); font: inherit; }
html[data-appearance="dark"]:not([data-theme="9x"]) select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238fa3b4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
html:not([data-theme="9x"]) .table-check-contents { list-style: none; padding: 0; color: var(--muted); }
html:not([data-theme="9x"]) .floor-map { gap: 8px; min-width: 0; }
/* The north mark is pinned over the viewport's top-right corner while a wide picker room scrolls (contract 2.1). */
.floor-map-stage { position: relative; min-width: 0; width: 100%; }
.floor-map-north { position: absolute; top: 0; right: 0; width: 32px; height: 32px; overflow: visible; pointer-events: none; }
html:not([data-theme="9x"]) .floor-map-rooms { display: flex; gap: 6px; overflow-x: auto; padding: 1px 1px 5px; scrollbar-width: thin; }
html:not([data-theme="9x"]) .floor-map-room-chip { flex: 0 0 auto; }
html:not([data-theme="9x"]) .floor-map-room-chip,
html:not([data-theme="9x"]) .floor-map-back { min-height: 44px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface-alt); color: var(--ink); font: inherit; font-size: .82rem; font-weight: 700; }
html:not([data-theme="9x"]) .floor-map-room-chip.selected,
html:not([data-theme="9x"]) .floor-map-back { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
html:not([data-theme="9x"]) .floor-map-viewport { width: 100%; max-width: 100%; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; border-radius: 10px; scrollbar-width: thin; }
html:not([data-theme="9x"]) .floor-map.is-readonly .floor-map-viewport { overflow: visible; }
html:not([data-theme="9x"]) .floor-map-viewport:focus-visible,
html:not([data-theme="9x"]) .floor-map-room-chip:focus-visible,
html:not([data-theme="9x"]) .floor-map-back:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
html:not([data-theme="9x"]) .floor-map-svg { display: block; max-width: none; overflow: visible; touch-action: pan-x pan-y; }
html:not([data-theme="9x"]) .floor-map .map-cell { outline: none; }
html:not([data-theme="9x"]) .map-room-outline { fill: var(--surface-alt); stroke: var(--line-strong); stroke-width: 1.5; }
html:not([data-theme="9x"]) .map-room-outline.fill-veg { fill: var(--plants-soft); }
html:not([data-theme="9x"]) .map-room-outline.fill-clone { fill: var(--care-soft); }
html:not([data-theme="9x"]) .map-room-outline.fill-bloom { fill: var(--warning-soft); }
html:not([data-theme="9x"]) .map-door { stroke: var(--warning); stroke-width: 3; stroke-linecap: square; }
html:not([data-theme="9x"]) .map-rail { fill: var(--accent); opacity: .09; stroke: var(--accent); stroke-width: 1; cursor: pointer; }
html:not([data-theme="9x"]) .map-rail:focus-visible { opacity: .22; stroke-width: 2; outline: none; }
html:not([data-theme="9x"]) .map-cell { cursor: default; }
html:not([data-theme="9x"]) .map-cell[role="button"] { cursor: pointer; outline: none; }
html:not([data-theme="9x"]) .map-cell-shape { fill: transparent; stroke: var(--muted); stroke-width: 1; }
html:not([data-theme="9x"]) .map-cell.free .map-cell-shape { stroke-dasharray: 3 2; }
html:not([data-theme="9x"]) .map-cell-shape.stage-clone { stroke: var(--care); }
html:not([data-theme="9x"]) .map-cell-shape.stage-veg { stroke: var(--plants); }
html:not([data-theme="9x"]) .map-cell-shape.stage-new_mother { stroke: #7452a8; }
html:not([data-theme="9x"]) .map-cell-shape.stage-bloom { stroke: var(--warning); }
html:not([data-theme="9x"]) .map-cell-shape.stage-mother { stroke: var(--muted); }
html:not([data-theme="9x"]) .map-cell.occupied .map-cell-shape { fill: var(--surface-alt); }
html:not([data-theme="9x"]) .map-cell.occupied .map-cell-shape.stage-clone { fill: var(--care-soft); }
html:not([data-theme="9x"]) .map-cell.occupied .map-cell-shape.stage-veg { fill: var(--plants-soft); }
html:not([data-theme="9x"]) .map-cell.occupied .map-cell-shape.stage-new_mother { fill: #eee8f7; }
html:not([data-theme="9x"]) .map-cell.occupied .map-cell-shape.stage-bloom { fill: var(--warning-soft); }
html:not([data-theme="9x"]) .map-cell.plant-position .map-cell-shape { fill: var(--surface-alt); stroke: var(--muted); stroke-dasharray: none; }
html:not([data-theme="9x"]) .map-cell.plant-position[data-untagged="true"] .map-cell-shape { stroke: var(--warning); stroke-dasharray: 3 2; }
html:not([data-theme="9x"]) .map-cell.available .map-cell-shape { fill: var(--success-soft); stroke: var(--success); stroke-width: 1.5; }
/* An untagged Mother plant stays marked inside the green available outline (the Android picker tints it the same way). */
html:not([data-theme="9x"]) .map-cell.available[data-untagged="true"] .map-cell-shape { fill: var(--warning-soft); }
html:not([data-theme="9x"]) .map-cell.current .map-cell-shape { fill: var(--warning-soft); stroke: var(--warning); stroke-width: 2.5; }
html:not([data-theme="9x"]) .map-cell[role="button"]:focus-visible .map-cell-shape { stroke: var(--accent); stroke-width: 2.5; }
html:not([data-theme="9x"]) .map-slot-name,
html:not([data-theme="9x"]) .map-slot-number { fill: var(--ink); font: 6px system-ui, sans-serif; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
html:not([data-theme="9x"]) .map-slot-name.current-name { fill: var(--warning); font-size: 7px; font-weight: 800; }
html:not([data-theme="9x"]) .map-current-pin { fill: var(--warning); }
html:not([data-theme="9x"]) .map-flag-pole { stroke: var(--ink); stroke-width: 1.2; }
html:not([data-theme="9x"]) .map-flag-shape { fill: #fff; stroke: var(--ink); stroke-width: 1; }
html:not([data-theme="9x"]) .map-flag-letter { fill: #1b2935; font: 700 8px system-ui, sans-serif; text-anchor: middle; pointer-events: none; }
html:not([data-theme="9x"]) .map-row-label,
html:not([data-theme="9x"]) .map-room-caption { fill: var(--muted); font: 700 8.5px system-ui, sans-serif; }
html:not([data-theme="9x"]) .map-room-caption { font-size: 9px; }
html:not([data-theme="9x"]) .map-north-circle { fill: var(--surface); stroke: var(--muted); stroke-width: 1; }
html:not([data-theme="9x"]) .map-north-arrow { fill: none; stroke: var(--ink); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
html:not([data-theme="9x"]) .map-north-label { fill: var(--muted); font: 700 7px system-ui, sans-serif; }
html:not([data-theme="9x"]) .slot-selection-detail { margin: 0; color: var(--muted); font-size: .84rem; }
.slot-map-hint { margin: 0; color: var(--muted); font-size: .84rem; }
.floor-map .map-slot-name,
.floor-map .map-slot-number,
.floor-map .map-flag-letter { text-anchor: middle; dominant-baseline: central; }
.floor-map .map-flag { pointer-events: none; }
.floor-map .map-flag-pole { stroke-width: 1.2; }
html[data-theme="9x"] .floor-map-rooms { display: flex; gap: 4px; overflow-x: auto; }
/* A picker with one room to draw shows no chip strip; both themes' display rules above would otherwise override [hidden]. */
html .floor-map-rooms[hidden] { display: none; }
html[data-theme="9x"] .floor-map-room-chip,
html[data-theme="9x"] .floor-map-back { min-height: 44px; color: var(--ink); }
html[data-theme="9x"] .floor-map-viewport { max-width: 100%; overflow-x: auto; overflow-y: hidden; }
html[data-theme="9x"] .floor-map.is-readonly .floor-map-viewport { overflow: visible; }
html[data-theme="9x"] .floor-map-svg { display: block; max-width: none; }
html[data-theme="9x"] .floor-map .map-cell { outline: none; }
html[data-theme="9x"] .map-cell[role="button"]:focus-visible .map-cell-shape { stroke: var(--accent); stroke-width: 3; stroke-dasharray: 2 1; }
html[data-theme="9x"] .map-room-outline { fill: #f4f4f4; stroke: #808080; stroke-width: 1.5; }
html[data-theme="9x"] .map-door { stroke: #b08000; stroke-width: 3; }
html[data-theme="9x"] .map-cell-shape { fill: transparent; stroke: #808080; stroke-width: 1; }
html[data-theme="9x"] .map-cell.available .map-cell-shape { fill: #e5f1e5; stroke: #287a3d; stroke-width: 1.5; }
/* 9X marks an untagged Mother the same way: amber inside the green available outline. */
html[data-theme="9x"] .map-cell.available[data-untagged="true"] .map-cell-shape { fill: #fff1c5; }
html[data-theme="9x"] .map-cell.plant-position[data-untagged="true"] .map-cell-shape { stroke: #a66b00; stroke-dasharray: 3 2; }
html[data-theme="9x"] .map-cell.current .map-cell-shape { fill: #fff1c5; stroke: #a66b00; stroke-width: 2.5; }
html[data-theme="9x"] .map-cell.free .map-cell-shape { stroke: #287a3d; stroke-dasharray: 3 2; }
html[data-theme="9x"] .map-rail { fill: #808080; opacity: .12; stroke: #808080; }
html[data-theme="9x"] .map-slot-name,
html[data-theme="9x"] .map-slot-number,
html[data-theme="9x"] .map-flag-letter,
html[data-theme="9x"] .map-row-label,
html[data-theme="9x"] .map-room-caption,
html[data-theme="9x"] .map-north-label { fill: #222; font-family: Arial, sans-serif; }
html[data-theme="9x"] .map-slot-name,
html[data-theme="9x"] .map-slot-number { font-size: 6px; }
html[data-theme="9x"] .map-slot-name.current-name { font-size: 7px; font-weight: 700; }
html[data-theme="9x"] .map-flag-letter { fill: #222; font-size: 8px; font-weight: 700; }
html[data-theme="9x"] .map-row-label { font-size: 8.5px; font-weight: 700; }
html[data-theme="9x"] .map-room-caption { font-size: 9px; font-weight: 700; }
html[data-theme="9x"] .map-flag-shape { fill: #fff; }
html[data-theme="9x"] .map-north-arrow { fill: none; stroke: #222; stroke-width: 1.4; }
html[data-theme="9x"] .map-flag-pole,
html[data-theme="9x"] .map-flag-shape,
html[data-theme="9x"] .map-north-circle { stroke: #555; }
html[data-theme="9x"] .map-north-circle { fill: #fff; }
html[data-theme="9x"] .map-north-label { font-size: 7px; font-weight: 700; }
html[data-theme="9x"] .map-current-pin { fill: #a66b00; }
html[data-appearance="dark"]:not([data-theme="9x"]) .map-cell.free .map-cell-shape.stage-new_mother,
html[data-appearance="dark"]:not([data-theme="9x"]) .map-cell.occupied .map-cell-shape.stage-new_mother { stroke: #b69ae8; }
html[data-appearance="dark"]:not([data-theme="9x"]) .map-cell.occupied .map-cell-shape.stage-new_mother { fill: #30253e; }
html[data-appearance="dark"]:not([data-theme="9x"]) .map-flag-shape { stroke: #1b2935; }
/* Radios read as rings, filled only when chosen, in both appearances. */
html:not([data-theme="9x"]) input[type="radio"] { appearance: none; -webkit-appearance: none; width: 22px; height: 22px; margin: 0; border: 2px solid var(--muted); border-radius: 50%; background: transparent; }
html:not([data-theme="9x"]) input[type="radio"]:checked { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 5px, transparent 5.5px); }

/* 9X: a long press on a scan card opens its context menu, so the card must not start a text selection. */
html[data-theme="9x"] .press-card { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
html[data-theme="9x"] .scan-item.is-undone { color: var(--muted); }
html[data-theme="9x"] .scan-item.is-undone > .grow strong { text-decoration: line-through; }
@media (prefers-reduced-motion: reduce) { .swipe-card { transition: none !important; } }

/* Keep table-check answers reachable in short coarse-pointer landscape. */
@media (max-height: 599px) and (pointer: coarse) {
  .dialog:has(.table-check-map) { max-height: calc(100dvh - 24px); padding: 8px; }
  .dialog:has(.table-check-map) > h2 { margin-bottom: 2px; font-size: 1rem; }
  .dialog:has(.table-check-map) > p { margin: 0; font-size: .9rem; line-height: 1.2; }
  .table-check-location { font-size: .9rem; }
  .table-check-answers { gap: 8px; }
  .dialog:has(.table-check-map) .table-check-answer { min-height: 44px; font-size: 1rem; }
  .dialog:has(.table-check-map) > .dialog-actions { margin-top: 4px; }
}
