/* Layout: three-pane workbench. Searchable catalogue | live editor | page preview and checks. A save bar rises from the bottom when there are unsaved changes. */
:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #f3f0e8;
  --surface-3: #ebe6da;
  --ink: #141414;
  --muted: #6a655c;
  --faint: #8f897d;
  --line: #e3ded2;
  --line-strong: #cfc7b6;
  --gold: #baa26d;
  --gold-ink: #7a6531;
  --gold-wash: #f4eedf;
  --ok: #2f6e45;
  --ok-wash: #e5f0e8;
  --warn: #8f5508;
  --warn-wash: #f8ecd8;
  --err: #b23b26;
  --err-wash: #f7e3de;
  --scrim: rgb(20 18 14 / 0.45);
  --bar: #141414;
  --bar-ink: #f6f4ef;
  --font-ui: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --radius: 4px;
  --header-h: 58px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121110; --surface: #1b1a17; --surface-2: #22201c; --surface-3: #2b2823;
    --ink: #eeeae2; --muted: #a8a194; --faint: #857f73; --line: #34302a; --line-strong: #4a443b;
    --gold: #c4ad7a; --gold-ink: #d8c290; --gold-wash: #2a2519;
    --ok: #86c79a; --ok-wash: #1d2b21; --warn: #e5ad55; --warn-wash: #2e2414; --err: #ee8b77; --err-wash: #331d18;
    --scrim: rgb(0 0 0 / 0.6); --bar: #2b2823; --bar-ink: #eeeae2;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-ui); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
/* Open dropdown lists: Chrome takes their colours from the select, and a see-through select (as in .chips) gave a white list with pale dark-mode text. */
option { background-color: var(--surface); color: var(--ink); }
option:disabled { color: var(--faint); }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; }
code { font-family: var(--font-mono); font-size: 0.88em; background: var(--surface-2); padding: 1px 5px; border-radius: 3px; overflow-wrap: anywhere; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mark-ink { fill: var(--ink); }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--bg); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; align-items: center; gap: 16px; padding: 10px 24px; max-width: 1680px; margin: 0 auto; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand svg { width: 28px; height: 28px; flex: none; }
.brand-name { font-weight: 800; letter-spacing: -0.01em; font-size: 15px; line-height: 1.1; }
.brand-sub { color: var(--muted); font-size: 12px; line-height: 1.2; }
.conn { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.conn[data-state="ok"] .dot { background: var(--ok); }
.conn[data-state="error"] .dot { background: var(--err); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-strong); background: var(--surface); padding: 8px 14px; border-radius: var(--radius); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--gold); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: var(--gold-ink); border-color: var(--gold-ink); color: var(--bg); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #141414; }
.btn-gold:hover { background: #cbb47e; border-color: #cbb47e; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--muted); padding-inline: 8px; }
.btn-quiet:hover { color: var(--ink); border-color: var(--line); }
.btn-quiet-dark { border-color: transparent; background: transparent; color: var(--bar-ink); }
.btn-quiet-dark:hover { border-color: rgb(255 255 255 / 0.25); }
.btn-danger { color: var(--err); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.icon-btn { width: 30px; height: 30px; display: inline-grid; place-items: center; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); cursor: pointer; color: var(--muted); font-size: 14px; flex: none; padding: 0; }
.icon-btn:hover { color: var(--ink); border-color: var(--gold); }
.icon-btn[disabled] { opacity: 0.35; cursor: not-allowed; }

/* Workbench */
.app { display: grid; grid-template-columns: 320px minmax(0, 1fr) 340px; gap: 22px; align-items: start; max-width: 1680px; margin: 0 auto; padding: 18px 24px 120px; }
.sidebar, .preview { position: sticky; top: calc(var(--header-h) + 14px); max-height: calc(100vh - var(--header-h) - 28px); overflow: auto; min-width: 0; }
.sidebar { display: grid; grid-template-rows: auto 1fr auto; gap: 10px; align-content: start; }
@media (max-width: 1280px) {
  .app { grid-template-columns: 290px minmax(0, 1fr); }
  .preview { grid-column: 2; position: static; max-height: none; overflow: visible; }
}
@media (max-width: 880px) {
  .app { grid-template-columns: minmax(0, 1fr); padding-inline: 16px; }
  .sidebar, .preview { position: static; grid-column: auto; max-height: none; overflow: visible; }
  .plist { max-height: 320px; overflow: auto; }
  .topbar-in { padding-inline: 16px; }
}

/* Search + list */
.search { display: grid; gap: 8px; }
.plist { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; align-content: start; }
.pitem { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: center; width: 100%; text-align: left; padding: 7px; border: 1px solid transparent; border-radius: var(--radius); background: transparent; cursor: pointer; }
.pitem:hover { background: var(--surface); border-color: var(--line); }
.pitem[aria-current="true"] { background: var(--surface); border-color: var(--gold); }
.thumb { width: 44px; height: 44px; object-fit: cover; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 700; color: var(--gold-ink); font-size: 12px; }
.pbody { display: grid; gap: 2px; min-width: 0; }
.pname { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pmeta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dirty-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); display: inline-block; }
.list-note { color: var(--muted); padding: 10px 6px; font-size: 13px; }
.list-foot { display: grid; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 18px; border: 1px solid var(--line); white-space: nowrap; }
.pill-active { color: var(--ok); background: var(--ok-wash); border-color: transparent; }
.pill-draft { color: var(--muted); background: var(--surface-2); }
.pill-archived { color: var(--warn); background: var(--warn-wash); border-color: transparent; }
.pill-err { color: var(--err); background: var(--err-wash); border-color: transparent; }
.pill-warn { color: var(--warn); background: var(--warn-wash); border-color: transparent; }
.pill-ok { color: var(--ok); background: var(--ok-wash); border-color: transparent; }
.pill-gold { color: var(--gold-ink); background: var(--gold-wash); border-color: transparent; }

