/* PRESTOC · charte « velours profond » (aplats uniquement) */
:root {
  --nuit: #1F3354; --velours: #2C4670; --moyen: #3F5F92; --clair: #5574A8;
  --fond: #F4F6FA; --blanc: #FFFFFF; --corail: #E0705A; --corailF: #B85240;
  --ligne: #DCE2EC; --texte: #1F3354; --doux: #5A6A85;
  --rayon: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fond); color: var(--texte); font-family: 'Poppins', Arial, sans-serif; font-size: 15px; }
button, input, select, textarea { font-family: inherit; font-size: 15px; }
a { color: var(--moyen); }
.chargement { padding: 40px; text-align: center; color: var(--doux); }

/* En-tête */
.entete { background: var(--nuit); color: var(--blanc); padding: 12px 18px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 5; }
.logo { font-weight: 800; font-style: italic; font-size: 22px; letter-spacing: .5px; display: flex; align-items: center; gap: 8px; }
.logo img { height: 28px; }
.entete .societe { font-size: 13px; opacity: .85; }
.essai { background: var(--corail); color: var(--blanc); font-size: 12px; padding: 3px 10px; border-radius: 20px; margin-left: 10px; }

/* Navigation */
.nav { display: flex; gap: 4px; background: var(--velours); padding: 0 12px; overflow-x: auto; }
.nav button { background: none; border: 0; color: #C9D3E6; padding: 12px 14px; cursor: pointer; white-space: nowrap; border-bottom: 3px solid transparent; }
.nav button.actif { color: var(--blanc); border-bottom-color: var(--corail); font-weight: 600; }
@media (max-width: 700px) {
  .nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; justify-content: space-around; padding: 0 0 env(safe-area-inset-bottom); }
  .nav button { flex: 1; padding: 14px 4px; font-size: 13px; border-bottom: 0; border-top: 3px solid transparent; }
  .nav button.actif { border-top-color: var(--corail); }
  main { padding-bottom: 90px !important; }
}

main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; }
h1 { font-size: 24px; margin: 4px 0 16px; }
h2 { font-size: 18px; margin: 24px 0 10px; }
.sous { color: var(--doux); font-size: 13px; }

