/* ============================================================
   v05 SHELL — shared by Orders list, Order detail, Place order
   and the Calendar month (which has its own variant inline).

   Locked-in defaults (cohesive across pages):
     • Ink sidebar (.hf-side, --sidebar-bg = ink-900)
     • Ink topbar (.hf-header, --topbar-bg = ink-900)
     • Warm canvas (--page-bg = #E8EAE6)
     • Dark-white active sidebar pill
     • Page title sits at top of sidebar (not in content)
     • Account block pinned to bottom of sidebar

   Per-page Tweaks can override these via :root inside the page.
   ============================================================ */

:root {
  /* Sidebar */
  --sidebar-bg: var(--enroute-ink-900);
  --sidebar-fg: rgba(255,255,255,0.65);
  --sidebar-fg-mute: rgba(255,255,255,0.40);
  --sidebar-fg-strong: #fff;
  --sidebar-hover-bg: rgba(255,255,255,0.06);
  --sidebar-border: #000;
  --sidebar-icon-opacity: 0.7;

  /* Topbar */
  --topbar-bg: var(--enroute-ink-900);
  --topbar-fg: rgba(255,255,255,0.55);
  --topbar-fg-strong: #fff;
  --topbar-fg-mute: rgba(255,255,255,0.50);
  --topbar-border: #000;

  /* Canvas */
  --page-bg: #E8EAE6;

  /* Motion */
  --dur-fast: 120ms;
  --dur-base: 220ms;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
}

html, body { background: var(--page-bg); }
body { font-family: var(--font-sans); }

/* a11y-visual-06: strong DEFAULT keyboard-focus indicator. Any control without
   its own :focus-visible rule gets a 2px solid green-700 outline (5.64:1 on
   white, computed). Controls that DO define one are more specific and keep
   their tuned look (white outlines on the dark chrome, var(--focus-ring) —
   itself now a hard ring — on the light-surface buttons). */
:focus-visible {
  outline: 2px solid var(--enroute-green-700);
  outline-offset: 2px;
}

/* ---------- Shell grid ---------- */
.hf-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 55px 1fr;
  min-height: 100vh;
  background: var(--page-bg);
}

/* ---------- Header (top chrome) ---------- */
.hf-header {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr max-content 1fr;
  align-items: center;
  gap: 28px;
  padding: 0 28px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  position: sticky; top: 0; z-index: 30;
  height: 55px;
}
.hf-header__title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--topbar-fg-strong);
  line-height: 1.05;
  margin: 0;
  text-decoration: none;
}
.hf-header__title .dot { color: var(--enroute-green-400); }
.hf-header__center {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: center;
  min-width: 0;
  max-width: 100%;
}
.hf-header__controls {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-self: end;
}

/* F147 top-right brand emblem slot REMOVED (JJ, 2026-06-10) — the .hf-emblem /
   .hf-emblem__ph placeholder styles were retired with the markup in base.html. */

/* Header utility label ("SHOW BY", "ROLE", etc.) */
.hf-hlabel {
  color: var(--topbar-fg);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-weight: 700;
  white-space: nowrap;
}

/* Header primary action (lives in topbar right cluster) */
.hf-hbtn {
  appearance: none;
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px 7px 11px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.005em;
  /* a11y-visual-02: white 13px label needs >=4.5:1 — green-700 CTA fill (5.64:1). */
  background: var(--cta-bg);
  color: #fff;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.hf-hbtn:hover { background: var(--cta-bg-hover); }
.hf-hbtn svg { width: 14px; height: 14px; }

.hf-hbtn--ghost {
  background: rgba(255,255,255,0.06);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
}
.hf-hbtn--ghost:hover { background: rgba(255,255,255,0.12); }
/* F120/F099 (critical): the header CTA lives on the dark ink-900 topbar where a
   green ring is barely perceivable (≈1.x:1), so use a LIGHT high-contrast outline
   plus the brand ring. Covers both the primary header button and its ghost variant. */
.hf-hbtn:focus-visible {
  outline: 2px solid var(--sidebar-fg-strong);   /* #fff on the dark topbar */
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

/* Header search (used by Orders list + Order detail) */
.hf-search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-pill);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.10);
  min-width: 320px;
  max-width: 100%;
}
.hf-search:focus-within {
  background: rgba(255,255,255,0.10);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.22);
}
.hf-search svg { width: 14px; height: 14px; color: rgba(255,255,255,0.5); flex: none; }
.hf-search input {
  background: transparent;
  border: 0;
  outline: 0;
  color: #fff;
  font: inherit;
  font-size: 13px;
  flex: 1;
  min-width: 0;
}
.hf-search input::placeholder { color: rgba(255,255,255,0.45); }

