/* Terminal d'entrepôt — le MÊME habillage que le back-office et le
   portail, demandé par Massimo : barre bleue #1E5EAA, fond #F0EEEE,
   panneaux blancs à bordure #DEE2E6, rayons courts, même police. Une
   personne qui passe d'un écran à l'autre doit reconnaître la maison.

   Ce qui reste propre à la tablette, et qui ne se négocie pas : gros
   doigts, gants, lumière d'entrepôt. Cibles d'au moins 60 px, la quantité
   en plus gros chiffre de l'écran, aucune dépendance à la souris — pas de
   survol, pas de menu déroulant, pas de tableau à faire défiler
   horizontalement.

   Le thème sombre d'origine a été abandonné pour l'uniformité. Si la
   tablette éblouit en entrepôt, c'est ici qu'on le rouvrira. */
:root {
  color-scheme: light;
  --encre: #374151;
  --ardoise: #4B5563;
  --acier: #6B7280;
  --acier-pale: #9CA3AF;
  --papier: #F0EEEE;
  --panneau: #FFFFFF;
  --trait: #DEE2E6;
  --entete-panneau: #F8F9FA;
  --laiton: #1E5EAA;
  --laiton-fonce: #17497F;
  --laiton-pale: #E9F1FA;
  --patine: #28A745;
  --patine-fonce: #1E7E34;
  --patine-pale: #E9F6EC;
  --oxyde: #D9534F;
  --oxyde-pale: #FBEAEA;
  --ambre: #B7791F;
  --ambre-pale: #FDF3DF;

  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--papier);
  color: var(--encre);
  font: 16px/1.45 var(--sans);
  -webkit-text-size-adjust: 100%;
  /* La page occupe au moins tout l'écran, pour que la barre des flux
     reste EN BAS : sur un iPad, une liste courte la laissait flotter au
     milieu de l'écran, un demi-écran vide dessous. */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  /* Installé sur l'écran d'accueil, le terminal passe SOUS la barre d'état
     (black-translucent, viewport-fit=cover) : l'heure et la pile
     recouvraient le logo et le nom du flux. Le haut est décalé d'autant,
     et body::before repeint la bande de la couleur de l'en-tête. Dans
     Safari, l'encart vaut zéro et rien ne bouge. */
  padding-top: env(safe-area-inset-top);
}
body::before {
  content: '';
  position: fixed; top: 0; left: 0; right: 0; z-index: 6;
  height: env(safe-area-inset-top);
  background: var(--laiton);
}
#app { flex: 1 0 auto; display: flex; flex-direction: column; }
#vue { flex: 1 0 auto; }

/* Un élément masqué par l'attribut `hidden` le reste, quel que soit son
   display : `#bandeau-refus { display: flex }` l'emportait sur la règle
   du navigateur, et une bande rouge VIDE restait en haut de l'écran —
   la couleur de l'alerte la plus grave, sans rien à lire. */
[hidden] { display: none !important; }

/* Rien ne se sélectionne par accident avec un gant, sauf ce qu'on veut
   pouvoir copier. */
body { -webkit-user-select: none; user-select: none; }
.selectionnable { -webkit-user-select: text; user-select: text; }

button {
  min-height: 60px;
  min-width: 60px;
  font-size: 1.05rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: 6px;
  border: 1px solid var(--trait);
  background: var(--panneau);
  color: var(--laiton);
  cursor: pointer;
  touch-action: manipulation;   /* pas de zoom au double-tap */
}
button:active { transform: scale(.98); }
button:disabled { opacity: .45; }
button:focus-visible { outline: 3px solid var(--laiton); outline-offset: 2px; }

