/* Doublage v2 — feuille de style
   Direction : « on calme le décor, la donnée mène ».
   Profondeur unique (surface + filet 1px + 1 ombre douce). Couleur = sens.
   Light + dark (prefers-color-scheme). Accents dérivés en color-mix. */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f5f7fa;
  --ink: #0f172a;
  --ink-2: #475467;
  --muted: #98a2b3;
  --line: rgba(15, 23, 42, .09);
  --line-strong: rgba(15, 23, 42, .14);

  /* BETA : l'accent bleu est remplacé par du rouge pour distinguer la version test. */
  --blue: #dc2626;
  --navy: #991b1b;
  --green: #12b76a;
  --amber: #d98a0b;
  --danger: #d92d20;

  --shadow-card: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 26px rgba(16, 24, 40, .07);
  --shadow-btn: 0 1px 2px rgba(16, 24, 40, .08), 0 8px 18px rgba(220, 38, 38, .22);

  --radius-card: 20px;
  --radius-ctl: 14px;
  --radius-chip: 10px;
  --radius-badge: 10px;

  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --title-font: "SF Pro Display", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --skeleton: rgba(15, 23, 42, .07);
  --skeleton-shine: rgba(15, 23, 42, .12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0e16;
    --surface: #141a24;
    --surface-2: #1b2230;
    --ink: #f1f5f9;
    --ink-2: #aab4c4;
    --muted: #6b7686;
    --line: rgba(255, 255, 255, .10);
    --line-strong: rgba(255, 255, 255, .17);

    --blue: #f87171;          /* BETA : rouge éclairci pour rester lisible sur fond sombre */
    --navy: #fca5a5;          /* BETA : second accent rouge clair (cartes paires) */
    --green: #34d399;
    --amber: #f0b449;
    --danger: #f97066;

    /* sur fond sombre on s'appuie sur les filets, pas les ombres */
    --shadow-card: 0 0 0 1px rgba(255, 255, 255, .04), 0 8px 22px rgba(0, 0, 0, .45);
    --shadow-btn: 0 8px 20px rgba(0, 0, 0, .5);
    --skeleton: rgba(255, 255, 255, .06);
    --skeleton-shine: rgba(255, 255, 255, .12);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  min-height: 100%;
  background: var(--bg);
  color-scheme: light dark;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.42 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
a,
input {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .14s var(--ease), box-shadow .14s var(--ease),
    background-color .14s var(--ease), opacity .14s var(--ease);
}

button:active,
a:active {
  transform: scale(.97);
}

button:disabled {
  cursor: wait;
  opacity: .6;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* Icônes (SVG inline) dans les boutons / champs */
.ico {
  width: 1.1em;
  height: 1.1em;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Coque ---------- */

.app-shell {
  width: min(100%, 480px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

.brand-header {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.brand-logo-img {
  display: block;
  width: min(232px, 64vw);
  max-width: 100%;
  height: auto;
  /* BETA : le logo PNG est bleu — on bascule sa teinte vers le rouge. */
  filter: hue-rotate(150deg) saturate(1.25);
}

@media (prefers-color-scheme: dark) {
  /* le logo bleu/marine sur fond clair : on l'éclaircit légèrement en sombre */
  .brand-logo-img { filter: hue-rotate(150deg) saturate(1.25) brightness(1.18); }
}

/* BETA : bandeau d'avertissement « version test », visible sur chaque écran. */
.beta-banner {
  margin: 0 0 12px;
  padding: 7px 14px;
  border-radius: var(--radius-chip);
  background: color-mix(in srgb, var(--blue) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--blue) 38%, transparent);
  color: var(--blue);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .02em;
  text-align: center;
  text-transform: uppercase;
}

.screen {
  animation: screen-in .26s var(--ease) both;
}

.screen-kicker,
h1,
h2,
p {
  margin: 0;
}

.screen-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ---------- Titres (caractère) ---------- */

.hero-copy h1,
.analysis-panel h1,
.results-top h1 {
  margin-top: 4px;
  font-family: var(--title-font);
  font-size: 34px;
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -.03em;
  text-wrap: balance;
}

.hero-copy p,
.analysis-panel p,
.ticket-sent-card p,
.status-line {
  color: var(--ink-2);
  font-size: 15px;
  text-wrap: pretty;
}

.hero-copy { margin: 10px 0 14px; }

/* ---------- Capture ---------- */

.capture-frame {
  position: relative;
  min-height: 312px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, .14);
  border-radius: 24px;
  background: #0f1629;
  box-shadow: var(--shadow-card);
}

.capture-frame.has-photo { border-color: color-mix(in srgb, var(--blue) 32%, transparent); }

.capture-frame img {
  width: 100%;
  height: 312px;
  display: block;
  object-fit: cover;
  animation: fade-in .26s var(--ease) both;
}

.capture-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: rgba(255, 255, 255, .58);
}

.capture-placeholder p {
  color: rgba(255, 255, 255, .56);
  font-size: 14px;
  font-weight: 700;
}

.camera-icon {
  position: relative;
  width: 66px;
  height: 52px;
  border: 2px solid rgba(255, 255, 255, .34);
  border-radius: 16px;
}

.camera-icon::before {
  content: "";
  position: absolute;
  left: 13px;
  top: -8px;
  width: 22px;
  height: 9px;
  border-radius: 7px 7px 0 0;
  background: rgba(255, 255, 255, .34);
}

.camera-icon span {
  position: absolute;
  inset: 12px 20px;
  border: 2px solid rgba(255, 255, 255, .42);
  border-radius: 50%;
}

.capture-actions {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

/* ---------- Boutons ---------- */

.btn-main,
.btn-ghost,
.btn-maps {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 56px;
  width: 100%;
  border-radius: var(--radius-ctl);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.01em;
}

.btn-main,
.btn-maps {
  background: var(--blue);
  color: #fff;
  box-shadow: var(--shadow-btn);
}

.btn-main:is(:hover, :focus-visible),
.btn-maps:is(:hover, :focus-visible) {
  background: color-mix(in srgb, var(--blue) 86%, #000);
}

.btn-ghost {
  background: var(--surface);
  color: var(--blue);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-card);
}

.btn-ghost:is(:hover, :focus-visible) {
  background: color-mix(in srgb, var(--blue) 10%, var(--surface));
}

.btn-maps { margin-top: 14px; }

/* ---------- Analyse (resserré) + squelette ---------- */

.ticket-sent-card {
  display: grid;
  grid-template-columns: 56px 1fr 26px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}

.ticket-sent-card p {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.ticket-sent-card strong {
  display: block;
  margin-top: 1px;
  color: var(--ink);
  font-size: 16px;
}

.ticket-thumb {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: var(--surface-2) center/cover no-repeat;
  border: 1px solid var(--line);
}

.sent-check {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--green) 16%, transparent);
  color: var(--green);
  font-weight: 800;
  font-size: 14px;
}

.analysis-panel {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 20px 18px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  text-align: center;
}

.analysis-panel h1 { font-size: 24px; color: var(--ink); }

.search-loader {
  width: 44px;
  height: 44px;
  margin-bottom: 4px;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--blue) 18%, transparent);
  border-top-color: var(--blue);
  animation: spin .7s linear infinite;
}

/* En-tête slim de l'écran d'analyse */
.analyse-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 2px 4px;
}

