/* Eytoubi - interface web. Jetons de couleur en tete : changer la marque = changer ce bloc.
   Direction : base neutre, une seule couleur forte (le jaune Eytoubi), graphite pour le texte et
   la structure, vert reserve a l'argent. Du relief par les ombres, pas par les couleurs. */
:root {
  --encre: #1D2433;        /* graphite : texte, structure, curseur du livreur */
  --encre-2: #3A4357;
  --papier: #F4F5F7;       /* fond gris tres clair */
  --surface: #FFFFFF;
  --signal: #FFC800;       /* jaune Eytoubi : la seule couleur forte */
  --signal-clair: #FFD633;
  --signal-fonce: #E0A800;
  --signal-pale: #FFF6D1;
  --foret: #0F8A44;        /* argent, succes */
  --foret-vif: #12A150;
  --foret-clair: #E6F6EC;
  --alerte: #D0353A;
  --alerte-clair: #FDECEC;
  --attente: #7A5600;
  --attente-clair: #FFF6D1;
  --gris: #6B7385;
  --gris-2: #8A91A0;
  --trait: #E3E6EB;
  --trait-2: #F0F1F4;
  --rayon: 16px;
  --rayon-bloc: 22px;
  --ombre: 0 12px 26px -14px rgba(29, 36, 51, 0.3), 0 1px 3px rgba(29, 36, 51, 0.06);
  --ombre-forte: 0 16px 34px -12px rgba(29, 36, 51, 0.38), 0 2px 6px rgba(29, 36, 51, 0.08);
  --police: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --nav-h: 66px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--papier); color: var(--encre);
  font: 600 16px/1.5 var(--police); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--encre); }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--signal-fonce); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- titres */
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.015em; }
h1 { font-size: 1.75rem; font-weight: 900; }
h2 { font-size: 1.25rem; font-weight: 900; }
h3 { font-size: 1.05rem; font-weight: 800; }
p { margin: 0; }
.discret { color: var(--gris); }
.petit { font-size: 0.875rem; }
.montant { font-weight: 900; white-space: nowrap; letter-spacing: -0.01em; }

/* ---------------------------------------------------------------- structure */
.coquille { min-height: 100dvh; display: flex; flex-direction: column; }
.barre {
  background: var(--encre); color: #fff; padding: 14px 20px;
  padding-top: max(14px, env(safe-area-inset-top));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.marque { font-weight: 900; font-size: 1.35rem; letter-spacing: -0.01em; color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.marque::before { content: ''; width: 13px; height: 13px; border-radius: 3px; background: var(--signal); transform: rotate(45deg); }
.barre .qui { font-size: 0.875rem; opacity: 0.92; text-align: right; color: #fff; text-decoration: none; }
.barre .qui:hover { text-decoration: underline; }
.contenu { flex: 1; width: 100%; max-width: 620px; margin: 0 auto; padding: 20px 16px calc(var(--nav-h) + 40px); display: flex; flex-direction: column; gap: 18px; }

.onglets {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--surface);
  box-shadow: 0 -1px 0 var(--trait), 0 -8px 24px -16px rgba(29, 36, 51, 0.25);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 6px 6px calc(8px + env(safe-area-inset-bottom));
}
.onglets a {
  text-decoration: none; color: var(--gris-2); text-align: center; padding: 4px 4px 2px; font-size: 0.78rem; font-weight: 800;
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 48px; justify-content: center;
}
.onglets a svg { width: 24px; height: 24px; padding: 2px 14px; box-sizing: content-box; border-radius: 12px; transition: background 0.15s; }
.onglets a[aria-current="page"] { color: var(--encre); }
.onglets a[aria-current="page"] svg { background: var(--signal); }

/* Administration : navigation laterale sur grand ecran */
.coquille.admin .contenu { max-width: 1180px; }
@media (min-width: 960px) {
  .coquille.admin { display: grid; grid-template-columns: 230px 1fr; grid-template-rows: auto 1fr; }
  .coquille.admin .barre { grid-column: 1 / -1; }
  .coquille.admin .onglets {
    position: sticky; top: 0; align-self: start; align-content: start; grid-auto-flow: row; grid-auto-columns: auto; box-shadow: 1px 0 0 var(--trait);
    height: calc(100dvh - 60px); padding: 16px 10px; background: var(--surface); gap: 4px;
  }
  .coquille.admin .onglets a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 14px; font-size: 0.95rem; border-radius: 14px; min-height: 0; }
  .coquille.admin .onglets a svg { padding: 0; background: none; }
  .coquille.admin .onglets a[aria-current="page"] { background: var(--signal); color: var(--encre); }
  .coquille.admin .onglets a[aria-current="page"] svg { background: none; }
  .coquille.admin .contenu { padding: 28px 32px 48px; }
}

/* ---------------------------------------------------------------- blocs */
.bloc { background: var(--surface); border-radius: var(--rayon-bloc); padding: 18px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--ombre); }
.bloc.plat { background: transparent; box-shadow: none; padding: 0; }
.entete { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pile { display: flex; flex-direction: column; gap: 10px; }
.ligne { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ligne.entre { justify-content: space-between; flex-wrap: nowrap; }
.ligne.entre > :first-child { flex: 1 1 auto; min-width: 0; }
.ligne.entre > :last-child:not(:first-child):not(input) { flex: 0 1 auto; text-align: right; }
.ligne.entre > b:last-child, .ligne.entre > .montant:last-child { white-space: nowrap; }
.grille-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grille-4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 760px) { .grille-4 { grid-template-columns: repeat(4, 1fr); } }
.deux-colonnes { display: grid; gap: 20px; }
@media (min-width: 1100px) { .deux-colonnes { grid-template-columns: 1.4fr 1fr; align-items: start; } }

/* Chiffres cles : le chiffre d'abord, l'etiquette dessous */
.chiffre { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--surface); border-radius: 18px; box-shadow: var(--ombre); }
.chiffre b { font-size: 1.5rem; font-weight: 900; line-height: 1.1; letter-spacing: -0.02em; }
.chiffre span { font-size: 0.85rem; color: var(--gris); font-weight: 700; }
.chiffre.argent b { color: var(--foret); }

