/* Page téléphone du logiciel Stock : gros boutons, gros textes, lisible au dépôt. */
:root {
  --fond: #f4f2ef;
  --carte: #ffffff;
  --texte: #1d1d1f;
  --doux: #6b6b70;
  --ligne: #e2dfda;
  --accent: #1d1d1f;
  --vert: #1f8a4c;
  --vert-clair: #e3f4ea;
  --rouge: #c62f2f;
  --rouge-clair: #fbe7e7;
  --orange: #b86a00;
  --orange-clair: #fff1dc;
  --bleu: #2457a6;
  --bleu-clair: #e6eefb;
  --rayon: 14px;
  --haut-nav: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  color: var(--texte);
  background: var(--fond);
  padding-bottom: calc(var(--haut-nav) + env(safe-area-inset-bottom) + 16px);
}
body.fige { overflow: hidden; }
h1 { font-size: 1.5rem; margin: 0.4em 0 0.5em; }
h2 { font-size: 1.15rem; margin: 1.2em 0 0.5em; }
p { margin: 0.4em 0; }
button, input, textarea { font: inherit; }
[hidden] { display: none !important; }

.barre {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--accent); color: #fff;
}
.marque { font-size: 1.05rem; letter-spacing: 0.02em; }
.qui { font-size: 0.95rem; opacity: 0.85; }
.vue { max-width: 720px; margin: 0 auto; padding: 8px 14px 24px; }
.attente { color: var(--doux); text-align: center; padding: 40px 0; }

/* Onglets du bas */
.onglets {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; background: var(--carte); border-top: 1px solid var(--ligne);
  padding-bottom: env(safe-area-inset-bottom);
}
.onglets a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: var(--haut-nav); color: var(--doux); text-decoration: none; font-size: 0.85rem;
}
.onglets a.actif { color: var(--texte); font-weight: 600; }
.onglets .picto { font-size: 1.4rem; line-height: 1.2; }

