/* Dr.SANTE New Zealand trade portal. Design system v1 (4 November 2026), documented in portal/DESIGN.md.
   Family resemblance with site/DESIGN.md: Cabinet Grotesk 700 + Satoshi, ink #162A7A, flat colour, square edges, 1px hairlines.
   Working-tool scale: denser type, sidebar shell, tables. Light only. */
@font-face { font-family: "Cabinet Grotesk"; src: url(/assets/fonts/CabinetGrotesk-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Satoshi"; src: url(/assets/fonts/Satoshi-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Satoshi"; src: url(/assets/fonts/Satoshi-500.woff2) format("woff2"); font-weight: 500 700; font-display: swap; }

/* ---------- 1. Tokens ---------- */
:root {
  color-scheme: light;
  /* colour */
  --ground: #F6FBFF; --surface: #FFFFFF; --tile: #EAF4FD; --tile-2: #F2F8FE;
  --ink: #162A7A; --ink-2: #0F1F5E; --text: #2A3352; --text-2: #5A6382; --text-3: #6B7391;
  --accent: #4CA6FC; --accent-soft: rgba(76, 166, 252, .14);
  --rule: rgba(22, 42, 122, .12); --line: rgba(22, 42, 122, .30); --line-strong: rgba(22, 42, 122, .5);
  --ok: #1E6B45; --ok-bg: #EAF6EF; --warn: #8A5300; --warn-bg: #FFF5E0; --error: #A3222E; --error-bg: #FCEFEF;
  --info: #1F4F96; --info-bg: #EAF2FD; --mute: #5A6382; --mute-bg: #EEF1F6;
  /* type */
  --font-display: "Cabinet Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-text: "Satoshi", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fs-h1: clamp(28px, 1vw + 22px, 32px); --lh-h1: 1.12;
  --fs-h2: clamp(20px, .4vw + 18px, 22px); --lh-h2: 1.25;
  --fs-h3: 17px; --lh-h3: 24px;
  --fs-body: 15px; --lh-body: 24px;
  --fs-small: 13px; --lh-small: 20px;
  --fs-stat: clamp(26px, 1.4vw + 18px, 34px);
  /* space (4px base) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 40px; --s-9: 56px;
  --gutter: clamp(16px, 3vw, 40px);
  --sidebar-w: 248px; --content-max: 1240px; --tap: 44px;
  /* surface: the one shadow */
  --shadow: 0 1px 2px rgba(22, 42, 122, .05), 0 6px 20px -12px rgba(22, 42, 122, .18);
  /* motion */
  --ease-out: cubic-bezier(.23, 1, .32, 1); --ease-drawer: cubic-bezier(.32, .72, 0, 1);
  --t-fast: 120ms; --t-med: 200ms;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body { margin: 0; background: var(--ground); color: var(--text); font: 400 var(--fs-body)/var(--lh-body) var(--font-text); -webkit-font-smoothing: antialiased; min-height: 100vh; min-height: 100dvh; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; color: var(--ink); text-wrap: balance; margin: 0 0 var(--s-3); }
h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); letter-spacing: -.02em; }
h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); letter-spacing: -.01em; }
h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); letter-spacing: -.005em; }
p { margin: 0 0 var(--s-4); text-wrap: pretty; }
a { color: var(--ink); }
img { max-width: 100%; }
.lead { font-size: 16px; line-height: 24px; color: var(--text-2); max-width: 44em; margin: 0 0 var(--s-6); }
.small, .muted { font-size: var(--fs-small); line-height: var(--lh-small); color: var(--text-2); }
.muted { opacity: 1; }
.num, td.num, th.num, .tabular { font-variant-numeric: tabular-nums; }
.text-link { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: .2em; text-decoration-thickness: 1px; transition: text-decoration-color var(--t-fast) ease; }
.text-link:hover { text-decoration-color: var(--ink); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: var(--s-3); top: -60px; z-index: 100; background: var(--ink); color: #fff; padding: var(--s-2) var(--s-4); text-decoration: none; font-weight: 500; }
.skip-link:focus { top: var(--s-3); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--ink); }
.icon { flex: none; display: block; }
hr { border: 0; border-top: 1px solid var(--rule); margin: var(--s-6) 0; }