.analyse-head .search-loader {
  width: 30px;
  height: 30px;
  margin: 0;
}

.analyse-head strong {
  display: block;
  margin-top: 1px;
  color: var(--ink);
  font-size: 17px;
}

/* Squelette : cartes fantômes qui « se préparent » pendant l'analyse */
.resultats-skeleton {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.skeleton-card {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border-radius: var(--radius-card);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}

.skeleton-card::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--skeleton-shine), transparent);
  animation: shimmer 1.25s var(--ease) infinite;
}

.skeleton-line {
  height: 12px;
  border-radius: 7px;
  background: var(--skeleton);
}

.skeleton-line + .skeleton-line { margin-top: 10px; }
.skeleton-line.lg { height: 22px; width: 70%; }
.skeleton-line.sm { width: 40%; }
.skeleton-line.pill { width: 54px; height: 30px; border-radius: var(--radius-badge); }

.skeleton-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.analysis-steps {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 14px 0 0;
  list-style: none;
}

.analysis-steps li {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 700;
  font-size: 15px;
}

.analysis-steps li::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
}

.analysis-steps li.done { color: var(--ink-2); }

.analysis-steps li.done::before {
  content: "✓";
  display: grid;
  place-items: center;
  border-color: var(--green);
  background: color-mix(in srgb, var(--green) 14%, transparent);
  color: var(--green);
  font-size: 11px;
}

.analysis-steps li.active {
  color: var(--blue);
  border-color: color-mix(in srgb, var(--blue) 26%, transparent);
  background: color-mix(in srgb, var(--blue) 10%, var(--surface));
}

.status-line {
  min-height: 22px;
  margin: 14px 2px 0;
  font-weight: 700;
}

.status-error { color: var(--danger); }

.reading-actions {
  display: grid;
  margin-top: 12px;
}

.btn-retry { min-height: 52px; }

/* État vide « rien lu » (résultats) */
.empty-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--amber) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent);
  color: color-mix(in srgb, var(--amber) 70%, var(--ink));
  font-size: 14px;
  font-weight: 700;
}

