/* GOA Paris - design system
 * Palette : noir chaud, or, crème. Typographies : Bodoni Moda (titres), Jost (texte).
 */
:root {
  --bg: #0d0c0a;
  --surface: rgba(24, 21, 16, 0.92);
  --surface-2: #1e1b14;
  --fg: #efe9dc;
  --muted: #a8a190;
  --gold: #c9a45c;
  --gold-hi: #e8cd8a;
  --gold-ink: #0d0c0a;
  --line: rgba(201, 164, 92, 0.18);
  --danger: #e08a7a;
  --ok: #8fbf8a;
  --radius: 20px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .55);
  --font-display: "Bodoni Moda", "Didot", "Times New Roman", serif;
  --font-body: "Jost", "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

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

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Barre haute ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px;
  background: linear-gradient(rgba(13, 12, 10, .96) 55%, rgba(13, 12, 10, 0));
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; justify-self: start; }
.logo {
  height: 42px; width: 42px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--gold);
  box-shadow: 0 0 0 4px rgba(201, 164, 92, .08);
}
.brand-name {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.brand-name em { font-style: normal; color: var(--gold); }
@media (max-width: 480px) {
  .brand-name { display: none; }
  .topbar { grid-template-columns: auto 1fr auto; }
  .mode-switch { justify-self: center; }
}

.mode-switch {
  display: flex;
  background: rgba(24, 21, 16, .85);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  backdrop-filter: blur(10px);
}
.mode-switch button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  letter-spacing: .04em;
  font-size: 14px;
  transition: background .25s, color .25s;
}
.mode-switch button.active {
  background: linear-gradient(135deg, var(--gold-hi), var(--gold));
  color: var(--gold-ink);
  font-weight: 600;
}

.user-name {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 20px);
  right: 64px;
  font-size: 13px;
  color: var(--gold-hi);
  max-width: 40vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-name[hidden] { display: none !important; }

.icon-btn {
  justify-self: end;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(24, 21, 16, .85);
  color: var(--gold);
  display: grid; place-items: center;
  cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- Vues ---------- */
main { position: relative; height: 100%; }
.view { position: absolute; inset: 0; height: 100%; overflow-x: hidden; }

.map { position: absolute; inset: 0; z-index: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

h1, h2 {
  font-family: var(--font-display);
  font-weight: 500;
  margin: 0 0 10px;
  letter-spacing: .01em;
  line-height: 1.15;
}
h1 { font-size: 30px; }
h2 { font-size: 20px; }
.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold);
}
.muted { color: var(--muted); font-size: 14px; }
.fine { margin: 10px 0 0; text-align: center; color: var(--muted); font-size: 12px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Connexion ---------- */
.auth-view {
  overflow-y: auto;
  padding: 0 0 32px;
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(201, 164, 92, .18), transparent 60%),
    var(--bg);
}
.auth-hero { position: relative; padding-top: 88px; }
.hero-art {
  width: 100%;
  height: auto;
  max-height: 46vh;
  object-fit: cover;
  opacity: .95;
  mask-image: linear-gradient(#000 70%, transparent);
  -webkit-mask-image: linear-gradient(#000 70%, transparent);
}
.hero-copy { padding: 0 20px; margin-top: -40px; position: relative; }
.hero-copy h1 { font-size: 40px; }
.hero-copy em { color: var(--gold); font-style: italic; }

.auth-card { margin: 18px 16px 0; max-width: 460px; }
@media (min-width: 720px) { .auth-card { margin-left: auto; margin-right: auto; } }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border-radius: 999px; padding: 4px; margin-bottom: 16px; }
.auth-tabs button { border: 0; background: transparent; color: var(--muted); padding: 9px; border-radius: 999px; cursor: pointer; font-size: 14px; }
.auth-tabs button.active { background: linear-gradient(135deg, var(--gold-hi), var(--gold)); color: var(--gold-ink); font-weight: 600; }
.type-choice { border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; display: flex; gap: 18px; margin: 0; }
.type-choice legend { font-size: 12px; color: var(--gold); text-transform: uppercase; letter-spacing: .12em; padding: 0 6px; }
.type-choice label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.type-choice input { accent-color: var(--gold); }
.note { font-size: 12px; margin: 0; }

/* ---------- Champs ---------- */
.field { display: block; position: relative; }
.field > span {
  display: block;
  font-size: 12px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: .14em;
  margin-bottom: 6px;
}
.input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  transition: border-color .2s, box-shadow .2s;
}
.input-wrap:focus-within { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201, 164, 92, .12); }
.input-wrap svg { color: var(--gold); flex-shrink: 0; }
.input-wrap input,
.field input {
  width: 100%;
  background: transparent;
  border: 0;
  padding: 14px 0;
  outline: none;
}
.input-wrap.code input { text-align: center; letter-spacing: .5em; font-size: 22px; }

/* Croix d'effacement des adresses */
.input-wrap.clearable { padding-right: 6px; }
.clear-btn {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--gold);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background .2s, color .2s;
}
.clear-btn:hover, .clear-btn:focus-visible { background: var(--gold); color: var(--gold-ink); outline: none; }
.clear-btn[hidden] { display: none !important; }

/* Bouton date et heure */
.when-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  color: var(--fg);
  cursor: pointer;
  text-align: left;
  transition: border-color .2s;
}
.when-btn:hover, .when-btn:focus-visible { border-color: var(--gold); outline: none; }
.when-btn svg { width: 20px; height: 20px; color: var(--gold); flex-shrink: 0; }
#when-hint { display: block; margin-top: 6px; font-size: 12px; }

/* Sélecteur date et heure (calendrier + horloge) */
.picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(5, 4, 3, .6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 16px;
  animation: fade .2s ease;
}
.picker-backdrop[hidden] { display: none !important; }
.picker {
  width: min(92vw, 340px);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 16px;
  box-shadow: var(--shadow);
  animation: rise .25s ease;
}
.picker-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border-radius: 999px; padding: 4px; margin-bottom: 14px; }
.picker-tabs button {
  border: 0; background: transparent; color: var(--muted); padding: 8px; border-radius: 999px; cursor: pointer; font-size: 14px;
}
.picker-tabs button.active { background: linear-gradient(135deg, var(--gold-hi), var(--gold)); color: var(--gold-ink); font-weight: 600; }
.picker-view[hidden] { display: none !important; }

