/* FlipLedger — design tokens from docs/BUILD_SPEC.md §7 */
:root {
  --ground: #F4F1EA;
  --surface: #FFFFFF;
  --line: #DDD6C8;
  --line-strong: #CFC7B6;
  --line-soft: #F0EBE1;
  --ink: #1C1B19;
  --muted: #5E5A52;
  --accent: #B8430F;
  --accent-dark: #8C3209;
  --accent-light: #F08A4B;
  --good: #1F6B45; --good-bg: #DCEBDF;
  --bad: #7A1717; --bad-bg: #F5DCDC;
  --info: #1D4E89; --info-bg: #DDE7F3;
  --warm: #8C3209; --warm-bg: #F6E3D6;
  --neutral: #3D3A34; --neutral-bg: #E8E4DA;
  --font-head: 'Bricolage Grotesque', 'IBM Plex Sans', system-ui, sans-serif;
  --font-ui: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --r-sm: 6px; --r: 8px; --r-md: 10px; --r-lg: 12px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font-ui); font-size: 15px; line-height: 1.45; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-family: var(--font-head); font-weight: 700; font-size: 34px; letter-spacing: -0.02em; }
h2 { font-size: 17px; font-weight: 600; }
p { margin: 0; }
code { font-family: var(--font-mono); font-size: 0.92em; }
:focus-visible { outline: 3px solid var(--accent-light); outline-offset: 2px; }
[hidden] { display: none !important; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 50; background: var(--surface); padding: 8px 12px; border-radius: var(--r); }
.skip:focus { left: 8px; }
.js .js-hide { display: none; }

.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.warn { color: var(--warm); font-weight: 600; }
.num { text-align: right; }
.row { display: flex; gap: 8px; align-items: center; }
.row > input { flex: 1 1 auto; min-width: 0; }

/* ---------------------------------------------------------------- shell */

.brand { font-family: var(--font-head); font-weight: 700; font-size: 24px; letter-spacing: -0.02em; color: var(--ground); text-decoration: none; }
.brand span { color: var(--accent-light); }
.brand:hover { color: var(--ground); }
.brand--dark { color: var(--ink); }
.brand--dark span { color: var(--accent); }

