:root {
  --orange: #F4511E; --noir: #12201F; --bleu: #0072B2; --gris: #6b6b6b; --fond: #E6EAEA; --carte: #ffffff;
  --ligne: #BFC9C8; --ok: #1F1F1F; --doux: #fbe9e3; --bleu-doux: #e3f0f8; --jaune: #F9E3A6;
  font-size: 17px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fond); color: var(--noir); font-family: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--bleu); }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.15; font-family: Archivo, "Segoe UI", sans-serif; font-stretch: 100%; font-weight: 800; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
.cache { display: none !important; }

header.haut { background: var(--noir); color: #fff; display: flex; align-items: center; gap: 12px; padding: 8px 16px; position: sticky; top: 0; z-index: 20; flex-wrap: wrap; border-bottom: 4px solid var(--orange); }
header.haut nav { display: flex; gap: 6px; margin-left: auto; align-items: center; flex-wrap: wrap; }
header.haut nav a, header.haut nav button { color: #fff; background: transparent; border: 2px solid #5d6b6a; border-radius: 0; padding: 8px 12px; text-decoration: none; cursor: pointer; min-height: 42px; }
header.haut nav a.actif { background: var(--orange); border-color: var(--orange); }
.pastille { font-size: .85rem; color: #ddd; }
main { max-width: 1240px; margin: 0 auto; padding: 18px 20px 90px; }

.carte { background: var(--carte); border: 1px solid var(--ligne); border-top: 5px solid var(--noir); border-radius: 0; padding: 14px 18px; margin-bottom: 16px; }
.carte.attention { border-color: var(--orange); border-top-width: 5px; }
.rang { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.rang.espace { justify-content: space-between; }
.grille { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.doux { color: var(--gris); font-size: .92rem; }
.petit { font-size: .85rem; }
.droite { text-align: right; }

.btn { background: var(--noir); color: #fff; border: 2px solid var(--noir); border-radius: 0; padding: 12px 18px; min-height: 48px; cursor: pointer; font: 700 1rem Archivo, "Segoe UI", sans-serif; font-stretch: 105%; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn.orange { background: var(--orange); border-color: var(--orange); }
.btn.contour { background: #fff; color: var(--noir); border: 2px solid var(--noir); }
.btn.petit { min-height: 38px; padding: 6px 12px; font-size: .9rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.gros { font-size: 1.15rem; min-height: 60px; width: 100%; }

input[type=text], input[type=number], input[type=password], input[type=date], input[type=email], select, textarea {
  width: 100%; border: 2px solid #9fb0ae; border-radius: 0; padding: 10px 12px; background: #fff; min-height: 48px;
}
input:focus, select:focus, textarea:focus { outline: 3px solid var(--bleu-doux); border-color: var(--bleu); }
input.num { font-size: 1.35rem; font-weight: 700; text-align: right; }
label.c { display: block; font-weight: 600; margin-bottom: 4px; }
.champ { margin-bottom: 10px; }

.puce { display: inline-flex; align-items: center; gap: 6px; border-radius: 0; padding: 4px 10px; font-size: .88rem; font-weight: 600; border: 1.5px solid var(--noir); background: #fff; white-space: nowrap; }
.puce.plein { background: var(--noir); color: #fff; }
.puce.orange { border-color: var(--orange); color: var(--orange); }
.puce.orange.plein { background: var(--orange); color: #fff; }
.puce.bleu { border-color: var(--bleu); color: var(--bleu); }
.puce.gris { border-color: var(--ligne); color: var(--gris); }

.ecart { font-weight: 700; white-space: nowrap; }
.ecart.haut { color: #B23A10; } .ecart.bas { color: var(--bleu); } .ecart.ok { color: var(--noir); }

table.t { width: 100%; border-collapse: collapse; }
table.t th, table.t td { padding: 8px 10px; border-bottom: 1px solid var(--ligne); text-align: left; vertical-align: top; }
table.t th { font-size: .82rem; text-transform: uppercase; color: var(--gris); letter-spacing: .04em; }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; }
.defile { overflow-x: auto; }

.parquet { border: 1px solid var(--ligne); border-radius: 0; padding: 12px 14px; background: #fff; }
.parquet h3 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sexe { border-radius: 0; padding: 10px 12px; background: var(--fond); }
.sexe.f { border-left: 6px solid var(--orange); } .sexe.m { border-left: 6px solid var(--bleu); }
.sexe h4 { margin: 0 0 6px; font-size: 1rem; }
.retenu { display: flex; align-items: center; gap: 6px; }
.retenu input { max-width: 110px; }
.retenu .pm { width: 44px; min-height: 44px; border-radius: 10px; border: 2px solid var(--noir); background: #fff; font-size: 1.3rem; cursor: pointer; }
.raison { font-size: .9rem; color: #333; margin-top: 6px; }
.alerte { background: var(--jaune); border: 1px solid #d9b94a; border-radius: 0; padding: 6px 10px; margin-top: 6px; font-size: .9rem; }
.alerte.n2 { background: var(--doux); border-color: var(--orange); }

.bandeau { border-radius: 0; padding: 12px 16px; margin-bottom: 14px; font-weight: 600; }
.bandeau.vacances { background: var(--orange); color: #fff; }
.bandeau.info { background: var(--bleu-doux); border: 1px solid var(--bleu); }
.bandeau.attention { background: var(--jaune); border: 1px solid #e3c85a; }

.interrupteur { position: relative; width: 74px; height: 40px; flex: none; }
.interrupteur input { opacity: 0; width: 100%; height: 100%; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 2; }
.interrupteur i { position: absolute; inset: 0; background: #bbb; border-radius: 999px; transition: .2s; }
.interrupteur i::after { content: ""; position: absolute; width: 32px; height: 32px; top: 4px; left: 4px; background: #fff; border-radius: 50%; transition: .2s; }
.interrupteur input:checked + i { background: var(--orange); }
.interrupteur input:checked + i::after { left: 38px; }

@media (min-width: 0) { .modal { border-top: 5px solid var(--orange); } }
.modal-voile { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 24px 12px; overflow: auto; }
.modal { background: #fff; border-radius: 0; padding: 18px; max-width: 640px; width: 100%; }
pre.courriel { white-space: pre-wrap; background: var(--fond); border: 1px solid var(--ligne); border-radius: 0; padding: 12px; font-family: inherit; font-size: .95rem; }
#toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--noir); color: #fff; padding: 12px 18px; border-left: 6px solid var(--orange); border-radius: 0; z-index: 60; pointer-events: none; opacity: 0; transition: opacity .25s; max-width: 90vw; }
#toast.on { opacity: 1; }
.enr { font-size: .85rem; color: var(--gris); min-height: 1.2em; }
svg.graph { width: 100%; height: auto; display: block; }
details > summary { cursor: pointer; font-weight: 600; padding: 6px 0; }

@media (max-width: 640px) {
  :root { font-size: 16px; }
  main { padding: 10px; }
  header.haut nav { margin-left: 0; width: 100%; }
}
@media print {
  header.haut, .btn, nav, #toast { display: none !important; }
  body { background: #fff; }
}

/* ---- écran de décision : bandes et ruban de pesée ---- */
.parquets { display: grid; gap: 18px; }
.parquet-b { background: var(--carte); border: 1px solid var(--ligne); border-top: 6px solid var(--noir); padding: 6px 18px 4px; }
.parquet-b > h3 { font-size: 1.6rem; font-stretch: 112%; font-weight: 900; margin: 10px 0 2px; }
.bande { display: grid; grid-template-columns: 150px minmax(0, 1fr) 250px; gap: 8px 22px; padding: 16px 0; border-top: 1px solid var(--ligne); align-items: start; }
.bande:first-of-type { border-top: 0; }
.b-id h4 { margin: 0; font: 700 1rem "Atkinson Hyperlegible", sans-serif; }
.b-poids { font: 900 2.6rem/1 Archivo, sans-serif; font-stretch: 112%; font-variant-numeric: tabular-nums; margin: 4px 0 6px; }
.b-poids small { font-size: 1rem; font-weight: 600; font-stretch: 100%; color: var(--gris); }
.ruban { margin: 2px 0 8px; }
.r-regle { position: relative; height: 38px; background: repeating-linear-gradient(90deg, #9fb0ae 0 1px, transparent 1px 8.333%) bottom/100% 10px no-repeat; border-bottom: 2px solid var(--noir); }
.r-charte { position: absolute; left: 43.75%; width: 12.5%; top: 0; bottom: 0; background: var(--bleu-doux); border-left: 2px solid var(--bleu); border-right: 2px solid var(--bleu); }
.r-zero { position: absolute; left: 50%; top: 0; bottom: 0; border-left: 1px dashed var(--bleu); }
.r-repere { position: absolute; left: var(--pos); top: 0; bottom: -2px; width: 5px; margin-left: -2px; background: var(--noir); animation: glisse .7s cubic-bezier(.2,.8,.2,1) both; }
.ruban.f .r-repere { background: var(--orange); } .ruban.m .r-repere { background: var(--noir); }
.r-bulle { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 3px; background: var(--noir); color: #fff; font: 700 .85rem Archivo, sans-serif; padding: 2px 8px; white-space: nowrap; }
.ruban.f .r-bulle { background: var(--orange); }
.r-regle { margin-top: 26px; }
.r-graduations { display: flex; justify-content: space-between; font-size: .78rem; color: var(--gris); margin-top: 4px; }
.ruban.vide { color: var(--gris); padding: 14px 0; }
@keyframes glisse { from { left: 50%; opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .r-repere { animation: none; } }
.b-ration { border-left: 3px solid var(--noir); padding-left: 16px; display: grid; gap: 4px; }
.b-avant b, .b-sugg b { font: 800 1.35rem Archivo, sans-serif; font-variant-numeric: tabular-nums; }
.delta { font-weight: 700; font-size: .92rem; padding: 2px 8px; border: 2px solid var(--noir); white-space: nowrap; }
.delta.plus { background: var(--noir); color: #fff; } .delta.moins { border-color: var(--orange); color: #B23A10; } .delta.zero { border-color: var(--ligne); color: var(--gris); }
.b-ration .retenu { margin-top: 4px; } .b-ration .retenu input { max-width: 128px; min-width: 92px; font: 900 1.7rem Archivo, sans-serif; }
.retenu .pm { border-radius: 0; }
.parquet-b .alerte { border-radius: 0; }
@media (max-width: 860px) {
  .bande { grid-template-columns: 1fr; }
  .b-id { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; } .b-poids { font-size: 2rem; margin: 0; }
  .b-ration { border-left: 0; border-top: 3px solid var(--noir); padding: 10px 0 0; }
}

/* ---- identité : logo, connexion, vides ---- */
header.haut .marque { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; }
header.haut .marque img { height: 48px; width: auto; background: #fff; padding: 3px 6px; display: block; }
header.haut .marque span { font: 800 1.2rem/1.05 Archivo, sans-serif; font-stretch: 112%; letter-spacing: .01em; display: grid; }
header.haut .marque small { font: 400 .8rem "Atkinson Hyperlegible", sans-serif; color: #cdd7d6; font-stretch: 100%; }
main.connexion { display: grid; justify-items: center; align-content: start; gap: 8px; padding-top: 28px; }
.cx-logo img { width: min(300px, 70vw); height: auto; display: block; }
.cx-carte { width: min(460px, 100%); }
.vide { text-align: center; padding: 28px 12px; } .vide img { width: 180px; max-width: 50%; height: auto; }
.lien-carte { display: block; text-decoration: none; color: inherit; }
.lien-carte:hover, .lien-carte:focus-visible { border-top-color: var(--orange); outline: 3px solid var(--bleu-doux); }
.case { display: flex; gap: 10px; align-items: center; min-height: 48px; font-weight: 400; }
.case input { width: 26px; height: 26px; flex: none; accent-color: var(--noir); }

/* ---- vacances, transferts, envois ---- */
.vac { background: var(--carte); border: 1px solid var(--ligne); border-left: 8px solid var(--ligne); padding: 14px 18px; margin-bottom: 16px; }
.vac.on { border-left-color: var(--orange); background: #fff7f2; }
.transfert { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 24px; align-items: center; background: var(--jaune); border: 2px solid var(--noir); border-left: 10px solid var(--orange); padding: 14px 18px; margin-bottom: 16px; }
.transfert h3 { margin: 0 0 4px; } .transfert p { margin: 0; }
.t-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; } .t-actions input { width: 190px; }
.bloc { margin: 26px 0 8px; } .bloc > h2 { font-size: 1.5rem; font-stretch: 108%; }
.envois { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 16px; }
.envoi-cm { background: var(--carte); border: 1px solid var(--ligne); border-top: 5px solid var(--noir); padding: 14px 18px; display: grid; gap: 12px; align-content: start; }
.e-tete { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; } .e-tete h3 { margin: 0; font-size: 1.3rem; }
.e-lots { display: flex; flex-wrap: wrap; gap: 8px; }
.e-lot { display: grid; gap: 2px; min-width: 104px; padding: 8px 12px; border: 2px solid var(--ligne); text-decoration: none; color: var(--noir); background: #fff; font-size: .9rem; }
.e-lot b { font: 800 1.05rem Archivo, sans-serif; }
.e-lot.pret { border-color: var(--noir); border-left: 8px solid var(--noir); } .e-lot.attend { border-color: var(--orange); border-left: 8px solid var(--orange); background: #fff7f2; }
.e-lot.envoye { border-color: var(--ligne); color: var(--gris); border-left: 8px solid #9fb0ae; } .e-lot.saisie { border-style: dashed; color: #394949; }

/* ---- tendances ---- */
.tendances { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 16px; margin-top: 12px; }
.tend { background: var(--carte); border: 1px solid var(--ligne); border-top: 5px solid var(--noir); padding: 10px 14px 12px; display: grid; gap: 10px; align-content: start; }
.tend header { display: flex; align-items: baseline; gap: 10px; } .tend header h3 { margin: 0; font-size: 1.3rem; } .tend header a { margin-left: auto; }
.mg-tete { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; } .mg-t { font-weight: 700; min-width: 54px; }
.mg-v { font: 800 1.35rem Archivo, sans-serif; font-variant-numeric: tabular-nums; } .mg-e { font-weight: 700; margin-left: auto; }
.mg.vide { display: flex; justify-content: space-between; padding: 14px 0; border-top: 1px dashed var(--ligne); }
.mg svg { margin: 2px 0; }

/* ---- barre d'actions collée en bas (décision) ---- */
.barre-actions { position: sticky; bottom: 0; z-index: 15; display: flex; gap: 10px; flex-wrap: wrap; background: rgba(230,234,234,.96); border-top: 3px solid var(--noir); padding: 12px 0; margin: 14px 0 0; }

/* ---- tous formats ---- */
@media (min-width: 1500px) { :root { font-size: 19px; } main { max-width: 1520px; } .bande { grid-template-columns: 190px minmax(0, 1fr) 300px; } .r-regle { height: 46px; } }
@media (min-width: 1900px) { :root { font-size: 21px; } main { max-width: 1780px; } }
@media (max-width: 860px) {
  .transfert { grid-template-columns: 1fr; } .t-actions input { width: 100%; }
  header.haut .marque img { height: 42px; }
  .barre-actions .btn { flex: 1 1 200px; }
}
@media (max-width: 560px) {
  :root { font-size: 16px; }
  main { padding: 12px 12px 96px; }
  header.haut { padding: 8px 12px; } header.haut .marque span { font-size: 1.05rem; }
  header.haut nav { width: 100%; justify-content: space-between; }
  .parquet-b { padding: 4px 12px 2px; } .b-poids { font-size: 2.2rem; }
  .e-lot { min-width: calc(50% - 6px); flex: 1; }
  .btn.gros { min-height: 64px; }
  table.t th, table.t td { padding: 8px 6px; }
}
@media (hover: none) { .btn, .retenu .pm { min-height: 52px; } .retenu .pm { width: 52px; } }
:focus-visible { outline: 3px solid var(--bleu); outline-offset: 2px; }
.tend { align-self: start; } .tend.sans { border-top-color: var(--ligne); } .tend.sans h3 { margin: 0 0 4px; }

/* ---- voir comme (directeur) ---- */
label.comme { display: flex; align-items: center; gap: 8px; color: #cdd7d6; font-size: .85rem; }
label.comme select { width: auto; min-height: 42px; border: 2px solid #5d6b6a; background: #1b2b2a; color: #fff; padding: 6px 10px; }
.bandeau-comme { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--noir); color: #fff; border-left: 8px solid var(--orange); padding: 10px 16px; margin-bottom: 16px; }
.bandeau-comme .btn.contour { background: #fff; }

/* ---- vue contremaître : simple, gros, épuré ---- */
body.cm { font-size: 1.18rem; }
body.cm main { max-width: 980px; padding-top: 22px; }
body.cm h1 { font-size: 2.1rem; }
body.cm h2 { font-size: 1.6rem; }
body.cm .doux { font-size: 1.02rem; color: #3b4b4a; }
body.cm .petit { font-size: .98rem; }
body.cm .btn { min-height: 60px; font-size: 1.15rem; padding: 14px 22px; }
body.cm .btn.petit { min-height: 54px; font-size: 1.05rem; }
body.cm .btn.gros { min-height: 76px; font-size: 1.4rem; }
body.cm input.num { font-size: 2.1rem; min-height: 76px; padding: 8px 14px; }
body.cm .parquet { border-width: 2px; padding: 16px 18px; margin-bottom: 18px; }
body.cm .parquet h3 { font-size: 1.5rem; }
body.cm .sexe h4 { font-size: 1.15rem; margin: 6px 0; }
body.cm .det-dir { display: none; }
body.cm .puce { font-size: 1.02rem; padding: 6px 12px; white-space: normal; }
body.cm .lien-carte { padding: 20px 22px; }
body.cm .lien-carte h2 { font-size: 2rem; }
body.cm header.haut nav a, body.cm header.haut nav button { min-height: 52px; font-size: 1.05rem; }
body.cm .grille.g2 { grid-template-columns: 1fr; }
@media (min-width: 900px) { body.cm .parquet .grille { grid-template-columns: 1fr 1fr; } }
body.cm table.t td.n { white-space: nowrap; font-size: 1.25rem; font-weight: 700; }
body.cm table.t td.n .doux { display: block; font-weight: 400; font-size: .95rem; }
body.cm table.t td { padding: 10px 8px; }

/* ---- poulailler vide ---- */
.carte.vide-lot { border-top-style: dashed; border-style: dashed; background: transparent; color: #3b4b4a; }
tr.vide-ligne td { color: #3b4b4a; background: #eef1f1; }

header.haut nav button.annuler { border-color: var(--orange); max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- épuration de l'écran Décider + historique ---- */
table.histo { border-collapse: collapse; margin: 6px 0 10px; font-variant-numeric: tabular-nums; width: 100%; max-width: 560px; }
table.histo th, table.histo td { padding: 3px 8px; text-align: right; font-size: .95rem; border-bottom: 1px solid var(--ligne); white-space: nowrap; }
table.histo thead th { font-size: .8rem; color: var(--gris); font-weight: 600; }
table.histo tbody th { text-align: left; font-weight: 600; color: var(--gris); font-size: .85rem; white-space: normal; }
table.histo .now { background: var(--bleu-doux); font-weight: 800; }
table.histo small { font-size: .7rem; }
details.opt-courriel { margin: 0 0 8px; padding: 4px 0; } details.opt-courriel[open] { padding: 8px 12px; border: 1px solid var(--ligne); background: var(--carte); }
.parquets { gap: 12px; }
.parquet-b { padding: 2px 16px 0; }
.r-graduations { justify-content: center; }
.bande { padding: 12px 0; }

table.histo tr.repere th,table.histo tr.repere td{color:#333;font-weight:400;border-top:2px dashed #999}
table.histo tr.repere td.now{color:#222}

/* menu latéral (vue directeur) */
.cadre { display: flex; align-items: flex-start; }
.cadre > main { flex: 1; min-width: 0; margin: 0; max-width: 1240px; }
aside.menu { width: 230px; flex: none; position: sticky; top: 64px; align-self: flex-start; padding: 14px 0 20px 12px; display: flex; flex-direction: column; gap: 4px; max-height: calc(100vh - 64px); overflow: auto; }
aside.menu a { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 14px; background: var(--carte); border: 2px solid var(--ligne); color: var(--noir); text-decoration: none; font-weight: 600; min-height: 46px; }
aside.menu a.actif { background: var(--noir); color: #fff; border-color: var(--noir); border-left: 8px solid var(--orange); }
aside.menu .badge { font-size: .85rem; background: var(--orange); color: #fff; padding: 2px 8px; font-weight: 700; }
aside.menu .menu-titre { margin: 14px 2px 2px; font: 800 .8rem Archivo, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--gris); }
.nav-cm { margin: 0 0 10px; gap: 8px; align-items: center; }
@media (max-width: 900px) {
  .cadre { display: block; }
  aside.menu { position: static; width: auto; flex-direction: row; overflow-x: auto; max-height: none; padding: 8px 10px 0; }
  aside.menu a { white-space: nowrap; flex: none; }
  aside.menu .menu-titre { display: none; }
}
@media print { aside.menu { display: none !important; } }
