/* STEGO — app-shell (mobile-first, look app native) */
:root {
  --brand: #1d4ed8;
  --brand-600: #2563eb;
  --brand-700: #1e40af;
  --accent: #f59e0b;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 16px rgba(15,23,42,.06);
  --nav-h: 60px;
  --bar-h: 54px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220; --surface: #131c2e; --text: #e2e8f0;
    --muted: #94a3b8; --border: #1e293b;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  margin: 0; height: 100dvh; overflow: hidden;   /* tout tient sur un écran */
  display: flex; flex-direction: column;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
p, h1, h2, h3 { user-select: text; }

/* Icônes SVG */
.ic { width: 22px; height: 22px; fill: currentColor; vertical-align: -5px; flex: none; }

/* Barre d'application : fixée tout en haut, comme une nav classique */
.app-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; align-items: center; gap: .6rem;
  height: calc(var(--bar-h) + var(--safe-t));
  padding: 0 1rem;
  padding-top: var(--safe-t);
  background: var(--surface); color: var(--text);
  border-bottom: 1px solid var(--border);
}
.app-bar__logo { width: 30px; height: 30px; border-radius: 8px; }
.app-bar__name { font-weight: 800; font-size: 1.15rem; letter-spacing: .02em; color: var(--brand); flex: 1; }

/* Contenu : occupe l'espace restant, scroll seulement si vraiment nécessaire */
.content {
  flex: 1; min-height: 0; overflow-y: auto;
  width: 100%; max-width: 640px; margin: 0 auto;
  /* réserve l'espace de la barre fixe en haut et de la nav flottante en bas */
  padding: calc(var(--bar-h) + var(--safe-t) + .5rem) 1rem calc(var(--nav-h) + 18px + var(--safe-b));
  display: flex; flex-direction: column;
  justify-content: safe center;   /* centre, mais aligne en haut + scroll si ça déborde */
  scrollbar-width: none;          /* pas d'ascenseur visible (style app) */
}
.content::-webkit-scrollbar { display: none; }
.section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: .5rem 0 .4rem; }

/* Hero compact */
.hero { text-align: center; padding: .2rem 0 .6rem; }
.hero__hello { color: var(--muted); font-size: .9rem; margin: 0 0 .2rem; }
.hero__title { font-size: 1.35rem; line-height: 1.2; margin: .3rem 0; }
.hero__subtitle { color: var(--muted); margin: 0 auto .9rem; max-width: 38ch; line-height: 1.45; font-size: .9rem; }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  border: 0; border-radius: 999px; padding: .7rem 1.3rem;
  font: 600 1rem/1 inherit; cursor: pointer; text-decoration: none;
  transition: transform .06s, background .15s, box-shadow .15s;
}
.btn:active { transform: scale(.96); }
.btn--primary { background: var(--brand); color: #fff; box-shadow: 0 6px 18px rgba(29,78,216,.35); }
.btn--primary:hover { background: var(--brand-600); }
.btn--lg { padding: .95rem 1.9rem; font-size: 1.02rem; }
.btn--ghost { background: transparent; color: var(--brand); font-size: .88rem; padding: .5rem .8rem; }

/* Cartes compactes */
.features { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .65rem; box-shadow: var(--shadow);
}
.card__icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--brand); margin-bottom: .4rem;
}
.card__icon .ic { width: 18px; height: 18px; }
.card__icon--xl { width: 64px; height: 64px; }
.card__icon--xl .ic { width: 32px; height: 32px; }
.card h3 { margin: 0 0 .2rem; font-size: .88rem; }
.card p { margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.4; }

/* Navigation basse : flottante, fixée au-dessus du bord */
.bottom-nav {
  position: fixed; z-index: 20;
  left: 14px; right: 14px;
  bottom: calc(14px + var(--safe-b));
  max-width: 480px; margin: 0 auto;
  display: flex; height: var(--nav-h);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 8px 28px rgba(15,23,42,.16);
}
@media (prefers-color-scheme: dark) {
  .bottom-nav { box-shadow: 0 8px 28px rgba(0,0,0,.5); }
}
.bottom-nav__item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  font-size: .66rem; font-weight: 600;
  color: var(--muted); text-decoration: none;
  border-radius: 24px;
}
.bottom-nav__item.is-active { color: var(--brand); }
.bottom-nav__item:active { opacity: .7; }