/* feat-operator-05: internal quick-find — compact topbar variant of .hf-search.
   Desktop only; mobile.css hides it ≤1024 (the sidebar/drawer Find form takes
   over there). Compact so it never crowds page-specific header CTAs. */
.hf-find { min-width: 200px; max-width: 260px; }

/* feat-operator-05: sidebar quick-find (the ≤1024 drawer home of the jump box).
   Hidden on desktop — mobile.css reveals it inside the drawer. Reuses the
   sidebar label style for its "Find" caption. */
.hf-side__find { display: none; padding: 0 10px 4px; }
.hf-side__find .hf-side__label { padding: 14px 0 6px; }
.hf-side__find-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--sidebar-fg-strong);
  background: rgba(255,255,255,0.06);
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.10);
  outline: 0;
}
.hf-side__find-input:focus-visible {
  background: rgba(255,255,255,0.10);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.22);
}
.hf-side__find-input::placeholder { color: var(--sidebar-fg-mute); }

/* Breadcrumb / title cluster in header center for non-calendar pages */
.hf-bc {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  color: var(--topbar-fg);
  font-size: 13px;
  font-weight: 600;
}
.hf-bc strong {
  color: var(--topbar-fg-strong);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.hf-bc .sep { color: var(--topbar-fg-mute); font-weight: 400; }

/* ---------- Sidebar ---------- */
.hf-side {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  padding: 0 10px 14px;
  display: flex; flex-direction: column;
  gap: 2px;
  /* The shell grid (.hf-shell) reserves a 55px header row, and the sidebar lives
     in the row BELOW it. height:100vh made the sidebar a full viewport tall while
     offset 55px down, pushing its bottom (the account block / avatar) below the
     fold. Fill only the space under the header and stick there. */
  position: sticky; top: 55px;
  height: calc(100vh - 55px);
  overflow-y: auto;
}
.hf-side__logo {
  height: 55px;
  display: flex; align-items: center;
  padding: 0 8px;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--sidebar-fg-strong);
  text-decoration: none;
  margin-bottom: 4px;
}
.hf-side__logo .dot { color: var(--enroute-green-400); }
.hf-side__pagetitle { font-size: 20px; }
.hf-side__pagetitle small {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sidebar-fg-mute);
  margin-top: -1px;
}

.hf-side__spacer { flex: 1 1 auto; min-height: 12px; }

.hf-side__account {
  /* Pin the account block to the bottom of the scrolling sidebar so the avatar
     is ALWAYS reachable, even when the nav list overflows a short viewport
     (sticky also establishes the containing block the popped-above menu anchors
     to). The opaque sidebar fill keeps scrolling nav rows from showing through. */
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  padding-top: var(--space-3);
  /* 0.06 (--sidebar-hover-bg) was effectively invisible on ink-900 chrome;
     0.12 makes the account block a perceptible, deliberate break from the nav. */
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  margin-top: var(--space-2);
}

/* account-menu feat: the avatar + name button that toggles the account dropdown.
   Its OWN class (not .hf-side__item) so mobile.js does not auto-close the drawer
   when the avatar is tapped. Resets native <button> chrome. */
.hf-acct-trigger {
  display: flex; align-items: center; gap: 11px;
  width: 100%; box-sizing: border-box;
  padding: 8px 10px;
  min-height: 44px;   /* ADR 0005: >=44px tap target (UX-24) */
  border-radius: var(--radius-md);
  background: none; border: 0; cursor: pointer;
  color: var(--sidebar-fg); font-family: inherit; text-align: left;
}
.hf-acct-trigger:hover { background: var(--sidebar-hover-bg); }
.hf-acct-trigger:hover .hf-acct-trigger__name { color: var(--sidebar-fg-strong); }
/* F120: the dark sidebar makes the UA outline ~1.03:1; use the light inset
   outline so keyboard focus is visible (matches .hf-side__item). */