/* ---------- 3. App shell ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: var(--s-3); height: 56px; padding: 0 var(--s-2) 0 var(--gutter); background: rgba(246, 251, 255, .94); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--rule); }
.topbar .role-chip { margin-right: auto; }
@media (max-width: 479px) { .topbar .brand span { display: none; } }
.topbar .brand { min-width: 0; }
.brand { display: flex; align-items: center; gap: var(--s-3); text-decoration: none; color: var(--ink); font: 500 13px/20px var(--font-text); letter-spacing: .02em; }
.brand img { display: block; height: 20px; width: auto; }
.brand span { padding-left: var(--s-3); border-left: 1px solid var(--rule); white-space: nowrap; }
.role-chip { display: inline-flex; align-items: center; height: 24px; padding: 0 var(--s-2); font: 500 12px/1 var(--font-text); letter-spacing: .04em; text-transform: uppercase; color: var(--ink); background: var(--tile); border: 1px solid var(--rule); white-space: nowrap; }
.menu-btn, .menu-close { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-width: var(--tap); min-height: var(--tap); padding: 0 var(--s-3); color: var(--ink); text-decoration: none; font-weight: 500; border: 1px solid transparent; }
.menu-btn:hover, .menu-close:hover { background: var(--tile); }
.shell { min-height: calc(100dvh - 56px); }
.app-main { display: flex; flex-direction: column; min-width: 0; min-height: calc(100dvh - 56px); }
.app-main main { flex: 1; }
main { width: 100%; max-width: calc(var(--content-max) + 2 * var(--gutter)); margin: 0 auto; padding: var(--s-7) var(--gutter) var(--s-9); }
main.narrow { max-width: calc(560px + 2 * var(--gutter)); }
.site-foot { padding: var(--s-5) var(--gutter); border-top: 1px solid var(--rule); font-size: var(--fs-small); color: var(--text-2); }

/* sidebar: off-canvas sheet below 1024px, persistent column above */
.sidebar { position: fixed; z-index: 50; inset: 0 auto 0 0; width: min(86vw, 320px); display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-4) var(--s-3) var(--s-4); background: var(--surface); border-right: 1px solid var(--rule); overflow-y: auto; overscroll-behavior: contain; transform: translateX(-102%); visibility: hidden; transition: transform 260ms var(--ease-drawer), visibility 0s linear 260ms; }
.sidebar:target, .sidebar.is-open { transform: none; visibility: visible; transition: transform 260ms var(--ease-drawer), visibility 0s; box-shadow: var(--shadow); }
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(15, 31, 94, .28); opacity: 0; pointer-events: none; transition: opacity var(--t-med) ease; }
.sidebar:target ~ .scrim, .sidebar.is-open ~ .scrim { opacity: 1; pointer-events: auto; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); padding: 0 0 0 var(--s-2); min-height: var(--tap); }
.sidebar > .role-chip { align-self: flex-start; margin: 0 var(--s-2) var(--s-2); }
.app-nav { display: grid; gap: 2px; margin: 0; }
.nav-item { position: relative; display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: var(--tap); padding: 0 var(--s-3); color: var(--text); text-decoration: none; font: 500 14px/20px var(--font-text); border: 0; background: none; cursor: pointer; text-align: left; transition: background-color var(--t-fast) ease, color var(--t-fast) ease; }
.nav-item .icon { color: var(--text-3); transition: color var(--t-fast) ease; }
.nav-label { flex: 1; display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.nav-item:hover { background: var(--tile-2); color: var(--ink); }
.nav-item:hover .icon { color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--tile); color: var(--ink); }
.nav-item[aria-current="page"] .icon { color: var(--ink); }
.nav-item[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; background: var(--ink); }
.nav-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; margin-left: auto; padding: 0 6px; font: 500 12px/1 var(--font-text); font-variant-numeric: tabular-nums; color: #fff; background: var(--ink); }
.sidebar-foot { margin-top: auto; padding-top: var(--s-3); border-top: 1px solid var(--rule); display: grid; gap: 2px; }
.sidebar-foot form { margin: 0; }
.sidebar-foot .link-btn { min-height: var(--tap); }
.who { display: block; padding: var(--s-1) var(--s-3) var(--s-2); font-size: 12px; line-height: 18px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (min-width: 1024px) {
  .topbar, .menu-close, .scrim { display: none; }
  .shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100dvh; }
  .app-main { min-height: 100dvh; }
  .sidebar { position: sticky; top: 0; height: 100dvh; width: auto; transform: none; visibility: visible; transition: none; box-shadow: none; background: var(--surface); padding-top: var(--s-6); }
  .sidebar-head { padding-left: var(--s-3); margin-bottom: var(--s-1); }
  .sidebar > .role-chip { margin-left: var(--s-3); }
  main { padding-top: var(--s-8); }
}

/* sign-in pages: narrow centred card, no sidebar */
body.auth { display: flex; flex-direction: column; min-height: 100dvh; }
.auth-head { display: flex; justify-content: center; padding: var(--s-8) var(--gutter) 0; }
body.auth main { flex: 1; display: flex; flex-direction: column; justify-content: center; padding-top: var(--s-6); }
.auth-card { background: var(--surface); border: 1px solid var(--rule); box-shadow: var(--shadow); padding: clamp(24px, 5vw, 40px); }
.auth-card .stack { max-width: none; }
.auth-card .stack + .small { margin-top: var(--s-4); }
.auth-card .auth-help { margin-top: var(--s-4); text-align: center; text-wrap: balance; }
body.auth .site-foot { text-align: center; border-top: 0; }

/* ---------- 4. Page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-3) var(--s-6); margin: 0 0 var(--s-6); }
.page-head-text { flex: 1 1 320px; min-width: 0; }
.page-head h1 { margin-bottom: var(--s-2); }
.page-head .lead { margin: 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.back-link, .breadcrumb { flex-basis: 100%; display: inline-flex; align-items: center; gap: var(--s-1); font-size: var(--fs-small); color: var(--text-2); text-decoration: none; min-height: 32px; }
.back-link::before { content: "\2190"; }
.back-link:hover, .breadcrumb a:hover { color: var(--ink); text-decoration: underline; }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-2); list-style: none; margin: 0; padding: 0; }
.breadcrumb li + li::before { content: "/"; margin-right: var(--s-2); color: var(--line); }
.breadcrumb a { color: inherit; text-decoration: none; }
main > h1:first-child, main > nav + h1 { margin-top: 0; }

/* ---------- 5. Surfaces ---------- */
.card, .panel { background: var(--surface); border: 1px solid var(--rule); padding: clamp(16px, 2.2vw, 24px); margin: 0 0 var(--s-5); }
.card-raised { box-shadow: var(--shadow); }
.panel > h2:first-child, .card > h2:first-child { margin-top: 0; }
.notice { background: var(--surface); border: 1px solid var(--accent); padding: var(--s-5); margin: 0 0 var(--s-5); }
.account-grid { display: grid; gap: var(--s-5); align-items: start; }
.account-grid > * { margin: 0; }
@media (min-width: 900px) { .account-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); } }
.grid-2, .grid-3 { display: grid; gap: var(--s-4); }
@media (min-width: 760px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* stat tiles */
.stats { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin: 0 0 var(--s-6); }
.stat { display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-4) var(--s-5); background: var(--surface); border: 1px solid var(--rule); color: var(--text); text-decoration: none; min-width: 0; }
.stat-label { font: 500 13px/18px var(--font-text); color: var(--text-2); }
.stat-value { font: 700 var(--fs-stat)/1.1 var(--font-display); color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.01em; overflow-wrap: anywhere; }
.stat-note { font-size: var(--fs-small); line-height: 18px; color: var(--text-2); }
.stat-note.up { color: var(--ok); } .stat-note.down { color: var(--error); }
a.stat { transition: border-color var(--t-fast) ease; } a.stat:hover { border-color: var(--line-strong); }

