/* Inventaire FRB — app téléphone (M1 localisations, M2 comptage, M5 fin) */
:root {
  --encre: #15171a; --encre-2: #374151; --gris: #4b5563; --gris-2: #6b7280;
  --fond: #eef0f3; --carte: #ffffff; --bord: #d6d9de; --bord-2: #b9bdc4;
  --orange: #c2410c; --orange-pale: #fff1e8; --orange-fonce: #9a3412;
  --vert: #15803d; --vert-pale: #f1f9f3; --vert-bord: #a7d7b5;
  --ambre: #b45309; --ambre-pale: #fdf6ea; --ambre-bord: #e5b56a;
  --bleu: #1d4ed8; --bleu-pale: #e8eefc;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--fond); color: var(--encre); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
#app { max-width: 520px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; background: var(--fond); }
.chargement { padding: 40px; text-align: center; color: var(--gris); }
.mono { font-family: var(--mono); }
.ico { width: 22px; height: 22px; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* En-tête sombre */
.entete { background: var(--encre); color: #fff; padding: 12px 14px 14px 8px; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 0; z-index: 5; padding-top: max(12px, env(safe-area-inset-top)); }
.entete-ligne { display: flex; align-items: center; gap: 6px; }
.entete h1 { margin: 0; font-size: 22px; line-height: 1.15; font-weight: 800; }
.entete .sous { font-size: 13px; color: #c9ccd2; }
.entete .code { font-family: var(--mono); font-size: 26px; line-height: 1.05; font-weight: 800; }
.entete .titre { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.entete-accueil { padding: 18px 16px 16px; flex-direction: row; align-items: center; justify-content: space-between; }
.btn-retour { flex: none; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; background: transparent; color: #fff; border-radius: 10px; }
.avatar { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--orange); color: #fff; font-weight: 800; font-size: 15px; }
.pastille-reseau { flex: none; display: flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 14px; background: #2a2d33; font-size: 12px; font-weight: 700; }
.pastille-reseau.hors { color: #f5c27a; } .pastille-reseau.en { color: #86efac; }
.pastille-reseau .ico { width: 14px; height: 14px; }
.progression { display: flex; align-items: center; gap: 10px; padding-left: 8px; }
.progression .barre { flex: 1; height: 8px; border-radius: 5px; background: #3a3e45; overflow: hidden; }
.progression .barre > i { display: block; height: 8px; background: #22c55e; }
.progression span { font-size: 13px; font-weight: 700; }

/* Contenu */
.contenu { flex: 1; padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.carte { background: var(--carte); border: 1.5px solid var(--bord); border-radius: 14px; padding: 12px 14px; }
.carte-sync { display: flex; align-items: center; gap: 12px; }
.carte-sync .icone { flex: none; width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.carte-sync.hors .icone { background: #fdf3e2; color: var(--ambre); }
.carte-sync.ok .icone { background: #e8f6ec; color: var(--vert); }
.carte-sync.attente .icone { background: var(--orange-pale); color: var(--orange); }
.carte-sync .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.carte-sync strong { font-size: 14px; }
.carte-sync small { font-size: 12.5px; color: var(--gris); line-height: 1.3; }
.btn-contour { flex: none; height: 44px; padding: 0 12px; border: 1.5px solid var(--encre); border-radius: 10px; background: #fff; font-size: 13px; font-weight: 700; }
.btn-contour:disabled { border-color: var(--bord-2); color: var(--gris-2); }
.zone { display: flex; flex-direction: column; gap: 8px; }
.zone .haut { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.zone .etiq { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gris); }
.zone .nom { font-size: 17px; font-weight: 800; }
.zone .barre { height: 10px; border-radius: 6px; background: #e3e6ea; overflow: hidden; }
.zone .barre > i { display: block; height: 10px; background: var(--vert); }
.recherche { display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 50px; border-radius: 12px; background: #fff; border: 1.5px solid var(--bord-2); color: var(--gris); }
.recherche input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 16px; color: var(--encre); }
.puces { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.puces::-webkit-scrollbar { display: none; }
.puce { flex: none; height: 38px; padding: 0 13px; border-radius: 19px; border: 1.5px solid var(--bord-2); background: #fff; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.puce.active { background: var(--encre); border-color: var(--encre); color: #fff; font-weight: 700; }
.liste { display: flex; flex-direction: column; gap: 8px; }
.loc { display: flex; align-items: center; gap: 12px; min-height: 62px; padding: 8px 10px 8px 14px; border-radius: 12px; background: #fff; border: 1.5px solid var(--bord); text-align: left; width: 100%; }
.loc.en_cours { background: var(--orange-pale); border: 2px solid var(--orange); }
.loc .c { width: 96px; flex: none; font-family: var(--mono); font-size: 17px; font-weight: 800; overflow-wrap: anywhere; }
.loc .i { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.loc .s { font-size: 14px; font-weight: 700; }
.loc .d { font-size: 12.5px; color: var(--gris); }
.loc .s.a_faire { color: var(--encre); } .loc .s.en_cours { color: var(--orange); } .loc .s.terminee { color: var(--vert); } .loc .s.ecart { color: var(--ambre); }
.badge-multi { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 6px; background: var(--bleu-pale); color: var(--bleu); font-size: 12px; font-weight: 700; }
.badge-multi .ico { width: 12px; height: 12px; }
.vide { text-align: center; color: var(--gris); padding: 28px 12px; font-size: 14px; line-height: 1.5; }

/* Comptage */
.aide { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--bord); font-size: 13px; color: var(--gris); }
.aide span { display: flex; align-items: center; gap: 6px; }
.aide .mini { display: flex; align-items: center; justify-content: center; min-width: 28px; height: 22px; padding: 0 4px; border: 2px solid var(--encre); border-radius: 6px; font-size: 12px; font-weight: 800; color: var(--encre); }
.aide .mini.crayon { border: 0; background: var(--fond); }
.bandeau { padding: 10px 14px; border-radius: 12px; font-size: 13.5px; line-height: 1.35; }
.bandeau.info { background: var(--bleu-pale); color: #1e3a8a; }
.bandeau.alerte { background: #fdf3e2; color: #78350f; }
.ligne { display: flex; align-items: center; gap: 10px; padding: 12px 10px 12px 14px; border-radius: 14px; background: #fff; border: 1.5px solid var(--bord); }
.ligne.ok { background: var(--vert-pale); border-color: var(--vert-bord); }
.ligne.corr { background: var(--ambre-pale); border-color: var(--ambre-bord); }
.ligne.edition { background: #fff; border: 2px solid var(--orange); }
.ligne .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ligne .g { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ligne .g b { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.iv { padding: 2px 7px; border-radius: 6px; background: var(--fond); font-size: 13px; font-weight: 700; }
.ligne .m { font-size: 13px; color: var(--gris); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne .sku { font-family: var(--mono); font-size: 12px; color: var(--gris-2); }
.ligne .badge-multi { align-self: flex-start; margin-top: 2px; }
.ligne .corrige { font-size: 12.5px; font-weight: 700; color: var(--ambre); }
.actions { flex: none; display: flex; align-items: center; gap: 8px; }
.btn-crayon { display: flex; align-items: center; justify-content: center; width: 44px; height: 56px; border: 0; border-radius: 12px; background: var(--fond); }
.btn-nombre { display: flex; align-items: center; justify-content: center; gap: 3px; min-width: 72px; height: 56px; padding: 0 8px; border-radius: 12px; border: 2px solid var(--encre); background: #fff; }
.btn-nombre b { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.btn-nombre.ok { background: var(--vert); border-color: var(--vert); color: #fff; }
.btn-nombre.corr { background: var(--ambre); border-color: var(--ambre); color: #fff; }
.btn-nombre .ico { width: 18px; height: 18px; }
.champ-qte { width: 80px; height: 56px; border: 2px solid var(--orange); border-radius: 12px; background: #fff; text-align: center; font-size: 24px; font-weight: 800; outline: none; }
.btn-ok { width: 56px; height: 56px; border: 0; border-radius: 12px; background: var(--orange); color: #fff; font-size: 16px; font-weight: 800; }
.pied { position: sticky; bottom: 0; display: flex; gap: 10px; padding: 12px 14px; padding-bottom: max(16px, env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--bord); z-index: 5; }
.btn-secondaire { flex: none; display: flex; align-items: center; justify-content: center; gap: 6px; height: 54px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--encre); background: #fff; font-size: 14px; font-weight: 700; }
.btn-principal { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 54px; border: 0; border-radius: 12px; background: var(--orange); color: #fff; padding: 6px 10px; }
.btn-principal b { font-size: 16px; font-weight: 800; }
.btn-principal small { font-size: 12px; font-weight: 600; color: #ffe4d4; }
.btn-principal:disabled { background: #d9dce1; color: var(--gris); }
.btn-principal:disabled small { color: var(--gris); }

/* Fin */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: #fff; border: 1.5px solid var(--bord); border-radius: 14px; overflow: hidden; }
.stats > div { display: flex; flex-direction: column; align-items: center; padding: 12px 6px; }
.stats > div + div { border-left: 1px solid var(--bord); }
.stats b { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12.5px; color: var(--gris); }
.stats .ecart-pos { background: var(--ambre-pale); } .stats .ecart-pos b { color: var(--ambre); }
.compteurs { display: flex; gap: 8px; flex-wrap: wrap; font-size: 13px; font-weight: 700; }
.compteurs span { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 14px; }
.compteurs .ico { width: 14px; height: 14px; }
.cv { background: #e8f6ec; color: var(--vert); } .ca { background: #fdf3e2; color: #92400e; } .cb { background: var(--bleu-pale); color: var(--bleu); } .cg { background: #e3e6ea; color: var(--encre-2); }
.section h2 { margin: 0; font-size: 16px; font-weight: 800; }
.section > small { display: block; font-size: 12.5px; color: var(--gris); margin-top: 1px; }
.section .liste { margin-top: 8px; }
.item { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; border-radius: 14px; background: #fff; border: 1.5px solid var(--bord); }
.item.a-faire { border: 2px solid var(--orange); } .item.fait { border-color: var(--vert-bord); } .item.ajout { border-color: #9db4f0; }
.item .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item .t { font-size: 16px; font-weight: 800; }
.item .t small { font-size: 13px; font-weight: 700; color: var(--gris); }
.item .m { font-size: 12.5px; color: var(--gris); }
.item .e { font-size: 13px; font-weight: 700; color: var(--ambre); }
.item .lien { font-size: 13px; font-weight: 700; color: var(--orange); background: none; border: 0; padding: 0; text-align: left; text-decoration: underline; }
.coche { flex: none; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700; background: none; border: 0; padding: 4px; min-width: 64px; }
.coche .boite { width: 30px; height: 30px; border-radius: 6px; border: 2px solid var(--orange); background: #fff; display: flex; align-items: center; justify-content: center; }
.coche.oui { color: var(--vert); } .coche.oui .boite { border-color: var(--vert); background: var(--vert); color: #fff; }
.coche.non { color: var(--orange); }
.pas { flex: none; display: flex; align-items: center; border: 1.5px solid var(--bord-2); border-radius: 12px; overflow: hidden; background: #fff; }
.pas button { width: 42px; height: 48px; border: 0; background: var(--fond); font-size: 22px; font-weight: 700; }
.pas span { width: 40px; text-align: center; font-size: 20px; font-weight: 800; }
.btn-tirets { display: flex; align-items: center; justify-content: center; gap: 8px; height: 52px; border: 2px dashed #8a9099; border-radius: 14px; background: transparent; font-size: 15px; font-weight: 700; width: 100%; }
.champ { display: flex; flex-direction: column; gap: 6px; }
.champ > span { font-size: 13px; font-weight: 700; }
.champ input { height: 48px; padding: 0 12px; border: 1.5px solid var(--bord-2); border-radius: 12px; background: #fff; font-size: 16px; }
.ensuite { text-align: center; font-size: 12.5px; color: var(--gris); margin-top: 6px; }

/* Connexion */
.connexion { flex: 1; display: flex; flex-direction: column; gap: 16px; padding: 28px 20px; padding-top: max(28px, env(safe-area-inset-top)); }
.connexion h1 { margin: 0; font-size: 28px; font-weight: 800; }
.connexion p { margin: 0; color: var(--gris); font-size: 15px; line-height: 1.4; }
.connexion .init { height: 56px; border: 2px solid var(--bord-2); border-radius: 12px; padding: 0 14px; font-size: 22px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; background: #fff; }
.points { display: flex; justify-content: center; gap: 14px; height: 30px; align-items: center; }
.points i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--encre); }
.points i.plein { background: var(--encre); }
.pave { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pave button { height: 60px; border-radius: 14px; border: 1.5px solid var(--bord); background: #fff; font-size: 24px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.pave .gris { background: var(--fond); }
.erreur { color: #b91c1c; font-weight: 700; font-size: 14px; min-height: 20px; text-align: center; }
.btn-plein { height: 58px; border: 0; border-radius: 14px; background: var(--orange); color: #fff; font-size: 17px; font-weight: 800; }
.btn-plein:disabled { background: #d9dce1; color: var(--gris); }

/* Modale (feuille du bas) */
#modale { position: fixed; inset: 0; z-index: 50; background: rgba(15, 17, 20, .55); display: flex; align-items: flex-end; justify-content: center; }
#modale[hidden] { display: none; }
.feuille { width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; background: var(--fond); border-radius: 18px 18px 0 0; padding: 16px 16px max(18px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.feuille h2 { margin: 0; font-size: 19px; font-weight: 800; }
.feuille p { margin: 0; font-size: 14.5px; line-height: 1.4; color: var(--encre-2); }
.feuille .boutons { display: flex; gap: 10px; }
.feuille .boutons > * { flex: 1; }
.resultat { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 12px; background: #fff; border: 1.5px solid var(--bord); }
.resultat.choisi { border: 2px solid var(--orange); }
.resultat .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; height: 54px; padding: 0 14px; border-radius: 12px; background: #fff; border: 1.5px solid var(--bord); font-size: 15px; font-weight: 700; text-decoration: none; color: var(--encre); }

/* Toast */
#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 60; max-width: 92vw; padding: 12px 16px; border-radius: 12px; background: var(--encre); color: #fff; font-size: 14px; font-weight: 600; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
#toast.err { background: #b91c1c; }
