html, body { overscroll-behavior-y: contain; }
:root { --blue:#0b6ea8; --green:#0a8f3c; --red:#c0392b; --bg:#f4f6f9; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin:0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background:var(--bg); color:#1c2733; }
#screens { max-width: 760px; margin: 0 auto; padding: 12px; }
.screen { display:none; }
.screen.active { display:block; }
h1 { font-size: 22px; margin: 12px 0; }
header { display:flex; align-items:center; justify-content:space-between; gap:8px; margin: 8px 0 14px; }
button { border:0; border-radius:10px; padding:12px 14px; font-size:16px; background:#e6edf5; }
button.primary { background:var(--blue); color:#fff; width:100%; margin-top:10px; }
button.big { display:block; width:100%; margin:10px 0; padding:22px; font-size:19px; background:#fff; border:1px solid #d6e1ec; text-align:left; }
button.link { background:transparent; color:var(--blue); padding:6px; }
input { width:100%; padding:12px; font-size:16px; border:1px solid #c9d6e3; border-radius:10px; margin:6px 0; background:#fff; }
input.scan { font-size:20px; padding:14px; border:2px solid var(--blue); }
.chips { display:flex; flex-wrap:wrap; gap:6px; margin: 4px 0 10px; }
.chip { padding:8px 10px; border-radius:16px; background:#fff; border:1px solid #c9d6e3; font-size:14px; }
.chip.on { background:var(--blue); color:#fff; border-color:var(--blue); }
.list { max-height: 48vh; overflow:auto; border:1px solid #dce4ee; border-radius:10px; background:#fff; }
.row { display:flex; justify-content:space-between; align-items:center; gap:8px; padding:10px 12px; border-bottom:1px solid #edf1f6; font-size:14px; }
.row:last-child { border-bottom:0; }
.row .n { font-weight:600; }
.row .c { color:#5b6b7c; font-size:12px; }
.row .q { font-size:18px; font-weight:700; min-width:46px; text-align:right; }
.row.ok { background:#eef9f0; }
.row.ko { background:#fdeeee; }
.bar { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-top:10px; }
.bar button { width:auto; margin:0; }
.last { min-height: 22px; font-size:14px; margin:6px 0; }
.msg { margin-top:10px; font-size:14px; }
.msg.ok { color: var(--green); }
.msg.err { color: var(--red); }
.muted { color:#6b7c8d; font-size:13px; }
.ver { margin-top:18px; }

/* gros elements (demande Comptable) */
select { width:100%; padding:16px; font-size:17px; border:1px solid #c9d6e3; border-radius:12px; margin:8px 0; background:#fff; }
label.chk { display:flex; align-items:center; gap:12px; font-size:17px; padding:12px 0; }
input[type=checkbox] { width:28px; height:28px; accent-color: #0b6ea8; }
button { font-size:17px; padding:14px 16px; }
button.big { font-size:20px; padding:26px 20px; }
button.link { font-size:26px; padding:10px 16px; font-weight:700; }
header b { font-size:19px; }
header { margin-bottom: 10px; }

/* barre quantite reception */
.qtybar { display:flex; gap:10px; align-items:center; background:#fff; border:2px solid #0b6ea8;
  border-radius:12px; padding:10px; margin:10px 0; }
.qtybar span { flex:1; font-size:15px; }
.qtybar input { width:100px; font-size:22px; padding:10px; text-align:center; margin:0; }
.qtybar button { width:auto; margin:0; padding:12px 18px; }

/* loader */
.loader { position:fixed; inset:0; background:rgba(255,255,255,.75); display:flex; flex-direction:column;
  align-items:center; justify-content:center; z-index:9999; gap:14px; }
.spinner { width:52px; height:52px; border-radius:50%; border:5px solid #cfe0f0; border-top-color:#0b6ea8;
  animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loader-text { font-size:16px; color:#1c2733; font-weight:600; }

/* pavé numérique */
.keypad { position:fixed; bottom:0; left:0; right:0; display:grid; grid-template-columns:repeat(3,1fr);
  gap:6px; padding:10px; background:#fff; border-top:2px solid #0b6ea8; z-index:9998; }
.keypad button { font-size:24px; padding:18px 0; background:#eef3f9; }
.keypad .kp-ok { grid-column: span 3; background:#0a8f3c; color:#fff; }
input.kp-on { border-color:#0a8f3c; }
.btn-cam { font-size:22px; padding:12px 14px; background:#0b6ea8; color:#fff; border-radius:10px; }
.scan-modal { position:fixed; inset:0; background:#000; z-index:9999; display:flex; flex-direction:column; }
.scan-modal video { flex:1; width:100%; object-fit:cover; }
.scan-bar { display:flex; justify-content:space-between; align-items:center; padding:12px; background:#111; color:#fff; font-size:15px; }
.scan-bar button { background:#c0392b; color:#fff; font-size:20px; padding:8px 14px; }

.scan-frame { position:absolute; left:10%; right:10%; top:30%; height:28%; border:3px solid #0a8f3c;
  border-radius:12px; box-shadow:0 0 0 9999px rgba(0,0,0,.25); pointer-events:none; }

body { overscroll-behavior: none; }

#offline-bar { position:fixed; top:0; left:0; right:0; background:#c0392b; color:#fff; text-align:center;
  padding:8px 10px; font-size:14px; z-index:10000; }
body.offline #screens { padding-top: 38px; }

#quagga-view { position:absolute; top:0; left:0; right:0; bottom:60px; overflow:hidden; }
#quagga-view video, #quagga-view canvas { width:100% !important; height:100% !important; object-fit:cover; }
.scan-bar { position:relative; z-index:3; flex-shrink:0; }

#scan-refocus { background:#0b6ea8; color:#fff; }