.hf-acct-trigger:focus-visible {
  outline: 2px solid var(--sidebar-fg-strong);
  outline-offset: -2px;
  border-radius: var(--radius-md);
}
.hf-acct-trigger__name {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px; font-weight: 600; color: var(--sidebar-fg);
}
.hf-acct-trigger__caret {
  width: 14px; height: 14px; flex-shrink: 0;
  opacity: 0.6; transition: transform var(--dur-base);
}
.hf-acct-trigger[aria-expanded="true"] .hf-acct-trigger__caret { transform: rotate(180deg); }

/* The initials chip. Decorative (aria-hidden) — the name text is the
   accessible identity, so the white-on-gradient contrast is not load-bearing. */
.hf-avatar {
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--avatar-gradient);
  color: var(--avatar-fg);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
}

/* The account dropdown: a paper card popping ABOVE the trigger (the account
   block sits at the sidebar bottom). Mirrors the .oactx-menu recipe so the
   app's two menus stay visually consistent.
   NOTE: position:absolute inside .hf-side (overflow-y:auto) means a much TALLER
   menu could be clipped by the scroll container on a short viewport. Fine for
   the current 2 items; if this grows past ~4, switch to position:fixed + a JS
   clamp like order-actions-menu.js place(). */
.hf-acct-menu {
  position: absolute;
  bottom: calc(100% + 6px); left: 0; right: 0;
  z-index: 1000;
  background: var(--bg-paper);
  border: 1px solid var(--border-1);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(10, 13, 11, 0.16);
  padding: 6px;
}
.hf-acct-menu[hidden] { display: none; }
.hf-acct-menu form { margin: 0; }
.hf-acct-menu__item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; box-sizing: border-box;
  padding: 8px 10px;
  min-height: 44px;   /* ADR 0005: >=44px tap target (UX-24) */
  border: 0; border-radius: 7px;
  background: transparent; color: var(--fg-1);
  font: inherit; text-align: left; text-decoration: none; cursor: pointer;
}
.hf-acct-menu__item svg { width: 17px; height: 17px; flex-shrink: 0; color: var(--fg-3); }
.hf-acct-menu__item:hover { background: var(--enroute-ink-100); }
.hf-acct-menu__item:hover svg { color: var(--fg-2); }
/* Paper-surface focus ring (the menu pops onto paper, not the dark sidebar).
   box-shadow form — `outline: var(--focus-ring)` is invalid (it's a shadow). */
.hf-acct-menu__item:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.hf-side__label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--sidebar-fg-mute); font-weight: 700;
  padding: 14px 10px 6px;
}
.hf-side__label:first-child { padding-top: 4px; }
.hf-side__item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px;
  min-height: 44px;   /* ADR 0005: >=44px tap target (UX-24) */
  box-sizing: border-box;
  border-radius: var(--radius-md);
  font-size: 13.5px; font-weight: 500;
  color: var(--sidebar-fg);
  text-decoration: none;
  white-space: nowrap;
  transition: background 100ms, color 100ms;
}
.hf-side__item:hover { background: var(--sidebar-hover-bg); color: var(--sidebar-fg-strong); }
/* F120 (critical): keyboard focus on the sidebar nav was invisible — the UA
   outline on the ink-900 sidebar computes to ~1.03:1. Use a LIGHT (white) outline
   so the focused item is clearly visible against the dark sidebar. */
.hf-side__item:focus-visible {
  outline: 2px solid var(--sidebar-fg-strong);
  outline-offset: -2px;   /* inset so the ring stays within the 240px sidebar */
  border-radius: var(--radius-md);
}
/* The active item has a paper-white background, so a white ring would blend —
   draw it in dark ink instead. */
