/*
  Direction visuelle — taxis jaune et noir de Dakar.
  Palette : bitume (#15171A), jaune taxi (#F5B800), gris route, bleu Atlantique pour l'itinéraire,
  rouge latérite pour les alertes, vert baobab pour les confirmations.
  Typo : Archivo variable, en largeur condensée pour les prix et titres (lettrage de signalétique),
  largeur normale pour le texte courant.
  Élément signature : le damier de toit de taxi, utilisé comme barre de progression de la course.
*/
@font-face {
  font-family: 'Archivo Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url(../fonts/archivo-latin-ext-wdth-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Archivo Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url(../fonts/archivo-latin-wdth-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --asphalt: #15171a;
  --ink: #1e2125;
  --muted: #5b626a;
  --line: #dcdfe2;
  --paper: #f1f2f3;
  --card: #ffffff;
  --taxi: #f5b800;
  --taxi-soft: #fff3c4;
  --atlantic: #0b6e83;
  --laterite: #b8381f;
  --laterite-soft: #fbe6e1;
  --baobab: #2a7a4b;
  --baobab-soft: #e1f1e7;
  --r-card: 14px;
  --r-btn: 10px;
  --font: 'Archivo Variable', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
h1, h2, h3 { font-stretch: 75%; font-weight: 800; line-height: 1.1; margin: 0; letter-spacing: 0.005em; }
h1 { font-size: 30px; } h2 { font-size: 22px; } h3 { font-size: 17px; }
p { margin: 0; }
a { color: var(--atlantic); }
.num { font-variant-numeric: tabular-nums; font-stretch: 75%; font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }

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

/* ---------- Damier ---------- */
.checker {
  height: 10px;
  background: repeating-conic-gradient(var(--asphalt) 0 25%, var(--taxi) 0 50%) 0 0 / 20px 20px;
}
.progress { height: 12px; border-radius: 3px; overflow: hidden; background: var(--line); }
.progress > i {
  display: block; height: 100%; width: 0;
  background: repeating-conic-gradient(var(--asphalt) 0 25%, var(--taxi) 0 50%) 0 0 / 24px 24px;
  transition: width 0.6s ease;
}

/* ---------- Marque ---------- */
.brand { display: inline-flex; align-items: center; gap: 8px; font-stretch: 62%; font-weight: 900; font-size: 26px; letter-spacing: 0.01em; color: var(--asphalt); }
.brand .lamp { width: 26px; height: 14px; border-radius: 4px 4px 2px 2px; background: var(--taxi); border: 2px solid var(--asphalt); position: relative; }
.brand .lamp::after { content: ''; position: absolute; inset: auto 3px -6px 3px; height: 4px; background: var(--asphalt); border-radius: 0 0 2px 2px; }

/* ---------- Boutons ---------- */
button, .btn { font: inherit; cursor: pointer; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: var(--r-btn);
  border: 2px solid var(--asphalt); background: var(--card); color: var(--asphalt);
  font-weight: 700; text-decoration: none; transition: transform 0.08s ease, background 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--taxi); }
