/* AubeDistributor : utilitaire suisse avec l'habillage arrondi de la Suite Aube.
   Blanc pur en clair, noir pur en sombre, filets 1 px, aucun italique.
   Les couleurs d'état (ok, bas, vide) ne portent jamais le sens seules :
   toujours avec une icône et un libellé. */
:root {
  --fond: #fff; --surf: #fff; --surf2: #f4f4f6; --ligne: #e5e5e9; --ligne2: #cfcfd5;
  --encre: #111214; --encre2: #55575d; --encre3: #85878d;
  --primaire: #111214; --sur-primaire: #fff;
  --ok: #0ca30c; --bas: #fab219; --vide: #d03b3b; --inconnu: #b9bbc1;
  --piste: #ececf0; --danger: #c22f2f; --danger-fond: #fdf1f1;
  --r: 16px; --rc: 10px; --rp: 999px; --ring: 0 0 0 3px rgba(17, 18, 20, .18);
  --ombre: 0 1px 2px rgba(17, 18, 20, .04), 0 6px 20px rgba(17, 18, 20, .05);
  --barre: 56px; --onglets: 62px;
  --police: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #000; --surf: #0c0c0e; --surf2: #17171a; --ligne: #26262b; --ligne2: #3a3a40;
    --encre: #f5f5f7; --encre2: #a9abb1; --encre3: #7c7e85;
    --primaire: #f5f5f7; --sur-primaire: #000;
    --piste: #222226; --inconnu: #55575d; --danger: #ff6b6b; --danger-fond: #1c0d0d;
    --ring: 0 0 0 3px rgba(245, 245, 247, .25);
    --ombre: 0 1px 2px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--encre); font: 16px/1.5 var(--police);
  min-height: 100dvh; -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1;
}
em, i { font-style: normal; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0 0 .4rem; line-height: 1.15; letter-spacing: -.015em; font-weight: 650; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
p { margin: 0 0 1rem; }
small { font-size: .8em; font-weight: 400; color: var(--encre3); }
[hidden] { display: none !important; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico-grand { width: 40px; height: 40px; stroke-width: 1.4; }
.mono { font-family: var(--mono); font-size: .92em; }
.sourd { color: var(--encre2); }
.petit { font-size: .86rem; }
.fort { font-weight: 700; }
.centre { justify-content: center; text-align: center; }
.etiquette { font-family: var(--mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--encre3); margin: 0 0 .5rem; }
.lien-souligne { text-decoration: underline; text-underline-offset: 2px; }
.texte-libre { white-space: pre-line; }
.impression-seule { display: none; }

/* ------------------------------------------------------------------ boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 44px; padding: .55rem 1.05rem; border-radius: var(--rp); border: 1px solid var(--ligne2);
  background: var(--surf); color: var(--encre); font-weight: 600; font-size: .95rem; line-height: 1.2;
  cursor: pointer; text-align: center; transition: background .12s, transform .08s;
}
.btn:hover { text-decoration: none; background: var(--surf2); }
.btn:active { transform: scale(.98); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primaire { background: var(--primaire); border-color: var(--primaire); color: var(--sur-primaire); }
.btn-primaire:hover { background: var(--primaire); opacity: .88; }
.btn-danger { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger-fond); }
.btn-grand { min-height: 50px; padding: .7rem 1.4rem; font-size: 1rem; }
.btn-petit { min-height: 34px; padding: .3rem .8rem; font-size: .85rem; }
.btn-bloc { width: 100%; }
.btn[disabled] { opacity: .5; cursor: progress; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0; }

/* ------------------------------------------------------------------ barre du haut */
.barre {
  position: sticky; top: 0; z-index: 30; height: var(--barre);
  display: flex; align-items: center; gap: 1rem; padding: 0 1rem;
  background: color-mix(in srgb, var(--fond) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ligne);
}
.marque { display: flex; align-items: center; gap: .5rem; font-size: 1.05rem; letter-spacing: -.01em; white-space: nowrap; }
.marque:hover { text-decoration: none; }
.marque b { font-weight: 700; }
.marque span { font-weight: 450; }
.marque-glyphe { width: 26px; height: 26px; fill: var(--encre); }
.marque-trait { fill: none; stroke: var(--fond); stroke-width: 2.2; stroke-linecap: round; }
.nav { margin-left: auto; display: flex; align-items: center; gap: .2rem; }
.nav > a:not(.btn) { padding: .45rem .8rem; border-radius: var(--rp); color: var(--encre2); font-weight: 550; font-size: .93rem; }
.nav > a:not(.btn):hover { background: var(--surf2); text-decoration: none; color: var(--encre); }
.nav > a.actif { background: var(--surf2); color: var(--encre); }
.nav-compte { padding: 0 !important; margin-left: .4rem; width: 34px; height: 34px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--surf2); border: 1px solid var(--ligne); }
.nav-compte img { width: 100%; height: 100%; object-fit: cover; }
.nav-compte span { font-weight: 700; font-size: .9rem; }
.langues { display: inline-flex; border: 1px solid var(--ligne); border-radius: var(--rp); padding: 2px; gap: 2px; }
.langues a { padding: .25rem .6rem; border-radius: var(--rp); font-family: var(--mono); font-size: .75rem; color: var(--encre2); }
.langues a:hover { text-decoration: none; background: var(--surf2); }
.langues a.actif { background: var(--primaire); color: var(--sur-primaire); }

/* onglets du bas (téléphone) */
.onglets { display: none; }
@media (max-width: 760px) {
  .connecte .nav { display: none; }
  .onglets {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
    height: calc(var(--onglets) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--fond) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--ligne);
  }
  .onglets a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: .68rem; font-weight: 600; color: var(--encre3); }
  .onglets a:hover { text-decoration: none; }
  .onglets a.actif { color: var(--encre); }
  .onglets .ico { width: 23px; height: 23px; }
  .connecte main { padding-bottom: calc(var(--onglets) + 1.5rem + env(safe-area-inset-bottom)); }
  .connecte .pied { padding-bottom: calc(var(--onglets) + 1rem + env(safe-area-inset-bottom)); }
}