/* Calendrier */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head strong { font-family: var(--font-display); font-weight: 500; font-size: 18px; text-transform: capitalize; }
.cal-nav {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  color: var(--gold); font-size: 20px; line-height: 1; cursor: pointer;
}
.cal-nav:hover { background: var(--gold); color: var(--gold-ink); }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 11px; letter-spacing: .1em; color: var(--muted); margin-bottom: 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day {
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--fg);
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.cal-day:hover:not(:disabled) { background: rgba(201, 164, 92, .15); }
.cal-day.today { box-shadow: inset 0 0 0 1px var(--gold); }
.cal-day.selected { background: linear-gradient(135deg, var(--gold-hi), var(--gold)); color: var(--gold-ink); font-weight: 600; }
.cal-day:disabled { opacity: .3; cursor: not-allowed; }
.cal-day.blank { visibility: hidden; }

/* Horloge */
.clock-readout { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 8px; }
.clk-part {
  font-family: var(--font-display); font-size: 40px; border: 0; background: transparent; color: var(--muted);
  padding: 4px 10px; border-radius: 14px; cursor: pointer;
}
.clk-part.active { color: var(--gold-hi); background: rgba(201, 164, 92, .12); }
.clock-readout > span { font-family: var(--font-display); font-size: 40px; color: var(--muted); }
.period { display: flex; flex-direction: column; gap: 4px; margin-left: 6px; }
.period button {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 8px;
  padding: 3px 8px; font-size: 12px; cursor: pointer;
}
.period button.on { border-color: var(--gold); color: var(--gold-hi); }
.clock { width: 100%; max-width: 260px; height: auto; display: block; margin: 0 auto; }
.clock .face { fill: var(--surface); stroke: var(--line); stroke-width: 2; }
.clock .num { fill: var(--muted); font-size: 14px; text-anchor: middle; dominant-baseline: central; cursor: pointer; font-family: var(--font-body); }
.clock .num:hover { fill: var(--gold-hi); }
.clock .num.sel { fill: var(--gold-ink); }
.clock .sel-bg { fill: url(#clockGold); }
.clock .hand { stroke: var(--gold); stroke-width: 2; stroke-linecap: round; }
.clock .pivot { fill: var(--gold); }
.picker-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }
.picker-foot .btn { width: auto; flex: 1; }

/* Étape 2 : véhicule et réservation, affichée après le bouton OK */
.ok-btn { width: auto; margin-top: 10px; }
.step-ride { margin-top: 4px; }
.step-ride[hidden] { display: none !important; }
#when-edit { margin: 0 0 12px; }

/* Date et heure de la course */
.schedule { margin-top: 12px; }
.schedule .input-wrap input[type="datetime-local"] { color-scheme: dark; cursor: pointer; }
.schedule small { display: block; margin-top: 6px; font-size: 12px; }
.input-wrap select {
  width: 100%;
  background: transparent;
  border: 0;
  padding: 14px 0;
  outline: none;
  color: var(--fg);
  cursor: pointer;
}
.input-wrap select option { background: var(--surface-2); color: var(--fg); }

.suggest {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 6px);
  z-index: 600;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  max-height: 240px;
  overflow-y: auto;
}
.suggest[hidden] { display: none; }
.suggest li {
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
}
.suggest li:hover { background: rgba(201, 164, 92, .1); color: var(--gold-hi); }

/* ---------- Feuille de réservation ---------- */
.sheet {
  position: absolute;
  z-index: 500;
  left: 0; right: 0; bottom: 0;
  margin: 0 auto;
  max-width: 560px;
  max-height: 84vh;
  max-height: 84dvh;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  overflow-y: auto;
  border-radius: 26px 26px 0 0;
  padding: 10px 18px calc(env(safe-area-inset-bottom, 0px) + 18px);
  animation: rise .5s cubic-bezier(.2, .8, .2, 1);
}
@media (min-width: 720px) {
  .sheet { left: 24px; right: auto; bottom: 24px; width: 400px; max-height: calc(100% - 140px); border-radius: var(--radius); }
}
.sheet-handle { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet-title { font-size: 26px; margin-bottom: 14px; }

.route-inputs { display: grid; grid-template-columns: 22px 1fr; gap: 10px; margin-bottom: 16px; }
.route-line { display: flex; flex-direction: column; align-items: center; padding: 22px 0; }
.route-line .ring { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--gold); }
.route-line .bar { flex: 1; width: 2px; background: repeating-linear-gradient(var(--gold) 0 4px, transparent 4px 8px); margin: 4px 0; }
.route-line .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--gold); }
.route-fields { display: grid; gap: 8px; }
.field.compact .input-wrap { padding: 0 14px; }
.field.compact input { font-size: 15px; padding: 12px 0; }
.route-fields .field { display: block; }
.route-fields .input-wrap { background: var(--surface-2); }

/* Photo dans chaque onglet véhicule */
.option img {
  width: 56px;
  height: 38px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 2px;
}
.credit { margin-top: 4px; font-size: 11px; }
.credit a { color: var(--gold); }

/* Options véhicule */
.options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 14px; }
.option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 6px;
  cursor: pointer;
  text-align: center;
  transition: transform .2s, border-color .2s, background .2s;
}
.option svg { width: 44px; height: 24px; stroke-width: 1.4; fill: rgba(201, 164, 92, .12); color: var(--gold); }
.option strong { font-size: 14px; font-weight: 600; }
.option small { color: var(--muted); font-size: 11px; }
.option:hover { transform: translateY(-2px); }
/* Loupe : aperçu agrandi au survol ou au focus clavier */
.option { position: relative; }
.option::after {
  content: "";
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  width: 200px;
  height: 140px;
  transform: translateX(-50%) scale(.85);
  transform-origin: bottom center;
  /* Le nom de la catégorie reste lisible par-dessus la photo */
  content: attr(data-label);
  display: flex;
  align-items: flex-end;
  padding: 8px 10px;
  font: 600 13px var(--font-body);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #efe9dc;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .85);
  background: linear-gradient(transparent 45%, rgba(0, 0, 0, .75)), var(--photo) center / cover no-repeat;
  border: 2px solid var(--gold);
  border-radius: 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 20;
}
.option:first-child::after { left: 0; transform: scale(.85); transform-origin: bottom left; }
.option:last-child::after { left: auto; right: 0; transform: scale(.85); transform-origin: bottom right; }
.option:hover::after,
.option:focus-visible::after { opacity: 1; transform: translateX(-50%) scale(1); }
.option:first-child:hover::after,
.option:first-child:focus-visible::after,
.option:last-child:hover::after,
.option:last-child:focus-visible::after { transform: scale(1); }

