/* BizatiDB: Studio Dark + Bizati Cream. Four tokens per theme; every other colour is a tint of them. */
@font-face { font-family: "Instrument Serif"; src: url("../fonts/instrument-serif-normal-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("../fonts/instrument-serif-italic-400.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("../fonts/plus-jakarta-sans-normal-400-700.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

:root, [data-theme="dark"] {
  --bg: #121110; --surface: #1c1a18; --text: #f3eee5; --accent: #ff3b00;
  color-scheme: dark;
}
[data-theme="cream"] {
  --bg: #f3eee4; --surface: #fffcf6; --text: #151413; --accent: #c93200;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) { --bg: #f3eee4; --surface: #fffcf6; --text: #151413; --accent: #c93200; color-scheme: light; }
}
:root {
  --muted: color-mix(in srgb, var(--text) 64%, var(--bg));
  --line: color-mix(in srgb, var(--text) 16%, transparent);
  --line-strong: color-mix(in srgb, var(--text) 32%, transparent);
  --wash: color-mix(in srgb, var(--text) 5%, transparent);
  --accent-wash: color-mix(in srgb, var(--accent) 14%, transparent);
  --on-accent: #121110;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --radius: 10px;
  --step-0: clamp(0.875rem, 0.1vw + 0.85rem, 0.95rem);
  --step-1: clamp(1rem, 0.3vw + 0.92rem, 1.15rem);
  --step-2: clamp(1.35rem, 1vw + 1.05rem, 1.9rem);
  --step-3: clamp(2rem, 3.2vw + 1rem, 3.6rem);
  --step-4: clamp(2.6rem, 5.5vw + 1rem, 5.4rem);
}
[data-theme="cream"] { --on-accent: #fffcf6; }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; overflow-x: clip; }
body {
  background: var(--bg); color: var(--text); font: 400 var(--step-0)/1.5 var(--sans);
  -webkit-font-smoothing: antialiased; min-height: 100dvh;
}
.num, .mono, .price, td.n, input[type="number"] { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 0.86em; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: 6px; z-index: 50; }
.skip:focus { left: 8px; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- masthead ---------- */
.mast { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; padding: 14px clamp(14px, 3vw, 36px); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); z-index: 20; }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; min-width: 0; }
.brand b { font: 400 1.75rem/1 var(--serif); letter-spacing: -0.01em; }
.brand b i { color: var(--accent); }
.brand span { color: var(--muted); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modes { display: flex; gap: 4px; justify-self: center; border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.modes a { text-decoration: none; padding: 6px 14px; border-radius: 999px; font-weight: 600; font-size: 0.85rem; display: flex; gap: 6px; align-items: center; }
.modes a[aria-current="page"] { background: var(--text); color: var(--bg); }
.modes a:hover:not([aria-current="page"]) { background: var(--wash); color: var(--text); }
.tools { display: flex; gap: 8px; align-items: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-strong); background: transparent; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: 0.88rem; text-decoration: none; min-height: 38px; }
.btn:hover { border-color: var(--text); background: var(--wash); color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 86%, var(--text)); color: var(--on-accent); }
.btn.ghost { border-color: transparent; }
.btn.icon-only { padding: 8px; width: 38px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.danger { border-color: var(--accent); color: var(--accent); }

/* ---------- cartridge strip ---------- */
.strip { display: flex; gap: 0; overflow-x: auto; border-bottom: 1px solid var(--line); padding: 0 clamp(14px, 3vw, 36px); scrollbar-width: thin; }
.strip button { border: 0; background: none; padding: 12px 16px 11px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; color: var(--muted); font-weight: 600; font-size: 0.85rem; }
.strip button[aria-pressed="true"] { color: var(--text); border-bottom-color: var(--accent); }
.strip button:hover { color: var(--text); }
.demo-flag { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; align-self: center; white-space: nowrap; font: 0.75rem var(--mono); color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 3px 10px; }

/* ---------- kiosk ---------- */
.kiosk { display: grid; grid-template-columns: 8fr 4fr; gap: 0; min-height: calc(100dvh - 120px); }
.kiosk-main { padding: clamp(16px, 3vw, 36px); min-width: 0; border-right: 1px solid var(--line); }
.kicker { font: 0.75rem var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 8px; }
.headline { font: 400 var(--step-4)/0.95 var(--serif); letter-spacing: -0.02em; margin: 0 0 18px; max-width: 14ch; }
.headline em { color: var(--accent); }
.search { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line-strong); border-radius: 12px; padding: 0 14px; background: var(--surface); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.search input { flex: 1; min-width: 0; border: 0; background: none; padding: 16px 0; font-size: var(--step-1); outline: none; }
.search .meta { color: var(--muted); font: 0.75rem var(--mono); white-space: nowrap; }
.facets { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.facet { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.facet > span { font: 0.72rem var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; min-width: 88px; }
.pill { border: 1px solid var(--line-strong); background: transparent; border-radius: 999px; padding: 4px 11px; font-size: 0.8rem; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.pill small { color: var(--muted); font-variant-numeric: tabular-nums; }
.pill:hover { border-color: var(--text); }
.pill[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.pill[aria-pressed="true"] small { color: inherit; opacity: 0.7; }
.results-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 6px 0 10px; flex-wrap: wrap; }
.results-bar select { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 8px; }
.vgrid { position: relative; height: calc(100dvh - 340px); min-height: 380px; overflow-y: auto; overflow-x: hidden; border-top: 1px solid var(--line); contain: strict; overscroll-behavior: contain; }
.vgrid-spacer { width: 1px; }
.card { position: absolute; left: 0; top: 0; display: grid; grid-template-rows: auto 1fr auto; gap: 4px; padding: 12px 14px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); background: var(--bg); will-change: transform; }
.card:hover { background: var(--wash); }
.card h3 { margin: 0; font-size: 0.95rem; line-height: 1.25; font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card .sub { color: var(--muted); font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .loc { display: flex; gap: 6px; align-items: flex-start; color: var(--muted); font: 0.72rem var(--mono); white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
.card .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.price { font: 600 1.05rem var(--mono); }
.stock { font: 0.72rem var(--mono); color: var(--muted); }
.stock.out { color: var(--accent); }
.add { border: 1px solid var(--line-strong); background: none; border-radius: 8px; width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer; }
.add:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.add:disabled { opacity: 0.35; cursor: not-allowed; }
.card.skeleton h3, .card.skeleton .sub { background: var(--wash); color: transparent; border-radius: 4px; }
.empty { padding: 40px 0; color: var(--muted); }

.pull { padding: clamp(16px, 2.4vw, 28px); background: var(--surface); display: flex; flex-direction: column; gap: 14px; position: sticky; top: 62px; height: calc(100dvh - 62px); overflow-y: auto; }
.pull h2, .panel h2 { font: 400 var(--step-2)/1.1 var(--serif); margin: 0; }
.pull-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pull-lines li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pull-lines .t { font-weight: 600; font-size: 0.88rem; }
.pull-lines .l { grid-column: 1; color: var(--muted); font: 0.72rem var(--mono); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 8px; grid-row: span 2; align-self: center; }
.stepper button { border: 0; background: none; width: 30px; height: 30px; cursor: pointer; display: grid; place-items: center; }
.stepper button:hover { color: var(--accent); }
.stepper output { min-width: 26px; text-align: center; font: 0.85rem var(--mono); }
.total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line-strong); padding-top: 10px; }
.total strong { font: 600 1.3rem var(--mono); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label, .field > span { font: 0.72rem var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.field input, .field select, .field textarea { background: var(--bg); border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 11px; min-width: 0; width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-wash); }
.ticket { border: 1px solid var(--accent); border-radius: var(--radius); padding: 18px; text-align: center; background: var(--bg); }
.ticket .no { font: 600 clamp(1.3rem, 2.2vw, 1.8rem) var(--mono); letter-spacing: 0.02em; color: var(--accent); overflow-wrap: anywhere; }
.note { color: var(--muted); font-size: 0.82rem; margin: 0; }
.alert { border-left: 3px solid var(--accent); background: var(--accent-wash); padding: 10px 12px; border-radius: 0 8px 8px 0; font-size: 0.86rem; overflow-wrap: anywhere; }
.alert::before { content: "! "; font-weight: 700; color: var(--accent); }
.ok-msg { border-left: 3px solid var(--text); background: var(--wash); padding: 10px 12px; border-radius: 0 8px 8px 0; font-size: 0.86rem; overflow-wrap: anywhere; }
.pull-toggle { display: none; }
.facets-toggle { display: none; }

/* ---------- staff deck ---------- */
.deck { display: grid; grid-template-columns: 3fr 9fr; min-height: calc(100dvh - 120px); }
.rail { border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 62px; align-self: start; max-height: calc(100dvh - 62px); overflow-y: auto; }
.rail button { display: flex; align-items: center; gap: 10px; border: 0; background: none; text-align: left; padding: 10px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 0.88rem; color: var(--muted); }
.rail button:hover { color: var(--text); background: var(--wash); }
.rail button[aria-current="true"] { color: var(--text); background: var(--wash); box-shadow: inset 2px 0 0 var(--accent); }
.rail .badge { margin-left: auto; font: 0.72rem var(--mono); background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 1px 7px; }
.panel { padding: clamp(16px, 3vw, 36px); min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.panel-head p { margin: 4px 0 0; color: var(--muted); max-width: 62ch; }
.split { display: grid; grid-template-columns: 7fr 5fr; gap: 24px; align-items: start; }
.box { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface); min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.box h3 { margin: 0; font-size: 0.95rem; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > .field { flex: 1 1 140px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 0.7rem var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: var(--surface); position: sticky; top: 0; }
td.n, th.n { text-align: right; }
tr.done td { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.walk-step { font: 600 0.8rem var(--mono); color: var(--accent); }
.check { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; }
.ticket-card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ticket-card header { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ticket-card header b { font-family: var(--mono); }
.tag { font: 0.7rem var(--mono); border: 1px solid var(--line-strong); border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.tag.new { border-color: var(--accent); color: var(--accent); }
.tag.mod { background: var(--text); color: var(--bg); border-color: var(--text); }
.stats { display: flex; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; flex-wrap: wrap; }
.stats div { flex: 1 1 120px; padding: 12px 14px; border-right: 1px solid var(--line); }
.stats div:last-child { border-right: 0; }
.stats b { display: block; font: 600 1.5rem var(--mono); }
.stats span { color: var(--muted); font-size: 0.78rem; }
.labels-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.labels-grid figure { margin: 0; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #fff; }
.labels-grid img { width: 100%; height: auto; display: block; }
.labels-grid figcaption { color: #151413; font: 0.7rem var(--mono); margin-top: 6px; }
.fields-editor { display: flex; flex-direction: column; gap: 8px; }
.split.schema { grid-template-columns: 1fr; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 110px auto auto auto; gap: 8px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.field-row input, .field-row select { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px; padding: 7px 9px; min-width: 0; width: 100%; }
.field-row .values { grid-column: 1 / -1; }
.field-row label.inline { display: flex; gap: 6px; align-items: center; font-size: 0.8rem; white-space: nowrap; }
.dropzone { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); }
.dropzone.over { border-color: var(--accent); background: var(--accent-wash); }
dialog { border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); color: var(--text); padding: 0; width: min(920px, calc(100vw - 24px)); max-height: calc(100dvh - 40px); }
dialog::backdrop { background: color-mix(in srgb, #000 55%, transparent); }
.dialog-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.diff-row td:first-child { white-space: nowrap; }
.change { font: 0.75rem var(--mono); color: var(--muted); display: block; overflow-wrap: anywhere; }
.change b { color: var(--text); font-weight: 600; }
.login { max-width: 380px; margin: clamp(30px, 8vh, 90px) auto; padding: 0 16px; display: flex; flex-direction: column; gap: 14px; }
.login h1 { font: 400 var(--step-3)/1 var(--serif); margin: 0; }
.pin-input { font: 600 1.6rem var(--mono) !important; letter-spacing: 0.4em; text-align: center; }
.foot-note { padding: 18px clamp(14px, 3vw, 36px); border-top: 1px solid var(--line); color: var(--muted); font-size: 0.78rem; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 0.88rem; z-index: 60; max-width: calc(100vw - 32px); }

/* ---------- responsive ---------- */
@media (max-width: 1040px) {
  .split { grid-template-columns: 1fr; }
  .deck { grid-template-columns: 1fr; }
  .rail { position: static; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); max-height: none; padding: 8px; }
  .rail button { white-space: nowrap; }
  .rail button[aria-current="true"] { box-shadow: inset 0 -2px 0 var(--accent); }
}
@media (max-width: 860px) {
  .kiosk { grid-template-columns: 1fr; }
  .kiosk-main { border-right: 0; padding-bottom: 90px; }
  .pull { position: fixed; inset: auto 0 0 0; top: auto; height: auto; max-height: 82dvh; border-top: 1px solid var(--line-strong); z-index: 30; transform: translateY(100%); transition: transform 0.2s ease; overflow-x: clip; }
  .pull.open { transform: none; }
  .facets-toggle { display: inline-flex; align-self: flex-start; margin-top: 12px; }
  .facets.collapsed { display: none; }
  .pull-toggle { display: inline-flex; position: fixed; right: 14px; bottom: 14px; z-index: 31; box-shadow: 0 6px 20px color-mix(in srgb, #000 30%, transparent); }
  .vgrid { height: calc(100dvh - 300px); }
  .field-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .mast { grid-template-columns: 1fr auto; }
  .modes { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; justify-content: center; }
  .brand span { display: none; }
  .facet > span { min-width: 100%; }
  .headline { font-size: clamp(2.2rem, 11vw, 3rem); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ---------- print: labels and purchase orders only ---------- */
@media print {
  body { background: #fff; color: #000; }
  .mast, .strip, .rail, .foot-note, .no-print, .pull-toggle, .kiosk { display: none !important; }
  .deck { display: block; }
  .panel { padding: 0; }
  .box { border: 0; background: none; padding: 0; }
  table { font-size: 10pt; }
  th { background: none; color: #000; }
  .labels-grid { grid-template-columns: repeat(2, 1fr); }
  .labels-grid figure { break-inside: avoid; border: 0; }
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- v1.1: theme accent from the Setup Wizard (replaces only the accent token, per theme) ---------- */
[data-accent="cobalt"] { --accent: #5b8cff; }
[data-accent="jade"] { --accent: #2fc08a; }
[data-accent="violet"] { --accent: #a98bff; }
[data-accent="amber"] { --accent: #ffb020; }
[data-accent="graphite"] { --accent: #c9c4bb; }
[data-theme="cream"][data-accent="cobalt"] { --accent: #1f4fd1; }
[data-theme="cream"][data-accent="jade"] { --accent: #0b7a55; }
[data-theme="cream"][data-accent="violet"] { --accent: #6a3fd6; }
[data-theme="cream"][data-accent="amber"] { --accent: #a35f00; }
[data-theme="cream"][data-accent="graphite"] { --accent: #3a3836; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme])[data-accent="cobalt"] { --accent: #1f4fd1; }
  :root:not([data-theme])[data-accent="jade"] { --accent: #0b7a55; }
  :root:not([data-theme])[data-accent="violet"] { --accent: #6a3fd6; }
  :root:not([data-theme])[data-accent="amber"] { --accent: #a35f00; }
  :root:not([data-theme])[data-accent="graphite"] { --accent: #3a3836; }
}

/* ---------- v1.1: power search, view switcher ---------- */
.browse { display: flex; flex-direction: column; min-width: 0; }
.op-hint { color: var(--muted); font-size: 0.75rem; margin: 8px 0 0; }
.op-hint code { font: 0.72rem var(--mono); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; margin-right: 4px; }
.op-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.op-chips:empty { display: none; }
.op-chip { font: 0.72rem var(--mono); border: 1px solid var(--accent); color: var(--accent); border-radius: 999px; padding: 2px 9px; }
.view-switch { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.view-switch .btn { border: 0; border-radius: 0; min-height: 34px; padding: 6px 10px; }
.view-switch .btn + .btn { border-left: 1px solid var(--line); }
.view-switch .btn[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.linkish { border: 0; background: none; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.linkish:hover { color: var(--accent); }
.card-open { all: unset; cursor: pointer; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.card-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card.selected { background: var(--accent-wash); }
.card .add[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ---------- v1.1: Spec Table ---------- */
.table-wrap.spec { max-height: calc(100dvh - 330px); min-height: 320px; overflow: auto; }
.spec-table { font-variant-numeric: tabular-nums; }
.spec-table td { white-space: nowrap; max-width: 28ch; overflow: hidden; text-overflow: ellipsis; padding: 7px 10px; }
.spec-table th { z-index: 1; white-space: nowrap; }
.spec-table th.sel, .spec-table td.sel { width: 36px; }
.th-sort { all: unset; cursor: pointer; }
.th-sort:hover { color: var(--text); }
.spec-table tr:hover td { background: var(--wash); }
.spec-table tr.selected td { background: var(--accent-wash); }
.spec-table td.editable { cursor: cell; }
.spec-table td.editable:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
.spec-table td.saved { box-shadow: inset 2px 0 0 var(--accent); }
.cell-input, .spec-table td select { width: 100%; min-width: 8ch; background: var(--bg); border: 1px solid var(--accent); border-radius: 5px; padding: 3px 6px; }
.table-more { padding: 10px 2px; }

/* ---------- v1.1: Bin Map ---------- */
.crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font: 0.8rem var(--mono); margin: 4px 0 12px; color: var(--muted); }
.bins { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.bin-tile { display: flex; flex-direction: column; gap: 4px; text-align: left; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 14px; cursor: pointer; min-width: 0; }
.bin-tile:hover { border-color: var(--text); }
.bin-tile b { font: 400 var(--step-2)/1.1 var(--serif); overflow-wrap: anywhere; }
.bin-tile .kicker { margin: 0; }
.bin-stats { font: 0.75rem var(--mono); color: var(--muted); }
.bin-bar { height: 4px; background: var(--wash); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.bin-bar span { display: block; height: 100%; background: var(--accent); }

/* ---------- v1.1: Item Spec & Variant Drawer ---------- */
dialog.drawer { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(560px, 100vw); max-width: 100vw; border-radius: 0; border-width: 0 0 0 1px; }
.drawer-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.drawer-head h2 { font: 400 var(--step-2)/1.1 var(--serif); margin: 0; overflow-wrap: anywhere; }
.drawer-body { padding: 16px 20px 28px; display: flex; flex-direction: column; gap: 14px; }
.drawer-body h3 { margin: 6px 0 0; font-size: 0.95rem; }
.drawer-art { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); padding: 12px; }
.drawer-price { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.drawer-price .btn { margin-left: auto; }
.schematic { display: block; width: 100%; max-height: 240px; color: var(--text); }
.schematic * { fill: none; stroke: currentColor; stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.schematic .sch-text { fill: currentColor; stroke: none; font-family: var(--mono); }
.spec-list th { width: 40%; text-transform: none; letter-spacing: 0; font: 0.8rem var(--sans); color: var(--muted); background: none; position: static; }
.spec-list td { overflow-wrap: anywhere; }
tr.current td { background: var(--wash); }

/* ---------- v1.1: Items telemetry and bulk bar ---------- */
.telemetry b { font-size: 1.2rem; }
.bulk-bar { display: flex; gap: 10px 16px; align-items: center; flex-wrap: wrap; border: 1px solid var(--accent); border-radius: var(--radius); padding: 12px 14px; background: var(--accent-wash); position: sticky; top: 64px; z-index: 5; }
.bulk-bar input, .bulk-bar select { background: var(--bg); border: 1px solid var(--line-strong); border-radius: 6px; padding: 6px 8px; min-width: 0; width: 120px; }
.bulk-bar .kicker { margin: 0; }
.row.wrap { align-items: center; }
.actor-kiosk { border-color: var(--accent); color: var(--accent); }
.actor-system { background: var(--wash); }
.total.sub { border-top: 0; padding-top: 0; color: var(--muted); font-size: 0.82rem; }

/* ---------- v1.1: Setup Wizard and mixer ---------- */
dialog.wizard-dialog { width: min(980px, calc(100vw - 16px)); }
.wizard header { justify-content: space-between; align-items: center; }
.wizard h2 { font: 400 var(--step-2)/1.1 var(--serif); margin: 0; }
.wiz-steps { list-style: none; display: flex; gap: 8px; margin: 0; padding: 0; flex-wrap: wrap; }
.wiz-steps li { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 0.82rem; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 4px; }
.wiz-steps li span { width: 22px; height: 22px; border-radius: 999px; display: grid; place-items: center; border: 1px solid var(--line-strong); }
.wiz-steps li[aria-current="step"] { color: var(--text); border-color: var(--accent); }
.wiz-steps li[aria-current="step"] span { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.wiz-steps li.done span { background: var(--text); color: var(--bg); }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.choice { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--bg); min-width: 0; }
label.choice { cursor: pointer; }
label.choice:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.pill-check { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line-strong); border-radius: 999px; padding: 5px 12px 5px 8px; cursor: pointer; font-size: 0.85rem; }
.swatch { display: inline-flex; gap: 8px; align-items: center; border: 1px solid var(--line-strong); border-radius: 999px; padding: 5px 12px 5px 6px; background: none; cursor: pointer; font-weight: 600; font-size: 0.85rem; }
.swatch[aria-checked="true"] { border-color: var(--text); box-shadow: 0 0 0 2px var(--text) inset; }
.swatch .dot { width: 18px; height: 18px; border-radius: 999px; background: #ff3b00; }
.swatch[data-swatch="cobalt"] .dot { background: #4d7cf0; }
.swatch[data-swatch="jade"] .dot { background: #1fa676; }
.swatch[data-swatch="violet"] .dot { background: #8b66f0; }
.swatch[data-swatch="amber"] .dot { background: #e89a10; }
.swatch[data-swatch="graphite"] .dot { background: #6e6a64; }
.wiz-import:empty { display: none; }
.wiz-import { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 14px; }
.mixer-list { list-style: none; margin: 0; padding: 0; max-height: 50dvh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.mixer-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 6px 4px 10px; border-bottom: 1px solid var(--line); font-size: 0.86rem; }
.mixer-list .btn.icon-only { width: 30px; min-height: 30px; padding: 4px; }
.preset { display: inline-flex; align-items: center; }

@media (max-width: 860px) {
  .table-wrap.spec { max-height: none; }
  .wide-only { display: none; }
  .results-bar .row { width: 100%; }
  .view-switch .btn span { display: none; }
  .bulk-bar { position: static; }
  .bulk-bar input, .bulk-bar select { width: 100%; }
}
@media (max-width: 560px) {
  .bins { grid-template-columns: 1fr 1fr; }
  .drawer-price .btn { margin-left: 0; width: 100%; }
}
