/* Low Price Auto Glass - Glass Inventory. Phone first, high contrast for a bright shop. */
:root {
  --brand: #0b3f78;
  --brand-2: #1260b0;
  --brand-soft: #e6f0fb;
  --glass: #9fdcf0;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #5b6b80;
  --line: #d9e1ec;
  --line-2: #c3cfdd;
  --bg: #eef2f7;
  --card: #ffffff;
  --in: #137a3a;
  --in-strong: #0f6a31;
  --in-bg: #dcf5e4;
  --out: #c0262d;
  --out-strong: #a51f25;
  --out-bg: #fde4e4;
  --move: #6b3fb5;
  --move-bg: #efe7fb;
  --adj: #a15c07;
  --adj-bg: #fdf0d8;
  --undo: #475569;
  --undo-bg: #e7ecf2;
  --warn: #9a5b00;
  --warn-bg: #fff4d6;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 14px rgba(15, 23, 42, .06);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, .25);
  --tap: 52px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 17px; line-height: 1.4; color: var(--ink); background: var(--bg);
  min-height: 100vh; -webkit-tap-highlight-color: transparent;
}
body.has-bottomnav { padding-bottom: calc(72px + var(--safe-b)); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
a { color: var(--brand-2); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot { padding: 3rem 1rem; text-align: center; color: var(--muted); }
.noscript { padding: 2rem; text-align: center; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .75rem;
  padding: calc(.5rem + env(safe-area-inset-top, 0px)) 1rem .5rem; background: var(--brand); color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
}
.brand { display: flex; align-items: center; gap: .55rem; color: #fff; text-decoration: none; min-width: 0; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-text { font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .01em; }
.brand-text strong { font-weight: 800; }
.topnav { display: none; gap: .25rem; margin-left: 1rem; }
.topnav a {
  color: #dbe8f7; text-decoration: none; font-weight: 600; padding: .55rem .9rem; border-radius: 999px; font-size: .95rem;
}
.topnav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.topnav a.active { background: #fff; color: var(--brand); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.icon-btn {
  appearance: none; border: 0; background: rgba(255, 255, 255, .12); color: #fff; border-radius: 999px;
  min-height: 40px; padding: 0 .9rem; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
}
.net-pill { font-size: .78rem; font-weight: 700; padding: .3rem .6rem; border-radius: 999px; background: var(--warn-bg); color: var(--warn); }
.net-pill.bad { background: #fff; color: var(--out); }

/* ---------- bottom nav (phone) ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr);
  background: #fff; border-top: 1px solid var(--line); padding-bottom: var(--safe-b);
  box-shadow: 0 -4px 16px rgba(15, 23, 42, .06);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 64px;
  color: var(--muted); text-decoration: none; font-size: .78rem; font-weight: 700;
}
.bottomnav a svg { width: 26px; height: 26px; }
.bottomnav a.active { color: var(--brand); }
.bottomnav a.active svg { stroke: var(--brand); }

@media (min-width: 900px) {
  .topnav { display: flex; }
  .bottomnav { display: none !important; }
  body.has-bottomnav { padding-bottom: 0; }
}

/* ---------- layout ---------- */
main { display: block; outline: none; }
.page { max-width: 1280px; margin: 0 auto; padding: 1rem; }
.page.narrow { max-width: 720px; }
.page-head { display: flex; align-items: flex-end; gap: .75rem; flex-wrap: wrap; margin: .25rem 0 1rem; }
.page-head h1 { margin: 0; }
.page-head .grow { flex: 1 1 260px; min-width: 0; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; }
.card + .card { margin-top: 1rem; }
.stack > * + * { margin-top: .75rem; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.grow { flex: 1; min-width: 0; }
.grid-2 { display: grid; gap: .75rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* ---------- buttons ---------- */
.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: var(--tap);
  padding: 0 1.15rem; border-radius: var(--radius-sm); border: 2px solid transparent; font: inherit; font-weight: 700;
  font-size: 1rem; cursor: pointer; text-decoration: none; background: var(--brand-2); color: #fff; white-space: nowrap;
  transition: transform .05s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn.secondary { background: #fff; color: var(--brand); border-color: var(--line-2); }
.btn.ghost { background: transparent; color: var(--brand-2); border-color: transparent; }
.btn.danger { background: var(--out); }
.btn.success { background: var(--in); }
.btn.warn { background: var(--adj); }
.btn.big { min-height: 64px; font-size: 1.15rem; padding: 0 1.4rem; }
.btn.block { width: 100%; }
.btn.sm { min-height: 40px; padding: 0 .8rem; font-size: .9rem; }
.btn:focus-visible, .seg button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #f59e0b; outline-offset: 2px;
}

/* ---------- forms ---------- */
label.field { display: block; }
label.field > span.lbl { display: block; font-weight: 700; font-size: .92rem; margin-bottom: .3rem; color: var(--ink-2); }
input[type=text], input[type=password], input[type=number], input[type=search], input[type=date], input:not([type]), select, textarea {
  width: 100%; min-height: var(--tap); padding: .6rem .8rem; font: inherit; font-size: 1.05rem; color: var(--ink);
  background: #fff; border: 2px solid var(--line-2); border-radius: var(--radius-sm);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); outline: none; }
.hint { font-size: .85rem; color: var(--muted); margin-top: .3rem; }
.auto-tag {
  display: inline-block; font-size: .75rem; font-weight: 800; color: var(--warn); background: var(--warn-bg); border-radius: 6px;
  padding: .1rem .45rem; margin-left: .35rem; vertical-align: middle; text-transform: uppercase; letter-spacing: .02em;
}
.form-error { color: var(--out-strong); background: var(--out-bg); border-radius: var(--radius-sm); padding: .6rem .8rem; font-weight: 600; }
.checkbox { display: flex; gap: .6rem; align-items: center; min-height: 44px; font-weight: 600; }
.checkbox input { width: 24px; height: 24px; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .3rem; font-weight: 800; font-size: .8rem; letter-spacing: .02em;
  border-radius: 999px; padding: .22rem .6rem; white-space: nowrap; background: var(--undo-bg); color: var(--undo);
}
.badge.yes, .badge.IN { background: var(--in-bg); color: var(--in-strong); }
.badge.no, .badge.OUT { background: var(--out-bg); color: var(--out-strong); }
.badge.low, .badge.ADJUST { background: var(--adj-bg); color: var(--adj); }
.badge.MOVE { background: var(--move-bg); color: var(--move); }
.badge.UNDO { background: var(--undo-bg); color: var(--undo); }
.badge.sample { background: #ede9fe; color: #5b21b6; }
.badge.type { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.badge.inactive { background: #e5e7eb; color: #4b5563; }
.qty-pill {
  display: inline-flex; align-items: center; justify-content: center; min-width: 2.6rem; height: 2.2rem; padding: 0 .6rem;
  font-weight: 900; font-size: 1.15rem; border-radius: 10px; background: var(--in-bg); color: var(--in-strong);
}
.qty-pill.zero { background: var(--out-bg); color: var(--out-strong); }
.qty-pill.low { background: var(--adj-bg); color: var(--adj); }

/* ---------- scan screen ---------- */
.scan-page { max-width: 760px; margin: 0 auto; padding: .75rem .75rem 1rem; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.seg button {
  appearance: none; min-height: 68px; border-radius: var(--radius); border: 3px solid var(--line-2); background: #fff;
  font: inherit; font-weight: 900; font-size: 1.25rem; letter-spacing: .03em; color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: .5rem;
}
.seg button svg { width: 26px; height: 26px; flex: none; }
.seg button { white-space: nowrap; padding: 0 .4rem; }
@media (max-width: 420px) { .seg button { font-size: 1.08rem; gap: .3rem; letter-spacing: .01em; } .seg button svg { width: 22px; height: 22px; } }
.vf-overlay > svg { width: 44px; height: 44px; opacity: .85; }
.seg button.in.on { background: var(--in); border-color: var(--in); color: #fff; box-shadow: 0 6px 16px rgba(19, 122, 58, .35); }
.seg button.out.on { background: var(--out); border-color: var(--out); color: #fff; box-shadow: 0 6px 16px rgba(192, 38, 45, .35); }
.seg button.in:not(.on) { color: var(--in); border-color: #a8dcb9; }
.seg button.out:not(.on) { color: var(--out); border-color: #f2b4b6; }

.who {
  margin-top: .6rem; display: flex; align-items: center; gap: .75rem; padding: .7rem .9rem; border-radius: var(--radius);
  background: #fff; border: 2px solid var(--line);
}
.who .avatar {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 1.1rem;
  background: var(--brand-soft); color: var(--brand); flex: none;
}
.who .name { font-size: 1.25rem; font-weight: 900; }
.who .sub { font-size: .85rem; color: var(--muted); }
.who.none { background: var(--warn-bg); border-color: #f3d27a; }
.who.none .avatar { background: #fff; color: var(--warn); }
.who.none .name { color: var(--warn); font-size: 1.1rem; }
.who.none { flex-wrap: wrap; }
.who.none .grow { flex: 1 1 0; min-width: 0; }
.who.none .btn { flex: 1 1 100%; min-height: 52px; font-size: 1.1rem; }
@media (min-width: 700px) { .who.none .btn { flex: 0 0 auto; padding-inline: 1.4rem; } }

/* "Who are you?" name picker */
.name-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .5rem; max-height: 55vh; overflow: auto; }
.name-btn {
  display: flex; align-items: center; gap: .65rem; min-height: 56px; padding: .5rem .75rem; text-align: left;
  border: 2px solid var(--line); border-radius: var(--radius-sm); background: #fff; font: inherit; font-weight: 800; font-size: 1.05rem; cursor: pointer;
}
.name-btn:hover, .name-btn:focus-visible { border-color: var(--brand); }
.name-btn .avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--brand-soft); color: var(--brand); font-weight: 900;
}

.viewfinder {
  position: relative; margin-top: .6rem; border-radius: var(--radius); overflow: hidden; background: #0b1220;
  aspect-ratio: 4 / 3; border: 4px solid var(--line-2); max-height: 56vh; width: 100%;
}
.mode-in .viewfinder { border-color: var(--in); }
.mode-out .viewfinder { border-color: var(--out); }
@media (max-width: 600px) { .viewfinder { aspect-ratio: 16 / 11; } }
.more-filters > summary {
  list-style: none; cursor: pointer; font-weight: 800; color: var(--brand); padding: .5rem 0; min-height: 44px; display: flex; align-items: center; gap: .4rem;
}
.more-filters > summary::-webkit-details-marker { display: none; }
.more-filters > summary::after { content: "▾"; }
.more-filters[open] > summary::after { content: "▴"; }
.viewfinder video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.viewfinder .aim {
  position: absolute; left: 7%; right: 7%; top: 22%; bottom: 22%; border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .28);
}
.viewfinder .aim::before, .viewfinder .aim::after {
  content: ""; position: absolute; inset: 0; border-radius: 12px; border: 3px solid rgba(255, 255, 255, .9);
  -webkit-mask: linear-gradient(#000 0 0) top left / 26px 26px no-repeat, linear-gradient(#000 0 0) top right / 26px 26px no-repeat,
    linear-gradient(#000 0 0) bottom left / 26px 26px no-repeat, linear-gradient(#000 0 0) bottom right / 26px 26px no-repeat;
  mask: linear-gradient(#000 0 0) top left / 26px 26px no-repeat, linear-gradient(#000 0 0) top right / 26px 26px no-repeat,
    linear-gradient(#000 0 0) bottom left / 26px 26px no-repeat, linear-gradient(#000 0 0) bottom right / 26px 26px no-repeat;
}
.viewfinder .aim::after { -webkit-mask: none; mask: none; border: 0; top: 50%; bottom: auto; height: 2px; background: rgba(255, 60, 60, .85); animation: scanline 1.8s ease-in-out infinite; }
@keyframes scanline { 0%, 100% { transform: translateY(-40px); opacity: .4; } 50% { transform: translateY(40px); opacity: 1; } }
.viewfinder.paused .aim::after { animation: none; opacity: 0; }
.viewfinder .vf-hint {
  position: absolute; left: .6rem; right: .6rem; bottom: .6rem; text-align: center; color: #fff; font-weight: 700;
  font-size: .95rem; text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
}
.viewfinder .vf-hint.alert { background: rgba(154, 91, 0, .92); border-radius: 10px; padding: .45rem .6rem; text-shadow: none; }
.viewfinder .vf-tools { position: absolute; top: .5rem; right: .5rem; display: flex; gap: .4rem; }
.vf-btn {
  appearance: none; border: 0; min-width: 48px; height: 48px; border-radius: 999px; background: rgba(15, 23, 42, .65); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: .3rem; padding: 0 .8rem; font: inherit; font-weight: 800; font-size: .85rem; cursor: pointer;
}
.vf-btn.on { background: #fbbf24; color: #111827; }
.vf-btn svg { width: 22px; height: 22px; }
.vf-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .8rem;
  color: #fff; text-align: center; padding: 1.2rem; background: rgba(11, 18, 32, .92);
}
.vf-overlay p { max-width: 30rem; margin: 0; }
.vf-overlay ol { text-align: left; margin: 0; padding-left: 1.2rem; max-width: 30rem; }
.vf-overlay .btn.secondary { background: #fff; }

.scan-tools { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .6rem; }
.scan-tools .btn { min-height: 56px; }
.in-options { margin-top: .6rem; display: grid; grid-template-columns: auto 1fr; gap: .5rem .75rem; align-items: center; }
.in-options .lbl { font-weight: 800; font-size: .9rem; color: var(--ink-2); }
.stepper { display: inline-flex; align-items: center; border: 2px solid var(--line-2); border-radius: var(--radius-sm); background: #fff; overflow: hidden; }
.stepper button { appearance: none; border: 0; background: var(--brand-soft); color: var(--brand); width: 52px; height: 52px; font-size: 1.6rem; font-weight: 900; cursor: pointer; }
.stepper input { width: 64px; min-height: 52px; border: 0; border-radius: 0; text-align: center; font-weight: 900; font-size: 1.25rem; padding: 0; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.result {
  margin-top: .75rem; border-radius: var(--radius); padding: 1rem; border: 3px solid var(--line); background: #fff;
}
.result.ok-IN { border-color: var(--in); background: var(--in-bg); }
.result.ok-OUT { border-color: var(--out); background: var(--out-bg); }
.result.ok-UNDO, .result.ok-MOVE, .result.ok-ADJUST { border-color: var(--undo); background: var(--undo-bg); }
.result.err { border-color: var(--out); background: #fff; }
.result.queued { border-color: #e0a800; background: var(--warn-bg); }
.result .r-title { font-size: 1.3rem; font-weight: 900; }
.result .r-part { font-size: 1.45rem; font-weight: 900; font-family: var(--mono); letter-spacing: .02em; }
.result .r-desc { font-size: 1.05rem; font-weight: 600; margin: .15rem 0 .35rem; }
.result .r-meta { color: var(--ink-2); font-size: .95rem; }
.result .r-qty { font-size: 1.1rem; font-weight: 800; margin-top: .4rem; }
.result .r-actions { display: flex; gap: .5rem; margin-top: .75rem; flex-wrap: wrap; }

.outbox {
  margin-top: .75rem; display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: .92rem; padding: .6rem .8rem;
  border-radius: var(--radius-sm); background: #fff; border: 1px solid var(--line);
}
.outbox .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--in); flex: none; }
.outbox.waiting .dot { background: #e0a800; animation: pulse 1s infinite; }
.outbox.problem { background: var(--out-bg); border-color: #f2b4b6; color: var(--out-strong); }
.outbox.problem .dot { background: var(--out); }
@keyframes pulse { 50% { opacity: .35; } }

/* big confirmation flash */
.flash {
  position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; color: #fff; padding: 2rem; pointer-events: none; animation: flashIn .12s ease-out;
}
.flash.IN { background: rgba(19, 122, 58, .94); }
.flash.OUT { background: rgba(192, 38, 45, .94); }
.flash.HELLO { background: rgba(11, 63, 120, .95); }
.flash.UNDO, .flash.MOVE, .flash.ADJUST { background: rgba(51, 65, 85, .95); }
.flash.ERR { background: rgba(154, 91, 0, .96); }
.flash .f-icon svg { width: 96px; height: 96px; }
.flash .f-big { font-size: 2.3rem; font-weight: 900; letter-spacing: .02em; margin-top: .4rem; }
.flash .f-mid { font-size: 1.5rem; font-weight: 800; margin-top: .4rem; font-family: var(--mono); }
.flash .f-small { font-size: 1.15rem; font-weight: 600; margin-top: .4rem; max-width: 34rem; }
@keyframes flashIn { from { opacity: 0; transform: scale(1.03); } to { opacity: 1; transform: none; } }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + var(--safe-b)); z-index: 90; display: flex; flex-direction: column; gap: .5rem; width: min(92vw, 520px); pointer-events: none; }
@media (min-width: 900px) { .toasts { bottom: 1.5rem; } }
.toast { background: #0f172a; color: #fff; border-radius: 12px; padding: .8rem 1rem; font-weight: 700; box-shadow: var(--shadow-lg); pointer-events: auto; }
.toast.ok { background: var(--in-strong); }
.toast.err { background: var(--out-strong); }
.toast.warn { background: #7c4a03; }

/* ---------- modal / sheet ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 70; background: rgba(15, 23, 42, .55); display: flex; align-items: flex-end; justify-content: center;
  animation: fade .15s ease-out;
}
@media (min-width: 700px) { .modal-back { align-items: center; padding: 1rem; } }
.modal {
  background: #fff; width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0;
  box-shadow: var(--shadow-lg); padding: 1.1rem 1.1rem calc(1.1rem + var(--safe-b)); animation: up .18s ease-out;
}
.modal.wide { max-width: 980px; }
@media (min-width: 700px) { .modal { border-radius: 18px; } }
.modal-head { display: flex; align-items: flex-start; gap: .75rem; margin-bottom: .75rem; }
.modal-head h2 { margin: 0; flex: 1; font-size: 1.3rem; }
.modal-close { appearance: none; border: 0; background: var(--bg); width: 44px; height: 44px; border-radius: 50%; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--ink-2); flex: none; }
.modal-foot { display: flex; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }
.modal-foot .btn { flex: 1; }
.sheet-banner { border-radius: var(--radius-sm); padding: .7rem .9rem; font-weight: 800; margin-bottom: .8rem; }
.sheet-banner.IN { background: var(--in-bg); color: var(--in-strong); }
.sheet-banner.OUT { background: var(--out-bg); color: var(--out-strong); }
.sheet-banner.warn { background: var(--warn-bg); color: var(--warn); }
.part-hero { background: var(--bg); border-radius: var(--radius-sm); padding: .8rem .9rem; margin-bottom: .8rem; }
.part-hero .pn { font-family: var(--mono); font-weight: 900; font-size: 1.4rem; }
.part-hero .desc { font-weight: 700; font-size: 1.05rem; }
.choice-list { display: grid; gap: .5rem; }
.choice {
  appearance: none; text-align: left; width: 100%; border: 2px solid var(--line-2); background: #fff; border-radius: var(--radius-sm);
  padding: .8rem .9rem; font: inherit; cursor: pointer; display: flex; align-items: center; gap: .75rem; min-height: 64px;
}
.choice:hover { border-color: var(--brand-2); }
.choice .c-main { flex: 1; font-weight: 700; }
.choice .c-sub { color: var(--muted); font-size: .88rem; font-weight: 600; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: .5; } }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; margin-bottom: 1rem; }
@media (min-width: 800px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
  appearance: none; text-align: left; font: inherit; cursor: pointer; background: #fff; border: 2px solid var(--line); border-radius: var(--radius);
  padding: .85rem 1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .15rem; color: var(--ink);
}
.stat .s-num { font-size: 1.9rem; font-weight: 900; line-height: 1; }
.stat .s-lbl { font-weight: 700; color: var(--muted); font-size: .88rem; }
.stat.active { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(18, 96, 176, .2); }
.stat.green .s-num { color: var(--in); }
.stat.red .s-num { color: var(--out); }
.stat.amber .s-num { color: var(--adj); }

/* ---------- filters ---------- */
.filters { display: grid; gap: .5rem; grid-template-columns: 1fr; margin-bottom: .75rem; }
.filters .search { position: relative; }
.filters .search input { padding-left: 2.6rem; }
.filters .search svg { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; stroke: var(--muted); }
.filter-row { display: grid; gap: .5rem; grid-template-columns: 1fr 1fr; }
@media (min-width: 800px) { .filter-row { grid-template-columns: repeat(4, 1fr); } .filter-row.five { grid-template-columns: repeat(5, 1fr); } }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { appearance: none; border: 2px solid var(--line-2); background: #fff; border-radius: 999px; padding: .4rem .85rem; font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; min-height: 40px; color: var(--ink-2); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.result-count { color: var(--muted); font-weight: 700; font-size: .9rem; margin: .25rem 0 .5rem; }

/* ---------- data tables (become cards on phones) ---------- */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table.data { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.data th {
  text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #f7f9fc;
  padding: .7rem .75rem; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0;
}
table.data th button { appearance: none; border: 0; background: none; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; padding: 0; display: inline-flex; gap: .25rem; align-items: center; }
table.data th button.sorted { color: var(--brand); }
table.data td { padding: .7rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover { background: #f7faff; }
table.data .pn { font-family: var(--mono); font-weight: 800; font-size: 1rem; white-space: nowrap; }
table.data .desc { font-weight: 600; min-width: 220px; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.undone td { color: var(--muted); }
tr.undone .pn, tr.undone .desc { text-decoration: line-through; text-decoration-thickness: 2px; }
.loc-btn {
  appearance: none; border: 2px dashed var(--line-2); background: #fff; border-radius: 8px; padding: .3rem .6rem; font: inherit;
  font-weight: 700; color: var(--ink-2); cursor: pointer; min-height: 40px; display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap;
}
.loc-btn:hover { border-color: var(--brand-2); color: var(--brand); }
.loc-btn svg { width: 16px; height: 16px; }
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 1.1rem; margin-bottom: .3rem; }
.load-more { display: flex; justify-content: center; padding: 1rem; }

@media (max-width: 899px) {
  table.data.cards thead { display: none; }
  table.data.cards, table.data.cards tbody { display: block; }
  table.data.cards tr {
    display: grid; grid-template-columns: 1fr auto; gap: .2rem .75rem; padding: .85rem .9rem; border-bottom: 1px solid var(--line);
  }
  table.data.cards td { display: block; padding: 0; border: 0; }
  table.data.cards td.c-hide { display: none; }
  table.data.cards td[data-c="pn"] { grid-column: 1; }
  table.data.cards td[data-c="qty"] { grid-column: 2; grid-row: 1 / span 2; text-align: right; align-self: center; }
  table.data.cards td[data-c="desc"] { grid-column: 1; min-width: 0; }
  table.data.cards td[data-c="meta"] { grid-column: 1 / -1; display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; color: var(--ink-2); font-size: .9rem; }
  table.data.cards td[data-c="when"] { grid-column: 1 / -1; color: var(--muted); font-size: .85rem; font-weight: 700; }
  table.data.cards td[data-c="loc"] { grid-column: 1 / -1; margin-top: .25rem; }
  table.data.cards td[data-c="act"] { grid-column: 2; grid-row: 1; text-align: right; }
}
@media (min-width: 900px) {
  td[data-c="meta"] .m-only, td[data-c="when"] .m-only { display: none; }
  .d-hide { display: none; }
}
@media (max-width: 899px) { .m-hide { display: none !important; } }

/* ---------- menu tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
@media (min-width: 800px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile {
  display: flex; flex-direction: column; gap: .45rem; padding: 1rem; min-height: 120px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: var(--ink); font-weight: 800;
}
.tile svg { width: 32px; height: 32px; stroke: var(--brand-2); }
.tile .t-sub { font-weight: 600; color: var(--muted); font-size: .85rem; }
.tile.locked { opacity: .55; }

/* ---------- lists ---------- */
.list { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.list-item { display: flex; align-items: center; gap: .75rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); min-height: 60px; }
.list-item:last-child { border-bottom: 0; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 800; }
.list-item .li-sub { color: var(--muted); font-size: .88rem; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; background: linear-gradient(160deg, #0b3f78 0%, #1260b0 55%, #3a8fd6 100%); }
.login-card { width: 100%; max-width: 420px; background: #fff; border-radius: 20px; padding: 1.6rem 1.4rem; box-shadow: var(--shadow-lg); }
.login-brand { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.2rem; }
.login-brand svg { width: 52px; height: 52px; background: var(--brand); border-radius: 14px; padding: 6px; }
.login-brand .lb-name { font-weight: 900; font-size: 1.25rem; line-height: 1.1; }
.login-brand .lb-sub { color: var(--muted); font-weight: 600; font-size: .9rem; }

/* ---------- part detail ---------- */
.kv { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; font-size: .95rem; }
.kv dt { color: var(--muted); font-weight: 700; }
.kv dd { margin: 0; font-weight: 600; }
.mini-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.mini-table th, .mini-table td { text-align: left; padding: .45rem .4rem; border-bottom: 1px solid var(--line); }
.mini-table th { color: var(--muted); font-size: .75rem; text-transform: uppercase; }
.section-title { margin: 1.1rem 0 .5rem; font-size: 1rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

/* ---------- help ---------- */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { position: relative; padding: .2rem 0 .9rem 3.2rem; }
.steps li::before {
  counter-increment: step; content: counter(step); position: absolute; left: 0; top: 0; width: 2.3rem; height: 2.3rem; border-radius: 50%;
  background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 900;
}

/* ---------- labels (print sheets) ---------- */
.label-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(3.375in, 1fr)); gap: .25in; }
.badge-card {
  width: 3.375in; height: 2.125in; border: 1px solid #9aa5b4; border-radius: .12in; padding: .12in .16in; background: #fff;
  display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto 1fr; column-gap: .1in; break-inside: avoid; overflow: hidden;
}
.badge-card .bc-shop { grid-column: 1 / -1; font-size: 8pt; font-weight: 800; color: var(--brand); text-transform: uppercase; letter-spacing: .06em; }
.badge-card .bc-name { grid-column: 1; font-size: 15pt; font-weight: 900; line-height: 1.05; margin-top: .04in; overflow-wrap: anywhere; }
.badge-card .bc-qr { grid-column: 2; grid-row: 2 / span 2; width: .95in; height: .95in; align-self: start; margin-top: .04in; }
.badge-card .bc-bar { grid-column: 1; align-self: end; width: 100%; height: .62in; object-fit: contain; object-position: left bottom; }
.badge-card .bc-id { grid-column: 1; font-family: var(--mono); font-size: 8pt; font-weight: 700; }
.shelf-label {
  width: 3.375in; min-height: 1.6in; border: 1px solid #9aa5b4; border-radius: .08in; padding: .1in .14in; background: #fff; break-inside: avoid;
  display: flex; flex-direction: column; gap: .04in;
}
.shelf-label .sl-kind { font-size: 7.5pt; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.shelf-label .sl-title { font-size: 16pt; font-weight: 900; font-family: var(--mono); line-height: 1.05; }
.shelf-label .sl-desc { font-size: 8.5pt; font-weight: 600; line-height: 1.2; }
.shelf-label .sl-codes { display: flex; align-items: center; gap: .1in; }
.shelf-label .sl-bar { flex: 1; min-width: 0; height: .75in; object-fit: contain; object-position: left center; }
.shelf-label .sl-qr { width: .8in; height: .8in; flex: none; }
.shelf-label.cmd-in { border: 3px solid var(--in); }
.shelf-label.cmd-out { border: 3px solid var(--out); }
.shelf-label.cmd-in .sl-title { color: var(--in); }
.shelf-label.cmd-out .sl-title { color: var(--out); }
.pick-list { max-height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.pick-list label { display: flex; gap: .6rem; align-items: center; padding: .55rem .75rem; border-bottom: 1px solid var(--line); min-height: 48px; font-weight: 600; }
.pick-list input { width: 22px; height: 22px; }

/* ---------- import preview ---------- */
.import-table td.err { color: var(--out-strong); font-weight: 700; }
.status-new { color: var(--in-strong); font-weight: 800; }
.status-error { color: var(--out-strong); font-weight: 800; }

/* ---------- print ---------- */
.print-only { display: none; }
@media print {
  @page { margin: .4in; }
  body { background: #fff; padding: 0 !important; font-size: 10pt; }
  .topbar, .bottomnav, .toasts, .no-print, .filters, .stats button, .load-more, .page-head .actions, .loc-btn svg { display: none !important; }
  .print-only { display: block; }
  .page { max-width: none; padding: 0; }
  .table-wrap, .card { box-shadow: none; border: 0; }
  table.data { font-size: 8.5pt; }
  table.data th { position: static; background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.data td, table.data th { padding: .25rem .35rem; }
  table.data.cards thead { display: table-header-group !important; }
  table.data.cards, table.data.cards tbody { display: table-row-group; }
  table.data.cards tr { display: table-row !important; }
  table.data.cards td, table.data.cards td.c-hide { display: table-cell !important; }
  .d-hide, .m-only { display: none !important; }
  .loc-btn { border: 0; padding: 0; min-height: 0; }
  .badge, .qty-pill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .label-sheet { gap: .15in; }
  .badge-card, .shelf-label { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