.principal { background: var(--laiton); border-color: var(--laiton); color: #fff; }
.danger { background: var(--panneau); border-color: var(--oxyde); color: var(--oxyde); }
.succes { background: var(--patine); border-color: var(--patine); color: #fff; }

/* --- bandeaux ------------------------------------------------------- */
/* Pleins et saturés, pas pâles comme au back-office : ils doivent se
   voir de l'autre bout d'une allée. */
.bandeau {
  padding: 12px 16px;
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
}
#bandeau-hors-ligne { background: var(--oxyde); color: #fff; }
#bandeau-file { background: var(--ambre); color: #fff; }
#bandeau-refus {
  background: var(--oxyde);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
#bandeau-refus button { min-height: 44px; padding: 0 14px; font-size: .9rem; background: #fff; border-color: #fff; color: var(--oxyde); }

/* --- en-tête : la barre bleue du back-office ------------------------ */
.entete {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  min-height: 52px;
  background: var(--laiton);
  color: #fff;
  position: sticky;
  top: env(safe-area-inset-top);
  z-index: 5;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
/* flex : le logo est un bloc, et le filet séparateur (::after) passait
   dessous au lieu de se ranger à sa droite. */
.entete .marque { font-weight: 700; letter-spacing: .02em; font-size: 1.05rem; display: flex; align-items: center; }
.entete .marque::after {
  content: '';
  display: inline-block;
  width: 1px; height: 20px;
  margin: 0 2px 0 14px;
  background: rgba(255,255,255,0.25);
  vertical-align: middle;
}
.entete .ecran { font-weight: 600; color: rgba(255,255,255,0.85); }
.entete .qui { margin-left: auto; font-size: .82rem; color: rgba(255,255,255,0.75); text-align: right; line-height: 1.3; }

/* --- contenu -------------------------------------------------------- */
.page {
  padding: 16px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left));
  display: flex; flex-direction: column; gap: 14px;
}
.titre { font-size: 1.25rem; font-weight: 700; margin: 0; color: var(--encre); }
.sous { color: var(--acier); font-size: .95rem; margin: 0; }
.vide { color: var(--acier); text-align: center; padding: 40px 16px; font-size: 1.05rem; line-height: 1.6; }

.carte {
  background: var(--panneau);
  border: 1px solid var(--trait);
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  overflow: hidden;
  color: var(--encre);
}
.carte-entete {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--entete-panneau);
  border-bottom: 1px solid var(--trait);
  font-weight: 700;
  flex-wrap: wrap;
}
.carte-entete .compte { margin-left: auto; font-size: .85rem; color: var(--acier); font-weight: 600; }

/* Une ligne à prélever. La QUANTITÉ est le plus gros chiffre de l'écran :
   c'est la seule information qu'on ne doit jamais lire de travers. */
.ligne {
  display: grid;
  /* minmax(0, …) : une description sans espace (« ***DISCONTINUÉ***VERTIGO »)
     élargissait la colonne et poussait « Pris » hors d'un écran de téléphone. */
  grid-template-columns: 5.2rem minmax(0, 1fr) auto;
  gap: 4px 14px;
  align-items: center;
  padding: 14px;
  border-top: 1px solid var(--trait);
}
.ligne:first-of-type { border-top: none; }
.ligne .qte {
  grid-row: 1 / span 2;
  font-size: 2.1rem;
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  background: var(--papier);
  border: 1px solid var(--trait);
  border-radius: 6px;
  padding: 8px 4px;
  color: var(--encre);
}
.ligne .sku { font-weight: 700; font-size: 1.05rem; word-break: break-all; font-family: var(--mono); }
.ligne .desc { color: var(--acier); font-size: .88rem; line-height: 1.35; overflow-wrap: anywhere; }
.ligne .ou {
  grid-column: 2;
  font-size: .82rem;
  color: var(--laiton);
  font-weight: 700;
  letter-spacing: .02em;
}
/* La colonne est FIXÉE, pas seulement la ligne. Un élément qui n'a
   qu'une ligne définie est placé AVANT ceux qui n'ont rien de défini :
   le bouton prenait la 2e colonne et le code d'article passait à la
   3e — « 2 | Pris | RVT41CC » au lieu de « 2 | RVT41CC | Pris ». */
.ligne .action { grid-row: 1 / span 2; grid-column: 3; }
.ligne .action button { min-height: 64px; padding: 0 18px; }
.ligne.faite { opacity: .55; }
/* Une carte entière peut être « faite » : une ligne de retour reçue au
   complet (retours.js), qui n'est pas une .ligne — son en-tête prend toute
   la largeur au lieu de la colonne de la quantité. */
.carte.faite { opacity: .55; }
.carte-entete .sku { font-family: var(--mono); }
.ligne.faite .qte { background: var(--patine-pale); border-color: var(--patine); color: var(--patine-fonce); }

