/* ==========================================================================
   GearPilot — design system

   Colours, type and the rules below come from the production brand pack
   (design/brand/pack, guidelines PDF in 06_Brand_Guidelines). The pack is the
   source of truth: the marks are used as supplied and never redrawn.

   The pack is deliberately monochromatic — navy, cyan, two blues, silver. That
   buys coherence and costs the one thing the old amber system had for free:
   two unrelated hues to mean two different things. So the work is done by
   LIGHTNESS instead. Signal Blue is the accent, the "this one, out of all of
   them" colour: the found item, the next case, the focused control. Navy is
   structure — links' resting state is not navy, because navy is body text and
   a link that matches the paragraph around it is not a link.

   Accent is still rationed. If everything is highlighted, nothing is found.

   Every value below is either a pack colour or a tint of one, and every
   foreground/background pair a person has to read was checked to 4.5:1. Where
   a pack colour could not carry text at that ratio — Forward Cyan is 1.7:1 on
   silver — it is used as a surface with navy on top, never as text.

   Status bands are the exception and stay outside the brand palette, for the
   reason the old system gave: a band covering a third of the wall spends a
   brand colour on something that is not the brand.
   ========================================================================== */

:root {
  /* Pack palette — design/brand/pack/07_Source/gearpilot-design-tokens.json */
  --navy:      #071525;   /* Pilot Navy   */
  --navy-2:    #0B223A;
  --cyan:      #00C8F5;   /* Forward Cyan */
  --blue:      #087EFF;   /* Action Blue  */
  --blue-deep: #135CE6;   /* Signal Blue  */
  --silver:    #E8EDF2;
  --steel:     #9AA6B2;
  --graphite:  #202A35;

  /* Tints of the above, for surfaces and washes the pack does not enumerate. */
  --silver-sunken: #D9E1EA;
  --silver-line:   #CBD6E0;
  --steel-deep:    #5A6875;   /* dim text: Steel is 2.1:1 on silver, this is 4.9 */
  --blue-wash:     #E6EEFE;
  --navy-wash:     #DCE3EB;

  --red:      #A6402E;
  --red-wash: #F8E9E6;

  /* Status frames only (see Display/StatusBands.cs). Deliberately NOT brand
     colours, and deliberately five different HUES: nobody distinguishes five
     shades of the same blue at thumbnail size. */
  --teal:  #0E7C86;
  --ochre: #B4761F;
  --plum:  #6E4A7E;

  /* Semantic — remapped wholesale for dark mode below */
  --bg:            var(--silver);
  --bg-raised:     #FFFFFF;
  --bg-sunken:     var(--silver-sunken);
  --text:          var(--navy);
  --text-dim:      var(--steel-deep);
  --line:          var(--silver-line);
  --line-strong:   #B3C1CE;
  --accent:        var(--blue-deep);
  --accent-bright: var(--blue);
  --accent-wash:   var(--blue-wash);
  --on-accent:     #FFFFFF;      /* text ON an accent fill: 5.7:1 */
  --on-danger:     #FFFFFF;      /* text ON a danger fill: 5.1:1 */
  --brand:         var(--navy);
  --brand-wash:    var(--navy-wash);
  --danger:        var(--red);
  --danger-wash:   var(--red-wash);
  --shelf:         var(--steel-deep);
  --going:         var(--plum);
  --away:          var(--teal);
  --blocked:       var(--ochre);

  --shadow: 0 1px 2px rgb(7 21 37 / 0.06), 0 4px 16px rgb(7 21 37 / 0.06);
  --shadow-lift: 0 2px 4px rgb(7 21 37 / 0.09), 0 12px 32px rgb(7 21 37 / 0.12);

  --radius: 10px;
  --radius-lg: 16px;
  --tap: 48px;            /* one-handed, standing up, possibly gloved */

  /* Avenir Next per the guidelines, then the platform grotesques, then the
     pack's own fallback. Nothing is fetched: a webfont on the critical path is
     a blank header on a bad connection in a loading bay. */
  --sans: "Avenir Next", Avenir, ui-sans-serif, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, monospace;
}

/* Dark is a first-class case, not an afterthought: the app gets used in a
   spare room at night. Surfaces lift towards navy rather than towards grey,
   because navy is the pack's own ground rather than a darkened white.

   Driven by [data-theme], not a media query: a tiny pre-paint script resolves
   the OS preference and any saved override into data-theme="light|dark" on
   <html>, and everything themed hangs off that one attribute. That is what
   lets the nav toggle actually win an argument with the OS. */
:root[data-theme="dark"] {
    /* Dark is not a dimmed light theme — it is the brand's own ground. Pilot
       Navy IS the pack's background colour, so this is the truer of the two. */
    --bg:            var(--navy);
    --bg-raised:     var(--navy-2);
    --bg-sunken:     #05080C;
    --text:          var(--silver);
    --text-dim:      var(--steel);
    --line:          #1B3350;
    --line-strong:   #2C4A6B;

    /* Cyan finally gets to be the accent. It is unreadable as text on silver
       (1.7:1) but sings on navy at 9.3:1, and carries navy text on top at the
       same ratio — so unlike the light theme, an accent fill here keeps dark
       text rather than white. */
    --accent:        var(--cyan);
    --accent-bright: #5FDDFA;
    --accent-wash:   #06263A;
    --on-accent:     var(--navy);
    /* Same reasoning as --on-accent: the dark danger is a LIGHT red,
       so white on it is about 2:1 and unreadable. Navy is 8:1. */
    --on-danger:     var(--navy);
    --brand:         var(--blue);
    --brand-wash:    #0A2036;
    --danger:        #E88C7B;
    --danger-wash:   #2E1512;

    /* Lifted clear of the near-black ground — the light values vanish on it,
       and a frame nobody can see is not a frame. */
    --shelf:         var(--steel);
    --going:         #B693C8;
    --away:          #3FB6C2;
    --blocked:       #E0A94E;

    --shadow: 0 1px 2px rgb(0 0 0 / 0.5), 0 4px 16px rgb(0 0 0 / 0.4);
    --shadow-lift: 0 2px 4px rgb(0 0 0 / 0.6), 0 12px 32px rgb(0 0 0 / 0.5);
}

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

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

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  /* The mark, scattered and very faint, the way the old tag texture was —
     built by tools/pattern.py from the pack's single-colour masters. It should
     read as paper texture, not wallpaper: the sign-in lockup sits directly on
     it, and the guidelines are clear about not putting the logo on a busy
     area. That is what the 5% and the 520px tile are for — at this weight it
     is a surface, not a competing image. */
  background-image: url("brand/pattern-light.svg");
  background-size: 520px;
  -webkit-font-smoothing: antialiased;

  /* Sticky footer. The page is a column at least as tall as the viewport and
     the footer takes up the slack, so a short screen — sign-in, an empty
     search, a one-item pick list — puts the credit line on the bottom edge
     rather than floating it halfway up with dead space beneath.
     100vh first as a fallback; 100dvh then wins where supported, which is what
     keeps it honest on a phone with a retracting address bar. */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

:root[data-theme="dark"] body { background-image: url("brand/pattern-dark.svg"); }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 0.5rem; }
h1 { font-size: 1.6rem; font-weight: 680; }
h2 { font-size: 1.15rem; font-weight: 640; }
h3 { font-size: 1rem; font-weight: 640; }
p  { margin: 0 0 1rem; }

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-bright); }

/* --- The reference ------------------------------------------------------
   Four digits and a check digit, read off handwriting under a rail and typed
   back in. Tabular, spaced, and unmissable — it is the single most important
   string in the product. */
.ref {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text);
}

.ref-hero {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.4rem, 12vw, 3.6rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);       /* the found item */
  line-height: 1;
}

/* --- Theme-paired assets -------------------------------------------------
   The brand ships separate light and dark SVGs because recolouring the body is
   forbidden. Both render; the attribute picks one. */
/* `!important` on all three, which is the whole point of them. The rule used
   to be a comment saying "nothing may set display on these elements" — and it
   was broken within the hour by a rule sizing the header logo, at (0,3,1)
   against the utility's (0,1,0). The failure is quiet and easy to miss in
   light mode: the dark logo draws underneath the light one with its white
   half invisible on white, so all you see is a stray cyan "Pilot" below the
   header. A convention that is one careless selector from silently breaking
   should be enforced by the cascade, not by a comment nobody reads twice. */
.theme-dark-only { display: none !important; }
/* `revert`, not `block`: forcing block made the visible variant lay out
   differently from its light-mode twin, so a lockup centred in one theme sat
   left in the other. This hands display back to the browser default, keeping
   both variants identical in everything but artwork. */
:root[data-theme="dark"] .theme-dark-only { display: revert !important; }
:root[data-theme="dark"] .theme-light-only { display: none !important; }

/* Layout still belongs on a wrapper, not on these elements: `!important` stops
   the wrong artwork appearing, it does not make sizing them a good idea. */

/* The toggle itself: sun or moon, matching the surface it sits on. */
button.theme-toggle {
  /* Outlined rather than a bare glyph. On the signed-out pages this sits alone
     in a lot of empty space, and a low-contrast character with no border does
     not read as something you can press — it reads as decoration, or as
     nothing at all. A tap target and a visible edge fix that without making it
     compete with the sign-in button. */
  /* 2.25rem in the nav bar, where its neighbours are compact links and a full
     48px target would make the sticky header a third taller on every screen.
     .bare-chrome below restores the proper tap size, since those pages have
     vertical room to spare. */
  min-height: 2.25rem; min-width: 2.25rem;
  padding: 0.35rem 0.55rem;
  background: transparent; border-color: var(--line); color: var(--text-dim);
  font-size: 1.15rem; line-height: 1;
}
button.theme-toggle:hover { background: var(--bg-sunken); color: var(--text); }
:root[data-theme="dark"] button.theme-toggle { background: transparent; border-color: var(--line); color: var(--text-dim); }
:root[data-theme="dark"] button.theme-toggle:hover { background: var(--bg-sunken); color: var(--text); }
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: inline; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }

/* The signed-out pages have no chrome to hang the toggle on, so it gets a
   strip of its own. Aligned to the same gutter as everything else. */
.bare-chrome {
  display: flex; justify-content: flex-end;
  padding: 0.6rem clamp(0.75rem, 3vw, 1.5rem) 0;
}
.bare-chrome button.theme-toggle { min-height: var(--tap); min-width: var(--tap); }

/* --- Chrome ------------------------------------------------------------- */
.chrome {
  display: flex; flex-direction: column; align-items: stretch;
  /* Full-bleed bar, but its CONTENTS line up with the .content column: the
     first term is the gutter either side of that column once it hits its
     90rem cap, the second is the column's own padding. Without it the brand
     and "sign out" sit on the screen edges while everything below starts
     240px inboard, which reads as two unrelated layouts on a wide monitor. */
  padding-block: 0.6rem;
  padding-inline: calc(max(0px, (100% - 90rem) / 2) + clamp(0.75rem, 3vw, 1.5rem));
  background: var(--bg-raised);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}

.chrome .brand { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; min-width: 0; }
/* No `display` here on purpose. These are flex children of .brand, so they are
   blockified already and setting it gains nothing — but at (0,3,0) it outranks
   the .theme-dark-only utility at (0,1,0), which then cannot hide anything and
   both the light and dark artwork render side by side. */
/* The logo carries its own clear space inside the viewBox, so it needs no
   margin here — and 36px is the floor at which the descriptor line under the
   wordmark stays a crisp rule rather than grey mush. */
/* No `display` on these images. They carry .theme-light-only/.theme-dark-only,
   and any display here lands at (0,3,1) — which outranks the (0,1,0) utility
   that hides the wrong variant, so BOTH render. That is exactly what happened:
   the dark logo drew underneath the light one, its white "Gear" invisible on
   white, leaving a stray cyan "Pilot" hanging below the header. The wrappers
   below own the switching; these only get sized. */
.chrome .brand .brand-logo img { height: 36px; width: auto; }
.chrome .brand .brand-mark { display: none; }
.chrome .brand .brand-mark img { height: 28px; width: auto; }
/* The brand row. flex-wrap on both: the nav holds a variable set of links —
   an administrator carries three more than an Operator — plus the worth
   figure, and `flex: none` let it slide left OVER the brand mark on a narrow
   phone once the set outgrew the row. Nothing may ever overlap; a second
   right-aligned row is the honest fallback, and on the common link set nothing
   changes. */
.chrome-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.chrome .brand { flex: none; }
.chrome-row nav {
  margin-left: auto; display: flex; align-items: center; gap: 0.6rem;
  flex: 0 1 auto; min-width: 0; flex-wrap: wrap; justify-content: flex-end;
}

/* What the room is worth. Quiet on purpose — a standing figure, not an alert,
   sitting beside a brand mark already asking for attention. Tabular numerals so
   it does not reflow every time the total changes. */
