/* Routeur road trip Movoo (app.html) — refonte de l'interface du 2026-10-15 (demande développeur :
   « professionnel, ergonomique, sexy, dans le même esprit que l'app Android »). Charte Material 3
   de l'app Android (ui/theme/Color.kt, Theme.kt) : forêt = marque et sélection, terracotta =
   action principale (Calculer), sable = fond, mousse = sélection, lac = information. Police
   Manrope. Mode sombre complet (préférence système ou choix dans Options › Apparence,
   js/theme-init.js). Les couleurs fonctionnelles (palette des jours, catégories POI dans
   js/state.js) ne changent pas.

   Trois dispositions :
   - ordinateur : carte plein écran, panneau à onglets flottant à gauche (escamotable) ;
   - tablette (html[data-client="tablet"]) : idem, panneau plus étroit ;
   - smartphone (html[data-client="mobile"], js/device-detect.js) : feuille du bas glissable
     (js/components/panel-tabs.js), mêmes onglets. */

:root {
  --bg: #F6F1E7;
  --surface: #FFFFFF;
  --surface-low: #FBF8F2;
  --surface-high: #F1EBDF;
  --surface-highest: #EAE3D5;
  --ink: #17201B;
  --muted: #5B655E;
  --line: #CBD3CC;
  --line-soft: #E4E8E1;
  --primary: #1F4D3A;
  --primary-strong: #163828;
  --on-primary: #FFFFFF;
  --primary-container: #DDEBDF;
  --on-primary-container: #0E2A1E;
  --accent: #C4541F;
  --accent-strong: #A84516;
  --on-accent: #FFFFFF;
  --accent-container: #F8DCCD;
  --on-accent-container: #4A1904;
  --lake: #2F6FB0;
  --lake-container: #DCE8F5;
  --on-lake-container: #0B2C4F;
  --danger: #B3261E;
  --danger-container: #F9DEDC;
  --on-danger-container: #410E0B;
  --warn-container: #FFF1D6;
  --on-warn-container: #5A3B00;
  --ok-container: #DDEBDF;
  --on-ok-container: #0E2A1E;
  --scrim: rgba(23, 32, 27, .45);
  --shadow-1: 0 1px 2px rgba(23, 32, 27, .10), 0 2px 10px rgba(23, 32, 27, .08);
  --shadow-2: 0 10px 34px rgba(23, 32, 27, .20), 0 2px 6px rgba(23, 32, 27, .08);
  --focus: #2F6FB0;
  --map-dim: none;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius-s: 10px;
  --radius-m: 14px;
  --radius-l: 22px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --panel-w: 404px;
  --gap: 12px;
  --peek-h: 156px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121814; --surface: #1A211D; --surface-low: #161D19; --surface-high: #232E27; --surface-highest: #2B372F;
    --ink: #E6ECE7; --muted: #A9B5AC; --line: #4A554D; --line-soft: #323C35;
    --primary: #8FD0A9; --primary-strong: #A8DDB9; --on-primary: #0E2A1E; --primary-container: #24412F; --on-primary-container: #A8DDB9;
    --accent: #E07A47; --accent-strong: #EB8F60; --on-accent: #121814; --accent-container: #6E2A0B; --on-accent-container: #F8DCCD;
    --lake: #9CC3EE; --lake-container: #1D3D5E; --on-lake-container: #DCE8F5;
    --danger: #F2B8B5; --danger-container: #8C1D18; --on-danger-container: #F9DEDC;
    --warn-container: #4A3A12; --on-warn-container: #FFE3A3;
    --ok-container: #24412F; --on-ok-container: #A8DDB9;
    --scrim: rgba(0, 0, 0, .6);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .5), 0 2px 10px rgba(0, 0, 0, .35);
    --shadow-2: 0 10px 34px rgba(0, 0, 0, .55);
    --focus: #9CC3EE;
    --map-dim: brightness(.82) contrast(1.05);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121814; --surface: #1A211D; --surface-low: #161D19; --surface-high: #232E27; --surface-highest: #2B372F;
  --ink: #E6ECE7; --muted: #A9B5AC; --line: #4A554D; --line-soft: #323C35;
  --primary: #8FD0A9; --primary-strong: #A8DDB9; --on-primary: #0E2A1E; --primary-container: #24412F; --on-primary-container: #A8DDB9;
  --accent: #E07A47; --accent-strong: #EB8F60; --on-accent: #121814; --accent-container: #6E2A0B; --on-accent-container: #F8DCCD;
  --lake: #9CC3EE; --lake-container: #1D3D5E; --on-lake-container: #DCE8F5;
  --danger: #F2B8B5; --danger-container: #8C1D18; --on-danger-container: #F9DEDC;
  --warn-container: #4A3A12; --on-warn-container: #FFE3A3;
  --ok-container: #24412F; --on-ok-container: #A8DDB9;
  --scrim: rgba(0, 0, 0, .6);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .5), 0 2px 10px rgba(0, 0, 0, .35);
  --shadow-2: 0 10px 34px rgba(0, 0, 0, .55);
  --focus: #9CC3EE;
  --map-dim: brightness(.82) contrast(1.05);
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.4; font-weight: 500;
  background: var(--bg); color: var(--ink); overflow: hidden;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--accent); color: var(--on-accent); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
label:has(> input.toggle-input:focus-visible), .mode-item:has(input:focus-visible), .poi-item:has(input:focus-visible),
.segmented label:has(input:focus-visible) { outline: 2.5px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.icon { width: 20px; height: 20px; flex-shrink: 0; }
h1, h2, h3, h4 { font-weight: 800; letter-spacing: -.01em; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; } }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border: 1px solid transparent; border-radius: 999px;
  font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, box-shadow .15s, transform .12s var(--ease), border-color .15s;
}
.btn:active { transform: scale(.98); }
.btn .icon { width: 18px; height: 18px; }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-tonal { background: var(--primary-container); color: var(--on-primary-container); }
.btn-tonal:hover { background: color-mix(in srgb, var(--primary-container) 80%, var(--primary)); }
.btn-outline { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-danger-text { background: transparent; color: var(--danger); }
.btn-danger-text:hover { background: var(--danger-container); color: var(--on-danger-container); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex-shrink: 0;
  border: none; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; font-weight: 700;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-high); color: var(--ink); }