.hf-side__item--active:focus-visible {
  outline-color: var(--enroute-ink-900);
}
.hf-side__item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: var(--sidebar-icon-opacity); }
.hf-side__item:hover svg { opacity: 1; }
.hf-side__item--active,
.hf-side__item--active:hover {
  background: var(--bg-paper);
  color: var(--enroute-ink-900);
  font-weight: 700;
}
.hf-side__item--active svg { opacity: 1; }
.hf-side__item__count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255,255,255,0.10);
  color: var(--sidebar-fg-strong);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-variant-numeric: tabular-nums;
}
.hf-side__item--active .hf-side__item__count {
  background: rgba(10,13,11,0.08);
  color: var(--enroute-ink-900);
}

/* ---------- Main content shell ---------- */
.hf-main { padding: 18px; min-width: 0; }

/* ---------- Status pill (3-bucket palette, locked) ---------- */
.st-pill {
  display: inline-flex; align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  background: var(--st-bg);
  color: var(--st-fg);
  white-space: nowrap;
  --st-bg: var(--enroute-ink-100);
  --st-fg: var(--enroute-ink-700);
  --st-dot: var(--enroute-ink-400);
}
.st-pill .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--st-dot);
}
.st-pill.s-pending,
.st-pill.s-accepted   { --st-bg: var(--enroute-amber-50); --st-fg: var(--enroute-amber-800); --st-dot: var(--enroute-amber-500); }
.st-pill.s-loading,
.st-pill.s-transit    { --st-bg: var(--enroute-green-50); --st-fg: var(--enroute-green-800); --st-dot: var(--enroute-green-500); }
.st-pill.s-delivered,
.st-pill.s-invoiced   { --st-bg: var(--enroute-ink-100); --st-fg: var(--enroute-ink-700); --st-dot: var(--enroute-ink-400); }
.st-pill.s-cancelled  { --st-bg: var(--enroute-rose-100); --st-fg: var(--enroute-rose-700); --st-dot: var(--enroute-rose-500); }
/* draft-orders (ADR 0046): the pre-placement "Draft" pill — muted neutral with a
   DASHED border (provisional, not yet live), token-driven (no raw values). */
.st-pill.s-draft {
  --st-bg: var(--draft-bg);
  --st-fg: var(--draft-fg);
  --st-dot: var(--enroute-ink-400);
  border: 1px dashed var(--draft-border);
}

/* Quiet inline status (used in tables): just dot + label, no chip background */
.st-inline {
  display: inline-flex; align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg-1);
  white-space: nowrap;
}
.st-inline .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--enroute-ink-400);
  flex: none;
}
.st-inline.s-pending .dot,
.st-inline.s-accepted .dot   { background: var(--enroute-amber-500); }
.st-inline.s-loading .dot,
.st-inline.s-transit .dot    { background: var(--enroute-green-500); }
.st-inline.s-delivered .dot,
.st-inline.s-invoiced .dot   { background: var(--enroute-ink-400); }
.st-inline.s-cancelled .dot  { background: var(--enroute-rose-500); }

/* ---------- Primary surface (cards / panels) ---------- */
.surface {
  background: var(--bg-paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.surface--quiet {
  background: var(--bg-canvas);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 0 0 1px var(--border-1);
}

/* ---------- Buttons ---------- */
.btn {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  border: 0;
  background: var(--enroute-ink-100);
  color: var(--enroute-ink-900);
  text-decoration: none;
  white-space: nowrap;
  transition: background 100ms;
  min-height: 36px;
}
.btn:hover { background: var(--enroute-ink-200); }
/* submit-once guard: a submitted form's buttons disable until the response
   lands (8s disarm) — dim + lock the cursor so the wait state is visible. */
.btn:disabled, .btn:disabled:hover, .hf-hbtn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; }
.btn--primary {
  /* a11y-visual-02: white 13px label needs >=4.5:1 — green-700 CTA fill (5.64:1). */
  background: var(--cta-bg);
  color: #fff;
}
.btn--primary:hover { background: var(--cta-bg-hover); }
.btn--outline {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--border-2);
  color: var(--fg-1);
}
.btn--outline:hover { background: var(--enroute-ink-100); box-shadow: inset 0 0 0 1px var(--border-3); }
.btn--danger {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--enroute-rose-200);
  color: var(--enroute-rose-700);
}
.btn--danger:hover { background: var(--enroute-rose-50); box-shadow: inset 0 0 0 1px var(--enroute-rose-400); }
/* Tweak 061: amber "Change <doc type>" button shown once a document exists. */
.btn--change {
  background: var(--enroute-amber-500);
  color: var(--enroute-amber-800);
}
.btn--change:hover { filter: brightness(0.95); }
.btn--ghost {
  background: transparent;
  color: var(--fg-2);
}
.btn--ghost:hover { background: var(--enroute-ink-100); color: var(--fg-1); }
.btn--lg { padding: 12px 18px; font-size: 14px; min-height: 44px; }
.btn--block { width: 100%; justify-content: center; }
/* F120/F008/F054 (critical): visible keyboard focus on every button.
   `.btn` had no :focus-visible, so keyboard focus fell back to the UA outline
   (invisible on dark chrome / brand fills). Brand-press outline (≈5.6:1 on paper)
   + the soft brand ring is the canonical pattern (see .ol-qf-chip). Variants that
   carry a brand-green or rose fill swap to a LIGHT/tinted outline so the ring is
   perceivable against the coloured fill rather than blending in. */
