/* Thème commun Ellinga (Android, sombre). Aucun framework. */
:root {
  color-scheme: dark;
  --fond: #14120f;
  --carte: #1c1a17;
  --carte2: #241f1a;
  --bord: #443e35;
  --texte: #ece7df;
  --doux: #8a857c;
  --ok: #6fbf8f;
  --ko: #d98a6f;
  --accent: #c9a86a;
}
* { box-sizing: border-box; }
body {
  font-family: system-ui, sans-serif;
  background: var(--fond);
  color: var(--texte);
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; padding: 1rem; max-width: 56rem; margin: 0 auto; width: 100%; }
h1 { font-size: 1.3rem; margin: 0 0 .75rem; }
h2 { font-size: 1rem; margin: 0 0 .5rem; }
.carte {
  background: var(--carte);
  border: 1px solid var(--bord);
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.statut { color: var(--doux); font-size: .9rem; min-height: 1.2em; }
.statut .ok { color: var(--ok); }
.statut .ko { color: var(--ko); }
button {
  font: inherit;
  background: var(--carte2);
  color: inherit;
  border: 1px solid var(--bord);
  border-radius: .5rem;
  padding: .45rem .9rem;
  cursor: pointer;
}
button:active { background: #332d26; }
button.principal {
  background: var(--accent);
  color: #1c1a17;
  border-color: var(--accent);
  font-weight: 600;
  width: 100%;
  padding: .7rem 1rem;
  font-size: 1.05rem;
}
button:disabled { opacity: .5; }
input, select, textarea {
  font: inherit;
  background: #100e0c;
  color: inherit;
  border: 1px solid var(--bord);
  border-radius: .5rem;
  padding: .55rem .7rem;
  width: 100%;
}
input:focus, select:focus { outline: 1px solid var(--accent); }
.etape { border-top: 1px solid var(--bord); padding: .5rem 0; }
.etape p { margin: .25rem 0; }
.etape.faite strong { color: var(--doux); }
fieldset { border: none; padding: 0; margin: 0 0 .75rem; }
legend { color: var(--doux); font-size: .85rem; margin-bottom: .35rem; }
.ligne { display: flex; gap: .6rem; align-items: center; }
footer {
  text-align: center;
  color: #55504a;
  font-size: .8rem;
  padding: .6rem 1rem 1rem;
}
/* Tuiles de l'accueil */
.grille { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.tuile {
  background: var(--carte);
  border: 1px solid var(--bord);
  border-radius: 1rem;
  padding: 1rem;
  text-decoration: none;
  color: inherit;
  display: block;
}
.tuile:active { background: var(--carte2); }
.tuile .titre { font-size: 1.05rem; font-weight: 600; }
.tuile .detail { color: var(--doux); font-size: .85rem; margin-top: .3rem; min-height: 1.2em; }
.tuile.bientot { opacity: .55; }
/* Pavé numérique (PIN) */
.pave { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; max-width: 20rem; margin: 0 auto; }
.pave button {
  font-size: 1.6rem;
  padding: 1rem 0;
  border-radius: .7rem;
}
.points { display: flex; gap: .5rem; justify-content: center; margin: 1rem 0; }
.points span {
  width: .9rem; height: .9rem; border-radius: 50%;
  border: 1px solid var(--bord);
}
.points span.plein { background: var(--accent); border-color: var(--accent); }
.entree-code { letter-spacing: .5em; text-align: center; font-size: 1.4rem; }
a { color: var(--accent); }
/* Écran d'ouverture du stand */
.lignes2 { display: flex; gap: .8rem; }
.lignes2 label { flex: 1; display: block; }
label { display: block; color: var(--doux); font-size: .9rem; margin-bottom: .7rem; }
label input, label select { margin-top: .3rem; color: var(--texte); }
.case { display: flex; gap: .5rem; align-items: center; color: var(--texte); margin-bottom: .5rem; }
.case input { width: 1.4rem; height: 1.4rem; margin: 0; flex: none; }
.note { color: var(--doux); font-size: .88rem; margin: 0 0 .75rem; }
.produit {
  display: flex; justify-content: space-between; gap: 1rem;
  align-items: center; padding: .7rem 0;
  border-bottom: 1px solid var(--bord);
}
.produit:last-child { border-bottom: none; }
.p-nom { font-size: .98rem; }
.p-meta { color: var(--doux); font-size: .8rem; margin-top: .15rem; }
.p-qte { flex: none; width: 6.5rem; text-align: right; }
.p-entete { display: block; color: var(--doux); font-size: .8rem; margin-bottom: .25rem; }
.p-qte input { text-align: right; }
.produit.depasse .p-meta { color: var(--ko); }
.produit.depasse .charge { border-color: var(--ko); }

/* Écran de vente (4c) — retour 3 : onglets + grille parfum × format */
.onglets { display: flex; gap: .4rem; margin-bottom: .8rem; }
.onglets .onglet { flex: 1; padding: .55rem 0; font-weight: 600; }
.onglets .onglet.actif { background: var(--accent); color: #16130f; border-color: var(--accent); }
.grille-v { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.grille-v th {
  color: var(--doux); font-size: .8rem; font-weight: 500;
  text-align: center; padding: .3rem .4rem;
}
.grille-v th.ligne-lab {
  text-align: left; color: var(--texte); font-weight: 600;
  font-size: .95rem; white-space: normal;
}
/* Retour A : chaque ligne (en-tête compris) est une grille CSS — 1re
   colonne étiquette, puis une colonne égale par format — photo et nom
   côte à côte, centrés sur la hauteur des champs. Partagé Stand/Vente. */
table.grille-v, .grille-v tbody { display: block; }
.grille-v tr {
  display: grid; grid-template-columns: minmax(7rem, 15rem);
  grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  align-items: center; gap: .5rem;
  padding: .45rem 0; border-bottom: 1px solid var(--bord);
}
.grille-v tr:first-child { padding: 0; border-bottom: none; }
.grille-v tr:last-child { border-bottom: none; }
.grille-v td { display: flex; justify-content: center; padding: 0; }
.grille-v th.ligne-lab { display: flex; align-items: center; gap: .6rem; padding: 0; }
/* FB12 : vignette d'étiquette en tête de ligne (vraie ou factice, même taille). */
.grille-v th.ligne-lab .photo-lab {
  flex: none; width: 4rem; height: 4rem;
  object-fit: cover; border-radius: .5rem;
}
/* Retour B : onglet sans produit — message explicite. */
.etat-vide {
  text-align: center; color: var(--doux);
  border: 1px dashed var(--bord); border-radius: .8rem;
  padding: 1.5rem 1rem; margin: 0 0 1rem;
}
.accessoire { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px solid var(--bord); }
.grille-v .case-prod {
  width: 100%; min-height: 3.6rem;
  display: flex; flex-direction: column; justify-content: center;
  gap: .1rem; border-radius: .6rem; padding: .3rem;
}
.grille-v .case-prod .c-prix { font-weight: 600; }
.grille-v .case-prod .c-stock { color: var(--doux); font-size: .75rem; }
.grille-v .case-prod.vide { opacity: .55; }
/* Le ticket reste toujours visible au bas de l'écran. */
.carte.ticket { position: sticky; bottom: 0; z-index: 5; }
/* Ouverture du stand (retour 7) : quantités avec gros boutons +/− */
.case-ch { display: flex; flex-direction: column; align-items: center; gap: .15rem; }
.case-ch .ch-ligne { display: flex; align-items: center; gap: .25rem; }
.case-ch button {
  width: 2.6rem; height: 2.6rem; padding: 0;
  font-size: 1.35rem; line-height: 1;
}
.case-ch input {
  width: 3.4rem; text-align: center; padding: .4rem 0;
  font-weight: 600;
}
.case-ch .ch-stock { color: var(--doux); font-size: .75rem; }
.case-ch.depasse { outline: 1px solid var(--ko); border-radius: .6rem; }
.total-onglet { margin: .3rem 0 0; font-weight: 600; }
.grille h2 { grid-column: 1 / -1; }
.produit-btn { display: flex; justify-content: space-between; gap: .6rem; width: 100%; text-align: left; }
.produit-btn .b-nom { font-size: .98rem; color: var(--texte); }
.produit-btn .b-meta { color: var(--doux); font-size: .8rem; }
.produit-btn.vide { opacity: .55; }
#lignes { margin-bottom: .75rem; }
.t-ligne { display: flex; gap: .5rem; align-items: center; margin-bottom: .4rem; }
.t-ligne { flex-wrap: wrap; }  /* portrait : les boutons passent sous le nom au lieu de sortir de l'écran */
.t-ligne .l-nom { flex: 1 1 10rem; min-width: 0; font-size: .95rem; }
.t-ligne button { flex: none; width: 2.2rem; padding: .3rem 0; }
.t-ligne .l-rabais { flex: none; width: 4.4rem; padding: .3rem .2rem; text-align: right; }
.lignes2 label.rabais { flex: 0 0 6rem; }
.t-ligne .l-montant { flex: none; width: 5.5rem; text-align: right; font-size: .9rem; }
.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: .5rem; margin-bottom: .75rem; }
.modes .mode.actif { background: var(--accent); color: #16130f; }
#total { font-size: 1.35rem; font-weight: 700; margin: .5rem 0; }
/* Barre haute (retours 4 et 9) : retour accueil, titre, utilisateur,
   alerte erreurs de synchro + réessayer. */
.barre {
  display: flex; align-items: center; gap: .6rem;
  max-width: 56rem; width: 100%; margin: 0 auto;
  padding: .55rem 1rem;
  background: var(--carte);
  border-bottom: 1px solid var(--bord);
  position: sticky; top: 0; z-index: 10;
}
/* R18 point 6 : Retour / Accueil = vrais boutons, cible de toucher ≥ 48 px (Android). */
.barre { flex-wrap: wrap; }
.barre-lien {
  font-weight: 600; white-space: nowrap;
  min-height: 48px; min-width: 48px; padding: .6rem 1.1rem; font-size: 1.05rem;
}
.barre-titre { font-weight: 600; flex: 1; min-width: 0; }
.barre-util { color: var(--doux); font-size: .9rem; white-space: nowrap; min-height: 48px; }
/* A4b : connexion, une grosse ligne par personne mémorisée ; « Oublier cet appareil » discret. */
.comptes { display: grid; gap: .8rem; margin-bottom: 1.2rem; }
.comptes button { min-height: 64px; font-size: 1.3rem; }
button.discret { background: none; border: none; color: var(--doux); font-size: .85rem; text-decoration: underline; }
.barre-alerte {
  color: var(--ko); font-weight: 700; white-space: nowrap;
  cursor: pointer; text-decoration: underline;
}
.barre-reessayer { white-space: nowrap; padding: .3rem .7rem; }
/* Deux mondes (Loïc, 08.11) : couleur d'en-tête par monde (body.monde-…, posée par common.js),
   mêmes couleurs que les blocs de l'accueil. */
.monde-stand .barre, .bloc-monde.monde-stand h2 { background: #1d2a22; border-bottom: 3px solid #6fbf8f; }
.monde-production .barre, .bloc-monde.monde-production h2 { background: #2b2318; border-bottom: 3px solid #c9a86a; }
.bloc-monde { margin-bottom: 1.2rem; }
.bloc-monde h2 { margin: 0 0 .6rem; padding: .4rem .7rem; border-radius: .5rem; border-bottom: 3px solid var(--bord); }
/* Retour D : fenêtre de confirmation / message dans la page (common.js
   confirmer), gros boutons tactiles. */
dialog.boite {
  background: var(--carte); color: var(--texte);
  border: 1px solid var(--bord); border-radius: 1rem;
  padding: 1.25rem; width: min(34rem, calc(100% - 2rem));
  max-height: calc(100vh - 2rem); overflow: auto;
}
dialog.boite::backdrop { background: rgba(0, 0, 0, .65); }
.boite-titre { font-size: 1.15rem; margin-bottom: .75rem; }
.boite-message { white-space: pre-line; margin: 0 0 .75rem; }
.recap { width: 100%; border-collapse: collapse; margin: .25rem 0 .5rem; }
.recap td { padding: .4rem; border-bottom: 1px solid var(--bord); }
.recap td:first-child { width: 3.5rem; text-align: right; font-weight: 600; white-space: nowrap; }
.recap td:last-child { text-align: right; white-space: nowrap; }
.recap td[colspan] { width: auto; text-align: left; font-weight: normal; white-space: normal; }
.recap-total { font-weight: 700; font-size: 1.1rem; text-align: right; margin: .5rem 0; }
.boite-erreur { color: var(--ko); font-weight: 600; white-space: pre-line; margin: .5rem 0; }
.boite-boutons { display: flex; gap: .6rem; margin-top: 1rem; }
.boite-boutons button { flex: 1; min-height: 3.4rem; font-size: 1.1rem; width: auto; }
/* Retour F : déconnexion / changement d'utilisateur (accueil). */
.compte { display: flex; gap: .6rem; align-items: center; margin-top: .5rem; flex-wrap: wrap; }
/* Retour I : vente sur écran large — ticket toujours visible à droite,
   gros boutons de paiement. */
.modes .mode { min-height: 3.4rem; font-size: 1.1rem; font-weight: 600; }
@media (min-width: 64rem) {
  main.vente {
    max-width: 84rem; display: grid; align-items: start;
    grid-template-columns: minmax(0, 1fr) 26rem; column-gap: 1.25rem;
    grid-template-rows: auto auto 1fr; /* le ticket n'étire pas l'en-tête */
  }
  main.vente > * { grid-column: 1; }
  main.vente > .ticket {
    grid-column: 2; grid-row: 1 / span 3;
    position: sticky; top: 3.8rem; bottom: auto;
    max-height: calc(100vh - 4.6rem); overflow: auto;
  }
}
/* Retour J : événements en erreur (common.js ecranErreurs). */
.err-ligne { border-bottom: 1px solid var(--bord); padding: .5rem 0; }
.err-ligne .boite-boutons { margin-top: .4rem; }
.err-texte .boite-erreur { display: block; margin: .25rem 0 0; }
button.danger { border-color: var(--ko); color: var(--ko); }
/* Journal de fermentation (B3) : gros boutons, alertes, historique. */
.gros-boutons { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: .6rem 0; }
.gros-boutons button { min-height: 3.4rem; font-size: 1.1rem; }
a.gros {
  display: block; text-align: center; padding: .8rem; margin-top: .5rem;
  border: 1px solid var(--accent); border-radius: .5rem;
  color: var(--accent); font-weight: 600; text-decoration: none;
}
.retard, .hors { color: var(--ko); font-weight: 600; }
.alerte { border: 1px solid var(--ko); color: var(--ko); border-radius: .5rem; padding: .5rem .8rem; margin-bottom: .5rem; }
.hist-ligne { display: flex; flex-wrap: wrap; gap: .2rem .8rem; border-bottom: 1px solid var(--bord); padding: .4rem 0; font-size: .92rem; }
.hist-ligne:last-child { border-bottom: none; }
/* Offert (0.9.4) : produit choisi dans la grille de la vente. */
.case-prod.choisi, .produit-btn.choisi { outline: 2px solid var(--accent); outline-offset: -2px; }
/* A6c : sélecteur de lot (gros boutons), bandeau de refus, panier par lot */
.lots-choix { display: flex; flex-direction: column; gap: .6rem; }
.lot-btn { min-height: 3.6rem; font-size: 1.1rem; text-align: left; }
.lot-ligne { display: flex; align-items: center; gap: .6rem; font-size: 1.05rem; }
.lot-ligne input { width: 5rem; font-size: 1.2rem; }
#signal { position: fixed; left: 1rem; right: 1rem; bottom: 4rem; z-index: 10; padding: 1rem;
  border-radius: 8px; font-size: 1.15rem; font-weight: 600; text-align: center; }
#signal.ko { background: var(--ko); color: #fff; }
#signal.ok { background: var(--ok); color: #000; }
.panier .t-ligne .l-nom { font-size: 1.15rem; }
.panier .l-qte { font-size: 1.4rem; font-weight: 700; min-width: 2.5rem; text-align: center; }

/* Retours de Loïc (portrait, 08.11) : l'attribut hidden doit gagner sur
   « label { display: block } » (le bénéficiaire restait affiché pour la casse),
   et un motif long passe à la ligne au lieu de déborder. */
[hidden] { display: none !important; }
.modes .mode { white-space: normal; overflow-wrap: anywhere; }
input.l-qte { width: 4.5rem; text-align: center; }

/* Ouverture du stand (Loïc 08.11, téléphone portrait) : cases compactes — nombre chargé en
   gros, encadré (.choisi) dès qu'il est > 0, « Moiry R » dessous ; 3 formats tiennent sur 360 px. */
.legende { color: var(--doux); font-size: .8rem; margin: 0 0 .4rem; }
.grille-charge .grille-v tr { grid-template-columns: minmax(5rem, 15rem); gap: .35rem; }
.grille-charge .grille-v th.ligne-lab { font-size: .85rem; gap: .4rem; overflow-wrap: anywhere; }
.grille-charge .grille-v th.ligne-lab .photo-lab { width: 2.6rem; height: 2.6rem; }
.grille-charge .grille-v .case-prod { min-width: 0; padding: .25rem .1rem; }
.grille-charge .grille-v .case-prod .c-prix { font-size: 1.5rem; line-height: 1.1; }
.grille-charge .grille-v .case-prod .c-stock { font-size: .7rem; }
/* Le chargement : carte à part (fond et bordure distincts), comme le ticket de la vente. */
.carte.charge-stand { background: var(--carte2); border-color: var(--accent); }
.charge-stand .t-ligne { flex-wrap: nowrap; padding: .35rem 0; border-bottom: 1px solid var(--bord); margin: 0; }
.charge-stand .t-ligne .l-nom { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; font-size: 1rem; }
.charge-stand .l-titre { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.charge-stand .l-lot { color: var(--doux); font-size: .8rem; }
.charge-stand .l-actions { flex: none; display: flex; align-items: center; gap: .3rem; }
.charge-stand input.l-qte { width: 3.2rem; padding: .3rem 0; font-size: 1.1rem; min-width: 0; }

/* R18-15 : arbre hiérarchique des personnes (indentation par supérieur) */
ul.arbre { list-style: none; margin: 0; padding-left: 0; }
ul.arbre ul.arbre { padding-left: 1.2rem; border-left: 2px solid var(--doux); margin-left: .3rem; }
ul.arbre li { padding: .25rem 0; }

/* R18-16 : marges d'impression des écrans imprimés depuis le navigateur ; Android ignore @page,
   donc le body les porte en padding à l'impression (Loïc 11.11) */
@page { margin: 14mm 0; }
@media print { body { padding: 0 14mm; } }
