/* Écho — feuille de style unique. Mobile d'abord (360 px), clair, léger, sans image. */
:root {
  --vert: #146B5B;
  --vert-fonce: #0E4F43;
  --vert-pale: #E4F0EC;
  --ivoire: #FAFAF6;
  --carte: #FFFFFF;
  --charbon: #17231E;
  --gris: #55635D;
  --bord: #DEDCD0;
  --sable: #D3A969;
  --sable-pale: #F7EEDD;
  --rouge: #C34843;
  --rouge-pale: #FBEAE9;
  --rayon: 14px;
  --ombre: 0 1px 2px rgba(23, 35, 30, .06), 0 4px 14px rgba(23, 35, 30, .05);
  --nav: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ivoire);
  color: var(--charbon);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.5rem; line-height: 1.2; letter-spacing: -.01em; }
h2 { font-size: 1.125rem; line-height: 1.3; }
h3 { font-size: 1rem; }
a { color: var(--vert); }
small, .discret { color: var(--gris); font-size: .875rem; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--sable); outline-offset: 2px; }
svg { flex: none; }

/* ---------- structure ---------- */
.entete {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--vert); color: #fff;
}
.entete .logo { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.25rem; }
.entete .logo svg { width: 26px; height: 26px; }
.casquette {
  display: flex; align-items: center; gap: 6px; max-width: 62%;
  min-height: 40px; padding: 6px 12px; border: 1px solid rgba(255, 255, 255, .45); border-radius: 999px;
  background: transparent; color: #fff; font: inherit; font-size: .875rem; cursor: pointer;
}
.casquette span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.casquette svg { width: 16px; height: 16px; }

main { display: block; outline: none; }
.ecran { max-width: 560px; margin: 0 auto; padding: 20px 16px calc(var(--nav) + 28px); display: grid; gap: 16px; }
.ecran.large { max-width: 880px; }
.ecran.sans-nav { padding-bottom: 32px; }
.titre { display: grid; gap: 4px; }
.retour { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; color: var(--vert); text-decoration: none; font-weight: 600; }
.retour svg { width: 18px; height: 18px; }

.navigation {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: space-around;
  height: calc(var(--nav) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--carte); border-top: 1px solid var(--bord);
}
.navigation a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--gris); text-decoration: none; font-size: .75rem; font-weight: 600;
}
.navigation a svg { width: 24px; height: 24px; }
.navigation a.actif { color: var(--vert); }

/* ---------- accueil ---------- */
.accueil { min-height: 100vh; min-height: 100dvh; align-content: center; gap: 24px; }
.marque { display: grid; justify-items: center; gap: 6px; text-align: center; }
.marque svg { width: 72px; height: 72px; color: var(--vert); }
.marque h1 { font-size: 2.5rem; color: var(--vert); letter-spacing: -.02em; }
.marque p { color: var(--gris); }
.portes { display: grid; gap: 12px; }
.porte {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 76px; padding: 14px 16px;
  border: 1px solid var(--bord); border-radius: var(--rayon); background: var(--carte); box-shadow: var(--ombre);
  color: var(--charbon); font: inherit; text-align: left; cursor: pointer;
}
.porte:active { background: var(--vert-pale); }
.porte .rond { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--vert); color: #fff; flex: none; }
.porte .rond svg { width: 26px; height: 26px; }
.porte strong { display: block; font-size: 1.0625rem; line-height: 1.25; }
.porte small { display: block; margin-top: 2px; }
.porte .fleche { margin-left: auto; width: 20px; height: 20px; color: var(--gris); }
.pied { text-align: center; }