/* dashboard cards (home.js): link tiles in a grid, same anatomy as .stat */
.cards { display: grid; grid-template-columns: 1fr; gap: var(--s-3); margin-top: var(--s-4); }
@media (min-width: 560px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cards .card { display: flex; flex-direction: column; gap: var(--s-1); margin: 0; padding: var(--s-4) var(--s-5); color: var(--text); text-decoration: none; min-height: var(--tap); transition: border-color var(--t-fast) ease; }
.cards a.card:hover { border-color: var(--line-strong); }
.card-n { font: 700 var(--fs-stat)/1.1 var(--font-display); color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; order: 2; }
.card-label { font: 500 13px/18px var(--font-text); color: var(--text-2); order: 1; }
.card-sub { font-size: var(--fs-small); line-height: 18px; color: var(--text-2); order: 3; }
.card-alert { border-left: 3px solid var(--accent); }
.card-zero .card-n { color: var(--text-3); }

/* ---------- 6. Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: var(--s-2) 0 var(--s-5); background: var(--surface); border: 1px solid var(--rule); max-width: 100%; }
.panel .table-wrap, .card .table-wrap { border-left: 0; border-right: 0; }
.table, table.data { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; line-height: 20px; }
.table th, .table td, table.data th, table.data td { text-align: left; vertical-align: top; padding: 10px var(--s-3); border-bottom: 1px solid var(--rule); }
.table thead th, table.data thead th { position: sticky; top: 0; z-index: 1; background: var(--tile-2); font: 500 12px/16px var(--font-text); letter-spacing: .03em; text-transform: uppercase; color: var(--text-2); white-space: nowrap; }
.table tbody tr, table.data tbody tr { transition: background-color var(--t-fast) ease; }
.table tbody tr:hover, table.data tbody tr:hover { background: var(--tile-2); }
.table tbody tr:last-child td, table.data tbody tr:last-child td { border-bottom: 0; }
.table .num, table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tr.total td, .table tr.total td { font-weight: 500; color: var(--ink); border-top: 1px solid var(--line-strong); background: var(--tile-2); }
.table td.actions { text-align: right; white-space: nowrap; }
td.over, [data-remaining].over { color: var(--error); font-weight: 500; }
tr.is-unread td:first-child a { font-weight: 700; }

/* ---------- 7. Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 var(--s-2); font: 500 12px/1 var(--font-text); letter-spacing: .01em; white-space: nowrap; color: var(--mute); background: var(--mute-bg); border: 1px solid transparent; text-transform: capitalize; }
.badge::before { content: ""; width: 6px; height: 6px; background: currentColor; flex: none; }
.badge-plain { text-transform: none; }
.badge-draft, .badge-expired { color: var(--mute); background: var(--mute-bg); }
.badge-awaiting, .badge-pending { color: var(--warn); background: var(--warn-bg); }
.badge-paid, .badge-accepted, .badge-received { color: var(--ok); background: var(--ok-bg); }
.badge-dispatched { color: var(--info); background: var(--info-bg); }
.badge-cancelled, .badge-revoked, .badge-out { color: var(--error); background: var(--error-bg); }
.badge-low { color: var(--warn); background: var(--warn-bg); border-color: rgba(138, 83, 0, .25); }
.badge-unread { color: #fff; background: var(--ink); }
.badge-note { color: #7A4B00; background: #FFF8E6; border-color: #B7791F; text-transform: none; }

/* ---------- 8. Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); justify-self: start; min-height: var(--tap); padding: 0 var(--s-5); font: 500 15px/20px var(--font-text); letter-spacing: .01em; text-decoration: none; white-space: nowrap; cursor: pointer; color: #fff; background: var(--ink); border: 1px solid var(--ink); transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease, color var(--t-fast) ease, transform var(--t-fast) var(--ease-out); -webkit-tap-highlight-color: transparent; }
.btn:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn:active, .nav-item:active, .stepper button:active { transform: scale(.97); }
.btn-primary { color: #fff; background: var(--ink); border-color: var(--ink); }
.btn-secondary { color: var(--ink); background: var(--surface); border-color: var(--line); }
.btn-secondary:hover { background: var(--tile); border-color: var(--ink); color: var(--ink); }
.btn-ghost { color: var(--ink); background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--tile); border-color: transparent; color: var(--ink); }
.btn-danger { color: #fff; background: var(--error); border-color: var(--error); }
.btn-danger:hover { background: #861B25; border-color: #861B25; }
.btn-sm, .btn-small { min-height: 36px; padding: 0 var(--s-3); font-size: 14px; }
.btn-lg { min-height: 52px; padding: 0 var(--s-7); font-size: 16px; }
.btn-block { width: 100%; justify-self: stretch; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
@media (pointer: coarse) { .btn-sm, .btn-small { min-height: var(--tap); } }
.link-btn { display: inline-flex; align-items: center; min-height: 32px; font: 500 14px/20px var(--font-text); color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: .2em; }
.link-btn:hover { text-decoration-color: currentColor; }
.link-btn.danger { color: var(--error); }
.sidebar-foot .link-btn { text-decoration: none; padding: 0 var(--s-3); }
.action-row { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-6); align-items: end; margin: var(--s-4) 0; }

/* ---------- 9. Forms ---------- */
.stack { display: grid; gap: var(--s-4); max-width: 560px; }
.form-narrow { max-width: 520px; }
.form-narrow > label { margin-bottom: -8px; }
label { display: grid; gap: 6px; font: 500 14px/20px var(--font-text); color: var(--ink); }
.req, label .req { color: var(--error); margin-left: 2px; }
input, select, textarea { width: 100%; font: 400 15px/22px var(--font-text); color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 0; padding: 10px 12px; min-height: var(--tap); transition: border-color var(--t-fast) ease; }
@media (pointer: coarse) { input, select, textarea { font-size: 16px; } }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
select { max-width: 100%; appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23162A7A' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
textarea { min-height: 120px; resize: vertical; }
input[readonly] { background: var(--tile-2); color: var(--ink); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--ink); }
input[type="file"] { padding: 10px; min-height: 48px; }
.hint { font-weight: 400; color: var(--text-2); font-size: var(--fs-small); line-height: 18px; }
.field-error { display: block; margin-top: -2px; font-size: var(--fs-small); line-height: 18px; color: var(--error); font-weight: 500; }
[aria-invalid="true"] { border-color: var(--error); }
fieldset { border: 1px solid var(--rule); margin: 0; padding: var(--s-5); display: grid; gap: var(--s-4); }
fieldset[hidden] { display: none; }
legend { font: 500 14px/20px var(--font-text); color: var(--ink); padding: 0 6px; }
label.check, .radio { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--s-2); font-weight: 500; }
label.check input, .radio input { width: 18px; }
.radio .hint { flex-basis: 100%; padding-left: 26px; }
.kind-pick { gap: var(--s-3); }
.inline-form { margin: 0 0 var(--s-2); }
.copy-row { display: flex; gap: var(--s-2); margin-bottom: var(--s-3); }
.copy-row input { font-size: 14px; }
.line-row { display: grid; grid-template-columns: 1fr 6.5rem; gap: var(--s-3); align-items: end; }
.line-row select { min-width: 0; width: 100%; }
.qty-input { width: 5.5rem; }

