/* Sales Matrix count app. Tokens from the Sales Matrix design system (design spec 2.2–2.4).
   Built for older, non-technical users: big text, big targets, one main action per screen. */

@font-face { font-family: "Noto Sans Thai"; font-weight: 400; font-display: swap; src: url("../fonts/noto-sans-thai-thai-400-normal.woff2") format("woff2"); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Noto Sans Thai"; font-weight: 600; font-display: swap; src: url("../fonts/noto-sans-thai-thai-600-normal.woff2") format("woff2"); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Noto Sans Thai"; font-weight: 700; font-display: swap; src: url("../fonts/noto-sans-thai-thai-700-normal.woff2") format("woff2"); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Noto Sans Thai"; font-weight: 400; font-display: swap; src: url("../fonts/noto-sans-thai-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Noto Sans Thai"; font-weight: 600; font-display: swap; src: url("../fonts/noto-sans-thai-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Noto Sans Thai"; font-weight: 700; font-display: swap; src: url("../fonts/noto-sans-thai-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --primary: #cc4c02;
  --primary-pressed: #a13c0b;
  --brand-soft: #fff8ec;
  --ink: #1a1a2e;
  --body: #3f4254;
  --muted: #5e6278;
  --bg: #f4f5f7;
  --card: #ffffff;
  --line: #e1e3ea;
  --line-strong: #c4c8d4;
  --dash: #dbdfe9;
  --gray-soft: #f1f1f2;
  --success: #27a96a;
  --success-text: #1f7a4d;
  --success-soft: #e8f8f0;
  --warning-text: #a13c0b;
  --warning-soft: #fff8f0;
  --danger: #c42b3a;
  --danger-icon: #dc3545;
  --danger-soft: #fff5f8;
  --info-text: #0b5fcc;
  --info-soft: #eef6ff;
  --unit-accent: #ffc26d;
  --radius: 16px;
  --radius-sm: 12px;
  --focus: 0 0 0 3px #fff, 0 0 0 6px #0b5fcc;
  --ease: cubic-bezier(.4, 0, .2, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink);
  font-family: "Noto Sans Thai", system-ui, sans-serif; font-size: 19px; line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
}
h1, h2 { margin: 0; line-height: 1.3; color: var(--ink); }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 24px; font-weight: 700; }
p { margin: 0; }
b, strong { font-weight: 700; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
.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; }
.num { font-variant-numeric: tabular-nums; letter-spacing: .5px; }
.center { text-align: center; }
.hint { font-size: 16px; color: var(--muted); }
.lead { font-size: 20px; }
.noscript { padding: 24px; font-size: 20px; }

