/* Harbor Ledger. Every colour, radius and shadow here is a token from tokens.css — no
   values of its own, so the dark theme needs no rules in this file. Mobile first:
   base < 600, tablet from 600, desktop from 1024. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* The attribute must win over any display rule below, or "hidden" hints stay visible. */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/24px var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body.no-scroll {
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--stand-height));
}

/* ── Test stand ───────────────────────────────────────────────────────── */

/* The strip above everything on a test stand (stand.js). It stays in sight while the page
   scrolls; its height is `--stand-height`, which the few things placed against the top of
   the window add to their own offset. */
.stand-strip {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: var(--stand-height);
  padding: env(safe-area-inset-top) calc(var(--gutter) + env(safe-area-inset-right)) 0 calc(var(--gutter) + env(safe-area-inset-left));
  border-bottom: 2px solid var(--problem);
  background: var(--problem-soft);
  color: var(--problem-text);
  font: 400 13px/18px var(--font-sans);
}

.stand-strip-tag {
  flex: none;
  padding: 1px var(--space-2);
  border-radius: var(--radius-xs);
  background: var(--problem);
  color: var(--on-problem);
  font: 600 12px/18px var(--font-mono);
  letter-spacing: 0.08em;
}

.stand-strip-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stand-strip-text .short {
  display: none;
}

.stand-strip-text.failed {
  font-weight: 600;
}

.stand-strip .button {
  flex: none;
  min-height: 28px;
  padding: 0 var(--space-3);
  border-width: 1px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 18px;
}

/* "Refresh from prod" carries an icon and a label: the label here, the icon alone on a phone. */
.stand-refresh .icon {
  display: none;
}

@media (prefers-reduced-motion: no-preference) {
  .stand-refresh[aria-busy='true'] .icon {
    animation: spin 1s linear infinite;
  }
}

/* What the stand runs and the real server does not yet: a quiet button in the strip's own ink. */
.stand-strip .button.features-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  border-color: transparent;
  background: none;
  color: inherit;
  font-weight: 600;
  white-space: nowrap;
}

.stand-strip .button.features-toggle[aria-expanded='true'] {
  border-color: var(--problem);
}

.stand-strip .button.features-toggle:active {
  background: none;
  border-color: var(--problem);
}

.features-toggle .short {
  display: none;
}

@media (max-width: 599px) {
  .stand-strip-text .long,
  .features-toggle .long {
    display: none;
  }

  .stand-strip-text .short,
  .features-toggle .short {
    display: inline;
  }

  .stand-strip {
    gap: var(--space-2);
  }

  .stand-strip .button {
    min-height: 44px;
  }

  .stand-strip .button.features-toggle {
    padding: 0 var(--space-2);
  }

  .stand-strip .button.stand-refresh {
    width: 44px;
    padding: 0;
  }

  .stand-refresh .icon {
    display: block;
  }

  .stand-refresh .label {
    display: none;
  }

  /* Bad news about a refresh needs the room more than the list does. */
  .stand-strip:has(.stand-strip-text.failed) .features-toggle {
    display: none;
  }
}

/* On the narrowest phones two buttons leave the sentence a few letters: the TEST tag says it
   alone, and the hidden sentence keeps the buttons to the right. From 380px up it fits whole. */
@media (max-width: 379px) {
  :root[data-stand-refresh][data-stand-features] .stand-strip-text:not(.failed) {
    visibility: hidden;
  }
}

@media (hover: hover) {
  .stand-strip .button.features-toggle:hover {
    border-color: var(--problem);
  }
}

/* The list itself hangs under the strip — the box of the order menu (.menu-items), placed by stand.js. */
.features-panel {
  position: fixed;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: min(400px, calc(100vw - 16px));
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--e2);
  font: 400 14px/20px var(--font-sans);
  text-align: left;
}

.features-panel > * {
  flex: none;
}