.worth {
  display: inline-flex; align-items: baseline; gap: 0.4rem;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.worth strong { font-weight: 640; }
/* A dim inline run beside something louder — the listed price next to the
   worth, a bank reference next to a payment. Unscoped because it was scoped to
   .worth and the second place that wanted it silently rendered as body text. */
.listed { font-size: 0.8rem; color: var(--text-dim); }

/* The nav is already fighting for room on a phone, and the total is the more
   useful half. */
@media (max-width: 46rem) {
  .worth .listed { display: none; }
}

.chrome .who {
  color: var(--text-dim); font-size: 0.85rem;
  max-width: 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chrome-row nav button.link { white-space: nowrap; }

/* On a phone the signature drops to the mark alone — permitted by the
   guidelines where the brand is already established, and a signed-in header
   qualifies — and the name goes too, because "sign out" must not wrap. */
@media (max-width: 30rem) {
  .chrome .brand .brand-logo { display: none; }
  .chrome .brand .brand-mark { display: block; }
  .chrome .who { display: none; }
  /* The text links go too: every one of them is in the Office strip and in
     the go-to palette, and with them the row ran to three lines with "Sign
     out" alone on the last. What is left is the figure, two buttons and the
     way out, which fits on one line beside the mark. */
  .chrome-link { display: none; }
}
/* The row's own links, so the rule above has something to point at. */
.chrome-link { white-space: nowrap; }

/* Which warehouse this is, for somebody in more than one, and the way to
   another. A quiet pill rather than a link, because it is a state as much as
   a destination: it has to be read at a glance before anything is scanned. */
.chrome .current-warehouse {
  display: inline-flex; align-items: baseline; gap: 0.4rem; min-width: 0;
  max-width: 16rem; min-height: 2.25rem; align-self: center;
  padding: 0.35rem 0.7rem; border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg-sunken); color: var(--text); text-decoration: none;
  font-size: 0.85rem; white-space: nowrap;
}
.chrome .current-warehouse:hover { border-color: var(--line-strong); }
.chrome .current-warehouse:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chrome .current-warehouse-label {
  color: var(--text-dim); font-size: 0.7rem; letter-spacing: 0.05em; text-transform: uppercase;
}
.chrome .current-warehouse-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 30rem) {
  /* On a phone the name is the one that matters, so it keeps the room the
     fleet value had, and drops its label to fit. */
  .chrome-row nav:has(.current-warehouse) .worth { display: none; }
  /* One row still: the pill gives way, truncating the name, rather than
     pushing the mark onto a line of its own. */
  .chrome-row:has(.current-warehouse) { flex-wrap: nowrap; }
  .chrome-row:has(.current-warehouse) nav { flex-wrap: nowrap; flex: 1 1 auto; }
  .chrome .current-warehouse { flex: 0 1 auto; max-width: 11rem; padding-inline: 0.6rem; }
  .chrome .current-warehouse-label { display: none; }
}

/* --- The section strip ----------------------------------------------------
   The second row of the header. The dashboard tiles are the first level of
   the menu; this is the second, and it only appears once somebody has picked
   an area. Everything in it is a plain link or a native <details>, so it
   works with script off — nav.js adds the keyboard and the scrolling.

   The icons carry .theme-light-only/.theme-dark-only, so nothing here may set
   `display` on them: a display declaration at (0,3,1) outranks the utility
   and BOTH variants render. Size only. */
.subnav {
  display: flex; align-items: center; gap: 0.5rem;
  margin: 0.5rem 0 -0.6rem;
  padding: 0.3rem 0 0.4rem;
  border-top: 1px solid var(--line);
  min-width: 0;
}
.subnav-icon { width: 1.1rem; height: 1.1rem; flex: none; }

/* The area switcher. A <details> rather than a <select>: a select cannot hold
   an icon, cannot be styled to match, and navigates on change, which on a
   phone means an accidental thumb is a page load. */
.subnav-area { position: relative; flex: none; }
.subnav-area summary {
  list-style: none;
  display: inline-flex; align-items: center; gap: 0.45rem;
  min-height: 2.25rem; padding: 0.25rem 0.6rem 0.25rem 0.55rem;
  border-radius: var(--radius);
  font-weight: 640; cursor: pointer; user-select: none; white-space: nowrap;
}
.subnav-area summary::-webkit-details-marker { display: none; }
.subnav-area summary:hover, .subnav-area[open] summary { background: var(--bg-sunken); }
.subnav-area .caret { color: var(--text-dim); font-size: 0.7rem; transition: transform 0.15s ease; }
.subnav-area[open] .caret { transform: rotate(180deg); }
.subnav-areas {
  position: absolute; left: 0; top: calc(100% + 0.4rem); z-index: 30;
  min-width: 15rem; margin: 0; padding: 0.35rem; list-style: none;
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lift);
  animation: subnav-drop 0.14s ease-out;
}
.subnav-areas a {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.65rem; border-radius: var(--radius);
  color: var(--text); text-decoration: none; font-weight: 560;
}
.subnav-areas a:hover { background: var(--bg-sunken); }
.subnav-areas a.here { background: var(--accent-wash); color: var(--accent); }
.subnav-areas small { margin-left: auto; color: var(--text-dim); font-size: 0.78rem; }
.subnav-areas a.here small { color: inherit; opacity: 0.8; }
/* Home sits apart at the bottom: it is the way OUT of the areas, not one of
   them. Indented past where an icon would be so the words line up. */
.subnav-home { margin-top: 0.35rem; padding-top: 0.35rem; border-top: 1px solid var(--line); }
.subnav-home a { padding-left: calc(0.65rem + 1.1rem + 0.6rem); }
@keyframes subnav-drop {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

/* The screens in the area. One row that scrolls sideways when it must —
   never wraps, because a strip two rows tall is a second header — with the
   scrollbar hidden and the edges faded so the overflow reads as "more this
   way" rather than as a cut. */
.subnav-items {
  display: flex; align-items: center; gap: 0.1rem;
  flex: 1 1 auto; min-width: 0;
  margin: 0; padding: 0 0.25rem; list-style: none;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; scrollbar-width: none;
  --fade-left: 0rem; --fade-right: 0rem;
  mask-image: linear-gradient(90deg, transparent, #000 var(--fade-left), #000 calc(100% - var(--fade-right)), transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--fade-left), #000 calc(100% - var(--fade-right)), transparent);
}
/* Faded, and given an arrow, only at an end with more beyond it (nav.js). */
.more-left > .subnav-items { --fade-left: 2.75rem; }
.more-right > .subnav-items { --fade-right: 2.75rem; }
.subnav-more {
  display: none; flex: none; place-items: center;
  width: 1.9rem; height: 1.9rem; margin: 0; padding: 0;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--bg-raised); color: var(--text-dim);
  font: inherit; font-size: 0.9rem; line-height: 1; cursor: pointer;
}
.subnav-more:hover { color: var(--text); border-color: var(--line-strong); }
/* Pointer devices only: a thumb swipes, a mouse needs something to press. */
@media (hover: hover) and (pointer: fine) {
  .more-left > .subnav-more.left, .more-right > .subnav-more.right { display: inline-grid; }
}
.subnav-items::-webkit-scrollbar { display: none; }
.subnav-items > li { flex: none; scroll-snap-align: center; }
.subnav-items a {
  position: relative;
  display: inline-flex; align-items: center; gap: 0.45rem;
  min-height: 2.25rem; padding: 0.25rem 0.7rem;
  border-radius: var(--radius);
  color: var(--text-dim); text-decoration: none;
  font-weight: 560; font-size: 0.92rem; white-space: nowrap;
  transition: color 0.12s ease, background-color 0.12s ease;
}
.subnav-items a:hover { color: var(--text); background: var(--bg-sunken); }
.subnav-items a.here { color: var(--text); background: var(--accent-wash); }
/* The one that is lit. A bar along the header's bottom edge, which is where
   the eye lands coming up from the page — the wash alone reads as hover. */
.subnav-items a.here::after {
  content: ""; position: absolute; left: 0.7rem; right: 0.7rem; bottom: -0.4rem;
  height: 3px; border-radius: 3px 3px 0 0; background: var(--accent);
}
/* Dim icons on a dim label; the wash lifts both together. */
.subnav-items a .subnav-icon { opacity: 0.7; transition: opacity 0.12s ease; }
.subnav-items a:hover .subnav-icon, .subnav-items a.here .subnav-icon { opacity: 1; }

/* --- Go to ------------------------------------------------------------------
   The button in the brand row, and the palette it opens. */
button.goto-open {
  display: inline-flex; align-items: center; gap: 0.5rem;
  min-height: 2.25rem; padding: 0.3rem 0.5rem 0.3rem 0.55rem;
  background: var(--bg-sunken); border-color: var(--line); color: var(--text-dim);
  font-size: 0.9rem; font-weight: 560; white-space: nowrap;
}
button.goto-open:hover { background: var(--bg-sunken); color: var(--text); border-color: var(--line-strong); }
:root[data-theme="dark"] button.goto-open { background: var(--bg-sunken); border-color: var(--line); color: var(--text-dim); }
:root[data-theme="dark"] button.goto-open:hover { color: var(--text); border-color: var(--line-strong); }
.goto-glyph { width: 1.05rem; height: 1.05rem; flex: none; }
.goto-open kbd, .goto-foot kbd {
  font-family: var(--mono); font-size: 0.7rem; line-height: 1;
  padding: 0.2rem 0.35rem; border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: 5px; color: var(--text-dim); background: var(--bg-raised);
}

dialog.goto {
  width: min(34rem, calc(100vw - 2rem));
  margin: min(10vh, 6rem) auto 0;
  padding: 0;
  background: var(--bg-raised); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
}
dialog.goto[open] { animation: goto-in 0.16s ease-out; }
dialog.goto::backdrop { background: rgb(7 21 37 / 0.45); backdrop-filter: blur(3px); }
@keyframes goto-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
/* Outranks the global field rule, which would give this a border, a radius
   and a background that fight the box it sits in. */
dialog.goto input.goto-input {
  width: 100%; margin: 0;
  padding: 1rem 1.15rem; font-size: 1.05rem;
  background: transparent; color: var(--text);
  border: 0; border-bottom: 1px solid var(--line);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: none;
}
dialog.goto input.goto-input:focus { outline: none; box-shadow: none; }
dialog.goto input.goto-input::-webkit-search-cancel-button { display: none; }
.goto-list {
  list-style: none; margin: 0; padding: 0.4rem;
  max-height: min(60vh, 26rem); overflow-y: auto;
}
.goto-item a {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.55rem 0.75rem; border-radius: var(--radius);
  color: var(--text); text-decoration: none; font-weight: 560;
}
.goto-item small { margin-left: auto; color: var(--text-dim); font-size: 0.78rem; white-space: nowrap; }
.goto-item.recent small::before { content: "recent · "; }
.goto-item.hit a { background: var(--accent-wash); color: var(--accent); }
.goto-item.hit small { color: inherit; opacity: 0.8; }
/* A record rather than a screen: no icon, so the name lines up with the
   screens' names by padding where the icon would be. */
.goto-item.found a span { padding-left: calc(18px + 0.7rem); }
.goto-empty { margin: 0; padding: 1.25rem; text-align: center; color: var(--text-dim); }
.goto-foot {
  display: flex; gap: 1.1rem; margin: 0;
  padding: 0.5rem 0.9rem; border-top: 1px solid var(--line);
  color: var(--text-dim); font-size: 0.75rem;
}
.goto-foot span { display: inline-flex; align-items: center; gap: 0.3rem; }

/* On a phone the button is the glyph alone, and the palette takes the width. */
@media (max-width: 46rem) {
  .goto-open .goto-label, .goto-open kbd { display: none; }
  button.goto-open { padding: 0.3rem 0.5rem; }
  .goto-foot { display: none; }
  dialog.goto { margin-top: 1rem; width: calc(100vw - 1.5rem); }
}

/* --- The tab bar ------------------------------------------------------------
   The phone's menu, along the bottom where a thumb reaches. Replaces the
   strip under the header at phone width; desktop never sees it. Every tab is
   a <details>, every destination a link — see TabBar.razor.

   The icons carry .theme-light-only/.theme-dark-only, so nothing here sets
   `display` on them: size only. */
.tabbar { display: none; }

@media (max-width: 46rem) {
  :root { --tabbar-h: 3.9rem; }

  .tabbar {
    display: flex; align-items: stretch; gap: 0.15rem;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 0.3rem 0.35rem calc(0.3rem + env(safe-area-inset-bottom));
    background: var(--bg-raised);
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 18px rgb(7 21 37 / 0.06);
  }
  /* Room for the bar under the last thing on every page, so the footer and
     the last button on a long form are never hidden behind it. */
  body:has(.tabbar) { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }

  /* The strip goes: the bar does its job, and the header is one row. */
  .chrome .subnav { display: none; }

  .tabbar .tab { flex: 1 1 0; min-width: 0; }
  .tabbar .tab > summary, .tabbar a.tab {
    list-style: none;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 0.2rem; height: 100%; min-height: 3.2rem;
    border-radius: var(--radius);
    color: var(--text-dim); text-decoration: none;
    font-size: 0.72rem; font-weight: 640; letter-spacing: 0.01em;
    cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  }
  .tabbar .tab > summary::-webkit-details-marker { display: none; }
  .tabbar .tab-icon { width: 1.45rem; height: 1.45rem; flex: none; opacity: 0.75; }
  .tabbar .tab-label { white-space: nowrap; }

  /* The area you are in: accent text and a bar along the top edge, which is
     where the eye lands coming down from the page. */
  .tabbar .tab.here > summary { color: var(--accent); position: relative; }
  .tabbar .tab.here > summary::after {
    content: ""; position: absolute; top: -0.3rem; left: 30%; right: 30%;
    height: 3px; border-radius: 0 0 3px 3px; background: var(--accent);
  }
  .tabbar .tab.here .tab-icon, .tabbar .tab[open] .tab-icon { opacity: 1; }
  .tabbar .tab[open] > summary { color: var(--text); background: var(--bg-sunken); }

  /* Scan: the one thing done from every screen, so the largest target. */
  .tabbar a.tab-scan { color: var(--text); }
  .tabbar .tab-scan-disc {
    display: flex; align-items: center; justify-content: center;
    width: 3.1rem; height: 3.1rem; margin-top: -1.15rem;
    border-radius: 50%;
    background: #071525;
    border: 3px solid var(--bg-raised);
    box-shadow: 0 4px 14px rgb(7 21 37 / 0.28);
  }
  :root[data-theme="dark"] .tabbar .tab-scan-disc { border-color: var(--accent-bright); }
  .tabbar .tab-scan-disc .tab-icon { width: 1.6rem; height: 1.6rem; opacity: 1; }
  .tabbar a.tab-scan.here { color: var(--accent); }

  /* The sheet: every screen in the area, nothing behind a sideways scroll. */
  .tabbar .tab-sheet {
    position: fixed; left: 0; right: 0;
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    max-height: min(72vh, 36rem); overflow-y: auto; overscroll-behavior: contain;
    padding: 0.6rem 0.6rem 0.8rem;
    background: var(--bg-raised);
    border-top: 1px solid var(--line);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -10px 30px rgb(7 21 37 / 0.18);
    animation: tab-sheet-up 0.16s ease-out;
  }
  /* Tapping anywhere above the sheet closes it: the backdrop is the open
     tab's own summary, stretched over the page, so a tap on it is a tap on
     the toggle. No script needed. */
  .tabbar .tab[open] > summary::before {
    content: ""; position: fixed; left: 0; right: 0; top: 0;
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    background: rgb(7 21 37 / 0.42);
    animation: tab-fade 0.16s ease-out;
    cursor: default;
  }
  /* The sheet's name and its close button, kept in view while the list scrolls. */
  .tabbar .tab-sheet-head {
    position: sticky; top: -0.6rem; z-index: 1;
    display: flex; align-items: center; justify-content: space-between;
    margin: -0.6rem -0.6rem 0.2rem; padding: 0.45rem 0.35rem 0 0.6rem;
    background: var(--bg-raised);
  }
  .tabbar .tab-sheet-head h2 { margin-bottom: 0.35rem; }
  /* Small to look at, thumb-sized to hit: an 18px cross in a 44px target. */
  /* :root-prefixed, like every button variant: the dark default
     (:root[data-theme="dark"] button) otherwise paints it a silver disc. */
  :root .tabbar button.tab-close {
    display: grid; place-items: center; flex: none;
    width: 2.75rem; height: 2.75rem; margin: 0; padding: 0;
    border: 0; border-radius: 50%; background: transparent; box-shadow: none;
    color: var(--text-dim); cursor: pointer;
  }
  :root .tabbar button.tab-close:hover, :root .tabbar button.tab-close:focus-visible { background: var(--bg-sunken); border: 0; color: var(--text); }
  .tabbar .tab-sheet h2 {
    margin: 0.2rem 0.5rem 0.55rem;
    font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--text-dim);
  }
  .tabbar .tab-sheet ul {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem;
    margin: 0; padding: 0; list-style: none;
  }
  .tabbar .tab-sheet a {
    display: flex; align-items: center; gap: 0.6rem;
    min-height: 3.1rem; padding: 0.5rem 0.65rem;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--bg);
    color: var(--text); text-decoration: none;
    font-size: 0.92rem; font-weight: 600; line-height: 1.2;
  }
  .tabbar .tab-sheet a .tab-icon { width: 1.3rem; height: 1.3rem; opacity: 1; }
  .tabbar .tab-sheet a.here { background: var(--accent-wash); border-color: var(--accent); color: var(--accent); }
}