/* Boutons */
button { cursor: pointer; border: 0; border-radius: var(--rayon); padding: 10px 16px; background: var(--ligne); color: var(--texte); }
button:disabled { opacity: 0.45; cursor: default; }
.gros { display: block; width: 100%; min-height: 56px; font-size: 1.1rem; font-weight: 600; margin: 10px 0; }
.petit { padding: 8px 12px; font-size: 0.9rem; border-radius: 10px; }
.principal { background: var(--accent); color: #fff; }
.secondaire { background: var(--carte); color: var(--texte); border: 1.5px solid var(--ligne); }
.vert { background: var(--vert); color: #fff; }
.rouge { background: var(--rouge); color: #fff; }
.rouge-contour { background: var(--carte); color: var(--rouge); border: 1.5px solid var(--rouge); }
.lien { background: none; padding: 6px 4px; color: var(--bleu); text-decoration: underline; }
a.gros { display: flex; align-items: center; justify-content: center; text-decoration: none; border-radius: var(--rayon); }
.bouton-lien { display: inline-block; padding: 8px 12px; border-radius: 10px; background: var(--carte); border: 1.5px solid var(--ligne); color: var(--texte); text-decoration: none; font-size: 0.95rem; }

input[type="text"], input[type="search"], input[type="password"], input[type="number"], textarea {
  width: 100%; padding: 14px; border: 1.5px solid var(--ligne); border-radius: var(--rayon);
  background: var(--carte); color: var(--texte); margin: 6px 0; font-size: 1.05rem;
}
input:focus, textarea:focus { outline: 2px solid var(--bleu); outline-offset: 1px; }

/* Connexion */
.connexion { max-width: 380px; margin: 40px auto; text-align: center; }
.champ-pin { text-align: center; font-size: 2rem !important; letter-spacing: 0.4em; }
.champ-pin::placeholder { font-size: 1rem; letter-spacing: normal; }
.champ-numero { text-align: center; font-size: 2.4rem !important; letter-spacing: 0.15em; font-weight: 700; }

/* Messages */
.message {
  position: fixed; left: 12px; right: 12px; z-index: 30;
  bottom: calc(var(--haut-nav) + env(safe-area-inset-bottom) + 12px);
  padding: 14px 16px; border-radius: var(--rayon); background: var(--texte); color: #fff;
  font-weight: 600; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); max-width: 700px; margin: 0 auto;
}
.message.erreur { background: var(--rouge); }
.message.bon { background: var(--vert); }
.alerte { padding: 12px 14px; border-radius: var(--rayon); font-weight: 600; margin: 8px 0; }
.alerte.rouge { background: var(--rouge-clair); color: var(--rouge); }
.alerte.orange { background: var(--orange-clair); color: var(--orange); }
.alerte.bleue { background: var(--bleu-clair); color: var(--bleu); }
.info { color: var(--doux); }
.aide { color: var(--doux); font-size: 0.95rem; }
h2.vert { color: var(--vert); background: none; }
h2.rouge { color: var(--rouge); background: none; }

/* Caméra */
.bloc-camera { background: var(--carte); border-radius: var(--rayon); padding: 12px; margin: 10px 0; }
.invite { font-weight: 600; margin: 0 0 6px; }
.camera { position: relative; border-radius: 12px; overflow: hidden; background: #000; display: none; }
.camera.ouverte { display: block; aspect-ratio: 4 / 3; }
.camera-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.viseur {
  position: absolute; top: 50%; left: 50%; width: 60%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border: 3px solid rgba(255, 255, 255, 0.9); border-radius: 16px; box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.25);
}
.saisie-code { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.saisie-code input { flex: 1; text-transform: uppercase; }
.saisie-code input::placeholder { text-transform: none; }
.saisie-code button { min-height: 50px; }

/* Commande */
.recherche-commande { background: var(--carte); border-radius: var(--rayon); padding: 16px; }
.recherche-commande label { font-weight: 600; }
.reprise { margin-top: 16px; }
.entete-commande { display: flex; justify-content: space-between; align-items: baseline; }
.avancement { font-size: 1.1rem; font-weight: 600; color: var(--doux); margin-top: 0; }
.lignes, .fiches-presentes, .historique, .attendus { list-style: none; padding: 0; margin: 8px 0; }
.ligne, .fiche {
  display: flex; gap: 12px; align-items: center; background: var(--carte); border-radius: var(--rayon);
  padding: 10px; margin: 8px 0; border: 2px solid transparent;
}
.ligne { cursor: pointer; }
.ligne.scanne, .ligne.sans-scan { border-color: var(--vert); background: var(--vert-clair); }
.ligne.erreur { border-color: var(--rouge); background: var(--rouge-clair); }
.vignette { width: 64px; height: 84px; object-fit: cover; border-radius: 8px; flex: none; background: var(--ligne); }
.sans-photo { display: flex; align-items: center; justify-content: center; text-align: center; font-size: 0.7rem; color: var(--doux); }
.ligne-texte { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ligne-texte strong { overflow-wrap: anywhere; }
.detail { color: var(--doux); font-size: 0.92rem; }
.emplacements { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.emplacements em { color: var(--orange); font-size: 0.9rem; }
.pastille { background: var(--accent); color: #fff; border-radius: 8px; padding: 2px 8px; font-size: 0.95rem; letter-spacing: 0.03em; }
.etat-ligne { font-size: 1.6rem; font-weight: 700; width: 28px; text-align: center; }
.ligne.scanne .etat-ligne, .ligne.sans-scan .etat-ligne { color: var(--vert); }
.ligne.erreur .etat-ligne { color: var(--rouge); }
.pied { position: sticky; bottom: calc(var(--haut-nav) + env(safe-area-inset-bottom)); padding: 4px 0; background: linear-gradient(transparent, var(--fond) 30%); }
.fini { text-align: center; padding: 30px 0; }
.grand-ok { font-size: 5rem; color: var(--vert); line-height: 1; }

/* Article en grand (confirmation) */
.article-grand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; margin: 8px 0 14px; }
.photo-grande { width: min(70vw, 280px); aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; background: var(--ligne); }
.article-titre { font-size: 1.25rem; }
.article-taille { font-size: 1.5rem; font-weight: 800; }
.article-quantite { font-size: 1.1rem; font-weight: 600; color: var(--doux); }
.article-quantite.plusieurs { color: #fff; background: var(--orange); padding: 4px 12px; border-radius: 10px; font-size: 1.3rem; }
.ou { text-align: center; font-size: 1.05rem; }

/* Fenêtre du bas */
.feuille-fond { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.45); display: flex; align-items: flex-end; justify-content: center; }
.feuille {
  background: var(--fond); width: 100%; max-width: 720px; max-height: 92vh; overflow-y: auto;
  border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
}
.feuille h2 { margin-top: 0; }
.boutons { display: flex; flex-direction: column; }
.choix { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 10px; }
.choix-bouton { text-align: left; background: var(--carte); border: 1.5px solid var(--ligne); min-height: 50px; }
.choix-bouton.choisi { border-color: var(--accent); background: var(--accent); color: #fff; }

/* Ranger */
.entete-emplacement { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; }
.code-grand { font-size: 2.6rem; font-weight: 800; letter-spacing: 0.04em; }
.fiche.perdue { border-color: var(--orange); }
.fiches-presentes .vide { color: var(--doux); padding: 6px 0; }
.filtres { display: flex; gap: 8px; margin: 6px 0 10px; }
.filtre { flex: 1; background: var(--carte); border: 1.5px solid var(--ligne); }
.filtre.choisi { background: var(--accent); color: #fff; border-color: var(--accent); }
.grille-fiches { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.tuile { display: flex; flex-direction: column; padding: 0; overflow: hidden; background: var(--carte); text-align: left; border-radius: var(--rayon); }
.tuile-photo { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: var(--ligne); border-radius: 0; }
.tuile-titre { padding: 6px 8px 0; font-weight: 600; font-size: 0.95rem; overflow-wrap: anywhere; }
.tuile-detail { padding: 2px 8px 8px; color: var(--doux); font-size: 0.8rem; }

/* Plus */
.menu { display: flex; flex-direction: column; gap: 8px; }
.menu-lien { display: flex; flex-direction: column; background: var(--carte); border-radius: var(--rayon); padding: 14px 16px; text-decoration: none; color: var(--texte); }
.menu-lien span { color: var(--doux); font-size: 0.92rem; }
.creer-rayon { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--carte); border-radius: var(--rayon); padding: 12px; }
.creer-rayon label { width: 100%; font-weight: 600; }
.champ-lettre { width: 64px !important; text-align: center; text-transform: uppercase; font-weight: 700; }
.champ-nombre { width: 84px !important; text-align: center; }
.rayon { background: var(--carte); border-radius: var(--rayon); padding: 12px; margin: 12px 0; }
.entete-rayon { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; justify-content: space-between; }
.entete-rayon h2 { margin: 0; }
.grille-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; margin-top: 10px; }
.code-case { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: 10px; border: 1.5px solid var(--ligne); text-decoration: none; color: var(--texte); font-size: 0.8rem; }
.code-case b { font-size: 1rem; }
.code-case span { color: var(--doux); }
.code-case.rempli { border-color: var(--vert); background: var(--vert-clair); }
.code-case.inactif { opacity: 0.45; border-style: dashed; }
.historique li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; background: var(--carte); border-radius: var(--rayon); padding: 12px; margin: 8px 0; }
.historique li strong { width: 100%; }
.historique li.incomplete { border-left: 5px solid var(--orange); }
.historique li.annulee { opacity: 0.55; }
.formulaire { background: var(--carte); border-radius: var(--rayon); padding: 14px; margin: 16px 0; }
.formulaire h2 { margin-top: 0; }
.case { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.case input { width: 22px; height: 22px; }
