/* GTM Hub — every colour, font and corner comes from theme tokens (see themes.js). */
:root {
  --bg: #f5f6f8; --surface: #fff; --ink: #1c2230; --muted: #586174; --line: #e3e6ec;
  --accent: #2f6fed; --accent-ink: #fff; --accent-text: #2558c7;
  --header: #1f2a44; --header-ink: #fff; --header-border: 0; --hero-bg: #1f2a44; --hero-ink: #fff; --nav-bg: #fff;
  --good: #1f7a45; --bad: #c8372d; --warn: #8a5a10;
  --font-body: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --font-head: var(--font-body);
  --head-weight: 800; --head-tracking: -0.01em; --radius: 12px; --scale: 1;
  --card-border: 1px solid var(--line); --card-shadow: none;
  --tab-active-bg: var(--header); --tab-active-ink: #fff; --tab-active-border: 1px solid var(--header);
  --sev-high: #fde8e6; --sev-high-ink: #a42a21; --sev-mid: #fbf0dc; --sev-mid-ink: #7a4f0e; --sev-low: #e8f0fd; --sev-low-ink: #1f4fb0;
  --soft: color-mix(in srgb, var(--ink) 6%, var(--surface));
  --accent-soft: color-mix(in srgb, var(--accent) 14%, var(--surface));
  --radius-sm: calc(var(--radius) * 0.66);
  --nav-w: 240px; --top-h: 56px;
  font-family: var(--font-body);
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; font-size: calc(15px * var(--scale)); line-height: 1.5; background: var(--bg); color: var(--ink); }
a { color: var(--accent-text); text-underline-offset: 2px; }
h1, h2, h3, .card-title { font-family: var(--font-head); letter-spacing: var(--head-tracking); }
h1 { font-size: 1.45em; font-weight: var(--head-weight); margin: 0 0 14px; line-height: 1.2; }
h2 { font-size: 1.1em; margin: 22px 0 10px; font-weight: 700; }
h3 { font-size: 1em; margin: 16px 0 8px; font-weight: 700; }
.card-title { font-size: 1em; margin: 0 0 10px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: .86em; }
.mt { margin-top: 10px; }
.empty { padding: 8px 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); color: var(--ink); padding: 10px 14px; border-radius: var(--radius-sm); }
.skip:focus { left: 8px; }

/* ---------- shell */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px;
  height: var(--top-h); padding: 0 12px; background: var(--header); color: var(--header-ink); border-bottom: var(--header-border); }
.topbar .brand { color: var(--header-ink); font-family: var(--font-head); font-weight: var(--head-weight); text-decoration: none; font-size: 1.1em;
  display: inline-flex; align-items: center; gap: 8px; }
.brand-logo { height: 28px; width: 28px; object-fit: contain; border-radius: 6px; }
.brand-logo.wide { width: auto; max-width: 180px; height: 22px; border-radius: 0; }
.brand.has-wordmark span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.login-logo { height: 56px; width: 56px; object-fit: contain; border-radius: 10px; display: block; margin-bottom: 8px; }
.login-logo.wide { width: auto; max-width: min(320px, 100%); height: 44px; border-radius: 0; margin-bottom: 14px; }
.topbar-right { margin-left: auto; font-size: .85em; opacity: .9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 50vw; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0;
  background: transparent; border: 0; color: inherit; border-radius: var(--radius-sm); cursor: pointer; }
.sidenav { position: fixed; top: var(--top-h); left: 0; bottom: 0; width: var(--nav-w); background: var(--nav-bg);
  border-right: 1px solid var(--line); padding: 8px 0 24px; z-index: 25; overflow-y: auto; }
