/* Shared by the staff app (index.html), the shop (shop/, with shop.css on top) and privacy.html.
   One rule per thing: when a look changes, change it here rather than adding an override below. */

/* ---------- Tokens: "Groundwater & Marigold" (docs/design-plan.md) ----------
   Groundwater for structure (rail, headings, links, selected), Marigold for the one thing to do next
   (primary action, the duty point), Galvanised for the ground, Slip for working surfaces. */
:root {
  /* Palette */
  --groundwater: #0D3B47;
  --groundwater-2: #145566;   /* hover / pressed */
  --marigold: #F2A20C;
  --marigold-2: #DB8F00;      /* hover / pressed */
  --galvanised: #E9EDEC;
  --slip: #FFFFFF;
  --riser: #5E7A80;
  --ink: #16252B;
  --hairline: #CDD6D6;
  --well-wall: #DCE3E2;
  --shallow: #BFE0DD;
  /* Roles (every component uses these) */
  --bg: var(--galvanised);
  --surface: var(--slip);
  --surface-2: #F1F4F3;
  --zebra: #F4F6F5;
  --line: #DCE3E2;
  --line-2: var(--hairline);
  --text: var(--ink);
  --muted: #4F6A70;
  --faint: #546F75;          /* small hints: 4.5:1 on Slip, Galvanised and zebra rows */
  --accent: var(--groundwater);
  --accent-hover: var(--groundwater-2);
  --accent-ink: #FFFFFF;
  --accent-soft: #DCEDEB;
  --act: var(--marigold);           /* the primary action */
  --act-hover: var(--marigold-2);
  --act-ink: var(--groundwater);    /* text on Marigold: never white */
  --rail: var(--groundwater);       /* navigation rail and bottom bar */
  --rail-ink: #E4EFEE;
  --rail-muted: #9FC1C3;
  --sun: var(--marigold);
  /* Status colours double as text on their -soft tint, so each passes 4.5:1 on it. */
  --ok: #17703F;   --ok-soft: #DDF0E3;
  --warn: #8A5A00; --warn-soft: #FCEFCF;
  --crit: #B0322A; --crit-soft: #FBE3E0;
  --info: #1E5899; --info-soft: #E1ECF9;
  /* Depth: nothing rests on a shadow; only overlays (dialogs, sheets, menus, toasts) float. */
  --shadow: none;
  --lift: inset 0 0 0 1px var(--line-2);
  --float: 0 12px 32px rgb(13 59 71 / .18);
  --paper: #ffffff; --paper-ink: #1b252b; --paper-muted: #5f6d74; --paper-line: #dfe5e8;
  /* Type: Barlow Condensed for titles, figures and pump models; Lexend for reading (plain zero, so 0 and the phase sign Ø never look alike);
     Atkinson Hyperlegible Mono only for codes and serials. */
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Lexend", "Segoe UI", system-ui, sans-serif;
  --mono: "Atkinson Hyperlegible Mono", ui-monospace, Menlo, Consolas, monospace;
  --t-xs: 13px; --t-sm: 14px; --t-md: 16px; --t-lg: 20px; --t-xl: 26px; --t-2xl: 34px; --t-fig: 44px;
  /* Spacing: 4px steps on a 24px rhythm */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 72px;
  /* Corners say what a thing is: ledgers and panels (read) 4px, controls (press, type) 10px, chips round,
     phone sheets 20px at the top. sm/lg/xl are the older names, kept for every rule that uses them. */
  --r-ledger: 4px; --r-control: 10px; --r-chip: 999px; --r-sheet: 20px;
  --r-sm: 4px; --r-md: var(--r-control); --r-lg: var(--r-ledger); --r-xl: 8px; --r-pill: var(--r-chip);
}
/* Night shift: a deep groundwater night, not near-black */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0B1D23; --surface: #12282F; --surface-2: #17313A; --zebra: #152D35; --line: #21404A; --line-2: #2C4F5A;
    --text: #E4ECEB; --ink: #E4ECEB; --muted: #A6BCBF; --faint: #93ABAF;
    --accent: #7FC4C9; --accent-hover: #9AD3D6; --accent-ink: #082228; --accent-soft: #1A3E46;
    --act: #F5B33A; --act-hover: #F7C15F; --act-ink: #0B1D23;
    --rail: #071519; --rail-ink: #E4ECEB; --rail-muted: #8FB0B3; --shallow: #1E4B53; --well-wall: #21404A;
    --ok: #5CCB91; --ok-soft: #12321F; --warn: #EBB54C; --warn-soft: #382A0E; --crit: #F08177; --crit-soft: #3B1A17; --info: #86B1F2; --info-soft: #152943;
    --float: 0 12px 32px rgb(0 0 0 / .45);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B1D23; --surface: #12282F; --surface-2: #17313A; --zebra: #152D35; --line: #21404A; --line-2: #2C4F5A;
  --text: #E4ECEB; --ink: #E4ECEB; --muted: #A6BCBF; --faint: #93ABAF;
  --accent: #7FC4C9; --accent-hover: #9AD3D6; --accent-ink: #082228; --accent-soft: #1A3E46;
  --act: #F5B33A; --act-hover: #F7C15F; --act-ink: #0B1D23;
  --rail: #071519; --rail-ink: #E4ECEB; --rail-muted: #8FB0B3; --shallow: #1E4B53; --well-wall: #21404A;
  --ok: #5CCB91; --ok-soft: #12321F; --warn: #EBB54C; --warn-soft: #382A0E; --crit: #F08177; --crit-soft: #3B1A17; --info: #86B1F2; --info-soft: #152943;
  --float: 0 12px 32px rgb(0 0 0 / .45);
}

/* ---------- Base ----------
   Nothing may be wider than the screen (otherwise iOS lets the whole page slide sideways and the
   header and nav move with it), and the page doesn't rubber-band. */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { overscroll-behavior: none; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--barh, 72px) + 8px); }