@keyframes tab-sheet-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
@keyframes tab-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .tabbar .tab-sheet, .tabbar .tab[open] > summary::before { animation: none; }
}

/* A short viewport — a phone on its side, a laptop with the dock up — cannot
   afford two sticky rows. The header scrolls away like anything else. */
@media (max-height: 30rem) {
  .chrome { position: static; }
}

@media (prefers-reduced-motion: reduce) {
  dialog.goto[open], .subnav-areas { animation: none; }
  .subnav-area .caret { transition: none; }
}

.content {
  /* 62rem wasted most of a desktop screen: the tile menu and the photo wall are
     both auto-fit grids, so they were capped at two or three columns by the
     container rather than by anything about the design. Widening it lets them
     flow to four or five, and the grids stay responsive on the way down. */
  max-width: 90rem;
  /* width:100% is load-bearing, not decoration. body is a flex column, and an
     `auto` horizontal margin on a flex item switches OFF the default stretch —
     the element then shrinks to fit its contents instead of filling to
     max-width. Without this the whole app rendered about 611px wide at every
     desktop size, which is what capped the tile menu at two columns. */
  width: 100%;
  margin: 0 auto;
  padding: clamp(1rem, 4vw, 2rem) clamp(0.75rem, 3vw, 1.5rem) 5rem;
}

/* The container is wide so the GRIDS can use it — not the prose. A line of text
   140 characters long, or a text input a metre wide, is worse than the
   whitespace it replaced, so anything read or typed into keeps its own measure.
   Grids, walls and row lists deliberately are not on this list. */
.content > p,
.content > .lede,
.content > form,
.content > .notice { max-width: 46rem; }
/* An empty state stands where a list would be, so it takes the list's width:
   capped like prose it zig-zagged against the full-width lists around it. */
.content > p.empty { max-width: none; }

/* --- Home tiles ---------------------------------------------------------
   Sale capture is one tap from here and never buried in a menu: if capturing
   a sale takes more than ~20 seconds it will not happen consistently, and a
   stale index is worse than no index. */
.tiles { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }

.tile {
  display: flex; flex-direction: column; gap: 0.15rem;
  padding: 1.1rem 1.2rem;
  min-height: 5.5rem;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  text-decoration: none; color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--line-strong); color: var(--text); }
.tile strong { font-size: 1.05rem; font-weight: 640; }
.tile span { color: var(--text-dim); font-size: 0.88rem; }

/* The icon sits on the title's line, so the two travel together: the head is a
   row, the tile itself stays a column. Written as `.tile .tile-head` rather
   than `.tile-head` because `.tile span` above would otherwise dim it — the
   head is a span too, and it must not inherit the subtitle's colour. */
.tile .tile-head {
  display: flex; align-items: center; gap: 0.55rem;
  color: var(--text); font-size: inherit;
}

/* Size only. NO `display` here: these images carry .theme-light-only /
   .theme-dark-only, and a display declaration at this specificity outranks the
   utility that hides the wrong variant, so both would render. That is exactly
   the bug that put a second cyan logo in the header. */
.tile-icon { width: 1.4rem; height: 1.4rem; flex: none; }

.tile.primary { border-color: var(--accent); background: linear-gradient(180deg, var(--accent-wash), var(--bg-raised) 60%); }
.tile.primary strong { color: var(--accent); }

/* --- Forms --------------------------------------------------------------
   Every identifier input opens with a numeric keypad, focused and ready.
   Scanning is secondary. Layout must not assume a camera exists. */
form { margin: 0 0 1.5rem; }

/* Vertical rhythm in a form comes from the LABEL's top margin, so a submit
   button straight after a field got nothing and sat touching it. Space the
   button here rather than on each page — the auth screens had already patched
   it locally, and the admin console and import page had not. Hidden inputs are
   excluded: the little inline forms put one before their button, and spacing
   off an invisible element would push those buttons around. */
form :is(input:not([type="hidden"]), select, textarea) + button,
form :is(input:not([type="hidden"]), select, textarea) + .actions {
  margin-top: 1.1rem;
}

label {
  display: block;
  font-weight: 600; font-size: 0.9rem;
  margin: 1rem 0 0.35rem;
}
label .hint { display: block; font-weight: 400; color: var(--text-dim); font-size: 0.82rem; }

/* A checkbox and its words belong on one line, with the words not sliding back
   under the box when they wrap. */
label:has(input[type="checkbox"]) {
  display: flex; align-items: flex-start; gap: 0.6rem;
  font-weight: 500; line-height: 1.35;
  min-height: var(--tap); padding: 0.5rem 0;
}
label input[type="checkbox"] { width: 1.4rem; height: 1.4rem; flex: none; accent-color: var(--accent); }

/* Every text-like input, stated as an EXCLUSION rather than a list.
   The list version silently missed each new type as it appeared — tel on the
   invite, profile and join screens, url on the listing screens, date at intake
   — and an unmatched input falls back to the browser default: narrow, unpadded
   and below the tap target, sitting next to siblings that are none of those
   things. Excluding is the safe direction: a type nobody thought about is
   styled like a field, which is what it almost always is.

   StylesheetCoverageTests fails if a type is used that neither this rule nor a
   deliberate exception below covers. */
input:not([type="checkbox"], [type="radio"], [type="file"], [type="submit"],
          [type="button"], [type="image"], [type="reset"], [type="hidden"], [type="range"],
          [type="color"]),
select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 0.6rem 0.8rem;
  font: inherit; color: var(--text);
  background: var(--bg-raised);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
}

input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Blazor's FocusOnNavigate moves focus to the h1 on every navigation, which is
   right for a screen reader and wrong for a mouse — it drew a box round the
   heading of every page. The heading stays focusable; it just stops looking
   like something you clicked. */
h1:focus, h1:focus-visible { outline: none; }

/* The keypad field: big, tabular, centred. Typed with a thumb while the other
   hand holds the bag. */
input.keypad {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.9rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-align: center;
  min-height: 4rem;
}

/* A reference typed as a secondary field. Tabular and spaced like the big
   keypad so a number reads the same wherever it is entered, but not sized as
   though it were the point of the screen. */
input.keypad-small {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  max-width: 12rem;
  /* Block, or a narrow field lets whatever follows sit beside it — the submit
     button flowed up alongside the reference box and read as part of it. */
  display: block;
}

/* The retire form is the one destructive thing on the item screen, so it is
   set apart rather than reading as more fields to fill in. */
form.retire {
  border: 1px solid var(--line);
  border-left: 3px solid var(--danger);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.2rem;
  background: var(--bg-raised);
}
form.retire label:first-of-type { margin-top: 0; }

input:disabled, select:disabled {
  background: var(--bg-sunken); color: var(--text-dim); cursor: not-allowed;
}

input[type="file"] {
  width: 100%; padding: 0.9rem;
  background: var(--bg-sunken);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
}

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: var(--tap); padding: 0.6rem 1.2rem;
  font: inherit; font-weight: 620;
  color: var(--silver); background: var(--navy);
  border: 1.5px solid var(--navy); border-radius: var(--radius);
  cursor: pointer; text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease;
}
button:hover, .button:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button[disabled] { opacity: 0.45; cursor: not-allowed; }

:root[data-theme="dark"] button,
:root[data-theme="dark"] .button { color: var(--navy); background: var(--silver); border-color: var(--silver); }
:root[data-theme="dark"] button:hover,
:root[data-theme="dark"] .button:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* Every variant below is prefixed with `:root`, and that is load-bearing.
   The dark default a few lines up is `:root[data-theme="dark"] button` — an
   attribute plus two elements — which outranks a bare `button.found`. So in
   dark mode the default silver fill beat every variant: `found` (the confirm
   action) and `quiet` (the deliberately understated one) both rendered as the
   same silver button, and `danger` lost its red. Measured in the running app,
   not reasoned about: `.found` and `.quiet` came back identical at
   rgb(232,237,242) on rgb(7,21,37).

   `:root button.found` ties that weight and wins on order, in both themes at
   once, so no variant needs a dark restatement — they are built from themed
   variables and follow the palette on their own. Prefix any new variant the
   same way; a bare `button.x` is silently correct in light and wrong at night. */
:root button.found, :root .button.found {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent);
}
:root button.found:hover { background: var(--accent-bright); border-color: var(--accent-bright); color: var(--navy); }

:root button.quiet, :root .button.quiet {
  background: transparent; color: var(--text); border-color: var(--line-strong);
}
:root button.quiet:hover { background: var(--bg-sunken); color: var(--text); border-color: var(--line-strong); }

/* Destructive. The only actions wearing this are the ones with no undo, so it
   must not be mistakable for `quiet` sitting next to it in a row of buttons. */
:root button.danger, :root .button.danger {
  background: var(--danger); border-color: var(--danger); color: var(--on-danger);
}
:root button.danger:hover { background: var(--danger); border-color: var(--danger); filter: brightness(0.92); }

/* Inline warning text — a warehouse counting down to deletion, an owner with
   no TOTP. Amber means "this one", per the brand pack, and it stays scarce. */
.warn { color: var(--accent); font-weight: 600; }

/* A link that happens to post a form, and it has to read as one in both
   themes — see the note on the variants above for why the `:root` is here. */
:root button.link {
  background: none; border: none; color: var(--accent);
  min-height: auto; padding: 0.25rem 0.4rem; font-weight: 600;
}
:root button.link:hover { background: none; color: var(--accent-bright); }
/* A link that takes something out of use: quieter than the actions beside it until hovered, then plainly not one of them. */
:root button.link.caution { color: var(--text-dim); margin-inline-start: 0.5rem; }
:root button.link.caution:hover { color: var(--danger); }

form.inline { display: inline; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }

/* --- Messages ----------------------------------------------------------- */
.error, .notice, .wrote, .empty, .saved {
  padding: 0.85rem 1rem; border-radius: var(--radius);
  border: 1px solid var(--line); margin: 0 0 1rem;
}
.error  { background: var(--danger-wash); border-color: var(--danger); color: var(--danger); font-weight: 560; }
.notice { background: var(--brand-wash); border-color: var(--brand); }
.empty  { background: var(--bg-sunken); color: var(--text-dim); text-align: center; }

/* Quieter than a notice. It confirms something small went through and is
   read once, so it must not compete with the screen it appears on. */
.saved  { background: var(--bg-sunken); border-color: var(--line-strong); color: var(--text-dim); }

/* "Write 0412 7 on the bag." The one moment the operator has to copy
   something down, so it gets the whole width and the accent. */
.wrote {
  background: var(--accent-wash); border-color: var(--accent);
  text-align: center; padding: 1.4rem 1rem;
}
.wrote .label { display: block; color: var(--text-dim); font-size: 0.85rem; margin-bottom: 0.4rem; }

/* Paging under a wall. Links, not buttons — a page is a place, and a place
   can be refreshed and sent to somebody. The disabled ends stay rendered so
   the row does not jump as the controls appear and vanish. */