.i { width: 1.3em; height: 1.3em; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- layout ---------- */
#app, .screen { max-width: 520px; margin: 0 auto; }
.view, .screen { min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.content { flex: 1; display: flex; flex-direction: column; gap: 16px; padding: 20px 16px; }
.footer {
  position: sticky; bottom: 0; display: flex; flex-direction: column; gap: 12px;
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); background: var(--bg);
}
.screen-host:empty, .sheet-host:empty { display: none; }
.screen-host { position: fixed; inset: 0; z-index: 10; overflow-y: auto; background: var(--bg); }
.sheet-host { position: fixed; inset: 0; z-index: 20; }
body.has-screen #app { visibility: hidden; }

.view-boot { align-items: center; justify-content: center; gap: 16px; font-size: 20px; color: var(--muted); }
.spinner { width: 48px; height: 48px; border-radius: 50%; border: 5px solid var(--line); border-top-color: var(--primary); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; min-height: 64px;
  padding: 8px 12px; background: var(--card); border-bottom: 1px solid var(--line);
}
.bar h1 { font-size: 20px; }
.back {
  display: inline-flex; align-items: center; gap: 4px; min-height: 48px; padding: 0 12px 0 6px; border: 0;
  border-radius: var(--radius-sm); background: transparent; font-size: 18px; font-weight: 600; flex-shrink: 0;
}
.back:active { background: var(--gray-soft); }
.bar-scan { justify-content: space-between; padding: 10px 16px; }
.who { display: flex; flex-direction: column; min-width: 0; }
.who-line { font-size: 15px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who b { font-size: 20px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: var(--warning-soft); color: var(--warning-text); font-size: 16px; font-weight: 600; white-space: nowrap;
}
.badge .i { width: 18px; height: 18px; }

/* ---------- buttons ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 64px;
  padding: 10px 18px; border-radius: var(--radius); border: 2px solid transparent; font-size: 20px; font-weight: 600;
  text-align: center; text-decoration: none; transition: background-color .12s var(--ease), transform .12s var(--ease);
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { min-height: 76px; background: var(--primary); color: #fff; font-size: 23px; font-weight: 700; }
.btn-primary:active:not(:disabled) { background: var(--primary-pressed); }
.btn-dark { min-height: 72px; background: var(--ink); color: #fff; font-size: 22px; font-weight: 700; }
.btn-secondary { background: var(--card); border-color: var(--ink); color: var(--ink); }
.btn-outline { background: var(--card); border-color: var(--line-strong); color: var(--ink); }
.btn-tile { min-height: 64px; background: var(--card); border-color: var(--line-strong); color: var(--ink); font-size: 18px; gap: 8px; }
.btn-danger { min-height: 72px; background: var(--danger); color: #fff; font-size: 22px; font-weight: 700; }
.btn-quiet { min-height: 56px; background: transparent; color: var(--ink); text-decoration: underline; font-size: 19px; }
.btn-quiet.danger { color: var(--danger); }
.btn.small { min-height: 52px; width: auto; padding: 6px 14px; font-size: 17px; gap: 6px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; flex-shrink: 0;
  border-radius: 14px; border: 2px solid var(--dash); background: var(--card);
}
.icon-btn.danger { color: var(--danger-icon); }

/* ---------- cards, banners, tags ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 16px 18px; }
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; font-size: 18px; line-height: 1.45; }
.banner > span { display: flex; flex-direction: column; }
.banner-success { background: var(--success-soft); border: 1px solid #b7e8cd; color: var(--ink); }
.banner-success .i, .banner-success b { color: var(--success-text); }
.banner-warning { background: var(--warning-soft); color: var(--warning-text); font-weight: 600; }
.banner-error { background: var(--danger-soft); border: 1px solid #f3c2c9; }
.banner-error .i { color: var(--danger); }
.banner-brand { background: var(--brand-soft); }
.banner-brand .i { color: var(--primary); }
.tag { align-self: flex-start; display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 15px; font-weight: 600; }
.tag-pending { background: var(--warning-soft); color: var(--warning-text); }
.tag-failed { background: var(--danger-soft); color: var(--danger); }
.tag-inactive { background: var(--gray-soft); color: var(--muted); }
.toast {
  position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30;
  max-width: calc(100% - 32px); padding: 12px 20px; border-radius: 14px; background: var(--ink); color: #fff; font-size: 18px;
}

/* ---------- message screens ---------- */
.screen-msg .content { justify-content: center; }
.msg { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.msg p { font-size: 20px; color: var(--body); }
.msg-icon { display: inline-flex; align-items: center; justify-content: center; width: 112px; height: 112px; border-radius: 50%; }
.msg-icon .i { width: 56px; height: 56px; stroke-width: 2; }
.msg-icon.big { width: 136px; height: 136px; }
.msg-icon.big .i { width: 76px; height: 76px; stroke-width: 2.6; }
.msg-icon.small { width: 80px; height: 80px; align-self: center; }
.msg-icon.small .i { width: 42px; height: 42px; }
.tone-green { background: var(--success-soft); color: var(--success); }
.tone-amber { background: var(--warning-soft); color: var(--primary); }
.tone-red { background: var(--danger-soft); color: var(--danger-icon); }
.tone-gray { background: var(--gray-soft); color: var(--muted); }
.tone-brand { background: var(--brand-soft); color: var(--primary); }
.note {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: var(--card);
  border: 1px solid var(--line); text-align: left; font-size: 18px !important;
}
.note .i { color: var(--success); }
.note-warn { background: var(--warning-soft); border: 0; color: var(--warning-text) !important; font-weight: 600; }
.code-box { padding: 8px 16px; border-radius: 10px; background: var(--card); border: 1px dashed var(--dash); font-size: 22px !important; font-weight: 600; color: var(--ink) !important; }
.empty { padding: 32px 8px; text-align: center; font-size: 19px; color: var(--muted); }

.facts, .totals { margin: 0; padding: 4px 18px; display: flex; flex-direction: column; }
.facts > div { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px dashed var(--dash); }
.facts > div:last-child, .totals > div:last-child { border-bottom: 0; }
.facts .i { grid-row: span 2; width: 30px; height: 30px; color: var(--muted); stroke-width: 2; }
.facts dt { font-size: 16px; color: var(--muted); }
.facts dd { margin: 0; font-size: 22px; font-weight: 600; }
.totals > div { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px dashed var(--dash); font-size: 19px; }
.totals dd { margin: 0; font-weight: 700; }
.steps { margin: 0; padding: 16px 18px; list-style: none; display: flex; flex-direction: column; gap: 14px; }
.steps li { display: flex; gap: 14px; align-items: flex-start; font-size: 19px; }
.step-n { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 700; }

/* ---------- welcome ---------- */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 12px; background: var(--ink); color: #ff8419; }
.brand-mark .i { width: 28px; height: 28px; stroke-width: 2.4; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text b { font-size: 20px; }
.brand-text span { font-size: 16px; color: var(--muted); }
.welcome-card { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 28px 24px; text-align: center; }
.welcome-card h1 { font-size: 30px; }
.welcome-card p { font-size: 20px; color: var(--body); }
.qr-art { display: flex; align-items: center; justify-content: center; width: 160px; height: 160px; border-radius: 24px; background: var(--brand-soft); }
.qr-art svg { width: 96px; height: 96px; fill: none; stroke: var(--primary); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- camera stage ---------- */
.stage { position: relative; overflow: hidden; border-radius: 20px; background: var(--ink); display: flex; align-items: center; justify-content: center; }
.stage-scan { min-height: 260px; flex: 1; max-height: 340px; }
.stage-qr { min-height: 360px; }
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.frame { position: relative; z-index: 1; border: 4px solid #fff; border-radius: 16px; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.frame-bar { width: 72%; height: 46%; }
.frame-qr { width: 230px; height: 230px; border-radius: 20px; }
.aim { width: 86%; height: 3px; border-radius: 2px; background: #ff8419; }
.stage-start {
  position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  border: 0; background: rgba(26, 26, 46, .82); color: #fff; font-size: 21px; font-weight: 600;
}
.stage-start .i { width: 44px; height: 44px; }
.stage.live .stage-start, .stage.starting .stage-start { display: none; }
/* Before the camera opens: a hint pointing at the big button at the bottom (in thumb reach). */
.stage-idle {
  position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 16px; background: rgba(26, 26, 46, .82); color: #fff; font-size: 20px; text-align: center; line-height: 1.5;
}
.stage-idle .i { width: 44px; height: 44px; }
.stage.live .stage-idle, .stage.starting .stage-idle { display: none; }
.stage-torch {
  position: absolute; top: 10px; right: 10px; z-index: 3; display: inline-flex; align-items: center; gap: 6px; min-height: 48px;
  padding: 0 14px; border: 2px solid #fff; border-radius: 999px; background: rgba(26, 26, 46, .7); color: #fff; font-size: 17px; font-weight: 600;
}
.stage-torch[aria-pressed="true"] { background: #ffc934; border-color: #ffc934; color: var(--ink); }
.stage-status { position: absolute; left: 0; right: 0; bottom: 14px; z-index: 3; text-align: center; color: #fff; font-size: 18px; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.stage-hint { position: absolute; bottom: 48px; left: 50%; transform: translateX(-50%); z-index: 3; white-space: nowrap; padding: 6px 14px; border-radius: 999px; background: var(--warning-soft); color: var(--warning-text); font-size: 17px; font-weight: 600; }

/* ---------- scan view ---------- */
.content-scan { gap: 12px; padding-top: 14px; }
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 4px; border-radius: 14px; background: var(--gray-soft); }
.seg button { min-height: 52px; border: 0; border-radius: 11px; background: transparent; font-size: 17px; font-weight: 600; line-height: 1.3; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.span-2 { grid-column: span 2; }
.footer-scan { gap: 12px; background: var(--card); border-top: 1px solid var(--line); }
.footer-row { display: flex; align-items: center; gap: 14px; }
.footer-scan .btn-dark { width: auto; min-height: 68px; padding: 0 24px; flex-shrink: 0; }
.total { flex: 1; display: flex; flex-direction: column; align-items: flex-start; min-height: 56px; border: 0; background: transparent; text-align: left; padding: 0; }
.total b { font-size: 26px; line-height: 1.25; }

/* ---------- count ---------- */
.content-count { gap: 12px; padding-top: 12px; }
.product-card { display: flex; align-items: center; gap: 12px; padding: 12px; }
.thumb { display: inline-flex; align-items: center; justify-content: center; width: 76px; height: 76px; flex-shrink: 0; overflow: hidden; border-radius: 12px; background: var(--gray-soft); color: #7e8299; }
.thumb .i { width: 36px; height: 36px; stroke-width: 1.8; }
.thumb.small { width: 56px; height: 56px; }
.thumb.small .i { width: 28px; height: 28px; }
.thumb.big { width: 128px; height: 128px; border: 2px dashed var(--line-strong); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.product-text b { font-size: 20px; line-height: 1.3; }
.unit-band { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-radius: var(--radius); background: var(--ink); color: #fff; }
.unit-band span { font-size: 18px; color: var(--line-strong); }
.unit-band b { font-size: 30px; text-align: right; }
.unit-band em { font-style: normal; color: var(--unit-accent); }
.qty-row { display: flex; align-items: center; gap: 10px; }
.qty-step { display: inline-flex; align-items: center; justify-content: center; width: 76px; height: 84px; flex-shrink: 0; border-radius: var(--radius); border: 2px solid var(--line-strong); background: var(--card); }
.qty-step .i { width: 36px; height: 36px; stroke-width: 2.8; }
.qty {
  display: flex; align-items: center; justify-content: center; flex: 1; height: 84px; border-radius: var(--radius);
  border: 3px solid var(--primary); background: var(--card); font-size: 52px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.barcode-out { flex: none; font-size: 34px; letter-spacing: 2px; }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.keypad button { min-height: 60px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--card); font-size: 28px; font-weight: 600; }
.keypad button:active { background: var(--gray-soft); }
.keypad .key-word { background: var(--gray-soft); font-size: 20px; }
.field-error { color: var(--danger); font-size: 17px; font-weight: 600; }

/* ---------- sheets ---------- */
.sheet-wrap { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; }
.backdrop { position: absolute; inset: 0; background: rgba(26, 26, 46, .72); }
.sheet {
  position: relative; display: flex; flex-direction: column; gap: 16px; width: 100%; max-width: 520px; margin: 0 auto;
  padding: 28px 20px calc(24px + env(safe-area-inset-bottom)); border-radius: 28px 28px 0 0; background: var(--card); text-align: center;
}
.sheet p { font-size: 20px; color: var(--body); }
.sheet-box { display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: var(--radius); background: var(--bg); }
.sheet-box span { font-size: 20px; }
.sheet-box b { font-size: 26px; }
.sheet-box.big b { font-size: 56px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.sheet-box.big small { font-size: 30px; }
.sheet-box.big span { font-size: 19px; color: var(--muted); }
.dialog-sheet:not([open]) { display: none; }
.dialog-sheet { position: fixed; inset: auto 0 0 0; margin: 0 auto; border: 0; max-height: 100dvh; }
.dialog-sheet::backdrop { background: rgba(26, 26, 46, .72); }
.sheet .field { text-align: left; }

/* ---------- lists and search ---------- */
.content-list { gap: 10px; padding-top: 12px; }
.list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 80px; padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--card); text-align: left;
}
.row-text { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 2px; }
.row-text b { font-size: 19px; font-weight: 600; line-height: 1.35; }
.unit-chip { padding: 6px 10px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 17px; font-weight: 700; white-space: nowrap; }
.entry { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); }
.qty-text { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.search-box { padding: 0 16px 12px; background: var(--card); border-bottom: 1px solid var(--line); }
.search-field { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 0 14px; border-radius: 14px; border: 2px solid var(--primary); background: var(--card); }
.search-field .i { color: var(--muted); }
.search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 21px; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: block; }
.more { margin-top: 4px; }
.recent { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.recent h2 { font-size: 17px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 48px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--line-strong); background: var(--card); font-size: 17px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 14px 16px 0; }
.stats div { display: flex; flex-direction: column; align-items: center; padding: 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); }
.stats b { font-size: 30px; line-height: 1.2; }
.stats span { font-size: 16px; color: var(--muted); }

/* ---------- forms ---------- */
.form { gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field > span:first-child, .field legend { font-size: 18px; font-weight: 600; padding: 0; }
.field input[type="text"], .field input[type="url"] {
  min-height: 58px; padding: 0 14px; border-radius: var(--radius-sm); border: 2px solid var(--dash); background: var(--card); font-size: 20px;
}
.field input:focus { border-color: var(--primary); outline: 0; }
.readonly { display: flex; align-items: center; min-height: 52px; padding: 0 14px; border-radius: var(--radius-sm); background: var(--gray-soft); color: var(--muted); }
.req { color: var(--danger); }
.choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; }
.choice span { display: flex; align-items: center; justify-content: center; min-height: 54px; border-radius: var(--radius-sm); border: 2px solid var(--line-strong); background: var(--card); font-size: 19px; font-weight: 600; }
.choice input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.choice input:focus-visible + span { box-shadow: var(--focus); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.photo-row { display: flex; align-items: center; gap: 14px; }
.photo-buttons { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.file-btn { width: 100% !important; }
.code-card { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.code-card > span { display: flex; flex-direction: column; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (min-width: 560px) {
  body { background: #e8eaed; }
  .view, .screen { box-shadow: 0 0 0 1px var(--line); }
}

/* Headings get focus when a screen opens (for screen readers); no ring for that. */
[tabindex="-1"]:focus { box-shadow: none; outline: none; }
.sheet-box.big b span { font-size: inherit; color: inherit; }

/* Short screens (small phones, landscape): keep the whole number pad above the save button. */
@media (max-height: 760px) {
  .content-count { gap: 8px; padding-top: 8px; }
  .content-count .product-card { padding: 8px 10px; }
  .content-count .thumb { width: 52px; height: 52px; }
  .content-count .product-text b { font-size: 18px; }
  .unit-band { padding: 8px 16px; }
  .unit-band b { font-size: 24px; }
  .qty, .qty-step { height: 64px; }
  .qty { font-size: 40px; }
  .barcode-out { font-size: 30px; }
  .keypad { gap: 6px; }
  .keypad button { min-height: 50px; font-size: 24px; }
  .footer { padding-top: 8px; }
  .footer .btn-primary { min-height: 64px; }
}

/* Camera windows shrink to fit, so the big camera button at the bottom is never covered (small phones). */
.stage:not(.live) .frame { visibility: hidden; }
.stage-qr { flex: 1; min-height: 200px; max-height: 380px; }
.stage-scan { min-height: 170px; }
.view-scan .content-scan { min-height: 0; }
.frame-qr { width: min(230px, 60%); height: auto; aspect-ratio: 1; }
.stage-scan { max-height: 420px; }
@media (max-width: 380px) { .tiles .btn-tile { font-size: 17px; padding: 8px 10px; } }