.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.topbar { display: none; }
.sidenav { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 28px 20px; background: var(--ink); color: var(--ground); display: flex; flex-direction: column; gap: 22px; }
.sidenav__search input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid #3A3833; border-radius: var(--r); background: #2A2926; color: var(--ground); font: inherit; font-size: 14px; }
.sidenav__search input::placeholder { color: #A39B8B; }
.sidenav__links { display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.sidenav a:not(.brand) { color: #D9D3C5; text-decoration: none; padding: 11px 14px; border-radius: var(--r); min-height: 44px; display: flex; align-items: center; }
.sidenav a:not(.brand):hover { background: #2A2926; color: var(--ground); }
.sidenav a[aria-current="page"] { background: var(--ground); color: var(--ink); font-weight: 600; }
.sidenav__foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #B5AE9F; }
.sidenav__foot a:not(.brand) { padding: 8px 14px; min-height: 36px; }
.sidenav__foot .linkbtn { color: #D9D3C5; padding: 0; }

.main { padding: 28px 36px 48px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.bare { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; }
.bare__main { width: 100%; max-width: 420px; padding: 48px 16px; display: flex; flex-direction: column; gap: 18px; }
.auth h1 { font-size: 28px; }

/* ---------------------------------------------------------------- page head */

.page-head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; }
.page-head h1 { flex: 1 1 auto; }
.page-head--stack { align-items: flex-end; }
.page-head__main { flex: 1 1 auto; display: flex; flex-direction: column; gap: 6px; }
.page-head__main a { text-decoration: none; }
.page-head__meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 15px; color: var(--muted); }
.page-head__meta strong { color: var(--ink); }
.page-head__search input { width: 320px; max-width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); font: inherit; }

/* ---------------------------------------------------------------- buttons */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 44px; padding: 0 18px; border: 1px solid var(--ink); background: var(--surface); color: var(--ink); border-radius: var(--r); font: inherit; font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--ground); color: var(--ink); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn--quiet { border-color: var(--line-strong); background: var(--ground); font-weight: 500; }
.btn--danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn--danger:hover { background: #5C1010; border-color: #5C1010; color: #fff; }
.blocked { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.btn--warm { border-color: var(--accent); color: var(--accent-dark); }
.btn--sm { height: 36px; padding: 0 12px; font-size: 14px; border-radius: var(--r-sm); }
.btn--lg { height: 48px; font-size: 16px; border-radius: var(--r-md); }
.btn--xl { height: 56px; font-size: 17px; border-radius: var(--r-md); }
.btn--square { flex: 0 0 52px; width: 52px; height: 52px; padding: 0; font-size: 24px; border-color: var(--line-strong); background: var(--ground); border-radius: var(--r-md); }
.btn--light { background: var(--ground); border-color: var(--ground); color: var(--ink); }
.btn--ghost-dark { background: transparent; border-color: #5E5A52; color: var(--ground); }
.btn--ghost-dark:hover { background: #2A2926; color: var(--ground); }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; min-height: 32px; }
.iconbtn { width: 44px; height: 44px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); border: 0; background: none; border-radius: var(--r); cursor: pointer; font-size: 22px; }
.iconbtn:hover { background: var(--line-soft); color: var(--ink); }
.iconbtn--sm { width: 36px; height: 36px; font-size: 20px; color: var(--muted); }

/* ---------------------------------------------------------------- cards */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card--flush { padding: 0; gap: 0; overflow: hidden; }
.card__head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.card__head h2 { flex: 1 1 auto; }
.card__row { display: flex; align-items: center; gap: 8px; }
.card__row h2 { flex: 1 1 auto; }
.card--good { background: var(--good-bg); border-color: #BFD9C5; color: var(--good); }
fieldset.card { margin: 0; }
fieldset.card legend { padding: 0; float: left; width: 100%; margin-bottom: 4px; }
fieldset.card legend + * { clear: both; }
.empty { padding: 28px 20px; color: var(--muted); }
.count { font-weight: 400; font-size: 14px; }

.notice { padding: 12px 16px; border-radius: var(--r); font-weight: 500; }
.notice--good { background: var(--good-bg); color: var(--good); }
.notice--bad { background: var(--bad-bg); color: var(--bad); }
.notice--info { background: var(--info-bg); color: var(--info); }

/* ---------------------------------------------------------------- pills */

.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; background: var(--neutral-bg); color: var(--neutral); }
.pill--scouting, .pill--listed, .pill--plan-sell { background: var(--info-bg); color: var(--info); }
.pill--in_repair, .pill--bought, .pill--plan-repair { background: var(--warm-bg); color: var(--warm); }
.pill--sold { background: var(--good-bg); color: var(--good); }
.pill--passed { background: var(--bad-bg); color: var(--bad); }

/* ---------------------------------------------------------------- dashboard */

.stages { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.stages--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stage { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; color: var(--ink); text-decoration: none; }
a.stage:hover { border-color: var(--ink); color: var(--ink); }
.stage__label { font-size: 13px; color: var(--muted); font-weight: 500; }
.stage__count { font-family: var(--font-mono); font-size: 28px; font-weight: 500; }

.split { display: flex; gap: 20px; align-items: flex-start; }
.split > .card:first-child, .split > section:first-child { flex: 1 1 auto; }
.split__side { width: 340px; flex: 0 0 auto; display: flex; flex-direction: column; gap: 20px; }
.split--labels > aside { width: 400px; flex: 0 0 auto; position: sticky; top: 20px; }

.bignum { font-family: var(--font-mono); font-size: 36px; font-weight: 500; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar__label { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 4px; }
.bar__track { height: 8px; background: var(--line-soft); border-radius: 4px; }
.bar__fill { height: 8px; background: var(--ink); border-radius: 4px; min-width: 2px; }
.slow { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--warm-bg); border-radius: var(--r); }
.slow__text { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.slow__text .small { color: #6B3A1E; }

/* ---------------------------------------------------------------- tables */

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
select, input, textarea { font: inherit; color: var(--ink); }
.select--sm, .filters select, .filters input { height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); background: var(--ground); border-radius: var(--r-sm); font-size: 14px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { padding: 10px 12px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; text-align: left; border-bottom: 1px solid #EAE4D8; white-space: nowrap; }
.table td { padding: 8px 12px; height: 52px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table th.num, .table td.num { text-align: right; }
.table tbody tr:hover { background: #FBF9F5; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .col-check { width: 44px; padding-right: 0; }
.table input[type=checkbox], .label-panel input[type=checkbox], .card__head input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); vertical-align: middle; }
.rowlink { color: inherit; text-decoration: none; font-weight: 500; }
.rowlink:hover { color: var(--accent); text-decoration: underline; }
.table td.mono { font-size: 14px; white-space: nowrap; }
.table td .small.muted { white-space: nowrap; }
.codes summary { cursor: pointer; }
.nowrap { white-space: nowrap; }
.table--lot td:nth-child(2) { min-width: 200px; }
.codes a { display: inline-block; margin: 2px 6px 2px 0; }

/* ---------------------------------------------------------------- forms */

.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label, .field .label { font-size: 14px; font-weight: 500; color: var(--muted); }
.field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea, .pos__notes input {
  width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); font-size: 16px;
}
.field textarea { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); outline: 2px solid var(--ink); outline-offset: -1px; }
.field .static { min-height: 44px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.field--grow { flex: 1 1 260px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }

.narrow { width: 100%; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.narrow--form { max-width: 760px; }
.item-head { display: flex; align-items: center; gap: 10px; }
.item-head__text { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
.item-head h1 { font-size: 26px; }
.item-head a { text-decoration: none; }

.stepper { list-style: none; margin: 0; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); display: flex; justify-content: space-between; }
.stepper li { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.stepper__dot { width: 14px; height: 14px; border-radius: 999px; background: var(--surface); border: 2px solid #A39B8B; }
.stepper li.is-done, .stepper li.is-current { color: var(--ink); }
.stepper li.is-done .stepper__dot, .stepper li.is-current .stepper__dot { background: var(--ink); border-color: var(--ink); }
.stepper li.is-current { font-weight: 700; }
.stepper li.is-current .stepper__dot { box-shadow: 0 0 0 3px var(--accent-light); }

.kv { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 6px 12px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.notes { font-size: 14px; padding-top: 8px; border-top: 1px solid #EAE4D8; }
.ledger { margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.ledger > div { display: flex; justify-content: space-between; gap: 12px; }
.ledger dt { color: var(--muted); }
.ledger dd { margin: 0; white-space: nowrap; }
.ledger__total { padding-top: 6px; border-top: 1px solid #EAE4D8; font-weight: 600; }
.ledger__total dt, .ledger__profit dt { color: inherit; }
.ledger__profit { font-weight: 600; }
.meta { line-height: 1.6; }
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.actions__wide { grid-column: 1 / -1; }
.moves { display: flex; flex-wrap: wrap; gap: 8px; }
.moves__listed { display: flex; gap: 8px; }
.moves__listed input { width: 130px; height: 44px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r); }
.history summary { cursor: pointer; list-style: none; }
.history summary::-webkit-details-marker { display: none; }
.history summary h2::after { content: ' ▾'; color: var(--muted); font-weight: 400; }
.history ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.history li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- POS */

.pos__item { flex-direction: row; align-items: center; gap: 12px; padding: 14px; }
.pos__item > div:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pos__thumb { width: 72px; height: 72px; flex: 0 0 auto; border-radius: var(--r); background: var(--neutral-bg); display: flex; align-items: center; justify-content: center; font-family: var(--font-head); font-size: 28px; color: var(--muted); }
.pos__title { font-size: 17px; font-weight: 600; }
.pos__form { display: flex; flex-direction: column; gap: 14px; }
.stepper-input { display: flex; align-items: center; gap: 10px; }
.stepper-input__field { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 40px; font-weight: 500; min-width: 0; }
.stepper-input__field input { width: 100%; min-width: 0; border: 0; border-bottom: 2px solid var(--line-strong); text-align: center; font: inherit; background: transparent; padding: 0; }
.stepper-input__field input:focus { outline: none; border-bottom-color: var(--ink); }
.pos__summary { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; min-height: 20px; }
.pos__methods { border: 0; margin: 0; padding: 0; }
.pos__methods legend { padding: 0; margin-bottom: 8px; font-size: 14px; }
.toggle2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.toggle2__opt { position: relative; }
.toggle2__opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.toggle2__opt span { display: flex; align-items: center; justify-content: center; gap: 8px; height: 60px; border: 2px solid var(--line-strong); background: var(--surface); border-radius: var(--r-md); font-size: 17px; font-weight: 600; }
.toggle2__opt input:checked + span { border-color: var(--ink); background: var(--ink); color: #fff; }
.toggle2__opt input:checked + span::before { content: '✓'; }
.toggle2__opt input:focus-visible + span { outline: 3px solid var(--accent-light); outline-offset: 2px; }
.pos__notes summary { cursor: pointer; color: var(--muted); min-height: 32px; }
.pos__complete { height: 58px; font-size: 18px; font-weight: 700; border-radius: var(--r-lg); }

.done { align-items: center; text-align: center; padding-top: 48px; gap: 14px; }
.done__tick { width: 84px; height: 84px; border-radius: 999px; background: var(--good-bg); display: flex; align-items: center; justify-content: center; }
.done h1 { font-size: 30px; }
.done__meta { font-size: 16px; color: var(--muted); }
.done__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 8px; }

/* ---------------------------------------------------------------- lots */

.lot-meta { flex-direction: row; flex-wrap: wrap; gap: 14px; }
.lot-meta .field:not(.field--grow) { flex: 0 1 180px; }
.segmented { border: 1px solid var(--line-strong); border-radius: var(--r); display: flex; align-items: stretch; padding: 0; margin: 0; overflow: hidden; }
.segmented__label { align-self: center; padding: 0 10px; }
.segmented label { position: relative; display: flex; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: flex; align-items: center; height: 40px; padding: 0 14px; font-size: 14px; background: var(--surface); border-left: 1px solid var(--line-strong); }
.segmented input:checked + span { background: var(--ink); color: #fff; font-weight: 600; }
.segmented input:focus-visible + span { outline: 3px solid var(--accent-light); outline-offset: -3px; }
.table--form td { height: 56px; }
.table--form input, .table--form select { width: 100%; height: 40px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); font-size: 15px; }
.table--form input.num { text-align: right; }
.table--form td:nth-child(1) { min-width: 200px; }
.table--form td:nth-child(2) { min-width: 120px; }
.table--form td:nth-child(3) { width: 72px; }
.table--form td:nth-child(4), .table--form td:nth-child(5) { width: 120px; }
.table--form td:nth-child(8) { min-width: 100px; }
.table--form .manual-only { display: none; }
.table--form.is-manual .manual-only { display: table-cell; }
.table--form .specs-row td { height: auto; padding-top: 0; background: #FBF9F5; }
.specs-box { display: flex; flex-direction: column; gap: 8px; padding: 10px 0 14px; }
.specs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px 12px; }
.specs-grid .field label { font-size: 13px; }
.table--form .specs-grid input, .table--form .specs-grid select { height: 40px; }
.recon { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 16px 20px; background: var(--ground); border-top: 1px solid var(--line); font-weight: 600; color: var(--muted); }
.recon__text { flex: 1 1 auto; }
.recon__note { font-weight: 400; }
.recon--ok { background: var(--good-bg); border-top-color: #BFD9C5; color: var(--good); }
.recon--bad { background: var(--bad-bg); border-top-color: #E6BDBD; color: var(--bad); }
.recon__icon::before { content: '•'; }
.recon--ok .recon__icon::before { content: '✓'; }
.recon--bad .recon__icon::before { content: '✗'; }

/* ---------------------------------------------------------------- labels */

.label-panel { gap: 16px; }
.label-panel .form { gap: 18px; }
.sheet-grid { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 4px; padding: 10px; background: var(--ground); border-radius: var(--r); }
.sheet-grid__cell { height: 24px; border-radius: 3px; border: 1px solid var(--line-strong); background: var(--surface); padding: 0; cursor: pointer; }
.sheet-grid__cell.is-used { background: var(--line-strong); }
.sheet-grid__cell.is-print { background: var(--ink); border-color: var(--ink); }
.sheet-grid__cell[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 1px; }
.legend { display: flex; gap: 14px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }
.sw--used { background: var(--line-strong); }
.sw--print { background: var(--ink); }
.sw--free { background: var(--surface); border: 1px solid var(--line-strong); }
.label-preview { display: flex; gap: 14px; align-items: center; padding: 14px; border: 1px dashed #A39B8B; border-radius: var(--r-sm); }
.label-preview__qr { width: 92px; height: 92px; flex: 0 0 auto; }
.label-preview__qr svg { width: 100%; height: 100%; display: block; }
.label-preview__text { display: flex; flex-direction: column; gap: 4px; font-size: 14px; min-width: 0; }
.label-preview__code { font-size: 18px; font-weight: 500; }
.label-panel__go { display: flex; flex-direction: column; gap: 8px; align-items: stretch; text-align: center; }
.label-panel details summary { cursor: pointer; min-height: 32px; }
.label-panel details[open] { display: flex; flex-direction: column; gap: 10px; }

/* ---------------------------------------------------------------- scanner */

.scanner { width: min(520px, 100vw); max-width: 100vw; max-height: 100vh; padding: 16px; border: 0; border-radius: var(--r-lg); background: var(--ink); color: var(--ground); }
.scanner::backdrop { background: rgba(28, 27, 25, 0.7); }
.scanner__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.scanner__head h2 { font-size: 20px; }
.scanner__view { position: relative; aspect-ratio: 1 / 1; background: #000; border-radius: var(--r-md); overflow: hidden; }
.scanner__view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner__frame { position: absolute; inset: 18%; border: 3px solid var(--accent-light); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.25); }
.scanner.is-nocam .scanner__view { display: none; }
.scanner__status { margin: 12px 0; font-size: 14px; color: #D9D3C5; min-height: 20px; }
.scanner__manual label { display: block; font-size: 13px; color: #B5AE9F; margin-bottom: 6px; }
.scanner__manual input { height: 48px; padding: 0 12px; border: 1px solid #5E5A52; border-radius: var(--r); background: #2A2926; color: var(--ground); font-family: var(--font-mono); font-size: 18px; }
.scan-page .btn--xl { width: 100%; }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1200px) {
  .split { flex-direction: column; align-items: stretch; }
  .split__side, .split--labels > aside { width: auto; position: static; }
  .split__side { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
}

@media (max-width: 960px) {
  .app { display: block; }
  .topbar { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 20; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--ink); }
  .topbar .brand { flex: 1 1 auto; font-size: 21px; }
  .sidenav { display: none; position: fixed; inset: 56px 0 0 0; height: auto; z-index: 19; padding: 16px; }
  .sidenav > .brand { display: none; }
  .nav-open .sidenav { display: flex; }
  .main { padding: 16px 16px 40px; gap: 16px; }
  h1 { font-size: 28px; }
  .stages { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stage { padding: 10px 12px; }
  .stage__count { font-size: 22px; }
  .page-head__search { flex: 1 1 100%; order: 3; }
  .page-head__search input { width: 100%; }
}

@media (max-width: 700px) {
  .hide-sm { display: none; }
  .table td, .table th { padding-left: 8px; padding-right: 8px; }
  .table th:first-child, .table td:first-child { padding-left: 12px; }
  .table th:last-child, .table td:last-child { padding-right: 12px; }
  .card__head { padding: 12px; }
  .card { padding: 14px; }
  .card--flush { padding: 0; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .stages--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stages--3 .stage__count { font-size: 18px; }
  .item-head h1 { font-size: 24px; }
  .page-head .btn { flex: 1 1 auto; }
  .recon__note { display: none; }
  .table--form { font-size: 14px; }
}
