/* Escáner para caja. One hand, right thumb: everything tappable sits in the lower right, above the phone's
   bottom edge (gesture bar); nothing important at the very top. */
:root {
  --bg: #0f172a; --panel: #1e293b; --line: #334155; --fg: #f1f5f9; --muted: #94a3b8;
  --accent: #2563eb; --accent-fg: #fff; --ok: #22c55e; --warn: #f59e0b; --bad: #ef4444;
  --edge: max(28px, calc(env(safe-area-inset-bottom, 0px) + 20px));
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font: 16px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; }
[hidden] { display: none !important; }
button { font: inherit; color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 0 16px; min-height: 52px; touch-action: manipulation; }
button:disabled { opacity: .4; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 700; }
button.big { min-height: 72px; font-size: 1.3rem; flex: 1 1 auto; }
button.mid { min-height: 56px; }
button.small { min-height: 48px; padding: 0 14px; color: var(--muted); }
button.wide { width: 100%; }
.muted { color: var(--muted); }
.warn { color: var(--warn); }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); }
.info .info-body { flex: 1; overflow: auto; padding: 48px 20px 16px; display: flex; flex-direction: column; gap: 12px; }
.info h1 { font-size: 1.5rem; margin: 8px 0 0; }
.info ol { padding-left: 1.2em; margin: 0; display: grid; gap: 8px; }
.info input { font: inherit; font-size: 1.2rem; width: 100%; min-height: 56px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); padding: 0 14px; margin-top: 6px; }

/* Lower-right dock: rows right-aligned, the main action last (closest to the thumb). */
.dock { display: flex; flex-direction: column; gap: 10px; padding: 10px 14px var(--edge) 14px; }
.dock .row, .sheet .row { display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.dock .row > .mid { flex: 0 1 48%; }

.camera { position: relative; flex: 0 0 36dvh; margin: 10px 14px 0; border-radius: 18px; overflow: hidden; background: #000; }
.camera video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-window { position: absolute; left: 8%; right: 8%; top: 28%; bottom: 28%; border: 3px solid rgba(255,255,255,.85); border-radius: 12px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
.camera.qr .scan-window { left: 18%; right: 18%; top: 8%; bottom: 8%; border-color: var(--warn); }
.camera.hit .scan-window { border-color: var(--ok); }
.cam-message { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 16px; background: rgba(0,0,0,.7); }
.cam-message button { margin-top: 10px; }
.status { position: absolute; left: 10px; bottom: 10px; font-size: .8rem; padding: 3px 9px; border-radius: 999px; background: rgba(0,0,0,.6); color: var(--muted); }
.status.bad { color: #fff; background: var(--bad); }

.middle { flex: 1; min-height: 0; overflow: auto; padding: 12px 14px 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; }
.card p { margin: 0; }
#card-name { font-size: 1.15rem; font-weight: 600; }
.card.empty #card-name { color: var(--muted); font-weight: 400; }
.price { font-size: 3rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.price.none { font-size: 1.8rem; color: var(--bad); }
.sub { color: var(--muted); font-size: .92rem; margin: 2px 0 0; }
.card.unknown { border-color: var(--warn); }
.result { border-radius: 14px; padding: 12px 14px; font-weight: 600; background: var(--panel); border: 1px solid var(--line); display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.result.ok { border-color: var(--ok); color: #bbf7d0; }
.result.bad { border-color: var(--bad); color: #fecaca; }
.result button { min-height: 44px; flex: none; }

.seg { display: flex; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; min-height: 48px; background: transparent; color: var(--muted); }
.seg button[aria-checked="true"] { background: var(--line); color: var(--fg); font-weight: 700; }

/* Sheets cover the lower part only, keys toward the right. */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); border-radius: 22px 22px 0 0; padding: 16px 14px var(--edge); display: flex; flex-direction: column; gap: 10px; box-shadow: 0 -12px 40px rgba(0,0,0,.5); max-height: 80dvh; overflow: auto; }
.pad-title { margin: 0; font-weight: 600; }
.pad-value { display: block; text-align: right; font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; min-height: 1.2em; padding: 0 6px; }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keys button { min-height: 60px; font-size: 1.5rem; font-weight: 600; }
.check { display: flex; gap: 12px; align-items: center; min-height: 52px; }
.check input { width: 24px; height: 24px; }