/* Segmented */
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { position: relative; display: grid; gap: 1px; padding: 8px 13px; border: 1px solid var(--line-strong); border-radius: var(--radius); cursor: pointer; font-weight: 600; font-size: 13px; background: var(--surface); }
.seg label small { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
.seg.tight label { padding: 4px 10px; font-size: 12.5px; }

/* Editor shell */
.editor { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; min-width: 0; }
.empty { padding: 40px 32px; display: grid; gap: 14px; max-width: 640px; }
.empty h1 { margin: 0; font-size: clamp(22px, 2.6vw, 30px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.empty p { margin: 0; color: var(--muted); font-size: 15px; }
.eyebrow { margin: 0 0 4px; font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-ink); font-weight: 700; }
.ed-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.ed-head-l { min-width: 0; display: grid; gap: 2px; }
.ed-title { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; margin: 0; overflow-wrap: anywhere; }
.ed-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.secnav { display: flex; gap: 6px; overflow-x: auto; padding: 10px 20px; border-bottom: 1px solid var(--line); position: sticky; top: var(--header-h); background: var(--surface); z-index: 5; }
.secnav a { white-space: nowrap; padding: 4px 11px; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 12.5px; font-weight: 600; border: 1px solid var(--line); }
.secnav a:hover { color: var(--ink); border-color: var(--gold); }
.sec { padding: 22px 20px 24px; border-bottom: 1px solid var(--line); display: grid; gap: 16px; scroll-margin-top: calc(var(--header-h) + 54px); }
.sec:last-child { border-bottom: 0; }
.sec h2 { margin: 0; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-ink); font-weight: 700; }
.sec-note { margin: -8px 0 0; color: var(--muted); max-width: 72ch; }
.loading-block { padding: 40px 20px; color: var(--muted); }

/* Fields */
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
@media (max-width: 600px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
@media (max-width: 760px) { .grid3 { grid-template-columns: minmax(0, 1fr); } }
.span2 { grid-column: 1 / -1; }
.f { display: grid; gap: 6px; min-width: 0; align-content: start; }
.f > label, .lbl { font-weight: 600; font-size: 12.5px; }
.lbl-row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 12px; margin: 0; }
.ns { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); font-weight: 400; }
.inp { width: 100%; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius); padding: 8px 11px; font-size: 14px; min-width: 0; }
textarea.inp { resize: vertical; min-height: 90px; line-height: 1.55; }
.inp:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px var(--gold-wash); }
.inp[disabled], .inp[readonly] { background: var(--surface-2); color: var(--muted); }
.inp.changed { border-color: var(--gold); background: var(--gold-wash); }
.with-prefix { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface-2); min-width: 0; }
.with-prefix:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-wash); }
.with-prefix span { padding: 8px 2px 8px 11px; color: var(--muted); white-space: nowrap; font-family: var(--font-mono); font-size: 12.5px; align-self: center; }
.with-prefix .inp { border: 0; background: transparent; box-shadow: none; padding-left: 2px; font-family: var(--font-mono); font-size: 13px; }
.counter { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.counter.over { color: var(--warn); font-weight: 600; }
.check-row { display: flex; gap: 8px; align-items: center; font-size: 13px; cursor: pointer; }
.check-row input { width: 16px; height: 16px; accent-color: var(--gold-ink); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 5px; background: var(--surface); min-height: 40px; }
.chips:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-wash); }
.chip { display: inline-flex; align-items: center; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 3px; padding: 2px 3px 2px 9px; font-size: 13px; font-weight: 500; }
.chip button { border: 0; background: transparent; cursor: pointer; color: var(--muted); width: 22px; height: 22px; border-radius: 3px; line-height: 1; font-size: 15px; padding: 0; }
.chip button:hover { color: var(--err); background: var(--err-wash); }
.chips input, .chips select { border: 0; outline: 0; flex: 1 1 140px; min-width: 110px; padding: 4px 6px; background: transparent; font-size: 13.5px; }
.chips.readonly { background: var(--surface-2); }

/* Rich text */
.rte { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.rte:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-wash); }
.rte-bar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.rte-bar button { min-width: 30px; height: 28px; border: 1px solid transparent; background: transparent; border-radius: 3px; cursor: pointer; font-size: 13px; color: var(--ink); padding: 0 7px; }
.rte-bar button:hover { border-color: var(--line-strong); background: var(--surface); }
.rte-bar button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.rte-bar .sep { width: 1px; background: var(--line-strong); margin: 3px 4px; }
.rte-body { min-height: 180px; max-height: 520px; overflow: auto; padding: 12px 14px; line-height: 1.6; outline: none; }
.rte-body:empty::before { content: attr(data-placeholder); color: var(--faint); }
.rte-body p { margin: 0 0 10px; }
.rte-body ul, .rte-body ol { margin: 0 0 10px; padding-left: 22px; }
.rte-body h2, .rte-body h3, .rte-body h4 { margin: 12px 0 6px; font-size: 15px; }
.rte-body a { color: var(--gold-ink); }
.rte-source { width: 100%; min-height: 220px; border: 0; padding: 12px 14px; font-family: var(--font-mono); font-size: 12.5px; background: transparent; resize: vertical; outline: none; }