.sidenav a { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 16px; color: var(--ink); text-decoration: none; position: relative; }
.sidenav a svg { flex: 0 0 auto; color: var(--muted); }
.sidenav .nav-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sidenav .nav-text b { font-weight: 600; }
.sidenav .nav-text small { color: var(--muted); font-size: .78em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidenav a .pill { margin-left: auto; }
.sidenav a:hover { background: var(--soft); }
.sidenav a.active { background: var(--accent-soft); color: var(--ink); box-shadow: inset 3px 0 0 var(--accent); }
.sidenav a.active b { font-weight: 800; }
.sidenav a.active svg { color: var(--accent-text); }
.nav-version { padding: 14px 18px 0; font-size: .75em; color: var(--muted); }
.subnav { position: sticky; top: var(--top-h); z-index: 20; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  padding: 0 14px; background: var(--bg, var(--surface)); border-bottom: 1px solid var(--line); }
.subnav::-webkit-scrollbar { display: none; }
body.with-shell .subnav { margin-left: var(--nav-w); }
.subnav a { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; min-height: 46px; padding: 0 12px; color: var(--muted);
  text-decoration: none; font-weight: 500; white-space: nowrap; border-bottom: 3px solid transparent; }
.subnav a:hover { color: var(--ink); }
.subnav a.active { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }
.update-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 60; display: flex; align-items: center; gap: 12px;
  max-width: calc(100vw - 24px); padding: 10px 12px 10px 16px; background: var(--ink); color: var(--surface); border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .25); }
.update-bar button { min-height: 36px; }
html[data-nav="bawah"] .update-bar { bottom: 86px; }
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 24; }
main { padding: 20px; max-width: 1160px; outline: none; }
body.with-shell main { margin-left: var(--nav-w); }
.tabbar { display: none; }
.menu-btn { display: none; }

@media (max-width: 860px) {
  .menu-btn { display: inline-flex; }
  .sidenav { transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 24px rgba(0, 0, 0, .2); width: min(300px, 86vw); }
  .sidenav.open { transform: none; }
  body.with-shell main { margin-left: 0; padding: 14px; }
  body.with-shell .subnav { margin-left: 0; padding: 0 6px; }
  html[data-nav="bawah"] .menu-btn { display: none; }
  html[data-nav="bawah"] body.with-shell .tabbar:not([hidden]) {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--nav-bg);
    border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  html[data-nav="bawah"] body.with-shell main { padding-bottom: 92px; }
  html[data-nav="bawah"] .sidenav { top: 0; z-index: 35; }
  .tabbar a, .tabbar button { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; min-height: 58px; padding: 6px 2px; color: var(--muted); text-decoration: none; font: inherit; font-size: .72em;
    background: none; border: 0; border-radius: 0; cursor: pointer; }
  .tabbar a.active { color: var(--accent-text); font-weight: 700; }
  .tabbar .pill { position: absolute; top: 4px; left: calc(50% + 6px); }
}
@media (prefers-reduced-motion: reduce) { .sidenav { transition: none; } }

/* ---------- surfaces */
.card { background: var(--surface); border: var(--card-border); box-shadow: var(--card-shadow); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 14px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + * { margin-top: 14px; }

/* KPIs: three layouts chosen by the theme */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: var(--card-border); box-shadow: var(--card-shadow); border-radius: var(--radius); padding: 12px 14px; }
.kpi .label { color: var(--muted); font-size: .82em; }
.kpi .value { font-family: var(--font-head); font-size: 1.4em; font-weight: var(--head-weight); margin-top: 2px; letter-spacing: var(--head-tracking); }
.kpi .sub { font-size: .8em; color: var(--muted); }
html[data-layout="hero"] .kpi-hero { grid-column: 1 / -1; order: -1; background: var(--hero-bg); color: var(--hero-ink); border: 0; padding: 18px 20px; }
html[data-layout="hero"] .kpi-hero .label, html[data-layout="hero"] .kpi-hero .sub { color: var(--hero-ink); opacity: .9; }
html[data-layout="hero"] .kpi-hero .value { font-size: 2.3em; }
html[data-layout="hero"] .kpi-hero .value span { color: inherit; }
html[data-layout="daftar"] .kpis { display: block; background: var(--surface); border: var(--card-border); box-shadow: var(--card-shadow); border-radius: var(--radius); padding: 2px 14px; }
html[data-layout="daftar"] .kpi { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; box-shadow: none; padding: 10px 0; }
html[data-layout="daftar"] .kpi:last-child { border-bottom: 0; }
html[data-layout="daftar"] .kpi .value { grid-row: 1 / 3; grid-column: 2; align-self: center; font-size: 1.15em; margin: 0; text-align: right; }
html[data-layout="daftar"] .kpi .label { color: var(--ink); font-size: .92em; font-weight: 600; }
.pos { color: var(--good); } .neg { color: var(--bad); }