.link-btn {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 6px 2px; border: none; background: none;
  color: var(--primary); font-weight: 700; font-size: 13px; cursor: pointer; text-align: left;
}
.link-btn .icon { width: 16px; height: 16px; }
.link-btn:hover { text-decoration: underline; }
.text-link { font-size: 13px; font-weight: 700; color: var(--primary); }

/* Boutons flottants (carte) */
.fab {
  display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px;
  border: none; border-radius: 16px; background: var(--surface); color: var(--ink); cursor: pointer;
  box-shadow: var(--shadow-1); transition: background .15s, color .15s, transform .12s var(--ease);
}
.fab:hover { background: var(--surface-high); }
.fab:active { transform: scale(.96); }
.fab-sm { width: 44px; height: 44px; border-radius: 14px; }
.fab-toggle { position: relative; }
.fab-toggle .toggle-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fab-toggle:has(.toggle-input:checked) { background: var(--accent); color: var(--on-accent); }

/* ---------- Structure plein écran ---------- */
.app-shell { position: fixed; inset: 0; overflow: hidden; }
#map { position: absolute; inset: 0; z-index: 0; background: var(--surface-high); }
#map .leaflet-tile-pane { filter: var(--map-dim); }
.leaflet-container { font-family: var(--font); }

/* Barre du haut */
.topbar {
  position: absolute; z-index: 1100; top: var(--gap); right: var(--gap); left: calc(var(--panel-w) + var(--gap) * 2);
  display: flex; align-items: flex-start; gap: 10px; pointer-events: none; transition: left .28s var(--ease);
}
.topbar > * { pointer-events: auto; }
.topbar-panel-open { display: none; }
body.panel-collapsed .topbar { left: var(--gap); }
body.panel-collapsed .topbar-panel-open { display: inline-flex; }

.search-box {
  position: relative; flex: 0 1 520px; min-width: 0; display: flex; align-items: center; gap: 6px;
  height: 52px; padding: 0 6px 0 16px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-1);
}
.search-box .search-icon { color: var(--primary); }
.search-box input {
  flex: 1; min-width: 0; height: 100%; border: none; outline: none; background: transparent;
  font-size: 16px; font-weight: 600; color: var(--ink);
}
.search-box input::placeholder { color: var(--muted); font-weight: 600; }
.search-box:focus-within { box-shadow: 0 0 0 2px var(--primary), var(--shadow-1); }
.search-add {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex-shrink: 0;
  border: none; border-radius: 12px; background: var(--primary-container); color: var(--on-primary-container); cursor: pointer;
}
.search-add:hover { background: var(--primary); color: var(--on-primary); }
.suggestions-list {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; display: none; max-height: min(320px, 50vh); overflow-y: auto;
  background: var(--surface); border-radius: var(--radius-m); box-shadow: var(--shadow-2); padding: 6px; z-index: 3000;
}
.suggestion-item {
  padding: 10px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.suggestion-item:hover, .suggestion-item:focus-visible { background: var(--primary-container); color: var(--on-primary-container); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.auth-status {
  display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 4px 0 14px; background: var(--surface);
  border-radius: 14px; box-shadow: var(--shadow-1); font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap;
}
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #8a8f94; flex-shrink: 0; }
.status-dot.status-dot-online { background: #3FA35B; box-shadow: 0 0 0 3px color-mix(in srgb, #3FA35B 25%, transparent); }
.user-menu { position: relative; }
.menu-pop {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 220px; padding: 6px; background: var(--surface);
  border-radius: var(--radius-m); box-shadow: var(--shadow-2); display: flex; flex-direction: column; z-index: 1300;
}
.menu-pop[hidden] { display: none; }
/* Menu ouvert : la barre du haut (contexte d'empilement z-index 1100) passe au-dessus du panneau
   du trajet (1200), sinon le menu s'ouvrait DERRIÈRE le panneau sur smartphone (2026-10-17). */
body.user-menu-open .topbar { z-index: 1250; }
.menu-pop a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--ink);
  text-decoration: none; font-weight: 700; font-size: 14px;
}
.menu-pop a .icon, .menu-pop .menu-auth .icon { color: var(--primary); }
.menu-pop a:hover, .menu-pop a:focus-visible, .menu-auth:hover { background: var(--surface-high); }
.menu-auth {
  display: none; align-items: center; gap: 10px; padding: 10px 12px; border: none; border-radius: 10px; background: none;
  color: var(--ink); font-weight: 800; font-size: 14px; cursor: pointer; text-align: left; border-bottom: 1px solid var(--line-soft);
}
.topbar-right:has(.status-dot-online) #btn-user-menu { box-shadow: var(--shadow-1), inset 0 0 0 2px #3FA35B; color: var(--primary); }

/* Boutons de carte (droite) */
.map-controls {
  position: absolute; z-index: 1100; right: var(--gap); top: calc(var(--gap) + 64px);
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
}
.layer-control {
  display: flex; align-items: center; gap: 6px; height: 48px; padding: 0 6px 0 14px; background: var(--surface);
  border-radius: 16px; box-shadow: var(--shadow-1); color: var(--ink); cursor: pointer;
}
.layer-control .icon { color: var(--primary); }
.layer-control select {
  max-width: 190px; height: 36px; padding: 0 8px; border: none; border-radius: 10px; background: var(--surface-high);
  color: var(--ink); font-size: 13px; font-weight: 700; cursor: pointer;
}
.zoom-slot .leaflet-control-zoom { border: none !important; box-shadow: var(--shadow-1); border-radius: 16px; overflow: hidden; margin: 0 !important; }
.zoom-slot .leaflet-control-zoom a {
  width: 48px !important; height: 44px !important; line-height: 44px !important; font-size: 22px !important; font-weight: 600;
  background: var(--surface) !important; color: var(--ink) !important; border-bottom: 1px solid var(--line-soft) !important;
}
.zoom-slot .leaflet-control-zoom a:last-child { border-bottom: none !important; }
.zoom-slot .leaflet-control-zoom a:hover { background: var(--surface-high) !important; }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--muted) !important; font-size: 10px; }
.leaflet-control-attribution a { color: var(--primary) !important; }
.locate-dot { width: 18px; height: 18px; border-radius: 50%; background: #2F6FB0; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(47, 111, 176, .25); }

/* Outils du mode édition (flottants) */
.edit-tools {
  position: absolute; z-index: 1100; top: calc(var(--gap) + 64px); right: calc(var(--gap) + 60px);
  flex-direction: column; gap: 6px; padding: 10px; background: var(--surface); border-radius: var(--radius-m); box-shadow: var(--shadow-2);
  animation: pop-in .18s var(--ease);
}
.edit-tools-title { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; padding: 2px 4px 6px; }
.edit-tools-title .icon { width: 16px; height: 16px; }
.edit-tool-btn {
  display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line-soft); border-radius: 12px;
  background: var(--surface-low); color: var(--ink); font-size: 13px; font-weight: 700; cursor: pointer; text-align: left;
}
.edit-tool-btn:hover { border-color: var(--line); }
.edit-tool-btn.active { background: var(--accent-container); color: var(--on-accent-container); border-color: var(--accent); }
.edit-tool-btn .icon { width: 18px; height: 18px; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }

.cursor-add { cursor: crosshair !important; }
.cursor-delete { cursor: not-allowed !important; }
.cursor-move { cursor: move !important; }

/* Profil d'élévation : tiroir bas repliable */
#elevation-container {
  position: absolute; z-index: 1050; left: calc(var(--panel-w) + var(--gap) * 2); right: calc(var(--gap) + 60px); bottom: var(--gap);
  height: 210px; display: none; flex-direction: column; gap: 6px; padding: 10px 12px 10px 16px;
  background: var(--surface); border-radius: var(--radius-l); box-shadow: var(--shadow-2); transition: left .28s var(--ease), height .22s var(--ease);
}
body.panel-collapsed #elevation-container { left: var(--gap); }
#elevation-container.collapsed { height: 56px; }
#elevation-container.collapsed .elevation-chart-wrapper { display: none; }
#elevation-container.collapsed .chevron { transform: rotate(180deg); }
.elevation-header { display: flex; align-items: center; gap: 10px; min-height: 36px; }
.elevation-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.elevation-title .icon { color: var(--primary); }
.elevation-title small { font-weight: 600; color: var(--muted); }
.elevation-stats {
  margin-left: auto; font-size: 12px; font-weight: 800; color: var(--on-accent-container); background: var(--accent-container);
  padding: 5px 10px; border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
@media (max-width: 1440px) { .elevation-title small { display: none; } }
.elevation-chart-wrapper { flex: 1; position: relative; min-height: 0; }
.chevron { transition: transform .2s var(--ease); }

/* ---------- Panneau du trajet ---------- */
.side-panel {
  position: absolute; z-index: 1200; top: var(--gap); left: var(--gap); bottom: var(--gap); width: var(--panel-w);
  display: flex; flex-direction: column; background: var(--surface); border-radius: 24px; box-shadow: var(--shadow-2);
  overflow: hidden; transition: transform .28s var(--ease), visibility 0s linear 0s;
}
body.panel-collapsed .side-panel { transform: translateX(calc(-100% - var(--gap) * 2)); visibility: hidden; transition: transform .28s var(--ease), visibility 0s linear .28s; }
.sheet-handle { display: none; }

.panel-header { display: flex; align-items: center; gap: 10px; padding: 14px 10px 10px 16px; }
.brand-mark { border-radius: 12px; flex-shrink: 0; }
.trip-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.eyebrow { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
#trip-name {
  width: 100%; min-width: 0; border: 1px solid transparent; border-radius: 8px; background: transparent; padding: 1px 4px; margin-left: -5px;
  font-size: 19px; font-weight: 800; letter-spacing: -.01em; color: var(--ink); text-overflow: ellipsis;
}
#trip-name:hover { border-color: var(--line-soft); }
#trip-name:focus { outline: none; border-color: var(--primary); background: var(--surface-low); }
.days-stepper { display: flex; align-items: center; gap: 2px; padding: 3px; background: var(--surface-high); border-radius: 999px; flex-shrink: 0; }
.days-stepper .icon-btn { width: 30px; height: 30px; color: var(--ink); }
.days-stepper .icon-btn .icon { width: 16px; height: 16px; }
.days-stepper .icon-btn:hover { background: var(--surface); }
.days-field { display: flex; flex-direction: column; align-items: center; line-height: 1; cursor: text; }
.days-field input {
  width: 30px; border: none; background: transparent; text-align: center; font-size: 16px; font-weight: 800; color: var(--ink);
  -moz-appearance: textfield; appearance: textfield;
}
.days-field input::-webkit-outer-spin-button, .days-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.days-field span { font-size: 10px; font-weight: 700; color: var(--muted); }
.panel-collapse { margin-left: -2px; }

.panel-tabs { display: flex; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--line-soft); }
.panel-tab {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0;
  padding: 8px 2px 9px; border: none; background: none; cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 700;
  border-radius: 12px 12px 0 0; transition: color .15s, background .15s;
}
.panel-tab .icon { width: 22px; height: 22px; padding: 2px 10px; box-sizing: content-box; border-radius: 999px; transition: background .2s var(--ease), color .15s; }
.panel-tab:hover { color: var(--ink); }
.panel-tab.active { color: var(--primary); }
.panel-tab.active .icon { background: var(--primary-container); color: var(--on-primary-container); }
.panel-tab.active::after { content: ""; position: absolute; left: 22%; right: 22%; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); }
.tab-badge {
  position: absolute; top: 4px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: var(--on-accent); font-size: 10px; font-weight: 800; line-height: 18px; text-align: center;
}
.tab-badge[hidden] { display: none; }