.btn.dark { background: var(--asphalt); color: #fff; }
.btn.danger { border-color: var(--laterite); color: var(--laterite); }
.btn.ghost { border-color: transparent; background: transparent; text-decoration: underline; min-height: 40px; }
.btn.block { width: 100%; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--asphalt); background: var(--card); display: grid; place-items: center; padding: 0; }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- Champs ---------- */
label.field { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
input, select, textarea {
  font: inherit; width: 100%; min-height: 48px; padding: 10px 12px;
  border: 2px solid var(--line); border-radius: var(--r-btn); background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { border-color: var(--asphalt); outline: none; }
.hint { font-size: 13px; color: var(--muted); font-weight: 400; }
.error-text { color: var(--laterite); font-weight: 600; font-size: 14px; min-height: 1.3em; }

/* ---------- Cartes, pastilles ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px; }
.pill { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 99px; font-size: 13px; font-weight: 700; background: var(--line); color: var(--ink); white-space: nowrap; }
.pill.ok { background: var(--baobab-soft); color: var(--baobab); }
.pill.warn { background: var(--taxi-soft); color: #7a5a00; }
.pill.bad { background: var(--laterite-soft); color: var(--laterite); }
.pill.info { background: #dff0f4; color: var(--atlantic); }

/* ---------- Carte + panneau ---------- */
.shell { height: 100dvh; display: flex; flex-direction: column; }
.stage { position: relative; flex: 1; min-height: 0; }
.map { position: absolute; inset: 0; background: #dfe3e6; }
.leaflet-container { font-family: var(--font); }
.topbar { position: absolute; z-index: 700; top: 0; left: 0; right: 0; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.topbar .brand { background: var(--card); padding: 6px 12px; border-radius: 99px; border: 2px solid var(--asphalt); font-size: 22px; }
.sheet {
  position: absolute; z-index: 800; left: 0; right: 0; bottom: 0;
  background: var(--card); border-radius: 22px 22px 0 0; border-top: 2px solid var(--asphalt);
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); max-height: 80%; overflow: auto;
  display: grid; gap: 14px;
  animation: rise 0.25s ease;
}
@keyframes rise { from { transform: translateY(24px); } to { transform: none; } }
.stage .leaflet-top.leaflet-right { margin-top: 64px; }
@media (min-width: 900px) {
  .sheet { left: 16px; top: 72px; bottom: 16px; right: auto; width: 400px; max-height: none; border: 2px solid var(--asphalt); border-radius: 18px; align-content: start; }
}
.sheet .grab { width: 44px; height: 4px; border-radius: 4px; background: var(--line); margin: -6px auto 0; }
@media (min-width: 900px) { .sheet .grab { display: none; } }

.place { display: flex; gap: 12px; align-items: flex-start; }
.dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 6px; flex: none; }
.dot.from { background: var(--atlantic); }
.dot.to { background: var(--asphalt); border-radius: 2px; }

.results { display: grid; border: 1px solid var(--line); border-radius: var(--r-btn); overflow: hidden; }
.results button { text-align: left; background: #fff; border: 0; border-bottom: 1px solid var(--line); padding: 12px; min-height: 48px; }
.results button:last-child { border-bottom: 0; }
.results button:hover { background: var(--taxi-soft); }

.vehicle { display: flex; align-items: center; gap: 12px; padding: 12px; border: 2px solid var(--line); border-radius: var(--r-card); background: #fff; width: 100%; text-align: left; }
.vehicle[aria-checked='true'] { border-color: var(--asphalt); background: var(--taxi-soft); }
.vehicle .price { font-size: 22px; }
.vehicle svg { width: 44px; height: 24px; flex: none; }

.pay-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pay-opts button { min-height: 44px; border: 2px solid var(--line); border-radius: var(--r-btn); background: #fff; font-weight: 700; font-size: 14px; }
.pay-opts button[aria-checked='true'] { border-color: var(--asphalt); background: var(--taxi-soft); }
.pay-opts button[disabled] { opacity: 0.4; }

.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--asphalt); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--taxi); box-shadow: 0 0 0 0 rgb(245 184 0 / 0.7); animation: pulse 1.6s infinite; }
@keyframes pulse { to { box-shadow: 0 0 0 18px rgb(245 184 0 / 0); } }

.stars { display: flex; gap: 4px; justify-content: center; }
.stars button { background: none; border: 0; padding: 4px; font-size: 34px; line-height: 1; color: var(--line); }
.stars button.on { color: var(--taxi); }

.plate { display: inline-block; font-weight: 800; font-stretch: 75%; letter-spacing: 0.06em; background: var(--taxi); border: 2px solid var(--asphalt); border-radius: 6px; padding: 1px 8px; }

.car-marker { width: 30px; height: 30px; }
.car-marker div { width: 100%; height: 100%; border-radius: 50%; background: var(--taxi); border: 3px solid var(--asphalt); display: grid; place-items: center; }
.car-marker.busy div { background: var(--asphalt); border-color: var(--taxi); }
.car-marker.me div { box-shadow: 0 0 0 6px rgb(11 110 131 / 0.25); background: var(--atlantic); border-color: #fff; }
.pin { width: 28px; height: 28px; }
.pin.from div { background: var(--atlantic); border: 4px solid #fff; border-radius: 50%; width: 22px; height: 22px; box-shadow: 0 0 0 2px var(--atlantic); }
.pin.to div { background: var(--asphalt); border: 4px solid #fff; width: 22px; height: 22px; box-shadow: 0 0 0 2px var(--asphalt); }
.center-pin { position: absolute; z-index: 750; left: 50%; top: 50%; width: 22px; height: 22px; margin: -22px 0 0 -11px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--asphalt); border: 3px solid var(--taxi); pointer-events: none; }

/* ---------- Offre chauffeur ---------- */
.offer { position: fixed; z-index: 1500; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); max-width: 440px; margin: 0 auto; background: var(--card); border: 3px solid var(--asphalt); border-radius: 18px; overflow: hidden; animation: rise 0.2s ease; }
.offer .body { padding: 14px 16px 16px; display: grid; gap: 12px; }
.offer .fare { font-size: 40px; }

/* ---------- Barre d'onglets mobile ---------- */
.tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--asphalt); padding-bottom: env(safe-area-inset-bottom); }
.tabbar button { background: none; border: 0; color: #c9ccd0; min-height: 56px; font-weight: 700; font-size: 13px; display: grid; place-items: center; gap: 2px; align-content: center; }
.tabbar button[aria-current='page'] { color: var(--taxi); }
.tabbar svg { width: 22px; height: 22px; }

.page { overflow: auto; padding: 16px; display: grid; gap: 14px; align-content: start; max-width: 720px; width: 100%; margin: 0 auto; }

/* ---------- Tableaux de bord société / admin ---------- */
.dash { height: 100dvh; display: grid; grid-template-columns: 232px 1fr; }
.side { background: var(--asphalt); color: #fff; display: flex; flex-direction: column; padding: 16px 12px; gap: 6px; overflow: auto; }
.side .brand { color: #fff; margin: 4px 8px 12px; }
.side .brand .lamp { border-color: #fff; }
.side .brand .lamp::after { background: #fff; }
.side button { background: none; border: 0; color: #d3d6da; text-align: left; padding: 11px 12px; border-radius: 8px; font-weight: 600; min-height: 44px; }
.side button[aria-current='page'] { background: var(--taxi); color: var(--asphalt); }
.side .who { margin-top: auto; padding: 10px 8px 0; border-top: 1px solid #353a40; font-size: 14px; color: #aeb3b9; }
.main { overflow: auto; padding: 22px; display: grid; gap: 18px; align-content: start; min-width: 0; }
.main header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
@media (min-width: 801px) { .mobile-only { display: none !important; } }
@media (max-width: 800px) {
  .dash { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .side { flex-direction: row; overflow-x: auto; padding: 8px; gap: 4px; align-items: center; }
  .side .brand, .side .who { display: none; }
  .side button { white-space: nowrap; }
  .main { padding: 14px; }
}
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--taxi); border-radius: var(--r-card); padding: 12px 14px; }
.kpi .v { font-size: 30px; line-height: 1.1; }
.kpi .l { font-size: 14px; color: var(--muted); }
.table-wrap { overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-weight: 700; background: var(--paper); padding: 10px 12px; position: sticky; top: 0; white-space: nowrap; }
td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { padding: 26px 16px; text-align: center; color: var(--muted); }
.chart { width: 100%; height: 180px; }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--muted); }
.maphalf { position: relative; height: 340px; border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.codebox { display: flex; align-items: center; gap: 10px; background: var(--taxi-soft); border: 2px dashed var(--asphalt); border-radius: var(--r-card); padding: 12px 14px; }
.codebox .code { font-size: 30px; letter-spacing: 0.12em; }

/* ---------- Modale, toast ---------- */
.modal-back { position: fixed; inset: 0; z-index: 2000; background: rgb(21 23 26 / 0.55); display: grid; place-items: end center; }
.modal { background: var(--card); width: min(520px, 100%); max-height: 92dvh; overflow: auto; border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); display: grid; gap: 14px; animation: rise 0.2s ease; }
@media (min-width: 700px) { .modal-back { place-items: center; } .modal { border-radius: 18px; } }
.toasts { position: fixed; z-index: 3000; left: 0; right: 0; top: calc(10px + env(safe-area-inset-top)); display: grid; gap: 8px; justify-items: center; pointer-events: none; padding: 0 12px; }
.toast { background: var(--asphalt); color: #fff; padding: 11px 16px; border-radius: 10px; font-weight: 600; max-width: 460px; animation: rise 0.2s ease; }
.toast.error { background: var(--laterite); }
.toast.ok { background: var(--baobab); }

/* ---------- Connexion ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
.auth main { display: grid; place-items: center; padding: 20px 16px 40px; }
.auth .panel { width: min(440px, 100%); display: grid; gap: 16px; }
.auth .hero { font-size: clamp(34px, 9vw, 46px); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 2px solid var(--asphalt); border-radius: var(--r-btn); overflow: hidden; }
.seg button { border: 0; background: #fff; min-height: 44px; font-weight: 700; border-right: 2px solid var(--asphalt); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed='true'] { background: var(--asphalt); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
