/* NordLeaf Procurement Portal — design system.
   Matches the published prototype: dark navy surface, elevated cards,
   status pills, monospace numbers. Light theme via [data-theme=light]. */

:root {
  --bg: #10151d;
  --bg-side: #0c1118;
  --bg-card: #141b25;
  --bg-card-2: #101722;
  --bg-hover: #1a2330;
  --bg-active: #1d2735;
  --line: #232d3b;
  --line-soft: #1b2430;
  --text: #dfe5ec;
  --text-strong: #f4f7fa;
  --muted: #8b95a3;
  --faint: #5d6875;
  --green: #63d68f;
  --green-bg: rgba(99, 214, 143, .12);
  --red: #e5697c;
  --red-bg: rgba(229, 105, 124, .12);
  --amber: #d9a742;
  --amber-bg: rgba(217, 167, 66, .12);
  --teal: #45c4a4;
  --teal-bg: rgba(69, 196, 164, .13);
  --blue: #5aa7e8;
  --blue-bg: rgba(90, 167, 232, .13);
  --gray-pill: #313c4c;
  --accent: #63d68f;
  --sans: "Inter", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.25);
}
[data-theme="light"] {
  --bg: #f4f6f9;
  --bg-side: #eceff4;
  --bg-card: #ffffff;
  --bg-card-2: #f8fafc;
  --bg-hover: #eef1f6;
  --bg-active: #e3e9f2;
  --line: #d8dee8;
  --line-soft: #e5eaf1;
  --text: #29313c;
  --text-strong: #10151d;
  --muted: #66707e;
  --faint: #98a1ad;
  --green: #1d9e57;
  --green-bg: rgba(29, 158, 87, .1);
  --red: #cc3d54;
  --red-bg: rgba(204, 61, 84, .09);
  --amber: #a97b14;
  --amber-bg: rgba(169, 123, 20, .1);
  --teal: #15806a;
  --teal-bg: rgba(21, 128, 106, .1);
  --blue: #2d6fb4;
  --blue-bg: rgba(45, 111, 180, .1);
  --gray-pill: #dde3ec;
  --shadow: 0 1px 3px rgba(16,21,29,.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  display: flex;
  overflow: hidden;           /* every page fits the viewport; panels scroll inside */
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
.mono, td.num, .kpi-value, code { font-family: var(--mono); }

/* ---------- sidebar ---------- */
.sidebar {
  width: 234px; min-width: 234px;
  background: var(--bg-side);
  border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column;
  height: 100vh; position: sticky; top: 0;
}
.side-head { display: flex; gap: 10px; align-items: center; padding: 18px 16px 14px; }
.side-logo {
  width: 30px; height: 30px; border-radius: 7px;
  background: linear-gradient(135deg, #2e7d54, #63d68f);
  color: #fff; font-weight: 700; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
}
.side-title { font-weight: 600; font-size: 14px; color: var(--text-strong); line-height: 1.2; }
.side-sub { font-size: 9.5px; letter-spacing: .12em; color: var(--faint); margin-top: 2px; }
.side-nav { flex: 1; overflow-y: auto; padding: 4px 10px 10px; }
.nav-section { font-size: 10px; letter-spacing: .14em; color: var(--faint);
  padding: 16px 8px 6px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 10px; border-radius: 7px; margin: 1px 0;
  color: var(--muted); font-size: 13.5px;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--bg-active); color: var(--text-strong); }
.nav-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--faint); flex: none; }
.nav-item.active .nav-dot { background: var(--green); }
.nav-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
  font-family: var(--mono); font-size: 10.5px; color: var(--amber);
  background: var(--amber-bg); border-radius: 9px; padding: 1px 7px;
}
.side-foot { border-top: 1px solid var(--line-soft); padding: 10px 14px 14px; }
.seg { display: flex; background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden; margin-bottom: 9px; }
.seg a { flex: 1; text-align: center; padding: 5px 0; font-size: 12.5px; color: var(--muted); }
.seg a.on { background: var(--bg-active); color: var(--text-strong); }
.side-user { font-size: 11px; color: var(--faint); line-height: 1.45; }

/* ---------- main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column;
  height: 100vh; overflow: hidden; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 26px; border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.crumb { font-size: 13px; color: var(--muted); }
.crumb b { color: var(--text-strong); font-weight: 500; }
.topbar .spacer { flex: 1; }
.badge-demo {
  font-size: 10px; letter-spacing: .1em; font-weight: 600;
  color: var(--amber); background: var(--amber-bg);
  border: 1px solid rgba(217,167,66,.25);
  padding: 4px 10px; border-radius: 6px; font-family: var(--mono);
}
.badge-live { color: var(--green); background: var(--green-bg);
  border-color: rgba(99,214,143,.25); }
.btn-ghost {
  background: var(--bg-card); color: var(--text); border: 1px solid var(--line);
  border-radius: 7px; padding: 5px 13px; font-size: 12.5px;
}
.btn-ghost:hover { background: var(--bg-hover); }

/* round 63g (Adaora, 29 Sep: "hard to scroll a page if my cursor is on the
   left side"): the scrolling box is the WHOLE column, edge to edge; the page
   is centred inside it by padding, so the wheel works over the empty margins
   on both sides. Same 1220 / 1600 px reading width as before. */
.content { padding: 24px max(26px, calc((100% - 1220px) / 2 + 26px)) 40px;
  max-width: none; width: 100%; margin: 0;
  flex: 1; min-height: 0; overflow-y: auto; }
.content > .fill-page { height: auto; min-height: 0; }
.side-hidden .content { max-width: none; padding: 24px max(44px, calc((100% - 1600px) / 2 + 44px)) 60px; }
.side-hidden .topbar { padding-left: 46px; }
h1 { font-size: 22px; font-weight: 600; color: var(--text-strong); margin-bottom: 4px; }
.lede { color: var(--muted); max-width: 560px; margin-bottom: 22px; }

/* ---------- banner ---------- */
.banner {
  background: var(--amber-bg); border: 1px solid rgba(217,167,66,.3);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 22px;
  font-size: 13px; color: var(--text);
}
.banner b { color: var(--text-strong); }
.banner.green { background: var(--green-bg); border-color: rgba(99,214,143,.3); }