.btn:focus-visible {
  outline: 2px solid var(--brand-press);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}
.btn--primary:focus-visible,
.btn--change:focus-visible {
  outline-color: var(--enroute-green-50);
}
.btn--danger:focus-visible {
  outline-color: var(--enroute-rose-700);
}

/* ---------- Form atoms ---------- */
.fld { display: flex; flex-direction: column; gap: 6px; }
.fld__lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  /* F128: fg-3 (ink-400) is ≈4.6:1 at 11px — borderline AA with no margin. Use
     fg-2 (ink-600) for a comfortable AA pass at this small uppercase size. */
  color: var(--fg-2);
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.fld__lbl em {
  font-style: normal;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  color: var(--fg-4);
}
/* UX-37: distinguish the "required" marker from the muted "optional" one so
   mandatory fields are scannable. Required reads in the brand ink at a slightly
   heavier weight; optional keeps the quiet --fg-4 treatment above. */
.fld__lbl em.req {
  color: var(--brand);
  font-weight: 600;
}
/* F056: make the required marker brand-green GLOBALLY (a control-layer style),
   not just where a template remembered to add `class="req"`. Any `.fld` whose
   control is [required] gets a brand-green, slightly heavier label marker —
   so auth/onboarding/location forms that still use the plain `<em>required</em>`
   pick up the cue without per-template edits. Optional fields (no [required])
   keep the muted --fg-4 treatment above. */
.fld:has(:required) .fld__lbl em {
  color: var(--brand);
  font-weight: 600;
}
.fld__hint {
  font-size: 12px;
  color: var(--fg-3);
}
.fld__ctrl,
.fld input[type="text"],
.fld input[type="number"],
.fld input[type="date"],
.fld input[type="time"],
.fld input[type="email"],
.fld input[type="tel"],
.fld input[type="search"],
.fld input[type="password"],
.fld input[type="url"],
.fld input[type="datetime-local"],
.fld input[type="month"],
.fld input[type="week"],
.fld select,
.fld textarea {
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 0;
  background: var(--bg-paper);
  box-shadow: inset 0 0 0 1px var(--border-2);
  color: var(--fg-1);
  outline: 0;
  min-height: 44px;   /* ADR 0005: >=44px tap target (UX-24) */
  min-width: 0;
  width: 100%;
}
.fld textarea { min-height: 88px; resize: vertical; line-height: 1.5; }
.fld select { appearance: none; padding-right: 32px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='none' stroke='%23232825' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1l4 4 4-4'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center;
}
/* a11y-code-14: the focused field's outer ring was 3px at 6%-alpha black —
   imperceptible on the white card, leaving only a 1px border-colour change as
   the focus cue. Keep the soft 1px ink inner border, wire the OUTER ring
   through the shared var(--focus-ring) (now a hard white+green-700 pair),
   matching .app-input:focus and the rest of the design system. */
.fld input:focus,
.fld select:focus,
.fld textarea:focus {
  box-shadow: inset 0 0 0 1px var(--enroute-ink-700), var(--focus-ring);
}
.fld--inline { display: grid; grid-template-columns: minmax(120px, 180px) 1fr; gap: 12px 16px; align-items: center; }
.fld--inline .fld__lbl { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 600; color: var(--fg-1); }