.etiq {
  display: inline-block;
  white-space: nowrap;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 10px;
  border: 1px solid var(--trait);
  background: var(--panneau);
  color: var(--acier);
}
.etiq.kit { background: var(--laiton-pale); border-color: var(--laiton); color: var(--laiton); }

/* --- connexion : la boîte du back-office ---------------------------- */
.connexion { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.connexion .boite {
  width: 100%;
  max-width: 26rem;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--panneau);
  border: 1px solid var(--trait);
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  padding: 22px 24px;
}
.connexion .marque { font-size: 1.5rem; font-weight: 700; color: var(--laiton); letter-spacing: .02em; }
label { display: block; font-size: .85rem; font-weight: 600; color: var(--ardoise); margin-bottom: 6px; }
input, select {
  width: 100%;
  min-height: 60px;
  padding: 0 14px;
  font-size: 1.15rem;
  font-family: inherit;
  color: var(--encre);
  background: var(--panneau);
  border: 1px solid var(--trait);
  border-radius: 6px;
}
input:focus, select:focus { outline: 3px solid var(--laiton); outline-offset: 1px; }
.erreur {
  background: var(--oxyde-pale);
  border: 1px solid var(--oxyde);
  color: var(--oxyde);
  padding: 12px 14px;
  border-radius: 6px;
  font-weight: 600;
  line-height: 1.45;
}
.note { color: var(--acier); font-size: .85rem; line-height: 1.5; }

/* --- barre du bas : les flux ---------------------------------------- */
.flux {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-auto-flow: column;
  /* Des colonnes égales (cinq onglets depuis le 2026-10-08, avec les
     Retours) : à la largeur de leur libellé, « Réception »
     prenait le double de « Bacs » sur une tablette. */
  grid-auto-columns: minmax(0, 1fr);
  gap: 1px;
  background: var(--trait);
  border-top: 1px solid var(--trait);
}
/* Les boutons descendent sous l'indicateur d'accueil (iPhone, iPad sans
   bouton) sans que leur libellé y passe : la hauteur grandit de l'encart,
   le libellé reste au-dessus. */
.flux button {
  border-radius: 0;
  border: none;
  min-height: calc(68px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--panneau);
  font-size: .95rem;
  color: var(--ardoise);
}
.flux button.actif { background: var(--laiton); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  button:active { transform: none; }
}

