:root {
  --bleu: #0b5fa5; --bleu-fonce: #084a82; --bleu-pale: #e6f1fb;
  --fond: #f3f7fb; --carte: #fff; --texte: #14202b; --gris: #5f6f7e; --bord: #d5e0ea;
  --rouge: #c62828; --rouge-pale: #fdeaea; --orange: #b25e00; --orange-pale: #fff1dc; --vert: #1b7a3d; --vert-pale: #e4f5ea;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--fond); color: var(--texte); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#app { max-width: 720px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
header.haut { position: sticky; top: 0; z-index: 5; background: var(--bleu); color: #fff; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; display: flex; align-items: center; gap: 10px; }
header.haut h1 { font-size: 18px; margin: 0; flex: 1; font-weight: 650; }
header.haut button { background: transparent; border: 0; color: #fff; font-size: 15px; padding: 6px 8px; }
main { padding: 12px; }
nav.bas { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--bord); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); z-index: 6; }
nav.bas .inner { display: flex; width: 100%; max-width: 720px; }
nav.bas button { flex: 1; background: none; border: 0; padding: 8px 2px 8px; font-size: 12px; color: var(--gris); display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative; }
nav.bas button .ic { font-size: 22px; line-height: 1; }
nav.bas button.actif { color: var(--bleu); font-weight: 650; }
nav.bas .pastille { position: absolute; top: 2px; left: calc(50% + 6px); background: var(--rouge); color: #fff; font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; line-height: 18px; padding: 0 5px; }

input, select, textarea, button { font: inherit; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--bord); border-radius: 10px; background: #fff; color: var(--texte); }
textarea { min-height: 70px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--gris); margin: 12px 0 4px; font-weight: 600; }
.btn { display: inline-block; background: var(--bleu); color: #fff; border: 0; border-radius: 10px; padding: 12px 16px; font-weight: 650; cursor: pointer; }
.btn:active { background: var(--bleu-fonce); }
.btn.sec { background: var(--bleu-pale); color: var(--bleu); }
.btn.danger { background: var(--rouge-pale); color: var(--rouge); }
.btn.plein { width: 100%; }
.btn.petit { padding: 8px 12px; font-size: 14px; }
.rangee { display: flex; gap: 8px; align-items: center; }
.rangee > * { flex: 1; }
.rangee > .fixe { flex: none; }
.gap { height: 10px; }

.recherche { display: flex; gap: 8px; margin-bottom: 8px; }
.recherche input { flex: 1; }
.puces { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 6px; }
.puce { flex: none; border: 1px solid var(--bord); background: #fff; border-radius: 18px; padding: 6px 12px; font-size: 14px; color: var(--gris); }
.puce.actif { background: var(--bleu); border-color: var(--bleu); color: #fff; }

.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.article { display: flex; gap: 10px; align-items: center; }
.article .photo { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--bleu-pale); flex: none; display: flex; align-items: center; justify-content: center; font-size: 26px; }
.article .corps { flex: 1; min-width: 0; }
.article .nom { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.article .meta { font-size: 13px; color: var(--gris); }
.qte { display: flex; align-items: center; gap: 4px; flex: none; }
.qte button { width: 38px; height: 38px; border-radius: 19px; border: 1px solid var(--bord); background: #fff; font-size: 20px; color: var(--bleu); }
.qte .val { min-width: 34px; text-align: center; font-weight: 650; }
.badge { display: inline-block; font-size: 12px; font-weight: 650; border-radius: 8px; padding: 2px 7px; margin-right: 4px; }
.badge.rouge { background: var(--rouge-pale); color: var(--rouge); }
.badge.orange { background: var(--orange-pale); color: var(--orange); }
.badge.vert { background: var(--vert-pale); color: var(--vert); }
.vide { text-align: center; color: var(--gris); padding: 36px 12px; }
.titre-section { font-size: 14px; font-weight: 700; color: var(--gris); margin: 16px 2px 8px; text-transform: uppercase; letter-spacing: .04em; }
.ligne { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--bord); }
.ligne:last-child { border-bottom: 0; }
.ligne .sous { font-size: 13px; color: var(--gris); }
.erreur { background: var(--rouge-pale); color: var(--rouge); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.info { background: var(--bleu-pale); color: var(--bleu-fonce); border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-size: 14px; }

.rapides { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.photo-edit img { max-width: 100%; max-height: 220px; border-radius: 12px; display: block; margin: 8px 0; }

.connexion { padding: 40px 16px 16px; max-width: 380px; margin: 0 auto; }
.connexion h1 { text-align: center; color: var(--bleu); }
.connexion .logo { text-align: center; font-size: 56px; }

.scan { position: fixed; inset: 0; background: #000; z-index: 20; display: flex; flex-direction: column; }
.scan video { flex: 1; width: 100%; object-fit: cover; min-height: 0; }
.scan .barre { background: #000; color: #fff; padding: 12px; display: flex; gap: 8px; align-items: center; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
.scan .barre span { flex: 1; font-size: 14px; }
.scan .viseur { position: absolute; left: 12%; right: 12%; top: 30%; height: 28%; border: 3px solid rgba(255,255,255,.85); border-radius: 14px; pointer-events: none; }

.modal-fond { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 15; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: #fff; width: 100%; max-width: 720px; border-radius: 18px 18px 0 0; padding: 16px; max-height: 88vh; overflow-y: auto; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
.modal h2 { margin: 0 0 6px; font-size: 18px; }

#toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: #14202b; color: #fff; padding: 10px 16px; border-radius: 22px; opacity: 0; pointer-events: none; transition: .25s; z-index: 30; font-size: 14px; max-width: 90%; text-align: center; }
#toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
