:root {
  --encre: #1d2733;
  --encre-douce: #5d6773;
  --fond: #f4f6f8;
  --carte: #ffffff;
  --trait: #dde2e8;
  --accent: #0f6b66;
  --accent-fonce: #0b524e;
  --ok: #067647;
  --ok-fond: #e7f6ee;
  --attention: #9a5b00;
  --attention-fond: #fff4dc;
  --danger: #b42318;
  --danger-fond: #fdecea;
  --info: #1f4e8c;
  --info-fond: #e8f0fb;
  --rayon: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--encre);
  background: var(--fond);
}

a { color: var(--accent); }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 .5rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
[hidden] { display: none !important; }

.bandeau-exemple {
  background: #fff8e6;
  color: #7a5200;
  border-bottom: 1px solid #f1dfb1;
  font-size: .8rem;
  text-align: center;
  padding: .3rem 1rem;
}

.entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .8rem clamp(1rem, 3vw, 2rem);
  background: var(--encre);
}
.entete .marque { color: #fff; text-decoration: none; font-weight: 700; letter-spacing: .01em; }
.entete .marque span { color: #7fd1c9; }
.entete nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.entete nav a { color: #cfd6de; text-decoration: none; padding: .35rem .7rem; border-radius: 6px; font-size: .92rem; }
.entete nav a.actif, .entete nav a:hover { background: rgba(255, 255, 255, .12); color: #fff; }

main { max-width: 1240px; margin: 0 auto; padding: 1.25rem clamp(.75rem, 3vw, 2rem) 2rem; }

.pied {
  max-width: 1240px;
  margin: 0 auto;
  padding: 1rem clamp(.75rem, 3vw, 2rem) 2rem;
  color: var(--encre-douce);
  font-size: .82rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--trait);
}
.pied p { margin: 0; }

.bouton {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: .55rem 1rem;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.bouton:hover { background: var(--accent-fonce); }
.bouton:disabled { opacity: .55; cursor: wait; }
.bouton.grand { padding: .75rem 1.3rem; font-size: 1.02rem; }
.bouton.petit { padding: .3rem .65rem; font-size: .85rem; }
.bouton.secondaire { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
.bouton.secondaire:hover { background: #eef7f6; }
.bouton.danger-plein { background: var(--encre); }
.bouton.danger-plein:hover { background: #000; }
.lien { background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

.carte { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 1rem; }
.bloc { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 1rem 1.1rem; margin: 0 0 1.1rem; }
.titre-bloc { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .5rem; }
.titre-bloc h2 { margin: 0; }
.aide { color: var(--encre-douce); font-size: .85rem; margin: .25rem 0 .75rem; }
.discret { color: var(--encre-douce); font-size: .85em; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .9em; }
.zero { color: #a7afb8; }
.nowrap { white-space: nowrap; }
.fil { font-size: .85rem; color: var(--encre-douce); margin: 0 0 .4rem; }

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: center;
  background: var(--carte);
  border: 1px solid var(--trait);
  border-left: 4px solid var(--accent);
  border-radius: var(--rayon);
  padding: 1.3rem 1.4rem;
  margin-bottom: 1.1rem;
}
.intro p { margin: 0 0 1rem; max-width: 62ch; }
.etapes { margin: 0; padding-left: 1.3rem; color: var(--encre-douce); font-size: .9rem; }
.etapes li { margin: .3rem 0; }
.etapes strong { color: var(--encre); }

.titre-page { margin-bottom: 1rem; }
.titre-page p { max-width: 75ch; margin: .25rem 0; }

.indicateurs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1.1rem; }
.indicateur { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: .75rem .9rem; color: var(--encre-douce); font-size: .85rem; }
.indicateur span { display: block; font-size: 1.5rem; font-weight: 700; color: var(--encre); line-height: 1.2; }
.indicateur em { display: block; font-style: normal; color: var(--danger); font-size: .8rem; }
.indicateur.alerte span { color: var(--danger); }

.defilement { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.donnees { width: 100%; border-collapse: collapse; font-size: .88rem; }
.donnees th { text-align: left; font-weight: 600; color: var(--encre-douce); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; border-bottom: 2px solid var(--trait); padding: .45rem .5rem; white-space: nowrap; }
.donnees td { border-bottom: 1px solid #edf0f3; padding: .45rem .5rem; vertical-align: top; }
.donnees .num { text-align: right; white-space: nowrap; }
.donnees .fort { font-weight: 700; }
.donnees td.alerte { color: var(--danger); }
.donnees tr.mis-a-jour td { background: #eaf7f5; }
.donnees tr.complet td { background: #f3faf6; }
.donnees td.actions { text-align: right; }

.badge { display: inline-block; border-radius: 999px; padding: .1rem .55rem; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge.petit { font-size: .72rem; padding: 0 .45rem; }
.badge.ok { background: var(--ok-fond); color: var(--ok); }
.badge.attention { background: var(--attention-fond); color: var(--attention); }
.badge.danger { background: var(--danger-fond); color: var(--danger); }
.badge.info { background: var(--info-fond); color: var(--info); }
.badge.neutre { background: #eef0f3; color: var(--encre-douce); }

.filtres { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; font-size: .88rem; }
.filtres input[type=search] { padding: .4rem .6rem; border: 1px solid var(--trait); border-radius: 6px; min-width: 220px; font: inherit; }

.cartes-commandes { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .75rem; }
.commande header { display: flex; justify-content: space-between; gap: .5rem; font-weight: 600; }
.commande .canal { color: var(--info); }
.commande p { margin: .2rem 0 .5rem; }
.commande ul { margin: 0; padding: 0; list-style: none; font-size: .86rem; }
.commande li { padding: .15rem 0; border-top: 1px dashed #edf0f3; }
.commande li .num { display: inline-block; min-width: 2.2rem; font-weight: 700; }

.message { border-radius: var(--rayon); padding: .8rem 1rem; margin: 0 0 1rem; border: 1px solid; }
.message.erreur { background: var(--danger-fond); border-color: #f4b8b2; color: #7a1a12; }
.message.succes { background: var(--ok-fond); border-color: #a6dcbf; color: #0b4d31; }
.message.attention { background: var(--attention-fond); border-color: #f1d18f; color: #6b4100; }

.cartes-exemples { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .9rem; }
.exemple { position: relative; display: flex; flex-direction: column; }
.exemple h3 { padding-right: 2rem; }
.exemple p { margin: 0 0 .35rem; }
.exemple .pastille { position: absolute; top: .8rem; right: .8rem; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--info-fond); color: var(--info); display: grid; place-items: center; font-weight: 700; }
.actions-carte { margin-top: auto; padding-top: .6rem; display: flex; justify-content: space-between; align-items: center; gap: .5rem; }

.depot { display: flex; gap: .75rem; align-items: stretch; flex-wrap: wrap; }
.zone-depot { flex: 1 1 320px; border: 2px dashed #b9c3cd; border-radius: var(--rayon); padding: .9rem; display: flex; flex-direction: column; gap: .35rem; cursor: pointer; background: #fafbfc; }
.zone-depot span { color: var(--encre-douce); font-size: .85rem; }

.attente { position: fixed; inset: 0; background: rgba(29, 39, 51, .45); display: grid; place-items: center; z-index: 10; padding: 1rem; }
.attente .carte { text-align: center; min-width: 260px; }
.attente p { margin: .3rem 0; }
.roue { width: 38px; height: 38px; border: 4px solid #d6e9e7; border-top-color: var(--accent); border-radius: 50%; margin: .2rem auto .8rem; animation: tourner 1s linear infinite; }
@keyframes tourner { to { transform: rotate(360deg); } }

.entete-facture { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem 1.25rem; margin-bottom: 1rem; }
.etiquette { display: block; font-size: .75rem; color: var(--encre-douce); text-transform: uppercase; letter-spacing: .03em; }
.synthese { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: 0 0 .75rem; }

.lignes-facture td { vertical-align: middle; }
.lignes-facture tr.statut-inconnue td { background: var(--danger-fond); }
.lignes-facture tr.statut-inconnue td:first-child { box-shadow: inset 4px 0 0 var(--danger); }
.lignes-facture tr.statut-a_confirmer td:first-child { box-shadow: inset 4px 0 0 #e0a300; }
.lignes-facture tr.statut-auto td:first-child { box-shadow: inset 4px 0 0 var(--ok); }
.lignes-facture tr.corrigee td { background: #eef6ff; }
.lignes-facture .choix select { width: 100%; min-width: 260px; max-width: 380px; padding: .35rem; border: 1px solid #b9c3cd; border-radius: 6px; font: inherit; font-size: .85rem; background: #fff; }
.lignes-facture tr.statut-inconnue select { border-color: var(--danger); }
.lignes-facture .correction { display: block; color: var(--info); font-size: .75rem; margin-top: .2rem; }
.lignes-facture .statut { min-width: 190px; }
.lignes-facture .score { font-weight: 700; margin-left: .3rem; font-size: .85rem; }
.lignes-facture .raison { display: block; color: var(--encre-douce); font-size: .78rem; }

.arrivage-prevu { margin-top: 1rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem 1rem; align-items: end; }
.arrivage-prevu legend { font-weight: 700; padding: 0 .3rem; }
.arrivage-prevu label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--encre-douce); }
.arrivage-prevu input, .arrivage-prevu select { padding: .5rem; border: 1px solid #b9c3cd; border-radius: 6px; font: inherit; color: var(--encre); }

.reception-appel { display: flex; gap: 1.5rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.reception-appel > div { flex: 1 1 320px; }
.qr { margin: 0; text-align: center; }
.qr svg { width: 180px; height: 180px; }
.qr figcaption { font-size: .7rem; color: var(--encre-douce); max-width: 220px; word-break: break-all; }

.deux-colonnes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.liste-ecarts { margin: 0; padding-left: 1rem; font-size: .88rem; }
.liste-ecarts li { margin: .25rem 0; }

[data-live].rafraichi .indicateur, [data-live].rafraichi .entete-facture { animation: lueur 1.2s ease-out; }
@keyframes lueur { from { box-shadow: 0 0 0 3px rgba(15, 107, 102, .35); } to { box-shadow: 0 0 0 0 rgba(15, 107, 102, 0); } }

.vue-mobile main { max-width: 520px; padding: .75rem; }
.vue-mobile .pied { max-width: 520px; }
.reception h1 { font-size: 1.3rem; margin: 0; }
.titre-reception p { margin: .1rem 0; }
.progression { height: 8px; background: #e3e8ec; border-radius: 99px; overflow: hidden; margin: .6rem 0 .2rem; }
.progression div { height: 100%; background: var(--ok); transition: width .25s; }
.compteur-global { font-size: .9rem; }

.scan { position: sticky; top: 0; z-index: 5; background: var(--fond); padding: .6rem 0; }
.scan label { font-weight: 600; font-size: .9rem; display: block; margin-bottom: .3rem; }
.ligne-scan { display: flex; gap: .5rem; }
.ligne-scan input { flex: 1; min-width: 0; font-size: 1.3rem; padding: .6rem .7rem; border: 2px solid var(--accent); border-radius: 8px; font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .04em; }
.scan .camera { width: 100%; margin-top: .5rem; }
.lecteur { margin-top: .5rem; border-radius: 8px; overflow: hidden; background: #000; }

.retour-scan { min-height: 0; border-radius: 8px; font-weight: 600; margin: .2rem 0 .6rem; }
.retour-scan.succes { background: var(--ok-fond); color: var(--ok); border: 1px solid #a6dcbf; padding: .7rem .8rem; }
.retour-scan.erreur { background: var(--danger); color: #fff; padding: .8rem; animation: secousse .35s; }
@keyframes secousse { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.lignes-reception { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.lignes-reception li { background: var(--carte); border: 1px solid var(--trait); border-radius: 8px; padding: .65rem .75rem; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .25rem .75rem; }
.lignes-reception li.complet { border-color: #a6dcbf; background: #f3faf6; }
.lignes-reception li.eclair { animation: eclair .6s; }
.lignes-reception li.enregistre .details input { border-color: var(--ok); }
@keyframes eclair { from { background: #d7f2e3; } }
.lignes-reception .produit { font-size: .9rem; }
.lignes-reception .produit .mono { display: block; }
.lignes-reception .compteur { text-align: right; font-size: 1.5rem; font-weight: 700; line-height: 1; white-space: nowrap; }
.lignes-reception .compteur small { font-size: .9rem; color: var(--encre-douce); font-weight: 500; margin-left: .15rem; }
.lignes-reception li.complet .compteur { color: var(--ok); }
.lignes-reception .details { grid-column: 1 / -1; display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.lignes-reception .details input { flex: 1 1 120px; min-width: 0; padding: .35rem .45rem; border: 1px solid var(--trait); border-radius: 6px; font: inherit; font-size: .85rem; }
.lignes-reception .details .lien { font-size: .82rem; }
.cloture { margin-top: 1.2rem; text-align: center; }
.cloture .bouton { width: 100%; }

@media (max-width: 760px) {
  h1 { font-size: 1.3rem; }
  .intro { grid-template-columns: 1fr; padding: 1rem; }
  .masquable { display: none; }
  .filtres input[type=search] { min-width: 0; width: 100%; }
  .filtres { width: 100%; }
  .bloc { padding: .8rem; }
  .entete nav a { padding: .3rem .5rem; }
  .bouton { white-space: normal; text-align: center; }
}