/* ---------- forms */
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.row > * { flex: 1 1 170px; min-width: 0; }
label { display: block; font-size: .84em; color: var(--muted); margin-bottom: 4px; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: .92em; min-height: 44px; }
label.check input { width: 20px; height: 20px; }
input, select, textarea { width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid color-mix(in srgb, var(--ink) 22%, var(--surface));
  border-radius: var(--radius-sm); font: inherit; background: var(--surface); color: var(--ink); }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 0; padding: 0; margin: 0; flex: none;
  accent-color: var(--accent); vertical-align: middle; cursor: pointer; }
[hidden] { display: none !important; }
input[type="color"] { padding: 4px; height: 44px; }
input[type="file"] { padding: 8px; }
input[readonly] { background: var(--soft); }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 9px 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
button.secondary, .btn.secondary { background: var(--surface); color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
button.danger { background: var(--surface); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); }
button.small, .btn.small { min-height: 36px; padding: 5px 12px; font-size: .86em; }
button:disabled { opacity: .5; cursor: default; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: space-between; margin-bottom: 12px; }
.toolbar .tabs { margin: 0; }
.line-row { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.total-line { font-weight: 700; margin: 12px 0 0; }

/* ---------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; position: relative; max-width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: .92em; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .8em; color: var(--muted); font-weight: 600; white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td:first-child { white-space: nowrap; }
table.pnl td { padding: 8px 4px; }
table.pnl td:first-child { white-space: normal; }
.grid-2 > * { min-width: 0; }
table.pnl tr.strong td { font-weight: 700; border-top: 2px solid var(--ink); }
.breakdown { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; margin: 0; }
.breakdown dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- tags, notices, alerts */
.pill { display: inline-block; min-width: 20px; padding: 1px 7px; border-radius: 99px; background: var(--bad); color: #fff; font-size: .72em; font-weight: 700; text-align: center; }
.pill:empty { display: none; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .76em; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; }
.tag.sev-tinggi { background: var(--sev-high); color: var(--sev-high-ink); }
.tag.sev-sedang { background: var(--sev-mid); color: var(--sev-mid-ink); }
.tag.sev-rendah { background: var(--sev-low); color: var(--sev-low-ink); }
.tag.ok, .tag.st-selesai { background: color-mix(in srgb, var(--good) 16%, var(--surface)); color: var(--ink); }
.tag.st-batal, .tag.st-retur { background: var(--sev-high); color: var(--sev-high-ink); }
.tag.st-diproses { background: var(--sev-mid); color: var(--sev-mid-ink); }
.tag.st-dikirim { background: var(--sev-low); color: var(--sev-low-ink); }
.alert-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.alert-title { font-size: 1em; margin: 8px 0 2px; }
.alert-card p { margin: 4px 0; }
.notice { padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 12px; color: var(--ink);
  background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--surface)); }
.notice.error { background: color-mix(in srgb, var(--bad) 11%, var(--surface)); border-color: color-mix(in srgb, var(--bad) 35%, var(--surface)); }
.notice.ok { background: color-mix(in srgb, var(--good) 11%, var(--surface)); border-color: color-mix(in srgb, var(--good) 35%, var(--surface)); }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--surface);
  padding: 11px 16px; border-radius: var(--radius-sm); z-index: 60; max-width: 92vw; box-shadow: 0 4px 16px rgba(0, 0, 0, .2); }