/* Native checkbox / radio row: brand-coloured control + a same-line label.
   Use .fld--check for [checkbox | label] rows; .fld--inline's grid columns
   assume the opposite order ([label | input]) and misalign the box. */
.fld--check { display: flex; align-items: center; gap: 10px; flex-direction: row; }
.fld--check .fld__lbl { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 500; color: var(--fg-1); margin: 0; }
.fld input[type="checkbox"],
.fld input[type="radio"] {
  width: 18px; height: 18px; flex: none; margin: 0;
  accent-color: var(--brand); cursor: pointer;
}

/* Inline composite control: two inputs glued together (eg "R/L" prefix) */
.fld__ctrl--combo {
  display: flex; align-items: stretch;
  background: var(--bg-paper);
  box-shadow: inset 0 0 0 1px var(--border-2);
  border-radius: var(--radius-md);
  overflow: hidden;
  min-height: 40px;
}
.fld__ctrl--combo > input {
  border: 0; outline: 0; background: transparent;
  padding: 10px 12px;
  font-size: 14px;
  flex: 1;
  min-width: 0;
}
.fld__ctrl--combo > .fld__affix {
  display: inline-flex; align-items: center; padding: 0 12px;
  background: var(--bg-sunken);
  color: var(--fg-3);
  font-size: 12.5px; font-weight: 600;
  border-left: 1px solid var(--border-1);
  font-family: var(--font-mono);
}
.fld__ctrl--combo > .fld__affix--lead {
  border-left: 0; border-right: 1px solid var(--border-1);
}

/* ---------- Drawer (slide-in) ---------- */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(10,13,11,0.32);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out);
  z-index: 80;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0;
  height: 100vh;
  width: 380px;
  max-width: 100vw;
  background: var(--bg-paper);
  box-shadow: -12px 0 32px rgba(10,13,11,0.18);
  transform: translateX(100%);
  /* a11y-code-03: a closed off-canvas drawer kept all its fields/buttons in
     the Tab order (it was only translated off-screen). visibility:hidden drops
     them out; the 0s visibility flip is DELAYED by --dur-base on close so the
     slide-out animation still plays, and undelayed on open. Belt-and-braces
     with the `inert` attribute toggled in mobile.js. */
  visibility: hidden;
  transition: transform var(--dur-base) var(--ease-out),
              visibility 0s linear var(--dur-base);
  z-index: 90;
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); visibility: visible; transition-delay: 0s; }
.drawer__hd {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-1);
  display: flex; align-items: center; justify-content: space-between;
}
.drawer__hd h2 { margin: 0; font-size: 16px; font-weight: 700; }
.drawer__close {
  appearance: none; background: transparent; border: 0; cursor: pointer;
  width: 30px; height: 30px; border-radius: var(--radius-md);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--fg-2);
}
.drawer__close:hover { background: var(--enroute-ink-100); color: var(--fg-1); }
.drawer__body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.drawer__ft {
  padding: 14px 18px;
  border-top: 1px solid var(--border-1);
  display: flex; gap: 10px;
  background: var(--bg-canvas);
}
.drawer__ft .btn { flex: 1; justify-content: center; }

/* ============================================================
   FORM SHELL — used by Request location / Import orders / Export
   orders / Document upload / Accept / Amend / Cancel pages.
   Single centered card for "context-free" forms; +sticky right rail
   for order-scoped forms.
   ============================================================ */

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
  max-width: 1100px;
  margin: 0 auto;
}
.form-grid--solo {
  display: block;
  max-width: 720px;
  margin: 0 auto;
}
.form-intro {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: var(--space-5);
  /* No inline padding: the intro must share the form-card's exact left/right
     edges (both are max-width:1100px + margin:0 auto inside .hf-main). The old
     0 24px pushed the heading 24px off the card's left rule, visible on wide
     screens once both bands reach max-width and centre. */
  padding: 0 0 var(--space-3);
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}
.form-intro--solo { max-width: 720px; }
/* Full-bleed page header: left-aligns to the content edge instead of centring.
   Use on pages whose body is NOT a centred .form-grid — lists, tables,
   dashboards, a bare full-width .form-card. The default .form-intro centres
   itself at max-width:1100px to share a centred .form-grid's edges; over
   full-bleed content that centring makes the heading drift RIGHT of everything
   below it by (content_width - 1100)/2, worsening as the screen widens. --flush
   removes the cap + centring so the heading sits on the content's left rule.
   The intro's band MUST match its body's band — guarded by
   tests/conformance/test_form_intro_alignment.py. */
