/* Census: the one stylesheet. Dark only. No framework, no build step.

   FleetOps' colours and fonts (its DESIGN.md), set bold and simple:
   - one big thing per screen: a 32px page title, and on Scan the place you're scanning into;
   - flat: a page section is a heading over a hairline, not a box; only repeated things (a pallet,
     a check, a batch, a line) get a box, and a box never sits in a box in a box;
   - headings and labels in sentence case, never small uppercase; nothing under 12px anywhere;
   - buttons look like buttons: orange for the one thing to do, solid grey for the rest. */

@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("vendor/fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
                 U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("vendor/fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
                 U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("vendor/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("vendor/fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2");
}

:root {
  --bg:#1a1a1a; --surface:#222222; --surface-2:#2a2a2a;
  --border:#333333; --border-light:#3d3d3d;
  --text:#f0ede8; --text-muted:#a69a90; --text-dim:#837565;
  --accent:#F7931A; --accent-dim:rgba(247,147,26,0.12); --accent-hover:#e8820f;
  --ok:#3ecf8e; --warn:#f5c451; --danger:#e8604c; --info:#5b8def;
  --neutral:#7c98bc; --violet:#a78bfa; --sleep:#8f88c2;
  --mono:'IBM Plex Mono',monospace;
  --sans:'Inter',-apple-system,sans-serif;
  --radius:8px; --radius-lg:12px;
  --header-h:64px;
  --page-w:1080px;
  --title:32px;
  --caret:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23a69a90' stroke-width='2'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans);
  line-height: 1.5; -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
@media (max-width: 767px) {
  html { font-size: 16px; }
  :root { --header-h:56px; --title:28px; }
}

a { color: inherit; }
.mono { font-family: var(--mono); }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.2; }
.page h1 { font-size: var(--title); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.page h1.mono { font-family: var(--mono); font-weight: 600; letter-spacing: 0; overflow-wrap: anywhere; }

/* htmx's indicator rules, kept here so htmx never injects a <style> tag (strict CSP). */
.htmx-indicator { opacity: 0; transition: opacity 200ms ease-in; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* --- Shell -------------------------------------------------------------------------------- */

.topbar {
  height: var(--header-h); background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
  height: 100%; max-width: var(--page-w); margin: 0 auto; padding: 0 28px;
  display: flex; align-items: center; gap: 32px;
}
.brand { flex: none; text-decoration: none; display: flex; align-items: center; gap: 12px; }
.brand img { width: 30px; height: 30px; }
.wordmark { display: block; font-family: var(--mono); font-size: 16px; font-weight: 600; color: var(--accent); letter-spacing: 2.5px; line-height: 1.1; }
.tagline { display: block; font-size: 12px; color: var(--text-muted); }
.page { max-width: var(--page-w); margin: 0 auto; padding: 40px 28px 72px; display: flex; flex-direction: column; gap: 32px; }
@media (max-width: 767px) {
  .topbar-inner { padding: 0 16px; gap: 16px; }
  .brand img { width: 28px; height: 28px; }
  .tagline { display: none; }
  .page { padding: 20px 16px 48px; gap: 24px; }
  section.card { padding-top: 24px; }
}

/* A page section: a heading over a hairline. The section holding the page's title has no line. */
section.card { padding-top: 28px; border-top: 1px solid var(--border); }
section.card:has(h1) { padding-top: 0; border-top: none; }
.card > .label:first-child { display: block; margin-bottom: 16px; font-size: 18px; font-weight: 700; color: var(--text); }
.card h1 { margin-bottom: 12px; }
.card p { margin: 0; }
.card p + p { margin-top: 10px; }
/* A repeated thing: a box. */
li.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; }
.stack { display: flex; flex-direction: column; gap: 28px; }
.hint { font-size: 13px; color: var(--text-muted); margin-top: 8px; max-width: 72ch; }
.card p.hint { margin-top: 10px; }
.plain-list { margin: 0; padding-left: 20px; }
.plain-list li { margin: 4px 0; }
.list-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 12px; }

/* --- Top bar: navigation and who is signed in ---------------------------------------------- */
/* On a desk the links sit in the bar, the chosen one underlined in orange. Below 1024px they move
   behind Menu, a native popover (no script): one row of bar, 56px tall, that stays on screen. */

.menu { display: flex; align-items: center; gap: 32px; flex: 1; min-width: 0; }
.nav { display: flex; align-items: stretch; gap: 24px; height: var(--header-h); }
.nav a {
  display: inline-flex; align-items: center; text-decoration: none; font-size: 15px; font-weight: 600;
  color: var(--text-muted); border-bottom: 3px solid transparent; padding-top: 3px; transition: color 0.15s, border-color 0.15s;
}
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--text); border-bottom-color: var(--accent); }
.nav a:focus-visible, .menu-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13px; }
.who-name { color: var(--text-muted); }
.who form { margin: 0; }
.menu-btn { display: none; }