.option.active { border-color: var(--gold); background: linear-gradient(180deg, rgba(201, 164, 92, .18), rgba(201, 164, 92, .04)); box-shadow: 0 0 0 1px var(--gold) inset; }

.estimate {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(201, 164, 92, .16), rgba(201, 164, 92, .02));
  border: 1px solid var(--line);
  margin-bottom: 12px;
  animation: fade .35s ease;
}
.estimate[hidden] { display: none; }
.estimate .trip { color: var(--muted); font-size: 14px; display: flex; gap: 6px; flex-wrap: wrap; }
.estimate .trip i { font-style: normal; }
.price { font-family: var(--font-display); font-size: 28px; color: var(--gold-hi); }
.rate { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.estimate { flex-wrap: wrap; }
.estimate > div:first-child { flex: 1 1 100%; }

/* ---------- Boutons ---------- */
.btn {
  width: 100%;
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 15px 18px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: .04em;
  cursor: pointer;
  background: transparent;
  color: var(--fg);
  transition: transform .15s, box-shadow .2s, background .2s, opacity .2s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn.primary {
  background: linear-gradient(135deg, var(--gold-hi), var(--gold));
  color: var(--gold-ink);
  font-weight: 600;
  border-color: transparent;
  box-shadow: 0 10px 28px rgba(201, 164, 92, .28);
}
.btn.primary:hover:not(:disabled) { box-shadow: 0 14px 36px rgba(201, 164, 92, .4); }
.btn.ghost { border-color: var(--line); color: var(--muted); margin-top: 8px; }
.btn.small { width: auto; padding: 9px 16px; font-size: 14px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px;
  border-radius: 50%; border: 2px solid var(--gold-ink); border-top-color: transparent; animation: spin .7s linear infinite;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- Statut course ---------- */
.status {
  position: absolute;
  z-index: 500;
  top: 96px;
  left: 16px; right: 16px;
  max-width: 380px;
  margin: 0 auto;
  animation: fade .4s ease;
}
@media (min-width: 720px) { .status { left: auto; right: 24px; margin: 0; } }
.status-line { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; font-weight: 500; }
.pulse {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 0 rgba(201, 164, 92, .6);
  animation: ping 1.6s infinite;
  flex-shrink: 0;
}

/* ---------- Chauffeur ---------- */
.driver-view { overflow-y: auto; padding: 96px 16px 32px; max-width: 640px; margin: 0 auto; }
.driver-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.driver-head h1 { margin: 0; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  position: relative; width: 52px; height: 30px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); transition: background .3s, border-color .3s;
}
.switch .knob {
  position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--muted); transition: transform .3s, background .3s;
}
.switch input:checked + .track { background: linear-gradient(135deg, var(--gold-hi), var(--gold)); border-color: transparent; }
.switch input:checked + .track .knob { transform: translateX(22px); background: var(--gold-ink); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px rgba(201, 164, 92, .25); }
.switch-label { font-size: 14px; color: var(--muted); min-width: 70px; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 10px; }
@media (min-width: 560px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat[data-filter] { cursor: pointer; font: inherit; color: inherit; text-align: left; transition: border-color .2s, transform .15s; }
.stat[data-filter]:hover { transform: translateY(-2px); }
.stat[data-filter].active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.stat { align-items: flex-start; padding: 14px; }
.stat-value { font-size: 26px; }
.stat-label { font-size: 11px; }
.dash-title { margin: 6px 0 12px; }
.earn-card { margin-bottom: 16px; }
/* Barre de période : raccourcis et dates compactes */
.period-bar { display: grid; gap: 8px; margin: 10px 0 6px; }
.period-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.period-chips button {
  width: auto; padding: 5px 12px; border-radius: 999px; font: inherit; font-size: 12.5px;
  background: transparent; color: var(--muted); border: 1px solid var(--line); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.period-chips button:hover { border-color: var(--gold); color: var(--fg); }
.period-chips button.on { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); font-weight: 600; }
.period-range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.period-range label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.period-range input[type="date"] {
  width: 148px; min-height: 36px; padding: 6px 8px; border-radius: 10px;
  background: var(--surface-2); color: var(--fg); border: 1px solid var(--line);
  font: inherit; font-size: 13px; color-scheme: dark;
}
.period-range input[type="date"]:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 164, 92, .15); }
.earn-period-label { margin: 2px 0 10px; font-size: 13px; }
.earn-months-title { margin-top: 18px; }

/* Lien administrateur dédié : pas de création de compte depuis cette page */
body[data-space="admin"] #tab-signup,
body[data-space="admin"] #signup-form { display: none !important; }

/* Compte chauffeur en attente de validation */
.pending-banner { border: 1px solid var(--gold); border-radius: 16px; padding: 14px 16px; margin: 0 0 14px; background: var(--surface-2); }
.pending-banner .eyebrow { margin-bottom: 4px; }
.pending-banner .pending-text { margin: 0 0 8px; font-size: 14px; }
.pending-banner .btn { width: auto; }
#pending-driver-banner { position: absolute; top: 84px; left: 12px; right: 12px; z-index: 450; max-width: 420px; }
@media (min-width: 720px) { #pending-driver-banner { left: auto; right: 24px; top: 96px; } }
#earn-months li { flex-wrap: wrap; }
.range-arrow { color: var(--muted); font-size: 14px; flex: 0 0 auto; }

/* Sélecteur de période des gains : pastilles défilables sur mobile */
.month-chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; margin: 6px -2px 2px; scrollbar-width: none; }
.month-chips::-webkit-scrollbar { display: none; }
.month-chip {
  flex: 0 0 auto; width: auto; padding: 8px 14px; border-radius: 999px; font: inherit; font-size: 13px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, transform .15s;
}
.month-chip:hover { border-color: var(--gold); color: var(--fg); }
.month-chip:active { transform: scale(.97); }
.month-chip.on {
  background: linear-gradient(135deg, var(--gold-hi), var(--gold)); color: var(--gold-ink);
  border-color: transparent; font-weight: 600; box-shadow: 0 6px 18px rgba(201, 164, 92, .25);
}
.earn-period-label { margin: 2px 0 10px; font-size: 13px; }

