/* C-O-G-S — design system
   Palette is the validated dataviz reference instance; chart surfaces match it exactly. */

:root {
  color-scheme: light;
  --plane:        #f9f9f7;
  --surface:      #fcfcfb;
  --surface-2:    #f2f2ef;
  --surface-3:    #e9e9e4;
  --ink:          #0b0b0b;
  --ink-2:        #52514e;
  --ink-3:        #898781;
  --line:         #e1e0d9;
  --line-2:       #c3c2b7;
  --ring:         rgba(11, 11, 11, .10);

  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;

  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --good-ink: #006300;

  /* the -l / -d slots are what an organization's brand colour lands in, after
     it has been checked for contrast; the literals are the default theme */
  --accent: var(--accent-l, #2a78d6);
  --accent-ink: var(--accent-ink-l, #fff);
  --accent-soft: var(--accent-soft-l, #eaf2fd);

  --r: 10px; --r-sm: 7px; --r-lg: 14px;
  --sh-1: 0 1px 2px rgba(11,11,11,.05), 0 0 0 1px var(--ring);
  --sh-2: 0 4px 14px rgba(11,11,11,.09), 0 0 0 1px var(--ring);
  --sh-3: 0 18px 50px rgba(11,11,11,.20), 0 0 0 1px var(--ring);
  --edge-sh: rgba(11,11,11,.16);
  --nav-w: 232px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --plane: #0d0d0d; --surface: #1a1a19; --surface-2: #222221; --surface-3: #2c2c2a;
    --ink: #fff; --ink-2: #c3c2b7; --ink-3: #898781;
    --line: #2c2c2a; --line-2: #383835; --ring: rgba(255,255,255,.10);
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --good-ink: #0ca30c;
    --accent: var(--accent-d, #3987e5);
    --accent-ink: var(--accent-ink-d, #fff);
    --accent-soft: var(--accent-soft-d, #14283d);
    --sh-1: 0 1px 2px rgba(0,0,0,.4), 0 0 0 1px var(--ring);
    --sh-2: 0 4px 14px rgba(0,0,0,.45), 0 0 0 1px var(--ring);
    --sh-3: 0 18px 50px rgba(0,0,0,.6), 0 0 0 1px var(--ring);
    --edge-sh: rgba(0,0,0,.55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --plane: #0d0d0d; --surface: #1a1a19; --surface-2: #222221; --surface-3: #2c2c2a;
  --ink: #fff; --ink-2: #c3c2b7; --ink-3: #898781;
  --line: #2c2c2a; --line-2: #383835; --ring: rgba(255,255,255,.10);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --good-ink: #0ca30c;
  --accent: var(--accent-d, #3987e5);
  --accent-ink: var(--accent-ink-d, #fff);
  --accent-soft: var(--accent-soft-d, #14283d);
  --sh-1: 0 1px 2px rgba(0,0,0,.4), 0 0 0 1px var(--ring);
  --sh-2: 0 4px 14px rgba(0,0,0,.45), 0 0 0 1px var(--ring);
  --sh-3: 0 18px 50px rgba(0,0,0,.6), 0 0 0 1px var(--ring);
  --edge-sh: rgba(0,0,0,.55);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* ── Holding the app still ───────────────────────────────────────────────────
   Three separate things were letting the app drift inside the window on a
   phone, and they are three separate fixes.

   1. `dvh` is the *dynamic* viewport height, and it is dynamic on purpose: it
      changes the instant a browser bar slides away or a keyboard opens. Every
      one of those changes relaid out the shell, which is the lurch you see when
      you tap into a field. `svh` is the small viewport — the height with all
      the chrome showing — and it never changes, so nothing relaid out. The app
      is now measured against a ruler that holds still.

   2. Anything one pixel too wide makes the whole document horizontally
      scrollable, and a page that can pan sideways feels exactly like an app
      sliding around in its window. `overflow-x: clip` refuses the pan without
      creating a scroll container (which `hidden` would, and which would break
      every `position: sticky` inside it).

   3. The top bar and the tab bar are sticky and fixed, and during an iOS
      rubber-band both are repainted a frame late — they visibly lag the content
      and then snap back. Promoting them to their own compositor layer means the
      rubber-band moves the content underneath them and they are never redrawn
      at all. */
html {
  /* On the root, not on body: an overflow set on body propagates to the viewport
     only while the root is `visible`, so putting it here is the one placement
     that reliably holds. `clip` and not `hidden` because `hidden` makes this a
     scroll container, and a scroll container re-anchors every `position: sticky`
     inside it — which would quietly unstick the top bar. */
  overflow-x: clip;
  overscroll-behavior: none;
}
html, body { margin: 0; padding: 0; }
body {
  background: var(--plane); color: var(--ink);
  font-family: var(--font); font-size: var(--t-body); line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  max-width: 100%;
}
/* Tracking and leading are size-specific: large type reads too loose at 0, small
   type reads too tight. One value across the scale is wrong at one end or both. */
h1, h2, h3, h4 { margin: 0; font-weight: 650; }
h1 { letter-spacing: -.022em; line-height: 1.15; }
h2 { letter-spacing: -.016em; line-height: 1.25; }
h3 { letter-spacing: -.011em; line-height: 1.3; }
h4 { letter-spacing: -.005em; line-height: 1.35; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: var(--t-body); }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--ink-3); }
.dim { color: var(--ink-2); }
.tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------------ layout */
#app { min-height: 100svh; }
.shell { display: grid; grid-template-columns: var(--nav-w) 1fr; min-height: 100svh; }
.main { min-width: 0; padding: 0 0 96px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 22px 20px 0; }
.wrap-narrow { max-width: 720px; margin: 0 auto; padding: 18px 16px 0; }

/* sidebar (desktop) */
/* The sidebar is a floating layer, not a slab: translucent with the page
   travelling underneath it, which is what gives an interface depth without
   drawing a single extra line. The solid background underneath is the fallback
   for a browser with no backdrop-filter, and for anyone who has asked for less
   transparency. */
.side {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100svh;
}
@supports (backdrop-filter: blur(1px)) {
  .side {
    background: color-mix(in srgb, var(--surface) 72%, transparent);
    backdrop-filter: blur(22px) saturate(180%);
  }
}
.side-top { padding: 18px 16px 12px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.02em; font-size: 16px; }
.brand-mk {
  width: 26px; height: 26px; border-radius: var(--r-sm); flex: none;
  background: linear-gradient(145deg, var(--s1), var(--s7)); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 800;
}
.org-pick {
  margin: 12px 0 0; width: 100%; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 7px 9px; font-size: 13px; font-weight: 550;
}
/* The scroll edge effect: the list fades where there is more of it, and only
   where there is more of it, so the affordance appears exactly when it is true. */
.nav {
  padding: 6px 10px; display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto; flex: 1; scrollbar-width: thin;
  mask-image: linear-gradient(to bottom, transparent 0, #000 14px,
                              #000 calc(100% - 18px), transparent 100%);
}
/* A group label is a hairline and a word, not a word floating in space. The rule
   stops short of the left edge so it aligns with the labels, not the icons. */
.nav-lbl {
  font-size: 10.5px; letter-spacing: .085em; text-transform: uppercase;
  color: var(--ink-3); padding: 18px 8px 6px; font-weight: 650;
  margin-top: 6px; border-top: 1px solid var(--line);
}
.nav-lbl:first-child { border-top: 0; margin-top: 0; padding-top: 6px; }

/* Every row carries the accent rail; only the current one shows it. Animating a
   transform rather than appearing from nowhere means the marker travels. */
.nav a {
  position: relative;
  display: flex; align-items: center; gap: 11px; padding: 8px 10px;
  border-radius: 9px; color: var(--ink-2); font-size: 14px; font-weight: 500;
  transition: background .14s ease, color .14s ease;
}
.nav a::before {
  content: ""; position: absolute; left: -4px; top: 50%;
  width: 3px; height: 17px; border-radius: 2px; background: var(--accent);
  transform: translate(0, -50%) scaleY(0); transform-origin: center;
  transition: transform .18s cubic-bezier(.3, .9, .3, 1);
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
/* Response lives on the press, not the release (apple-design §1). */
.nav a:active { background: var(--surface-3); transform: scale(.985); }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a.on::before { transform: translate(0, -50%) scaleY(1); }
.nav a.on svg { color: var(--accent); }
/* A fixed slot, so labels line up down the column whatever shape the glyph is. */
.nav svg { width: 18px; height: 18px; flex: none; color: var(--ink-3); }
.nav .cnt { margin-left: auto; font-size: var(--t-micro); font-weight: 700; background: var(--surface-3); color: var(--ink-2); padding: 1px 6px; border-radius: 20px; }
.side-btm { padding: 10px; border-top: 1px solid var(--line); }
.who { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: var(--r-sm); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--surface-3); color: var(--ink-2); font-size: var(--t-micro); font-weight: 700;
}

/* top bar (mobile) */
.topbar {
  display: none; position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line); padding: 10px 14px;
  align-items: center; gap: 10px;
  /* --sat, not env(), and that is the point.
     iOS re-evaluates env(safe-area-inset-top) as Safari collapses and expands
     its toolbar during a scroll. Used directly here it changes the bar's
     padding mid-scroll, so the bar changes HEIGHT while somebody is looking at
     it -- which reads as the header moving around. --sat is measured once at
     launch and again only on rotation, never on scroll. */
  padding-top: max(10px, var(--sat, env(safe-area-inset-top)));
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  /* NO transform and NO will-change here, deliberately.
     They were added to give the bar its own compositor layer so an overscroll
     would scroll content underneath it rather than repaint it a frame late.
     On a `position: sticky` element that does the opposite: promoting it moves
     the sticky offset onto the compositor, which updates it asynchronously
     during a momentum scroll, so the bar visibly drifts and then snaps back.
     Combined with the sticky element sitting inside a grid (.shell), it is the
     standard recipe for a header that wanders while the page scrolls.
     Sticky bars are already composited by every engine that matters; asking
     for it again is what broke it. */
}
.tabbar { display: none; }

@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { display: flex; }
  .wrap, .wrap-narrow { padding: 14px 14px 0; }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + var(--sab, env(safe-area-inset-bottom)));
    transform: translateZ(0);
    will-change: transform;
  }
  .tabbar a, .tabbar .tab-menu {
    display: grid; justify-items: center; align-content: center; gap: 3px;
    padding: 5px 2px; min-width: 0; background: none; border: 0; cursor: pointer;
    font: inherit; font-size: 10.5px; font-weight: 600; letter-spacing: 0;
    color: var(--ink-3); border-radius: var(--r-sm);
  }
  /* four fixed tracks at 390px give ~95px each; a label that still will not fit
     is trimmed rather than allowed to widen its track and push the bar sideways */
  .tabbar a span, .tabbar .tab-menu span {
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .tabbar a svg, .tabbar .tab-menu svg { width: 21px; height: 21px; }
  .tabbar a.on, .tabbar .tab-menu.on { color: var(--accent); }
  .tabbar a:active, .tabbar .tab-menu:active { background: var(--surface-2); }
  .main { padding-bottom: 108px; }
  /* keep the wizard rail on one line: only the current step keeps its label */
  .steps { gap: 4px; flex-wrap: nowrap; }
  .step span { display: none; }
  .step.on span { display: inline; }
  .step-bar { min-width: 8px; }
}

/* ------------------------------------------------------------------ pieces */
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.card-p { padding: 16px 18px; }
.card-h {
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card-h h2 { flex: 1; min-width: 120px; }
/* an icon sitting directly in a card header must not flex to fill it */
.card-h > svg { width: 18px; height: 18px; flex: none; color: var(--ink-3); }
/* the foot of a card: the mirror of .card-h, for paging a long list */
.card-f {
  padding: 12px 18px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.pager .muted { text-align: center; font-size: 13px; }

/* ── dashboard ─────────────────────────────────────────────────────────────
   A heading that says which question the tiles under it answer. The dashboard
   mixes two: trade done in a period, and work outstanding right now. Without a
   line between them an open purchase order looks like this month's problem. */
.sec-h {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin: 4px 0 -4px;
}
.sec-h b { font-size: var(--t-body); letter-spacing: -.01em; }
.sec-h .muted { font-size: var(--t-sm); }

/* The period selector. */
.seg { display: inline-flex; background: var(--surface-2, #efefea); border: 1px solid var(--line);
       border-radius: 10px; padding: 2px; gap: 2px; flex-wrap: wrap; }
.seg-b {
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
  font: 600 12.5px/1 inherit; padding: 7px 11px; border-radius: var(--r-sm);
  white-space: nowrap; transition: background .14s ease, color .14s ease;
}
.seg-b:hover { color: var(--ink); }
.seg-b.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
:root[data-theme="dark"] .seg-b.on { box-shadow: none; background: var(--surface-3); }

/* Two views of one book — surgeons and the offices they work out of. An
   underline rather than a pill, so it reads as "same screen, other half" and
   not as a filter you have applied. */
.tabs-l { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 2px; }
.tab-l {
  padding: 9px 14px 10px; font: 600 13.5px/1 inherit; color: var(--ink-3);
  text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .14s ease, border-color .14s ease;
}
.tab-l:hover { color: var(--ink-2); }
.tab-l.on { color: var(--ink); border-bottom-color: var(--accent); }

/* The map fills what is left of the window rather than taking a guessed height:
   a map you have to scroll is a map you cannot read. */
.map-canvas { width: 100%; height: clamp(360px, calc(100vh - 290px), 760px); background: var(--surface-2); }
.chip-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 2px; }
/* Google's info window is its own DOM and its own light surface; the one thing
   worth taking back is the hard corner. */
.gm-style .gm-style-iw-c { border-radius: 10px; padding: 12px 14px; }

/* A line of consequence, not a decoration: used where a gap in the data stops
   something downstream from working. */
.note {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--ink-3);
  border-radius: 10px; padding: 11px 14px; font-size: 13px; line-height: 1.45;
}
.note > svg { width: 17px; height: 17px; flex: none; margin-top: 1px; color: var(--ink-3); }
.note-warn { border-left-color: var(--s4); }
.note-warn > svg { color: var(--s4); }

/* A row of small numbers that do not deserve a tile each. */
/* Each cell carries its own border rather than the grid faking one with a 1px
   gap: at three columns eight numbers leave two cells empty, and a gap-coloured
   hole reads as a rendering fault rather than as nothing to show. */
.kpis {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
}
.kpi {
  background: var(--surface); padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--r);
}
.kpi-v { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.kpi-k { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

.viz-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* ── a KPI against the same stretch of last year ───────────────────────────
   Small multiples, each with its own scale and its unit written out. Dollars,
   people and percentages never share an axis; putting them on one is the
   quickest way to a chart that is confidently wrong. */
.pairs-h { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 4px 0 -4px; }
.pairs-h b { font-size: var(--t-body); letter-spacing: -.01em; }
.pairs-h .muted { font-size: var(--t-sm); }
.pairs { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
.pair {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px 14px 13px;
}
.pair-k { font-size: 11.5px; color: var(--ink-3); font-weight: 650; }
.pair-top { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; }
.pair-a { font-size: 21px; font-weight: 700; letter-spacing: -.02em; flex: 1; min-width: 0; }
.chip {
  font-size: var(--t-micro); font-weight: 700; padding: 2px 6px; border-radius: 999px;
  white-space: nowrap; flex: none;
}
/* Direction is carried by the words "last year …" underneath and by the two
   bars, so colour is reinforcement rather than the only signal. */
.chip.up   { color: var(--s6); background: color-mix(in srgb, var(--s6) 14%, transparent); }
.chip.down { color: var(--s8); background: color-mix(in srgb, var(--s8) 14%, transparent); }
.chip.flat { color: var(--ink-3); background: color-mix(in srgb, var(--ink-3) 14%, transparent); }
.pair-bars { display: grid; gap: 3px; margin: 9px 0 7px; }
.pb { height: 7px; background: color-mix(in srgb, var(--ink-3) 16%, transparent); border-radius: 4px; }
.pb i { display: block; height: 100%; border-radius: 4px; }
.pb i.now  { background: var(--s1); }
.pb i.then { background: var(--ink-3); }
.pair-b { font-size: var(--t-micro); color: var(--ink-3); }

/* A legend is required the moment there are two series. */
.legend-row { display: flex; gap: 12px; flex-wrap: wrap; }
.lgi { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink-2); }
.lgi i { width: 9px; height: 9px; border-radius: 3px; }

/* The ring and its legend. The legend is not decoration: two of the five hues
   fall under 3:1 against the light surface, so the written label and the value
   are what carry the meaning and the colour is only the index. */
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 10px; }
.donut-wrap > svg { flex: none; }
.legend { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 180px; }
.lg { display: flex; align-items: center; gap: 8px; font-size: var(--t-sm); }
.lg i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.lg-k { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.lg-v { font-weight: 650; }
.lg-p { color: var(--ink-3); width: 34px; text-align: right; }

/* The week strip. */
.wk { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 12px; }
.wk-d {
  background: var(--surface-2, rgba(0,0,0,.03)); border: 1px solid transparent;
  border-radius: 10px; padding: 8px 4px 9px; text-align: center; min-width: 0;
}
.wk-d.now { border-color: var(--s1); background: color-mix(in srgb, var(--s1) 9%, transparent); }
/* A day with something on it should be legible at a glance from across a desk. */
.wk-d.has .wk-dt { color: var(--ink); }
.wk-d:not(.has) { opacity: .62; }
/* A panel that is one line of news rather than a chart. */
.viz-slim { padding-top: 13px; padding-bottom: 13px; }
.viz-slim > .row > svg { width: 17px; height: 17px; color: var(--ink-3); flex: none; }
.wk-n { font-size: var(--t-micro); color: var(--ink-3); font-weight: 650; }
.wk-dt { font-size: var(--t-body); font-weight: 700; letter-spacing: -.02em; }
.wk-bar { height: 48px; display: flex; align-items: flex-end; justify-content: center; margin: 5px 0 3px; }
.wk-bar i { display: block; width: 16px; border-radius: 4px 4px 0 0; background: var(--s1); }
.wk-c { font-size: 12px; font-weight: 650; min-height: 15px; }
.wk-v { font-size: 10.5px; color: var(--ink-3); }
@media (max-width: 560px) { .wk-v { display: none; } }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 14px; }
.stack-sm { display: grid; gap: 8px; }
.pagehead { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.pagehead p { margin: 3px 0 0; color: var(--ink-2); font-size: 13.5px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 14px; border-radius: var(--r-sm); border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .12s, border-color .12s, transform .06s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-pri { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn-pri:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-danger { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 40%, var(--line-2)); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.btn-lg { padding: 13px 20px; font-size: 15.5px; border-radius: var(--r); }
.btn-sm { padding: 5px 9px; font-size: var(--t-sm); }
.btn-block { width: 100%; }
.btn-icon { padding: 7px; border-radius: var(--r-sm); }

/* fields */
.f { display: grid; gap: 5px; min-width: 0; }
.f > label { font-size: 12px; font-weight: 650; color: var(--ink-2); letter-spacing: .01em; }
/* tick boxes and radios keep their intrinsic size — a 100% width here would
   swallow the row they sit in */
.f input:not([type="checkbox"]):not([type="radio"]), .f select, .f textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); padding: 9px 10px; font-size: 14.5px;
  transition: border-color .12s, box-shadow .12s;
}
.f input[type="checkbox"], .f input[type="radio"] { width: auto; flex: none; }

/* The search and filter boxes scattered through the app were bare <input>s
   wearing a hard-coded pixel width, so they rendered as raw browser controls
   and could not be told to fill a phone's column. They are fields like any
   other, and their width is now the stylesheet's business. */
input.fld, select.fld {
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: 9px 10px; font-size: 14.5px; min-width: 0; max-width: 300px;
  transition: border-color .12s, box-shadow .12s;
}
select.fld { max-width: 200px; }
/* …but a dropdown that is answering a labelled question fills its field. The
   200px cap suits a status picker in a toolbar; it truncates "Keylift
   Instrument Tray — 43 on the shelf of 44" into nonsense. */
.f input.fld, .f select.fld, .f textarea.fld { max-width: none; width: 100%; }
/* a search box in a card header takes the space the header has spare, up to
   its cap, rather than sitting at the browser's default field width */
.card-h input.fld { flex: 1 1 220px; }
input.fld:focus, select.fld:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.f input:focus, .f select:focus, .f textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.f textarea { resize: vertical; min-height: 68px; }
.f .hint { font-size: 11.5px; color: var(--ink-3); }
.f-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.f-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 620px) { .f-2, .f-3 { grid-template-columns: 1fr; } }
.f.lowconf input, .f.lowconf select { border-color: var(--warning); background: color-mix(in srgb, var(--warning) 7%, var(--surface)); }

/* pills */
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 20px;
  font-size: 11.5px; font-weight: 650; letter-spacing: .01em; white-space: nowrap;
  border: 1px solid transparent;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-muted    { color: var(--ink-2);   background: var(--surface-3); }
.pill-info     { color: var(--s1);      background: color-mix(in srgb, var(--s1) 13%, var(--surface)); }
.pill-good     { color: var(--good-ink);background: color-mix(in srgb, var(--good) 15%, var(--surface)); }
.pill-warning  { color: #7a5600;        background: color-mix(in srgb, var(--warning) 26%, var(--surface)); }
.pill-serious  { color: #8a4116;        background: color-mix(in srgb, var(--serious) 26%, var(--surface)); }
.pill-critical { color: var(--critical);background: color-mix(in srgb, var(--critical) 13%, var(--surface)); }
:root[data-theme="dark"] .pill-warning, :root:not([data-theme="light"]) .pill-warning { color: var(--warning); }
:root[data-theme="dark"] .pill-serious, :root:not([data-theme="light"]) .pill-serious { color: var(--serious); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 20px;
  font-size: var(--t-sm); font-weight: 550; max-width: 100%; white-space: nowrap;
}
/* a strip scrolls sideways on purpose, so its chips keep their own width
   rather than being squeezed into three-line labels */
.pagestrip > * { flex: none; }
.chip.locked { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--accent); }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip > svg { width: 13px; height: 13px; flex: none; opacity: .75; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--ink-3); padding: 0 2px; font-size: var(--t-body); line-height: 1; }
.chip button:hover { color: var(--critical); }

/* tables */
/* §12: a scroll edge effect rather than a hard rule. The two `local` layers
   travel with the content and sit on top of the two fixed shadows, so a shadow
   is visible exactly when there is more table in that direction and fades out
   as you reach the end — the affordance appears only when it is true. */
.tbl-wrap, .calwrap {
  background:
    linear-gradient(to right, var(--surface) 40%, transparent) left / 26px 100% no-repeat local,
    linear-gradient(to left, var(--surface) 40%, transparent) right / 26px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, var(--edge-sh), transparent) left / 13px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, var(--edge-sh), transparent) right / 13px 100% no-repeat scroll;
}
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 700; padding: 9px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: var(--surface);
}
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl tbody tr.clickable { cursor: pointer; }
table.tbl tbody tr.clickable:hover { background: var(--surface-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 12px; }
/* A tile is a number with a hairline of colour down its left edge — enough to
   make the row read as a set of cards rather than a table of boxes, and enough
   to let one of them say "this is the one to look at" without shouting. */
.tile {
  position: relative; overflow: hidden;
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-1);
  padding: 14px 16px 15px 17px;
  transition: box-shadow .18s ease, transform .18s ease;
}
.tile::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--s1); opacity: .5;
}
.tile .k { font-size: 11.5px; font-weight: 650; color: var(--ink-3); letter-spacing: .03em; text-transform: uppercase; }
.tile .v { font-size: 27px; font-weight: 680; letter-spacing: -.028em; margin-top: 6px; line-height: 1.1; }
.tile .sub { font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.tile.tap { cursor: pointer; }
/* Respond on press, and lift by a hair rather than a jump. */
.tile.tap:hover { box-shadow: var(--sh-2); transform: translateY(-1px); }
.tile.tap:active { transform: translateY(0); box-shadow: var(--sh-1); }

/* Status, for the one tile in a row that is actually a problem. Reserved
   colours, and always with a word beside them — never colour on its own. */
.tile.warn::before    { background: var(--s4); opacity: 1; }
.tile.serious::before { background: var(--s8); opacity: 1; }
.tile.quiet::before   { background: var(--ink-3); opacity: .35; }
.tile .sub.flag { color: var(--s4); font-weight: 600; }
.tile .sub.flag-bad { color: var(--s8); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .tile, .tile.tap:hover, .tile.tap:active { transition: none; transform: none; }
}

/* pipeline board — one column per open stage */
.pipe { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1100px) { .pipe { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px)  { .pipe { grid-template-columns: 1fr; } }
.pipe-col { display: grid; gap: 7px; align-content: start; background: var(--surface-2);
  border-radius: var(--r); padding: 9px; min-height: 60px; }
.pipe-h { display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; padding: 0 2px 2px; }
.pipe-card {
  display: grid; gap: 2px; text-align: left; width: 100%; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 8px 10px; font: inherit; color: inherit;
}
.pipe-card:hover { box-shadow: var(--sh-1); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.pipe-card b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pipe-card small { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* template editor: pick an output, edit the words, watch the real thing render */
.tpl-grid { display: grid; grid-template-columns: 230px minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 1200px) { .tpl-grid { grid-template-columns: 210px minmax(0, 1fr); } }
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px)  { .tpl-grid { grid-template-columns: 1fr; } }
.tpl-item {
  display: grid; gap: 1px; text-align: left; width: 100%; cursor: pointer;
  background: none; border: 0; border-radius: var(--r-sm); padding: 7px 9px;
  font: inherit; color: inherit;
}
.tpl-item:hover { background: var(--surface-2); }
.tpl-item.on { background: var(--accent-soft); color: var(--accent); }
.tpl-item b { font-size: 13px; }
.tpl-item small { font-size: 11.5px; }
.tpl-item .pill { justify-self: start; margin-top: 3px; }
.tpl-preview { padding: 12px; background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.tpl-subject { display: flex; gap: 8px; align-items: baseline; padding: 0 2px 9px; font-size: 13px; }
.tpl-subject .muted { font-size: var(--t-micro); text-transform: uppercase; letter-spacing: .04em; flex: none; }
.tpl-frame { width: 100%; height: 620px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.tpl-doc { background: #fff; color: #11161d; border: 1px solid var(--line); border-radius: var(--r);
  padding: 22px 24px; max-height: 620px; overflow: auto; }

/* empty / loading */
.empty { text-align: center; padding: 46px 20px; color: var(--ink-2); }
.empty svg { width: 34px; height: 34px; color: var(--ink-3); margin-bottom: 10px; }
.empty h3 { margin-bottom: 4px; }
.spin {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  border: 2px solid var(--line-2); border-top-color: var(--accent);
  animation: sp .7s linear infinite;
}
@keyframes sp { to { transform: rotate(360deg); } }
.skel { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2));
  background-size: 200% 100%; animation: sk 1.3s ease-in-out infinite; border-radius: var(--r-xs); height: 13px; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* toasts */
.toasts { position: fixed; z-index: 90; left: 50%; transform: translateX(-50%); bottom: calc(18px + var(--sab, env(safe-area-inset-bottom)));
  display: grid; gap: 8px; width: min(520px, calc(100vw - 24px)); pointer-events: none; }
@media (min-width: 701px) and (min-height: 521px), (min-width: 961px) { .toasts { left: auto; right: 20px; transform: none; bottom: 20px; } }
.toast {
  background: var(--ink); color: var(--plane); padding: 11px 14px; border-radius: var(--r);
  font-size: 13.5px; font-weight: 550; box-shadow: var(--sh-3);
  opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s;
}
.toast.in { opacity: 1; transform: none; }
.toast-critical { background: var(--critical); color: #fff; }
.toast-good { background: var(--good-ink); color: #fff; }
.toast-warning { background: #7a5600; color: #fff; }

/* modal / sheet */
.scrim { position: fixed; inset: 0; background: rgba(11,11,11,.45); z-index: 70;
  display: grid; place-items: center; padding: 18px; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-3);
  width: min(620px, 100%); max-height: min(86svh, 820px); display: flex; flex-direction: column; overflow: hidden; }
.modal-h { padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal-b { padding: 16px 18px; overflow-y: auto; }
.modal-f { padding: 13px 18px; border-top: 1px solid var(--line); display: flex; gap: 9px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 620px) {
  .scrim { padding: 0; align-items: flex-end; }
  .modal { width: 100%; max-height: 92svh; border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .modal-f { padding-bottom: calc(13px + var(--sab, env(safe-area-inset-bottom))); }
  .modal-f .btn { flex: 1; }
}

/* mobile menu sheet */
.menu-scrim { padding: 0; align-items: flex-end; }
/* The sheet is the same material as the sidebar, so the two read as one system
   rather than two menus that happen to list the same things. The bright top edge
   is light catching the surface. */
.menu-panel {
  width: 100%; max-height: 86svh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 18px 18px 0 0;
  box-shadow: var(--sh-3); overflow: hidden; touch-action: none;
  padding-bottom: var(--sab, env(safe-area-inset-bottom)); will-change: transform;
  border-top: 1px solid color-mix(in srgb, var(--ink) 8%, transparent);
}
@supports (backdrop-filter: blur(1px)) {
  .menu-panel {
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: blur(26px) saturate(180%);
  }
}
.menu-grab {
  width: 38px; height: 4px; border-radius: 2px; background: var(--line-2);
  margin: 9px auto 3px; flex: none;
}
.menu-who {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px 12px;
  border-bottom: 1px solid var(--line); flex: none;
}
.menu-who-n {
  font-size: 14.5px; font-weight: 640; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.menu-scroll {
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 8px 10px 14px; touch-action: pan-y; min-height: 0;
}
.menu-scroll .org-pick { margin: 4px 6px 8px; width: calc(100% - 12px); }
.menu-grp { display: flex; flex-direction: column; gap: 2px; }
/* Same hairline-and-a-word as the sidebar, so a group is a group in both places. */
.menu-grp .nav-lbl {
  padding: 16px 8px 6px; margin-top: 6px; border-top: 1px solid var(--line);
}
.menu-grp:first-child .nav-lbl { border-top: 0; margin-top: 0; }
.menu-grp a {
  position: relative;
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 12px;
  border-radius: 11px; color: var(--ink); font-size: var(--t-body); font-weight: 520;
  transition: background .14s ease, color .14s ease;
}
.menu-grp a::before {
  content: ""; position: absolute; left: -2px; top: 50%;
  width: 3px; height: 20px; border-radius: 2px; background: var(--accent);
  transform: translate(0, -50%) scaleY(0);
  transition: transform .18s cubic-bezier(.3, .9, .3, 1);
}
.menu-grp a svg { width: 19px; height: 19px; flex: none; color: var(--ink-3); }
.menu-grp a span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-grp a.on { background: var(--accent-soft); color: var(--accent); font-weight: 620; }
.menu-grp a.on::before { transform: translate(0, -50%) scaleY(1); }
.menu-grp a.on svg { color: var(--accent); }
/* Touch-down, not touch-up. */
.menu-grp a:active { background: var(--surface-2); transform: scale(.99); }
body.no-scroll { overflow: hidden; }

/* ------------------------------------------------------------- fit the screen
   `.stack` and friends are grids, and a grid item's automatic minimum size is
   its content. One wide table therefore widened the whole column track, and
   every sibling — the page heading, its description — was stretched with it,
   which is what made five screens scroll sideways. Tracks are now explicitly
   allowed to be narrower than their contents, and anything that genuinely
   needs the width scrolls inside its own box instead of moving the page. */
.stack, .stack-sm { grid-template-columns: minmax(0, 1fr); }
.wrap > *, .wrap-narrow > *, .stack > *, .stack-sm > *, .tiles > *, .chat-grid > *,
.card, .card-p, .card-h, .tbl-wrap, .calwrap, .pagestrip { min-width: 0; }
.pagehead > * { min-width: 0; }
.pagehead h1, .pagehead p { overflow-wrap: break-word; }
/* a page heading's action buttons never wrap their own labels, so the row that
   holds them has to be the thing that wraps */
.pagehead .row { flex-wrap: wrap; }
/* and the same holds for every other control row on a phone: a picker and its
   button fit a laptop and not a 320px screen, and wrapping is what should
   happen rather than the page growing to accommodate them */
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) { .row { flex-wrap: wrap; } }
/* a pill holding a whole sentence is a status line, not a chip: on a narrow
   screen it wraps rather than pushing the page sideways. Its dot stays put. */
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .pill { max-width: 100%; white-space: normal; }
  .pill::before { flex: none; }
  /* inside a table the row height is the cost of wrapping, and the table has
     its own sideways scroll, so a status chip there stays on one line */
  table.tbl .pill { white-space: nowrap; }
  /* a filter control shares a card header with its heading; on a phone it takes
     the full line instead of whatever the browser's default field width is */
  .card-h { flex-wrap: wrap; }
  .card-h input, .card-h select, .card-h .inp { flex: 1 1 100%; min-width: 0; }
  /* no field on a phone is capped below the column it sits in */
  input.fld, select.fld { max-width: none; width: 100%; min-height: 44px; }

  /* A table squeezed to the screen wraps a facility name onto four lines and
     is harder to read than one that scrolls. The table sizes to its content
     and the card scrolls sideways — the page still does not. */
  table.tbl { width: max-content; min-width: 100%; }
  table.tbl th, table.tbl td { max-width: 190px; }

  /* A heading and its action buttons cannot share a line on a phone. Side by
     side, the buttons hold their labels and the heading column is squeezed to
     whatever is left — which is how an order number ended up broken across
     three lines. The heading takes the full width and the actions sit beneath
     it, which is also the order they are read in. */
  .pagehead { flex-direction: column; align-items: stretch; gap: 12px; }
  .pagehead > * { width: 100%; }
  .pagehead .row-wrap, .pagehead .row { width: 100%; }
  .pagehead .btn { flex: 1 1 auto; }
  /* the back link is a link, not an action — it stays its own size */
  .pagehead .grow > a.row { display: inline-flex; width: auto; }

  /* --------------------------------------------------- phone: type and touch
     §15: tracking and leading are size-specific. A page title on a phone is the
     one piece of type that should be unmistakably the title, so it grows and
     tightens rather than sitting a few points above the body copy. */
  .pagehead h1 { font-size: 27px; letter-spacing: -.028em; line-height: 1.12; }
  .pagehead p { font-size: 14px; line-height: 1.45; }
  .card-h h2 { font-size: 17.5px; }

  /* 16px is the gutter a phone screen reads as "edge", and it matches the
     inset of the cards it contains. */
  .wrap, .wrap-narrow { padding: 16px 16px 0; }
  .card { border-radius: var(--r-lg); }

  /* §1 and §10: anything tappable answers on the press, not on the release,
     and no target is smaller than a fingertip. */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }
  table.tbl td { padding-top: 13px; padding-bottom: 13px; }
  table.tbl tbody tr.clickable:active { background: var(--surface-2); }
  .tile.tap:active, .who:active, .ob-row:active { background: var(--surface-2); }
  .card-h h2 + .btn, .pagehead .btn { touch-action: manipulation; }

  /* Eight numbers in one column is eight screens of scrolling to read eight
     numbers. Two up reads as a dashboard and puts the whole thing in a glance
     and a half — the type steps down with the box, per §15. */
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 13px 14px; border-radius: 14px; }
  .tile .k { font-size: 10.5px; letter-spacing: .04em; }
  .tile .v { font-size: 23px; letter-spacing: -.026em; margin-top: 5px; }
  .tile .sub { font-size: 11.5px; }
}

/* ------------------------------------------------- floating chrome (§12)
   A hairline under a bar that is already floating above the content is a
   drawn divider where the material should be doing the separating. The rule
   is the same one iOS uses: nothing while the page is at rest at the top,
   and an edge that materialises only once content has actually travelled
   underneath the bar. */
.topbar { border-bottom: 1px solid transparent; transition: border-color .2s ease, box-shadow .2s ease; }
.topbar-n {
  font-weight: 670; font-size: 15.5px; line-height: 1.2; letter-spacing: -.014em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar.edge {
  border-bottom-color: var(--line);
  box-shadow: 0 6px 16px -14px rgba(11, 11, 11, .55);
}
.tabbar {
  /* the bright top edge is light catching the material, not a border */
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--surface) 55%, transparent);
}
@media (prefers-reduced-transparency: reduce) {
  .topbar.edge { box-shadow: none; }
}

/* steps */
.steps { display: flex; align-items: center; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 7px; font-size: var(--t-sm); font-weight: 600; color: var(--ink-3); }
.step i { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-3); color: var(--ink-3); font-size: var(--t-micro); font-style: normal; font-weight: 700; flex: none; }
.step.on { color: var(--ink); } .step.on i { background: var(--accent); color: #fff; }
.step.done i { background: var(--good-ink); color: #fff; }
.step-bar { flex: 1; min-width: 12px; height: 1px; background: var(--line-2); }

/* capture / redaction */
.drop {
  border: 2px dashed var(--line-2); border-radius: var(--r-lg); background: var(--surface);
  padding: 30px 20px; text-align: center; transition: border-color .15s, background .15s;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop svg { width: 34px; height: 34px; color: var(--ink-3); }
.pagestrip { display: flex; gap: 8px; overflow-x: auto; padding: 2px; }
.pagestrip img, .pagestrip canvas {
  height: 92px; border-radius: var(--r-sm); border: 1px solid var(--line); background: #fff; cursor: pointer;
}
.pagestrip .on { outline: 2px solid var(--accent); outline-offset: 1px; }
.boxer { position: relative; user-select: none; touch-action: none; background: var(--surface-2);
  border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); }
.boxer canvas { display: block; width: 100%; height: auto; }
/* Positioned by transform, not left/top, so dragging stays off the layout path. */
.boxer .bx { position: absolute; top: 0; left: 0; border: 2px solid var(--s8);
  background: color-mix(in srgb, var(--s8) 18%, transparent);
  cursor: move; box-shadow: 0 0 0 9999px rgba(11,11,11,.30);
  transition: border-color .1s ease-out, background .1s ease-out; }
/* Feedback on pointer-down, not on release. */
.boxer .bx.grabbing { border-color: var(--s8); background: color-mix(in srgb, var(--s8) 28%, transparent); }
.boxer .bx .hd { position: absolute; width: 16px; height: 16px; background: var(--s8);
  border: 2px solid #fff; border-radius: 50%; touch-action: none; }
/* A 44px target around a 16px dot — the handle stays small, the finger doesn't. */
.boxer .bx .hd::before { content: ""; position: absolute; inset: -14px; border-radius: 50%; }
.boxer .bx.grabbing .hd { transform: scale(1.15); }
.boxer .bx .hd { transition: transform .1s ease-out; }
.boxer .bx .hd.se { right: -9px; bottom: -9px; cursor: nwse-resize; }
.boxer .bx .hd.nw { left: -9px; top: -9px; cursor: nwse-resize; }
.boxer .bx .tag { position: absolute; top: -22px; left: -2px; background: var(--s8); color: #fff;
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 4px; letter-spacing: .04em; white-space: nowrap; }

/* line items */
.lines { display: grid; gap: 7px; }
.lineitem { display: grid; grid-template-columns: 1fr 92px 80px 62px 92px 100px 32px; gap: 7px; align-items: center; }
.lineitem input { padding: 7px 8px; font-size: 13.5px; }
.lineitem-h { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 700; padding: 0 2px; }
.lineitem-h > .num { text-align: right; }
@media (max-width: 820px) {
  /* every cell gets a full-width column; the delete button sits beside the amount
     rather than defining a 32px column that squeezes the inputs above it */
  .lineitem {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "d d" "c l" "q u" "a x";
    padding: 10px; background: var(--surface-2); border-radius: var(--r-sm);
  }
  .lineitem-h { display: none; }
  .lineitem > :nth-child(1) { grid-area: d; } .lineitem > :nth-child(2) { grid-area: c; }
  .lineitem > :nth-child(3) { grid-area: l; } .lineitem > :nth-child(4) { grid-area: q; }
  .lineitem > :nth-child(5) { grid-area: u; } .lineitem > :nth-child(6) { grid-area: a; }
  .lineitem > :nth-child(7) { grid-area: x; justify-self: end; align-self: center; }
}

/* banners */
.banner { display: flex; gap: 11px; padding: 12px 14px; border-radius: var(--r); font-size: 13.5px; line-height: 1.5; }
.banner svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.banner strong { font-weight: 650; }
.banner-info { background: var(--accent-soft); color: var(--ink); }
.banner-warn { background: color-mix(in srgb, var(--warning) 18%, var(--surface)); color: var(--ink); }
.banner-phi  { background: color-mix(in srgb, var(--s7) 12%, var(--surface)); color: var(--ink); }
.banner-crit { background: color-mix(in srgb, var(--critical) 12%, var(--surface)); color: var(--ink); }
/* FE_AUDITOR_CARD_POLISH: one switch row for settings toggles (whole row is the 44px hit area). */
.sw-row { display: flex; gap: 12px; align-items: flex-start; min-height: 44px; cursor: pointer; }
.sw-row.is-off { cursor: default; }
.sw-row > input[type="checkbox"] { width: 22px; height: 22px; margin: 2px 0 0; flex: 0 0 auto; }
.sw-row small { display: block; margin-top: 2px; }

/* charts */
.viz { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: 15px 17px 12px; }
.viz h3 { font-size: 13.5px; }
.viz .vsub { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.viz svg { display: block; max-width: 100%; overflow: visible; }
.viz .grid line { stroke: var(--line); stroke-width: 1; }
.viz .axis text { fill: var(--ink-3); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.viz .base { stroke: var(--line-2); stroke-width: 1; }
.viz .dlab { fill: var(--ink-2); font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.viz .mark { transition: opacity .12s; }
.viz:hover .mark.fade { opacity: .38; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-2); font-weight: 550; }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.vtip {
  position: fixed; z-index: 95; pointer-events: none; background: var(--ink); color: var(--plane);
  padding: 7px 9px; border-radius: 7px; font-size: 12px; box-shadow: var(--sh-2);
  opacity: 0; transition: opacity .1s; max-width: 230px;
}
.vtip.on { opacity: 1; }
.vtip b { font-variant-numeric: tabular-nums; }
.bars2 { display: grid; gap: 7px; }
.bar2 { display: grid; grid-template-columns: minmax(80px, 150px) 1fr auto; gap: 10px; align-items: center; font-size: var(--t-sm); }
.bar2 .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.bar2 .track { background: var(--surface-3); border-radius: 4px; height: 13px; overflow: hidden; }
.bar2 .fill { height: 100%; border-radius: 4px; }
.bar2 .amt { font-variant-numeric: tabular-nums; font-weight: 620; font-size: var(--t-sm); }

/* documents */
.docrow { display: flex; gap: 14px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.docrow:last-child { border-bottom: 0; }
.docthumb {
  width: 108px; flex: none; min-height: 84px; max-height: 150px; overflow: hidden;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface-2);
  display: grid; place-items: center; cursor: pointer; position: relative;
  transition: border-color .12s, box-shadow .12s;
}
.docthumb:hover { border-color: var(--accent); box-shadow: var(--sh-2); }
.docthumb > div { width: 100%; }
.docthumb img, .docthumb canvas { width: 100%; height: auto; display: block; }
.docthumb-locked {
  display: grid; place-items: center; gap: 5px; padding: 18px 6px;
  color: var(--ink-3); font-size: var(--t-micro); font-weight: 600; text-align: center;
}
.docthumb-locked svg { width: 18px; height: 18px; }
@media (max-width: 620px) { .docthumb { width: 84px; } }

.modal-wide { width: min(940px, 100%); }
.modal-wide .modal-b { background: var(--plane); }

/* recipient parties */
.parties { display: grid; gap: 6px; }
.party {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); cursor: pointer; transition: border-color .12s, background .12s;
}
.party:hover { border-color: var(--line-2); background: var(--surface-2); }
.party:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.party > input[type="checkbox"] { margin-top: 2px; flex: none; }
.party-name { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 650; }
.party-name > svg { width: 15px; height: 15px; flex: none; color: var(--ink-3); }
.party-addr { font-size: var(--t-sm); color: var(--ink-2); margin-top: 2px; word-break: break-word; }
.party-locked { cursor: default; background: var(--surface-2); border-style: dashed; }
.party-locked > svg { width: 15px; height: 15px; flex: none; color: var(--ink-3); margin-top: 3px; }
.party-locked:hover { border-color: var(--line); background: var(--surface-2); }

/* contextual action row on an order */
.actionbar { display: flex; flex-wrap: wrap; gap: 8px; }
.actionbar .btn { flex: none; }

/* email preview */
.mailprev { border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden; background: #fff; }
.mailprev iframe { display: block; width: 100%; border: 0; height: 360px; background: #fff; }
.mailprev-head {
  background: var(--surface-2); border-bottom: 1px solid var(--line);
  padding: 9px 12px; display: grid; gap: 3px;
}
.mailprev-head .ln { font-size: 12px; color: var(--ink-2); display: flex; gap: 7px; }
.mailprev-head .ln b { color: var(--ink-3); font-weight: 650; min-width: 54px; flex: none; text-transform: uppercase; letter-spacing: .05em; font-size: 10.5px; padding-top: 1px; }
.mailprev-head .ln span { color: var(--ink); word-break: break-word; }
.mailprev-tall iframe { height: 620px; }

/* audit diff */
.diff { font-size: var(--t-sm); }
.diff .fld { font-weight: 650; }
.diff del { color: var(--critical); text-decoration: line-through; opacity: .85; }
.diff ins { color: var(--good-ink); text-decoration: none; }

/* auth */
.auth { min-height: 100svh; display: grid; place-items: center; padding: 22px; }
.auth-card { width: min(430px, 100%); }
.auth-mk { width: 46px; height: 46px; border-radius: 13px; margin: 0 auto 14px;
  background: linear-gradient(145deg, var(--s1), var(--s7)); color: #fff;
  display: grid; place-items: center; font-size: 17px; font-weight: 800; }
/* The logo carries its own wordmark, so the card shows it in place of a heading. */
.auth-logo { display: block; width: min(268px, 82%); height: auto; margin: 2px auto 0; }
.or { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .08em; font-weight: 650; margin: 16px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.otp { display: flex; gap: 8px; justify-content: center; }
.otp input { width: 44px; text-align: center; font-size: 20px; font-weight: 650; padding: 10px 0; }

/* --- trays, calendar, platform ------------------------------------------ */
.flip { transform: rotate(180deg); }

/* a chip that acts as a button shouldn't inherit the button reset's centring */
button.chip { cursor: pointer; font: inherit; }
button.chip:hover { border-color: var(--line-2); }

/* Seven columns will not fit a phone honestly, so the month scrolls sideways
   rather than being crushed into something unreadable. */
.calwrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.calgrid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  min-width: 640px;
}
.calhead { font-size: 11.5px; text-align: center; padding: 2px 0; color: var(--ink-3); }
@media (min-width: 760px) { .calgrid { min-width: 0; } }

/* --- chat ---------------------------------------------------------------- */
.chat-grid {
  display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 14px;
  align-items: stretch;
}
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) { .chat-grid { grid-template-columns: 1fr; } }

.chat-side { display: flex; flex-direction: column; gap: 2px; }
.chat-chan {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 10px; border-radius: var(--r-sm); border: 0; background: transparent;
  color: var(--ink-2); font: inherit; font-size: 13.5px; cursor: pointer; text-align: left;
}
.chat-chan:hover { background: var(--surface-2); color: var(--ink); }
.chat-chan.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.chat-chan svg { width: 15px; height: 15px; flex: none; opacity: .7; }
.chat-badge {
  margin-left: auto; font-size: var(--t-micro); font-weight: 700; border-radius: 20px;
  padding: 1px 6px; background: var(--critical); color: #fff;
}

.chat-pane {
  display: flex; flex-direction: column; min-height: 62svh; max-height: 78svh;
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-1); overflow: hidden;
}
.chat-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); flex: none;
}
.chat-scroll { flex: 1 1 auto; overflow-y: auto; padding: 10px 6px 14px; }

.chat-day { display: flex; align-items: center; gap: 10px; margin: 14px 12px 8px; }
.chat-day::before, .chat-day::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.chat-day span { font-size: 11.5px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }

.chat-msg { display: flex; gap: 10px; padding: 4px 12px; align-items: flex-start; position: relative; }
.chat-msg:hover { background: var(--surface-2); }
.chat-msg.grouped { padding-top: 1px; padding-bottom: 1px; }
.chat-gutter { width: 34px; flex: none; text-align: right; }
.chat-time { font-size: 10.5px; color: var(--ink-3); opacity: 0; }
.chat-msg:hover .chat-time { opacity: 1; }
.chat-meta { display: flex; align-items: baseline; gap: 7px; font-size: var(--t-sm); }
.chat-meta b { font-size: 13.5px; }
.chat-body { font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-quote {
  border-left: 2px solid var(--line-2); padding-left: 8px; margin: 2px 0 4px;
  font-size: var(--t-sm); color: var(--ink-3);
}
.chat-tools {
  position: absolute; right: 10px; top: 2px; display: none; gap: 2px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px;
}
.chat-msg:hover .chat-tools { display: flex; }

.mention {
  background: color-mix(in srgb, var(--accent) 13%, var(--surface));
  color: var(--accent); border-radius: 4px; padding: 0 3px; font-weight: 600;
}
.mention-me { background: color-mix(in srgb, var(--warning) 26%, var(--surface)); color: var(--ink); }

.chat-reply {
  display: flex; align-items: center; gap: 8px; padding: 7px 14px;
  border-top: 1px solid var(--line); font-size: var(--t-sm); color: var(--ink-3);
}
.chat-reply svg { width: 14px; height: 14px; flex: none; }

.chat-composer { position: relative; padding: 10px 14px 12px; border-top: 1px solid var(--line); flex: none; }
.chat-input {
  flex: 1; resize: none; min-height: 40px; max-height: 160px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface-2); color: var(--ink); font: inherit; font-size: 14px;
}
.chat-input:focus { outline: none; border-color: var(--accent); background: var(--surface); }

.chat-at {
  position: absolute; bottom: calc(100% - 4px); left: 14px; right: 14px; max-width: 340px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--sh-2); overflow: hidden; z-index: 5;
}
.chat-at-row {
  display: flex; gap: 9px; align-items: baseline; width: 100%; text-align: left;
  padding: 7px 11px; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 13px;
  cursor: pointer;
}
.chat-at-row.on, .chat-at-row:hover { background: var(--accent-soft); }

.chat-mention {
  display: block; width: 100%; text-align: left; border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 10px 12px; background: transparent;
  color: var(--ink); font: inherit; cursor: pointer;
}
.chat-mention:hover { background: var(--surface-2); }

/* Sandbox mode: a send that succeeds while it is on looks exactly like a send
   that reached the vendor, so the whole app carries the warning. */
.sandbox-strip {
  position: sticky; top: 0; z-index: 90;
  display: flex; align-items: center; gap: 9px;
  padding: 8px 16px;
  background: #b45309; color: #fff;
  font: 500 13px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.sandbox-strip svg { width: 16px; height: 16px; flex: none; }
.sandbox-strip span { flex: 1; min-width: 0; }
.sandbox-strip a { color: #fff; text-decoration: underline; white-space: nowrap; font-weight: 600; }
:root[data-theme="dark"] .sandbox-strip { background: #92400e; }

/* Wearing somebody else's account. A different colour from the sandbox amber on
   purpose: the two can be on at once, and they mean different things. */
.sandbox-strip.viewing { background: #6d28d9; z-index: 92; }
:root[data-theme="dark"] .sandbox-strip.viewing { background: #5b21b6; }
.strip-btn {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 5px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.14); color: #fff;
  font: 600 12.5px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  transition: background 120ms ease-out, transform 100ms ease-out;
}
.strip-btn:hover { background: rgba(255, 255, 255, 0.26); }
.strip-btn:active { transform: scale(0.97); }
.strip-btn[disabled] { opacity: 0.7; cursor: default; }
.strip-btn svg { width: 14px; height: 14px; }
@media (prefers-reduced-motion: reduce) { .strip-btn { transition: none; } }

/* Outbox — a stacked list, because this screen is read on a phone in a corridor. */
.ob-list { display: flex; flex-direction: column; }
.ob-row { display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 14px; border-bottom: 1px solid var(--line); }
.ob-row:last-child { border-bottom: 0; }
.ob-main { flex: 1; min-width: 0; }
.ob-title { font-weight: 600; font-size: 14.5px; }
.ob-sub { font-size: var(--t-sm); margin-top: 2px; }
.ob-err { font-size: 12px; color: var(--critical); margin-top: 5px; word-break: break-word; }
.ob-side { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; flex: none; }
@media (max-width: 460px) {
  .ob-row { flex-direction: column; gap: 9px; }
  .ob-side { flex-direction: row; align-items: center; width: 100%; }
}


/* ---- accessibility preferences -------------------------------------------
   Reduced motion is not "no feedback" — it is the same information delivered
   without vestibular movement. Transforms become cross-fades; the spring that
   settles the redaction box is skipped in JS and snaps instead. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .scrim > * { transform: none !important; }
  .toast { transform: none !important; }
}

/* Frosted chrome becomes solid rather than merely less blurred — a half-
   transparent bar is exactly what this preference is asking us not to show. */
@media (prefers-reduced-transparency: reduce) {
  .topbar, .tabbar, .side {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: var(--surface) !important;
  }
  .scrim { background: rgba(11, 11, 11, .72) !important; }
}

@media (prefers-contrast: more) {
  :root { --line: color-mix(in srgb, var(--ink) 38%, transparent); }
  .btn, .card, .f input, .f select, .f textarea { border-width: 2px; }
  .muted { color: var(--ink-2); }
  .topbar, .tabbar { backdrop-filter: none; background: var(--surface); }
}

/* ------------------------------------------------------------------- CRM
   The funnel list is rows, not a table: a rep reads it on a phone, and the
   four things they need — who, where they stand, when they were last seen,
   what is due — do not want to be columns. */
.crm-list { display: grid; gap: 8px; }
.crm-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 12px 12px 14px; cursor: pointer; font: inherit; color: inherit;
  transition: border-color .12s, box-shadow .12s, transform .06s;
}
.crm-row:hover { border-color: var(--line-2); box-shadow: var(--sh-1); }
.crm-row:active { transform: scale(.995); background: var(--surface-2); }
.crm-row-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.crm-row-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.crm-row-top b { font-size: 14.5px; font-weight: 640; letter-spacing: -.008em; }
.crm-row-sub { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-row-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11.5px; }
.crm-row-go { flex: none; color: var(--ink-3); display: flex; }
.crm-row-go svg { width: 16px; height: 16px; }

/* a tag is smaller and quieter than a pill: it labels, it does not announce */
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 5px;
  font-size: var(--t-micro); font-weight: 650; letter-spacing: .01em; white-space: nowrap;
}
.tag svg { width: 11px; height: 11px; }
.tag-key  { background: color-mix(in srgb, var(--s7) 16%, var(--surface)); color: var(--s7); }
.tag-due  { background: color-mix(in srgb, var(--critical) 13%, var(--surface)); color: var(--critical); }
.tag-out  { background: var(--surface-3); color: var(--ink-3); }
.tag-open { background: color-mix(in srgb, var(--s1) 13%, var(--surface)); color: var(--s1); }

/* chips as filters: the funnel's counts are the filter, so the two are one control */
button.chip { cursor: pointer; font: inherit; font-size: var(--t-sm); font-weight: 550; color: inherit; }
.chip b {
  font-size: 11.5px; font-weight: 700; background: var(--surface); color: var(--ink-3);
  padding: 1px 6px; border-radius: 20px; margin-left: 2px;
}
.chip.on {
  background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 34%, transparent);
  color: var(--accent);
}
.chip.on b { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--accent); }
button.chip:active { transform: scale(.97); }

/* the stage control on a record header is the pill itself, made pressable */
.stage-btn {
  display: inline-flex; align-items: center; gap: 4px; background: none; border: 0;
  padding: 0; cursor: pointer; font: inherit; color: var(--ink-3);
}
.stage-btn:disabled { cursor: default; }
.stage-btn svg { width: 13px; height: 13px; }
.stage-btn:not(:disabled):active { transform: scale(.97); }

/* label / value pairs, two up where there is room */
.kv-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kv { min-width: 0; }
.kv-k {
  font-size: var(--t-micro); font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3);
}
.kv-v { font-size: 14px; margin-top: 2px; overflow-wrap: break-word; }

.pref-row {
  padding: 9px 0; border-bottom: 1px solid var(--line); gap: 10px; align-items: flex-start;
  color: inherit;
}
.pref-row:last-child { border-bottom: 0; }
a.pref-row:hover { background: var(--surface-2); }
a.pref-row:active { background: var(--surface-3); }
.task-late .kv-v, .task-late { color: inherit; }

/* the history timeline — a rail with a marker per entry */
.tl { display: grid; gap: 2px; }
.tl-row { display: flex; gap: 12px; position: relative; padding-bottom: 14px; }
.tl-row:last-child { padding-bottom: 0; }
.tl-row::before {
  content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 1px;
  background: var(--line);
}
.tl-row:last-child::before { display: none; }
.tl-dot {
  width: 27px; height: 27px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--surface-2); color: var(--ink-3); z-index: 1;
}
.tl-dot svg { width: 14px; height: 14px; }
.tl-visit { background: color-mix(in srgb, var(--s3) 16%, var(--surface)); color: var(--s3); }
.tl-call  { background: color-mix(in srgb, var(--s1) 16%, var(--surface)); color: var(--s1); }
.tl-email { background: color-mix(in srgb, var(--s7) 16%, var(--surface)); color: var(--s7); }
.tl-meeting { background: color-mix(in srgb, var(--s4) 18%, var(--surface)); color: #7a5600; }
.tl-stage { background: var(--accent-soft); color: var(--accent); }
.tl-body { flex: 1; min-width: 0; padding-top: 3px; }
.tl-meta { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 11.5px; }
.tl-meta b { font-size: 13px; font-weight: 640; }
.tl-text { font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; margin-top: 2px; overflow-wrap: break-word; }

/* a count on a button, for the follow-ups badge */
.btn .cnt {
  font-size: var(--t-micro); font-weight: 700; background: var(--critical); color: #fff;
  padding: 1px 6px; border-radius: 20px; margin-left: 1px;
}

/* ---------------------------------------------------------------- onboarding
   The nudge lives above the page, not inside it, so it survives navigation.
   It is a banner and a pair of buttons and nothing else: onboarding that blocks
   a rep standing in a basement with a charge sheet is onboarding that gets the
   app uninstalled. */
.onb-host { max-width: 1180px; margin: 0 auto; padding: 14px 20px 0; }
.onb-host:empty { display: none; }
.onb-nudge { align-items: center; }
.onb-nudge .btn { white-space: nowrap; }
@media (max-width: 720px) {
  .onb-host { padding: 12px 16px 0; }
  .onb-nudge { align-items: flex-start; flex-wrap: wrap; }
  .onb-nudge > .row { width: 100%; }
}

.banner-good { background: color-mix(in srgb, var(--good) 15%, var(--surface)); color: var(--ink); }

.onb-step { padding: 11px 0; border-top: 1px solid var(--line); gap: 12px; align-items: flex-start; }
.onb-step:first-child { border-top: 0; }
.onb-tick {
  width: 21px; height: 21px; border-radius: 50%; flex: none; margin-top: 1px;
  border: 1.6px solid var(--line-2, var(--line)); display: grid; place-items: center;
  color: var(--surface);
}
.onb-tick.on { background: var(--good); border-color: var(--good); }
.onb-tick svg { width: 13px; height: 13px; }

/* ------------------------------------------------------- custody chain dots
   The chain reuses the CRM timeline, but here the dot carries a state rather
   than a kind: signed, refused, or still waiting on somebody. */
.tl-dot.on { background: color-mix(in srgb, var(--good) 20%, var(--surface)); color: var(--good-ink); }
.tl-dot.bad { background: color-mix(in srgb, var(--critical) 18%, var(--surface)); color: var(--critical); }
.tl-dot:not(.on):not(.bad):not([class*="tl-"]) {
  background: color-mix(in srgb, var(--warning) 22%, var(--surface));
}
input.fld.sig { font-family: "Segoe Script", "Bradley Hand", cursive; font-size: 19px; }

/* ---------------------------------------------------------------- the egg
   Shown once to whoever is made an owner, and to nobody else, ever. Gold on a
   dark grid — the ranks are named off the Grid, so this is where that shows.
   Everything animated is transform or opacity, and all of it stops dead under
   prefers-reduced-motion: a surprise should never be the thing that makes
   somebody feel sick. */
.egg-veil {
  position: fixed; inset: 0; z-index: 400;
  display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1200px 600px at 50% 40%, rgba(212, 160, 23, 0.16), transparent 70%),
    linear-gradient(180deg, #05070b 0%, #0a0d14 100%);
  animation: egg-in 420ms ease-out both;
}
.egg-veil::before {                       /* the grid, receding */
  content: ""; position: absolute; inset: 0; opacity: 0.25; pointer-events: none;
  background-image:
    linear-gradient(rgba(120, 200, 255, 0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 200, 255, 0.10) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, transparent, #000 55%, transparent);
}
@keyframes egg-in { from { opacity: 0 } to { opacity: 1 } }

.egg-stage { position: relative; text-align: center; max-width: 560px; }

.egg-shell {
  width: 132px; height: 170px; margin: 0 auto 26px;
  border-radius: 50% 50% 48% 48% / 62% 62% 38% 38%;
  background: linear-gradient(155deg, #fde9a9 0%, #e8b73c 38%, #a9741a 72%, #6d4a10 100%);
  box-shadow:
    0 0 0 1px rgba(255, 240, 200, 0.35),
    0 10px 60px rgba(226, 170, 40, 0.45),
    inset -10px -16px 30px rgba(0, 0, 0, 0.35),
    inset 8px 10px 26px rgba(255, 245, 210, 0.5);
  cursor: pointer;
  animation: egg-float 4.5s ease-in-out infinite;
  transition: transform var(--dur-1) ease-out;
}
.egg-shell:hover { transform: scale(1.03); }
.egg-shell:active { transform: scale(0.98); }
@keyframes egg-float {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50%      { transform: translateY(-12px) rotate(1.5deg); }
}
.egg-shell.cracked { animation: egg-crack 900ms cubic-bezier(.2,.9,.3,1) forwards; }
@keyframes egg-crack {
  0%   { transform: scale(1) rotate(0); }
  18%  { transform: scale(1.06) rotate(-4deg); }
  36%  { transform: scale(0.97) rotate(5deg); }
  60%  { transform: scale(1.12) rotate(-2deg); opacity: 1; }
  100% { transform: scale(2.2) rotate(0); opacity: 0; }
}

.egg-hint { color: #d8c48a; font: 500 13.5px/1.5 system-ui, sans-serif; letter-spacing: 0.02em; }
.egg-note {
  margin-top: 6px; padding: 26px 26px 22px; text-align: left;
  border-radius: 14px; border: 1px solid rgba(226, 190, 110, 0.35);
  background: rgba(10, 13, 20, 0.86);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: egg-rise 620ms cubic-bezier(.2,.9,.3,1) both;
}
@keyframes egg-rise { from { opacity: 0; transform: translateY(16px) scale(0.98) } to { opacity: 1; transform: none } }
.egg-note h2 {
  margin: 0 0 14px; color: #f3dca2;
  font: 650 23px/1.25 system-ui, sans-serif; letter-spacing: -0.015em;
}
.egg-note p { margin: 0 0 13px; color: #e6e3da; font: 400 15px/1.65 system-ui, sans-serif; }
.egg-note .egg-sign { margin-top: 18px; color: #d8c48a; font-weight: 600; }
.egg-veil .btn-egg {
  margin-top: 20px; width: 100%;
  background: linear-gradient(180deg, #edc455, #c6901d);
  color: #2a1d02; border: none; font-weight: 700;
}
@media (prefers-reduced-motion: reduce) {
  .egg-veil, .egg-shell, .egg-shell.cracked, .egg-note { animation: none !important; }
  .egg-shell.cracked { opacity: 0; }
}

/* ---------------------------------------------------------------- the bell
   A count in the corner that reads as part of the bar rather than stuck on it,
   and a row style for the panel behind it. The dot is only ever drawn when there
   is something unread — a badge showing "0" is a badge people stop reading. */
.bellbtn { position: relative; }
.bell-n {
  position: absolute; top: 1px; right: 1px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 9px; background: var(--critical); color: #fff;
  font: 650 10.5px/16px system-ui, sans-serif; text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}
.notif {
  display: flex; gap: 11px; align-items: flex-start; width: 100%; text-align: left;
  padding: 11px 12px; border: 0; border-radius: var(--r); background: transparent;
  color: inherit; cursor: pointer; font: inherit;
  -webkit-tap-highlight-color: transparent;
}
.notif:hover { background: var(--plane); }
.notif:active { transform: scale(.995); }
.notif.unread { background: var(--accent-soft); }
.notif-i { flex: none; margin-top: 1px; color: var(--ink-3); }
.notif-i svg { width: 17px; height: 17px; }
.notif-b { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.notif-t { font-size: 13.8px; font-weight: 600; line-height: 1.35; }
.notif-d {
  font-size: var(--t-sm); color: var(--ink-3); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.notif-w { font-size: 11.5px; color: var(--ink-3); }
.notif-dot {
  flex: none; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); margin-top: 6px;
}
@media (prefers-reduced-motion: reduce) { .notif:active { transform: none; } }

/* ---------------------------------------------------------------- help
   Numbered steps that read as steps. The counter sits in its own column so a
   step that wraps onto three lines still lines up under itself rather than
   stepping back under the number. */
.help-steps { list-style: none; counter-reset: hs; padding-left: 0; margin: 0 0 14px; }
.help-steps > li {
  counter-increment: hs; position: relative;
  padding-left: 30px; margin-bottom: 9px; line-height: 1.55;
}
.help-steps > li::before {
  content: counter(hs);
  position: absolute; left: 0; top: 1px;
  width: 21px; height: 21px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
  font-size: 11.5px; font-weight: 700;
}
.help-body h4 {
  font-size: 14px; font-weight: 650; letter-spacing: -.01em;
  margin: 20px 0 7px; padding-top: 14px; border-top: 1px solid var(--line);
}
.help-body h4:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.help-body p { line-height: 1.6; }
.help-body ul { line-height: 1.6; }
.help-body > .banner { margin: 12px 0; }

/* ---------------------------------------------------------------- walkthroughs
   The coaching lives in a strip pinned to an edge, never over the content. The
   first version floated a card beside whatever was lit, which on a phone sat
   directly on top of the thing being taught — worst of all on the redaction
   step, the one step where you have to see the whole page. */

.tour { position: fixed; inset: 0; z-index: 2000; pointer-events: none; }


.tour-lit {
  position: relative; z-index: 2001;
  border-radius: var(--r-sm, 8px);
  box-shadow: 0 0 0 2.5px var(--accent), 0 0 0 7px color-mix(in srgb, var(--accent) 24%, transparent);
}

.tour-bar {
  position: fixed; z-index: 2002; pointer-events: auto;
  left: 50%; transform: translateX(-50%);
  bottom: calc(14px + var(--sab, env(safe-area-inset-bottom)));
  width: min(720px, calc(100vw - 24px));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: saturate(170%) blur(16px);
  color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 10px 34px rgba(0,0,0,.30), 0 1px 4px rgba(0,0,0,.16);
  padding: 9px 11px;
  transition: bottom .22s cubic-bezier(.3,0,0,1), top .22s cubic-bezier(.3,0,0,1);
}
/* Moved out of the way when the lit element is itself near the bottom. */
.tour-bar.tour-bar-top { bottom: auto; top: calc(12px + var(--sat, env(safe-area-inset-top))); }

.tour-line { display: flex; align-items: center; gap: 10px; }
.tour-say {
  flex: 1; min-width: 0;
  font-size: 13px; line-height: 1.45; color: var(--ink-2);
}
.tour-say strong { color: var(--ink); font-weight: 650; }
.tour-step {
  flex: none;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  color: var(--accent); font-variant-numeric: tabular-nums;
}
.tour-acts { display: flex; align-items: center; gap: 5px; flex: none; }
.tour-more {
  background: none; border: 0; cursor: pointer; padding: 3px 5px; border-radius: var(--r-xs);
  font: inherit; font-size: 11.5px; font-weight: 650; color: var(--ink-3);
}
.tour-more:hover { color: var(--ink); background: var(--surface-2); }
.tour-note {
  margin: 7px 0 1px; padding-left: 10px;
  border-left: 2px solid var(--line);
  font-size: var(--t-sm); line-height: 1.5; color: var(--ink-3);
}
.tour-x {
  background: none; border: 0; cursor: pointer; color: var(--ink-3);
  padding: 3px; border-radius: var(--r-xs); display: grid; place-items: center;
}
.tour-x svg { width: 15px; height: 15px; }
.tour-x:hover { color: var(--ink); background: var(--surface-2); }
.tour-wait {
  display: inline-flex; align-items: center; gap: 3px; white-space: nowrap;
  font-size: 11.5px; font-weight: 650; color: var(--accent);
}
.tour-wait svg { width: 13px; height: 13px; }

@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  /* above the tab bar, not over it */
  .tour-bar { bottom: calc(62px + var(--sab, env(safe-area-inset-bottom))); width: calc(100vw - 16px); padding: 8px 9px; }
  .tour-bar.tour-bar-top { top: calc(8px + var(--sat, env(safe-area-inset-top))); }
  .tour-line { flex-wrap: wrap; gap: 6px 8px; }
  .tour-say { flex: 1 1 100%; order: 2; font-size: var(--t-sm); }
  .tour-step { order: 1; }
  .tour-acts { order: 1; margin-left: auto; }
}

/* ── the construct record ────────────────────────────────────────────────────
   A dictation card is filled in standing up, on a phone, in a corridor. So the
   row is not a table: a table wide enough for level, side, three dimensions, an
   angle, a catalogue number and a lot number needs sideways scrolling to reach
   the lot number, and the lot number is the field that matters. Labelled fields
   that wrap keep every column reachable at any width. */
.backlink {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--ink-3); font-size: var(--t-sm); font-weight: 550; margin-bottom: 4px;
}
.backlink:hover { color: var(--ink-2); }
.backlink svg { width: 14px; height: 14px; }
.tiny { font-size: 11.5px; }
input.fld-sm, select.fld-sm {
  padding: 6px 8px; font-size: 13px; width: 100%; max-width: none; min-height: 36px;
}

.cgroup + .cgroup { margin-top: 12px; }
.crow {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.crow:first-child { border-top: 0; }
.crow-n {
  flex: none; width: 20px; padding-top: 20px;
  font-size: 11.5px; font-weight: 700; color: var(--ink-3);
}
.crow-f {
  flex: 1; min-width: 0; display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
}
.cfield { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cfield-wide { grid-column: span 2; }
.cfield-l {
  font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 650;
}

.pickrow {
  display: flex; align-items: flex-start; gap: 10px; padding: 9px 2px;
  border-top: 1px solid var(--line); cursor: pointer;
}
.pickrow:first-of-type { border-top: 0; }
.pickrow input { margin-top: 3px; flex: none; }

/* ── operative imaging ──────────────────────────────────────────────────────
   Fixed tiles in a grid rather than a free-flowing list, so a before and its
   after stay the same size and sit next to each other. That adjacency is the
   whole value of the report: the eye does the comparison, not the caption. */
.imgrid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.imtile {
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
  background: var(--surface-2); display: flex; flex-direction: column;
}
.imtile-h {
  padding: 7px 10px; font-size: 11.5px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  border-bottom: 1px solid var(--line); color: var(--ink-2);
}
.imtile.im-pre  .imtile-h { background: color-mix(in srgb, var(--s4) 16%, transparent); }
.imtile.im-post .imtile-h { background: color-mix(in srgb, var(--s3) 16%, transparent); }
.imtile-b {
  flex: 1; min-height: 92px; display: grid; place-items: center; gap: 5px;
  padding: 16px 10px; text-align: center;
}
.imtile-b svg { width: 22px; height: 22px; color: var(--ink-3); }
.imtile.on .imtile-b svg { color: var(--good-ink); }
.imtile-f {
  display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line);
}

/* ── the back control ────────────────────────────────────────────────────────
   §16 Wayfinding: every screen has to answer "how do I get out", and until now
   the answer was "open the menu and work it out". One control, top-left, in the
   same place on every screen — inside the bar on a phone, beside the wordmark on
   a desktop.

   It is hidden, not removed, when there is nowhere to go back to. Removing it
   would shift the wordmark sideways on every navigation, which is exactly the
   kind of movement the app was just fixed to stop doing. */
.backbtn { flex: none; margin-right: 2px; }
.backbtn svg { width: 19px; height: 19px; }
/* §1 Response: the press is acknowledged on pointer-down, not on release. */
.backbtn:active:not(:disabled) { transform: scale(0.92); }
.backbtn { transition: transform 110ms cubic-bezier(.3,0,0,1); }
@media (prefers-reduced-motion: reduce) {
  .backbtn { transition: none; }
  .backbtn:active:not(:disabled) { transform: none; }
}
/* One of the two is always the wrong one for the viewport. */
.back-side { display: none; }
.back-top  { display: inline-flex; }
@media (min-width: 701px) and (min-height: 521px), (min-width: 961px) {
  .back-side { display: inline-flex; margin-right: 8px; }
  .back-top  { display: none; }
}

/* ── the courier network ─────────────────────────────────────────────────────
   A job is read in a van, often one-handed, often in poor light. So a row is a
   single tall target with the two things that decide whether to take it —
   urgency and where it's going — set above everything else. */
.delrow {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 13px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface-2); color: inherit;
  transition: transform 120ms cubic-bezier(.3,0,0,1), border-color 120ms ease;
}
.delrow:hover { border-color: var(--line-2); }
/* §1: the press is acknowledged on pointer-down, not on release. */
.delrow:active { transform: scale(0.988); }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }

.bidrow {
  display: flex; align-items: flex-start; gap: 12px; padding: 11px 0;
  border-top: 1px solid var(--line);
}
.bidrow:first-child { border-top: 0; padding-top: 0; }

.kv { display: flex; flex-direction: column; gap: 7px; }
.kvrow { display: flex; gap: 12px; align-items: baseline; }
.kvrow > span:first-child { flex: none; width: 110px; font-size: var(--t-sm); }

.photostrip { display: flex; gap: 8px; flex-wrap: wrap; }
.photochip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--ink-2); font: inherit; font-size: var(--t-sm);
}
.photochip:hover { border-color: var(--line-2); color: var(--ink); }
.photochip svg { width: 14px; height: 14px; }
.photochip em { font-style: normal; color: var(--ink-3); }

/* The timeline. The dot column is what makes it read as a sequence rather than
   as a list — and the two custody lines sit under their own event, because a
   release and an acceptance are two separate acts with a gap between them. */
.timeline { display: flex; flex-direction: column; }
.tl-row { display: flex; gap: 11px; padding: 9px 0; position: relative; }
.tl-row::before {
  content: ""; position: absolute; left: 4.5px; top: 0; bottom: 0;
  width: 1px; background: var(--line);
}
.tl-row:first-child::before { top: 16px; }
.tl-row:last-child::before { bottom: calc(100% - 16px); }
.tl-dot {
  flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 5px;
  background: var(--ink-3); position: relative; z-index: 1;
  box-shadow: 0 0 0 3px var(--surface);
}
.tl-picked_up .tl-dot, .tl-awarded .tl-dot { background: var(--s3); }
.tl-delivered .tl-dot { background: var(--good-ink); }
.tl-delayed .tl-dot, .tl-cancelled .tl-dot { background: var(--s2); }

.pickgrid { display: grid; gap: 7px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.pickchip {
  display: flex; align-items: flex-start; gap: 8px; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-2); cursor: pointer; font-size: 13px;
}
.pickchip:hover { border-color: var(--line-2); }
.pickchip input { margin-top: 2px; flex: none; }

@media (prefers-reduced-motion: reduce) {
  .delrow { transition: none; }
  .delrow:active { transform: none; }
}

/* Rating stars. Big enough to hit with a thumb in a van — §10 says a tap target
   wants ~10px of slack around it, and a 44px control is the floor on a phone. */
.starbtn {
  background: none; border: 0; cursor: pointer; font: inherit;
  font-size: 30px; line-height: 1; padding: 4px 6px; min-width: 44px; min-height: 44px;
  color: var(--line-2);
  transition: transform 110ms cubic-bezier(.3,0,0,1), color 110ms ease;
}
.starbtn.on { color: var(--s4); }
.starbtn:active { transform: scale(0.88); }
@media (prefers-reduced-motion: reduce) {
  .starbtn { transition: none; }
  .starbtn:active { transform: none; }
}

/* ===================================================== the command palette
   A floating material over a dimmed page (§12): this is a modal task, so the
   background is both dimmed and pushed back rather than merely blurred. It
   enters by materialising — blur and scale together — so it reads as a surface
   arriving rather than an opacity fade.

   Anchored to the top of the viewport, not centred, because the list grows
   downward as you type and a centred box would slide the first result out from
   under the cursor on every keystroke. */
.pal-scrim {
  position: fixed; inset: 0; z-index: 90;
  display: flex; justify-content: center; align-items: flex-start;
  padding: max(10vh, 48px) 16px 16px;
  background: color-mix(in srgb, var(--ink) 34%, transparent);
  backdrop-filter: blur(3px);
  animation: pal-in var(--dur-1) cubic-bezier(.22,.61,.36,1);
}
.pal {
  width: 100%; max-width: 620px;
  display: flex; flex-direction: column; min-height: 0;
  max-height: min(60vh, 560px);
  border-radius: var(--r-lg); overflow: hidden;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-top-color: color-mix(in srgb, #fff 42%, transparent);  /* light on the top edge */
  box-shadow: 0 28px 70px -12px color-mix(in srgb, var(--ink) 46%, transparent),
              0 2px 8px -2px color-mix(in srgb, var(--ink) 18%, transparent);
  animation: pal-rise 220ms cubic-bezier(.22,.61,.36,1);
}
@keyframes pal-in   { from { opacity: 0 } to { opacity: 1 } }
@keyframes pal-rise {
  from { opacity: 0; transform: translateY(-10px) scale(.985); filter: blur(5px); }
  to   { opacity: 1; transform: none; filter: none; }
}

.pal-top {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 15px; flex: none;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.pal-top svg { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.pal-in {
  flex: 1; min-width: 0; border: 0; background: none; outline: none;
  color: var(--ink); font: inherit; font-size: 16.5px; letter-spacing: -.005em;
}
.pal-in::placeholder { color: var(--ink-3); }

.pal-list { overflow-y: auto; overscroll-behavior: contain; padding: 6px; min-height: 0; }
.pal-group {
  font-size: var(--t-micro); font-weight: 650; letter-spacing: .055em; text-transform: uppercase;
  color: var(--ink-3); padding: 10px 10px 4px;
}
.pal-row {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 9px; cursor: pointer;
  /* No transition on the highlight: it tracks the arrow keys, and an eased
     background lags a held keypress into a smear. */
}
.pal-row svg { width: 17px; height: 17px; color: var(--ink-3); flex: none; }
.pal-row.on { background: color-mix(in srgb, var(--accent) 13%, transparent); }
.pal-row.on svg, .pal-row.on .pal-l { color: var(--accent); }
.pal-l { font-size: 14.5px; font-weight: 520; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-s { font-size: var(--t-sm); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-k {
  flex: none; font-size: var(--t-micro); font-weight: 600; color: var(--ink-3);
  padding: 2px 7px; border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 7%, transparent);
}
.pal-empty { padding: 26px 12px; text-align: center; color: var(--ink-3); font-size: 14px; }

.pal-hint {
  display: flex; gap: 16px; flex: none; padding: 9px 15px;
  border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  font-size: 11.5px; color: var(--ink-3);
}
.pal-hint kbd {
  font: inherit; font-size: var(--t-micro); padding: 1px 5px; margin-right: 3px;
  border-radius: 4px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--ink) 5%, transparent);
}
/* On a phone there is no keyboard to tell anybody about, and the bar is better
   spent on results. */
@media (max-width: 620px) {
  .pal-scrim { padding-top: 24px; }
  .pal { max-height: 76svh; }
  .pal-hint { display: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .pal { background: var(--surface); backdrop-filter: none; }
  .pal-scrim { backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  .pal { background: var(--surface); border-color: var(--ink-2); }
}
@media (prefers-reduced-motion: reduce) {
  .pal-scrim, .pal { animation: pal-in 140ms ease; }
  .pal { transform: none; filter: none; }
}

/* A row of filters above a long table. Wraps to one per line on a phone rather
   than squeezing six controls into a width none of them fit. */
.filters {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.filters .f { margin: 0; }

/* ---------------------------------------------------------------- plan the day */
.plan-ctl { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px 14px; align-items: end; }
.plan-ctl .f { margin: 0; }
.plan-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.plan-map-card { padding: 0; overflow: hidden; position: sticky; top: 12px; }
.plan-canvas { height: clamp(320px, calc(100vh - 260px), 720px); }
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .plan-grid { grid-template-columns: 1fr; }
  .plan-map-card { position: static; order: -1; }
  .plan-canvas { height: 300px; }
}
.plan-stops { display: flex; flex-direction: column; }
.plan-stop { display: flex; gap: 12px; align-items: flex-start; padding: 12px 18px; border-top: 1px solid var(--line); }
.plan-stop.compact { padding: 9px 16px; gap: 10px; }
.plan-stop.is-done { opacity: .62; }
.plan-stop.is-skipped { opacity: .45; }
.plan-stop.is-skipped .plan-name { text-decoration: line-through; }
.plan-n { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; font: 700 11.5px/1 system-ui, sans-serif; margin-top: 1px; }
.plan-n > svg { width: 13px; height: 13px; }
.plan-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.plan-name { font-weight: 600; color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
a.plan-name:hover { text-decoration: underline; }
.plan-time { color: var(--ink-2); font-size: 13px; white-space: nowrap; margin-left: 10px; }
.plan-sub { font-size: var(--t-sm); overflow: hidden; text-overflow: ellipsis; }
.plan-why { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 3px; }
.plan-tag { font-size: 11.5px; line-height: 1; padding: 4px 7px; border-radius: var(--r-xs); color: var(--ink-2);
  background: color-mix(in srgb, var(--ink-3) 12%, transparent); }
.plan-tag.warn { color: var(--s4); background: color-mix(in srgb, var(--s4) 13%, transparent); }
.plan-tag.good { color: var(--s6); background: color-mix(in srgb, var(--s6) 13%, transparent); }
.plan-week { display: grid; gap: 12px; }
.cal-appt { border-style: dashed !important; background: transparent !important; }

/* ---------------------------------------------------------------- grouped sidebar
   Everyday screens stay one click away; everything else folds into groups that
   open on demand. Height animates through grid-template-rows 0fr → 1fr, which the
   browser re-targets from the current value if you click again mid-motion, so a
   group can be reversed half-open rather than finishing first (§3). */
.nav-search {
  display: flex; align-items: center; gap: 8px; width: 100%;
  margin: 2px 0 10px; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-3);
  font: 500 13px/1 inherit; cursor: pointer; text-align: left;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.nav-search:hover { color: var(--ink-2); border-color: color-mix(in srgb, var(--ink-3) 40%, var(--line)); }
.nav-search:active { transform: scale(.985); }
.nav-search svg { width: 15px; height: 15px; flex: none; }
.nav-search kbd {
  margin-left: auto; font: 600 10.5px/1 system-ui, sans-serif; letter-spacing: .02em;
  padding: 3px 5px; border-radius: 5px; background: var(--surface); border: 1px solid var(--line);
  color: var(--ink-3);
}
.nav-home { display: flex; flex-direction: column; gap: 1px; padding-bottom: 8px; margin-bottom: 6px;
  border-bottom: 1px solid var(--line); }

.nav-grp-h {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 9px;
  border: 0; background: none; border-radius: var(--r-sm); cursor: pointer; text-align: left;
  color: var(--ink-2); font: 600 13.5px/1.2 inherit; letter-spacing: -.005em;
  transition: background .15s ease, color .15s ease;
}
.nav-grp-h:hover { background: var(--surface-2); color: var(--ink); }
.nav-grp-h:active { transform: scale(.985); }
.nav-grp-h > svg { width: 17px; height: 17px; flex: none; color: var(--ink-3); }
.nav-grp-t { flex: 1; min-width: 0; }
.nav-grp-h .nav-chev {
  width: 13px; height: 13px; color: var(--ink-3); opacity: .8;
  transition: transform .32s cubic-bezier(.32, .72, 0, 1);
}
.nav-grp.open .nav-chev { transform: rotate(90deg); }
/* A folded group that holds the screen you are on, or something waiting for you,
   says so without having to be opened. */
.nav-grp:not(.open):has(a.on) .nav-grp-h { color: var(--accent); }
.nav-grp:not(.open):has(a.on) .nav-grp-h > svg:first-child { color: var(--accent); }
.nav-grp-dot { display: none; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.nav-grp:not(.open):has(.cnt) .nav-grp-dot { display: block; }

.nav-grp-b {
  display: grid; grid-template-rows: 0fr; opacity: 0;
  transition: grid-template-rows .32s cubic-bezier(.32, .72, 0, 1), opacity .2s ease;
}
.nav-grp.open .nav-grp-b { grid-template-rows: 1fr; opacity: 1; }
.nav-grp-i {
  overflow: hidden; min-height: 0; display: flex; flex-direction: column; gap: 1px;
  margin-left: 17px; padding-left: 9px; border-left: 1px solid var(--line);
}
.nav-grp.open .nav-grp-i { padding-top: 2px; padding-bottom: 6px; }
.nav-grp-i a { padding: 7px 9px; font-size: 13.5px; }
.nav-grp-i a svg { width: 15px; height: 15px; }

/* mobile menu: the same groups, as tiles */
.menu-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 2px 4px 4px; }
.menu-grp a.menu-tile {
  flex-direction: column; justify-content: center; gap: 6px; min-height: 74px; padding: 10px 6px;
  border-radius: 14px; background: var(--surface-2); text-align: center;
  font-size: var(--t-sm); font-weight: 560; line-height: 1.15;
  transition: transform .12s ease, background .15s ease;
}
.menu-grp a.menu-tile svg { width: 20px; height: 20px; }
.menu-grp a.menu-tile span { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.menu-grp a.menu-tile:active { transform: scale(.96); background: var(--surface-3); }
.menu-grp a.menu-tile.on { background: var(--accent-soft); }
.menu-grp a.menu-tile .cnt { position: absolute; top: 6px; right: 8px; margin: 0; }
.menu-tile { position: relative; }
/* The sidebar's accent rail is for rows. On a tile it drew a bar half outside the
   tile's rounded edge; the tile already says "current" with its fill and colour. */
.menu-grp a.menu-tile::before { display: none; }

@media (prefers-reduced-motion: reduce) {
  .nav-grp-b, .nav-grp-h .nav-chev, .menu-grp a.menu-tile { transition: none; }
}
@media (prefers-contrast: more) {
  .nav-grp-i { border-left-color: var(--ink-3); }
  .nav-search { border-color: var(--ink-3); }
}

/* ------------------------------------------------ the menu pass, and its limits
   Everything above gives both menus the same vocabulary: a translucent surface,
   a group that is a hairline and a word, an accent rail that travels to whatever
   is current, and feedback on the press rather than the release.

   Three accessibility signals are honoured rather than assumed, because a
   translucent, animated menu is exactly the kind of thing each of them is about
   (apple-design §14). */

/* Reduced motion: the rail still marks the current screen, it just stops
   travelling, and nothing scales under a finger. */
@media (prefers-reduced-motion: reduce) {
  .nav a, .nav a::before, .menu-grp a, .menu-grp a::before { transition: none; }
  .nav a:active, .menu-grp a:active { transform: none; }
}

/* Reduced transparency: the material becomes a surface. The blur is what costs
   legibility, so the blur is what goes. */
@media (prefers-reduced-transparency: reduce) {
  .side, .menu-panel { backdrop-filter: none; background: var(--surface); }
}

/* More contrast: a defined edge rather than a soft fill, and the rail does the
   work of saying which row is current. */
@media (prefers-contrast: more) {
  .side, .menu-panel { backdrop-filter: none; background: var(--surface); }
  .nav a.on, .menu-grp a.on {
    background: transparent; outline: 1px solid var(--accent); outline-offset: -1px;
  }
}

/* The sheet's own scroll edge, so a list that continues below the fold says so.
   This is the thing Binika's screenshot could not have told us either way. */
.menu-scroll {
  mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 20px), transparent 100%);
}

/* "A new version is ready." Not the amber of the sandbox warning — nothing is
   wrong, there is simply something newer. */
/* FE_UPDATE_STRIP_CONTRAST_V1: a deeper accent (same as the seat-grace strip) so white 13 px
   text clears 4.5:1 in dark mode too (8.4:1 light, 6.2:1 dark with the default accent). */
.sandbox-strip.update { background: color-mix(in srgb, var(--accent) 68%, #000); }
:root[data-theme="dark"] .sandbox-strip.update { background: color-mix(in srgb, var(--accent) 68%, #000); }
.sandbox-strip.update .btn {
  background: rgba(255,255,255,.18); color: #fff; border-color: rgba(255,255,255,.35);
  flex: none;
}
/* FE_UPDATE_STRIP_TARGET_V1: under a thumb the Reload button is a real 44 px (it was a 36 px
   .btn-sm), the same size as the retired-build Reload. The negative block margin keeps the strip
   as tall as before (the seat strip's Details / x use the same trick); the .btn-sm hit-slop
   ::after is not needed once the box itself is 44. Desktop with a mouse is unchanged. */
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px), (pointer: coarse) {
  .sandbox-strip.update .btn { min-height: 44px; min-width: 64px; margin-block: -6px; padding-inline: 14px; }
  .sandbox-strip.update .btn::after { inset: 0; }
}

/* ---------------------------------------------------------------- scanning */
.scan-bar {
  display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r);
  box-shadow: var(--sh-1); transition: box-shadow .18s, border-color .18s, transform .18s;
}
.scan-bar > svg { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.scan-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.scan-bar.got { border-color: var(--good); box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 22%, transparent); transform: scale(1.006); }
.scan-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink);
  font: 500 16px/1.3 var(--font); padding: 8px 0; }
.scan-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 45%, transparent); animation: scan-pulse 2.4s infinite; }
@keyframes scan-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 45%, transparent); }
  70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.scan-cam { flex: none; }
.scan-stage { position: relative; border-radius: var(--r); overflow: hidden; background: #000; aspect-ratio: 4 / 3; max-height: 60vh; }
.scan-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-reticle { position: absolute; inset: 22% 12%; border: 2px solid rgba(255,255,255,.85); border-radius: var(--r);
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.28); transition: border-color .15s, transform .2s cubic-bezier(.3,1.4,.5,1); }
.scan-reticle.flash { border-color: var(--good); transform: scale(1.04); }
.scan-status { font-size: 13px; color: var(--ink-2); text-align: center; min-height: 18px; }
.scan-log { display: grid; gap: 4px; max-height: 140px; overflow: auto; }
.scan-log-row { display: flex; gap: 8px; align-items: center; font: 12.5px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink-2); animation: bio-in .22s ease-out; }
.scan-log-row svg { width: 14px; height: 14px; color: var(--good); }

/* ---------------------------------------------------------------- biologics */
.bio-tabs { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.bio-tabs::-webkit-scrollbar { display: none; }
.bio-tabs .tab-l { white-space: nowrap; }
.bio-feed { display: grid; gap: 6px; }
.bio-hit { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: var(--r-sm);
  background: var(--surface); box-shadow: var(--sh-1); animation: bio-in .24s cubic-bezier(.3,1.3,.5,1); }
.bio-hit > svg { width: 18px; height: 18px; flex: none; }
.bio-hit.ok > svg { color: var(--good); }
.bio-hit.bad { background: color-mix(in srgb, var(--critical) 8%, var(--surface)); }
.bio-hit.bad > svg { color: var(--critical); }
.bio-hit.warn > svg { color: var(--s4); }
.bio-hit .grow small { display: block; color: var(--ink-3); }
@keyframes bio-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.bio-count { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.bio-count .tile .v { font-variant-numeric: tabular-nums; transition: transform .2s cubic-bezier(.3,1.5,.5,1); }
.bio-count .tile.bump .v { transform: scale(1.12); }
.bio-label { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.bio-slot { border: 1px dashed var(--line-2); border-radius: var(--r-sm); padding: 8px 10px; min-height: 52px; }
.bio-slot.on { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.bio-slot .k { font-size: var(--t-micro); font-weight: 650; color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; }
.bio-slot .v { font: 600 14px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.bio-slot .v.empty { color: var(--ink-3); font-weight: 400; font-family: var(--font); }
.bio-sig { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); }
.bio-sig svg { color: var(--good-ink); flex: none; margin-top: 2px; }
.bio-sig small { display: block; color: var(--ink-3); }
.bio-sig .mono { font-size: var(--t-micro); color: var(--ink-3); overflow-wrap: anywhere; }
.bio-pf { display: inline-flex; gap: 2px; background: var(--surface-2); border-radius: var(--r-sm); padding: 2px; }
.bio-pf button { border: 0; background: transparent; padding: 5px 10px; border-radius: var(--r-xs); font: 600 12.5px var(--font); color: var(--ink-2); cursor: pointer; }
.bio-pf button.on.pass { background: var(--good); color: #fff; }
.bio-pf button.on.fail { background: var(--critical); color: #fff; }
.bio-pf button.on.na { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
.bio-pf button:active { transform: scale(.96); }
.bio-steps { display: flex; gap: 6px; flex-wrap: wrap; }
.bio-step { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; font-size: var(--t-sm); font-weight: 600;
  background: var(--surface-2); color: var(--ink-3); }
.bio-step.done { background: color-mix(in srgb, var(--good) 14%, var(--surface)); color: var(--good-ink); }
.bio-step.now { background: var(--accent-soft); color: var(--accent); }
.bio-step svg { width: 14px; height: 14px; }
.tbl input.fld-sm { width: 70px; }
@media (max-width: 640px) {
  .bio-label { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scan-input { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  .scan-dot, .bio-hit, .scan-log-row { animation: none; }
  .scan-bar, .scan-reticle, .bio-count .tile .v { transition: none; }
}

/* ---------------------------------------------------------------- agreements */
tr.bio-changed > td { background: color-mix(in srgb, var(--s4) 9%, transparent); }


/* ================================================================ the phone shell
   Header and tab bar that never move, and an app that never zooms.

   Every earlier fix kept the same structure — a scrolling DOCUMENT with a sticky
   header on top and a fixed tab bar underneath — and tuned it: measured safe
   areas, removed compositor hints, clipped the root. Each helped and none could
   finish the job, because on a phone the document is the one thing the browser
   reserves the right to move: Safari collapses its toolbar as the document
   scrolls, rubber-bands it past the ends, slides it under the keyboard, and
   zooms it on a pinch or a focused field. Anything attached to the document's
   scroll goes along for the ride for a frame or two, which is the drift.

   So on a phone the document no longer scrolls at all. The body is pinned to the
   screen and laid out as a column: header, then a scrolling region, then the tab
   bar. Only .scroller scrolls, the header and tab bar are plain rows with nothing
   to be sticky or fixed against, and there is no document movement left for the
   browser to animate. Desktop is untouched. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  html, body { height: 100%; overflow: hidden; }
  html { touch-action: manipulation; }          /* no double-tap zoom */
  body {
    /* Pinned to the top, sized by height rather than by bottom: 0. On some iOS
       versions the home-screen app's layout viewport stops short of the screen,
       so `inset: 0` left a band of empty canvas under the tab bar. --app-h is set
       by fitShell() in lib.js to the real screen height when installed. */
    position: fixed; top: 0; left: 0; right: 0; width: 100%;
    height: 100%; height: var(--app-h, 100dvh);
    display: flex; flex-direction: column;
    overscroll-behavior: none;
  }
  /* the strips (sandbox, viewing-as, new version) are rows above the app */
  body > .sandbox-strip { position: relative; top: auto; flex: none; }
  body > .sandbox-strip:first-child { padding-top: calc(8px + var(--sat, env(safe-area-inset-top))); }
  #app {
    /* min-height overrides the desktop 100svh: a column row taller than the
       body pushed the tab bar's labels off the bottom of the screen */
    flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
    overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  }
  #app > .shell { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  .auth { min-height: 100%; }
  .shell > .content { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  .shell .topbar { position: relative; top: auto; flex: none; }
  body:has(> .sandbox-strip) .shell .topbar { padding-top: 10px; }
  /* b-iphone-top-gap-still (2026-10-24): the "Complete your training" strip is
     also a row above #app, but it never took the top inset and the topbar kept
     its own, so the strip hid under the status bar and the inset was paid a
     second time below it = the blank band over the header. Exactly one element
     owns the top inset: whichever strip is first, else the topbar. */
  body > .training-strip:first-child { padding-top: calc(8px + var(--sat, env(safe-area-inset-top))); }
  body:has(> .training-strip) .shell .topbar { padding-top: 10px; }
  .shell .scroller {
    flex: 1 1 auto; min-height: 0;
    overflow-x: hidden; overflow-y: auto;
    overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  }
  .shell .main { padding-bottom: 28px; }
  #app > .tabbar { position: relative; left: auto; right: auto; bottom: auto; flex: none; transform: none; will-change: auto; }
  /* iOS zooms into any field under 16px when it gets focus */
  input:not([type="checkbox"]):not([type="radio"]):not(.sig), select, textarea { font-size: max(16px, 1em) !important; }
}

/* ------------------------------------------------------------------ iPad
   Phones (and a phone held sideways) keep the phone shell. Anything wider and
   taller than a phone -- an iPad in either orientation, a narrow desktop window --
   gets the sidebar. iPad portrait is 744-1032px wide, which used to fall under
   the old 860px phone breakpoint and got a stretched phone. iPad Split View at
   half width or less is under 700px and correctly gets the phone shell. */

/* Tablet width: a slimmer sidebar and slightly tighter gutters, so the content
   column keeps room for a table at 744px (iPad mini portrait). */
@media (min-width: 701px) and (max-width: 1180px) and (min-height: 521px) {
  :root { --nav-w: 212px; }
  .wrap { padding: 18px 18px 0; }
  .side-top { padding: 16px 14px 10px; }
  .tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
  .card-h { flex-wrap: wrap; }
}

/* Tablet portrait: the content column is 530-820px, so the side-by-side
   screens stack the way they do on a phone. */
@media (min-width: 701px) and (max-width: 1032px) and (min-height: 521px) {
  .plan-grid { grid-template-columns: 1fr; }
  .plan-map-card { position: static; order: -1; }
  .plan-canvas { height: 360px; }
  .chat-grid { grid-template-columns: 1fr; }
  .tpl-grid { grid-template-columns: 1fr; }
  /* a table sizes to its content and scrolls sideways inside its card, so an
     order number is never broken across two lines */
  table.tbl { width: max-content; min-width: 100%; }
  table.tbl th, table.tbl td { max-width: 240px; }
  /* a heading keeps its line; its buttons wrap underneath rather than squeezing it */
  .pagehead .row, .pagehead .row-wrap { flex-wrap: wrap; }
}

/* A finger, not a mouse, at any size above a phone: targets of at least 44pt,
   fields at 16px so iOS never zooms on focus, and rows a thumb can hit. The
   phone shell already does all of this for itself. */
@media (pointer: coarse) and (min-width: 701px) and (min-height: 521px), (pointer: coarse) and (min-width: 961px) {
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }
  .nav a { min-height: 44px; }
  input.fld, select.fld { min-height: 44px; }
  input:not([type="checkbox"]):not([type="radio"]):not(.sig), select, textarea { font-size: max(16px, 1em); }
  table.tbl td { padding-top: 12px; padding-bottom: 12px; }
  table.tbl tbody tr.clickable:active, .nav a:active { background: var(--surface-2); }
  html { touch-action: manipulation; }
}

/* The iPad app draws edge to edge (contentInset "never"), so the status bar and
   the home indicator sit over the page. In a browser these are 0 and nothing moves. */
@media (min-width: 701px) and (min-height: 521px), (min-width: 961px) {
  .side-top { padding-top: max(16px, calc(env(safe-area-inset-top) + 10px)); }
  .side-btm { padding-bottom: max(10px, calc(env(safe-area-inset-bottom) + 6px)); }
  .main { padding-top: env(safe-area-inset-top); }
}

/* Sign-in footer links: 44px hit boxes on a phone, same type size, and enough
   side padding that Privacy / Terms / Support no longer touch. Phone-shell rule
   only, so desktop is unchanged (bug-dev-footer-tap-targets). */
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .auth-foot a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; }
  .auth-foot { margin-top: 4px !important; line-height: 1.2; }
}

/* ══ Design refresh, Phase 1 (r-design-refresh, 2026-10-14) ══════════════════
   Tokens, type and motion only — no layout changes. Direction (approved by JT):
   "Surgical-grade calm": cool-biased neutrals, one confident blue, numbers set
   like a spec sheet (Manrope display + JetBrains Mono for money and codes),
   and motion that answers immediately and is complete at rest.
   Everything here is an override placed last, so it can be lifted out as one
   block. Fonts are self-hosted (CSP font-src 'self'); /lp/ is same-origin and
   the service worker caches it like any other same-origin file. */

@font-face {
  font-family: "Manrope"; src: url("/lp/manrope.woff2") format("woff2");
  font-weight: 200 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono"; src: url("/lp/jbmono.woff2") format("woff2");
  font-weight: 400 800; font-style: normal; font-display: swap;
}

/* FE_TOKENS_P1B: literals equal to a token use the token (frontend-tokens-p1b) */
:root {
  /* cool neutrals; ink-3 darkened from the mockup (#848d9b) so small grey
     text clears WCAG AA on every surface (4.5:1+ on plane, surface, surface-2) */
  --plane: #f5f6f8; --surface: #ffffff; --surface-2: #eef1f5; --surface-3: #e4e8ee;
  --ink: #0e1116; --ink-2: #485160; --ink-3: #626b79;
  --line: #e2e6ec; --line-2: #cbd2dc; --ring: rgba(14, 17, 22, .08);
  --s1: #2a6fdb;
  --accent: var(--accent-l, #2a6fdb);
  --accent-ink: var(--accent-ink-l, #fff);
  --accent-soft: var(--accent-soft-l, #edf3fd);
  --good-soft: #e3f4ea; --warn-soft: #fbf0d6; --crit-soft: #fbe5e5;

  /* radius and elevation */
  --r-xs: 6px; --r-sm: 8px; --r: 12px; --r-lg: 16px;
  --sh-1: 0 1px 2px rgba(14,17,22,.05), 0 0 0 1px var(--ring);
  --sh-2: 0 6px 18px rgba(14,17,22,.08), 0 0 0 1px var(--ring);
  --sh-3: 0 18px 48px rgba(14,17,22,.16), 0 0 0 1px var(--ring);
  --edge-sh: rgba(14,17,22,.14);

  /* type */
  --f-display: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --t-micro: 11px; --t-sm: 12.5px; --t-body: 15px; --t-h3: 15px; --t-h2: 17px; --t-h1: 24px;

  /* spacing (4/8 pt) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;

  /* motion: critically damped, no bounce */
  --ease-out: cubic-bezier(.2, .9, .25, 1);
  --ease-io: cubic-bezier(.45, 0, .2, 1);
  --dur-press: 100ms; --dur-1: 160ms; --dur-2: 280ms; --dur-3: 700ms;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --plane: #0a0c0f; --surface: #12151a; --surface-2: #181c22; --surface-3: #20252d;
    --ink: #f2f4f7; --ink-2: #b3bbc7; --ink-3: #8a93a3;
    --line: #222831; --line-2: #2f3743; --ring: rgba(255, 255, 255, .08);
    --s1: #4d8ff0;
    --accent: var(--accent-d, #4d8ff0);
    --accent-ink: var(--accent-ink-d, #06101f);
    --accent-soft: var(--accent-soft-d, #13233b);
    --good-soft: #0f2a1c; --warn-soft: #2d230b; --crit-soft: #321515;
    --sh-1: 0 1px 2px rgba(0,0,0,.4), 0 0 0 1px var(--ring);
    --sh-2: 0 8px 22px rgba(0,0,0,.45), 0 0 0 1px var(--ring);
    --sh-3: 0 18px 48px rgba(0,0,0,.6), 0 0 0 1px var(--ring);
    --edge-sh: rgba(0,0,0,.55);
  }
}
:root[data-theme="dark"] {
  --plane: #0a0c0f; --surface: #12151a; --surface-2: #181c22; --surface-3: #20252d;
  --ink: #f2f4f7; --ink-2: #b3bbc7; --ink-3: #8a93a3;
  --line: #222831; --line-2: #2f3743; --ring: rgba(255, 255, 255, .08);
  --s1: #4d8ff0;
  --accent: var(--accent-d, #4d8ff0);
  --accent-ink: var(--accent-ink-d, #06101f);
  --accent-soft: var(--accent-soft-d, #13233b);
  --good-soft: #0f2a1c; --warn-soft: #2d230b; --crit-soft: #321515;
  --sh-1: 0 1px 2px rgba(0,0,0,.4), 0 0 0 1px var(--ring);
  --sh-2: 0 8px 22px rgba(0,0,0,.45), 0 0 0 1px var(--ring);
  --sh-3: 0 18px 48px rgba(0,0,0,.6), 0 0 0 1px var(--ring);
  --edge-sh: rgba(0,0,0,.55);
}

/* ── Type: display face for headings and big numbers, mono for codes and money */
h1, h2 { font-family: var(--f-display); }
h1 { font-size: var(--t-h1); font-weight: 780; letter-spacing: -.028em; }
h2 { font-weight: 720; letter-spacing: -.02em; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: .9em; }
.tnum { font-variant-numeric: tabular-nums; }
.tile .v, .kpi-v, .pair-a {
  font-family: var(--f-display); font-weight: 760; font-variant-numeric: tabular-nums;
}
/* Mono-caps micro labels: KPI keys and table headers read as a spec sheet. */
.tile .k, .kpi-k, .pair-k, table.tbl th {
  font-family: var(--f-mono); font-size: var(--t-micro); font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
}

/* ── Press feedback: answer the finger on the press, not the release */
.btn { transition: background var(--dur-1), border-color var(--dur-1), transform var(--dur-press) ease-out; }
.btn:active:not(:disabled) { transform: scale(.97); }
.tile.tap { transition: box-shadow var(--dur-2) var(--ease-out), transform var(--dur-press) ease-out; }
.tile.tap:active { transform: scale(.985); }

/* ── Alive: trends animate in once, and every screen is complete at rest ── */
/* Bars grow from the baseline with a 45ms stagger (desk.js growIn() sets --i
   and adds .grow on a chart's first paint only — never on a resize repaint). */
.viz svg.grow path.mark, .viz svg.grow path.prior {
  transform-box: fill-box; transform-origin: 50% 100%;
  animation: cg-grow .9s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.viz svg.grow path.prior { animation-duration: .7s; }
.viz svg.grow text, .viz svg.grow .prior-notch, .viz svg.grow line:not(.grid line) {
  animation: cg-fade .5s .55s both;
}
@keyframes cg-grow { from { transform: scaleY(.04); } to { transform: scaleY(1); } }
@keyframes cg-fade { from { opacity: 0; } to { opacity: 1; } }
/* This year vs last year, as bars that fill from the left. */
.pb i { transform-origin: 0 50%; animation: cg-fill .9s var(--ease-out) both; }
.pb i.then { animation-delay: 80ms; }
@keyframes cg-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
/* Tiles rise in, one after the other. */
.tiles > .tile { animation: cg-rise .5s var(--ease-out) both; }
.tiles > .tile:nth-child(2) { animation-delay: 40ms; }
.tiles > .tile:nth-child(3) { animation-delay: 80ms; }
.tiles > .tile:nth-child(4) { animation-delay: 120ms; }
.tiles > .tile:nth-child(5) { animation-delay: 160ms; }
.tiles > .tile:nth-child(n+6) { animation-delay: 200ms; }
@keyframes cg-rise { from { transform: translateY(6px); opacity: .35; } to { transform: none; opacity: 1; } }

/* KPI sparklines (desk.js spark()): last 8-10 complete months. The line draws in
   left to right; the latest point pulses. Decorative: the number is the data. */
.tile .spark { display: block; width: 100%; height: 28px; margin-top: 8px; overflow: visible; }
.tile .spark .l { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tile .spark .a { fill: var(--accent); opacity: .12; stroke: none; }
.tile .spark .pt { stroke: var(--accent); stroke-width: 6; stroke-linecap: round; }
.tile .spark .halo { stroke: var(--accent); stroke-width: 6; stroke-linecap: round; opacity: 0;
  animation: cg-pulse 2.4s 1.2s ease-out infinite; }
.tile .spark.draw { animation: cg-draw 1.1s .15s var(--ease-out) both; }
@keyframes cg-draw { from { clip-path: inset(-6px 100% -6px -6px); } to { clip-path: inset(-6px -6px -6px -6px); } }
@keyframes cg-pulse { 0% { stroke-width: 6; opacity: .5; } 70% { stroke-width: 16; opacity: 0; } 100% { stroke-width: 16; opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .viz svg.grow path.mark, .viz svg.grow path.prior, .viz svg.grow text,
  .viz svg.grow .prior-notch, .viz svg.grow line, .pb i, .tiles > .tile,
  .tile .spark.draw, .tile .spark .halo { animation: none !important; }
  .btn:active:not(:disabled), .tile.tap:active { transform: none; }
}
/* ══ end design refresh, Phase 1 ═══════════════════════════════════════════ */

/* ══ Design refresh, Phase 2 (r-design-refresh-p2, 2026-10-14) ═════════════
   Components: cards, buttons, fields, pills, tables (cards on a phone), toasts,
   sheets, the glass top bar and tab bar with a raised New order button, and the
   sidebar rail. Built on the Phase 1 tokens. No markup changes except the table
   labels lib.js adds (cardTables). Placed last so it lifts out as one block. */

/* ── Cards: one surface, one hairline, one radius ───────────────────────── */
.card { border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.card-h { padding: var(--sp-3) var(--sp-4) var(--sp-3) 18px; min-height: 52px; }
.card-h h2 { font-size: var(--t-h2); }
.card-f { padding: var(--sp-3) 18px; }
.pagehead h1 { font-family: var(--f-display); }
.pagehead p { color: var(--ink-2); }

/* ── Buttons: 40px on a desk, 44px under a thumb; the primary has weight ── */
.btn {
  min-height: 40px; padding: 9px 16px; border-radius: 10px; font-weight: 650;
  letter-spacing: -.005em; border-color: var(--line-2); box-shadow: 0 1px 1px rgba(14,17,22,.04);
}
.btn:hover:not(:disabled) { border-color: color-mix(in srgb, var(--ink) 22%, var(--line-2)); }
.btn-pri {
  border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 1px 2px color-mix(in srgb, var(--accent) 35%, transparent),
    0 4px 12px -4px color-mix(in srgb, var(--accent) 45%, transparent);
}
.btn-pri:hover:not(:disabled) { border-color: transparent; background: color-mix(in srgb, var(--accent) 90%, #000); }
.btn-danger { background: var(--surface); }
.btn-danger:hover:not(:disabled) { background: var(--crit-soft); border-color: color-mix(in srgb, var(--critical) 45%, var(--line-2)); }
.btn-ghost, .btn-ghost:hover:not(:disabled) { box-shadow: none; border-color: transparent; }
.btn-lg { min-height: 48px; border-radius: var(--r); }
.btn-sm { min-height: 32px; padding: 5px 11px; border-radius: var(--r-sm); }
.btn-icon { min-width: 40px; padding: 7px; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 10px; }

/* ── Fields: quiet until touched, then a clear accent ring ──────────────── */
.f > label { font-size: var(--t-sm); font-weight: 650; color: var(--ink-2); letter-spacing: 0; }
.f input:not([type="checkbox"]):not([type="radio"]), .f select, .f textarea, input.fld, select.fld {
  min-height: 40px; border-radius: 10px; background: var(--surface); border-color: var(--line-2);
}
.f input:not([type="checkbox"]):not([type="radio"]):hover, .f select:hover, .f textarea:hover,
input.fld:hover, select.fld:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line-2)); }
.f input:focus, .f select:focus, .f textarea:focus, input.fld:focus, select.fld:focus {
  border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}
.f .hint { font-size: 12px; color: var(--ink-3); }

/* FE_TOUCH_TARGETS_V1 (frontend-touch-targets): the 40px desk sizes above are
   for a mouse. Under a thumb (phone shell, or any coarse pointer) the floor is
   44px, as the phone-shell and coarse-pointer blocks earlier in this file ask;
   those lost to the rules above on order alone. */
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px), (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn-lg { min-height: 48px; }
  .btn-sm { min-height: 36px; }
  .btn-icon { min-width: 44px; }
  .f input:not([type="checkbox"]):not([type="radio"]), .f select, input.fld, select.fld { min-height: 44px; }
}

/* ── Pills: soft tint, a dot, and a word — never colour on its own ──────── */
.pill { padding: 3px 9px 3px 8px; font-size: 11.5px; font-weight: 650; gap: 6px; letter-spacing: 0; }
.pill-good     { color: var(--good-ink); background: var(--good-soft); }
.pill-warning  { background: var(--warn-soft); }
/* The old dark-mode colours for warning/serious pills were also applied in light
   mode (an unguarded :root:not([data-theme="light"]) rule): yellow on cream.
   Light gets dark inks again; dark keeps the bright ones. */
:root:not([data-theme="dark"]) .pill-warning { color: #7a5600; }
:root:not([data-theme="dark"]) .pill-serious { color: #8a4116; }
.pill-serious { background: color-mix(in srgb, var(--serious) 18%, var(--surface)); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pill-warning { color: var(--warning); }
  :root:not([data-theme="light"]) .pill-serious { color: var(--serious); }
}
:root[data-theme="dark"] .pill-warning { color: var(--warning); }
:root[data-theme="dark"] .pill-serious { color: var(--serious); }
.pill-critical { background: var(--crit-soft); }
.pill-info     { color: var(--accent); background: var(--accent-soft); }

/* ── Tables: mono-caps header on a tinted band, a calm row hover ────────── */
table.tbl th { background: var(--surface-2); padding: 10px 12px; border-bottom-color: var(--line); }
table.tbl th:first-child { padding-left: 18px; }
table.tbl td:first-child { padding-left: 18px; }
table.tbl th:last-child, table.tbl td:last-child { padding-right: 18px; }
table.tbl td { border-bottom-color: var(--line); }
table.tbl tbody tr { transition: background var(--dur-1); }
table.tbl tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
table.tbl tbody tr.clickable:hover { background: var(--surface-2); }
table.tbl td .mono, table.tbl td.mono { color: var(--ink); }

/* On a phone a table is a stack of cards. lib.js (cardTables) marks a table
   data-cards="on" only when it is plain enough to read that way (a header row,
   no fields in its rows, at most 9 columns) and copies each column's header
   into its cells as data-label. Anything else keeps scrolling sideways in its
   own box exactly as before. The first column is the card's title. */
@media (max-width: 720px) {
  .tbl-wrap:has(> table.tbl[data-cards="on"]) { overflow: visible; background: none; }
  table.tbl[data-cards="on"], table.tbl[data-cards="on"] tbody { display: block; width: 100%; }
  table.tbl[data-cards="on"] thead { display: none; }
  table.tbl[data-cards="on"] tbody tr { display: block; padding: 12px 16px 13px; border-bottom: 1px solid var(--line); }
  table.tbl[data-cards="on"] tbody tr:last-child { border-bottom: 0; }
  table.tbl[data-cards="on"] td {
    display: flex; justify-content: flex-end; align-items: center; gap: 12px; min-height: 26px;
    padding: 1px 0; border: 0; text-align: right; font-size: 13.5px; min-width: 0; max-width: none;
  }
  /* each labelled cell: a small label on the left, its value on the right */
  table.tbl[data-cards="on"] td[data-label]::before {
    content: attr(data-label); margin-right: auto; flex: none; max-width: 45%; text-align: left;
    font-family: var(--f-mono); font-size: 10.5px; font-weight: 600; letter-spacing: .07em;
    text-transform: uppercase; color: var(--ink-3);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  /* the first column is the card's title */
  table.tbl[data-cards="on"] td:first-child {
    display: block; padding: 0 0 4px; font-size: var(--t-body); font-weight: 650; text-align: left; overflow-wrap: anywhere;
  }
  table.tbl[data-cards="on"] td:first-child::before { content: none; }
  /* an empty-state row ("Nothing here yet") spans the card */
  table.tbl[data-cards="on"] td[colspan] { display: block; text-align: center; padding: 10px 0; font-weight: 400; }
  table.tbl[data-cards="on"] td[colspan]::before { content: none; }
  table.tbl[data-cards="on"] tbody tr.clickable { position: relative; }
  table.tbl[data-cards="on"] tbody tr.clickable td:first-child { padding-right: 22px; }
  table.tbl[data-cards="on"] tbody tr.clickable::after {
    content: ""; position: absolute; right: 18px; top: 19px; width: 7px; height: 7px;
    border: solid var(--ink-3); border-width: 0 2px 2px 0; transform: rotate(-45deg);
  }
  table.tbl[data-cards="on"] tbody tr.clickable:active { background: var(--surface-2); }
}

/* FE_TRAY_XFER_POLISH_V1 (r-fe-tray-transfer-polish) -----------------------------------
   Bulk tray transfer: picking trays on the Trays list and on a transfer batch.
   The box is drawn (span.xf-box) so a table you pick from still becomes phone cards. */
td.xf-ck, th.xf-ck { width: 44px; padding-right: 0; }
.xf-box {
  position: relative; display: inline-block; width: 20px; height: 20px; vertical-align: middle;
  border: 1.5px solid var(--line-2); border-radius: 6px; background: var(--surface);
  transition: background var(--dur-1), border-color var(--dur-1);
}
tr.xf-on .xf-box { background: var(--accent); border-color: var(--accent); }
tr.xf-on .xf-box::after {
  content: ""; position: absolute; left: 5.5px; top: 1.5px; width: 5px; height: 10px;
  border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
/* 2. a picked row reads as picked, not just its box */
table.tbl tbody tr.xf-on > td { background: var(--accent-soft); }
/* 3. a tray you can't move looks it (the row also says "Not with you") */
table.tbl tbody tr.xf-off { opacity: .6; cursor: not-allowed; }
table.tbl tbody tr.xf-off:hover { background: none; }
tr.xf-off .xf-box { background: var(--surface-2); border-style: dashed; }
table.tbl tbody tr[aria-selected]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* 4. the selection bar stays in reach on a long list: pinned to the bottom, frosted, hairline */
.xf-bar[hidden] { display: none; }
.xf-bar {
  position: sticky; bottom: 0; z-index: 6;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 0 -1px 0 var(--line), 0 6px 24px rgba(0, 0, 0, .10);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .xf-bar { background: color-mix(in srgb, var(--surface) 80%, transparent);
    -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%); }
}
@media (prefers-reduced-transparency: reduce) {
  .xf-bar { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) { .xf-bar { background: var(--surface); box-shadow: 0 -1px 0 var(--ink-3); } }
@media (min-width: 721px) { .xf-bar .xf-all { display: none; } }
/* 5. destination control: icon + label; 2x2 on a phone instead of 3 + 1 */
.xf-seg .seg-b { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; }
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .xf-seg { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .xf-seg .seg-b { justify-content: center; min-height: 44px; }
  .xf-seg .seg-b::after { inset: 0; }
  .xf-bar .xf-bar-row { gap: 8px; }
  .xf-bar .xf-bar-row > strong { flex: 1 0 100%; }
  .xf-bar .xf-bar-row > .btn-pri { flex: 1 1 auto; }
}
/* 1. phone cards with a box: the box sits at the card's left, the tray name stays the title */
@media (max-width: 720px) {
  table.tbl[data-cards="on"] tbody tr:has(> td.xf-ck) { position: relative; padding-left: 52px; }
  table.tbl[data-cards="on"] tbody tr > td.xf-ck {
    position: absolute; left: 16px; top: 13px; display: block; width: auto; min-height: 0; padding: 0;
  }
  table.tbl[data-cards="on"] tbody tr:has(> td.xf-ck)::after { content: none; }
  table.tbl[data-cards="on"] tbody td.xf-ck + td {
    display: block; padding: 0 0 4px; font-size: var(--t-body); font-weight: 650; text-align: left; overflow-wrap: anywhere;
  }
  table.tbl[data-cards="on"] tbody td.xf-ck + td::before { content: none; }
  table.tbl[data-cards="on"] tbody tr.xf-on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
  table.tbl[data-cards="on"] tbody tr.xf-on > td { background: transparent; }
}

/* ── Stat tiles and pair cards ──────────────────────────────────────────── */
.tile { border-radius: var(--r-lg); }
.pair { border-radius: var(--r); border-color: var(--line); background: var(--surface); box-shadow: 0 1px 1px rgba(14,17,22,.03); }
/* A long number no longer runs under its +/-% chip on a phone: the chip wraps. */
.pair-top { flex-wrap: wrap; row-gap: 4px; }
.pair-a { min-width: min(100%, 9ch); overflow-wrap: anywhere; }

/* ── Toasts: a dark glass capsule that rises in ─────────────────────────── */
.toast {
  border-radius: 14px; padding: 12px 16px; font-weight: 600;
  background: color-mix(in srgb, var(--ink) 92%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%);
  transform: translateY(10px) scale(.98);
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
}
.toast.in { transform: none; }
/* On a phone, toasts sit above the tab bar and its raised button, not on them. */
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .toasts { bottom: calc(92px + var(--sab, env(safe-area-inset-bottom))); }
}
.toast-critical { background: var(--critical); }
.toast-good { background: var(--good-ink); }

/* ── Modals and sheets ──────────────────────────────────────────────────── */
.scrim {
  background: rgba(8, 10, 14, .42);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  animation: fade var(--dur-1) ease-out;
}
.modal { border-radius: 20px; animation: cg-pop var(--dur-2) var(--ease-out) both; }
.modal-h { padding: 16px 20px; min-height: 56px; }
.modal-h h2, .modal-h h3 { font-family: var(--f-display); }
.modal-b { padding: 18px 20px; }
.modal-f { padding: 14px 20px; background: var(--surface); }
@keyframes cg-pop { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
/* On a phone the modal is a sheet: it rises from the bottom edge and carries a
   grabber, so it reads as something that came up over the page, not a page. */
@media (max-width: 620px) {
  .modal { border-radius: 22px 22px 0 0; animation: cg-sheet 340ms var(--ease-out) both; position: relative; }
  .modal::before {
    content: ""; position: absolute; top: 6px; left: 50%; width: 36px; height: 5px; margin-left: -18px;
    border-radius: 3px; background: var(--line-2); z-index: 1;
  }
  .modal-h { padding-top: 20px; }
}
@keyframes cg-sheet { from { transform: translateY(100%); } to { transform: none; } }

/* ── Glass chrome: top bar and phone tab bar ────────────────────────────── */
.topbar {
  background: color-mix(in srgb, var(--surface) 74%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.topbar-n { font-family: var(--f-display); font-weight: 750; letter-spacing: -.02em; }
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .tabbar {
    background: color-mix(in srgb, var(--surface) 76%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(22px); backdrop-filter: saturate(180%) blur(22px);
    border-top-color: color-mix(in srgb, var(--line) 80%, transparent);
    overflow: visible;
  }
  .tabbar a, .tabbar .tab-menu { min-height: 48px; transition: color var(--dur-1), transform var(--dur-press) ease-out; }
  .tabbar a:active, .tabbar .tab-menu:active { transform: scale(.94); background: none; }
  .tabbar a.on svg, .tabbar .tab-menu.on svg { transform: translateY(-1px); }
  /* New order is the app's one job, so it is the one raised button. */
  .tabbar a[data-to="#/new"] { color: var(--ink-2); gap: 4px; }
  .tabbar a[data-to="#/new"] svg {
    width: 52px; height: 52px; padding: 14px; margin-top: -24px; border-radius: 50%;
    background: var(--accent); color: var(--accent-ink);
    box-shadow: 0 0 0 4px var(--plane), 0 8px 20px -6px color-mix(in srgb, var(--accent) 70%, transparent);
    transition: transform var(--dur-press) ease-out, box-shadow var(--dur-2);
  }
  .tabbar a[data-to="#/new"]:active svg { transform: scale(.92); }
  .tabbar a[data-to="#/new"].on { color: var(--accent); }
}

/* ── Sidebar rail ───────────────────────────────────────────────────────── */
.nav a { border-radius: 10px; transition: background var(--dur-1), color var(--dur-1); }
.nav a.on { font-weight: 650; }
.brand { font-family: var(--f-display); font-weight: 800; letter-spacing: -.03em; }

/* ── Preferences ────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .modal, .scrim { animation: none !important; }
  .toast, .toast.in { transform: none !important; }
  .tabbar a:active, .tabbar .tab-menu:active, .tabbar a[data-to="#/new"]:active svg { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .toast { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--ink); }
  .scrim { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
}
@media (prefers-contrast: more) {
  .tabbar a[data-to="#/new"] svg { box-shadow: 0 0 0 2px var(--ink); }
}
/* ══ end design refresh, Phase 2 ═══════════════════════════════════════════ */

/* ══ Design refresh, Phase 3a (r-design-refresh-p3a, 2026-10-14) ═══════════
   Empty and loading states, and the page arriving. Built on the Phase 1 tokens
   and placed after Phase 2. Markup is unchanged apart from loading() in lib.js,
   which now draws .loading-state and a .skel-card. */

/* ── Empty states: a calm disc, a clear title, one line, then the action ── */
.empty:not(.v) {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  padding: 48px var(--sp-5) 52px; color: var(--ink-2); text-wrap: balance;
  animation: cg-rise var(--dur-2) var(--ease-out) both;
}
.empty > svg {
  box-sizing: content-box; width: 26px; height: 26px; padding: 15px; margin: 0 0 var(--sp-2);
  border-radius: 50%; color: var(--ink-2); background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line), 0 0 0 6px color-mix(in srgb, var(--surface-2) 45%, transparent);
}
.empty h3 { margin: 0; font-family: var(--f-display); font-size: var(--t-h2); font-weight: 750; letter-spacing: -.015em; color: var(--ink); }
.empty p { margin: 0; max-width: 44ch; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.empty > .btn, .empty > a.btn, .empty > .row { margin-top: var(--sp-3); }
/* Inside a card or a table cell the state is part of something, so it is quieter. */
.card .empty, td .empty { padding: 32px var(--sp-4) 36px; }
.card .empty > svg, td .empty > svg { width: 22px; height: 22px; padding: 12px; box-shadow: inset 0 0 0 1px var(--line); }

/* ── Loading: nothing for 150ms (fast screens never flash), then a spinner
      and a word, then the shape of a card while the data is still coming ── */
.loading-state {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 40px 0 var(--sp-5); color: var(--ink-3); font-size: 14px; font-weight: 550;
  animation: cg-fade var(--dur-2) 150ms ease-out both;
}
.spin {
  width: 18px; height: 18px; border-width: 2px;
  border-color: color-mix(in srgb, var(--accent) 18%, var(--line)); border-top-color: var(--accent);
  animation-duration: .8s; animation-timing-function: cubic-bezier(.5, .15, .5, .85);
}
.skel-card {
  display: grid; gap: 12px; max-width: 720px; margin: 0 auto; padding: 20px 18px 22px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  animation: cg-fade var(--dur-2) 450ms ease-out both;
}
.skel-card .skel:first-child { height: 16px; margin-bottom: 4px; }
.skel {
  background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--surface-3) 70%, var(--surface)) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; border-radius: var(--r-xs);
}

/* ── The page arriving: a short fade, so a route change reads as one motion ── */
main > .wrap { animation: cg-page var(--dur-1) ease-out both; }
@keyframes cg-page { from { opacity: .4; } to { opacity: 1; } }

/* ── Small interactions ─────────────────────────────────────────────────── */
/* A clickable row answers the press, not only the hover. */
table.tbl tbody tr.clickable { cursor: pointer; }
table.tbl tbody tr.clickable:active { background: color-mix(in srgb, var(--accent) 7%, var(--surface-2)); }
/* Keyboard focus is always visible on rows, tiles and links that act. */
table.tbl tbody tr.clickable:focus-visible, .tile.tap:focus-visible, .nav a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: -2px;
}
/* Pills change state with a short cross-fade instead of a jump. */
.pill { transition: background-color var(--dur-1), color var(--dur-1); }

/* ── Preferences ────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .empty, .loading-state, .skel-card, main > .wrap { animation: none !important; }
  .skel { animation: none !important; background: var(--surface-2); }
  .spin { animation-duration: 1.6s; }
}
@media (prefers-contrast: more) {
  .empty > svg { box-shadow: inset 0 0 0 1px var(--ink-3); }
  .skel-card { border-color: var(--ink-3); }
}
/* ══ end design refresh, Phase 3a ══════════════════════════════════════════ */

/* ══ FE_SKELETON_V1 (r-fe-skeleton-loading, 2026-11-24) ════════════════════
   loading() in lib.js draws the screen's own shape while its data comes:
   page head, then a table / KPI tiles / detail / day list / card. Bars are a
   flat surface-2 with one soft sheen passing over (a compositor-cheap
   background-position move, in step across the page via --sk-phase). Nothing
   for 150ms, then the shapes; a .sk-cont one (the route's, followed by the
   screen's own) shows at once so the hand-over never blinks. */
.sk-screen { animation: cg-fade var(--dur-2) 150ms ease-out both; }
.sk-screen.sk-cont { animation: none; }
.sk { display: grid; gap: var(--sp-4, 16px); }
.sk-b {
  display: block; height: 12px; width: 100%; border-radius: 6px; flex: none;
  background-color: var(--surface-2);
  background-image: linear-gradient(100deg, transparent 30%,
    color-mix(in srgb, var(--surface-3) 80%, var(--surface)) 50%, transparent 70%);
  background-size: 300% 100%; background-repeat: no-repeat;
  animation: sk-sheen 1.6s cubic-bezier(.4, 0, .6, 1) var(--sk-phase, 0ms) infinite;
}
@keyframes sk-sheen { from { background-position: 100% 0; } to { background-position: -50% 0; } }
.sk-b.sk-h1 { height: 26px; border-radius: 8px; }
.sk-b.sk-h3 { height: 15px; }
.sk-b.sk-strong { height: 13px; }
.sk-b.sk-big { height: 26px; border-radius: 8px; }
.sk-b.sk-btn { width: 112px; height: 40px; border-radius: var(--r, 10px); }
.sk-b.sk-pri { width: 140px; height: 44px; background-color: color-mix(in srgb, var(--accent) 16%, var(--surface-2)); }
.sk-b.sk-fld { height: 40px; border-radius: var(--r, 10px); }
.sk-b.sk-pill { height: 24px; border-radius: 999px; }
.sk-b.sk-dot { width: 8px; height: 8px; border-radius: 50%; }
.sk-b.sk-num { margin-left: auto; }
.sk-b.sk-time { height: 30px; border-radius: 8px; }

.sk-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4, 16px); margin: 2px 0 var(--sp-5, 24px); }
.sk-head-t { display: grid; gap: 10px; flex: 1; min-width: 0; }
.sk-card {
  display: grid; gap: 14px; padding: 20px 18px 22px; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg, 16px);
}
.sk-plain { max-width: 720px; }
/* the dashboard and the day list have no primary button in their head */
.sk-screen[data-sk="tiles"] .sk-head > .sk-pri, .sk-screen[data-sk="list"] .sk-head > .sk-pri { display: none; }

/* table: toolbar, a header row, rows; the same columns as the list it becomes */
.sk-table { padding: 0; gap: 0; overflow: hidden; }
.sk-bar { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px; }
.sk-bar .sk-h3 { margin-right: auto; }
.sk-bar .sk-fld { flex: 1 1 auto; max-width: 420px; }
.sk-bar .sk-btn { width: 96px; }
.sk-row {
  display: grid; align-items: center; gap: 16px; min-height: 37px; padding: 0 18px;
  grid-template-columns: 8px minmax(70px, 110px) minmax(0, 1.5fr) minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, .9fr) 80px;
  border-top: 1px solid var(--line);
}
.sk-th { background: var(--surface-2); }
.sk-th .sk-b { background-color: var(--surface-3); height: 10px; }
.sk-th .sk-b:first-child { visibility: hidden; }

/* tiles: the dashboard's KPI row, two panels, a chart */
.sk-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg, 16px); overflow: hidden; }
.sk-tile { display: grid; gap: 12px; padding: 20px; min-height: 112px; align-content: start; }
.sk-tile + .sk-tile { border-left: 1px solid var(--line); }
.sk-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4, 16px); }
.sk-line2 { display: flex; align-items: center; gap: 16px; }
.sk-line2 > .sk-b:first-child { flex: 0 1 auto; min-width: 0; }
.sk-cols { display: flex; align-items: flex-end; gap: 4%; height: 150px; padding: 0 6px; border-bottom: 1px solid var(--line); }
.sk-col { flex: 1; border-radius: 4px 4px 0 0; background: var(--surface-2); }

/* detail: status pills, fields on the left, a side panel */
.sk-pills { display: flex; gap: 8px; margin: -8px 0 0; }
.sk-detail { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--sp-4, 16px); align-items: start; }
.sk-kv { display: grid; grid-template-columns: minmax(90px, 160px) minmax(0, 1fr); gap: 16px; align-items: center; min-height: 28px; }
.sk-kv .sk-b:first-child { height: 10px; }

/* list: a day header and its cases */
.sk-day { display: grid; gap: 10px; }
.sk-item { grid-template-columns: 56px minmax(0, 1fr); align-items: center; gap: 14px; padding: 14px 16px; }
.sk-item-t { display: grid; gap: 8px; }

/* slow, offline */
.sk-note {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 0 0 var(--sp-4, 16px); padding: 10px 12px 10px 14px; min-height: 44px;
  font-size: 14px; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r, 10px); animation: cg-fade var(--dur-2) ease-out both;
}
.sk-note[hidden] { display: none; }
.sk-note .btn { min-height: 44px; }
.sk-slow .sk-b { animation-duration: 2.4s; }

/* the thin line along the top for work in the background */
.top-progress {
  position: fixed; z-index: 96; left: 0; right: 0; top: env(safe-area-inset-top, 0px); height: 2px;
  overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .2s ease-out;
}
.top-progress.on { opacity: 1; }
.top-progress > span {
  position: absolute; inset: 0 auto 0 0; width: 40%; border-radius: 0 2px 2px 0;
  background: var(--accent); transform: translateX(-100%);
}
.top-progress.on > span { animation: tp-run 1.1s cubic-bezier(.4, 0, .2, 1) infinite; }
@keyframes tp-run { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* inside a card or a dialog the shape is part of something: no page head, fewer rows, no frame */
.card .sk-head, .modal .sk-head, .card .sk-pills, .modal .sk-pills { display: none; }
.card .sk-screen, .modal .sk-screen { padding: 0; }
.card .sk-card, .modal .sk-card { border: 0; padding: 4px 0; background: none; }
.card .sk-row:nth-child(n+8), .modal .sk-row:nth-child(n+8) { display: none; }

/* phone shell (the same rule as the rest of app.css) */
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .sk-head { flex-direction: column; align-items: stretch; margin-bottom: var(--sp-4, 16px); }
  .sk-b.sk-pri { width: 100%; height: 48px; }
  .sk-bar { flex-wrap: wrap; padding: 16px; }
  .sk-bar .sk-h3 { flex: 1 0 100%; }
  .sk-bar .sk-fld { flex: 1 0 100%; max-width: none; }
  .sk-bar .sk-btn { flex: 1; width: auto; height: 44px; }
  .sk-th { display: none; }
  /* rows become the two-line phone list: dot, id, total / place / date */
  .sk-row { grid-template-columns: 8px minmax(0, 1fr) 72px; grid-auto-rows: auto; row-gap: 8px; column-gap: 10px; padding: 12px 16px; }
  .sk-row > :nth-child(1) { grid-area: 1 / 1; }
  .sk-row > :nth-child(2) { grid-area: 1 / 2; width: 40% !important; }
  .sk-row > :nth-child(7) { grid-area: 1 / 3; width: 100% !important; }
  .sk-row > :nth-child(3) { grid-area: 2 / 2 / 3 / 4; }
  .sk-row > :nth-child(4) { grid-area: 3 / 2; width: 55% !important; }
  .sk-row > :nth-child(5), .sk-row > :nth-child(6) { display: none; }
  .sk-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sk-tile { padding: 16px; min-height: 100px; }
  .sk-tile:nth-child(3) { border-left: 0; }
  .sk-tile:nth-child(n+3) { border-top: 1px solid var(--line); }
  .sk-split, .sk-detail { grid-template-columns: minmax(0, 1fr); }
  .sk-cols { height: 110px; }
  .sk-kv { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .sk-kv .sk-b:first-child { width: 36% !important; }
}

@media (prefers-reduced-motion: reduce) {
  .sk-screen, .sk-note { animation: none !important; }
  .sk-b { animation: none !important; background-image: none; }
  .top-progress > span, .top-progress.on > span { animation: none !important; transform: none; width: 100%; opacity: .5; }
}
@media (prefers-contrast: more) {
  .sk-card, .sk-tiles { border-color: var(--ink-3); }
  .sk-b { background-color: var(--surface-3); }
}
@media print { .sk-screen, .top-progress { display: none !important; } }
/* FE_SKELETON_P2_V1: a shape placed inside a screen (not the screen itself) has no page head */
.sk-screen.sk-sub { padding: 0; }
.sk-sub > .sk-head, .sk-sub .sk-pills { display: none; }
.sk-sub .sk-plain { max-width: none; }
/* ══ end FE_SKELETON_V1 ══════════════════════════════════════════════════ */

/* ══ Design refresh, Phase 4: Reports (r-design-refresh-p4-reports, 2026-10-16) ══
   The Reports module on the Phase 1 tokens. Aging bars grow from the left once
   per source with the 45ms stagger, labels are mono micro caps, the overdue
   bands carry the warm edge; the report table sorts from the keyboard, rows get
   the shared clickable treatment, and the totals row reads as a footer. */
.bars2.aging { gap: 9px; }
.bars2.aging .bar2 { grid-template-columns: minmax(74px, 130px) 1fr minmax(64px, auto); }
.bars2.aging .lbl {
  font-family: var(--f-mono); font-size: var(--t-micro); font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
}
.bars2.aging .track { height: 14px; border-radius: 999px; }
.bars2.aging .fill { border-radius: 999px; }
.bars2.aging .amt { font-family: var(--f-mono); font-size: var(--t-sm); text-align: right; color: var(--ink); }
.bars2.aging .bar2.late .lbl { color: var(--critical); }
.bars2.aging .bar2:hover .track { box-shadow: inset 0 0 0 1px var(--line-2); }
.bars2.grow .fill {
  transform-origin: 0 50%;
  animation: cg-grow-x .9s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.bars2.grow .amt { animation: cg-fade .5s .45s both; }
@keyframes cg-grow-x { from { transform: scaleX(.04); } to { transform: scaleX(1); } }
@media (max-width: 420px) {
  .bars2.aging .bar2 { grid-template-columns: 52px 1fr auto; gap: 8px; }
  .bars2.aging .lbl-u { display: none; }
}

table.tbl th.sort { cursor: pointer; user-select: none; -webkit-user-select: none; transition: color var(--dur-1); }
table.tbl th.sort.num { text-align: right; }
table.tbl th.num { text-align: right; } /* FE_NUM_TH_RIGHT: plain numeric headers line up with their numbers */
table.tbl th.sort:hover { color: var(--ink-2); }
table.tbl th.sort[aria-sort="ascending"], table.tbl th.sort[aria-sort="descending"] { color: var(--ink); }
table.tbl th.sort .sort-ar { color: var(--accent); }
table.tbl th.sort:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
table.tbl tbody tr.tot td {
  font-weight: 650; border-top: 2px solid var(--line-2); background: var(--surface-2);
}
table.tbl tbody tr.tot:hover { background: none; }

@media (prefers-reduced-motion: reduce) {
  .bars2.grow .fill, .bars2.grow .amt { animation: none; }
  table.tbl th.sort { transition: none; }
}
@media (prefers-contrast: more) {
  .bars2.aging .track { box-shadow: inset 0 0 0 1px var(--ink-3); }
}
/* ══ end design refresh, Phase 4: Reports ═══════════════════════════════════ */

/* ══ First-login training (r-training-walkthrough, 2026-10-23) ══════════════
   The slim "Complete your training" strip above the app, the walkthrough sheet
   (one pulsing control per screen: .trn-hot) and the #/training tables. */
.training-strip {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: 8px 16px; background: var(--accent-soft, color-mix(in srgb, var(--accent) 12%, var(--surface)));
  color: var(--ink); border-bottom: 1px solid var(--line); font-size: 13.5px;
}
.training-strip svg { width: 16px; height: 16px; flex: none; color: var(--accent); }
.training-strip .grow { min-width: 0; }
.trn-scrim { z-index: 200; }
.trn-sheet {
  background: var(--surface); color: var(--ink); border-radius: var(--r-lg); box-shadow: var(--shadow-3, 0 20px 50px rgba(0,0,0,.25));
  width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); overflow: auto;
  padding: 14px 18px 12px; display: grid; gap: 10px;
}
.trn-top { display: flex; align-items: center; justify-content: space-between; }
.trn-dots { display: flex; gap: 6px; }
.trn-dots span { width: 22px; height: 4px; border-radius: 2px; background: var(--line); }
.trn-dots span.on { background: var(--accent); }
.trn-dots span.done { background: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.trn-eyebrow { font-family: var(--f-mono); font-size: var(--t-micro, 11px); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.trn-sheet h2 { margin: 0; font-size: 20px; }
.trn-say { margin: 0; color: var(--ink-2); font-size: 14.5px; line-height: 1.5; }
.trn-screen { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.trn-pic { width: 100%; height: auto; max-height: 180px; }
.trn-kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.trn-kv span { color: var(--ink-3); }
.trn-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.trn-opt { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 13px; background: var(--surface); }
.trn-act { display: flex; justify-content: flex-end; padding-top: 4px; }
.trn-hot { position: relative; animation: trn-pulse 1.6s ease-in-out infinite; }
@keyframes trn-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
  50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 0%, transparent); }
}
.trn-foot { display: flex; align-items: center; justify-content: space-between; font-size: var(--t-sm); }
.trn-done { display: grid; gap: 10px; justify-items: center; text-align: center; padding: 18px 4px; }
.trn-done > svg { width: 36px; height: 36px; color: var(--good); }
.trn-sm { font-size: var(--t-sm); }
@media (max-width: 700px) { .trn-sheet .btn { min-height: 44px; } }
@media (prefers-reduced-motion: reduce) { .trn-hot { animation: none; outline: 2px solid var(--accent); outline-offset: 2px; } }
@media (prefers-contrast: more) { .trn-hot { outline: 2px solid var(--ink); outline-offset: 2px; } .trn-screen { border-color: var(--ink-3); } }
/* ══ end first-login training ═══════════════════════════════════════════════ */

/* ══ Design refresh, Phase 4: Orders (r-design-refresh-p4-orders, 2026-10-23) ══
   The Orders list and order detail on the Phase 1 tokens. The list dims while a
   search is fetching, the MRN header sorts from the keyboard like Reports, rows
   open with Enter, the patient-data lock is a class, a PO open 30+ days is red.
   The detail's label/value pairs are mono micro caps over tabular figures, and
   the Items table ends on a "Lines total" footer (tr.tot from Phase 4 Reports). */
.ord-busy .tbl-wrap, .ord-busy .empty { opacity: .55; transition: opacity var(--dur-1, .15s); pointer-events: none; }
table.tbl td svg.phi-lock { width: 12px; height: 12px; margin-left: 6px; color: var(--s7); vertical-align: -1px; }
.pager .muted { font-family: var(--f-mono); font-size: var(--t-sm, 12.5px); letter-spacing: .01em; }
.ord-detail .back-link { font-size: var(--t-sm); color: var(--ink-3); margin-bottom: 5px; }
.ord-detail .back-link:hover { color: var(--ink); }
.ord-detail .mrn-tag {
  font-family: var(--f-mono); font-size: .5em; font-weight: 600; letter-spacing: .08em;
  color: var(--ink-3); margin-right: 8px; vertical-align: middle;
}
.ord-detail .kv-grid.kv-tight { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.ord-detail .kv-k {
  font-family: var(--f-mono); font-size: var(--t-micro, 10.5px); font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
}
.ord-detail .kv-v { font-size: 14.5px; font-weight: 550; margin-top: 3px; color: var(--ink); }
.ord-detail .ord-notes { margin-top: 14px; }
.ord-detail .ord-notes .kv-v { font-size: 14px; font-weight: 400; white-space: pre-wrap; }
@media (prefers-reduced-motion: reduce) { .ord-busy .tbl-wrap, .ord-busy .empty { transition: none; } }
@media (prefers-contrast: more) { .ord-detail .kv-k, .ord-detail .mrn-tag { color: var(--ink-2); } }
/* ══ end design refresh, Phase 4: Orders ════════════════════════════════════ */

/* ══ Design refresh, Phase 4: Expenses (r-design-refresh-p4-expenses, 2026-10-23) ══
   The Expenses list, desk and claim sheet on the Phase 1 tokens. Rows use the
   shared clickable treatment and open with Enter; amounts are tabular and right
   aligned; a table with more than one claim ends on a totals footer (tr.tot from
   Phase 4 Reports); a claim waiting 14+ days is a red "Waiting 18d" pill. The
   claim sheet's label/value lines are mono micro caps, the amount is the display
   face, and the note is a tinted block. */
.exp-where { font-size: var(--t-sm, 12.5px); margin-top: 1px; }
table.tbl td.exp-amt { font-weight: 600; }
.exp-rcpt { display: inline-grid; place-items: center; color: var(--ink-2); }
.exp-rcpt svg { width: 15px; height: 15px; }
/* FE_EXPENSES_PHONE_V1 (r-fe-expenses-phone): on a phone an expense is a two-line row,
   not a five-line labelled card. Line 1: what (+ merchant) | amount. Line 2: date + receipt
   mark | status. Only tables holding td.exp-amt (My expenses, the Expenses desk cards). */
@media (max-width: 720px) {
  table.tbl[data-cards="on"]:has(td.exp-amt) tbody tr {
    display: grid; grid-template-columns: auto 1fr auto; column-gap: 10px; row-gap: 3px;
    grid-template-areas: "what what amt" "date rcpt status"; align-items: center;
    padding: 12px 16px; min-height: 44px;
  }
  table.tbl[data-cards="on"]:has(td.exp-amt) tbody tr.clickable { padding-right: 38px; }
  table.tbl[data-cards="on"]:has(td.exp-amt) tbody tr.clickable::after { top: 50%; margin-top: -4px; }
  table.tbl[data-cards="on"]:has(td.exp-amt) td { display: block; min-height: 0; padding: 0; }
  table.tbl[data-cards="on"]:has(td.exp-amt) td[data-label]::before { content: none; }
  table.tbl[data-cards="on"]:has(td.exp-amt) td:first-child { grid-area: what; padding: 0; min-width: 0; }
  table.tbl[data-cards="on"]:has(td.exp-amt) td:first-child .exp-where { font-weight: 400; color: var(--ink-2); }
  table.tbl[data-cards="on"]:has(td.exp-amt) td:nth-child(2) {
    grid-area: date; text-align: left; font-size: var(--t-sm, 12.5px); color: var(--ink-2); white-space: nowrap;
  }
  table.tbl[data-cards="on"]:has(td.exp-amt) td.exp-amt {
    grid-area: amt; align-self: start; font-size: var(--t-body, 15px); font-weight: 650; white-space: nowrap;
  }
  table.tbl[data-cards="on"]:has(td.exp-amt) td:nth-child(4) { grid-area: rcpt; text-align: left; line-height: 0; }
  table.tbl[data-cards="on"]:has(td.exp-amt) td:nth-child(4) .exp-rcpt svg { width: 14px; height: 14px; }
  /* no receipt: the dash stays for screen readers ("No receipt"), not on screen */
  table.tbl[data-cards="on"]:has(td.exp-amt) td:nth-child(4) > span:not(.exp-rcpt) {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  table.tbl[data-cards="on"]:has(td.exp-amt) td:nth-child(5) { grid-area: status; justify-self: end; white-space: nowrap; }
  /* the totals footer: "4 claims | $193.09", nothing else */
  table.tbl[data-cards="on"]:has(td.exp-amt) tbody tr.tot {
    grid-template-areas: "what what amt"; background: var(--surface-2); border-top: 2px solid var(--line-2);
  }
  table.tbl[data-cards="on"]:has(td.exp-amt) tbody tr.tot td { border: 0; }
  table.tbl[data-cards="on"]:has(td.exp-amt) tbody tr.tot td:not(:first-child):not(.num) { display: none; }
  table.tbl[data-cards="on"]:has(td.exp-amt) tbody tr.tot td.num { grid-area: amt; font-weight: 650; white-space: nowrap; }
}
/* ── end FE_EXPENSES_PHONE_V1 ── */
.exp-person-sum { margin-right: 8px; font-family: var(--f-mono); font-size: var(--t-sm, 12.5px); }
.exp-cats { gap: 6px; }
.exp-amount-in { font-family: var(--f-mono); }
.exp-calc { font-family: var(--f-mono); font-size: var(--t-sm, 12.5px); min-height: 18px; }
.exp-detail .exp-big {
  font-family: var(--f-display, inherit); font-size: 26px; font-weight: 760;
  letter-spacing: -.01em; line-height: 1.1;
}
.exp-detail .exp-cat { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-top: 3px; }
.exp-detail .exp-cat svg { width: 14px; height: 14px; }
.exp-detail .exp-lines { border-top: 1px solid var(--line); }
.exp-detail .exp-line { padding: 7px 0; gap: 12px; border-bottom: 1px solid var(--line); align-items: baseline; }
.exp-detail .exp-k {
  font-family: var(--f-mono); font-size: var(--t-micro, 11px); font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); flex: none;
}
.exp-detail .exp-v { font-size: 13.5px; font-weight: 550; text-align: right; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.exp-detail .exp-note {
  margin: 0; padding: 9px 11px; font-size: 13.5px; white-space: pre-wrap;
  background: var(--surface-2); border-radius: 10px; border-left: 3px solid var(--line-2);
}
@media (prefers-contrast: more) {
  .exp-detail .exp-k { color: var(--ink-2); }
  .exp-detail .exp-note { border-left-color: var(--ink-3); }
}
/* ══ end design refresh, Phase 4: Expenses ══════════════════════════════════ */

/* ══ Design refresh, Phase 4: Biologics (r-design-refresh-p4-bio, 2026-10-23) ══
   Biologics on the Phase 1 tokens. Every list row that opens something uses the
   shared clickable row and opens with Enter; overview tiles are keyboard links;
   filter chips say whether they are pressed; Stock ends on a totals footer
   (tr.tot from Phase 4 Reports); expiry dates are tabular with the days pill on
   a class; product and unit facts use mono micro-cap labels. Nothing animates. */
.bio-filters { gap: 8px; }
.bio-exp { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.bio-kv .kv-k {
  font-family: var(--f-mono); font-size: var(--t-micro, 11px); font-weight: 600;
  letter-spacing: .08em; color: var(--ink-3);
}
.bio-kv .kv-v { font-variant-numeric: tabular-nums; font-weight: 550; }
@media (prefers-contrast: more) {
  .bio-kv .kv-k { color: var(--ink-2); }
}
/* ══ end design refresh, Phase 4: Biologics ═════════════════════════════════ */

/* ══ Design refresh, Phase 4: Sets (r-design-refresh-p4-sets, 2026-10-23) ══
   Set requests, the Inventory desk and the asset register on the Phase 1 tokens.
   List rows (requests, assets, reps) use the shared clickable row and open with
   Enter; filter chips are buttons that say whether they are pressed; register
   tiles that match a filter are keyboard shortcuts to it and show which is on;
   the By rep table ends on a totals footer (tr.tot from Phase 4 Reports); a
   Needed date that has passed before the set has left reads red. Nothing new
   animates. */
td.set-late { color: var(--critical); font-weight: 600; }
.tile.tap.on { box-shadow: inset 0 0 0 2px var(--accent); }
.tile.tap.on:hover { box-shadow: inset 0 0 0 2px var(--accent), var(--sh-2); }
@media (prefers-contrast: more) {
  td.set-late { text-decoration: underline; text-underline-offset: 3px; }
  .tile.tap.on { box-shadow: inset 0 0 0 3px var(--ink); }
}
/* ══ end design refresh, Phase 4: Sets ══════════════════════════════════════ */

/* ══ Design refresh, Phase 4: Schedule (r-design-refresh-p4-schedule, 2026-10-23) ══
   The surgery board on the Phase 1 tokens. Day cells and case chips are classes
   instead of inline styles; today's number sits in an accent disc; weekends sit
   a step back; a case waiting on approval is a soft warn chip, a cancelled one is
   struck through; times are tabular mono. List view (default on a phone) groups
   the month's cases under day headings, one full-width 44px row per case with
   the rep colour as the edge stripe. Nothing animates. */
.cal-bar { gap: 8px 12px; align-items: center; }
.cal-nav { gap: 6px; align-items: center; }
.cal-month {
  margin: 0; min-width: 170px; text-align: center;
  font-family: var(--f-display, inherit); letter-spacing: -.01em;
}
.cal-views { flex: none; padding: 0; }
.cal-mine { gap: 6px; align-items: center; margin-left: auto; min-height: 44px; }
.cal-wlink { margin-right: 10px; white-space: nowrap; }
.calhead {
  font-family: var(--f-mono); font-size: var(--t-micro, 11px); font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
}
.cal-day {
  min-height: 104px; padding: 6px; border-radius: 10px; min-width: 0;
  border: 1px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; gap: 4px;
}
.cal-day.wkend { background: var(--surface-2); }
.cal-day.out { background: transparent; border-style: dashed; opacity: .55; }
.cal-day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-dayhead { display: flex; align-items: center; gap: 4px; min-height: 22px; }
.cal-num {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 4px;
  border-radius: 11px; font-size: 12px; font-weight: 600; color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.cal-day.today .cal-num { background: var(--accent); color: var(--accent-ink); }
.cal-count {
  margin-left: auto; font-family: var(--f-mono); font-size: var(--t-micro, 11px);
  color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.cal-bday { display: inline-flex; cursor: default; }
button.chip.cal-case {
  width: 100%; justify-content: flex-start; text-align: left; gap: 4px;
  font-size: 11.5px; padding: 3px 6px; border-left: 3px solid var(--ink-3); border-radius: var(--r-xs);
}
button.chip.cal-case.cal-appt { border-left-style: solid !important; }
.cal-case > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cal-t { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: .92em; color: var(--ink-3); margin-right: 4px; }
.cal-more { margin-left: auto; font-variant-numeric: tabular-nums; }
.cal-case.wait {
  background: color-mix(in srgb, var(--warning, var(--s4)) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--warning, var(--s4)) 35%, transparent);
}
.cal-case.wait > svg { color: var(--warning, var(--s4)); opacity: 1; }
.cal-case.off > span, .cal-arow.off .cal-awho b { text-decoration: line-through; color: var(--ink-3); }
.cal-overflow {
  border: 0; background: none; padding: 2px 4px; font: inherit; font-size: 11.5px;
  color: var(--accent); cursor: pointer; text-align: left; border-radius: var(--r-xs);
}
.cal-overflow:hover { text-decoration: underline; }
.cal-legend { flex-direction: row; flex-wrap: wrap; align-items: center; flex: none; gap: 6px 14px; }
.cal-key { gap: 6px; align-items: center; }
.cal-swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }

.cal-agenda { display: grid; gap: 14px; }
.cal-aday { display: grid; gap: 6px; scroll-margin-top: 12px; }
.cal-aday.past { opacity: .72; }
.cal-ahead { display: flex; align-items: center; gap: 8px; margin: 0; font-size: var(--t-h3, 15px); }
.cal-anum {
  display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px;
  border-radius: 14px; background: var(--surface-2); font-variant-numeric: tabular-nums; font-weight: 700;
}
.cal-aday.today .cal-anum { background: var(--accent); color: var(--accent-ink); }
.cal-arow {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--line); border-left: 3px solid var(--ink-3); border-radius: 10px;
  background: var(--surface); color: inherit; text-decoration: none;
  transition: background var(--dur-1, var(--dur-1)), transform var(--dur-press, 100ms) ease-out;
}
.cal-arow:hover { background: var(--surface-2); }
.cal-arow:active { transform: scale(.99); }
.cal-arow.wait { background: color-mix(in srgb, var(--warning, var(--s4)) 8%, var(--surface)); }
.cal-arow .cal-t { min-width: 42px; margin: 0; }
.cal-awho { display: grid; min-width: 0; }
.cal-awho b, .cal-awho small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* FE_CAL_LINES_V1: on a phone the case line (facility · procedure · rep) wraps to two lines instead of
   being cut at ~185 px; the legend names step up from 9.6 px to the micro size. */
.cal-key small { font-size: var(--t-micro, 11px); }
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .cal-awho small { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical;
    -webkit-line-clamp: 2; line-clamp: 2; overflow-wrap: anywhere; line-height: 1.35; }
}
.cal-aday > .cal-case { width: 100%; min-height: 36px; border-radius: 10px; }
@media (max-width: 700px) {
  .cal-month { min-width: 0; flex: 1; font-size: var(--t-h2, 17px); }
  .cal-nav { width: 100%; }
  .cal-mine { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .cal-arow { transition: none; } .cal-arow:active { transform: none; } }
@media (prefers-contrast: more) {
  .cal-day, .cal-arow { border-color: var(--ink-3); }
  .cal-day.out { opacity: 1; }
  .calhead, .cal-num, .cal-count, .cal-t { color: var(--ink-2); }
}
/* ══ end design refresh, Phase 4: Schedule ══════════════════════════════════ */

/* ══ Design refresh, Phase 4: Trays (r-design-refresh-p4-trays, 2026-10-23) ══
   The tray list and tray detail on the Phase 1 tokens. Rows that open something
   use the shared clickable row and open with Enter; tracking numbers, case and
   catalog numbers are mono; an inbound tray past its due date reads red; both
   tables end on a totals footer (tr.tot from Phase 4 Reports). Nothing animates. */
.tray-actions { gap: 8px; }
.tray-chips { gap: 6px; }
.tray-chip-n { margin-left: 5px; font-variant-numeric: tabular-nums; }
.tray-list .tray-name { font-weight: 600; color: var(--ink); }
.tray-list .tray-sub { display: block; margin-top: 1px; }
.tray-due { display: block; margin-top: 3px; font-family: var(--f-mono); font-size: var(--t-micro, 11px); letter-spacing: .02em; white-space: nowrap; }
.tray-due.late { color: var(--critical); font-weight: 600; }
.tray-track { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tray-track a, .tray-track .mono { overflow-wrap: anywhere; }
.tray-flags { display: flex; flex-wrap: wrap; gap: 4px; }
.tray-meta { font-family: var(--f-mono); font-size: var(--t-sm, 12.5px); font-variant-numeric: tabular-nums; }
.tray-detail .tray-facts {
  font-family: var(--f-mono); font-size: var(--t-sm, 12.5px); letter-spacing: .02em; color: var(--ink-3);
}
.tray-detail .tray-what { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tray-detail .tray-what svg { width: 14px; height: 14px; color: var(--ink-3); }
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .tray-actions { width: 100%; }
  .tray-actions .btn { flex: 1 1 0; justify-content: center; min-height: 44px; }
}
@media (prefers-contrast: more) {
  .tray-detail .tray-facts, .tray-detail .tray-what svg { color: var(--ink-2); }
  .tray-due.late { text-decoration: underline; }
}
/* ══ end design refresh, Phase 4: Trays ═════════════════════════════════════ */

/* ══ Design refresh, Phase 4: CRM (r-design-refresh-p4-crm, 2026-10-23) ══
   Surgeons funnel, Practices and Follow-ups on the Phase 1 tokens. Filter chips
   are buttons that say whether they are pressed and keep focus after a press;
   practice rows open with Enter; counts are tabular; the result count is
   announced; a surgeon with no contact in 30 days (or never) shows "seen …" in
   amber, the same rule as the "No contact in 30 days" filter. Nothing new
   animates. */
.crm-row-meta .crm-cold { color: color-mix(in srgb, var(--serious) 65%, var(--ink)); font-weight: 600; }
@media (prefers-contrast: more) {
  .crm-row-meta .crm-cold { text-decoration: underline; text-underline-offset: 3px; }
}
/* ══ end design refresh, Phase 4: CRM ═══════════════════════════════════════ */

/* ══ Design refresh, Phase 4: Directory (r-design-refresh-p4-directory, 2026-10-23) ══
   Library, Manufacturers, Facilities and Health systems on the Phase 1 tokens.
   List rows open with Enter; library category chips are buttons that say whether
   they are pressed; dates and counts are tabular; an expired document reads red
   and one expiring within 60 days amber. Warning text that was plain
   var(--warning) (about 1.9:1 on white) is mixed toward the ink so it passes AA
   in both themes. Nothing new animates. */
td.dir-late { color: var(--critical); font-weight: 600; }
td.dir-soon, .dir-partial { color: color-mix(in srgb, var(--warning) 55%, var(--ink)); font-weight: 600; }
@media (prefers-contrast: more) {
  td.dir-late, td.dir-soon, .dir-partial { text-decoration: underline; text-underline-offset: 3px; }
}
/* ══ end design refresh, Phase 4: Directory ═════════════════════════════════ */

/* ══ Design refresh, Phase 4: Agreements (r-design-refresh-p4-agreements, 2026-10-23) ══
   Agreements, Price lists and Approved products on the Phase 1 tokens. Rows open
   with Enter; the board's view chips are buttons that say whether they are
   pressed; tabs and version chips mark the current one; dates, counts and money
   are tabular. An executed agreement past its expiry reads red, one expiring
   within 90 days amber (mixed toward the ink so it passes AA in both themes).
   Nothing new animates. */
td.agr-late { color: var(--critical); font-weight: 600; }
td.agr-soon { color: color-mix(in srgb, var(--warning) 55%, var(--ink)); font-weight: 600; }
@media (prefers-contrast: more) {
  td.agr-late, td.agr-soon { text-decoration: underline; text-underline-offset: 3px; }
}
/* ══ end design refresh, Phase 4: Agreements ════════════════════════════════ */

/* ══ Design refresh, Phase 4: People (r-design-refresh-p4-people, 2026-10-23) ══
   People, the Distributors card and a person's filed documents on the Phase 1
   tokens. List rows open with Enter; the type chips are buttons that say
   whether they are pressed and keep focus; counts and dates are tabular.
   Inactive people and switched-off distributors are dimmed by colour rather
   than opacity (0.55 opacity took body text under AA). A filed document past
   its expiry reads red, one expiring within 60 days amber (mixed toward the ink
   so it passes AA in both themes). Nothing new animates. */
table.tbl tbody tr.ppl-off td { color: var(--ink-3); }
table.tbl tbody tr.ppl-off .avatar { filter: grayscale(1); }
td.ppl-late { color: var(--critical); font-weight: 600; }
td.ppl-soon { color: color-mix(in srgb, var(--warning) 55%, var(--ink)); font-weight: 600; }
@media (prefers-contrast: more) {
  td.ppl-late, td.ppl-soon { text-decoration: underline; text-underline-offset: 3px; }
  table.tbl tbody tr.ppl-off td { color: var(--ink-2); font-style: italic; }
}
/* ══ end design refresh, Phase 4: People ════════════════════════════════════ */

/* ══ Design refresh, Phase 4: Platform (r-design-refresh-p4-platform, 2026-10-23) ══
   Platform console, Sign-ups and Platform team on the Phase 1 tokens. An
   organization's header (and the Sandbox and training fold) is a disclosure
   with a focus ring, a press tint and a chevron that turns when it is open;
   team rows open with Enter; sign-up view chips are pressed buttons and the
   status reads as a pill. Counts are tabular. The chevron is the only thing
   that moves, and it stops under reduced motion. */
.card-h.plat-org-h { cursor: pointer; border-radius: inherit; -webkit-tap-highlight-color: transparent; }
.card-h.plat-org-h:active { background: color-mix(in srgb, var(--accent) 7%, var(--surface-2)); }
.card-h.plat-org-h:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.card-h.plat-org-h::after {
  content: ""; flex: none; width: 7px; height: 7px; margin: 0 4px 3px 2px;
  border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3);
  transform: rotate(45deg); transition: transform var(--dur-1) ease-out;
}
.card-h.plat-org-h[aria-expanded="true"]::after { transform: rotate(-135deg); margin-bottom: -3px; }
@media (prefers-reduced-motion: reduce) { .card-h.plat-org-h::after { transition: none; } }
@media (prefers-contrast: more) { .card-h.plat-org-h::after { border-color: var(--ink); } }
/* ══ end design refresh, Phase 4: Platform ══════════════════════════════════ */


/* ══ Mobile navigation redo + Pinned (r-mobile-nav-redo, r-nav-favorites, 2026-10-24) ══
   Pinned: a person's own short list at the very top of the sidebar and of the
   phone menu. Phone menu: the tiles become one list of section headers that open
   in place, one at a time (iOS Settings, not a launcher). Phone header: the mark
   hugs the top-left and the bar sits directly under the status bar. Desktop
   layout is unchanged apart from the Pinned block and the hover star. */

/* ── Pinned, both places ── */
.nav-pins { display: flex; flex-direction: column; gap: 1px; padding: 2px 0 8px; margin-bottom: 6px;
  border-bottom: 1px solid var(--line); }
.pin-h { display: flex; align-items: center; gap: 4px; padding: 6px 4px 4px 8px; }
.pin-t { flex: 1; min-width: 0; font-size: 10.5px; letter-spacing: .085em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 650; }
.pin-this { border: 0; background: none; color: var(--accent); font: 600 11.5px/1 inherit; padding: 5px 7px;
  border-radius: 7px; cursor: pointer; white-space: nowrap; }
.pin-this:hover { background: var(--surface-2); }
.pin-this:active { transform: scale(.97); }
.pin-empty { font-size: 12px; color: var(--ink-3); padding: 2px 9px 4px; }
.pin-list { display: flex; flex-direction: column; gap: 1px; }
.pin-row { position: relative; display: flex; align-items: center; min-width: 0; }
.pin-row > .pin-link { flex: 1; min-width: 0; }
.pin-link span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pin-ctl { display: none; align-items: center; gap: 0; }
.side .pin-ctl { position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  background: var(--surface-2); border-radius: var(--r-sm); }
.side .pin-row:hover .pin-ctl, .side .pin-row:focus-within .pin-ctl { display: flex; }
.pin-mv { display: inline-grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0;
  background: none; border-radius: 7px; color: var(--ink-3); cursor: pointer; }
.pin-mv:hover:not(:disabled) { background: var(--surface-3); color: var(--ink); }
.pin-mv:disabled { opacity: .3; cursor: default; }
.pin-mv svg { width: 13px; height: 13px; }
.pin-mv svg.up { transform: rotate(-90deg); }
.pin-mv svg.down { transform: rotate(90deg); }

/* the star: a toggle, so it says whether it is pressed */
.pin-star { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0;
  border: 0; background: none; border-radius: 7px; color: var(--ink-3); cursor: pointer;
  transition: opacity var(--dur-1, .14s) ease, color var(--dur-1, .14s) ease; }
.pin-star svg { width: 15px; height: 15px; }
.pin-star:hover { background: var(--surface-3); color: var(--ink); }
.pin-star.on, .pin-here.on { color: var(--accent); }
.pin-star.on svg, .pin-here.on svg { fill: currentColor; }
.pin-star:active { transform: scale(.9); }
.pin-star:focus-visible, .pin-mv:focus-visible, .pin-this:focus-visible, .menu-sec-h:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; }

/* sidebar rows: the star appears on hover or focus, over the row's right edge */
.nav-it { position: relative; }
.nav-it > .pin-star { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); opacity: 0; }
.nav-it > .pin-star:active { transform: translateY(-50%) scale(.9); }
.nav-it:hover > .pin-star, .nav-it > .pin-star:focus-visible { opacity: 1; }
.nav-it:hover > a .cnt { visibility: hidden; }
@media (hover: none) {
  .nav-it > .pin-star { opacity: .5; }
  .nav-it > .pin-star.on { opacity: 1; }
  .nav-it > a .cnt { margin-right: 26px; }
}

/* ── Phone menu sheet ── */
.menu-panel .nav-pins { padding: 0 0 6px; margin: 0 2px 4px; }
.menu-panel .pin-h { padding: 2px 2px 2px 10px; }
.menu-panel .pin-this { font-size: 13.5px; min-height: 36px; padding: 0 10px; }
.menu-panel .pin-empty { font-size: 13px; padding: 2px 12px 6px; }
.nav-pins-menu.editing .pin-ctl { display: flex; }
.nav-pins-menu .pin-mv, .nav-pins-menu .pin-ctl .pin-star { width: 40px; height: 40px; }
.nav-pins-menu .pin-mv svg { width: 15px; height: 15px; }

.menu-quick, .menu-sec-i { display: flex; flex-direction: column; gap: 1px; }
.menu-quick { padding-bottom: 6px; margin: 0 2px 4px; border-bottom: 1px solid var(--line); }
.menu-row { display: flex; align-items: center; gap: 2px; min-width: 0; }
.menu-row > a, .menu-panel .pin-link {
  flex: 1; min-width: 0; position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 0 12px; border-radius: 10px; color: var(--ink); text-decoration: none;
  font-size: var(--t-body); font-weight: 520; transition: background .14s ease, color .14s ease;
}
.menu-row > a svg, .menu-panel .pin-link svg { width: 18px; height: 18px; flex: none; color: var(--ink-3); }
.menu-row > a span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-row > a.on, .menu-panel .pin-link.on { background: var(--accent-soft); color: var(--accent); font-weight: 620; }
.menu-row > a.on svg, .menu-panel .pin-link.on svg { color: var(--accent); }
.menu-row > a:active, .menu-panel .pin-link:active { background: var(--surface-2); }
.menu-row > a .cnt { margin-left: auto; }
.menu-star { width: 44px; height: 44px; opacity: .55; }
.menu-star.on { opacity: 1; }
.menu-star svg { width: 17px; height: 17px; }

.menu-sec + .menu-sec { border-top: 1px solid var(--line); }
.menu-sec { margin: 0 2px; }
.menu-sec-h {
  width: 100%; display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px;
  border: 0; background: none; border-radius: 10px; cursor: pointer; text-align: left;
  color: var(--ink); font: 620 15.5px/1.2 inherit; letter-spacing: -.01em;
  transition: background .14s ease, color .14s ease;
}
.menu-sec-h > svg:first-child { width: 19px; height: 19px; flex: none; color: var(--ink-3); }
.menu-sec-t { flex: 1; min-width: 0; }
.menu-sec-n { font-size: var(--t-sm); font-weight: 550; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.menu-sec-h .nav-chev { width: 14px; height: 14px; flex: none; color: var(--ink-3);
  transition: transform .32s cubic-bezier(.32, .72, 0, 1); }
.menu-sec.open .menu-sec-h .nav-chev { transform: rotate(90deg); }
.menu-sec-h:active { background: var(--surface-2); }
/* a closed section that holds the current screen, or a badge, says so */
.menu-sec:not(.open):has(a.on) .menu-sec-h,
.menu-sec:not(.open):has(a.on) .menu-sec-h > svg:first-child { color: var(--accent); }
.menu-sec:not(.open):has(.cnt) .nav-grp-dot { display: block; }
.menu-sec-b { display: grid; grid-template-rows: 0fr; opacity: 0;
  transition: grid-template-rows .32s cubic-bezier(.32, .72, 0, 1), opacity .2s ease; }
.menu-sec.open .menu-sec-b { grid-template-rows: 1fr; opacity: 1; }
.menu-sec-i { overflow: hidden; min-height: 0; padding-left: 10px; }
.menu-sec.open .menu-sec-i { padding-bottom: 6px; }

@media (prefers-reduced-motion: reduce) {
  .menu-sec-b, .menu-sec-h .nav-chev, .menu-row > a, .menu-sec-h, .pin-star { transition: none; }
  .menu-sec-h:active, .pin-star:active, .pin-this:active { transform: none; }
  .nav-it > .pin-star:active { transform: translateY(-50%); }
}
@media (prefers-contrast: more) {
  .menu-row > a.on, .menu-panel .pin-link.on { background: transparent; outline: 1px solid var(--accent); outline-offset: -1px; }
  .menu-sec + .menu-sec, .nav-pins, .menu-quick { border-color: var(--ink-3); }
  .menu-star, .nav-it > .pin-star { opacity: 1; }
}

/* ── Phone header ──
   The back control used to be hidden but still take its 40px, so on every
   screen with nowhere to go back to the mark sat 40px in from the edge and
   looked centred. On a phone it now takes no room until there is somewhere to
   go back to (the iOS navigation bar does the same). The bar's top padding is
   exactly the settled safe-area inset (see freezeSafeArea in lib.js), with a
   slimmer row under it. */
.pin-here { display: none; }
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .topbar {
    gap: 6px; padding-bottom: 6px;
    padding-top: max(8px, var(--sat, env(safe-area-inset-top)));
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(6px, env(safe-area-inset-right));
  }
  .topbar .back-top[aria-hidden="true"] { display: none; }
  .topbar .backbtn { margin-right: 0; }
  .topbar-mark { display: flex; align-items: center; justify-content: flex-start; flex: none;
    height: 32px; max-width: 40vw; overflow: hidden; }
  .topbar-mark img { height: 30px !important; width: auto; max-width: 100% !important;
    object-fit: contain; object-position: left center; display: block; }
  .topbar-mark .brand-mk { margin: 0; }
  .topbar .topbar-n { font-size: 14.5px; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .grow .muted { line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .btn-icon { min-width: 38px; min-height: 38px; }
  .topbar .topbar-theme { display: none; }
  /* MOBILE_MENU_TOP_V1: first thing in the bar. 44px target; the bar's
     padding-left already carries the left safe-area inset. */
  .topbar .topbar-menu { flex: none; min-width: 44px; min-height: 44px; margin-left: -6px; }
  .topbar .topbar-menu svg { width: 22px; height: 22px; }
  .pin-here { display: inline-flex; }
  .pin-here[hidden] { display: none; }
}
/* ══ end mobile navigation redo + Pinned ══ */

/* ---- Columns chooser (columns.js, r-table-columns-chooser 2a) — cogs-columns-v1 */
.cols-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.cols-row { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 6px;
  border-radius: 10px; background: var(--surface-2, rgba(127,127,127,.06)); }
.cols-row.off .cols-label { color: var(--muted, #888); }
.cols-row:active { transform: scale(.99); }
.cols-grip { cursor: grab; color: var(--muted, #888); user-select: none; padding: 0 2px; }
.cols-label { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.cols-label input { width: 20px; height: 20px; }
@media (max-width: 700px) { .cols-grip { display: none; } .cols-row .btn-icon { min-width: 44px; min-height: 44px; } }

/* r-platform-nav-groups: sub-groups inside Platform (sidebar and phone menu).
   A sub is a quieter header (no icon) with its own fold; links keep their style. */
.nav-sub-h, .menu-sub-h {
  width: 100%; display: flex; align-items: center; gap: 8px; border: 0; background: none;
  cursor: pointer; text-align: left; color: var(--ink-3); border-radius: var(--r-sm);
  font: 600 12px/1.2 inherit; letter-spacing: .02em; text-transform: uppercase;
}
.nav-sub-h { padding: 8px 9px 5px; }
.menu-sub-h { padding: 12px 8px 8px; min-height: 44px; font-size: var(--t-sm); }
.nav-sub-h:hover, .menu-sub-h:hover { color: var(--ink-2); background: var(--surface-2); }
.nav-sub-h:focus-visible, .menu-sub-h:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.nav-sub-t, .menu-sub-t { flex: 1; min-width: 0; }
.nav-sub-n, .menu-sub-n { font-weight: 550; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.nav-sub-h .nav-chev, .menu-sub-h .nav-chev { width: 12px; height: 12px; flex: none;
  transition: transform .32s cubic-bezier(.32, .72, 0, 1); }
.nav-sub.open .nav-chev, .menu-sub.open .nav-chev { transform: rotate(90deg); }
.nav-sub:not(.open):has(a.on) .nav-sub-h, .menu-sub:not(.open):has(a.on) .menu-sub-h { color: var(--accent); }
.nav-sub:not(.open):has(.cnt) .nav-grp-dot, .menu-sub:not(.open):has(.cnt) .nav-grp-dot { display: block; }
.nav-sub-b, .menu-sub-b { display: grid; grid-template-rows: 0fr; opacity: 0;
  transition: grid-template-rows .32s cubic-bezier(.32, .72, 0, 1), opacity .2s ease; }
.nav-sub.open .nav-sub-b, .menu-sub.open .menu-sub-b { grid-template-rows: 1fr; opacity: 1; }
.nav-sub-i, .menu-sub-i { overflow: hidden; min-height: 0; display: flex; flex-direction: column; gap: 1px; }
.nav-sub-loose, .menu-sub-loose { overflow: visible; }
.nav-sub.open .nav-sub-i { padding-bottom: 4px; }
@media (prefers-reduced-motion: reduce) {
  .nav-sub-b, .menu-sub-b, .nav-sub-h .nav-chev, .menu-sub-h .nav-chev { transition: none; }
}
@media (prefers-contrast: more) {
  .nav-sub-h, .menu-sub-h { color: var(--ink-2); }
}

/* ---------------------------------------------------------------- notifications: sections + filters
   NOTIF_SECTIONS_P2 (r-notifications-security-scope-and-sections, part 2). The chip strip
   scrolls sideways on a phone; everything else wraps. Rows keep the .notif look. */
.nf { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.nf-bar { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.nf-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px;
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.nf-chips::-webkit-scrollbar { display: none; }
.nf-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.nf-chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px;
  padding: 0 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2, var(--ink)); font: inherit; font-size: 13px;
  font-weight: 550; cursor: pointer; white-space: nowrap; -webkit-tap-highlight-color: transparent;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.nf-chip:hover { border-color: var(--ink-3); }
.nf-chip.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.nf-chip:focus-visible, .nf-sec-h:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nf-chip-n { font-size: var(--t-micro); font-weight: 700; padding: 1px 6px; border-radius: 999px;
  background: var(--accent); color: #fff; }
.nf-tools .nf-range { width: auto; min-height: 36px; }
.nf-tools .nf-q { flex: 1 1 180px; min-width: 0; max-width: none; min-height: 36px; }
.nf-list { display: flex; flex-direction: column; gap: 14px; }
.nf-sec { display: flex; flex-direction: column; gap: 2px; }
.nf-sec-row { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.nf-sec-h { flex: 1; display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 2px;
  border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.nf-caret { width: 12px; color: var(--ink-3); font-size: var(--t-micro); }
.nf-sec-t { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.nf-sec-n { margin-left: auto; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.nf-rows { display: flex; flex-direction: column; gap: 2px; padding-top: 4px; }
@media (max-width: 700px) {
  .nf-chip, .nf-sec-h, .nf-tools .nf-range, .nf-tools .nf-q { min-height: 44px; }
  .nf-tools .nf-q, .nf-tools .nf-range { font-size: 16px; }   /* phones: 16px fields, so iOS never zooms */
  .nf-tools .nf-q { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { .nf-chip { transition: none; } }

/* ---------------------------------------------------------------- notifications: company filter
   NOTIF_COMPANY_P3B (r-notifications-security-scope-and-sections, part 3b). Only drawn for people
   in two or more companies. The picker is a <details> popover; rows carry a small company tag. */
.notif-co { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); font-weight: 600; max-width: 16em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.nf-co { position: relative; }
.nf-co > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.nf-co > summary::-webkit-details-marker { display: none; }
.nf-co > summary svg { width: 14px; height: 14px; }
.nf-co-l { max-width: 14em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nf-co-pop { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: min(320px, 86vw);
  max-height: 50vh; overflow: auto; display: flex; flex-direction: column; gap: 6px; padding: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .14); }
.nf-co-all { align-self: flex-start; }
.nf-co-list { display: flex; flex-direction: column; }
.nf-co-opt { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 6px;
  border-radius: var(--r-sm); cursor: pointer; }
.nf-co-opt:hover { background: var(--surface-2); }
.nf-co-opt input { width: 18px; height: 18px; flex: none; margin: 0; }
.nf-co-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nf-co-none { padding: 6px; font-size: 13px; }
.nf-co > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 700px) {
  .nf-co > summary, .nf-co-opt { min-height: 44px; }
  .nf-co-q { font-size: 16px; }   /* phones: 16px fields, so iOS never zooms */
}

/* ── FE_A11Y_FLOOR_P2 (frontend-a11y-floor-p2, 2026-11-10) ───────────────────────────────
   Measured on c-o-g-s.com/try at 1440 + 390, light + dark: every text pair under 4.5:1 and
   every control under 44px on a phone. Text tokens carry the contrast fix, so any screen that
   uses a colour as small words gets the safe value. --accent stays the organization's brand
   slot; --accent-text is derived from it (mixing toward --ink only ever raises contrast). */
:root {
  --accent-text: color-mix(in srgb, var(--accent) 85%, var(--ink));
  --good-text: #006b00;
  --warn-text: #8a5a00;
  --crit-text: color-mix(in srgb, var(--critical) 85%, var(--ink));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --accent-text: var(--accent); --good-text: #3cc13c; --warn-text: var(--s4); --crit-text: #f07272; }
}
:root[data-theme="dark"] { --accent-text: var(--accent); --good-text: #3cc13c; --warn-text: var(--s4); --crit-text: #f07272; }

/* accent as words on a soft fill: 4.29:1 -> 5.3:1 in light (dark already passes) */
.pill-info, .chip.locked, .chip.on, .chip.on b, .nav a.on, table.tbl th.sort .sort-ar { color: var(--accent-text); }
/* words on an accent fill use --accent-ink (white in light, near-black in dark), never a
   literal #fff: dark mode's accent is light enough that white is 3.2:1 */
.plan-n, .step.on i { color: var(--accent-ink); }
.sandbox-strip a.btn-pri { color: var(--accent-ink); text-decoration: none; }
.step:not(.on) i { color: var(--ink-2); }
/* status words: green 4.1 / amber 2.0 / red 4.0 -> all >= 5 */
.chip.up, .plan-tag.good { color: var(--good-text); }
.plan-tag.warn { color: var(--warn-text); }
.pill-critical { color: var(--crit-text); }

/* FE_QUIET_BADGES_V1 (r-fe-badges-quiet). JT 2026-11-10: "The badges are a little too loud on
   the reports and orders ... Just icons, less words, keep it simple".
   1) Status pills (.pill, one helper everywhere): no filled background. A coloured dot and the
      word. Calm states (draft, closed, sent, PO received, approved, paid) set the word in ink-2
      and keep their colour only in the dot; states that need a person (needs review, pending
      approval, open PO, overdue, void) keep their coloured word. Text stays >= 4.5:1, dots >= 3:1.
   2) Performer badges (.pbadge: Top 5, Needs a push, Fast payer, Slow to pay, Overdue) become
      a single 14px icon: no gold fill, no shine, no nudge. The word moves to the existing
      tooltip (title) and aria-label (role="img"), so nothing is lost for a screen reader.
      desk.js injects BADGE_CSS at runtime after this file, hence :root / !important below. */
.pill.pill-muted, .pill.pill-info, .pill.pill-good, .pill.pill-warning,
.pill.pill-serious, .pill.pill-critical { background: transparent; }
.pill { padding: 0; border-radius: 0; font-size: 12.5px; font-weight: 550; gap: 6px; box-shadow: none; }
.pill::before { width: 7px; height: 7px; }
.pill.pill-muted, .pill.pill-info, .pill.pill-good { color: var(--ink-2); }
.pill.pill-muted::before { background: var(--ink-3); }
.pill.pill-info::before { background: var(--accent-text); }
.pill.pill-good::before { background: var(--good-text); }
.pill.pill-critical { color: var(--crit-text); }

span.pbadge { background: none !important; box-shadow: none !important; animation: none !important;
  padding: 0; margin-left: 5px; width: 14px; height: 14px; gap: 0; vertical-align: -2px; overflow: visible; }
span.pbadge > span { display: none; }
span.pbadge::after { display: none !important; }
span.pbadge::before { content: ""; width: 14px; height: 14px; flex: none; background: currentColor;
  -webkit-mask: var(--pb-icon) center / contain no-repeat; mask: var(--pb-icon) center / contain no-repeat; }
:root span.pbadge.pb-top  { color: var(--accent-text); --pb-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2.8l2.85 5.78 6.38.93-4.62 4.5 1.09 6.35L12 17.36 6.3 20.36l1.09-6.35-4.62-4.5 6.38-.93z'/%3E%3C/svg%3E"); }
:root span.pbadge.pb-fast { color: var(--good-text);   --pb-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); }
:root span.pbadge.pb-low  { color: var(--ink-2);       --pb-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M23 18l-9.5-9.5-5 5L1 6M17 18h6v-6'/%3E%3C/svg%3E"); }
:root span.pbadge.pb-slow { color: var(--warn-text);   --pb-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20zM12 6v6l4 2'/%3E%3C/svg%3E"); }
:root span.pbadge.pb-over { color: var(--crit-text);   --pb-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 9v4M12 17h.01M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z'/%3E%3C/svg%3E"); }
/* inline style="color: var(--critical)" (Set requests headings): !important is the only way past it */
[style^="color: var(--critical)"], [style*="; color: var(--critical)"] { color: var(--crit-text) !important; }

/* 44px under a thumb, same media as FE_TOUCH_TARGETS_V1. */
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px), (pointer: coarse) {
  .btn-sm, .topbar .btn-icon, button.chip, .seg-b { position: relative; }
  .btn-sm::after, .topbar .btn-icon::after, button.chip::after, .seg-b::after {
    content: ""; position: absolute; inset: -4px 0;           /* .btn-sm 36 -> 44 */
  }
  .topbar .btn-icon::after { inset: -3px; }                   /* 38x38 -> 44x44, looks the same */
  button.chip::after, .seg-b::after { inset: -8px -2px; }     /* 29 / 37 -> 44+ */
  .tab-l { min-height: 44px; display: inline-flex; align-items: center; }
  a.plan-name { padding-block: 11px; margin-block: -11px; }   /* 23 -> 45, layout unchanged */
  details > summary.muted { padding-block: 14px; margin-block: -14px; }
  :where(input[type="checkbox"], input[type="radio"]) { width: 20px; height: 20px; }
}
/* ── end FE_A11Y_FLOOR_P2 ── */

/* FE_LINK_TARGETS_V1 (h-fe-link-targets): links FE_A11Y_FLOOR_P2 left under 44px on a phone.
   1. a.chip (Help's related topics, link chips): same invisible hit box as button.chip; the
      wrap gets an 18px row gap so stacked chips' boxes meet instead of overlapping.
   2. The back link above a page title ("<- Help"): 19 -> 45px, looks the same.
   3. Case / Tracking links inside a clickable tray card open something other than the card,
      so a near miss used to open the tray: those rows grow to 44px. */
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px), (pointer: coarse) {
  a.chip, .pagehead .grow > a.row:first-child { position: relative; }
  a.chip::after { content: ""; position: absolute; inset: -9px -2px; }       /* 29 -> 47 */
  .row-wrap:has(> a.chip) { row-gap: 18px !important; }
  .pagehead .grow > a.row:first-child::after { content: ""; position: absolute; inset: -13px -8px; }
  tr.clickable td > a.mono, tr.clickable .tray-track > a { display: inline-flex; align-items: center; min-height: 44px; }
  /* the carrier line under a tracking number stays where it was and taps through to the link */
  tr.clickable .tray-track > a { margin-bottom: -13px; }
  tr.clickable .tray-track > a ~ * { pointer-events: none; }
}
/* ── end FE_LINK_TARGETS_V1 ── */

/* FE_ORDERS_PHONE_V1 (r-fe-orders-phone-density): Orders on a phone.
   1. The pickers sit in .ord-filters behind one Filters button. On a desk the
      wrapper is display: contents and the button is hidden: no change there.
   2. Each order card is two or three short lines instead of an 8-row label /
      value block: MRN or order # with its status chip; then the other columns
      inline (a small label where the value alone is ambiguous) with the total
      on the right. Empty cells ("—") and the default "Patient case" chip are
      left out of the card. Column order still comes from Columns. */
.ord-filters { display: contents; }
.ord-filt-btn { display: none; }
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .card-h:has(> .ord-filt-btn) > input[type="search"] { flex: 1 0 100%; }
  .card-h .ord-filt-btn {
    display: inline-flex; flex: 1 1 0; min-width: fit-content; justify-content: center; gap: 8px;
    padding-left: 14px; padding-right: 14px;
  }
  /* open: the button reads as pressed (accent tint), so the panel below is clearly its */
  .card-h .ord-filt-btn[aria-expanded="true"] {
    background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--ink);
  }
  .ord-filt-n {
    display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 999px; background: var(--accent); color: var(--accent-ink);
    font-size: 12px; font-weight: 700; line-height: 1;
  }
  .card-h .ord-filters { display: none; }
  .card-h .ord-filters[data-open] {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
    flex: 1 1 100%; order: 1; min-width: 0;
  }
  .card-h .ord-filters select { width: 100%; min-width: 0; }
}
@media (max-width: 720px) {
  table.tbl.ord-tbl[data-cards="on"] tbody tr {
    display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 12px; row-gap: 3px;
    padding: 11px 38px 12px 16px;
  }
  /* a zero-height full-width break: line 1 is the key + status, the rest wraps below */
  table.tbl.ord-tbl[data-cards="on"] tbody tr::before { content: ""; order: 2; flex: 0 0 100%; height: 0; }
  table.tbl.ord-tbl[data-cards="on"] td {
    display: block; order: 3; flex: 0 1 auto; min-width: 0; max-width: 100%; min-height: 0;
    padding: 0; font-size: 13px; font-weight: 400; color: var(--ink-2); text-align: left;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  table.tbl.ord-tbl[data-cards="on"] td[data-label]::before {
    display: inline; margin-right: 5px; max-width: none; font-size: 10px; vertical-align: 1px;
  }
  table.tbl.ord-tbl[data-cards="on"] td[data-k="key"] {
    order: 1; flex: 1 1 0; font-size: var(--t-body); font-weight: 650; color: var(--ink); padding: 0;
  }
  table.tbl.ord-tbl[data-cards="on"] td[data-k="status"] { order: 1; flex: none; }
  table.tbl.ord-tbl[data-cards="on"] td[data-k="total"] {
    order: 4; margin-left: auto; font-size: 14px; font-weight: 650; color: var(--ink); text-align: right;
  }
  table.tbl.ord-tbl[data-cards="on"] td[data-k="key"]::before,
  table.tbl.ord-tbl[data-cards="on"] td[data-k="status"]::before,
  table.tbl.ord-tbl[data-cards="on"] td[data-k="total"]::before,
  table.tbl.ord-tbl[data-cards="on"] td[data-k="facility"]::before,
  table.tbl.ord-tbl[data-cards="on"] td[data-k="surgery"]::before { content: none; }
  table.tbl.ord-tbl[data-cards="on"] td[data-k]:not([data-k="key"]):has(> .muted:only-child),
  table.tbl.ord-tbl[data-cards="on"] td[data-k="otype"]:has(> .pill-muted) { display: none; }
  table.tbl.ord-tbl[data-cards="on"] td.ord-pick { order: 0; flex: none; width: 32px !important; overflow: visible; }
  table.tbl.ord-tbl[data-cards="on"] tbody tr.clickable::after { top: 17px; }
}

/* FE_V2_ORDERS_V1 (r-app-evolution, Orders list slice of the approved v2 direction).
   Codes read like codes: order numbers, MRNs and PO numbers in the mono face, tabular.
   The tape (FE_V2_P1) marks an order that waits on a person; desk.js adds tr.needs-you.
   On a phone card it runs the whole left edge of the card, not just the first line. */
table.tbl.ord-tbl td[data-k="key"] > span:not(.muted) {
  font-family: var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}
table.tbl.ord-tbl td[data-k="po"]:not(:has(.po-open, .muted)) {
  font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: .94em;
}
table.tbl.ord-tbl td[data-k="po"] .pill-good { font-family: var(--f-mono); font-weight: 550; }
@media (max-width: 720px) {
  table.tbl.ord-tbl[data-cards="on"] tbody tr.needs-you { position: relative; }
  table.tbl.ord-tbl[data-cards="on"] tbody tr.needs-you > td:first-child { position: static; }
  table.tbl.ord-tbl[data-cards="on"] tbody tr.needs-you > td:first-child::after { top: 0; bottom: 0; left: 0; }
}
/* ── end FE_V2_ORDERS_V1 ── */

/* NEW_ORDER_LINES_390 (b-dev-new-order-lines-clipped-390): order line items on a phone.
   A bare 1fr column never shrinks below its content, so two 268px inputs overflowed a
   322px card and Lot / Unit / Amount were cut off. minmax(0, 1fr) + min-width: 0 lets
   them fit. Each field sits in label.li-f; its small label (.li-l) shows only where the
   column header row is hidden (<= 820px). Desktop layout is unchanged. */
.li-f { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; margin: 0; }
.li-f > input { width: 100%; min-width: 0; }
.li-l { display: none; }
@media (max-width: 820px) {
  .lineitem { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .lineitem > :not(.btn), .lineitem input, .lineitem select { min-width: 0; }
  .lineitem input, .lineitem select { width: 100%; }
  .li-f { gap: 3px; }
  .li-l {
    display: block; font-size: 10.5px; line-height: 1.2; text-transform: uppercase;
    letter-spacing: .07em; color: var(--ink-2); font-weight: 700;
  }
}

/* FE_PHONE_TOPBAR_V1 (r-fe-phone-topbar): on a phone the organization's name gets the
   room the duplicate pin star took ("Pin this page" stays in the Menu sheet), and a long
   name wraps to two lines instead of reading 'Next G…'. Phone shell only. */
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .topbar .pin-here { display: none; }
  .topbar .topbar-n {
    font-size: 14px; line-height: 1.12; white-space: normal; overflow-wrap: anywhere;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  }
}

/* QR_TRAY_LABELS_P1B (r-qr-tray-labels): scan-to-open screens and the tray page label line. */
.qr-code-chip { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--surface-2, rgba(127,127,127,.12));
  border: 1px solid var(--line, rgba(127,127,127,.25)); letter-spacing: .06em; white-space: nowrap; }
.qr-row { gap: 8px; align-items: center; font-size: 13.5px; }
.qr-host:empty { display: none; }
.qr-type-row { gap: 8px; }
.qr-type-row .qr-type { flex: 1 1 auto; min-width: 0; text-transform: uppercase; letter-spacing: .08em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.qr-state-actions { gap: 8px; justify-content: center; }
.qr-pick { display: flex; flex-direction: column; gap: 4px; max-height: 55vh; overflow: auto; }
.qr-pick-row { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 10px; text-align: left;
  border: 1px solid var(--line, rgba(127,127,127,.25)); border-radius: 8px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.qr-pick-row .grow { display: flex; flex-direction: column; min-width: 0; }
.qr-pick-row:hover, .qr-pick-row:focus-visible { background: var(--surface-2, rgba(127,127,127,.1)); }
@media (max-width: 700px) {
  .qr-type-row .qr-type { font-size: 16px; }
  .qr-row .btn { min-height: 44px; }
  .tray-actions .tray-scan { flex-basis: 100%; }
}
/* v2, Front End Design review 2026-11-10: the global .empty svg rule must not size the icons inside
   resolver-state buttons; the Open button stays beside the code field at 390. */
.qr-state .btn svg { width: 17px; height: 17px; margin: 0; padding: 0; box-shadow: none; color: currentColor; }
.qr-type-row { flex-wrap: nowrap; } .qr-type-row .btn { flex: none; }

/* FE_V2_P1 (r-design-refresh-skills P1; direction approved by JT 2026-11-10 on d-fe-design-direction,
   "the label and the board"). app.css only:
   1) tokens: --signal / --signal-soft / --done / --tape / --t-label (light + dark);
   2) labels: field names read like an implant label, sentence case, quiet, 12.5px, system face.
      Retires the all-caps mono micro labels on KPI keys, table headers, phone card labels,
      key/value labels, aging rows and line-item headers;
   3) the signature: sterilization-indicator tape (.needs-you edge, .tag-signal) for things that
      need a person. Utilities only here; screens opt in in their own slices (Dashboard, Orders);
   4) the /try demo strip turns neutral and one row: orange is reserved for the tape. */
:root {
  --signal: #c2410c; --signal-soft: #fdf0e8; --signal-text: #9a3412; --done: #15803d;
  --strip-bg: #0e1116; --strip-ink: #f5f6f8;
  --t-label: 12.5px;
  --tape: repeating-linear-gradient(-45deg, var(--signal) 0 5px, transparent 5px 10px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --signal: #f97316; --signal-soft: #2a1709; --signal-text: #fb923c; --done: #22c55e;
    --strip-bg: #1d2229; --strip-ink: #f2f4f7; }
}
:root[data-theme="dark"] { --signal: #f97316; --signal-soft: #2a1709; --signal-text: #fb923c; --done: #22c55e;
  --strip-bg: #1d2229; --strip-ink: #f2f4f7; }

/* 2) labels */
.tile .k, .kpi-k, .pair-k, table.tbl th, table.tbl[data-cards="on"] td[data-label]::before,
.kv-k, .ord-detail .kv-k, .exp-detail .exp-k, .bars2.aging .lbl, .lineitem-h, .li-l {
  font-family: var(--font); text-transform: none; letter-spacing: 0;
  font-size: var(--t-label); font-weight: 500; color: var(--ink-3);
}

/* 3) tape */
.needs-you { position: relative; }
.tile.needs-you::before, tr.needs-you > td:first-child::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--tape); opacity: 1;
}
tr.needs-you > td:first-child { position: relative; }
.tag-signal {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px 2px 4px; border-radius: 999px;
  font: 600 12px/1.5 var(--font); color: var(--signal-text); background: var(--signal-soft); white-space: nowrap;
}
.tag-signal::before { content: ""; width: 12px; height: 12px; border-radius: 3px; background: var(--tape); flex: none; }
@media (forced-colors: active) { .tag-signal::before, .tile.needs-you::before, tr.needs-you > td:first-child::after { background: CanvasText; } }

/* 4) the demo strip */
.sandbox-strip.demo-strip, :root[data-theme="dark"] .sandbox-strip.demo-strip {
  background: var(--strip-bg); color: var(--strip-ink); padding: 6px 16px; min-height: 40px; gap: 12px; font-size: 13px;
  box-shadow: inset 0 -1px 0 var(--line-2);
}
.demo-strip > span b { font-weight: 650; }
.sandbox-strip.demo-strip .btn-pri { background: var(--accent); color: var(--accent-ink); border: 0; min-height: 30px;
  padding: 4px 12px; font-size: 12.5px; box-shadow: none; position: relative; }
.sandbox-strip.demo-strip .btn-pri::after { content: ""; position: absolute; inset: -7px -2px; } /* 44px hit area */
.demo-strip select { background: transparent; color: inherit; border: 1px solid color-mix(in srgb, currentColor 40%, transparent);
  border-radius: 6px; padding: 3px 6px; font-size: 13px; }
.demo-strip select option { color: #0e1116; background: #fff; }
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .sandbox-strip.demo-strip { min-height: 44px; padding-left: 12px; padding-right: 12px; flex-wrap: nowrap; gap: 8px; }
  .demo-strip label, .sandbox-strip.demo-strip .btn-pri { flex: none; white-space: nowrap; }
  .demo-strip > span { font-size: 0; }
  .demo-strip > span > :not(b) { display: none; }
  .demo-strip > span b { font-size: 13px; }
  .demo-strip label > span { display: none; }
  .demo-strip select { min-height: 32px; font-size: 16px; }
  /* Dev review 2026-11-10: keep the notch / Dynamic Island inset in every theme (the dark selector above
     outranks body > .sandbox-strip:first-child, which carries the safe-area padding). */
  :root body > .sandbox-strip.demo-strip:first-child { padding-top: calc(6px + var(--sat, env(safe-area-inset-top))); }
}

/* AUDITOR_RO_P2A (r-auditor-read-only-wider P2a): read-only badge + hidden write controls.
   The database refuses auditor writes; this only stops drawing buttons that would fail. */
.ro-badge {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  font-size: 10.5px; font-weight: 650; letter-spacing: .02em; vertical-align: 1px;
  color: var(--ink-2, #374151); background: color-mix(in srgb, currentColor 10%, transparent);
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
}
.ro-auditor [data-ro="hidden"] { display: none !important; }

/* FE_V2_DASH_V1 (r-fe-v2-dashboard) — the rep dashboard in the v2 language -------------
   One panel per group, hairline dividers, the indicator tape only where a person must act. */
.tiles.v2-panel { gap: 0; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-1);
  overflow: hidden; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tiles.v2-panel > .tile { border-radius: 0; box-shadow: none; background: transparent; padding: 16px 18px 16px 22px;
  animation: none; }
.tiles.v2-panel > .tile + .tile { box-shadow: inset 1px 0 0 var(--line); }
.tiles.v2-panel > .tile::before { background: transparent; opacity: 1; }
.tiles.v2-panel > .tile.needs-you::before { background: var(--tape); width: 5px; }
.tiles.v2-panel .tile .v { font-size: 32px; margin-top: 4px; }
.tiles.v2-panel .tile .sub { color: var(--ink-3); font-size: 13px; }
.tiles.v2-panel > .tile.tap:hover { transform: none; background: var(--surface-2); }
.tiles.v2-panel > .tile.tap:active { transform: none; background: var(--surface-3, var(--surface-2)); }
.tiles.v2-panel > .tile.tap:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.v2-pairs > .pairs { gap: 0; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-1);
  overflow: hidden; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.v2-pairs .pair { border: 0; border-radius: 0; background: transparent; padding: 16px 18px; }
.v2-pairs .pair + .pair { box-shadow: inset 1px 0 0 var(--line); }
.v2-pairs .pair-a { font-size: 24px; }
.v2-pairs .pair-bars { display: block; position: relative; margin: 12px 0 8px; }
.v2-pairs .pair-bars .pb { height: 4px; border-radius: 2px; background: var(--surface-3, var(--line)); }
.v2-pairs .pair-bars .pb + .pb { display: none; }
.v2-pairs .pair-bars .pb i.now { background: var(--accent); border-radius: 2px; }
.pb-tick { display: none; }
.v2-pairs .pb-tick { display: block; position: absolute; top: -4px; width: 2px; height: 12px; margin-left: -1px;
  background: var(--ink-2); border-radius: 1px; }
.v2-pairs .pair-b::before { content: ""; display: inline-block; width: 2px; height: 10px; background: var(--ink-2);
  margin-right: 6px; vertical-align: -1px; }

@media (max-width: 720px) {
  .tiles.v2-panel, .v2-pairs > .pairs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles.v2-panel > .tile:nth-child(3), .v2-pairs .pair:nth-child(3) { box-shadow: inset 0 1px 0 var(--line); }
  .tiles.v2-panel > .tile:nth-child(4), .v2-pairs .pair:nth-child(4) { box-shadow: inset 1px 0 0 var(--line), inset 0 1px 0 var(--line); }
  .tiles.v2-panel > .tile { padding: 14px 14px 14px 18px; }
  .tiles.v2-panel .tile .v { font-size: 28px; }
  .v2-pairs .pair { padding: 14px; }
  .v2-pairs .pair-a { font-size: 20px; }
  .v2-pairs .pair-top { flex-wrap: wrap; row-gap: 2px; }
}
@media (prefers-contrast: more) {
  .tiles.v2-panel, .v2-pairs > .pairs { box-shadow: 0 0 0 1px var(--ink-3); }
}
@media (forced-colors: active) {
  .tiles.v2-panel > .tile.needs-you::before, .v2-pairs .pb-tick { background: CanvasText; }
}

/* FE_NEW_ORDER_PHONE_V1 (r-fe-new-order-phone-flow) ---------------------------------
   c. Icons inside the New order buttons take the button's colour (.drop svg made them
      34px grey, which on the blue Take photo button read as a disabled glyph). */
.drop .btn svg { width: 18px; height: 18px; color: currentColor; }
/* a. On a phone the step's main action stays in the thumb zone: pinned to the bottom of
      .scroller (the only thing that scrolls in the phone shell), frosted, with a hairline. */
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .nf-actions {
    position: sticky; bottom: 0; z-index: 6;
    margin-left: -1px; margin-right: -1px; padding: 10px 12px;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    box-shadow: 0 -1px 0 var(--line);
    border-radius: 0 0 var(--r-lg) var(--r-lg);
  }
  .row-wrap.nf-actions { border-radius: var(--r-lg); margin-top: 4px; }
  .modal-f.nf-actions { border-top: 0 !important; padding-bottom: 10px; }
  .modal-f.nf-actions .btn { flex: 1; min-height: 48px; }
  .row-wrap.nf-actions .btn { width: 100%; min-height: 52px; }
  @supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    .nf-actions { background: color-mix(in srgb, var(--surface) 78%, transparent);
      -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%); }
  }
  @media (prefers-reduced-transparency: reduce) {
    .nf-actions { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
  }
  @media (prefers-contrast: more) { .nf-actions { background: var(--surface); box-shadow: 0 -1px 0 var(--ink-3); } }
}

/* FE_REPORTS_PHONE_V1 (r-fe-reports-filters-collapsed): Reports on a phone.
   Before: five export buttons, two wrapping chip rows and ~10 stacked fields came
   before the first number (y ~1013 at 390x844). Now, in the phone shell only:
   1. one Export button opens a sheet (Excel, CSV, PDF, "with orders", Hide MRN);
   2. the source chips and the report chips are one 44px line each that scrolls
      sideways (scroll-snap), the right edge fades while more is hidden;
   3. the filter fields fold behind one Filters button with a count, like Orders.
   On a desk .rep-exp is display: contents and both buttons are hidden: no change. */
.rep-exp { display: contents; }
.rep-exp-btn, .rep-filt-btn { display: none; }
.rep-exp-sheet { display: grid; gap: 8px; }
.rep-exp-sheet .rep-exp-item { width: 100%; min-height: 44px; justify-content: flex-start; gap: 10px; }
.rep-exp-sheet label[data-hide-mrn] { padding: 0 2px; }
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .rep-exp { display: none; }
  .pagehead .rep-exp-btn { display: inline-flex; gap: 8px; }
  .row.row-wrap.rep-chips {
    flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x proximity; scroll-padding-inline: 16px; scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    margin-inline: -16px; padding: 8px 16px; margin-block: -6px;   /* bleed to the screen edge; 8px keeps the chips' 44px hit area unclipped */
  }
  .row.row-wrap.rep-chips::-webkit-scrollbar { display: none; }
  .rep-chips > .chip { flex: none; scroll-snap-align: start; white-space: nowrap; }
  .rep-chips[data-more] {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
  }
  .rep-filt-btn {
    display: flex; width: 100%; min-height: 44px; justify-content: center; gap: 8px;
    border: 0; border-radius: inherit; background: transparent;
  }
  .rep-filt[data-open] .rep-filt-btn {
    background: var(--accent-soft); color: var(--ink);
    border-bottom-left-radius: 0; border-bottom-right-radius: 0;
  }
  .rep-filt-n {
    display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 999px; background: var(--accent); color: var(--accent-ink);
    font-size: 12px; font-weight: 700; line-height: 1;
  }
  .rep-filt:not([data-open]) > #rep-filters { display: none; }
}
@media (prefers-contrast: more) {
  .rep-chips[data-more] { -webkit-mask-image: none; mask-image: none; }
}
/* ── end FE_REPORTS_PHONE_V1 ── */

/* FE_REPORTS_TOOLBAR_V1 (r-fe-reports-toolbar-polish). JT 2026-11-11: "make this whole mess look
   nicer and more techy". Layout and styling only; every control and handler is the one it was.
   Header: More reports menu + Columns + one PDF split button (Excel / CSV in its menu).
   Data row: a segmented instrument tray, the picked source lit (accent ring + soft glow).
   Report row: lighter underline tabs. Filters: Period, dates, Search, More filters, Hide MRN in one
   bar of 40px controls; the rest on an even 4/2/1 grid behind More filters. What is on shows as
   chips you can remove, Clear filters on the right. Phone: the FE_REPORTS_PHONE_V1 fold still holds. */
.rep-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.rep-menu-wrap { position: relative; display: inline-flex; }
.rep-caret { width: 14px; height: 14px; transform: rotate(90deg); opacity: .7; transition: transform var(--dur-1) var(--ease-out); }
[aria-expanded="true"] > .rep-caret { transform: rotate(-90deg); }
.rep-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; min-width: 220px; padding: 6px;
  display: grid; gap: 2px; background: var(--surface); border-radius: var(--r); box-shadow: var(--sh-3);
  transform-origin: top right; animation: rep-menu-in var(--dur-1) var(--ease-out);
}
@keyframes rep-menu-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.rep-menu-i {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 12px;
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 550; text-align: left; text-decoration: none; cursor: pointer;
}
.rep-menu-i > svg { width: 16px; height: 16px; flex: none; color: var(--ink-2); }
.rep-menu-i:hover, .rep-menu-i:focus-visible { background: var(--surface-2); outline: none; }
.rep-menu-i:focus-visible { box-shadow: inset 0 0 0 1.5px var(--accent); }
/* split button: PDF does the common thing, the caret holds the other formats */
.rep-xsplit { display: inline-flex; border-radius: 10px; box-shadow: 0 1px 0 rgba(0,0,0,.04), 0 6px 18px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.rep-xsplit > .btn { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.rep-xsplit .rep-xsplit-more { border-top-left-radius: 0; border-bottom-left-radius: 0; padding-inline: 10px;
  box-shadow: inset 1px 0 0 color-mix(in srgb, var(--accent-ink) 30%, transparent); }
.rep-xsplit .rep-xsplit-more .rep-caret { opacity: .9; }

/* data row: one tray, segments inside it */
.row.row-wrap.rep-seg {
  gap: 2px; padding: 3px; align-self: flex-start; max-width: 100%;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
}
.rep-seg > .chip {
  min-height: 34px; padding: 0 12px; gap: 7px; border: 0; border-radius: 9px; background: transparent;
  color: var(--ink-2); font-weight: 600; cursor: pointer;
  transition: background var(--dur-1), color var(--dur-1), box-shadow var(--dur-1);
}
.rep-seg > .chip:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.rep-seg > .chip.locked {
  color: var(--ink); background: color-mix(in srgb, var(--accent) 20%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 65%, transparent),
              0 0 16px -4px color-mix(in srgb, var(--accent) 60%, transparent);
}
.rep-seg > .chip.locked > svg { color: var(--accent); opacity: 1; }

/* report row: underline tabs on a hairline, quieter than the tray above */
.row.row-wrap.rep-tabs { gap: 2px 18px; box-shadow: inset 0 -1px 0 var(--line); margin-top: -4px; }
.rep-tabs > .chip {
  min-height: 38px; padding: 0 2px; border: 0; border-radius: 0; background: transparent;
  color: var(--ink-2); font-weight: 550; cursor: pointer; transition: color var(--dur-1), box-shadow var(--dur-1);
}
.rep-tabs > .chip:hover { color: var(--ink); box-shadow: inset 0 -2px 0 var(--line-2); }
.rep-tabs > .chip.locked { color: var(--ink); font-weight: 650; background: transparent; box-shadow: inset 0 -2px 0 var(--accent); }
.rep-seg > .chip:focus-visible, .rep-tabs > .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* filters: one bar, then the panel */
.rep-fbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.rep-fbar > * { min-width: 0; }
@media (min-width: 1360px) {   /* wide desk: one line, Search takes the slack */
  .rep-fbar { display: grid; grid-template-columns: 180px 158px 158px minmax(160px, 1fr) auto auto; }
}
.rep-fbar > .f > span, .rep-fmore > .f > span { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.rep-f-period { flex: 0 1 180px; }
.rep-f-date { flex: 0 1 158px; }
.rep-f-q { flex: 1 1 220px; }
.rep-filt .f input:not([type="checkbox"]):not([type="radio"]), .rep-filt .f select {
  height: 40px; min-height: 40px; width: 100%; min-width: 0; font-variant-numeric: tabular-nums;
}
.rep-more-btn { min-height: 40px; gap: 8px; }
.rep-more-btn[aria-expanded="true"] { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.rep-more-btn > svg { width: 16px; height: 16px; }
.rep-filt-n {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-size: 12px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
}
.rep-switch { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer;
  font-size: 13.5px; font-weight: 550; color: var(--ink-2); white-space: nowrap; }
.rep-switch input {
  appearance: none; -webkit-appearance: none; flex: none; margin: 0; width: 36px; height: 22px; border-radius: 999px;
  background: var(--line-2); position: relative; cursor: pointer; transition: background var(--dur-1);
}
.rep-switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform var(--dur-1) var(--ease-out);
}
.rep-switch input:checked { background: var(--accent); }
.rep-switch input:checked::after { transform: translateX(14px); }
.rep-switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rep-fmore {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line);
}
.rep-fmore:not([data-open]) { display: none; }
.rep-check { align-self: end; gap: 8px; min-height: 40px; align-items: center; }
@media (max-width: 1180px) { .rep-fmore { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* what is on: removable chips, Clear filters on the right */
.rep-active { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 32px; margin-top: -4px; }
.rep-active-none { color: var(--ink-2); font-size: 13px; }
.rep-chip { padding: 2px 4px 2px 10px; min-height: 28px; font-weight: 550; background: var(--surface); border-color: var(--line-2); }
.rep-chip-fixed { padding-right: 10px; }
.rep-chip button { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; padding: 0; }
.rep-chip button > svg { width: 12px; height: 12px; }
.rep-chip button:hover { background: var(--surface-2); }
.rep-chip button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.rep-clear { margin-left: auto; }

@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .pagehead .rep-tools { width: 100%; justify-content: flex-start; }
  .pagehead .rep-tools .btn { min-height: 44px; }
  .pagehead .rep-tools > .rep-exp-btn { margin-left: auto; }
  .rep-xsplit { display: none; }
  .rep-menu { right: auto; left: 0; transform-origin: top left; }
  .rep-menu-i { min-height: 44px; }
  .row.row-wrap.rep-chips.rep-seg { border-radius: 0; border-inline: 0; gap: 2px; padding: 4px 16px; margin-block: 0; }
  .rep-seg > .chip, .rep-tabs > .chip { min-height: 44px; }
  .row.row-wrap.rep-chips.rep-tabs { margin-block: -4px 0; padding-block: 0; }
  .rep-fbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  .rep-f-period, .rep-f-q, .rep-switch { grid-column: 1 / -1; }
  .rep-filt .f input:not([type="checkbox"]):not([type="radio"]), .rep-filt .f select { height: 44px; min-height: 44px; }
  .rep-more-btn { display: none; }
  .rep-fmore, .rep-fmore:not([data-open]) { display: grid; grid-template-columns: 1fr; }
  .rep-switch { min-height: 44px; }
  .rep-chip { min-height: 36px; }
  .rep-chip button { width: 32px; height: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  .rep-menu { animation: none; }
  .rep-caret, .rep-switch input, .rep-switch input::after, .rep-seg > .chip, .rep-tabs > .chip { transition: none; }
}
@media (prefers-contrast: more) {
  .rep-seg > .chip.locked { box-shadow: inset 0 0 0 2px var(--accent); }
  .rep-chip { border-color: var(--ink-2); }
}
/* ── end FE_REPORTS_TOOLBAR_V1 ── */

/* FE_TOOLS_P1 (r-tools-section): the Tools page. One panel, a row per tool, hairline between rows:
   the same board the v2 dashboard uses. Three across on a wide screen, a plain list on a phone. */
.tools-page { max-width: 1080px; }
.tools { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-1); overflow: hidden; }
.tools .tool { position: relative; display: flex; flex-direction: column; box-shadow: inset 0 -1px 0 var(--line), inset -1px 0 0 var(--line); }
.tools .tool-a { display: flex; align-items: flex-start; gap: 14px; padding: 18px 18px 18px 20px; min-height: 64px;
  color: var(--ink); text-decoration: none; flex: 1; transition: background var(--dur-press, 100ms) var(--ease-out, ease); }
.tools .tool-a:hover { background: var(--surface-2); }
.tools .tool-a:active { background: var(--surface-3, var(--surface-2)); }
.tools .tool-a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tools .tool-ic { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r);
  background: var(--accent-soft); color: var(--accent-text, var(--accent)); }
.tools .tool-ic svg { width: 21px; height: 21px; }
.tools .tool-t { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.tools .tool-t b { font-size: 15px; font-weight: 620; }
.tools .tool-t span { font-size: 13.5px; color: var(--ink-2); line-height: 1.4; }
.tools .tool-chev { flex: none; align-self: center; color: var(--ink-3); }
.tools .tool-also { align-self: flex-start; display: inline-flex; align-items: center; min-height: 44px;
  margin: -10px 0 6px 74px; padding: 0 6px; font-size: 13.5px; font-weight: 550; color: var(--accent-text, var(--accent)); }
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .tools { grid-template-columns: 1fr; }
  .tools .tool { box-shadow: inset 0 -1px 0 var(--line); }
  .tools .tool:last-child { box-shadow: none; }
  .tools .tool-a { padding: 14px 14px 14px 16px; gap: 12px; }
  .tools .tool-also { margin-left: 66px; }
}
@media (prefers-reduced-motion: reduce) { .tools .tool-a { transition: none; } }
@media (forced-colors: active) { .tools .tool-ic { border: 1px solid CanvasText; } }
/* ── end FE_TOOLS_P1 ── */

/* FE_INTEL_TARGETS_V1 (h-fe-intel-targets): Intelligence on a phone.
   1. Table numbers that open their orders (button.cnum): 20 -> 46px hit box, same look.
   2. 'Open the <date> order' links under a finding: one 44px row each at 13px, not a
      14px-tall run of links joined by ' · ' (the separators are hidden with font-size 0). */
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px), (pointer: coarse) {
  .intel td button.cnum { position: relative; }
  .intel td button.cnum::after { content: ""; position: absolute; inset: -13px -6px; }
  .intel td span.sm:has(> a.lnk) { display: flex; flex-direction: column; align-items: flex-start;
    font-size: 0; line-height: 0; margin-top: 2px; }
  .intel td span.sm > a.lnk { display: inline-flex; align-items: center; min-height: 44px;
    font-size: 13px; line-height: 1.3; }
}
/* ── end FE_INTEL_TARGETS_V1 ── */

/* FE_V2_NEW_ORDER_V1 (r-app-evolution, v2 New order) ---------------------------------
   The first step of New order reads as a camera, not an upload form: a viewfinder (crop
   marks around a sketch of a charge sheet, the read lines in accent) beside the title,
   one full-width primary action, the rest sharing a row. The dashed box goes; a file
   dragged over the window turns the crop marks and the frame accent instead. */
.drop.nf-pick {
  border: 0; padding: 0; background: transparent; text-align: left;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); column-gap: 28px; align-items: center;
}
.nf-finder {
  --nf-mark: var(--ink-3); --nf-sheet: var(--surface);
  position: relative; aspect-ratio: 1 / 1; border-radius: 12px; background: var(--surface-2);
  display: grid; place-items: center; overflow: hidden;
  transition: background-color .18s ease;
}
:root[data-theme="dark"] .nf-finder { --nf-sheet: var(--surface-3); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .nf-finder { --nf-sheet: var(--surface-3); } }
.nf-finder::before { /* crop marks */
  content: ""; position: absolute; inset: 14px; --l: 22px; --w: 2px;
  background:
    linear-gradient(var(--nf-mark), var(--nf-mark)) top left / var(--l) var(--w) no-repeat,
    linear-gradient(var(--nf-mark), var(--nf-mark)) top left / var(--w) var(--l) no-repeat,
    linear-gradient(var(--nf-mark), var(--nf-mark)) top right / var(--l) var(--w) no-repeat,
    linear-gradient(var(--nf-mark), var(--nf-mark)) top right / var(--w) var(--l) no-repeat,
    linear-gradient(var(--nf-mark), var(--nf-mark)) bottom left / var(--l) var(--w) no-repeat,
    linear-gradient(var(--nf-mark), var(--nf-mark)) bottom left / var(--w) var(--l) no-repeat,
    linear-gradient(var(--nf-mark), var(--nf-mark)) bottom right / var(--l) var(--w) no-repeat,
    linear-gradient(var(--nf-mark), var(--nf-mark)) bottom right / var(--w) var(--l) no-repeat;
}
.nf-sheet {
  height: 72%; aspect-ratio: 8.5 / 11; background: var(--nf-sheet); border-radius: 3px;
  box-shadow: 0 0 0 1px var(--line), 0 8px 22px rgba(14, 17, 22, .08);
  padding: 9% 8%; display: grid; align-content: start; gap: 7%;
}
.nf-sheet i { display: block; height: 5px; border-radius: 2px; background: var(--line-2); width: 64%; }
.nf-sheet i:nth-child(1) { width: 46%; height: 7px; background: var(--ink-3); opacity: .55; }
.nf-sheet i:nth-child(4), .nf-sheet i:nth-child(6) { width: 82%; }
.nf-sheet i.hit { width: 74%; background: color-mix(in srgb, var(--accent) 60%, transparent); }
.drop.nf-pick.over { background: transparent; }
.drop.nf-pick.over .nf-finder { --nf-mark: var(--accent); background: var(--accent-soft); }
.nf-copy { display: grid; gap: 6px; min-width: 0; }
.nf-copy h3 { margin: 0; font-family: var(--f-display); font-size: 19px; font-weight: 700; letter-spacing: -.015em; }
.nf-copy > p.muted { margin: 0 0 10px; font-size: 14px; color: var(--ink-3); }
.row-wrap.nf-pick-btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-start; align-items: stretch; }
.nf-pick-btns > .btn { flex: 1 1 calc(50% - 5px); min-height: 48px; justify-content: center; }
/* the step's one primary action (Take photo, or Scan in the app) gets the full row, first */
.nf-pick-btns > .btn-pri:not([data-demo]) { flex-basis: 100%; order: -1; font-size: 16px; }
/* /try only: the sample-sheet button is a way in, not the main action */
.nf-pick-btns > .btn[data-demo] { background: transparent; color: var(--accent-text, var(--accent));
  border: 1px solid var(--line-2); box-shadow: none; }
.nf-pick .hint:empty { display: none; }
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .drop.nf-pick { grid-template-columns: minmax(0, 1fr); row-gap: 16px; }
  .nf-finder { aspect-ratio: auto; height: 132px; }
  .nf-sheet { height: 104px; gap: 6%; }
  .nf-finder::before { inset: 10px; --l: 18px; }
  /* keep the patient-data note above the tab bar at 390x844: secondary actions share a row */
  .nf-pick-btns > .btn { min-height: 52px; min-width: 0; white-space: normal; line-height: 1.2; padding-inline: 10px; }
}
@media (prefers-reduced-motion: reduce) { .nf-finder { transition: none; } }
@media (prefers-contrast: more) { .nf-finder { box-shadow: inset 0 0 0 1px var(--ink-3); } }
@media (forced-colors: active) {
  .nf-finder::before { background: none; outline: 2px dashed CanvasText; outline-offset: -2px; }
  .nf-sheet { border: 1px solid CanvasText; }
}

/* FE_V2_DESK_DASH_V1 (r-app-evolution: office dashboard) — the company dashboard and the manager's
   People view in the v2 language. One panel per group with 1px hairlines between cells (works for
   any count), zero counts recede, the tape stays the only orange. JT's section order is unchanged. */
.tiles.v2-panel.v2-grid { gap: 1px; background: var(--line); }
.tiles.v2-panel.v2-grid > .tile, .tiles.v2-panel.v2-grid > .tile + .tile { background: var(--surface); box-shadow: none; }
.tiles.v2-panel.v2-six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles.v2-panel > .tile.quiet .v { color: var(--ink-3); }
.tiles.v2-panel > .tile[role="link"]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (max-width: 720px) {
  .tiles.v2-panel.v2-six { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles.v2-panel.v2-grid > .tile:nth-child(n) { box-shadow: none; }
}

/* ── PRICE_LOOKUP_P3 (r-ai-price-lookup): #/price ── */
.pl-list { list-style: none; margin: 0; padding: 0; }
.pl-list > li { padding: 12px 18px; border-top: 1px solid var(--line, rgba(127,127,127,.18)); min-height: 44px; }
.pl-list > li:first-child { border-top: 0; }
.pl-list > li > a.pl-row { display: flex; align-items: center; gap: 12px; margin: -12px -18px; padding: 12px 18px; min-height: 44px; color: inherit; text-decoration: none; }
.pl-list > li > a.pl-row:hover { background: var(--hover, rgba(127,127,127,.08)); }
.pl-list > li > a.pl-row:active { transform: scale(.995); }
.pl-list > li > a.pl-row > svg { width: 16px; height: 16px; flex: none; color: var(--ink-3); }
.pl-list small, .pl-row small { overflow-wrap: anywhere; }
.pl-answer { margin: 0; line-height: 1.5; }
[data-mark="PRICE_LOOKUP_P3"] .row > .grow { min-width: 0; }
@media (prefers-reduced-motion: reduce) { .pl-list > li > a.pl-row:active { transform: none; } }
/* FE_PRICE_LOOKUP_POLISH_V1 (r-fe-price-lookup-polish): design review of h-price-lookup-p3 */
[data-mark="PRICE_LOOKUP_P3"] form[role="search"] { max-width: 640px; }
[data-mark="PRICE_LOOKUP_P3"] form.row .grow > .fld { width: 100%; max-width: none; }
[data-mark="PRICE_LOOKUP_P3"] [data-pl="header"] h2, .pl-row > .grow > b { font-family: var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.pl-price b.nowrap { font-variant-numeric: tabular-nums; }
[data-mark="PRICE_LOOKUP_P3"] .pl-list .grow > a, [data-mark="PRICE_LOOKUP_P3"] .empty a { display: inline-block; padding: 12px 0; margin: -12px 0; }
[data-mark="PRICE_LOOKUP_P3"] .empty a { color: var(--accent-text, var(--accent)); }
/* ── end PRICE_LOOKUP_P3 ── */

/* FE_V2_SCHEDULE_V1 (r-app-evolution, Schedule slice of the approved v2 direction).
   1) Waiting on approval is "needs a person": the tape, not a yellow fill. The banner is a quiet
      bar with the tape edge; month chips take the signal tint; list rows keep the rep colour on
      the left and carry the tape on the right edge. "No sets" (bright red, JT) is untouched.
   2) The Month / List switch is a segmented control the same height as the buttons beside it.
   3) On a phone the bar is three tidy rows: month, then view + Plan my day, then Only mine + count.
   4) Weekday heads read like the v2 labels (sentence case, system face); past days recede. */
.banner.cal-waitbar { position: relative; overflow: hidden; background: var(--surface); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line); padding-left: 20px; align-items: center; }
.banner.cal-waitbar::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  background: var(--tape); }
.banner.cal-waitbar > svg { color: var(--signal-text); margin-top: 0; }
.banner.cal-waitbar b { color: var(--signal-text); font-weight: 650; }
.banner.cal-waitbar .cal-wlink { display: inline-flex; align-items: center; gap: .3em; min-height: 32px; margin-right: 12px; }

.cal-case.wait:not(.cal-nosets) { background: var(--signal-soft); color: var(--signal-text);
  border-color: color-mix(in srgb, var(--signal) 30%, transparent); }
.cal-case.wait:not(.cal-nosets) > svg { color: var(--signal-text); }
.cal-case.wait:not(.cal-nosets) .cal-t { color: inherit; opacity: .85; }
.cal-arow.wait:not(.cal-nosets) { position: relative; background: var(--surface); padding-right: 20px; }
.cal-arow.wait:not(.cal-nosets)::after { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 5px;
  background: var(--tape); border-radius: 0 10px 10px 0; }

.cal-views { display: inline-flex; gap: 2px; padding: 2px; border-radius: 10px; overflow: visible;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.cal-views > .chip { min-height: 32px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent;
  color: var(--ink-2); font-weight: 600; box-shadow: none; }
.cal-views > .chip.on { outline: none; background: var(--surface); color: var(--ink);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 14%, transparent), inset 0 0 0 1px var(--line); }
.cal-views > .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal-bar .btn-sm { min-height: 36px; }
.cal-bar > .muted.tnum { font-size: 13px; }

.calhead { font-family: var(--font); text-transform: none; letter-spacing: 0;
  font-size: var(--t-label, 12.5px); font-weight: 500; color: var(--ink-3); }
.cal-day.past:not(.today) .cal-num { color: color-mix(in srgb, var(--ink-3) 70%, transparent); font-weight: 500; }

/* "No sets" stays bright red (JT), but its text measured 3.4-3.8:1 on the red tint; the a11y-floor
   text token brings it to 4.5:1. Specificity beats the style cases.js injects. */
button.chip.cal-case.cal-nosets, button.chip.cal-case.cal-nosets .cal-t { color: var(--crit-text); }
button.chip.cal-case.cal-nosets { background: color-mix(in srgb, var(--critical) 10%, var(--surface)); }

@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .cal-bar { display: grid; grid-template-columns: auto 1fr; gap: 10px 8px; }
  .cal-bar > .cal-nav { grid-column: 1 / -1; }
  .cal-bar > .cal-views { grid-column: 1; grid-row: 2; justify-self: start; }
  .cal-bar > a.btn { grid-column: 2; grid-row: 2; justify-self: end; align-self: center; }
  .cal-bar > .cal-mine { grid-column: 1; grid-row: 3; }
  .cal-bar > .muted.tnum { grid-column: 2; grid-row: 3; justify-self: end; align-self: center; }
  .cal-views > .chip { min-height: 44px; padding: 0 18px; }
  .cal-bar .btn-sm, .cal-bar > a.btn { min-height: 44px; }
  .banner.cal-waitbar .cal-wlink { position: relative; min-height: 34px; }
  .banner.cal-waitbar .cal-wlink::after { content: ""; position: absolute; inset: -5px 0; }   /* 44px hit area */
}
@media (prefers-contrast: more) {
  .cal-views > .chip.on { box-shadow: inset 0 0 0 2px var(--ink-2); }
}
@media (forced-colors: active) {
  .banner.cal-waitbar::before, .cal-arow.wait::after { background: CanvasText; }
}
/* end FE_V2_SCHEDULE_V1 */

/* FE_V2_PLAN_V1 (r-app-evolution, Plan my day slice of the approved v2 direction).
   1) Phone: the six settings fold behind one summary button ("Today · From here · 9:00 AM" /
      "4 h of calls · 30 min visits · within 30 mi"), the same pattern as Filters on Orders and
      Reports, so the stops start a screen higher. On a desk the wrapper is display: contents and
      the button is hidden: the settings card is unchanged.
   2) Phone: Publish / Google Maps / Apple Maps / Suggest again ride in a material bar pinned to
      the bottom of the stops card while it scrolls (sticky inside .scroller, released at the card's
      end so "Also worth a visit" stays reachable). Publish is full width, the rest share a row.
   3) "Change home address" gets a 44px hit area on touch; layout unchanged.
   4) Phone: a stop's time stays beside its name instead of wrapping under it. The stops lead and the route map follows them (it used to sit first, 300px tall). */
.plan-set { display: contents; }
.plan-set-btn { display: none; }
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .plan-set-btn {
    display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px 10px 16px;
    text-align: left; font: inherit; color: var(--ink); cursor: pointer;
    background: var(--surface); border: 0; border-radius: var(--r-lg); box-shadow: var(--sh-1);
    -webkit-tap-highlight-color: transparent; transition: transform 100ms ease-out, background-color 150ms ease;
  }
  .plan-set-btn:active { transform: scale(.985); background: var(--surface-2); }
  .plan-set-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .plan-set-btn > svg { flex: none; width: 18px; height: 18px; color: var(--ink-2); }
  .plan-set-btn > .plan-set-chev { transform: rotate(90deg); transition: transform 200ms cubic-bezier(.2, .8, .2, 1); }
  .plan-set-btn[aria-expanded="true"] > .plan-set-chev { transform: rotate(-90deg); }
  .plan-set-btn[aria-expanded="true"] { border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: none; }
  .plan-set-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .plan-set-txt > b { font-weight: 650; font-size: var(--t-base, 15px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .plan-set-txt > span { color: var(--ink-2); font-size: var(--t-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .plan-set > .plan-ctl { display: none; }
  .plan-set[data-open] { display: flex; flex-direction: column; border-radius: var(--r-lg); box-shadow: var(--sh-1); }
  .plan-set[data-open] > .plan-ctl { display: grid; border-radius: 0 0 var(--r-lg) var(--r-lg); box-shadow: none;
    border-top: 1px solid var(--line); }

  .plan .note a { display: inline-block; padding-block: 14px; margin-block: -14px; }

  /* a stop's arrival time stays on the name's line (it wrapped under it, indented); long names wrap */
  .plan-body > .spread { flex-wrap: nowrap; align-items: baseline; }
  .plan-body > .spread > .plan-name { min-width: 0; }

  /* the stops are the answer, so they lead; the route map follows them (it was first, 300px tall) */
  .plan-grid > .plan-map-card { order: 0; }

  .plan-acts {
    position: sticky; bottom: 0; z-index: 3;
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px !important;
    padding: 8px 12px;
    background: var(--surface); border-top: 1px solid var(--line);
    border-radius: 0 0 var(--r-lg) var(--r-lg);
  }
  @supports (backdrop-filter: blur(1px)) {
    .plan-acts { background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: saturate(160%) blur(14px); }
  }
  .plan-acts > .btn { justify-content: center; min-width: 0; padding-left: 8px; padding-right: 8px; white-space: nowrap; }
  .plan-acts > .btn-pri { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  .plan-set-btn, .plan-set-btn > .plan-set-chev { transition: none; }
  .plan-set-btn:active { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .plan-acts { background: var(--surface) !important; backdrop-filter: none !important; }
}

/* FE_V2_COMMISSIONS_V1 (r-app-evolution: Commissions) — #/commissions in the v2 language. The four
   money tiles are one panel (FE_V2_DESK_DASH_V1 grid); Over 90 days wears the tape. On a phone a
   Ready to pay out row stacks: name and detail full width, then amount and Draft on one line. */
.pref-row.cm-st .cm-no { font-weight: 600; letter-spacing: 0; }
@media (max-width: 720px) {
  .pref-row.cm-pay { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; row-gap: 6px; column-gap: 12px; }
  .pref-row.cm-pay > .grow { grid-column: 1 / -1; }
  .pref-row.cm-pay > .cm-amt { justify-self: start; }
  .pref-row.cm-pay > .btn { min-width: 88px; }
  .pref-row.cm-st { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; row-gap: 6px; column-gap: 12px; }
  .pref-row.cm-st > .grow { grid-column: 1 / -1; }
  .pref-row.cm-st > .tnum { justify-self: start; }
  a.cm-open { position: relative; }
  a.cm-open::after { content: ""; position: absolute; inset: -14px -8px; }
}

/* ================================================================ FE_AI_ASSISTANT_P1B
   "Ask the helper": a row at the top of the palette when the text reads like a question,
   and a sheet (openModal: a bottom sheet on phones) with the answer. Tokens only, so it
   follows light, dark and the v2 look. */
.pal-row.pal-ask .pal-l { font-weight: 600; }
.pal-row.pal-ask > svg { color: var(--accent); }
.ah { gap: 14px; }
.ah-form.f { gap: 6px; }
.ah-form.f input.ah-in { font-size: 16px; min-height: 44px; }   /* 16px: iOS never zooms on focus */
.ah-warn { display: flex; gap: 7px; align-items: flex-start; margin: 2px 0 0;
  font-size: var(--t-sm); line-height: 1.45; color: var(--ink-2); }
.ah-warn svg { width: 14px; height: 14px; flex: none; margin-top: 2px; color: var(--ink-3); }
.ah-err { margin: 0; font-size: var(--t-sm); font-weight: 600; color: var(--critical); }
.ah-form.f input.ah-in[aria-invalid="true"] { border-color: var(--critical); }
.ah-out:empty { display: none; }
.ah-out { display: grid; gap: 12px; }
.ah-wait { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--ink-2); font-size: 14px; }
.ah-ans { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink); }
.ah-steps { margin: 0; padding: 0; list-style: none; counter-reset: ah; display: grid; gap: 8px; }
.ah-steps li { counter-increment: ah; display: grid; grid-template-columns: 24px 1fr; gap: 10px;
  font-size: 14.5px; line-height: 1.5; color: var(--ink); }
.ah-steps li::before { content: counter(ah); width: 24px; height: 24px; border-radius: 999px;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--accent-soft); color: var(--ink); }
.ah-links { display: grid; gap: 6px; }
.ah-link { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--ink);
  font-weight: 600; font-size: 14.5px; text-decoration: none; }
.ah-link svg { width: 16px; height: 16px; color: var(--ink-3); flex: none; }
.ah-link:hover { border-color: var(--accent); }
.ah-link:active { transform: scale(.985); transition: transform 100ms ease-out; }
.ah-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ah-note { margin: 0; font-size: var(--t-sm); color: var(--ink-2); }
.ah-fail { align-items: center; }
.ah-fail .btn { flex: none; min-height: 36px; }
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .ah-fail .btn { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .ah-link:active { transform: none; } }
/* end FE_AI_ASSISTANT_P1B */

/* ================================================================ FE_STICKER_POLISH_V1
   Tools > Read a sticker (sticker.js): the inline styles of TOOLS_STICKER_P1 and
   TOOLS_STICKER_APPROVALS, on type tokens and --line rows (r-fe-sticker-polish). */
.stk-h { margin: 0; font-size: var(--t-h3); font-weight: 650; letter-spacing: -.01em; }
.stk-head { gap: 8px; align-items: center; }
.stk-earlier { margin-top: 6px; }
.stk-earlier .stk-h { color: var(--ink-2); }
.stk-actions { gap: 8px; flex-wrap: wrap; }
.stk-btn { min-height: 44px; display: inline-flex; align-items: center; }
.stk-list { list-style: none; margin: 0; padding: 0; }
.stk-row { gap: 12px; align-items: center; min-height: 52px; padding: 6px 0; box-shadow: inset 0 -1px 0 var(--line); }
.stk-list > .stk-row:last-child { box-shadow: none; }
.stk-cell { min-width: 0; }
.stk-k { font-size: var(--t-sm); color: var(--ink-2); overflow-wrap: anywhere; }
.stk-v { font-weight: 600; font-size: var(--t-body); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.stk-price { white-space: nowrap; overflow-wrap: normal; }
.stk-exp { gap: 8px; flex-wrap: wrap; align-items: center; }
.stk-copy { min-height: 44px; min-width: 64px; }
.stk-name { font-weight: 600; font-size: var(--t-body); overflow-wrap: anywhere; }
.stk-meta { font-size: var(--t-sm); color: var(--ink-2); overflow-wrap: anywhere; }
.stk-side { gap: 4px; align-items: flex-end; flex-shrink: 0; }
.stk-pills { gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.stk-p { margin: 0; color: var(--ink-2); }
.stk-raw > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--ink-2); font-size: var(--t-sm); }
.stk-raw > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.stk-raw > .mono { font-size: var(--t-sm); color: var(--ink-2); overflow-wrap: anywhere; }
/* end FE_STICKER_POLISH_V1 */

/* FE_INVITE_ACTIVITY_V1 — roster look shared by Invite people > Activity and (next) Sent invites.
   Summary tiles are filter toggles; the lit tile wears the accent rail along its foot. */
.roster-tiles > button.tile { font: inherit; color: inherit; text-align: left; border: 0; cursor: pointer; width: 100%; min-height: 44px; }
.roster-tiles > .tile.on { background: var(--accent-soft); }
.roster-tiles > .tile.on .k, .roster-tiles > .tile.on .v { color: var(--accent-text, var(--accent)); }
.roster-tiles > .tile.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--accent); }
.roster-tiles > .tile { position: relative; }
.card.roster { padding: 0; overflow: hidden; display: grid; min-width: 0; }
.roster-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 16px; box-shadow: inset 0 -1px 0 var(--line); }
.roster-search { position: relative; flex: 1 1 260px; max-width: 420px; }
.roster-search > svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.roster-search > .fld { width: 100%; padding-left: 36px; min-height: 44px; font-size: 16px; }
.roster-count { font-size: 13.5px; font-variant-numeric: tabular-nums; }
.roster-bar > .btn { margin-left: auto; min-height: 44px; }
.roster-table { position: relative; margin: 0; border-radius: 0; box-shadow: none; overflow-x: auto; min-width: 0; }
.roster-table th, .roster-table td { padding-left: 12px; padding-right: 12px; }
.roster-table td:first-child { min-width: 190px; max-width: 260px; }
.roster-dist { min-width: 140px; max-width: 200px; }
.roster-dist .muted { font-size: 13px; }
.roster-table th { vertical-align: bottom; }
.roster-sort { all: unset; display: inline-flex; align-items: baseline; gap: 4px; min-height: 32px; cursor: pointer; font: inherit; color: inherit; border-radius: 4px; }
.roster-sort { flex-wrap: wrap; }
.roster-sort small { flex-basis: 100%; order: 3; font-size: 11.5px; color: var(--ink-3); font-weight: 500; }
.roster-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.roster-arrow { color: var(--accent-text, var(--accent)); min-width: .7em; }
.roster-person { display: grid; gap: 1px; min-width: 0; }
.roster-person > a { font-weight: 650; color: var(--accent-text, var(--accent)); text-decoration: none; display: inline-flex; align-items: center; min-height: 28px; }
.roster-person > a:hover { text-decoration: underline; }
.roster-person > .muted { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster-card .roster-person > .muted { white-space: normal; overflow-wrap: anywhere; }
.roster-meter { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.roster-meter b { min-width: 1.4em; text-align: right; font-weight: 600; }
.roster-meter .bar { width: 48px; height: 4px; border-radius: 2px; background: var(--surface-3, var(--line)); overflow: hidden; }
.roster-meter .bar i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.roster-act { text-align: right; white-space: nowrap; }
.roster-act .btn { min-height: 44px; min-width: 88px; }
tr.roster-off td { color: var(--ink-3); }
.roster-cards { display: none; list-style: none; margin: 0; padding: 0; }
.roster-card { display: grid; gap: 8px; padding: 14px 16px; box-shadow: inset 0 -1px 0 var(--line); }
.rc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.rc-top .pill { flex: none; }
.rc-kv { display: flex; flex-wrap: wrap; gap: 6px; }
.rc-kv > span { font-size: 13px; color: var(--ink-2); background: var(--surface-2); border-radius: 6px; padding: 4px 8px; }
.rc-kv b { font-weight: 600; color: var(--ink); }
.rc-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13.5px; }
.rc-foot .btn { min-height: 44px; }
.card.roster > .btn { margin: 12px auto 16px; }
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .roster-table { display: none; }
  .roster-cards { display: block; }
  .roster-bar { padding: 12px; }
  .roster-search { max-width: none; flex-basis: 100%; }
  .roster-bar > .btn { margin-left: auto; }
  .roster-tiles.v2-six > .tile .sub { display: none; }
}
@media (prefers-contrast: more) { .roster-tiles > .tile.on { outline: 2px solid var(--ink); outline-offset: -2px; } }
/* ── DESKTOP_TABS_P1 (r-desktop-tabs-split-view, JT-approved mock) ─────────────
   A strip of in-app tabs at the top of .content, 1024 px and wider only. The active
   tab is the page surface joined to the content below, with the sidebar's accent
   rail laid flat along its top; the others recede to ink-2 on the translucent
   material. Phones and narrow windows never draw it. Tokens only. */
.dt-strip { display: none; }
@media (min-width: 1024px) {
  .dt-strip {
    position: sticky; top: 0; z-index: 31;
    display: flex; align-items: flex-end; gap: 2px;
    height: 44px; padding: 0 12px 0 16px;
    background: color-mix(in srgb, var(--plane) 84%, transparent);
    -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
    box-shadow: inset 0 -1px 0 var(--line);
  }
  .dt-tabs { display: flex; align-items: flex-end; gap: 2px; min-width: 0; flex: 1; overflow: hidden; }
  .dt-tab {
    position: relative; display: flex; align-items: center; gap: 8px;
    height: 36px; min-width: 112px; max-width: 216px; flex: 0 1 216px;
    padding: 0 6px 0 12px; border-radius: var(--r-sm) var(--r-sm) 0 0;
    font: 500 13.5px/1 var(--font); color: var(--ink-2); letter-spacing: -.003em;
    cursor: default; user-select: none; -webkit-user-select: none;
    transition: background-color .12s ease, color .12s ease;
  }
  .dt-tab:hover { background: var(--surface-2); color: var(--ink); }
  .dt-tab:active { background: var(--surface-3); }
  .dt-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--r-sm) var(--r-sm) 0 0; }
  .dt-tab svg { width: 16px; height: 16px; flex: none; opacity: .8; }
  .dt-tab .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dt-tab .t .sub { font-weight: 400; color: var(--ink-2); }
  .dt-tab .x {
    width: 24px; height: 24px; border-radius: 6px; flex: none;
    display: grid; place-items: center; color: var(--ink-2); opacity: 0;
  }
  .dt-tab:hover .x, .dt-tab.on .x, .dt-tab:focus-within .x { opacity: 1; }
  .dt-tab .x:hover { background: var(--surface-3); color: var(--ink); }
  .dt-tab .x svg { width: 12px; height: 12px; opacity: 1; }
  .dt-tab.on {
    background: var(--surface); color: var(--ink); font-weight: 600;
    box-shadow: 0 0 0 1px var(--line), 0 1px 0 0 var(--surface);
  }
  .dt-tab.on::after {
    content: ""; position: absolute; left: 10px; right: 10px; top: 0; height: 2px;
    border-radius: 0 0 2px 2px; background: var(--accent);
  }
  .dt-tab .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }
  .dt-tab .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;
  }
  .dt-tab + .dt-tab:not(.on)::before {
    content: ""; position: absolute; left: -1px; top: 11px; bottom: 11px; width: 1px; background: var(--line);
  }
  .dt-tab.on + .dt-tab::before, .dt-tab:hover + .dt-tab::before { display: none; }
  .dt-actions { display: flex; align-items: center; gap: 4px; height: 44px; flex: none; padding-left: 8px; }
  .dt-btn {
    height: 32px; min-width: 32px; padding: 0 8px; border: 0; border-radius: var(--r-sm);
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: transparent; color: var(--ink-2); font: 500 13px/1 var(--font); cursor: pointer;
  }
  .dt-btn:hover { background: var(--surface-2); color: var(--ink); }
  .dt-btn:active { background: var(--surface-3); }
  .dt-btn:disabled { opacity: .45; cursor: default; background: transparent; }
  .dt-btn svg { width: 16px; height: 16px; }
  /* a tablet in landscape gets the strip too: fingers need the full 44 px */
  @media (pointer: coarse) {
    .dt-strip, .dt-actions { height: 52px; }
    .dt-tab { height: 44px; }
    .dt-tab .x { width: 44px; height: 44px; margin-right: -6px; opacity: 1; }
    .dt-btn { height: 44px; min-width: 44px; }
  }
}
/* right-click menu on a link: grows from the pointer */
.dt-menu {
  position: absolute; z-index: 95; width: 248px; padding: 6px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  border-radius: var(--r); box-shadow: var(--sh-3), 0 0 0 1px var(--line);
  font: 400 14px/1 var(--font); color: var(--ink);
  animation: dt-menu-in .14s ease-out;
}
.dt-menu .mi {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px;
  border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: default;
}
.dt-menu .mi svg { width: 16px; height: 16px; color: var(--ink-2); flex: none; }
.dt-menu .mi .k { margin-left: auto; color: var(--ink-2); font-size: 12.5px; }
.dt-menu .mi:hover:not(:disabled), .dt-menu .mi:focus-visible { background: var(--accent); color: var(--accent-ink); outline: none; }
.dt-menu .mi:hover:not(:disabled) svg, .dt-menu .mi:hover:not(:disabled) .k,
.dt-menu .mi:focus-visible svg, .dt-menu .mi:focus-visible .k { color: var(--accent-ink); }
.dt-menu .mi:disabled { opacity: .45; }
.dt-menu hr { border: 0; height: 1px; background: var(--line); margin: 5px 6px; }
@keyframes dt-menu-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .dt-menu { animation: none; }
  .dt-tab { transition: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .dt-strip { background: var(--plane); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .dt-menu { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  .dt-tab.on { box-shadow: 0 0 0 2px var(--ink); }
  .dt-tab { color: var(--ink); }
}
@media print { .dt-strip, .dt-menu { display: none !important; } }
/* end DESKTOP_TABS_P1 */

/* FE_PANE_TABLE_CLIP_V1 (frontend-pane-table-clip): the scroll box is the containing block
   for anything absolutely placed inside a table (sr-only spans, row rails), so it scrolls
   with the table instead of widening the page at 701-1100 px and in split-view panes. */
.tbl-wrap, .calwrap { position: relative; }
/* end FE_PANE_TABLE_CLIP_V1 */

/* FE_CRIT_TEXT_V1 (frontend-crit-text): --critical is a fill colour; as words it is
   3.8:1 on --surface in dark. Words use --crit-text (a11y floor P2), which passes
   4.5:1 in light and dark. Fills, borders, toasts and badges keep --critical. */
.btn-danger,
.chip button:hover,
.diff del,
.ob-err,
.tag-due,
.tl-dot.bad,
.bars2.aging .bar2.late .lbl,
td.set-late, .tray-due.late, td.dir-late, td.agr-late, td.ppl-late,
.ah-err { color: var(--crit-text); }
/* end FE_CRIT_TEXT_V1 */

/* ── FE_ORDERS_TOOLBAR_V1 (r-fe-orders-toolbar-tidy) ───────────────────────────
   Orders header: one group of same-style controls (Select, Filters, Columns, CSV,
   Edit grid). Sized by the card, not the viewport (split-view panes, tablets):
   wide   = count | search | tools, desk pickers on a row below
   medium = count, then search (grows) | tools
   narrow = count, full-width search, then one row of equal 44px icon buttons;
            the words stay as each button's accessible name and tooltip.
   Colours come from .btn and the existing pressed / expanded states. */
.card-h.ord-h { container: ordh / inline-size; flex-wrap: wrap; row-gap: 10px; column-gap: 10px; }
.card-h.ord-h > h2 { order: 0; }
.card-h.ord-h > input[type="search"] { order: 1; flex: 1 1 260px; max-width: 420px; min-height: 40px; }
.ord-tools { order: 2; display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: nowrap; min-width: 0; }
.ord-tools > .btn { height: 40px; min-height: 40px; padding: 0 14px; gap: 7px; font-size: 14px; flex: none; }
.ord-tools > .btn svg { width: 16px; height: 16px; flex: none; }
.ord-tools > .btn .ord-filt-n { margin-left: 1px; }
.card-h.ord-h > .ord-filters { order: 3; }
@media (min-width: 961px), (min-width: 701px) and (min-height: 521px) {
  /* desk: the pickers get their own tidy row under the toolbar */
  .card-h.ord-h > .ord-filters { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 100%; min-width: 0; }
  .card-h.ord-h > .ord-filters select { min-height: 40px; max-width: 260px; }
}
@media (pointer: coarse) { .ord-tools > .btn { height: 44px; min-height: 44px; } }
@container ordh (max-width: 879px) {
  /* count on its own line, then search grows beside the tools (DOM = visual = tab order) */
  .card-h.ord-h > h2 { flex: 1 1 100%; }
  .card-h.ord-h > input[type="search"] { flex: 1 1 200px; max-width: none; }
}
@container ordh (max-width: 519px) {
  .card-h.ord-h > h2 { flex: 1 1 100%; }
  .card-h.ord-h > input[type="search"] { order: 1; min-height: 44px; }
  .ord-tools { order: 2; flex: 1 1 100%; margin-left: 0; }
  .ord-tools > .btn { flex: 1 1 0; min-width: 44px; height: 44px; min-height: 44px; padding: 0 8px; gap: 6px; }
  .ord-tools > .btn svg { width: 18px; height: 18px; }
  /* icon only: the words stay in the accessibility tree */
  .ord-tools > .btn:not([aria-pressed="true"]) .ot-l {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
  }
  .ord-tools > .btn { position: relative; }
}
/* ── end FE_ORDERS_TOOLBAR_V1 ── */
/* ── SO_REP_SEND_SHEET_V1: rep check-and-send sheet + Settings > Sales orders ── */
.sosh { display: grid; gap: 12px; }
.sosh .banner[hidden] { display: none; }
.sosh-steps { display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; }
.sosh-steps li { flex: 1 1 0; display: flex; align-items: center; gap: 6px; min-width: 0;
  font-size: var(--t-sm); font-weight: 600; color: var(--ink-3); padding-bottom: 6px; border-bottom: 2px solid var(--line); }
.sosh-steps li.past { color: var(--ink-2); border-color: var(--line-2); }
.sosh-steps li.on { color: var(--ink); border-color: var(--accent); }
.sosh-n { flex: none; width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.sosh-steps li.on .sosh-n { background: var(--accent); border-color: var(--accent); color: var(--accent-ink, #fff); }
.sosh-h { font-size: 12.5px; font-weight: 650; color: var(--ink-2); margin-top: 4px; }
.sosh-list { display: grid; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.sosh-row, .sosh-pick, .sosh-lines { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px;
  padding: 10px 12px; text-align: left; font: inherit; color: var(--ink); background: none;
  border: 0; border-top: 1px solid var(--line); cursor: pointer; }
.sosh-list > :first-child { border-top: 0; }
.sosh-row:hover, .sosh-pick:hover, .sosh-lines:hover { background: var(--surface-2); }
.sosh-row:active, .sosh-lines:active { background: var(--surface-3); }
.sosh-row:focus-visible, .sosh-lines:focus-visible { outline: 2px solid var(--ring, var(--accent)); outline-offset: -2px; }
.sosh-k { flex: none; width: 118px; font-size: var(--t-sm); color: var(--ink-3); }
.sosh-v { flex: 1 1 auto; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.sosh-ed { flex: none; color: var(--ink-3); width: 16px; height: 16px; }
.sosh-lines { flex-direction: column; align-items: stretch; gap: 0; padding: 0;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.sosh-line { display: flex; align-items: baseline; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--line); }
.sosh-line:first-child { border-top: 0; }
.sosh-ld { display: flex; align-items: center; gap: 6px; font-weight: 600; overflow-wrap: anywhere; }
.sosh-lm { display: block; font-size: 12.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.sosh-addr { white-space: pre-line; }
.sosh-lq { flex: none; color: var(--ink-2); font-size: var(--t-sm); }
.sosh-la { flex: none; min-width: 76px; font-weight: 600; }
.sosh-tot { background: var(--surface-2); font-weight: 650; }
.sosh-pick { cursor: pointer; }
.sosh-pick > input[type="checkbox"], .sosh-pick > input[type="radio"] { flex: none; width: 20px; height: 20px; margin: 0; }
.sosh-qty { flex: none; width: 72px; min-height: 40px; text-align: right; }
.sosh-pill { margin-left: 4px; }
.sosh-seg { display: flex; width: 100%; }
.sosh-seg .seg-b { flex: 1 1 0; justify-content: center; min-height: 44px; font-weight: 600; }
.sosh-new[hidden] { display: none; }
.sosh-chk { gap: 8px; min-height: 44px; font-size: 13.5px; font-weight: 550; }
.sosh-chk > input { width: 18px; height: 18px; margin: 0; }
.sosh-subj { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); font-size: var(--t-sm); }
.sosh-subj .sosh-k { width: auto; }
.sosh-foot { display: flex; gap: 8px; width: 100%; }
.sosh-foot > .btn { min-height: 44px; }
.sosh-done { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 18px 8px 6px; }
.sosh-done h3 { margin: 4px 0 0; font-size: 19px; letter-spacing: -0.01em; }
.sosh-done p { margin: 0; color: var(--ink-2); max-width: 38ch; }
.sosh-tick { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); }
.sosh-tick svg { width: 26px; height: 26px; }
.sosh-ticks { display: flex; flex-wrap: wrap; gap: 2px 16px; }
.sosw { display: flex; align-items: center; gap: 14px; min-height: 52px; cursor: pointer; }
.sosw-l { display: block; font-weight: 600; }
.sosw-in { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 46px; height: 28px; margin: 0;
  border-radius: 14px; background: var(--line-2); border: 1px solid var(--line-2); cursor: pointer;
  transition: background-color var(--dur-1, 120ms) var(--ease-out, ease-out); }
.sosw-in::after { content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform var(--dur-1, 120ms) var(--ease-out, ease-out); }
.sosw-in:checked { background: var(--accent); border-color: var(--accent); }
.sosw-in:checked::after { transform: translateX(18px); }
.sosw-in:focus-visible { outline: 2px solid var(--ring, var(--accent)); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .sosw-in, .sosw-in::after { transition: none; } }
@media (prefers-contrast: more) { .sosw-in { border-color: var(--ink); } .sosh-list, .sosh-lines { border-color: var(--ink-2); } }
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .sosh-k { width: 104px; }
  .sosh-qty { font-size: 16px; min-height: 44px; }
  .sosh .f input, .sosh .f textarea, .sosh-new textarea, .sosh input[type="email"] { font-size: 16px; }
}
.sosh .chip > button, [data-mark="SO_REP_SEND_SHEET_V1"] .chip > button { position: relative; min-width: 28px; min-height: 28px; }
@media (pointer: coarse) {
  .sosh .chip > button::after, [data-mark="SO_REP_SEND_SHEET_V1"] .chip > button::after { content: ""; position: absolute; inset: -8px; }
}
/* ── end SO_REP_SEND_SHEET_V1 ── */
/* FE_SO_SHEET_TYPE_V1 (r-fe-so-send-sheet-phone-type): send-sheet parties.
   1. Phones: role + muted name flow as one wrapping line, not two squeezed flex columns.
   2. The note in a locked party (Company inbox / Billing) is hint size and muted. */
.party .party-addr + .hint { font-size: 12px; line-height: 1.4; color: var(--ink-3); margin-top: 3px; }
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .party-name { display: block; line-height: 1.35; padding-left: 21px; text-indent: -21px; }  /* wrapped lines hang under the role */
  .party-name > svg { display: inline-block; vertical-align: -2px; margin-right: 6px; }
}
/* ── end FE_SO_SHEET_TYPE_V1 ── */
/* ── SO_REP_DIRECT_NOT_ALLOWED_V1: rep direct send refused for outside addresses ── */
.chip.sosh-out { border-color: color-mix(in srgb, var(--warning) 60%, var(--line));
  background: color-mix(in srgb, var(--warning) 12%, var(--surface)); }
.chip.sosh-out .sosh-out-tag { flex: none; font-size: 11.5px; font-weight: 650; color: var(--warn-text); }
.party-out { margin-top: 4px; }
.sosh-outbox { scroll-margin: 12px; }
.sosh-outbox:focus { outline: none; }
.sosh-outbox:focus-visible { outline: 2px solid var(--ring, var(--accent)); outline-offset: 2px; }
.sosh-out-h { font-weight: 650; margin-bottom: 2px; }
.sosh-out-list { margin: 6px 0 0; padding-left: 18px; overflow-wrap: anywhere; font-weight: 600; }
.sosh-foot-out { flex-wrap: wrap; }
.sosh-foot-out > .btn { flex: 1 1 auto; }
.sosh-foot-out > .btn:first-child { flex: 0 0 auto; }
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .sosh-foot-out { flex-direction: column-reverse; }
  .sosh-foot-out > .btn, .sosh-foot-out > .btn:first-child { width: 100%; flex: none; justify-content: center; }
}
@media (prefers-contrast: more) { .chip.sosh-out { border-color: var(--ink); } }
/* ── end SO_REP_DIRECT_NOT_ALLOWED_V1 ── */

/* ── SO_REP_OUTSIDE_ASK_FE_V1: office send sheet offers the outside addresses the rep asked for ── */
.so-ask-host:empty { display: none; }
.so-ask { align-items: flex-start; }
.so-ask-h { font-weight: 650; margin-bottom: 4px; }
.so-ask-list { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 4px; max-width: 560px; }
.so-ask-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.so-ask-addr { font-family: var(--mono, ui-monospace, monospace); font-size: 13px; min-width: 0; overflow-wrap: anywhere; }
.so-ask-done { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--good-text, var(--ink-2)); white-space: nowrap; }
.so-ask-done svg { width: 15px; height: 15px; margin: 0; }
.so-ask-list .btn, .so-ask-all { flex: none; min-height: 44px; }
.so-ask-all { margin-top: 6px; }
/* ── end SO_REP_OUTSIDE_ASK_FE_V1 ── */
/* ── SETREQ_GUIDED_V1: Request a set as a short guided flow (r-setreq-guided-flow) ── */
.srq [hidden] { display: none !important; }
.srq-strip { display: grid; gap: 6px; }
.srq-of { display: none; font-size: var(--t-sm); font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.srq-steps .sosh-n svg { width: 12px; height: 12px; }
.srq-st { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srq-card { overflow: visible; }
.srq-qh { display: grid; gap: 4px; }
.srq-qh h2 { margin: 0; font-size: 19px; line-height: 1.2; letter-spacing: -0.01em; outline: none; }
.srq-hint { margin: 0; font-size: 13.5px; max-width: 60ch; }
.srq-seg { display: flex; width: 100%; }
.srq-seg .seg-b { flex: 1 1 0; justify-content: center; min-height: 44px; font-size: 13.5px; }
.srq-pick.on { background: var(--accent-soft); }
.srq-pick .srq-tickmark { visibility: hidden; color: var(--accent-text, var(--accent)); }
.srq-pick.on .srq-tickmark { visibility: visible; }
.srq-pick[aria-pressed="true"] .sosh-ed { color: var(--accent-text, var(--accent)); }
.srq-addr { white-space: pre-line; }
.srq-lh { padding: 10px 12px 4px; margin: 0; border-top: 1px solid var(--line); background: var(--surface-2); }
.sosh-list > .srq-lh:first-child { border-top: 0; }
.srq-add .pill { flex: none; }
.srq-line { cursor: default; }
.srq-line:hover { background: none; }
.srq-step { flex: none; display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line);
  border-radius: 999px; padding: 2px; background: var(--surface); }
.srq-step .btn-icon { min-width: 44px; min-height: 44px; padding: 0; border-radius: 50%; font-size: 18px; line-height: 1;
  display: inline-grid; place-items: center; border: 0; background: var(--surface-2); }
.srq-step .btn-icon:active { transform: scale(0.94); }
.srq-qn { min-width: 28px; text-align: center; font-weight: 650; font-variant-numeric: tabular-nums; }
.srq-xline { box-shadow: none; background: var(--surface-2); }
.srq-qty { max-width: 88px; }
.srq-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.srq-xrow { display: grid; grid-template-columns: minmax(0, 1fr) 96px 44px; gap: 8px; align-items: end; }
.srq-xrow > .btn-icon { min-height: 44px; }
.srq-empty { padding: 14px 12px; }
.srq-what { display: grid; gap: 4px; }
.srq-edit { flex: none; font-size: var(--t-sm); font-weight: 600; color: var(--accent-text, var(--accent)); }
.sosh-row[disabled] { cursor: default; color: var(--ink); opacity: 1; }
.srq-foot { display: flex; align-items: center; gap: 10px; }
.srq-foot > .btn { min-height: 48px; }
.srq-count { flex: none; font-size: var(--t-sm); font-variant-numeric: tabular-nums; }
.srq-done-actions { justify-content: center; gap: 8px; margin-top: 8px; }
.srq-done-actions .btn { min-height: 44px; }
@media (prefers-reduced-motion: no-preference) {
  .srq-card { animation: srq-in 180ms var(--ease-out, ease-out); }
  @keyframes srq-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}
@media (prefers-contrast: more) { .srq-step { border-color: var(--ink-2); } .srq-pick.on { outline: 2px solid var(--ink); outline-offset: -2px; } }
/* Phone: one question per screen, "2 of 4" instead of the labelled strip, the buttons stay in reach. */
@media (max-width: 700px), (max-width: 960px) and (max-height: 520px) {
  .srq-steps .srq-st { display: none; }
  .srq-steps li { justify-content: center; padding-bottom: 4px; }
  .srq-steps .sosh-n { display: none; }
  .srq-steps li.past { border-color: var(--accent); }
  .srq-steps { gap: 4px; }
  .srq-steps li { border-bottom-width: 3px; }
  .srq-of { display: block; }
  .srq-qh h2 { font-size: 20px; }
  .srq-foot { position: sticky; bottom: 0; z-index: 2; margin: 0 -16px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--plane, var(--surface)); border-top: 1px solid var(--line); }
  .srq-foot > .btn:not(.grow) { flex: none; }
  .srq textarea.fld, .srq input.fld, .srq select.fld { font-size: 16px; }
  .srq .sosh-k { width: 86px; }
  .srq-xrow { grid-template-columns: minmax(0, 1fr) 44px; }
  .srq-xsys { grid-column: 1 / -1; }
}
/* ── end SETREQ_GUIDED_V1 ── */

/* FE_ORDERS_COMPACT_V1 (r-fe-orders-compact-rows). JT 2026-11-17: the Orders list should read like a
   real table. desk.js puts the app-wide row density on table.ord-tbl and table.appr-ord as data-density
   ("compact" by default, "comfortable" = the layout before this block; also on <html data-density> for
   lists that adopt it later), a title with the full text on cells an ellipsis can cut, and
   data-ord-fit="1" on the Orders wrap when the table fits its card, so the header can stick. */
.dens-btn svg { flex: none; }
@media (min-width: 721px) {
  table.tbl.ord-tbl[data-density="compact"] th { padding-top: 8px; padding-bottom: 8px; white-space: nowrap; }
  table.tbl.ord-tbl[data-density="compact"] td { padding-top: 8px; padding-bottom: 8px; line-height: 1.35; white-space: nowrap; }
  table.tbl.ord-tbl[data-density="compact"] td:is([data-k="vendor"], [data-k="surgeon"], [data-k="rep"], [data-k="distributor"]) {
    max-width: 170px; overflow: hidden; text-overflow: ellipsis;
  }
  table.tbl.ord-tbl[data-density="compact"] td[data-k="facility"] { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
  table.tbl.ord-tbl[data-density="compact"] td.ord-pick { padding-top: 4px; padding-bottom: 4px; }
  table.tbl.ord-tbl[data-density="compact"] td .btn-sm { min-height: 28px; padding-top: 2px; padding-bottom: 2px; }
  .tbl-wrap[data-ord-fit="1"]:has(> table.ord-tbl) { overflow: visible; }
  .tbl-wrap[data-ord-fit="1"] > table.tbl.ord-tbl thead th { position: sticky; top: 0; z-index: 2; }
}
/* a finger on a tablet: still one line, but rows a thumb can hit */
@media (pointer: coarse) and (min-width: 721px) {
  table.tbl.ord-tbl[data-density="compact"] tbody tr { height: 44px; }
  table.tbl.ord-tbl[data-density="compact"] td { padding-top: 10px; padding-bottom: 10px; }
}
/* phone: a 2-line row with hairlines, not a card.
   line 1: order no / MRN . facility (ellipsis) . total     line 2: date . status . vendor (ellipsis)
   Order type, PO, rep, surgeon, distributor and vendor-commission month stay on the order page and
   on Comfortable rows. The whole row is the target (56px+); the needs-you tape still runs its edge. */
@media (max-width: 720px) {
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"] tbody tr {
    position: relative; align-items: center; column-gap: 10px; row-gap: 2px; min-height: 56px;
    padding: 7px 34px 7px 16px;
  }
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"] td { order: 9; display: none; line-height: 1.3; }
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"] td[data-label]::before { content: none; }
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"] td:is([data-k="key"], [data-k="facility"], [data-k="total"]) {
    display: block; order: 1; font-size: 14px;
  }
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"] td[data-k="key"] { flex: none; max-width: 42%; font-size: 14px; }
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"] td[data-k="facility"] { flex: 1 1 0; color: var(--ink); }
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"] td[data-k="total"] { flex: none; margin-left: auto; }
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"] td:is([data-k="surgery"], [data-k="status"], [data-k="vendor"]) {
    display: block; order: 3; font-size: 12.5px;
  }
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"] td[data-k="surgery"] { order: 3; flex: none; }
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"] td[data-k="status"] { order: 4; flex: none; }
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"] td[data-k="vendor"] { order: 5; flex: 1 1 0; text-align: right; }
  /* a missing value stays hidden rather than printing a dash */
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"] td[data-k]:not([data-k="key"]):has(> .muted:only-child) { display: none; }
  /* Select mode / archive: the checkbox cell sits on the left edge across both lines, 44px wide */
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"] tbody tr:has(> td.ord-pick) { padding-left: 52px; }
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"] td.ord-pick {
    display: grid; place-items: center; position: absolute; left: 4px; top: 0; bottom: 0;
    width: 44px !important; padding: 0; overflow: visible;
  }
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"] tbody tr.clickable::after { top: 50%; margin-top: -4px; right: 16px; }
}
/* dashboard: Orders for approval / Your orders waiting for approval. The card sits half-width beside Set
   requests on a desk, so the layout follows the CARD's width (container query), not the screen's:
   a wide card gets one line per row; a narrow card (half-width desk, phone) gets 2-line rows:
   line 1 order . facility . total, line 2 date . waiting . rep (office); Approve (office) at the right edge.
   A rep's row is the tap target (its Open link is the row itself) and gets a chevron. */
.appr-dens-btn { min-width: 32px; justify-content: center; padding-left: 6px; padding-right: 6px; }
@media (pointer: coarse), (max-width: 720px) { .appr-dens-btn { min-width: 44px; min-height: 44px; } }
.appr-grid > .card[data-appr="orders"] { container: apprord / inline-size; }
@container apprord (min-width: 641px) {
  .appr-grid table.tbl.appr-ord[data-density="compact"] td { white-space: nowrap; padding-top: 6px; padding-bottom: 6px; }
  /* the name columns share what is left: max-width 0 + a % width shrinks them to an ellipsis */
  .appr-grid table.tbl.appr-ord[data-density="compact"] td:is([data-k="facility"], [data-k="rep"]) { max-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .appr-grid table.tbl.appr-ord[data-density="compact"] td[data-k="facility"] { width: 60%; }
  .appr-grid table.tbl.appr-ord[data-density="compact"] td[data-k="rep"] { width: 40%; }
}
@container apprord (max-width: 640px) {
  .appr-grid table.tbl.appr-ord[data-density="compact"],
  .appr-grid table.tbl.appr-ord[data-density="compact"] tbody { display: block; width: 100%; }
  .appr-grid table.tbl.appr-ord[data-density="compact"] thead { display: none; }
  .appr-grid table.tbl.appr-ord[data-density="compact"] tbody tr {
    position: relative; display: flex; flex-wrap: wrap; align-items: center; column-gap: 10px; row-gap: 2px;
    min-height: 56px; padding: 7px 26px 7px 0; border-bottom: 1px solid var(--line);
  }
  .appr-grid table.tbl.appr-ord[data-density="compact"] tbody tr:last-child { border-bottom: 0; }
  .appr-grid table.tbl.appr-ord[data-density="compact"] tbody tr::before { content: ""; order: 2; flex: 0 0 100%; height: 0; }
  .appr-grid table.tbl.appr-ord[data-density="compact"] tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  .appr-grid table.tbl.appr-ord[data-density="compact"] tbody tr:focus-visible td { outline: 0; }
  .appr-grid table.tbl.appr-ord[data-density="compact"] td {
    display: block; order: 3; flex: none; min-width: 0; min-height: 0; max-width: none; padding: 0; border: 0;
    font-size: 12.5px; line-height: 1.3; color: var(--ink-2); text-align: left;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .appr-grid table.tbl.appr-ord[data-density="compact"] td[data-label]::before { content: none; }
  .appr-grid table.tbl.appr-ord[data-density="compact"] td:is([data-k="key"], [data-k="facility"], [data-k="total"]) {
    order: 1; font-size: 14px; color: var(--ink);
  }
  .appr-grid table.tbl.appr-ord[data-density="compact"] td[data-k="facility"] { flex: 1 1 0; }
  .appr-grid table.tbl.appr-ord[data-density="compact"] td[data-k="total"] { margin-left: auto; font-weight: 650; }
  .appr-grid table.tbl.appr-ord[data-density="compact"] td[data-k="age"] { order: 4; }
  .appr-grid table.tbl.appr-ord[data-density="compact"] td[data-k="age"]::before { content: "waiting "; }
  .appr-grid table.tbl.appr-ord[data-density="compact"] td[data-k="rep"] { order: 5; flex: 1 1 0; }
  /* Approve sits at the right edge across both lines, so it never adds a third */
  .appr-grid table.tbl.appr-ord[data-density="compact"] td[data-k="act"] {
    position: absolute; right: 0; top: 50%; transform: translateY(-50%); overflow: visible;
  }
  .appr-grid table.tbl.appr-ord[data-density="compact"] td[data-k="act"]:not(:has(.btn-pri)) { display: none; }
  .appr-grid table.tbl.appr-ord[data-density="compact"] td[data-k="act"] .btn { min-height: 36px; }
  .appr-grid table.tbl.appr-ord[data-density="compact"] tbody tr:has(.btn-pri) { padding-right: 96px; }
  .appr-grid table.tbl.appr-ord[data-density="compact"] tbody tr:not(:has(.btn-pri))::after {
    content: ""; position: absolute; right: 6px; top: 50%; margin-top: -4px; width: 7px; height: 7px;
    border: solid var(--ink-3); border-width: 0 2px 2px 0; transform: rotate(-45deg);
  }
  .appr-grid table.tbl.appr-ord[data-density="compact"] tbody tr:active { background: var(--surface-2); }
}
/* a finger: 44px Approve, rows a thumb can hit */
@media (pointer: coarse), (max-width: 720px) {
  .appr-grid table.tbl.appr-ord[data-density="compact"] td[data-k="act"] .btn { min-height: 44px; }
}
@container apprord (min-width: 641px) {
  @media (pointer: coarse) { .appr-grid table.tbl.appr-ord[data-density="compact"] tbody tr { height: 44px; } }
}
/* ── end FE_ORDERS_COMPACT_V1 ── */
/* ── FE_SR_ONLY_V1: one global visually-hidden rule ──
   Screens use h("div", { class: "sr-only", role: "status" }) for live regions ("4 trays shown",
   "Login added for …"). Until now .sr-only existed only under .dt-tab, so those messages
   printed as visible text under the page. Standard pattern: hidden on screen, still read
   by VoiceOver / TalkBack / NVDA. A focusable element with .sr-only shows itself on focus
   (skip links). */
.sr-only:not(:focus):not(:focus-within) {
  position: absolute !important; width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important; overflow: hidden !important;
  clip: rect(0 0 0 0) !important; clip-path: inset(50%) !important;
  white-space: nowrap !important; border: 0 !important;
}
/* ── end FE_SR_ONLY_V1 ── */

/* FE_ORDERS_PHONE_FIELDS_V1 (r-fe-orders-phone-more-fields). JT 2026-11-18: the compact phone row also
   shows the facility, the surgeon and the distributor or rep, still narrow (about 66 px):
     line 1  status dot . MRN / order no ........ total
     line 2  facility . surgeon                         (each an ellipsis, full name in the title)
     line 3  date . distributor or rep ......... vendor
   desk.js adds two phone-only cells (td.ord-ph, data-k ph2 / ph3) to Compact rows and leaves off the
   field a grouped list's header already names (table data-grp). Desk + Comfortable: unchanged. */
table.tbl.ord-tbl td.ord-ph { display: none; }
@media (max-width: 720px) {
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"] tbody tr { row-gap: 1px; padding-top: 6px; padding-bottom: 6px; }
  /* the column cells now live on lines 2 and 3 */
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"] td:is([data-k="facility"], [data-k="surgery"], [data-k="vendor"]) { display: none; }
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"] td[data-k="key"] { flex: 1 1 0; max-width: none; line-height: 1.3; }
  /* status: the coloured dot leads line 1; its label stays for screen readers (font-size 0 is still read) */
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"] td[data-k="status"] {
    display: flex; align-items: center; justify-content: flex-start; gap: 6px; order: 0; flex: none; max-width: none; overflow: visible; font-size: 0;
  }
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"] td[data-k="status"] > .pill:first-child {
    font-size: 0; gap: 0; padding: 0; min-height: 0; background: transparent;
  }
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"] td[data-k="status"] > .pill:first-child::before { width: 9px; height: 9px; }
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"] td[data-k="status"] > :not(.pill:first-child) { font-size: 12px; }
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"][data-grp="status"] td[data-k="status"] > .pill:first-child { display: none; }
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"][data-grp="status"] td[data-k="status"]:not(:has(> :not(.pill:first-child))) { display: none; }
  /* lines 2 and 3: each a full-width flex line of short names */
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"] td.ord-ph {
    display: flex; align-items: baseline; justify-content: flex-start; gap: 0; order: 3; flex: 0 0 100%; min-width: 0; max-width: none;
    font-size: 13px; line-height: 1.25; color: var(--ink-2); overflow: hidden;
  }
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"] td.ord-ph[data-k="ph3"] { order: 5; font-size: 12.5px; }
  table.tbl.ord-tbl td.ord-ph > span { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  table.tbl.ord-tbl td.ord-ph > span + span::before { content: "\00b7"; margin: 0 6px; color: var(--ink-3, var(--ink-2)); }
  table.tbl.ord-tbl td.ord-ph > .ph-fac { color: var(--ink); }
  table.tbl.ord-tbl td.ord-ph > .ph-date { flex: none; font-variant-numeric: tabular-nums; }
  table.tbl.ord-tbl td.ord-ph > .ph-vend { flex: 0 1 auto; margin-left: auto; padding-left: 10px; text-align: right; }
  table.tbl.ord-tbl td.ord-ph > .ph-vend::before { content: none; }
  /* Select mode on a row with the needs-you tape: the checkbox cell stays pinned to the left edge
     (the tape's td:first-child { position: static } would otherwise drop it below line 3) */
  table.tbl.ord-tbl[data-cards="on"][data-density="compact"] tbody tr.needs-you > td.ord-pick:first-child {
    position: absolute; left: 0; width: 48px !important;
  }
}
/* ── end FE_ORDERS_PHONE_FIELDS_V1 ── */

/* FE_RECENT_ITEMS_V1 (r-fe-search-recent-activity): the search box's Recent list (palette.js).
   Each row leads with the record's type in words, as QuickBooks does; Clear sits in the header. */
.pal-type { font-weight: 650; color: var(--ink); }
.pal-row.on .pal-type { color: inherit; }
.pal-group-rec { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 4px; padding-bottom: 0; }
.pal-clear {
  font: inherit; font-size: 12.5px; font-weight: 600; letter-spacing: 0; text-transform: none;
  color: var(--accent-text, var(--accent)); background: none; border: 0; border-radius: 8px;
  min-height: 32px; padding: 0 10px; margin-right: -6px; cursor: pointer;
}
.pal-clear:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.pal-clear:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (pointer: coarse), (max-width: 620px) {
  .pal-row { min-height: 44px; }
  .pal-clear { min-height: 44px; min-width: 44px; }
}
/* ── end FE_RECENT_ITEMS_V1 ── */

/* FE_ORDERS_GROUP_BANDS_V1 (r-fe-orders-group-bands). JT 2026-11-18: a grouped Orders list draws each
   group heading as a coloured band across the full width, the group name on the left and
   "12 orders · $48,250.00" on the right. Six soft tints from the categorical palette (--s1 .. --s7),
   cycling by position (data-band 0-5), with the full colour as a 4 px left edge; text stays --ink /
   --ink-2 on the tint (>= 4.5:1 light and dark). The band pins to the top of the list while its
   group scrolls (sticky inside its own <details>, so the next band takes over), under the desktop
   tab strip (desk.js sets --ord-band-top on the list from .dt-strip's top + height). The <summary> folds the group; a chevron shows which way. */
.ord-grp { --band: var(--s1); }
.ord-grp:has(> .ord-band[data-band="1"]) { --band: var(--s3); }
.ord-grp:has(> .ord-band[data-band="2"]) { --band: var(--s7); }
.ord-grp:has(> .ord-band[data-band="3"]) { --band: var(--s2); }
.ord-grp:has(> .ord-band[data-band="4"]) { --band: var(--s5); }
.ord-grp:has(> .ord-band[data-band="5"]) { --band: var(--s4); }
.ord-grp > summary.ord-band {
  position: sticky; top: var(--ord-band-top, 0px); z-index: 4;
  display: flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 8px 16px 8px 12px;
  list-style: none; cursor: pointer; user-select: none;
  background: var(--surface-2);
  background: color-mix(in srgb, var(--band) 12%, var(--surface));
  border-left: 4px solid var(--band);
  border-top: 1px solid color-mix(in srgb, var(--band) 28%, var(--line));
  border-bottom: 1px solid color-mix(in srgb, var(--band) 28%, var(--line));
  color: var(--ink); font-size: 15px; font-weight: 650; line-height: 1.25;
  transition: background-color .16s ease;
}
.ord-grp + .ord-grp { margin-top: 10px; }
.ord-grp > summary.ord-band::-webkit-details-marker { display: none; }
.ord-grp > summary.ord-band::marker { content: ""; }
.ord-grp > summary.ord-band:hover { background: color-mix(in srgb, var(--band) 17%, var(--surface)); }
.ord-grp > summary.ord-band:active { background: color-mix(in srgb, var(--band) 22%, var(--surface)); }
.ord-grp > summary.ord-band:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ord-band .ord-chev {
  flex: none; width: 20px; height: 20px; display: grid; place-items: center;
}
.ord-band .ord-chev::before {
  content: ""; width: 7px; height: 7px;
  border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2);
  transform: translateY(-2px) rotate(45deg); transition: transform .2s cubic-bezier(.2, .8, .2, 1);
}
.ord-grp:not([open]) > .ord-band .ord-chev::before { transform: rotate(-45deg); }
.ord-band .ord-band-name {
  flex: 1 1 auto; min-width: 0; display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ord-band .ord-band-name > * { vertical-align: middle; margin-left: 6px; }
.ord-band .ord-band-meta { flex: none; display: flex; align-items: baseline; gap: 0; white-space: nowrap; }
.ord-band .ord-band-n { color: var(--ink-2); font-weight: 500; font-size: 14px; }
.ord-band .ord-band-sum { margin-left: 0; }
.ord-band .ord-band-n + .ord-band-sum::before { content: "\00b7"; margin: 0 8px; color: var(--ink-2); font-weight: 500; }
.ord-band .ord-band-sum.none { color: var(--ink-2); font-weight: 500; font-size: 14px; }
@media (min-width: 721px) {
  /* the fitted table head (FE_ORDERS_COMPACT_V1) pins under its band, not behind it */
  .ord-grp .tbl-wrap[data-ord-fit="1"] > table.tbl.ord-tbl thead th { top: calc(var(--ord-band-top, 0px) + 48px); }
}
@media (max-width: 720px) {
  .ord-grp > summary.ord-band { min-height: 48px; padding: 8px 14px 8px 10px; font-size: 15px; gap: 8px; }
  /* the name gets the width: count over total, right-aligned, two short lines */
  .ord-band .ord-band-meta { flex-direction: column; align-items: flex-end; line-height: 1.2; }
  .ord-band .ord-band-n + .ord-band-sum::before { content: none; }
  .ord-band .ord-band-n, .ord-band .ord-band-sum.none { font-size: 12.5px; }
  .ord-grp + .ord-grp { margin-top: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .ord-band .ord-chev::before, .ord-grp > summary.ord-band { transition: none; }
}
@media (prefers-contrast: more) {
  .ord-grp > summary.ord-band { background: var(--surface); border-top-color: var(--ink-2); border-bottom-color: var(--ink-2); }
}
/* ── end FE_ORDERS_GROUP_BANDS_V1 ── */

/* FE_AUDIT_WRAP_V1 (b-fe-order-audit-trail-overflow, JT 2026-11-18). The Audit trail card on an
   order (and #/audit) let long values run out of the card on a phone: the "What changed" cell was
   a right-aligned flex row of every field side by side. Now each field is a block (name, old
   value struck through, then -> new value), every value wraps anywhere and is clamped to 3 lines
   with "Show more" (desk.js auditClamp). On a phone a row reads: when ...... action pill, who underneath,
   then the changes full width. Desktop keeps its table; values stack inside the cell. */
.au-diff { min-width: 0; overflow-wrap: anywhere; }
.au-chg + .au-chg { margin-top: 8px; }
.au-chg .fld { display: block; }
.au-v {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3;
  overflow: hidden; overflow-wrap: anywhere; word-break: break-word;
}
.au-v.open { display: block; -webkit-line-clamp: unset; line-clamp: none; overflow: visible; }
.diff ins.au-v::before { content: "\2192\00a0"; content: "\2192\00a0" / ""; color: var(--ink-3); }
.au-more {
  display: inline-flex; align-items: center; min-height: 44px; margin: -10px 0 -10px; padding: 0 4px 0 0;
  border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--accent); cursor: pointer;
}
.au-more:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
@media (min-width: 721px) { table.au-tbl td { vertical-align: top; } table.au-tbl td.au-who { overflow-wrap: anywhere; } }

@media (max-width: 720px) {
  /* same width as the base table-to-card rules; a card is: when ...... action pill,
     who underneath (an e-mail address wraps, never cut), then the changes full width */
  table.tbl.au-tbl[data-cards="on"] tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "when act" "who who" "diff diff";
    align-items: center; column-gap: 10px; row-gap: 2px;
  }
  table.tbl.au-tbl[data-cards="on"] td {
    display: block; min-width: 0; min-height: 0; padding: 0; text-align: left; font-size: 13.5px;
  }
  table.tbl.au-tbl[data-cards="on"] td[data-label]::before { content: none; }
  table.tbl.au-tbl[data-cards="on"] td.au-when { grid-area: when; padding: 0; font-size: 14px; font-weight: 650; }
  table.tbl.au-tbl[data-cards="on"] td.au-act { grid-area: act; }
  table.tbl.au-tbl[data-cards="on"] td.au-who { grid-area: who; font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; line-height: 1.35; }
  table.tbl.au-tbl[data-cards="on"] td.au-diff { grid-area: diff; margin-top: 8px; line-height: 1.45; }
}
/* end FE_AUDIT_WRAP_V1 */

/* FE_SO_SUBJECT_LOCKED_V1 (r-fe-so-subject-locked): the sales order's subject, read-only */
.so-subj-locked .sosh-subj { align-items: flex-start; }
.so-subj-locked .sosh-subj svg { flex: none; width: 16px; height: 16px; margin-top: 2px; color: var(--ink-3); }
.so-subj-locked .hint { margin-top: 6px; }
/* end FE_SO_SUBJECT_LOCKED_V1 */

/* FE_ORDER_MONEY_V1 (r-fe-order-money-panel-polish, JT 2026-11-20): the order page Money card.
   Left, the sale read like a ledger: Order total leads, a rule above Gross profit (cost taken off the
   total), commission under it. Right, the payments in the order the money moves. One label style
   (--ink-2, 4.5:1+ both themes), right-aligned tabular numbers, a quiet dash when empty.
   The form sits behind Edit. Phone: one column, nothing wraps under its label. */
.om-card .card-h .btn svg { width: 15px; height: 15px; }
.om-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 32px; }
.om-paid { border-left: 1px solid var(--line); padding-left: 32px; }
.om-hero { padding-bottom: 12px; }
.om-hero-k, .om-k, .om-step-k { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.om-hero-v { font-size: 30px; line-height: 1.15; font-weight: 650; letter-spacing: -.015em; color: var(--ink); margin-top: 2px; }
.om-ledger { margin: 0; }
.om-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  min-height: 40px; padding: 9px 0; border-top: 1px solid var(--line); }
.om-row dd { margin: 0; }
.om-v { font-size: 14.5px; font-weight: 550; color: var(--ink); text-align: right; white-space: nowrap; }
.om-row.om-result { border-top: 1.5px solid var(--ink-2); }
.om-row.om-result .om-k { color: var(--ink); font-weight: 600; }
.om-row.om-result .om-v { font-weight: 650; }
.om-sub { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink-2); margin-top: 1px; }
.om-h { font-size: 13px; font-weight: 600; color: var(--ink); margin: 0 0 4px; padding: 0; }
.om-steps { list-style: none; margin: 0; padding: 0; position: relative; }
.om-step { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 8px 0; position: relative; }
/* the thread between the markers: the money moving from one to the next */
.om-step + .om-step::before { content: ""; position: absolute; left: 8.5px; top: -12px; height: 24px; width: 1.5px;
  background: var(--line-2); }
.om-step[data-done="1"] + .om-step[data-done="1"]::before { background: var(--good-ink); }
.om-dot { flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center;
  box-shadow: inset 0 0 0 1.5px var(--line-2); background: var(--surface); position: relative; z-index: 1; }
.om-dot svg { width: 12px; height: 12px; stroke-width: 3; color: var(--surface); }
.om-step[data-done="1"] .om-dot { background: var(--good-ink); box-shadow: none; }
.om-step-k { flex: 1 1 auto; min-width: 0; }
.om-step[data-done="1"] .om-step-k { color: var(--ink); }
.om-step-v { flex: none; font-size: 14.5px; font-weight: 550; color: var(--ink); text-align: right; white-space: nowrap; }
.om-step[data-done="0"] .om-step-v { color: var(--ink-2); font-weight: 500; }
.om-edit .om-form { max-width: 920px; }
.om-edit { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.om-fs { border: 0; margin: 0; padding: 0; min-width: 0; }
.om-fs + .om-fs { margin-top: 6px; }
.om-fs > .om-h { margin-bottom: 8px; }
.om-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
@media (max-width: 720px) {
  .om-grid { grid-template-columns: minmax(0, 1fr); }
  .om-paid { border-left: 0; padding-left: 0; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
  .om-hero-v { font-size: 28px; }
  .om-row, .om-step { min-height: 44px; }
  .om-f2 { grid-template-columns: 1fr 1fr; }   /* cost + %, month + year stay side by side */
  .om-actions .btn { flex: 1 1 0; min-height: 44px; justify-content: center; }
  .om-card .card-h .btn { min-height: 44px; min-width: 64px; justify-content: center; }
}
@media (prefers-contrast: more) {
  .om-hero-k, .om-k, .om-step-k { color: var(--ink); }
  .om-dot { box-shadow: inset 0 0 0 1.5px var(--ink-2); }
}
@media (forced-colors: active) {
  .om-step[data-done="1"] .om-dot { background: CanvasText; }
  .om-dot svg { color: Canvas; }
  .om-step + .om-step::before { background: CanvasText; }
}
/* ── end FE_ORDER_MONEY_V1 ── */

/* ── ORG_MENU_VIS_P2: Settings > Menus (menus.js) ── */
.mv-page .pagehead .btn { flex: none; }
.mv-ro { display: flex; gap: 8px; align-items: center; margin: 0 0 12px; color: var(--ink-2); font-size: 13.5px; }
.mv-ro svg { width: 16px; height: 16px; flex: none; }
.mv-card { overflow: hidden; }
.mv-h { gap: 10px; }
.mv-pick { display: none; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.mv-pick select { min-height: 44px; font-size: 16px; }
.mv-scroll { overflow-x: auto; overscroll-behavior-x: contain; }
.mv-grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.mv-grid th, .mv-grid td { border-bottom: 1px solid var(--line); padding: 0; text-align: center; vertical-align: middle; }
.mv-grid thead th { background: var(--surface); padding: 10px 6px 8px;
  font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; border-bottom: 1px solid var(--line-2, var(--line)); }
.mv-grid thead th.mv-l { text-align: left; padding-left: 18px; }
.mv-grid thead th span { display: block; }
.mv-n { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 450; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.mv-n.mv-n-on { color: var(--accent-text, var(--accent)); font-weight: 600; }
.mv-grid th.mv-l { text-align: left; font-weight: 450; color: var(--ink); padding: 0 12px 0 18px; min-width: 200px; }
.mv-grid tr.mv-item th.mv-l span { display: block; padding-left: 14px; border-left: 2px solid var(--line); line-height: 1.3; }
.mv-grid tr.mv-grp th.mv-l { font-weight: 650; }
.mv-grid tr.mv-grp > * { background: var(--surface-2, transparent); }
.mv-grid tr.mv-cap th { text-align: left; padding: 14px 18px 6px; font-size: 12.5px; font-weight: 650; color: var(--ink-2); background: var(--surface); }
.mv-grid tbody.mv-sec:last-child tr:last-child > * { border-bottom: 0; }
.mv-c { width: 84px; min-width: 72px; }
.mv-hit { display: inline-flex; align-items: center; justify-content: center; width: 52px; min-height: 44px; cursor: pointer; }
.mv-c.mv-under .mv-hit { cursor: default; }
/* The switch: a track and a knob, drawn on the checkbox itself so it stays a native control. */
.mv-sw { appearance: none; -webkit-appearance: none; margin: 0; flex: none; position: relative;
  width: 38px; height: 22px; border-radius: 11px; background: var(--ink-3); cursor: pointer; transition: background-color .18s ease; }
.mv-sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.28); transition: transform .2s cubic-bezier(.3,.7,.4,1); }
.mv-sw:checked { background: var(--accent); box-shadow: none; }
.mv-sw:checked::after { transform: translateX(16px); }
.mv-sw:focus-visible { outline: 2px solid var(--ring, var(--accent)); outline-offset: 2px; }
.mv-sw:disabled { cursor: default; opacity: .45; }
.mv-c.mv-under .mv-sw { opacity: .3; }
.mv-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 18px 14px; border-top: 1px solid var(--line);
  color: var(--ink-2); font-size: 13px; line-height: 1.45; }
.mv-note svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.mv-note p { margin: 0; max-width: 72ch; }
.mv-prev { display: grid; gap: 10px; }
.mv-prev-why { margin: 0; font-size: 13px; }
.mv-prev-tabs, .mv-prev-g li { display: grid; gap: 2px; font-size: 14px; }
.mv-prev-tabs b, .mv-prev-g b { font-size: 12.5px; font-weight: 650; color: var(--ink-2); }
.mv-prev-g { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.modal .mv-pick { display: flex; }
@media (prefers-reduced-motion: reduce) { .mv-sw, .mv-sw::after { transition: none; } }
@media (prefers-contrast: more) { .mv-sw { box-shadow: inset 0 0 0 2px var(--ink); } .mv-n, .mv-note { color: var(--ink); } }
@media (forced-colors: active) {
  .mv-sw { appearance: auto; -webkit-appearance: auto; width: 22px; height: 22px; background: none; box-shadow: none; }
  .mv-sw::after { display: none; }
}
/* Phone: one role at a time. Same table; the Role picker in the card header chooses the column. */
@media (max-width: 720px) {
  .mv-pick { display: flex; }
  .mv-h { flex-wrap: wrap; }
  .mv-grid .mv-c { display: none; }
  .mv-grid[data-col="manager"] .mv-c[data-a="manager"], .mv-grid[data-col="billing"] .mv-c[data-a="billing"],
  .mv-grid[data-col="accounting"] .mv-c[data-a="accounting"], .mv-grid[data-col="inventory"] .mv-c[data-a="inventory"],
  .mv-grid[data-col="inventory_hybrid"] .mv-c[data-a="inventory_hybrid"], .mv-grid[data-col="rep"] .mv-c[data-a="rep"],
  .mv-grid[data-col="distributor"] .mv-c[data-a="distributor"], .mv-grid[data-col="auditor"] .mv-c[data-a="auditor"] { display: table-cell; }
  .mv-grid th.mv-l { min-width: 0; padding-left: 16px; }
  .mv-grid tr.mv-r > * { height: 48px; }
  .mv-c { width: 76px; }
}
/* ── end ORG_MENU_VIS_P2 ── */