/* Media */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.mtile { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: grid; grid-template-rows: auto auto; overflow: hidden; position: relative; }
.mtile.dragging { opacity: 0.4; }
.mtile.drop-target { outline: 2px dashed var(--gold); outline-offset: 2px; }
.mimg { aspect-ratio: 1 / 1; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; cursor: grab; position: relative; }
.mimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mimg .ph { color: var(--muted); font-size: 12px; text-align: center; padding: 8px; }
.mbadge { position: absolute; top: 6px; left: 6px; background: var(--ink); color: var(--bg); font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 6px; border-radius: 3px; }
.mbadge.new { background: var(--gold); color: #141414; }
.mprog { position: absolute; inset: auto 0 0 0; height: 4px; background: rgb(0 0 0 / 0.15); }
.mprog span { display: block; height: 100%; background: var(--gold); }
.mbody { padding: 8px; display: grid; gap: 6px; }
.mbody .inp { padding: 5px 7px; font-size: 12.5px; }
.mactions { display: flex; gap: 4px; justify-content: space-between; }
.drop { border: 1.5px dashed var(--line-strong); border-radius: var(--radius); padding: 18px; display: grid; place-items: center; gap: 6px; text-align: center; color: var(--muted); background: var(--surface-2); cursor: pointer; }
.drop.over { border-color: var(--gold); background: var(--gold-wash); color: var(--ink); }
.drop b { color: var(--ink); }

/* Variants */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.vt { border-collapse: collapse; width: 100%; min-width: 1060px; font-size: 13px; }
.vt th { text-align: left; font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 8px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.vt td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.vt tr:last-child td { border-bottom: 0; }
.vt .inp { padding: 6px 8px; font-size: 13px; }
.vt .vname { font-weight: 600; white-space: nowrap; padding-top: 13px; }
.num { font-variant-numeric: tabular-nums; }
.deliv { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.tag-uk { color: var(--ok); font-weight: 700; }
.tag-factory { color: var(--gold-ink); font-weight: 700; }
.tag-off { color: var(--err); font-weight: 700; }

/* Category picker */
.picker { position: relative; }
.picker-results { list-style: none; margin: 4px 0 0; padding: 4px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); max-height: 280px; overflow: auto; display: grid; gap: 2px; }
.picker-results button { width: 100%; text-align: left; border: 0; background: transparent; padding: 7px 9px; border-radius: 3px; cursor: pointer; font-size: 13px; }
.picker-results button:hover, .picker-results button:focus-visible { background: var(--surface-2); }
.picker-results small { display: block; color: var(--muted); font-size: 11.5px; }
.current-cat { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface-2); }
.current-cat b { font-weight: 600; }

/* File field */
.filebox { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); min-height: 40px; }
.filebox a { color: var(--gold-ink); overflow-wrap: anywhere; font-size: 13px; }
.filebox .fname { font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; flex: 1 1 160px; }

details.more { border: 1px solid var(--line); border-radius: var(--radius); }
details.more summary { cursor: pointer; padding: 10px 12px; font-weight: 600; font-size: 13px; }
details.more > div { padding: 4px 12px 14px; }