.features-panel h3 {
  padding: var(--space-4) var(--space-4) var(--space-1);
  font: 600 12px/16px var(--font-sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.features-panel h3 span {
  color: var(--ink-3);
}

.features-list {
  margin: 0;
  padding: 0 var(--space-4);
  list-style: none;
}

.features-list li {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--divider);
}

.features-list li:last-child {
  border-bottom: 0;
}

.feature-title {
  font-size: 15px;
  line-height: 22px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.feature-text {
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.feature-branch {
  margin-top: var(--space-1);
  font: 400 12px/16px var(--font-mono);
  color: var(--ink-3);
  overflow-wrap: anywhere;
}

.features-empty {
  padding: var(--space-2) var(--space-4) var(--space-4);
  color: var(--ink-2);
}

.features-build {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
  font: 400 12px/16px var(--font-mono);
  color: var(--ink-3);
}

h1,
h2,
h3,
p {
  margin: 0;
}

button,
input {
  font: inherit;
  color: inherit;
}

button,
summary,
label.button {
  cursor: pointer;
}

a {
  color: var(--primary);
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.icon {
  flex: none;
  display: block;
}

/* ── Type roles ───────────────────────────────────────────────────────── */

h1,
.display {
  font-size: 28px;
  line-height: 34px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.lead {
  font-size: 15px;
  line-height: 22px;
  color: var(--ink-2);
}

.caption {
  font-size: 13px;
  line-height: 18px;
  letter-spacing: 0.01em;
  color: var(--ink-3);
}

.overline {
  padding: 8px 4px 0;
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.mono-meta {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}

.loading {
  padding: 24px 4px;
  color: var(--ink-3);
}

.form-error {
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  color: var(--problem-text);
}

.form-error:empty,
.upload-status:empty {
  display: none;
}

/* ── Page ─────────────────────────────────────────────────────────────── */

.page {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 8px calc(var(--gutter) + env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom))
    calc(var(--gutter) + env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.page.narrow {
  max-width: 512px;
}

.page.center {
  align-items: center;
  gap: 16px;
  padding-top: calc(72px + env(safe-area-inset-top));
  text-align: center;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 48px 16px;
  font-size: 15px;
  line-height: 22px;
  color: var(--ink-2);
  text-align: center;
}

/* ── Logo mark ────────────────────────────────────────────────────────── */

.logo {
  flex: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: calc(var(--logo-size) * 0.09);
  width: var(--logo-size);
  height: var(--logo-size);
  padding: calc(var(--logo-size) * 0.23);
  border-radius: calc(var(--logo-size) * 0.285);
  background: var(--logo-bg);
}

.logo i {
  border-radius: calc(var(--logo-size) * 0.055);
  background: var(--logo-on);
}

.logo i:last-child {
  background: var(--logo-off);
}

/* ── Buttons ──────────────────────────────────────────────────────────── */

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.button.large {
  gap: 8px;
  min-height: 52px;
  padding: 0 18px;
  font-size: 16px;
}

.button.xlarge {
  gap: 10px;
  min-height: 56px;
  font-size: 17px;
}

.button.primary {
  background: var(--primary);
  color: var(--on-primary);
}

.button.primary:active {
  background: var(--primary-pressed);
}

/* The one button in a status colour: it is the action that produces that status. */
.button.arrive {
  background: var(--arrived);
  color: var(--on-arrived);
}

.button.arrive:active {
  background: var(--arrived-pressed);
}

.button.outlined {
  border: 1.5px solid var(--border);
  background: var(--surface);
}

.button.outlined:active {
  background: var(--surface-sunken);
}

.button.outlined .icon-alert {
  color: var(--problem);
}

.button.tonal {
  background: var(--primary-soft);
  color: var(--primary);
}

.button.text {
  padding: 0 12px;
  color: var(--primary);
}

.button.text:active {
  background: var(--primary-soft);
}

.button.strong {
  background: var(--ink);
  color: var(--on-ink);
}

.button:disabled,
.button.disabled {
  border-color: transparent;
  background: var(--surface-sunken);
  color: var(--disabled-ink);
  cursor: not-allowed;
}

label.button.disabled {
  pointer-events: none;
}

/* The file inputs are hidden; their labels are the buttons, so the labels show the focus. */
.visually-hidden:focus-visible + label.button {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.icon-button {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--ink);
  text-decoration: none;
}

.icon-button:active {
  background: var(--surface-sunken);
}

.avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 15px;
  line-height: 1;
  font-weight: 600;
}

.avatar.small {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

.badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.problem {
  background: var(--problem-soft);
  color: var(--problem-text);
}

.badge.arrived {
  background: var(--arrived-soft);
  color: var(--arrived-text);
}

.badge.neutral {
  background: var(--surface-sunken);
  color: var(--ink-2);
}

/* "Not checked": amber, the colour of things to compare with the paper — not a status. */
.badge.check {
  background: var(--check-soft);
  color: var(--check-text);
}

/* How an order was closed. Ink and a hairline: never the green or red of a supplier status. */
.badge.shipped {
  background: var(--ink);
  color: var(--on-ink);
}

.badge.cancelled {
  border: 1px solid var(--border-strong);
  color: var(--ink-3);
}

/* What goods that did not leave with their order wait for: a ship (grey fill) or the supplier
   (hairline and an arrow). Equally quiet, and told apart without colour. */
.badge.left {
  background: var(--surface-sunken);
  color: var(--ink-2);
}

.badge.returned {
  background: var(--ink);
  color: var(--on-ink);
}

.badge.return {
  border: 1px solid var(--border-strong);
  color: var(--ink-2);
}

/* The kind of order from the paper's header. Ink on a hairline: it names the order, it
   says nothing about its state. */
.type-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 1px 7px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

/* ── Fields ───────────────────────────────────────────────────────────── */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field label,
.field-label {
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  letter-spacing: 0.005em;
  color: var(--ink-2);
}

.input {
  width: 100%;
  min-width: 0;
  height: 52px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  /* 16px or more, or iOS Safari zooms the page when the field is focused. */
  font-size: 16px;
  line-height: 24px;
  -webkit-appearance: none;
  appearance: none;
}

.input.strong {
  font-size: 17px;
  font-weight: 600;
}

.input.mono {
  font-family: var(--font-mono);
}

/* iOS centres the value of a date field and lets an empty one collapse. */
.input[type='date'] {
  text-align: left;
}

.input[type='date']::-webkit-date-and-time-value {
  text-align: left;
}

.input:focus-visible,
.comment-row:focus-within,
.supplier-editor input:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.field:focus-within label {
  color: var(--primary);
}

/* "Check": the field is empty — the model could not read it, or nobody has typed it yet. */
.input.check {
  border-color: var(--check);
  background: var(--check-soft);
}

.field.check label,
.check-hint {
  color: var(--check-text);
}

.check-hint {
  font-size: 13px;
  line-height: 18px;
}

::placeholder {
  color: var(--ink-3);
  opacity: 1;
}

/* ── Status squares ───────────────────────────────────────────────────── */

.squares {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.squares.large {
  gap: 5px;
}

.square {
  flex: none;
  position: relative;
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-xs);
}

.square.large {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

/* Readable without colour: solid, pale with an outline, solid with a white bar. */
.square.arrived {
  background: var(--arrived);
}

.square.waiting {
  background: var(--waiting);
  box-shadow: inset 0 0 0 1.5px var(--waiting-border);
}

.square.problem {
  background: var(--problem);
}

.square.problem::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 2px;
  border-radius: 1px;
  background: var(--on-problem);
  transform: translate(-50%, -50%);
}

.square.large.problem::after {
  width: 9px;
  height: 3px;
  border-radius: 2px;
}

/* Our own stock is picked in parts: one square cut into a stripe per part. */
.square.split {
  display: inline-flex;
  gap: 1px;
  overflow: hidden;
}

.square.split i {
  flex: 1;
  position: relative;
}

.square.split i.arrived {
  background: var(--arrived);
}

.square.split i.waiting {
  background: var(--waiting);
  box-shadow: inset 0 0 0 1.5px var(--waiting-border);
}

.square.split i.problem {
  background: var(--problem);
}

.square.split i.problem::after {
  content: '';
  position: absolute;
  left: 1px;
  right: 1px;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  background: var(--on-problem);
}

/* What a square stands for, while the mouse is on it. Flat like everything else: a hairline, no shadow. */
.square-tip {
  position: fixed;
  z-index: 60;
  max-width: min(320px, calc(100vw - 16px));
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  line-height: 18px;
  pointer-events: none;
}

.square-tip[hidden] {
  display: none;
}

.square-tip p {
  margin: 0;
}

.tip-name {
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.tip-status {
  color: var(--ink-3);
}

.tip-status.arrived {
  color: var(--arrived-text);
}

.tip-status.problem {
  color: var(--problem-text);
}

.tip-note {
  color: var(--problem-text);
  overflow-wrap: anywhere;
}

.square-tip p.tip-note {
  margin-top: 4px;
}

.tip-parts {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 4px 8px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.tip-parts li {
  display: contents;
}

.tip-part {
  font-weight: 600;
}

.tip-parts .tip-note {
  grid-column: 2 / -1;
}

/* ── PIN ──────────────────────────────────────────────────────────────── */

.pin-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: calc(72px + env(safe-area-inset-top)) calc(24px + env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom))
    calc(24px + env(safe-area-inset-left));
}

.pin-intro,
.pin-text,
.pin-entry {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pin-intro {
  gap: 20px;
}

.pin-text {
  gap: 6px;
  text-align: center;
}

.pin-entry {
  gap: 16px;
}

/* Keeps its line even when empty, so a wrong PIN does not push the keypad down. */
.pin-entry .form-error {
  display: block;
  min-height: 20px;
  text-align: center;
}

.pin-cells {
  position: relative;
  display: flex;
  gap: 12px;
}

.pin-cell {
  display: grid;
  place-items: center;
  width: 60px;
  height: 68px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.pin-cell i {
  width: 14px;
  height: 14px;
  border-radius: var(--radius-full);
}

.pin-cell.filled i {
  background: var(--ink);
}

.pin-cell.active {
  border: 2px solid var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.pin-cells.wrong .pin-cell {
  border-color: var(--problem);
}

/* The real input, stretched invisibly over the cells. */
.pin-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  opacity: 0;
  font-size: 16px;
}

.pin-input:focus-visible {
  outline: none;
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 312px;
  /* Pinned to the bottom edge, where the thumb is. */
  margin-top: auto;
}

.pin-key {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 68px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--e1);
  color: var(--ink);
  font-size: 26px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  touch-action: manipulation;
}

.pin-key:active {
  background: var(--surface-sunken);
}

.pin-key.plain {
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink-2);
}

@media (max-width: 359px) {
  .pin-page {
    padding-inline: 16px;
  }
}

/* A short phone: tighten, so cells and keypad still fit on one screen. */
@media (max-height: 720px) {
  .pin-page {
    gap: 20px;
    padding-top: calc(24px + env(safe-area-inset-top));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }

  .pin-intro {
    gap: 12px;
  }

  .pin-entry {
    gap: 8px;
  }

  .pin-key {
    height: 56px;
  }
}

/* ── Dialogs ──────────────────────────────────────────────────────────── */

.dialog {
  width: min(400px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 28px 24px 24px;
  border: 0;
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--e3);
  color: var(--ink);
  overflow: auto;
}

.dialog[open],
.dialog form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dialog::backdrop {
  background: var(--scrim);
}

.dialog h2 {
  font-size: 22px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.dialog > p,
.dialog-text p {
  font-size: 15px;
  line-height: 22px;
  color: var(--ink-2);
}

.dialog > h2 + p {
  margin-top: -14px;
}

.dialog-text,
.dialog-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dialog-stack {
  gap: 10px;
}

.dialog-stack .caption {
  text-align: center;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

/* What the answer leaves behind — amber, like everything a person should look at twice. */
.dialog > .dialog-warning {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--check-soft);
  color: var(--check-text);
  font-size: 14px;
  line-height: 20px;
}

/* The orders a "ship them all" is about, one per line. */
.dialog-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: -8px 0 0;
  padding: 0;
  list-style: none;
}

.dialog-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  font-size: 15px;
  line-height: 22px;
}

.dialog-list strong {
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dialog-list-note {
  flex-basis: 100%;
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-3);
}

.dialog-actions .button.large {
  min-height: 44px;
  font-size: 15px;
}

.dialog-text .admin-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 8px;
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-3);
}

.dialog-footer {
  display: flex;
  padding-top: 16px;
  border-top: 1px solid var(--divider);
}

/* High on the screen, so the iPhone keyboard never covers the field or the button. */
.name-dialog {
  margin-top: clamp(16px, 6dvh, 112px);
}

.icon-tile {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
}

@media (max-height: 720px) {
  .name-dialog .icon-tile {
    display: none;
  }
}

/* ── Dashboard ────────────────────────────────────────────────────────── */

/* On a phone the bar is only a corner: the avatar beside the title. "New order" floats. */
.app-bar {
  position: absolute;
  top: calc(20px + var(--stand-height) + env(safe-area-inset-top));
  right: calc(var(--gutter) + env(safe-area-inset-right));
  z-index: 2;
}

.app-bar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: none;
}

.new-order {
  position: fixed;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 5;
  gap: 10px;
  min-height: 56px;
  padding: 0 22px 0 18px;
  border-radius: var(--radius-lg);
  box-shadow: var(--e2);
  font-size: 16px;
}

.new-order .icon-plus {
  display: none;
}

.page.dashboard {
  max-width: 720px;
  gap: 0;
  padding-top: calc(20px + env(safe-area-inset-top));
  /* Room for the floating button under the last card. */
  padding-bottom: calc(120px + env(safe-area-inset-bottom));
}

.dashboard-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 12px;
}

.dashboard-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 44px;
  padding-right: 56px;
}

.dashboard-title p {
  font-size: 14px;
  line-height: 20px;
  color: var(--ink-2);
}

/* Bleeds to the screen edges so a long row of pills scrolls under them, not the page. */
.tabs {
  display: flex;
  gap: 8px;
  margin: -6px calc(var(--gutter) * -1);
  padding: 6px var(--gutter);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.pill {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

/* 36px to the eye, 44px to the finger. */
.pill::before,
.segment::before,
.send-button::before,
.photo-control::before,
.toast-action::before {
  content: '';
  position: absolute;
  inset: -4px 0;
}

.pill[aria-current='page'] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--on-ink);
  font-weight: 600;
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--border-strong);
}