/* ------------------------------------------------------------------ page */
main.page { max-width: 1080px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
.etroit { max-width: 440px; margin: 2rem auto; }
.entete { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.entete .actions { margin: 0; }
.retour { display: inline-flex; align-items: center; gap: .3rem; color: var(--encre2); font-size: .9rem; margin-bottom: .6rem; }
.retour .ico { width: 17px; height: 17px; }
.section { margin: 2rem 0 .7rem; }
.sous-nav { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0 0 1rem; }
.sous-nav a { padding: .4rem .9rem; border-radius: var(--rp); border: 1px solid var(--ligne); font-size: .88rem; font-weight: 550; color: var(--encre2); white-space: nowrap; }
.sous-nav a:hover { text-decoration: none; background: var(--surf2); }
.sous-nav a.actif { background: var(--primaire); border-color: var(--primaire); color: var(--sur-primaire); }

.carte { background: var(--surf); border: 1px solid var(--ligne); border-radius: var(--r); box-shadow: var(--ombre); padding: 1rem; margin: 0 0 1rem; }
.encart { border: 1px solid var(--ligne2); border-radius: var(--r); padding: .9rem 1rem; margin: 0 0 1rem; background: var(--surf2); }
.encart p { margin: 0 0 .4rem; }
.encart p:last-child { margin: 0; }
.encart .ico { vertical-align: -4px; }
.encart .actions { margin-bottom: 0; }

.flashs { max-width: 1080px; margin: .8rem auto 0; padding: 0 1rem; }
.flash { border-radius: var(--rc); padding: .7rem 1rem; margin-bottom: .5rem; border: 1px solid var(--ligne2); background: var(--surf2); font-weight: 500; }
.flash-erreur { border-color: var(--danger); background: var(--danger-fond); color: var(--danger); }
.flash-ok { border-left: 4px solid var(--ok); }

.pied { max-width: 1080px; margin: 0 auto; padding: 1.5rem 1rem 2rem; display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; align-items: center; color: var(--encre3); font-size: .82rem; border-top: 1px solid var(--ligne); }
.pied a:hover { color: var(--encre); }
.langues-pied { margin-left: auto; }

/* ------------------------------------------------------------------ formulaires */
.formulaire fieldset { border: 1px solid var(--ligne); }
fieldset { margin: 0 0 1rem; min-width: 0; }
legend { font-weight: 650; padding: 0 .3rem; margin-left: -.3rem; }
.champ { display: flex; flex-direction: column; gap: .3rem; margin: 0 0 .9rem; font-size: .9rem; font-weight: 550; min-width: 0; }
.champ > span { color: var(--encre); }
.champ-court { max-width: 260px; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%; min-height: 44px; padding: .55rem .75rem; border: 1px solid var(--ligne2); border-radius: var(--rc);
  background: var(--surf2); font-size: 1rem; font-weight: 400;
}
textarea { resize: vertical; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2385878d' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7rem center; background-size: 16px;
}
input::placeholder, textarea::placeholder { color: var(--encre3); }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--primaire); flex: none; }
.rangee-champs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 .8rem; align-items: end; }
.mdp { position: relative; display: block; }
.mdp input { padding-right: 3rem; }
.mdp-oeil { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: none; color: var(--encre3); display: grid; place-items: center; border-radius: var(--rc); cursor: pointer; }
.mdp-oeil[aria-pressed=true] { color: var(--encre); }
.choix-segmente { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: 1rem; }
.choix-segmente label { display: flex; gap: .6rem; align-items: flex-start; border: 1px solid var(--ligne2); border-radius: var(--rc); padding: .7rem; cursor: pointer; font-weight: 550; font-size: .92rem; }
.choix-segmente label:has(input:checked) { border-color: var(--primaire); box-shadow: inset 0 0 0 1px var(--primaire); }
.choix-segmente small { display: block; }
.interrupteur { display: flex; gap: .7rem; align-items: flex-start; cursor: pointer; }
.cases-a-cocher { border: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .4rem; }
.cases-a-cocher legend { margin-bottom: .4rem; }
.cases-a-cocher label { display: flex; gap: .6rem; align-items: center; padding: .5rem .7rem; border: 1px solid var(--ligne); border-radius: var(--rc); cursor: pointer; }
.cases-a-cocher label:has(input:checked) { border-color: var(--ligne2); background: var(--surf2); }
.outil-groupe { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; }
.outil-groupe .champ { margin-bottom: .9rem; }
.outil-groupe .btn { margin-bottom: .9rem; }
.barre-envoi { margin: 1rem 0; }
.champ-nb { max-width: 6.5rem; text-align: right; min-height: 38px !important; padding: .35rem .5rem !important; }

