/* Trainssy UI: admin + member cabinet. Light theme only, brand = trainssy.com.ua (Montserrat, ink #212020,
   white, sale red-orange), but calmer surfaces and denser data.
   Two layouts, one markup. Desktop: side menu + tables. Phone (<= 900px, the block "phone" below): an app shell —
   top bar with the page's back link, tab bar at the bottom, the rest of the menu as a sheet ("Ще"), lists as
   compact cards (table.rows / table.cards), sticky action bar for the main button, safe areas of the notch and
   the home indicator, 44px touch targets. */
:root {
  --ink: #212020; --ink-2: #4b4949; --muted: #7c7a78; --faint: #a9a7a4;
  --bg: #f3f3f1; --surface: #fff; --surface-2: #fafaf8; --hover: #f6f6f3;
  --line: #e4e3df; --line-2: #efeeeb; --field: #d6d4cf;
  --sale: #e8401c; --sale-bg: #fdece7;
  --ok: #1b8a4c; --ok-bg: #e7f4ec; --warn: #a76200; --warn-bg: #fff2dc;
  --err: #d2301e; --err-bg: #fdebe8; --info: #2453c4; --info-bg: #ecf1fc;
  --focus: 0 0 0 3px rgba(33, 32, 32, .14);
  --r: 4px; --r-lg: 8px;
  --shadow: 0 1px 2px rgba(20, 18, 16, .05);
  --shadow-lg: 0 12px 40px rgba(20, 18, 16, .18);
  --font: Montserrat, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
  --side-w: 236px; --top-h: 56px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; -webkit-tap-highlight-color: transparent; }
a, button, summary, label, input, select, textarea { touch-action: manipulation; }
html, body { margin: 0; }
body { font: 13px/1.5 var(--font); color: var(--ink); background: var(--bg); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; }
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--ink); }
img { max-width: 100%; }
h1 { font-size: 22px; line-height: 1.25; margin: 0; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 700; }
h3 { font-size: 11px; margin: 0 0 8px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
code, .mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hide { display: none !important; }
.m-only { display: none; }
s { color: var(--faint); }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 15px; height: 15px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.side { background: var(--surface); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; padding: 18px 12px 12px; overflow-y: auto; z-index: 40; }
.brand { display: flex; align-items: baseline; gap: 8px; padding: 2px 10px 20px; text-decoration: none; }
.brand img { height: 20px; width: auto; display: block; }
.brand span { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--r); color: var(--ink-2);
  text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--hover); color: var(--ink); }