/* Bouton central flottant */
.bottom-nav__item--fab { overflow: visible; }
.fab {
  display: flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; margin-top: -26px;
  border-radius: 50%; background: var(--brand); color: #fff;
  box-shadow: 0 6px 18px rgba(29,78,216,.45);
}
.fab .ic { width: 26px; height: 26px; }

/* ---- Commandes / Suivi ---- */
.page-title { font-size: 1.25rem; margin: .3rem 0 .8rem; }
.orders { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.order-card {
  display: flex; align-items: center; gap: .7rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .7rem .8rem;
  text-decoration: none; color: var(--text); box-shadow: var(--shadow);
}
.order-card__icon {
  display: flex; align-items: center; justify-content: center; flex: none;
  width: 38px; height: 38px; border-radius: 11px;
  background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand);
}
.order-card__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.order-card__body small { color: var(--muted); font-size: .78rem; }
.badge {
  flex: none; font-size: .68rem; font-weight: 700; padding: .25rem .55rem;
  border-radius: 999px; white-space: nowrap;
}
.badge--created    { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
.badge--accepted   { background: color-mix(in srgb, var(--brand) 22%, transparent); color: var(--brand-700); }
.badge--picked_up,
.badge--in_transit { background: color-mix(in srgb, var(--accent) 20%, transparent); color: #92400e; }
.badge--delivered  { background: color-mix(in srgb, #16a34a 15%, transparent); color: #16a34a; }
.badge--cancelled  { background: color-mix(in srgb, #dc2626 12%, transparent); color: #dc2626; }
.empty { text-align: center; color: var(--muted); padding: 1.2rem 0; display: flex; flex-direction: column; align-items: center; gap: .8rem; }
.order-card--static { cursor: default; }
/* Affectation d'un agent à une mission */
.assign { display: flex; align-items: center; gap: .35rem; margin-top: .4rem; color: var(--muted); }
.assign .ic { width: 16px; height: 16px; }
.assign .input { padding: .3rem .5rem; font-size: .8rem; border-radius: 9px; max-width: 160px; }
/* Actions d'une mission côté livreur */
.mission-actions { display: flex; gap: .4rem; margin-top: .5rem; }
.order-card__side { display: flex; flex-direction: column; align-items: flex-end; gap: .4rem; flex: none; }
.btn--sm { padding: .45rem .8rem; font-size: .8rem; }

/* Formulaire de commande (page défilante) */
.order-form { display: flex; flex-direction: column; }
.order-form .section-title { margin-top: .9rem; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.btn--block { width: 100%; margin-top: 1rem; }
.input--select { appearance: none; }
.field .errorlist { color: #dc2626; font-size: .78rem; margin: .2rem 0 0; padding-left: 1rem; }
.field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .35rem; color: var(--muted); }

/* Détail commande + QR */
.detail { text-align: center; display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.qr-box { background: #fff; border-radius: var(--radius); padding: .8rem; box-shadow: var(--shadow); }
.qr-box svg { display: block; width: 180px; height: 180px; }
.qr-hint { color: var(--muted); font-size: .82rem; margin: 0; }
.detail__card { text-align: left; width: 100%; }
.detail__card p { margin: 0 0 .7rem; font-size: .88rem; line-height: 1.45; }
.detail__card p:last-child { margin: 0; }
.detail__card strong { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }

/* Code de livraison (côté client) */
.delivery-code { text-align: center; width: 100%; display: flex; flex-direction: column; gap: .2rem; }
.delivery-code b {
  font-size: 1.9rem; letter-spacing: .35em; color: var(--brand);
  font-variant-numeric: tabular-nums; padding-left: .35em;
}
.delivery-code small { color: var(--muted); font-size: .76rem; }

/* Scanner QR (côté livreur) */
.scanner {
  display: flex; flex-direction: column; align-items: center; gap: .6rem;
  margin-bottom: 1rem;
}
.scanner__cam, .scanner__placeholder {
  width: 100%; max-width: 320px; aspect-ratio: 1;
  border-radius: var(--radius); background: #0b1220; object-fit: cover;
}
.scanner__placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .5rem; color: rgba(255, 255, 255, .5);
  border: 2px dashed color-mix(in srgb, var(--brand) 45%, transparent);
}
.scanner__placeholder .ic { width: 46px; height: 46px; }
.scanner__status { color: var(--muted); font-size: .84rem; margin: 0; text-align: center; }
.code-input {
  font-size: 1.5rem; letter-spacing: .3em; text-align: center;
  font-variant-numeric: tabular-nums;
}
.chip--pick { border: 0; cursor: pointer; font-family: inherit; margin: .2rem .2rem 0 0; }
.scan-form { padding: 0 1rem 1rem; overflow-y: auto; }
.scan-form .btn { width: 100%; margin-top: .6rem; }

/* Informations de la commande lue par le scan */
.scan-info {
  margin: .9rem 1rem .2rem; padding: .8rem .9rem; border-radius: 12px;
  background: color-mix(in srgb, var(--brand) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
}
.scan-info__head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.scan-info__head strong { font-size: 1.05rem; color: var(--brand); letter-spacing: .03em; }
.scan-info p { margin: .55rem 0 0; font-size: .86rem; line-height: 1.35; }
.scan-info b {
  color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .05em;
}

/* Suivi */
.track-form { display: flex; gap: .5rem; margin-bottom: 1rem; }
.track-form .input { flex: 1; }

/* ---- Espace agence : SPA avec sidebar gauche ---- */
.content:has(> .agence) { padding: 0; max-width: none; justify-content: flex-start; }
.agence { display: flex; width: 100%; height: 100%; min-height: 0; }

.side {
  width: 220px; flex: none;
  display: flex; flex-direction: column; gap: .25rem;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 1rem .7rem calc(1rem + var(--safe-b));
}
.side__nav { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: .25rem; }
.side__brand { display: flex; align-items: center; gap: .55rem; padding: .2rem .5rem 1rem; }
.side__brand img { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.side__brand b { color: var(--brand); font-size: 1.05rem; line-height: 1.1; }
.side__brand small { display: block; color: var(--muted); font-size: .66rem; text-transform: uppercase; letter-spacing: .05em; }
.side__item {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem .7rem; border-radius: 10px;
  color: var(--muted); text-decoration: none;
  font-weight: 600; font-size: .9rem;
}
.side__item:hover { background: color-mix(in srgb, var(--brand) 7%, transparent); }
.side__item.is-active { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); }
.side__item--danger { color: #dc2626; margin-top: auto; }
.side__item--danger:hover { background: color-mix(in srgb, #dc2626 8%, transparent); }
.side__count {
  margin-left: auto; font-style: normal;
  min-width: 20px; height: 20px; padding: 0 .4rem;
  border-radius: 999px; text-align: center;
  background: color-mix(in srgb, var(--brand) 14%, transparent);
  color: var(--brand); font-size: .72rem; font-weight: 800; line-height: 20px;
}
.side__count--new { background: #dc2626; color: #fff; }

.agence__main {
  flex: 1; min-width: 0; overflow-y: auto;
  padding: 1.2rem 1.4rem calc(1.2rem + var(--safe-b));
  scrollbar-width: none;
}
.agence__main::-webkit-scrollbar { display: none; }

/* Panneaux SPA : un seul visible à la fois */
.panel { display: none; }
.panel.is-active { display: block; animation: rise .25s ease both; }

/* Stats du tableau de bord */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .6rem; margin-bottom: .6rem; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .8rem .9rem; box-shadow: var(--shadow);
}
.stat b { font-size: 1.45rem; }
.stat small { color: var(--muted); font-size: .74rem; display: block; margin-top: .15rem; }
.stat--gain { border-color: color-mix(in srgb, #16a34a 40%, transparent); }
.stat--gain b { color: #16a34a; }
.stat--fee b { color: #dc2626; }
.recharge-form { display: flex; gap: .5rem; max-width: 420px; margin-bottom: .8rem; }
.recharge-form .input { flex: 1; }
.pos { color: #16a34a; }
.neg { color: #dc2626; }
.muted { color: var(--muted); }
.price { color: #16a34a; font-weight: 700; }

/* Statistiques : barres 7 jours (série unique, teinte marque) */
.chart { padding: 1rem 1rem .6rem; }
.chart__bars {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: .5rem; height: 140px;
  border-bottom: 1px solid var(--border);   /* ligne de base discrète */
}
.chart__col {
  flex: 1; height: 100%; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 4px; cursor: default;
}
.chart__bar {
  width: 22px; max-width: 60%;
  background: var(--brand); border-radius: 4px 4px 0 0;
  transition: opacity .15s;
}
.chart__col:hover .chart__bar { opacity: .8; }
.chart__val { font-size: .72rem; font-weight: 700; opacity: 0; transition: opacity .15s; }
.chart__col:hover .chart__val { opacity: 1; }        /* valeur au survol uniquement */
.chart__lbl { font-size: .68rem; color: var(--muted); padding: 4px 0 2px; }
@media (prefers-color-scheme: dark) { .chart__bar { background: var(--brand-600); } }

.status-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.status-list li {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: .55rem .8rem; box-shadow: var(--shadow);
}

/* Bouton d'upload de fichier stylisé (photo) */
.file-btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .55rem 1rem; border-radius: 999px; cursor: pointer;
  background: color-mix(in srgb, var(--brand) 10%, transparent);
  color: var(--brand); font-weight: 600; font-size: .88rem;
  border: 1.5px dashed color-mix(in srgb, var(--brand) 40%, transparent);
  transition: background .15s, border-color .15s;
  max-width: 100%;
}
.file-btn:hover { background: color-mix(in srgb, var(--brand) 16%, transparent); border-color: var(--brand); }
.file-btn input[type="file"] { display: none; }
.file-btn [data-file-label] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-btn.has-file { border-style: solid; }

/* Agents livreurs */
.agent-form { max-width: 560px; margin-bottom: 1rem; }
.agent-form .btn { margin-top: .3rem; }
.agent-form input[type="file"] { font-size: .85rem; color: var(--muted); }
.agent-avatar {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none;
  border: 1px solid var(--border);
}
.agent-avatar--initial {
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--brand) 14%, transparent);
  color: var(--brand); font-weight: 800; font-size: 1.1rem;
}
.agent-actions { display: flex; gap: .35rem; }
.btn--ghost-dark {
  background: color-mix(in srgb, var(--brand) 10%, transparent);
  color: var(--brand);
}

/* Paramètres agence */
.params-form { max-width: 560px; display: flex; flex-direction: column; }
.params-form .btn { align-self: flex-start; margin-top: 1rem; }
.params-photo { display: flex; align-items: center; gap: 1rem; margin-bottom: .6rem; }
.params-photo__img,
.params-photo__placeholder {
  width: 84px; height: 84px; border-radius: 16px; object-fit: cover; flex: none;
  border: 1px solid var(--border);
}
.params-photo__placeholder {
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--brand) 10%, transparent); color: var(--brand);
}
.params-photo input[type="file"] { font-size: .85rem; color: var(--muted); }
textarea.input { resize: vertical; min-height: 74px; font-family: inherit; }
.hint { display: block; color: var(--muted); font-size: .75rem; margin-top: .25rem; }

/* Zone de couverture : saisie en chips */
.chips {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem;
  padding: .45rem .6rem; border: 1.5px solid var(--border); border-radius: 12px;
  background: var(--surface); cursor: text;
}
.chips:focus-within { border-color: var(--brand); }
.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--brand); font-size: .82rem; font-weight: 600;
  padding: .3rem .3rem .3rem .65rem; border-radius: 999px;
  animation: pop .2s ease both;
}
.chip button {
  border: 0; background: color-mix(in srgb, var(--brand) 18%, transparent);
  color: var(--brand); width: 18px; height: 18px; border-radius: 50%;
  font-size: .85rem; line-height: 1; cursor: pointer; padding: 0;
}
.chip button:hover { background: var(--brand); color: #fff; }
.chips__entry {
  flex: 1; min-width: 140px; border: 0; outline: none;
  background: transparent; color: var(--text); font-size: .92rem; padding: .3rem 0;
}
.switch-row {
  display: flex; align-items: center; gap: .6rem;
  font-weight: 600; font-size: .92rem; cursor: pointer; margin: .6rem 0 0;
}
.switch-row input { width: 18px; height: 18px; accent-color: var(--brand); }
.success {
  background: color-mix(in srgb, #16a34a 12%, transparent); color: #16a34a;
  border-radius: 10px; padding: .6rem .9rem; font-size: .88rem; margin-bottom: 1rem;
  font-weight: 600;
}

/* ---- Scrollbars stylées (PC uniquement — masquées sur mobile) ---- */
@media (min-width: 768px) and (pointer: fine) {
  .content, .agence__main {
    scrollbar-width: thin;                              /* Firefox */
    scrollbar-color: color-mix(in srgb, var(--muted) 40%, transparent) transparent;
  }
  .content::-webkit-scrollbar,
  .agence__main::-webkit-scrollbar { display: block; width: 8px; }
  .content::-webkit-scrollbar-track,
  .agence__main::-webkit-scrollbar-track { background: transparent; }
  .content::-webkit-scrollbar-thumb,
  .agence__main::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--muted) 40%, transparent);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
  }
  .content::-webkit-scrollbar-thumb:hover,
  .agence__main::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--brand) 60%, transparent);
    background-clip: padding-box;
  }
  /* Espace livreur : app mobile, jamais d'ascenseur visible. */
  .content--no-scrollbar { scrollbar-width: none; }
  .content--no-scrollbar::-webkit-scrollbar { display: none; width: 0; }
}

/* Mobile : la sidebar devient une barre horizontale pleine largeur
   (logo + cloche en haut, puis les options en onglets défilables). */
@media (max-width: 640px) {
  .agence { flex-direction: column; }
  .side {
    width: 100%; flex-direction: column; gap: 0;
    border-right: 0; border-bottom: 1px solid var(--border);
    padding: 0;
  }
  .side__brand {
    padding: .5rem .9rem;
    padding-top: calc(.5rem + var(--safe-t));
    border-bottom: 1px solid var(--border);
  }
  .side__brand img { width: 30px; height: 30px; }

  .side__nav {
    flex: none; flex-direction: row; gap: 0;
    overflow-x: auto; overscroll-behavior-x: contain;
    scrollbar-width: none; padding: 0 .25rem;
  }
  .side__nav::-webkit-scrollbar { display: none; }
  .side__item {
    position: relative; flex: none; flex-direction: column; gap: 2px;
    min-width: 66px; padding: .5rem .55rem; border-radius: 12px;
    font-size: .63rem; text-align: center;
  }
  .side__item.is-active { background: transparent; box-shadow: inset 0 -2px 0 var(--brand); border-radius: 0; }
  .side__item--danger { margin-top: 0; }
  /* Compteur en pastille sur l'icône */
  .side__count {
    position: absolute; top: 3px; right: 12px; margin: 0;
    min-width: 15px; height: 15px; padding: 0 3px;
    font-size: .58rem; line-height: 15px;
  }
  .agence__main { padding: 1rem .9rem calc(1rem + var(--safe-b)); }
}

/* ---- Suivi public : carte, timeline, partage ---- */
.map-wrap {
  position: relative; height: 240px; border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow);
  margin: .2rem 0 .4rem;
}
.map { position: absolute; inset: 0; }
.map__fallback {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: .5rem; text-align: center;
  padding: 1rem; color: var(--muted); background: var(--surface);
}
.map__fallback .ic { width: 34px; height: 34px; color: var(--brand); opacity: .5; }
.map__fallback p { margin: 0; font-size: .86rem; }
.map__meta {
  display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap;
  font-size: .82rem; font-weight: 600; color: var(--brand); margin: 0 0 .8rem;
}
.map__meta .muted { font-weight: 500; }
.leaflet-container { font: inherit; }

.timeline { list-style: none; margin: .3rem 0 .9rem; padding: 0; display: flex; gap: .2rem; }
.timeline li {
  flex: 1; font-size: .6rem; color: var(--muted); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 4px; line-height: 1.2;
}
.timeline li span {
  width: 100%; height: 4px; border-radius: 2px; background: var(--border);
}
.timeline li.is-done { color: var(--brand); font-weight: 700; }
.timeline li.is-done span { background: var(--brand); }

.driver-card { display: flex; align-items: center; gap: .7rem; padding: .7rem .8rem; }
.gps-card { display: flex; align-items: center; gap: .7rem; padding: .7rem .8rem; margin-bottom: .8rem; }
.gps-card small { color: var(--muted); font-size: .76rem; }

.share-card p { margin-bottom: .5rem; }
.share-row {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .5rem 0; border-top: 1px solid var(--border); flex-wrap: wrap;
}
.share-row b { display: block; font-size: .82rem; color: var(--text); text-transform: none; letter-spacing: 0; }
.share-row small { color: var(--muted); font-size: .74rem; }
.share-actions { display: flex; gap: .35rem; }
.qr-box--center { margin: 0 auto; }

/* ---- Profil ---- */
.profile { text-align: center; display: flex; flex-direction: column; align-items: center; gap: .5rem; }
/* Formules de certification */
.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; }
.tier {
  position: relative; cursor: pointer;
  background: var(--surface); border: 2px solid var(--border);
  border-radius: var(--radius); padding: .8rem .9rem;
  display: flex; flex-direction: column; gap: .15rem;
  transition: border-color .15s, background .15s;
}
.tier input { position: absolute; opacity: 0; pointer-events: none; }
.tier:has(input:checked) {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 7%, var(--surface));
}
.tier b { font-size: 1rem; }
.tier__price { color: var(--brand); font-weight: 800; font-size: 1.15rem; }
.tier ul { margin: .4rem 0 0; padding-left: 1rem; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.badge--pro { background: color-mix(in srgb, var(--brand) 18%, transparent); color: var(--brand); }
.badge--promax { background: color-mix(in srgb, #f59e0b 25%, transparent); color: #92400e; }

.verif-check {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%; vertical-align: 3px;
  background: #16a34a; color: #fff; font-size: .7rem; margin-left: .25rem;
}
.profile__avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 84px; height: 84px; border-radius: 50%;
  background: color-mix(in srgb, var(--brand) 14%, transparent);
  color: var(--brand); font-size: 2.2rem; font-weight: 800;
}
.profile__name { margin: .9rem 0 .1rem; font-size: 1.35rem; }
.profile__phone { color: var(--muted); margin: 0 0 1.8rem; }
.btn--danger { background: #dc2626; color: #fff; box-shadow: 0 6px 18px rgba(220,38,38,.3); }
.btn--danger:hover { background: #b91c1c; }

/* ---- Notifications : cloche + badge + modal ---- */
.notif-btn {
  position: relative; border: 0; background: transparent; cursor: pointer;
  color: inherit; padding: .35rem; border-radius: 50%; flex: none;
  display: inline-flex;
}
.notif-btn:hover { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.app-bar .notif-btn { color: var(--brand); }
.side__brand .notif-btn { color: var(--brand); margin-left: auto; }
.notif-badge {
  position: absolute; top: -2px; right: -2px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: #dc2626; color: #fff;
  font-size: .62rem; font-weight: 800; line-height: 16px; text-align: center;
}

.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }   /* sinon display:flex écrase l'attribut hidden */
.modal__overlay { position: absolute; inset: 0; background: rgba(2, 6, 23, .55); }
.modal__sheet {
  position: relative; width: min(92vw, 420px); max-height: 78dvh;
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
  animation: pop .25s cubic-bezier(.2, 1.3, .4, 1) both;
}
.modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1rem .6rem; border-bottom: 1px solid var(--border);
}
.modal__head h2 { margin: 0; font-size: 1.05rem; display: flex; align-items: center; gap: .45rem; color: var(--brand); }
.modal__close {
  border: 0; background: transparent; color: var(--muted);
  font-size: 1.5rem; line-height: 1; cursor: pointer; padding: .2rem .5rem; border-radius: 8px;
}
.modal__close:hover { background: color-mix(in srgb, var(--muted) 12%, transparent); }
.notif-list { list-style: none; margin: 0; padding: .4rem 0; overflow-y: auto; scrollbar-width: thin; }
.notif-list li {
  display: flex; flex-direction: column; gap: 2px;
  padding: .6rem 1rem; border-bottom: 1px solid var(--border);
}
.notif-list li:last-child { border-bottom: 0; }
.notif-list li.is-unread { background: color-mix(in srgb, var(--brand) 6%, transparent); }
.notif-list li.is-unread::before { content: '●'; color: var(--brand); font-size: .5rem; }
.notif-list a { color: var(--text); text-decoration: none; font-size: .9rem; }
.notif-list a:hover { color: var(--brand); }
.notif-list span { font-size: .9rem; }
.notif-list small { color: var(--muted); font-size: .72rem; }
.notif-empty { color: var(--muted); text-align: center; padding: 1.6rem 1rem; margin: 0; }

/* ---- Splash ---- */
.splash {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem;
  background: linear-gradient(160deg, #1e40af, #2563eb 60%, #3b82f6); color: #fff;
}
/* Éléments invisibles tant que le logo n'est pas chargé (.is-ready lance tout) */
.splash__logo { width: 96px; height: 96px; border-radius: 24px; opacity: 0; }
.splash__name { font-size: 2rem; font-weight: 800; letter-spacing: .18em; opacity: 0; }
.splash__tag { font-size: .95rem; opacity: 0; }
.splash__bar { width: 120px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.25); margin-top: 1.6rem; overflow: hidden; }
.splash__bar i { display: block; height: 100%; width: 0; background: #fff; }
.splash.is-ready .splash__logo { animation: pop .9s cubic-bezier(.2,1.4,.4,1) both; }
.splash.is-ready .splash__name { animation: rise .7s .45s both; }
.splash.is-ready .splash__tag { animation: rise .7s .7s both; opacity: .85; }
.splash.is-ready .splash__bar i { animation: load 2s .3s ease both; }
@keyframes pop  { from { opacity: 0; transform: scale(.5); } to { opacity: 1; transform: scale(1); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes load { to { width: 100%; } }

/* ---- Onboarding ---- */
.onboard {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: .4rem; padding: .5rem;
}
.onboard__art {
  width: 110px; height: 110px; border-radius: 32px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--brand); animation: pop .7s both;
}
.onboard__art .ic { width: 54px; height: 54px; }
.onboard h1 { font-size: 1.45rem; margin: .9rem 0 .2rem; animation: rise .6s .15s both; }
.onboard p { color: var(--muted); max-width: 36ch; line-height: 1.55; animation: rise .6s .3s both; }
.dots { display: flex; gap: 6px; margin: 1.2rem 0; }
.dots i { width: 8px; height: 8px; border-radius: 4px; background: var(--border); transition: all .3s; }
.dots i.on { background: var(--brand); width: 22px; }
.onboard__actions { display: flex; align-items: center; gap: 1.2rem; }
.link { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .9rem; }

/* ---- Auth (connexion / inscription) ---- */
.auth {
  display: flex; flex-direction: column; justify-content: center;
  width: 100%; max-width: 400px; margin: 0 auto; padding: .5rem;
}
.auth__head { display: flex; align-items: center; justify-content: center; gap: .6rem; margin-bottom: 1rem; }
.auth__logo { width: 42px; height: 42px; border-radius: 12px; flex: none; }
.auth h1 { font-size: 1.25rem; margin: 0; }
.field { margin-bottom: .75rem; }
.field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .35rem; color: var(--muted); }
.input {
  width: 100%; padding: .7rem 1rem; border-radius: 12px;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 1rem; outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--brand); }
.auth .btn { width: 100%; margin-top: .4rem; }
.auth__alt { text-align: center; margin-top: 1.1rem; font-size: .92rem; color: var(--muted); }
.auth__alt a { color: var(--brand); font-weight: 700; text-decoration: none; }
.error {
  background: color-mix(in srgb, #dc2626 10%, transparent); color: #dc2626;
  border-radius: 10px; padding: .6rem .9rem; font-size: .88rem; margin-bottom: 1rem;
}