/* ---------- KPI cards ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi-label { font-size: 10px; letter-spacing: .12em; color: var(--muted);
  font-weight: 600; margin-bottom: 10px; }
.kpi-value { font-size: 26px; font-weight: 600; color: var(--text-strong); }
.kpi-value.good { color: var(--green); }
.kpi-value.bad { color: var(--red); }
.kpi-value.warn { color: var(--amber); }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- panels & tables ---------- */
.grid { display: grid; gap: 16px; }
.grid-main-side { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
@media (max-width: 1100px) { .grid-main-side { grid-template-columns: 1fr; } }
.panel { background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { display: flex; align-items: baseline; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.panel-title { font-size: 15px; font-weight: 600; color: var(--text-strong); }
.panel-hint { font-size: 12px; color: var(--faint); }
.panel-body { padding: 16px 18px; }
.panel .table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 10px; letter-spacing: .1em; color: var(--faint);
  font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line-soft);
  white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.hover:hover, tbody tr:hover { background: var(--bg-card-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th.num { text-align: right; }
.cell-main { color: var(--text-strong); font-weight: 500; }
.cell-sub { font-size: 11.5px; color: var(--faint); margin-top: 1px; }
.id { font-family: var(--mono); font-size: 12.5px; color: var(--text); }

/* ---------- pills ---------- */
.pill { display: inline-block; font-size: 11.5px; font-weight: 500;
  padding: 3px 10px; border-radius: 7px; white-space: nowrap; }
.pill-red { color: var(--red); background: var(--red-bg); }
/* round 64: a waiting price change whose delivery is under dispute */
.row-disputed td { background: var(--red-bg); }
.pill-amber { color: var(--amber); background: var(--amber-bg); }
.pill-green { color: var(--green); background: var(--green-bg); }
.pill-teal { color: var(--teal); background: var(--teal-bg); }
.pill-blue { color: var(--blue); background: var(--blue-bg); }
.pill-gray { color: var(--muted); background: var(--gray-pill); }

/* ---------- buttons / forms ---------- */
.btn { background: var(--bg-card-2); color: var(--text-strong);
  border: 1px solid var(--line); border-radius: 7px; padding: 6px 14px;
  font-size: 12.5px; font-weight: 500; }
.btn:hover { background: var(--bg-hover); }
.btn-primary { background: var(--green); border-color: var(--green); color: #0c1118; }
.btn-primary:hover { filter: brightness(1.08); background: var(--green); }
.btn-danger { color: var(--red); border-color: rgba(229,105,124,.35); }
.btn-sm { padding: 3px 10px; font-size: 11.5px; }
input, select, textarea {
  font: inherit; color: var(--text-strong);
  background: var(--bg-card-2); border: 1px solid var(--line);
  border-radius: 7px; padding: 6px 10px; font-size: 13px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); }
input.mono { font-family: var(--mono); }
input.cell { width: 88px; text-align: right; font-family: var(--mono); padding: 4px 8px; }
label.f { display: block; font-size: 11px; letter-spacing: .08em; color: var(--muted);
  font-weight: 600; margin-bottom: 4px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; }

/* ---------- misc ---------- */
.bar { height: 5px; border-radius: 3px; background: var(--line-soft);
  min-width: 70px; position: relative; overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; display: block; }
.tag-metric { font-family: var(--mono); font-size: 12px; }
.pos { color: var(--green); } .neg { color: var(--red); } .mid { color: var(--amber); }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.small { font-size: 12px; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.flex { display: flex; gap: 10px; align-items: center; }
.right { margin-left: auto; }
.section-gap { margin-top: 24px; }
/* A second section INSIDE a panel (round 51; Adaora, 16 Sep: "give space
   between both sessions. they are joined together"). Reads like a panel head
   — same type, same rhythm — with room above so the eye sees two things. */
.panel-inset { margin: 28px 18px 18px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--bg-card); overflow: hidden; }
.panel-sub { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 14px 18px 12px; border-bottom: 1px solid var(--line-soft);
  background: var(--bg-card-2); }
.panel-sub .panel-title { font-size: 14px; }
.checks { display: flex; flex-direction: column; gap: 6px; }
.check { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.check .ok { color: var(--green); font-family: var(--mono); }
.check .fail { color: var(--red); font-family: var(--mono); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { font-family: var(--mono); }
.toast { position: fixed; bottom: 18px; right: 18px; background: var(--green);
  color: #0c1118; font-weight: 600; padding: 10px 18px; border-radius: 9px;
  box-shadow: 0 4px 16px rgba(0,0,0,.35); animation: fade 3.5s forwards; }
@keyframes fade { 0%,80% { opacity: 1 } 100% { opacity: 0; visibility: hidden } }
details.rowform summary { cursor: pointer; color: var(--blue); font-size: 12.5px; }
.overflow-note { font-size: 11px; color: var(--faint); padding: 8px 14px; }

.btn, .pill { white-space: nowrap; }
.panel table td:first-child { white-space: nowrap; }
.panel table td:first-child .cell-main,
.panel table td:first-child .cell-sub { white-space: normal; }

.grid-main-side > .panel:last-child td, .grid-main-side > .panel:last-child th { padding: 9px 10px; }
.grid-main-side > .panel:last-child table { table-layout: fixed; }
.grid-main-side > .panel:last-child td:first-child { white-space: normal; }

/* ---------- collapsible sidebar ---------- */
.side-toggle { position: fixed; left: 222px; top: 14px; z-index: 30;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--bg-card); color: var(--muted); border: 1px solid var(--line);
  font-size: 12px; line-height: 1; transition: left .18s; }
.side-toggle:hover { color: var(--text-strong); }
.side-hidden .sidebar { display: none; }
.side-hidden .side-toggle { left: 10px; transform: rotate(180deg); }
/* ---------- pagination ---------- */
.pager { display: flex; gap: 8px; align-items: center; padding: 12px 16px; }
.pager .btn[aria-disabled="true"] { opacity: .4; pointer-events: none; }
/* ---------- pharmacy chips in grouped stock ---------- */
.ph-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ph-chip { font-family: var(--mono); font-size: 11px; padding: 2px 8px;
  border-radius: 6px; background: var(--bg-card-2); border: 1px solid var(--line); }

td.cell-alert { background: var(--red-bg); box-shadow: inset 2px 0 0 var(--red); }

/* inner scroller: the table scrolls, the page stays put (like the Looker dashboard) */
/* Adaora's rule (8 Sep): a page may scroll, but never gets long — a long
   table scrolls INSIDE its panel, roughly two-thirds of the screen tall
   (the Launch & day-after page is the model). */
.table-scroller { max-height: 68vh; overflow-y: auto; }
.table-scroller thead th { position: sticky; top: 0; background: var(--bg-card); z-index: 3; }
.th-sort { color: inherit; }
.th-sort:hover, .th-sort.on { color: var(--text-strong); }

/* ---------- one-viewport table pages ---------- */
/* .fill-page used to pin the page to ONE viewport (fixed height, panels
   squeezed to fit). That collapsed the last table whenever a panel above it
   grew (8 Sep). It is now an ordinary scrolling page whose tables scroll
   inside themselves; the compact typography below is kept. */
.fill-page { display: block; height: auto; min-height: 0; }
.fill-page h1 { margin-bottom: 10px; }
.fill-page .kpis { margin-bottom: 14px; }
.fill-page .kpi { padding: 10px 16px; }
.fill-page .kpi-value { font-size: 21px; }
.fill-page .kpi-label { margin-bottom: 4px; }
.fill-page .form-row { margin-bottom: 10px; }
.fill-page > .panel, .fill-page > .grid-main-side > div > .panel:first-child,
.fill-page > .grid-main-side > .panel { display: block; }
.fill-page .table-scroller { max-height: 68vh; }
/* compact two-line rows, wide product names */
.col-product { min-width: 340px; max-width: 480px; }
.fill-page td { padding: 6px 12px; }
.fill-page th { padding: 8px 12px; }
.fill-page .cell-sub { font-size: 10.5px; margin-top: 0; }
.fill-page .cell-main { font-size: 13px; line-height: 1.3; }
.weeks-cell { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.weeks-cell .bar { width: 44px; min-width: 44px; margin: 0 !important; }
.fill-page .btn-sm { padding: 2px 9px; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; white-space: normal; }
/* pharmacy multi-select chips */
.ph-picker { display: flex; gap: 6px; }
.ph-check { display: inline-flex; align-items: center; cursor: pointer;
  border: 1px solid var(--line); border-radius: 7px; padding: 5px 11px;
  font-size: 12px; font-family: var(--mono); font-weight: 600;
  color: var(--muted); background: var(--bg-card); user-select: none; }
.ph-check input { display: none; }
.ph-check.on { color: var(--text-strong); background: var(--bg-active);
  border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.ph-check:hover { background: var(--bg-hover); }

/* extra-dense table for wide views — everything fits one page width */
table.tight { table-layout: auto; width: 100%; }
table.tight th, table.tight td { padding: 5px 8px; font-size: 12.5px;
  white-space: nowrap; }
table.tight th { font-size: 10px; }
table.tight .col-product { min-width: 220px; max-width: 340px;
  white-space: normal; }
table.tight .cell-main { font-size: 12.5px; }
table.tight .pill { padding: 1px 7px; font-size: 10.5px; }
table.tight .weeks-cell .bar { width: 30px; min-width: 30px; }
table.tight .btn-sm { padding: 2px 7px; font-size: 11px; }

/* click-to-highlight rows */
tr[data-mark] { cursor: pointer; }
tr.row-marked, tr.row-marked:hover { background: var(--amber-bg) !important;
  box-shadow: inset 3px 0 0 var(--amber); }


/* v8.4 — denser KPIs on fill-page screens: more table at a glance */
.fill-page .kpi { padding: 7px 14px; }
.fill-page .kpi-value { font-size: 18px; line-height: 1.25; }
.fill-page .kpi-label { margin-bottom: 2px; font-size: 9.5px; }
.fill-page .kpi-sub { font-size: 10px; margin-top: 1px; }
.fill-page .kpis { margin-bottom: 10px; gap: 10px; }

/* zebra striping instead of heavier rules: guides the eye across a wide row
   without spending ink on borders; hover marks the row you're reading */
.table-scroller tbody tr:nth-child(even) td { background: var(--zebra, rgba(127,127,127,.045)); }
.table-scroller tbody tr:hover td { background: rgba(127,166,255,.07); }

/* v8.6 — slimmer footer bar: one more table row on screen */
.fill-page .pager { padding: 5px 14px; }
.fill-page .pager .btn { padding: 2px 9px; }

/* v8.8 — sidebar sheen reverted at Adaora's request: the original flat navy stays. */

/* v8.8 — quieter footer: the table is the show */
.fill-page .pager { opacity: .78; }
.fill-page .pager .btn { border-color: transparent; background: transparent; }
.fill-page .pager .btn:hover { opacity: 1; border-color: var(--line); }
.fill-page .pager .small { font-size: 11px; }

/* collapsed sidebar peeks back as an overlay from the left edge */
.side-hidden.side-peek .sidebar {
  display: flex; position: fixed; left: 0; top: 0; z-index: 60;
  height: 100vh; box-shadow: 12px 0 40px -18px rgba(0,0,0,.6);
  animation: nl-peek .14s ease-out;
}
@keyframes nl-peek { from { transform: translateX(-40px); opacity: .4; } to { transform: none; opacity: 1; } }

/* a row that opens on a click anywhere — the cursor says so */
tr[data-href] { cursor: pointer; }
tr[data-href]:hover { background: var(--bg-card-2); }
.btn:disabled, button:disabled { opacity: .45; cursor: not-allowed; }

/* A KPI you can click filters or opens what it counted. It stays a card —
   only the cursor, a hover lift and a small ↗ say it is a link; an active
   filter gets a green edge and clicking it again clears the filter. */
a.kpi-click { display: block; text-decoration: none; color: inherit;
  position: relative; transition: border-color .15s, transform .15s; }
a.kpi-click:hover { border-color: var(--green); transform: translateY(-1px); }
a.kpi-click::after { content: "↗"; position: absolute; top: 10px; right: 12px;
  font-size: 11px; color: var(--muted); opacity: .55; }
a.kpi-click.on { border-color: var(--green); box-shadow: inset 3px 0 0 var(--green); }
a.kpi-click.on::after { content: "✕ clear"; opacity: .9; color: var(--green); }

/* ---------- pending state ---------------------------------------------------
   The submit handler in base.html has always set data-busy on the button, and
   its comment claimed "CSS blocks a second click" — but no rule was ever
   written, so the attribute did nothing. A slow POST looked exactly like a
   dead one (Adaora, 2 Sep: "when something is loading, for example when one
   tries to login, can you do the loading thing so one knows"). The label is
   hidden rather than replaced so the button keeps its width and the row does
   not jump, and the control is never `disabled` — a disabled button is not
   submitted, which would drop its name and value from the POST. */
button[data-busy], .btn[data-busy] {
  position: relative;
  pointer-events: none;
  color: transparent !important;
}
button[data-busy]::after, .btn[data-busy]::after {
  content: "";
  position: absolute; inset: 0; margin: auto;
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--muted); border-top-color: transparent;
  animation: nl-spin .6s linear infinite;
}
@keyframes nl-spin { to { transform: rotate(360deg); } }
/* the rest of the form dims, so it reads as "in flight", not "broken" */
form[data-busy] { opacity: .62; transition: opacity .12s ease; }
form[data-busy] input, form[data-busy] select, form[data-busy] textarea {
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  button[data-busy]::after, .btn[data-busy]::after { animation-duration: 2.4s; }
  form[data-busy] { transition: none; }
}

/* ---------- a table that scrolls inside a panel -----------------------------
   .fill-page sizes its direct children, so a .table-scroller nested inside a
   <form> and a .panel (the ticked-rows table on Expiry & push) never got a
   bound and the page grew instead of the table scrolling. */
.fill-page .fill-flex { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* ---------- mobile (additive) ----------
   Adaora, 8 Sep: "yes go ahead with the mobile — hope it won't affect the
   desktop version at all". Everything below lives inside media queries that
   only match narrow screens; not one desktop rule above is touched. On a
   phone the sidebar becomes a drawer behind the ⟨ button, pages scroll
   normally instead of fitting one viewport, tables scroll sideways inside
   their panel, and the grids stack. */
@media (max-width: 820px) {
  .sidebar { display: none; }
  html.m-side-open .sidebar {
    display: flex; position: fixed; left: 0; top: 0; z-index: 60;
    height: 100vh; width: min(82vw, 290px); min-width: 0;
    box-shadow: 12px 0 40px -18px rgba(0,0,0,.6);
  }
  html.m-side-open::after {
    content: ""; position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.35);
  }
  .side-toggle, .side-hidden .side-toggle { left: 10px; top: 10px; transform: none; }
  html.m-side-open .side-toggle { left: calc(min(82vw, 290px) - 14px); z-index: 70; transform: rotate(180deg); }
  .topbar, .side-hidden .topbar { padding: 10px 12px 10px 44px; gap: 8px; flex-wrap: wrap; }
  .crumb { font-size: 12px; }
  .content, .side-hidden .content { padding: 12px 12px 40px; max-width: none; }
  h1 { font-size: 18px; }
  .lede { font-size: 13px; }
  /* one-viewport pages become ordinary scrolling pages */
  .fill-page, .content > .fill-page { height: auto; min-height: 0; display: block; }
  .fill-page > .panel { display: block; }
  .fill-page .table-scroller, .table-scroller { max-height: none; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 640px; }
  .col-product { min-width: 200px; max-width: 260px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 10px 12px; }
  .kpi-value { font-size: 18px; }
  .grid-main-side { grid-template-columns: 1fr; }
  .panel-head { flex-wrap: wrap; padding: 10px 12px; gap: 6px; }
  .panel-body { padding: 10px 12px; }
  .panel-head .right, .panel-hint { margin-left: 0; }
  .form-row .field input, .form-row .field select { max-width: 100%; }
  .form-row .field { min-width: 0; }
  .btn, .btn-sm { white-space: nowrap; }
  .pager { flex-wrap: wrap; row-gap: 6px; }
  .pager .right { margin-left: 0; width: 100%; }
  /* the candidate grids on the expiry page stack instead of squeezing */
  [style*="grid-template-columns:repeat(6"], [style*="grid-template-columns:repeat(5"],
  [style*="grid-template-columns:repeat(4"], [style*="grid-template-columns:repeat(3"] {
    grid-template-columns: 1fr !important;
  }
  .side-hidden.side-peek .sidebar { display: none; }
}
@media (max-width: 480px) {
  .kpis { grid-template-columns: 1fr; }
  .topbar .badge-demo { display: none; }
  td, th { padding: 6px 8px; }
}

/* the Excel-style cell expander (round 18) */
.cell-pop { position: absolute; z-index: 60; width: min(460px, calc(100vw - 24px));
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 18px 46px rgba(0,0,0,.42); padding: 12px; }
.cell-pop-head { font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin-bottom: 8px; }
/* min-height BELOW the JS floor so a short window still shows the buttons;
   the JS sets max-height from the room actually available (12 Sep). */
.cell-pop textarea { width: 100%; min-height: 72px; resize: vertical; overflow-y: auto;
  font-family: var(--mono); font-size: 13px; line-height: 1.6; }
.cell-pop-foot { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 10px; font-size: 12px; }
.cell-pop-foot .btn { margin-left: 6px; }
input[data-list] { cursor: cell; }

/* ---------- /expiry column budget ----------
   Adaora, 11 Sep: "increase the size of the product column and reduce the
   stage column size and reduce the at risk column size. maybe you can put
   sells out first in two lines instead of one."
   The stage pill carries a whole sentence ("pushed 9 d ago — 1,240/d vs
   900/d before, working"), and because .pill is nowrap that sentence was
   setting the width of the column and squeezing the product name — the one
   thing on the row she actually reads. Cap the stage and at-risk columns,
   let their text wrap, and give the slack to PRODUCT. */
.expiry-table th.col-stage, .expiry-table td.col-stage { width: 148px; max-width: 148px; }
.expiry-table td.col-stage .pill { white-space: normal; line-height: 1.35;
  display: inline-block; padding: 4px 8px; }
.expiry-table th.col-product { min-width: 270px; }
.expiry-table td.col-product .cell-main { white-space: normal; }
/* 13 Sep: "increase the width of column at risk a little. reduce days left
   column just a little" — 96 → 116 for AT RISK, DAYS LEFT capped at 68. */
.expiry-table th.col-risk, .expiry-table td.col-risk { width: 116px;
  max-width: 116px; white-space: normal; }
.expiry-table th.col-days, .expiry-table td.col-days { width: 68px;
  max-width: 68px; white-space: nowrap; }
.expiry-table td.col-risk .sells-out { line-height: 1.3; display: inline-block; }
.expiry-table td.col-risk .sells-out-d { display: block; opacity: .75; }

/* A cell that must WRAP inside a .tight table.
   Adaora, 12 Sep: "it is writing on top of each other" — the override panel
   held pharmacy addresses and email lists, and `table.tight td` is
   white-space: nowrap, so an inline max-width + word-break could not break
   anything: the text simply ran out of its box and painted over the columns
   to its right. A cap is only a cap if the content is allowed to wrap. */
table.tight td.wrap-cell, table.tight th.wrap-cell {
  white-space: normal; word-break: break-word; overflow-wrap: anywhere;
  max-width: 280px; }

/* ---------- the "?" note ----------
   ADAORA, 12 SEP: "the portal has many notes but at the top and in different
   places. I want the notes removed and instead written as a tooltip. it will
   make the pages finer... except it is very essential as first sight
   visibility, you can leave it in some pages or tables."

   A native title="" was the obvious route and the wrong one: it takes a
   second to appear, it cannot carry the bold, the `mono` fragments or the
   pills these notes are made of, and a long one wraps into an unreadable
   grey slab. So the note keeps its markup and moves behind a small mark next
   to the panel title. Hover or focus opens it; on a touch screen a tap does,
   because :hover never fires there. */
.note-mark { display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; margin-left: 7px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--bg-card-2);
  color: var(--muted); font-size: 10px; font-weight: 700; line-height: 1;
  cursor: help; vertical-align: middle; padding: 0; position: relative;
  flex: 0 0 auto; }
.note-mark:hover, .note-mark:focus-visible, .note-mark[aria-expanded="true"] {
  color: var(--text-strong); border-color: var(--muted); }
.note-wrap { position: relative; display: inline-flex; align-items: center; }
.note-pop { position: absolute; z-index: 60; top: calc(100% + 8px); left: -6px;
  width: max-content; max-width: min(520px, calc(100vw - 32px));
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 9px; box-shadow: var(--shadow-lg, 0 10px 30px rgba(0,0,0,.35));
  padding: 11px 14px; font-size: 12.5px; line-height: 1.55; color: var(--text);
  text-align: left; text-transform: none; letter-spacing: 0; font-weight: 400;
  white-space: normal; }
.note-pop b { color: var(--text-strong); }
.note-pop[hidden] { display: none !important; }
/* flip to the right edge when the mark sits near the right of the viewport */
.note-pop.flip-right { left: auto; right: -6px; }
.note-pop.flip-up { top: auto; bottom: calc(100% + 8px); }
@media (max-width: 720px) {
  .note-pop { position: fixed; left: 16px; right: 16px; width: auto;
    max-width: none; top: auto; }
}
/* the mark sits on a baseline-aligned flex row in a panel head, and next to a
   24px heading in an h1 — neither of which a 15px circle lands on by itself */
.panel-head .note-wrap { align-self: center; margin-left: -3px; }
h1 .note-mark { width: 17px; height: 17px; font-size: 11px; margin-left: 10px;
  vertical-align: 0.18em; }
h1 .note-pop { font-weight: 400; font-size: 12.5px; }

/* a pill that is also a button — the free-Rx toggle on /brief
   (Adaora, 12 Sep: "is there a way, one can also remove the free px if i
   choose to? maybe by me hovering on it?"). It has to still READ as a pill,
   so the button chrome comes off entirely and only the cursor and a hover
   lift say it can be pressed. */
.pill-btn { border: 1px solid transparent; cursor: pointer; font: inherit;
  font-size: 11.5px; font-weight: 500; }
.pill-btn:hover { border-color: currentColor; filter: brightness(1.06); }
.pill-btn:focus-visible { outline: 2px solid var(--accent, #2e7d54);
  outline-offset: 1px; }
.pill-btn .by-hand { opacity: .6; font-weight: 700; }

/* round 28: the hover-only × that takes an unarrived line off a finalized PO */
.line-x { position:absolute; left:-2px; top:50%; transform:translateY(-50%); margin:0;
  opacity:0; transition:opacity .12s; }
tr:hover .line-x, .line-x:focus-within { opacity:1; }
.line-x button { border:0; background:none; color:var(--muted); cursor:pointer;
  font-size:13px; line-height:1; padding:2px 4px; border-radius:4px; }
.line-x button:hover { color:var(--red, #c0392b); background:rgba(192,57,43,.08); }

/* ---------- COMPETITION hover card (round 56) ----------
   ADAORA, 17 SEP: "when we hover on the competition price, can it list the 3
   pharmacies selling at the lowest price. more like a tooltip." A native
   title cannot hold two columns, so the card is the cell's own child and
   opens on hover or keyboard focus. */
.comp-wrap { position: relative; display: inline-block; cursor: help; }
/* The card lives inside td.num, which is monospace and never wraps — the
   card must undo both or it reads like a terminal and the long pharmacy
   names push the prices off its edge (Adaora, 17 Sep: "it seems to write in
   a way i don't understand"). */
.comp-pop { display: none; position: absolute; z-index: 60; right: 0; top: calc(100% + 6px);
  width: 360px; max-width: calc(100vw - 32px); text-align: left;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 9px;
  box-shadow: var(--shadow-lg, 0 10px 30px rgba(0,0,0,.35)); padding: 10px 14px 11px;
  font-family: var(--sans); font-size: 13px; line-height: 1.45; color: var(--text);
  white-space: normal; font-weight: 400; font-variant-numeric: normal; }
.comp-wrap:hover .comp-pop, .comp-wrap:focus-within .comp-pop { display: block; }
.comp-pop-head { font-weight: 600; color: var(--text-strong); margin-bottom: 6px; }
/* `.panel table td:first-child { white-space: nowrap }` (the product-name
   rule for the big tables) outranks a plain `.comp-pop-table td`, so the
   pharmacy name refused to wrap and pushed the price past the card's edge
   (Adaora, 21 Sep: "it is flowing outside the box why?"). Same specificity
   class here, and the card clips as a belt. */
.comp-pop { overflow: hidden; }
.comp-pop-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.panel .comp-pop-table td, .panel .comp-pop-table td:first-child,
.comp-pop-table td, .comp-pop-table td:first-child {
  padding: 4px 0; border-top: 1px solid var(--line); white-space: normal;
  overflow-wrap: anywhere; text-align: left; font-family: var(--sans);
  vertical-align: top; background: none; font-size: 12.5px; }
.comp-pop-table tr:first-child td { border-top: 0; }
.panel .comp-pop-table td.num, .comp-pop-table td.num { text-align: right; padding-left: 12px;
  white-space: nowrap; width: 64px; font-family: var(--mono);
  font-variant-numeric: tabular-nums; font-weight: 600; }

.comp-pop-foot { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12px; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; }
.comp-pop-foot dt { color: var(--muted); }
.comp-pop-foot dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.comp-pop-foot dd a { color: inherit; }
tr:nth-last-child(-n+3) .comp-pop { top: auto; bottom: calc(100% + 6px); }

/* round 61j — the stale-data strip: one line, not a banner */
.stale-strip { font-size: 12px; line-height: 1.4; padding: 3px 10px; margin: -4px 0 10px;
  border-radius: 6px; color: var(--neg, #b42318);
  background: color-mix(in srgb, var(--neg, #b42318) 8%, transparent);
  display: inline-block; }


/* round 62: a clicked row is HIGHLIGHTED (your place in the list); the name
   link opens the record. Distinct from hover and from a link. */
tbody tr.row-selected > td { background: var(--row-selected, rgba(47, 133, 90, .12)) !important; }
tbody tr.row-selected > td:first-child { box-shadow: inset 3px 0 0 var(--accent, #2f855a); }
a.row-link { color: inherit; text-decoration: underline; text-decoration-color: rgba(127,127,127,.45); text-underline-offset: 2px; }
a.row-link:hover { text-decoration-color: currentColor; }

/* round 62g: the steps strip */
.steps-strip { display:flex; flex-wrap:wrap; align-items:center; gap:6px; padding:8px 12px; margin-bottom:12px;
  border:1px solid var(--line, #e2e8f0); border-radius:8px; font-size:13px; }
.steps-strip.compact { margin:6px 0 0; padding:4px 0; border:0; font-size:12px; }
.steps-kind { font-weight:600; margin-right:6px; }
.step { display:inline-flex; align-items:center; gap:4px; }
.step-done { color: var(--pos, #2f855a); }
.step-skip, .step-todo { color: var(--muted, #718096); }
.step-next { font-weight:600; }
.step-note { color: var(--muted, #718096); font-size:11px; }
.step-sep { color: var(--muted, #a0aec0); }

/* round 63: CM I / CM II with the € values on hover (cm_line macro) */
.cm-h { border-bottom: 1px dotted var(--faint, #9aa1ab); cursor: help; outline: none; white-space: nowrap; }
.cm-tip { display: none; position: fixed; z-index: 60; background: var(--text-strong); color: var(--bg);
  border-radius: 6px; padding: 7px 9px; font-size: 12px; line-height: 1.5; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,.2); font-weight: 400; pointer-events: none; }
.cm-tip b { font-weight: 600; }
.cm-h.cm-open .cm-tip { display: block; }
.cm-neg { color: #fc8181; }
.fee-std { color: var(--faint, #9aa1ab); }
.cm-line { white-space: nowrap; }
/* round 63d: a changed order line that is not saved yet */
tr.row-dirty td { background: rgba(214, 158, 46, .10); }
tr.row-dirty td:first-child { box-shadow: inset 3px 0 0 #d69e2e; }

/* round 63k: the History drawer (draft + PO pages) */
.hist-back { position: fixed; inset: 0; background: rgba(0,0,0,.28); z-index: 80; }
.hist-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); z-index: 81;
  background: var(--bg-card); border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(0,0,0,.25);
  display: flex; flex-direction: column; }
.hist-drawer[hidden], .hist-back[hidden] { display: none; }
.hist-head { display: flex; gap: 10px; align-items: baseline; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.hist-x { margin-left: auto; background: none; border: 0; color: var(--muted); font-size: 15px; cursor: pointer; }
.hist-body { overflow-y: auto; padding: 4px 16px 20px; }
.hist-row { padding: 10px 0; border-bottom: 1px solid var(--line); }

/* round 63o: a row that OPENS (Order drafts, Purchase orders) looks like a
   link on hover — pointer, a light wash and the name underlined — and never
   takes the green "you are here" highlight */
tbody tr[data-open-row] { cursor: pointer; }
tbody tr[data-open-row]:hover > td { background: var(--bg-hover); }
tbody tr[data-open-row]:hover .row-link { text-decoration: underline; }
/* round 63p: on Order drafts / Purchase orders the row HIGHLIGHTS as the
   mouse is on it (the same green as a highlighted row), and a click opens */
tbody tr[data-open-row]:hover > td { background: var(--row-selected, rgba(47, 133, 90, .12)); }
tbody tr[data-open-row]:hover > td:first-child { box-shadow: inset 3px 0 0 var(--accent, #2f855a); }

/* round 65q: collapsible panels (app.js) */
.panel[data-collapse] > .panel-head { cursor: pointer; user-select: none; }
.panel[data-collapse] > .panel-head::before { content: "▾"; color: var(--muted); margin-right: 8px; font-size: 11px; }
.panel[data-collapse].collapsed > .panel-head::before { content: "▸"; }
.panel[data-collapse].collapsed > :not(.panel-head) { display: none !important; }
.panel[data-collapse].collapsed > .panel-head { border-bottom: 0; }
.panel[data-collapse] > .panel-head:hover .panel-title { text-decoration: underline; text-underline-offset: 3px; }

/* round 65bb: the row she came back to, for a moment */
.nl-back-here, .nl-back-here > td { background: var(--bg-active) !important; transition: background 1.2s ease; }

/* ROUND 65dd — one design layer for the redesigned pages (Overview, Replies
   & intake, Expiry & push, Weekly push brief). The same parts as Launch and
   Price change: a header with the live state and the main action, tiles that
   say what waits, numbered sections, cards. */
.ux-head { display:flex; align-items:flex-end; gap:14px; flex-wrap:wrap; margin-bottom:16px; flex:0 0 auto; }
.ux-head h1 { margin:0; }
.ux-head .ux-act { margin-left:auto; display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.ux-state { display:flex; gap:6px 12px; flex-wrap:wrap; align-items:center; font-size:12.5px; color:var(--muted); margin-top:5px; }
.ux-dot { display:inline-block; width:7px; height:7px; border-radius:50%; margin-right:5px; vertical-align:1px; background:var(--muted); }
.ux-dot.on { background:var(--green); } .ux-dot.off { background:var(--red); } .ux-dot.amb { background:var(--amber); }
.ux-tiles { display:grid; grid-template-columns:repeat(auto-fit, minmax(200px, 1fr)); gap:12px; margin-bottom:20px; flex:0 0 auto; }
.ux-tile { display:block; position:relative; text-decoration:none; color:var(--text); background:var(--bg-card); border:1px solid var(--line);
           border-radius:var(--radius); padding:14px 16px; transition:border-color .12s, background .12s, transform .12s; }
a.ux-tile:hover { background:var(--bg-hover); border-color:var(--muted); }
.ux-tile.warn { border-color:var(--amber); box-shadow:0 0 0 1px var(--amber) inset; }
.ux-tile.bad { border-color:var(--red); box-shadow:0 0 0 1px var(--red) inset; }
.ux-tile .t { font-size:11px; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); font-weight:600; }
.ux-tile .n { font-size:27px; font-weight:700; font-family:var(--mono); color:var(--text-strong); line-height:1.25; margin-top:3px; }
.ux-tile .n.ok, .ux-tile .n.good { color:var(--green); } .ux-tile .n.warn { color:var(--amber); } .ux-tile .n.bad { color:var(--red); }
.ux-tile .n small { font-size:13px; font-weight:500; color:var(--muted); margin-left:4px; }
.ux-tile .d { font-size:12.5px; color:var(--muted); margin-top:3px; line-height:1.45; }
.ux-tile .go { position:absolute; top:12px; right:14px; color:var(--faint); font-size:13px; }
a.ux-tile:hover .go { color:var(--text); }
.ux-chips { display:flex; flex-wrap:wrap; gap:5px; margin-top:8px; }
.ux-chip { font-size:11.5px; padding:1px 8px; border-radius:9px; background:var(--bg-card-2); border:1px solid var(--line-soft); color:var(--text); white-space:nowrap; }
.ux-chip.r { color:var(--red); background:var(--red-bg); border-color:transparent; }
.ux-chip.a { color:var(--amber); background:var(--amber-bg); border-color:transparent; }
.ux-chip.g { color:var(--green); background:var(--green-bg); border-color:transparent; }
.ux-chip.b { color:var(--blue); background:var(--blue-bg); border-color:transparent; }
.ux-sec { display:flex; align-items:baseline; gap:10px; margin:24px 0 10px; flex-wrap:wrap; flex:0 0 auto; }
.ux-sec:first-of-type { margin-top:6px; }
.ux-sec .num { font-family:var(--mono); font-size:12px; color:var(--muted); border:1px solid var(--line); border-radius:50%;
               width:22px; height:22px; display:inline-flex; align-items:center; justify-content:center; align-self:center; }
.ux-sec h2 { margin:0; font-size:16px; font-weight:600; color:var(--text-strong); }
.ux-sec .sub { font-size:12.5px; color:var(--muted); }
.ux-sec .right { margin-left:auto; }
.ux-card { background:var(--bg-card); border:1px solid var(--line); border-radius:var(--radius); padding:14px 16px; }
.ux-card + .ux-card { margin-top:12px; }
.ux-k { font-size:11px; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); font-weight:600; margin-bottom:8px; }
.ux-empty { padding:16px 18px; color:var(--muted); font-size:13px; line-height:1.6; }
.ux-empty b.ok { color:var(--green); font-weight:600; }
.ux-grid2 { display:grid; grid-template-columns:minmax(0, 1fr) 340px; gap:16px; align-items:start; }
.ux-grid2.even { grid-template-columns:minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .ux-grid2, .ux-grid2.even { grid-template-columns:1fr; } }
.ux-filters { display:flex; gap:6px; flex-wrap:wrap; align-items:center; }
.ux-f { border:1px solid var(--line); background:var(--bg-card); color:var(--text); border-radius:14px; cursor:pointer;
        padding:3px 11px; font-size:12.5px; text-decoration:none; line-height:1.6; font-family:inherit; white-space:nowrap; }
.ux-f:hover { background:var(--bg-hover); }
.ux-f.on { background:var(--bg-active); border-color:var(--accent); color:var(--text-strong); }
.ux-f .c { font-family:var(--mono); font-size:11.5px; color:var(--muted); margin-left:4px; }
.ux-f.r { border-color:var(--red-bg); } .ux-f.r .c { color:var(--red); }
.ux-f.a { border-color:var(--amber-bg); } .ux-f.a .c { color:var(--amber); }
.ux-f.b .c { color:var(--blue); } .ux-f.t .c { color:var(--teal); }
.ux-toolbar { display:flex; gap:12px; align-items:flex-end; flex-wrap:wrap; background:var(--bg-card); border:1px solid var(--line);
              border-radius:var(--radius); padding:12px 16px; margin-bottom:12px; flex:0 0 auto; }
.ux-toolbar .form-row { margin:0 !important; }
.ux-fold { background:var(--bg-card); border:1px solid var(--line); border-radius:var(--radius); margin-bottom:12px; flex:0 0 auto; }
.ux-fold > summary { list-style:none; cursor:pointer; padding:12px 16px; display:flex; gap:10px; align-items:baseline; flex-wrap:wrap; user-select:none; }
.ux-fold > summary::-webkit-details-marker { display:none; }
.ux-fold > summary::before { content:"▸"; color:var(--muted); font-size:11px; width:10px; }
.ux-fold[open] > summary::before { content:"▾"; }
.ux-fold[open] > summary { border-bottom:1px solid var(--line-soft); }
.ux-fold > summary .ttl { font-weight:600; color:var(--text-strong); font-size:14px; }
.ux-fold > summary .hint { font-size:12.5px; color:var(--muted); flex:1 1 320px; line-height:1.5; }
.ux-fold > summary .right { margin-left:auto; }
.ux-fold > summary:hover .ttl { text-decoration:underline; text-underline-offset:3px; }
.ux-steps { display:flex; gap:0; flex-wrap:wrap; font-size:12.5px; color:var(--muted); margin:-4px 0 16px; flex:0 0 auto; }
.ux-steps span { display:inline-flex; align-items:center; gap:6px; }
.ux-steps span + span::before { content:"→"; margin:0 10px; color:var(--faint); }
.ux-steps b { color:var(--text); font-weight:600; }
.ux-steps i { font-style:normal; font-family:var(--mono); font-size:11px; border:1px solid var(--line); border-radius:50%;
              width:18px; height:18px; display:inline-flex; align-items:center; justify-content:center; }
.ux-pre { white-space:pre-wrap; font-size:12.5px; line-height:1.6; margin:0; font-family:var(--mono); color:var(--text);
          background:var(--bg-card-2); border:1px solid var(--line-soft); border-radius:8px; padding:12px 14px; overflow:auto; }
/* panel heads on the redesigned pages: the title never breaks, the hint takes
   the room that is left and wraps inside it */
.ux-page .panel-head { flex-wrap:wrap; row-gap:4px; }
.ux-page .panel-title { white-space:nowrap; }
.ux-page .panel-head .panel-hint { flex:1 1 300px; min-width:0; line-height:1.5; }

/* round 65ff: the price steps — tick any of Shopify / sheet / pharmacy, Run */
.ps-form { margin:0; }
.ps-chips { display:inline-flex; gap:6px; flex-wrap:wrap; align-items:center; }
.ps-chip { display:inline-flex; align-items:center; gap:5px; border:1px solid var(--line); border-radius:14px; padding:2px 10px 2px 7px;
           font-size:12px; cursor:pointer; background:var(--bg-card); color:var(--text); white-space:nowrap; user-select:none; }
.ps-chip:hover { background:var(--bg-hover); }
.ps-chip input { margin:0; }
.ps-chip:has(input:checked) { border-color:var(--accent); background:var(--bg-active); color:var(--text-strong); }
.ps-chip.locked { cursor:default; }
.ps-chip.st-done { border-color:transparent; background:var(--green-bg); color:var(--green); }
.ps-chip.st-na, .ps-chip.st-skip { border-color:transparent; background:var(--bg-card-2); color:var(--muted); }
.ps-chip.st-failed { border-color:var(--red); color:var(--red); }
.ps-chip .ps-ic { font-weight:700; }
.ps-chip .ps-s { font-size:10.5px; opacity:.8; }
.ps-fail { font-size:11.5px; color:var(--red); margin-top:4px; line-height:1.4; }
.ps-warn { font-size:11.5px; color:var(--amber); margin-top:4px; }
.ps-more { margin-top:3px; display:flex; gap:10px; flex-wrap:wrap; }
.ps-link { background:none; border:0; padding:0; font:inherit; font-size:11.5px; color:var(--muted); text-decoration:underline; cursor:pointer; }
.ps-link:hover { color:var(--text); }
.ps-bulk { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin:0; }
#naw-asks tr:has(+ tr.pz-steps) > td { border-bottom:0; }

/* 66h (Adaora, 2 Oct: "the filters here don't work" — Overview → Needs you):
   a filtered-out row got the hidden attribute, but .ov-item { display:grid }
   outranks the browser's own [hidden] rule, so nothing disappeared. One rule
   for the whole portal: hidden means hidden. */
[hidden] { display: none !important; }

/* 67h: SV / NEW tags after a product name — small, never wrapping the name */
.pill.ptag { font-size:10px; padding:1px 6px; letter-spacing:.04em; font-weight:700; vertical-align:1px; text-decoration:none; }

/* 68r: a bulk-action bar that appears only while rows are ticked (like
   Shopify's bulk actions) — Ordered lines and the UID register */
.bulk-bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; max-width: calc(100% - 32px);
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow), 0 8px 24px rgba(0,0,0,.18); padding: 8px 12px; margin: 0; }
.bulk-bar[hidden] { display: none; }
.bulk-bar input { width: 120px; }
.bulk-bar input[name=reason] { width: 200px; }
.fk-own { font-weight: 700; color: var(--text-strong); }

/* 68z (Adaora, 7 Oct: "i can't scroll to view it in full"): the hover card
   is placed by app.js in the viewport (fixed), below or above the price —
   whichever has room — and scrolls inside itself when taller than that. */
.comp-pop.comp-pop-fixed { position: fixed; right: auto; bottom: auto; overflow-y: auto;
  overscroll-behavior: contain; }

/* 68ae (Adaora, 7 Oct: "csv download button too on many pages … a very
   small button"): placed by app.js above every table marked data-csv */
.csv-btn { font: 600 10px/1 var(--sans); letter-spacing: .06em; color: var(--muted);
  background: transparent; border: 1px solid var(--line); border-radius: 5px;
  padding: 3px 6px; cursor: pointer; }
.csv-row { display: flex; justify-content: flex-end; margin: 0 0 4px; }
.csv-btn.csv-in-head { margin-left: auto; }
/* round 69b: on a line that already exists — level with its boxes */
.csv-btn.csv-inline { align-self: center; flex: 0 0 auto; }
form .csv-btn.csv-inline, .form-row .csv-btn.csv-inline, .ux-toolbar .csv-btn.csv-inline { align-self: flex-end; margin-bottom: 9px; }
.flex > .csv-btn.csv-inline { margin-bottom: 0; align-self: center; }
.csv-btn.csv-push { margin-left: auto; }
.title-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.title-line > h1 { margin-right: auto; }
.title-actions { display: flex; gap: 8px; align-items: center; }
.csv-btn:hover { color: var(--text-strong); border-color: var(--muted); }
.cell-sub.sv-off { color: #8a5a00; background: #fff4d6; border-radius: 4px; padding: 0 4px; font-weight: bold; }