/* Mois : période à gauche, nombre de courses au centre, montants à droite, sur une seule ligne */
/* Ligne d'un mois : période Du / Au, nombre de courses cliquable, montants */
#earn-months li.month-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; border-bottom: 1px solid var(--line);
}
#earn-months .month-period { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#earn-months .month-period label { display: flex; align-items: center; gap: 4px; }
#earn-months .month-period label span { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
#earn-months .month-period input[type="date"] {
  width: 132px; min-height: 32px; padding: 4px 8px; border-radius: 10px;
  background: var(--surface-2); color: var(--fg); border: 1px solid var(--line); font: inherit; font-size: 13px; color-scheme: dark;
}
#earn-months .month-period input[type="date"]:focus { outline: none; border-color: var(--gold); }
#earn-months .month-count-btn {
  width: auto; padding: 6px 14px; border-radius: 999px; font: inherit; font-size: 13px; font-weight: 600;
  background: transparent; color: var(--gold-hi); border: 1px solid var(--gold); cursor: pointer; white-space: nowrap;
  transition: background .2s, color .2s;
}
#earn-months .month-count-btn:hover { background: var(--gold); color: var(--gold-ink); }
#earn-months .month-amounts { font-size: 13px; white-space: nowrap; }
/* Historique chauffeur : courses rangées par mois, le détail s'ouvre au clic sur le mois */
.history li.hist-month, .hist-month { display: block; padding: 0; border-bottom: 1px solid var(--line); }
.history li.hist-month:last-child { border-bottom: 0; }
.hist-month-body { overflow-x: auto; padding: 4px 0 10px; }
.hist-month-body .history-table { margin-bottom: 0; }
.kpi-link { width: 100%; font: inherit; color: inherit; cursor: pointer; text-align: center; transition: border-color .2s, transform .15s; }
.kpi-link:hover { border-color: var(--gold); transform: translateY(-2px); }
.kpi-link:focus-visible { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 164, 92, .18); }
.admin-period { margin: 4px 0 12px; }
.row-actions-cell { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.row-actions-cell .btn { width: auto; }
/* Admin : la période se choisit dans une seule ligne, à gauche des pastilles */
@media (min-width: 720px) { .admin-period { grid-template-columns: auto 1fr; align-items: center; } .admin-period .period-range { justify-content: flex-end; } }
.hist-month-head {
  width: 100%; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px;
  padding: 14px 4px; background: none; border: 0; color: var(--fg); font: inherit; cursor: pointer; text-align: left;
}
.hist-month-head:hover .hist-month-name { color: var(--gold-hi); }
.hist-month-name { font-family: var(--font-display); font-size: 18px; }
.hist-month-count {
  font-size: 12.5px; color: var(--gold-hi); border: 1px solid var(--gold); border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
.hist-chev { color: var(--gold); transition: transform .25s; display: inline-block; }
.hist-month.open .hist-chev { transform: rotate(180deg); }
.hist-month-rides { list-style: none; margin: 0 0 8px; padding: 0 0 0 6px; border-left: 2px solid var(--line); }
.hist-month-rides > li { border-bottom: 1px solid var(--line); }
.hist-month-rides > li:last-child { border-bottom: 0; }
.earn-detail { margin-top: 12px; }
.earn-detail-list li { flex-wrap: wrap; }
.earn-detail-list li span:last-child { text-align: right; white-space: nowrap; }
.earn-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 8px; }
.earn-grid > div { display: flex; flex-direction: column; gap: 4px; }
.earn-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.earn-grid strong { font-family: var(--font-display); font-weight: 500; font-size: 18px; color: var(--fg); }
.earn-grid .ttc strong { color: var(--gold-hi); font-size: 22px; }
.earn-grid > .ttc { align-items: flex-end; text-align: right; }
.earn-grid > div:nth-child(2) { align-items: center; text-align: center; }
.history li.clickable { cursor: pointer; }
.history li.clickable:hover { color: var(--gold-hi); }
.ride-detail {
  margin: 4px 0 14px; padding: 14px; border: 1px solid var(--gold); border-radius: 14px;
  background: var(--surface-2); font-size: 14px;
}
.ride-detail[hidden] { display: none !important; }
.ride-detail dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 10px 0; }
.ride-detail dt { color: var(--muted); }
.ride-detail dd { margin: 0; }
.ride-detail .detail-price { color: var(--gold-hi); font-weight: 500; }
.ride-detail .btn { width: auto; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.earn-line strong { color: var(--gold-hi); font-weight: 500; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 16px; }
.stat-value { font-family: var(--font-display); font-size: 28px; color: var(--gold-hi); }
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }

.driver-view > .muted { margin: 4px 2px 16px; }
.driver-view > .card { margin-bottom: 14px; }

.driver-map {
  height: 260px;
  border-radius: 18px;
  border: 1px solid var(--line);
  overflow: hidden;
  margin-bottom: 14px;
}

