/* ============================================================================
   ElloTree design system - mobile-first, no framework.
   ========================================================================= */

:root {
  --green-900: #14532d;
  --green-700: #15803d;
  --green-600: #16a34a;
  --green-100: #dcfce7;
  --ink: #111827;
  --ink-soft: #4b5563;
  /* 4.98 on --bg. The old #6b7280 was 4.39 there - fine on a white card,
     under AA everywhere else, which is where most hint text sits. */
  --muted: #616a76;
  --line: #e5e7eb;
  --bg: #f3f4f6;
  --card: #ffffff;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --amber: #d97706;
  --amber-bg: #fef3c7;
  --blue: #2563eb;
  --blue-bg: #dbeafe;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --sidebar-w: 232px;
  /* The topbar is sticky at top:0, so anything else that wants to stick has to
     start below it or it parks underneath and is simply invisible - which is
     exactly what the catalog's filter bar did before this token existed. ONE
     number, pinned onto .topbar as a min-height as well as read by whoever
     stacks under it, so the two cannot drift apart in a later edit. */
  --topbar-h: 61px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--green-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.35rem; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 24px 0 10px; }
h3 { font-size: 1rem; margin: 16px 0 8px; }
p  { margin: 8px 0; }
code { background: #eef2f1; padding: 1px 5px; border-radius: 4px; font-size: .85em; }

/* --- Shell -------------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); color: #dcece1;
  background-color: var(--green-900);
  background-image: linear-gradient(185deg, rgba(255,255,255,.035), rgba(0,0,0,.26));
  flex-shrink: 0; display: flex; flex-direction: column; padding: 12px 0 22px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 8px 18px 14px; font-weight: 700; font-size: 1.05rem; color: #fff; }
/* The sidebar wordmark is an <a> to the dashboard. It keeps the sidebar's own
   white, rather than picking up the link colour, and gains no underline - it
   reads as a mark, not as navigation, and the pointer is the affordance. */
a.brand { text-decoration: none; }
a.brand:hover { text-decoration: none; color: #fff; opacity: .88; }
.brand-mark { font-size: 1.3rem; flex-shrink: 0; }
/* Stacked wordmark: first word large, the rest smaller on the line below -
   keeps "ElloTree / Inventory Management" tidy in the sidebar, auth cards
   and on phones. */
.brand-name { display: inline-flex; flex-direction: column; line-height: 1.12; }
.brand-lead { font-weight: 700; }
.brand-sub { font-size: .58em; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; opacity: .82; }
/* The VPM Wholesale logo as the public wordmark (public_logo_html()): the
   logo, and the powered-by line under it. Height-driven, so the frame keeps
   its proportions at every size. */
.pub-logo-wrap { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 3px; line-height: 1; }
.pub-logo { display: block; height: 36px; width: auto; max-width: 100%; }   /* 36px or 72px only: the -sm file's pixel grid */
.pub-powered { font-size: .5rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
                 color: var(--muted, #6b7280); white-space: nowrap; }
.sidebar .pub-powered { color: rgba(255,255,255,.62); }
.shop-foot-logo { margin-bottom: 10px; }
.shop-foot-logo .pub-powered { color: rgba(255,255,255,.72); }
.nav { display: flex; flex-direction: column; }
/* Pill-style rows: rounded, inset from the edges, sliding right on hover with a
   colour-popping icon; the active row is a soft emerald->lime gradient pill. */
.nav-link {
  display: flex; align-items: center; gap: 11px; margin: 1px 8px; padding: 9px 12px;
  border-radius: 9px; color: #cfe3d4; font-weight: 500;
  transition: background .15s ease, color .15s ease, transform .12s ease;
}
.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; transform: translateX(2px); }
.nav-link:hover .nav-ic { opacity: 1; color: var(--c-lime-b, #a3e635); }
.nav-link.active {
  color: #fff; font-weight: 600;
  background: linear-gradient(100deg, rgba(16,185,129,.30), rgba(163,230,53,.12));
  box-shadow: inset 0 0 0 1px rgba(163,230,53,.28);
}
.nav-link.active .nav-ic { opacity: 1; color: var(--c-lime-b, #a3e635); }
.nav-ic { width: 20px; text-align: center; opacity: .78; transition: color .15s ease, opacity .15s ease; }
/* Section headers: a colourful dash, uppercase label, and a hairline divider
   above so each group reads as its own block. */
.nav-section {
  display: flex; align-items: center; gap: 8px; margin: 12px 8px 4px; padding: 9px 10px 0;
  font-size: .66rem; letter-spacing: .11em; text-transform: uppercase; color: #a4c9b1; font-weight: 800;
  border-top: 1px solid rgba(255,255,255,.08);
}
.nav-section::before { content: ""; width: 12px; height: 2px; border-radius: 2px; flex-shrink: 0;
  background: linear-gradient(90deg, var(--c-lime-b, #a3e635), var(--c-emerald, #10b981)); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40; min-height: var(--topbar-h);
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.content { padding: 20px 16px 60px; max-width: 1200px; width: 100%; margin: 0 auto; }

.menu-btn { display: none; }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 90; }

/* --- Buttons / inputs ---------------------------------------------------- */
.btn, button.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 15px;
  background: var(--green-700); border: 1px solid var(--green-700); color: #fff;
  border-radius: 8px; font-weight: 600; font-size: .9rem; cursor: pointer;
}
.btn:hover { background: var(--green-600); text-decoration: none; }
/* `button.btn` (0,1,1) out-specifies a bare `.btn-outline` / `.btn-danger`
   (0,1,0), so on a <button> every variant lost to the primary green: Delete
   looked exactly like Save, and every secondary action looked primary.
   Anchors were never affected - there is no `a.btn` rule - which is why the
   bug hid for so long. Qualifying each variant to the same specificity hands
   the decision back to source order, which is what the cascade intended. */
.btn-outline, button.btn-outline { background: transparent; color: var(--green-700); }
.btn-outline:hover, button.btn-outline:hover { background: var(--green-100); }
.btn-danger, button.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover, button.btn-danger:hover { background: #b91c1c; }
/* Used in five views and defined in none: the quiet neighbour of a danger
   button ("Disable" beside "Delete"), which was rendering as a primary. */
.btn-ghost, button.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn-ghost:hover, button.btn-ghost:hover { background: var(--bg); color: var(--ink); }
.btn-sm { padding: 4px 10px; font-size: .8rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn {
  background: none; border: none; font-size: 1.15rem; cursor: pointer;
  padding: 6px 8px; border-radius: 8px; position: relative; color: var(--ink);
}
.icon-btn:hover { background: var(--bg); }
.bell-count {
  position: absolute; top: 0; right: 0; background: var(--red); color: #fff;
  font-size: .62rem; font-weight: 700; border-radius: 999px; padding: 1px 5px;
}

input, select, textarea {
  /* #8b929c, not the old #d1d5db: an input's border is the only thing that
     says "you can type here", so WCAG 1.4.11 wants 3:1 against the field.
     The old grey managed 1.47 - invisible on a dim laptop screen at an
     angle, which is where a warehouse actually is. */
  width: 100%; padding: 8px 10px; border: 1px solid #8b929c; border-radius: 8px;
  font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green-700); outline-offset: 0; border-color: var(--green-700); }
input[type="checkbox"], input[type="radio"] { width: auto; }

/* Everything else that takes focus - buttons, links, ticks, summaries, anything
   given a tabindex. Until now these fell back to the browser's own ring, which
   is a thin dark line drawn OVER a dark green button: technically present,
   invisible in practice. One ring, always outside the element, one colour that
   clears 3:1 on both the card and the page background.
   :focus-visible, not :focus, so clicking a button does not leave a ring
   behind it - the mouse already knows where it clicked. */
a:focus-visible, button:focus-visible, summary:focus-visible,
[tabindex]:focus-visible, input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible, input[type="file"]:focus-visible {
  outline: 2px solid var(--green-700);
  outline-offset: 2px;
  border-radius: 4px;
}
/* On the dark sidebar and the dark footer a green ring disappears into the
   background it is drawn on. White is the only thing that reads on both. */
.sidebar a:focus-visible, .sidebar button:focus-visible,
.shop-footer a:focus-visible, .site-footer a:focus-visible, .fp-foot a:focus-visible {
  outline-color: #ffffff;
}
label { font-weight: 600; font-size: .84rem; display: block; margin-bottom: 4px; color: var(--ink-soft); }
.hint { font-size: .8rem; color: var(--muted); margin-top: 3px; }
.req::after { content: " *"; color: var(--red); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.field { min-width: 0; }
.check-row { display: flex; align-items: center; gap: 8px; }
.check-row label { margin: 0; }
/* One form, two asks: the quote-or-sample picker on the public product page.
   A fieldset so the pair announces as one question, drawn as a plain row. */
.intent-pick { border: 0; margin: 0 0 14px; padding: 0; display: flex; gap: 22px; flex-wrap: wrap; }
.intent-pick .check-row { font-weight: 600; cursor: pointer; }

/* --- Cards / KPIs --------------------------------------------------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.card-title { font-weight: 700; margin: 0 0 12px; font-size: 1rem; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: .88rem; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .kpi-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.kpi .kpi-value { font-size: 1.5rem; font-weight: 700; margin-top: 2px; }
.kpi.warn .kpi-value { color: var(--amber); }
.kpi.crit .kpi-value { color: var(--red); }
.kpi.good .kpi-value { color: var(--green-700); }

/* --- Tables (stack to cards on phones) ------------------------------------ */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; background: var(--card); font-size: .9rem; }
table.data th {
  text-align: left; padding: 9px 12px; border-bottom: 2px solid var(--line);
  font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  white-space: nowrap;
}
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:hover td { background: #fafcfa; }
/* `table.data th` (0,1,2) out-specifies a bare `th.num` (0,1,1), so every
   numeric heading in the app rendered left while its figures rendered right -
   the heading and the number it labels sat at opposite ends of the column.
   Qualifying the selector to match puts them back over each other. */
td.num, th.num, table.data td.num, table.data th.num {
  text-align: right; font-variant-numeric: tabular-nums;
}
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* --- Badges ----------------------------------------------------------------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.badge-green { background: var(--green-100); color: var(--green-900); }
/* Darker than the base --red / --amber / --blue, which are sized for use
   ON WHITE. On their own pale tint they came in at 3.95, 2.86 and 4.24 -
   all under 4.5, and amber badly so. The base tokens are unchanged: they
   are also borders and icons, where 3:1 is the bar. */
.badge-red { background: var(--red-bg); color: #b91c1c; }
.badge-amber { background: var(--amber-bg); color: #a15c07; }
.badge-blue { background: var(--blue-bg); color: #1d4ed8; }
.badge-gray { background: #f3f4f6; color: var(--ink-soft); }
/* Made in USA. Its own colour rather than a borrowed one: it is the badge a
   buyer scans a grid for, and in green it read as another packaging flag. */
.badge-usa { background: #eef2ff; color: #1e3a8a; box-shadow: inset 0 0 0 1px #c7d2fe; }
/* The flag is drawn, not typed: 🇺🇸 is a regional-indicator PAIR that Windows
   renders as the letters "US", so the emoji version of this badge read
   "US US stock" on a large share of desktops. A hairline keeps the white
   stripes from dissolving into the badge's pale background. */
.usa-flag { display: inline-block; vertical-align: -1px; margin-right: 1px;
  border-radius: 1px; box-shadow: 0 0 0 .5px rgba(30, 58, 138, .35); }

/* --- List thumbnails ------------------------------------------------------------ */
.thumb-cell { width: 44px; padding-right: 0 !important; }
.thumb { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
         border-radius: 6px; object-fit: cover; border: 1px solid var(--line); background: #fff; vertical-align: middle; }
/* No photo yet. Deliberately a filled tile rather than a gap: a row whose
   picture cell is blank reads as a broken image, and a whole column of them
   reads as a broken page. Tinted from the brand green so it sits in the table
   as a considered absence, and kept to the same 36px box as a real thumbnail
   so nothing shifts when one is uploaded. */
.thumb-empty {
  color: var(--green-700, #15803d);
  background: linear-gradient(140deg, var(--green-100) 0%, #f7fbf8 75%);
  border-color: var(--line);
}
.thumb-empty svg { width: 19px; height: 19px; opacity: .5; }

/* --- 2FA QR enrolment ----------------------------------------------------------- */
.qr-enroll { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; margin: 10px 0 14px; }
.qr-box { background: #fff; padding: 10px; border: 1px solid var(--line); border-radius: 10px; flex-shrink: 0; }
.qr-box svg { display: block; width: 200px; height: 200px; }
.qr-manual { min-width: 220px; flex: 1; }
.qr-manual code { word-break: break-all; }

/* --- Callouts (inline emphasis boxes) ----------------------------------------- */
.callout { border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px; padding: 12px 16px; font-size: .9rem; }
.callout-warn { background: var(--amber-bg); border-color: var(--amber); }
.callout-danger { background: var(--red-bg); border-color: var(--red); }

/* --- Toasts / flashes -------------------------------------------------------- */
.toasts { position: fixed; top: 14px; right: 14px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(92vw, 380px); }
.toast { padding: 11px 16px; border-radius: 8px; box-shadow: var(--shadow); background: var(--ink); color: #fff; font-size: .9rem; animation: toast-in .25s ease; }
.toast-ok { background: var(--green-700); }
.toast-error { background: var(--red); }
.toast-warn { background: var(--amber); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }

/* --- Modals -------------------------------------------------------------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(17,24,39,.5); z-index: 150; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 12px; overflow-y: auto; }
.modal { background: #fff; border-radius: var(--radius); max-width: 620px; width: 100%; padding: 20px; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.modal h2 { margin-top: 0; }
[hidden] { display: none !important; }

/* --- Misc components ------------------------------------------------------------ */
.filter-bar { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
/* The min-width is for the text and select controls. Applied to every input it
   also stretched CHECKBOXES to 140px, so each one sat a hundred pixels from
   the label it belongs to - invisible until a filter bar grew its first tick
   box, and then wrong on every one of them. */
.filter-bar input:not([type="checkbox"]):not([type="radio"]),
.filter-bar select { width: auto; min-width: 140px; }
/* A tick and its label wrap to the next line of the bar as a unit rather than
   being squeezed narrower than their own text - the label is itself a nowrap
   flex line, so squeezed text spills instead of wrapping. The max-width is the
   escape hatch: a tick whose label is longer than the whole bar (the compliance
   one, for a business licensed in a dozen states) would otherwise hold its
   one-line width and run off the right of the card, scrolling the page
   sideways. Capped at the bar, its own text wraps instead. */
.filter-bar .check-row { flex-shrink: 0; max-width: 100%; }
.empty { text-align: center; color: var(--muted); padding: 34px 10px; }
/* The drawn empty shelf above an empty list's sentence (assets/img/empty.svg).
   Small on purpose: the sentence carries what to do next, the drawing only
   keeps a blank screen from reading as a broken one. */
.empty-art { display: block; width: 180px; max-width: 60%; margin: 0 auto 6px; }
.pager { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.pager a, .pager span { padding: 5px 11px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: .85rem; }
.pager .on { background: var(--green-700); color: #fff; border-color: var(--green-700); }
.spark { width: 110px; height: 30px; }
.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--green-600); }
.progress.warn > div { background: var(--amber); }
.progress.crit > div { background: var(--red); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.audit-diff { font-size: .82rem; }
.audit-diff .from { color: var(--red); text-decoration: line-through; }
.audit-diff .to { color: var(--green-700); font-weight: 600; }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; font-weight: 600; color: var(--muted); border-radius: 8px 8px 0 0; }
.tabs a.on { color: var(--green-900); box-shadow: inset 0 -2px 0 var(--green-700); }
.tabs a:hover { text-decoration: none; background: var(--green-100); }

/* --- Public storefront (guest catalog) ----------------------------------------- */
.shop-body { background: var(--bg); }
.shop-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50; flex-wrap: wrap;
}
.shop-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; color: var(--green-900); }
.shop-brand:hover { text-decoration: none; }
.shop-nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
/* Search in the sticky header. The row is `space-between` with `flex-wrap`, so
   this third child sits between the wordmark and the nav and drops to its own
   full-width line on a phone rather than crushing the two beside it. */
.shop-search { display: flex; gap: 6px; align-items: center; flex: 1 1 220px; max-width: 420px; }
.shop-search input[type="search"] {
  flex: 1; min-width: 0; padding: 7px 11px; font-size: .9rem;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
@media (max-width: 700px) {
  /* Full width on its own row: a 120px search box is a search box nobody uses,
     and the two buttons beside it are the ones that must stay tappable. */
  .shop-search { flex: 1 1 100%; max-width: none; order: 3; }
}
.shop-nav > a:first-child { font-weight: 600; }
.shop-main { max-width: 1100px; margin: 0 auto; padding: 22px 16px 40px; }
/* The storefront grid IS the catalog grid (.prod-grid / .prod-slot / .prod-card
   in catalog.css) rendering the one shared card partial. The storefront-only
   grid and card definitions that used to live here were the second copy, and
   the two had already stopped agreeing on card width, padding and hover. What
   the storefront still owns is colour, and that is scoped to .shop-body in
   shop/_top.php. Only the locked-price colour survives here, because the
   product page uses it too. */
.shop-price-locked { color: var(--muted); font-weight: 600; }
.shop-big-price { font-size: 1.4rem; font-weight: 700; margin-bottom: 6px; }
.shop-cta { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
/* Dark-gradient footers, site-wide (the marketing homepage keeps its own in
   .lp-foot). A deep-green gradient card with light text, a bright accent
   hairline across the top, and links that brighten to lime on hover. */
.shop-footer, .site-footer, .fp-foot {
  position: relative; overflow: hidden; margin-top: 44px; border: none;
  border-radius: 14px; padding: 22px 22px; font-size: .82rem;
  color: rgba(255,255,255,.75);
  background: linear-gradient(135deg, #0b2a1a 0%, #14532d 55%, #0e3b28 100%);
}
.shop-footer { max-width: 1100px; margin-inline: auto; margin-bottom: 24px; }
.shop-footer::before, .site-footer::before, .fp-foot::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, #16a34a, #14b8a6, #a3e635, #f59e0b);
}
.shop-footer a, .site-footer a, .fp-foot a { color: rgba(255,255,255,.9); font-weight: 600; }
.shop-footer a:hover, .site-footer a:hover, .fp-foot a:hover { color: #a3e635; }

/* --- Auth screens ------------------------------------------------------------------ */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, var(--green-900), #0b3018 70%); padding: 20px; }
.auth-card { background: #fff; border-radius: 14px; padding: 30px 28px; width: 100%; max-width: 400px; box-shadow: 0 15px 50px rgba(0,0,0,.35); }
.auth-card .brand { justify-content: center; color: var(--green-900); padding: 0 0 6px; font-size: 1.3rem; }
.auth-card h1 { text-align: center; font-size: 1.1rem; color: var(--ink-soft); font-weight: 500; }
.auth-card form { margin-top: 18px; display: flex; flex-direction: column; gap: 13px; }
.auth-links { margin-top: 14px; text-align: center; font-size: .85rem; display: flex; flex-direction: column; gap: 5px; }
.auth-error { background: var(--red-bg); color: var(--red); padding: 9px 12px; border-radius: 8px; font-size: .88rem; }
.auth-ok { background: var(--green-100); color: var(--green-900); padding: 9px 12px; border-radius: 8px; font-size: .88rem; }

/* A GUEST'S form confirmation - the homepage contact card and the storefront
   lead forms. The one thing that reload exists to say was a quiet .88rem
   strip a visitor scanning for their own form never saw, and a confirmation
   nobody notices reads as a submit that did nothing (the silent-submit
   failure the ?m= codes exist to prevent). Inside .flash-banner it arrives
   like an answer: full-size, it pops in and pulses twice, then HOLDS - a
   banner still throbbing a minute later is an alarm, not a confirmation.
   CSS only, so it works with JavaScript disabled; still under
   prefers-reduced-motion; defined ONCE here because both public shells load
   this stylesheet, and two copies of a flash is two flashes that drift.
   The app's own signed-in flashes never wear this class and stay quiet. */
.flash-banner { margin-bottom: 22px; }
.flash-banner > div {
  font-size: 1.05rem; font-weight: 650; text-align: center;
  padding: 15px 22px; border-radius: 13px; line-height: 1.5;
  animation: flashIn .45s cubic-bezier(.2, .9, .3, 1.35) both,
             flashPulse 1.5s ease-in-out .5s 2;
}
.flash-banner .auth-ok {
  background: linear-gradient(135deg, var(--green-100) 0%, #f0fdf4 100%);
  border: 2px solid var(--green-600); color: var(--green-900);
  box-shadow: 0 12px 34px -14px rgba(22, 163, 74, .55);
}
.flash-banner .auth-ok::before { content: "✓"; display: inline-block; margin-right: 10px;
  width: 24px; height: 24px; line-height: 24px; border-radius: 50%;
  background: var(--green-600); color: #fff; font-size: .9rem; font-weight: 800; }
.flash-banner .auth-error { border: 2px solid var(--red, #dc2626);
  box-shadow: 0 12px 34px -14px rgba(220, 38, 38, .45); }
@keyframes flashIn {
  from { opacity: 0; transform: translateY(-16px) scale(.95); }
  to   { opacity: 1; transform: none; }
}
@keyframes flashPulse {
  0%, 100% { transform: none; }
  50% { transform: scale(1.015);
        box-shadow: 0 0 0 7px rgba(22, 163, 74, .16), 0 12px 38px -12px rgba(22, 163, 74, .6); }
}
@media (prefers-reduced-motion: reduce) { .flash-banner > div { animation: none; } }

/* --- User menu dropdown --------------------------------------------------------------- */
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; background: none; border: none; cursor: pointer; font: inherit; padding: 4px 8px; border-radius: 8px; }
.user-btn:hover { background: var(--bg); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--green-700); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; }
.dropdown { display: none; position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); min-width: 210px; z-index: 100; overflow: hidden; }
.user-menu.open .dropdown { display: block; }
.dropdown a, .dropdown button { display: block; width: 100%; text-align: left; padding: 10px 14px; background: none; border: none; font: inherit; color: var(--ink); cursor: pointer; }
.dropdown a:hover, .dropdown button:hover { background: var(--bg); text-decoration: none; }
.dropdown-meta { padding: 10px 14px; font-size: .78rem; color: var(--muted); border-bottom: 1px solid var(--line); }
.biz-switcher select { max-width: 230px; font-weight: 600; }
.brand-logo { max-height: 34px; max-width: 170px; object-fit: contain; border-radius: 6px; background: #fff; padding: 2px 6px; }
.global-search { flex: 1; max-width: 340px; }
.global-search input { padding: 7px 12px; border-radius: 999px; font-size: .88rem; }
@media (max-width: 700px) { .global-search { display: none; } }

/* --- Alerts list ----------------------------------------------------------------------- */
.alert-item { display: flex; gap: 12px; padding: 13px 6px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.alert-item.unread { background: #f4faf5; }
.alert-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.alert-dot.info { background: var(--blue); } .alert-dot.warning { background: var(--amber); } .alert-dot.critical { background: var(--red); }
.alert-item .when { color: var(--muted); font-size: .78rem; white-space: nowrap; }

/* .site-footer is styled with .shop-footer / .fp-foot in the dark-footer block above. */
.billing-banner { background: var(--amber-bg); color: var(--amber); padding: 9px 16px; font-size: .88rem; font-weight: 600; border-bottom: 1px solid var(--line); }
.billing-banner a { color: inherit; text-decoration: underline; }
.chart-box { position: relative; width: 100%; }
.chart-box canvas { width: 100%; height: 100%; display: block; }
.chart-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chart-controls select { width: auto; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; margin-top: 8px; }
.chart-legend .key { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .swatch { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* --- Print (invoices / POs) --------------------------------------------------------------- */
@media print {
  .sidebar, .topbar, .toasts, .no-print { display: none !important; }
  .content { padding: 0; max-width: none; }
  .card { border: none; box-shadow: none; }
  body { background: #fff; }
}

/* --- Mobile ---------------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 95; transform: translateX(-100%); transition: transform .2s ease; }
  body.sidebar-open .sidebar { transform: none; }
  body:not(.sidebar-open) .sidebar-backdrop { display: none; }
  .menu-btn { display: inline-flex; }
  .user-name { display: none; }
  .two-col { grid-template-columns: 1fr; }

  /* Tables become cards. Labelled data cells (data-th) take ~half the row so two
     sit side by side and use the space to the right instead of stacking into one
     long column. The primary/first cell spans its own row (name/title), and
     unlabelled cells - checkboxes and per-cell action buttons - flow inline and
     wrap into a compact row instead of one button per line. */
  table.data.stack thead { display: none; }
  table.data.stack, table.data.stack tbody { display: block; width: 100%; }
  table.data.stack tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px;
    border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; background: var(--card); padding: 12px 14px; }
  table.data.stack td { border: none; padding: 3px 0; text-align: left !important; min-width: 0; }
  table.data.stack td[data-th] { flex: 1 1 40%; }          /* two labelled cells per line */
  table.data.stack td[data-th]::before { content: attr(data-th); display: block; font-size: .64rem;
    text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 1px; }
  table.data.stack td:first-child { flex-basis: 100%; }    /* name/title on its own row */
  table.data.stack td:not([data-th]):not(:first-child):not(:has(.row-actions)) { flex: 0 0 auto; padding-top: 6px; }
  /* The action-button cell spans the full row (it carries no real label, and the
     global width:1% would otherwise squish its buttons into a right-hand column);
     its .row-actions is already a wrapping flex row. */
  table.data.stack td:has(.row-actions) { flex: 1 1 100%; width: auto; padding-top: 6px; }
  table.data.stack td[data-th='']::before,
  table.data.stack td:has(.row-actions)::before { content: none; }
  .row-actions { justify-content: flex-start; }
}

/* --- Searchable selects (combobox) --------------------------------------------
   app.js upgrades big <select>s into .combo: the native select stays in the
   DOM (visually hidden, script-focusable for browser validation) under a
   button + filter panel. Touch targets and a 16px search input keep it
   comfortable on phones (sub-16px inputs make iOS zoom the page). */
/* Visible to a screen reader, to nothing else. The combobox below rolled its
   own copy of this before anything else needed one; now the quote list, the
   skip link and the storefront controls do too, so it is a utility. Not
   display:none - that removes it from the accessibility tree as well, which is
   the opposite of the point. */
.sr-only {
  position: absolute !important; width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important; border: 0 !important;
  clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap;
}

/* --- The quote list ------------------------------------------------------- */
.ql-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ql-thumb {
  width: 44px; height: 44px; flex: 0 0 44px; object-fit: contain;
  background: #fff; border: 1px solid var(--line, #e5e7eb); border-radius: 6px;
}
/* The shortlist bar carries two actions now, not one, and on a phone they have
   to wrap rather than shrink the count out of existence. */
.cmp-bar { flex-wrap: wrap; }
.cmp-bar .btn { white-space: nowrap; }
.cmp-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.combo { position: relative; min-width: 0; }
.combo-native {
  position: absolute !important; width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important; border: 0 !important;
  clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap;
}
.combo-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; min-height: 38px; padding: 8px 10px;
  border: 1px solid #d1d5db; border-radius: 8px; background: #fff;
  font: inherit; color: var(--ink); cursor: pointer; text-align: left;
}
.combo-btn:focus { outline: 2px solid var(--green-700); outline-offset: 0; border-color: var(--green-700); }
.combo-btn[disabled] { opacity: .55; cursor: not-allowed; background: var(--bg); }
.combo-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 1.2em; }
.combo-txt.combo-placeholder { color: var(--muted); }
.combo-caret { color: var(--muted); font-size: .78em; flex-shrink: 0; }
.combo-panel {
  /* min-width has to yield on a narrow phone: a flat 230px overhung the field
     it belongs to on a 320px screen. */
  position: absolute; z-index: 160; top: calc(100% + 4px); left: 0; right: 0;
  min-width: min(230px, 100%); max-width: calc(100vw - 16px);
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 34px rgba(0,0,0,.16); padding: 8px;
}
.combo-panel:focus { outline: none; }   /* focus target on touch, not a control */
.combo-panel.up { top: auto; bottom: calc(100% + 4px); }
.combo-panel.fixed { position: fixed; right: auto; min-width: min(230px, calc(100vw - 16px)); }
.combo-search { font-size: 16px; margin-bottom: 6px; }
.combo-list {
  list-style: none; margin: 0; padding: 0;
  max-height: min(300px, 42vh); overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.combo-opt { padding: 10px 10px; border-radius: 6px; cursor: pointer; }
.combo-opt:hover, .combo-opt.active { background: var(--green-100); }
.combo-opt.sel { font-weight: 700; }
.combo-opt.sel::after { content: " ✓"; color: var(--green-700); }
.combo-group { padding: 8px 10px 2px; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.combo-none { padding: 10px; color: var(--muted); }
/* The "Create <typed name>" row a [data-create] select offers: visibly an
   action, not another match, so a near-miss pick stays a deliberate choice. */
.combo-create { font-style: italic; color: var(--green-700); }
.combo-create::before { content: "+ "; font-style: normal; font-weight: 700; }
/* No min-width here, deliberately: the JS freezes each filter-bar combo at
   the width its native select painted at, so enhancement cannot re-flow the
   row (the 180px minimum this used to set was a 0.3 CLS on the storefront
   grid). The dropdown PANEL has its own minimum and does not need the
   button to be wide. */
.filter-bar .combo { width: auto; }
.biz-switcher .combo { min-width: 170px; max-width: 230px; }
.biz-switcher .combo-btn { font-weight: 600; }

/* --- CRM: pipeline board, timeline, detail grids ------------------------------ */
.pipe-board { display: flex; gap: 12px; overflow-x: auto; align-items: flex-start; padding-bottom: 10px; margin-bottom: 18px; -webkit-overflow-scrolling: touch; }
.pipe-col { flex: 0 0 250px; min-width: 250px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 10px 4px; }
.pipe-col-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 2px 4px 10px; border-bottom: 2px solid var(--line); margin-bottom: 10px; }
.deal-card { border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; margin-bottom: 9px; background: #fff; box-shadow: var(--shadow); }
.deal-amount { font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.deal-moves { display: flex; gap: 5px; margin-top: 8px; flex-wrap: wrap; }
.deal-moves form { display: inline-flex; }
.pipe-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.pipe-sum-col { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.pipe-sum-stage { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pipe-sum-count { font-weight: 600; margin-top: 2px; }
.pipe-sum-value { color: var(--green-700); font-weight: 700; font-variant-numeric: tabular-nums; }
.stage-track { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.stage-track form { display: inline-flex; }
.lost-form { display: inline-flex !important; gap: 6px; align-items: center; flex-wrap: wrap; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { border-left: 2px solid var(--line); margin-left: 9px; padding: 0 0 16px 16px; position: relative; }
.timeline li:last-child { padding-bottom: 2px; }
.timeline li::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--green-600); border: 2px solid #fff; position: absolute; left: -7px; top: 3px; }
.tl-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tl-ic { opacity: .7; }
.tl-body { margin: 4px 0 2px; font-size: .9rem; white-space: pre-wrap; word-break: break-word; }
.mini-row { display: flex; gap: 10px; align-items: center; padding: 8px 2px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.mini-row:last-child { border-bottom: none; }
.mini-row form { display: inline-flex; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
/* CRM social profiles: one folding group per kind of network on the edit
   forms, so the four anybody uses are not buried under fifty empty boxes. */
.crm-soc-group { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin-top: 8px; }
.crm-soc-group > summary { cursor: pointer; font-weight: 600; padding: 2px 0; }
.crm-soc-group[open] > summary { margin-bottom: 6px; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-size: inherit; color: var(--green-700); cursor: pointer; text-decoration: underline; }
.link-btn.link-danger { color: var(--red); }
@media (max-width: 900px) {
  .pipe-col { flex-basis: 220px; min-width: 220px; }
}

/* --- Image gallery + lightbox ------------------------------------------------ */
.img-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 10px;
  margin: 4px 0 2px;
}
.img-gallery a {
  display: block;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--card);
  cursor: zoom-in;
}
.img-gallery img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s ease; }
.img-gallery a:hover img { transform: scale(1.06); }

body.lightbox-open { overflow: hidden; }
.lightbox {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(9, 14, 11, .92);
}
.lightbox[hidden] { display: none; }
.lightbox-stage {
  margin: 0; max-width: 94vw; max-height: 90vh;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.lightbox-img {
  max-width: 94vw; max-height: 84vh; object-fit: contain;
  border-radius: 8px; background: #fff; box-shadow: 0 12px 48px rgba(0, 0, 0, .55);
  cursor: zoom-in; transition: transform .15s ease;
}
.lightbox-img.zoomed { transform: scale(2.3); cursor: zoom-out; }
.lightbox-cap { color: #e8f0ea; font-size: .9rem; text-align: center; max-width: 82vw; }
.lightbox-btn {
  position: absolute; border: none; cursor: pointer;
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255, 255, 255, .15); color: #fff;
  font-size: 1.7rem; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.lightbox-btn:hover { background: rgba(255, 255, 255, .3); }
.lightbox-close { top: 16px; right: 16px; }
.lightbox-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 14px; top: 50%; transform: translateY(-50%); }

/* --- Command palette (Ctrl-K) ------------------------------------------------ */
.palette-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 120; display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; }
.palette { background: var(--card, #fff); border-radius: 12px; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); width: 100%; max-width: 560px; overflow: hidden; }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--line, #e5e7eb); padding: 14px 16px; font-size: 1rem; outline: none; background: transparent; color: inherit; }
/* outline:none above is deliberate - a ring inside a rounded dialog looks
   wrong - but "no ring" is not an option: Shift-Tab away and back and there
   was nothing at all to say where the keyboard was. The underline thickens
   instead, which is the same signal in the shape the dialog already uses. */
.palette input:focus { border-bottom: 2px solid var(--green-700); padding-bottom: 13px; }
.palette ul { list-style: none; margin: 0; padding: 6px 0; max-height: 46vh; overflow-y: auto; }
.palette li { display: flex; align-items: center; gap: 10px; padding: 8px 16px; cursor: pointer; font-size: .92rem; }
.palette li.on, .palette li:hover { background: var(--green-50, #f0fdf4); }
.palette .pal-group { flex-shrink: 0; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted, #6b7280); width: 74px; }
.palette-hint { padding: 8px 16px; font-size: .74rem; color: var(--muted, #6b7280); border-top: 1px solid var(--line, #e5e7eb); }
.saved-views > summary { list-style: none; cursor: pointer; }
.saved-views > summary::-webkit-details-marker { display: none; }

/* --- Inline quick-edit (td[data-edit]) -----------------------------------
   The affordance has to be discoverable without shouting: a dotted underline
   on hover/focus, and the cell keeps its own width so the row does not jump
   when the input appears. */
td[data-edit] { cursor: text; }
td[data-edit]:hover, td[data-edit]:focus-visible { background: var(--green-50, #f0fdf4); outline: none; }
td[data-edit]:hover:not(.editing) { box-shadow: inset 0 -1px 0 0 var(--line, #e5e7eb); }
td[data-edit].is-empty { color: var(--muted, #6b7280); }
td[data-edit].saving { opacity: .55; pointer-events: none; }
td[data-edit].editing { padding: 2px 6px; }
.quick-edit { width: 100%; min-width: 90px; box-sizing: border-box; font: inherit;
  padding: 4px 6px; border: 1px solid var(--accent, #16a34a); border-radius: 6px; background: #fff; }
.quick-edit:focus { outline: 2px solid var(--accent, #16a34a); outline-offset: -1px; }
/* Wider modal for the CRM record forms - a 620px box makes a 14-field grid
   into a single tall column. */
.modal.modal-wide { max-width: 860px; }

/* Company logos: a fixed box so a wide wordmark and a square icon line up in
   the same column, and a neutral frame so a transparent PNG stays visible in
   both themes. */
.crm-logo { object-fit: contain; border-radius: 4px; background: #fff;
  border: 1px solid var(--line, #e5e7eb); padding: 1px; vertical-align: middle; margin-right: 6px; flex-shrink: 0; }

/* A 37-field record form is taller than the viewport, and a Save button you
   have to scroll to find reads as a form with no Save button. */
.modal .form-actions { position: sticky; bottom: -20px; background: #fff;
  padding: 12px 0; margin-bottom: -20px; border-top: 1px solid var(--line, #e5e7eb); z-index: 1; }

/* --- Long-value containment ---------------------------------------------
   A CRM holds strings nobody chose: a 100-character Facebook URL, an email
   at a corporate subdomain, an imported company name with no spaces in it.
   Grid and flex children default to min-width:auto, which refuses to shrink
   below their content - so one long value pushes its neighbour sideways and
   the whole page gains a horizontal scrollbar. These rules make the layout
   the authority on width and the text wrap to fit. */
.two-col > *, .page-head > *, .card, .kpi { min-width: 0; }
.detail-grid > * { min-width: 0; }
/* anywhere, not break-word: break-word will not split an unbroken URL that
   started on its own line, which is exactly the case that overflows. */
.detail-grid > * > div, .detail-grid > * > span,
.page-head h1, .page-head .sub,
.card > p, .card > h3 + p { overflow-wrap: anywhere; }
/* Links are the worst offenders and appear in both grids and cells - but NOT
   buttons: "anywhere" happily breaks Edit into Ed / it, and a two-word action
   like "Open full record" into confetti. A button's label is a fixed short
   phrase; if a column is too narrow for it the column is wrong, not the word. */
.detail-grid a:not(.btn), td a:not(.btn), .card > p a:not(.btn) { overflow-wrap: anywhere; }
.btn, button.btn { white-space: nowrap; }
/* The actions column sizes to its buttons instead of being squeezed by the
   data columns beside it.
   :empty, not every last column. An actions column is the one this app leaves
   unlabelled - <th></th> above the buttons - and a bare th:last-child squeezed
   the trailing column of every table that ends in real content instead: the
   supplier scorecard's "Basis" got 78px of a 1130px table and wrapped its
   explanation into four lines, "Changes" and "Import as" the same. The cell
   half of the rule still keys on the actions block itself, so a labelled
   actions column keeps its squeeze where it counts. */
td:has(> .row-actions), th:last-child:empty { width: 1%; white-space: nowrap; }
/* Read-only values echoed into inputs stay on one line and scroll internally,
   which is correct for a field - but the field itself must not stretch. */
.field, .field input, .field select, .field textarea { max-width: 100%; }
/* Compact rows (a company's contacts, its deals) and empty-state copy both
   quote record names back at the reader, so both meet the same strings. */
.mini-row > * { min-width: 0; }
.mini-row, .empty { overflow-wrap: anywhere; }

/* --- Filter-box type-ahead ------------------------------------------------
   Anchored to a wrapper we insert, because the filter bar is a flex row and
   the input's own parent is not a positioning context. */
.suggest-wrap { position: relative; display: inline-flex; flex: 1 1 auto; min-width: 0; }
.suggest-wrap > input { width: 100%; }
.suggest { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  list-style: none; margin: 0; padding: 4px 0; max-height: 300px; overflow-y: auto;
  background: var(--card, #fff); border: 1px solid var(--line, #e5e7eb);
  border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, .16); }
.suggest li { display: flex; align-items: baseline; gap: 10px; padding: 7px 12px;
  cursor: pointer; font-size: .9rem; }
.suggest li.on, .suggest li:hover { background: var(--green-50, #f0fdf4); }
.sg-label { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.sg-hint { flex-shrink: 0; font-size: .76rem; color: var(--muted, #6b7280); }

/* --- Sortable column headings ------------------------------------------- */
.th-sort { color: inherit; text-decoration: none; display: inline-block; white-space: nowrap; }
.th-sort:hover { color: var(--green-700, #15803d); text-decoration: none; }
.th-sort.on { color: var(--green-700, #15803d); }
th[aria-sort]:not([aria-sort="none"]) { background: var(--green-50, #f0fdf4); }

/* --- Touch --------------------------------------------------------------------
   Keyed on (pointer: coarse) - a finger rather than a mouse - so a desktop keeps
   its compact controls and a phone, tablet or touch laptop gets room. Two rules
   carry most of it.

   16px on anything you type into. Safari on iOS zooms the page in when a focused
   field's text is smaller than that, and it does not zoom back out: one tap on a
   search box and the rest of the visit is a pinch-to-read exercise. The base font
   is 15px, so every input on the site qualified. (.combo-search already set this
   for the same reason - this generalises it.)

   40px on anything you tap. The published guidance is 44; 40 is what these
   controls reach without redrawing anything, and it is padding on the inside, so
   nothing shifts on a pointer device. */
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px; }
  .global-search input { font-size: 16px; }
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { min-height: 40px; }
  input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }

  .btn, button.btn { min-height: 40px; }
  .btn-sm { min-height: 40px; padding: 7px 13px; font-size: .82rem; }
  .icon-btn { min-width: 40px; min-height: 40px; justify-content: center; }
  .icon-btn, .user-btn { display: inline-flex; align-items: center; }
  .user-btn { min-height: 40px; }
  .menu-btn { font-size: 1.35rem; }
  .combo-btn { min-height: 44px; }
  .combo-opt { padding: 12px 10px; }
  .pager a, .pager span { min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
  .tabs a { padding: 12px 14px; }
  .nav-link { padding: 11px 12px; }
  .dropdown a, .dropdown button { padding: 13px 14px; }
  .suggest li { padding: 11px 12px; }
}

/* Narrow phones: give the content back the width the chrome was taking, and let
   filter controls have a line each instead of three stubs on one. */
@media (max-width: 560px) {
  .card { padding: 14px; }
  .content { padding: 16px 12px 60px; }
  /* Text fields and selects go full width on a phone; a TICK BOX must not -
     stretched to 100% it pushes its own label off the row and the page scrolls
     sideways. Same exclusion the min-height rule above already makes. */
  .filter-bar input:not([type="checkbox"]):not([type="radio"]),
  .filter-bar select, .filter-bar .combo { flex: 1 1 100%; width: 100%; min-width: 0; }
  .filter-bar .check-row { flex: 0 1 auto; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 10px; }
  /* Pair short form fields two-across instead of one long column: drop the
     minimum track width so a prefix + a code sit side by side on a phone. A
     textarea holds addresses and note lists, so it always keeps the full row -
     .full markers do this on desktop, and :has() catches the ones that lack it. */
  .form-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px 12px; }
  .form-grid .field:has(textarea) { grid-column: 1 / -1; }
  /* Buttons keep white-space: nowrap everywhere else, and the reason is written
     where that rule is. A phone is the one case where it loses: some labels are
     whole phrases - "⇩ Payments - QuickBooks CSV (last 90 days)" is a report
     name, 297px of it - and no amount of layout makes that fit 320px. Wrapping
     is at spaces only, so "Edit" is still "Edit"; the alternative was the entire
     page scrolling sideways. A table's actions cell keeps nowrap: the stacked
     row already gives it a line of its own, and its labels are short verbs. */
  .btn, button.btn { white-space: normal; }
  td:has(> .row-actions) .btn, .row-actions .btn { white-space: nowrap; }
}

/* A toast pinned top-right lands squarely on the bell and the account menu at
   phone width - after every save, the header is unusable until it times out.
   Bottom of the screen instead: out of the way, and inside thumb reach. */
@media (max-width: 560px) {
  .toasts { top: auto; bottom: 12px; left: 12px; right: 12px; max-width: none; }
  /* A modal that starts 6vh down wastes the only screen a phone has. */
  .modal-backdrop { padding: 12px; }
  .modal { padding: 16px; }
}

/* Row-select boxes are the one control a finger has to hit exactly, and the
   browser default is about 13px square. */
@media (pointer: coarse) {
  table.data td input[type="checkbox"], table.data th input[type="checkbox"] { width: 24px; height: 24px; }
}

/* --- Auth screens on a phone ---------------------------------------------------
   The picker's buttons carry business names - arbitrary text, unlike the fixed
   short labels .btn is built for, so the nowrap that stops "Edit" breaking
   mid-word pushed the whole page sideways here. Every button on an auth card is
   a one-per-line choice, so full width, centred, and free to wrap. */
.auth-card .btn { width: 100%; justify-content: center; white-space: normal; text-align: center; }
/* A consent checkbox is a flex item next to a two-line label; without this it
   gets squeezed to 13px while the label takes the room. */
.check-row input[type="checkbox"], .check-row input[type="radio"] { flex-shrink: 0; }

@media (max-width: 400px) {
  .auth-wrap { padding: 14px; }
  .auth-card { padding: 22px 18px; }
}
/* Turnstile renders a fixed 300x65 iframe. Below about 360px the card cannot
   hold that however little padding it has, and the page scrolled sideways on
   sign-in, sign-up and password reset alike. Scaling keeps the checkbox both
   legible and tappable; transform does not disturb anything around it. */
@media (max-width: 360px) {
  .cf-turnstile { transform: scale(.84); transform-origin: left center; }
}

/* --- Two-factor setup ------------------------------------------------------------
   Its own shapes because this screen is a one-off: numbered steps, a code field
   you can read at arm's length, and buttons that fill the line on any device -
   most people meet it once, on a phone, having just been told they must. */
.auth-card-wide { max-width: 460px; }
.auth-lede { color: var(--ink-soft); font-size: .92rem; margin: 2px 0 14px; }
.btn-block { width: 100%; justify-content: center; }

.setup-steps { list-style: none; counter-reset: step; margin: 4px 0 18px; padding: 0; }
.setup-steps > li { counter-increment: step; position: relative; padding: 0 0 20px 34px; }
.setup-steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--green-700); color: #fff;
  font-size: .78rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.setup-steps > li > strong { display: block; margin-bottom: 2px; }
.setup-steps .btn { margin-top: 8px; }
.setup-steps .hint { margin-top: 4px; }

.qr-box-center { display: flex; justify-content: center; margin: 10px 0; }
.qr-box-center svg { width: 176px; height: 176px; }

.copy-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.copy-key {
  flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .08em; font-size: .84rem; padding: 8px 10px;
}

/* Six digits, spaced out - this is the field people squint at. */
.code-input {
  font-size: 1.5rem; letter-spacing: .35em; text-align: center;
  font-variant-numeric: tabular-nums; padding: 10px;
}
.code-input::placeholder { letter-spacing: .35em; opacity: .35; }

.code-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px; margin: 12px 0 4px;
}
.code-grid code {
  text-align: center; padding: 9px 6px; font-size: .92rem;
  letter-spacing: .06em; background: var(--bg); border: 1px solid var(--line);
}

/* --- File drop zones -----------------------------------------------------------
   Wraps every <input type="file"> (see app.js). The real input stays inside and
   visible: a zone that hides it would take the keyboard and screen-reader path
   away with it, and "drag files here" is worthless on a phone. */
.dropzone {
  border: 1px dashed #cbd5cf; border-radius: var(--radius);
  padding: 12px; background: #fbfcfb; transition: border-color .12s, background .12s;
  /* app.js wraps whatever <input type="file"> it finds, so a zone can land in a
     flex row (.filter-bar) as easily as in a .field. A flex item defaults to
     min-width:auto - it refuses to shrink below its content - and a native file
     input's "Choose File / No file chosen" is ~284px wide, so on a 320px phone
     the zone stayed wider than the card and scrolled the whole page sideways.
     Shrinking is the component's business, not each call site's. */
  min-width: 0; max-width: 100%;
}
.dropzone-cap { font-size: .8rem; color: var(--muted); margin-bottom: 8px; }
/* max-width, not just width: the width is what a call site overrides inline
   (files/_panel.php sets width:auto so the filter-bar rule can't stretch it),
   and an inline width beats any stylesheet. The cap is what actually holds. */
.dropzone input[type="file"] { width: 100%; max-width: 100%; background: transparent; border: none; padding: 0; }
.dropzone.is-over { border-color: var(--green-600); border-style: solid; background: #f0faf2; }
/* The drag is over the zone, so nothing inside it may become the drop target
   and swallow the event - dragleave would fire as the pointer crosses a child. */
.dropzone.is-over * { pointer-events: none; }

/* Capped and scrollable: a thirty-file drop must not push the Upload button
   below the fold - the whole point of the bulk path is one click at the end. */
.dropzone-list:not(:empty) {
  margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px;
  max-height: 200px; overflow-y: auto;
}
.dropzone-file {
  display: flex; gap: 10px; align-items: baseline; justify-content: space-between;
  font-size: .84rem; padding: 2px 0;
}
.dropzone-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone-file .hint { margin: 0; white-space: nowrap; }
.dropzone-note { margin-top: 6px; font-weight: 600; }

/* --- Upload progress -----------------------------------------------------------
   Shown under the form actions while a multipart POST is in flight (app.js). */
.upload-progress { margin-top: 12px; }
.upload-progress-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 5px;
}
.upload-progress-text { font-size: .82rem; color: var(--muted); }
.upload-progress-foot .btn { flex: 0 0 auto; }
.upload-progress .progress > div { transition: width .15s linear; }
/* No measurable progress to show - a bar that sweeps says "working" without
   claiming a percentage it does not have. */
.upload-progress.is-indeterminate .progress > div {
  width: 40% !important;
  animation: upload-sweep 1.1s ease-in-out infinite;
}
@keyframes upload-sweep {
  0%   { margin-left: -40%; }
  100% { margin-left: 100%; }
}
.upload-progress.is-error .progress { background: var(--red-bg); }
.upload-progress.is-error .upload-progress-text { color: var(--red); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .upload-progress .progress > div { transition: none; }
  .upload-progress.is-indeterminate .progress > div { animation: none; margin-left: 0; width: 100% !important; }
}

/* ============================================================================
   APP POLISH & COLOUR - a green-forward accent layer (emerald, teal, lime,
   with a warm amber pop) applied app-wide, matching the marketing homepage.
   Static colour + light hover only (no scroll reveals on data pages, where
   instant content matters); safe under reduced motion.
   ============================================================================ */
/* --c-amber too: the topbar hairline and the auth-card bar below read it, and
   it was defined only on .lp and .shop-body, which no app page carries - so a
   var() with no fallback invalidated both gradients and neither ever painted. */
:root { --c-emerald:#10b981; --c-teal:#14b8a6; --c-cyan:#22d3ee;
        --c-lime:#65a30d; --c-lime-b:#a3e635; --c-amber:#f59e0b; --c-amber-b:#fbbf24; }

/* Primary buttons: a green->emerald gradient with a gentle hover lift. Outline,
   danger and ghost variants keep their own colour but share the lift. */
.btn, button.btn { transition: transform .15s ease, box-shadow .15s ease, filter .15s ease; }
.btn:not(.btn-outline):not(.btn-danger):not(.btn-ghost),
button.btn:not(.btn-outline):not(.btn-danger):not(.btn-ghost) {
  /* Every stop clears 4.5 against the white label. The old ramp ran out to
     --c-emerald (#10b981), which is 2.54 - the right-hand third of every
     primary button in the app had a label below AA on it. --c-emerald
     itself is unchanged: as a decorative accent it never carries text. */
  background: linear-gradient(120deg, var(--green-700), #0f7a43 55%, #047857);
  border-color: transparent; }
.btn:not(.btn-outline):not(.btn-danger):not(.btn-ghost):hover,
button.btn:not(.btn-outline):not(.btn-danger):not(.btn-ghost):hover {
  background: linear-gradient(120deg, var(--green-700), #0f7a43 42%, #047857); }
.btn:hover, button.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 18px -10px rgba(21,128,61,.5); }
.btn[disabled], button.btn[disabled] { transform: none; box-shadow: none; }

/* Page headings get a colourful underline accent (the homepage signature). */
.page-head h1 { position: relative; }
.page-head h1::after { content:""; display:block; margin-top:8px; width:52px; height:4px; border-radius:2px;
  background: linear-gradient(90deg, var(--green-600), var(--c-teal) 55%, var(--c-lime-b)); }

/* Sticky topbar: a bright gradient hairline underneath. */
.topbar::after { content:""; position:absolute; left:0; right:0; bottom:-1px; height:2px;
  background: linear-gradient(90deg, var(--green-600), var(--c-teal), var(--c-lime-b), var(--c-amber)); opacity:.85; }

/* (Sidebar active/hover styling lives with the .sidebar rules above.) */

/* KPI tiles: a state-coloured top bar and a subtle hover lift. */
.kpi { position: relative; overflow: hidden; transition: transform .15s ease, box-shadow .15s ease; }

/* ---------------------------------------------------------------------------
 * Dashboard: the KPI row as status tiles.
 *
 * They were six identical boxes distinguished by a coloured hairline, which
 * gave "unpaid invoices 0" and "order now 3" the same weight. A tile now says
 * the figure, whether that figure is a problem, and links to the page that
 * fixes it - so the row can be read at a glance instead of compared.
 * ------------------------------------------------------------------------- */
a.kpi { display: block; text-decoration: none; color: inherit; }
a.kpi:hover { text-decoration: none; }
.kpi-note { font-size: .74rem; color: var(--muted); margin-top: 3px; line-height: 1.35; }
/* Tinted only where something is wrong. A calm tile stays white - if every
   tile shouts, none of them does. */
.kpi.kpi-warn { background: linear-gradient(180deg, #fffbeb 0%, var(--card) 62%); }
.kpi.kpi-crit { background: linear-gradient(180deg, #fef2f2 0%, var(--card) 62%); }
.kpi.kpi-crit { border-color: #fecaca; }
.kpi.kpi-warn .kpi-note { color: #92400e; }
.kpi.kpi-crit .kpi-note { color: var(--red); }
.kpi.kpi-good .kpi-value { color: var(--green-700); }
.kpi.kpi-warn .kpi-value { color: var(--amber); }
.kpi.kpi-crit .kpi-value { color: var(--red); }
.kpi.kpi-flat .kpi-value { color: var(--ink); }
.kpi.kpi-warn::before { background: linear-gradient(90deg, var(--amber), var(--c-amber-b)); }
.kpi.kpi-crit::before { background: linear-gradient(90deg, var(--red), #f87171); }
.kpi.kpi-good::before { background: linear-gradient(90deg, var(--c-emerald), var(--c-lime-b)); }
.kpi.kpi-flat::before { background: linear-gradient(90deg, var(--line), var(--line)); }

/* The greeting, and the one line under it. */
.dash-head h1 { margin-bottom: 2px; }
.dash-line { color: var(--ink-soft); font-size: .95rem; line-height: 1.5; max-width: 62ch; }
.dash-line.is-calm { color: var(--green-700); font-weight: 600; }

/* The money line under the KPI row. Three related figures read left to right,
   not three things to click - flex-wrap rather than a grid so a narrow screen
   stacks them in reading order instead of squeezing three columns. */
.dash-money { padding: 12px 16px; margin-bottom: 16px; }
.money-row { display: flex; flex-wrap: wrap; gap: 10px 34px; }
.money-fig { display: flex; flex-direction: column; gap: 1px; min-width: 150px; }
.money-fig strong { font-size: 1.3rem; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.25; }
.money-fig .badge { align-self: flex-start; margin-top: 2px; }

/* Usage trend: the figure the sparkline is a picture of. */
.dash-trend { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 2px 0 8px; }
.dash-trend-n { font-size: 1.35rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.dash-trend-n span { font-size: .82rem; font-weight: 600; color: var(--muted); }
.dash-delta { font-size: .82rem; font-weight: 700; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.dash-delta.up   { background: var(--green-100); color: var(--green-900); }
.dash-delta.down { background: #fff7ed; color: #9a3412; }
.dash-delta.flat { background: var(--bg-soft, #f3f4f6); color: var(--muted); }

/* The row arrives with a lift, staggered left to right. Deliberately an
   animation rather than a transition: .kpi already spends `transition` on the
   hover lift, and an animation with no forwards fill hands every property
   back afterwards, so hovering a tile still feels the same as before. */
@keyframes kpi-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  /* Gated on html.js - motion.js is what sets that, so a blocked or failed
     script leaves the tiles plainly visible instead of invisible. */
  html.js .kpis .kpi[data-reveal] { opacity: 0; }
  html.js .kpis .kpi[data-reveal].in { opacity: 1; animation: kpi-in .5s cubic-bezier(.2,.7,.2,1) backwards; }
  html.js .kpis .kpi[data-reveal]:nth-child(2).in { animation-delay: .05s; }
  html.js .kpis .kpi[data-reveal]:nth-child(3).in { animation-delay: .10s; }
  html.js .kpis .kpi[data-reveal]:nth-child(4).in { animation-delay: .15s; }
  html.js .kpis .kpi[data-reveal]:nth-child(5).in { animation-delay: .20s; }
  html.js .kpis .kpi[data-reveal]:nth-child(6).in { animation-delay: .25s; }
}

/* Six tiles want a factor of six per row. auto-fit takes whatever fits, which
   around 900px and 1180px is five across and the sixth stretched alone
   underneath - a full-width band reading "Unread alerts 3". The count is fixed
   by DashboardController::index's $tiles table and pinned by a test, so this
   row can simply be told what it is. Scoped to .kpis-6 rather than .kpis: the
   same grid carries anywhere from one tile to twelve on twenty-odd other
   screens, and a factor of six is wrong for most of them.

   A tile is a tap target before it is a statistic, so a phone gets two across
   rather than six squeezed columns, and the note stays readable. */
.kpis-6 { grid-template-columns: repeat(6, 1fr); }
.kpis-6 .kpi .kpi-value { font-variant-numeric: tabular-nums; font-size: 1.75rem; line-height: 1.1; }
@media (max-width: 1199px) { .kpis-6 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) {
  .kpis-6 { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpis-6 .kpi { padding: 12px 13px; }
  .kpis-6 .kpi .kpi-value { font-size: 1.5rem; }
  .kpis-6 .kpi-note { font-size: .7rem; }
}
.kpi::before { content:""; position:absolute; inset:0 0 auto 0; height:3px;
  background: linear-gradient(90deg, var(--green-600), var(--c-emerald)); }
.kpi.warn::before { background: linear-gradient(90deg, var(--amber), var(--c-amber-b)); }
.kpi.crit::before { background: linear-gradient(90deg, var(--red), #f87171); }
.kpi.good::before { background: linear-gradient(90deg, var(--c-emerald), var(--c-lime-b)); }
.kpi:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -14px rgba(20,83,45,.35); }

/* Active tab: a gradient underline replacing the flat green rule. */
.tabs a.on { box-shadow: none; position: relative; }
.tabs a.on::after { content:""; position:absolute; left:8px; right:8px; bottom:-2px; height:2px;
  background: linear-gradient(90deg, var(--green-600), var(--c-teal), var(--c-lime-b)); }

/* Auth card: a colour bar across the top of the sign-in / register screens. */
.auth-card { position: relative; overflow: hidden; }
.auth-card::before { content:""; position:absolute; inset:0 0 auto 0; height:4px;
  background: linear-gradient(90deg, var(--green-600), var(--c-teal), var(--c-lime-b), var(--c-amber)); }

@media (prefers-reduced-motion: reduce) {
  .btn, button.btn, .kpi { transition: none; }
}

/* ---- Order track -----------------------------------------------------------
   The status steps and the payment/production milestones of a PO, as one
   readable line that wraps instead of scrolling. Shared by the buyer's order
   sheet and the supplier portal, from one PoMilestoneService::track(). */
.po-track { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0 0 14px; padding: 0;
            counter-reset: postep; }
.po-step { display: flex; flex-direction: column; gap: 1px; flex: 0 1 auto; min-width: 0;
           border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px 6px;
           background: #fff; position: relative; }
/* The connector between steps. Drawn on the step rather than between them, so
   a row that wraps does not leave an arrow pointing at nothing. */
.po-step + .po-step::before { content: ""; position: absolute; left: -8px; top: 50%; width: 8px;
                              height: 1px; background: var(--line); }
.po-step-t { font-size: .76rem; font-weight: 700; color: var(--muted); white-space: nowrap;
             overflow: hidden; text-overflow: ellipsis; }
.po-step-d { font-size: .7rem; color: var(--muted); white-space: nowrap; }
/* The money note is a phrase where the date beside it is a date. "$200.00 of
   $267.00 paid · supplier confirms $150.00" under nowrap has a min-content
   width nothing gets under - wider than the whole card on a 320px phone, which
   took the page sideways with it. Wrapping is at spaces only, so no figure is
   ever split; the date keeps nowrap, because "Aug 7," / "2026" reads badly. */
.po-step-m { white-space: normal; }
.po-step.is-done { border-color: var(--green-600); background: var(--green-100); }
.po-step.is-done .po-step-t { color: var(--green-900); }
.po-step.is-done .po-step-d { color: var(--green-700); }
.po-step.is-now { border-color: #f59e0b; background: #fffbeb; }
.po-step.is-now .po-step-t { color: #92400e; }
.po-step.is-est { border-style: dashed; }
.po-step.is-cancelled { border-color: #dc2626; background: #fef2f2; color: #991b1b; font-weight: 700;
                        font-size: .76rem; }
@media (max-width: 560px) {
  .po-track { gap: 6px; }
  .po-step { padding: 6px 9px 5px; flex: 1 1 calc(50% - 6px); }
  .po-step + .po-step::before { display: none; }
  .po-step-t { white-space: normal; }
}

/* Shortlist lines in the lead queue: a list, tight, no bullets stealing width. */
.lead-skus { margin: 4px 0 0; padding: 0; list-style: none; font-size: .9em; }
.lead-skus li { padding: 1px 0; }

/* --- Public product page: the pieces that used to be behind the wall ------- */
.qty-calc { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line, #e5e7eb);
  border-radius: 8px; background: #fafafa; }
.qty-calc label { display: block; font-weight: 600; font-size: .9em; margin-bottom: 6px; }
.qty-calc-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.qty-calc-row input { max-width: 11rem; }
/* min-height so the answer appearing does not shove the buttons down the page
   the first time somebody types - a layout shift under the cursor. */
.qty-calc-out { margin: 8px 0 0; font-size: .92em; min-height: 1.2em; }
/* The availability verdict. NOT given a min-height like the line above it:
   this one is hidden outright when there is nothing to say, and reserving a
   row for an element that may never appear puts permanent white space in a
   card that is already the densest thing on the page. It only ever appears
   after the price line, which has absorbed the first shift already. */
.qty-calc-stock { margin: 4px 0 0; font-size: .92em; font-weight: 600; }
.qty-calc-stock.is-ready { color: var(--green-700, #15803d); }
/* Amber, not red: made-to-order is a lead time, not a refusal, and the page
   sells plenty of things that were never on a shelf. */
.qty-calc-stock.is-made  { color: #b45309; }

.lead-time { margin-top: 12px; padding: 10px 12px; border-left: 3px solid var(--green-600, #16a34a);
  background: #f0fdf4; border-radius: 0 6px 6px 0; }
.cert-list { margin-top: 12px; }
.cert-list ul { margin: 0 0 6px; padding-left: 18px; }
.cert-list li { padding: 1px 0; }

.brand-teaser { border-left: 3px solid var(--c-teal, #14b8a6); }

/* Grouped category chips: a heading, then its chips, wrapping as one unit. */
.cat-nav-grouped { flex-direction: column; align-items: flex-start; gap: 10px; }
.cat-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cat-group-h {
  font-size: .78em; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted, #6b7280); margin-right: 2px;
}
/* The pager is a window now, so it needs an ellipsis that is not a link. */
.pager-gap { padding: 0 4px; color: var(--muted, #6b7280); }

/* --- The storefront cart ------------------------------------------------------
   The header link and the product page's quantity row. The cart page itself is
   the quote list's table (.ql-line above) with a Remove column. */
.shop-cart { display: inline-flex; align-items: center; gap: 5px; }
.cart-add { align-items: center; }
.cart-add label { margin: 0; }
.cart-add .cart-qty { width: 8.5rem; }
.cart-remove { white-space: nowrap; }
/* On a phone five columns leave the product name a word per line and Remove a
   letter per line. Each line becomes a small card instead: the product across
   the top, then price | minimum, then quantity | Remove, each figure under its
   own label (the header row is hidden, so the labels ride on the cells). */
@media (max-width: 600px) {
  .cart-table thead { display: none; }
  .cart-table, .cart-table tbody { display: block; }
  .cart-table tr {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; align-items: end;
    padding: 12px 0; border-bottom: 1px solid var(--line);
  }
  .cart-table td { display: block; padding: 0; border: 0; }
  .cart-table td.cart-product { grid-column: 1 / -1; }
  .cart-table td[data-label]::before {
    content: attr(data-label); display: block;
    font-size: .72rem; font-weight: 600; color: var(--muted);
  }
  .cart-table td.cart-remove { justify-self: end; padding-bottom: 10px; }
  .cart-table input[data-cart-qty] { width: 100%; }
}

/* --- The cart's maths ----------------------------------------------------------
   Per-line price at the typed quantity, and the estimate under the table. */
.cart-qty-h { width: 16rem; }
.cart-calc { margin: 4px 0 0; font-size: .86em; }
.cart-sum { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.cart-sum-total { margin: 0; font-weight: 600; }
[data-cart-empty] { margin-top: 4px; }
@media (max-width: 600px) {
  .cart-table td.cart-qty { grid-column: 1 / -1; }
}

/* --- The storefront grid's controls -------------------------------------------
   The bar's two lists and its Undo; the Quantity box; add-all under a rail. */
.cmp-part { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cmp-part:not([hidden]) ~ .cmp-part:not([hidden]) { padding-left: 10px; border-left: 1px solid var(--line); }
.grid-qty { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.grid-qty label { margin: 0; font-weight: 600; }
.grid-qty input { width: 8.5rem; }
.rail-addall { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

/* The cart line's sizes: one select per option group under the product name. */
.cart-sizes { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.cart-sizes select { max-width: 100%; font-size: .85rem; }

/* CRM links: the live "also in a linked CRM" warning on the contact and company forms. */
.crm-link-warn { border: 1px solid var(--amber); background: rgba(245, 158, 11, .08); border-radius: 8px;
  padding: 8px 12px; margin-bottom: 12px; font-size: .9rem; }
.crm-link-warn ul { margin: 4px 0 0; padding-left: 18px; }
