:root {
  --bg: #f5f6f8; --surface: #fff; --surface-hover: #eef1f6; --text: #1d2433; --muted: #5d6677; --border: #d9dde5;
  --input-bg: #fff; --input-border: #b9c0cc;
  --primary: #1f5fbf; --primary-dark: #17488f; --danger: #b42318; --warn: #a15c00; --ok: #137a3e;
  --info: #1f5fbf; --sim: #7a2fbf; --radius: 8px;
  /* Semantic status triads: every badge/flash/notice/stat color resolves to one of these five,
     not a one-off hex, so a given status looks identical everywhere it appears. */
  --success: var(--ok); --success-bg: #dff3e6; --success-border: #a6d9b8;
  --warning: var(--warn); --warning-bg: #fff4d6; --warning-border: #efd58a;
  --danger-bg: #fde4e1; --danger-border: #f2b0a9;
  --info-bg: #e0ecfb; --info-border: #a9c6f0;
  --neutral: #3c4658; --neutral-bg: #eceff3; --neutral-border: #cdd3dd;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px; color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.45; }
a { color: var(--primary); }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
/* ============================================================
   APP SHELL — sidebar + content layout (replaces .topbar)
   ============================================================ */
.app-shell { display: flex; align-items: flex-start; min-height: 100vh; }
.app-main { flex: 1; min-width: 0; }

.sidebar {
  flex: 0 0 14rem; width: 14rem; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; background: #14213d; color: #fff;
  overflow-y: auto; transition: width .15s ease, flex-basis .15s ease; z-index: 10;
}
.sidebar a { color: #dbe4f5; text-decoration: none; }
.sidebar a:focus-visible, .sidebar button:focus-visible, .sidebar summary:focus-visible {
  outline: 2px solid #fff; outline-offset: 2px;
}

.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .75rem .75rem .5rem; }
.sidebar-head .brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; color: #fff; min-width: 0; overflow: hidden; }
.sidebar-head .brand .icon-wrap { flex: 0 0 auto; display: flex; }
.sidebar-head .brand .icon { width: 1.3rem; height: 1.3rem; }
.sidebar-toggle {
  background: none; border: 1px solid rgba(255,255,255,.3); color: #dbe4f5; border-radius: 6px;
  padding: .3rem; min-height: 2rem; min-width: 2rem; flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
}
.sidebar-toggle:hover { background: rgba(255,255,255,.12); }
.sidebar-toggle .icon { transition: transform .15s ease; }

.sidebar-nav { display: flex; flex-direction: column; gap: .1rem; padding: .25rem .5rem; flex: 1; }
.sidebar-nav a { display: flex; align-items: center; gap: .65rem; padding: .55rem .6rem; border-radius: 6px; white-space: nowrap; overflow: hidden; }
.sidebar-nav a .icon { flex: 0 0 auto; width: 1.1rem; height: 1.1rem; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,.15); color: #fff; }
.sidebar-nav a.active { box-shadow: inset 3px 0 0 #fff; }

.sidebar-foot { padding: .5rem; border-top: 1px solid rgba(255,255,255,.15); position: relative; }
.sidebar-foot .user-summary {
  width: 100%; display: flex; align-items: center; gap: .65rem; padding: .55rem .6rem;
  border-radius: 6px; list-style: none; white-space: nowrap; overflow: hidden;
}
.sidebar-foot .user-summary::-webkit-details-marker { display: none; }
.sidebar-foot .user-summary:hover { background: rgba(255,255,255,.12); }
.sidebar-foot .user-summary .icon { flex: 0 0 auto; width: 1.1rem; height: 1.1rem; }
.sidebar-foot .menu-up { bottom: calc(100% + .3rem); top: auto; left: 0; right: auto; }
.sidebar-foot .acting { display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; padding: 0; margin-bottom: .4rem; }
.sidebar-foot .acting label { margin: 0; font-weight: 600; font-size: .85rem; }
.sidebar-foot .acting select { font-size: .85rem; }
/* Always visible (not tucked inside the user-menu disclosure) so the version/commit hash that
   used to sit in the topbar stays glanceable — only hidden when the sidebar collapses to an
   icon rail, same as every other sidebar-foot label. */
.sidebar-version {
  margin-top: .4rem; padding: 0 .6rem; font-size: .75rem; color: #9bb0c9;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Collapsed (icon rail): labels keep their accessible name via the sr-only technique rather
   than display:none — a sighted mouse user relies on each link's title="" tooltip instead. */
.sidebar-collapsed .sidebar { flex-basis: 3.5rem; width: 3.5rem; }
.sidebar-collapsed .sidebar-head { justify-content: center; }
.sidebar-collapsed .sidebar-head .sidebar-toggle { transform: scaleX(-1); }
.sidebar-collapsed .sidebar-nav a,
.sidebar-collapsed .sidebar-foot .user-summary { justify-content: center; }
.sidebar-collapsed .sidebar-nav .label,
.sidebar-collapsed .sidebar-foot .label,
.sidebar-collapsed .sidebar-head .brand .label {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Narrow viewports always get the icon rail regardless of the stored preference — there is no
   room to spare for an expanded sidebar on a floor tablet. */
@media (max-width: 880px) {
  .sidebar { flex-basis: 3.5rem; width: 3.5rem; }
  .sidebar-toggle { display: none; }
  .sidebar-head { justify-content: center; }
  .sidebar-nav a, .sidebar-foot .user-summary { justify-content: center; }
  .sidebar-nav .label, .sidebar-foot .label, .sidebar-head .brand .label {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
  }
}

.simbar { background: #efe2fb; color: #3d1a66; border-bottom: 2px solid var(--sim); padding: .4rem 1.25rem; font-size: .9rem; }
main { padding: 1.25rem 1.5rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
/* Without a fixed flex-basis, whether the actions land beside or below the title block depends
   on each job's title/filename length, so buttons sat in different places across pick slips. */
#job-header > .actions { flex-basis: 100%; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.15rem; margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid > .card { margin: 0; }

/* ============================================================
   PANEL GRIDS — zone panels (pick) and unit panels (staging)
   ============================================================ */
/* Pick screen: one zone panel after another, each at full width — a pick line carries more
   columns of data (Bin/Item/Description/Required/Qty picked/Notes/Actions) than fits
   comfortably in a side-by-side column, so zones stack rather than going left to right. */
.zone-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; align-items: start; margin-bottom: 1rem; }
/* .slip-zone-group gets its boxed look from this selector alone — never from a second class
   token on the section, since a test asserts on the exact literal class="slip-zone-group". */
.slip-zone-group {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .9rem 1rem 1rem; margin: 0 0 1rem; display: flex; flex-direction: column; min-width: 0;
}
.zone-grid > .slip-zone-group { margin: 0; }

/* "Held in store" must not read as a package stores still controls. */
.card.held-panel { border-color: var(--info-border); }
.card.warning { border-color: var(--warning-border); }
.card.warning > h2 { color: var(--warn); }
.kv { display: grid; grid-template-columns: 11rem 1fr; gap: .3rem .75rem; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); white-space: nowrap; }
th a { color: inherit; text-decoration: none; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
tbody tr:hover td { background: var(--bg); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.btn, button { font: inherit; cursor: pointer; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: .4rem .85rem; text-decoration: none; display: inline-block; }
.btn:hover, button:hover { background: var(--surface-hover); }
.btn.primary, button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover, button.primary:hover { background: var(--primary-dark); }
.btn.danger, button.danger { background: var(--surface); border-color: var(--danger); color: var(--danger); }
.btn.danger:hover, button.danger:hover { background: #fdecea; }
a:focus-visible, button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid currentColor; outline-offset: 2px; border-radius: 2px;
}
.btn.link, button.link { border: 0; background: none; color: var(--primary); padding: 0; text-decoration: underline; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }
label { display: block; font-weight: 600; margin-bottom: .2rem; }
input[type=text], input[type=password], input[type=search], input[type=number], input[type=file], select, textarea { font: inherit; padding: .4rem .55rem; border: 1px solid var(--input-border); border-radius: 6px; width: 100%; background: var(--input-bg); }
textarea { min-height: 5rem; }
.field { margin-bottom: .85rem; }
.field .hint { color: var(--muted); font-size: .85rem; }
.field .error, .error-text { color: var(--danger); font-size: .88rem; }
.form-grid { display: grid; gap: 0 1.25rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
/* CSP forbids inline `style="..."` attributes (style-src-attr): every one-off placement below
replaces what used to be a literal inline style, scoped as narrowly as the thing it replaces. */
.span-all { grid-column: 1 / -1; }
.mt-sm { margin-top: .4rem; }
.form-narrow { max-width: 640px; }
.mt-card { margin-top: 1rem; }
/* Visually hidden but still announced — a "name" for a column that only ever holds a row
action, no written heading (a11y: a <th> is never left empty). */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.checks { display: flex; gap: 1.25rem; flex-wrap: wrap; margin-bottom: .85rem; }
.checks label { font-weight: 400; display: flex; gap: .4rem; align-items: center; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.filters .field { margin: 0; min-width: 9rem; } .filters .field.grow { flex: 1; min-width: 14rem; }
.field-row { display: flex; gap: .5rem; align-items: center; margin-bottom: .4rem; }
.field-row input[type=text] { flex: 1; }
.item-search-results { display: flex; flex-direction: column; gap: .3rem; margin-top: .4rem; }
.item-search-results form.item-search-result { margin: 0; }
.item-search-results button { width: 100%; text-align: left; }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.status-group { display: inline-flex; align-items: center; gap: .4rem; }
.icon { width: 1em; height: 1em; vertical-align: -0.125em; stroke: currentColor; fill: none; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.badge .icon { width: .85em; height: .85em; }
.b-draft { background: #eceff3; color: #3c4658; border-color: #cdd3dd; }
.b-pending { background: #fff4d6; color: #6d4a00; border-color: #efd58a; }
.b-approved { background: #dff3e6; color: #0d5a2c; border-color: #a6d9b8; }
.b-released { background: #cfeedd; color: #064a22; border-color: #7fcb9d; }
.b-rejected, .b-error { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
/* "Changes requested" is a distinct status, not a severity — kept on its own purple, not one
   of the five severity tokens. */
.b-changes { background: #e8e5fb; color: #3b2d96; border-color: #bdb4ee; }
.b-error { background: #fde4e1; color: #8a1a10; border-color: #f2b0a9; }
.b-warning { background: #fff0cf; color: #7a4a00; border-color: #efce85; }
.b-info { background: #e0ecfb; color: #174a94; border-color: #a9c6f0; }
.flash { padding: .6rem .9rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid var(--border); background: var(--surface); }
.flash.error { border-color: #f2b0a9; background: #fdecea; color: #8a1a10; }
.flash.success { border-color: #a6d9b8; background: #e8f6ed; color: #0d5a2c; }
.notice { border-left: 4px solid var(--info); background: #eef4fd; color: #1d2433; padding: .6rem .9rem; border-radius: 0 6px 6px 0; margin-bottom: .75rem; }
.notice.error { border-color: var(--danger); background: #fdecea; }
.notice.warning { border-color: #d98b00; background: #fff6e0; }
.notice.ok { border-color: var(--ok); background: #e8f6ed; }
.stat { text-align: center; } .stat .value { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.stat a { text-decoration: none; } .stat.error .value { color: var(--danger); } .stat.warning .value { color: var(--warn); } .stat.info .value { color: var(--info); }
.stat.error { border-left-color: var(--danger); } .stat.warning { border-left-color: var(--warn); } .stat.info { border-left-color: var(--info); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.pager { display: flex; gap: .75rem; align-items: center; justify-content: space-between; margin-top: .75rem; flex-wrap: wrap; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { border-left: 3px solid var(--border); padding: 0 0 .8rem .8rem; margin-left: .3rem; }
.timeline li.done { border-color: var(--ok); } .timeline li.current { border-color: var(--primary); } .timeline li.bad { border-color: var(--danger); }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.compare .same { color: var(--ok); } .compare .diff { color: var(--danger); font-weight: 600; }
.login { max-width: 380px; margin: 4rem auto; }
.htmx-indicator { opacity: 0; } .htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
details summary { cursor: pointer; font-weight: 600; }
.exception-group { margin-bottom: 1rem; padding-bottom: .25rem; border-bottom: 1px solid var(--border); }
.exception-group:last-of-type { border-bottom: none; }
.exception-group summary { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .4rem 0; }
.exception-group[open] summary { margin-bottom: .5rem; }
/* Pick slips list status filter (pick-slip-list-status-filter design): groups laid out left to
right so the expanded filter stays short, wrapping onto new rows only when the viewport is too
narrow to fit them. */
.status-filter { margin-bottom: 1rem; }
.status-filter-groups { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: .6rem; }
.status-filter-groups fieldset { flex: 1 1 200px; min-width: 180px; }
.status-filter-option { display: block; padding: .15rem 0; }
@media (max-width: 640px) { .kv { grid-template-columns: 1fr; } .compare { grid-template-columns: 1fr; } }

/* Pick slip print page (pick-slip-refactor-spec.md section 4.6). */
.slip-pick-blank { display: inline-block; width: 6rem; border-bottom: 1px solid var(--text); }
.pick-overpicked { background: #fff6e0; }
#pick-board input[type=number] { min-height: 2.75rem; font-size: 1rem; }
#pick-board button { min-height: 2.75rem; min-width: 2.75rem; padding: .55rem 1rem; }
/* Keep the row's action-cell buttons (Change location / Add to master data, then the edit-qty
pencil) on one line — otherwise the table's auto layout can shrink this column to fit only the
first button, wrapping the second onto its own line. */
#pick-board td:last-child { white-space: nowrap; }

/* A package's open/closed state (pick/pack/despatch design §4.3) is told apart by its own word
   and icon as well as its colour, so colour is never the only signal. The colours come from the
   semantic status tokens, not from new hex values. */
.badge-locked { background: var(--neutral-bg); color: var(--neutral); border-color: var(--neutral-border); }
.badge-editable { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.slip-signoff { display: flex; gap: 2.5rem; flex-wrap: wrap; margin-top: 2rem; }
.slip-signoff div { border-top: 1px solid var(--text); padding-top: .3rem; min-width: 12rem; }

/* "Change location" popup on the pick screen (change-location-popup design) — the app's first
dialog, so there's no existing modal primitive to match; styled to read as a floating .card.
It's opened without leaving the pick screen, so its controls get the same floor touch-target
sizing as #pick-board above. */
dialog#location-modal {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 1.15rem;
  max-width: 420px; width: calc(100% - 2rem); box-shadow: 0 12px 32px rgba(0,0,0,.18);
}
dialog#location-modal::backdrop { background: rgba(10,14,24,.45); }
dialog#location-modal .actions { margin-top: .75rem; }
dialog#location-modal input[type=text] { min-height: 2.75rem; font-size: 1rem; }
dialog#location-modal button { min-height: 2.75rem; min-width: 2.75rem; padding: .55rem 1rem; }

/* Packing summary (pick-staging-spec.md section 4.5 step 2) — no delivery address exists in
the app (Q1), so this is left blank for the office to fill in by hand on the printout. */
.deliver-to { border: 1px dashed var(--border); border-radius: var(--radius); min-height: 4rem; }
.print-only { display: none; }
.slip-page-header { display: none; }

/* Job stepper (pick slip header): the job's lifecycle collapsed from 14 JobStatus values to six
visible stages, so status reads at a glance instead of being inferred from which action buttons
happen to be present. States follow .timeline's done/current/bad vocabulary (_progress.html). */
.job-stepper { display: flex; align-items: center; gap: 0; margin-bottom: .75rem; overflow-x: auto; }
.job-stepper .stage { display: flex; align-items: center; gap: .4rem; padding: .3rem 0; flex: 0 0 auto; }
.job-stepper .stage .dot {
  width: 1.5rem; height: 1.5rem; border-radius: 999px; display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; border: 2px solid var(--border); color: var(--muted); background: var(--surface); flex: 0 0 auto;
}
.job-stepper .stage .label { font-size: .85rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.job-stepper .stage.done .dot { border-color: var(--ok); background: var(--ok); color: #fff; }
.job-stepper .stage.done .label { color: var(--text); }
.job-stepper .stage.current .dot { border-color: var(--primary); color: var(--primary); background: var(--info-bg); }
.job-stepper .stage.current .label { color: var(--text); }
.job-stepper .stage.bad .dot { border-color: var(--danger); color: var(--danger); background: var(--danger-bg); }
.job-stepper .stage.bad .label { color: var(--danger); }
.job-stepper .stage-line { width: 1.75rem; height: 2px; background: var(--border); flex: 0 0 auto; }
.job-stepper .stage-line.done { background: var(--ok); }

/* Job overview progress chips (pick/pack/despatch design §5): four `progress_chip()` cells in a
row, each a label above its own badge — same .stats grid rhythm as the job-list stat tiles, but
left-aligned and badge-driven rather than a big number, since a chip's value is a state word, not
a count. */
.chip-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.chip-cell { display: flex; flex-direction: column; gap: .3rem; }
.chip-cell .chip-label { font-weight: 600; }

/* The job overview's "Pick · Pack · Despatch" big links (design §5): plain, oversized nav
buttons so the next step off this page reads as the headline action it is, not one more item in
the header's action bar. */
.big-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.big-links .btn { text-align: center; padding: 1rem; font-size: 1.05rem; font-weight: 600; }

/* "More actions" overflow menu: the job header used to show every action (export, re-run
checks, revise, delete) at the same weight as the one action that actually matters for the
job's current status. A <details>/<summary> disclosure, like .exception-group elsewhere in
this file — works with no JS at all, same as the rest of this app. */
details.menu-wrap { position: relative; display: inline-block; }
details.menu-wrap > summary { list-style: none; }
details.menu-wrap > summary::-webkit-details-marker { display: none; }
details.menu-wrap[open] > summary { background: var(--surface-hover); }
.menu {
  position: absolute; right: 0; top: calc(100% + .3rem); z-index: 20; min-width: 13rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(16,24,38,.16); padding: .3rem;
}
.menu form, .menu > a, .menu > button { display: block; width: 100%; text-align: left; margin: 0; }
.menu a, .menu button { border: 0; background: none; border-radius: 4px; padding: .5rem .6rem; width: 100%; text-align: left; color: var(--text); }
.menu a:hover, .menu button:hover { background: var(--surface-hover); }
.menu button.danger, .menu a.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: .3rem .2rem; }

/* Pick screen toolbar: filters, item-entry and output actions used to read as one undifferentiated
row. Grouping them into labelled clusters is a layout-only change — every control keeps its
existing name/id/hx attributes. */
.toolbar { display: flex; align-items: flex-end; gap: 1.1rem; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem .9rem; margin-bottom: 1rem; }
.toolbar select { width: auto; }
.toolbar .cluster { display: flex; flex-direction: column; gap: .3rem; }
.toolbar .cluster .cluster-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.toolbar .cluster .cluster-controls { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.toolbar .cluster.output { margin-left: auto; }
.toolbar .divider { width: 1px; align-self: stretch; background: var(--border); }

/* One dialog shape app-wide: a bordered header under the h2, a bordered footer above the
action row — "Add item", "Edit quantity" and "Change location" already share the same
h2 + form + .actions markup (see their own templates), this just makes that structure visible. */
dialog { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.15rem; max-width: 32rem; width: 90vw; }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog .dialog-close { float: right; }
dialog h2 { border-bottom: 1px solid var(--border); padding-bottom: .6rem; margin-bottom: .8rem; padding-right: 1.6rem; }
dialog .actions { margin-top: 1.1rem; padding-top: .75rem; border-top: 1px solid var(--border); justify-content: flex-end; }
@media print {
  .sidebar, .simbar, .flash, .page-head .actions, .no-print { display: none !important; }
  .app-shell { display: block; }
  .app-main { width: 100%; }
  main { padding: 0; margin: 0; }
  body { background: #fff; }
  table { page-break-inside: auto; }
  tr { page-break-inside: avoid; }
  .print-only { display: block; }
  .slip-page-header { display: block; margin-bottom: .5rem; }
  /* Grid item page-break behaviour is unreliable across print engines — force the panel grids
     back to plain block flow so each zone prints as a normal block-level sibling, same as
     before the pick screen used a grid at all. */
  .zone-grid { display: block; }
  .slip-zone-group { border: 0; padding: 0; background: transparent; }
  /* master-data-edit-and-pick-zones-spec.md section 5.5: each zone starts its own printed page,
     except the very first (no leading blank page). */
  .slip-zone-group { page-break-before: always; }
  .slip-zone-group:first-of-type { page-break-before: avoid; }
}

/* Unit dimensions display under unit name (_where_it_is, _package_card). */
.unit-dims { font-variant-numeric: tabular-nums; margin-top: .15rem; font-weight: 400; }
span.unit-dims { margin-top: 0; }
.actions-cell { white-space: nowrap; }

/* Pack screen (pick/pack/despatch design §4.3, §5's Pack row). Two columns of work — the queue
   (what still needs packing, what is staying in store) and the packages themselves — but only
   once there is room: one column below 1100px, and plain block flow in print (see @media print
   above, which the .pack-layout/.package-grid rules there reset for the same reason .zone-grid
   is reset). Controls get the same 2.75rem floor touch-target sizing as #pick-board — this is
   used on the warehouse floor too. */
.pack-layout { display: grid; gap: 1rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 1100px) { .pack-layout { grid-template-columns: minmax(22rem, 2fr) 3fr; } }
.pack-layout > div > .card:last-child { margin-bottom: 0; }
.package-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); align-items: start; }
.package-grid > .card { margin: 0; }
/* A package's state is carried by its badge's word and icon; the accent border is a second,
   redundant signal for scanning a wall of cards, never the only one. */
.package-card { border-left: 3px solid var(--primary); }
.package-card.is-closed { border-left-color: var(--neutral); background: var(--bg); }
.package-card.new-package { border: 1px dashed var(--border); background: transparent; }
.package-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.package-head h3 { margin: 0; font-size: 1.05rem; }
.package-foot { margin-top: .75rem; }
/* Each row's controls stack: packing a quantity and releasing it to a build bay are different
   decisions (one reversible, one not), so they never share a dropdown or sit on one line. */
.pack-line-actions { display: flex; flex-direction: column; gap: .4rem; }
.pack-release { border-top: 1px dashed var(--danger-border); padding-top: .4rem; }
#pack-board input[type=number], #pack-board select { min-height: 2.75rem; font-size: 1rem; }
#pack-board button { min-height: 2.75rem; min-width: 2.75rem; padding: .55rem 1rem; }
#pack-board .actions input.qty { width: 5.5rem; }
#pack-board .actions select { width: auto; max-width: 13rem; }
dialog#close-package-dialog input[type=number] { min-height: 2.75rem; font-size: 1rem; }
dialog#close-package-dialog button { min-height: 2.75rem; min-width: 2.75rem; padding: .55rem 1rem; }
/* Printed, the Pack screen is a list, not a dashboard: same reason .zone-grid is
   reset in the print block above (grid page-break behaviour is unreliable across engines). Its
   own block because these rules are declared after that one and would otherwise win. */
@media print {
  .pack-layout, .package-grid { display: block; }
  .package-card { margin-bottom: 1rem; page-break-inside: avoid; }
}

/* The Build card (pick/pack/despatch design §4.3, §4.4; Phase 4 plan task 5): a variant of
   .package-card, not a different thing, so it keeps that base rule's accent border and
   is-open/is-closed language — this only widens it to the full grid row (it is the one card a
   build job has exactly one of, and it can carry a nested-packages list no ordinary card does)
   and thickens its own accent border a touch so it reads as the special one among the row. */
.package-card.build-card { grid-column: 1 / -1; border-left-width: 5px; }
.build-card h4 { margin: 1rem 0 .4rem; font-size: .95rem; }
.build-nested-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.build-nested-item { border: 1px solid var(--border); border-radius: 6px; padding: .55rem .7rem; background: var(--bg); }
.build-nested-item .package-head { margin-bottom: .2rem; }
.build-nest .actions, .build-card .package-foot { flex-wrap: wrap; }
@media print {
  .package-card.build-card { grid-column: auto; }
}

/* The Despatch board (pick/pack/despatch design §5's Despatch board row; Phase 5 plan task 2):
   three tabs sharing one #despatch-board swap target, the same convention #pack-board already
   uses. The tab nav is rendered *inside* each tab's own fragment (despatch.py's module
   docstring), not the outer page shell, so an htmx tab switch keeps the active underline in
   sync with what actually swapped in. */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { padding: .55rem .9rem; border-radius: 6px 6px 0 0; color: var(--muted); font-weight: 600; text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { background: var(--surface-hover); color: var(--text); }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
/* A consignment/job card follows .package-card's own accent-border language (booked == open,
   despatched == closed), rather than inventing a second visual vocabulary for "state". */
.despatch-card { border-left: 3px solid var(--primary); }
.despatch-card.is-closed { border-left-color: var(--neutral); background: var(--bg); }
.despatch-cancel { border-top: 1px dashed var(--danger-border); padding-top: .6rem; margin-top: .75rem; }