/* ------------------------------------------------------------------ tuiles, fiche, tableaux */
.tuiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; margin: 0 0 1rem; }
.tuile { border: 1px solid var(--ligne); border-radius: var(--r); padding: .8rem .9rem; background: var(--surf); min-width: 0; }
.tuile dt { font-family: var(--mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--encre3); }
.tuile dd { margin: .25rem 0 0; font-size: 1.45rem; font-weight: 650; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tuile-pied { display: block; font-size: .78rem; color: var(--encre2); margin-top: .15rem; }
.tuile-ecart { border-color: var(--ligne2); background: var(--surf2); }
@media (max-width: 760px) { .tuiles { grid-template-columns: 1fr 1fr; } .tuile dd { font-size: 1.25rem; } }

.fiche { margin: 0; display: grid; }
.fiche > div { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--ligne); }
.fiche > div:last-child { border-bottom: 0; }
.fiche dt { color: var(--encre2); font-size: .9rem; }
.fiche dd { margin: 0; }
.fiche-large dt { font-weight: 650; color: var(--encre); }
.fiche-large dd { color: var(--encre2); }

.defile { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 1rem; border: 1px solid var(--ligne); border-radius: var(--r); }
.defile > .donnees { border: 0; margin: 0; }
.donnees { width: 100%; border-collapse: collapse; font-size: .92rem; }
.donnees th { text-align: left; font-family: var(--mono); font-size: .68rem; letter-spacing: .07em; text-transform: uppercase; color: var(--encre3); font-weight: 500; padding: .6rem .7rem; border-bottom: 1px solid var(--ligne); white-space: nowrap; background: var(--surf); }
.donnees td { padding: .6rem .7rem; border-bottom: 1px solid var(--ligne); vertical-align: middle; }
.donnees tbody tr:last-child td { border-bottom: 0; }
.donnees tfoot td { border-top: 1px solid var(--ligne2); font-weight: 650; }
.donnees .date { white-space: nowrap; }
.donnees .nb { text-align: right; font-family: var(--mono); font-size: .88rem; white-space: nowrap; }
.donnees td a { text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--ligne2); }
.donnees .ecart, .ligne-ecart td { background: var(--surf2); font-weight: 650; }
.donnees-compactes th, .donnees-compactes td { padding: .45rem .55rem; }
.donnees-saisie td { padding: .4rem .6rem; }
.donnees-liste small { display: block; }
@media (max-width: 760px) {
  .donnees-liste th, .donnees-liste td { padding: .5rem .4rem; }
  .donnees.donnees-liste th { white-space: normal; font-size: .6rem; letter-spacing: .04em; font-family: var(--mono); }
  .donnees-liste th:first-child, .donnees-liste td:first-child { padding-left: .7rem; }
  .donnees .col-large { display: none; }
  .donnees-liste .champ-nb { max-width: 4.5rem; }
}
.barre-col { width: 22%; min-width: 70px; padding-left: 0 !important; }
.barre-h { display: block; height: 8px; border-radius: 0 4px 4px 0; background: var(--encre2); min-width: 2px; }