/* quantity stepper: works as a plain number input without JS */
.stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--line); background: var(--surface); height: var(--tap); }
.stepper:focus-within { border-color: var(--ink); }
.stepper input { width: 4.5rem; min-height: 0; height: 100%; border: 0; text-align: center; font-variant-numeric: tabular-nums; padding: 0 var(--s-1); -moz-appearance: textfield; }
.stepper input:focus-visible { outline: none; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper button { width: var(--tap); border: 0; background: var(--tile-2); color: var(--ink); font: 500 18px/1 var(--font-text); cursor: pointer; transition: background-color var(--t-fast) ease, transform var(--t-fast) var(--ease-out); -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.stepper button:hover { background: var(--tile); }
.stepper button:disabled { color: var(--text-3); opacity: .5; cursor: default; }
.stepper button[hidden] { display: none; }

/* filters bar */
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: var(--s-3); margin: 0 0 var(--s-5); padding: var(--s-3); background: var(--surface); border: 1px solid var(--rule); }
.filters > label { flex: 1 1 180px; min-width: 160px; font-size: 13px; }
.filters > .search, .filters > input[type="search"] { flex: 2 1 240px; }
.filters .btn { flex: 0 0 auto; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--s-3); font: 500 13px/1 var(--font-text); color: var(--text); background: var(--surface); border: 1px solid var(--line); text-decoration: none; cursor: pointer; }
.chip[aria-pressed="true"], .chip[aria-current="true"], .chip.is-active { color: #fff; background: var(--ink); border-color: var(--ink); }
.filter-note { font-size: var(--fs-small); color: var(--text-2); }

/* product thumbnails */
.thumb, .thumb-lg { flex: none; display: inline-grid; place-items: center; width: 48px; height: 48px; background: #fff; border: 1px solid var(--rule); overflow: hidden; vertical-align: middle; }
.thumb-lg { width: 96px; height: 96px; }
.thumb img, .thumb-lg img { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb[data-initials]:empty::before, .thumb-lg[data-initials]:empty::before { content: attr(data-initials); font: 700 15px/1 var(--font-display); letter-spacing: .02em; color: var(--text-3); text-transform: uppercase; }
.thumb[data-initials]:empty, .thumb-lg[data-initials]:empty { background: var(--tile-2); }
.thumb-lg[data-initials]:empty::before { font-size: 24px; }
.product-cell { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }

/* flash messages */
.msg, .flash { display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-left: 3px solid; max-width: 760px; margin: 0 0 var(--s-5); font-weight: 500; transition: opacity var(--t-med) ease, transform var(--t-med) var(--ease-out); }
.msg-error, .flash-error { color: var(--error); background: var(--error-bg); border-color: var(--error); }
.msg-ok, .flash-ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok); }
.flash-info { color: var(--info); background: var(--info-bg); border-color: var(--info); }
.flash-close { margin-left: auto; min-width: 32px; min-height: 32px; border: 0; background: none; color: inherit; cursor: pointer; font-size: 18px; line-height: 1; }
.flash.is-leaving { opacity: 0; transform: translateY(-4px); }

/* empty state */
.empty { color: var(--text-2); padding: var(--s-4) 0 0; margin: 0; }
div.empty, section.empty { display: grid; justify-items: center; gap: var(--s-2); text-align: center; padding: var(--s-8) var(--s-5); background: var(--surface); border: 1px dashed var(--line); }
div.empty h3, section.empty h3 { margin: 0; }
div.empty p, section.empty p { margin: 0 0 var(--s-2); max-width: 36em; }

/* summary bar: sticky footer on phones, side panel on desktop */
.with-summary { display: grid; gap: var(--s-6); align-items: start; }
.summary-bar { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin: var(--s-5) calc(-1 * var(--gutter)) 0; padding: var(--s-3) var(--gutter) calc(var(--s-3) + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -8px 20px -16px rgba(22, 42, 122, .35); }
.summary-bar dl { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-5); margin: 0; }
.summary-bar dt { font-size: 12px; line-height: 16px; color: var(--text-2); }
.summary-bar dd { margin: 0; font: 700 18px/24px var(--font-display); color: var(--ink); font-variant-numeric: tabular-nums; }
@media (min-width: 1280px) {
  .with-summary { grid-template-columns: minmax(0, 1fr) 300px; }
  .with-summary .summary-bar { position: sticky; top: var(--s-6); bottom: auto; margin: 0; padding: var(--s-5); flex-direction: column; align-items: stretch; border: 1px solid var(--rule); box-shadow: var(--shadow); }
  .with-summary .summary-bar dl { flex-direction: column; gap: var(--s-3); }
}

/* ---------- 10. Existing page parts (kept for the partner and admin modules) ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: var(--s-2) var(--s-5); padding: var(--s-3) 0; border-top: 1px solid var(--rule); }
.row:first-child { border-top: 0; }
.row-main { display: grid; gap: 2px; min-width: 0; }
.row-title { font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.row-sub { font-size: var(--fs-small); line-height: var(--lh-small); color: var(--text-2); }
.row-actions { display: flex; gap: var(--s-3); }
.row-actions form { margin: 0; }
.next { margin: 0; padding: 0; list-style: none; }
.next li { padding: var(--s-3) 0; border-top: 1px solid var(--rule); }
.facts { display: flex; flex-wrap: wrap; gap: var(--s-4) var(--s-8); margin: 0 0 var(--s-2); }
.facts dt { font-size: var(--fs-small); color: var(--text-2); }
.facts dd { margin: 0; font-weight: 500; color: var(--ink); text-transform: capitalize; }
.account-facts { display: grid; gap: var(--s-3); }
.account-facts div { display: grid; gap: 2px; padding-bottom: var(--s-3); border-bottom: 1px solid var(--rule); }
.account-facts div:last-child { border-bottom: 0; padding-bottom: 0; }
.account-facts dd, .thread-facts dd { text-transform: none; overflow-wrap: anywhere; }
.login-aside { margin-top: var(--s-6); padding-top: var(--s-4); border-top: 1px solid var(--rule); }
.login-aside p { margin: 0; }
.login-aside p + p { margin-top: var(--s-1); }
.shipment { margin: 0 0 var(--s-6); }
.shipment h3 { margin: 0 0 var(--s-1); font-size: 16px; }
.admin-note { font-style: italic; }
.money-grid { display: grid; grid-template-columns: 1fr; gap: var(--s-4); margin-top: var(--s-3); }
@media (min-width: 760px) { .money-grid { grid-template-columns: 1fr 1fr; } }
.money-month { background: var(--surface); border: 1px solid var(--rule); padding: var(--s-4) var(--s-5); }
.money-month h3 { margin-top: 0; }
.money-list { margin: 0; }
.money-list div, .top-list li { display: flex; justify-content: space-between; gap: var(--s-3); padding: 6px 0; border-bottom: 1px solid var(--rule); }
.money-list dt { color: var(--text-2); }
.money-list dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 500; text-align: right; color: var(--ink); }
.top-list { padding-left: 1.25rem; }
.activity { list-style: none; padding: 0; margin: 0; }
.activity li { padding: var(--s-2) 0; border-bottom: 1px solid var(--rule); overflow-wrap: anywhere; }
.activity .muted { display: block; font-size: 12px; }
.export-list { padding-left: 1.25rem; }
.export-list li { padding: var(--s-1) 0; }
.jump { position: sticky; top: 56px; z-index: 5; display: flex; gap: 6px var(--s-4); overflow-x: auto; padding: var(--s-2) 0; margin-top: var(--s-4); background: var(--ground); border-bottom: 1px solid var(--rule); white-space: nowrap; }
@media (min-width: 1024px) { .jump { top: 0; } }
.jump a { color: var(--ink); font-weight: 500; text-decoration: none; padding: 6px 0; }
.jump a:hover { text-decoration: underline; }
section[id] { scroll-margin-top: 72px; }
.all-clear-line { display: none; }
.statement { background: var(--surface); border: 1px solid var(--rule); padding: clamp(16px, 3vw, 32px); margin: 0 0 var(--s-6); }
.statement-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-4); }
.statement-head h2 { margin: 0; font-size: 18px; }
.statement-from { font-weight: 700; margin: 0; }
.statement h3 { font-size: 16px; margin: var(--s-4) 0 var(--s-1); }
.statement table.data th, .statement table.data td { padding: 8px 6px; }
.statement-meta .doc-title { font-size: 24px; line-height: 30px; }
.pay-box { border-left: 3px solid var(--ink); padding: var(--s-1) 0 var(--s-1) var(--s-4); margin: var(--s-4) 0; }
[data-sales-form] table.data th { white-space: normal; }
/* messages */
.message-form { max-width: 760px; }
.link-panel h2 { font-size: 18px; line-height: 24px; }
.link-items { margin: var(--s-2) 0 0; padding-left: 20px; }
.thread { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-4); }
.msg-item { padding: var(--s-4) var(--s-5); border: 1px solid var(--rule); background: var(--surface); }
.msg-team { background: var(--tile); border-color: var(--tile); margin-left: clamp(0px, 6vw, 64px); }
.msg-note { background: #FFF8E6; border: 1px dashed #B7791F; margin-left: clamp(0px, 6vw, 64px); }
.msg-meta { margin: 0 0 var(--s-2); font-size: var(--fs-small); line-height: var(--lh-small); color: var(--text-2); }
.msg-meta strong { color: var(--ink); font-weight: 500; }
.msg-body { white-space: normal; }
.msg-photos { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-3); }
.photo-thumb { display: grid; place-items: center; width: 112px; height: 112px; border: 1px solid var(--rule); background: #fff; overflow: hidden; }
.photo-thumb img { width: 112px; height: 112px; object-fit: cover; display: block; }
.msg-event { font-size: 12px; line-height: 18px; color: var(--text-2); text-align: center; }

/* ---------- 11. Small screens ---------- */
@media (max-width: 640px) {
  main { padding-top: var(--s-6); }
  .row { grid-template-columns: 1fr auto; }
  .row-actions { grid-column: 1 / -1; flex-wrap: wrap; }
  .copy-row { flex-direction: column; }
  .stack > .btn, form > .btn:only-of-type { width: 100%; justify-self: stretch; }
  .copy-row .btn { width: auto; justify-self: start; }
  .page-actions, .page-actions .btn { width: 100%; }
  .cards-collapse .card-collapsible { display: none; }
  .all-clear-line { display: block; margin: var(--s-3) 0 0; padding: var(--s-3) var(--s-4); background: var(--ok-bg); color: var(--ok); font-weight: 500; }
  .table-wrap table.data th:first-child, .table-wrap table.data td:first-child { position: sticky; left: 0; z-index: 2; background: var(--surface); box-shadow: 1px 0 0 var(--rule); }
  .table-wrap table.data thead th:first-child { background: var(--tile-2); z-index: 3; }
}
@media (max-width: 480px) {
  .msg-team, .msg-note { margin-left: 0; }
  .filters > label { flex-basis: 100%; }
  .statement { padding: var(--s-4) var(--s-3); }
  .statement table.data { font-size: 12px; }
  .statement table.data th { white-space: normal; }
  [data-sales-form] table.data { font-size: 12px; }
  [data-sales-form] table.data th, [data-sales-form] table.data td { padding: 8px 5px; }
  [data-sales-form] .qty-input { width: 3.75rem; }
}

/* ---------- 12. Motion and print ---------- */
@media (hover: none) { .nav-item:hover, .stepper button:hover { background: inherit; } .nav-item[aria-current="page"]:hover { background: var(--tile); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; scroll-behavior: auto !important; }
  .btn:active, .nav-item:active, .stepper button:active { transform: none; }
}
@media print {
  .topbar, .sidebar, .scrim, .site-foot, .sub-nav, .app-nav, .no-print, .msg, .flash, .page-actions, .filters, .summary-bar, .skip-link, .jump { display: none !important; }
  .shell { display: block; }
  body, .card, .panel, .statement, .table-wrap, .stat { background: #fff !important; color: #000 !important; box-shadow: none !important; }
  h1, h2, h3, a, .row-title, .money-list dd { color: #000 !important; }
  main, main.wide, main.narrow { max-width: none; padding: 0; margin: 0; }
  .statement, .panel, .card { border: 0; padding: 0; }
  .badge { border: 1px solid #000; background: none !important; color: #000 !important; }
  .badge::before { display: none; }
  table.data, .table { font-size: 10pt; }
  table.data thead th, .table thead th { position: static; background: none !important; color: #000; }
  .table-wrap { overflow: visible; border: 0; }
  tr, .statement-head { break-inside: avoid; }
  @page { margin: 16mm; }
}

/* ---------- Partner ordering, requests, sales and receipts (job 5c, 4 November 2026). Additions only. ---------- */
.product-text { display: flex; flex-direction: column; min-width: 0; }
.product-name { font-weight: 500; color: var(--ink); }
.row-sub { font-size: 12px; line-height: 16px; color: var(--text-2); }
tr.group-row th { position: static; background: var(--tile); color: var(--ink); font: 700 13px/18px var(--font-display); letter-spacing: .02em; text-align: left; padding: var(--s-2) var(--s-3); }
tr[hidden], .empty[hidden] { display: none; }
.qty-cell { white-space: nowrap; }
.qty-cell .field-error { margin-top: var(--s-1); white-space: normal; max-width: 14rem; }
.stepper:has(input[aria-invalid="true"]), input.qty-input[aria-invalid="true"] { border-color: var(--error); }
.stepper input[aria-invalid="true"] { color: var(--error); }
.stepper input:disabled { background: var(--tile-2); color: var(--text-3); }
.chips { margin: calc(-1 * var(--s-3)) 0 var(--s-5); }
.summary-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.summary-msg { margin: 0; }
.summary-msg:empty { display: none; }
.summary-bar .btn:disabled { opacity: .45; cursor: not-allowed; }
.next-steps { margin: 0; padding-left: 1.3em; display: grid; gap: var(--s-2); }
.placed { margin-bottom: var(--s-6); }
.placed-total { font: 700 var(--fs-h3)/1.3 var(--font-display); color: var(--ink); }
.review-aside { display: grid; gap: var(--s-4); }
.review-aside h2 { margin: 0; }
.review-aside dl { margin: 0; display: grid; gap: var(--s-2); }
.review-aside dl div { display: flex; justify-content: space-between; gap: var(--s-3); }
.review-aside dt { color: var(--text-2); }
.review-aside dd { margin: 0; font-variant-numeric: tabular-nums; }
.review-aside .grand { padding-top: var(--s-2); border-top: 1px solid var(--line-strong); }
.review-aside .grand dt { color: var(--ink); font-weight: 500; }
.review-aside .grand dd { font: 700 22px/28px var(--font-display); color: var(--ink); }
.review-aside p { margin: 0; }
tr.is-short td { background: var(--error-bg); }
.short-note { display: block; margin-top: var(--s-1); color: var(--error); font-size: var(--fs-small); font-weight: 500; white-space: normal; }
tr.is-open td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.stat-value.stat-text { font-size: var(--fs-h3); line-height: 1.3; }
.shipment + .shipment { margin-top: var(--s-5); }
@media (min-width: 1024px) { .review-aside { position: sticky; top: var(--s-6); } }
@media (max-width: 1279px) {
  .summary-bar { flex-wrap: wrap; }
  .summary-bar .sum-minor { display: none; }
}
/* Phones: product tables become one card per product, so the stepper is never off screen. */
@media (max-width: 599px) {
  .stack-rows .table-wrap { overflow: visible; }
  .stack-rows table, .stack-rows tbody, .stack-rows tr, .stack-rows td, .stack-rows th { display: block; width: auto; }
  .stack-rows thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .stack-rows tr[data-product-row] { display: grid; grid-template-columns: 1fr 1fr; align-items: end; gap: var(--s-2) var(--s-3); padding: var(--s-3); border-bottom: 1px solid var(--rule); }
  .stack-rows tr[data-product-row][hidden], .stack-rows tr.group-row[hidden] { display: none; }
  .stack-rows tr[data-product-row] > td { position: static; left: auto; padding: 0; border: 0; text-align: left; background: none; box-shadow: none; }
  .stack-rows tr[data-product-row] > td:first-child, .stack-rows tr[data-product-row] > td.qty-cell { grid-column: 1 / -1; }
  .stack-rows td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; line-height: 16px; color: var(--text-2); }
  .stack-rows td.qty-cell::before { margin-bottom: var(--s-1); }
  .stack-rows .table-wrap table.data tr[data-product-row] > td:first-child { position: static; box-shadow: none; background: none; }
  .stack-rows .stepper { width: 100%; }
  .stack-rows .stepper input { flex: 1; }
}
@media (min-width: 600px) { .stack-rows tr[data-product-row] > td { vertical-align: middle; } }

/* ---------- Stock operations (job 5d, 4 November 2026). Additions only. ---------- */
.form-card { padding: clamp(16px, 2.4vw, 28px); }
.form-what { color: var(--text-2); font-size: var(--fs-small); margin: calc(-1 * var(--s-2)) 0 var(--s-5); max-width: 60ch; }
.form-grid { display: grid; gap: var(--s-4); grid-template-columns: minmax(0, 1fr); }
.form-grid > * { min-width: 0; }
@media (min-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .form-grid .span-2 { grid-column: 1 / -1; } }
.field { display: flex; flex-direction: column; gap: var(--s-1); min-width: 0; }
.picker { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.picker select, .picker input { width: 100%; max-width: 100%; min-width: 0; }
.picker-search[hidden], .pick-preview[hidden] { display: none; }
.pick-preview { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3); background: var(--tile-2); border: 1px solid var(--rule); font-size: var(--fs-small); line-height: 20px; color: var(--text-2); min-width: 0; }
.pick-preview strong { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.pick-lines { display: grid; gap: var(--s-3); border: 0; padding: 0; margin: 0; min-width: 0; }
.pick-lines > legend { font-weight: 600; color: var(--ink); margin-bottom: var(--s-2); padding: 0; }
.pick-line { display: grid; gap: var(--s-3); grid-template-columns: minmax(0, 1fr); padding: var(--s-4); border: 1px solid var(--rule); background: var(--ground); }
@media (min-width: 760px) { .pick-line { grid-template-columns: minmax(0, 1fr) auto; align-items: start; } }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; margin-top: var(--s-5); }
.grid-2 > * { min-width: 0; }
.nowrap { white-space: nowrap; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--s-2) var(--s-4); }
.section-head h2 { margin: 0 0 var(--s-3); }
.filters > .picker { flex: 2 1 240px; font-size: 13px; }
.product-edit { display: grid; gap: var(--s-5); }
@media (min-width: 1024px) { .product-edit { grid-template-columns: 280px minmax(0, 1fr); align-items: start; } }
.product-media { display: flex; flex-direction: column; gap: var(--s-4); }
.thumb-lg.thumb-hero { width: 100%; max-width: 280px; height: auto; aspect-ratio: 1; }
.thumb-lg.thumb-hero[data-initials]:empty::before { font-size: 44px; }
.facts-mini { margin: 0; }
.facts-mini dt { font-size: 13px; color: var(--text-2); }
.facts-mini dd { margin: 0 0 var(--s-3); overflow-wrap: anywhere; }
.pager { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; justify-content: space-between; margin-top: var(--s-4); font-size: var(--fs-small); color: var(--text-2); }
.queue-age.is-old { color: var(--error); font-weight: 600; }

/* ---------- Admin screens and staff messages (job 5e, 4 November 2026) ---------- */
.dash-sec { margin: 0 0 var(--s-7); }
.dash-sec-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s-1) var(--s-4); margin-bottom: var(--s-3); }
.dash-sec-head h2 { margin: 0; }
.dash-sec-head .small { margin: 0; }
.attn-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); }
a.stat.attn { position: relative; transition: background-color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out); }
a.stat.attn:active { transform: scale(0.985); }
.attn.attn-on { box-shadow: inset 3px 0 0 var(--warn); }
.attn.attn-on .attn-state { color: var(--ink); font-weight: 600; }
.attn:not(.attn-on) .stat-value { color: var(--text-3); }
.attn:not(.attn-on) .attn-state { color: var(--ok); }
.money-tiles { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.money-tile .stat-note + .stat-note { margin-top: 0; }
.dash-grid { display: grid; gap: var(--s-5); margin-bottom: var(--s-5); }
.dash-grid > .card { min-width: 0; }
@media (min-width: 1024px) { .dash-grid { grid-template-columns: 1fr 1fr; } .dash-grid-wide { grid-template-columns: 3fr 2fr; } }
.kv-rows { border-top: 1px solid var(--rule); margin: var(--s-2) 0 var(--s-5); }
.kv-row { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); min-height: var(--tap); padding: var(--s-2) 0; border-bottom: 1px solid var(--rule); color: var(--text); text-decoration: none; transition: background-color var(--t-fast) var(--ease-out); }
.kv-row:hover { background: var(--tile-2); }
.kv-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kv-label .row-sub { display: block; }
.kv-n { font-weight: 700; color: var(--ink); }
.kv-row[data-n="0"] .kv-n { color: var(--text-3); font-weight: 400; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) 0; border-bottom: 1px solid var(--rule); min-width: 0; }
.feed li:last-child { border-bottom: 0; }
.feed li > div { min-width: 0; overflow-wrap: anywhere; }
.feed p { margin: 0; }
.feed-dot { flex: 0 0 48px; height: 48px; display: grid; place-items: center; background: var(--tile-2); }
.feed-dot::after { content: ''; width: 8px; height: 8px; background: var(--accent); }
.export-range { margin-top: var(--s-4); }
.table td .row-sub, table.data td .row-sub, .table td .cell-main, table.data td .cell-main { display: block; }
.row-btns { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-3); align-items: center; justify-content: flex-end; }
.row-btns form { margin: 0; }
.chips a.chip { text-decoration: none; }
.chips a.chip[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chips { margin-bottom: var(--s-3); }
.chips-sub { margin-top: calc(-1 * var(--s-1)); }
.chip.chip-static { cursor: default; white-space: nowrap; }
.report-list { display: grid; gap: var(--s-5); margin-top: var(--s-5); }
.report-card { scroll-margin-top: var(--s-6); }
.report-card:target { box-shadow: inset 3px 0 0 var(--accent); }
.settings-form { display: grid; gap: var(--s-5); max-width: 820px; margin-bottom: var(--s-6); }
.settings-card { max-width: 820px; }
.settings-card h2 { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin-top: 0; }
.settings-card label { display: block; margin-bottom: var(--s-4); }
.settings-card label:last-child { margin-bottom: 0; }
.settings-card .hint { display: block; max-width: 64ch; }
.settings-actions { position: sticky; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-5); align-items: center; padding: var(--s-4) 0; background: var(--ground); border-top: 1px solid var(--rule); }
.settings-actions .small { margin: 0; flex: 1 1 280px; }
.link-box { margin-bottom: var(--s-5); }
details.earlier { margin-top: var(--s-4); }
details.earlier summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; color: var(--ink); font-weight: 600; }
.inbox-cell { min-width: 220px; }
.inbox-preview { display: block; max-width: 56ch; color: var(--text-2); font-size: var(--fs-small); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr.is-unread .inbox-subject { font-weight: 700; }
.thread-layout { display: grid; gap: var(--s-5); align-items: start; }
.thread-main { min-width: 0; }
@media (min-width: 1024px) { .thread-layout { grid-template-columns: minmax(0, 1fr) 300px; } .thread-side { position: sticky; top: var(--s-5); } }
.thread-side .facts { margin-top: 0; }
.side-label { margin: var(--s-4) 0 var(--s-2); font-size: var(--fs-small); color: var(--text-2); }
.link-chip { display: flex; gap: var(--s-3); align-items: center; padding: var(--s-2); border: 1px solid var(--rule); background: var(--surface); min-width: 0; }
.link-chip-text { min-width: 0; overflow-wrap: anywhere; }
.link-chip-text strong { display: block; color: var(--ink); }
.link-chip-wrap .link-items { list-style: none; margin: var(--s-2) 0 0; padding: 0; }
.link-chip-wrap .link-items li { display: flex; gap: var(--s-2); align-items: center; padding: var(--s-1) 0; font-size: var(--fs-small); }
.link-chip-wrap .link-items .thumb { flex: 0 0 auto; }
ol.chat { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-4); }
.chat .msg-item { align-self: flex-start; max-width: min(80%, 600px); margin: 0; padding: 0; border: 0; background: none; box-shadow: none; }
.chat .msg-item.msg-mine { align-self: flex-end; }
.chat .bubble { padding: var(--s-3) var(--s-4); background: var(--surface); border: 1px solid var(--line); }
.chat .msg-mine .bubble { background: var(--tile); border-color: var(--tile); }
.chat .msg-item.msg-note { align-self: stretch; max-width: none; }
.chat .msg-note .bubble { background: #FFF7D9; border: 1px dashed #C9A23A; }
.chat .msg-meta { margin: 0 0 var(--s-1); font-size: var(--fs-small); }
.chat .msg-mine .msg-meta { text-align: right; }
.chat .msg-body { overflow-wrap: anywhere; }
.chat .msg-photos { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-2); }
.chat .msg-mine .msg-photos { justify-content: flex-end; }
.chat .msg-event { align-self: center; max-width: 100%; text-align: center; font-size: var(--fs-small); color: var(--text-2); }
@media (max-width: 759px) { .chat .msg-item { max-width: 92%; } }
.composer { margin-top: var(--s-5); padding: var(--s-5); background: var(--surface); border: 1px solid var(--rule); }
.composer h2 { margin-top: 0; font-size: var(--fs-h3); }
.composer-note { background: #FFFBEA; border: 1px dashed #C9A23A; }
.composer-note h2::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: var(--s-2); background: #C9A23A; vertical-align: middle; }
@media (max-width: 759px) { .composer { padding: var(--s-4); } }

/* ---------- sign-in split layout (login, invite, reset) ---------- */
body.auth-split { display: block; min-height: 100dvh; background: var(--surface); }
.split { display: grid; grid-template-columns: 1fr; grid-template-rows: auto 1fr; min-height: 100dvh; }
.split-art { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-5) var(--gutter); background: var(--tile); border-bottom: 1px solid var(--rule); }
.split-line { margin: 0; font: 400 var(--fs-small) var(--font-text); color: var(--text-2); }
.split-photo { display: none; }
.split-side { display: flex; flex-direction: column; min-width: 0; }
body.auth-split main.narrow { flex: 1; display: flex; flex-direction: column; justify-content: center; width: 100%; max-width: calc(400px + 2 * var(--gutter)); margin: 0 auto; padding: var(--s-7) var(--gutter); }
body.auth-split .auth-card { background: none; border: 0; box-shadow: none; padding: 0; }
body.auth-split .auth-card h1 { font-size: 26px; line-height: 32px; margin-bottom: var(--s-2); }
body.auth-split .auth-card .lead { margin: 0 0 var(--s-6); font-size: var(--fs-body); color: var(--text-2); }
body.auth-split .auth-card .stack { gap: var(--s-3); }
body.auth-split .auth-card .stack + .small { margin-top: var(--s-3); font-size: 13px; line-height: 20px; color: var(--text-2); }
body.auth-split .btn-block { margin-top: var(--s-2); }
.split-note { width: 100%; max-width: calc(400px + 2 * var(--gutter)); margin: 0 auto; padding: var(--s-4) var(--gutter); border-top: 1px solid var(--rule); }
.split-note .small { margin: 0; font-size: 13px; line-height: 20px; color: var(--text-2); }
body.auth-split .site-foot { text-align: center; border-top: 0; padding-top: var(--s-3); }
@media (min-width: 900px) {
  .split { grid-template-columns: minmax(0, 45fr) minmax(0, 55fr); grid-template-rows: 1fr; height: 100dvh; min-height: 600px; }
  .split-art { position: relative; gap: var(--s-4); padding: var(--s-8) clamp(32px, 4vw, 64px) 0; border-bottom: 0; border-right: 1px solid var(--rule); overflow: hidden; }
  .split-line { max-width: 22ch; font: 700 clamp(26px, 2.4vw, 34px)/1.15 var(--font-display); letter-spacing: -.01em; color: var(--ink); text-wrap: balance; margin-top: var(--s-7); }
  .split-photo { display: flex; flex: 1; min-height: 0; align-items: flex-end; justify-content: center; }
  .split-photo img { display: block; width: auto; height: 100%; max-height: 560px; max-width: 100%; object-fit: contain; object-position: center bottom; mix-blend-mode: multiply; }
  .split-side { overflow-y: auto; }
  .split-note { border-top: 1px solid var(--rule); padding: var(--s-4) var(--gutter); }
  body.auth-split .site-foot { padding-bottom: var(--s-5); }
}