.pager {
  display: flex; align-items: center; justify-content: center; gap: 1.25rem;
  margin: 1.5rem 0; font-variant-numeric: tabular-nums;
}
.pager a { min-height: var(--tap); display: inline-flex; align-items: center; }
.pager .ghost { color: var(--text-dim); opacity: 0.45; }
.pager .page-of { color: var(--text-dim); font-size: 0.9rem; }

/* --- Item cards ---------------------------------------------------------
   Photo-first. A wall of thumbnails is how humans recognise clothing; a table
   of text is not. And after a reference is entered, the photo is shown BEFORE
   any action is permitted — handwriting is occasionally ambiguous. */
.card {
  display: grid; gap: 1rem;
  grid-template-columns: minmax(0, 8rem) minmax(0, 1fr);
  padding: 1rem;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin: 0 0 1rem;
}
/* The left column: the confirmation photo, and whatever the screen stacks under
   it. align-content keeps it at the top rather than spread down a tall body. */
.card > .shots { display: grid; gap: 0.6rem; align-content: start; min-width: 0; }
/* contain, not cover: the photo is there to say what the thing is, and a
   cropped one showed a slice of a microphone's handle. The sunken ground
   fills the margin a tall or wide photo leaves. */
.card .confirm {
  width: 100%; aspect-ratio: 1; object-fit: contain;
  border-radius: var(--radius); background: var(--bg-sunken);
}
.card h2 { margin: 0; }
.card .body { min-width: 0; }
.card .no-photo {
  display: flex; align-items: center; justify-content: center; text-align: center;
  aspect-ratio: 1; padding: 0.5rem;
  color: var(--text-dim); font-size: 0.8rem;
  background: var(--bg-sunken); border-radius: var(--radius);
}

/* The other photographs, two across in an 8rem column. Twenty stacked one above
   the other would run past the bottom of the form they sit beside. */
.more-shots {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 0.4rem;
  grid-template-columns: repeat(auto-fill, minmax(3.25rem, 1fr));
}
.more-shots > li { display: grid; gap: 0.15rem; }
.more-shots img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: calc(var(--radius) - 2px); background: var(--bg-sunken);
  border: 1px solid var(--line);
}
/* Stacked deliberately rather than wrapped by accident: at 3.25rem the two
   actions never fit on one line, and space-between then strands them. */
.more-shots .photo-actions {
  display: grid; justify-items: start; gap: 0.05rem; font-size: 0.7rem;
}
.more-shots button.link { font-size: 0.7rem; padding: 0; }

.add-shots { margin: 0; display: grid; gap: 0.35rem; }
.add-shots input[type=file] { font-size: 0.75rem; padding: 0.35rem; }
.add-shots button { width: 100%; }
.add-shots label { font-size: 0.8rem; }

@media (max-width: 30rem) {
  .card { grid-template-columns: 1fr; }
  .card .confirm, .card .no-photo { aspect-ratio: 4 / 3; }
  .more-shots { grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr)); }
}

/* --- Pictures of a model -------------------------------------------------
   Not the same thing as .more-shots, which is a unit's evidence photos in a
   narrow column beside a form. These are bigger, because the question they
   answer is "is this the right model" rather than "what did that scratch look
   like on the way out". */
.pictures {
  list-style: none; margin: 0 0 1rem; padding: 0;
  display: grid; gap: 0.6rem;
  grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
}
.pictures > li { display: grid; gap: 0.25rem; }
.pictures img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: contain;
  border-radius: var(--radius); background: var(--bg-sunken);
  border: 1px solid var(--line);
}
/* The one a quote will show, marked on the picture rather than in a caption:
   the caption is what people stop reading. */
.pictures > li.chosen img { border: 2px solid var(--accent); }
.pictures .photo-actions { display: flex; gap: 0.5rem; font-size: 0.75rem; }
.pictures .photo-actions button.link { padding: 0; font-size: 0.75rem; }

/* A thumbnail at the head of a list row. The slot is rendered whether or not
   there is a picture, so a list does not jag down the left where a model has
   none yet. */
.row-thumb {
  width: 3rem; height: 3rem; flex: none;
  object-fit: cover; border-radius: 6px;
  background: var(--bg-sunken); border: 1px solid var(--line);
}
.empty-thumb { display: inline-block; }

/* The picture column on a quotation. Narrow, and it keeps its width whether or
   not a row has a picture — a column that appears and disappears down the page
   is worse than an empty cell. Prints: a customer's copy is usually paper, and
   a quote showing what the kit looks like is the entire reason this column
   exists, so it must not be a screen-only flourish. */
td.shot, th.shot { width: 3.2rem; padding-right: 0.4rem; }
/* --- The label sheet ----------------------------------------------------
   Each label is SVG carrying its own physical size in millimetres, so the grid
   only has to lay them out — it must never scale them, or what comes out of
   the printer is the wrong size for the stock and every label is wasted. */
.label-sheet {
  display: flex; flex-wrap: wrap; align-items: flex-start;
  gap: 4mm; margin: 0 0 1.5rem;
}
.label {
  border: 1px dashed var(--line-strong);
  background: #fff;
  line-height: 0;
}
.label svg { display: block; }

@media print {
  /* The cut lines are for finding the edges on screen. On the stock the edges
     are already there, and a dashed rule printed over a label is a label with
     a dashed rule on it. */
  .label { border: none; }
  .label-sheet { gap: 0; }
}

td.shot img {
  width: 3rem; height: 2.25rem; object-fit: cover;
  border-radius: 4px; background: var(--bg-sunken);
}

dl.facts { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 1rem; margin: 0.6rem 0 0; }
dl.facts dt { color: var(--text-dim); font-size: 0.85rem; }
dl.facts dd { margin: 0; font-weight: 560; }

/* Where it is. The answer to the question the product is named after. */
.where {
  font-family: var(--mono); font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.45rem; border-radius: 5px;
  background: var(--brand-wash); color: var(--brand);
}
.where.nowhere { background: var(--bg-sunken); color: var(--text-dim); }

/* --- Grid of thumbnails ------------------------------------------------- */
.wall { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); }
.wall a { text-decoration: none; color: var(--text); }
.wall figure { margin: 0; }
/* The frame carries the status. Three pixels because one is invisible at
   thumbnail size across a room, and it sits on this wrapper rather than on the
   picture so that dimming a written-off item does not dim its border too. */
.wall .frame {
  border: 3px solid var(--band, var(--line));
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-sunken);
  line-height: 0;
}
.wall img, .wall .no-photo {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  background: var(--bg-sunken);
}
/* The frame sets line-height: 0 so an image sits flush in it. That is right for
   an image and wrong for the words that stand in for one: the text collapsed to
   a sliver clipped against the top edge of every unphotographed unit on the
   dashboard, which is most of them in a warehouse that has just migrated in. */
.wall .no-photo {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.35rem;
  padding: 0.5rem; text-align: center;
  line-height: 1.3;
  color: var(--text-dim); font-size: 0.74rem;
}
/* A faint camera over the words: a wall of a freshly migrated fleet is mostly
   these, and grey squares saying "No photo" read as broken rather than as
   pictures still to take. */
.wall .no-photo::before {
  content: ""; width: 1.7rem; height: 1.7rem; opacity: 0.45;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 8h3l1.6-2.2h6.8L17 8h3v11H4z'/%3E%3Ccircle cx='12' cy='13.2' r='3.4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 8h3l1.6-2.2h6.8L17 8h3v11H4z'/%3E%3Ccircle cx='12' cy='13.2' r='3.4'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* --- Status bands ------------------------------------------------------
   Five, not eleven. Nobody learns eleven colours, and what matters at a glance
   is on the shelf / going out / out / not available / gone. See
   Display/StatusBands.cs for which status is which. */
.band-on-the-shelf  { --band: var(--shelf); }         /* steel  — bookable        */
.band-going-out     { --band: var(--going); }         /* plum   — in staging      */
.band-on-hire       { --band: var(--away); }          /* teal   — out earning     */
.band-not-available { --band: var(--blocked); }       /* ochre  — here, not free  */
.band-gone          { --band: var(--danger); }        /* red    — gone            */

/* Gone is gone: the picture is a record, not kit. Dimming it means a unit
   written off never gets mistaken for one on a shelf, even in a thumbnail too
   small to read the frame on. */
.wall .band-gone img { opacity: 0.5; filter: grayscale(0.7); }

.status-key {
  list-style: none; margin: 0 0 0.75rem; padding: 0;
  display: flex; flex-wrap: wrap; gap: 0.35rem 1rem;
  font-size: 0.8rem; color: var(--text-dim);
}
.status-key li { display: flex; align-items: center; gap: 0.35rem; }
/* A colour chip, filled: drawn as a hollow square it read as a checkbox. */
.status-key .swatch {
  width: 1rem; height: 0.6rem; flex: none;
  border-radius: 3px; background: var(--band, var(--line));
}
.status-key .key-title { font-weight: 600; }

/* Available to a screen reader, absent from the page. The frame is the glance;
   this is the same fact for somebody who cannot see it. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}
.wall figcaption { font-size: 0.8rem; margin-top: 0.3rem; }
.wall figcaption .ref { display: block; color: var(--text-dim); }

/* Edit, on the picture rather than under it. The wall is a recognition surface
   before it is a menu, so this must not push the thumbnails apart or compete
   with them — but a wrong title is noticed here and nowhere else. */
.wall figure { position: relative; }
.wall .edit {
  position: absolute; top: 0.3rem; right: 0.3rem;
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem; font-weight: 640; line-height: 1.4;
  text-decoration: none; color: var(--text);
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: 999px; box-shadow: var(--shadow);
  opacity: 0.85;
}
.wall .edit:hover, .wall .edit:focus-visible {
  opacity: 1; color: var(--accent); border-color: var(--accent);
}

/* --- Photo strip on the edit screen ------------------------------------- */
/* Up to twenty per item, so this wraps rather than scrolls sideways — a
   horizontal scroller hides the photos at the end, and the whole point of the
   strip is seeing which one comes first. */
.photo-strip {
  list-style: none; margin: 0 0 1.25rem; padding: 0;
  display: grid; gap: 0.6rem;
  grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
}
.photo-strip > li {
  display: flex; flex-direction: column; gap: 0.35rem;
  padding: 0.4rem; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--bg-sunken);
}
/* The confirmation photo (CLAUDE.md 6) is the one that settles which bag this
   is, so it is marked, not merely first. */
.photo-strip > li.primary { border-color: var(--accent); background: var(--accent-wash); }
.photo-strip img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: calc(var(--radius) - 2px); background: var(--bg);
}
.photo-actions {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.4rem; flex-wrap: wrap; font-size: 0.8rem;
}
.photo-actions .pill { font-size: 0.7rem; }
.photo-strip button.link { font-size: 0.8rem; padding: 0; }

/* --- Status pills ------------------------------------------------------- */
.pill {
  display: inline-block; padding: 0.1rem 0.5rem;
  font-size: 0.75rem; font-weight: 640; letter-spacing: 0.02em;
  border-radius: 999px;
  background: var(--bg-sunken); color: var(--text-dim);
  border: 1px solid var(--line);
}
.pill.live    { background: var(--brand-wash); color: var(--brand); border-color: var(--brand); }
.pill.found   { background: var(--accent-wash); color: var(--accent); border-color: var(--accent); }
.pill.gone    { background: var(--danger-wash); color: var(--danger); border-color: var(--danger); }

/* A field a model filled in. Quiet on purpose — it marks something to CHECK,
   not something that is done, and there may be a dozen of them at once. */
.pill.suggested {
  background: transparent; color: var(--text-dim);
  border-style: dashed; font-weight: 560; text-transform: lowercase;
}

/* --- Something is happening ---------------------------------------------
   Enhanced navigation posts by fetch, so the browser shows nothing at all
   while a model is looking at a photograph. These two say so: a bar at the
   top of the window for when the button has scrolled away, and a spinner in
   the button itself for where the eye already is. */
#busy-bar {
  /* Where there is no nav bar to hang under — sign-in, the field page — it
     pins to the top of the window instead. z-index clears the scanner overlay:
     an indicator that can be covered is not an indicator. */
  position: fixed; inset: 0 0 auto 0; z-index: 200;
  height: 3px; opacity: 0;
  background: var(--bg-sunken);
  pointer-events: none;
  /* The travelling fill runs past both ends; without this it widens the page
     and the whole layout shifts every time something loads. */
  overflow: hidden;
  transition: opacity 120ms linear;
}

/* Along the bottom of the nav bar, which is where the eye already is after
   pressing something in the page below it. Absolute against the sticky header,
   so no height is measured and none needs re-measuring. */
.chrome > #busy-bar { position: absolute; inset: auto 0 0 0; }
#busy-bar.on { opacity: 1; }
#busy-bar.on::before {
  content: ""; display: block; height: 100%; width: 40%;
  background: var(--accent);
  animation: busy-slide 1.1s ease-in-out infinite;
}
@keyframes busy-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

.spinner {
  display: inline-block; vertical-align: -0.125em;
  width: 0.9em; height: 0.9em; margin-right: 0.45em;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%;
  animation: busy-spin 0.7s linear infinite;
}
@keyframes busy-spin { to { transform: rotate(360deg); } }

button[aria-busy="true"] { cursor: progress; }

/* A moving bar is the whole signal, so it cannot simply be switched off here —
   it slows to something that reads as alive rather than as motion. */