.panel-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 14px 18px; scroll-behavior: smooth; }
.tab-panel { display: flex; flex-direction: column; gap: 12px; animation: tab-in .2s var(--ease); }
.tab-panel[hidden] { display: none; }
@keyframes tab-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.panel-footer {
  display: flex; flex-direction: column; gap: 8px; padding: 10px 14px 14px; border-top: 1px solid var(--line-soft); background: var(--surface);
}
#status {
  padding: 8px 12px; border-radius: 12px; font-size: 12.5px; font-weight: 700; line-height: 1.35;
  max-height: 3.9em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.status-info { background: var(--lake-container); color: var(--on-lake-container); }
.status-warn { background: var(--warn-container); color: var(--on-warn-container); }
.status-ok { background: var(--ok-container); color: var(--on-ok-container); }
.status-err { background: var(--danger-container); color: var(--on-danger-container); }
.btn-calc { width: 100%; min-height: 52px; font-size: 16px; border-radius: 16px; }
.btn-calc .icon { width: 22px; height: 22px; }
.btn-spinner { width: 18px; height: 18px; border: 2.5px solid color-mix(in srgb, currentColor 35%, transparent); border-top-color: currentColor; border-radius: 50%; animation: spin .8s linear infinite; }

/* Cartes / sections */
.card { background: var(--surface-low); border: 1px solid var(--line-soft); border-radius: var(--radius-l); padding: 14px; }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; color: var(--ink); margin-bottom: 10px; }
.card-title .icon { width: 18px; height: 18px; color: var(--primary); }
.card-title small { font-weight: 600; color: var(--muted); font-size: 12px; }
.card-hint { font-size: 12.5px; color: var(--muted); margin: -4px 0 10px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section-head .card-title { margin-bottom: 0; }

/* Tuiles chiffrées */
.summary-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.summary-tile {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 16px; background: var(--surface-high);
}
.summary-tile .icon { width: 18px; height: 18px; color: var(--primary); margin-bottom: 2px; }
.summary-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.summary-tile b { font-size: 18px; font-weight: 800; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-tile.updated b { animation: value-in .4s var(--ease); }
@keyframes value-in { from { opacity: .2; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* Distance et temps par jour (G12, js/trip-days.js) : jours, liaisons comptées à part, tronçons */
.trip-days-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 4px 0; font-size: 13px; color: var(--ink); }
.trip-days-row > :first-child { min-width: 0; overflow-wrap: anywhere; }
.trip-days-value { white-space: nowrap; text-align: right; }
.trip-day { border-top: 1px solid var(--line-soft); padding-top: 8px; margin-top: 4px; font-size: 14px; }
.trip-days .card-title + .trip-day { border-top: 0; margin-top: 0; padding-top: 0; }
.trip-leg { padding-left: 10px; color: var(--muted); }
.trip-liaison { font-style: italic; color: var(--muted); font-size: 12.5px; }
.trip-days .card-hint { margin: 8px 0 0; }

/* Sélecteur d'activité en tuiles groupées */
.mode-group { display: flex; flex-direction: column; gap: 6px; }
.mode-group-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-top: 2px; }
.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mode-item {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 66px;
  padding: 8px 4px; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--line-soft); cursor: pointer; text-align: center;
  font-size: 12px; font-weight: 700; color: var(--ink); transition: border-color .15s, background .15s, transform .12s var(--ease);
}
.mode-item:hover { border-color: var(--line); }
.mode-item:active { transform: scale(.97); }
.mode-item input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mode-item .chip-icon { color: var(--muted); }
.mode-item .chip-icon .icon { width: 24px; height: 24px; }
.mode-item:has(input:checked) { background: var(--primary-container); border-color: var(--primary); color: var(--on-primary-container); }
.mode-item:has(input:checked) .chip-icon { color: var(--primary); }
.chip-label { line-height: 1.15; }
.mode-explain { margin-top: 10px; padding: 10px 12px; border-radius: 14px; background: var(--surface-high); font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.mode-explain:empty { display: none; }
.mode-explain .mode-hint { color: var(--ink); font-weight: 700; font-size: 13.5px; margin-bottom: 4px; }
.mode-explain h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); margin: 6px 0 2px; }