/* ---------- boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 20px; border: 1px solid var(--vert); border-radius: 12px;
  background: var(--vert); color: #fff; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn:active { background: var(--vert-fonce); }
.btn.bloc { width: 100%; }
/* Bouton d'action du chauffeur : très gros, utilisable avec des gants et en plein soleil. */
.btn.geant { min-height: 76px; font-size: 1.25rem; text-transform: uppercase; letter-spacing: .02em; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats .carte { padding: 12px 10px; gap: 2px; text-align: center; align-content: start; }
.stats strong { font-size: clamp(.75rem, 3.9vw, 1.25rem); line-height: 1.25; }
.stats .carte { overflow: hidden; }
.apercu { display: block; max-width: 100%; max-height: 65vh; margin: 0 auto 12px; border-radius: 10px; }
form.affecter { display: flex; gap: 8px; }
form.affecter select { min-height: 44px; padding: 6px 10px; }
input[type="file"] { width: 100%; min-height: 52px; padding: 12px 0; font: inherit; }
.btn.secondaire { background: var(--carte); color: var(--vert); }
.btn.secondaire:active { background: var(--vert-pale); }
.btn.danger { background: var(--carte); border-color: var(--rouge); color: var(--rouge); }
.btn.danger:active { background: var(--rouge-pale); }
.btn.petit { min-height: 44px; padding: 8px 14px; font-size: .9375rem; }
.btn.lien { min-height: 44px; border-color: transparent; background: none; color: var(--vert); padding: 8px 12px; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn svg { width: 20px; height: 20px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions.fin { justify-content: flex-end; }

/* ---------- cartes et listes ---------- */
.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 16px; display: grid; gap: 12px; }
a.carte { color: inherit; text-decoration: none; }
a.carte:active { background: var(--vert-pale); }
.navigation a { min-width: 0; }
.carte.accent { border-left: 5px solid var(--sable); }
.carte.succes { border-left: 5px solid var(--vert); }
.carte.alerte { border-left: 5px solid var(--rouge); }
.carte > .haut { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ligne { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--bord); }
.ligne:first-child { border-top: 0; padding-top: 0; }
/* Jamais de défilement horizontal, même sur un très petit écran. */
.ecran > *, .carte > *, .liste, .ligne, .ligne > * { min-width: 0; }
.ligne > *, .titre > * { overflow-wrap: anywhere; }
.ligne .haut { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ligne .nom { font-weight: 700; }
.droits { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.droits li { display: flex; gap: 10px; align-items: flex-start; }
.droits svg { width: 20px; height: 20px; margin-top: 2px; }
.droits .oui svg { color: var(--vert); }
.droits .non svg { color: var(--gris); }
.bientot { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; color: var(--gris); }
.bientot li::before { content: "· "; }
.vide { text-align: center; color: var(--gris); padding: 12px 0; }

.pastille { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .8125rem; font-weight: 700; white-space: nowrap; }
.pastille.ok { background: var(--vert-pale); color: var(--vert-fonce); }
.pastille.attente { background: var(--sable-pale); color: #6E4E14; }
.pastille.alerte { background: var(--rouge-pale); color: #8E2B27; }
.pastille.neutre { background: #EEEDE6; color: var(--gris); }
.puces { display: flex; flex-wrap: wrap; gap: 6px; }
.puce { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border: 1px solid var(--bord); border-radius: 999px; font-size: .8125rem; background: var(--ivoire); }
.puce.inactive { color: var(--gris); text-decoration: line-through; }
.puce button { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 50%; background: none; color: var(--rouge); cursor: pointer; }
.puce button svg { width: 16px; height: 16px; }
.code { font: 700 1.75rem/1.2 ui-monospace, "SF Mono", Consolas, monospace; letter-spacing: .08em; text-align: center; padding: 14px; border: 2px dashed var(--sable); border-radius: 12px; background: var(--sable-pale); }

/* ---------- formulaires ---------- */
form { display: grid; gap: 14px; }
.champ { display: grid; gap: 6px; }
.champ > span { font-weight: 600; }
.champ small { line-height: 1.35; }
input[type="text"], input[type="tel"], input[type="date"], input[type="number"], select, textarea {
  width: 100%; min-height: 52px; padding: 12px 14px; border: 1px solid #B9B7AA; border-radius: 12px;
  background: var(--carte); color: var(--charbon); font: inherit;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--sable); outline-offset: 1px; border-color: var(--vert); }
.saisie-code { font-size: 1.75rem; letter-spacing: .3em; text-align: center; font-weight: 700; }
.coche { display: flex; gap: 12px; align-items: flex-start; min-height: 48px; padding: 10px 12px; border: 1px solid var(--bord); border-radius: 12px; background: var(--carte); cursor: pointer; }
.coche input { width: 24px; height: 24px; margin: 2px 0 0; accent-color: var(--vert); flex: none; }
.segments { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segments.trois { grid-template-columns: repeat(3, 1fr); }
.segments.trois span { min-height: 44px; font-size: .9375rem; }
.ligne a.haut { color: inherit; text-decoration: none; }
.segments label { display: block; }
.segments input { position: absolute; opacity: 0; pointer-events: none; }
.segments span { display: grid; place-items: center; min-height: 52px; padding: 8px; border: 1px solid #B9B7AA; border-radius: 12px; background: var(--carte); text-align: center; font-weight: 600; cursor: pointer; }
.segments input:checked + span { background: var(--vert); border-color: var(--vert); color: #fff; }
.segments input:focus-visible + span { outline: 3px solid var(--sable); outline-offset: 2px; }
.erreur-form { color: #8E2B27; background: var(--rouge-pale); border-radius: 10px; padding: 10px 12px; font-weight: 600; }
fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
legend { font-weight: 600; padding: 0; margin-bottom: 6px; }

/* ---------- messages ---------- */
.bandeau { padding: 10px 16px; font-size: .875rem; font-weight: 600; text-align: center; }
.bandeau.hors-ligne { background: var(--charbon); color: #fff; }
.note { padding: 12px 14px; border-radius: 12px; background: var(--sable-pale); color: #5A410F; font-size: .9375rem; }
.note.info { background: var(--vert-pale); color: var(--vert-fonce); }
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--nav) + 16px + env(safe-area-inset-bottom)); z-index: 20;
  max-width: 528px; margin: 0 auto; padding: 14px 16px; border-radius: 12px;
  background: var(--charbon); color: #fff; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.toast.erreur { background: var(--rouge); }
dialog.dialogue { width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); border: 0; border-radius: 16px; padding: 20px; color: var(--charbon); box-shadow: 0 16px 48px rgba(0, 0, 0, .3); }
dialog.dialogue::backdrop { background: rgba(23, 35, 30, .55); }
dialog.dialogue h2 { margin-bottom: 12px; }
dialog.dialogue .actions { margin-top: 4px; }
.chargement { text-align: center; color: var(--gris); padding: 48px 16px; }

/* ---------- journal ---------- */
.journal { font-size: .875rem; }
.journal .ligne { gap: 4px; }
.journal code { font: .8125rem ui-monospace, Consolas, monospace; color: var(--gris); word-break: break-all; }
.journal .action { font-weight: 700; }
.journal pre { margin: 0; padding: 8px; border-radius: 8px; background: #F1F0E8; font: .75rem/1.4 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }

@media (min-width: 720px) {
  .ecran { padding-top: 32px; }
  .deux { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .porte { transition: background-color .12s; }
}