.pill-dot.on {
  background: var(--problem);
}

.pill-count {
  margin-left: -6px;
  font-variant-numeric: tabular-nums;
  white-space: pre;
}

@media (max-width: 400px) {
  .tabs {
    gap: 6px;
  }

  .pill {
    padding: 0 11px;
  }
}

.list,
.day {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list {
  padding-top: 4px;
}

.cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

/* "Developed by Rokitskiy.DEV": the quietest line on the page, at its very foot. */
.credit {
  margin-top: auto;
  padding-top: 32px;
  text-align: center;
  font-size: 13px;
  line-height: 18px;
  letter-spacing: 0.01em;
  color: var(--ink-3);
}

.credit a {
  position: relative;
  display: inline-block;
  color: var(--ink-2);
  font-weight: 600;
  text-decoration: none;
}

.credit a:hover {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* A line of text to the eye, 44px to the finger. */
.credit a::before {
  content: '';
  position: absolute;
  inset: -13px 0;
}

/* ── Dashboard: search ────────────────────────────────────────────────── */

/* A magnifier in the bar until it is pressed; then the field. Nothing is hidden by a search:
   the page moves to what matches and rings it. */

/* On a phone the bar is only a corner, so the field opens across the whole top of the window,
   over the title, with an arrow back that closes it. */
.app-bar.searching {
  z-index: 20;
}

.search {
  position: fixed;
  top: var(--stand-height);
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  /* The strip of a test stand has already taken the notch into account. */
  padding: calc(var(--space-2) + max(0px, env(safe-area-inset-top) - var(--stand-height))) calc(var(--space-3) + env(safe-area-inset-right)) var(--space-2)
    calc(var(--space-1) + env(safe-area-inset-left));
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--e1);
}

.search-back {
  color: var(--ink-2);
}

.search-field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  /* Tall enough for full-size touch targets inside its border. */
  height: 46px;
  padding-left: var(--space-3);
  border: 1px solid var(--primary);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--primary-soft);
  color: var(--ink);
}

