/* scan.css — scanner-PWA: mobile-first (360–430 px), gloves-friendly ≥56 px targets */

html, body { height: 100%; }
body.scan {
  display: flex;
  justify-content: center;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.scan-app {
  width: 100%;
  max-width: 480px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
}

/* hidden always-focused input that receives DataWedge keystrokes */
#scan-trap {
  position: fixed;
  top: -100px;
  left: 0;
  width: 10px;
  height: 10px;
  opacity: 0;
  pointer-events: none;
}

/* ── top bar ──────────────────────────────────────────────────────────── */
.scan-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.scan-logo {
  height: 34px;
  max-width: 40%;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
  padding: 3px 6px;
  flex: none;
}
.scan-top h1 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.scan-top h1 b { color: var(--amber); }
.scan-user {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 12px;
  color: var(--ink-dim);
}
.scan-user b { color: var(--ink); font-weight: 600; }

/* ── home ─────────────────────────────────────────────────────────────── */
.home-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.action-btn {
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .08em;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 4px;
  padding: 14px;
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
}
.action-btn::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
}
.action-btn .sym { font-size: 24px; color: var(--accent); line-height: 1; }
.action-btn small { font-size: 10px; font-weight: 600; letter-spacing: .1em; color: var(--ink-dim); }
.action-btn:active { background: var(--panel-2); }
.action-in       { --accent: var(--green); }
.action-out      { --accent: var(--orange); }
.action-transfer { --accent: var(--blue); }
.action-count    { --accent: #8B98A5; }

/* verwacht-deze-week card */
.panel.scan-expected .exp-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.panel.scan-expected .exp-line:last-child { border-bottom: 0; }
.panel.scan-expected .exp-line:active { background: var(--panel-2); }
.exp-line .what { min-width: 0; }
.exp-line .what b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exp-line .what span { font-size: 11px; color: var(--ink-dim); font-family: var(--font-mono); }
.exp-line .rest { margin-left: auto; text-align: right; font-family: var(--font-mono); font-size: 13px; white-space: nowrap; }
.exp-line .rest small { display: block; color: var(--ink-dim); font-size: 10px; }

/* status line */
.scan-status {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-dim);
}
.scan-status .dot { color: var(--green); }
.scan-status.offline .dot { color: var(--red); }

/* ── flow screens ─────────────────────────────────────────────────────── */
.flow-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.flow-head .back {
  width: 44px;
  height: 44px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  font-size: 18px;
  cursor: pointer;
}
.flow-head h2 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--flow-accent, var(--ink));
}
.flow-head .step-dim { font-size: 12px; color: var(--ink-dim); letter-spacing: 0; text-transform: none; display: block; font-weight: 400; }

.flow-in       { --flow-accent: var(--green); }
.flow-out      { --flow-accent: var(--orange); }
.flow-transfer { --flow-accent: var(--blue); }
.flow-count    { --flow-accent: var(--ink-dim); }
.flow-receive  { --flow-accent: var(--blue); }

.scan-prompt {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 26px 16px;
  text-align: center;
  margin-bottom: 14px;
}
.scan-prompt .big { font-size: 34px; display: block; margin-bottom: 8px; color: var(--flow-accent, var(--amber)); }
.scan-prompt p { margin: 0; color: var(--ink-dim); font-size: 13px; }

.scan-manual { display: grid; gap: 10px; }
.scan-manual input[type="search"] { min-height: 52px; font-size: 16px; }
.btn-cam { min-height: 52px; width: 100%; }

.result-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  font: inherit;
  width: 100%;
}
.result-item:active { background: var(--panel-2); }
.result-item .mono { color: var(--ink-dim); font-size: 12px; }

/* article card */
.art-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--flow-accent, var(--amber));
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}
.art-card .sku { font-family: var(--font-mono); font-size: 12px; color: var(--ink-dim); }
.art-card h3 { font-size: 16px; margin: 2px 0 10px; }
.art-card .total { font-family: var(--font-mono); font-size: 12px; color: var(--ink-dim); margin-top: 8px; }

.loc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.loc-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
}
.loc-chip .q { color: var(--ink-dim); font-size: 12px; }
.loc-chip.sel {
  border-color: var(--flow-accent, var(--amber));
  background: color-mix(in srgb, var(--flow-accent, var(--amber)) 14%, transparent);
  font-weight: 600;
}

/* qty stepper */
.qty-step {
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  gap: 10px;
  margin: 14px 0;
}
.qty-step button {
  min-height: 64px;
  font-size: 26px;
  font-weight: 700;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--ink);
  cursor: pointer;
}
.qty-step button:active { background: var(--line); }
.qty-step input {
  min-height: 64px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
}

/* reference quick chips */
.ref-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ref-chips button {
  min-height: 40px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
}

.flow-field { margin-bottom: 12px; }
.flow-field input, .flow-field select { min-height: 52px; font-size: 16px; }

/* big commit button */
.btn-commit {
  width: 100%;
  min-height: 62px;
  border: 0;
  border-radius: var(--radius);
  background: var(--flow-accent, var(--amber));
  color: #101418;
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  margin-top: 8px;
}
.btn-commit:disabled { opacity: .5; }
.btn-commit:active { filter: brightness(1.1); }

/* count list */
.count-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  margin-bottom: 8px;
}
.count-row .what { min-width: 0; flex: 1; }
.count-row .what b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.count-row .what span { font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim); }
.count-row input {
  width: 84px;
  min-height: 52px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 19px;
}
.count-row .btn { min-height: 52px; }
.delta-badge { font-family: var(--font-mono); font-size: 12px; font-weight: 600; }
.delta-badge.pos { color: var(--green); }
.delta-badge.neg { color: var(--red); }
.delta-badge.zero { color: var(--ink-dim); }

/* success screen */
.success {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 30px 10px;
}
.success .check {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 44px;
  color: #101418;
  background: var(--green);
  animation: pop .25s ease-out;
}
.success.err .check { background: var(--red); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.success h2 { font-size: 18px; }
.success p { margin: 0; color: var(--ink-dim); font-size: 14px; }
.success .btns { display: grid; gap: 10px; width: 100%; margin-top: 14px; }

/* error banner in flows */
.flow-error {
  border: 1px solid var(--red);
  background: var(--red-dim);
  color: var(--red);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  margin-bottom: 12px;
}

/* match banner (IN flow, expected match) */
.match-banner {
  border: 1px solid var(--blue);
  background: var(--blue-dim);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}
.match-banner h4 { font-size: 13px; color: var(--blue); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px; }
.match-banner p { margin: 0 0 10px; font-size: 13px; }

/* red flash on failure */
#flash {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--red);
  opacity: 0;
  pointer-events: none;
}
#flash.go { animation: flash .45s ease-out; }
@keyframes flash { 0% { opacity: .55; } 100% { opacity: 0; } }

/* floating camera button — phone users can scan from every screen */
.cam-fab {
  position: fixed;
  right: 14px;
  bottom: 72px;
  z-index: 80;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
}
.cam-fab:active { background: var(--line); transform: scale(.96); }

/* camera overlay */
#cam-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(8, 10, 13, .96);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  gap: 16px;
}
#cam-overlay.open { display: flex; }
#qr-reader { width: min(92vw, 420px); }
#qr-reader video { border-radius: var(--radius); }

/* offline blocking overlay */
#offline-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(8, 10, 13, .96);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 30px;
}
#offline-overlay.open { display: flex; }
#offline-overlay .sym { font-size: 44px; color: var(--red); }