@media (min-width: 1024px) {
  /* The popover's own box, undone: on a desk the menu is part of the bar. */
  .menu[popover] {
    position: static; inset: auto; width: auto; height: auto; margin: 0; padding: 0; overflow: visible;
    border: none; background: none; color: inherit;
  }
}
@media (max-width: 1023px) {
  @supports selector(:popover-open) {
    .menu-btn {
      display: inline-flex; align-items: center; justify-content: center; gap: 10px; margin-left: auto;
      min-width: 48px; min-height: 48px; padding: 0 16px; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
      color: var(--text); background: var(--surface-2); border: 1px solid var(--border-light); border-radius: var(--radius);
    }
    .menu-btn::before {         /* three bars */
      content: ""; width: 16px; height: 2px; background: currentColor; box-shadow: 0 -5px currentColor, 0 5px currentColor;
    }
    .menu:not(:popover-open) { display: none; }
    .menu[popover] {
      position: fixed; inset: var(--header-h) 0 auto 0; width: auto; max-width: none; margin: 0;
      max-height: calc(100dvh - var(--header-h)); overflow-y: auto; flex-direction: column; align-items: stretch; gap: 16px;
      padding: 12px calc(16px + env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
      color: var(--text); background: var(--surface); border: none; border-bottom: 1px solid var(--border);
    }
    .menu::backdrop { background: rgba(0, 0, 0, 0.6); }
    .nav { flex-direction: column; gap: 8px; height: auto; }
    .nav a {
      min-height: 56px; padding: 0 16px; font-size: 20px; font-weight: 700; color: var(--text);
      border: none; border-radius: var(--radius);
    }
    .nav a:hover { background: var(--surface-2); }
    .nav a.active { color: var(--accent); background: var(--accent-dim); }
    .who { margin-left: 0; padding: 16px 16px 0; border-top: 1px solid var(--border); flex-wrap: wrap; font-size: 15px; }
    .who .chip { font-size: 13px; }
    .who form { margin-left: auto; }
    .menu .who .btn { min-height: 48px; padding: 0 20px; font-size: 15px; }
  }
  /* A browser with no popover (iOS before 17): the links stay in the bar, wrapping onto more rows. */
  @supports not selector(:popover-open) {
    .topbar { height: auto; position: static; }
    .topbar-inner { flex-wrap: wrap; gap: 8px 16px; min-height: var(--header-h); padding-top: 4px; padding-bottom: 8px; }
    .menu { flex-basis: 100%; flex-wrap: wrap; gap: 8px; }
    .nav { flex-wrap: wrap; gap: 8px; height: auto; }
    .nav a { min-width: 48px; min-height: 48px; justify-content: center; padding: 0 10px; border: none; border-radius: var(--radius); }
    .nav a.active { color: var(--accent); background: var(--accent-dim); }
    .menu .who .btn { min-height: 48px; padding: 0 16px; }
  }
}

/* --- Chips and notices --------------------------------------------------------------------- */

.chip {
  display: inline-block; border-radius: 999px; padding: 3px 10px; font-family: var(--mono); font-size: 12px;
  font-weight: 600; line-height: 1.4; color: var(--neutral); background: rgba(124, 152, 188, 0.12);
}
.chip.role-admin { color: var(--accent); background: var(--accent-dim); }
.chip.role-manager { color: var(--info); background: rgba(91, 141, 239, 0.12); }
/* A notice: a tinted strip with a solid bar at its left, so its colour reads at a glance. */
.notice {
  margin: 0; padding: 12px 16px; border-radius: var(--radius); font-size: 15px; border: 1px solid; border-left-width: 4px;
}
.notice.ok { color: var(--ok); background: rgba(62, 207, 142, 0.10); border-color: rgba(62, 207, 142, 0.25); border-left-color: var(--ok); }
.notice.error { color: #ff8a75; background: rgba(232, 96, 76, 0.10); border-color: rgba(232, 96, 76, 0.25); border-left-color: var(--danger); }

/* --- Buttons and inputs -------------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  font: inherit; font-size: 15px; font-weight: 600; line-height: 1.2; text-align: center; text-decoration: none;
  border-radius: var(--radius); border: 1px solid transparent; cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a1a1a; font-weight: 700; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
/* "ghost" is every other button: solid grey with full-strength text, so it never looks switched off. */
.btn.ghost { background: var(--surface-2); color: var(--text); border-color: var(--border-light); }
.btn.ghost:hover { border-color: var(--text-muted); }
.btn.strong { border-color: var(--text-muted); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 13px; }
/* A quiet button: for an action that's there if needed but shouldn't draw the eye (Undo, after the fact). */
.btn.quiet { background: transparent; border-color: transparent; color: var(--text-muted); text-decoration: underline; text-underline-offset: 3px; }
.btn.quiet:hover { color: var(--text); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type="text"], input[type="email"], input[type="number"], input[type="search"], select, textarea {
  font: inherit; font-size: 15px; color: var(--text); background-color: var(--surface-2);
  border: 1px solid var(--border-light); border-radius: var(--radius); padding: 10px 14px; min-height: 44px;
}
textarea { resize: vertical; }
/* Selects drawn by us, not the platform, so they read the same everywhere: dark, with a muted caret. */
select {
  -webkit-appearance: none; appearance: none; padding-right: 40px; cursor: pointer;
  background-image: var(--caret); background-repeat: no-repeat; background-position: right 14px center;
}
select:disabled { color: var(--text-dim); cursor: not-allowed; }
input::placeholder, textarea::placeholder { color: var(--text-dim); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
@media (max-width: 767px) {
  input[type="text"], input[type="email"], input[type="number"], input[type="search"], select, textarea {
    font-size: 16px; padding: 12px 14px; min-height: 48px;
  }
  select { padding-right: 40px; }
}
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
label.check { flex-direction: row; align-items: center; gap: 10px; font-size: 15px; font-weight: 500; color: var(--text); }
label.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.form-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.form-row label { flex: 1 1 180px; }
form.inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
form.inline select { min-height: 36px; padding: 6px 34px 6px 10px; font-size: 13px; background-position: right 10px center; }
.settings-form { display: flex; flex-direction: column; gap: 20px; align-items: flex-start; }
.setting { display: flex; flex-direction: column; gap: 4px; max-width: 560px; }
.setting .hint { margin-top: 4px; }
.with-unit { display: flex; align-items: center; gap: 8px; }
.with-unit input { width: 110px; }

/* --- Tables and feeds ---------------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 13px; font-weight: 600; color: var(--text-muted);
  padding: 10px 12px; border-bottom: 1px solid var(--border-light);
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table td.mono { font-size: 13px; }
.table tbody tr:hover { background: var(--surface); }
.table td.actions { text-align: right; white-space: nowrap; }
.roles-table .yes { color: var(--ok); font-weight: 600; }
.roles-table .no { color: var(--text-muted); }
details > summary { cursor: pointer; list-style-position: inside; }
details[open] > summary { margin-bottom: 10px; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li {
  display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.feed li:last-child { border-bottom: none; }
.feed li > span:last-child { margin-left: auto; }

/* A property list: label, then value beside it, hairlines between rows. */
.props { margin: 12px 0 0; max-width: 720px; }
.props > div {
  display: grid; grid-template-columns: minmax(7rem, 30%) 1fr; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border);
}
.props > div:last-child { border-bottom: none; }
.props dt { font-size: 13px; font-weight: 600; color: var(--text-muted); padding-top: 2px; }
.props dd { margin: 0; min-width: 0; font-size: 15px; color: var(--text); }

/* --- Home ---------------------------------------------------------------------------------- */

.home-intro { font-size: 15px; color: var(--text-muted); }
.launch { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.launch a {
  display: flex; flex-direction: column; gap: 6px; min-height: 120px; padding: 20px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  transition: border-color 0.15s, background 0.15s;
}
.launch a:hover { border-color: var(--text-muted); }
.launch a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.launch-name { font-size: 24px; font-weight: 800; letter-spacing: -0.01em; color: var(--text); }
.launch-what { font-size: 15px; color: var(--text-muted); }
.launch a.go { background: var(--accent); border-color: var(--accent); }
.launch a.go:hover { background: var(--accent-hover); }
.launch a.go .launch-name, .launch a.go .launch-what { color: #1a1a1a; }
@media (max-width: 767px) {
  .launch { grid-template-columns: 1fr; }
  .launch a { min-height: 88px; }
}

/* --- Sign-in ------------------------------------------------------------------------------- */

.card.signin {
  max-width: 440px; width: 100%; margin: 8vh auto 0; padding: 48px 32px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
}
.card.signin h1 {
  font-family: var(--mono); font-size: 40px; font-weight: 600; color: var(--accent); letter-spacing: 6px; text-transform: uppercase; margin: 0;
}
.card.signin p { margin: 0; }
.gsi-button { min-height: 44px; display: flex; justify-content: center; }
.signin-error { color: #ff8a75; min-height: 1.5em; font-size: 15px; }

/* --- Scan (SPEC §5; DESIGN §5 "Scanning", "Sync, offline and conflict states", §5b) ------------- */
/* The field layout: 16px base, nothing under 12px, 48px touch targets, nothing hover-only. */

.scan [hidden], .action-bar [hidden], .pallets [hidden] { display: none !important; }
.scan {
  display: flex; flex-direction: column; gap: 24px; max-width: 720px;
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
  padding-bottom: calc(150px + env(safe-area-inset-bottom));     /* room for the action bar */
}
.scan .hint { margin-top: 0; }
.scan > .scan-place { padding-top: 0; border-top: none; }      /* straight under the title: Scan is mostly this */
.scan p { margin: 0; }
.scan .btn, .action-bar .btn, .pallets .btn { min-height: 48px; font-size: 16px; padding: 10px 18px; }
.scan select, .scan input[type="text"], .pallets select, .pallets input[type="number"] {
  width: 100%; min-height: 48px; font-size: 16px; padding: 12px 14px;
}
.scan select, .pallets select { padding-right: 40px; }
.scan .chip, .pallets .chip { font-size: 13px; }
.btn.danger { color: #ff8a75; background: rgba(232, 96, 76, 0.10); border-color: rgba(232, 96, 76, 0.45); }
.btn.danger:hover { border-color: var(--danger); }
.btn.primary:disabled { background: var(--surface-2); border-color: var(--border); color: var(--text-dim); cursor: not-allowed; }
.btn.wide { width: 100%; }
.link { color: var(--accent); }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.chip.ok { color: var(--ok); background: rgba(62, 207, 142, 0.12); }
.chip.warn { color: var(--warn); background: rgba(245, 196, 81, 0.12); }
.chip.danger { color: var(--danger); background: rgba(232, 96, 76, 0.12); }
.chip.info { color: var(--info); background: rgba(91, 141, 239, 0.12); }
.chip.neutral { color: var(--neutral); background: rgba(124, 152, 188, 0.12); }
.notice.warn { color: var(--warn); background: rgba(245, 196, 81, 0.10); border-color: rgba(245, 196, 81, 0.25); border-left-color: var(--warn); }
.notice.info { color: var(--info); background: rgba(91, 141, 239, 0.10); border-color: rgba(91, 141, 239, 0.25); border-left-color: var(--info); }
.notice .row-actions, .notice .reason-form { margin-top: 12px; }
.badge {
  display: inline-block; align-self: flex-start; font-family: var(--mono); font-size: 13px; font-weight: 600;
  color: var(--accent); background: var(--accent-dim); border-radius: 4px; padding: 4px 8px;
}

/* Segmented control: joined buttons, the chosen one orange. */
.segmented { display: flex; }
.segmented .seg {
  flex: 1; min-height: 52px; font: inherit; font-size: 16px; font-weight: 600; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border-light); cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.segmented .seg + .seg { border-left: none; }
.segmented .seg:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.segmented .seg:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.segmented .seg[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: #1a1a1a; font-weight: 800; }
.segmented .seg:focus-visible, .pallet-pick:focus-visible, .line-remove:focus-visible, .kbd-btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* The place picker. Folded (static/js/scan/place.js), it's the heading, Change and the banner; a
   pallet also keeps its label box (the next label scanned there is the next place), its card and the
   Recount switch. */
.place-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; margin-bottom: 12px; }
.place-head .label { font-size: 18px; font-weight: 700; color: var(--text); }
.place-fields, .place-group { display: flex; flex-direction: column; gap: 16px; }
.place-fields { margin-top: 20px; }
.scan-place.folded .segmented, .scan-place.folded #field-site, .scan-place.folded #pallet-recent, .scan-place.folded:not([data-kind="pallet"]) .place-fields { display: none; }
.scan-place.folded .place-fields { margin-top: 0; }
.scan-place.folded .place-summary { margin-top: 0; }
.scan-place.folded[data-kind="pallet"] .place-summary { margin-top: 16px; }
.place-group .label { display: block; margin-bottom: 8px; }
/* Where the serials go: the one thing a tech must never get wrong, so it's the biggest thing here. */
.place-summary {
  margin-top: 20px; padding: 14px 16px; font-size: 15px; color: var(--text-muted);
  border: 1px dashed var(--border-light); border-radius: var(--radius);
}
.place-summary.chosen {
  padding: 16px 18px; font-size: 22px; font-weight: 800; line-height: 1.25; letter-spacing: -0.01em; color: var(--text);
  background: var(--accent-dim); border: none; border-left: 6px solid var(--accent);
}
.pallet-find { display: flex; align-items: flex-end; gap: 8px; }
.pallet-find label { flex: 1; }
.pallet-chosen {
  display: flex; flex-direction: column; gap: 8px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.pallet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pallet-code { font-size: 22px; font-weight: 600; color: var(--text); }
.pallet-facts, .flag-note { color: var(--text); }
.pallet-recent { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pallet-recent > li.muted { font-size: 15px; }
.pallet-pick {
  width: 100%; min-height: 52px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
  padding: 12px 16px; font: inherit; text-align: left; color: var(--text); cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.pallet-pick:hover { border-color: var(--text-muted); }
.pallet-pick .mono { font-size: 17px; font-weight: 600; }
/* Start this pallet (a printed label), and what the start is doing */
.pallet-start {
  display: flex; flex-direction: column; gap: 14px; padding: 16px;
  background: var(--surface); border: 2px solid var(--accent); border-radius: var(--radius-lg);
}
.pallet-start .label { margin-bottom: 0; }
.start-text { color: var(--text); }
.pallet-start .segmented .seg { background: var(--surface-2); }
.pallet-start .segmented .seg[aria-checked="true"] { background: var(--accent); }
.hint.problem, .pallets .hint.problem { color: #ff8a75; }
.pallet-start-state { color: var(--text); }
/* Recount this pallet: a switch, with its state in its position as well as its colour */
.recount-field { display: flex; flex-direction: column; gap: 6px; }
label.check.switch { min-height: 48px; font-size: 16px; font-weight: 700; }
label.check.switch input {
  -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 52px; height: 30px; margin: 0;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-light); cursor: pointer;
}
label.check.switch input::before {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--text-muted); transition: transform 0.15s;
}
label.check.switch input:checked { background: var(--accent); border-color: var(--accent); }
label.check.switch input:checked::before { transform: translateX(22px); background: #1a1a1a; }
label.check.switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The scan box: 60px, mono 22px, with the keyboard button at its right */
.scan-box { display: flex; gap: 8px; }
.scan input.scan-input { flex: 1; min-width: 0; height: 60px; font-family: var(--mono); font-size: 22px; font-weight: 600; }
.scan input.scan-input::placeholder { font-family: var(--sans); font-weight: 500; }      /* words, so sans */
.kbd-btn {
  flex: none; height: 60px; padding: 0 14px; font: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
  color: var(--text); background: var(--surface-2); border: 1px solid var(--border-light); border-radius: var(--radius);
}
.kbd-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-dim); border-color: var(--accent); }
.scan-count { margin-top: 16px; font-size: 20px; font-weight: 800; letter-spacing: -0.01em; color: var(--text); }
.scan-lines .hint { margin-top: 4px; }
.scan-lines .notice { margin-top: 12px; }
.scan-result:empty { display: none; }
.scan-lines .scan-outbox { margin-top: 12px; }
.scan-lines { scroll-margin-top: calc(var(--header-h) + 12px); }      /* clear of the sticky top bar */

/* The lines, newest first; the newest is the scan's confirmation */
.lines { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.line {
  display: flex; flex-direction: column; gap: 8px; padding: 10px 10px 10px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.line.latest { border-left: 6px solid var(--accent); }
.line-main { display: flex; align-items: center; gap: 8px; }
.line-serial { flex: 1; min-width: 0; font-size: 17px; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.line.latest .line-serial { font-size: 24px; font-weight: 600; }
.line.struck .line-serial { text-decoration: line-through; color: var(--text-muted); }
.line-remove {
  flex: none; width: 48px; height: 48px; font: inherit; font-size: 24px; line-height: 1; cursor: pointer;
  color: var(--text); background: var(--surface-2); border: 1px solid var(--border-light); border-radius: var(--radius);
}
.line-info { display: flex; flex-direction: column; gap: 6px; }
.line-info:empty { display: none; }
.line-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.line-note { font-size: 14px; color: var(--text-muted); }
.line-server { font-size: 14px; color: #ff8a75; }
.line-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.line-slot { display: flex; gap: 16px; }
.line-slot label { flex: 1 1 0; flex-direction: row; align-items: center; gap: 8px; color: var(--text-muted); }
.scan input.slot-input { flex: 1; min-width: 0; text-align: center; font-family: var(--mono); padding: 12px 8px; }
.line-slot label.missing .slot-input { border-color: var(--warn); border-width: 2px; }

/* What the outbox holds */
.scan-outbox { display: flex; flex-direction: column; gap: 8px; }
.outbox-list, .recent-list, .recent-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.outbox-list, .recent-lines { gap: 8px; }
.outbox-item {
  display: flex; flex-direction: column; gap: 8px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.outbox-item.state-attention { border-color: rgba(232, 96, 76, 0.5); border-left: 6px solid var(--danger); }
.outbox-head, .recent-head, .recent-line-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.outbox-place, .recent-place { color: var(--text); font-weight: 700; }
.outbox-count { color: var(--text); }
.outbox-why { color: var(--text); font-size: 15px; }
.outbox-when { color: var(--text-muted); font-size: 13px; }
.outbox-lines { margin: 0; padding-left: 18px; font-size: 14px; }

/* Your recent batches */
.recent-item { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.recent-item:last-child { border-bottom: none; }
.recent-list > li.muted { font-size: 15px; }
.recent-meta { font-size: 13px; color: var(--text-muted); }
.recent-line {
  display: flex; flex-direction: column; gap: 6px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.recent-line .serial { font-size: 16px; color: var(--text); overflow-wrap: anywhere; }
.recent-line .slot { font-size: 14px; color: var(--text); }
.reason-form { display: flex; flex-direction: column; gap: 8px; }

/* The fixed action bar: one primary button, within thumb reach */
.action-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--border-light);
  padding: 14px calc(16px + env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
}
/* Lined up with the page's column (.page, .scan) at every width. */
.action-bar-inner { max-width: var(--page-w); margin: 0 auto; padding: 0 12px; display: flex; flex-direction: column; gap: 8px; }
.action-bar-inner > * { max-width: 720px; }
@media (max-width: 767px) { .action-bar-inner { padding: 0; } }
.action-bar .btn.primary { min-height: 56px; font-size: 18px; font-weight: 800; }
.action-reason { margin: 0; font-size: 14px; color: var(--text-muted); }
.action-question { margin: 0; font-size: 17px; font-weight: 700; color: var(--text); }
.action-pair { display: flex; gap: 8px; }
.action-pair .btn { flex: 1; }

/* --- Pallets (SPEC §12; DESIGN §5, §5b) -------------------------------------------------------- */
/* The same field layout as Scan: 16px base, nothing under 12px, 48px touch targets, cards on phones. */

.pallets {
  display: flex; flex-direction: column; gap: 28px; max-width: 720px;
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
}
.pallets p { margin: 0; }
.pallets .row-actions .btn { flex: 1 1 140px; }
.back { font-size: 15px; margin: 0; }
.back a { display: inline-flex; align-items: center; min-height: 48px; font-weight: 600; text-decoration: none; }
.back a::before { content: "\2039"; margin-right: 8px; font-size: 22px; line-height: 1; }
.back a:hover { text-decoration: underline; }
.pallet-result:empty, .print-message:empty { display: none; }

/* The list: a site, which pallets, then one card per pallet */
.pallets-filter { display: flex; align-items: flex-end; gap: 8px; margin-top: 16px; }
.pallets-filter label { flex: 1; }
.show-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.show-filter .filter {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; font-size: 15px; font-weight: 600;
  text-decoration: none; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border-light); border-radius: 999px;
}
.show-filter .filter:hover { border-color: var(--text-muted); }
.show-filter .filter.active { color: #1a1a1a; background: var(--accent); border-color: var(--accent); font-weight: 700; }
.show-filter .filter:focus-visible, .pallet-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 767px) { .show-filter .filter { min-height: 48px; } }
.pallet-list, .unit-list, .history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pallet-list, .unit-list { gap: 8px; }
.pallet-list > li.empty, .unit-list > li.empty, .history > li.empty { font-size: 15px; padding: 8px 0; }
.pallet-card {
  display: flex; flex-direction: column; gap: 6px; min-height: 48px; padding: 16px 18px; text-decoration: none;
  color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  transition: border-color 0.15s;
}
.pallet-card:hover { border-color: var(--text-muted); }
.pallet-card-head, .pallet-card-meta, .unit-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.pallet-card-head { justify-content: space-between; }
.pallet-card .pallet-code { font-size: 20px; }
.pallet-card-facts { font-size: 16px; font-weight: 600; color: var(--text); }
.pallet-card-meta { font-size: 13px; }
.pallet-card-meta .units { color: var(--text); }
.print-form { display: flex; flex-direction: column; gap: 14px; }
.print-form .btn { align-self: flex-start; }
@media (max-width: 767px) { .print-form .btn { align-self: stretch; } }
.print-message { margin-top: 12px; }

/* One pallet: its facts, the change form, what's on it and its history */
.sorting-note { margin-top: 12px; color: var(--text); }
.sorting-note p + p { margin-top: 8px; }
.change-form { display: flex; flex-direction: column; gap: 14px; margin-bottom: 12px; }
.change-form > p { color: var(--text); }
.unit { display: flex; flex-direction: column; gap: 4px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.unit .serial { font-size: 16px; color: var(--text); overflow-wrap: anywhere; }
.unit-meta { font-size: 13px; color: var(--text-muted); }
.history > li {
  display: flex; flex-wrap: wrap; gap: 2px 12px; padding: 10px 0; font-size: 15px; border-bottom: 1px solid var(--border);
}
.history > li:last-child { border-bottom: none; }
.history .when { font-size: 13px; color: var(--text-muted); }
.history .what { flex: 1 1 200px; color: var(--text); }
.history .by { font-size: 13px; color: var(--text-muted); margin-left: auto; }