/* The arrow back stands where the magnifier would; a phone has no room for both. */
.search-field > .icon {
  display: none;
  flex: none;
  margin-right: var(--space-2);
  color: var(--ink-3);
}

/* 16px, or a phone zooms the page in when the field is focused. The field's own border is the focus mark. */
.search-field input {
  flex: 1 1 72px;
  min-width: 48px;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: none;
  color: var(--ink);
  font: 400 16px/24px var(--font-sans);
}

.search-field input::placeholder {
  color: var(--ink-3);
}

/* "1 of 2", or "No match" — said quietly: finding nothing is not an error. */
.search-count {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  padding: 0 var(--space-1);
  color: var(--ink-3);
  font: 400 13px/20px var(--font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-step,
.search-clear {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink-2);
}

.search-step:disabled {
  color: var(--disabled-ink);
  cursor: default;
}

.search-clear {
  border-left: 1px solid var(--divider);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.search-step:not(:disabled):active,
.search-clear:active {
  background: var(--surface-sunken);
}

.search-step:focus-visible,
.search-clear:focus-visible {
  outline-offset: -2px;
}

/* Marks the height at which the field stops when the bar scrolls away under it. */
.search-probe {
  position: fixed;
  top: calc(var(--stand-height) + 10px);
  left: 0;
  width: 0;
  height: 0;
  visibility: hidden;
  pointer-events: none;
}

/* The match the page has moved to, and the others still waiting for Enter. The ring is the
   product's own focus outline one step heavier; the real focus stays in the field. */
.search-current {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.search-other {
  outline: 1px solid var(--primary);
  outline-offset: 3px;
}

mark.search-mark {
  padding: 1px 0;
  border-radius: var(--radius-xs);
  background: var(--primary-soft);
  color: inherit;
}

.search-current mark.search-mark {
  background: var(--primary);
  color: var(--on-primary);
}

/* What does not match steps back while a query is typed. Still readable, still clickable. */
.search-dim {
  opacity: var(--dim-opacity);
}

/* Stepping back is not said twice. */
.search-dim .search-dim {
  opacity: 1;
}

@media (min-width: 1024px) {
  /* In the bar, where the magnifier was. The bar itself is not pinned: the slot keeps the
     field's place in it, and once the page has scrolled the field floats at the same height. */
  .search {
    position: static;
    display: block;
    flex: none;
    width: 320px;
    height: 44px;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
  }

  /* "No match in Bonded stores" needs the room. */
  .search.long,
  .search.long .search-field {
    width: 400px;
  }

  .search-back {
    display: none;
  }

  .search-field {
    width: 320px;
    height: 44px;
    padding-right: var(--space-1);
  }

  .search-field > .icon {
    display: block;
  }

  .search.floating .search-field {
    position: fixed;
    top: calc(var(--stand-height) + 10px);
    right: var(--search-right, var(--gutter));
    z-index: 20;
    box-shadow:
      0 0 0 4px var(--primary-soft),
      var(--e2);
  }

  .search-step {
    width: 28px;
    height: 32px;
  }

  .search-clear {
    width: 32px;
    height: 32px;
    margin-left: 2px;
    border-radius: 0;
  }

  .search-step:not(:disabled):hover,
  .search-clear:hover {
    background: var(--surface-sunken);
    color: var(--ink);
  }
}

/* ── Dashboard: order types and ships ─────────────────────────────────── */

/* Chips that narrow the tab to one kind of order. Scrolls sideways on a phone, like the tabs. */
.type-filter {
  display: flex;
  gap: 8px;
  margin: 0 calc(var(--gutter) * -1) 4px;
  padding: 6px var(--gutter);
  overflow-x: auto;
  scrollbar-width: none;
}

.type-filter::-webkit-scrollbar {
  display: none;
}

.type-chip {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* 36px looks right in the row; the tap area is still 44px. */
.type-chip::before {
  content: '';
  position: absolute;
  inset: -4px 0;
}

.type-chip[aria-pressed='true'] {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.type-count {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}

.type-chip[aria-pressed='true'] .type-count {
  color: inherit;
}

.ships {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

/* ── Dashboard: what stayed in the warehouse ──────────────────────────── */

/* "2 waiting to ship · 1 return", in ordinary type beside the overline. */
.stay .overline span {
  margin-left: 12px;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}

/* "1 more hidden from your dashboard — see Warehouse": a reminder, not a call to act. */
.stay-more {
  padding: 0 4px;
  font-size: 14px;
  line-height: 20px;
  color: var(--ink-3);
}

.stay-more a {
  position: relative;
  display: inline-block;
  font-weight: 600;
  text-decoration: none;
}

.stay-more a::before {
  content: '';
  position: absolute;
  inset: -12px 0;
}

/* Hidden by this person: listed under "Warehouse" only, a step quieter than the rest. */
.badge.off {
  border: 1px dashed var(--border-strong);
  color: var(--ink-3);
}

.order-card.off-dashboard {
  opacity: 0.7;
}

/* Dashed: these blocks are not a day's delivery, they are what one left behind. */
.stay .ship {
  border-style: dashed;
  border-color: var(--border-strong);
}

.leftover-note {
  font-size: 15px;
  line-height: 22px;
  font-weight: 500;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.order-card.leftover .card-footer {
  font-weight: 400;
}

/* ── "Mark as shipped?" with part of the order staying ────────────────── */

.ship-dialog {
  width: min(480px, calc(100vw - 32px));
}

.choices,
.leftover-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leftover-form {
  gap: 16px;
}

.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 16px;
  line-height: 22px;
  color: var(--ink);
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.choice input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--primary);
}

.leftover-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.leftover-pick .type-chip {
  min-width: 44px;
  justify-content: center;
}

/* ── Dashboard: upcoming days, folded ─────────────────────────────────── */

.upcoming,
.folds {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.folds {
  gap: 10px;
}

/* "7 orders on 3 days", in ordinary type beside the overline. */
.upcoming .overline span {
  margin-left: 12px;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}

.fold {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--e1);
}

/* The whole line is the button. On a phone the ships wrap under the date. */
.fold-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas:
    'day total chevron'
    'ships ships ships';
  align-items: center;
  gap: 6px 10px;
  width: 100%;
  min-height: 56px;
  padding: 12px 14px 12px 16px;
  border: 0;
  border-radius: var(--radius-lg);
  background: none;
  color: var(--ink);
  text-align: left;
}

.fold-head:focus-visible {
  outline-offset: -2px;
}

.fold-day {
  grid-area: day;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.fold-day strong {
  font-size: 17px;
  line-height: 24px;
  font-weight: 600;
}

.fold-day span,
.fold-total {
  font-size: 14px;
  line-height: 20px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.fold-ships {
  grid-area: ships;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
  min-width: 0;
  font-size: 14px;
  line-height: 20px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.fold-ships span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.fold-ships b {
  font-weight: 600;
  color: var(--ink);
}

.fold-total {
  grid-area: total;
  text-align: right;
}

.fold-head .icon {
  grid-area: chevron;
  color: var(--ink-2);
}

.fold.open .fold-head .icon {
  transform: rotate(180deg);
}

.fold-body {
  padding: 2px 10px 10px;
}

/* One ship, all of its orders: the block is the card, the orders sit in it as tiles. */
.ship {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 12px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--e1);
}

.ship-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  padding: 0 4px;
}

.ship-head h3 {
  font-size: 18px;
  line-height: 24px;
  overflow-wrap: anywhere;
}

.ship-head span {
  font-size: 13px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* "Mark all as shipped": a quiet text action at the end of the heading, so the tiles stay
   the loudest thing in the block. 28px to the eye, 44px to the finger. */
.ship-all {
  position: relative;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  margin-left: auto;
  padding: 0 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
}

/* "Hide" is a short word; it is still a full-size target. */
.stay .ship-all {
  min-width: 44px;
  justify-content: center;
}

.ship-all::before {
  content: '';
  position: absolute;
  inset: -8px 0;
}

.ship-all .icon {
  color: var(--ink-3);
}

.ship-all:active {
  background: var(--surface-sunken);
}

.ship-orders {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.order-card.in-ship {
  background: var(--bg);
  box-shadow: none;
}

.order-card.in-ship h3 {
  font-size: 15px;
  line-height: 20px;
  letter-spacing: 0.05em;
}

.order-card.in-ship .mono-meta {
  white-space: nowrap;
}

/* A cancelled order is crossed out the way it would be on paper, and its squares fade. */
.order-card.cancelled h3,
.order-card.cancelled .mono-meta {
  color: var(--ink-3);
  text-decoration: line-through;
}

.order-card.cancelled .squares {
  opacity: 0.45;
}

.order-card.archived .card-footer {
  font-weight: 400;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--e1);
}

.order-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px;
  color: inherit;
  text-decoration: none;
}

.order-card:active {
  border-color: var(--border-strong);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

/* The order type follows the name on the same line and drops under it when there is no room. */
.card-name,
.order-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.order-name {
  gap: 6px 10px;
}

.card-badges {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

/* Ship names wrap; they are never cut off. */
.card-title h3 {
  font-size: 18px;
  line-height: 24px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--divider);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  letter-spacing: 0.005em;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.card-footer p {
  min-width: 0;
  overflow-wrap: anywhere;
}

.card-footer strong {
  font-weight: 600;
  color: var(--ink);
}

.card-footer .icon {
  color: var(--ink-3);
}

.card-updated {
  display: none;
  flex: none;
  font-size: 13px;
  font-weight: 400;
  color: var(--ink-3);
}

.skeleton .card {
  height: 150px;
}

/* ── Top bar of the inner screens ─────────────────────────────────────── */

.topbar {
  padding-top: env(safe-area-inset-top);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  max-width: 736px;
  min-height: 56px;
  margin: 0 auto;
  padding: 0 calc(8px + env(safe-area-inset-right)) 0 calc(8px + env(safe-area-inset-left));
}

.topbar-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 17px;
  line-height: 24px;
  font-weight: 600;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar.centered .topbar-title {
  font-size: 15px;
  color: var(--ink-2);
  text-align: center;
}

.topbar .badge {
  margin-right: 4px;
}

.topbar-space {
  display: none;
}

.discard {
  color: var(--ink-2);
}

.discard span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

/* ── Menu ─────────────────────────────────────────────────────────────── */

.menu {
  position: relative;
  flex: none;
}

.menu summary {
  list-style: none;
  color: var(--ink-2);
}

.menu summary::-webkit-details-marker {
  display: none;
}

.menu[open] summary {
  background: var(--surface-sunken);
}

.menu-items {
  position: absolute;
  right: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  min-width: 200px;
  margin-top: 4px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--e2);
}

.menu-items a,
.menu-items button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
}

.menu-items .icon {
  color: var(--ink-3);
}

.menu-separator {
  height: 1px;
  margin: 6px 6px;
  border: 0;
  background: var(--divider);
}

.menu-items a:active,
.menu-items button:active {
  background: var(--surface-sunken);
}

/* ── Order ────────────────────────────────────────────────────────────── */

.order-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.order-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
}

.order-heading {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.order-ship {
  font-size: 24px;
  line-height: 30px;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.order-meta {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 20px;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

/* The photo itself, small: a tap opens it full screen. */
.photo-chip {
  position: relative;
  flex: none;
  width: 56px;
  height: 72px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--paper);
  overflow: hidden;
  cursor: zoom-in;
}

.photo-chip img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* How many pages are behind the thumbnail. */
.photo-pages {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2px 0;
  background: var(--viewer-control);
  color: var(--photo-ink);
  font-size: 11px;
  line-height: 14px;
  font-weight: 600;
  text-align: center;
}

/* On the order itself the banner also carries the way to the check. */
.check-call {
  flex-wrap: wrap;
  gap: 10px 12px;
}

.check-call > span {
  flex: 1 1 200px;
}

.check-call .button {
  flex: none;
  margin-left: auto;
  color: var(--ink);
}

.summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

/* Under the summary: what has arrived, in a sentence, and the way out of "Active". */
.ship-bar,
.archive-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  font-size: 15px;
  line-height: 22px;
  color: var(--ink-2);
}

.ship-bar p,
.archive-banner p {
  flex: 1 1 220px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.ship-bar strong,
.archive-banner strong {
  font-weight: 600;
  color: var(--ink);
}

/* The order the leftover was split from. */
.ship-bar p a {
  color: var(--primary);
  font-family: var(--font-mono);
  text-decoration: underline;
  text-underline-offset: 3px;
  position: relative;
  display: inline-block;
}

/* A line of text to the eye, 44px to the finger. */
.ship-bar p a::before {
  content: '';
  position: absolute;
  inset: -13px 0;
}

/* On a phone the button takes the full row under the sentence. */
.ship-bar .button,
.archive-banner .button {
  flex: 1 1 auto;
}

/* An archived order: sunken and grey — it is a record now, not something to act on. */
.archive-banner {
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  font-size: 14px;
  line-height: 20px;
}

.summary-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

.summary-text {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.summary-count {
  font-size: 26px;
  line-height: 32px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: pre;
}

.summary-count span {
  font-weight: 500;
  color: var(--ink-3);
}

.summary-label {
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--ink-2);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
}

.segment {
  position: relative;
  height: 40px;
  padding: 0 2px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.segment[aria-pressed='true'] {
  background: var(--surface);
  box-shadow: var(--e-segment);
  color: var(--ink);
}

.suppliers,
.comments,
.supplier-editor,
.tips {
  margin: 0;
  padding: 0;
  list-style: none;
}

.suppliers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.supplier {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.supplier-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 14px 14px 14px 16px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

/* The card clips what sticks out, so the ring is drawn inside. */
.supplier-head:focus-visible {
  outline-offset: -3px;
  border-radius: var(--radius-lg);
}

.supplier-title {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.supplier-name {
  font-size: 16px;
  line-height: 22px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.supplier-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0 8px;
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.supplier-status.arrived {
  color: var(--arrived-text);
}

.supplier-status.problem {
  color: var(--problem-text);
}

.supplier-number {
  font-family: var(--font-mono);
  color: var(--ink-3);
}

.comment-count {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.supplier-head .icon-chevronDown {
  color: var(--ink-3);
}

.supplier.open .icon-chevronDown {
  transform: rotate(180deg);
}

/* Indented to line up with the name, under the square. */
.supplier-actions {
  display: flex;
  gap: 8px;
  padding: 0 14px 14px 48px;
}

.supplier-actions .arrive {
  flex: 1;
}

@media (max-width: 359px) {
  .supplier-actions {
    padding-left: 16px;
  }

  .supplier-actions .button {
    padding: 0 12px;
  }

  .segment {
    font-size: 13px;
  }
}

/* Our own stock: one line per part under the row's name, each marked on its own. */
.stock-parts {
  margin: 0;
  padding: 0 14px 6px 48px;
  list-style: none;
}

.stock-part {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  min-height: 56px;
  padding: 8px 0;
  border-top: 1px solid var(--divider);
}

.part-title {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.part-name {
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
}

.part-status {
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.part-status.arrived {
  color: var(--arrived-text);
}

.part-status.problem {
  color: var(--problem-text);
}

.part-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.part-actions .button {
  padding: 0 12px;
}

.part-problem .icon {
  color: var(--problem);
}

/* What is wrong, on a line of its own under the part. */
.part-note {
  flex-basis: 100%;
  min-width: 0;
  margin: 2px 0 2px 30px;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  line-height: 22px;
}

.part-note.filled,
p.part-note {
  border-color: transparent;
  background: var(--problem-soft);
  color: var(--problem-text);
}

input.part-note:focus-visible {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  color: var(--ink);
}

/* The same note under a supplier marked as a problem, in line with its name. */
.supplier-note {
  display: flex;
  padding: 0 14px 14px 48px;
}

.supplier-note .part-note {
  flex: 1;
  margin: 0;
}

@media (max-width: 359px) {
  .supplier-note {
    padding-left: 16px;
  }
}

@media (max-width: 599px) {
  .stock-parts {
    padding-left: 16px;
  }

  /* No room beside "Problem · 10:15 · Pieter B.": the note first, then what can be done. */
  .stock-part.problem .part-note {
    order: 1;
  }

  .stock-part.problem .part-actions {
    order: 2;
    flex-basis: 100%;
    margin-left: 30px;
  }
}

.supplier-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--divider);
  background: var(--surface-subtle);
}

.comments {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.comments li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.comment {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.comment-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 8px;
  font-size: 13px;
  line-height: 20px;
  color: var(--ink-3);
}

.comment-meta strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.comment-text {
  max-width: 100%;
  padding: 9px 12px;
  border-radius: 4px 12px 12px 12px;
  background: var(--bg);
  font-size: 15px;
  line-height: 22px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.comment-edited {
  font-style: italic;
}

.comments li.editing .comment {
  align-items: stretch;
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.editing .comment-actions {
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

/* Quiet text buttons under one's own comment: 28px to the eye, 44px to the finger. */
.comment-action {
  position: relative;
  min-width: 44px;
  height: 28px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
}

.comment-action:first-child {
  margin-left: -8px;
}

.comment-action::before {
  content: '';
  position: absolute;
  inset: -8px 0;
}

.comment-action:active {
  background: var(--primary-soft);
}

/* The comment itself, turned into a field. */
.comment-editor {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  line-height: 22px;
  resize: none;
  overflow: hidden;
}

.comment-editor:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.comment-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.comment-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 16px;
}

.send-button {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: var(--on-primary);
}

.send-button::before {
  inset: -2px;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.panel-actions .button.text {
  padding: 0 8px;
}

.filter-empty {
  padding: 24px 16px;
  font-size: 15px;
  color: var(--ink-3);
  text-align: center;
}

/* ── Photo panel ──────────────────────────────────────────────────────── */

/* Dark in both themes: paper reads best against it, as in a lightbox. */
.review-photo {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 18px 14px;
  border-radius: var(--radius-lg);
  background: var(--photo-panel);
  color: var(--photo-ink);
}

.review-photo :focus-visible,
.viewer :focus-visible {
  outline-color: var(--photo-ink);
}

.photo-button {
  position: relative;
  align-self: center;
  display: block;
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: var(--radius-xs);
  background: none;
  cursor: zoom-in;
}

.photo-thumb {
  display: block;
  max-width: 100%;
  max-height: 46dvh;
  border-radius: var(--radius-xs);
  box-shadow: var(--e-photo);
}

.photo-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  line-height: 18px;
  color: var(--photo-ink-muted);
}

.photo-control {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: var(--photo-control);
  color: var(--photo-ink);
  font-size: 14px;
  font-weight: 600;
}

.photo-control:active {
  background: var(--photo-control-hover);
}

.photo-control.round {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-full);
}

.photo-control:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Under the photo when the order has several pages: previous · "Page 1 of 2" · next. */
.photo-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.pager-label {
  min-width: 96px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.photo-missing {
  padding: 32px 0;
  font-size: 15px;
  color: var(--photo-ink-muted);
  text-align: center;
}

.viewer {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--viewer-bg);
}

.viewer-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* The page must not scroll or zoom under the fingers; the script moves the image. */
  touch-action: none;
}

.viewer-stage img {
  max-width: 100%;
  max-height: 100%;
  transform-origin: center;
  user-select: none;
  -webkit-user-drag: none;
}

/* Over a white page the translucent control would vanish; these are solid. */
.viewer .photo-control {
  background: var(--viewer-control);
}

.viewer-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
}

.viewer-count {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  left: 50%;
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-full);
  background: var(--viewer-control);
  color: var(--photo-ink);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transform: translateX(-50%);
}

.viewer-previous,
.viewer-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.viewer-previous {
  left: calc(12px + env(safe-area-inset-left));
}

.viewer-next {
  right: calc(12px + env(safe-area-inset-right));
}

.viewer-zoom {
  position: absolute;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  display: flex;
  gap: 12px;
  transform: translateX(-50%);
}

/* ── Draft review ─────────────────────────────────────────────────────── */

.review-page {
  /* Room for the action bar pinned to the bottom edge. */
  padding-bottom: calc(100px + env(safe-area-inset-bottom));
}

.review,
.review-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.check-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--check-soft);
  color: var(--check-text);
  font-size: 14px;
  line-height: 20px;
}

.check-banner strong {
  font-weight: 600;
}

.fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 16px;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 359px) {
  .field-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

.supplier-card {
  display: flex;
  flex-direction: column;
  padding: 16px 0 8px;
  overflow: hidden;
}

.supplier-card h2 {
  padding: 0 16px 8px;
  font-size: 18px;
  line-height: 24px;
  font-weight: 600;
}

.supplier-card .count {
  font-weight: 500;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.supplier-editor li {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 52px;
  padding: 4px 8px 4px 16px;
  border-top: 1px solid var(--divider);
}

.supplier-editor li.check {
  background: var(--check-soft);
}

.row-number {
  flex: none;
  width: 22px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-3);
  text-align: right;
}

/* Name over order number on a phone; side by side when there is room. */
.row-fields {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 0 4px;
  min-width: 0;
}

/* They read as text in a list and turn into fields when touched. */
.supplier-editor input {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 8px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 16px;
  line-height: 22px;
}

.supplier-editor input:focus-visible {
  background: var(--surface);
}

.row-name {
  font-weight: 500;
}

.row-order {
  font-family: var(--font-mono);
  color: var(--ink-2);
}

.supplier-editor input.check {
  border-color: var(--check);
}

/* On a VOORRAAD row: which parts our own stock is picked in. */
.row-parts {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 2px 9px 8px;
  font-size: 13px;
  color: var(--ink-3);
}

.row-parts[hidden] {
  display: none;
}

.row-hint {
  grid-column: 1 / -1;
  padding: 2px 9px 6px;
  font-size: 12px;
  line-height: 16px;
  color: var(--check-text);
}

.supplier-editor .icon-button {
  border-radius: 10px;
  color: var(--ink-3);
}

.supplier-add {
  display: flex;
  padding: 8px 16px;
  border-top: 1px solid var(--divider);
}

.supplier-add .button {
  flex: 1;
}

/* The sticky action bar. Its buttons live in the top bar's markup, so that on a desktop
   they simply stay there; on a phone they are pinned to the bottom edge. */
.form-actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  display: flex;
  gap: 10px;
  padding: 12px calc(16px + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
  border-top: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--e-bar);
}

.form-actions > :last-child {
  flex: 1;
}

/* ── New order and the photo being read ───────────────────────────────── */

.capture {
  --frame-h: 300px;
  gap: 20px;
}

.capture-text,
.job-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 4px;
}

.capture-frame {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  height: var(--frame-h);
  border: 1.5px dashed var(--border-strong);
  border-radius: 20px;
  background: var(--surface);
}

.paper {
  display: flex;
  flex-direction: column;
  gap: calc(var(--frame-h) * 0.027);
  width: calc(var(--frame-h) * 0.5);
  height: calc(var(--frame-h) * 0.667);
  padding: calc(var(--frame-h) * 0.073) calc(var(--frame-h) * 0.06);
  border-radius: 4px;
  background: var(--paper);
  box-shadow: var(--e-paper);
}

.paper i {
  height: 4px;
  border-radius: 2px;
  background: var(--paper-line);
}

.paper i:nth-child(1) {
  width: 60%;
  height: 6px;
  background: var(--paper-line-strong);
}

.paper i:nth-child(3) {
  width: 80%;
}

.paper i:nth-child(5) {
  width: 70%;
}

.paper i:nth-child(6) {
  width: 90%;
}

.paper i:nth-child(7) {
  width: 65%;
}

.corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 0 solid var(--primary);
}

.corner.tl,
.corner.tr {
  top: calc(50% - var(--frame-h) * 0.367);
  border-top-width: 3px;
}

.corner.bl,
.corner.br {
  bottom: calc(50% - var(--frame-h) * 0.367);
  border-bottom-width: 3px;
}

.corner.tl,
.corner.bl {
  left: calc(50% - var(--frame-h) * 0.303);
  border-left-width: 3px;
}

.corner.tr,
.corner.br {
  right: calc(50% - var(--frame-h) * 0.303);
  border-right-width: 3px;
}

.corner.tl {
  border-top-left-radius: 6px;
}

.corner.tr {
  border-top-right-radius: 6px;
}

.corner.bl {
  border-bottom-left-radius: 6px;
}

.corner.br {
  border-bottom-right-radius: 6px;
}

.tips {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 4px;
}

.tips li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  line-height: 22px;
  color: var(--ink-2);
}

.tips .icon {
  color: var(--arrived);
}

.capture-intro {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* The pages picked so far, numbered in the order they will be read. */
.page-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.page-tile {
  position: relative;
}

.page-open {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--paper);
  overflow: hidden;
  cursor: zoom-in;
}

.page-open img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.page-number,
.page-remove {
  position: absolute;
  display: grid;
  place-items: center;
  background: var(--viewer-control);
  color: var(--photo-ink);
}

.page-number {
  left: 6px;
  bottom: 6px;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
}

.page-remove {
  top: 6px;
  right: 6px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-full);
}

.page-remove::before {
  content: '';
  position: absolute;
  inset: -6px;
}

.page-remove:disabled {
  opacity: 0.4;
}

.add-page {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.has-pages .add-page {
  flex-flow: row wrap;
}

.has-pages .add-page .button {
  flex: 1 1 auto;
}

.page-limit {
  text-align: center;
}

.upload-progress {
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--surface-sunken);
  overflow: hidden;
}

.upload-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

/* Pinned to the bottom of the screen on a phone. */
.capture-actions,
.job-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.capture-actions {
  margin-top: auto;
  padding-top: 4px;
}

.upload-status {
  font-size: 15px;
  line-height: 22px;
  color: var(--ink-2);
  text-align: center;
}

.capture-actions .form-error {
  text-align: center;
}

@media (max-height: 720px) {
  .capture {
    --frame-h: 200px;
  }
}

.job {
  gap: 20px;
}

.job .review-photo {
  padding: 18px;
}

.job-text h2 {
  font-size: 22px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.job-text p {
  font-size: 15px;
  line-height: 22px;
  color: var(--ink-2);
}

.photo-veil {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius-xs);
  background: var(--photo-dim);
  color: var(--photo-ink);
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--photo-control-hover);
  border-top-color: var(--photo-ink);
  border-radius: var(--radius-full);
}

.failed-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--viewer-control);
}

