:root {
  --fond: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --bord: #dfe3e8;
  --texte: #1b2430;
  --texte-2: #5d6b7c;
  --accent: #2f6fed;
  --vert: #1a8f5c;
  --rouge: #d0413a;
  --orange: #c9741a;
  --ombre: 0 1px 2px rgba(20, 30, 50, .06), 0 4px 16px rgba(20, 30, 50, .06);
  --rayon: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #12161c;
    --surface: #1a2029;
    --surface-2: #222a35;
    --bord: #2e3846;
    --texte: #e6eaf0;
    --texte-2: #94a1b3;
    --accent: #5b8cff;
    --vert: #3fbf86;
    --rouge: #f0716a;
    --orange: #e79a45;
    --ombre: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
  background: var(--fond);
  color: var(--texte);
  font: 15px/1.45 "Segoe UI", system-ui, sans-serif;
}

h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
a { color: inherit; text-decoration: none; }

/* ---------- Barre latérale ---------- */
.barre {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 14px;
  background: var(--surface);
  border-right: 1px solid var(--bord);
}
.marque { font-size: 18px; font-weight: 700; padding: 0 8px; }
#nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-titre {
  margin: 14px 8px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--texte-2);
}
.nav-lien {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--texte-2);
  font-weight: 500;
}
.nav-lien:hover { background: var(--surface-2); color: var(--texte); }
.nav-lien.actif { background: var(--surface-2); color: var(--texte); font-weight: 600; }
.nav-lien .compte { margin-left: auto; font-size: 12px; color: var(--texte-2); font-variant-numeric: tabular-nums; }
.pastille { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--c, var(--accent)); }

/* ---------- Contenu ---------- */
main { padding: 28px 32px 60px; min-width: 0; }
.entete { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.entete .pastille { width: 16px; height: 16px; }
.entete .espace { flex: 1; }
.sous-titre { color: var(--texte-2); margin: 4px 0 0; }

.cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 28px; }
.carte {
  display: block;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--bord);
  border-top: 4px solid var(--c, var(--accent));
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  transition: transform .12s;
}
a.carte:hover { transform: translateY(-2px); }
.carte h3 { font-size: 17px; margin-bottom: 12px; }
.carte .valeur { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.carte .ligne { display: flex; justify-content: space-between; color: var(--texte-2); margin-top: 6px; font-size: 14px; }

.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.stat {
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  min-width: 140px;
}
.stat b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--texte-2); }

.outils { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.outils input[type="search"] { flex: 1; min-width: 200px; }

/* ---------- Tableaux ---------- */
.tableau {
  background: var(--surface);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; white-space: nowrap; }
th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--texte-2);
  background: var(--surface-2);
  border-bottom: 1px solid var(--bord);
  position: sticky;
  top: 0;
}
td { border-bottom: 1px solid var(--bord); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.large { white-space: normal; min-width: 200px; }
td .secondaire { display: block; font-size: 12.5px; color: var(--texte-2); }
td.actions { text-align: right; }
.vide { padding: 40px 20px; text-align: center; color: var(--texte-2); }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--texte-2);
}
.badge.entree { background: color-mix(in srgb, var(--vert) 16%, transparent); color: var(--vert); }
.badge.sortie { background: color-mix(in srgb, var(--rouge) 16%, transparent); color: var(--rouge); }
.badge.correction, .badge.alerte { background: color-mix(in srgb, var(--orange) 18%, transparent); color: var(--orange); }
.plus { color: var(--vert); }
.moins { color: var(--rouge); }

/* ---------- Boutons et champs ---------- */
.btn {
  padding: 8px 14px;
  border: 1px solid var(--bord);
  border-radius: 8px;
  background: var(--surface);
  color: var(--texte);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn.principal { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.principal:hover { filter: brightness(1.08); }
.btn.danger { color: var(--rouge); }
.btn.discret { border-color: transparent; background: none; color: var(--texte-2); text-align: left; }
.btn.discret:hover { background: var(--surface-2); color: var(--texte); }
.btn.mini { padding: 4px 9px; font-size: 13px; }
.btn.entree { color: var(--vert); }
.btn.sortie { color: var(--rouge); }

input, select, textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--bord);
  border-radius: 8px;
  background: var(--surface);
  color: var(--texte);
  font: inherit;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type="color"] { padding: 2px; height: 38px; width: 56px; cursor: pointer; }
select { width: auto; }
textarea { resize: vertical; min-height: 64px; }

/* ---------- Modale ---------- */
dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--bord);
  border-radius: 14px;
  background: var(--surface);
  color: var(--texte);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
dialog::backdrop { background: rgba(10, 15, 25, .55); }
dialog form { padding: 22px 24px; }
dialog h2 { margin-bottom: 16px; }
.champs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.champs label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--texte-2); }
.champs .plein { grid-column: 1 / -1; }
.modale-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.erreur { color: var(--rouge); font-weight: 600; margin: 14px 0 0; }
.info { color: var(--texte-2); margin: 0 0 14px; }