body { background: var(--bg); color: var(--text); font: var(--t-md)/1.5 var(--body); padding-inline: 16px; padding-block: 0 40px; overflow-x: clip; overscroll-behavior: none; max-width: 100vw; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { min-width: 0; max-width: 100%; }
input[type="date"], input[type="time"] { -webkit-appearance: none; appearance: none; display: block; width: 100%; min-height: 44px; text-align: left; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code, .mono { font-family: var(--mono); font-size: .88em; }
h1, h2, h3 { font-family: var(--display); margin: 0; text-wrap: balance; letter-spacing: 0; color: var(--text); }
h2 { font-size: var(--t-xl); font-weight: 700; line-height: 1.15; }
h3 { font-size: var(--t-lg); font-weight: 600; line-height: 1.3; }
/* Figures line up in columns everywhere */
body { font-variant-numeric: tabular-nums; }
p { margin: 0; }
a[href^="tel"] { color: inherit; text-decoration: none; }
/* iPhones zoom into any box with text under 16px when you tap it, and the page then stays zoomed and
   slides about as you scroll. 16px on touch screens stops that. */
@media (max-width: 760px), (pointer: coarse) {
  input, select, textarea, .input, .field input, .field select, .field textarea { font-size: 16px !important; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- App shell: header and sections ----------
   The header is fixed, not sticky: iPhones and iPads move a sticky header late during a fling, so
   the page showed above it and then jumped once scrolling stopped. Its height is kept in --barh by
   the app so the page starts below it. Phones and tablets get the sections as a bar along the
   bottom; computers get them in the header (shop) or a sidebar (staff app, body.staff). */
.app { max-width: 1240px; margin: 0 auto; padding-top: var(--barh, 72px); display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.bar { position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex; align-items: center; gap: 16px; background: var(--surface); border-bottom: 1px solid var(--line); padding: calc(12px + env(safe-area-inset-top, 0px)) max(16px, calc((100% - 1240px) / 2)) 12px; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; min-width: 0; }
.brand svg { flex: none; }
.brand-logo { flex: none; width: 50px; aspect-ratio: 218 / 192; background: currentColor; -webkit-mask: url(icons/kohinoor-logo.png) center / contain no-repeat; mask: url(icons/kohinoor-logo.png) center / contain no-repeat; }
.gate-card .brand-logo { width: 84px; }
.brand > div { min-width: 0; }
.brand-name { font: 600 19px/1.1 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; min-width: 0; }
.brand-sub #conn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.live { background: var(--ok); }
.dot.off { background: var(--crit); }
.user-chip { order: 2; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.user-chip b { color: var(--text); font-weight: 600; }
.user-chip .btn.ghost { min-height: 40px; padding: 6px 8px; }
.user-chip .theme-lbl, #signOutBtn span { display: none; }
.role-tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent); }
.theme-btn { min-height: 40px; padding: 6px 10px !important; gap: 6px; }
.theme-btn svg { width: 20px; height: 20px; flex: none; }
.theme-lbl { font-size: 13px; }
/* Sections in the header: a grey track, icons with the open one named; names only on wide screens.
   Labels stay for screen readers and tooltips. */
/* Header tabs (the pump selector on a computer): text, the open one underlined in Marigold */
nav.tabs { order: 1; display: flex; gap: 4px; max-width: 100%; background: none; border-radius: 0; padding: 0; }
nav.tabs button { position: relative; border: 0; background: transparent; padding: 8px 12px; border-radius: var(--r-sm); cursor: pointer; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
nav.tabs button svg { width: 20px; height: 20px; flex: none; }
nav.tabs button .lbl { display: none; }
nav.tabs button[aria-current="page"] .lbl { display: inline; }
nav.tabs button:hover { background: var(--surface-2); color: var(--text); }
nav.tabs button[aria-current="page"] { background: none; color: var(--accent); box-shadow: inset 0 -3px 0 var(--act); border-radius: 0; }
.tabs .count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--crit); color: #fff; font: 600 12px/1 var(--body); margin-left: 2px; }
nav.tabs .count { position: absolute; top: 1px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; font-size: 10.5px; margin: 0; }
nav.tabs .count.dotonly { min-width: 0; width: 9px; height: 9px; padding: 0; font-size: 0; }
.nav-group, .nav-scan kbd { display: none; }
@media (min-width: 1240px) {
  nav.tabs button svg { display: none; }
  nav.tabs button .lbl { display: inline; }
  nav.tabs button { padding: 9px 14px; font-size: 15px; }
  nav.tabs .count { position: static; margin-left: 6px; }
}
@media (max-width: 1023px) {
  body { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .bar { gap: 8px; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; }
  .bar .brand { flex: 1 1 0; }
  .brand-name { font-size: 17px; }
  .user-chip { flex: none; gap: 4px; }
  .user-chip .who { display: none; }
  .role-tag { font-size: 10px; padding: 2px 6px; }
  .theme-btn { width: 40px; padding: 0 !important; }
  /* The bottom bar: an icon over a short name, every one the same width */
  /* The bottom bar on Groundwater; the open section in Marigold */
  nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; gap: 0; justify-content: space-around; background: var(--rail); border-top: 0; border-radius: 0; padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px)); box-shadow: none; }
  nav.tabs button, nav.tabs button[aria-current="page"] { flex: 1 1 0; min-width: 0; min-height: 54px; flex-direction: column; justify-content: center; gap: 3px; padding: 6px 0 5px; font-size: 12px; line-height: 1.2; background: transparent; box-shadow: none; color: var(--rail-muted); }
  nav.tabs button:hover { background: transparent; color: var(--rail-ink); }
  nav.tabs button[aria-current="page"] { color: var(--act); font-weight: 700; }
  nav.tabs :focus-visible { outline-color: var(--act); }
  nav.tabs button .lbl { display: inline; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  nav.tabs button svg { width: 24px; height: 24px; }
  nav.tabs .count { top: 3px; left: calc(50% + 6px); right: auto; }
}
@media (min-width: 600px) and (max-width: 1023px) { nav.tabs { padding-inline: max(4px, calc((100% - 600px) / 2)); } }

/* Staff app on phones and tablets: three sections around a raised Scan button, the rest under More
   (the app picks the three by role and sets --slot). The account is in More too. */
@media (max-width: 1023px) {
  .staff .bar .user-chip { display: none; }
  .staff nav.tabs > * { order: var(--slot, 9); }
  .staff nav.tabs .in-more { display: none; }
  .staff nav.tabs .nav-scan { order: 3; flex: 0 0 64px; align-self: flex-start; height: 56px; min-height: 0; margin: -18px 6px 0; padding: 0; border-radius: var(--r-control); background: var(--act); color: var(--act-ink); box-shadow: 0 0 0 4px var(--rail); }
  .staff nav.tabs .nav-scan:hover { background: var(--act-hover); color: var(--act-ink); }
  .staff nav.tabs .nav-scan svg { width: 28px; height: 28px; }
  .staff nav.tabs .nav-scan .lbl { display: none; }
  .staff nav.tabs .nav-more { order: 10; }
  .staff nav.tabs .nav-more.on { color: var(--act); }
}
/* Staff app on computers: the sections in a sidebar, grouped, with Scan at the top and the account
   at the bottom. */
@media (min-width: 1024px) {
  body.staff { padding-left: calc(248px + 32px); padding-right: 32px; }
  .staff .app { padding-top: 28px; }
  /* The Groundwater rail: the business, Scan in Marigold, the sections, the person at the foot */
  .staff .bar { right: auto; bottom: 0; width: 248px; flex-direction: column; align-items: stretch; gap: 18px; overflow-y: auto; border: 0; background: var(--rail); color: var(--rail-ink); padding: calc(24px + env(safe-area-inset-top, 0px)) 14px 16px; }
  .staff .bar .brand { margin: 0; padding: 0 6px; }
  .staff .bar .brand-logo { width: 64px; }
  .staff .bar .brand-name { color: var(--rail-ink); font-size: var(--t-lg); font-weight: 700; }
  .staff .bar .brand-sub { color: var(--rail-muted); }
  .staff .bar .brand-name, .staff .bar .brand-sub #conn { white-space: normal; }
  .staff nav.tabs { flex-direction: column; gap: 2px; background: none; border-radius: 0; padding: 0; }
  .staff nav.tabs button { min-height: 44px; padding: 0 10px; border-radius: var(--r-sm); gap: 12px; font-size: 15px; color: var(--rail-ink); }
  .staff nav.tabs button svg { display: block; color: var(--rail-muted); }
  .staff nav.tabs button .lbl { display: inline; flex: 1; text-align: left; }
  .staff nav.tabs button:hover { background: rgb(255 255 255 / .07); color: #fff; }
  /* The open section: a Marigold bar on its left edge */
  .staff nav.tabs button[aria-current="page"] { background: rgb(255 255 255 / .1); color: #fff; box-shadow: inset 3px 0 0 var(--act); }
  .staff nav.tabs button[aria-current="page"] svg { color: var(--act); }
  .staff nav.tabs .count { position: static; margin: 0; }
  .staff .nav-group { display: block; font-size: var(--t-xs); font-weight: 600; color: var(--rail-muted); padding: 16px 10px 6px; }
  .staff nav.tabs .nav-scan { order: -1; min-height: 48px; margin-bottom: 4px; justify-content: center; gap: 8px; background: var(--act); color: var(--act-ink); font-weight: 700; border-radius: var(--r-control); }
  .staff nav.tabs .nav-scan svg { color: currentColor; }
  .staff nav.tabs .nav-scan .lbl { flex: none; }
  .staff nav.tabs .nav-scan:hover { background: var(--act-hover); color: var(--act-ink); }
  .staff .nav-scan kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: var(--r-sm); background: rgb(13 59 71 / .14); font: 500 12px var(--mono); }
  .staff nav.tabs .nav-more { display: none; }
  .staff .bar .user-chip { order: 2; margin-top: auto; flex-wrap: wrap; gap: 6px 8px; padding: 14px 6px 0; border-top: 1px solid rgb(255 255 255 / .14); color: var(--rail-muted); }
  .staff .bar .user-chip .who { flex: 1 1 100%; font-size: 15px; }
  .staff .bar .user-chip b { color: var(--rail-ink); }
  .staff .bar .role-tag { background: rgb(255 255 255 / .12); color: var(--rail-ink); }
  .staff .bar .user-chip .btn.ghost { color: var(--rail-muted); }
  .staff .bar .user-chip .btn.ghost:hover { background: rgb(255 255 255 / .08); color: #fff; }
  .staff .bar :focus-visible { outline-color: var(--act); }
}
/* The More sheet */
.more-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.more-tile { position: relative; display: grid; justify-items: center; align-content: center; gap: 8px; min-height: 96px; padding: 10px 6px; border: 1px solid transparent; border-radius: var(--r-lg); background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 14px; text-align: center; cursor: pointer; }
.more-tile svg { width: 40px; height: 40px; padding: 9px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent); }
.more-tile[aria-current] { border-color: var(--accent); }
.more-tile .count { position: absolute; top: 8px; right: 8px; margin: 0; }
.more-list { display: grid; gap: 2px; border-top: 1px solid var(--line); padding-top: 10px; }
.more-list .menu-item.danger, .more-list .menu-item.danger svg { color: var(--crit); }
.more-list [data-theme-btn] .theme-lbl { font-size: 15px; }
.more-list [data-theme-btn] .theme-lbl::before { content: "Appearance: "; }
@media (min-width: 761px) { dialog.more-dlg { width: min(460px, calc(100vw - 24px)); } }
@media (max-width: 760px) { .more-dlg .dlg { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); } }

/* ---------- Page structure ---------- */
/* Phones: the page's own explanation gives way to the work; the header buttons share one row. */
@media (max-width: 760px) {
  .view-head > div > p { display: none; }
  .view-head > .head-actions { width: 100%; flex-wrap: nowrap; }
  .head-actions > .btn, .head-actions > details { flex: 1 1 auto; }
  .head-actions > details > summary.btn { width: 100%; }
  .head-actions .btn { padding-inline: 12px; font-size: 14px; }
  .head-actions > .btn:not(.primary) > svg:first-child { display: none; }
}
.view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.view-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 20px; }
.view-head h2 { font: 700 34px/1.1 var(--display); letter-spacing: -.015em; }
.view-head p { color: var(--muted); max-width: 62ch; margin-top: 6px; font-size: 15.5px; }
@media (max-width: 760px) { .view-head h2 { font-size: 28px; } .hide-sm { display: none; } }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.head-actions { flex-wrap: wrap; gap: 8px; align-items: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.ta-r { text-align: right; }
.err { color: var(--crit); font-size: 14px; }
.section-t { font-size: 13px; font-weight: 700; color: var(--muted); }
.section-t .hint { text-transform: none; letter-spacing: 0; font-weight: 400; }
/* Nothing inside a card can be wider than it. */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; display: grid; gap: 14px; align-content: start; min-width: 0; max-width: 100%; }
.card > * { min-width: 0; }
.card.raised { box-shadow: var(--shadow); }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.empty { padding: 44px 20px; text-align: center; display: grid; gap: 8px; justify-items: center; color: var(--muted); }
.empty h3 { color: var(--text); }
.empty .row { justify-content: center; margin-top: 6px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.col { display: grid; gap: 18px; min-width: 0; }
.sticky { position: sticky; top: calc(var(--barh, 72px) + 14px); }
@media (max-width: 960px) { .split { grid-template-columns: minmax(0, 1fr); } .sticky { position: static; } }
/* Sell and other two-column screens: the totals card stays in view while you scroll the items */
@media (min-width: 961px) { .split > aside.col { align-self: stretch; align-content: start; } }
.step-head { display: flex; align-items: center; gap: 10px; }
.step { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font: 600 14px var(--display); flex: none; }

/* ---------- Buttons, pills, banners ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; max-width: 100%; border: 1px solid var(--line-2); background: var(--surface); padding: 9px 16px; border-radius: var(--r-md); cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn svg { width: 18px; height: 18px; flex: none; }
/* Primary: Marigold with Groundwater text, the one thing to do next on a screen. */
.btn.primary { background: var(--act); border-color: var(--act); color: var(--act-ink); font-weight: 700; }
.btn.primary:hover { background: var(--act-hover); border-color: var(--act-hover); color: var(--act-ink); }
/* "Solid": the strong action repeated on every card in a list, in Groundwater, so Marigold stays rare. */
.btn.solid, .lc .btn.primary, .pcard:not(.top) .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.solid:hover, .lc .btn.primary:hover, .pcard:not(.top) .btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn.ghost { min-height: 40px; border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--accent); background: var(--accent-soft); }
.btn.danger { color: var(--crit); border-color: var(--line-2); }
.btn.danger.armed { background: var(--crit); color: #fff; border-color: var(--crit); }
.btn.big { padding: 13px 20px; font-size: 16px; width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.cam-start { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.cam-start:hover { background: var(--accent-hover); color: var(--accent-ink); }
.addrow .btn, .pcard .btn { white-space: normal; text-align: center; line-height: 1.25; }
/* Links styled as buttons (WhatsApp, Call, Send from my WhatsApp) look like the other buttons, not like links */
a.btn, a.btn:visited { color: var(--text); text-decoration: none; }
a.btn:hover { color: var(--accent); }
a.btn.primary, a.btn.primary:visited, a.btn.primary:hover { color: var(--act-ink); }
a.btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.icon-btn { border: 0; background: transparent; cursor: pointer; color: var(--faint); width: 30px; height: 30px; border-radius: var(--r-sm); display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--surface-2); color: var(--crit); }
.linkish { background: none; border: 0; color: var(--accent); cursor: pointer; font-weight: 600; padding: 0; }
/* Long badges wrap instead of widening the page. */
.pill { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: var(--r-pill); white-space: normal; overflow-wrap: break-word; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.low, .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.out, .pill.err { background: var(--crit-soft); color: var(--crit); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.neutral { background: var(--surface-2); color: var(--muted); }
.st-new { background: var(--info-soft); color: var(--info); }
.st-quoted { background: var(--warn-soft); color: var(--warn); }
.st-confirmed, .st-dispatched { background: var(--ok-soft); color: var(--ok); }
.st-closed, .st-cancelled { background: var(--surface-2); color: var(--muted); }
.banner { border-radius: var(--r-md); padding: 12px 16px; background: var(--warn-soft); color: var(--warn); font-weight: 500; }
/* "New shops to approve" banner on Stock and Enquiries, with a dark Review button */
.approve-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--warn-soft); color: var(--text); border-radius: var(--r-lg); padding: 14px 16px 14px 20px; }
.approve-banner svg { width: 20px; height: 20px; color: var(--warn); flex: none; }
.approve-banner span { flex: 1 1 200px; min-width: 0; font-size: 14px; }
.approve-banner .btn { background: var(--text); border-color: var(--text); color: var(--bg); }
.approve-banner .btn:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
@media (max-width: 760px) {
  .approve-banner { flex-wrap: nowrap; padding: 8px 8px 8px 12px; }
  .approve-banner span { flex: 1 1 0; font-size: 13px; }
  .approve-banner .btn { min-height: 36px; padding: 6px 12px; }
}
.pending-box { margin-top: 12px; padding: 10px 12px; border-radius: var(--r-md); background: var(--warn-soft); color: var(--ink, inherit); font-size: 14px; }

/* ---------- Forms ---------- */
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fields .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .fields, .fields.three { grid-template-columns: 1fr; } }
.field { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea, .input { width: 100%; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 9px 12px; font-size: 15px; font-weight: 400; color: var(--text); }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); outline-offset: 0; }
.field textarea { resize: vertical; min-height: 64px; }
.hint { font-weight: 400; font-size: 12px; color: var(--faint); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.choices { display: grid; gap: 8px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-md); cursor: pointer; background: var(--surface); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { flex: none; margin-top: 3px; accent-color: var(--accent); }
.choice b { display: block; }
.choice > span { display: grid; gap: 2px; min-width: 0; }
.choice.off { opacity: .5; cursor: not-allowed; }
.copy-grid { display: grid; gap: 6px; margin-top: 8px; }
.copy-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 10px; align-items: center; overflow-wrap: anywhere; }
@media (max-width: 520px) { .copy-row { grid-template-columns: minmax(0, 1fr) auto; } .copy-row > span { grid-column: 1 / -1; } }

/* ---------- Figures ---------- */
/* One strip of figures, divided, instead of four separate cards */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ledger); overflow: hidden; }
.stat { background: none; border: 0; border-left: 1px solid var(--line); border-radius: 0; padding: 14px 22px 16px; display: grid; gap: 2px; align-content: start; }
.stat:first-child { border-left: 0; }
.stat .k { font-size: var(--t-sm); color: var(--muted); font-weight: 500; order: 2; }
.stat .v { font: 700 40px/1.05 var(--display); order: 1; }
.stat .s { font-size: var(--t-xs); color: var(--faint); order: 3; }
.stat.attn .v { color: var(--crit); }
.stat.way .v { color: var(--info); }
button.stat { font: inherit; color: inherit; text-align: left; cursor: pointer; }
button.stat:hover { background: var(--accent-soft); }
@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 10px 14px 12px; }
  .stat:nth-child(odd) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .stat .v { font-size: 30px; }
}
body.role-warehouse .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { body.role-warehouse .stat { padding: 12px; } body.role-warehouse .stat .s { display: none; } }
body.role-warehouse .money { display: none !important; }