.toast.error { background: var(--bad); color: #fff; }
html[data-nav="bawah"] .toast { bottom: 86px; }

/* ---------- tabs, chart, meter */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button { min-height: 38px; padding: 6px 14px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 99px; font-weight: 500; }
.tabs button.active { background: var(--tab-active-bg); color: var(--tab-active-ink); border: var(--tab-active-border); font-weight: 700; }
.chart { width: 100%; height: 150px; display: block; }
.chart-axis { display: flex; justify-content: space-between; margin-top: 4px; }
.meter { height: 8px; border-radius: 99px; background: var(--soft); overflow: hidden; min-width: 60px; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.meter.warn > span { background: var(--bad); }
td .meter { margin: 6px 0 2px; }
details summary { cursor: pointer; color: var(--accent-text); min-height: 32px; }
code { background: var(--soft); padding: 1px 5px; border-radius: 4px; font-size: .86em; }
pre { overflow-x: auto; background: var(--soft); padding: 10px; border-radius: var(--radius-sm); }
.login { max-width: 400px; margin: 60px auto; }

/* ---------- AI team */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ai-headline { font-family: var(--font-head); font-size: 1.12em; font-weight: 700; margin: 8px 0 6px; line-height: 1.35; }
.ai-prio, .ai-summary { margin: 6px 0 4px; padding-left: 22px; }
.ai-prio li, .ai-summary li { margin: 3px 0; }
.ai-card { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.ai-note { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); padding: 8px 10px; border-radius: var(--radius-sm); }

/* ---------- theme gallery */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr)); gap: 12px; }
.theme-card { display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 10px; min-height: 0; text-align: left;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); font-weight: 400; }
.theme-card.active { border: 2px solid var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-name { font-weight: 700; }
.theme-desc { line-height: 1.35; }
.theme-preview { position: relative; display: flex; flex-direction: column; gap: 6px; height: 128px; padding: 0 0 6px; overflow: hidden; border: 1px solid rgba(127, 127, 127, .3); }
.theme-preview i { display: block; height: 4px; border-radius: 2px; }
.tp-head { display: flex; align-items: center; height: 18px; padding: 0 8px; }
.tp-head i { width: 40%; opacity: .9; }
.tp-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 0 8px; }
.tp-cards > span { display: flex; flex-direction: column; gap: 3px; padding: 5px; }
.tp-cards i:first-child { width: 60%; } .tp-cards i:last-child { width: 85%; height: 6px; }
.tp-hero { display: flex; align-items: center; height: 40px; margin: 0 8px; border-radius: 6px; padding: 0 8px; }
.tp-hero span { display: block; width: 55%; height: 10px; border-radius: 3px; opacity: .95; }
.tp-list { display: flex; flex-direction: column; margin: 0 8px; padding: 0 6px; border-radius: 4px; }
.tp-list > span { display: flex; justify-content: space-between; align-items: center; height: 13px; border-bottom: 1px solid; }
.tp-list > span:last-child { border-bottom: 0; }
.tp-list i:first-child { width: 40%; } .tp-list i:last-child { width: 22%; }
.tp-bars { display: flex; align-items: flex-end; gap: 4px; height: 30px; padding: 0 8px; }
.tp-bars span { flex: 1; border-radius: 2px 2px 0 0; }
.tp-nav { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; align-items: center; height: 16px; }
.tp-nav i { width: 12px; height: 5px; }

@media (max-width: 860px) {
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
  .tabs button { flex: 0 0 auto; }
  .toolbar > .tabs { flex: 1 1 100%; }
}

