:root {
  --bg: #F1F3EF;
  --surface: #FFFFFF;
  --surface-2: #E8ECE6;
  --ink: #142019;
  --muted: #5B6861;
  --faint: #8A958E;
  --line: #D7DDD5;
  --accent: #0D7A5B;
  --accent-ink: #FFFFFF;
  --accent-soft: #DAEEE5;
  --accent-mid: #8CCBB3;
  --cost: #66727E;
  --cost-soft: #DCE1E6;
  --warn: #A3610A;
  --warn-soft: #F8E9CF;
  --bad: #B9372F;
  --bad-soft: #F6DDDA;
  --shadow: 0 1px 2px rgba(20, 32, 25, .05), 0 6px 20px rgba(20, 32, 25, .06);
  --r: 12px;
  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1311; --surface: #151C19; --surface-2: #1D2622; --ink: #E6ECE8; --muted: #95A29B; --faint: #6C7872; --line: #29332E;
    --accent: #3DC598; --accent-ink: #052419; --accent-soft: #143628; --accent-mid: #24684F;
    --cost: #97A3AF; --cost-soft: #2A323A;
    --warn: #E4A645; --warn-soft: #382A13; --bad: #EE7169; --bad-soft: #3B1D1B;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1311; --surface: #151C19; --surface-2: #1D2622; --ink: #E6ECE8; --muted: #95A29B; --faint: #6C7872; --line: #29332E;
  --accent: #3DC598; --accent-ink: #052419; --accent-soft: #143628; --accent-mid: #24684F;
  --cost: #97A3AF; --cost-soft: #2A323A;
  --warn: #E4A645; --warn-soft: #382A13; --bad: #EE7169; --bad-soft: #3B1D1B;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--f-body); }
h1, h2, h3 { font-family: var(--f-display); margin: 0; text-wrap: balance; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; line-height: 1.3; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num, .mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.pos { color: var(--accent); }
.neg { color: var(--bad); }
.muted { color: var(--muted); }
.grow { flex: 1; }
svg { display: block; }

/* Header */
.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1240px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 9px; font: 800 20px/1 var(--f-display); color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; }
.mark svg { width: 22px; height: 22px; fill: none; stroke: var(--accent-ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.tabs { display: flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 10px; }
.tabs a { padding: 6px 14px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14px; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.top-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 7px 13px; border-radius: 9px; font-weight: 500; font-size: 14px; cursor: pointer; white-space: nowrap; line-height: 1.3; }
.btn:hover { border-color: var(--faint); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { color: var(--bad); background: transparent; border-color: transparent; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.sm { padding: 4px 9px; font-size: 13px; border-radius: 7px; }
.btn:disabled { opacity: .55; cursor: wait; }
.icon-only { padding: 7px; }
.icon-only svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }

main { max-width: 1240px; margin: 0 auto; padding: 22px 20px 60px; display: grid; gap: 18px; }
.loading, .empty { color: var(--muted); }
.empty { padding: 26px 8px; text-align: center; font-size: 14px; }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; min-width: 0; }
.panel-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-h p { margin: 0; color: var(--muted); font-size: 13px; }
.row-2 { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 18px; }
.row-2b { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }

/* KPI strip */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.kpi { padding: 16px 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.kpi:nth-child(4n) { border-right: 0; }
.kpi:nth-last-child(-n+4) { border-bottom: 0; }
.kpi .lbl { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.kpi .val { font: 600 26px/1.15 var(--f-mono); font-variant-numeric: tabular-nums; margin: 6px 0 4px; letter-spacing: -.02em; overflow-wrap: anywhere; }
.kpi .sub { font-size: 13px; color: var(--muted); }
.kpi .sub.warn { color: var(--warn); font-weight: 500; }
.kpi.lead { background: var(--accent-soft); }

/* Charts */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.legend i.box { height: 10px; width: 10px; border-radius: 3px; }
.legend i.dash { background: none; border-top: 2px dashed var(--accent); height: 0; }
.chart { width: 100%; height: auto; overflow: visible; }
.chart text { font: 11px var(--f-mono); fill: var(--muted); }
.chart .gl { stroke: var(--line); stroke-width: 1; }
.chart .gl0 { stroke: var(--faint); }
.chart .l-out { stroke: var(--cost); stroke-width: 2.2; fill: none; }
.chart .l-in { stroke: var(--accent); stroke-width: 2.4; fill: none; }
.chart .a-in { fill: var(--accent); opacity: .12; }
.chart .l-proj { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 5 5; fill: none; }
.chart .end-lbl { font-weight: 600; font-size: 12px; paint-order: stroke; stroke: var(--surface); stroke-width: 5px; stroke-linejoin: round; }
.chart .t-out { fill: var(--cost); }
.chart .t-in, .chart .t-proj { fill: var(--accent); }
.chart .d-out { fill: var(--cost); }
.chart .d-in { fill: var(--accent); }
.chart .b-rev { fill: var(--accent-mid); }
.chart .b-prof { fill: var(--accent); }
.chart .b-loss { fill: var(--bad); }

/* Attention list */
.attn { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.attn li { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.attn li:last-child { border-bottom: 0; }
.attn b { font-weight: 600; font-size: 14px; }
.attn p { margin: 0; grid-column: 2; font-size: 13px; color: var(--muted); }
.attn .act { grid-column: 2; justify-self: start; margin-top: 4px; }
.attn-ok { color: var(--muted); font-size: 14px; padding: 8px 0; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; letter-spacing: .02em; height: fit-content; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.p-in { background: var(--accent-soft); color: var(--accent); }
.p-low, .p-warn { background: var(--warn-soft); color: var(--warn); }
.p-out, .p-bad { background: var(--bad-soft); color: var(--bad); }
.p-empty, .p-info { background: var(--surface-2); color: var(--muted); }
.k-purchase { background: var(--cost-soft); color: var(--cost); }
.k-sale { background: var(--accent-soft); color: var(--accent); }
.k-adjust { background: var(--warn-soft); color: var(--warn); }

/* Shelf bars */
.shelf { display: grid; gap: 14px; }
.shelf-row { display: grid; gap: 5px; cursor: pointer; border-radius: 8px; padding: 4px; margin: -4px; }
.shelf-row:hover { background: var(--surface-2); }
.shelf-name { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; font-weight: 500; }
.shelf-name span { color: var(--muted); font-weight: 400; white-space: nowrap; }
.bar { height: 9px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 5px; }
.b-cost { background: var(--cost); }
.b-proj { background: var(--accent); }
.shelf-v { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); font-family: var(--f-mono); flex-wrap: wrap; }

/* Tables */
.tbl-wrap { overflow-x: auto; margin: 0 -18px -18px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th:first-child, td:first-child { padding-left: 18px; }
th:last-child, td:last-child { padding-right: 18px; }
th.r, td.r { text-align: right; }
td.num { white-space: nowrap; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--surface-2); }
.t-prod { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.t-prod .thumb { width: 34px; height: 34px; border-radius: 7px; flex: none; }
.t-prod b { font-weight: 500; }
.t-note { color: var(--muted); font-size: 13px; max-width: 240px; }
.row-acts { display: flex; gap: 2px; justify-content: flex-end; }

/* Thumbs */
.thumb { background: var(--surface-2); display: grid; place-items: center; overflow: hidden; color: var(--muted); font: 700 13px var(--f-display); }
.thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }

/* Inventory */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar h1 { font-size: 24px; font-weight: 800; margin-right: auto; }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; min-width: 240px; }
.search svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; }
.search input { border: 0; background: none; padding: 8px 0; outline: none; width: 100%; }
select.sel { border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 7px 10px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); display: grid; grid-template-columns: 112px 1fr; gap: 0; overflow: hidden; }
.card .thumb { border: 0; border-right: 1px solid var(--line); cursor: pointer; padding: 0; font-size: 26px; min-height: 100%; }
.card-b { padding: 14px 16px; display: grid; gap: 10px; min-width: 0; }
.card-h { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; }
.card-h h3 { cursor: pointer; }
.card-h h3:hover { color: var(--accent); }
.meta { font-size: 12.5px; color: var(--muted); }
.onhand { display: flex; align-items: baseline; gap: 8px; }
.onhand b { font: 600 28px/1 var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.onhand span { color: var(--muted); font-size: 13px; }
.gauge { display: flex; height: 7px; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.gauge i { display: block; height: 100%; }
.g-sold { background: var(--accent); }
.g-lost { background: var(--bad); }
.mini { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.mini div { min-width: 0; }
.mini dt { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.mini dd { margin: 2px 0 0; font: 500 14px var(--f-mono); font-variant-numeric: tabular-nums; }
.mini dd button { font: 500 13px var(--f-body); color: var(--warn); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.card-acts { display: flex; gap: 6px; flex-wrap: wrap; }

/* Activity */
.filters { display: flex; gap: 8px; flex-wrap: wrap; }

/* Dialog */
dialog { border: 0; padding: 0; border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgba(0, 0, 0, .28); width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 32px); }
dialog.wide { width: min(940px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(10, 18, 14, .5); }
.sheet { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.sheet-h { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.sheet-h h2 { font-size: 20px; font-weight: 800; flex: 1; }
.x { border: 0; background: none; font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.x:hover { background: var(--surface-2); color: var(--ink); }
.sheet-b { padding: 18px 20px; overflow-y: auto; display: grid; gap: 14px; }
.sheet-f { display: flex; gap: 8px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.field { display: grid; gap: 5px; min-width: 0; }
.lbl { font-size: 12.5px; font-weight: 600; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.lbl em { font-style: normal; font-weight: 400; color: var(--faint); }
.field input, .field select, .field textarea, .money-in { border: 1px solid var(--line); background: var(--bg); border-radius: 9px; padding: 8px 10px; width: 100%; min-width: 0; }
.field input:focus, .field select:focus, .field textarea:focus, .money-in:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.field textarea { resize: vertical; }
.money-in { display: flex; align-items: center; gap: 4px; padding: 0 10px; }
.money-in span { color: var(--muted); font-family: var(--f-mono); }
.money-in input { border: 0; background: none; padding: 8px 0; outline: none !important; font-family: var(--f-mono); }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.price-row { display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.seg { display: flex; background: var(--surface-2); padding: 3px; border-radius: 9px; }
.seg button { border: 0; background: none; padding: 5px 11px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--muted); font-weight: 500; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.calc { background: var(--surface-2); border-radius: 9px; padding: 10px 12px; font: 13.5px/1.6 var(--f-mono); font-variant-numeric: tabular-nums; }
.calc b { font-weight: 600; }
.form-err { margin: 0; color: var(--bad); font-size: 13.5px; font-weight: 500; min-height: 0; }
.form-err:empty { display: none; }
.hint { font-size: 12.5px; color: var(--muted); margin: 0; }
fieldset { border: 1px dashed var(--line); border-radius: 10px; padding: 12px 14px 14px; margin: 0; display: grid; gap: 12px; }
legend { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 0 6px; }

.prod-top { display: grid; grid-template-columns: 150px 1fr; gap: 16px; }
.drop { border: 1.5px dashed var(--faint); border-radius: 12px; display: grid; place-items: center; text-align: center; cursor: pointer; background: var(--bg); position: relative; min-height: 150px; overflow: hidden; padding: 10px; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop.has { border-style: solid; padding: 0; background: #fff; }
.drop img { width: 100%; height: 100%; max-height: 190px; object-fit: contain; }
.drop .drop-hint { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.drop .drop-hint b { display: block; color: var(--ink); font-size: 13px; margin-bottom: 4px; }
.drop.busy::after { content: "Uploading..."; position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--surface) 80%, transparent); font-size: 13px; }
.drop-x { position: absolute; top: 6px; right: 6px; border: 0; background: rgba(0, 0, 0, .6); color: #fff; border-radius: 6px; font-size: 12px; padding: 2px 7px; cursor: pointer; }
.stack { display: grid; gap: 12px; align-content: start; }
kbd { font: 11px var(--f-mono); background: var(--surface-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; }

/* Detail */
.det-top { display: grid; grid-template-columns: 170px 1fr; gap: 20px; align-items: start; }
.det-top .thumb { width: 170px; height: 170px; border-radius: 12px; font-size: 38px; border: 1px solid var(--line); }
.det-info { display: grid; gap: 10px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stat-grid div { padding: 10px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.stat-grid div:nth-child(4n) { border-right: 0; }
.stat-grid div:nth-last-child(-n+4) { border-bottom: 0; }
.stat-grid dt { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.stat-grid dd { margin: 3px 0 0; font: 600 16px var(--f-mono); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-grid dd small { display: block; font: 400 12px var(--f-body); color: var(--muted); }
.det-ledger { border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
.det-ledger td, .det-ledger th { padding: 8px 10px; }

/* Toast */
#toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); color: #fff; }

@media (max-width: 960px) {
  .row-2, .row-2b { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(4n) { border-right: 1px solid var(--line); }
  .kpi:nth-child(2n) { border-right: 0; }
  .kpi:nth-last-child(-n+4) { border-bottom: 1px solid var(--line); }
  .kpi:nth-last-child(-n+2) { border-bottom: 0; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid div:nth-child(4n) { border-right: 1px solid var(--line); }
  .stat-grid div:nth-child(2n) { border-right: 0; }
  .stat-grid div:nth-last-child(-n+4) { border-bottom: 1px solid var(--line); }
  .stat-grid div:nth-last-child(-n+2) { border-bottom: 0; }
}
@media (max-width: 640px) {
  .top-in, main { padding-left: 16px; padding-right: 16px; }
  .top-actions { margin-left: 0; width: 100%; }
  .top-actions .btn:not(.icon-only) { flex: 1; justify-content: center; }
  .kpi .val { font-size: 21px; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .card { grid-template-columns: 88px 1fr; }
  .prod-top, .det-top { grid-template-columns: minmax(0, 1fr); }
  .det-top .thumb { width: 100%; height: 180px; }
  .cols-3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .price-row { grid-template-columns: minmax(0, 1fr); }
  .search { min-width: 0; flex: 1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Bundles */
[hidden] { display: none !important; }
td small.sub { display: block; font-size: 11.5px; color: var(--muted); font-family: var(--f-body); }
.packs { display: flex; gap: 6px; flex-wrap: wrap; }
.pack { display: grid; gap: 1px; text-align: left; border: 1px solid var(--line); background: var(--surface-2); border-radius: 9px; padding: 6px 10px; cursor: pointer; font-size: 12px; color: var(--muted); font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.pack b { font: 600 13px var(--f-body); color: var(--ink); }
.pack:hover { border-color: var(--accent); background: var(--accent-soft); }
.pack:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.b-list { display: grid; gap: 10px; }
.b-list:empty { display: none; }
.b-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, .9fr) minmax(0, 1.2fr) auto; gap: 10px; align-items: end; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.b-row .b-del { margin-bottom: 4px; }
.b-row .b-calc { grid-column: 1 / -1; }
.b-row .b-calc:empty { display: none; }
.linkish { font: 500 13px var(--f-body); color: var(--warn); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 640px) {
  .b-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

/* Sold comps */
.comp-chip { display: flex; align-items: center; gap: 10px; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 6px 10px 6px 6px; cursor: pointer; color: var(--muted); font-size: 12.5px; min-width: 0; }
.comp-chip.none { border-style: dashed; padding-left: 10px; }
.comp-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.comp-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cc-imgs { display: flex; flex: none; }
.cc-imgs img { width: 34px; height: 34px; object-fit: cover; object-position: top left; border-radius: 6px; border: 2px solid var(--surface); background: var(--surface-2); }
.cc-imgs img + img { margin-left: -12px; }
.cc-txt { display: grid; gap: 1px; min-width: 0; font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.cc-txt b { font: 600 13px var(--f-body); color: var(--ink); }
.comps-sec { display: grid; gap: 10px; }
.sec-h { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; }
.sec-h .hint { font-size: 13px; }
.sec-h .hint b { color: var(--ink); font-family: var(--f-mono); }
.comps { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.comp { display: grid; grid-template-rows: auto 1fr; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); padding: 0; cursor: pointer; text-align: left; color: var(--ink); }
.comp:hover { border-color: var(--accent); }
.comp:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.comp-img { display: block; aspect-ratio: 4 / 3; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.comp-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.comp-cap { display: grid; gap: 1px; padding: 7px 9px 8px; }
.comp-cap b { font: 600 15px var(--f-mono); font-variant-numeric: tabular-nums; }
.comp-cap small { font-size: 11.5px; color: var(--muted); }
.comp.old { opacity: .62; }
.comp.old:hover { opacity: 1; }
.comps-empty { display: grid; gap: 4px; place-items: center; text-align: center; border: 1.5px dashed var(--faint); border-radius: 10px; background: var(--bg); padding: 22px 16px; cursor: pointer; color: var(--muted); font-size: 13px; }
.comps-empty b { color: var(--ink); font-size: 14px; }
.comps-empty:hover { border-color: var(--accent); background: var(--accent-soft); }
.comp-drop { min-height: 170px; }
.comp-drop img { max-height: 260px; }
.lightbox { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-rows: minmax(0, 1fr) auto; background: rgba(8, 12, 10, .92); color: #F1F3EF; }
.lb-img { display: grid; place-items: center; padding: 20px 64px; min-height: 0; }
.lb-img img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; background: #fff; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.lb-nav { position: absolute; top: calc(50% - 60px); width: 44px; height: 64px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .12); color: #fff; font-size: 34px; line-height: 1; cursor: pointer; }
.lb-nav:hover { background: rgba(255, 255, 255, .24); }
.lb-nav:focus-visible, .lightbox .btn:focus-visible { outline: 2px solid var(--accent-mid); outline-offset: 2px; }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
.lb-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 20px 16px; border-top: 1px solid rgba(255, 255, 255, .14); background: rgba(8, 12, 10, .6); }
.lb-info { display: flex; align-items: baseline; gap: 4px 14px; flex-wrap: wrap; font-size: 13.5px; color: #B9C4BE; min-width: 0; }
.lb-info b { font: 600 22px var(--f-mono); color: #fff; }
.lb-count { font-size: 12.5px; color: #B9C4BE; margin-right: 4px; }
@media (max-width: 640px) {
  .comps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lb-img { padding: 12px; }
  .lb-nav { top: auto; bottom: 120px; }
  .lb-bar { padding: 10px 12px 14px; }
}

/* Day / night toggle: the moon shows by day, the sun by night */
.theme-btn .i-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-btn .i-moon { display: none; }
}
:root[data-theme="dark"] .theme-btn .i-sun { display: block; }
:root[data-theme="dark"] .theme-btn .i-moon { display: none; }

/* eBay sync */
.eb-bar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; background: var(--warn-soft); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; }
.eb-bar p { margin: 0; flex: 1; min-width: 220px; font-size: 14px; }
.eb-bar b { font-weight: 600; }
.eb-list { list-style: none; margin: 0; padding: 0; display: grid; }
.eb-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.eb-list li:last-child { border-bottom: 0; }
.eb-main, .eb-order { display: grid; gap: 2px; min-width: 0; flex: 1; }
.eb-main b, .eb-order b { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.eb-order { background: var(--surface-2); border-radius: 9px; padding: 10px 12px; }
.hint.warn { color: var(--warn); }
.hint.neg { color: var(--bad); }
.eb-sync { display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.eb-h { font-size: 14px; margin-top: 4px; }
.eb-key { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.eb-key .lbl { color: var(--muted); font-size: 13px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }

/* ---------- accounts, Zapier setup, admin ---------- */
.eb-url { overflow-wrap: anywhere; font-size: 12.5px; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.zap-how { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; font-size: 14px; }
.zap-how summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.zap-how[open] summary { margin-bottom: 8px; }
.zap-how h4 { font: 700 14px/1.3 var(--f-display); margin: 14px 0 6px; }
.zap-how p { margin: 0 0 8px; }
.zap-how ol { margin: 0; padding-left: 20px; display: grid; gap: 5px; line-height: 1.45; }
.zap-tbl { overflow-x: auto; margin: 12px 0 8px; }
.zap-tbl table { border-collapse: collapse; width: 100%; font-size: 13px; }
.zap-tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); }
.zap-tbl td { padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.zap-tbl td.mono { font-family: var(--f-mono); color: var(--accent); white-space: nowrap; }
.zap-tbl .hint { display: block; }
.adm td { white-space: nowrap; }
.adm td:first-child { white-space: normal; min-width: 160px; }
.adm-act { display: flex; gap: 6px; justify-content: flex-end; }
.acct-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.acct-row .field { flex: 1; min-width: 200px; }
.who { font-size: 13px; color: var(--muted); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; align-self: center; }
.pub-link { font-size: 13px; color: var(--muted); text-decoration: none; align-self: center; }
.pub-link:hover { color: var(--accent); }
@media (max-width: 640px) { .who, .pub-link { display: none; } }