/* Tuiles */
.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tuile { background: var(--blanc); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 14px 16px; cursor: pointer; }
.tuile .val { font-size: 24px; font-weight: 700; }
.tuile .lib { font-size: 13px; color: var(--doux); }
.tuile.principale { background: var(--nuit); color: var(--blanc); border-color: var(--nuit); }
.tuile.principale .lib { color: #C9D3E6; }
.tuile.alerte .val { color: var(--corailF); }

/* Barre d'outils */
.outils { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; align-items: center; }
.outils input[type=search] { flex: 1; min-width: 200px; }
.filtres { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filtre { background: var(--blanc); border: 1px solid var(--ligne); border-radius: 20px; padding: 6px 14px; cursor: pointer; font-size: 13px; }
.filtre.actif { background: var(--nuit); color: var(--blanc); border-color: var(--nuit); }

/* Champs et boutons */
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--ligne); border-radius: 10px; background: var(--blanc); color: var(--texte); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--clair); border-color: var(--clair); }
label { display: block; font-size: 13px; color: var(--doux); margin: 10px 0 4px; }
.btn { background: var(--nuit); color: var(--blanc); border: 0; border-radius: 10px; padding: 10px 16px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { background: var(--velours); }
.btn.second { background: var(--blanc); color: var(--nuit); border: 1px solid var(--nuit); }
.btn.alerte { background: var(--corailF); }
.btn.petit { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.grille2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 520px) { .grille2 { grid-template-columns: 1fr; } }

/* Liste d'articles */
.famille-titre { font-weight: 700; margin: 20px 0 8px; display: flex; justify-content: space-between; align-items: center; }
.carte { background: var(--blanc); border: 1px solid var(--ligne); border-radius: var(--rayon); margin-bottom: 8px; display: flex; gap: 12px; padding: 10px 12px; align-items: center; cursor: pointer; }
.carte:hover { border-color: var(--clair); }
.carte .vignette { width: 52px; height: 52px; border-radius: 8px; background: var(--fond); flex: none; object-fit: cover; display: flex; align-items: center; justify-content: center; color: var(--clair); font-weight: 700; }
.carte .infos { flex: 1; min-width: 0; }
.carte .nom { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.carte .meta { font-size: 12px; color: var(--doux); }
.pastilles { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.pastille { font-size: 12px; padding: 2px 9px; border-radius: 20px; background: var(--fond); color: var(--velours); font-weight: 500; }
.pastille.ok { background: #E3EAF6; color: var(--nuit); }
.pastille.bas { background: var(--corail); color: var(--blanc); }
.pastille.zero { background: var(--corailF); color: var(--blanc); }

/* Tableaux */
table { width: 100%; border-collapse: collapse; background: var(--blanc); border-radius: var(--rayon); overflow: hidden; border: 1px solid var(--ligne); }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--ligne); font-size: 14px; vertical-align: top; }
th { background: var(--fond); font-size: 12px; color: var(--doux); font-weight: 600; }
.vide { color: var(--doux); padding: 30px; text-align: center; background: var(--blanc); border: 1px dashed var(--ligne); border-radius: var(--rayon); }

/* Fenêtre */
.fenetre { position: fixed; inset: 0; background: rgba(31, 51, 84, .55); z-index: 20; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 30px 12px; }
.fenetre[hidden] { display: none; }
.boite { background: var(--blanc); border-radius: 16px; padding: 22px; width: 100%; max-width: 560px; }
.boite h2 { margin-top: 0; }
.boite .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.photo-grande { width: 100%; max-height: 260px; object-fit: contain; border-radius: 10px; background: var(--fond); }

/* Connexion */
.accueil { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--nuit); }
.accueil .boite { max-width: 420px; }
.accueil .logo { color: var(--nuit); font-size: 30px; justify-content: center; }
.accueil .signature { text-align: center; color: var(--doux); margin: 2px 0 18px; }
.lien { background: none; border: 0; color: var(--moyen); cursor: pointer; padding: 0; text-decoration: underline; }
.message-erreur { color: var(--corailF); font-size: 14px; margin-top: 10px; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--nuit); color: var(--blanc); padding: 10px 18px; border-radius: 10px; z-index: 30; max-width: 90%; }
.toast.erreur { background: var(--corailF); }
.toast[hidden] { display: none; }

video.scan { width: 100%; border-radius: 10px; background: #000; }
.ligne-reglage { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--blanc); border: 1px solid var(--ligne); border-radius: 10px; padding: 8px 12px; margin-bottom: 6px; }
.interrupteur { display: flex; gap: 10px; align-items: center; }
.interrupteur input { width: auto; }

/* Matériel des locaux */
.choix { border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 10px 14px; margin: 12px 0; }
.choix legend { font-weight: 600; font-size: 14px; padding: 0 4px; }
.option { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; color: var(--texte); font-size: 14px; cursor: pointer; }
.option input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--corail); }
.option-texte { flex: 1; min-width: 0; }
.option-titre { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.option-titre b { flex: 1; min-width: 0; }
.option-titre .sous, .option-texte > .sous { display: block; }
.prix { font-weight: 600; color: var(--corailF); white-space: nowrap; }
.prix small { font-weight: 400; font-size: 12px; color: var(--doux); }
.ariane { font-size: 13px; color: var(--doux); margin: -8px 0 6px; }
.recense { max-width: none; border: 1px solid var(--ligne); margin: 14px 0; }
.grille2 > div { min-width: 0; }
@media (max-width: 700px) {
  .nav.serre button { white-space: normal; line-height: 1.15; font-size: 12px; padding: 10px 2px; min-width: 0; }
}