/* Bon de réservation : fenêtre modale claire, prête à imprimer */
.voucher-backdrop {
  position: fixed; inset: 0; z-index: 3500;
  background: rgba(5, 4, 3, .7);
  display: grid; place-items: center; padding: 12px;
}
.voucher-backdrop[hidden] { display: none !important; }
.voucher-panel {
  width: min(94vw, 640px); max-height: 90vh; overflow-y: auto;
  background: #fff; color: #17150f; border-radius: 16px; padding: 20px;
  font-family: var(--font-body);
}
.voucher-actions { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 12px; }
.voucher-actions .btn { width: auto; }
.voucher-doc h2 { font-family: var(--font-display); font-weight: 500; margin: 0 0 4px; color: #17150f; }
.voucher-doc .doc-head { display: flex; align-items: center; gap: 14px; }
.voucher-doc .paid-stamp {
  display: inline-block; margin: 0 0 12px; padding: 6px 14px; border: 2px solid #2f7a2a; border-radius: 8px;
  color: #2f7a2a; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; transform: rotate(-2deg);
}
.voucher-doc .doc-logo { width: 64px; height: 64px; object-fit: cover; border-radius: 50%; border: 1px solid #86661f; flex: 0 0 auto; }
@media (max-width: 480px) { .voucher-doc .doc-logo { width: 52px; height: 52px; } }
.voucher-doc h3 { font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: #86661f; margin: 18px 0 6px; }
.voucher-doc .ref { margin: 0; font-size: 12px; color: #655f50; }
.voucher-doc p { font-size: 14px; margin: 0; line-height: 1.5; }
.voucher-doc table { width: 100%; border-collapse: collapse; font-size: 14px; }
.voucher-doc th, .voucher-doc td { text-align: left; padding: 7px 6px; border-bottom: 1px solid #e3ddcc; vertical-align: top; }
.voucher-doc th { width: 40%; color: #655f50; font-weight: 500; }
.voucher-doc small { color: #655f50; }
.voucher-doc .legal { font-size: 12px; color: #333; padding-left: 18px; margin: 0; }
.voucher-doc .legal li { margin: 5px 0; }

.voucher-send { margin-top: 18px; padding-top: 14px; border-top: 1px solid #e3ddcc; color: #17150f; }
.send-title { font-weight: 600; margin: 0 0 8px; font-size: 14px; }
.send-row { display: flex; gap: 8px; margin-bottom: 8px; }
.send-row input {
  flex: 1; min-width: 0; padding: 10px 12px;
  border: 1px solid #cfc7b2; border-radius: 10px; font: inherit; color: #17150f; background: #fff;
}
.send-row .btn { width: auto; white-space: nowrap; }
.voucher-send .btn.ghost { color: #17150f; border-color: #cfc7b2; }

@media print {
  body * { visibility: hidden; }
  .voucher-send { display: none; }
  #voucher-body, #voucher-body * { visibility: visible; }
  #voucher-body { position: absolute; left: 0; top: 0; width: 100%; }
  .voucher-actions { display: none; }
  .voucher-backdrop { position: static; background: none; display: block; }
  .voucher-panel { box-shadow: none; max-height: none; overflow: visible; width: auto; padding: 0; }
}

/* Fiche complète d'un compte */
.sheet-panel { width: min(94vw, 680px); max-height: 90vh; overflow-y: auto; text-align: left; }
.sheet-panel h3 { font-family: var(--font-display); font-weight: 500; font-size: 17px; margin: 18px 0 8px; color: var(--gold-hi); }
.sheet-panel dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; font-size: 14px; }
.sheet-panel dt { color: var(--muted); }
.sheet-panel dd { margin: 0; }
.sheet-panel .sheet-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.sheet-panel select, .sheet-panel input[type="file"] { font: inherit; color: var(--fg); }
.sheet-panel select { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.sheet-panel .sheet-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }

/* Œil du mot de passe */
.pw-toggle { flex-shrink: 0; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px; display: grid; place-items: center; }
.pw-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.pw-toggle:hover, .pw-toggle.on { color: var(--gold); }
.btn.danger { color: var(--danger); border-color: var(--danger); }

/* Documents chauffeur */
.doc-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.doc-btn { width: auto; cursor: pointer; }

/* Photo de profil */
.avatar-row { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 1px solid var(--gold); background: var(--surface-2); }
.avatar[src=""] { display: none; }
.avatar-btn { width: auto; cursor: pointer; }

/* Mon compte */
.account-view { overflow-y: auto; padding: 96px 16px 32px; }
.account-card { max-width: 520px; margin: 0 auto; }
.account-card .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sub-title { margin-top: 24px; }
.account-card .muted.note { margin-bottom: 10px; }
@media (max-width: 480px) { .account-card .row { grid-template-columns: 1fr; } }

/* Administration : grille des photos */
.admin-view { overflow-y: auto; padding: 96px 16px 32px; max-width: 900px; margin: 0 auto; }
.admin-view > .muted { margin: 4px 0 16px; }
.admin-map { height: 340px; border-radius: 16px; border: 1px solid var(--line); overflow: hidden; margin-bottom: 16px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.admin-card { margin: 0; font-size: 13px; }
.admin-card img {
  width: 100%;
  max-height: 160px;
  aspect-ratio: auto;
  object-fit: contain;
  background: #0d0c0a;
  border-radius: 12px;
  border: 1px solid var(--line);
  display: block;
}
.admin-card figcaption { margin-top: 6px; }
.admin-card .coords { color: var(--muted); font-size: 12px; }
.sub-group { font-family: var(--font-display); font-weight: 500; font-size: 18px; margin: 16px 0 8px; color: var(--gold-hi); }
.sub-group:first-child { margin-top: 0; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 8px; }
.admin-table th, .admin-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table th { color: var(--gold); font-weight: 500; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.admin-table select { background: var(--surface-2); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: inherit; }
.admin-table .btn { width: auto; padding: 6px 12px; }
.admin-card-block { overflow-x: auto; }

/* Mission chauffeur */
.mission { border-color: var(--gold); }
.mission-status { font-weight: 500; color: var(--gold-hi); margin: 4px 0; }
.mission-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.mission-steps .btn { margin-top: 0; width: 100%; }
.mission-steps .btn:disabled { opacity: .35; }
.photo-btn { display: block; width: 100%; text-align: center; cursor: pointer; margin-top: 4px; }
.photo-btn[hidden] { display: none !important; }
.mission-events { list-style: none; padding: 0; margin: 10px 0 0; font-size: 13px; }
.mission-events li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.mission-events li:last-child { border-bottom: 0; }
.mission-events img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.mission-events .coords { color: var(--muted); font-size: 12px; }
.ride-category {
  display: inline-block;
  margin: 0 0 10px;
  padding: 4px 12px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gold-hi);
}
.ride-category:empty { display: none; }
.wait-box { margin: 8px 0 12px; padding: 12px 14px; border: 1px dashed var(--gold); border-radius: 12px; }
.wait-box[hidden] { display: none !important; }
.wait-free { margin: 0; font-weight: 500; }
.wait-extra { margin: 6px 0 0; color: var(--gold-hi); font-size: 14px; }
.eta { color: var(--gold-hi); font-weight: 500; margin: 0 0 12px; }
.eta[hidden] { display: none; }

.incoming { border-color: var(--gold); animation: rise .4s ease; }
.incoming-text { font-size: 17px; margin: 0 0 14px; }

.history { list-style: none; padding: 0; margin: 0; }
.history li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.history li:last-child { border-bottom: 0; }
.history .badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--line); color: var(--muted); margin-left: 6px;
}
.history .badge.ok { color: var(--ok); border-color: rgba(143, 191, 138, .4); }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  transform: translateX(-50%);
  z-index: 2000;
  display: grid;
  gap: 8px;
  width: min(92vw, 420px);
  pointer-events: none;
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 14px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  font-size: 14px;
  animation: rise .3s ease;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--ok); }

/* ---------- Marqueurs de carte ---------- */
.map-pin {
  background: linear-gradient(135deg, var(--gold-hi), var(--gold));
  color: var(--gold-ink);
  font: 600 12px var(--font-body);
  letter-spacing: .04em;
  padding: 5px 10px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
  white-space: nowrap;
  border: 1px solid rgba(13, 12, 10, .3);
}
.map-pin.end { background: var(--surface-2); color: var(--gold-hi); }
.map-pin.driver { background: var(--fg); color: var(--gold-ink); }

/* ---------- Leaflet à la palette ---------- */
.leaflet-container { background: #1a1813; font-family: var(--font-body); }
.leaflet-control-attribution { background: rgba(13, 12, 10, .7) !important; color: var(--muted) !important; }
.leaflet-control-attribution a { color: var(--gold) !important; }
.leaflet-control-zoom { border: 0 !important; }
.leaflet-control-zoom a {
  background: var(--surface) !important; color: var(--gold) !important;
  border: 1px solid var(--line) !important; width: 40px !important; height: 40px !important; line-height: 38px !important;
}
.leaflet-control-zoom a:first-child { border-radius: 12px 12px 0 0 !important; }
.leaflet-control-zoom a:last-child { border-radius: 0 0 12px 12px !important; }

/* ---------- Animations ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(201, 164, 92, .55); }
  70% { box-shadow: 0 0 0 12px rgba(201, 164, 92, 0); }
  100% { box-shadow: 0 0 0 0 rgba(201, 164, 92, 0); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f3ec; --surface: rgba(255, 255, 255, .94); --surface-2: #efebe0;
    --fg: #17150f; --muted: #655f50; --gold: #86661f; --gold-hi: #b08a3a; --gold-ink: #ffffff;
    --line: rgba(134, 102, 31, .22);
    color-scheme: light;
  }
}

/* Tableau de bord admin : indicateurs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 12px 0 20px; }
.kpi { display: flex; flex-direction: column; align-items: center; padding: 12px 8px; text-align: center; }
.kpi .stat-label { font-size: 12px; color: var(--muted); }

/* ===== Administration : lisibilité ===== */
.admin-view { max-width: 1200px; }
.admin-view h1 { margin-bottom: 8px; }
.admin-view .kpis { gap: 14px; margin: 16px 0 28px; }
.admin-view .kpi { padding: 18px 12px; background: var(--surface-2); }
.admin-view .kpi .stat-value { font-size: 30px; line-height: 1.1; color: var(--gold-hi); }
.admin-view .kpi .stat-label { font-size: 13px; margin-top: 6px; letter-spacing: .02em; }
.admin-card-block .admin-table { min-width: 760px; }
.admin-table tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.025); }
.admin-table tbody tr:hover { background: rgba(201, 164, 92, 0.07); }
.admin-table td { font-size: 14px; line-height: 1.45; padding: 12px 10px; }
.admin-table td strong { font-size: 15px; font-weight: 600; }
.admin-card-block { padding: 10px; }
.role-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); }
.role-badge.role-driver { border-color: var(--gold); color: var(--gold-hi); }
.role-badge.role-admin { border-color: var(--danger); color: var(--danger); }
.acc-menu { position: relative; }
.acc-menu > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; width: auto; }
.acc-menu > summary::-webkit-details-marker { display: none; }
.acc-menu[open] > summary { border-color: var(--gold); }
.acc-menu-items {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20;
  min-width: 260px; display: flex; flex-direction: column; gap: 2px; padding: 8px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}
.acc-menu-items > button {
  width: 100%; text-align: left; background: none; border: 0; border-radius: 8px;
  padding: 9px 10px; font: inherit; font-size: 14px; color: var(--fg); cursor: pointer;
}
.acc-menu-items > button:hover { background: rgba(201, 164, 92, 0.12); }
.acc-menu-items > button.danger { color: var(--danger); }
.acc-menu-role { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; font-size: 13px; color: var(--muted); }
.acc-menu-role select { flex: 1; max-width: 160px; }
@media (max-width: 700px) {
  .admin-view { padding-left: 16px; padding-right: 16px; }
  .admin-view .kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .admin-card-block { overflow: visible; }
}

/* Comptes : un bloc séparé par catégorie */
.account-group { margin-bottom: 18px; }
/* Filtre de tri : deux boutons en pastilles */
.sort-toggle { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.sort-toggle .sort-caption { color: var(--muted); font-size: 13px; margin-right: 4px; }
.sort-toggle button {
  width: auto; padding: 6px 14px; border-radius: 999px; font: inherit; font-size: 13px;
  background: transparent; color: var(--fg); border: 1px solid var(--line); cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.sort-toggle button:hover { border-color: var(--gold); }
.sort-toggle button[aria-pressed="true"] { background: var(--gold); color: #1a1408; border-color: var(--gold); font-weight: 600; }

/* Bouton « ma position » sur la carte */
.map-locate { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--gold-hi); font-size: 20px; line-height: 1; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.map-locate:hover { border-color: var(--gold); }

/* Menu Actions ouvert : passe au-dessus des blocs suivants */
.account-group { position: relative; }
.account-group:has(.acc-menu[open]) { z-index: 40; }
.acc-menu[open] { z-index: 41; }
.admin-card-block .admin-table, .admin-card-block td { overflow: visible; }

/* Croix de fermeture des fenêtres */
.picker-backdrop > *, .voucher-backdrop > * { position: relative; }
.modal-x { position: absolute; top: 10px; right: 12px; z-index: 5; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); color: var(--fg); font-size: 22px; line-height: 1; cursor: pointer; }
.modal-x:hover { border-color: var(--gold); color: var(--gold-hi); }

/* Le bon de réservation s'affiche au-dessus de la fiche admin */
#voucher { z-index: 300; }
.account-block { margin-top: 16px; }

/* Fenêtres longues (modification de compte, fiche) : défilement jusqu'au bouton Valider */
.picker-backdrop { overflow-y: auto; padding: 16px 0; align-items: flex-start; }
.picker-backdrop > .picker { max-height: calc(100vh - 32px); overflow-y: auto; margin: auto; }
.picker-backdrop > .sheet-panel { max-height: calc(100vh - 32px); }
.picker-backdrop { place-items: start center; }
.picker-backdrop > .picker, .picker-backdrop > .sheet-panel { margin-top: auto; margin-bottom: auto; }

/* Visionneuse de photo agrandie */
.photo-lightbox { position: fixed; inset: 0; z-index: 4000; background: rgba(0, 0, 0, 0.85); display: flex; align-items: center; justify-content: center; padding: 16px; }
.photo-lightbox[hidden] { display: none; }
.photo-lightbox img { max-width: 92vw; max-height: 88vh; object-fit: contain; border-radius: 10px; }
.photo-lightbox .modal-x { position: absolute; top: 12px; right: 12px; }

/* Chiffres centrés dans les tableaux de comptes (hors nom, contact, rôle et actions) */
.admin-table th:not(:nth-child(-n+3)):not(:last-child),
.admin-table td:not(:nth-child(-n+3)):not(:last-child) { text-align: center; }

/* Montants et chiffres sur une seule ligne */
.admin-table th:not(:nth-child(-n+3)),
.admin-table td:not(:nth-child(-n+3)) { white-space: nowrap; }

/* Icônes de carte : voiture (départ) et drapeau à damier (arrivée) */
.map-icon { width: 36px; height: 36px; border-radius: 50%; background: #15110a; border: 2px solid var(--gold); box-shadow: 0 4px 14px rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; }
.map-icon svg { width: 22px; height: 22px; display: block; }
.map-icon.car svg { fill: var(--gold-hi); }
.map-icon.flag { background: #ffffff; }

/* Demande en cours : lien vers les courses en attente du client */
.count-link { width: auto; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--gold); background: transparent; color: var(--gold-hi); font: inherit; font-weight: 600; cursor: pointer; }
.count-link:hover { background: rgba(201, 164, 92, 0.14); }
.pending-filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 12px; margin-bottom: 12px; border: 1px solid var(--gold); border-radius: 12px; }

/* Historique des courses d un chauffeur, sous sa ligne */
.history-cell { padding: 8px 10px 14px; white-space: normal; }
.history-table td, .history-table th { white-space: normal; }

/* Menu Actions : s ouvre dans le flux du tableau, sans être masqué par les blocs suivants */
.acc-menu { position: static; }
.admin-table td:last-child { position: relative; }
.acc-menu-items { position: static; margin-top: 8px; min-width: 240px; box-shadow: none; }

/* Menu Actions flottant au-dessus du tableau */
.acc-menu-items.floating { position: fixed !important; z-index: 500; margin: 0 !important; min-width: 240px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45); background: var(--surface-2); }

/* Menu Actions : largeur resserrée */
.acc-menu-items.floating { width: 210px; min-width: 0; padding: 6px; }
.acc-menu-items.floating > button { font-size: 13px; padding: 7px 8px; white-space: normal; }
.acc-menu-items.floating .acc-menu-role select { max-width: 110px; }

/* Tableaux de comptes : tout tient dans le cadre, sans défilement horizontal */
.account-group { overflow: hidden; }
.account-group .admin-table { width: 100%; table-layout: auto; font-size: 13px; }
.account-group .admin-table th { font-size: 10.5px; letter-spacing: .04em; white-space: normal; padding: 8px 5px; line-height: 1.25; }
.account-group .admin-table td { padding: 9px 5px; }
.account-group .admin-table td:last-child { white-space: nowrap; }
.account-group .admin-table td strong { font-size: 14px; }

/* Montants sur une seule ligne (les en-têtes peuvent se replier) */
.account-group .admin-table td:not(:nth-child(-n+3)) { white-space: nowrap; }
.history-table td { white-space: nowrap; }
.history-table td:nth-child(2) { white-space: normal; }
/* Montants des comptes : petite taille pour tenir sur une ligne */
.account-group .admin-table td:not(:nth-child(-n+3)) { font-size: 12.5px; }

/* Titre de course dans l onglet Photos de l historique */
.course-head { margin: 14px 0 6px; font-family: var(--font-display); font-weight: 500; color: var(--gold-hi); }

/* Panneau des photos d une course */
.photos-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.photos-head .photos-close { position: static; width: 32px; height: 32px; font-size: 20px; flex: none; }

/* Historique des courses : tient dans la largeur du cadre */
.history-cell { overflow-x: hidden; }
.history-table { width: 100%; font-size: 12.5px; }
.history-table th, .history-table td { padding: 7px 4px; }
.history-table th { font-size: 10px; }
.history-table .btn { width: auto; padding: 4px 8px; font-size: 12px; }

/* Photos d une course : une carte indépendante par photo, aperçu de taille fixe */
.ride-photos .admin-grid { grid-template-columns: repeat(auto-fill, 200px); gap: 14px; }
.ride-photos .admin-card { border: 1px solid var(--line); border-radius: 14px; padding: 8px; background: var(--surface-2); width: 200px; }
.ride-photos .admin-card img { max-height: 120px; width: 100%; object-fit: contain; }
.ride-photos .admin-card figcaption { font-size: 12px; }

/* Photos d une course : espacement entre les cartes, texte qui passe à la ligne */
.ride-photos .admin-grid { gap: 22px; padding: 4px; margin: 0; }
.ride-photos .admin-card { margin: 0; box-sizing: border-box; overflow-wrap: anywhere; }
.ride-photos .admin-card figcaption a { word-break: break-all; }

/* Espace plus large entre les photos d une course */
.ride-photos .admin-grid { gap: 40px; }

/* Navigation proposée pendant la mission */
.mission-nav { margin-top: 12px; display: grid; gap: 8px; }
.mission-nav .nav-leg { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mission-nav .nav-leg span { flex-basis: 100%; font-size: 13px; color: var(--muted); }
.mission-nav .btn { width: auto; }

/* Devis et réservation côte à côte */
.book-row { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.book-row .btn { margin-top: 0; }
.book-row .btn:disabled { opacity: .4; }

/* Ajout à l'agenda : boutons côte à côte */
.cal-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.cal-row .btn { width: auto; text-decoration: none; text-align: center; display: inline-block; }
.cal-row[hidden] { display: none !important; }
.cal-row .btn.small { padding: 9px 14px; font-size: 13px; }

/* ===== Responsive : téléphone, tablette, ordinateur ===== */

/* Téléphone (jusqu'à 599 px) */
@media (max-width: 599px) {
  h1 { font-size: 26px; }
  .hero-copy h1 { font-size: 34px; }
  .auth-card { margin-left: 12px; margin-right: 12px; padding: 16px; }
  .type-choice { flex-wrap: wrap; gap: 8px 14px; padding: 10px 12px; }
  .type-choice legend { width: 100%; }
  .space-choice label { font-size: 15px; }
  .clear-btn { width: 36px; height: 36px; }
  .btn { padding: 14px 16px; }
  .driver-view, .account-view, .admin-view { padding-top: 84px; padding-left: 12px; padding-right: 12px; }
  .driver-head { flex-wrap: wrap; align-items: flex-start; }
  .earn-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .earn-grid strong { font-size: 16px; }
  .earn-grid .ttc strong { font-size: 18px; }
  .options { gap: 6px; }
  .option strong { font-size: 13px; }
  .admin-view .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .admin-view .kpi .stat-value { font-size: 24px; }
  .admin-map { height: 260px; }
  .driver-map { height: 220px; }
  .sort-toggle button { padding: 8px 12px; }
  /* Nom affiché dans la barre haute : masqué sur téléphone pour ne pas chevaucher les onglets */
  .user-name { display: none; }
  /* Tableaux de comptes : défilement horizontal propre, en-tête visible */
  .account-group { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .account-group .admin-table { min-width: 680px; }
  .admin-card-block { overflow-x: auto; }
  .admin-card-block .admin-table { min-width: 720px; }
  .history-cell { overflow-x: auto; }
  .history-table { min-width: 560px; }
  .picker { width: min(94vw, 360px); }
  .voucher-panel { width: 96vw; padding: 14px; }
  .send-row { flex-direction: column; }
  .send-row .btn { width: 100%; }
}

/* Très petit téléphone (jusqu'à 360 px) */
@media (max-width: 360px) {
  .mode-switch button { padding: 7px 10px; font-size: 13px; }
  .options { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr; }
  .earn-grid { grid-template-columns: 1fr 1fr; }
}

/* Tablette (600 à 1023 px) */
@media (min-width: 600px) and (max-width: 1023px) {
  .auth-card { max-width: 520px; }
  .hero-art { max-height: 40vh; }
  .driver-view { max-width: 760px; padding-top: 96px; }
  .account-card { max-width: 640px; }
  .admin-view { max-width: 960px; }
  .admin-view .kpis { grid-template-columns: repeat(3, 1fr); }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .driver-map { height: 320px; }
  .admin-map { height: 380px; }
  .account-group .admin-table { font-size: 14px; }
  .account-group .admin-table th { font-size: 11px; }
  .account-group .admin-table td:not(:nth-child(-n+3)) { font-size: 13.5px; }
  .admin-card-block { overflow-x: auto; }
  .admin-card-block .admin-table { min-width: 860px; }
}

/* Grand écran (1024 px et plus) */
@media (min-width: 1024px) {
  .auth-card { max-width: 480px; }
  .driver-view { max-width: 960px; }
  .account-card { max-width: 720px; }
  .admin-view { max-width: 1280px; }
  .admin-view .kpis { grid-template-columns: repeat(5, 1fr); }
  .admin-card-block { overflow: visible; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .admin-map { height: 420px; }
}

/* Mode paysage sur téléphone : hauteur réduite des zones fixes */
@media (max-height: 500px) and (orientation: landscape) {
  .hero-art { max-height: 30vh; }
  .auth-hero { padding-top: 56px; }
  .auth-view { padding-bottom: 16px; }
  .sheet { max-height: 92dvh; }
  .driver-map, .admin-map { height: 200px; }
  .driver-view, .account-view, .admin-view { padding-top: 72px; }
}

/* Cibles tactiles confortables (44 px) sur les écrans tactiles */
@media (pointer: coarse) {
  .icon-btn { width: 44px; height: 44px; }
  .mode-switch button { padding: 10px 16px; }
  .sort-toggle button, .count-link, .acc-menu > summary { min-height: 40px; }
  .type-choice input, .space-choice input { width: 20px; height: 20px; }
}

/* Coordonnées de l'invité : une colonne, champs pleine largeur */
.guest-fields { display: flex; flex-direction: column; gap: 12px; }
.guest-fields legend { width: 100%; }
.guest-fields .field { display: block; width: 100%; }
.guest-fields .input-wrap { width: 100%; }
.guest-fields .muted.note { display: block; width: 100%; margin: 0; }
.guest-fields[hidden] { display: none !important; }

/* Propositions de sociétés sous le SIRET (liste dans le flux, pas en superposition) */
.siret-suggest { margin: -4px 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); overflow: hidden; }
.siret-suggest p { margin: 0; padding: 12px 14px; }
.siret-opt { display: block; width: 100%; min-height: 44px; padding: 10px 14px; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); color: inherit; cursor: pointer; font: inherit; }
.siret-opt:last-child { border-bottom: 0; }
.siret-opt:hover, .siret-opt:focus-visible { background: rgba(201, 164, 92, 0.12); }
.siret-opt strong { display: block; font-weight: 600; }
.siret-opt span { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