/* ---------- Search, filters, segmented tabs ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.search { position: relative; flex: 1 1 260px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--faint); }
.search input { padding-left: 38px; }
.toolbar .search input, .toolbar select.input { min-height: 48px; border-color: var(--line); background: var(--surface); }
.toolbar select.input { padding-inline: 14px 34px; font-weight: 600; }
.toolbar .search svg { left: 16px; }
.toolbar .search input { padding-left: 44px; }
/* Phones: the search across the top, the filters sharing the row under it */
@media (max-width: 760px) {
  .toolbar .search { flex-basis: 100%; }
  .toolbar > select.input { flex: 1 1 0; min-height: 44px; padding-inline: 10px 26px; }
  #v-stock .toolbar > #stockLevel { flex-basis: 100%; }
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--r-pill); padding: 5px 12px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); }
.chip b { font-weight: 500; color: var(--faint); margin-left: 4px; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip[aria-pressed="true"] b { color: var(--accent-ink); opacity: .8; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--r-md); padding: 4px; }
.seg button { border: 0; background: transparent; padding: 8px 16px; border-radius: var(--r-sm); cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--lift); }

/* ---------- Stock: product list ----------
   Two ways to see it (the Photos / List switch): photo cards, or a ledger with one aligned row per
   product. Phones get the same choice: a two-column photo grid, or rows with a small photo. */
.list-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.view-mode button { padding: 6px 14px; }
.phead { display: none; }
.prow { width: 100%; display: grid; gap: 4px 12px; align-items: center; border: 0; background: transparent; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.p-main { grid-area: main; min-width: 0; } .p-stock { grid-area: stock; } .p-spec { grid-area: spec; } .p-price { grid-area: price; } .p-cat { grid-area: cat; } .prow .p-img { grid-area: img; }
.p-name { font-weight: 600; display: block; overflow-wrap: anywhere; }
.p-meta { font-size: var(--t-xs); color: var(--muted); display: block; }
.p-meta code { color: var(--accent); font-size: 13px; }
.p-cat { font-size: var(--t-sm); color: var(--muted); }
.p-spec { font-size: var(--t-sm); }
.p-spec small, .p-price small { display: block; color: var(--faint); font-size: 12px; }
.p-stock { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; }
/* The water-column gauge: a well-wall track, filled from the bottom to what's on hand, with what's on
   the way as a dashed segment above it */
.gauge { position: relative; flex: none; width: 12px; height: 32px; border-radius: 2px; background: var(--well-wall); overflow: hidden; }
.gauge i { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--have) * 100%); background: var(--accent); }
.gauge s { position: absolute; left: 1px; right: 1px; bottom: calc(var(--have) * 100%); height: calc(var(--way) * 100%); border: 1.5px dashed var(--info); border-bottom: 0; text-decoration: none; }
.gauge.low i { background: var(--warn); }
.g-txt { display: grid; gap: 1px; min-width: 0; }
.g-st { font-size: var(--t-xs); font-weight: 600; }
.g-st.ok { color: var(--ok); } .g-st.low { color: var(--warn); } .g-st.out { color: var(--crit); }
.g-way { color: var(--info); font-weight: 600; }
.p-stock b { font: 700 22px/1 var(--display); }
.p-stock span.u { color: var(--faint); font-size: var(--t-xs); }
.p-img { display: grid; place-items: center; background: var(--surface-2); border-radius: var(--r-sm); overflow: hidden; color: var(--faint); }
.p-img:not(.none) { background: #fff; }
.p-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.p-img svg { width: 40%; max-width: 40px; height: auto; }
.p-photo { display: grid; place-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--r-ledger); padding: 8px; }
.p-photo img { max-width: 100%; max-height: 240px; object-fit: contain; }