/* ---------------------------------------------------------------- boutons et champs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 20px;
  border: 0; border-radius: var(--rayon); background: linear-gradient(180deg, var(--signal-clair) 0%, #FFC400 100%); color: var(--encre);
  font-weight: 900; font-size: 1rem; cursor: pointer; text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 3px 0 var(--signal-fonce), 0 10px 18px -10px rgba(224, 168, 0, 0.8);
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 1px 0 var(--signal-fonce); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.large { width: 100%; min-height: 58px; font-size: 1.08rem; border-radius: 18px; }
.btn.second { background: var(--surface); color: var(--encre); box-shadow: inset 0 0 0 1.5px var(--trait), 0 2px 0 var(--trait); }
.btn.second:hover { background: var(--papier); }
.btn.sombre { background: var(--encre); color: #fff; box-shadow: 0 3px 0 #0B0F18, 0 10px 18px -10px rgba(29, 36, 51, 0.7); }
.btn.danger { background: var(--surface); color: var(--alerte); box-shadow: inset 0 0 0 1.5px var(--alerte); }
.btn.petit { min-height: 40px; padding: 0 14px; font-size: 0.9rem; border-radius: 13px; }
.grille-2 > .btn { padding: 0 10px; font-size: 0.95rem; line-height: 1.2; text-align: center; }
.lien { background: none; border: 0; padding: 0; color: var(--encre); text-decoration: underline; cursor: pointer; font-weight: 800; }

label.champ { display: flex; flex-direction: column; gap: 6px; font-weight: 800; font-size: 0.95rem; }
label.champ small { font-weight: 600; color: var(--gris); margin-left: 6px; }
input[type=text], input[type=tel], input[type=email], input[type=date], input[type=search], input[type=number], select, textarea {
  width: 100%; min-height: 52px; padding: 12px 14px; border: 1.5px solid var(--trait); border-radius: 14px;
  background: var(--surface); font-size: 1rem; font-weight: 700;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--encre); outline: none; box-shadow: 0 0 0 4px rgba(255, 200, 0, 0.45); }
.prefixe { display: flex; }
.prefixe span { display: flex; align-items: center; padding: 0 12px; border: 1.5px solid var(--trait); border-right: 0; border-radius: 14px 0 0 14px; background: var(--papier); font-weight: 800; }
.prefixe input { border-radius: 0 14px 14px 0; }
.code-saisie { font-size: 1.8rem !important; letter-spacing: 0.4em; text-align: center; font-weight: 900 !important; }

/* Choix segmentes (paiement, disponibilite) */
.choix { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--papier); border-radius: 16px; }
.choix input { position: absolute; opacity: 0; pointer-events: none; }
.choix label { text-align: center; padding: 11px 6px; font-weight: 800; cursor: pointer; font-size: 0.95rem; border-radius: 12px; color: var(--gris); }
.choix input:checked + label { background: var(--surface); color: var(--encre); box-shadow: var(--ombre); }
.choix input:focus-visible + label { outline: 3px solid var(--signal-fonce); outline-offset: -3px; }

.interrupteur { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px; border-radius: var(--rayon-bloc); border: 0; background: var(--surface); box-shadow: var(--ombre); cursor: pointer; width: 100%; text-align: left; }
.interrupteur.actif { background: var(--foret-clair); color: var(--foret); }
.interrupteur .pastille { width: 54px; height: 32px; border-radius: 16px; background: var(--trait); position: relative; flex: none; }
.interrupteur .pastille::after { content: ''; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); }
.interrupteur.actif .pastille { background: var(--foret-vif); }
.interrupteur.actif .pastille::after { transform: translateX(22px); }