.liste-simple { list-style: none; margin: 0 0 1rem; padding: 0; border-top: 1px solid var(--ligne); }
.liste-simple li { padding: .6rem 0; border-bottom: 1px solid var(--ligne); }
.liste-simple a { text-decoration: underline; text-underline-offset: 2px; }
.pastilles { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.pastilles li { display: inline-flex; gap: .5rem; align-items: center; border: 1px solid var(--ligne2); border-radius: var(--rp); padding: .3rem .8rem; font-size: .9rem; }
.section-repliee { margin: 0 0 1rem; }
.section-repliee > summary, .zone-danger > summary { cursor: pointer; font-weight: 600; padding: .4rem 0; }
.zone-danger { border-color: var(--ligne2); }
.zone-danger > summary { color: var(--danger); }
.zone-danger h2 { color: var(--danger); }

/* ------------------------------------------------------------------ statut et jauges */
.statut { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; font-weight: 600; white-space: nowrap; color: var(--encre); border: 1px solid var(--ligne); border-radius: var(--rp); padding: .2rem .65rem .2rem .45rem; }
.statut .ico { width: 16px; height: 16px; stroke-width: 2.2; }
.statut-ok .ico { color: var(--ok); }
.statut-bas .ico { color: var(--bas); }
.statut-vide .ico { color: var(--vide); }
.statut-inconnu .ico { color: var(--encre3); }
.jauge { display: block; height: 8px; border-radius: 4px; background: var(--piste); overflow: hidden; flex: 1; }
.jauge > span { display: block; height: 100%; border-radius: 4px; background: var(--inconnu); }
.jauge-ok > span { background: var(--ok); }
.jauge-bas > span { background: var(--bas); }
.jauge-vide > span { background: var(--vide); }

/* ------------------------------------------------------------------ tableau des machines */
.machines { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .8rem; }
.machine { display: flex; flex-direction: column; gap: .8rem; margin: 0; }
.machine-corps { display: grid; grid-template-columns: 72px minmax(0, 1fr); column-gap: .9rem; align-content: start; flex: 1; }
.machine-corps > :not(.machine-vignette) { grid-column: 2; }
.machine-vignette { grid-row: 1 / span 6; width: 72px; }
.machine-vignette svg { width: 100%; height: auto; display: block; }
.machine-corps:hover { text-decoration: none; }
.machine-corps:hover h2 { text-decoration: underline; text-underline-offset: 3px; }
.machine-tete { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: .4rem .6rem; }
.machine-tete h2 { flex: 1 1 150px; }
.machine-tete h2 { margin: 0; font-size: 1.12rem; }
.machine-lieu { margin: .15rem 0 0; font-size: .9rem; }
.machine-jauge { display: flex; align-items: center; gap: .7rem; margin: .8rem 0 .2rem; }
.machine-jauge .mono { font-size: .85rem; min-width: 3.2em; text-align: right; }
.mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: .7rem 0 0; }
.mini dt { font-size: .7rem; color: var(--encre3); text-transform: uppercase; letter-spacing: .06em; font-family: var(--mono); }
.mini dd { margin: .1rem 0 0; font-weight: 600; font-size: .95rem; }
.signaux { list-style: none; padding: 0; margin: .7rem 0 0; display: flex; flex-direction: column; gap: .25rem; font-size: .86rem; color: var(--encre2); }
.signaux li { display: flex; align-items: center; gap: .4rem; }
.signaux .ico { width: 16px; height: 16px; }
.vide-etat { text-align: center; padding: 2rem 1rem; }
.vide-etat .ico-grand { margin: 0 auto .8rem; color: var(--encre3); }