/* Photos: cards with the photo on top */
.plist:not(.as-ledger) { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.plist:not(.as-ledger) > .empty { grid-column: 1 / -1; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ledger); }
.plist:not(.as-ledger) .prow { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "img img" "cat cat" "main main" "spec price" "stock stock"; align-items: start; align-content: start; gap: 6px 12px; padding: 12px 12px 14px; border: 1px solid var(--line); border-radius: var(--r-ledger); background: var(--surface); }
body.role-warehouse .plist:not(.as-ledger) .prow { grid-template-areas: "img img" "cat cat" "main main" "spec spec" "stock stock"; }
.plist:not(.as-ledger) .prow:hover { border-color: var(--accent); }
.plist:not(.as-ledger) .p-img { aspect-ratio: 4 / 3; width: 100%; margin-bottom: 4px; }
.plist:not(.as-ledger) .p-cat { font-size: 12px; font-weight: 600; color: var(--faint); }
.plist:not(.as-ledger) .p-price { text-align: right; }
.plist:not(.as-ledger) .p-stock { margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--line); }
@media (max-width: 760px) {
  .plist:not(.as-ledger) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .plist:not(.as-ledger) .prow { grid-template-columns: minmax(0, 1fr); grid-template-areas: "img" "main" "spec" "price" "stock"; padding: 8px 10px 10px; gap: 4px; }
  .plist:not(.as-ledger) .p-img { aspect-ratio: 1; }
  .plist:not(.as-ledger) .p-cat { display: none; }
  .plist:not(.as-ledger) .p-name { font-size: var(--t-sm); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .plist:not(.as-ledger) .p-meta { overflow-wrap: anywhere; }
  .plist:not(.as-ledger) .p-price { text-align: left; font-size: var(--t-sm); }
}

/* List: a ledger with column headings, zebra rows and the same columns on every row */
.plist.as-ledger { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ledger); overflow: hidden; }
.plist.as-ledger .prow { padding: 10px 18px; }
.plist.as-ledger .prow:nth-of-type(even) { background: var(--zebra); }
.plist.as-ledger .prow:hover { background: var(--accent-soft); }
.plist.as-ledger .prow .p-img { width: 44px; height: 44px; }
@media (min-width: 761px) {
  .plist.as-ledger .phead, .plist.as-ledger .prow { grid-template-columns: 44px minmax(0, 2.4fr) minmax(0, .8fr) minmax(0, 1fr) 150px 200px; grid-template-areas: "img main cat spec price stock"; column-gap: 16px; }
  body.role-warehouse .plist.as-ledger .phead, body.role-warehouse .plist.as-ledger .prow { grid-template-columns: 44px minmax(0, 2.4fr) minmax(0, .8fr) minmax(0, 1fr) 200px; grid-template-areas: "img main cat spec stock"; }
  .plist.as-ledger .phead { display: grid; padding: 10px 18px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: var(--t-xs); font-weight: 600; color: var(--muted); }
  .plist.as-ledger .phead > :nth-child(1) { grid-area: img; } .plist.as-ledger .phead > :nth-child(2) { grid-area: main; } .plist.as-ledger .phead > :nth-child(3) { grid-area: cat; }
  .plist.as-ledger .phead > :nth-child(4) { grid-area: spec; } .plist.as-ledger .phead > :nth-child(5) { grid-area: price; text-align: right; } .plist.as-ledger .phead > :nth-child(6) { grid-area: stock; }
  .plist.as-ledger .p-price { text-align: right; }
}
@media (max-width: 760px) {
  .plist.as-ledger .prow { grid-template-columns: 44px minmax(0, 1fr) auto; grid-template-areas: "img main main" "img stock stock" "img spec price"; gap: 4px 12px; padding: 10px 14px; }
  body.role-warehouse .plist.as-ledger .prow { grid-template-areas: "img main main" "img stock stock" "img spec spec"; }
  .plist.as-ledger .prow .p-img { align-self: start; }
  .plist.as-ledger .p-spec { font-size: var(--t-xs); color: var(--muted); }
  .plist.as-ledger .p-price { text-align: right; font-size: var(--t-xs); }
  .plist.as-ledger .p-cat { display: none; }
}