/* ---------- Résultats ---------- */

.results-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin: 6px 0 14px;
}

.btn-small {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: auto;
  min-width: 84px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--blue);
  border: 1px solid var(--line-strong);
  font-size: 15px;
  font-weight: 800;
  box-shadow: var(--shadow-card);
}

.btn-small:is(:hover, :focus-visible) {
  background: color-mix(in srgb, var(--blue) 10%, var(--surface));
}

.resultats {
  display: grid;
  gap: 12px;
}

/* Accent par arrêt : la couleur sert à NE PAS confondre les 2 livraisons.
   Soft/press dérivés en color-mix → s'adaptent tout seuls au mode sombre. */
.carte-arret-1, .carte-arret-3, .carte-arret-5 { --accent: var(--blue); }
.carte-arret-2, .carte-arret-4, .carte-arret-6 { --accent: var(--navy); }

.carte {
  position: relative;
  container-type: inline-size;
  overflow: hidden;
  padding: 14px 16px 16px;
  border-radius: var(--radius-card);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  animation: result-in .28s var(--ease) both;
  transition: box-shadow .18s var(--ease);
}

.carte:nth-child(2) { animation-delay: .06s; }
.carte:nth-child(3) { animation-delay: .12s; }

/* :has() — la carte en cours d'édition se distingue, sans JS */
.carte:has(input:focus) {
  box-shadow: var(--shadow-card), 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent);
}

/* arrêt livré : on grise et on rétrécit l'importance */
.carte.is-done { opacity: .58; }
.carte.is-done .ligne-adresse { text-decoration: line-through; text-decoration-thickness: 2px; }

.carte::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--accent);
}

.carte-tete {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.arret-badge {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: var(--radius-badge);
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.arret-titre {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.arret-code {
  width: 84px;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: var(--radius-chip);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  outline: 0;
}

.ligne-adresse,
.ligne-complement,
.ligne-telephone {
  display: block;
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.ligne-adresse::placeholder,
.ligne-complement::placeholder,
.ligne-telephone::placeholder {
  color: var(--muted);
  font-weight: 600;
}

.ligne-adresse {
  font-size: 23px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -.018em;
}

.ligne-complement {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
}

.ligne-telephone {
  margin-top: 12px;
  color: var(--accent);
  font-size: 21px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}

/* Champ à vérifier (faible confiance) — préparé pour la Phase 3 */
.champ-doute {
  position: relative;
  border-radius: 8px;
  box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--amber) 80%, transparent);
}

.carte-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.btn-appeler,
.btn-plans {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: var(--radius-ctl);
  border: 1px solid transparent;
  text-decoration: none;
  font-size: 15px;
  font-weight: 800;
  transition: transform .14s var(--ease), background-color .14s var(--ease),
    box-shadow .14s var(--ease), opacity .14s var(--ease);
}

.btn-appeler {
  min-width: 120px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-btn);
}

.btn-appeler:is(:hover, :focus-visible) {
  background: color-mix(in srgb, var(--accent) 86%, #000);
}

.btn-plans {
  margin-left: auto;
  padding: 0 18px;
  background: var(--surface);
  color: var(--accent);
  border-color: var(--line-strong);
}

.btn-plans:is(:hover, :focus-visible) {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.carte-actions a.disabled {
  opacity: .4;
  pointer-events: none;
}

/* Bouton « marquer livré » discret, en haut à droite de la carte */
.btn-done {
  margin-left: auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
}

.btn-done .ico {
  width: 22px;
  height: 22px;
  stroke-width: 2.4;
}

.stats-ligne {
  margin-top: 14px;
  text-align: center;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 700;
}

.carte.is-done .btn-done {
  background: color-mix(in srgb, var(--green) 16%, transparent);
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 30%, transparent);
}

/* Carte étroite : actions empilées (container query) */
@container (max-width: 300px) {
  .carte-actions { flex-direction: column; align-items: stretch; }
  .btn-appeler, .btn-plans { width: 100%; margin-left: 0; }
}

/* ---------- Responsive ---------- */

@media (max-width: 360px) {
  .hero-copy h1,
  .results-top h1 { font-size: 30px; }

  .capture-frame,
  .capture-frame img { min-height: 270px; height: 270px; }
}

/* ---------- Mouvement ---------- */

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes result-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes shimmer { to { transform: translateX(100%); } }

/* Micro-interaction de succès (check qui « pop ») */
@keyframes check-pop {
  0% { transform: scale(.4); opacity: 0; }
  60% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); }
}

.success-burst {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 50;
}

.success-burst svg {
  width: 88px;
  height: 88px;
  color: var(--green);
  animation: check-pop .42s var(--ease) both;
  filter: drop-shadow(0 8px 22px color-mix(in srgb, var(--green) 45%, transparent));
}