/* Actions secondaires en tuiles */
.action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.action-tile {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 8px; min-height: 74px; padding: 10px 12px;
  border-radius: 14px; border: 1px solid var(--line-soft); background: var(--surface); color: var(--ink); cursor: pointer; text-align: left;
  font-size: 13px; font-weight: 700; line-height: 1.2; transition: border-color .15s, background .15s, transform .12s var(--ease);
}
.action-tile small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); }
.action-tile .icon { color: var(--primary); }
.action-tile:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary-container) 35%, var(--surface)); }
.action-tile:active { transform: scale(.98); }
.action-tile-strong { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.action-tile-strong .icon { color: var(--on-primary); }
.action-tile-strong:hover { background: var(--primary-strong); color: var(--on-primary); }

/* Options dynamiques (évitements, gabarit, « Plus d'options ») — HTML généré par
   js/components/routing-controls.js et js/vehicle.js */
.dynamic-options-panel { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--ink); }
.dynamic-options-panel:empty::before { content: attr(data-empty); color: var(--muted); font-size: 12.5px; }
.dynamic-options-panel hr { border: none !important; border-top: 1px solid var(--line-soft) !important; margin: 8px 0 !important; }
.dynamic-options-panel > hr:first-child { display: none; }
.dynamic-options-panel label { display: flex; align-items: center; gap: 10px; min-height: 36px; font-size: 13px; font-weight: 600; cursor: pointer; }
.dynamic-options-panel input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); flex-shrink: 0; }
.dynamic-options-panel h4 { font-size: 12px; color: var(--primary); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.dynamic-options-panel .more-options { margin-top: 6px; border-top: 1px solid var(--line-soft); padding-top: 6px; }
.dynamic-options-panel .more-options summary { cursor: pointer; font-weight: 800; color: var(--primary); padding: 6px 0; }
.dynamic-options-panel small { color: var(--muted); }
#vehicle-panel { display: flex; flex-direction: column; gap: 2px; }
.vehicle-field { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 3px 0; }
.vehicle-field input {
  width: 92px; height: 34px; padding: 0 10px; text-align: right; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink);
}
.vehicle-field input::placeholder { color: var(--muted); font-style: italic; }
#vehicle-error { color: var(--danger) !important; }
.vehicle-disclaimer, .rb-vehicle-notice { background: var(--warn-container); color: var(--on-warn-container); border-left: 3px solid #E0A438; padding: 8px 10px; margin: 6px 0 0; border-radius: 8px; font-size: 12px; line-height: 1.4; }

/* Thème clair/sombre (segmented) */
.segmented { display: flex; padding: 3px; gap: 3px; background: var(--surface-high); border-radius: 999px; }
.segmented label { flex: 1; position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span { display: block; text-align: center; padding: 8px 6px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--muted); }
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* Étapes */
.wp-list { display: flex; flex-direction: column; gap: 8px; min-height: 64px; }
.wp-list:empty::before {
  content: attr(data-empty); display: block; padding: 18px 16px; border: 1.5px dashed var(--line); border-radius: var(--radius-m);
  color: var(--muted); font-size: 13px; text-align: center; line-height: 1.5;
}
.wp-item { display: flex; flex-direction: column; gap: 6px; padding: 10px 10px 10px 8px; background: var(--surface); border-radius: 16px; border: 1px solid var(--line-soft); box-shadow: 0 1px 0 var(--line-soft); }
.wp-item:hover { border-color: var(--line); }
.wp-item.sortable-ghost { opacity: .35; }
.wp-item.sortable-chosen { box-shadow: var(--shadow-2); }
.wp-item-row { display: flex; align-items: center; gap: 8px; }
.wp-item .drag-handle {
  cursor: grab; color: var(--muted); font-size: 16px; font-weight: 800; user-select: none; letter-spacing: -2px; padding: 4px 4px; touch-action: none;
}
.wp-item .wp-num { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; border-radius: 50%; background: var(--surface-high); font-weight: 800; font-size: 12px; }
.wp-item .wp-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wp-item select.wp-day-select { height: 30px; padding: 0 6px; font-size: 12px; font-weight: 700; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-low); color: var(--ink); }
.wp-label-input { height: 32px; padding: 0 10px; font-size: 12.5px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--surface-low); color: var(--ink); margin-left: 34px; width: calc(100% - 34px); }
.btn-danger {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; flex-shrink: 0;
  border: none; border-radius: 50%; background: transparent; color: var(--muted); font-size: 14px; font-weight: 800; cursor: pointer;
}
.btn-danger:hover { background: var(--danger-container); color: var(--on-danger-container); }
.legend { display: flex; gap: 8px 14px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; }
.legend-bar { width: 22px; height: 5px; border-radius: 3px; }

/* Points d'intérêt */
.poi-panel { background: var(--surface-low); border: 1px solid var(--line-soft); border-radius: var(--radius-l); padding: 14px; }
.poi-search-controls { display: flex; gap: 8px; margin-bottom: 6px; }
.poi-search-controls select { flex: 1; min-width: 0; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600; }
.poi-group-title { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 10px 0 6px; }
.poi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.poi-item {
  position: relative; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 10px 6px 6px; border-radius: 12px;
  background: var(--surface); border: 1.5px solid var(--line-soft); cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--ink);
  transition: border-color .15s, background .15s;
}
.poi-item:hover { border-color: var(--line); }
.poi-item input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-icon { display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background .15s, color .15s; }
.poi-item .chip-icon { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-high); color: var(--muted); }
.poi-item .chip-icon .icon { width: 17px; height: 17px; }
.poi-item.active { background: var(--accent-container); border-color: var(--accent); color: var(--on-accent-container); }
.poi-item.active .chip-icon { background: var(--accent); color: var(--on-accent); }
.poi-item-disabled { display: none; }
.poi-loading { font-size: 12px; color: var(--muted); text-align: center; padding: 6px; }
.poi-count { font-size: 11px; font-weight: 800; color: inherit; opacity: .8; margin-left: auto; }
.saved-poi-panel { background: var(--surface-low); }
.saved-poi-list { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow-y: auto; }
.saved-poi-item { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; background: var(--surface); border-radius: 12px; border: 1px solid var(--line-soft); font-size: 13px; }
.saved-poi-item:hover { border-color: var(--line); }
.saved-poi-item .poi-icon { font-size: 16px; }
.saved-poi-item .poi-name { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-poi-item .poi-remove { color: var(--danger); cursor: pointer; font-size: 14px; font-weight: 800; padding: 2px 6px; border-radius: 8px; }
.saved-poi-item .poi-remove:hover { background: var(--danger-container); }
.saved-poi-anchor { flex-basis: 100%; display: flex; gap: 6px; padding-left: 26px; }
.saved-poi-anchor:empty { display: none; }
.saved-poi-anchor select { height: 30px; font-size: 12px; padding: 0 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-low); color: var(--ink); min-width: 0; }
.saved-poi-anchor select:last-child { flex: 1; }