/* ---------- Scanning ---------- */
.scan-box { display: flex; gap: 10px; flex-wrap: wrap; }
.scan-field { flex: 1 1 220px; min-width: 0; display: flex; align-items: center; gap: 10px; border: 2px dashed var(--line-2); border-radius: var(--r-lg); padding: 10px 14px; background: var(--surface-2); cursor: text; transition: border-color .15s, background .15s; }
.scan-field svg { width: 26px; height: 26px; color: var(--faint); flex: none; }
.scan-field input { flex: 1; min-width: 0; border: 0; background: transparent; font: 500 17px var(--mono); outline: none; padding: 6px 0; }
.scan-state { font-size: 12px; font-weight: 600; color: var(--faint); white-space: nowrap; }
.scan-field.armed { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.scan-field.armed svg, .scan-field.armed .scan-state { color: var(--accent); }
@media (max-width: 760px) { .scan-state { display: none; } }
.scan-help { font-size: 13px; color: var(--faint); }
.active-hint { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--info-soft); color: var(--info); border-radius: var(--r-md); padding: 10px 14px; font-weight: 500; }
.active-hint .btn { padding: 5px 12px; font-size: 13px; margin-left: auto; }
.feedback { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-radius: var(--r-md); padding: 11px 14px; font-weight: 500; }
.feedback.ok { background: var(--ok-soft); color: var(--ok); }
.feedback.warn { background: var(--warn-soft); color: var(--warn); }
.feedback.err { background: var(--crit-soft); color: var(--crit); }
.feedback.info { background: var(--info-soft); color: var(--info); }
.feedback .btn { padding: 5px 12px; font-size: 13px; margin-left: auto; }
@media (prefers-reduced-motion: no-preference) { .feedback.flash { animation: flash .35s ease; } @keyframes flash { from { transform: scale(.985); opacity: .6; } to { transform: none; opacity: 1; } } }
.picker { display: flex; gap: 8px; flex: 1 1 240px; min-width: 0; max-width: 460px; }
.picker input { flex: 1; min-width: 0; }
.cam { position: fixed; inset: 0; z-index: 200; background: #000; margin: 0; padding: 0; border: 0; width: 100%; height: 100%; max-width: none; max-height: none; }
.cam video { width: 100%; height: 100%; object-fit: cover; }
.cam-frame { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.cam-frame span { width: min(86vw, 560px); height: min(36vh, 240px); border-radius: var(--r-lg); box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); border: 3px solid rgba(255,255,255,.9); }
.cam-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px; color: #fff; }
.cam-title { font: 600 17px var(--display); margin-right: auto; }
.cam-btn { border: 0; border-radius: var(--r-pill); padding: 10px 18px; font-weight: 700; background: rgba(255,255,255,.18); color: #fff; cursor: pointer; }
.cam-btn[data-close] { background: #fff; color: #111; }
.cam-btn.on { background: #f0a31a; color: #111; }
.cam-status { position: absolute; left: 16px; right: 16px; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); margin: 0 auto; max-width: 560px; background: rgba(20,28,32,.86); color: #fff; border-radius: var(--r-lg); padding: 14px 16px; font-weight: 600; text-align: center; }
.cam-status.ok { background: rgba(22,122,74,.95); }
.cam-status.warn { background: rgba(143,92,0,.95); }
.cam-status.err { background: rgba(181,53,46,.95); }
.cam-status.info { background: rgba(36,90,166,.95); }
body.cam-open { overflow: hidden; }

/* ---------- Item lines (receiving, selling, checking) ---------- */
.lines { display: grid; gap: 10px; min-width: 0; max-width: 100%; }
.line { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; display: grid; gap: 10px; min-width: 0; max-width: 100%; }
.line.is-active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.line-top { display: flex; gap: 12px; align-items: flex-start; min-width: 0; max-width: 100%; }
.line-top .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.line-top > .pill { flex: none; white-space: nowrap; }
.line-nums { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; }
.mini { display: grid; gap: 3px; font-size: 12px; color: var(--muted); font-weight: 600; }
.mini input { width: 92px; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 6px 8px; background: var(--surface); font-variant-numeric: tabular-nums; }
.mini input.rate { width: 120px; }
.mini input.disc { width: 76px; }
.mini .val { font: 600 18px/32px var(--display); color: var(--text); font-variant-numeric: tabular-nums; }
.stepper { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; }
.stepper button { width: 32px; border: 0; background: var(--surface-2); cursor: pointer; font-size: 17px; color: var(--muted); }
.stepper button:hover { color: var(--accent); }
.stepper input { width: 58px; border: 0; border-radius: 0; text-align: center; padding: 6px 0; }
.serials { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; max-width: 100%; }
.sn { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; overflow-wrap: anywhere; font: 500 12px/1 var(--mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 4px 4px 4px 8px; }
.sn button { border: 0; background: transparent; cursor: pointer; color: var(--faint); font-size: 14px; line-height: 1; padding: 0 3px; }
.sn button:hover { color: var(--crit); }
.sn.plain { padding-right: 8px; }
.sn.new { border-color: var(--info); }
.sn.ok { padding-right: 8px; background: var(--ok-soft); border-color: transparent; color: var(--ok); cursor: pointer; }
.sn.warn { padding-right: 8px; background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.sn.err { padding-right: 8px; background: var(--crit-soft); border-color: var(--crit); color: var(--crit); text-decoration: line-through; }
.sn.info { background: var(--info-soft); border-color: transparent; color: var(--info); }
/* Pump + motor billing lines: code and amount on top, product, then qty × rate — the same at every width */
.enq-split { display: grid; gap: 6px; margin-top: 8px; padding: 8px 10px; border-radius: var(--r-md); background: var(--surface-2); }
.bill-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "id total" "name name" "calc calc"; gap: 2px 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 10px; min-width: 0; }
.bill-id { grid-area: id; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.bill-id code { font: 500 12.5px var(--mono); color: var(--accent); }
.bill-id .pill { flex: none; }
.bill-total { grid-area: total; font: 600 15px var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; align-self: center; }
.bill-name { grid-area: name; font-size: 13px; min-width: 0; overflow-wrap: anywhere; }
.bill-calc { grid-area: calc; font-variant-numeric: tabular-nums; }
.totals { display: grid; gap: 6px; min-width: 0; max-width: 100%; font-variant-numeric: tabular-nums; }
.totals .tr { display: flex; justify-content: space-between; gap: 10px; }
.totals .tr span:first-child { color: var(--muted); }
.totals .grand { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; font: 600 22px var(--display); }
.totals .grand span:first-child { color: var(--text); }
.words { font-size: 13px; color: var(--muted); }
.sell-dock { display: none; }
@media (max-width: 960px) {
  .sell-dock { position: fixed; z-index: 25; left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); max-width: 600px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; border-radius: var(--r-lg); background: var(--text); color: var(--bg); box-shadow: var(--float); transition: opacity .15s, transform .15s; }
  .sell-dock .grow { flex: 1; min-width: 0; display: grid; }
  .sell-dock .muted { color: inherit; opacity: .75; }
  .sell-dock b { font: 700 20px/1.15 var(--display); font-variant-numeric: tabular-nums; }
  .sell-dock .btn.primary { background: var(--surface); border-color: var(--surface); color: var(--text); }
  .sell-dock.away { opacity: 0; transform: translateY(12px); pointer-events: none; }
  #v-sell:not([hidden]) { padding-bottom: 72px; }
}
.warnlist { display: grid; gap: 6px; }

/* ---------- Record lists (records, purchases, parties, shops) ---------- */
.rlist { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
/* Every row is its own grid, so the date and amount columns have fixed widths: with an "auto" column each
   row sized it to its own amount and the other columns moved from row to row. */
.rrow { width: 100%; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) 120px 150px; gap: 12px; align-items: center; padding: 13px 18px; border: 0; background: transparent; text-align: left; cursor: pointer; color: inherit; font: inherit; }
/* Zebra rows instead of a rule under every row */
.rlist > .rrow:nth-of-type(even) { background: var(--zebra); }
.rrow:first-child { border-top: 0; }
.rrow:hover, .rlist > .rrow:hover { background: var(--accent-soft); }
.rrow .no { font: 500 14px var(--mono); color: var(--accent); overflow-wrap: anywhere; min-width: 0; }
.rrow .amt { font: 600 16px var(--display); text-align: right; font-variant-numeric: tabular-nums; }
/* Records and Purchases: the number column doesn't need a third of the row */
#rlist .rrow, #puList .rrow { grid-template-columns: minmax(150px, .8fr) minmax(0, 2.4fr) 120px 150px; }
.rrow .when { font-variant-numeric: tabular-nums; white-space: nowrap; }
.rrow > .amt, .rrow .pr-amt { justify-self: end; text-align: right; }
.rrow.party-row { grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) 120px 150px; }
#recStats:empty, #puStats:empty { display: none; }
@media (max-width: 640px) {
  .rrow, #rlist .rrow, #puList .rrow { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; }
  .rrow .when { display: none; }
  .rrow .no { grid-column: 1 / -1; }
}
/* Parties on phones: name and amount on top, contact underneath */
@media (max-width: 760px) {
  .rrow.party-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main amt" "contact contact"; row-gap: 6px; }
  .party-row .pr-main { grid-area: main; min-width: 0; }
  .party-row .pr-amt { grid-area: amt; display: grid; justify-items: end; align-content: start; gap: 4px; text-align: right; }
  .party-row .pr-contact { grid-area: contact; display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); text-align: left; justify-self: start; }
  .party-row .pr-contact div { display: inline; }
  .party-row .when { display: none; }
}
.team-row { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.team-row:first-child { border-top: 0; }
.cust-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.cust-row:first-child { border-top: 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
table.grid { border-collapse: collapse; width: 100%; font-size: 13px; }
table.grid th, table.grid td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
table.grid th { background: var(--surface-2); vertical-align: top; }
table.grid th select { width: 100%; min-width: 130px; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 4px 6px; background: var(--surface); font-size: 12px; }
table.grid th .hdr { display: block; font-weight: 600; margin-bottom: 4px; color: var(--muted); }
table.grid td .pill { white-space: nowrap; }
.ptable { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.ptable th, .ptable td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.ptable th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.ptable td.n, .ptable th.n { text-align: right; }
.ptable input { width: 100%; min-width: 64px; padding: 6px 8px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); text-align: right; }
/* Party statement on phones: one card per line instead of a 7-column table */
@media (max-width: 760px) {
  .stmt-wrap { border: 0; overflow: visible; }
  .stmt, .stmt tbody { display: block; }
  .stmt thead { display: none; }
  .stmt tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "date amt" "det det" "st bal"; gap: 4px 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 8px; background: var(--surface); position: relative; }
  table.grid.stmt td { display: block; border: 0; padding: 0; max-width: none; overflow: visible; white-space: normal; text-align: left; }
  .stmt .st-date { grid-area: date; font-size: 12.5px; color: var(--muted); }
  .stmt .st-det { grid-area: det; font-weight: 600; }
  table.grid.stmt .st-dr, table.grid.stmt .st-cr { grid-area: amt; text-align: right; font: 600 15px var(--display); }
  .stmt .st-dr:empty, .stmt .st-cr:empty { display: none; }
  .stmt .st-cr:not(:empty) { color: var(--ok); }
  .stmt .st-cr:not(:empty)::before { content: "− "; }
  table.grid.stmt .st-bal { grid-area: bal; text-align: right; font-size: 13px; color: var(--muted); font-weight: 500 !important; }
  .stmt .st-bal::before { content: "Balance "; }
  .stmt .st-st { grid-area: st; }
}

/* ---------- Import ---------- */
.drop { border: 2px dashed var(--line-2); border-radius: var(--r-lg); padding: 30px 20px; text-align: center; display: grid; gap: 8px; justify-items: center; cursor: pointer; background: var(--surface-2); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop svg { width: 36px; height: 36px; color: var(--accent); }
.progress { height: 8px; background: var(--surface-2); border-radius: var(--r-pill); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

/* ---------- Dialogs ---------- */
dialog { border: 0; border-radius: var(--r-xl); padding: 0; background: var(--surface); color: var(--text); width: min(680px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: var(--float); }
dialog.wide { width: min(900px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(12,24,28,.45); }
.dlg { display: grid; gap: 16px; padding: 22px; }
.dlg-head { display: flex; align-items: flex-start; gap: 12px; }
.dlg-head .grow { flex: 1; min-width: 0; }
.dlg-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 16px; }
.dlg-foot .row { margin-left: auto; }
.close { border: 0; background: var(--surface-2); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 18px; color: var(--muted); flex: none; }
.close:hover { color: var(--text); }
.kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.kv div { background: var(--surface-2); border-radius: var(--r-md); padding: 10px 12px; }
.kv b { display: block; font: 600 20px var(--display); font-variant-numeric: tabular-nums; }
.kv span { font-size: 12px; color: var(--muted); }
.barcode-box { background: #fff; border-radius: var(--r-md); padding: 10px; display: flex; justify-content: center; border: 1px solid var(--line); }
.barcode-box svg { max-width: 100%; height: 70px; }
/* Phones: every pop-up is a sheet from the bottom, with its buttons kept in reach at the bottom */
@media (max-width: 760px) {
  dialog, dialog.wide { width: 100%; max-width: 100%; margin: auto 0 0; max-height: 94vh; max-height: 94dvh; border-radius: var(--r-sheet) var(--r-sheet) 0 0; overscroll-behavior: contain; }
  dialog > .dlg, dialog > form.dlg { padding: 10px 16px 0; gap: 14px; }
  dialog > .dlg::before, dialog > form.dlg::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 0 auto -4px; }
  dialog .dlg-head h3 { font-size: 19px; }
  dialog .dlg-foot { padding: 14px 0 calc(16px + env(safe-area-inset-bottom, 0px)); gap: 8px; }
  dialog .dlg-foot > span:empty { display: none; }
  dialog .dlg-foot .row { margin-left: 0; width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  dialog .dlg-foot .row .btn { width: 100%; min-height: 42px; padding: 8px 10px; font-size: 14px; white-space: normal; line-height: 1.2; }
  dialog .dlg-foot .row .btn.primary { grid-column: 1 / -1; order: -1; min-height: 48px; font-size: 15px; }
  dialog .dlg-foot .row .btn.danger:not(.armed) { border-color: transparent; background: transparent; }
  dialog .dlg-foot .row [data-close] { display: none; } /* the × at the top closes it */
  #vBody > .row > .small[style*="text-align:right"] { text-align: left !important; }
  #vDlg .totals .grand { font-size: 18px; }
}
/* Header action menus ("More") */
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary svg { width: 16px; height: 16px; transition: transform .15s; }
details.menu[open] > summary svg { transform: rotate(180deg); }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 25; min-width: 250px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--float); padding: 6px; display: grid; gap: 2px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: transparent; border-radius: var(--r-md); padding: 10px 12px; min-height: 44px; font-weight: 600; color: var(--text); cursor: pointer; white-space: nowrap; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); color: var(--accent); }
.menu-item svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
@media (max-width: 760px) { .menu-pop { right: 0; left: auto; max-width: calc(100vw - 16px); } }

/* ---------- Dispatch note / invoice preview ----------
   A full page on wide screens; on phones the lines become cards. */
.paper-wrap { overflow-x: auto; container-type: inline-size; }
.paper { background: var(--paper); color: var(--paper-ink); border: 1px solid var(--paper-line); border-radius: var(--r-md); padding: 24px; font-size: 13px; display: grid; gap: 16px; min-width: 0; }
.paper .muted { color: var(--paper-muted); }
.paper h4 { margin: 0; font: 600 20px var(--display); }
.paper .top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
.paper .title { font: 700 13px var(--body); letter-spacing: .12em; text-transform: uppercase; color: #0a7480; }
.paper table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.paper th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--paper-muted); border-bottom: 1.5px solid var(--paper-ink); padding: 6px; }
.paper td { border-bottom: 1px solid var(--paper-line); padding: 7px 6px; vertical-align: top; }
.paper .num { text-align: right; white-space: nowrap; }
.paper .sns { font: 11px var(--mono); color: var(--paper-muted); margin-top: 3px; }
.paper .sum { margin-left: auto; width: min(300px, 100%); display: grid; gap: 4px; }
.paper .sum div { display: flex; justify-content: space-between; }
.paper .sum .g { font: 700 16px var(--display); border-top: 1.5px solid var(--paper-ink); padding-top: 6px; }
@container (max-width: 620px) {
  .paper { padding: 16px; }
  .paper .top > div[style*="text-align:right"] { text-align: left !important; }
  .paper table, .paper tbody { display: block; }
  .paper thead { display: none; }
  .paper tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "item amt" "q q"; gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--paper-line); }
  .paper tbody td { display: block; border: 0; padding: 0; }
  .paper td.c-no, .paper td.c-hsn, .paper td.c-rate, .paper td.c-disc, .paper td.c-tax, .paper td.c-gst { display: none; }
  .paper td.c-item { grid-area: item; min-width: 0; overflow-wrap: anywhere; }
  .paper td.c-amt { grid-area: amt; font: 700 15px var(--display); }
  .paper td.c-qty { display: inline; grid-row: 2; grid-column: 1 / -1; text-align: left; font-size: 12px; color: var(--paper-muted); }
  .paper td.c-qty::after { content: attr(data-x); }
  .paper .sum { width: 100%; }
}

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: var(--r-pill); font-weight: 600; z-index: 50; max-width: calc(100vw - 32px); text-align: center; }
@media (max-width: 1023px) { .toast { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); } }