.form-intro--flush { max-width: none; margin-inline: 0; }
.form-intro__copy h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0 0 4px;
}
.form-intro__copy p {
  font-size: 13.5px;
  color: var(--fg-3);
  margin: 0;
  max-width: 64ch;
}
.form-intro__actions { display: flex; gap: var(--space-2); }
/* F012: shared mono/muted record id for a page-intro H1 (e.g. "Update ETA #1234").
   Promoted here from loads-cancel.css so EVERY form page — loads and orders — shares
   one source instead of re-inlining the font/colour/size run (which had drifted). */
.form-intro__id {
  font-family: var(--font-mono);
  color: var(--fg-3);
  font-weight: 500;
  font-size: 22px;
}

.form-card {
  background: var(--bg-paper);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column;
  gap: 18px;
  min-width: 0;
}
.form-card__hd {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px;
  margin-bottom: -2px;
}
.form-card__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--fg-1);
  letter-spacing: -0.01em;
  margin: 0;
  display: inline-flex; align-items: baseline; gap: 8px;
}
.form-card__title .step {
  display: inline-flex;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--enroute-ink-900);
  color: #fff;
  font-size: 11px; font-weight: 700;
  align-items: center; justify-content: center;
  letter-spacing: 0;
}
.form-card__sub {
  font-size: 12px;
  color: var(--fg-3);
  font-weight: 500;
}
.form-card__actions {
  display: flex; gap: 10px;
  justify-content: flex-end;
  margin-top: 6px;
}
.form-card__actions .btn { min-height: 44px; }
.form-card__empty {
  margin: 0;
  font-size: 13px;
  color: var(--fg-3);
}

.form-row { display: grid; gap: 14px 18px; grid-template-columns: 1fr; }
.form-row--2 { grid-template-columns: 1fr 1fr; }
.form-row--3 { grid-template-columns: 1fr 1fr 1fr; }

/* Context card (sticky right rail, parent-order summary etc.) */
.ctx-card {
  background: var(--bg-paper);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column;
  gap: 4px;
  position: sticky; top: 73px;
}
.ctx-card__lbl {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--fg-3);
  margin: 0 0 6px;
}
.ctx-card__id {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  color: var(--fg-1);
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.ctx-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-1);
  gap: 12px;
  font-size: 12.5px;
}
.ctx-row:last-of-type { border-bottom: 0; }
.ctx-row .lbl { color: var(--fg-3); font-weight: 500; }
.ctx-row .val { color: var(--fg-1); font-weight: 600; text-align: right; max-width: 60%; }
.ctx-row .val.mono { font-family: var(--font-mono); }

/* ============================================================
   ROLE-SCOPED HIDING (shared so every page can use it)
   Add .role-internal-only, .role-client-only, .role-transporter-only,
   or the inverse hide-* utilities to any element. The page's <body>
   needs data-role="internal" | "client" | "transporter".
   ============================================================ */
[data-role="client"]      .role-hide-client      { display: none !important; }
[data-role="transporter"] .role-hide-transporter { display: none !important; }
[data-role="internal"]    .role-hide-internal    { display: none !important; }

.role-internal-only { display: none; }
[data-role="internal"] .role-internal-only { display: revert; }

.role-client-only { display: none; }
[data-role="client"] .role-client-only { display: revert; }

.role-transporter-only { display: none; }
[data-role="transporter"] .role-transporter-only { display: revert; }

/* Role pill (e.g. shown next to a field that's role-gated) */
.role-pill {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  vertical-align: middle;
  margin-left: 6px;
  white-space: nowrap;
}
.role-pill--internal   { background: var(--enroute-cobalt-100); color: var(--enroute-cobalt-700); }
.role-pill--client     { background: var(--enroute-amber-100);  color: var(--enroute-amber-800); }
.role-pill--transporter{ background: var(--enroute-violet-100);                    color: var(--enroute-violet-700); }