/* Cloud, balades partagées, coorganisation */
.cloud-panel { display: flex; flex-direction: column; }
#cloud-logged-in > * + * { margin-top: 10px; }
.cloud-hint { font-size: 13px; color: var(--muted); line-height: 1.5; margin-bottom: 10px; }
.cloud-empty { font-size: 13px; color: var(--muted); text-align: center; padding: 14px; border: 1.5px dashed var(--line); border-radius: var(--radius-m); }
#cloud-projects-list { display: flex; flex-direction: column; gap: 6px; }
.cloud-project-item { display: flex; align-items: center; gap: 6px; padding: 10px 8px 10px 12px; background: var(--surface); border-radius: 14px; border: 1px solid var(--line-soft); font-size: 13px; }
.cloud-project-item:hover { border-color: var(--line); }
.cloud-project-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.cloud-project-date { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.btn-cloud-open, .btn-cloud-delete, .btn-cloud-participants {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; flex-shrink: 0;
  border: none; border-radius: 10px; background: none; cursor: pointer;
}
.btn-cloud-open .icon, .btn-cloud-delete .icon, .btn-cloud-participants .icon { width: 17px; height: 17px; }
.btn-cloud-open, .btn-cloud-participants { color: var(--primary); }
.btn-cloud-open:hover, .btn-cloud-participants:hover, .btn-cloud-participants[aria-expanded="true"] { background: var(--primary-container); }
.btn-cloud-delete { color: var(--danger); }
.btn-cloud-delete:hover { background: var(--danger-container); }
.cloud-badge { font-size: 10.5px; font-weight: 800; color: var(--on-warn-container); background: var(--warn-container); border-radius: 999px; padding: 2px 8px; flex-shrink: 0; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cloud-current-info { font-size: 12.5px; line-height: 1.45; padding: 8px 10px; border-radius: 12px; background: var(--warn-container); color: var(--on-warn-container); }
.cloud-current-info[hidden] { display: none; }
.cloud-invitations-title { font-size: 12px; font-weight: 800; margin: 2px 0 6px; color: var(--on-warn-container); }
.cloud-invitation { padding: 10px; background: var(--warn-container); color: var(--on-warn-container); border-radius: 14px; margin-bottom: 6px; font-size: 13px; }
.cloud-invitation-meta { font-size: 12px; opacity: .85; margin: 2px 0 8px; }
.cloud-invitation-actions, .cloud-invite-form { display: flex; gap: 6px; flex-wrap: wrap; }
.cloud-invitation-actions button, .cloud-invite-form button {
  min-height: 32px; font-size: 12.5px; font-weight: 700; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
}
.cloud-invitation-actions .btn-accept, .cloud-invite-form button { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.cloud-invitation-actions .btn-decline { color: var(--danger); }
.cloud-participants { margin: -2px 0 6px; padding: 10px; background: var(--surface-high); border-radius: 0 0 14px 14px; font-size: 13px; }
.cloud-invite-form input { flex: 1; min-width: 0; height: 32px; font-size: 13px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); }
.cloud-participant { display: flex; align-items: center; gap: 6px; padding: 4px 0; }
.cloud-participant-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.cloud-participant-status { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; background: var(--surface-highest); }
.cloud-participant-status.accepted { background: var(--ok-container); color: var(--on-ok-container); }
.cloud-participant-status.declined { background: var(--danger-container); color: var(--on-danger-container); }
.cloud-role-select { height: 28px; font-size: 12px; padding: 0 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); max-width: 42%; }
.cloud-remote-change { font-size: 12.5px; line-height: 1.5; padding: 8px 10px; border-radius: 12px; background: var(--lake-container); color: var(--on-lake-container); }
.cloud-remote-change[hidden] { display: none; }
.cloud-remote-change button { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; border: none; background: var(--primary); color: var(--on-primary); cursor: pointer; }
.cloud-conflict-overlay { position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: center; justify-content: center; z-index: 4000; padding: 16px; }
.cloud-conflict-box { background: var(--surface); color: var(--ink); border-radius: var(--radius-l); padding: 18px; max-width: 480px; width: 100%; max-height: 85vh; overflow: auto; font-size: 13px; box-shadow: var(--shadow-2); }
.cloud-conflict-box h3 { margin: 0 0 6px; font-size: 17px; }
.cloud-conflict-box button { min-height: 36px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-high); color: var(--ink); font-weight: 700; cursor: pointer; }
.cloud-conflict-box .btn-conflict-confirm { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.cloud-conflict-item { border: 1px solid var(--line); border-radius: 12px; margin: 8px 0; padding: 8px 10px; }
.cloud-conflict-item legend { font-weight: 800; padding: 0 4px; }
.cloud-conflict-item label { display: block; padding: 3px 0; cursor: pointer; }

/* ---------- Fenêtres (modales) ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: var(--scrim); display: none; justify-content: center; align-items: center; z-index: 2000; padding: 16px;
  animation: fade-in .16s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal-content {
  width: 100%; max-width: 520px; max-height: min(86vh, 900px); display: flex; flex-direction: column; padding: 20px;
  background: var(--surface); color: var(--ink); border-radius: 26px; box-shadow: var(--shadow-2); animation: pop-in .2s var(--ease);
}
.modal-small { max-width: 420px; }
.modal-center { text-align: center; }
.modal-roadbook { max-width: 960px; height: min(88vh, 960px); }
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.modal-header h2 { display: flex; align-items: center; gap: 10px; font-size: 18px; }
.modal-header h2 .icon { color: var(--primary); }
.modal-form { display: flex; flex-direction: column; gap: 12px; font-size: 13.5px; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding-top: 12px; }
.modal-actions-between { justify-content: space-between; }
.insert-point { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 14px; background: var(--accent-container); color: var(--on-accent-container); }
.insert-point span { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; opacity: .8; }
.insert-point b { font-size: 14px; }
.form-group { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.form-group label { font-size: 12.5px; font-weight: 800; color: var(--ink); }
.form-group select, .form-group input { height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; font-size: 14px; background: var(--surface-low); color: var(--ink); }
.form-group select:focus, .form-group input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent); }
#router-login-feedback { padding: 8px 10px; border-radius: 10px; font-size: 12.5px; }
.password-field { position: relative; }
.password-field input { width: 100%; padding-right: 40px; }
.btn-toggle-password { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 16px; line-height: 1; padding: 6px 8px; border-radius: 8px; color: var(--muted); }
.btn-toggle-password:hover { color: var(--ink); }
.btn-toggle-password[aria-pressed="true"] { color: var(--primary); }
.qr-body { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.qr-body img { width: 220px; height: 220px; padding: 10px; border-radius: 18px; background: #fff; border: 1px solid var(--line-soft); }
.qr-body p { font-size: 13px; color: var(--muted); }
#track-import-list label, #track-import-chain-option label { display: block; padding: 4px 0; }
#track-import-chain-list { margin-top: 6px; padding-left: 18px; }

/* Road book : document « papier », lisible et imprimable (mêmes couleurs quel que soit le thème,
   le HTML généré par route-engine.js contient des fonds clairs en ligne). */
.rb-modal-body {
  flex: 1; overflow: auto; padding: 18px 20px; border-radius: 16px; background: #FFFDF8; color: #17201B; border: 1px solid #E4E8E1;
  font-size: 13px; line-height: 1.45;
}
.rb-modal-body h3 { font-size: 18px; color: #1F4D3A; margin-bottom: 6px; }
.rb-table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; margin-top: 8px; font-size: 12.5px; }
.rb-table th { background: #1F4D3A; color: #fff; padding: 8px 10px; position: sticky; top: -18px; font-weight: 800; }
.rb-table th:first-child { border-radius: 10px 0 0 0; }
.rb-table th:last-child { border-radius: 0 10px 0 0; }
.rb-table td { padding: 8px 10px; border-bottom: 1px solid #ECE6DA; vertical-align: top; }
.rb-table tr:nth-child(even) td { background: #FBF8F2; }
.rb-table td:first-child, .rb-table td > b:only-child { white-space: nowrap; }
.rb-signs { margin: 4px 0 0; padding-left: 18px; }
.rb-signs li { margin: 2px 0; }
.rb-sign { display: inline-block; background: #1d4f91; color: #fff; border-radius: 4px; padding: 1px 6px; font-weight: 700; }
.rb-poi-row td { background: #FFF6E3 !important; font-size: 12px; }

/* ---------- Carte : bulles, infobulles, marqueurs ---------- */
.leaflet-popup-content-wrapper { border-radius: 16px; box-shadow: var(--shadow-2); }
.leaflet-popup-content { font-family: var(--font); margin: 14px 16px; }
.poi-popup-btn { display: block; margin-top: 6px; padding: 7px 10px; background: #2F6FB0; color: #fff !important; border-radius: 10px; text-decoration: none; font-size: 11.5px; font-weight: 800; text-align: center; border: none; cursor: pointer; width: 100%; }
.btn-streetview { background: #1F4D3A; }
.btn-streetview:hover { background: #163828; }
.btn-add-project { display: block; margin-top: 6px; padding: 7px 10px; background: #C4541F; color: #fff !important; border-radius: 10px; font-size: 11.5px; font-weight: 800; text-align: center; border: none; cursor: pointer; width: 100%; }
.btn-add-project:hover { background: #A84516; }
.btn-add-project.added { background: #8A938C; }
.btn-remove-project { background: #B3261E !important; }
.btn-remove-project:hover { background: #8C1D18 !important; }
.weather-badge { display: inline-flex; align-items: center; justify-content: center; gap: 4px; background: #DCE8F5; color: #0B2C4F; padding: 5px 8px; border-radius: 8px; font-size: 11.5px; font-weight: 700; margin: 6px 0; width: 100%; }
.address-badge { font-size: 11px; color: #3D4741; background: #F1EBDF; padding: 5px 8px; border-radius: 8px; margin: 4px 0; display: block; text-align: left; line-height: 1.35; }
.fuel-prices-badge { font-size: 11px; color: #8C1D18; background: #F9DEDC; padding: 5px 8px; border-radius: 8px; margin: 4px 0; display: block; text-align: left; line-height: 1.35; font-weight: 700; }
.parking-details { font-size: 11px; color: #0D3C78; background: #E3ECFA; padding: 5px 8px; border-radius: 8px; margin: 4px 0; display: block; text-align: left; line-height: 1.45; }
.pharmacy-details { font-size: 11px; color: #1B5E20; background: #E8F5E9; padding: 5px 8px; border-radius: 8px; margin: 4px 0; display: block; text-align: left; line-height: 1.45; }
.camper-details { font-size: 11px; color: #004D40; background: #E0F2F1; padding: 5px 8px; border-radius: 8px; margin: 4px 0; display: block; text-align: left; line-height: 1.45; }
.camper-details a { color: #00695C; }
.parking-warning { font-size: 12px; color: #8C1D18; background: #F9DEDC; padding: 5px 8px; border-radius: 8px; margin: 4px 0; display: block; text-align: left; font-weight: 700; }
.poi-popup-img { max-width: 200px; max-height: 130px; border-radius: 10px; margin: 6px 0; display: block; }
.poi-addr-loading { font-size: 11px; color: #5B655E; font-style: italic; }
.trace-tooltip { font-size: 12px; background: #17201B; color: #fff; border-radius: 10px; padding: 7px 11px; border: none; box-shadow: 0 4px 12px rgba(0, 0, 0, .35); line-height: 1.45; font-family: var(--font); }
.trace-tooltip::before { display: none; }
.leaflet-div-icon { background: transparent !important; border: none !important; }

/* Indicateur de chargement des POI */
.poi-spinner-overlay { position: fixed; inset: 0; background: var(--scrim); display: none; justify-content: center; align-items: center; z-index: 5000; }
.poi-spinner { width: 48px; height: 48px; border: 4px solid color-mix(in srgb, #fff 35%, transparent); border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Tablette ---------- */
html[data-client="tablet"] { --panel-w: 336px; }
html[data-client="tablet"] #auth-status-text { display: none; }
html[data-client="tablet"] .layer-control select { max-width: 130px; }

/* Fenêtre d'ordinateur étroite : le panneau garde sa place à gauche (une fenêtre desktop
   redimensionnée reste « desktop », décision du 2026-10-04), recherche au-dessus. */
@media (max-width: 860px) {
  html[data-client="desktop"] { --panel-w: min(380px, calc(100vw - 24px)); }
  html[data-client="desktop"] #auth-status-text { display: none; }
  html[data-client="desktop"] .layer-control select { max-width: 120px; }
}
@media (max-width: 640px) {
  html[data-client="desktop"] .topbar { left: var(--gap); }
  html[data-client="desktop"] .side-panel { top: calc(var(--gap) + 62px); }
  html[data-client="desktop"] .map-controls { top: calc(var(--gap) + 124px); }
}

/* ---------- Smartphone : feuille du bas ---------- */
html[data-client="mobile"] { --gap: 10px; --peek-h: calc(150px + env(safe-area-inset-bottom)); }
html[data-client="mobile"] .topbar { left: var(--gap); top: calc(var(--gap) + env(safe-area-inset-top)); gap: 8px; }
html[data-client="mobile"] .topbar-panel-open { display: none !important; }
html[data-client="mobile"] .search-box { flex: 1 1 auto; height: 50px; padding-left: 14px; }
html[data-client="mobile"] .search-box input { font-size: 16px; }
/* Smartphone : la connexion passe par le menu Movoo (pastille verte sur le bouton si connecté). */
html[data-client="mobile"] .auth-status { display: none; }
html[data-client="mobile"] .menu-auth { display: flex; }
html[data-client="mobile"] .user-menu .fab-sm { width: 50px; height: 50px; }
html[data-client="mobile"] .map-controls { top: calc(var(--gap) + 66px + env(safe-area-inset-top)); }
/* Fond de carte : bouton rond, la liste native du téléphone s'ouvre au toucher. */
html[data-client="mobile"] .layer-control { position: relative; width: 46px; height: 46px; padding: 0; justify-content: center; }
html[data-client="mobile"] .layer-control select { position: absolute; inset: 0; width: 100%; max-width: none; height: 100%; opacity: 0; }
html[data-client="mobile"] .fab { width: 46px; height: 46px; }
html[data-client="mobile"] .zoom-slot .leaflet-control-zoom a { width: 46px !important; }
html[data-client="mobile"] .edit-tools { top: calc(var(--gap) + 66px + env(safe-area-inset-top)); left: var(--gap); right: calc(var(--gap) + 56px); }
html[data-client="mobile"] #elevation-container { left: var(--gap); right: var(--gap); bottom: calc(var(--peek-h) + 8px); height: 138px; padding: 6px 10px 6px 12px; gap: 2px; }
html[data-client="mobile"] .elevation-stats { font-size: 11px; padding: 4px 8px; }
html[data-client="mobile"] #elevation-container.collapsed { height: 52px; }
html[data-client="mobile"] .elevation-title-text { display: none; }
html[data-client="mobile"] .elevation-stats {
  margin-left: 0; flex: 1;
  /* Sur téléphone, le résumé (total, D+, D-, min, max) ne tient pas sur une ligne : deux lignes
     au plus plutôt qu'une coupure « Mi… » (retour du développeur, 2026-10-15). */
  white-space: normal; border-radius: 12px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
html[data-client="mobile"] #elevation-container { height: 150px; }

html[data-client="mobile"] .side-panel {
  top: auto; left: 0; right: 0; bottom: 0; width: auto; border-radius: 26px 26px 0 0; height: var(--peek-h);
  padding-bottom: env(safe-area-inset-bottom); transition: height .3s var(--ease); transform: none !important; visibility: visible !important;
}
html[data-client="mobile"] .side-panel[data-sheet="half"] { height: 58dvh; }
html[data-client="mobile"] .side-panel[data-sheet="full"] { height: calc(100dvh - 72px - env(safe-area-inset-top)); }
html[data-client="mobile"] .side-panel.dragging { transition: none; }
html[data-client="mobile"] .sheet-handle {
  display: flex; justify-content: center; align-items: center; width: 100%; height: 22px; flex-shrink: 0; border: none; background: none; cursor: grab; touch-action: none;
}
html[data-client="mobile"] .sheet-handle span { width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
html[data-client="mobile"] .side-panel[data-sheet="peek"] .panel-header,
html[data-client="mobile"] .side-panel[data-sheet="peek"] .panel-body { display: none; }
html[data-client="mobile"] .panel-header { padding: 4px 10px 8px 14px; }
html[data-client="mobile"] .panel-collapse { display: none; }
html[data-client="mobile"] .brand-mark { width: 30px; height: 30px; }
html[data-client="mobile"] #trip-name { font-size: 17px; }
html[data-client="mobile"] .panel-tab { font-size: 11px; padding: 4px 0 7px; }
html[data-client="mobile"] .panel-tab .icon { padding: 2px 8px; }
html[data-client="mobile"] .panel-footer { flex-direction: row-reverse; align-items: center; padding: 8px 12px 10px; }
html[data-client="mobile"] .panel-footer .btn-calc { width: auto; flex-shrink: 0; min-height: 46px; padding: 0 18px; font-size: 15px; }
html[data-client="mobile"] .panel-footer #status { flex: 1; min-width: 0; font-size: 12px; padding: 6px 10px; }
html[data-client="mobile"] .mode-item, html[data-client="mobile"] .poi-item { min-height: 48px; }
html[data-client="mobile"] .modal-overlay { align-items: flex-end; padding: 0; }
html[data-client="mobile"] .modal-content { max-width: none; border-radius: 26px 26px 0 0; max-height: 92dvh; padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); }
html[data-client="mobile"] .modal-roadbook { height: 92dvh; }
html[data-client="mobile"] .rb-modal-body { padding: 12px; }
html[data-client="mobile"] .leaflet-control-attribution { display: none; }

/* Boucle découverte (ligne D15, js/components/discovery-loop.js) */
.loop-card .segmented { margin-bottom: 10px; }
.loop-card .segmented span { padding: 8px 2px; font-size: 12.5px; }
.loop-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; font-size: 13px; font-weight: 700; color: var(--ink); }
.loop-row[hidden] { display: none; }
.loop-row select, .loop-row input { min-height: 36px; border: 1px solid var(--line); border-radius: 10px; padding: 4px 8px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; max-width: 62%; }
.loop-card > .btn-primary { width: 100%; justify-content: center; }
.loop-results { display: grid; gap: 8px; margin-top: 10px; }
.loop-results .card-hint { margin: 0; }
.loop-option { display: grid; grid-template-columns: 84px 1fr auto; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line-soft); border-radius: 14px; background: var(--surface); }
.loop-option.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.loop-preview { width: 84px; height: 59px; padding: 0; border: none; border-radius: 10px; background: var(--surface-high); color: var(--accent); cursor: pointer; }
.loop-preview svg { width: 100%; height: 100%; display: block; }
.loop-preview .loop-start-dot { fill: var(--primary); stroke: var(--surface); stroke-width: 1.5; }
.loop-stats { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 12.5px; color: var(--muted); }
.loop-stats b { font-size: 14px; color: var(--ink); }

@media print {
  .topbar, .map-controls, .side-panel, #elevation-container, .edit-tools { display: none !important; }
}

/* « Nouveau trajet » (onglet Trajet, 2026-10-25) : en bas de l'onglet, juste au-dessus de « Calculer ». */
.new-trip-row { display: flex; justify-content: flex-end; margin-top: 12px; }