/* ---------- Sign-in ---------- */
/* On Groundwater, the form left-aligned on a Slip panel (phones: the panel fills the width) */
.gate { position: fixed; inset: 0; z-index: 100; background: var(--rail); display: grid; place-items: center start; padding: 24px max(16px, 9vw); overflow-y: auto; }
.gate .gate-card { border: 0; border-radius: var(--r-ledger); }
.gate-card h1 { font: 700 var(--t-2xl)/1.05 var(--display); }
@media (max-width: 560px) { .gate { place-items: center stretch; padding-inline: 16px; } }
.gate-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow); padding: 28px 24px; display: grid; gap: 16px; }
.gate-card h1 { font-size: 24px; }
.gate-card .brand { margin: 0; }
.gate-card form { display: grid; gap: 12px; }
.gate-msg { border-radius: var(--r-md); padding: 10px 12px; font-size: 14px; }
.gate-msg.err { background: var(--crit-soft); color: var(--crit); }
.gate-msg.ok { background: var(--ok-soft); color: var(--ok); }

/* ---------- Enquiries ----------
   Cards; on computers (from 880px) the list on the left and the open enquiry beside it. */
.reply-box { display: grid; gap: 8px; }
.team-card { border-radius: var(--r-lg); }
.team-card > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.team-card > summary::-webkit-details-marker { display: none; }
.team-card > summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; flex: none; margin: 0 4px 0 auto; }
.team-card[open] > summary::after { transform: rotate(-135deg); }
.team-card:not([open]) { gap: 0; }
.enq-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.enq-cards .empty { grid-column: 1 / -1; }
.enq-card { text-align: left; display: grid; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 18px; cursor: pointer; font: inherit; color: inherit; min-width: 0; }
.enq-card:hover { border-color: var(--accent); }
.enq-card[aria-current] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ec-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.ec-top b { font: 700 17px/1.25 var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ec-top .pill { flex: none; }
.ec-meta { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.ec-foot { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.ec-foot b { font: 600 16px var(--display); color: var(--text); font-variant-numeric: tabular-nums; }
.ec-foot b small { font: 500 11.5px var(--body); color: var(--muted); }
.enq-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 0; display: grid; gap: 0; min-width: 0; overflow: hidden; }
.enq-panel .ep-head { padding: 22px 26px 16px; border-bottom: 1px solid var(--line); }
.ep-head h3 { font: 700 26px/1.15 var(--display); margin: 0; }
.ep-head p { margin: 4px 0 0; font-size: 15px; }
.ep-body { display: grid; gap: 14px; min-width: 0; }
.enq-panel .ep-body { padding: 18px 26px; }
.ep-foot { border-top: 1px solid var(--line); padding-top: 14px; }
.ep-foot .row { margin-left: 0; }
.enq-panel .ep-foot { margin: 0; padding: 16px 26px; background: var(--surface-2); }
.enq-panel .ep-foot:empty { display: none; }
.enq-panel .line { border-radius: var(--r-lg); background: var(--surface); }
@media (min-width: 880px) {
  .enq-layout { display: grid; grid-template-columns: minmax(250px, 30%) minmax(0, 1fr); gap: 16px; align-items: start; }
  /* Beside the open enquiry the list is one ledger: rows, zebra, a Groundwater bar on the open one */
  .enq-layout .enq-cards { grid-template-columns: minmax(0, 1fr); gap: 0; position: sticky; top: calc(var(--barh, 72px) + 12px); max-height: calc(100vh - var(--barh, 72px) - 24px); overflow-y: auto; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ledger); }
  .enq-layout .enq-card { border: 0; border-radius: 0; box-shadow: none; }
  .enq-layout .enq-card:nth-of-type(even) { background: var(--zebra); }
  .enq-layout .enq-card:hover { background: var(--accent-soft); }
  .enq-layout .enq-card[aria-current] { background: var(--accent-soft); box-shadow: inset 4px 0 0 var(--accent); }
  .enq-layout .ec-meta { font-size: 12.5px; }
  /* the enquiry's own content stacks so it fits a narrower column */
  .enq-panel .line-top { flex-wrap: wrap; }
  .enq-panel .enq-r { text-align: left !important; flex: 1 1 100%; }
}
@media (max-width: 760px) {
  #v-enquiries .view-head h2 { font-size: 22px; }
  #v-enquiries .toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  #v-enquiries .toolbar .search { grid-column: 1 / -1; order: -1; }
  #v-enquiries .toolbar .seg { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow-x: auto; }
  #v-enquiries .toolbar .seg button { padding-inline: 4px; }
  #v-enquiries .toolbar #enqOrder { grid-column: 1 / -1; }
  .team-card { padding: 12px 14px; }
  .team-card > summary h3 { font-size: 15px; }
  .enq-panel .ep-head, .enq-panel .ep-body, .enq-panel .ep-foot { padding-inline: 16px; }
  .enq-panel .totals .grand { font-size: 18px; }
}
@media (max-width: 560px) {
  /* Enquiry lines: prices and rate under the item instead of squeezing it */
  .line-top:has(.enq-r) { flex-wrap: wrap; }
  .enq-r { flex: 1 1 100%; text-align: left !important; }
  .enq-r .mini { display: grid !important; }
}

/* ---------- WhatsApp lead cards (Enquiries page and /shop → My leads) ---------- */
.lc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 12px; }
.lc { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); min-width: 0; }
.lc.is-new { border-color: var(--accent); }
.lc a { color: var(--accent); text-decoration: none; }
.lc-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lc-av { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font: 700 15px var(--display); }
.lc-who { display: grid; gap: 2px; min-width: 0; flex: 1; }
.lc-who b { font: 700 17px/1.2 var(--display); overflow-wrap: anywhere; }
.lc-src { flex: none; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--ok); background: var(--ok-soft); border-radius: var(--r-pill); padding: 4px 10px; }
.lc-src svg { width: 13px; height: 13px; }
.lc-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); counter-reset: s; }
.lc-steps li { position: relative; display: grid; justify-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--faint); text-align: center; }
.lc-steps li::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--surface); position: relative; z-index: 1; }
.lc-steps li + li::after { content: ""; position: absolute; top: 6px; right: 50%; width: 100%; height: 2px; background: var(--line-2); }
.lc-steps li.done, .lc-steps li.now { color: var(--text); }
.lc-steps li.done::before { background: var(--accent); border-color: var(--accent); }
.lc-steps li.now::before { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.lc-steps li.done + li::after, .lc-steps li.done + li.now::after { background: var(--accent); }
.lc-steps li.lost { color: var(--crit); }
.lc-steps li.lost::before { border-color: var(--crit); background: var(--crit-soft); }
.lc-pump { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--r-md); background: var(--surface-2); min-width: 0; }
.lc-pump.none { color: var(--muted); font-size: 14px; }
.lc-img { flex: none; width: 52px; height: 52px; border-radius: var(--r-sm); background: #fff; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); }
.lc-img img { width: 100%; height: 100%; object-fit: contain; }
.lc-pump-t { display: grid; gap: 1px; min-width: 0; flex: 1; }
.lc-pump-t b { font: 700 16px var(--display); }
.lc-mrp { flex: none; text-align: right; font: 700 15px var(--display); font-variant-numeric: tabular-nums; }
.lc-mrp small { display: block; font: 500 11px var(--body); color: var(--faint); }
.lc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lc-chip { font-size: 12.5px; padding: 3px 9px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.lc-chip b { color: var(--text); font-weight: 600; }
.lc-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lc-fields label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); min-width: 0; }
.lc-fields .full { grid-column: 1 / -1; }
.lc-fields select, .lc-fields input { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; }
.lc-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.lc-foot .row { gap: 6px; }
.lc-foot a.btn, .lc-foot a.btn:visited { color: var(--text); text-decoration: none; }
.lc-enq { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
@media (max-width: 480px) { .lc-fields { grid-template-columns: 1fr; } .lc-steps li { font-size: 10.5px; } }
/* Lead passed to a shop: the panel on the card, and the shop picker */
.lc-shop { display: grid; gap: 8px; padding: 10px 12px; border-radius: var(--r-md); border: 1px dashed var(--line-2); background: var(--surface); min-width: 0; }
.lc-shop-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; font-size: 14px; }
.lc-msgs { display: grid; gap: 4px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface-2); font-size: 13.5px; overflow-wrap: anywhere; }
.ls-list { display: grid; gap: 6px; max-height: 42vh; overflow: auto; }
.ls-list .choice { align-items: center; }
.ls-list .choice > span { flex: 1; }
.ls-list .choice .pill { flex: none; }
.ls-msg { margin: 0; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); font: 13.5px/1.45 var(--body); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- The borewell section (well.js): the app's signature drawing ---------- */
.well { display: block; width: 100%; max-width: 420px; height: auto; font-family: var(--body); }
.well .w-earth { fill: var(--well-wall); }
.well .w-shaft { fill: var(--surface); stroke: var(--riser); stroke-width: 1.5; }
.well .w-water { fill: var(--shallow); }
.well .w-level { stroke: var(--accent); stroke-width: 2.5; }
.well .w-pipe { stroke: var(--riser); stroke-width: 2; }
.well .w-pump { fill: var(--accent); }
.well .w-ground { stroke: var(--text); stroke-width: 2; }
.well .w-lead { fill: none; stroke: var(--faint); stroke-width: 1; }
.well .w-lbl { fill: var(--text); font-size: 13px; font-weight: 600; }
.well .w-head { fill: var(--accent); font: 700 30px var(--display); }
.well .w-head-k { fill: var(--muted); font-size: 12px; }
/* Where it sits: beside the details in an enquiry, above the chips on a lead card and in the selector */
.site-split { display: grid; gap: 10px 20px; align-items: start; }
.site-split:has(> .well) { grid-template-columns: minmax(0, 340px) minmax(0, 1fr); }
@media (max-width: 1100px) { .site-split:has(> .well) { grid-template-columns: minmax(0, 1fr); } }
.lc > .well { max-width: 360px; }
.site-well { display: block; margin: 6px 0 2px; }
.site-well:empty { display: none; }
/* Cards in a row share its height: the extra space goes above the footer, not inside the chips */
.lc > * { flex: none; }
.lc > .lc-foot { margin-top: auto; }
.lc-chips { align-items: flex-start; }
/* The shop said No: our choice (supply the shop, or another shop), set apart in the shop panel */
.lc-decide { display: grid; gap: 8px; padding: 10px 12px; border-radius: var(--r-ledger); background: var(--warn-soft); }
/* Dealer portal: Full / Short switch over the leads; short rows open into the full card */
.lc-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.lc-bar > .view-mode { margin-left: auto; }.lc-rows { display: grid; gap: 8px; }
.lc-row > button { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.lc-row > button b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) { .lc-row > button { grid-template-columns: auto minmax(0, 1fr); row-gap: 4px; } .lc-row > button .pill { justify-self: start; } }
.lc-row > button .lc-src, .lc-row > button .pill { justify-self: start; }
/* Long shop names: the shop box shrinks to the card and its buttons wrap instead of pushing past the right edge */
.lc-shop, .lc-decide { grid-template-columns: minmax(0, 1fr); }
.lc-shop .btn { white-space: normal; max-width: 100%; text-align: center; }
/* Phones: the lead tabs and Full / Short stay on one line */
@media (max-width: 560px) { .lc-bar { flex-wrap: nowrap; gap: 6px; } .lc-bar .seg { padding: 3px; flex: none; } .lc-bar .seg button { padding: 6px 9px; font-size: 14px; } }
@media (max-width: 400px) { .lc-bar { gap: 4px; } .lc-bar .seg { padding: 2px; } .lc-bar .seg button { padding: 6px 7px; font-size: 13px; } }
/* Lead card header: the Lead tag with Less under it, and a name column never narrower than the phone number (no overlap on phones) */
.lc-tags { flex: none; display: grid; justify-items: end; gap: 4px; }
.lc-tags .btn { min-height: 0; padding: 2px 8px; font-size: 13px; }
.lc-who { min-width: min-content; }
.lc-who a[href^="tel"] { white-space: nowrap; }

