/* Cardan — navigation
 *
 * Le fond est sombre parce que l'app vit dans une auto, souvent la nuit.
 * L'ambre est la couleur du marquage au sol : elle ne sert qu'au guidage.
 * Le bleu glacier ne sert qu'à l'électrique. Rien d'autre n'a le droit
 * d'être coloré, pour qu'un coup d'œil suffise à savoir quoi regarder.
 * La typographie est Overpass, dessinée d'après le Highway Gothic des
 * panneaux routiers nord-américains. */

:root {
  --void: #07090d;
  --panel: #131926;
  --raise: #1b2333;
  --line: #262f42;
  --amber: #ffb000;
  --amber-deep: #7a5400;
  --ice: #5fd4e8;
  --ice-deep: #0f4653;
  --alert: #ff4a3d;
  --ok: #4ade80;
  --text: #e9eef7;
  --dim: #8593a8;
  --faint: #55617a;

  --tap: 56px;
  --radius: 14px;
  --sheet-peek: 108px;
  --sheet-half: 58vh;
  --sheet-full: calc(100vh - 92px);

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);

  --ease: cubic-bezier(.22, .78, .3, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--void);
  color: var(--text);
  font-family: Overpass, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  overscroll-behavior: none;
}

button, input, select { font-family: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

/* Les chiffres sont lus en un coup d'œil : chasse fixe obligatoire. */
.mono, .banner-dist, .speed-value, .peek-metric strong, .drain-num,
.ev-readout b, .step-dist, .charge-num {
  font-family: "Overpass Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

#map { position: fixed; inset: 0; background: #0b0f16; z-index: 0; }

.leaflet-container { background: #0b0f16; font-family: inherit; }
.leaflet-control-attribution {
  background: rgba(7, 9, 13, .7) !important;
  color: var(--faint) !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--dim) !important; }
.leaflet-control-zoom { display: none; }

/* ─────────── Bandeau de manœuvre ─────────── */

.banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  padding-top: var(--safe-t);
  background: linear-gradient(180deg, #0d1420 0%, #101827 88%, rgba(16, 24, 39, .94) 100%);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .6);
  animation: bannerIn .34s var(--ease);
}

@keyframes bannerIn {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

.banner-main {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 14px 12px;
}

/* Le pictogramme de manœuvre : gros, ambre, sans fioriture. */
.glyph {
  flex: none;
  width: 62px; height: 62px;
  display: grid; place-items: center;
}
.glyph svg { width: 100%; height: 100%; fill: none; stroke: var(--amber); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.glyph svg .solid { fill: var(--amber); stroke: none; }

.banner-text { flex: 1; min-width: 0; }

.banner-dist {
  font-size: 40px;
  font-weight: 700;
  line-height: .96;
  color: var(--amber);
}
.banner-dist small { font-size: 20px; font-weight: 600; margin-left: 3px; }

.banner-road {
  margin-top: 4px;
  font-size: 19px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.banner-road .then {
  display: block;
  font-size: 14px;
  font-weight: 400;
  color: var(--dim);
  margin-top: 2px;
}

.banner-close {
  flex: none;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--raise);
  color: var(--dim);
  font-size: 17px;
}

/* La barre qui se vide : signal périphérique de proximité.
 * Le conducteur n'a pas à lire le chiffre pour savoir qu'il approche. */
.drain {
  height: 7px;
  background: #0b111c;
  overflow: hidden;
}
.drain-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--amber-deep), var(--amber));
  transform-origin: left center;
  transition: transform .32s linear, background .3s;
}
.drain-fill.is-imminent {
  background: linear-gradient(90deg, #b33, var(--alert));
  animation: pulseBar .5s ease-in-out infinite alternate;
}
@keyframes pulseBar { from { opacity: .55; } to { opacity: 1; } }

/* Le ruban : ce qui arrive dans les 500 prochains mètres, placé à l'échelle. */
.ribbon {
  position: relative;
  height: 30px;
  background: #0a0f19;
  border-top: 1px solid #141c2b;
  overflow: hidden;
}
.ribbon:empty { display: none; }
.ribbon-tick {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  display: grid; place-items: center;
  width: 22px; height: 22px;
  border-radius: 6px;
  font-size: 11px; font-weight: 800;
  background: var(--raise);
  color: var(--dim);
  transition: left .3s linear;
}
.ribbon-tick[data-kind="signal"] { background: #2b1f00; color: var(--amber); }
.ribbon-tick[data-kind="stop"]   { background: #33110e; color: var(--alert); }
.ribbon-tick[data-kind="yield"]  { background: #2b1f00; color: #ffd47a; }
.ribbon-tick[data-kind="camera"] { background: #2a1030; color: #d99cff; }
.ribbon-tick[data-kind="railway"], .ribbon-tick[data-kind="toll"] { background: #12293a; color: var(--ice); }
.ribbon-tick[data-kind="report"] { background: #331a0a; color: #ffa14a; }
.ribbon-tick[data-kind="charger"] { background: var(--ice-deep); color: var(--ice); }

/* ─────────── Pastille de vitesse ─────────── */

.speed-pod {
  position: fixed;
  left: 14px;
  bottom: calc(var(--sheet-peek) + var(--safe-b) + 16px);
  z-index: 30;
  width: 78px;
  padding: 8px 4px 6px;
  border-radius: var(--radius);
  background: rgba(19, 25, 38, .93);
  border: 1px solid var(--line);
  text-align: center;
  backdrop-filter: blur(10px);
  transition: bottom .34s var(--ease);
}
.speed-value { font-size: 31px; font-weight: 700; line-height: 1; }
.speed-unit { font-size: 10px; color: var(--dim); letter-spacing: .09em; text-transform: uppercase; }
.speed-limit {
  margin: 7px auto 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid #d8232a;
  color: #111;
  display: grid; place-items: center;
  font-weight: 800; font-size: 16px;
}
.speed-pod.is-over .speed-value { color: var(--alert); }

/* ─────────── Boutons flottants ─────────── */

.rail {
  position: fixed;
  right: 12px;
  bottom: calc(var(--sheet-peek) + var(--safe-b) + 16px);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: bottom .34s var(--ease);
}
.rail-btn {
  width: var(--tap); height: var(--tap);
  border-radius: 50%;
  background: rgba(19, 25, 38, .93);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  backdrop-filter: blur(10px);
  transition: transform .14s var(--ease), background .18s;
}
.rail-btn:active { transform: scale(.9); }
.rail-btn svg {
  width: 25px; height: 25px;
  fill: none; stroke: var(--text);
  stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
}
.rail-btn[aria-pressed="true"] svg { stroke: var(--faint); }
.rail-btn[aria-pressed="true"] .wave { display: none; }
.rail-btn.is-active { background: var(--amber); border-color: var(--amber); }
.rail-btn.is-active svg { stroke: #16110a; }

.rail-report { background: rgba(255, 176, 0, .16); border-color: rgba(255, 176, 0, .45); }
.rail-report svg { stroke: var(--amber); }

/* ─────────── Panneau coulissant ─────────── */

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  height: var(--sheet-full);
  transform: translateY(calc(100% - var(--sheet-peek) - var(--safe-b)));
  background: var(--panel);
  border-top: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -14px 44px rgba(0, 0, 0, .62);
  transition: transform .36s var(--ease);
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-b);
}
.sheet[data-state="half"] { transform: translateY(calc(100% - var(--sheet-half))); }
.sheet[data-state="full"] { transform: translateY(0); }
.sheet.is-dragging { transition: none; }

.sheet-grip { padding: 10px 0 4px; display: grid; place-items: center; flex: none; touch-action: none; }
.grip-bar { width: 40px; height: 4px; border-radius: 2px; background: var(--faint); }

.sheet-peek { flex: none; padding: 4px 14px 14px; }

.peek-search {
  width: 100%;
  height: var(--tap);
  display: flex; align-items: center; gap: 11px;
  padding: 0 18px;
  border-radius: var(--radius);
  background: var(--raise);
  color: var(--dim);
  font-size: 17px;
  text-align: left;
}
.peek-search .icon-sm { width: 19px; height: 19px; fill: none; stroke: var(--dim); stroke-width: 2; }

.peek-summary { display: flex; align-items: center; gap: 16px; }
.peek-metric { display: flex; flex-direction: column; line-height: 1.14; }
.peek-metric strong { font-size: 21px; font-weight: 700; }
.peek-metric span { font-size: 10.5px; color: var(--dim); text-transform: uppercase; letter-spacing: .07em; }
.peek-eta strong { color: var(--amber); }
.peek-ev strong { color: var(--ice); }

.peek-go {
  margin-left: auto;
  height: 48px;
  padding: 0 26px;
  border-radius: var(--radius);
  background: var(--amber);
  color: #16110a;
  font-size: 17px; font-weight: 800;
  letter-spacing: .01em;
}
.peek-go:active { transform: scale(.96); }

.sheet-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 14px 24px; }

.tabs {
  position: sticky; top: 0; z-index: 2;
  display: flex; gap: 4px;
  padding: 4px 0 10px;
  background: var(--panel);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  padding: 10px 16px;
  border-radius: 9px;
  font-size: 13.5px; font-weight: 600;
  color: var(--dim);
  background: var(--raise);
  white-space: nowrap;
}
.tab.is-active { background: var(--amber); color: #16110a; }

.panel { display: none; }
.panel.is-active { display: block; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Champs d'itinéraire */
.field-stack { position: relative; padding-left: 4px; }
.field-stack::before {
  content: '';
  position: absolute;
  left: 12px; top: 26px; bottom: 26px;
  width: 2px;
  background: repeating-linear-gradient(180deg, var(--faint) 0 4px, transparent 4px 9px);
}
.field {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  height: 52px;
  margin-bottom: 8px;
  padding: 0 12px 0 0;
}
.field-dot { flex: none; width: 17px; height: 17px; border-radius: 50%; margin-left: 4px; z-index: 1; }
.dot-origin { background: var(--panel); border: 3px solid var(--dim); }
.dot-dest { background: var(--amber); border: 3px solid var(--panel); }
.dot-stop { background: var(--ice); border: 3px solid var(--panel); }

.field input {
  flex: 1; min-width: 0;
  height: 100%;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--raise);
  font-size: 16.5px;
}
.field input::placeholder { color: var(--faint); }
.field input:focus { outline: none; border-color: var(--amber); }
.field-clear { width: 32px; color: var(--faint); font-size: 14px; }

.field-actions { display: flex; gap: 8px; margin: 4px 0 14px; flex-wrap: wrap; }
.chip {
  padding: 9px 15px;
  border-radius: 999px;
  background: var(--raise);
  border: 1px solid var(--line);
  color: var(--dim);
  font-size: 13.5px; font-weight: 600;
}
.chip:active { background: var(--line); }

.suggest { list-style: none; margin: 0 0 14px; padding: 0; }
.suggest li {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.suggest li:active { background: var(--raise); }
.suggest .s-name { font-weight: 600; font-size: 15.5px; }
.suggest .s-label { font-size: 12.5px; color: var(--dim); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Itinéraires proposés */
.routes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.route-card {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 15px;
  border-radius: var(--radius);
  background: var(--raise);
  border: 1px solid var(--line);
  text-align: left;
  width: 100%;
}
.route-card.is-selected { border-color: var(--amber); background: rgba(255, 176, 0, .09); }
.route-time { font-size: 21px; font-weight: 700; }
.route-meta { font-size: 12.5px; color: var(--dim); margin-top: 2px; }
.route-tag {
  margin-left: auto;
  font-size: 11px; font-weight: 700;
  padding: 4px 9px; border-radius: 999px;
  background: var(--line); color: var(--dim);
}
.route-card.is-selected .route-tag { background: var(--amber); color: #16110a; }

/* Feuille de route */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li {
  display: flex; align-items: flex-start; gap: 13px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
}
.step-icon { flex: none; width: 30px; height: 30px; margin-top: 1px; }
.step-icon svg { width: 100%; height: 100%; fill: none; stroke: var(--dim); stroke-width: 2.2;
  stroke-linecap: round; stroke-linejoin: round; }
.step-body { flex: 1; min-width: 0; }
.step-text { font-size: 15px; }
.step-dist { font-size: 12.5px; color: var(--dim); margin-top: 2px; }
.step-furniture { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.furn-pill {
  font-size: 10.5px; font-weight: 700;
  padding: 3px 7px; border-radius: 5px;
  background: var(--line); color: var(--dim);
}
.furn-pill[data-kind="signal"] { background: #2b1f00; color: var(--amber); }
.furn-pill[data-kind="stop"] { background: #33110e; color: var(--alert); }
.furn-pill[data-kind="yield"] { background: #2b1f00; color: #ffd47a; }
.furn-pill[data-kind="camera"] { background: #2a1030; color: #d99cff; }

/* ─────────── Électrique ─────────── */

.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  padding: 14px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 15.5px;
}
.switch {
  appearance: none; -webkit-appearance: none;
  flex: none;
  width: 50px; height: 30px;
  border-radius: 15px;
  background: var(--line);
  position: relative;
  transition: background .2s;
}
.switch::after {
  content: '';
  position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--dim);
  transition: transform .2s var(--ease), background .2s;
}
.switch:checked { background: var(--ice-deep); }
.switch:checked::after { transform: translateX(20px); background: var(--ice); }

.lbl {
  display: block;
  margin: 16px 0 7px;
  font-size: 12px; font-weight: 700;
  color: var(--dim);
  text-transform: uppercase; letter-spacing: .07em;
}
.lbl b { float: right; text-transform: none; letter-spacing: 0; color: var(--text);
  font-family: "Overpass Mono", monospace; }

select, input[type="number"] {
  width: 100%; height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--raise);
  font-size: 16px;
  appearance: none; -webkit-appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%),
                          linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: calc(100% - 19px) 21px, calc(100% - 13px) 21px;
  background-size: 6px 6px; background-repeat: no-repeat; }

input[type="range"] {
  width: 100%; height: 30px;
  appearance: none; -webkit-appearance: none;
  background: none;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 5px; border-radius: 3px; background: var(--line);
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none;
  width: 26px; height: 26px; margin-top: -10.5px;
  border-radius: 50%; background: var(--ice);
  border: 3px solid var(--panel);
}
input[type="range"]::-moz-range-track { height: 5px; border-radius: 3px; background: var(--line); }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%;
  background: var(--ice); border: 3px solid var(--panel); }

.slider-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 400px) { .slider-grid { grid-template-columns: 1fr; } }

.weather-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 16px 0 6px; padding: 12px;
  border-radius: 11px; background: var(--raise);
  font-size: 13px; color: var(--dim);
}
.wx-item b { color: var(--text); margin-left: 5px; font-family: "Overpass Mono", monospace; }
.wx-override { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.wx-override input[type="number"] { width: 68px; height: 34px; padding: 0 8px; }
.wx-override input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--ice); }

.ev-readout {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1px; margin: 16px 0;
  background: var(--line);
  border-radius: 11px; overflow: hidden;
}
.ev-readout div { background: var(--panel); padding: 13px 10px; text-align: center; }
.ev-readout b { display: block; font-size: 20px; font-weight: 700; color: var(--ice); }
.ev-readout span { font-size: 10.5px; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }

.ev-plan { display: flex; flex-direction: column; gap: 9px; }

.stop-card {
  display: flex; gap: 13px;
  padding: 13px;
  border-radius: var(--radius);
  background: var(--raise);
  border-left: 3px solid var(--ice);
}
.stop-index {
  flex: none; width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--ice-deep); color: var(--ice);
  display: grid; place-items: center;
  font-weight: 800; font-size: 13px;
}
.stop-name { font-weight: 600; font-size: 15.5px; }
.stop-meta { font-size: 12.5px; color: var(--dim); margin-top: 3px; line-height: 1.5; }
.charge-num { color: var(--ice); font-weight: 700; }
.stop-bar {
  margin-top: 8px; height: 5px; border-radius: 3px;
  background: var(--line); position: relative; overflow: hidden;
}
.stop-bar i { position: absolute; top: 0; bottom: 0; background: var(--ice); border-radius: 3px; }

.ev-warning {
  padding: 13px;
  border-radius: var(--radius);
  background: rgba(255, 74, 61, .1);
  border: 1px solid rgba(255, 74, 61, .35);
  color: #ffb3ad;
  font-size: 14px; line-height: 1.5;
}

#socChart { width: 100%; margin-top: 16px; display: block; }

/* ─────────── Signalements ─────────── */

.hint { font-size: 13.5px; color: var(--dim); line-height: 1.5; margin: 10px 0 16px; }

.alert-list { display: flex; flex-direction: column; gap: 8px; }
.alert-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 13px;
  border-radius: 11px;
  background: var(--raise);
}
.alert-badge {
  flex: none; width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 18px;
}
.alert-name { font-weight: 600; font-size: 15px; }
.alert-meta { font-size: 12px; color: var(--dim); margin-top: 2px; }
.alert-votes { margin-left: auto; display: flex; gap: 6px; }
.vote-btn {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--line);
  font-size: 15px;
}
.vote-btn.up:active { background: rgba(74, 222, 128, .25); }
.vote-btn.down:active { background: rgba(255, 74, 61, .25); }

/* ─────────── Superpositions ─────────── */

.report-overlay, .layers-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(4, 6, 10, .78);
  backdrop-filter: blur(7px);
  display: flex; align-items: flex-end;
  animation: fadeIn .18s ease;
}
.report-card, .layers-card {
  width: 100%;
  max-height: 88vh; overflow-y: auto;
  padding: 18px 16px calc(20px + var(--safe-b));
  background: var(--panel);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--line);
  animation: slideUp .28s var(--ease);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }

.report-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.report-head h2 { margin: 0; font-size: 21px; font-weight: 800; }
.report-close { width: 40px; height: 40px; border-radius: 50%; background: var(--raise); color: var(--dim); }

.voice-report {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 11px;
  height: 62px;
  margin-bottom: 14px;
  border-radius: var(--radius);
  background: rgba(255, 176, 0, .13);
  border: 1px solid rgba(255, 176, 0, .4);
  color: var(--amber);
  font-size: 17px; font-weight: 700;
}
.voice-report.is-listening { background: rgba(255, 74, 61, .16); border-color: var(--alert); color: var(--alert); }
.voice-report.is-listening .icon-mic { animation: micPulse .9s ease-in-out infinite; }
@keyframes micPulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
.icon-mic { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.voice-heard {
  margin: -6px 0 14px;
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--raise);
  font-size: 14.5px; color: var(--dim);
  font-style: italic;
}

.report-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
@media (max-width: 360px) { .report-grid { grid-template-columns: repeat(3, 1fr); } }

.report-item {
  aspect-ratio: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  border-radius: var(--radius);
  background: var(--raise);
  border: 1px solid var(--line);
  font-size: 11px; font-weight: 600;
  color: var(--dim);
  text-align: center;
  padding: 4px;
  transition: transform .12s var(--ease);
}
.report-item:active { transform: scale(.92); }
.report-item .ri-glyph { font-size: 25px; line-height: 1; }

.layers-card .toggle-row:last-of-type { border-bottom: none; }

/* ─────────── Toast ─────────── */

.toast {
  position: fixed;
  left: 50%; top: calc(var(--safe-t) + 14px);
  transform: translateX(-50%);
  z-index: 80;
  max-width: min(92vw, 460px);
  padding: 13px 19px;
  border-radius: 999px;
  background: rgba(27, 35, 51, .97);
  border: 1px solid var(--line);
  font-size: 14.5px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .55);
  animation: toastIn .26s var(--ease);
}
.toast.is-alert { background: rgba(70, 18, 14, .97); border-color: var(--alert); color: #ffc9c4; }
.toast.is-ok { background: rgba(12, 48, 30, .97); border-color: rgba(74, 222, 128, .5); color: #b6f5cf; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Le bandeau pousse le toast plus bas. */
.banner:not([hidden]) ~ .toast { top: calc(var(--safe-t) + 152px); }

/* ─────────── Marqueurs de carte ─────────── */

.mk {
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 13px; font-weight: 800;
  border: 2px solid var(--void);
  box-shadow: 0 2px 7px rgba(0, 0, 0, .6);
}
.mk-furn { width: 20px; height: 20px; font-size: 10px; }
.mk-signal { background: var(--amber); color: #16110a; }
.mk-stop { background: var(--alert); color: #fff; }
.mk-yield { background: #ffd47a; color: #16110a; }
.mk-camera { background: #b06fd6; color: #fff; }
.mk-crossing { background: #4a5568; color: #cbd5e0; }
.mk-railway, .mk-toll { background: var(--ice); color: #06222a; }
.mk-bump { background: #6b7280; color: #e5e7eb; }
.mk-roundabout { background: #4a5568; color: #cbd5e0; }
.mk-report { width: 32px; height: 32px; background: #ff8b3d; color: #1a0d02; font-size: 16px; }
.mk-charger { width: 30px; height: 30px; background: var(--ice); color: #06222a; font-size: 15px; }
.mk-charger.is-planned { background: var(--amber); color: #16110a;
  box-shadow: 0 0 0 4px rgba(255, 176, 0, .28); }

.puck {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #2f8fff;
  border: 3px solid #fff;
  box-shadow: 0 0 0 7px rgba(47, 143, 255, .2), 0 2px 8px rgba(0, 0, 0, .5);
}
.puck-cone {
  position: absolute; left: 50%; top: 50%;
  width: 0; height: 0;
  border-left: 17px solid transparent;
  border-right: 17px solid transparent;
  border-bottom: 40px solid rgba(47, 143, 255, .3);
  transform-origin: 50% 100%;
  margin: -40px 0 0 -17px;
  pointer-events: none;
}

.leaflet-popup-content-wrapper {
  background: var(--panel); color: var(--text);
  border-radius: var(--radius); border: 1px solid var(--line);
}
.leaflet-popup-tip { background: var(--panel); }
.leaflet-popup-content { margin: 13px 15px; font-size: 14px; line-height: 1.5; }
.leaflet-popup-content b { display: block; margin-bottom: 4px; font-size: 15px; }
.leaflet-popup-content .pop-meta { color: var(--dim); font-size: 12.5px; }
.leaflet-popup-close-button { color: var(--dim) !important; }

.pop-btn {
  display: inline-block; margin-top: 9px;
  padding: 8px 14px; border-radius: 9px;
  background: var(--amber); color: #16110a;
  font-weight: 700; font-size: 13px;
}

/* ─────────── Divers ─────────── */

.btn-secondary {
  width: 100%; height: 48px;
  margin-top: 14px;
  border-radius: 11px;
  background: var(--raise);
  border: 1px solid var(--line);
  font-size: 15px; font-weight: 600;
  color: var(--dim);
}
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.about { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.about p { font-size: 12.5px; color: var(--faint); line-height: 1.6; margin: 0 0 6px; }

.empty { padding: 26px 12px; text-align: center; color: var(--faint); font-size: 14px; }

/* En navigation, la carte respire : on rétracte le panneau et on
 * remonte les commandes. */
body.is-navigating .sheet { --sheet-peek: 88px; }
body.is-navigating .tabs { display: none; }

/* ─────────── Indicateur de connexion ─────────── */

.net-badge {
  position: fixed;
  left: 50%; top: calc(var(--safe-t) + 14px);
  transform: translateX(-50%);
  z-index: 78;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(122, 84, 0, .95);
  border: 1px solid var(--amber-deep);
  color: var(--amber);
  font-size: 13px; font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}
.net-badge svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.banner:not([hidden]) ~ .net-badge { top: calc(var(--safe-t) + 152px); }

/* ─────────── Favoris ─────────── */

.favorites-row {
  display: flex; gap: 8px; overflow-x: auto;
  margin: 2px 0 14px;
  scrollbar-width: none;
}
.favorites-row::-webkit-scrollbar { display: none; }
.favorites-row:empty { display: none; }
.fav-chip {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 7px;
  padding: 10px 15px;
  border-radius: 999px;
  background: var(--raise);
  border: 1px solid var(--line);
  font-size: 13.5px; font-weight: 600;
  color: var(--text);
}
.fav-chip .fav-glyph { font-size: 15px; }

.save-place-row { display: flex; gap: 8px; margin: 2px 0 14px; }
.chip-save { flex: 1; text-align: center; }
.chip-save.is-saved { background: rgba(74, 222, 128, .16); border-color: rgba(74, 222, 128, .4); color: #b6f5cf; }

.resume-chip {
  display: flex; align-items: center; gap: 8px;
  width: 100%; height: 44px;
  margin-bottom: 12px;
  padding: 0 14px;
  border-radius: 11px;
  background: rgba(95, 212, 232, .12);
  border: 1px solid rgba(95, 212, 232, .35);
  color: var(--ice);
  font-size: 13.5px; font-weight: 700;
}
.resume-chip .icon-sm { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; }

/* ─────────── Hors ligne ─────────── */

.storage-card { margin-bottom: 16px; }
.storage-bar {
  height: 8px; border-radius: 4px;
  background: var(--raise);
  overflow: hidden;
}
.storage-bar i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--ice-deep), var(--ice));
  border-radius: 4px;
  transition: width .3s var(--ease);
}
.storage-bar.is-full i { background: linear-gradient(90deg, #7a2a00, var(--alert)); }
.storage-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 7px;
  font-size: 12.5px; color: var(--dim);
}
.persist-badge {
  font-size: 10.5px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px;
  background: rgba(74, 222, 128, .16); color: #b6f5cf;
}

.kind-badge {
  font-size: 10.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
  background: var(--line); color: var(--dim);
  text-transform: uppercase; letter-spacing: .04em;
}

.offline-plan {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--raise);
  border: 1px solid var(--line);
}
.offline-plan-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px;
}
.offline-plan-head strong { font-size: 16px; font-weight: 700; }
.offline-plan-meta {
  font-size: 13px; color: var(--dim);
  margin: 8px 0 4px;
  font-family: "Overpass Mono", monospace;
}
.offline-plan-warning {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 176, 0, .1);
  border: 1px solid rgba(255, 176, 0, .35);
  color: #ffd47a;
  font-size: 12.5px; line-height: 1.5;
}
.offline-plan-warning.is-blocking {
  background: rgba(255, 74, 61, .1);
  border-color: rgba(255, 74, 61, .35);
  color: #ffb3ad;
}
.offline-plan-actions { display: flex; gap: 10px; margin-top: 12px; }
.offline-plan-actions .chip { flex: none; }
.offline-plan-actions .peek-go { flex: 1; height: 46px; }

.offline-progress {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--raise);
  border: 1px solid var(--ice-deep);
}
.offline-progress .storage-meta { align-items: center; }
.offline-progress .chip { padding: 6px 12px; font-size: 12px; }

.region-list { display: flex; flex-direction: column; gap: 9px; margin-top: 16px; }
.region-card {
  display: flex; align-items: center; gap: 12px;
  padding: 13px;
  border-radius: var(--radius);
  background: var(--raise);
  border-left: 3px solid var(--ice);
}
.region-icon {
  flex: none; width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--ice-deep); color: var(--ice);
  display: grid; place-items: center;
  font-size: 18px;
}
.region-body { flex: 1; min-width: 0; }
.region-name {
  font-weight: 600; font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.region-meta { font-size: 12px; color: var(--dim); margin-top: 2px; }
.region-delete {
  flex: none; width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--line); color: var(--dim);
  font-size: 15px;
}
.region-delete:active { background: rgba(255, 74, 61, .25); color: var(--alert); }

/* ─────────── Compte ─────────── */

.account-box {
  margin-bottom: 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.account-signed-in {
  display: flex; align-items: center; gap: 12px;
}
.account-avatar {
  flex: none; width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--amber), #c97e00);
  color: #16110a;
  display: grid; place-items: center;
  font-weight: 800; font-size: 17px;
}
.account-name { font-weight: 700; font-size: 16px; }
.account-sub { font-size: 12px; color: var(--dim); margin-top: 1px; }
.account-logout {
  margin-left: auto;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--line);
  font-size: 13px; font-weight: 600;
  color: var(--dim);
}

.account-places { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.place-row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px;
  border-radius: 11px;
  background: var(--raise);
}
.place-row .fav-glyph { font-size: 17px; }
.place-name { flex: 1; font-size: 14px; font-weight: 600; }
.place-remove { color: var(--faint); font-size: 13px; padding: 4px 8px; }

.auth-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.auth-tab {
  flex: 1; padding: 9px; border-radius: 9px;
  background: var(--raise); color: var(--dim);
  font-size: 13.5px; font-weight: 600;
}
.auth-tab.is-active { background: var(--line); color: var(--text); }

.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form input {
  height: 48px; padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--raise);
  font-size: 15.5px;
}
.auth-form input:focus { outline: none; border-color: var(--amber); }
.auth-error {
  font-size: 12.5px; color: #ffb3ad;
  padding: 9px 11px;
  border-radius: 9px;
  background: rgba(255, 74, 61, .1);
}
.auth-submit {
  height: 48px; border-radius: 11px;
  background: var(--amber); color: #16110a;
  font-weight: 800; font-size: 15px;
}
.auth-hint { font-size: 12px; color: var(--faint); text-align: center; margin-top: 2px; }

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

:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 6px; }