/* ---------- print (reports) */
@media print {
  .topbar, .sidenav, .subnav, .update-bar, .tabbar, .scrim, .no-print, .actions, .toast, .skip { display: none !important; }
  body.with-shell main { margin: 0; padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
  .card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
}

/* ---------- operations: purchasing, setup checklist, connections */
.lines { width: 100%; }
.lines td { padding: 4px; vertical-align: top; }
.lines input, .lines select { min-width: 0; width: 100%; }
.lines .num input { text-align: right; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.checklist li { display: flex; gap: 10px; align-items: baseline; }
.checklist .mark { width: 1.3em; flex: none; font-weight: 700; color: var(--muted); }
.checklist li.done .mark { color: var(--good); }
.checklist li.done a, .checklist li.done span.txt { color: var(--muted); text-decoration: line-through; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 8px 0 12px; }
.progress > span { display: block; height: 100%; background: var(--accent); }
.conn-status { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 6px 0 10px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 6px; }
.dot.on { background: var(--good); } .dot.err { background: var(--bad); }

.photo-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.photo { position: relative; width: 84px; height: 104px; border-radius: 10px; overflow: hidden; background: var(--line); display: inline-flex; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo button { position: absolute; top: 4px; right: 4px; min-height: 28px; padding: 0 8px; }
.photo.add { align-items: center; justify-content: center; font-size: 28px; cursor: pointer; border: 2px dashed var(--muted); background: transparent; color: var(--muted); }
.cart-list { display: grid; gap: 6px; }
.cart-item { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cart-item input { width: 72px; }
.big-total { font-size: 1.8em; font-weight: 700; }
.receipt { font-family: ui-monospace, Menlo, monospace; font-size: 13px; white-space: pre; background: var(--surface); padding: 12px; border-radius: 8px; overflow-x: auto; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 0; }
.toggle { position: relative; display: inline-flex; align-items: center; cursor: pointer; min-height: 44px; margin: 0; }
.toggle input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; min-height: 0; padding: 0;
  border: 0; border-radius: 99px; background: color-mix(in srgb, var(--ink) 22%, var(--surface));
  position: relative; cursor: pointer; transition: background .15s; margin: 0; flex: none; }
.toggle input[type="checkbox"]::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: left .15s; }
.toggle input[type="checkbox"]:checked { background: var(--accent); }
.toggle input[type="checkbox"]:checked::after { left: 21px; }
.toggle input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.check.switch { font-size: 1.05em; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; z-index: 2; border-top: 1px solid var(--line); }
.photo .first { left: 4px; right: auto; }
@media (max-width: 860px) { html[data-nav="bawah"] .sticky-actions { bottom: 72px; } }
.toolbar.bulk { justify-content: flex-start; background: var(--soft); border-radius: var(--radius-sm); padding: 6px 10px; }

/* ---------- phones: tables as cards */
@media (max-width: 640px) {
  table.rt thead { display: none; }
  table.rt, table.rt tbody, table.rt tr { display: block; width: 100%; }
  table.rt tr { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px 12px; margin-bottom: 10px; background: var(--surface); }
  table.rt td { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 0; padding: 7px 0;
    text-align: right; white-space: normal; min-width: 0; overflow-wrap: anywhere; }
  table.rt td + td { border-top: 1px dashed var(--line); }
  table.rt td::before { content: attr(data-label); color: var(--muted); font-size: .8em; text-align: left; flex: 0 1 auto; max-width: 45%; }
  table.rt td[data-label=""]::before { content: none; }
  table.rt td[data-label=""] { justify-content: flex-start; text-align: left; }
  table.rt td:first-child { font-weight: 600; }
  table.rt td:empty { display: none; }
  table.rt td form.row { flex-wrap: nowrap; }
  .table-wrap:has(table.rt) { overflow: visible; }

  /* product list: one compact card per product */
  table.ptable thead tr { display: flex; align-items: center; gap: 8px; }
  table.ptable thead th { display: none; }
  table.ptable thead th:first-child { display: block; border: 0; padding: 4px 0; }
  table.ptable tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  table.ptable td { border: 0; padding: 0; white-space: normal; text-align: left; }
  table.ptable .c-sel { order: 0; }
  table.ptable .c-name { order: 1; flex: 1 1 calc(100% - 110px); min-width: 0; font-weight: 600; }
  table.ptable .c-web { order: 2; }
  table.ptable .c-sku, table.ptable .c-cat, table.ptable .c-status { order: 3; font-size: .82em; color: var(--muted); }
  table.ptable .c-sku { margin-left: 30px; }
  table.ptable .c-cost, table.ptable .c-price, table.ptable .c-stock { order: 4; font-size: .85em; }
  table.ptable .c-cost { margin-left: 30px; }
  table.ptable .c-cost::before, table.ptable .c-price::before, table.ptable .c-stock::before { content: attr(data-label) ": "; color: var(--muted); }
  table.ptable .c-edit { order: 5; margin-left: auto; }
  table.ptable td[colspan] { flex: 1 1 100%; }
}