/* Brochure check before download: one block per series, products with a price box each */
.bro { display: grid; gap: 12px; }
.bro-g { border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 10px 12px; background: var(--surface); display: grid; gap: 8px; }
.bro-g.off { opacity: .6; }
.bro-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bro-h .btn { min-height: 36px; padding: 4px 10px; }
.bro-pic { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bro-img { width: 64px; height: 64px; flex: none; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.bro-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.bro-pic select { margin-left: 6px; max-width: 240px; }
.bro-r { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding-top: 8px; border-top: 1px solid var(--line); }
.bro-r.off .bro-t { opacity: .5; text-decoration: line-through; }
.bro-r input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; }
.bro-t { min-width: 0; overflow-wrap: anywhere; }
.bro-p { display: flex; align-items: center; gap: 4px; }
.bro-p input { width: 90px; text-align: right; }
@media (max-width: 520px) { .bro-r { grid-template-columns: auto 1fr; } .bro-p { grid-column: 2; } }

/* ---------- Warehouse map (warehouse.js) ---------- */
:root {
  --wh-floor: #E3E9E8; --wh-walk: #FFFFFF; --wh-walk-edge: #AFC0BE; --wh-stairs: #34474C; --wh-stairs-ink: #E4EFEE;
  --wh-pump: #4E9BA4; --wh-motor: #7FAE5B; --wh-other: #8E80BC; --wh-ink: #10242A; --wh-pillar: #6B7F84; --wh-stair-step: #8A9A9D;
  /* Sales speed, cool to marigold; grey = no sales in 90 days */
  --wh-s0: #A9B4B5; --wh-s1: #3F7EA6; --wh-s2: #4FA39B; --wh-s3: #C9B03E; --wh-s4: #EE8F0A;
  /* Weight per box, light to dark; brick = heavy */
  --wh-w0: #A9B4B5; --wh-w1: #BFDCD8; --wh-w2: #74B3B0; --wh-w3: #2F7F8C; --wh-w4: #B4472F;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --wh-floor: #1B3740; --wh-walk: #0E2329; --wh-walk-edge: #2F5A64; --wh-stairs: #04100F; --wh-stairs-ink: #A6BCBF;
    --wh-pump: #5FB5BE; --wh-motor: #93C46E; --wh-other: #A699D4; --wh-ink: #061417; --wh-pillar: #8DA2A7; --wh-stair-step: #5C7378; --wh-s0: #5E7175; --wh-s1: #5B9AC4; --wh-s2: #62BDB3; --wh-s3: #DCC25A; --wh-s4: #F7A73A; --wh-w0: #5E7175; --wh-w1: #3A6B70; --wh-w2: #4F9C9E; --wh-w3: #8FD0D4; --wh-w4: #EC7B5E;
  }
}
:root[data-theme="dark"] {
  --wh-floor: #1B3740; --wh-walk: #0E2329; --wh-walk-edge: #2F5A64; --wh-stairs: #04100F; --wh-stairs-ink: #A6BCBF;
  --wh-pump: #5FB5BE; --wh-motor: #93C46E; --wh-other: #A699D4; --wh-ink: #061417; --wh-pillar: #8DA2A7; --wh-stair-step: #5C7378; --wh-s0: #5E7175; --wh-s1: #5B9AC4; --wh-s2: #62BDB3; --wh-s3: #DCC25A; --wh-s4: #F7A73A; --wh-w0: #5E7175; --wh-w1: #3A6B70; --wh-w2: #4F9C9E; --wh-w3: #8FD0D4; --wh-w4: #EC7B5E;
}
.wh-wrap { display: grid; gap: 12px; }
.wh-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.wh-find { position: relative; display: flex; gap: 6px; flex: 1 1 280px; min-width: 0; }
.wh-find .input { flex: 1; min-width: 0; }
.wh-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-control); box-shadow: var(--float, 0 8px 24px rgb(0 0 0 / .18)); max-height: 60vh; overflow: auto; }
.wh-hit { display: grid; gap: 2px; width: 100%; text-align: left; padding: 8px 10px; background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--text); cursor: pointer; font: inherit; }
.wh-hit:hover, .wh-hit:focus-visible { background: var(--accent-soft); }
.wh-main { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; align-items: start; }
.wh-host { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ledger); min-height: 420px; height: min(78vh, 900px); overflow: auto; display: flex; justify-content: center; }
.wh-svg { height: 100%; width: auto; max-width: 100%; display: block; touch-action: pinch-zoom; user-select: none; }
.wh-canvas { width: 100%; height: 100%; display: block; }
.wh-panel { position: sticky; top: 12px; display: grid; gap: 4px; }
.wh-floor { fill: var(--wh-floor); stroke: var(--line-2); stroke-width: 2; }
.wh-walk { fill: var(--wh-walk); stroke: var(--wh-walk-edge); stroke-width: 1.5; stroke-dasharray: 8 6; }
.wh-stairs { fill: var(--wh-stairs); }
.wh-stairs-lbl { fill: var(--wh-stairs-ink); font-weight: 600; }
.wh-dim { fill: var(--muted); }
/* Piles are see-through until pointed at (or chosen), then solid with a bold edge. */
.wh-pile { cursor: pointer; --c: var(--wh-other); }
.wh-pile.pump { --c: var(--wh-pump); }
.wh-pile.motor { --c: var(--wh-motor); }
.wh-pile .wh-box { fill: var(--c); fill-opacity: .22; stroke: var(--c); stroke-width: 1; transition: fill-opacity .15s, stroke-width .15s; }
.wh-pile .wh-spot { fill: var(--c); fill-opacity: .38; stroke: var(--wh-ink); stroke-opacity: .35; stroke-width: .5; transition: fill-opacity .15s, stroke-opacity .15s; }
.wh-pile:hover .wh-box, .wh-pile.sel .wh-box { fill-opacity: .55; stroke-width: 2.5; }
.wh-pile:hover .wh-spot, .wh-pile.sel .wh-spot { fill-opacity: .95; stroke-opacity: .9; stroke-width: .8; }
.wh-pile.empty .wh-box { stroke-dasharray: 4 3; }
.wh-pile.sel .wh-box { stroke: var(--act); stroke-width: 3.5; }
.wh-pile.moving .wh-box { stroke: var(--ok); stroke-width: 3.5; cursor: grab; }
.wh-pile.moving.bad .wh-box { stroke: var(--crit); fill: var(--crit); fill-opacity: .25; }
.wh-lbl { fill: var(--text); font-weight: 600; pointer-events: none; paint-order: stroke; stroke: var(--wh-floor); stroke-width: 2.5px; stroke-linejoin: round; }
.wh-lbl .wh-qty { font-weight: 400; }
.wh-host { position: relative; }
.wh-tip { position: absolute; z-index: 5; pointer-events: none; max-width: 220px; background: var(--surface); color: var(--text); border: 1px solid var(--line-2); border-radius: var(--r-control); box-shadow: var(--float, 0 8px 24px rgb(0 0 0 / .18)); padding: 6px 10px; font-size: 12px; line-height: 1.35; }
/* The hover box: label badge, then the product code and name large, then the details */
.wh-tip { max-width: 300px; padding: 10px 12px; }
.wh-tip .wh-ltag { margin-bottom: 6px; }
.wh-tip .tip-code { display: block; font-size: 17px; font-weight: 700; }
.wh-tip .tip-name { display: block; font-size: 15px; font-weight: 600; line-height: 1.3; margin-top: 2px; }
.wh-tip .tip-sub { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.wh-codes { display: inline-flex; align-items: center; gap: 6px; }
.wh-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.wh-legend span { display: inline-flex; align-items: center; gap: 4px; }
.wh-legend .sw { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--wh-ink); display: inline-block; }
.wh-legend .sw.pump { background: var(--wh-pump); }
.wh-legend .sw.motor { background: var(--wh-motor); }
.wh-legend .sw.other { background: var(--wh-other); }
.wh-legend .sw.walk { background: var(--wh-walk); border-style: dashed; }
.wh-legend .sw.stairs { background: var(--wh-stairs); }
.wh-main > * { min-width: 0; }
@media (max-width: 860px) {
  .wh-main { grid-template-columns: minmax(0, 1fr); }
  .wh-find { flex-basis: 100%; }
  .wh-host { height: 68vh; min-height: 360px; }
  .wh-panel { position: static; }
}