.liste-stocks { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.liste-stocks .rang { display: flex; gap: 8px; align-items: center; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast {
  padding: 11px 16px;
  border-radius: 10px;
  background: var(--texte);
  color: var(--fond);
  font-weight: 500;
  box-shadow: var(--ombre);
  animation: monter .2s ease-out;
}
.toast.echec { background: var(--rouge); color: #fff; }
@keyframes monter { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Petit écran ---------- */
@media (max-width: 800px) {
  body { grid-template-columns: 1fr; }
  .barre { position: static; height: auto; padding: 12px; gap: 8px; border-right: 0; border-bottom: 1px solid var(--bord); }
  #nav { flex-direction: row; flex-wrap: wrap; }
  .nav-titre { display: none; }
  main { padding: 18px 16px 50px; }
  .champs { grid-template-columns: 1fr; }
}

/* ---------- Étapes (sous-stocks) ---------- */
.onglets { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.onglet {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 9px 14px;
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  background: var(--surface);
  color: var(--texte);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.onglet:hover { background: var(--surface-2); }
.onglet .detail { font-size: 12.5px; font-weight: 400; color: var(--texte-2); font-variant-numeric: tabular-nums; }
.onglet.actif { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.onglet.archive { border-style: dashed; color: var(--texte-2); }
.badge.etape, .badge.deplacement { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.btn.deplacer { color: var(--accent); }

.etapes-carte { margin-top: 12px; padding-top: 6px; border-top: 1px solid var(--bord); }
.etapes-carte .ligne { font-size: 13px; font-variant-numeric: tabular-nums; }
.etapes-carte .ligne.archive { opacity: .65; }

input[type="checkbox"] { width: auto; }
.coche { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--texte-2); white-space: nowrap; cursor: pointer; }

/* Tableau des articles : un peu plus compact pour que les actions tiennent sans défilement */
.table-articles th, .table-articles td { padding-left: 10px; padding-right: 10px; }
td.actions .btn.mini { padding: 4px 7px; }
td.actions { padding-left: 4px; }

/* ---------- Catégories d'une étape (répartition du poids) ---------- */
.repartition { display: flex; gap: 6px; flex-wrap: wrap; margin: -6px 0 16px; }
.repartition:empty { display: none; }
.puce {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 11px;
  border: 1px solid var(--bord);
  border-radius: 99px;
  background: var(--surface);
  color: var(--texte);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.puce b { font-variant-numeric: tabular-nums; }
.puce:hover { background: var(--surface-2); }
.puce.actif { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.puce.vide-puce { color: var(--texte-2); }
.puce.vide-puce b { font-weight: 400; }
#liste-etapes .rang { flex-wrap: wrap; padding-bottom: 8px; border-bottom: 1px solid var(--bord); }
#liste-etapes .nom-etape { flex: 1; width: auto; min-width: 140px; }
#liste-etapes .categories-etape { flex-basis: 100%; font-size: 13px; }

/* Actions d'une ligne : peuvent passer sur deux lignes plutôt que de faire défiler le tableau */
td.actions { white-space: normal; min-width: 270px; }
td.actions .btn.mini { margin: 2px 0; }

/* ---------- Couleurs des catégories ---------- */
.badge.cat[style] {
  background: color-mix(in srgb, var(--c) 22%, transparent);
  color: color-mix(in srgb, var(--c) 55%, var(--texte));
  border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
}
.table-articles tr[style] td:first-child { box-shadow: inset 4px 0 0 var(--c); }
.puce .pastille { align-self: center; background: var(--c, var(--texte-2)); }
#liste-etapes .categories-etape { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cat-edit { display: inline-flex; align-items: center; gap: 3px; }
.cat-edit input[type="color"] { width: 30px; height: 30px; padding: 1px; }
.cat-edit .cat-nom { width: 118px; padding: 4px 8px; font-size: 13px; }

/* ---------- Réception des colis ---------- */
input[type="radio"] { width: auto; margin: 0; }
.etiquette { font-size: 13px; font-weight: 600; color: var(--texte-2); margin-bottom: 4px; }
.choix { display: flex; gap: 8px; flex-wrap: wrap; }
.choix label {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  padding: 9px 14px;
  border: 1px solid var(--bord);
  border-radius: 8px;
  font-size: 15px !important;
  color: var(--texte) !important;
  cursor: pointer;
}
.choix label:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
tr.prochain td { background: color-mix(in srgb, var(--vert) 7%, transparent); }

/* ---------- Utilisateurs ---------- */
.btn.qui { font-weight: 600; color: var(--texte); }
.choix-utilisateur { display: flex; flex-wrap: wrap; gap: 10px; }
.choix-utilisateur .rang { display: inline-flex; align-items: center; gap: 4px; }
.choix-utilisateur .btn:not(.mini) { padding: 12px 18px; font-size: 16px; }

/* ---------- Comptes et droits ---------- */
table.droits td, table.droits th { padding: 6px 12px; font-size: 13.5px; }
table.droits .centre { text-align: center; color: var(--texte-2); }
table.droits td.moi { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--texte); font-weight: 700; }

/* Accès aux stocks par utilisateur */
.acces-stocks { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; padding: 2px 0 10px; border-bottom: 1px solid var(--bord); font-size: 13px; color: var(--texte-2); }
.acces-stocks .coche { color: var(--texte); }

/* ---------- Panneau d'actions (grosses tuiles) ---------- */
.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-bottom: 26px; }
.tuile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 34px 18px 28px;
  border: 1px solid var(--bord);
  border-radius: 16px;
  background: var(--surface);
  color: var(--texte);
  font: inherit;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--ombre);
  transition: transform .12s, border-color .12s;
}
.tuile:hover { transform: translateY(-3px); border-color: var(--accent); }
.tuile-icone { font-size: 64px; line-height: 1; }
.tuile-titre { font-size: 20px; font-weight: 700; }
.tuile-detail { font-size: 13.5px; color: var(--texte-2); min-height: 2.6em; }

.tri .pastille, .liste-depart .pastille, .droits .pastille { display: inline-block; margin-right: 6px; }
.liste-depart { display: flex; flex-direction: column; gap: 10px; }
.liste-depart .coche { font-size: 15px; color: var(--texte); white-space: normal; }
.grille-grv { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.btn.grv { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; border-left: 6px solid var(--c, var(--bord)); text-align: left; }
.btn.grv span { font-size: 13px; color: var(--texte-2); font-variant-numeric: tabular-nums; }

/* ---------- File des colis en capsules ---------- */
.capsules { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; padding: 2px; }
.capsule {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px 10px 10px;
  border: 1px solid var(--bord);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--texte);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.capsule:hover:not(:disabled) { border-color: var(--accent); }
.capsule.prochaine { border-color: var(--vert); box-shadow: inset 0 0 0 1px var(--vert); }
.capsule:disabled { opacity: .5; cursor: not-allowed; }
.capsule-rang {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--bord);
  font-weight: 700;
  font-size: 16px;
}
.capsule.prochaine .capsule-rang { background: var(--vert); border-color: var(--vert); color: #fff; }
.capsule-texte { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.capsule-texte b { white-space: normal; overflow-wrap: anywhere; } /* le nom et ses pastilles (lot, tri en cours) peuvent passer à la ligne */
.capsule-texte span { font-size: 12.5px; color: var(--texte-2); }
.capsule-poids { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Lots : capsules à cocher */
label.capsule { cursor: pointer; }
label.capsule input[type="checkbox"] { width: 20px; height: 20px; margin-left: 8px; flex: none; }
label.capsule:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* Détail des colis d'un lot */
.detail-lot { display: block; margin-top: 3px; font-size: 12.5px; color: var(--texte-2); white-space: normal; }
.detail-lot b { color: var(--texte); font-variant-numeric: tabular-nums; }
.capsule:has(.detail-lot) { border-radius: 26px; }

/* ---------- Sous-catégories de tri ---------- */
.groupe-tri { margin: 0; padding: 10px 14px 14px; border: 1px solid color-mix(in srgb, var(--c, var(--bord)) 55%, var(--bord)); border-radius: var(--rayon); min-width: 0; }
.groupe-tri legend { padding: 0 6px; font-size: 13px; font-weight: 600; color: var(--texte-2); }
.groupe-tri legend b { color: var(--texte); }
.groupe-tri .pastille { display: inline-block; margin-right: 6px; }
.cat-edit .cat-sous { width: 250px; padding: 4px 8px; font-size: 13px; }

/* ---------- Unité affichée en fin de case (kg, €/kg) ---------- */
.champ-unite { position: relative; display: block; }
.champ-unite input { padding-right: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.champ-unite::after {
  content: 'kg';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--texte-2);
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
}
.champ-unite.eur input { padding-right: 58px; }
.champ-unite.eur::after { content: '€/kg'; }

/* ---------- Fenêtre de tri en deux colonnes verticales ---------- */
.tri-colonnes { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.tri-colonne { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tri-colonne label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--texte-2); }
.tri-colonne .groupe-tri .champs { grid-template-columns: 1fr; }
#liste-etapes .tri-gauche { flex-basis: 100%; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--texte-2); }
#liste-etapes .tri-gauche input { font-size: 13px; padding: 5px 9px; }
@media (max-width: 800px) { .tri-colonnes { grid-template-columns: 1fr; } }

/* ---------- Bilan du tri : total du colis − net = tare ---------- */
.bilan-tri { display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap; }
.bilan-tri > span:not(.signe) { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border: 1px solid var(--bord); border-radius: var(--rayon); background: var(--surface-2); }
.bilan-tri small { font-size: 12px; color: var(--texte-2); }
.bilan-tri b { font-size: 18px; color: var(--texte); font-variant-numeric: tabular-nums; }
.bilan-tri .signe { align-self: center; font-size: 22px; font-weight: 700; color: var(--texte-2); }

/* ---------- Tri caisse par caisse ---------- */
.entete-caisses { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.nouvelle-caisse { margin-bottom: 14px; padding: 14px 16px; border: 1px solid var(--accent); border-radius: var(--rayon); background: var(--surface-2); }
.poids-caisse { display: flex; flex-direction: column; gap: 4px; max-width: 260px; margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--texte-2); }
.poids-caisse input { font-size: 20px; font-weight: 700; padding: 10px 44px 10px 12px; }
.choix-categorie { display: flex; flex-wrap: wrap; gap: 8px; }
.choix-categorie label { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border: 1px solid var(--bord); border-radius: 99px; background: var(--surface); font-size: 14px; cursor: pointer; }
.choix-categorie label:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 600; }
.choix-categorie input { position: absolute; opacity: 0; pointer-events: none; }
.choix-categorie .pastille { display: inline-block; }
.actions-caisse { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.actions-caisse .btn { width: 56px; height: 46px; font-size: 20px; font-weight: 700; }
.btn.valider-caisse { background: var(--vert); border-color: var(--vert); color: #fff; }
.btn.annuler-caisse { color: var(--rouge); }
.vide-caisses { padding: 18px; border: 1px dashed var(--bord); border-radius: var(--rayon); text-align: center; margin: 0; }

/* ---------- Étiquettes de caisse (impression) ---------- */
.actions-caisse .btn.large { width: auto; padding: 0 18px; }
#zone-impression { display: none; }
@page { margin: 3mm; } /* ticket de caisse : marges minimales */
@media print {
  body { display: block; background: #fff; }
  body > *:not(#zone-impression), dialog { display: none !important; }
  #zone-impression { display: block; }
  .etiquette-caisse {
    box-sizing: border-box;
    /* Format ticket de caisse : rouleau thermique de 80 mm (72 mm imprimables), hauteur libre, pas de cadre */
    width: 72mm;
    max-width: 100%;
    padding: 1mm 0 3mm;
    border: 0;
    border-bottom: 0.4mm dashed #000;
    color: #000;
    background: #fff;
    font-family: "Segoe UI", Arial, sans-serif;
    page-break-after: always;
    break-after: page;
  }
  .etiquette-caisse:last-child { page-break-after: auto; break-after: auto; }
  .etiquette-client { font-size: 20pt; font-weight: 800; line-height: 1.1; overflow-wrap: anywhere; }
  .etiquette-commande { margin-top: 1mm; padding-bottom: 2mm; border-bottom: 0.4mm solid #000; font-size: 15pt; font-weight: 700; }
  .etiquette-categorie { margin-top: 2.5mm; font-size: 26pt; font-weight: 800; line-height: 1.05; }
  .etiquette-categorie span { font-weight: 700; }
  .etiquette-poids { margin-top: 1mm; font-size: 26pt; font-weight: 800; }
  .etiquette-caisse footer { margin-top: 2.5mm; padding-top: 1.5mm; border-top: 0.25mm solid #000; font-size: 9pt; }
}

/* ---------- Choix de la catégorie d'une caisse : pastilles pleines, couverts dans un cadre ---------- */
.choix-caisse { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.choix-caisse input { position: absolute; opacity: 0; pointer-events: none; }
.pastille-choix {
  position: relative;
  min-width: 70px;
  padding: 10px 16px;
  border: 3px solid transparent;
  border-radius: 10px;
  background: var(--c);
  color: var(--t);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: transform .08s;
}
.pastille-choix:hover { transform: translateY(-1px); filter: brightness(1.08); }
.pastille-choix:has(input:checked) { border-color: var(--texte); box-shadow: 0 0 0 3px var(--accent); }
/* La coche est posée en médaillon sur le coin : la pastille ne change pas de largeur, donc rien ne passe à la ligne */
.pastille-choix:has(input:checked)::after {
  content: '✔';
  position: absolute;
  top: -9px;
  right: -9px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--surface-2);
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  line-height: 1;
}
.cadre-categorie {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 4px;
  padding: 8px 12px 12px;
  border: 2px solid var(--c);
  border-radius: 12px;
  background: color-mix(in srgb, var(--c) 9%, transparent);
  min-width: 0;
}
.cadre-categorie legend { padding: 0 8px; font-size: 14px; font-weight: 700; color: var(--texte); }

/* Pastille « tri en cours » */
.badge.en-cours { background: color-mix(in srgb, var(--orange) 20%, transparent); color: var(--orange); border: 1px solid color-mix(in srgb, var(--orange) 50%, transparent); }

/* ---------- Confirmations intégrées au site ---------- */
#confirmation { width: min(660px, calc(100vw - 32px)); }
.confirmation { padding: 22px 24px; }
.confirmation h2 { margin-bottom: 14px; }
.confirmation p { margin: 0; }
.confirmation-etape { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.alerte-confirmation { margin: 12px 0 0 !important; padding: 10px 12px; border-radius: 8px; background: color-mix(in srgb, var(--orange) 18%, transparent); color: var(--orange); font-weight: 600; }
.btn.danger-plein { background: var(--rouge); border-color: var(--rouge); color: #fff; }
.btn.danger-plein:hover { filter: brightness(1.08); background: var(--rouge); }

.capsule:has(.badge.en-cours) { border-radius: 26px; }

/* Deuxième confirmation du tri : le poids de l'emballage, bien visible dans un carré rouge */
.carre-emballage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: 16px;
  padding: 16px;
  border: 2px solid var(--rouge);
  border-radius: var(--rayon);
  background: color-mix(in srgb, var(--rouge) 16%, transparent);
  text-align: center;
}
.carre-emballage small { font-size: 13px; font-weight: 600; color: var(--rouge); text-transform: uppercase; letter-spacing: .05em; }
.carre-emballage b { font-size: 32px; line-height: 1.15; color: var(--rouge); font-variant-numeric: tabular-nums; }
.carre-emballage span { font-size: 13px; color: var(--texte-2); }

/* Couleur du carré selon la part de l'emballage : ≥ 30 % rouge, 10 à 30 % orange, < 10 % vert */
.carre-emballage { --ton: var(--rouge); border-color: var(--ton); background: color-mix(in srgb, var(--ton) 16%, transparent); }
.carre-emballage small, .carre-emballage b { color: var(--ton); }
.carre-emballage.orange { --ton: var(--orange); }
.carre-emballage.vert { --ton: var(--vert); }

.etat-sauvegarde { margin-left: auto; font-size: 12.5px; color: var(--vert); }

.titre-caisse { margin-bottom: 10px; font-weight: 700; }

/* ---------- Versement en GRV, caisse par caisse ---------- */
table.versement td, table.versement th { padding: 9px 12px; font-size: 14px; }
table.versement .pastille { display: inline-block; margin-right: 6px; }
table.versement tr.versee td { background: color-mix(in srgb, var(--vert) 9%, transparent); }
table.versement .btn.mini.principal { padding: 6px 16px; font-size: 14px; }
.carre-grv { display: inline-block; min-width: 58px; padding: 4px 10px; border-radius: 6px; background: var(--c); color: var(--t); font-weight: 700; text-align: center; }
.pied-versement { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.pied-versement .espace { flex: 1; }

.liste-restantes { margin: 0 0 12px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.liste-restantes li { display: flex; align-items: center; gap: 10px; }


td .secondaire.moins { color: var(--rouge); font-weight: 600; } /* GRV qui dépasserait son poids autorisé */


/* Cadre rouge des avertissements dans les messages du site */
.cadre-rouge { padding: 14px 16px; border: 2px solid var(--rouge); border-radius: var(--rayon); background: color-mix(in srgb, var(--rouge) 14%, transparent); }
.cadre-rouge .liste-restantes { margin-bottom: 0; }
.cadre-rouge p b { color: var(--rouge); }

/* ---------- Choix d'un GRV : boutons pleins à la couleur de la matière, rangés par lignes ---------- */
.lignes-grv { display: flex; flex-direction: column; gap: 10px; }
.ligne-grv { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.lignes-grv .btn.grv {
  align-items: center;
  gap: 3px;
  padding: 14px 10px;
  border: 3px solid transparent;
  border-radius: 12px;
  background: var(--c);
  color: var(--t);
  text-align: center;
}
.lignes-grv .btn.grv b { font-size: 17px; }
.lignes-grv .btn.grv span { font-size: 12.5px; color: inherit; opacity: .85; }
.lignes-grv .btn.grv:hover { filter: brightness(1.08); transform: translateY(-1px); border-color: var(--texte); }
@media (max-width: 800px) { .ligne-grv { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Choix après avoir cliqué sur un GRV + détail de son contenu ---------- */
.choix-grv { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.choix-grv .tuile { padding: 24px 14px; }
.choix-grv .tuile-icone { font-size: 44px; }
.repartition-grv { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
@media (max-width: 800px) { .choix-grv { grid-template-columns: 1fr; } }

/* Bouton d'un GRV : nom de la matière dans un carré, puis tare / brut / net alignés */
.lignes-grv .btn.grv { align-items: stretch; gap: 10px; padding: 12px; }
.lignes-grv .btn.grv .grv-nom {
  display: block;
  padding: 7px 8px;
  border: 2px solid currentColor;
  border-radius: 8px;
  background: rgba(0, 0, 0, .16);
  font-size: 16px;
  letter-spacing: .02em;
}
.lignes-grv .btn.grv .grv-mesures {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 10px;
  font-size: 13px;
  opacity: 1;
  text-align: left;
}
.lignes-grv .btn.grv .grv-mesures span { font-size: 13px; opacity: .9; }
.lignes-grv .btn.grv .grv-mesures span:nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; opacity: 1; }
.lignes-grv .btn.grv .grv-mesures b { font-size: 14px; }
.lignes-grv .btn.grv .grv-trop { padding: 0 5px; border-radius: 5px; background: #fff; color: #c92a2a; font-weight: 700; }

/* Menu « Valider un GRV » compact : les 4 lignes tiennent à l'écran, sans barre de défilement */
.lignes-grv { gap: 8px; }
.ligne-grv { gap: 8px; }
.lignes-grv .btn.grv { gap: 5px; padding: 7px 9px 8px; border-width: 2px; border-radius: 10px; }
.lignes-grv .btn.grv .grv-nom { padding: 3px 6px; border-width: 1.5px; border-radius: 6px; font-size: 14.5px; }
.lignes-grv .btn.grv .grv-mesures { gap: 0 8px; line-height: 1.3; }
.lignes-grv .btn.grv .grv-mesures span { font-size: 12px; }
.lignes-grv .btn.grv .grv-mesures b { font-size: 12.5px; }
dialog { max-height: calc(100vh - 16px); }

/* ---------- Fiche imprimable d'un GRV (A4) ---------- */
@media print {
  .fiche-grv { padding: 8mm; color: #000; background: #fff; font-family: "Segoe UI", Arial, sans-serif; font-size: 10.5pt; }
  .fiche-grv h1 { margin: 0; font-size: 22pt; }
  .fiche-tampon { float: right; padding: 2mm 5mm; border: 0.8mm solid #000; border-radius: 2mm; font-size: 15pt; font-weight: 800; letter-spacing: .04em; }
  .fiche-tampon.cloture { background: #000; color: #fff; }
  .fiche-grv h2 { margin: 7mm 0 2mm; font-size: 13pt; }
  .fiche-mention { margin: 1mm 0 5mm; font-size: 10pt; }
  .fiche-grv table { width: 100%; border-collapse: collapse; }
  .fiche-grv th, .fiche-grv td { padding: 1.6mm 2mm; border: 0.2mm solid #000; text-align: left; white-space: normal; position: static; background: #fff; color: #000; font-size: 10pt; text-transform: none; letter-spacing: 0; }
  .fiche-grv th { background: #e9e9e9; font-weight: 700; }
  .fiche-grv .droite { text-align: right; white-space: nowrap; }
  .fiche-bilan td { font-size: 15pt; font-weight: 700; text-align: center; }
  .fiche-bilan th { text-align: center; }
  .fiche-grv tr { break-inside: avoid; }
}

/* Fenêtre compacte (menu des GRV) : pas de pied de fenêtre, « Fermer » remonte à côté du titre */
dialog.compacte form { position: relative; padding: 14px 18px 16px; }
dialog.compacte h2 { margin-bottom: 6px; padding-right: 110px; }
dialog.compacte .info { margin-bottom: 10px; font-size: 14px; }
dialog.compacte .modale-actions { position: absolute; top: 8px; right: 14px; margin: 0; }
dialog.compacte .modale-actions .btn { padding: 5px 12px; font-size: 13px; }
@media print { .fiche-grv tr:last-child td { border-bottom: 0.2mm solid #000; } }

.lignes-grv .btn.grv .grv-mesures .grv-trop { justify-self: end; }

.lignes-grv .btn.grv .grv-nom small { font-size: 11.5px; font-weight: 600; opacity: .9; }

/* « ← Retour » : dans le pied de fenêtre, à l'opposé de « Fermer » */
#modale-retour { margin-right: auto; }

/* Rangée de boutons d'une fenêtre : actions à gauche, action principale tout à droite */
.rangee-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.rangee-actions .espace { flex: 1; }

/* ---------- Validation de la clôture d'un GRV : récapitulatif sur quatre lignes ---------- */
.recap-cloture { border: 2px solid var(--vert); border-radius: var(--rayon); overflow: hidden; }
.recap-cloture.rouge { border-color: var(--rouge); }
.recap-nom { padding: 12px 16px; background: color-mix(in srgb, var(--vert) 18%, transparent); font-size: 20px; font-weight: 800; }
.recap-cloture.rouge .recap-nom { background: color-mix(in srgb, var(--rouge) 18%, transparent); }
.recap-ligne { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 16px; border-top: 1px solid var(--bord); font-size: 16px; }
.recap-ligne b { font-size: 20px; font-variant-numeric: tabular-nums; }

/* ---------- Fiche récap d'un GRV : A4 paysage, sans le détail ---------- */
@page paysage { size: A4 landscape; margin: 10mm; }
@media print {
  .fiche-recap { page: paysage; break-after: page; padding: 6mm 10mm; color: #000; background: #fff; font-family: "Segoe UI", Arial, sans-serif; }
  .fiche-recap:last-child { break-after: auto; }
  .recap-entete { display: flex; justify-content: space-between; align-items: center; font-size: 16pt; font-weight: 700; }
  .fiche-recap .fiche-tampon { float: none; font-size: 20pt; padding: 3mm 8mm; }
  .fiche-recap h1 { margin: 10mm 0 8mm; font-size: 58pt; line-height: 1.05; text-align: center; }
  .fiche-recap table { width: 100%; border-collapse: collapse; }
  .fiche-recap th, .fiche-recap td { padding: 5mm 8mm; border: 0.6mm solid #000; background: #fff; color: #000; position: static; text-transform: none; letter-spacing: 0; white-space: nowrap; }
  .fiche-recap th { width: 42%; text-align: left; font-size: 30pt; font-weight: 700; background: #ececec; }
  .fiche-recap td { text-align: right; font-size: 44pt; font-weight: 800; font-variant-numeric: tabular-nums; }
  .fiche-recap tr:last-child td, .fiche-recap tr:last-child th { border-bottom: 0.6mm solid #000; }
  .fiche-recap footer { margin-top: 8mm; font-size: 13pt; text-align: right; }
}

.rangee-actions { flex-wrap: nowrap; align-items: flex-start; justify-content: space-between; }
.rangee-actions .actions-gauche { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.rangee-actions .cloturer { flex: none; white-space: nowrap; }

/* Emplacement libre : matière sans GRV en place */
.lignes-grv .btn.grv.libre { background: transparent; color: var(--texte); border: 2px dashed var(--c); }
.lignes-grv .btn.grv.libre .grv-nom { background: var(--c); color: var(--t); border-color: var(--c); }
.lignes-grv .btn.grv.libre .grv-libre { font-size: 12px; line-height: 1.35; opacity: 1; color: var(--texte-2); text-align: center; }
.lignes-grv .btn.grv.libre .grv-libre b { color: var(--texte); font-size: 12.5px; }

/* Cases à cocher dans un formulaire : le texte passe à la ligne au lieu de faire défiler la fenêtre */
.champs .coche { white-space: normal; align-items: flex-start; }
.champs .coche input { margin-top: 3px; flex: none; }
.champs .coche small { font-weight: 400; color: var(--texte-2); }
dialog form { overflow-x: hidden; }

/* Faire un départ */
.liste-depart .coche { align-items: center; gap: 10px; }
.choix.destinations label { flex: 1; min-width: 190px; }

/* Un champ masqué (attribut hidden) le reste, même si sa classe lui donne un affichage en flex ou en grille */
[hidden] { display: none !important; }

.choix.destinations small { display: block; margin-top: 4px; font-size: 12px; color: var(--texte-2); }
.choix.destinations label.inactif { opacity: .5; cursor: not-allowed; }
.liste-depart .titre-groupe { margin: 10px 0 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--texte-2); }

/* Faire une réception */
.rang-reception { display: flex; align-items: center; gap: 8px; }
.rang-reception .capsule { flex: 1; min-width: 0; }

/* « Faire une réception » : toujours dans la première colonne, juste sous « Ajouter un colis » ; le reste du parcours garde sa rangée */
.tuiles { grid-auto-flow: row dense; }
.tuile.sous-ajouter { grid-column: 1; }

/* Compteurs des tuiles : une information par ligne ; nombre vert s'il y a à faire, ligne grise à zéro */
.compte-tuile { display: block; line-height: 1.5; }
.compte-tuile b { font-size: 15px; font-variant-numeric: tabular-nums; }
.compte-tuile.actif b { color: var(--vert); }
.compte-tuile.rien { opacity: .55; }

/* ---------- Planning partagé : une colonne par jour de la semaine ---------- */
.planning { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; align-items: start; }
.jour-planning { min-height: 220px; padding: 10px; border: 1px solid var(--bord); border-radius: var(--rayon); background: var(--fond-2, transparent); display: flex; flex-direction: column; gap: 8px; }
.jour-planning.week-end { opacity: .7; }
.jour-planning.aujourdhui { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.jour-entete { display: flex; align-items: center; justify-content: space-between; text-transform: capitalize; }
.jour-vide { margin: 0; text-align: center; color: var(--texte-2); opacity: .5; }
.evt-planning { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 8px 10px; text-align: left; font: inherit; color: var(--texte); cursor: pointer;
  border: 1px solid var(--bord); border-left: 4px solid var(--c); border-radius: 10px; background: color-mix(in srgb, var(--c) 14%, transparent); }
.evt-planning:hover { border-color: var(--c); }
.evt-planning small { color: var(--texte-2); font-size: 12px; }
.evt-planning b { font-size: 13.5px; overflow-wrap: anywhere; }
.evt-planning span { font-size: 12px; color: var(--texte-2); overflow-wrap: anywhere; }
.evt-planning .alerte-planning { color: var(--rouge); font-weight: 700; }
.evt-planning.reception, .planning-reception { --c: var(--vert); }
.evt-planning.absence, .planning-absence { --c: var(--rouge); }
.evt-planning.indisponibilite, .planning-indisponibilite { --c: #f08c00; }
.evt-planning.autre, .planning-autre { --c: var(--accent); }
.recap-cloture[class*="planning-"] { border-color: var(--c); }
.recap-cloture[class*="planning-"] .recap-nom { background: color-mix(in srgb, var(--c) 18%, transparent); }
.compte-tuile.en-cours { color: var(--vert); font-weight: 700; }
@media (max-width: 900px) { .planning { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.evt-planning.blocage, .planning-blocage { --c: #c2255c; }
.evt-planning.blocage { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 16%, transparent) 0 10px, color-mix(in srgb, var(--c) 7%, transparent) 10px 20px); }


/* ---------- Planning : grille horaire (heures sur le côté) ---------- */
.grille-planning { display: grid; grid-template-columns: 46px repeat(5, minmax(0, 1fr)) repeat(2, minmax(0, .55fr)); column-gap: 6px; row-gap: 6px; }
.gp-entete { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; border: 1px solid var(--bord); border-radius: 10px; text-transform: capitalize; }
.gp-entete.aujourdhui { border-color: var(--accent); color: var(--accent); }
.gp-libelle { align-self: center; font-size: 11px; color: var(--texte-2); text-align: right; padding-right: 4px; }
.gp-journee { display: flex; flex-direction: column; gap: 4px; min-height: 30px; }
.gp-heures { position: relative; }
.gp-heures span { position: absolute; right: 6px; transform: translateY(-50%); font-size: 11.5px; color: var(--texte-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.gp-heures .gp-repas-texte { transform: none; display: flex; align-items: center; font-size: 10px; opacity: .8; }
.gp-jour { position: relative; border: 1px solid var(--bord); border-radius: 10px; cursor: cell; overflow: hidden;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--heure) - 1px), var(--bord) calc(var(--heure) - 1px), var(--bord) var(--heure)); }
.gp-jour.aujourdhui { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.gp-jour.week-end, .gp-journee.week-end, .gp-entete.week-end { opacity: .6; }
.gp-repas { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--texte-2) 22%, transparent) 0 6px, transparent 6px 12px); pointer-events: none; }
.evt-planning.horaire { position: absolute; gap: 0; padding: 2px 6px; overflow: hidden; border-radius: 7px; background: color-mix(in srgb, var(--c) 24%, var(--fond, #12161f)); }
.evt-planning.horaire b { font-size: 12px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.evt-planning.horaire small, .evt-planning.horaire span { font-size: 11px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gp-journee .evt-planning { padding: 4px 8px; }
.gp-journee .evt-planning b { font-size: 12.5px; }
@media (max-width: 900px) { .grille-planning { grid-template-columns: 40px repeat(7, minmax(120px, 1fr)); overflow-x: auto; } }

/* Planning : cartes horaires courtes lisibles, zones hors journée normale, heures sup */
.evt-planning.horaire > * { flex: none; }
.gp-hors { position: absolute; left: 0; right: 0; background: color-mix(in srgb, var(--texte-2) 10%, transparent); pointer-events: none; }
.evt-planning.heures_sup, .planning-heures_sup { --c: #9775fa; }
.gp-entete.week-end { padding: 6px; font-size: 12.5px; }
.gp-entete.week-end .btn { display: none; }
.plus { color: var(--vert); }

/* Planning — choix du type : grille de 3 colonnes (6 types = 2 lignes), jamais de chevauchement */
.choix.types-planning { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.choix.types-planning label { min-width: 0; font-size: 13.5px; white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 560px) { .choix.types-planning { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Menu : bloc « Stocks » repliable, en bas, entre deux séparateurs, juste au-dessus du nom de la personne */
.nav-espace { flex: 1; min-height: 12px; }
.nav-repli { display: flex; flex-direction: column; gap: 2px; padding: 6px 0; margin-bottom: 6px; border-top: 1px solid var(--bord); border-bottom: 1px solid var(--bord); }
.nav-bascule { width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.nav-bascule .chevron { margin-left: auto; font-size: 12px; color: var(--texte-2); }
.nav-bascule .compte + .chevron { margin-left: 8px; }

/* Bon de livraison du Massif */
#champs-bl textarea { width: 100%; resize: vertical; font: inherit; }
@media print {
  .bon-livraison .bl-adresses { width: 100%; margin: 6mm 0; }
  .bon-livraison .bl-adresses th { width: 50%; text-align: left; }
  .bon-livraison .bl-adresses td { vertical-align: top; height: 32mm; font-size: 11pt; line-height: 1.45; }
  .bon-livraison .bl-signatures { width: 100%; margin-top: 12mm; }
  .bon-livraison .bl-signatures th { width: 33.33%; text-align: left; font-size: 10pt; }
  .bon-livraison .bl-signatures small { font-weight: 400; }
  .bon-livraison .bl-signatures td { height: 34mm; }
}

/* Carnet d'adresses du bon de livraison */
.apercu-adresse { margin: 6px 0 0; padding: 8px 10px; border: 1px dashed var(--bord); border-radius: 10px; font-size: 13px; line-height: 1.45; color: var(--texte-2); min-height: 1.45em; }
.apercu-adresse:empty { display: none; }
#champs-bl textarea { margin-top: 6px; }

#champs-bl [id^="bl-edition-"] textarea { width: 100%; resize: vertical; font: inherit; margin-top: 6px; }

/* Personnes, rôles et accès */
.rang.personne { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.personne-entete { display: flex; align-items: center; gap: 8px; }
.personne-entete b { flex: 1; }
.personne-identite { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.champ-personne { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--texte-2); }
.champ-personne input, .champ-personne select { width: 100%; }
.acces-personne { flex-direction: row; font-size: 14px; }
.acces-site { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px dashed var(--bord); border-radius: 10px; }
@media (max-width: 640px) { .personne-identite { grid-template-columns: 1fr; } }
.liste-stocks .rang.personne + .rang.personne { padding-top: 14px; margin-top: 4px; border-top: 1px solid var(--bord); }

/* ---------- Contrôle comptable ---------- */
.filtres-controle { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.filtres-controle #controle-q { flex: 1; min-width: 240px; }
.filtres-controle label { display: inline-flex; align-items: center; gap: 6px; color: var(--texte-2); font-size: 13px; }
.table-controle .ligne-cliquable { cursor: pointer; }
.table-controle .ligne-cliquable:hover td { background: var(--surface-2); }
.puces-controle { max-width: 360px; line-height: 2; }
.puces-controle .carre-grv { font-size: 11.5px; padding: 2px 7px; }
.pieces-dossier { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.pieces-dossier .coche { flex-direction: row; font-size: 14px; }
.bon-livraison .bl-signatures th { width: auto; }

.table-controle td { white-space: normal; vertical-align: top; }
.table-controle td.num, .table-controle td:first-child, .table-controle td:nth-child(2) { white-space: nowrap; }
.table-controle .etat-controle { max-width: 230px; }
.table-controle .etat-controle .badge { white-space: normal; display: inline-block; line-height: 1.35; text-align: left; }
.puces-controle { max-width: 330px; }

/* Valorisation : prix au kg par ligne */
.table-valorisation .champ-unite { width: 130px; margin-left: auto; }
.table-valorisation .prix-ligne { width: 100%; text-align: right; }
.table-valorisation td { vertical-align: middle; }

/* Pièces justificatives : une ligne par pièce, avec ses fichiers */
.pieces-dossier { flex-direction: column; gap: 8px; }
.piece-ligne { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 10px; border: 1px solid var(--bord); border-radius: 10px; }
.piece-ligne .coche { min-width: 250px; }
.depot-piece { cursor: pointer; }
.fichiers-piece { display: flex; flex-wrap: wrap; gap: 6px 10px; flex: 1 1 100%; }
.fichiers-piece:empty { display: none; }
.fichier-piece { display: inline-flex; align-items: center; gap: 4px; }
.lien-fichier { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; overflow-wrap: anywhere; text-align: left; }

/* Contrôle comptable : onglets des étapes */
.onglets-controle { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 16px; }
.compte-onglet { display: inline-block; min-width: 22px; margin-left: 6px; padding: 1px 7px; border-radius: 99px; background: color-mix(in srgb, var(--texte-2) 22%, transparent); font-size: 12px; font-variant-numeric: tabular-nums; }
.compte-onglet.actif { background: var(--vert); color: #0b1a12; font-weight: 700; }

/* ---------- Identité REDAStocks ---------- */
.marque { display: flex; align-items: center; gap: 10px; }
.marque-logo { width: 38px; height: 38px; padding: 4px; border-radius: 10px; background: #fff; flex: none; object-fit: contain; }
.marque-nom { display: flex; flex-direction: column; line-height: 1.1; font-size: 19px; font-weight: 800; letter-spacing: .01em; }
.marque-nom b { color: #e0121f; font-weight: 800; display: inline; }
.marque-nom small { font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--texte-2); margin-top: 3px; }
.plaque-logo { display: flex; justify-content: center; padding: 18px 22px; margin-bottom: 18px; border-radius: 14px; background: #fff; }
.plaque-logo img { width: min(100%, 360px); height: auto; display: block; }

/* En-tête des documents imprimés : logo REDAStocks et adresse du site */
.entete-fiche { display: none; }
@media print {
  .entete-fiche { display: flex; align-items: flex-end; justify-content: space-between; gap: 6mm; margin-bottom: 5mm; padding-bottom: 2.5mm; border-bottom: 0.4mm solid #000; }
  .entete-fiche img { height: 13mm; width: auto; }
  .entete-fiche span { font-size: 10pt; font-weight: 600; letter-spacing: .02em; color: #000; white-space: nowrap; }
  .fiche-recap .entete-fiche { margin-bottom: 4mm; }
  .fiche-recap .entete-fiche img { height: 15mm; }
  .fiche-recap h1 { margin: 6mm 0 6mm; }
  .etiquette-caisse footer b { letter-spacing: .02em; }
}