.nav a.on { background: var(--ink); color: #fff; }
.nav a .count { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--sale); color: #fff; border-radius: 9px; padding: 0 7px; line-height: 18px; }
.nav a.on .count { background: #fff; color: var(--ink); }
.nav .sep { height: 1px; background: var(--line-2); margin: 8px 10px; }
.who { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 10px 4px; border-top: 1px solid var(--line-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 12px; flex: none; text-transform: uppercase; }
.who .name { min-width: 0; line-height: 1.3; }
.who .name b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .name span { font-size: 11px; color: var(--muted); }
.who form { margin-left: auto; }
.iconbtn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: var(--r); background: none;
  color: inherit; cursor: pointer; padding: 0; }
.iconbtn:hover { background: var(--hover); }
.topbar { display: none; }
.scrim { display: none; }
.tabbar { display: none; }
.actionbar { display: none; }
.main { padding: 24px 32px 56px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: 12px; margin: 0 0 8px; }
.crumbs a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.crumbs a:hover { color: var(--ink); }
.count-pill { display: inline-block; vertical-align: middle; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 0 9px; margin-left: 6px; line-height: 22px; letter-spacing: 0; }

/* ---------- layout helpers ---------- */
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.stack-y > * + * { margin-top: 16px; }
.row { display: flex; gap: 8px 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.panel.flush { padding: 0; overflow: hidden; }
.panel.sel { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px;
  box-shadow: var(--shadow); display: block; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
a.stat:hover { border-color: var(--ink); }
.stat b { display: block; white-space: nowrap; font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.stat b small { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat span { color: var(--muted); font-size: 12px; }
.stat.alert b { color: var(--sale); }
.stat .icon { position: absolute; top: 14px; right: 14px; color: var(--faint); }

/* ---------- tables ---------- */
table { border-collapse: collapse; width: 100%; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: middle; }
th { font-weight: 700; color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; background: var(--surface-2);
  position: sticky; top: 0; z-index: 1; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td, table tr:hover td { background: var(--hover); }
tr.head:hover td { background: none; }
td.num, th.num { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); }
.panel .table-wrap { box-shadow: none; }
tr.off td { color: var(--faint); }
tr.off td a { color: var(--muted); }
tr.best td { background: var(--ok-bg) !important; }
tr.group td { background: var(--surface-2); font-weight: 600; border-top: 1px solid var(--line); }
.vprices { float: right; display: inline-flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; font-weight: 500; }
.vprices b { font-weight: 700; }
.sub-price { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
tr[data-href] { cursor: pointer; }
td.indent { padding-left: 26px; }
.cell-main { font-weight: 700; text-decoration: none; }
.cell-main:hover { text-decoration: underline; }
.mini-table th, .mini-table td { padding: 6px 8px; }

/* ---------- badges ---------- */
.b { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 3px; font-size: 11px; font-weight: 600; line-height: 16px;
  background: var(--line-2); color: var(--ink-2); white-space: nowrap; vertical-align: middle; }
.b.ok { background: var(--ok-bg); color: var(--ok); }
.b.warn { background: var(--warn-bg); color: var(--warn); }
.b.err { background: var(--err-bg); color: var(--err); }
.b.info { background: var(--info-bg); color: var(--info); }
.b.accent, .b.sale { background: var(--sale); color: #fff; }
.b.ink { background: var(--ink); color: #fff; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); vertical-align: 1px; margin-right: 6px; }
.dot.ok { background: var(--ok); } .dot.warn { background: #e39a1b; } .dot.err { background: var(--err); } .dot.info { background: var(--info); }

/* ---------- forms ---------- */
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search], input[type=tel], select, textarea {
  font: inherit; font-size: 13px; border: 1px solid var(--field); border-radius: var(--r); padding: 0 10px; height: 36px; background: #fff;
  color: inherit; max-width: 100%; transition: border-color .15s, box-shadow .15s; }
select { padding-right: 30px; appearance: none; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23212020' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center; }
textarea { width: 100%; min-height: 80px; resize: vertical; padding: 8px 10px; height: auto; line-height: 1.5; }
textarea.tall { min-height: 180px; }
input:hover, select:hover, textarea:hover { border-color: #bdbab4; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible, button:focus-visible { outline: none; border-color: var(--ink); box-shadow: var(--focus); }
input[type=file] { font: inherit; font-size: 12px; max-width: 100%; }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; border: 1px solid var(--field); background: #fff; border-radius: var(--r);
  padding: 7px 12px; margin-right: 10px; cursor: pointer; }
input[type=checkbox], input[type=radio] { accent-color: var(--ink); }
input[type=checkbox] { width: 15px; height: 15px; }
label.f { display: block; margin-bottom: 14px; }
label.f > span, .f > .label { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--ink-2); font-size: 12px;
  font-weight: 600; margin-bottom: 5px; }
label.f input[type=text], label.f input[type=email], label.f input[type=password], label.f input[type=url], label.f input[type=tel], label.f select { width: 100%; }
.hint { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
label.f em.hint, label.f .err-text { display: block; font-style: normal; }
label.f .err-text { font-size: 12px; color: var(--err); margin-top: 4px; font-weight: 500; }
label.f.has-err input, label.f.has-err select { border-color: var(--err); background: #fffafa; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linkbtn:hover { color: var(--sale); }
.linkbtn:disabled { color: var(--muted); text-decoration: none; cursor: default; }
input.code-input { font-size: 22px !important; letter-spacing: .4em; font-weight: 700; text-align: center; }
.auth-aside { text-align: right; margin: -6px 0 12px; font-size: 13px; }
.auth-aside a { color: var(--ink-2); }
.auth-switch { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.auth-switch a { color: var(--ink); font-weight: 600; }
.auth-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; margin-bottom: 18px; }
.auth-icon .icon { width: 24px; height: 24px; }
.auth-form .auth-switch .btn, .auth-form .linkbtn { width: auto; height: auto; margin: 0; font-size: 13px; }
.shell.no-side { grid-template-columns: minmax(0, 1fr); }
.settings .panel { align-self: start; }
.settings .btn { margin-top: 4px; }
.sessions { display: grid; gap: 8px; }
.sess { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r); }
.sess.cur { border-color: var(--ink); }
.sess-main { min-width: 0; }
.sess-main .small { overflow-wrap: anywhere; }
.sess .btn { margin: 0; }
/* ---------- dropper cabinet ---------- */
.seg { display: inline-flex; border: 1px solid var(--ink); border-radius: 18px; padding: 2px; gap: 2px; background: var(--surface); }
.seg button { font: inherit; font-size: 12px; font-weight: 700; border: 0; background: none; color: var(--ink); height: 30px;
  padding: 0 14px; border-radius: 15px; cursor: pointer; text-transform: uppercase; letter-spacing: .03em; }
.seg button.on { background: var(--ink); color: #fff; cursor: default; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.pcard { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden; color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.pcard:hover { border-color: var(--ink); box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.pcard .ph { aspect-ratio: 1; background: #f4f3f1; display: flex; align-items: center; justify-content: center; position: relative; }
.pcard .ph img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.pcard .ph .b { position: absolute; top: 8px; left: 8px; }
.pcard .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.pcard .pb { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .04em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .name { font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard .code { font-size: 11px; color: var(--muted); }
.pcard .price { margin-top: auto; padding-top: 6px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pcard .price b { font-size: 16px; }
.pcard .price span { font-size: 11px; color: var(--muted); }
.pcard .sizes { font-size: 11px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
[data-cart-count][hidden] { display: none; }
.prod { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.gal-main { aspect-ratio: 1; background: #f4f3f1; border-radius: var(--r); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.gal-view { position: relative; }
.gal-track { display: flex; aspect-ratio: 1; background: #f4f3f1; border-radius: var(--r); overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.gal-track::-webkit-scrollbar { display: none; }
.gal-slide { flex: 0 0 100%; scroll-snap-align: center; scroll-snap-stop: always; display: flex; align-items: center; justify-content: center; cursor: zoom-in; }
.gal-slide img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.gal-count { position: absolute; right: 10px; bottom: 10px; background: rgba(33, 32, 32, .72); color: #fff; font-size: 11px; font-weight: 600;
  border-radius: 10px; padding: 2px 9px; pointer-events: none; }
.gal-thumbs { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; padding-bottom: 4px; }
.gal-thumbs button { flex: 0 0 64px; height: 64px; border: 1px solid var(--line); border-radius: var(--r); background: #f4f3f1; padding: 0; cursor: pointer; }
.gal-thumbs button.on { border-color: var(--ink); }
.gal-thumbs img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.size-list { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
[data-incart][hidden] { display: none; }
.size-head, .size-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 8px 12px; margin: 0; }
.size-head { background: var(--surface-2); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.size-row { border-top: 1px solid var(--line-2); }
.size-row .sz b { display: block; font-size: 15px; line-height: 1.25; }
.size-row .sz small, .size-row .pr small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.size-row .pr b { font-size: 14px; white-space: nowrap; }
.size-row .pr .b { margin-top: 3px; }
.size-row .add { padding: 0 12px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--r); height: 32px; }
.qty button { width: 28px; height: 30px; border: 0; background: none; cursor: pointer; color: var(--ink); display: flex; align-items: center; justify-content: center; }
.qty input { width: 38px; height: 30px; border: 0; text-align: center; padding: 0; font-weight: 600; -moz-appearance: textfield; }
.qty input::-webkit-inner-spin-button { -webkit-appearance: none; }
.qty button:disabled { color: var(--faint); cursor: default; }
.cart-line { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto auto auto; gap: 14px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.cart-line:last-child { border-bottom: 0; }
.cart-line img, .cart-line .noimg { width: 64px; height: 64px; object-fit: contain; background: #f4f3f1; border-radius: var(--r); mix-blend-mode: multiply; }
.cart-line .sum { font-weight: 700; min-width: 80px; text-align: right; }
.cart-line.gone { opacity: .6; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; font-size: 13px; }
.totals .big { font-size: 18px; font-weight: 800; }
.checkout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.checkout .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.checkout .row3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 0 12px; }
.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.radio-cards label { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; cursor: pointer; font-weight: 600; font-size: 13px; }
.radio-cards label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.ac { position: relative; }
.ac-list { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin-top: 2px; background: var(--surface); border: 1px solid var(--ink);
  border-radius: var(--r); max-height: 280px; overflow-y: auto; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.ac-list button { display: block; width: 100%; text-align: left; font: inherit; font-size: 13px; padding: 8px 12px; border: 0; background: none; cursor: pointer; }
.ac-list button:hover, .ac-list button.act { background: var(--hover); }
.ac-list button small { color: var(--muted); display: block; font-size: 11px; }
.ac-list .empty-ac { padding: 10px 12px; font-size: 12px; color: var(--muted); }
.checkbox { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; margin: 4px 0 14px; cursor: pointer; }
.checkbox input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--ink); }
.money-pos { color: var(--err); font-weight: 700; }
.money-neg { color: var(--ok); font-weight: 700; }
.feed-url { display: flex; gap: 6px; align-items: center; }
.feed-url input { flex: 1; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
details.more-box { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
details.more-box summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.lock { font-size: 11px; color: var(--muted); cursor: pointer; user-select: none; font-weight: 500; display: inline-flex; align-items: center; gap: 5px; }
.lock input { width: 13px; height: 13px; margin: 0; }
.lock.on { color: var(--warn); font-weight: 700; }
.btn { font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px;
  border: 1px solid var(--field); background: #fff; color: var(--ink); padding: 0 14px; border-radius: var(--r); cursor: pointer;
  white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s, color .15s; }
.btn:hover { background: var(--hover); border-color: #bdbab4; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #000; }
.btn.sale { background: var(--sale); border-color: var(--sale); color: #fff; }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--hover); }
.btn.small { height: 30px; padding: 0 10px; font-size: 12px; }
.btn.danger { color: var(--err); }
.btn.danger:hover { background: var(--err-bg); border-color: #f0b9b0; }
.btn:disabled, .btn.busy { opacity: .5; cursor: not-allowed; }
.btn.busy::after { content: ""; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
form.inline { display: inline; }
td.actions .btn { vertical-align: middle; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters .search { position: relative; flex: 1 1 260px; max-width: 360px; }
.filters .search .icon { position: absolute; left: 10px; top: 9px; color: var(--muted); pointer-events: none; }
.filters .search input { width: 100%; padding-left: 34px; }
.filters .more { display: contents; }
.filters .toggle { display: none; }
.filters select { max-width: 230px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 1px solid var(--line); border-radius: 15px;
  background: var(--surface); text-decoration: none; font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip b { font-weight: 700; }
nav.chips { margin-bottom: 14px; }
dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; margin: 0; font-size: 13px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.panel.callout { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  border-left: 3px solid var(--sale); margin-bottom: 16px; }
.panel.callout h2 { margin-bottom: 4px; }
.grid > div > .panel + .panel { margin-top: 16px; }

/* ---------- notes, flash, toast ---------- */
.note { padding: 11px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--info);
  margin-bottom: 16px; color: var(--ink-2); }
.note.warn { border-left-color: #e39a1b; background: #fffaf0; }
.note.err { border-left-color: var(--err); background: #fff7f6; }
.note.ok { border-left-color: var(--ok); }
.toasts { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--ink); color: #fff; padding: 12px 14px; border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); animation: toast-in .25s ease-out; font-weight: 500; }
.toast .icon { margin-top: 1px; color: #7ad19c; }
.toast.error { background: var(--err); }
.toast.error .icon { color: #fff; }
.toast button { margin-left: auto; background: none; border: 0; color: inherit; opacity: .7; cursor: pointer; padding: 0 0 0 6px; font-size: 18px; line-height: 1; }
.toast.out { animation: toast-out .2s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px); } }

/* ---------- pager ---------- */
.pager { display: flex; gap: 4px; align-items: center; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.pager a, .pager span.cur, .pager span.gap { min-width: 34px; height: 34px; padding: 0 8px; display: inline-grid; place-items: center;
  border-radius: var(--r); text-decoration: none; font-weight: 600; font-size: 12px; }
.pager a { border: 1px solid var(--line); background: var(--surface); }
.pager a:hover { border-color: var(--ink); }
.pager span.cur { background: var(--ink); color: #fff; }
.pager span.gap { color: var(--faint); min-width: 16px; }
.pager .total { width: 100%; text-align: center; color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ---------- photos ---------- */
.thumb { width: 48px; height: 48px; object-fit: contain; background: #fff; border: 1px solid var(--line-2); border-radius: var(--r); display: block; }
.thumb.big { width: 88px; height: 88px; }
.thumb.none { display: grid; place-items: center; color: var(--faint); background: var(--surface-2); }
.photos { display: flex; flex-wrap: wrap; gap: 10px; }
.ph { position: relative; width: 116px; }
.ph img { width: 116px; height: 116px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: var(--r); display: block; }
.ph.in img { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok); }
.ph .meta { font-size: 10.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 4px; margin-top: 3px; }
.ph .meta span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph .act { position: absolute; top: 5px; right: 5px; display: flex; gap: 4px; }
.ph .act button { border: 0; border-radius: var(--r); background: rgba(33, 32, 32, .82); color: #fff; width: 26px; height: 26px; cursor: pointer;
  font-size: 15px; line-height: 26px; padding: 0; font-weight: 600; }
.ph .act button:hover { background: var(--sale); }
.ph .n { position: absolute; top: 5px; left: 5px; background: var(--ink); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 3px; padding: 1px 6px; }
.gallery-drop { min-height: 140px; padding: 10px; border: 1.5px dashed var(--field); border-radius: var(--r-lg); background: var(--surface-2); }
.gallery-drop .ph { cursor: grab; }
.sortable-ghost { opacity: .35; }
.group { border-top: 1px solid var(--line-2); padding-top: 14px; margin-top: 14px; }
details > summary { cursor: pointer; color: var(--ink-2); font-weight: 600; }
pre { white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r); padding: 10px;
  font: 12px/1.45 var(--mono); margin: 8px 0 0; max-height: 320px; overflow: auto; }

/* lightbox */
.lb { position: fixed; inset: 0; z-index: 300; background: rgba(18, 17, 16, .94); display: flex; align-items: center; justify-content: center;
  touch-action: pan-y pinch-zoom; animation: fade .15s; }
.lb img { max-width: calc(100vw - 120px); max-height: calc(100vh - 100px); max-height: calc(100dvh - 100px); object-fit: contain; background: #fff;
  border-radius: var(--r); user-select: none; }
.lb button { position: absolute; background: rgba(255, 255, 255, .1); border: 0; color: #fff; width: 48px; height: 48px; border-radius: 50%;
  cursor: pointer; display: grid; place-items: center; }
.lb button:hover { background: rgba(255, 255, 255, .22); }
.lb .close { top: 14px; right: 14px; }
.lb .prev { left: 16px; } .lb .next { right: 16px; }
.lb .cap { position: absolute; bottom: 16px; left: 0; right: 0; text-align: center; color: #ddd; font-size: 12px; }
.lb .cap a { color: #fff; }
@keyframes fade { from { opacity: 0; } }

/* ---------- login ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); background: var(--surface); }
.auth-hero { background: var(--ink); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-hero img { height: 30px; width: auto; align-self: flex-start; }
.auth-hero h2 { font-size: 40px; line-height: 1.05; font-weight: 800; text-transform: uppercase; letter-spacing: -.02em; margin: 0 0 14px; }
.auth-hero h2 em { font-style: normal; color: var(--sale); }
.auth-hero p { color: #b9b6b2; max-width: 380px; margin: 0; }
.auth-hero::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border: 60px solid rgba(255, 255, 255, .04); border-radius: 50%; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-form .box { width: 100%; max-width: 360px; }
.auth-form h1 { font-size: 26px; margin-bottom: 6px; }
.auth-form .lead { color: var(--muted); margin: 0 0 24px; }
.auth-form input { width: 100%; height: 44px; font-size: 14px; }
.auth-form .btn { width: 100%; height: 46px; font-size: 14px; margin-top: 6px; }
.auth-logo-m { display: none; }

/* ---------- merge ---------- */
.mcard { min-width: 0; }
.mthumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; }
.pair > .mcard { border: 1px solid var(--line-2); border-radius: var(--r); padding: 12px; background: var(--surface-2); }

/* ---------- product page ---------- */
.section-nav { display: flex; gap: 6px; overflow-x: auto; margin: -4px 0 16px; padding-bottom: 2px; scrollbar-width: none; }
.section-nav::-webkit-scrollbar { display: none; }
.price { font-weight: 700; white-space: nowrap; }
.params-table td { padding: 4px; border: 0; }
.params-table input { width: 100%; }
.savebar { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--surface) 30%); padding: 14px 0 2px; margin-top: 6px; }

/* ---------- phone ---------- */
@media (max-width: 900px) {
  :root { --top-h: 52px; --tab-h: 58px; --r: 8px; --r-lg: 14px;
    --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
    --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px); }
  body { font-size: 14px; }
  .m-only { display: inline; }
  .d-only { display: none !important; }

  /* shell: top bar, tab bar, menu sheet */
  .shell { display: block; min-height: 0; }
  .topbar { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 50; height: calc(var(--top-h) + var(--sat));
    padding: var(--sat) calc(14px + var(--sar)) 0 calc(14px + var(--sal)); background: var(--ink); color: #fff; }
  .topbar .logo { display: flex; align-items: center; height: 100%; }
  .topbar .logo img { height: 17px; width: auto; display: block; }
  .topbar .title { display: none; font-weight: 600; font-size: 14px; margin-left: auto; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; max-width: 52vw; opacity: .8; }
  /* a page with a back link: the link sits in the top bar, the page title next to it */
  body:has(.crumbs) .topbar .logo { display: none; }
  body:has(.crumbs) .topbar .title { display: block; }
  .crumbs { position: fixed; top: var(--sat); left: var(--sal); z-index: 51; height: var(--top-h); margin: 0; display: flex; }
  .crumbs a, .crumbs a:hover { color: #fff; font-size: 15px; font-weight: 600; height: 100%; padding: 0 14px 0 6px; gap: 0; max-width: 44vw; }
  .crumbs a .icon { width: 24px; height: 24px; }
  body:has(.tabbar) { padding-bottom: calc(var(--tab-h) + var(--sab)); }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    height: calc(var(--tab-h) + var(--sab)); padding: 0 var(--sar) var(--sab) var(--sal); background: rgba(255, 255, 255, .94);
    -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: 0; background: none; font: inherit; font-size: 10.5px; font-weight: 600; color: var(--muted); text-decoration: none; padding: 0 2px;
    min-width: 0; cursor: pointer; box-shadow: none; }
  .tabbar .icon { width: 23px; height: 23px; }
  .tabbar span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar .on { color: var(--ink); }
  .tabbar .on .icon { stroke-width: 2.3; }
  .tabbar a:active, .tabbar button:active { opacity: .55; }
  .tab-n { position: absolute; top: 6px; left: calc(50% + 5px); min-width: 17px; height: 17px; border-radius: 9px; background: var(--sale);
    color: #fff; font-size: 10px; font-weight: 700; line-height: 17px; text-align: center; padding: 0 4px; }
  .tab-n[hidden] { display: none; }
  .side { position: fixed; left: 0; right: 0; top: auto; bottom: 0; width: auto; height: auto; max-height: 88vh; max-height: 88dvh;
    transform: translateY(105%); transition: transform .24s cubic-bezier(.2, .8, .2, 1); box-shadow: var(--shadow-lg); border-right: 0;
    border-radius: 18px 18px 0 0; padding: 8px calc(12px + var(--sar)) calc(12px + var(--sab)) calc(12px + var(--sal)); z-index: 60;
    overscroll-behavior: contain; }
  .side::before { content: ""; flex: none; width: 38px; height: 4px; border-radius: 2px; background: var(--field); margin: 0 auto 8px; }
  .side .brand, .side .nav .sep, .side .nav a.in-tabs { display: none; }
  body.nav-open .side { transform: none; }
  body.nav-open { overflow: hidden; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(18, 17, 16, .45); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .nav a { padding: 13px 12px; font-size: 15px; border-radius: 10px; }
  .who { margin-top: 8px; padding: 12px 10px 2px; }
  .main { padding: 14px calc(12px + var(--sar)) 28px calc(12px + var(--sal)); }
  html { scroll-padding-top: calc(var(--top-h) + var(--sat) + 12px); }
  .toasts { top: calc(var(--top-h) + var(--sat) + 8px); bottom: auto; left: 12px; right: 12px; max-width: none; }

  /* the main button of a page: a bar above the tab bar */
  .actionbar { display: flex; align-items: center; gap: 14px; position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--sab)); z-index: 45;
    padding: 10px calc(12px + var(--sar)) 10px calc(14px + var(--sal)); background: rgba(255, 255, 255, .96);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
  .actionbar .sum { display: flex; flex-direction: column; line-height: 1.2; flex: none; }
  .actionbar .sum small { color: var(--muted); font-size: 11px; }
  .actionbar .sum b { font-size: 18px; font-weight: 800; white-space: nowrap; }
  .actionbar .btn { flex: 1; height: 48px; font-size: 15px; min-width: 0; }
  body:has(.actionbar) .main { padding-bottom: 96px; }

  /* type, panels, controls: sizes for a finger */
  h1 { font-size: 21px; }
  .page-head { margin-bottom: 12px; gap: 10px; }
  .page-head .actions { width: 100%; }
  .page-head .actions > .btn { flex: 1; }
  .cols-2, .pair { grid-template-columns: minmax(0, 1fr); }
  .grid { gap: 12px; }
  .panel { padding: 14px; }
  .panel + .panel, .grid > div > .panel + .panel { margin-top: 12px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
  .stat { padding: 12px; }
  .stat b { font-size: 20px; }
  .stat .icon { display: none; }
  /* 16px stops iOS from zooming into fields */
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search], input[type=tel], select, textarea { font-size: 16px; height: 46px; }
  textarea { height: auto; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; flex: none; }
  .checkbox input { width: 20px; height: 20px; margin-top: 0; }
  .btn { height: 46px; padding: 0 16px; }
  .btn.small { height: 38px; padding: 0 12px; font-size: 13px; }
  .btn:active, .chip:active, .pcard:active, .stat:active, .iconbtn:active { opacity: .6; }
  .iconbtn { width: 44px; height: 44px; }
  .linkbtn { padding: 6px 0; }
  .seg { display: flex; width: 100%; border-radius: 12px; }
  .seg button { flex: 1; height: 38px; border-radius: 9px; font-size: 12.5px; }
  .chip { height: 36px; padding: 0 14px; border-radius: 18px; font-size: 13px; flex: none; }
  nav.chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px 10px; padding: 0 12px 2px; scrollbar-width: none; overscroll-behavior-x: contain; }
  nav.chips::-webkit-scrollbar { display: none; }
  details > summary { padding: 6px 0; }
  .pager a, .pager span.cur { min-width: 42px; height: 42px; font-size: 14px; }
  .pager { gap: 6px; }
  .qty { height: 42px; }
  .qty button { width: 40px; height: 40px; }
  .qty input, .qty input[type=number] { width: 38px; height: 40px; font-size: 16px; padding: 0; }
  dl.kv { gap: 6px 14px; }
  .ac-list { max-height: 240px; }
  .ac-list button { padding: 12px; font-size: 15px; border-bottom: 1px solid var(--line-2); }
  .radio-cards label { padding: 13px 12px; }
  .sess { align-items: flex-start; }
  .feed-url { flex-wrap: wrap; }
  .feed-url input { flex: 1 1 100%; }
  .feed-url .btn { flex: 1; }

  /* search + filters stay under the top bar */
  .filters { position: sticky; top: calc(var(--top-h) + var(--sat)); z-index: 30; background: var(--bg); margin: 0 -12px 8px; padding: 8px 12px; gap: 8px; }
  .filters .search { max-width: none; flex: 1 1 0; }
  .filters .search .icon { top: 14px; }
  .filters .toggle { display: inline-flex; }
  .filters .more { display: none; }
  .filters.open .more { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; width: 100%; }
  .filters.open .more select { max-width: none; width: 100%; }

  /* dropper cabinet */
  .prod, .checkout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .pcard { border-radius: 12px; }
  .pcard .body { padding: 8px 10px 10px; gap: 2px; }
  .pcard .name { font-size: 13px; }
  .pcard .price { padding-top: 4px; gap: 2px 8px; }
  .pcard .price b { font-size: 15px; }
  .gal-view { margin: -14px calc(-12px - var(--sar)) 0 calc(-12px - var(--sal)); }
  .gal-track { border-radius: 0; }
  .gal-thumbs { display: none; }
  .size-head { display: none; }
  .size-head + .size-row { border-top: 0; }
  .size-head, .size-row { grid-template-columns: 58px minmax(0, 1fr) auto auto; gap: 8px; padding: 8px 10px; }
  .size-row .add { width: 46px; padding: 0; }
  .size-row .add span { display: none; }
  .size-row .add .icon { width: 18px; height: 18px; }
  .cart-line { grid-template-columns: 60px minmax(0, 1fr) auto; gap: 8px 12px; }
  .cart-line img, .cart-line .noimg { width: 60px; height: 60px; }
  .cart-line .unit { display: none; }
  .cart-line .qty-cell { grid-column: 2; }
  .cart-line .sum { grid-column: 3; grid-row: 1; align-self: start; min-width: 0; }
  .cart-line .del { grid-column: 3; grid-row: 2; justify-self: end; }
  .checkout .row2 { grid-template-columns: minmax(0, 1fr); }
  .checkout .row3 { grid-template-columns: 1fr 1fr; }
  .checkout .row3 > :first-child { grid-column: 1 / -1; }
  .radio-cards { grid-template-columns: 1fr; }

  /* admin bits */
  .photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .ph, .ph img { width: 100%; height: auto; }
  .ph img { aspect-ratio: 1; }
  .ph .act button { width: 32px; height: 32px; line-height: 32px; }
  .lb img { max-width: 100vw; max-height: calc(100vh - 120px); max-height: calc(100dvh - 120px); border-radius: 0; }
  .lb .prev, .lb .next { display: none; }
  .lb .close { top: calc(10px + var(--sat)); right: 10px; }
  .lb .cap { bottom: calc(16px + var(--sab)); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-hero { display: none; }
  .auth-logo-m { display: block; height: 22px; width: auto; margin-bottom: 28px; }
  .auth-form { align-items: flex-start; padding: calc(9vh + var(--sat)) 20px calc(24px + var(--sab)); }
  .auth-form input { height: 50px; font-size: 16px; }
  .auth-form .btn { height: 52px; font-size: 16px; }

  /* lists as cards: table.rows — the cells say what they are (r-title, r-side, r-line, r-kv); ui.js gives every
     cell its header text in data-label */
  table.rows, table.rows tbody { display: block; width: 100%; }
  table.rows tr.head { display: none; }
  table.rows tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
  table.rows tr:last-child { border-bottom: 0; }
  table.rows tr[data-href]:active { background: var(--hover); }
  table.rows td { display: block; border: 0; padding: 0; text-align: left; min-width: 0; overflow-wrap: anywhere; order: 5; }
  table.rows td:empty, table.rows td.r-hide { display: none; }
  table.rows td.r-title { order: 1; font-size: 15px; font-weight: 700; }
  table.rows td.r-title a { text-decoration: none; }
  table.rows td.r-sub { order: 2; color: var(--muted); font-size: 12.5px; flex: 1 1 0; white-space: nowrap; }
  table.rows td.r-side { order: 3; margin-left: auto; text-align: right; flex: none; max-width: 60%; }
  table.rows td.r-line { order: 4; flex: 0 0 100%; font-size: 13px; }
  table.rows td.r-kv { order: 6; font-size: 13px; white-space: nowrap; }
  table.rows td.r-kv::before { content: attr(data-label) " "; color: var(--muted); font-size: 12px; }
  table.rows td.r-kv.r-last { margin-left: auto; }
  table.rows td br { display: none; }
  table.rows td div.small { display: inline; }
  table.rows td div.small::before { content: " · "; }
  table.rows td br + .muted::before { content: " · "; }
  table.rows tr:hover td { background: none; }
  table.rows td.r-side div.small { display: none; }
  /* line break after the first line (title, date, badge): the "label value" cells start a new one */
  table.rows:not(.dash) tr:not(.group):not(.head)::after { content: ""; order: 4; flex: 0 0 100%; height: 0; margin-top: -3px; }
  table.rows.offers td.r-last { order: 3; margin-left: 0; }
  table.rows.offers td.r-last::before { display: none; }
  table.rows.offers td.r-side { align-self: center; }
  table.rows tr.group { display: block; background: var(--surface-2); padding: 10px 14px; }
  table.rows tr.group td { display: block; }
  table.rows tr.best { background: var(--ok-bg); }
  table.rows tr.off { color: var(--faint); }
  table.rows .vprices { float: none; display: flex; margin-top: 4px; }
  table.rows td.r-title .sku { display: block; font-weight: 400; }
  table.rows td.r-title div.small { font-weight: 500; }
  table.rows td form.inline .btn { margin: 0; }
  /* suppliers: schedule form and buttons on the last line of the card */
  table.rows.sup td.r-line { order: 7; flex: 0 0 auto; margin-top: 6px; }
  table.rows.sup td.r-line.actions { margin-left: auto; }
  table.rows.sup td.r-line input[type=number] { width: 70px !important; }
  table.rows.dash tr.head { display: none; }
  /* dashboard lists: the first cell is the card title, the second sits next to it, the rest are "label value" lines */
  table.rows.dash tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; }
  table.rows.dash td { font-size: 13px; grid-column: 1 / -1; }
  table.rows.dash td.r-title { grid-column: 1; font-size: 15px; }
  table.rows.dash td:nth-child(2) { grid-column: 2; grid-row: 1; text-align: right; }
  table.rows.dash td:not(.r-title)::before { content: attr(data-label) " "; color: var(--muted); font-size: 12px; font-weight: 500; }

  /* tables become cards: ui.js sets data-label on every cell from the header row */
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr.head { display: none; }
  table.stack tr { padding: 10px 12px; border-bottom: 1px solid var(--line-2); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; min-height: 0; }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: none; font-weight: 500; }
  table.stack td:not([data-label])::before, table.stack td[data-label=""]::before { display: none; }
  table.stack td:not([data-label]), table.stack td[data-label=""] { text-align: left; }
  table.stack td { overflow-wrap: anywhere; }
  table.stack td.indent { padding-left: 0; }
  table.stack td[colspan] { display: block; text-align: left; }
  table.stack td.nowrap { white-space: normal; }
  table.stack td.lead { flex-wrap: wrap; gap: 4px 8px; align-items: baseline; white-space: normal;
  }
  table.stack td.lead { font-size: 15px; justify-content: flex-start; text-align: left; padding-bottom: 6px; }
  table.stack td.lead::before { display: none; }
  table.stack td:empty { display: none; }
  table.stack tr:hover td { background: none; }
  table.stack tr.group { background: var(--surface-2); }
  table.stack tr.group td { background: none; border: 0; }
  table.stack .vprices { float: none; display: flex; margin-top: 6px; }
  table.stack tr.best { background: var(--ok-bg); }
  table.stack td.m-hide { display: none; }
  table.stack td form.row { justify-content: flex-end; flex-wrap: nowrap; min-width: 0; }
  table.stack td form.row input { flex: 1 1 auto; min-width: 0; width: auto !important; }
  table.stack td.actions { justify-content: flex-end; flex-wrap: wrap; gap: 6px; padding-top: 8px; }

  /* catalog rows: photo + text card */
  table.cards tr { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; column-gap: 12px; row-gap: 2px; align-items: start; }
  table.cards td { display: block; text-align: left; padding: 0; }
  table.cards td::before { display: none; }
  table.cards td.c-thumb { grid-row: 1 / span 5; }
  table.cards td.c-thumb .thumb { width: 72px; height: 72px; }
  table.cards td.c-code { grid-column: 2; font-size: 14px; }
  table.cards td.c-price { grid-column: 3; grid-row: 1; text-align: right; font-weight: 700; }
  table.cards td.c-name { grid-column: 2 / 4; font-size: 13px; line-height: 1.35; }
  table.cards td.c-meta { grid-column: 2 / 4; font-size: 12px; color: var(--muted); }
  table.cards td.c-hide { display: none; }

  .m-later { order: 2; }
  .table-wrap { border-radius: var(--r-lg); }
  .params-table tr:first-child { display: none; }
  .params-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
  .params-table td:first-child { grid-column: 1 / 3; }
  .params-table td:nth-child(4) { grid-column: 3; grid-row: 1 / span 2; align-self: center; }
}
@media (max-width: 380px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
}
@media (hover: none) {
  tr:hover td { background: none; }
}

/* order TTNs (web/templates/_order_bits.html ttn_card) and the dashboard */
.ttn { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px 12px; margin-bottom: 10px; background: var(--surface); }
.ttn.wrong { background: var(--surface-2); color: var(--muted); }
.ttn.wrong b { color: var(--muted); }
.ttn-head { display: flex; gap: 8px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; margin-bottom: 2px; }
.ttn-more { margin-top: 8px; }
.ttn-more summary { font-size: 12px; }
.err-text { color: var(--err); font-weight: 600; }
label.check { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; cursor: pointer; }
.todo { display: grid; gap: 16px; }
.todo .panel h2 .count { font-size: 12px; font-weight: 700; color: var(--muted); margin-left: 6px; }
.todo .panel.hot { border-left: 3px solid var(--err); }
.todo table td { vertical-align: top; }
.alert-lines { white-space: pre-line; }