/* Floor features, the floor editor, quick actions and motion (warehouse.js) */
.wh-pillar { fill: var(--wh-pillar); stroke: var(--wh-ink); stroke-width: 1; }
.wh-door { fill: var(--act); fill-opacity: .45; stroke: var(--act); stroke-width: 2; }
.wh-feat-lbl { fill: var(--text); font-weight: 600; pointer-events: none; }
.wh-stairs + .wh-feat-lbl { fill: var(--wh-stairs-ink); }
.wh-svg.editing .wh-feat { cursor: move; }
.wh-svg.editing .wh-feat:hover rect { stroke: var(--accent); stroke-width: 3; }
.wh-feat.sel rect { stroke: var(--act); stroke-width: 4; stroke-dasharray: none; }
.wh-pile.ghost { opacity: .35; pointer-events: none; }
.wh-pile.low .wh-box { stroke: var(--act); stroke-width: 2; }
.wh-code { font-family: "Atkinson Hyperlegible Mono", ui-monospace, monospace; }
.wh-pulse { fill: none; stroke: var(--act); stroke-width: 4; pointer-events: none; transform-box: fill-box; transform-origin: center; animation: wh-pulse 1.4s ease-out 1 forwards; }
@keyframes wh-pulse { 0% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.35); } }
.wh-pile.fresh { transform-box: fill-box; transform-origin: center; animation: wh-fresh .45s cubic-bezier(.2, .8, .2, 1) 1; }
@keyframes wh-fresh { from { opacity: 0; transform: translateY(-14px) scale(.96); } to { opacity: 1; transform: none; } }
.wh-pile g, .wh-pile { transition: transform .12s ease-out; }
.wh-menu { position: absolute; z-index: 6; min-width: 180px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-control); box-shadow: var(--float, 0 8px 24px rgb(0 0 0 / .18)); padding: 4px 0; display: grid; animation: wh-pop .14s ease-out 1; }
.wh-menu button { text-align: left; background: none; border: 0; padding: 8px 12px; font: inherit; color: var(--text); cursor: pointer; }
.wh-menu button:hover, .wh-menu button:focus-visible { background: var(--accent-soft); }
.wh-menu button.danger { color: var(--crit); }
@keyframes wh-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.wh-addlist, .wh-featlist { display: grid; max-height: 46vh; overflow: auto; margin-top: 8px; border: 1px solid var(--line); border-radius: var(--r-control); }
.wh-hit.on { background: var(--accent-soft); }
.wh-legend .sw.low { background: transparent; border: 2px solid var(--act); }
.wh-legend .sw.pillar { background: var(--wh-pillar); }
.wh-legend .sw.door { background: var(--act); opacity: .6; }
@media (prefers-reduced-motion: reduce) {
  .wh-pulse, .wh-pile.fresh, .wh-menu { animation: none; }
  .wh-pile, .wh-pile g, .wh-pile .wh-box, .wh-pile .wh-spot { transition: none; }
}

/* Pick list (warehouse.js): the sale being loaded, numbered in walking order */
.wh-picklist { display: grid; gap: 4px; max-height: 52vh; overflow: auto; margin-top: 8px; }
.wh-pickrow { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; text-align: left; width: 100%; background: var(--surface-2); border: 1px solid transparent; border-radius: var(--r-control); padding: 8px 10px; font: inherit; color: var(--text); cursor: pointer; }
.wh-pickrow:hover { border-color: var(--line-2); }
.wh-pickrow > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.wh-pickrow.done { opacity: .62; }
.wh-num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--act); color: var(--act-ink); font-weight: 700; font-size: 13px; }
.wh-pickrow.done .wh-num { background: var(--ok); color: var(--surface); }
.wh-progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.wh-progress span { display: block; height: 100%; background: var(--ok); transition: width .3s ease-out; }
.wh-pile.dim { opacity: .28; }
.wh-pile.pick .wh-box { stroke: var(--act); stroke-width: 3; fill-opacity: .5; }
.wh-pile.pick.done .wh-box { stroke: var(--ok); }
.wh-badge circle { fill: var(--act); stroke: var(--surface); stroke-width: 2; }
.wh-badge text { fill: var(--act-ink); font-weight: 700; pointer-events: none; }
.wh-badge.done circle { fill: var(--ok); }
.wh-badge.done text { fill: var(--surface); }
.wh-badge { pointer-events: none; }
.wh-route { fill: none; stroke: var(--act); stroke-width: 3; stroke-dasharray: 10 8; stroke-linecap: round; stroke-linejoin: round; opacity: .85; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .wh-progress span { transition: none; } }

/* Put-away: a suggested spot for a product new to the map */
.wh-sug-box { fill: var(--act); fill-opacity: .14; stroke: var(--act); stroke-width: 2.5; stroke-dasharray: 8 5; }
.wh-sug-lbl { fill: var(--text); font-weight: 600; pointer-events: none; }
.wh-sug { pointer-events: none; }

/* Colour by sales speed (warehouse.js) */
.wh-pile.s0 { --c: var(--wh-s0); } .wh-pile.s1 { --c: var(--wh-s1); } .wh-pile.s2 { --c: var(--wh-s2); } .wh-pile.s3 { --c: var(--wh-s3); } .wh-pile.s4 { --c: var(--wh-s4); }
.wh-legend .sw.s0 { background: var(--wh-s0); } .wh-legend .sw.s1 { background: var(--wh-s1); } .wh-legend .sw.s2 { background: var(--wh-s2); } .wh-legend .sw.s3 { background: var(--wh-s3); } .wh-legend .sw.s4 { background: var(--wh-s4); }
.wh-colour { display: inline-flex; align-items: center; gap: 6px; }
.wh-colour select { width: auto; padding-top: 6px; padding-bottom: 6px; }
.wh-toplist { display: grid; margin-top: 4px; border: 1px solid var(--line); border-radius: var(--r-control); }

/* Colour by weight (warehouse.js) */
.wh-pile.w0 { --c: var(--wh-w0); } .wh-pile.w1 { --c: var(--wh-w1); } .wh-pile.w2 { --c: var(--wh-w2); } .wh-pile.w3 { --c: var(--wh-w3); } .wh-pile.w4 { --c: var(--wh-w4); }
.wh-legend .sw.w0 { background: var(--wh-w0); } .wh-legend .sw.w1 { background: var(--wh-w1); } .wh-legend .sw.w2 { background: var(--wh-w2); } .wh-legend .sw.w3 { background: var(--wh-w3); } .wh-legend .sw.w4 { background: var(--wh-w4); }

/* Zooming and moving round the map (warehouse.js) */
.wh-host { overflow: hidden; }
.wh-svg { width: 100%; height: 100%; max-width: none; touch-action: none; cursor: grab; }
.wh-svg:active { cursor: grabbing; }
.wh-zoom { position: absolute; right: 10px; bottom: 34px; display: grid; gap: 4px; z-index: 4; }
.wh-zoom button { min-width: 40px; height: 36px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--r-control); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; box-shadow: var(--float, 0 4px 12px rgb(0 0 0 / .15)); }
.wh-zoom button:hover { background: var(--accent-soft); }
.wh-hint { position: absolute; left: 10px; right: 64px; bottom: 8px; color: var(--muted); pointer-events: none; z-index: 3; text-shadow: 0 0 4px var(--surface); }
.wh-stairs { transition: fill-opacity .15s; }
.wh-feat.under .wh-stairs { fill-opacity: .35; stroke: var(--wh-stairs); stroke-width: 2; stroke-dasharray: 10 6; }
.wh-feat.under .wh-feat-lbl { fill: var(--text); }

/* Pile labels (G-L03): a mono tag in lists and panels, bold in front of the code on the plan */
.wh-ltag { display: inline-block; font-family: "Atkinson Hyperlegible Mono", ui-monospace, monospace; font-weight: 700; font-size: 14px; padding: 1px 6px; border-radius: 4px; background: var(--accent); color: var(--accent-ink); letter-spacing: .02em; vertical-align: 1px; }
.wh-ltag.big { font-size: 24px; padding: 3px 12px; margin-bottom: 4px; }
.wh-ltag, .wh-ltag.big { color: var(--accent-ink); background: var(--accent); } /* never inherit a muted colour from around it */
.wh-lcode { font-weight: 800; fill: var(--text); } /* same colour and outline as the pile text, so it reads on any pile in light and dark */

/* Hovered or chosen pile: its boxes turn solid, so the text switches to dark ink, extra bold, to stay readable */
.wh-pile:hover .wh-lbl, .wh-pile.sel .wh-lbl, .wh-pile:hover .wh-lcode, .wh-pile.sel .wh-lcode { fill: var(--wh-ink); stroke: none; font-weight: 800; }