/* sélections d'une machine */
.cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.case { border: 1px solid var(--ligne); border-radius: var(--rc); padding: .6rem .7rem; display: flex; flex-direction: column; gap: .35rem; background: var(--surf); min-width: 0; }
.case-tete { display: flex; justify-content: space-between; align-items: baseline; }
.case-code { font-weight: 700; font-size: .95rem; }
.case-niveau { font-weight: 650; }
.case-niveau small { color: var(--encre3); }
.case-produit { font-weight: 550; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.case-details { display: flex; flex-wrap: wrap; gap: .1rem .6rem; font-size: .75rem; color: var(--encre2); }
.case-peremption { display: flex; align-items: center; gap: .3rem; font-size: .78rem; color: var(--encre2); }
.case-peremption .ico { width: 14px; height: 14px; }
.case-peremption.proche { color: var(--encre); font-weight: 650; }
.case-peremption.proche .ico { color: var(--bas); }
.case-peremption.perime { color: var(--danger); font-weight: 650; }
.case-inconnu .case-produit { color: var(--encre3); }

/* réglage des sélections : en-tête de colonnes sur ordinateur, étiquette par champ sur téléphone */
.sel-entete, .sel-ligne { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr) 5rem 6rem 6rem 5.5rem; gap: .5rem; align-items: center; }
.sel-entete { font-family: var(--mono); font-size: .66rem; letter-spacing: .07em; text-transform: uppercase; color: var(--encre3); padding: 0 0 .3rem; }
.sel-lignes { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .8rem; }
.sel-champ { display: block; min-width: 0; }
.sel-etiquette { display: none; }
.sel-ligne input, .sel-ligne select { min-height: 40px; padding: .4rem .55rem; }
.sel-ligne select { padding-right: 2rem; }
.sel-suppr { display: flex; align-items: center; gap: .35rem; font-size: .82rem; color: var(--encre2); cursor: pointer; }
.sel-ligne:has(.sel-suppr input:checked) { opacity: .45; }
.sel-nouvelle { background: var(--surf2); border-radius: var(--rc); padding: .3rem; }
@media (max-width: 760px) {
  .sel-entete { display: none; }
  .sel-ligne { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .45rem; padding: .7rem 0; border-bottom: 1px solid var(--ligne); align-items: end; }
  .sel-nouvelle { padding: .7rem .4rem; }
  .sel-champ-produit { grid-column: span 3; }
  .sel-etiquette { display: block; font-family: var(--mono); font-size: .62rem; letter-spacing: .05em; text-transform: uppercase; color: var(--encre3); margin-bottom: .2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sel-suppr, .sel-ligne > .btn { min-height: 40px; justify-content: center; }
}

/* ------------------------------------------------------------------ visite */
.page-visite main.page { max-width: 720px; }
.acces { background: var(--surf2); border-radius: var(--rc); padding: .4rem .7rem; display: inline-block; }
.consigne { color: var(--encre2); font-size: .92rem; border-left: 3px solid var(--ligne2); padding-left: .8rem; }
.vis-ligne { border: 1px solid var(--ligne); border-radius: var(--r); padding: .8rem; margin: 0 0 .6rem; background: var(--surf); }
.vis-ligne.compte { border-color: var(--ligne2); box-shadow: var(--ombre); }
.vis-tete { display: grid; grid-template-columns: auto auto 1fr; gap: .1rem .6rem; align-items: center; margin-bottom: .6rem; }
.vis-tete > .vis-produit, .vis-tete > .vis-info { grid-column: 3; }
.vis-icone { grid-row: span 2; }
.vis-code { font-weight: 700; font-size: 1.15rem; grid-row: span 2; min-width: 2.2rem; }
.vis-produit { font-weight: 650; }
.vis-info { font-size: .78rem; color: var(--encre2); }
.vis-champs { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.pas { display: grid; grid-template-columns: 44px 1fr 44px; grid-template-rows: auto 48px; gap: .25rem; }
.pas-libelle { grid-column: 1 / -1; font-size: .78rem; font-weight: 600; color: var(--encre2); text-transform: uppercase; letter-spacing: .05em; font-family: var(--mono); }
.pas input { text-align: center; font-family: var(--mono); font-size: 1.25rem !important; font-weight: 650; padding: 0 !important; min-height: 48px; }
.pas-btn { border: 1px solid var(--ligne2); background: var(--surf); border-radius: var(--rc); display: grid; place-items: center; cursor: pointer; touch-action: manipulation; }
.pas-btn:active { background: var(--surf2); }
.vis-resultat { min-height: 1.2em; margin-top: .5rem; font-size: .85rem; display: flex; flex-wrap: wrap; gap: .2rem .9rem; color: var(--encre2); font-family: var(--mono); }
.vis-resultat b { color: var(--encre); }
.vis-resultat .alerte { color: var(--encre); font-family: var(--police); font-weight: 600; display: inline-flex; gap: .3rem; align-items: center; }
.vis-resultat .alerte .ico { width: 16px; height: 16px; color: var(--bas); }
.vis-plus { margin-top: .5rem; }
.vis-plus > summary { cursor: pointer; font-size: .85rem; color: var(--encre2); padding: .2rem 0; }
.vis-plus-champs { padding-top: .6rem; }
.vis-sans-produit .vis-champs { opacity: .55; }
.caisse { margin-top: 1.2rem; }
.champ-argent { font-size: 1.3rem !important; font-weight: 650; max-width: 220px; }
.caisse-ecart { font-weight: 650; margin: 0; }
.vis-date { margin: 0 0 1rem; }
.vis-date > summary { cursor: pointer; color: var(--encre2); font-size: .9rem; padding: .3rem 0; }
.collante {
  position: sticky; bottom: 0; z-index: 20; margin: 1rem -1rem 0; padding: .7rem 1rem calc(.7rem + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--fond) 94%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--ligne); display: flex; gap: .8rem; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.page-visite.connecte main { padding-bottom: 1rem; }
.page-visite .onglets { display: none; }
.totaux { display: flex; gap: .9rem; font-size: .85rem; color: var(--encre2); flex-wrap: wrap; }
.totaux b { color: var(--encre); font-size: 1rem; }
@media (max-width: 420px) { .collante .btn { width: 100%; } }

/* ------------------------------------------------------------------ achats, tournée */
.achat-ligne { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: 0 .6rem; padding: .5rem 0; border-bottom: 1px solid var(--ligne); }
.achat-calcul { grid-column: 1 / -1; margin: -.4rem 0 .2rem; min-height: 1em; }
@media (max-width: 760px) { .achat-ligne { grid-template-columns: 1fr 1fr 1fr; } .achat-produit { grid-column: 1 / -1; } }
.tournee-machines { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .7rem; }
.tournee-machine header { display: flex; justify-content: space-between; align-items: baseline; }
.tournee-machine h3 a { text-decoration: underline; text-underline-offset: 2px; }
.tournee-lignes { list-style: none; padding: 0; margin: .4rem 0 0; }
.tournee-lignes li { display: grid; grid-template-columns: 3rem 1fr auto; gap: .5rem; padding: .35rem 0; border-top: 1px solid var(--ligne); font-size: .9rem; }

/* ------------------------------------------------------------------ réglages */
.compte { display: flex; gap: .9rem; align-items: center; flex-wrap: wrap; }
.compte-photo { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--surf2); display: grid; place-items: center; font-weight: 700; border: 1px solid var(--ligne); }
.compte p { margin: 0; }
.compte-sortie { margin-left: auto; }
.prose { max-width: 680px; }
.prose h2 { margin-top: 1.6rem; }

/* ------------------------------------------------------------------ vitrine */
.vitrine-tete { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 2.5rem; align-items: center; padding: 2.5rem 0 2rem; }
.vitrine-tete h1 { font-size: clamp(2rem, 4.5vw, 3rem); letter-spacing: -.03em; line-height: 1.05; margin-bottom: 1rem; }
.chapeau { font-size: 1.1rem; color: var(--encre2); max-width: 36rem; }
.exemple { margin: 0; padding: 0; overflow: hidden; }
.exemple figcaption { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 1rem; border-bottom: 1px solid var(--ligne); font-size: .82rem; }
.exemple figcaption .etiquette { margin: 0; }
.exemple .donnees { margin: 0; }
.exemple .fiche { padding: .3rem 1rem; border-top: 1px solid var(--ligne); }
.vitrine-fiche { padding: 1.5rem 0; border-top: 1px solid var(--ligne); }
.vitrine-fiche h2 { margin-bottom: 1rem; }
@media (max-width: 760px) {
  .vitrine-tete { grid-template-columns: 1fr; gap: 1.5rem; padding-top: 1rem; }
  .fiche > div { grid-template-columns: 1fr; gap: .15rem; }
  .nav .langues { display: none; }
  h1 { font-size: 1.5rem; }
}

/* ------------------------------------------------------------------ impression (liste de tournée) */
@media print {
  .barre, .onglets, .pied, .sans-impression, .flashs { display: none !important; }
  .impression-seule { display: block; font-weight: 650; }
  body { background: #fff; color: #000; font-size: 12px; }
  .carte, .tuile, .defile { box-shadow: none; border-color: #bbb; }
  main.page { padding: 0; max-width: none; }
}

/* ------------------------------------------------------------------ machine virtuelle */
.mv { width: 100%; height: auto; display: block; user-select: none; -webkit-user-select: none; }
.mv .mv-case { cursor: pointer; outline: none; }
.mv .mv-case:focus-visible > rect:first-child { stroke: #111214; stroke-width: 2.5; }
.icone-produit { display: inline-flex; flex: none; }
.icone-produit-svg { display: block; }
.avec-icone { display: flex; align-items: center; gap: .55rem; }
.segmente { display: inline-flex; border: 1px solid var(--ligne2); border-radius: var(--rp); padding: 2px; gap: 2px; }
.segmente button { border: 0; background: none; border-radius: var(--rp); padding: .35rem .8rem; font-weight: 600; font-size: .85rem; color: var(--encre2); cursor: pointer; min-height: 34px; }
.segmente button.actif { background: var(--primaire); color: var(--sur-primaire); }

.fiche-machine { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: 1.2rem; align-items: start; margin: 0 0 1.2rem; }
.vue-machine { max-width: 440px; }
.vue-cote { display: flex; flex-direction: column; gap: .8rem; align-items: flex-start; }
.info-case { border: 1px solid var(--ligne); border-radius: var(--rc); padding: .6rem .8rem; margin: 0; min-height: 2.6rem; display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .4rem; width: 100%; }
.info-case svg { vertical-align: middle; }
.photo-machine img, .photo-produit img { max-width: 100%; max-height: 360px; border-radius: var(--rc); border: 1px solid var(--ligne); margin-bottom: .6rem; }
.form-photo { display: flex; flex-wrap: wrap; gap: .4rem; }
.form-photo label.btn { cursor: pointer; }
.form-photo label.occupe { opacity: .5; pointer-events: none; }
@media (max-width: 760px) {
  .fiche-machine { grid-template-columns: 1fr; }
  .vue-machine { max-width: 100%; }
}

/* catalogue de modèles */
.modeles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.modele { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: .7rem; align-items: center; border: 1px solid var(--ligne2); border-radius: var(--rc); padding: .6rem; cursor: pointer; position: relative; }
.modele input { position: absolute; opacity: 0; pointer-events: none; }
.modele:has(input:checked) { border-color: var(--primaire); box-shadow: inset 0 0 0 1px var(--primaire); }
.modele:has(input:focus-visible) { box-shadow: var(--ring); }
.modele-dessin { display: block; width: 76px; }
.modele-texte { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.modele-texte b { font-size: .92rem; }
.modele-texte small { font-size: .78rem; line-height: 1.35; }
.modele-perso { grid-template-columns: 1fr; min-height: 76px; }

/* écran Ranger */
.ranger-outils { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0 0 .9rem; }
.couleur-facade { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; font-weight: 600; }
input[type=color] { width: 44px !important; min-height: 34px !important; padding: 2px !important; border-radius: var(--rc); cursor: pointer; }
.ranger-corps { display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.ranger-scene { max-width: 520px; }
.ranger-cote { display: flex; flex-direction: column; gap: .8rem; position: sticky; top: calc(var(--barre) + .8rem); }
.ranger-cote .consigne { margin: 0; }
.palette { display: flex; flex-wrap: wrap; gap: .4rem; }
.pastille-produit { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--ligne2); background: var(--surf); border-radius: var(--rp); padding: .2rem .8rem .2rem .3rem; font-size: .86rem; font-weight: 600; cursor: pointer; min-height: 40px; touch-action: manipulation; }
.pastille-produit.arme { border-color: var(--primaire); box-shadow: inset 0 0 0 2px var(--primaire); background: var(--surf2); }
.pastille-vider { padding-left: .7rem; color: var(--danger); }
.ranger-panneau { margin: 0; }
.ranger-panneau-tete { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
.ranger-panneau-tete h2 { margin: 0; }
.ranger-reglages { display: flex; flex-wrap: wrap; gap: .8rem; margin-bottom: .4rem; }
.pas-mini { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; font-weight: 600; }
.pas-mini .btn { min-width: 34px; padding: .2rem .5rem; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(5.5rem + env(safe-area-inset-bottom)); z-index: 40; max-width: min(92vw, 520px); background: var(--primaire); color: var(--sur-primaire); border-radius: var(--rc); padding: .7rem 1rem; font-size: .9rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.page-ranger .onglets { display: none; }
.page-ranger.connecte main { padding-bottom: 1rem; }
@media (max-width: 760px) {
  /* téléphone : machine en haut, palette fixée en bas au-dessus d'« Enregistrer »,
     réglage d'une sélection en panneau qui monte du bas : on pose les produits
     sans jamais faire défiler entre la palette et la machine */
  .ranger-corps { grid-template-columns: 1fr; }
  .ranger-cote { position: static; }
  .ranger-scene { max-width: 100%; }
  .page-ranger main.page { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
  .page-ranger .palette {
    position: fixed; z-index: 30; left: 0; right: 0; bottom: calc(66px + env(safe-area-inset-bottom));
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: .55rem 1rem;
    background: color-mix(in srgb, var(--fond) 94%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--ligne);
  }
  .page-ranger .palette::-webkit-scrollbar { display: none; }
  .page-ranger .pastille-produit { flex: none; }
  .page-ranger .ranger .collante { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; z-index: 31; flex-wrap: nowrap; background: var(--fond); }
  .page-ranger .ranger .collante .btn { width: auto; }
  .ranger-panneau {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 36; max-height: 78vh; overflow-y: auto;
    border-radius: 16px 16px 0 0; box-shadow: 0 -10px 30px rgba(0, 0, 0, .18);
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }
  .page-ranger .toast { bottom: calc(140px + env(safe-area-inset-bottom)); }
}

/* dessin du produit */
.choix-formes { border: 0; padding: 0; margin: 0 0 .9rem; }
.choix-formes legend { font-size: .9rem; margin-bottom: .4rem; }
.formes { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .4rem; margin-bottom: .7rem; }
.forme { display: flex; flex-direction: column; align-items: center; gap: .2rem; border: 1px solid var(--ligne2); border-radius: var(--rc); padding: .5rem .3rem; cursor: pointer; font-size: .78rem; font-weight: 600; text-align: center; position: relative; }
.forme input { position: absolute; opacity: 0; pointer-events: none; }
.forme:has(input:checked) { border-color: var(--primaire); box-shadow: inset 0 0 0 1px var(--primaire); }
.forme-dessin { height: 44px; }


/* ------------------------------------------------------------------ statistiques */
/* Couleurs de série : ordre fixe, réglé pour le clair et le sombre (8 au plus,
   le reste est regroupé en « Autres machines » côté serveur). */
:root {
  --serie-1: #2a78d6; --serie-2: #eb6834; --serie-3: #1baf7a; --serie-4: #eda100;
  --serie-5: #e87ba4; --serie-6: #008300; --serie-7: #4a3aa7; --serie-8: #e34948;
  --bon: #0ca30c; --mauvais: #d03b3b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --serie-1: #3987e5; --serie-2: #d95926; --serie-3: #199e70; --serie-4: #c98500;
    --serie-5: #d55181; --serie-6: #008300; --serie-7: #9085e9; --serie-8: #e66767;
  }
}
.filtres { margin-bottom: .4rem; }
.graphique-carte h2 { margin-bottom: .2rem; }
.graphique { position: relative; margin: .6rem 0 .4rem; min-height: 60px; }
.graphique-svg { width: 100%; height: auto; display: block; overflow: visible; }
.graphique-svg .grille { stroke: var(--ligne); stroke-width: 1; }
.graphique-svg .base { stroke: var(--ligne2); stroke-width: 1; }
.graphique-svg .axe { font: 10px var(--mono); fill: var(--encre3); }
.graphique-svg .etiquette-barre { font: 600 12px var(--police); fill: var(--encre); }
.graphique-svg .valeur-barre { font: 600 11.5px var(--mono); fill: var(--encre2); }
.graphique-svg .zone { fill: transparent; cursor: default; outline: none; }
.graphique-svg .zone.survol, .graphique-svg .zone:focus-visible { fill: var(--encre); fill-opacity: .05; }
.legende { display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .82rem; color: var(--encre2); margin-bottom: .4rem; }
.legende > span { display: inline-flex; align-items: center; gap: .35rem; }
.legende-cle { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.bulle { position: absolute; z-index: 5; pointer-events: none; background: var(--surf); border: 1px solid var(--ligne2); border-radius: var(--rc); box-shadow: 0 6px 18px rgba(0, 0, 0, .12); padding: .45rem .6rem; font-size: .8rem; min-width: 120px; }
.bulle-titre { color: var(--encre2); font-size: .74rem; margin-bottom: .2rem; }
.bulle-ligne { display: flex; align-items: center; gap: .4rem; white-space: nowrap; }
.bulle-ligne b { font-family: var(--mono); font-size: .82rem; }
.bulle-ligne span:last-child { color: var(--encre2); }
.bulle-cle { width: 10px; height: 2px; border-radius: 1px; display: inline-block; }
.donnees-graphique { margin-top: .4rem; }
.donnees-graphique > summary { cursor: pointer; font-size: .85rem; color: var(--encre2); padding: .3rem 0; }
.variation { display: inline-flex; align-items: center; gap: .15rem; font-family: var(--mono); font-size: .8rem; font-weight: 700; color: var(--encre); margin-top: .2rem; }
.variation .ico { width: 15px; height: 15px; stroke-width: 2.4; }
.variation-bonne .ico { color: var(--bon); }
.variation-mauvaise .ico { color: var(--mauvais); }
.tuile .variation + .tuile-pied { display: inline; margin-left: .3rem; }
.fiche-chiffres { grid-template-columns: repeat(4, 1fr); display: grid; gap: 0 1rem; }
.fiche-chiffres > div { grid-template-columns: 1fr; gap: .1rem; border-bottom: 0; }
@media (max-width: 760px) { .fiche-chiffres { grid-template-columns: 1fr 1fr; } }

/* pistes d'amélioration */
.liste-pistes { list-style: none; padding: 0; margin: 0 0 1.2rem; display: flex; flex-direction: column; gap: .5rem; }
.piste { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: .8rem; align-items: center; border: 1px solid var(--ligne); border-radius: var(--r); padding: .75rem .9rem; background: var(--surf); }
.piste-important { border-left: 4px solid var(--mauvais); }
.piste-conseil { border-left: 4px solid var(--bas); }
.piste-icone { width: 36px; height: 36px; border-radius: 50%; background: var(--surf2); display: grid; place-items: center; }
.piste-important .piste-icone .ico { color: var(--mauvais); }
.piste-conseil .piste-icone .ico { color: #b77e00; }
.piste-texte b { display: block; font-size: .95rem; }
.piste-texte p { margin: .15rem 0 0; color: var(--encre2); font-size: .88rem; }
@media (max-width: 760px) {
  .piste { grid-template-columns: 32px minmax(0, 1fr); }
  .piste > .btn { grid-column: 2; justify-self: start; }
}

/* carte des ventes */
.choix-carte { margin: .4rem 0 .6rem; flex-wrap: wrap; }
.carte-ventes-corps { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: 1.2rem; align-items: end; }
.legende-chaleur { display: flex; flex-direction: column; gap: .25rem; max-width: 240px; }
.legende-degrade { display: block; height: 10px; border-radius: 5px; background: linear-gradient(90deg, #cde2fb, #86b6ef, #3987e5, #1c5cab, #0d366b); }
.legende-bornes { display: flex; justify-content: space-between; font-family: var(--mono); font-size: .8rem; color: var(--encre2); }
@media (max-width: 760px) { .carte-ventes-corps { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ logos */
.entreprise-barre { display: inline-flex; align-items: center; gap: .5rem; padding-left: .9rem; margin-left: .2rem; border-left: 1px solid var(--ligne); min-width: 0; }
.entreprise-barre:hover { text-decoration: none; }
.entreprise-barre img { height: 28px; max-width: 96px; object-fit: contain; }
.entreprise-barre span { font-weight: 650; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 18ch; }
@media (max-width: 760px) { .entreprise-barre span { display: none; } .entreprise-barre { padding-left: .6rem; } }
.logo-apercu { display: flex; align-items: center; justify-content: center; height: 96px; border: 1px dashed var(--ligne2); border-radius: var(--rc); margin: .6rem 0; background: var(--surf2); }
.logo-apercu img { max-height: 80px; max-width: 80%; object-fit: contain; }
.logo-vide { color: var(--encre3); font-size: .85rem; }
.logo-machine h3 { margin: 0 0 .2rem; }
.logo-machine p { margin: 0 0 .4rem; }
.logo-apercu-img { max-height: 64px; max-width: 200px; object-fit: contain; border: 1px solid var(--ligne); border-radius: var(--rc); padding: .3rem; background: #fff; margin-bottom: .4rem; }

/* ------------------------------------------------------------------ code-barres, équipe, pertes */
.scanner { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .78); display: grid; place-items: center; padding: 1rem; }
.scanner-boite { background: var(--surf); border-radius: var(--r); padding: 1rem; width: min(420px, 100%); display: flex; flex-direction: column; gap: .7rem; }
.scanner-video { position: relative; border-radius: var(--rc); overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.scanner-video video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner-viseur { position: absolute; left: 12%; right: 12%; top: 38%; bottom: 38%; border: 3px solid #5dff9f; border-radius: 8px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .25); }
.scanner-message { margin: 0; font-size: .9rem; color: var(--encre2); }
.scanner-manuel { display: flex; gap: .4rem; }
.scanner-manuel input { font-family: var(--mono); }
.champ-avec-bouton { display: flex; gap: .4rem; }
.champ-avec-bouton input { flex: 1; min-width: 0; }
.vis-ligne.trouve, .achat-ligne.trouve { box-shadow: 0 0 0 3px #5dff9f; transition: box-shadow .2s; border-radius: var(--r); }
.onglets-4 { grid-template-columns: repeat(4, 1fr) !important; }
.machine-tournee { display: flex; align-items: center; gap: .3rem; margin: .2rem 0 0; color: var(--encre2); }
.machine-tournee .ico { width: 15px; height: 15px; }
.encart.pertes .ico { color: var(--mauvais); vertical-align: -4px; }
.encart.pertes .liste-simple { margin: .4rem 0 0; }
.bilan-mensuel h3, .logo-machine h3 { margin: 0 0 .2rem; }
.bilan-mensuel { width: 100%; }
.bilan-mensuel select { max-width: 220px; }

.liste-membres { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-direction: column; gap: .5rem; }
.liste-membres li { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin: 0; flex-wrap: wrap; }
.membre-texte { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.membre-texte small { overflow-wrap: anywhere; }