/* ── Snackbar ─────────────────────────────────────────────────────────── */

#toast {
  position: fixed;
  left: calc(16px + env(safe-area-inset-left));
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  max-width: 480px;
  min-height: 52px;
  margin: 0 auto;
  padding: 0 8px 0 16px;
  border-radius: var(--radius-md);
  background: var(--snackbar-bg);
  box-shadow: var(--e2);
  color: var(--snackbar-ink);
  font-size: 15px;
  line-height: 20px;
}

/* Above the floating "New order" and the review action bar, never on top of them. */
body:has(.new-order) #toast {
  bottom: calc(88px + env(safe-area-inset-bottom));
}

body:has(.form-actions) #toast {
  bottom: calc(92px + env(safe-area-inset-bottom));
}

.toast-text {
  min-width: 0;
  padding: 14px 0;
  overflow-wrap: anywhere;
}

.toast-action {
  position: relative;
  flex: none;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--snackbar-action);
  font-size: 15px;
  font-weight: 600;
}

.toast-action:focus-visible {
  outline-color: var(--snackbar-action);
}

/* ── Tablet ───────────────────────────────────────────────────────────── */

@media (min-width: 600px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ship-bar .button,
  .archive-banner .button {
    flex: none;
  }

  /* Room for the whole day on one line: date, ships, total. */
  .fold-head {
    grid-template-columns: 200px minmax(0, 1fr) auto auto;
    grid-template-areas: 'day ships total chevron';
    gap: 6px 16px;
    min-height: 64px;
    padding: 12px 20px;
  }

  .fold-total {
    white-space: nowrap;
  }

  .fold-body {
    padding: 4px 16px 16px;
  }

  .ship {
    padding: 16px 18px 18px;
  }

  .ship-orders {
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: 12px;
  }

  /* Nothing to pin a keypad to on a big screen; it follows the cells. */
  .pin-keypad {
    margin-top: 0;
  }

  .name-dialog {
    margin-top: min(112px, 12dvh);
  }

  .row-fields {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }

  .capture-actions {
    margin-top: 0;
  }

  .page-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ── Desktop ──────────────────────────────────────────────────────────── */

@media (min-width: 1024px) {
  .app-bar,
  .topbar {
    position: static;
    padding-top: 0;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
  }

  .app-bar-inner {
    max-width: 1240px;
    min-height: 64px;
    margin: 0 auto;
    padding: 0 var(--gutter);
  }

  .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: auto;
    border-radius: var(--radius-sm);
    color: var(--ink);
    font-size: 17px;
    font-weight: 600;
    text-decoration: none;
  }

  .new-order {
    position: static;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px 0 12px;
    border-radius: var(--radius-md);
    box-shadow: none;
    font-size: 15px;
  }

  .new-order .icon-camera {
    display: none;
  }

  .new-order .icon-plus {
    display: block;
  }

  body:has(.new-order) #toast {
    bottom: 24px;
  }

  .page.dashboard {
    max-width: 1240px;
    padding: 32px var(--gutter) 48px;
  }

  .dashboard-header {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    padding-bottom: 24px;
  }

  .dashboard-title {
    gap: 4px;
    padding-right: 0;
  }

  .dashboard-title p {
    font-size: 15px;
  }

  .tabs {
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    overflow: visible;
  }

  .list {
    gap: 24px;
    padding-top: 0;
  }

  .day {
    gap: 16px;
  }

  .overline {
    padding: 0;
  }

  .cards {
    grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
    gap: 16px;
  }

  /* Two ships abreast; a ship with several orders takes the full row for them. */
  .ships {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
  }

  .ship.wide {
    grid-column: 1 / -1;
  }

  .ship-head h3 {
    font-size: 20px;
    line-height: 26px;
  }

  .type-filter {
    margin-bottom: 8px;
  }

  .order-card {
    padding: 18px 20px;
  }

  .order-card:hover {
    border-color: var(--border-strong);
  }

  /* A desktop has room to say when the order last changed; the chevron is for touch. */
  .card-footer .icon {
    display: none;
  }

  .card-updated {
    display: inline;
  }

  .topbar-inner {
    gap: 12px;
    max-width: 1320px;
    min-height: 64px;
    padding: 10px var(--gutter);
  }

  .topbar-back {
    background: var(--bg);
  }

  .topbar-title,
  .topbar.centered .topbar-title {
    font-size: 18px;
    color: var(--ink);
    text-align: left;
  }

  /* With actions in the bar the title keeps its own width and a spacer pushes them right. */
  .topbar.actions .topbar-title {
    flex: none;
  }

  .topbar-space {
    display: block;
    flex: 1;
  }

  .discard {
    width: auto;
    gap: 6px;
    padding: 0 12px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
  }

  .discard span {
    position: static;
    width: auto;
    height: auto;
    clip-path: none;
  }

  .fold-head:hover .icon {
    color: var(--ink);
  }

  .ship-all:hover {
    background: var(--surface-sunken);
    color: var(--ink);
  }

  .discard:hover,
  .icon-button:hover,
  .menu-items a:hover,
  .menu-items button:hover {
    background: var(--surface-sunken);
  }

  .form-actions {
    position: static;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
  }

  .form-actions .button.large {
    min-height: 44px;
    font-size: 15px;
  }

  .form-actions > :last-child {
    flex: none;
    padding: 0 20px;
  }

  body:has(.form-actions) #toast {
    bottom: 24px;
  }

  .page {
    padding-top: 28px;
    padding-bottom: 48px;
  }

  .order-page {
    max-width: 784px;
  }

  .review-page {
    max-width: 1320px;
  }

  .review {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 24px;
  }

  .review > .review-photo {
    position: sticky;
    top: calc(24px + var(--stand-height));
    flex: 1 1 520px;
    gap: 16px;
    min-width: 0;
    padding: 32px 24px 20px;
    border-radius: 20px;
  }

  .review > .review-photo .photo-thumb {
    max-height: calc(100dvh - 240px - var(--stand-height));
  }

  .review-form {
    flex: 1 1 440px;
  }

  .fields {
    padding: 20px;
  }

  .supplier-card h2 {
    padding-left: 20px;
  }

  .supplier-editor li {
    min-height: 44px;
    padding-left: 20px;
  }

  .button.primary:hover {
    background: var(--primary-pressed);
  }

  .button.outlined:hover {
    border-color: var(--border-strong);
  }
}

/* ── Motion ───────────────────────────────────────────────────────────── */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shake {
  20%,
  60% {
    transform: translateX(-6px);
  }

  40%,
  80% {
    transform: translateX(6px);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .button,
  .icon-button,
  .ship-all,
  .pin-key,
  .pill,
  .segment,
  .order-card {
    transition:
      background-color var(--t-press),
      border-color var(--t-press),
      color var(--t-press);
  }

  .square {
    transition: background-color var(--t-expand) ease-out;
  }

  .supplier-head .icon-chevronDown,
  .fold-head .icon-chevronDown {
    transition: transform var(--t-expand) ease-out;
  }

  .upload-progress i {
    transition: width var(--t-expand) ease-out;
  }

  .pin-cells.wrong {
    animation: shake 0.4s;
  }

  .spinner {
    animation: spin 0.9s linear infinite;
  }

  #toast:not([hidden]),
  .dialog[open] {
    animation: rise var(--t-sheet) ease-out;
  }
}