/* Job 6b: stock team information pages */
tr.row-attn > td { background: var(--warn-bg); }
.ship-lines { list-style: none; margin: 0; padding: 0; }
.ship-lines li + li { margin-top: 2px; }
.chip.chip-static { cursor: default; min-height: 28px; }
.product-detail { display: flex; flex-wrap: wrap; gap: var(--s-5); align-items: flex-start; margin-bottom: var(--s-5); }
.product-detail .facts { flex: 1 1 320px; margin: 0; }
.product-photo { width: 220px; height: 220px; object-fit: contain; background: var(--tile); border: 1px solid var(--rule); }
.shortcuts .chips { margin: 0; }

/* Usability pass: coherent selection, readable tools, and touch/keyboard access. */
[hidden] { display: none !important; }
.catalogue-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-bottom: 16px; }
.catalogue-tools p { margin: 0; flex: 1 1 220px; }
.catalogue-tools label { font-size: 13px; }
.catalogue tr.is-selected > td { background: var(--tile-2); }
.catalogue tr.is-selected > td:first-child { box-shadow: inset 3px 0 var(--ink); }
.stepper:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.password-field { display: flex; position: relative; }
.password-field input { padding-right: 72px; min-width: 0; }
.password-toggle { position: absolute; right: 1px; top: 1px; bottom: 1px; min-width: 64px; border: 0; background: var(--tile-2); color: var(--ink); font: inherit; cursor: pointer; }
.attachment-feedback { overflow-wrap: anywhere; }
@media (max-width: 599px) {
  .chip { min-height: 44px; }
  .catalogue-tools { gap: 12px; padding: 12px; border: 1px solid var(--rule); background: var(--surface); }
  .catalogue-tools p { flex-basis: 100%; }
  .catalogue tr.is-selected { background: var(--tile-2); box-shadow: inset 3px 0 var(--ink); }
  .catalogue tr.is-selected > td:first-child { box-shadow: none; }
  .summary-bar { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}

.catalogue-tools + .chips { margin-top: 0; }