/* Le mot-symbole de rubi.ca, en ligne : blanc sur la barre, encre sur la connexion. */
.entete .marque .logo { display: block; height: 16px; width: auto; color: #fff; }
.connexion .marque .logo, .boite .marque .logo { display: block; height: 28px; width: auto; color: var(--encre, #2B2B2B); margin: 0 auto 8px; }

/* --- scan : champ (lecteur Bluetooth) + caméra ----------------------- */
.barre-scan { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.barre-scan input { font-family: var(--mono); letter-spacing: .02em; }
.barre-scan button {
  display: inline-flex; align-items: center; gap: 8px; padding: 0 16px;
  background: var(--laiton); border-color: var(--laiton); color: #fff;
}
@media (max-width: 380px) { .barre-scan button span { display: none; } }
.ligne.scannee { background: var(--patine-pale); transition: background .3s; }

.entete .chercher-article {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; min-width: 0; padding: 0 12px;
  background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.35); color: #fff; font-size: .9rem;
}
.entete .chercher-article.actif { background: #fff; color: var(--laiton); }
/* Le poste de la tablette : discret dans l'en-tête, lisible au doigt. */
.entete .poste { display: flex; align-items: center; gap: 6px; margin-left: 10px; font-size: .78rem; color: rgba(255,255,255,0.8); }
.entete .poste select {
  min-height: 36px; padding: 0 8px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.12); color: #fff; font: inherit; font-size: .9rem; font-weight: 600;
}
.entete .poste select option { color: #222; }

/* --- fiche article --------------------------------------------------- */
.mono { font-family: var(--mono); }
.chiffres-article { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chiffres-article > div { display: flex; flex-direction: column; gap: 2px; background: var(--papier); border-radius: 6px; padding: 10px 12px; }
.chiffres-article .valeur { font-size: 1.8rem; font-weight: 800; font-family: var(--mono); color: var(--encre); }
.rangee-stock { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--trait); }
.rangee-stock:first-of-type { border-top: none; }
.rangee-stock .fort { font-weight: 700; }
.rangee-stock .droite { text-align: right; font-size: 1.15rem; }
.choix-article {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%;
  text-align: left; border: none; border-top: 1px solid var(--trait); border-radius: 0; padding: 10px 14px; color: var(--encre);
}
.choix-article .sku { font-family: var(--mono); font-weight: 700; color: var(--laiton); }
.choix-article .desc { font-weight: 400; font-size: .9rem; color: var(--acier); }
.barre-scan input::placeholder { font-family: var(--sans); font-size: 1rem; letter-spacing: 0; }

/* --- téléphone : le terminal tient aussi dans une main ---------------- */
@media (max-width: 420px) {
  .page { padding: 12px; }
  .ligne { grid-template-columns: 3.6rem minmax(0, 1fr) auto; gap: 4px 10px; padding: 12px 10px; }
  .ligne .qte { font-size: 1.6rem; }
  .ligne .action button { padding: 0 12px; }
  .entete { gap: 8px; padding: 0 10px; }
}

/* --- le scan est le geste du prélèvement, pas un raccourci ----------- */
.barre-scan.principale { gap: 10px; }
.barre-scan.principale input { min-height: 68px; font-size: 1.2rem; }
.barre-scan.principale button { min-height: 68px; padding: 0 22px; font-size: 1.1rem; }
@media (max-width: 380px) { .barre-scan.principale button span { display: inline; } }
/* « Sans scan » : possible, mais visiblement secondaire. */
.ligne .action button.sans-scan {
  background: var(--panneau); color: var(--acier); border: 1px solid var(--trait);
  font-size: .85rem; font-weight: 600; min-height: 52px; padding: 0 12px;
}

/* --- caméra en continu : ce qui manque, sous l'image ----------------- */
/* Annuler un prélèvement : discret sur une ligne prise, jamais gros — c'est
   un retour en arrière, pas le geste du jour. */
.ligne .action button.annuler { background:#fff; color:var(--oxyde, #b23a2a); border:1px solid var(--oxyde, #b23a2a); min-height:48px; padding:0 12px; }

/* Préparation terminée : la commande passe au bureau (R158), on le dit une
   fois sur l'écran vide. */
.fin-preparation { padding:12px 14px; border:1px solid var(--patine); border-radius:8px;
  background:var(--patine-pale); color:var(--patine-fonce); font-weight:600; }

.reste-titre { font-weight: 700; font-size: .95rem; margin-bottom: 6px; color: #374151; }
.reste-ligne { display: grid; grid-template-columns: 3rem 1fr; gap: 10px; align-items: center;
  padding: 8px 0; border-top: 1px solid #e5e7eb; font-size: .95rem; line-height: 1.35; }
.reste-qte { font-family: var(--mono); font-weight: 800; font-size: 1.3rem; text-align: center;
  background: #f3f4f6; border-radius: 6px; padding: 4px 0; }
.ou-autres { font-weight: 400; color: var(--acier); }
.reste-ou { color: #1E5EAA; font-weight: 700; font-size: .8rem; letter-spacing: .02em; }
.reste-fini { padding: 14px 4px; font-weight: 700; color: #1E7E34; }

/* --- L'animation de chargement RUBI : COPIE de /commun/css/chargement.css
   (le service worker ne met pas /commun en cache). Corriger l'une, c'est
   corriger l'autre. --------------------------------------------------- */
.rubi-chargement { width: 150px; height: auto; overflow: visible; display: block; }
.rubi-chargement .rubi-fantome { opacity: .13; }
.rubi-chargement .rubi-goutte {
  transform-box: fill-box; transform-origin: 50% 100%;
  animation: rubi-goutte 2.6s cubic-bezier(.55,0,1,.45) infinite;
}
.rubi-chargement .rubi-onde {
  fill: none; stroke: currentColor; stroke-width: 1.1;
  transform-box: fill-box; transform-origin: 50% 50%;
  opacity: 0; animation: rubi-onde 2.6s cubic-bezier(.2,.6,.3,1) infinite;
}
.rubi-chargement .rubi-onde-2 { animation-delay: .16s; stroke-width: .8; }
@keyframes rubi-goutte {
  0%   { transform: translateY(-44px) scale(.78, 1.38); opacity: 0; }
  7%   { opacity: 1; }
  27%  { transform: translateY(0) scale(.78, 1.38); animation-timing-function: ease-out; }
  31%  { transform: translateY(0) scale(1.32, .66); }
  37%  { transform: translateY(0) scale(.94, 1.07); }
  43%, 84% { transform: translateY(0) scale(1, 1); opacity: 1; }
  93%  { transform: translateY(0) scale(1, 1); opacity: 0; }
  100% { transform: translateY(-44px) scale(.78, 1.38); opacity: 0; }
}
@keyframes rubi-onde {
  0%, 27% { transform: scale(.15); opacity: 0; }
  30%     { opacity: .55; }
  62%     { transform: scale(1.35); opacity: 0; }
  100%    { transform: scale(1.35); opacity: 0; }
}

/* Le conteneur : n'apparaît qu'après 250 ms — un chargement éclair ne
   clignote pas à chaque changement d'écran. */
.rubi-chargement-bloc, .rubi-chargement-ligne {
  animation: rubi-apparaitre .3s ease-out .25s both;
}
@keyframes rubi-apparaitre { from { opacity: 0; } to { opacity: 1; } }
.rubi-chargement-bloc { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.rubi-chargement-petit .rubi-chargement { width: 64px; }
.rubi-chargement-legende { font-size: 13px; opacity: .75; text-align: center; }
/* Dans un bouton ou une cellule : à la hauteur du texte, jamais plus. */
.rubi-chargement-ligne { display: inline-flex; align-items: center; vertical-align: middle; }
.rubi-chargement-ligne .rubi-chargement { width: auto; height: 1.15em; overflow: hidden; }

/* Pour les lecteurs d'écran seulement. */
.rubi-cache {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* Mouvement réduit : le logo plein, fixe, qui respire doucement. */
.rubi-chargement-calme { display: none; }
@media (prefers-reduced-motion: reduce) {
  .rubi-chargement-anime { display: none; }
  .rubi-chargement-calme { display: block; animation: rubi-respire 2.4s ease-in-out infinite; }
  .rubi-chargement-bloc, .rubi-chargement-ligne { animation-duration: .01s; }
}
@keyframes rubi-respire { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
/* Il prend la couleur du texte autour (currentColor). */
.rubi-chargement-bloc { padding: 40px 0; }
.rubi-chargement-petit { padding: 12px 0; }

/* --- scanner, puis sauvegarder ; le lot (R161) ----------------------- */
/* Un article scanné n'est PAS pris : il est en JAUNE (ambre) tant que
   « Sauvegarder » ne l'a pas confirmé — vert seulement une fois parti. */
.ligne.groupe { grid-template-rows: auto auto auto; }
.ligne .statut { font-weight: 700; font-size: .92rem; margin-top: 4px; color: var(--acier); }
.ligne.marquee { background: var(--ambre-pale); box-shadow: inset 6px 0 0 var(--ambre); }
.ligne.marquee .qte { background: var(--ambre); border-color: var(--ambre); color: #fff; }
.ligne.marquee .statut, .ligne.partielle .statut { color: #7A4F0E; }
.ligne.partielle { background: #FFFBF2; box-shadow: inset 6px 0 0 #E8C27A; }
.ligne.partielle .qte { border-color: var(--ambre); color: #7A4F0E; }
.ligne.refusee { background: var(--oxyde-pale); box-shadow: inset 6px 0 0 var(--oxyde); }
.ligne.refusee .statut { color: var(--oxyde); }
.ligne.groupe.scannee { background: var(--ambre-pale); }
.ligne .detail { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.detail-ligne {
  display: grid; grid-template-columns: minmax(0, 1.3fr) 2.6rem minmax(0, 2fr) auto; gap: 8px;
  align-items: center; padding: 6px 10px; border: 1px solid var(--trait); border-radius: 6px;
  background: var(--panneau); font-size: .9rem; min-height: 48px;
}
.detail-cmd { font-weight: 700; font-family: var(--mono); overflow-wrap: anywhere; }
.detail-qte { font-family: var(--mono); font-weight: 800; text-align: center; }
.detail-etat { color: var(--acier); overflow-wrap: anywhere; }
.detail-ligne.marquee { border-color: var(--ambre); background: var(--ambre-pale); }
.detail-ligne.marquee .detail-etat, .detail-ligne.partielle .detail-etat { color: #7A4F0E; font-weight: 700; }
.detail-ligne.partielle { border-color: #E8C27A; }
.detail-ligne.faite { opacity: .6; }
.detail-ligne.faite .detail-etat { color: var(--patine-fonce); font-weight: 700; }
.detail-ligne.attente .detail-etat { color: var(--ambre); font-weight: 700; }
.detail-ligne.refusee { border-color: var(--oxyde); background: var(--oxyde-pale); }
.detail-ligne.refusee .detail-etat { color: var(--oxyde); font-weight: 700; }
.detail-ligne .prochain { color: var(--laiton); white-space: nowrap; }
.detail-ligne button.annuler { min-height: 44px; min-width: 0; padding: 0 10px; font-size: .85rem;
  background: #fff; color: var(--oxyde); border: 1px solid var(--oxyde); }

.lot-commandes { display: flex; flex-direction: column; gap: 6px; }
.lot-commande { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--panneau);
  border: 1px solid var(--trait); border-radius: 6px; }
.lot-commande-nom { flex: 1; min-width: 0; line-height: 1.35; }
.lot-commande-nom strong { font-family: var(--mono); }
.lot-commande button { min-height: 48px; padding: 0 12px; font-size: .9rem; }

/* « Sauvegarder » : gros, en bas, TOUJOURS là — collé au-dessus de la barre
   des onglets (quand il y en a une) pendant qu'on fait défiler la liste. */
.barre-sauvegarder {
  position: sticky; bottom: 0; z-index: 5;
  margin: 0 -16px -16px; padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--papier); border-top: 1px solid var(--trait);
  display: flex; flex-direction: column; gap: 6px;
}
#app:has(.flux) .barre-sauvegarder { bottom: calc(68px + env(safe-area-inset-bottom)); padding-bottom: 12px; }
.barre-sauvegarder button { width: 100%; min-height: 76px; font-size: 1.3rem; font-weight: 800; }
.barre-sauvegarder button:disabled { background: var(--acier-pale); border-color: var(--acier-pale); color: #fff; opacity: 1; }
.barre-sauvegarder .note:empty { display: none; }

/* La question avant de quitter : dans la page, pas un window.confirm. */
.dialogue-fond { position: fixed; inset: 0; z-index: 20; background: rgba(17, 24, 39, .55);
  display: flex; align-items: center; justify-content: center; padding: 16px; }
.dialogue { background: var(--panneau); border-radius: 10px; padding: 20px; max-width: 480px; width: 100%;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.dialogue p { margin: 0 0 16px; line-height: 1.5; }
.dialogue-boutons { display: flex; flex-direction: column; gap: 8px; }

@media (max-width: 420px) {
  .barre-sauvegarder { margin: 0 -12px -12px; padding-left: 12px; padding-right: 12px; }
  .detail-ligne { grid-template-columns: minmax(0, 1fr) 2.2rem auto; }
  .detail-ligne .detail-etat { grid-column: 1 / -1; grid-row: 2; }
}

/* --- téléphone (< 768 px) : un en-tête d'UNE ligne, des onglets lisibles --
   Capture de Massimo à ~400 px (2026-10-30) : « Article » coupé, « Tous les »
   tronqué, le nom et la version sur trois lignes, « Préparatior » en bas. Sur
   une tablette (≥ 768 px), rien de ce bloc ne s'applique.
   · « Article » et « Poste » deviennent deux boutons icône + mot court ; la
     liste des postes reste le <select> natif, invisible PAR-DESSUS l'icône :
     le doigt ouvre le sélecteur du téléphone, aucun menu à écrire ;
   · le nom, la tablette, la version et le poste choisi passent au pied de
     page (pied() dans app.js), au-dessus des onglets ;
   · chaque onglet : une icône au-dessus d'un libellé plus petit, coupé
     seulement entre deux mots — jamais au milieu (« Préparatio n »). */
.pied-terminal, .entete .poste-court, .flux .icone { display: none; }

@media (max-width: 767px) {
  .entete {
    gap: 6px; min-height: 56px;
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }
  .entete .marque::after { margin-left: 10px; }
  /* Le nom du flux prend la place qui reste ; les noms sont courts, la
     coupure n'est qu'un filet de sécurité. */
  .entete .ecran { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .entete .qui, .entete .poste-mot { display: none; }

  .entete .chercher-article, .entete .poste-court {
    flex: none;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 48px; min-width: 54px; padding: 3px 6px;
    font-size: .7rem; font-weight: 600; line-height: 1.1;
    border-radius: 6px;
    background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.35); color: #fff;
  }
  .entete .chercher-article.actif { background: #fff; color: var(--laiton); }
  .entete .chercher-article svg, .entete .poste-court svg { flex: none; width: 20px; height: 20px; }
  .entete .poste { position: relative; margin: 0; flex: none; }
  /* 16 px : en dessous, Safari zoome la page à l'ouverture de la liste. */
  .entete .poste select {
    position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0;
    opacity: 0; font-size: 16px; cursor: pointer;
  }
  .entete .poste:has(select:focus-visible) .poste-court { outline: 3px solid #fff; outline-offset: 2px; }

  .pied-terminal {
    display: block;
    padding: 10px max(12px, env(safe-area-inset-right)) 12px max(12px, env(safe-area-inset-left));
    font-size: .75rem; line-height: 1.4; color: var(--acier); text-align: center;
    overflow-wrap: anywhere;
  }

  .flux button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-width: 0;
    padding: 6px 2px env(safe-area-inset-bottom);
    font-size: .72rem; line-height: 1.15; letter-spacing: -.01em;
    overflow-wrap: normal; word-break: normal; hyphens: none;
  }
  .flux .icone { display: block; flex: none; width: 22px; height: 22px; }

  .barre-scan input::placeholder { font-size: .9rem; }
}

/* Le plan du trajet (R190) : presque tout l'écran, la liste des arrêts dessous. */
.dialogue.plan-dialogue { width: min(96vw, 1200px); max-width: none; max-height: 94vh; overflow: auto; }
.plan-carte svg { width: 100%; height: auto; max-height: 62vh; display: block; background: #fff; border: 1px solid var(--trait, #ccc); border-radius: 8px; }
.plan-arrets { list-style: none; padding: 0; margin: 12px 0; columns: 2; column-gap: 20px; }
.plan-arrets li { break-inside: avoid; margin: 0 0 6px; font-size: 1.05rem; }
.plan-arrets li.fait { color: #7f8c8d; }
.plan-arrets .num { display: inline-block; min-width: 28px; padding: 2px 6px; border-radius: 14px; background: #c0392b; color: #fff; text-align: center; font-weight: 700; }
.plan-arrets li.fait .num { background: #7f8c8d; }
@media (max-width: 700px) { .plan-arrets { columns: 1; } }


/* --- poste Pointage (R218) ------------------------------------------ */
/* Des cibles larges : on pointe en passant, parfois avec des gants. */
.grille-noms { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.nom-employe { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; min-height: 76px; padding: 10px 14px; text-align: left; color: var(--encre); }
.nom-employe-nom { font-size: 1.1rem; font-weight: 700; }
.nom-employe-etat { font-size: .85rem; font-weight: 500; color: var(--acier); }
.nip-points { display: flex; gap: 16px; justify-content: center; padding: 8px 0; }
.nip-points span { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--laiton); }
.nip-points span.plein { background: var(--laiton); }
.pave { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 420px; width: 100%; margin: 0 auto; }
.pave button { min-height: 72px; font-size: 1.6rem; }
.pave [data-effacer], .pave [data-annuler] { font-size: 1rem; }
.gestes { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.gestes button { min-height: 96px; font-size: 1.3rem; }
.confirmation-faite, .confirmation-attente { border-radius: 6px; padding: 28px 18px; text-align: center; display: flex; flex-direction: column; gap: 10px; }
.confirmation-faite { background: var(--patine-pale); border: 2px solid var(--patine); color: var(--patine-fonce); }
.confirmation-attente { background: var(--ambre-pale); border: 2px solid var(--ambre); color: var(--ambre); }
.confirmation-qui { font-size: 1.1rem; font-weight: 600; }
.confirmation-titre { font-size: 1.6rem; font-weight: 800; }
.confirmation-note { font-size: .95rem; font-weight: 500; color: var(--encre); }