/* View Transitions : cross-fade doux entre écrans */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: .26s;
  animation-timing-function: var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }

  .search-loader,
  .skeleton-card::after {
    animation-duration: 1s !important;
    animation-iteration-count: infinite !important;
  }
}

/* ---------- Phase 2 : récents, outils résultats, dictée ---------- */

.lien-recents {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  margin-top: 12px;
  border-radius: var(--radius-ctl);
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 700;
}

.lien-recents:is(:hover, :focus-visible) { background: var(--surface); }

.results-tools {
  display: flex;
  gap: 8px;
  margin: 0 0 12px;
  flex-wrap: wrap;
}

.btn-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 800;
}

.btn-chip:is(:hover, :focus-visible) {
  background: color-mix(in srgb, var(--blue) 8%, var(--surface));
  color: var(--blue);
}

.btn-chip.is-listening {
  background: color-mix(in srgb, var(--danger) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--danger) 40%, transparent);
  color: var(--danger);
  animation: pulse 1.1s var(--ease) infinite;
}

@keyframes pulse { 50% { opacity: .55; } }

/* Vignette(s) de vérification (beta) : photo du ticket gardée sur l'écran résultats. */
.vignettes-ticket {
  margin: 0 0 14px;
}

.vignettes-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 700;
}
.vignettes-label .ico { width: 15px; height: 15px; }

.vignettes-liste {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.vignette {
  width: 64px;
  height: 64px;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid color-mix(in srgb, var(--blue) 55%, transparent);
  background: var(--surface-2);
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}
.vignette img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.vignette:is(:hover, :focus-visible) {
  border-color: var(--blue);
}

/* Plein écran (lightbox) — fond sombre, image entière, zoomable au pinch. */
.zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, .92);
  animation: zoom-in .18s var(--ease);
}
.zoom-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  touch-action: pinch-zoom;
}
.zoom-fermer {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 14px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: #fff;
}
.zoom-fermer .ico { width: 24px; height: 24px; }
body.zoom-ouvert { overflow: hidden; }

@keyframes zoom-in { from { opacity: 0; } to { opacity: 1; } }

.stats-detail {
  margin: 0 2px 12px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 700;
}

.historique-liste { display: grid; gap: 10px; }

.historique-entree {
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}

.historique-date {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.historique-arret {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 0;
}

.historique-arret + .historique-arret { border-top: 1px solid var(--line); }
.historique-adresse { flex: 1; font-weight: 700; color: var(--ink); }

.historique-tel {
  color: var(--blue);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}

.historique-vide { color: var(--muted); font-weight: 700; padding: 8px 2px; }

/* ---------- Phase 3 : viewfinder caméra ---------- */

.cam-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.cam-cadre {
  position: absolute;
  inset: 16px;
  border: 2px solid rgba(255, 255, 255, .55);
  border-radius: 16px;
  pointer-events: none;
}

.cam-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  text-align: center;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .7);
  pointer-events: none;
}

.capture-frame.cam-active {
  border-color: color-mix(in srgb, var(--blue) 40%, transparent);
}

.capture-frame.cam-lock {
  border-color: color-mix(in srgb, var(--green) 55%, transparent);
}

.capture-frame.cam-lock .cam-cadre {
  border-color: var(--green);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--green) 45%, transparent);
}

/* Écran d'accès par code */
.code-form { display: flex; flex-direction: column; gap: 12px; }
.champ-code {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-ctl);
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .14em;
  text-align: center;
  text-transform: uppercase;
}
.champ-code:focus-visible { outline: none; border-color: var(--blue); }

.btn-gestion {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-2);
}
.brand-header { position: relative; }

/* Page Gestion */
.livreur-form { display: flex; gap: 8px; margin: 4px 0 14px; }
.champ-nom { flex: 1; padding: 12px; border-radius: var(--radius-ctl); border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 16px; }
.livreur-form .btn-main { width: auto; padding: 0 16px; }
.nouveau-code { margin: 0 0 14px; padding: 12px 14px; border-radius: var(--radius-ctl); background: color-mix(in srgb, var(--green) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--green) 35%, transparent); font-size: 14px; }
.code-affiche { font-weight: 800; font-size: 18px; letter-spacing: .12em; }
.liste-livreurs { display: flex; flex-direction: column; gap: 8px; }
.livreur-ligne { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius-ctl); background: var(--surface); border: 1px solid var(--line); }
.livreur-ligne.revoque { opacity: .55; }
.livreur-nom { font-weight: 700; flex: 1; }
.livreur-etat { font-size: 12px; color: var(--ink-2); }
.btn-revoquer { padding: 6px 12px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); color: var(--danger); font-weight: 700; }