/* ---------------------------------------------------------------- etiquettes d'etat */
.etat { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 800; white-space: nowrap; background: var(--papier); color: var(--encre-2); }
.etat::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.etat.ok { background: var(--foret-clair); color: var(--foret); }
.etat.attente { background: var(--attente-clair); color: var(--attente); }
.etat.ko { background: var(--alerte-clair); color: var(--alerte); }
.etat.encours { background: var(--encre); color: #fff; }
.etat.encours::before { background: var(--signal); }

.bandeau { padding: 14px 16px; border-radius: 18px; background: var(--attente-clair); color: var(--encre); display: flex; flex-direction: column; gap: 6px; }
.bandeau.ko { background: var(--alerte-clair); }
.bandeau.ko b { color: var(--alerte); }
.bandeau.ok { background: var(--foret-clair); }

/* ---------------------------------------------------------------- LA ROUTE (suivi de course) */
.route { --avance: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.route .chaussee { grid-column: 1 / -1; position: relative; height: 12px; border-radius: 6px; background: var(--trait); margin: 16px 0 10px; }
.route .parcouru { position: absolute; inset: 0 auto 0 0; width: calc(var(--avance) * 100%); border-radius: 6px; background: var(--encre); transition: width 0.8s ease; }
.route .borne { position: absolute; top: 50%; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 5px solid var(--encre); transform: translate(-50%, -50%); }
.route .borne.depart { left: 9px; }
.route .borne.arrivee { left: calc(100% - 9px); border-radius: 6px; border-color: var(--signal); background: var(--signal); }
.route .vehicule {
  position: absolute; top: 50%; left: clamp(18px, calc(var(--avance) * 100%), calc(100% - 18px)); transform: translate(-50%, -50%);
  width: 38px; height: 38px; border-radius: 50%; background: var(--encre); color: var(--signal); border: 3px solid #fff; box-shadow: 0 4px 10px rgba(29, 36, 51, 0.3); display: grid; place-items: center; transition: left 0.8s ease;
}
.route .vehicule svg { width: 20px; height: 20px; }
.route.recherche .vehicule { animation: cherche 1.6s ease-in-out infinite; }
@keyframes cherche { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 200, 0, 0.7); } 50% { box-shadow: 0 0 0 12px rgba(255, 200, 0, 0); } }
.route .point { font-size: 0.85rem; color: var(--gris); font-weight: 700; }
.route .point b { display: block; color: var(--encre); font-size: 1rem; font-weight: 900; }
.route .point.fin { text-align: right; }
@media (prefers-reduced-motion: reduce) { .route .parcouru, .route .vehicule { transition: none; } .route.recherche .vehicule { animation: none; } }

.carte-course { text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 12px; }
a.carte-course:hover { box-shadow: var(--ombre-forte); }

/* Etapes de la course (vraie sequence : numerotee) */
.etapes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.etapes li { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: start; padding-bottom: 16px; position: relative; }
.etapes li::before { content: ''; position: absolute; left: 13px; top: 26px; bottom: 0; width: 2px; background: var(--trait); }
.etapes li:last-child::before { display: none; }
.etapes .num { width: 28px; height: 28px; border-radius: 50%; background: var(--papier); display: grid; place-items: center; font-size: 0.8rem; font-weight: 900; color: var(--gris); z-index: 1; }
.etapes li.fait .num { background: var(--encre); color: var(--signal); }
.etapes li.fait::before { background: var(--encre); }