@media (prefers-reduced-motion: reduce) {
  #busy-bar.on::before { width: 100%; animation: busy-fade 1.6s ease-in-out infinite; }
  .spinner { animation-duration: 2s; }
  @keyframes busy-fade { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
}

/* --- The magic button --------------------------------------------------- */
.suggest { margin: 0 0 1rem; display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.suggest .hint { margin: 0; flex: 1 1 14rem; }
button.wand { white-space: nowrap; }
button.wand span { color: var(--accent); margin-right: 0.3rem; }

/* --- Lists and tables --------------------------------------------------- */
.rows { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: 0.5rem; }
.rows > li {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.75rem 1rem;
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius);
}
.rows > li .grow { flex: 1; min-width: 8rem; }
.rows > li.done { border-left: 4px solid var(--brand); }
.rows > li.next { border-left: 4px solid var(--accent); }

.money { font-variant-numeric: tabular-nums; font-weight: 620; }

/* --- Auth pages ---------------------------------------------------------
   No navigation, no warehouse chrome, no circuit. */
.auth {
  /* Same reason as .content: auto margins on a flex item disable stretch. */
  width: 100%;
  max-width: 24rem; margin: 0 auto; padding: clamp(1.5rem, 8vh, 4rem) 1.25rem 3rem;
}
/* The wrapper owns the layout so the images can own nothing but their size. */
.auth .lockup-slot { text-align: center; margin: 0 0 1.75rem; }
.auth .lockup { width: min(15rem, 70%); }
.auth .voice { text-align: center; color: var(--text-dim); font-size: 0.9rem; margin: -1rem 0 1.75rem; }
.auth form { background: var(--bg-raised); padding: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.auth button { width: 100%; margin-top: 1.25rem; }

/* --- Back ---------------------------------------------------------------
   Sized for a thumb, and above the heading so it is the first thing focus
   reaches. */
.back {
  display: inline-flex; align-items: center; gap: 0.4rem;
  min-height: var(--tap); padding: 0.4rem 0.7rem 0.4rem 0.5rem;
  margin: 0 0 0.25rem -0.5rem;
  font-weight: 600; font-size: 0.95rem;
  color: var(--text-dim); text-decoration: none;
  border-radius: var(--radius);
}
/* Amber on hover, not ink. This is the one place the accent is spent on
   something other than "this one, out of all of them" — a back link is on every
   screen, only ever one of them, and only lit while the pointer is on it. */
.back:hover, .back:focus-visible { color: var(--accent); background: var(--bg-sunken); }
.back span { font-size: 1.15rem; line-height: 1; }

.auth .back { margin-bottom: 0.75rem; }

/* --- Warehouse switcher --------------------------------------------------
   Rarely seen — most people belong to one warehouse — but when it is seen the
   question is "which room am I about to be in", so the name carries the row and
   the slug and role sit under it. */
.warehouses { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: 0.5rem; }
.warehouses > li {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.warehouses > li.here { border-left: 4px solid var(--accent); }
.warehouses form {
  display: flex; align-items: center; gap: 0.75rem;
  margin: 0; padding: 0.7rem 0.9rem;
}
.warehouses .grow { flex: 1; min-width: 0; }
.warehouses strong { display: block; }

/* --- Section headers ---------------------------------------------------- */
.section-head { display: flex; align-items: baseline; gap: 0.75rem; margin: 2rem 0 0.75rem; }
.section-head h2 { margin: 0; }
.section-head .count { color: var(--text-dim); font-size: 0.85rem; }
.section-head a { margin-left: auto; font-size: 0.9rem; }

.lede { color: var(--text-dim); margin-top: -0.25rem; }

/* --- Depot headings -----------------------------------------------------
   Only ever rendered when a company has more than one building. A single-depot
   warehouse sees an unbroken list, because for them the grouping would be a
   heading with everything under it. */
h3.depot {
  margin: 1.5rem 0 0.4rem;
  font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-dim);
  border-bottom: 1px solid var(--line); padding-bottom: 0.3rem;
}
h3.depot:first-of-type { margin-top: 0.5rem; }

/* A name over its address, in a row that is otherwise all on one line. */
.stacked { display: flex; flex-direction: column; gap: 0.15rem; }

/* --- Permission list ----------------------------------------------------
   Thirty-two rows at row height is a form nobody reads, and an access model
   nobody reads is one that ends up with everything ticked. */
.rows.checks { gap: 0.25rem; }
.rows.checks > li { padding: 0.35rem 0.7rem; }
.rows.checks label { display: flex; align-items: center; gap: 0.6rem; margin: 0; cursor: pointer; }
.rows.checks input[type="checkbox"] { flex: none; margin: 0; }

/* --- Pick list ----------------------------------------------------------
   Sorted by location path — zone, rail, position — not by item. A three-item
   bundle is one walk, not three. */
.walk { counter-reset: stop; }
.walk > li::before {
  counter-increment: stop; content: counter(stop);
  display: grid; place-items: center;
  width: 1.9rem; height: 1.9rem; flex: none;
  font-family: var(--mono); font-weight: 700; font-size: 0.9rem;
  border-radius: 50%; background: var(--bg-sunken); color: var(--text-dim);
}
.walk > li.next::before { background: var(--accent); color: var(--on-accent); }
.walk > li.done::before { background: var(--brand); color: var(--silver); content: "✓"; }
.walk img { width: 3rem; height: 3rem; object-fit: cover; border-radius: 6px; flex: none; }

/* --- Enrolment ---------------------------------------------------------- */
.qr { display: block; width: min(14rem, 60%); margin: 1rem auto; background: #fff; padding: 0.75rem; border-radius: var(--radius); }
.secret { font-family: var(--mono); font-size: 0.9rem; letter-spacing: 0.1em; word-break: break-all; text-align: center; color: var(--text-dim); }

/* --- Scanner ------------------------------------------------------------
   The secondary button and the full-screen viewfinder. The button only exists
   when BarcodeDetector does. */
button.scan { margin-top: 0.4rem; margin-inline-end: 0.5rem; }

.scan-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; padding: 1rem;
  background: rgb(17 26 22 / 0.92);
}
.scan-overlay .scan-note { margin: 0.75rem 0 0; min-height: 1.4em; color: #fff; text-align: center; font-weight: 600; }
.scan-overlay video {
  width: 100%; max-width: 28rem; border-radius: var(--radius-lg);
}

/* --- Misc --------------------------------------------------------------- */
.stack > * + * { margin-top: 1rem; }
.muted { color: var(--text-dim); }
.small { font-size: 0.85rem; }
.right { margin-left: auto; }

/* --- Footer -------------------------------------------------------------
   Quiet on purpose. It is on every screen including the ones used a hundred
   times a day, so it has to sit below the work rather than compete with it. */
.site-footer {
  padding: 2rem 1rem 1.5rem;
  text-align: center;
}
.site-footer a {
  color: var(--text-dim);
  font-size: 0.8rem;
  text-decoration: none;
}
.site-footer a:hover { color: var(--text); text-decoration: underline; }

/* The content already reserves space at the bottom for thumb reach, so the
   footer does not need to add more. */
.content { padding-bottom: 2rem; }

/* Takes the slack in the body column above. margin-top rather than flex-grow
   on the main element, because both layouts have a different main — .content
   and .auth — and the footer is the one element common to both. */
.site-footer { margin-top: auto; }

#blazor-error-ui {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
  padding: 0.75rem 1.25rem; background: var(--danger); color: #fff;
}
#blazor-error-ui .dismiss { cursor: pointer; float: right; }

/* The way out of the error bar, on a red ground where the ordinary link
   colour disappears. It was unstyled and rendered as a default blue link on
   red, which is the least readable pair of colours in the app. */
#blazor-error-ui .reload { color: #fff; text-decoration: underline; font-weight: 560; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}


/* --- The availability grid ----------------------------------------------
   The screen the desk lives on: models down, weeks across, and how many are
   free in each cell. It is the only wide thing in the app, so it scrolls
   inside its own box rather than making the page scroll sideways — a page
   that moves horizontally on a phone loses the navigation. */
.scroller { overflow-x: auto; margin: 0 0 1.5rem; }

.grid {
  border-collapse: collapse; width: 100%; font-size: 0.9rem;
  background: var(--bg-raised);
}

.grid th, .grid td {
  border: 1px solid var(--line); padding: 0.4rem 0.6rem; text-align: center;
  white-space: nowrap;
}

.grid thead th { background: var(--bg-sunken); font-weight: 620; }

/* The model column is the one thing being read down rather than across, so
   it is left-aligned and sticks while the weeks scroll past it. */
.grid tbody th {
  text-align: left; position: sticky; left: 0; background: var(--bg-raised);
  font-weight: 560;
}

/* Three states, not two. "None free" and "none free unless you bump a quote"
   are different answers and only a person can choose between them, so the
   middle one gets its own colour rather than being rounded down to red. */
.grid td.ok   { color: var(--text); }
.grid td.warn { background: var(--accent-wash); color: var(--text); }
.grid td.bad  { background: var(--danger-wash); color: var(--danger); font-weight: 560; }

/* The answer to "is it free?": three tones, the same three as the grid. */
.content .answer {
  display: grid; gap: 0.35rem; margin-top: 1rem; padding: 0.9rem 1.1rem;
  border-radius: var(--radius-lg); border: 1px solid var(--line);
  box-shadow: inset 4px 0 0 var(--brand);
}
.content .answer strong { font-size: 1.08rem; }
.content .answer .button { justify-self: start; margin-top: 0.35rem; }
.content .answer.ok { background: var(--brand-wash); }
.content .answer.warn { background: var(--accent-wash); box-shadow: inset 4px 0 0 var(--accent); }
.content .answer.bad { background: var(--danger-wash); box-shadow: inset 4px 0 0 var(--danger); }
.content .answer.bad strong { color: var(--danger); }

.grid td .small { display: block; font-size: 0.75rem; color: var(--text-dim); }

/* --- Form shapes --------------------------------------------------------
   Three, and the difference between them is how much of the screen the form
   owns. A card-form is one of several on a page — check-in draws one per unit
   — so it carries its own border; an inline-form is a row of controls inside
   a screen that belongs to something else. */
.card-form {
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 1.25rem; margin: 0 0 1rem;
  box-shadow: var(--shadow);
}

.card-form h2 { margin-top: 0; }

.inline-form, .filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem;
  margin: 0 0 1.25rem;
}

.inline-form label, .filters label {
  margin: 0; font-size: 0.8rem; color: var(--text-dim);
}

.inline-form select, .inline-form input, .filters select, .filters input {
  margin: 0; width: auto; min-width: 8rem;
}

.inline-form button, .filters button { margin: 0; }

/* A checkbox is a box beside a label, not a field with a label above it. */
.check {
  display: flex; align-items: center; gap: 0.5rem; font-weight: 400;
  margin: 0 0 0.5rem;
}

.check input { width: auto; margin: 0; }

/* A row of secondary destinations under a form — the other things you might
   do to this unit. Quieter than .actions, which carries buttons. */
.also {
  display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.25rem;
  padding-top: 1rem; border-top: 1px solid var(--line);
  font-size: 0.9rem;
}

/* --- Paper ---------------------------------------------------------------
   Documents that get printed and handed to somebody: quotes, pick sheets,
   delivery notes, invoices. A screen shows them so they can be checked before
   they go out, and the browser's own print dialog is the PDF button — a
   headless browser per request is a heavy dependency to run on a home
   connection, and it would sit in the path of the one action a crew does while
   a van is waiting. */
.paper {
  max-width: 190mm; margin: 1.5rem auto; padding: 12mm;
  background: #fff; color: #1a1a1a;
  border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 10.5pt; line-height: 1.45;
}
.paper h1 { font-size: 18pt; margin: 0 0 0.2rem; }
.paper h2 { font-size: 11pt; margin: 1.4rem 0 0.4rem; letter-spacing: 0.04em;
            text-transform: uppercase; color: #555; }
.paper a { color: inherit; }
/* A job title is a name, not a section label. The h2 rule shouts on purpose;
   this is what stops it shouting a customer's show back at them. */
.paper .subject { font-size: 13pt; font-weight: 700; margin: 0 0 0.3rem; }

.paper-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 2rem; }
.paper-head .who { text-align: right; font-size: 9.5pt; color: #444; }

/* A document opened on a phone — a driver showing the delivery note at the
   door — fits the screen rather than being an A4 page the hand can push
   sideways. Print is untouched: this is screen only. */
@media screen and (max-width: 640px) {
  .paper { box-sizing: border-box; max-width: 100%; margin: 0.5rem 0; padding: 6mm 5mm; overflow-wrap: anywhere; }
  .paper-head { flex-direction: column; gap: 0.75rem; }
  .paper-head .who { text-align: left; }
  .paper table { font-size: 9.5pt; }
  .paper .shot { display: none; }
  .paper .signed-for { grid-template-columns: 1fr; }
  .paper .sign { gap: 1rem; }
}
/* The warehouse's own logo above the document's name; sized for a letterhead, never a banner. */
.paper-logo { display: block; max-width: 60mm; max-height: 22mm; width: auto; height: auto; margin-bottom: 4mm; }
.content .logo-preview { display: block; max-width: 18rem; max-height: 7rem; padding: 0.75rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin: 0.5rem 0; }
.paper-mark { font-family: var(--mono); font-weight: 700; letter-spacing: 0.06em; }

.paper table { width: 100%; border-collapse: collapse; margin: 0.4rem 0 1rem; }
.paper th { text-align: left; font-size: 8.5pt; letter-spacing: 0.06em;
            text-transform: uppercase; color: #555;
            border-bottom: 1px solid #bbb; padding: 0.3rem 0.4rem; }
.paper td { padding: 0.35rem 0.4rem; border-bottom: 1px solid #eee; vertical-align: top; }
.paper td.num, .paper th.num { text-align: right; white-space: nowrap; }
.paper tfoot td { border-bottom: none; border-top: 1px solid #bbb; font-weight: 700; }

.paper .terms { font-size: 8.5pt; color: #555; margin-top: 1.5rem; }
/* The portal shows the same terms as something to READ before agreeing, not as
   a footnote. A <pre> that scrolls sideways on a phone is a paragraph nobody
   reads, and this is the text they are being asked to be bound by. */
/* The signature pad. Sized in CSS and scaled for the device in script, or the
   line lands somewhere other than the finger on any screen that is not 1x. */
canvas.signature {
  display: block; width: 100%; height: 200px; touch-action: none;
  /* White in both themes: the ink is dark, and what is captured is printed
     on white paper — a dark pad hid the signature while it was being drawn. */
  background: #fff; border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius); margin: 0 0 0.5rem;
}
.signature-pad { display: grid; gap: 0.25rem; margin: 0 0 0.75rem; }
.signature-pad .signature-foot { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }
.signature-pad.signed canvas.signature { border-style: solid; border-color: var(--accent); }
.signature-pad.wanted canvas.signature { border-color: var(--danger); border-style: solid; }
.signature-pad [data-signature-missing] { color: var(--danger); margin: 0; }

/* What is being signed for, shown in full above the pad: the words a
   signature is put to, not a summary of them. */
.content .statement {
  white-space: pre-wrap; margin: 0 0 1rem; padding: 0.9rem 1rem;
  background: var(--bg-sunken); border: 1px solid var(--line); border-radius: var(--radius);
  font: inherit; font-size: 0.95rem; line-height: 1.55; color: var(--text);
}
.content .acceptance { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.content .acceptance img { max-height: 3.5rem; max-width: 12rem; background: #fff; border-radius: var(--radius); padding: 0.2rem 0.4rem; }
.fingerprint { font-family: var(--mono, ui-monospace, monospace); letter-spacing: 0.04em; }

/* A signature captured on screen, printed where the blank lines would be. */
.paper .signed-for { margin-top: 1.6rem; display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 1.5rem; align-items: end; font-size: 9pt; }
.paper .signed-for img { grid-row: span 3; max-height: 22mm; max-width: 70mm; border-bottom: 1px solid #999; }
.paper .signed-for .small { color: #555; }

pre.terms {
  white-space: pre-wrap; word-break: break-word;
  background: var(--bg-sunken); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0.9rem; max-height: 22rem; overflow-y: auto;
  font-family: var(--sans); font-size: 0.88rem; color: var(--text);
}
.paper .sign { margin-top: 2rem; display: flex; gap: 3rem; }
.paper .sign div { flex: 1; border-top: 1px solid #999; padding-top: 0.3rem;
                   font-size: 8.5pt; color: #555; }

.paper-actions { text-align: center; margin: 0 0 2rem; }

@media print {
  /* The page IS the document. Everything else was scaffolding to look at it
     with. */
  .no-print, nav, header, footer, .brand-tile { display: none !important; }
  body { background: #fff; }
  .paper { max-width: none; margin: 0; padding: 0; border: none; border-radius: 0; }
  .paper table { page-break-inside: auto; }
  .paper tr { page-break-inside: avoid; }
  .paper h2 { page-break-after: avoid; }

  /* Browsers drop background images when printing, and some drop <img>
     backgrounds with them; this makes sure the picture column survives onto
     paper, which is the only form of a quote most customers read. */
  td.shot img { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* A list of column names is one unbroken token as far as wrapping is concerned,
   so on a phone it pushed the whole document sideways — 219px of horizontal
   scroll on the import screen, which takes the header and every form with it.
   Measured at 390px. Breaking the list is better than hiding the overflow,
   because the column names are the thing somebody is there to read. */
code {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ==========================================================================
   Polish — the finish layer
   --------------------------------------------------------------------------
   Last in the file on purpose: it refines what is above rather than
   restating it, and every rule is scoped to the signed-in app (.content,
   .chrome) so the paper documents and the field page are untouched.

   What it is for, in one line each:
   - a calm ground: the scattered-mark texture read as wallpaper behind every
     list, so it stays behind the sign-in lockup only;
   - a column a person can read across: 90rem put a row's price 1,300px from
     its name;
   - lists as one grouped surface with hairlines, not a stack of loose boxes;
   - Blazor trims the whitespace between elements, so "Andy CampbellStage" —
     spacing between inline siblings is the stylesheet's job, not the markup's;
   - p.hint was used 107 times with no rule of its own and printed at body size.
   ========================================================================== */

:root {
  --shadow-sm: 0 1px 2px rgb(7 21 37 / 0.05), 0 1px 1px rgb(7 21 37 / 0.03);
  --ring: 0 0 0 4px var(--accent-wash);
  --column: 80rem;
}
:root[data-theme="dark"] {
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.45);
}

/* --- Ground ------------------------------------------------------------- */
body,
:root[data-theme="dark"] body {
  background-image: linear-gradient(180deg, var(--bg-raised) 0, var(--bg) 18rem);
  background-repeat: no-repeat;
  background-size: 100% 18rem;
  background-color: var(--bg);
}
:root[data-theme="dark"] body {
  background-image: linear-gradient(180deg, var(--navy-2) 0, var(--bg) 18rem);
}
/* The texture stays where it was designed for: behind the lockup on the
   signed-out pages, with nothing else on the screen to compete. */
body:has(.auth) { background-image: url("brand/pattern-light.svg"); background-size: 520px; background-repeat: repeat; }
:root[data-theme="dark"] body:has(.auth) { background-image: url("brand/pattern-dark.svg"); background-size: 520px; background-repeat: repeat; }

/* --- Column --------------------------------------------------------------- */
.content { max-width: var(--column); }
.chrome {
  padding-inline: calc(max(0px, (100% - var(--column)) / 2) + clamp(0.75rem, 3vw, 1.5rem));
  background: color-mix(in srgb, var(--bg-raised) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  box-shadow: 0 1px 0 var(--line), 0 8px 24px rgb(7 21 37 / 0.04);
  border-bottom: 0;
}

/* --- Header: quiet links, one voice ------------------------------------- */
.chrome .chrome-link, .chrome .who {
  color: var(--text-dim); text-decoration: none; font-weight: 560; font-size: 0.9rem;
}
.chrome .chrome-link:hover, .chrome .who:hover { color: var(--text); }
.chrome-row nav button.link { font-weight: 600; text-decoration: none; }
/* The person, as a chip: an initial in a circle, then the name. */
.chrome .who { display: inline-flex; align-items: center; gap: 0.45rem; max-width: 11rem; }
.chrome .who .initial {
  flex: none; display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem;
  border-radius: 50%; background: var(--accent-wash); color: var(--accent);
  font-size: 0.8rem; font-weight: 700;
}
.chrome .who .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Sign out in the header's quiet voice, not the page's loudest link. */
:root .chrome-row nav button.link { color: var(--text-dim); font-size: 0.9rem; }
:root .chrome-row nav button.link:hover { color: var(--text); }
/* Still gone on a phone, as the rule further up says: this block comes later and would bring it back. */
@media (max-width: 30rem) { .chrome .who { display: none; } }

/* --- Type ----------------------------------------------------------------- */
.content h1 { font-size: clamp(1.6rem, 1.2rem + 1.2vw, 2.05rem); font-weight: 700; letter-spacing: -0.028em; margin-bottom: 0.4rem; }
.content h2 { font-size: 1.2rem; font-weight: 660; letter-spacing: -0.015em; }
.content .lede { font-size: 1.04rem; line-height: 1.55; max-width: 62ch; margin: 0 0 1.75rem; }

/* Sections breathe. A heading that follows content starts a new section, so
   it gets room above it; one that opens a card or a form keeps its own. */
.content > h2:not(:first-child),
.content > form > h2:not(:first-child),
.content > section > h2:not(:first-child) { margin-top: 2.25rem; margin-bottom: 0.8rem; }
.content > dl.facts { margin-bottom: 1.75rem; }
.content > dl.facts + h2 { margin-top: 0.5rem; }
dl.facts { row-gap: 0.4rem; }
dl.facts dd { font-weight: 600; }

/* --- Help text -------------------------------------------------------------- */
p.hint {
  margin: 0.45rem 0 0; font-size: 0.85rem; line-height: 1.45; color: var(--text-dim);
  max-width: 60ch;
}
.content > p.hint { margin-bottom: 1rem; }

/* --- Inline neighbours ------------------------------------------------------ */
.rows > li > .grow {
  display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 0.55rem; row-gap: 0.15rem;
}
:is(h1, h2, h3) > :is(.ref, .small, .pill, .listed, .muted) { margin-inline-start: 0.5em; }
:is(h1, h2, h3) > .pill { vertical-align: 0.2em; }

/* --- Lists: one surface, hairlines between -------------------------------- */
.content .rows {
  gap: 0;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.content .rows > li {
  border: 0; border-radius: 0; background: transparent;
  padding: 0.85rem 1.15rem; min-height: 3.4rem;
  transition: background-color 0.12s ease;
}
.content .rows > li + li { border-top: 1px solid var(--line); }
.content .rows > li:first-child { border-top-left-radius: var(--radius-lg); border-top-right-radius: var(--radius-lg); }
.content .rows > li:last-child { border-bottom-left-radius: var(--radius-lg); border-bottom-right-radius: var(--radius-lg); }
.content .rows > li:has(a:not(.button)):hover { background: color-mix(in srgb, var(--bg-sunken) 40%, transparent); }
.content .rows > li.done { box-shadow: inset 4px 0 0 var(--brand); border-left: 0; }
.content .rows > li.next { box-shadow: inset 4px 0 0 var(--accent); border-left: 0; }
/* A row that only holds a "correct this" disclosure belongs to the row above
   it: it reads as that row's footnote, not as another entry. */
.content .rows > li:has(> details:only-child) {
  min-height: 0; padding-block: 0.15rem 0.55rem; border-top: 0;
}
.content .rows > li > details > summary { color: var(--text-dim); cursor: pointer; width: fit-content; }
.content .rows > li > details > summary:hover { color: var(--accent); }
.content .rows .money { font-size: 0.98rem; }

/* --- Links ------------------------------------------------------------------ */
.content a:not(.button):not(.back):not(.tile) {
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
}
.content a:not(.button):not(.back):not(.tile):hover { text-decoration-color: currentColor; }
.content :is(.rows, .section-head, dl.facts, table, .warehouses) a:not(.button) { text-decoration: none; }
.content :is(.rows, .section-head, dl.facts, table, .warehouses) a:not(.button):hover { text-decoration: underline; }

/* --- Surfaces ----------------------------------------------------------------- */
.tile, .card, .card-form, .auth form { box-shadow: var(--shadow-sm); }
.tile:hover { box-shadow: var(--shadow-lift); }
.error, .notice, .wrote, .empty, .saved { border-radius: var(--radius-lg); }
.content .empty { border-style: dashed; background: transparent; }

/* --- Pills ---------------------------------------------------------------- */
.pill {
  padding: 0.15rem 0.6rem; line-height: 1.45; font-size: 0.74rem; font-weight: 650;
  border-color: color-mix(in srgb, currentColor 28%, transparent);
  white-space: nowrap;
}
/* Sentence case whatever the source said: the words come from several places
   ("off the road", "Draft", "owner") and a row of them should read as one set. */
.pill::first-letter { text-transform: uppercase; }
/* The neutral pill a shade brighter than help text: on the dark theme the
   dim grey on a near-black sunken fill fell under comfortable contrast. */
.pill:not(.live, .found, .gone, .suggested) { color: color-mix(in srgb, var(--text) 70%, var(--text-dim)); }

/* --- Breathing room ---------------------------------------------------------
   A button straight after its help text sat two pixels under it on a dozen
   forms. One rule rather than a dozen margins. */
p.hint + :is(button, .button, .actions) { margin-top: 0.9rem; }

/* --- File pickers -------------------------------------------------------------
   The browser's own button inside the dashed drop area was the one control on
   the page not in the app's dress, and on the dark theme a glaring grey slab. */
input[type="file"] { color: var(--text-dim); font-size: 0.9rem; }
input[type="file"]::file-selector-button {
  margin-right: 0.85rem; padding: 0.5rem 1rem; min-height: 2.5rem;
  font: inherit; font-weight: 620; color: var(--text);
  background: var(--bg-raised); border: 1px solid var(--line-strong); border-radius: var(--radius);
  cursor: pointer; transition: border-color 0.12s ease, color 0.12s ease;
}
input[type="file"]::file-selector-button:hover { border-color: var(--accent); color: var(--accent); }

/* --- Fields --------------------------------------------------------------- */
input:not([type="checkbox"], [type="radio"], [type="file"], [type="submit"],
          [type="button"], [type="image"], [type="reset"], [type="hidden"], [type="range"],
          [type="color"]),
select, textarea {
  border-width: 1px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"]):hover,
select:hover, textarea:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong)); }
input:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"]):focus,
select:focus, textarea:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }
input:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"]):focus-visible,
select:focus-visible, textarea:focus-visible { outline: none; }
::placeholder { color: color-mix(in srgb, var(--text-dim) 75%, transparent); }

/* --- Buttons --------------------------------------------------------------- */
button, .button { letter-spacing: 0.005em; box-shadow: var(--shadow-sm); }
:root button.found, :root .button.found {
  box-shadow: 0 1px 2px rgb(7 21 37 / 0.14), inset 0 1px 0 rgb(255 255 255 / 0.14);
}
:root button.quiet, :root .button.quiet, button.link, .theme-toggle, button.goto-open { box-shadow: none; }
button:active, .button:active { transform: translateY(1px); }

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

/* --- Short forms: the label over its field ---------------------------------
   Every .inline-form and .filters form is label/control pairs and then a
   button — checked across all of them. As a flex row the labels sat BESIDE
   their fields, bottom-aligned and drifting left of what they named. A column
   grid puts each label over its control and the button on the controls' line:
   a label locked to row 1 and its control to row 2 share a column, and the
   next label, being above the cursor, opens the next one. */
.content :is(.inline-form, .filters) {
  display: grid; grid-auto-flow: column; grid-template-rows: auto auto;
  justify-content: start; align-items: end; column-gap: 0.75rem; row-gap: 0.35rem;
}
.content :is(.inline-form, .filters) > label { grid-row: 1; font-weight: 600; }
.content :is(.inline-form, .filters) > :is(input, select, textarea, button, a, .button) { grid-row: 2; }
.content :is(.inline-form, .filters) > :is(input, select) { min-width: 11rem; }
/* The general form rule spaces a button off the field before it; here the
   button sits BESIDE the fields, and that margin made its row taller than
   theirs and dropped every field a line below its label. */
.content :is(.inline-form, .filters) > :is(button, .button, a) { margin-top: 0; }
/* A checkbox's label holds its own control, so it is a field, not a heading
   over one: it sits on the controls' line, words beside the box. */
.content :is(.inline-form, .filters) > label:has(input[type="checkbox"]) {
  grid-row: 2; align-self: center; align-items: center; white-space: nowrap;
  font-size: 0.9rem; font-weight: 560; color: var(--text); padding: 0;
}
/* The older inline-form rule gave every input a minimum width — the checkbox
   too, which put eight rems of nothing between the box and its words. */
.content :is(.inline-form, .filters) input[type="checkbox"] { min-width: 0; width: 1.4rem; }
.content :is(.inline-form, .filters) > :is(button, .button) { white-space: nowrap; }

/* A phone has no room for a row of them: one column, full width, the label
   still over its field. */
@media (max-width: 46rem) {
  .content :is(.inline-form, .filters) {
    grid-auto-flow: row; grid-template-rows: none; grid-template-columns: minmax(0, 1fr);
  }
  .content :is(.inline-form, .filters) > :is(label, input, select, textarea, button, a, .button) { grid-row: auto; }
  .content :is(.inline-form, .filters) > label:has(input[type="checkbox"]) { grid-row: auto; }
  .content :is(.inline-form, .filters) > :is(input, select) { width: 100%; }
  .content :is(.inline-form, .filters) > :is(button, .button) { justify-self: start; margin-top: 0.4rem; }
}

/* --- Label printer ---------------------------------------------------------
   A queued 62 mm label, as the printer's head will print it. On white in both
   themes, because it is a picture of paper. */
.label-preview {
  height: 2.6rem; width: auto; flex: none;
  background: #fff; border: 1px solid var(--line); border-radius: 4px;
  image-rendering: auto;
}
/* "Queue their labels" sits in the sentence that says what was taken in. */
.saved form.inline { display: inline; margin: 0 0 0 0.35rem; }
.saved form.inline button.link { min-height: 0; padding: 0; }

/* ---------------------------------------------------------------------------
   Drawer — a whole task folded behind one line on a busy screen ("Book this
   again"). A native <details>, so it opens with script off; the summary reads
   as the task and its one-line explanation, the chevron says it opens.
   --------------------------------------------------------------------------- */
.content .drawer {
  margin-top: 1.75rem;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px rgb(7 21 37 / 0.06);
}
.content .drawer > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.75rem;
  row-gap: 0.15rem;
  padding: 1rem 3rem 1rem 1.2rem;
  position: relative;
  font-weight: 650;
  font-size: 1.05rem;
  border-radius: var(--radius-lg);
}
.content .drawer > summary::-webkit-details-marker { display: none; }
.content .drawer > summary .hint { font-weight: 400; font-size: 0.9rem; margin: 0; }
.content .drawer > summary::after {
  content: "";
  position: absolute;
  right: 1.3rem;
  top: 1.35rem;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--text-dim);
  border-bottom: 2px solid var(--text-dim);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}
.content .drawer[open] > summary::after { transform: rotate(-135deg); top: 1.6rem; }
.content .drawer > summary:hover { background: var(--bg-sunken); }
.content .drawer > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.content .drawer > form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
  padding: 0.25rem 1.2rem 1.25rem;
  border-top: 1px solid var(--line);
  padding-top: 1.1rem;
}
.content .drawer > form > :not(.half) { grid-column: 1 / -1; }
.content .drawer > form .half { display: grid; gap: 0.35rem; min-width: 0; }
.content .drawer > form .half label { margin: 0; }
.content .drawer > form .hint, .content .drawer > form .actions { margin: 0; }

/* A choice between a few named options, each a card you can press anywhere on. */
.content .choices { border: 0; margin: 0; padding: 0; display: grid; gap: 0.5rem; min-width: 0; }
.content .choices legend { font-weight: 600; padding: 0; margin-bottom: 0.45rem; }
.content .choices label {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin: 0;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}
.content .choices label:hover { border-color: var(--line-strong); }
.content .choices label:has(input:checked) { border-color: var(--accent); background: var(--accent-wash); }
.content .choices input[type="radio"] { margin: 0.2rem 0 0; accent-color: var(--accent); flex: none; }
.content .choices small { display: block; font-weight: 400; color: var(--text-dim); margin-top: 0.15rem; }

@media (max-width: 640px) {
  .content .drawer > form { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .content .drawer > summary::after, .content .choices label { transition: none; }
}

/* Connection — one outside account per card: what it is, whether it is on,
   and the one thing an Owner can do about it. */
.content .connection {
  margin-top: 1.25rem;
  padding: 1.2rem 1.3rem 1.3rem;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px rgb(7 21 37 / 0.06);
  display: grid;
  gap: 0.85rem;
  max-width: 46rem;
}
.content .connection > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.content .connection > header h2 { margin: 0; }
.content .connection > header .hint { margin: 0.15rem 0 0; }
.content .connection > p, .content .connection > .facts, .content .connection > .actions,
.content .connection > form { margin: 0; }
.content .connection code { font-size: 0.9em; }

/* The customer's card button on a portal invoice: the one call to action on
   the page, so it is large; never printed, because paper cannot be pressed. */
.paper .pay { display: grid; gap: 0.5rem; justify-items: start; margin: 0.25rem 0 1rem; }
.paper .pay button { font-size: 1.05rem; padding: 0.8rem 1.4rem; }
.paper .pay .hint { margin: 0; }
@media print { .paper .pay { display: none; } }

/* Quotes sent — each version a row: number, when, how, what it came to. */
.content .quote-history { margin-top: 1.25rem; display: grid; gap: 0.75rem; }
.content .quote-history h3 { margin: 0; }
.content .quote-history .notice ul, .content .quote-history .versions ul { margin: 0.35rem 0 0; padding-left: 1.2rem; }
.content .quote-history .notice p { margin: 0; }
.content .quote-history .versions {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
}
.content .quote-history .versions > li { padding: 0.75rem 1rem; border-top: 1px solid var(--line); }
.content .quote-history .versions > li:first-child { border-top: 0; }
.content .quote-history .version-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.9rem;
}
.content .quote-history .version-head .num { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.content .quote-history details { margin-top: 0.35rem; }

/* A read-only value with its copy button beside it. */
.content .copy-field { display: grid; gap: 0.35rem; }
.content .copy-field label { margin: 0; }
.content .copy-field > div { display: flex; gap: 0.5rem; min-width: 0; }
.content .copy-field input { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9rem; }
.content .copy-field button { margin: 0; flex: none; }

/* ---------------------------------------------------------------------------
   The print box flasher — a bench tool with a page of its own. The brand's
   navy stage with the board drawn beside the steps; every colour from the
   theme tokens, so it reads in day and night alike.
   --------------------------------------------------------------------------- */
.flasher-app {
  min-height: 100vh;
  background:
    radial-gradient(60rem 30rem at 85% -10%, var(--accent-wash), transparent 70%),
    var(--bg);
  color: var(--text);
}
.flasher-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem max(1.25rem, env(safe-area-inset-right)) 1rem max(1.25rem, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
}
.flasher-brand { display: flex; align-items: center; gap: 0.9rem; min-width: 0; }
.flasher-brand img { height: 2.6rem; width: auto; }
.flasher-tool {
  padding-left: 0.9rem;
  border-left: 1px solid var(--line-strong);
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  white-space: nowrap;
}
.flasher-back { color: var(--text-dim); text-decoration: none; font-weight: 600; white-space: nowrap; margin-right: 3.5rem; }
/* The bare layout's day/night switch, lifted into the flasher's own bar rather
   than sitting in a strip above it. */
body:has(.flasher-app) .bare-chrome {
  position: absolute;
  top: 0;
  right: 0;
  padding: 0.95rem max(1.25rem, env(safe-area-inset-right)) 0 0;
  z-index: 2;
}
.flasher-app [hidden] { display: none !important; }
.flasher-back:hover { color: var(--accent); }
.flasher-main { max-width: 68rem; margin: 0 auto; padding: 2.25rem 1.25rem 4rem; }
.flasher-hero h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -0.02em; text-wrap: balance; }
.flasher-hero p { margin: 0.6rem 0 0; max-width: 40rem; color: var(--text-dim); font-size: 1.08rem; }
.flasher-grid {
  display: grid;
  grid-template-columns: minmax(0, 17rem) minmax(0, 1fr);
  gap: 2rem;
  margin-top: 2rem;
  align-items: start;
}
.flasher-board { margin: 0; position: sticky; top: 1.5rem; text-align: center; }
.flasher-board svg { width: 100%; max-width: 15rem; height: auto; }
.flasher-board .lid-through { fill: #050b08; }
.flasher-board .lid-body { fill: #1d4a33; stroke: #2f6a4b; stroke-width: 0.3; }
.flasher-board .lid-graphic { fill: #c9ced3; }
.flasher-board .lid-graphic.power { fill: var(--accent); animation: lid-glow 1.8s ease-in-out infinite; }
@keyframes lid-glow { 50% { opacity: 0.45; } }
.flasher-board .cable { fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; opacity: 0.85; }
.flasher-board .lid-word { font: 600 3.4px system-ui, sans-serif; fill: var(--accent); }
.flasher-board figcaption { color: var(--text-dim); font-size: 0.92rem; margin-top: 0.5rem; }
.flasher-lights { margin-top: 2rem; padding: 1.25rem 1.5rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg-raised); }
.flasher-lights h2 { margin: 0 0 0.25rem; font-size: 1.1rem; }
.flasher-lights > p { margin: 0 0 1rem; color: var(--text-dim); }
.flasher-lights ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.flasher-lights li { display: grid; grid-template-columns: 1.4rem 10rem 1fr; gap: 0.75rem; align-items: start; }
.flasher-lights li > span:last-child { color: var(--text-dim); min-width: 0; }
.flasher-lights .light { width: 1.1rem; height: 1.1rem; margin-top: 0.15rem; border-radius: 50%; background: var(--light); box-shadow: 0 0 0.6rem var(--light), inset 0 0 0 1px rgb(0 0 0 / 0.2); }
.flasher-lights .light.steady { animation: none; }
.box-light { flex: none; width: 0.85rem; height: 0.85rem; border-radius: 50%; background: var(--light); box-shadow: 0 0 0.5rem var(--light), inset 0 0 0 1px rgb(0 0 0 / 0.2); }
.box-light.steady { animation: none; }
.box-light.blink { animation: light-blink 1s steps(1, end) infinite; }
.box-light.flicker { animation: light-blink 0.24s steps(1, end) infinite; }
.box-light.breathe { animation: light-breathe 2.4s ease-in-out infinite; }
.box-light.unknown { background: var(--bg-sunken); box-shadow: none; border: 2px solid var(--line-strong); }
.flasher-lights .light.blink { animation: light-blink 1s steps(1, end) infinite; }
.flasher-lights .light.flicker { animation: light-blink 0.24s steps(1, end) infinite; }
.flasher-lights .light.breathe { animation: light-breathe 2.4s ease-in-out infinite; }
@keyframes light-blink { 50% { opacity: 0.08; box-shadow: none; } }
@keyframes light-breathe { 0%, 100% { opacity: 0.12; } 50% { opacity: 1; } }
@keyframes flasher-pulse { 50% { stroke-opacity: 0.35; } }
.flasher-card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgb(7 21 37 / 0.08);
  padding: 1.5rem;
  display: grid;
  gap: 1.25rem;
  min-width: 0;
}
.flasher-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.9rem 1rem; }
.flasher-form .field { display: grid; gap: 0.35rem; min-width: 0; }
.flasher-form label { font-weight: 600; margin: 0; }
.flasher-form .skip { grid-column: 1 / -1; display: flex; gap: 0.5rem; align-items: center; font-weight: 500; color: var(--text-dim); }
.flasher-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; counter-reset: flasher; }
.flasher-steps > li {
  counter-increment: flasher;
  display: grid;
  grid-template-columns: 2rem 1fr;
  column-gap: 0.85rem;
  align-items: center;
  padding: 0.55rem 0;
}
.flasher-steps > li::before {
  content: counter(flasher);
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  color: var(--text-dim);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.flasher-steps > li > span { font-weight: 600; color: var(--text-dim); }
.flasher-steps > li > small { color: var(--text-dim); min-height: 1.1em; }
.flasher-steps > li[data-state="current"]::before { background: var(--accent); border-color: var(--accent); color: var(--on-accent); animation: flasher-pulse 1.2s ease-in-out infinite; }
.flasher-steps > li[data-state="current"] > span,
.flasher-steps > li[data-state="done"] > span { color: var(--text); }
.flasher-steps > li[data-state="done"]::before { content: "✓"; background: var(--accent-wash); border-color: var(--accent); color: var(--accent); }
.flasher-steps > li[data-state="skipped"]::before { content: "–"; }
.flasher-steps > li[data-state="failed"]::before { content: "!"; background: var(--danger-wash); border-color: var(--danger); color: var(--danger); }
.flasher-meter { grid-column: 2; height: 0.45rem; margin-top: 0.45rem; border-radius: 999px; background: var(--bg-sunken); overflow: hidden; }
.flasher-meter > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s linear; }
.flasher-actions { display: flex; gap: 0.75rem; }
.flasher-go {
  font-size: 1.05rem;
  font-weight: 650;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius);
  border: 0;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
}
.flasher-go.quiet { background: transparent; color: var(--text); border: 1px solid var(--line-strong); }
.flasher-go:disabled { opacity: 0.6; cursor: progress; }
.flasher-go:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.flasher-done {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  background: var(--accent-wash);
  border: 1px solid var(--accent);
}
.flasher-done .tick {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 1.4rem;
  font-weight: 700;
}
.flasher-done strong { font-size: 1.1rem; }
.flasher-done p { margin: 0.2rem 0 0; color: var(--text-dim); }
.flasher-batch { border-top: 1px solid var(--line); padding-top: 0.9rem; color: var(--text-dim); font-size: 0.92rem; }
.flasher-batch ul { margin: 0.35rem 0 0; padding-left: 1.2rem; color: var(--text); }
.flasher-error { margin: 0; padding: 0.75rem 0.95rem; border-radius: var(--radius); background: var(--danger-wash); color: var(--danger); border: 1px solid var(--danger); }
.flasher-note { margin: 1.5rem 0 0; padding: 0.75rem 0.95rem; border-radius: var(--radius); background: var(--bg-sunken); color: var(--text); }
.flasher-card .flasher-note { margin: 0; }
.flasher-log summary { cursor: pointer; color: var(--text-dim); font-size: 0.9rem; }
.flasher-log pre { max-height: 14rem; overflow: auto; font-size: 0.78rem; white-space: pre-wrap; margin: 0.5rem 0 0; color: var(--text-dim); }
@media (max-width: 820px) {
  .flasher-grid { grid-template-columns: 1fr; }
  .flasher-board { position: static; }
  .flasher-board svg { max-width: 14rem; }
  .flasher-lights li { grid-template-columns: 1.4rem 1fr; }
  .flasher-lights li > span:last-child { grid-column: 2; }
  .flasher-form { grid-template-columns: 1fr; }
  .flasher-done { grid-template-columns: auto 1fr; }
  .flasher-done .flasher-go { grid-column: 1 / -1; }
}
@media (max-width: 520px) { .flasher-tool { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .flasher-board .lid-graphic.power, .flasher-lights .light, .box-light, .flasher-steps > li[data-state="current"]::before { animation: none; }
  .flasher-meter > i { transition: none; }
}

/* A file's columns, one chip each, so a long header wraps between names. */
.columns { display: inline-flex; flex-wrap: wrap; gap: 0.3rem 0.35rem; vertical-align: top; }
.columns code { white-space: nowrap; }

/* A page's own buttons sit under its lede, and need room from whatever comes
   next — the diary's "From" was touching its calendar button. */
.content > .lede + .actions { margin-top: -0.75rem; margin-bottom: 1.5rem; }

/* --- Small disclosures ------------------------------------------------------
   A details that is not a drawer: one line that opens on more. The browser's
   black triangle at body size sat beside drawers with a chevron on the same
   page; this is the drawer's chevron, smaller, turning as it opens. */
.content details:not(.drawer, .subnav-area, .tab, .flasher-log) > summary {
  list-style: none; display: inline-flex; align-items: center; gap: 0.35rem;
  cursor: pointer; color: var(--text-dim); font-weight: 600; font-size: 0.88rem;
  padding: 0.2rem 0; width: fit-content;
}
.content details:not(.drawer, .subnav-area, .tab, .flasher-log) > summary::-webkit-details-marker { display: none; }
.content details:not(.drawer, .subnav-area, .tab, .flasher-log) > summary::before {
  content: ""; flex: none; width: 0.75rem; height: 0.75rem; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4 2.5 7.5 6 4 9.5' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4 2.5 7.5 6 4 9.5' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 0.15s ease;
}
.content details[open]:not(.drawer, .subnav-area, .tab, .flasher-log) > summary::before { transform: rotate(90deg); }
.content details:not(.drawer, .subnav-area, .tab, .flasher-log) > summary:hover { color: var(--accent); }
.content details:not(.drawer, .subnav-area, .tab, .flasher-log)[open] > summary { margin-bottom: 0.5rem; }

/* The diary's later weeks sit off a phone's right edge with nothing to say
   they are there. Shown only where the grid cannot fit. */
.scroll-hint { display: none; margin: 0 0 0.4rem; font-size: 0.8rem; color: var(--text-dim); }
@media (max-width: 46rem) { .scroll-hint { display: block; } }

/* --- Trees and filters --------------------------------------------------- */
.rows.tree > li { padding-left: calc(1rem + var(--depth, 0) * 1.4rem); }
/* A row the filter hid: .rows > li sets display, which outranks the hidden attribute. */
.rows > li[hidden] { display: none; }
.rows.tree > li[style*="--depth: 0"] { font-weight: 600; }
.list-filter { max-width: 22rem; margin: 0 0 0.85rem; }

/* What a delivery just made: the numbers, and the next thing to do with them. */
.content .receipt {
  display: grid; gap: 0.4rem; margin: 0 0 1.25rem; padding: 0.9rem 1.1rem;
  background: var(--brand-wash); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: inset 4px 0 0 var(--brand);
}
.content .receipt strong { font-size: 1.05rem; }
.content .receipt .actions { margin: 0.35rem 0 0; }

/* Ten recovery codes, two columns, big enough to read off paper. */
.content .recovery-codes {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.35rem 1.5rem; margin: 0.6rem 0 0.9rem; padding-left: 1.5rem; font-size: 1.05rem;
}

/* Setting up a new warehouse: a short numbered list, done steps struck through. */
.content .setup {
  margin: 0 0 1.5rem; padding: 1rem 1.15rem; max-width: 46rem;
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: inset 4px 0 0 var(--accent);
}
.content .setup h2 { margin: 0 0 0.6rem; font-size: 1.02rem; }
.content .setup ol { margin: 0; padding-left: 1.3rem; display: grid; gap: 0.45rem; }
.content .setup li { display: grid; gap: 0.1rem; }
.content .setup li a { font-weight: 600; }
.content .setup li.done { color: var(--text-dim); text-decoration: line-through; }

/* Today on the home screen: three short columns, each a list of jobs to touch. */
.content .today {
  display: grid; gap: 0.75rem; margin: 0 0 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}
.content .today > div {
  display: grid; gap: 0.35rem; align-content: start; min-width: 0;
  padding: 0.85rem 1rem; background: var(--bg-raised);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.content .today h2 { margin: 0 0 0.2rem; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }
.content .today p { margin: 0; }
.content .today > div[hidden] { display: none; }
.content .today a { display: grid; text-decoration: none; padding: 0.35rem 0.5rem; margin-inline: -0.5rem; border-radius: var(--radius); }
.content .today a:hover { background: var(--accent-wash); }
.content .today a strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* "Which unit is in your hand?" — first on the page, and focused, so after
   each check-in the next scan goes straight in. */
.content .jump {
  max-width: 26rem; padding: 0.75rem 0.9rem; margin-bottom: 1rem;
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: 0 6px 18px rgb(7 21 37 / 0.08);
}
.content .jump .hint { margin: 0.4rem 0 0; color: var(--danger); }
.content .card-form.jumped { outline: 2px solid var(--accent); outline-offset: 3px; scroll-margin-top: 7rem; }
.content .card-form { scroll-margin-top: 7rem; }
.content .rows.checks > li.jumped { box-shadow: inset 4px 0 0 var(--accent); }
/* The unit's own picture beside its name: what it is, before anything is done to it. */
.content .confirm-shot {
  width: 3.25rem; height: 3.25rem; object-fit: cover; border-radius: var(--radius);
  vertical-align: middle; margin-right: 0.6rem; border: 1px solid var(--line);
}
.rows.filtered-out { display: none; }
/* A file being dragged over a file box: say it can be let go here. */
input[type="file"].dropping { border-color: var(--accent); background: var(--accent-wash); color: var(--accent); }
/* Checkboxes and radios in the app's colour and the theme's: the browser's
   own were a bright white square on the dark theme. */
:root { accent-color: var(--accent); }

/* --- Rows on a phone ----------------------------------------------------------
   Every row the same shape: what it is on the first line, everything about it
   on the second. Left to wrap on their own, rows in one list broke in three
   different places depending on how long each name happened to be. */
@media (max-width: 30rem) {
  .rows > li > .grow { flex-basis: 100%; }
}


/* Never smaller than 16px in a box somebody types in, on a touch screen.
   iOS zooms the page in on focus for anything smaller, and leaves it zoomed —
   the screen then slides left and right under the thumb. The small fold-outs
   (details.small) shrank their boxes to 13.6px and did exactly that. */
@media (pointer: coarse) {
  input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]),
  select,
  textarea {
    font-size: max(16px, 1em);
  }
}

/* --- Gears, the assistant ------------------------------------------------ */
/* The button in the header: the same quiet chip as Go to, with the accent on
   its cog so it reads as the one that talks back. */
:root button.gears-open {
  display: inline-flex; align-items: center; gap: 0.45rem;
  min-height: 2.25rem; padding: 0.3rem 0.65rem 0.3rem 0.55rem;
  background: var(--bg-sunken); border: 1px solid var(--line); color: var(--text-dim);
  font-size: 0.9rem; font-weight: 600; white-space: nowrap; box-shadow: none;
}
:root button.gears-open:hover { background: var(--accent-wash); border-color: var(--accent); color: var(--accent); }
.gears-glyph { color: var(--accent); flex: none; }
@media (max-width: 720px) { .gears-open .gears-label { display: none; } :root button.gears-open { padding: 0.3rem 0.5rem; } }

/* The panel: a drawer down the right on a desk, the whole screen on a phone. */
dialog.gears {
  position: fixed; inset: 0 0 0 auto; margin: 0; padding: 0;
  width: min(30rem, 100vw); height: 100dvh; max-height: none; max-width: 100vw;
  display: none; flex-direction: column;
  background: var(--bg-raised); color: var(--text);
  border: 0; border-left: 1px solid var(--line);
  box-shadow: -18px 0 40px rgb(7 21 37 / 0.18);
}
dialog.gears[open] { display: flex; animation: gears-in 0.18s ease-out; }
dialog.gears::backdrop { background: rgb(7 21 37 / 0.35); }
@keyframes gears-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { dialog.gears[open] { animation: none; } }

.gears-head {
  display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 0.1rem 0.5rem;
  padding: calc(env(safe-area-inset-top, 0px) + 0.85rem) 0.75rem 0.75rem 1.1rem;
  border-bottom: 1px solid var(--line);
}
.gears-head strong { font-size: 1.1rem; }
.gears-head .gears-sub { grid-column: 1; grid-row: 2; font-size: 0.82rem; color: var(--text-dim); }
:root .gears-head button.gears-new { grid-row: 1 / span 2; padding: 0.3rem 0.7rem; font-size: 0.85rem; background: transparent; border: 1px solid var(--line); color: var(--text); box-shadow: none; }
:root .gears-head button.gears-close {
  grid-row: 1 / span 2; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--text-dim); box-shadow: none;
}
:root .gears-head button.gears-close:hover { background: var(--bg-sunken); color: var(--text); }

/* Read aloud: a speaker that lights up when on; the waves show only then. */
:root .gears-head button.gears-speak {
  grid-row: 1 / span 2; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--text-dim); box-shadow: none;
}
:root .gears-head button.gears-speak[aria-pressed="true"] { background: var(--accent-wash); border-color: var(--accent); color: var(--accent); }
.gears-speak .gears-speak-waves { opacity: 0; }
.gears-speak[aria-pressed="true"] .gears-speak-waves { opacity: 1; }

.gears-log { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.gears-hello p { margin: 0 0 0.85rem; color: var(--text-dim); }
.gears-try { display: grid; gap: 0.45rem; }
:root .gears-try button {
  text-align: left; justify-content: flex-start; font-weight: 500; font-size: 0.92rem;
  background: var(--bg); color: var(--text); border: 1px solid var(--line); box-shadow: none;
}
:root .gears-try button:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-wash); }

.gears-msg { max-width: 88%; padding: 0.6rem 0.8rem; border-radius: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.gears-msg.mine { align-self: flex-end; background: var(--accent); color: var(--on-accent, #fff); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.gears-msg.theirs { align-self: flex-start; background: var(--bg-sunken); border-bottom-left-radius: 4px; }
.gears-msg.waiting { color: var(--text-dim); font-style: italic; }
.gears-text p { margin: 0 0 0.5rem; }
.gears-text p:last-child { margin-bottom: 0; }
.gears-links { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }
.gears-links .button { min-height: 2.4rem; font-size: 0.9rem; }

.gears-ask { display: flex; gap: 0.5rem; align-items: flex-end; padding: 0.75rem 0.9rem 0.4rem; border-top: 1px solid var(--line); }
.gears-ask textarea { flex: 1; resize: none; min-height: 2.75rem; max-height: 8rem; margin: 0; field-sizing: content; }
.gears-ask button { min-height: 2.75rem; }
/* The mic: round, beside the box; red and breathing while it listens. */
:root .gears-ask button.gears-mic {
  display: grid; place-items: center; width: 2.75rem; padding: 0; flex: none;
  border: 1px solid var(--line); border-radius: 50%; background: var(--bg); color: var(--text); box-shadow: none;
}
:root .gears-ask button.gears-mic:hover { border-color: var(--accent); color: var(--accent); }
:root .gears-ask button.gears-mic[aria-pressed="true"] {
  background: var(--danger); border-color: var(--danger); color: #fff; animation: gears-listen 1.2s ease-in-out infinite;
}
@keyframes gears-listen { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--danger) 25%, transparent); } }
@media (prefers-reduced-motion: reduce) { :root .gears-ask button.gears-mic[aria-pressed="true"] { animation: none; } }
.gears-foot { margin: 0; padding: 0 1rem calc(env(safe-area-inset-bottom, 0px) + 0.6rem); font-size: 0.75rem; color: var(--text-dim); }