/* Preview */
.preview { display: grid; gap: 14px; align-content: start; }
.pv-card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; min-width: 0; }
.pv-head { padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.pv-body { padding: 14px; display: grid; gap: 11px; min-width: 0; }
.pv-hero { aspect-ratio: 1 / 1; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; position: relative; }
.pv-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pv-badge { position: absolute; top: 10px; left: 10px; border: 1px solid #baa26d; padding: 4px 9px; border-radius: 3px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: #141414; background: #fff; }
.pv-title { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; margin: 0; overflow-wrap: anywhere; }
.pv-price { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.pv-price b { font-size: 20px; font-weight: 600; }
.pv-price s { color: var(--muted); }
.pv-sub { margin: 0; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.pv-deliv { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 12.5px; }
.pv-deliv li { display: grid; gap: 1px; padding: 8px 10px; background: var(--surface-2); border-radius: var(--radius); }
.pv-deliv .k { font-weight: 600; }
.spec { width: 100%; border-collapse: collapse; border: 1px solid var(--line); font-size: 12.5px; }
.spec tr { border-bottom: 1px solid var(--line); }
.spec tr:nth-child(odd) { background: var(--surface-2); }
.spec tr:last-child { border-bottom: 0; }
.spec th, .spec td { text-align: left; padding: 8px 11px; font-weight: 400; vertical-align: top; overflow-wrap: anywhere; }
.spec th { color: var(--muted); font-weight: 500; width: 42%; border-right: 1px solid var(--line); }
.spec-empty { color: var(--muted); font-size: 12.5px; margin: 0; }
.pv-links { display: flex; gap: 8px; flex-wrap: wrap; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.check { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px; align-items: start; font-size: 12.5px; line-height: 1.45; }
.check .mk { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 800; margin-top: 1px; }
.check.err .mk { background: var(--err-wash); color: var(--err); }
.check.warn .mk { background: var(--warn-wash); color: var(--warn); }
.check button { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.check button:hover { text-decoration-color: var(--gold); }
.ready { display: flex; gap: 10px; align-items: center; color: var(--ok); font-weight: 600; font-size: 13px; }
.ready .mk { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-wash); font-size: 12px; }

/* Save bar */
.savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--bar); color: var(--bar-ink); padding-bottom: env(safe-area-inset-bottom, 0px); box-shadow: 0 -8px 30px rgb(0 0 0 / 0.18); }
.savebar-in { max-width: 1680px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.savebar-msg { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.savebar-msg::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.savebar-actions { display: flex; gap: 8px; }

/* Setup */
.setup { max-width: 820px; margin: 0 auto; padding: 36px 24px 80px; display: grid; gap: 22px; }
.setup h1 { margin: 0; font-size: clamp(24px, 3vw, 32px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.setup > p { margin: 0; color: var(--muted); font-size: 15px; max-width: 64ch; }
.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; gap: 10px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.steps li::before { content: counter(s); width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid var(--gold); color: var(--gold-ink); font-weight: 700; font-size: 12.5px; border-radius: 50%; }
.step-body { display: grid; gap: 6px; min-width: 0; padding-top: 2px; }
.step-body > b { font-size: 14px; }
.step-body > span { color: var(--muted); font-size: 13px; }
.step-body > span:not(:first-of-type) { margin-top: 4px; }
.copybox { display: flex; gap: 8px; align-items: flex-start; }
.copybox code { flex: 1; min-width: 0; padding: 8px 10px; display: block; background: var(--surface-2); border: 1px solid var(--line); line-height: 1.6; overflow-wrap: break-word; word-break: normal; }
.copybox .btn { flex: none; }
.setup-form { display: grid; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; }
.alert-err { background: var(--err-wash); color: var(--err); }
.alert-warn { background: var(--warn-wash); color: var(--warn); }

/* View tabs (top bar) */
.views { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.vtab { border: 0; background: transparent; padding: 5px 12px; border-radius: 4px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.vtab:hover { color: var(--ink); }
.vtab[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* Catalogue view: filters | reports + table */
.catalogue { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 22px; align-items: start; max-width: 1680px; margin: 0 auto; padding: 18px 24px 120px; }
.cat-filters { position: sticky; top: calc(var(--header-h) + 14px); max-height: calc(100vh - var(--header-h) - 28px); overflow: auto; display: grid; gap: 10px; align-content: start; min-width: 0; }
.cat-main { display: grid; gap: 16px; min-width: 0; }
.cat-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.cat-head h1 { margin: 0; font-size: clamp(20px, 2.4vw, 26px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.cat-head p { margin: 2px 0 0; }
.cat-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cat-empty { padding: 40px 8px; display: grid; gap: 10px; max-width: 640px; }
.cat-empty h1 { margin: 0; font-size: clamp(20px, 2.4vw, 26px); font-weight: 800; letter-spacing: -0.02em; }
.cat-empty p { margin: 0; color: var(--muted); }
@media (max-width: 1000px) {
  .catalogue { grid-template-columns: minmax(0, 1fr); padding-inline: 16px; }
  .cat-filters { position: static; max-height: none; overflow: visible; }
}

/* Filters */
.fpanel { display: grid; gap: 6px; }
details.facet { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
details.facet > summary { cursor: pointer; padding: 8px 10px; font-weight: 600; font-size: 13px; }
.facet-opts { padding: 2px 10px 10px; display: grid; gap: 6px; max-height: 300px; overflow: auto; }
.facet-opts .check-row { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 8px; font-size: 12.5px; }
.cnt { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.range { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; align-items: center; }
.range .lbl { grid-column: 1 / -1; }
.range .inp { padding: 6px 8px; font-size: 13px; }
.lfilters { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.lfilters > summary { cursor: pointer; padding: 7px 10px; font-weight: 600; font-size: 13px; }
.lfilters .fpanel { padding: 0 8px 8px; }
.lfilters details.facet { background: var(--surface-2); }
.cfilters { background: transparent; border: 0; }
.cfilters > summary { padding: 4px 2px 8px; }
.cfilters .fpanel { padding: 0; }
.cfilters details.facet { background: var(--surface); }
.fchips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fchips .chip { font-size: 12px; background: var(--gold-wash); border-color: transparent; }

/* Report cards */
.rcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; align-items: start; }
.rcard { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 14px; display: grid; gap: 12px; min-width: 0; }
.rcard h3 { margin: 0; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-ink); font-weight: 700; }
.rcard .hint { margin: 0; }
.rcards > .rcard.wide { grid-column: 1 / -1; }
.rcard.wide .rgroups { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 22px; align-items: start; }
.stats { display: flex; flex-wrap: wrap; gap: 6px; }
.stat { display: grid; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); text-align: left; min-width: 70px; font: inherit; color: inherit; }
button.stat { cursor: pointer; }
button.stat:hover { border-color: var(--gold); }
.stat.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.stat b { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.3; }
.stat span { font-size: 11.5px; color: var(--muted); }
.rgroups { display: grid; gap: 12px; }
.rgroup h4 { margin: 0 0 4px; font-size: 12px; font-weight: 700; }
.rlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.rrow { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 4px 6px; border: 1px solid transparent; border-radius: 3px; background: transparent; text-align: left; cursor: pointer; font-size: 12.5px; }
.rrow:has(.rbar) { grid-template-columns: minmax(0, 2.2fr) minmax(28px, 1fr) auto; }
.rrow:hover { background: var(--surface-2); }
.rrow.on { border-color: var(--gold); background: var(--gold-wash); }
.rrow.static { cursor: default; }
.rrow.static:hover { background: transparent; }
.rrow.zero { color: var(--faint); }
.rlabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rnum { font-variant-numeric: tabular-nums; font-weight: 600; }
.rbar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.rbar span { display: block; height: 100%; background: var(--gold); }

/* Bulk bar */
#cat-bulk { position: sticky; top: calc(var(--header-h) + 6px); z-index: 6; }
#cat-bulk:empty { display: none; }
.bulkbar.idle { border-color: var(--line); box-shadow: none; padding: 6px 12px; }
.bulkbar { box-shadow: 0 6px 18px rgb(0 0 0 / 0.08); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; background: var(--surface); border: 1px solid var(--gold); border-radius: 6px; }
.bulk-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.bulkbar .undo { margin-left: auto; }
.progress { flex: 1 1 200px; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--gold); transition: width 0.2s; }

/* Catalogue table */
table.ct { min-width: 1180px; }
.ct td { vertical-align: middle; }
.ct th.num, .ct td.num { text-align: right; }
.ct .c-sel { width: 34px; }
.ct .c-sel input { width: 16px; height: 16px; accent-color: var(--gold-ink); }
.ct .c-img { width: 52px; }
.ct .thumb { width: 40px; height: 40px; }
.ct .c-title { min-width: 240px; max-width: 380px; }
.ct tr.sel td { background: var(--gold-wash); }
.sortbtn { border: 0; background: transparent; padding: 0; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.sortbtn:hover { color: var(--ink); }
.linkish { border: 0; background: transparent; padding: 0; text-align: left; font-weight: 600; color: var(--ink); cursor: pointer; font-size: 13px; }
.linkish:hover { color: var(--gold-ink); text-decoration: underline; }

/* Modal + toast */
.overlay { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; padding: 16px; z-index: 60; }
.dlg { background: var(--surface); color: var(--ink); border-radius: 8px; border: 1px solid var(--line); width: min(540px, 100%); max-height: calc(100vh - 32px); overflow: auto; display: grid; }
.dlg-head { padding: 18px 20px 6px; }
.dlg-head h2 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.dlg-body { padding: 8px 20px 4px; display: grid; gap: 12px; color: var(--ink); }
.dlg-body p { margin: 0; color: var(--muted); }
.dlg-body ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 13px; }
.dlg-foot { padding: 16px 20px 18px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 6px; font-weight: 600; font-size: 13px; z-index: 70; max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgb(0 0 0 / 0.18); }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* Import tab (public/import.js): one column of numbered cards, file, columns, preview, result, history. */
.import { max-width: 1080px; margin: 0 auto; padding: 18px 24px 120px; }
.im-wrap { display: grid; gap: 16px; }
.im-title { margin: 0; font-size: clamp(20px, 2.4vw, 26px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.im-wrap > div > p.muted { margin: 4px 0 0; }
.im-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: grid; gap: 14px; min-width: 0; }
.im-card h2 { margin: 0; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-ink); font-weight: 700; }
.im-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.im-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.im-row > .f { min-width: 200px; flex: 1 1 220px; }
.im-row > .im-end { flex: 0 0 auto; min-width: 0; }
.im-saved { width: auto; max-width: 280px; }
.im-drop { padding: 34px 18px; }
.im-file { display: grid; gap: 12px; }
.im-tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.im-map { border-collapse: collapse; width: 100%; font-size: 13px; }
table.im-map th, table.im-map td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.im-map thead th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); background: var(--surface-2); font-weight: 700; }
table.im-map tbody th { font-weight: 600; min-width: 140px; }
table.im-map td.muted { max-width: 320px; overflow-wrap: anywhere; }
table.im-map td:last-child { width: 240px; }
table.im-map tr.on { background: var(--gold-wash); }
table.im-map tr:last-child > * { border-bottom: 0; }
.im-opts { align-items: flex-start; }
.im-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.im-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.im-card details { border: 1px solid var(--line); border-radius: var(--radius); }
.im-card details > summary { cursor: pointer; padding: 10px 12px; font-size: 13px; }
.im-changes, .im-rows { margin: 0; padding: 4px 14px 12px 30px; display: grid; gap: 8px; font-size: 13px; overflow-wrap: anywhere; }
.im-changes ul { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.im-card p { margin: 0; }
.im-warn { color: var(--warn); font-size: 12.5px; }
p.im-warn { font-weight: 600; }
.mono { font-family: var(--font-mono); font-size: 0.92em; }
.alert-ok { background: var(--ok-wash); color: var(--ok); }
.im-busy { background: var(--gold-wash); color: var(--gold-ink); font-weight: 600; }
.im-hist { list-style: none; margin: 0; padding: 0; display: grid; font-size: 13px; }
.im-hist li { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.im-hist li:first-child { border-top: 0; }
.im-hist li > span:nth-child(2) { overflow-wrap: anywhere; }
.im-hist-acts { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 700px) {
  .import { padding-inline: 16px; }
  .im-card { padding: 14px; }
  .im-hist li { grid-template-columns: minmax(0, 1fr) auto; }
  .im-hist li > span:nth-child(3) { grid-column: 1; }
  /* Each column becomes a small card: name, examples, then the choice at full width. */
  table.im-map thead { display: none; }
  table.im-map, table.im-map tbody, table.im-map tr, table.im-map th, table.im-map td { display: block; width: auto; }
  table.im-map tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.im-map tr:last-child { border-bottom: 0; }
  table.im-map th, table.im-map td { padding: 0; border: 0; }
  table.im-map td.muted { margin: 2px 0 8px; font-size: 12.5px; max-width: none; }
  table.im-map td:last-child { width: auto; }
}

/* ------------------------------ Sidebar shell and areas (10 Nov 2026: public/shell.js, public/admin.js) ------------------------------ */
:root { --rail-w: 84px; }
.rail { position: fixed; top: 0; bottom: 0; left: 0; width: var(--rail-w); z-index: 45; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; padding: 12px 8px; overflow-y: auto; }
.rail-btn { display: grid; justify-items: center; gap: 3px; padding: 8px 4px 7px; border-radius: 6px; border: 1px solid transparent; color: var(--muted); font-size: 11px; font-weight: 600; line-height: 1.15; text-align: center; text-decoration: none; position: relative; }
.rail-btn svg { width: 21px; height: 21px; }
.rail-btn:hover { color: var(--ink); background: var(--surface-2); }
.rail-btn[aria-current="page"] { color: var(--ink); background: var(--gold-wash); border-color: var(--gold); }
.rail-soon { font-size: 9.5px; font-weight: 500; color: var(--faint); letter-spacing: 0.02em; }
body.has-rail { padding-left: var(--rail-w); }
body.has-rail .savebar { left: var(--rail-w); }
body[data-area]:not([data-area="products"]) #views,
body[data-area]:not([data-area="products"]) #btn-new,
body[data-area]:not([data-area="products"]) .savebar { display: none !important; }
.who { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.who-name { font-weight: 600; }
.who-role { color: var(--gold-ink); background: var(--gold-wash); padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 18px; }
.who-out { margin: 0; }
@media (max-width: 880px) {
  body.has-rail { padding-left: 0; padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
  body.has-rail .savebar { left: 0; bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
  .rail { top: auto; right: 0; width: auto; height: calc(66px + env(safe-area-inset-bottom, 0px)); flex-direction: row; border-right: 0; border-top: 1px solid var(--line); padding: 6px 6px env(safe-area-inset-bottom, 0px); overflow-x: auto; overflow-y: hidden; gap: 2px; }
  .rail-btn { min-width: 66px; flex: none; }
  .rail-soon { display: none; }
}

.area-in { max-width: 1280px; margin: 0 auto; padding: 22px 24px 80px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }
@media (max-width: 880px) { .area-in { padding-inline: 16px; } }
.area-title { margin: 0; font-size: clamp(22px, 2.6vw, 30px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.area-in > .eyebrow { margin-bottom: -10px; }
.area-lead { margin: 0; color: var(--muted); max-width: 760px; }
.area-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.soon-card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 18px 20px; display: grid; gap: 8px; max-width: 760px; }
.soon-card p { margin: 0; }
.subtabs { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); width: max-content; max-width: 100%; overflow-x: auto; }
.subtabs .vtab { white-space: nowrap; flex: none; }
.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
table.adm-tbl { border-collapse: collapse; width: 100%; font-size: 13px; }
table.adm-tbl th, table.adm-tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.adm-tbl thead th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); background: var(--surface-2); font-weight: 700; white-space: nowrap; }
table.adm-tbl tbody tr:last-child > * { border-bottom: 0; }
.nowrap { white-space: nowrap; }
.row-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.adm-pre { margin: 6px 0 0; font-family: var(--font-mono); font-size: 11.5px; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 420px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; }
fieldset.f { border: 0; padding: 0; margin: 0; }
fieldset.f legend { font-weight: 600; font-size: 12.5px; padding: 0; margin-bottom: 6px; }
.settings-form { display: grid; gap: 16px; max-width: 760px; }
.card-sec { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 18px 20px; display: grid; gap: 12px; }
.card-sec h2 { margin: 0; font-size: 15px; font-weight: 700; }
@media (max-width: 600px) { .settings-form .grid2 { grid-template-columns: minmax(0, 1fr); } }

/* Hosted login pages (lib/pages.mjs) */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 28px 24px; display: grid; gap: 14px; }
.login-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.login-brand svg { width: 28px; height: 28px; }
.login-lang { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--gold-ink); }
.login-title { margin: 4px 0 0; font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.login-form { display: grid; gap: 12px; margin: 0; }
.login-form label { display: grid; gap: 6px; font-weight: 600; font-size: 13px; }
.login-msg { margin: 0; padding: 10px 12px; border-radius: var(--radius); background: var(--err-wash); color: var(--err); font-size: 13px; }
.login-note { margin: 0; color: var(--muted); font-size: 13px; }
.login .btn-primary { width: 100%; padding: 10px 14px; }
.login-steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 13.5px; }
.setup-key { display: block; margin-top: 6px; padding: 8px 10px; font-size: 15px; letter-spacing: 0.06em; text-align: center; user-select: all; }
.code-inp { font-family: var(--font-mono); font-size: 20px; letter-spacing: 0.2em; text-align: center; }

/* ------------------------------ Home, Orders and Stock (stage 2, 10 Nov 2026: public/business.js) ------------------------------ */
/* Chart bars: a deeper gold than --gold, checked with the dataviz palette validator against both surfaces. */
:root { --chart-bar: #a07f2c; }
@media (prefers-color-scheme: dark) { :root { --chart-bar: #a8842f; } }
.home-head { margin: 0; font-size: clamp(22px, 2.8vw, 32px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; max-width: 900px; }
.stat-chip { display: inline-flex; padding: 3px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 18px 20px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.panel p { margin: 0; }
.panel-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; justify-content: space-between; }
.panel-head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.home-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.home-grid .span2 { grid-column: span 2; }
@media (max-width: 1000px) { .home-grid { grid-template-columns: minmax(0, 1fr); } .home-grid .span2 { grid-column: auto; } }
.hero-num { font-size: clamp(28px, 3.2vw, 38px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.delta { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--err); }
.warn-text { color: var(--warn); font-weight: 600; }

/* The pipeline strip: one step per stage, the count in a circle, joined by a line. */
.pipeline { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(92px, 1fr); overflow-x: auto; }
.pipe-step { position: relative; display: grid; justify-items: center; gap: 4px; text-align: center; padding: 0 4px 4px; }
.pipe-step::before { content: ''; position: absolute; top: 22px; left: 0; right: 0; height: 2px; background: var(--line); z-index: 0; }
.pipe-step:first-child::before { left: 50%; }
.pipe-step:last-child::before { right: 50%; }
.pipe-dot { position: relative; z-index: 1; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 16px; text-decoration: none; color: var(--muted); background: var(--surface-2); border: 2px solid var(--line); font-variant-numeric: tabular-nums; }
.pipe-step.has .pipe-dot { color: var(--ink); background: var(--gold-wash); border-color: var(--gold); }
.pipe-dot:hover { border-color: var(--gold-ink); color: var(--ink); }
.pipe-label { font-size: 12.5px; font-weight: 600; line-height: 1.2; }
.pipe-sub { font-size: 11px; color: var(--faint); min-height: 14px; }
.warn-chip { color: var(--warn); background: var(--warn-wash); border-color: transparent; text-decoration: none; }

/* The sales chart (hairline grid, thin bars with a rounded top, hover tooltip, a table view underneath). */
.chart-wrap { position: relative; }
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
svg.chart .ax { fill: var(--muted); font-size: 11px; font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
svg.chart .fill { fill: var(--chart-bar); }
svg.chart .hit { fill: transparent; }
svg.chart .bar.is-future .fill { opacity: 0.35; }
svg.chart .bar.hover .hit { fill: var(--surface-2); }
.chart-tip { position: absolute; width: 160px; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 600; padding: 5px 8px; border-radius: var(--radius); text-align: center; font-variant-numeric: tabular-nums; }
details.chart-table summary { cursor: pointer; font-size: 12.5px; color: var(--muted); font-weight: 600; }
details.chart-table .tbl-wrap { margin-top: 8px; max-height: 260px; overflow: auto; }

.fx { display: grid; gap: 8px; }
.fx-row { display: grid; gap: 1px; }
.fx-big { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.wait-list { list-style: none; margin: 0; padding: 0; display: grid; }
.wait-list li { display: grid; grid-template-columns: 90px minmax(0, 1fr) auto; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.wait-list li:last-child { border-bottom: 0; }

/* Orders and Stock tables */
.ord-q { width: auto; flex: 1 1 220px; max-width: 360px; }
.sel-auto { width: auto; }
table.adm-tbl td.num, table.adm-tbl th.num { text-align: right; }
.ord-row.is-cancelled td { color: var(--faint); }
tr.ord-lines > td { background: var(--surface-2); padding: 8px 12px 12px 34px; }
table.lines-tbl { border-collapse: collapse; width: 100%; font-size: 12.5px; }
table.lines-tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); padding: 4px 8px; }
table.lines-tbl td { padding: 6px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; display: grid; gap: 2px; }
.tile-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
.tile-value { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; }
.tile-sub { font-size: 12px; color: var(--muted); }
.stock-prod { display: flex; gap: 10px; align-items: flex-start; min-width: 220px; }
.stock-prod img, .thumb-sm { width: 36px; height: 36px; flex: none; object-fit: cover; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--line); }

/* ------------------------------ Suppliers, Purchasing and Shipments (stage 3, 10 Nov 2026: public/purchasing.js) ------------------------------ */
.area-in .eyebrow a { color: inherit; text-decoration: none; }
.area-in .eyebrow a:hover { text-decoration: underline; }
.title-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; }
.title-row .area-title a { color: inherit; text-decoration: none; }
.title-row .area-title a:hover { color: var(--gold-ink); }
.two-col { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px 16px; }
.contact-list { list-style: none; margin: 0; padding: 0; display: grid; }
.contact-list li { display: grid; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.contact-list li:last-child { border-bottom: 0; }
.contact-list .row-actions { justify-content: flex-start; }
/* Purchasing: what needs checking before the cut-off, and PO lines grouped by customer order. */
.alert-gold { background: var(--gold-wash); color: var(--gold-ink); }
.alert-info { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.alert a { color: inherit; font-weight: 700; }
#checks .panel-head .btn { margin-left: auto; }
#checks > .alert, #checks > p { margin: 0 0 10px; }
.checks-tbl td.row-actions { justify-content: flex-end; align-items: center; min-width: 220px; }
.place { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.place .inp { padding: 4px 6px; font-size: 12.5px; max-width: 150px; }
table.adm-tbl tr.grp-row th { background: var(--surface-2); text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 400; color: var(--ink); border-top: 1px solid var(--line-strong); }
table.adm-tbl tr.row-flag td { background: var(--warn-wash); }
.layout-pick { border: 0; padding: 10px 0 0; margin: 0; display: grid; gap: 4px; }
.layout-pick label { display: flex; gap: 8px; align-items: center; }
.inp-num { width: 96px; text-align: right; font-variant-numeric: tabular-nums; padding: 5px 8px; font-size: 13px; }
.add-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; }
.add-line .inp:not(.inp-num) { width: auto; flex: 1 1 160px; max-width: 280px; }
/* Delivery promises in Orders (public/business.js). */
.promise-cell { min-width: 180px; }
.why { margin: 4px 0 0; padding-left: 16px; color: var(--warn); font-size: 12.5px; }
.why li { margin: 2px 0; }
.line-facts td { padding-top: 0; border-top: 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 6px 18px; margin: 0 0 6px; padding: 8px 10px; background: var(--surface-2); border-radius: var(--radius); font-size: 12.5px; }
.facts dt { color: var(--muted); font-weight: 600; font-size: 11.5px; }
.facts dd { margin: 1px 0 0; }
.lines-tbl tbody.line-grp + tbody.line-grp tr:first-child td { border-top: 1px solid var(--line); }

/* The "Add stock" SKU drop-down (public/purchasing.js). */
.sku-pick { position: relative; flex: 1 1 200px; max-width: 320px; min-width: 0; }
.add-line .sku-pick .inp { width: 100%; max-width: none; }
.sku-list { position: absolute; z-index: 20; left: 0; top: calc(100% + 4px); width: min(440px, calc(100vw - 32px)); max-height: 340px; overflow-y: auto; margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14); }
.sku-opt { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 3px; cursor: pointer; }
.sku-opt img, .sku-opt .thumb-sm { width: 32px; height: 32px; flex: none; object-fit: cover; border-radius: 3px; border: 1px solid var(--line); background: var(--surface-2); }
.sku-opt .sku-txt { display: grid; gap: 1px; flex: 1; min-width: 0; }
.sku-opt .sku-txt .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sku-opt:hover, .sku-opt[aria-selected="true"] { background: var(--gold-wash, var(--surface-2)); }
.sku-opt[aria-selected="true"] { outline: 1px solid var(--gold); }
.sku-note { padding: 8px; color: var(--muted); font-size: 12.5px; }
@media (max-width: 600px) { .sku-pick { flex-basis: 100%; max-width: none; } .sku-list { width: 100%; } }
.alloc { display: inline-flex; align-items: center; gap: 2px; padding: 0 2px 0 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); margin: 1px 0; white-space: nowrap; }
.x-btn { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 2px 5px; border-radius: 999px; }
.x-btn:hover { color: var(--err); background: var(--err-wash); }
table.adm-tbl tfoot th { background: var(--surface-2); border-top: 1px solid var(--line-strong); }
table.adm-tbl td .inp-num { margin-left: auto; display: block; }

/* The purchase order copy for the factory: hidden on screen, the only thing printed. */
.po-print { display: none; }
@media print {
  @page { margin: 14mm; }
  body { background: #fff !important; color: #000 !important; padding: 0 !important; }
  body.printing-po > *:not(#area) { display: none !important; }
  body.printing-po #area > .area-in > *:not(.po-print) { display: none !important; }
  body.printing-po #area > .area-in { padding: 0; max-width: none; display: block; }
  body.printing-po .po-print { display: block; color: #000; font-size: 11pt; }
}
.po-print .pp-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 12px; }
.po-print .pp-title { font-size: 18pt; font-weight: 800; }
.po-print .pp-num { font-family: var(--font-mono); font-size: 13pt; }
.po-print .pp-brand { text-align: right; font-weight: 700; }
.po-print .pp-brand span { font-weight: 400; font-size: 9pt; }
.po-print .zh { font-weight: 400; color: #444; }
.po-print table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.po-print th, .po-print td { border: 1px solid #999; padding: 5px 7px; text-align: left; vertical-align: top; font-size: 10pt; }
.po-print th { background: #f0f0f0; }
.po-print .num { text-align: right; }
.po-print .pp-notes p { margin: 4px 0 0; }
.po-print .pp-grp th { background: #fff; border-top: 2px solid #000; font-size: 10.5pt; }
.po-print .pp-sub { font-size: 11pt; margin: 4px 0 6px; }
.po-print .pp-orders tbody { break-inside: avoid; }