/* ---------------------------------------------------------------- listes et tableaux */
.liste { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--rayon-bloc); box-shadow: var(--ombre); overflow: hidden; }
.liste > * { padding: 14px 16px; border-top: 1px solid var(--trait-2); display: flex; justify-content: space-between; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.liste > *:first-child { border-top: 0; }
a.liste-el:hover, .liste > a:hover { background: var(--papier); }
.liste .titre { font-weight: 800; }
.liste .sous { font-size: 0.85rem; color: var(--gris); font-weight: 700; }
.vide { padding: 28px 16px; text-align: center; color: var(--gris); display: flex; flex-direction: column; gap: 12px; align-items: center; font-weight: 700; }

.tableau { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 0.92rem; }
.tableau th { text-align: left; font-weight: 800; color: var(--gris); font-size: 0.82rem; padding: 12px; border-bottom: 1px solid var(--trait); white-space: nowrap; background: #FAFBFC; }
.tableau td { padding: 12px; border-bottom: 1px solid var(--trait-2); vertical-align: top; }
.tableau tr.cliquable { cursor: pointer; }
.tableau tr.cliquable:hover td { background: var(--papier); }
.tableau .droite { text-align: right; }
.defile { overflow-x: auto; border-radius: var(--rayon-bloc); box-shadow: var(--ombre); background: var(--surface); }

.filtres { display: flex; gap: 6px; flex-wrap: wrap; }
.filtres button { border: 0; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--trait); border-radius: 999px; padding: 8px 14px; font-weight: 800; cursor: pointer; font-size: 0.9rem; }
.filtres button[aria-pressed="true"] { background: var(--encre); color: #fff; box-shadow: none; }

/* Graphique 14 jours */
.histo { display: grid; grid-template-columns: repeat(14, 1fr); align-items: end; gap: 6px; height: 150px; padding-top: 10px; }
.histo .col { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; position: relative; }
.histo .barre-cmd { background: var(--trait); border-radius: 6px 6px 0 0; position: relative; min-height: 2px; }
.histo .barre-liv { position: absolute; bottom: 0; left: 0; right: 0; background: var(--encre); border-radius: 6px 6px 0 0; }
.histo-axe { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; font-size: 0.7rem; color: var(--gris); text-align: center; }
.legende { display: flex; gap: 16px; font-size: 0.82rem; color: var(--gris); }
.legende i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* Documents du dossier */
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.doc { border: 1.5px dashed var(--trait); border-radius: 18px; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.doc.fourni { border-style: solid; border-color: var(--foret-vif); }
.doc .vignette { aspect-ratio: 4 / 3; border-radius: 12px; background: var(--papier); overflow: hidden; display: grid; place-items: center; color: var(--gris); font-size: 0.8rem; }
.doc .vignette img { width: 100%; height: 100%; object-fit: cover; }
.doc label.btn { cursor: pointer; }
.doc input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }

.carte { height: 260px; border-radius: var(--rayon-bloc); overflow: hidden; background: var(--papier); box-shadow: var(--ombre); }
.carte .leaflet-tile-pane, .carte-plein .leaflet-tile-pane { filter: saturate(0.3) brightness(1.05) contrast(0.92); }

/* Connexion */
.accueil-connexion { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; background: var(--signal); background: linear-gradient(180deg, var(--signal-clair) 0%, #FFC400 100%); color: var(--encre); }
.accueil-connexion .marque { color: var(--encre); }
.accueil-connexion .marque::before { background: var(--encre); }
.accueil-connexion .haut { padding: 32px 24px 28px; max-width: 520px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: 16px; }
.accueil-connexion .slogan { font-size: 2.2rem; font-weight: 900; line-height: 1.02; letter-spacing: -0.03em; }
.accueil-connexion .bas { background: var(--papier); color: var(--encre); border-radius: 30px 30px 0 0; padding: 28px 20px 40px; box-shadow: 0 -12px 30px -12px rgba(120, 80, 0, 0.4); }
.accueil-connexion .bas > div { max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }

#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 24px); transform: translate(-50%, 20px); max-width: min(92vw, 460px); z-index: 60;
  background: var(--encre); color: #fff; padding: 12px 18px; border-radius: 16px; font-weight: 800; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; box-shadow: var(--ombre-forte);
}
#toast.visible { opacity: 1; transform: translate(-50%, 0); }
#toast.ko { background: var(--alerte); }

.chargement { padding: 40px; text-align: center; color: var(--gris); font-weight: 700; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Primes et niveaux */
.jauge { height: 8px; background: var(--trait); border-radius: 4px; overflow: hidden; margin: 0.4rem 0 0.25rem; }
.jauge i { display: block; height: 100%; background: var(--encre); border-radius: 4px; transition: width 0.4s ease; }
.chiffre .jauge { margin-top: 0.5rem; }
.niveau { display: inline-block; font-size: 0.75rem; font-weight: 900; padding: 0.15rem 0.6rem; border-radius: 8px; background: var(--papier); color: var(--encre-2); vertical-align: middle; }
.niveau.confirme { background: var(--encre); color: var(--signal); }
.niveau.pro { background: var(--signal); color: var(--encre); }
.jeu .fiab { font-size: 1.35rem; }
.jeu .defi { border-top: 1px solid var(--trait-2); padding-top: 0.75rem; margin-top: 0.75rem; }
.jeu .gagne { color: var(--foret); font-weight: 900; }
.jours { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 0.4rem 0 0.25rem; }
.jours span { height: 8px; border-radius: 4px; background: var(--trait); }
.jours span.fait { background: var(--signal); }
.jours span.cible { box-shadow: 0 0 0 2px var(--encre); }
.grille-reglages { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 1rem; margin-bottom: 1rem; align-items: end; }
a.btn { text-align: center; justify-content: center; }
.coche { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0; font-weight: 800; }

/* ================================================================ LIVREUR : ecran carte */
.coquille.immersif { height: 100dvh; overflow: hidden; }
.coquille.immersif .barre, .coquille.sans-barre .barre { display: none; }
.coquille.immersif .contenu { max-width: none; padding: 0; gap: 0; position: relative; }
.ecran-carte { position: fixed; inset: 0 0 calc(var(--nav-h) + env(safe-area-inset-bottom)) 0; overflow: hidden; background: #EEF0F3; }
.carte-plein { position: absolute; inset: 0; z-index: 0; background: #EEF0F3; }
.carte-plein .leaflet-control-attribution { font-size: 9px; background: rgba(255, 255, 255, 0.7); }
.carte-plein .leaflet-control-zoom { display: none; }

.verre { background: rgba(255, 255, 255, 0.92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: var(--ombre-forte); }
.hud { position: absolute; z-index: 10; left: 12px; right: 12px; top: max(12px, env(safe-area-inset-top)); display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud-ligne { display: flex; align-items: center; gap: 10px; }
.hud-ligne .espace { flex: 1; }
.puce { display: flex; align-items: center; gap: 9px; border-radius: 30px; padding: 4px 14px 4px 4px; text-decoration: none; color: var(--encre); }
.puce .qui { display: flex; flex-direction: column; line-height: 1.15; }
.puce .qui b { font-size: 15px; font-weight: 900; }
.puce .qui span { font-size: 12px; font-weight: 800; color: var(--gris); }
.anneau { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; background: conic-gradient(from -90deg, var(--signal) 0 var(--p, 0%), var(--trait) var(--p, 0%) 100%); }
.anneau > svg, .anneau > span { width: 36px; height: 36px; border-radius: 50%; border: 2px solid #fff; display: block; background: #fff; }
.piece { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: linear-gradient(180deg, #FFDA4D 0%, #FFB800 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 2px 4px rgba(200, 140, 0, 0.35); }
.piece svg { width: 15px; height: 15px; fill: var(--encre); }
.puce.points { padding: 5px 14px 5px 5px; font-weight: 900; font-size: 18px; }

.objectif-hud { border-radius: 22px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; }
.objectif-hud .barres { flex: 1; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.objectif-hud .titre { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; font-weight: 900; }
.objectif-hud .titre span { font-size: 13px; font-weight: 800; color: var(--gris); white-space: nowrap; }
.objectif-hud .gain { color: var(--foret); font-weight: 900; }
.segments { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.segments i { height: 8px; border-radius: 4px; background: var(--trait); }
.segments i.fait { background: var(--signal); }
.objectif-hud .sep { width: 1px; align-self: stretch; background: var(--trait); }
.serie-hud { display: flex; align-items: center; gap: 6px; line-height: 1.05; }
.serie-hud svg { width: 20px; height: 20px; fill: #FF9500; }
.serie-hud b { display: block; font-size: 16px; font-weight: 900; }
.serie-hud span { font-size: 11px; font-weight: 800; color: var(--gris); }

.etape-hud { background: var(--encre); color: #fff; border-radius: 24px; padding: 14px 16px; box-shadow: 0 16px 30px -12px rgba(29, 36, 51, 0.6); display: flex; flex-direction: column; gap: 12px; }
.etape-hud .haut { display: flex; align-items: center; gap: 12px; }
.etape-hud .ico { width: 50px; height: 50px; border-radius: 16px; background: linear-gradient(180deg, #FFDA4D 0%, #FFC400 100%); display: grid; place-items: center; flex: none; color: var(--encre); }
.etape-hud .ico svg { width: 26px; height: 26px; }
.etape-hud .txt { flex: 1; min-width: 0; line-height: 1.2; }
.etape-hud .txt span { font-size: 13px; font-weight: 800; color: var(--signal-clair); }
.etape-hud .txt b { display: block; font-size: 20px; font-weight: 900; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.etape-hud .dist { font-size: 16px; font-weight: 900; color: #C9CED8; white-space: nowrap; }
.etape-hud .progres { display: flex; gap: 6px; }
.etape-hud .progres i { flex: 1; height: 6px; border-radius: 3px; background: #3A4357; }
.etape-hud .progres i.fait { background: var(--signal); }
.pastille-info { align-self: flex-start; display: flex; align-items: center; gap: 8px; border-radius: 20px; padding: 8px 14px 8px 10px; font-size: 13px; font-weight: 800; color: var(--encre-2); }
.pastille-info svg { width: 16px; height: 16px; stroke: var(--foret-vif); }

.boutons-carte { position: absolute; z-index: 10; right: 12px; display: flex; flex-direction: column; gap: 10px; transition: bottom 0.25s; }
.rond { width: 50px; height: 50px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 8px 18px -6px rgba(29, 36, 51, 0.35); display: grid; place-items: center; cursor: pointer; color: var(--encre); text-decoration: none; }
.rond svg { width: 22px; height: 22px; }

.feuille {
  position: absolute; z-index: 20; left: 0; right: 0; bottom: 0; max-height: 50%; display: flex; flex-direction: column; transition: max-height 0.25s ease;
  background: #fff; border-radius: 30px 30px 0 0; box-shadow: 0 -12px 34px -8px rgba(29, 36, 51, 0.22);
}
.feuille.grande { max-height: 84%; }
.feuille .poignee { width: 72px; height: 24px; margin: 2px auto 0; flex: none; border: 0; background: none; cursor: pointer; display: grid; place-items: center; padding: 0; }
.feuille .poignee::before { content: ''; width: 40px; height: 5px; border-radius: 3px; background: #DDE0E6; }
.feuille .defile-feuille { overflow-y: auto; padding: 6px 16px 18px; display: flex; flex-direction: column; gap: 14px; overscroll-behavior: contain; }
@media (min-width: 700px) { .feuille { left: 50%; width: 560px; transform: translateX(-50%); } }
.feuille-tete { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 2px; }
.feuille-tete h2 { font-size: 22px; line-height: 1.1; }
.feuille-tete p { font-size: 13px; color: var(--gris); font-weight: 700; display: flex; align-items: center; gap: 5px; }
.dispo { display: flex; align-items: center; gap: 7px; border: 0; border-radius: 22px; padding: 8px 14px; font-weight: 900; font-size: 14px; min-height: 44px; cursor: pointer; background: var(--papier); color: var(--encre-2); white-space: nowrap; }
.dispo i { width: 9px; height: 9px; border-radius: 50%; background: var(--gris-2); }
.dispo.on { background: var(--foret-clair); color: var(--foret); }
.dispo.on i { background: var(--foret-vif); box-shadow: 0 0 0 4px rgba(18, 161, 80, 0.2); }
.dispo[disabled] { opacity: 0.5; cursor: not-allowed; }

.offre { background: #fff; border-radius: 24px; padding: 16px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 0 0 1px #ECEEF2, 0 14px 30px -14px rgba(29, 36, 51, 0.3); scroll-margin: 12px; transition: box-shadow 0.2s; }
.offre.focus { box-shadow: 0 0 0 3px var(--signal), 0 14px 30px -14px rgba(29, 36, 51, 0.3); }
.offre .tete { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tag { background: var(--papier); color: var(--encre-2); font-size: 13px; font-weight: 900; border-radius: 10px; padding: 5px 10px; white-space: nowrap; }
.tag.jaune { background: var(--signal-pale); color: var(--attente); display: inline-flex; align-items: center; gap: 5px; }
.tag.jaune svg { width: 13px; height: 13px; fill: var(--signal-fonce); }
.tag.vert { background: var(--foret-clair); color: var(--foret); }
.offre .prix { font-size: 30px; font-weight: 900; line-height: 1; letter-spacing: -0.02em; white-space: nowrap; }
.offre .prix small { font-size: 15px; font-weight: 800; color: var(--gris); }
.trajet { display: grid; grid-template-columns: 16px 1fr; gap: 0 12px; }
.trajet .rail { display: flex; flex-direction: column; align-items: center; padding-top: 4px; grid-row: span 2; }
.trajet .rail .a { width: 14px; height: 14px; border-radius: 50%; border: 4px solid var(--encre); background: #fff; flex: none; }
.trajet .rail .l { flex: 1; width: 2px; background: #DDE0E6; margin: 4px 0; min-height: 14px; }
.trajet .rail .b { width: 14px; height: 14px; border-radius: 4px; background: var(--signal); box-shadow: 0 0 0 3px var(--signal-pale); flex: none; }
.trajet .lieu { line-height: 1.25; padding-bottom: 12px; }
.trajet .lieu:last-child { padding-bottom: 0; }
.trajet .lieu b { display: block; font-weight: 900; font-size: 15px; }
.trajet .lieu span { font-size: 13px; color: var(--gris); font-weight: 700; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; }

.contact { display: flex; align-items: center; gap: 12px; }
.contact .initiale { width: 50px; height: 50px; border-radius: 50%; background: var(--papier); display: grid; place-items: center; font-weight: 900; font-size: 19px; color: var(--encre-2); flex: none; }
.contact .txt { flex: 1; min-width: 0; line-height: 1.25; }
.contact .txt b { display: block; font-size: 16px; font-weight: 900; }
.contact .txt span { font-size: 13px; color: var(--gris); font-weight: 700; }
.contact .rond { background: var(--papier); box-shadow: none; width: 48px; height: 48px; }
.cases { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.case { border-radius: 20px; padding: 12px 14px; display: flex; flex-direction: column; background: #F7F8FA; box-shadow: inset 0 0 0 1px #ECEEF2; min-width: 0; }
.case span { font-size: 13px; font-weight: 800; color: var(--gris); }
.case b { font-size: 22px; font-weight: 900; line-height: 1.2; letter-spacing: -0.02em; }
.case.jaune { background: var(--signal-pale); box-shadow: none; }
.case.jaune span, .case.jaune small { color: var(--attente); }
.case.vert { background: var(--foret-clair); box-shadow: none; }
.case.vert span { color: var(--foret); }
.case small { font-size: 12px; font-weight: 800; }
.case b .piece-mini { display: inline-block; width: 16px; height: 16px; vertical-align: -1px; margin-right: 4px; fill: var(--signal-fonce); }
.jour-stats { display: flex; justify-content: center; gap: 18px; font-size: 13px; font-weight: 800; color: var(--gris); }
.jour-stats b { color: var(--encre); }
.jour-stats .argent { color: var(--foret); }

/* Glisser pour confirmer */
.glisser { position: relative; display: flex; align-items: center; background: var(--encre); color: #fff; border-radius: 22px; min-height: 64px; padding: 6px; box-shadow: 0 4px 0 #0B0F18, 0 14px 24px -12px rgba(29, 36, 51, 0.7); user-select: none; -webkit-user-select: none; touch-action: none; overflow: hidden; }
.glisser.vert { background: var(--foret); box-shadow: 0 4px 0 #075C2C, 0 14px 24px -12px rgba(15, 138, 68, 0.7); }
.glisser .remplissage { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(255, 200, 0, 0.18); border-radius: 22px; }
.glisser .poignee-g { position: relative; z-index: 1; width: 52px; height: 52px; border-radius: 17px; background: linear-gradient(180deg, #FFDA4D 0%, #FFC400 100%); border: 0; display: grid; place-items: center; flex: none; cursor: grab; color: var(--encre); touch-action: none; }
.glisser .poignee-g svg { width: 24px; height: 24px; }
.glisser .libelle { flex: 1; text-align: center; font-size: 18px; font-weight: 900; padding-right: 52px; pointer-events: none; }
.glisser.retour .poignee-g { transition: transform 0.25s ease; }
.glisser[aria-disabled="true"] { opacity: 0.55; }

/* Celebration apres une livraison */
.bravo { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(29, 36, 51, 0.45); animation: bravo-fond 2.6s ease forwards; pointer-events: none; }
.bravo .carte-bravo { background: #fff; border-radius: 30px; padding: 26px 30px; text-align: center; box-shadow: var(--ombre-forte); display: flex; flex-direction: column; align-items: center; gap: 6px; animation: bravo-pop 2.6s cubic-bezier(.2, 1.4, .4, 1) forwards; min-width: 240px; }
.bravo .gros { width: 74px; height: 74px; border-radius: 50%; background: linear-gradient(180deg, #FFDA4D 0%, #FFB800 100%); display: grid; place-items: center; box-shadow: 0 10px 20px -8px rgba(224, 168, 0, 0.9); margin-bottom: 6px; }
.bravo .gros svg { width: 38px; height: 38px; fill: var(--encre); }
.bravo b { font-size: 30px; font-weight: 900; letter-spacing: -0.02em; }
.bravo span { font-weight: 800; color: var(--gris); }
@keyframes bravo-fond { 0% { opacity: 0; } 10%, 82% { opacity: 1; } 100% { opacity: 0; } }
@keyframes bravo-pop { 0% { transform: scale(0.6); } 14% { transform: scale(1); } 82% { transform: scale(1); opacity: 1; } 100% { transform: scale(0.96); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .bravo, .bravo .carte-bravo { animation-duration: 0.01s; animation-iteration-count: 1; } .bravo { animation: none; } }

/* Marqueurs de la carte */
.pin { display: flex; flex-direction: column; align-items: center; filter: drop-shadow(0 6px 10px rgba(29, 36, 51, 0.25)); cursor: pointer; }
.pin b { background: #fff; color: var(--encre); font: 900 14px/1 var(--police); padding: 8px 11px; border-radius: 13px; white-space: nowrap; }
.pin i { width: 10px; height: 10px; margin-top: -6px; background: #fff; transform: rotate(45deg); border-radius: 0 0 3px 0; }
.pin.top b { background: linear-gradient(180deg, #FFDA4D 0%, #FFC400 100%); font-size: 16px; padding: 9px 13px; }
.pin.top i { background: #FFC400; }
.puck { width: 52px; height: 52px; border-radius: 50%; background: var(--encre); border: 4px solid #fff; box-shadow: 0 0 0 10px rgba(255, 200, 0, 0.22), 0 10px 20px rgba(29, 36, 51, 0.35); display: grid; place-items: center; }
.puck svg { width: 24px; height: 24px; fill: var(--signal); }
.repere { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 6px solid var(--encre); box-shadow: 0 4px 10px rgba(29, 36, 51, 0.25); }
.repere.fait { background: var(--foret-vif); border-color: #fff; }
.destination { display: flex; flex-direction: column; align-items: center; filter: drop-shadow(0 8px 12px rgba(29, 36, 51, 0.3)); }
.destination div { width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(180deg, #FFDA4D 0%, #FFC400 100%); display: grid; place-items: center; }
.destination div svg { width: 22px; height: 22px; }
.destination i { width: 12px; height: 12px; margin-top: -7px; background: #FFC400; transform: rotate(45deg); border-radius: 0 0 3px 0; }

/* ================================================================ LIVREUR : profil */
.profil-tete { margin: -20px -16px 0; background: linear-gradient(180deg, var(--signal-clair) 0%, #FFC400 100%); padding: max(22px, env(safe-area-inset-top)) 18px 60px; display: flex; flex-direction: column; gap: 14px; position: relative; overflow: hidden; }
.profil-tete::before { content: ''; position: absolute; right: -50px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); }
.profil-tete::after { content: ''; position: absolute; right: 40px; top: 96px; width: 90px; height: 90px; border-radius: 50%; background: rgba(255, 255, 255, 0.12); }
.profil-tete > * { position: relative; z-index: 1; }
.profil-tete .ident { display: flex; align-items: center; gap: 14px; }
.avatar-grand { position: relative; flex: none; }
.avatar-grand svg { width: 88px; height: 88px; border-radius: 50%; background: #fff; box-shadow: 0 10px 20px -8px rgba(120, 80, 0, 0.6); display: block; }
.avatar-grand .niv { position: absolute; right: -4px; bottom: -2px; background: var(--encre); color: var(--signal); font-size: 12px; font-weight: 900; border: 3px solid #FFC400; border-radius: 12px; padding: 1px 7px; }
.profil-tete h1 { font-size: 26px; line-height: 1.05; }
.profil-tete .sous { font-size: 13px; font-weight: 800; color: #4A3A00; }
.profil-tete .barre-niv { height: 10px; border-radius: 5px; background: rgba(29, 36, 51, 0.15); }
.profil-tete .barre-niv i { display: block; height: 10px; border-radius: 5px; background: var(--encre); }
.profil-tete .legende-niv { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 900; }
.profil-stats { margin: -44px 0 0; background: #fff; border-radius: 22px; box-shadow: var(--ombre-forte); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 14px 6px; position: relative; z-index: 2; }
.profil-stats > div { display: flex; flex-direction: column; align-items: center; gap: 1px; text-align: center; padding: 0 4px; }
.profil-stats > div + div { border-left: 1px solid #ECEEF2; }
.profil-stats b { font-size: 20px; font-weight: 900; letter-spacing: -0.02em; display: flex; align-items: center; gap: 4px; }
.profil-stats b svg { width: 16px; height: 16px; fill: #FF9500; }
.profil-stats span { font-size: 12px; color: var(--gris); font-weight: 800; }
.profil-stats .argent { color: var(--foret); }
.badges { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 8px; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; background: none; border: 0; padding: 0; cursor: pointer; color: var(--encre); }
.badge .medaille { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(180deg, #FFE066 0%, #FFB800 100%); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.6), inset 0 -3px 0 rgba(170, 110, 0, 0.3), 0 8px 14px -6px rgba(224, 168, 0, 0.7); }
.badge .medaille svg { width: 26px; height: 26px; }
.badge .nom { font-size: 12px; font-weight: 900; line-height: 1.15; }
.badge.verrou .medaille { background: conic-gradient(from -90deg, var(--encre) 0 var(--p, 0%), var(--trait) var(--p, 0%) 100%); box-shadow: none; }
.badge.verrou .medaille span { width: 48px; height: 48px; border-radius: 50%; background: var(--papier); display: grid; place-items: center; font-size: 13px; font-weight: 900; color: var(--encre-2); }
.badge.verrou .nom { color: var(--gris); }
.classement { background: #fff; border-radius: 22px; padding: 4px 14px; display: flex; flex-direction: column; box-shadow: var(--ombre); }
.classement .rang { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--trait-2); }
.classement .rang:last-child { border-bottom: 0; }
.classement .rang .n { width: 28px; height: 28px; border-radius: 50%; background: var(--papier); display: grid; place-items: center; font-size: 14px; font-weight: 900; color: var(--gris); flex: none; }
.classement .rang.r1 .n { background: linear-gradient(180deg, #FFE066 0%, #FFB800 100%); color: var(--encre); }
.classement .rang.r2 .n { background: linear-gradient(180deg, #EDEFF3 0%, #C9CED8 100%); color: var(--encre); }
.classement .rang.r3 .n { background: linear-gradient(180deg, #F2C9A0 0%, #D9965A 100%); color: var(--encre); }
.classement .rang .qui { flex: 1; font-size: 15px; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.classement .rang .pts { font-size: 15px; font-weight: 900; }
.classement .rang.moi { background: var(--encre); color: #fff; border-radius: 16px; margin: 4px -10px; padding: 10px; border-bottom: 0; }
.classement .rang.moi .pts { color: var(--signal-clair); }
.classement .ecart { text-align: center; color: var(--gris-2); font-weight: 900; letter-spacing: 0.2em; padding: 2px 0; }
.liens-profil { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.puck.moto svg { fill: none; color: var(--signal); width: 26px; height: 26px; }
.contact .initiale svg { width: 24px; height: 24px; }
.feuille-tete p svg { width: 14px; height: 14px; flex: none; }
.btn svg { width: 20px; height: 20px; flex: none; }
