/* ==========================================================================
   EuroRail — Carte interactive train & bus en Europe
   Feuille de style principale
   ========================================================================== */

:root {
  /* Couleurs — palette principale */
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-muted: #f1efe8;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.16);

  --text: #1a1a1a;
  --text-muted: #5a5a55;
  --text-faint: #8a8a82;

  --accent: #d85a30;
  --accent-hover: #b94a26;
  --accent-soft: #faece7;
  --accent-text: #712b13;

  --info: #185fa5;
  --info-soft: #e6f1fb;
  --info-text: #0c447c;

  --success: #1d9e75;
  --success-soft: #e1f5ee;
  --success-text: #0f6e56;

  --danger: #c2384a;
  --danger-soft: #fcebeb;
  --danger-text: #791f1f;

  --warn: #b87814;
  --warn-soft: #faeeda;
  --warn-text: #854f0b;

  /* Bandes d'isochrones */
  --band-1: #4a1b0c;
  --band-2: #993c1d;
  --band-3: #d85a30;
  --band-4: #ef9f27;
  --band-5: #ba7517;
  --band-6: #534ab7;
  --band-7: #185fa5;
  --band-8: #0f6e56;
  --band-9: #04342c;

  /* Rayons & ombres */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 1px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.10), 0 4px 8px rgba(0, 0, 0, 0.04);
  --shadow-pop: 0 20px 50px rgba(0, 0, 0, 0.15);

  /* Typo */
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* Animation */
  --t-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-med: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 320ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --sidebar-width: 380px;
  --topbar-height: 64px;
  --footer-height: 48px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14141a;
    --surface: #1c1c24;
    --surface-elevated: #24242e;
    --surface-muted: #2a2a34;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);

    --text: #f0eee8;
    --text-muted: #a8a8a0;
    --text-faint: #6a6a62;

    --accent: #ef7d5c;
    --accent-hover: #f59672;
    --accent-soft: #3a1a10;
    --accent-text: #f5c4b3;

    --info: #6fa8e5;
    --info-soft: #142a44;
    --info-text: #b5d4f4;

    --success: #5dcaa5;
    --success-soft: #0f3326;
    --success-text: #9fe1cb;

    --danger: #e07585;
    --danger-soft: #3a1818;
    --danger-text: #f4a8b3;

    --warn: #efaf57;
    --warn-soft: #3a280a;
    --warn-text: #fac775;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
    --shadow-pop: 0 20px 50px rgba(0, 0, 0, 0.6);
  }
}

/* ==========================================================================
   Base & reset
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: 0;
  background: transparent;
  color: inherit;
}

input {
  font-family: inherit;
  font-size: inherit;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--t-fast);
}

a:hover {
  color: var(--accent-hover);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-faint);
}

/* ==========================================================================
   Topbar
   ========================================================================== */

.topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 1000;
  position: relative;
}

.topbar-inner {
  height: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: var(--shadow-sm);
}

.brand-text h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.1;
}

.brand-tag {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  letter-spacing: 0.02em;
}

.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-muted);
  padding: 4px;
  border-radius: var(--radius-md);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all var(--t-fast);
  position: relative;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.tab i {
  font-size: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  border-radius: 9px;
  margin-left: 2px;
}

/* ==========================================================================
   Layout principal
   ========================================================================== */

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 24px;
  gap: 16px;
  min-height: 0;
}

@media (max-width: 1099px) and (min-width: 700px) {
  .layout {
    grid-template-columns: var(--sidebar-width) 1fr;
  }
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

.sidebar {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
  max-height: calc(100vh - var(--topbar-height) - var(--footer-height) - 32px);
  box-shadow: var(--shadow-sm);
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-header h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.panel-header p {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   Search avec autocomplétion
   ========================================================================== */

.search {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  font-size: 16px;
  pointer-events: none;
}

.search input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  background: var(--surface-muted);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 13px;
  transition: all var(--t-fast);
  outline: none;
}

.search input::placeholder {
  color: var(--text-faint);
}

.search input:hover {
  background: var(--surface);
  border-color: var(--border);
}

.search input:focus {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  max-height: 220px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  display: none;
  padding: 4px;
}

.suggestions.show {
  display: block;
  animation: dropdown 160ms cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes dropdown {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sug-item {
  padding: 8px 10px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--t-fast);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.sug-item:hover {
  background: var(--surface-muted);
}

.sug-item i {
  font-size: 14px;
  color: var(--text-faint);
}

/* ==========================================================================
   Controls & sliders
   ========================================================================== */

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.control-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-transform: none;
  letter-spacing: 0;
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--surface-muted);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--accent);
  border: 3px solid var(--surface);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform var(--t-fast);
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--accent);
  border: 3px solid var(--surface);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

.slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-faint);
  margin-top: 2px;
  padding: 0 4px;
}

/* ==========================================================================
   Segmented control (Rapide / Train / Bus)
   ========================================================================== */

.segment {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  background: var(--surface-muted);
  border-radius: var(--radius-md);
}

.segment-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all var(--t-fast);
}

.segment-btn:hover {
  color: var(--text);
}

.segment-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.segment-btn i {
  font-size: 14px;
}

/* ==========================================================================
   Chips (filtres)
   ========================================================================== */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  transition: all var(--t-fast);
}

.chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.chip.active {
  background: var(--info-soft);
  border-color: var(--info);
  color: var(--info-text);
}

.chip i {
  font-size: 13px;
}

/* ==========================================================================
   Légende
   ========================================================================== */

.legend-wrap {
  background: var(--surface-muted);
  border-radius: var(--radius-md);
  padding: 12px;
}

.legend-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

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

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text);
}

.legend-swatch {
  width: 14px;
  height: 10px;
  border-radius: 3px;
}

/* ==========================================================================
   Stats cards
   ========================================================================== */

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat {
  background: var(--surface-muted);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
}

.stat-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

/* ==========================================================================
   Map area
   ========================================================================== */

.map-area {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  min-height: 500px;
}

#map {
  width: 100%;
  height: 100%;
  min-height: calc(100vh - var(--topbar-height) - var(--footer-height) - 32px);
}

@media (max-width: 1099px) and (min-width: 700px) {
  #map {
    min-height: 60vh;
  }
}

.map-hint {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  box-shadow: var(--shadow-md);
  z-index: 500;
  animation: slideDown 320ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

.map-hint.hidden {
  display: none;
}

.map-hint > i {
  color: var(--info);
  font-size: 16px;
  flex-shrink: 0;
}

.map-hint span {
  flex: 1;
}

.hint-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--t-fast);
  flex-shrink: 0;
}

.hint-close:hover {
  background: var(--surface-muted);
  color: var(--text);
}

/* ==========================================================================
   Leaflet overrides
   ========================================================================== */

.leaflet-container {
  background: var(--surface-muted);
  font-family: var(--font);
}

.leaflet-control-zoom {
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-md) !important;
  border-radius: var(--radius-md) !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
  transition: background var(--t-fast) !important;
}

.leaflet-control-zoom a:hover {
  background: var(--surface-muted) !important;
}

.leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.8) !important;
  font-size: 10px !important;
  padding: 2px 8px !important;
}

@media (prefers-color-scheme: dark) {
  .leaflet-control-attribution {
    background: rgba(28, 28, 36, 0.8) !important;
    color: var(--text-muted) !important;
  }
  .leaflet-control-attribution a {
    color: var(--text-muted) !important;
  }
  .leaflet-tile {
    filter: brightness(0.8) saturate(0.7) hue-rotate(180deg) invert(0.92);
  }
}

.leaflet-popup-content-wrapper {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-pop) !important;
  border: 1px solid var(--border) !important;
  padding: 0 !important;
}

.leaflet-popup-content {
  margin: 14px 16px !important;
  font-family: var(--font) !important;
  font-size: 13px !important;
  line-height: 1.4 !important;
  min-width: 200px;
}

.leaflet-popup-tip {
  background: var(--surface) !important;
  box-shadow: var(--shadow-md) !important;
}

.leaflet-popup-close-button {
  color: var(--text-muted) !important;
  font-size: 18px !important;
  padding: 6px 8px 0 0 !important;
}

.pop-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.pop-meta {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 6px;
}

.pop-time {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.pop-mode {
  font-size: 11px;
  color: var(--text-muted);
}

.pop-dist {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.pop-night {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 3px 8px;
  background: var(--warn-soft);
  color: var(--warn-text);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
}

.pop-unreachable {
  color: var(--text-faint);
  font-size: 12px;
  font-style: italic;
  margin-top: 4px;
}

.pop-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.pop-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--t-fast);
  font-family: var(--font);
}

.pop-btn.primary {
  background: var(--accent);
  color: #fff;
}

.pop-btn.primary:hover {
  background: var(--accent-hover);
}

.pop-btn.secondary {
  background: var(--surface-muted);
  color: var(--text);
}

.pop-btn.secondary:hover {
  background: var(--border);
}

.pop-btn i {
  font-size: 14px;
}

.station-marker-origin {
  background: var(--text);
  border: 3px solid var(--surface);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  box-shadow: 0 0 0 2px var(--text), var(--shadow-md);
}

.station-marker-route {
  background: var(--accent);
  border: 2.5px solid var(--surface);
  border-radius: 50%;
  width: 16px;
  height: 16px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
}

.station-marker-city {
  border: 1.5px solid var(--surface);
  border-radius: 50%;
  width: 11px;
  height: 11px;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.2);
}

.station-marker-faint {
  background: var(--text-faint);
  border: 1px solid var(--surface);
  border-radius: 50%;
  width: 6px;
  height: 6px;
  opacity: 0.4;
}

.station-marker-hidden {
  background: var(--text-faint);
  border: 1px solid var(--surface);
  border-radius: 50%;
  width: 4px;
  height: 4px;
  opacity: 0.15;
}

.station-marker-reachable {
  background: var(--accent);
  border: 1.5px solid var(--surface);
  border-radius: 50%;
  width: 11px;
  height: 11px;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   Route panel — itinéraire
   ========================================================================== */

.route-display {
  background: var(--surface-muted);
  border-radius: var(--radius-md);
  padding: 12px;
  min-height: 80px;
}

.route-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 16px;
  gap: 8px;
}

.route-empty > i {
  font-size: 28px;
  color: var(--text-faint);
}

.route-empty p {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.route-empty span {
  font-size: 11px;
  color: var(--text-muted);
  max-width: 240px;
}

.route-list {
  display: flex;
  flex-direction: column;
}

.route-stop {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all var(--t-fast);
  position: relative;
  z-index: 2;
}

.route-stop:hover {
  border-color: var(--border-strong);
}

.route-stop-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.route-stop-stay {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px 6px 36px;
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-muted);
  position: relative;
}

.route-stop-stay-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.route-stop-stay-label i {
  font-size: 14px;
  color: var(--accent);
}

.stay-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.stay-btn {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  transition: all var(--t-fast);
}

.stay-btn:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.stay-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.stay-value {
  min-width: 56px;
  text-align: center;
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
}

.stop-num {
  background: var(--accent);
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.stop-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.stop-actions {
  display: flex;
  gap: 2px;
}

.stop-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--t-fast);
  font-size: 14px;
}

.stop-btn:hover:not(:disabled) {
  background: var(--surface-muted);
  color: var(--text);
}

.stop-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.stop-btn.remove:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.segment-info {
  margin: 6px 0;
  padding: 10px 12px 10px 22px;
  font-size: 12px;
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.segment-info::before {
  content: '';
  position: absolute;
  left: 22px;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: linear-gradient(to bottom, var(--border-strong), var(--border));
}

.seg-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.seg-mode-badge.train {
  background: var(--info-soft);
  color: var(--info-text);
}

.seg-mode-badge.bus {
  background: var(--success-soft);
  color: var(--success-text);
}

.seg-mode-badge.mixed {
  background: var(--warn-soft);
  color: var(--warn-text);
}

.seg-mode-badge.none {
  background: var(--danger-soft);
  color: var(--danger-text);
}

.seg-mode-badge i {
  font-size: 12px;
}

.seg-time {
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
}

.seg-detail {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
  text-align: right;
}

#route-totals {
  margin-top: 4px;
}

.totals {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent-soft), var(--info-soft));
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.total-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.total-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.total-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.total-value.accent {
  color: var(--accent);
}

.route-actions {
  display: flex;
  gap: 8px;
}

.btn-secondary,
.btn-danger {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  transition: all var(--t-fast);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--surface-muted);
  border-color: var(--border-strong);
}

.btn-danger {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--border);
}

.btn-danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

.btn-secondary i,
.btn-danger i {
  font-size: 14px;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  height: var(--footer-height);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer p {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  max-width: 800px;
  line-height: 1.5;
}

/* ==========================================================================
   Responsive — mobile
   ========================================================================== */

/* ==========================================================================
   Responsive — Tablette (700-1099px)
   Sidebar plus compacte mais toujours à gauche
   ========================================================================== */

@media (max-width: 1099px) and (min-width: 700px) {
  :root {
    --sidebar-width: 320px;
  }

  .layout {
    padding: 12px;
    gap: 12px;
  }

  .sidebar {
    padding: 16px;
  }

  .panel {
    gap: 16px;
  }

  .panel-header h2 {
    font-size: 15px;
  }

  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Compacter les boutons d'action */
  .route-actions .btn-secondary span,
  .route-actions .btn-danger span {
    font-size: 11px;
  }
}

/* ==========================================================================
   Responsive — Mobile (< 700px)
   Drawer bottom-sheet en 3 positions : fermé (peek) / mid / plein
   ========================================================================== */

@media (max-width: 699px) {

  /* --- Layout : carte plein écran sous la topbar --- */
  body {
    overflow: hidden; /* empêche le scroll de body, le drawer scrollera */
  }

  .layout {
    display: block;
    padding: 0;
    margin: 0;
    height: calc(100vh - var(--topbar-height));
    height: calc(100dvh - var(--topbar-height)); /* support 100dvh quand dispo */
    position: relative;
    max-width: none;
  }

  /* Topbar plus compacte */
  .topbar-inner {
    padding: 0 12px;
    gap: 8px;
  }
  .brand-text {
    display: none;
  }
  .brand-logo {
    width: 36px;
    height: 36px;
    font-size: 19px;
  }
  .tab span:not(.badge) {
    display: none;
  }
  .tab {
    padding: 8px 10px;
  }
  .tab i {
    font-size: 17px;
  }

  /* Map en arrière-plan, plein écran sous topbar */
  .map-area {
    position: absolute;
    inset: 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
    z-index: 1;
  }

  #map {
    min-height: 0;
    height: 100%;
  }

  /* Le footer disparaît sur mobile, son contenu va en bas du drawer */
  .footer {
    display: none;
  }

  /* Hint moins intrusif */
  .map-hint {
    top: 10px;
    left: 10px;
    right: 10px;
    font-size: 11px;
    padding: 8px 10px;
  }

  /* --- DRAWER : la sidebar devient une bottom sheet --- */
  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    max-width: none;
    max-height: 85vh;
    max-height: 85dvh;
    border-radius: 18px 18px 0 0;
    border: 0;
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.12), 0 -2px 6px rgba(0, 0, 0, 0.06);
    z-index: 1500;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;

    /* Animation entre les 3 positions */
    transform: translateY(var(--drawer-translate, calc(100% - 124px)));
    transition: transform 320ms cubic-bezier(0.32, 0.72, 0.24, 1);
  }

  /* Trois positions du drawer pilotées par data-drawer-state sur body */
  body[data-drawer-state="peek"] .sidebar {
    --drawer-translate: calc(100% - 124px);
  }
  body[data-drawer-state="mid"] .sidebar {
    --drawer-translate: 40vh;
  }
  body[data-drawer-state="full"] .sidebar {
    --drawer-translate: 0;
  }

  /* En cours de drag (utilise une variable inline) */
  .sidebar.dragging {
    transition: none;
    --drawer-translate: var(--drag-translate);
  }

  /* Poignée du drawer (visible uniquement sur mobile) */
  .sidebar-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 28px;
    flex-shrink: 0;
    cursor: grab;
    background: transparent;
    border: 0;
    padding: 10px 0 4px;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
  }

  .sidebar-handle:active {
    cursor: grabbing;
  }

  .sidebar-handle-bar {
    width: 40px;
    height: 4px;
    background: var(--border-strong);
    border-radius: 2px;
    transition: background var(--t-fast), width var(--t-fast);
  }

  .sidebar-handle:hover .sidebar-handle-bar,
  .sidebar-handle:active .sidebar-handle-bar {
    background: var(--text-faint);
    width: 56px;
  }

  /* Panel scrollable à l'intérieur du drawer */
  .panel {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 16px 24px;
    gap: 16px;
    flex: 1;
    min-height: 0;
  }

  /* Padding bas augmenté pour ne pas être masqué par les boutons système */
  .panel:last-of-type {
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }

  .panel-header {
    padding-top: 4px;
  }
  .panel-header h2 {
    font-size: 17px;
  }
  .panel-header p {
    font-size: 12px;
  }

  /* Bouton flottant pour rouvrir le panneau si masqué */
  .fab-toggle {
    position: absolute;
    right: 12px;
    bottom: 134px; /* au-dessus du peek de 124px */
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 24px;
    padding: 10px 14px 10px 12px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    z-index: 1000;
    transition: opacity var(--t-fast), transform var(--t-fast);
  }

  .fab-toggle i {
    font-size: 17px;
    color: var(--accent);
  }

  .fab-toggle:active {
    transform: scale(0.95);
  }

  /* Le FAB se masque quand le drawer n'est pas en peek */
  body[data-drawer-state="mid"] .fab-toggle,
  body[data-drawer-state="full"] .fab-toggle {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
  }

  /* Stats compactées : 3 colonnes serrées */
  .stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .stat {
    padding: 10px 6px;
  }
  .stat-value {
    font-size: 17px;
  }

  /* Summary : 2 colonnes même sur mobile */
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .summary-value {
    font-size: 16px;
  }

  /* Actions itinéraire en grille 2 cols pour ne pas déborder */
  .route-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .route-actions .btn-secondary,
  .route-actions .btn-danger {
    flex: 0;
    min-width: 0;
    padding: 10px 8px;
  }
  .route-actions .btn-secondary span,
  .route-actions .btn-danger span {
    font-size: 11px;
  }

  /* Étapes de route plus compactes */
  .route-stop {
    padding: 10px 12px;
  }
  .stop-name {
    font-size: 14px;
  }

  /* Modale plein écran sur mobile */
  .modal-backdrop {
    padding: 0;
  }
  .modal {
    max-width: none;
    max-height: 100vh;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    margin: 0;
  }

  /* Tooltips Leaflet plus larges au tap */
  .leaflet-popup-content {
    min-width: 180px;
    font-size: 13px !important;
  }

  /* Toast plus haut pour éviter le drawer */
  .toast,
  .mini-toast {
    bottom: 140px;
  }
}

/* ==========================================================================
   Très petits écrans (< 380px) — encore plus compact
   ========================================================================== */

@media (max-width: 379px) {
  .topbar-inner {
    padding: 0 10px;
  }
  .brand-logo {
    width: 32px;
    height: 32px;
    font-size: 17px;
  }
  .tab {
    padding: 7px 8px;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .route-actions {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Reset des composants desktop sur mobile : poignée et FAB invisibles >= 700px
   ========================================================================== */

@media (min-width: 700px) {
  .sidebar-handle,
  .fab-toggle {
    display: none !important;
  }
}

/* ==========================================================================
   Nouveaux composants : dates, partage, optimisation, comparaison, récap
   ========================================================================== */

/* --- Bouton accessoire dans control-label (croix d'effacement, etc.) --- */
.control-action {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  font-size: 11px;
  transition: all var(--t-fast);
}
.control-action:hover {
  background: var(--surface-muted);
  color: var(--text);
}
.control-action i {
  font-size: 13px;
}

/* --- Champs date et heure --- */
.date-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 8px;
}
.date-input,
.time-input {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font);
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  color-scheme: light dark;
}
.date-input:hover,
.time-input:hover {
  border-color: var(--border-strong);
}
.date-input:focus,
.time-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.date-input::-webkit-calendar-picker-indicator,
.time-input::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.6;
}
.date-input::-webkit-calendar-picker-indicator:hover,
.time-input::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* --- Pour l'étape : affichage des dates calculées --- */
.route-stop-dates {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  margin-top: 4px;
  border-top: 1px dashed var(--border);
  font-size: 11px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.route-stop-dates .date-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  font-weight: 500;
  color: var(--text);
}
.route-stop-dates .date-chip.arrival {
  background: var(--info-soft);
  color: var(--info-text);
}
.route-stop-dates .date-chip.departure {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.route-stop-dates .date-chip i {
  font-size: 11px;
}
.route-stop-dates .date-arrow {
  color: var(--text-faint);
}

/* --- Badge train de nuit dans le segment-info --- */
.seg-mode-badge.night {
  background: linear-gradient(135deg, #2a2360 0%, #534ab7 100%);
  color: #f0eee8;
  border-color: #534ab7;
}
.seg-mode-badge.night i {
  color: #f0eee8;
}
.seg-night-saved {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--info-soft);
  color: var(--info-text);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  margin-left: 4px;
}
.seg-night-saved i {
  font-size: 11px;
}

/* --- Récapitulatif détaillé --- */
#route-summary {
  margin-top: 8px;
}
.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
}
.summary-card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.summary-card-title i {
  font-size: 13px;
  color: var(--accent);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 12px;
}
.summary-row:last-child {
  border-bottom: none;
}
.summary-row-label {
  color: var(--text-muted);
}
.summary-row-value {
  font-weight: 600;
  color: var(--text);
}
.summary-row-value.accent {
  color: var(--accent);
}
.summary-row-value.success {
  color: var(--success-text);
}
.summary-row-value.warn {
  color: var(--warn-text);
}
.summary-row-value.danger {
  color: var(--danger);
}

/* Sous-valeur (par ex. « 6h30 dont 2h en train de nuit ») */
.summary-row-sub {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-faint);
  margin-left: 4px;
}

/* Liste de chips à l'intérieur du récap (modes utilisés, opérateurs…) */
.summary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text);
}
.summary-chip i {
  font-size: 11px;
}
.summary-chip.train { background: var(--info-soft); color: var(--info-text); }
.summary-chip.bus   { background: var(--success-soft); color: var(--success-text); }
.summary-chip.night { background: #2a2360; color: #f0eee8; }

/* Barre de progression train/bus */
.summary-bar {
  display: flex;
  height: 8px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: 6px;
  background: var(--surface-muted);
}
.summary-bar-seg {
  height: 100%;
  transition: width var(--t-med);
}
.summary-bar-seg.train { background: var(--info); }
.summary-bar-seg.bus   { background: var(--success); }
.summary-bar-seg.night { background: #534ab7; }
.summary-bar-legend {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Calendrier compact des étapes */
.summary-calendar {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}
.summary-cal-row {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 10px;
  font-size: 11px;
  align-items: baseline;
  padding: 4px 0;
}
.summary-cal-date {
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.summary-cal-text {
  color: var(--text);
  line-height: 1.4;
}
.summary-cal-text .sub {
  color: var(--text-muted);
  font-size: 10px;
}

/* --- Boutons primaire (modale) --- */
.btn-primary {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  cursor: pointer;
  transition: all var(--t-fast);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn-primary i {
  font-size: 14px;
}

/* --- Mini-toast --- */
.mini-toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--success-soft);
  color: var(--success-text);
  border: 1px solid var(--success);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 500;
  margin-top: 8px;
  animation: toast-in var(--t-med);
}
.mini-toast.error {
  background: var(--danger-soft);
  color: var(--danger-text);
  border-color: var(--danger);
}
.mini-toast.info {
  background: var(--info-soft);
  color: var(--info-text);
  border-color: var(--info);
}
.mini-toast i {
  font-size: 14px;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Modale (utilisée pour l'optimisation TSP)
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in var(--t-med);
}
.modal-backdrop[hidden] { display: none; }

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

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modal-in var(--t-slow);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.modal-header h3 i {
  color: var(--accent);
  font-size: 18px;
}
.modal-close {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--t-fast);
}
.modal-close:hover {
  background: var(--surface-muted);
  color: var(--text);
}
.modal-close i {
  font-size: 18px;
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  flex: 1;
}
.modal-intro {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.optimize-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}
.opt-stop-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--t-fast);
}
.opt-stop-row.locked {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.opt-stop-num {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 600;
  border-radius: 50%;
  flex-shrink: 0;
}
.opt-stop-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.opt-lock {
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all var(--t-fast);
}
.opt-lock:hover {
  background: var(--surface);
  color: var(--text);
}
.opt-lock.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.opt-lock i {
  font-size: 12px;
}

.optimize-preview {
  margin-top: 14px;
  padding: 12px;
  background: var(--surface-muted);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.optimize-preview-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.optimize-preview-stops {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}
.optimize-preview-stop {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text);
}
.optimize-preview-arrow {
  color: var(--text-faint);
  font-size: 11px;
  align-self: center;
}
.optimize-preview-result {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.optimize-preview-saved {
  color: var(--success-text);
  font-weight: 600;
}
.optimize-preview-saved.no-gain {
  color: var(--text-muted);
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  background: var(--surface-muted);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ==========================================================================
   Onglet Comparer
   ========================================================================== */

.compare-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}
.compare-empty > i {
  font-size: 40px;
  margin-bottom: 12px;
  color: var(--text-faint);
}
.compare-empty p {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.compare-empty span {
  font-size: 12px;
  line-height: 1.5;
  max-width: 280px;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
@media (max-width: 480px) {
  .compare-grid {
    grid-template-columns: 1fr;
  }
}
.compare-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  transition: all var(--t-fast);
}
.compare-card.winner {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}
.compare-card.unreachable {
  opacity: 0.5;
}
.compare-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.compare-card-header i {
  font-size: 14px;
}
.compare-card.train .compare-card-header i { color: var(--info); }
.compare-card.bus   .compare-card-header i { color: var(--success); }
.compare-card.mixed .compare-card-header i { color: var(--accent); }

.compare-card-time {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.compare-card.winner .compare-card-time {
  color: var(--accent);
}
.compare-card-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  padding-top: 4px;
  border-top: 1px dashed var(--border);
}
.compare-card-row strong {
  color: var(--text);
  font-weight: 600;
}
.compare-card-badge {
  position: absolute;
  top: -8px;
  right: 8px;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.compare-winner-wrap {
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--accent-soft), var(--info-soft));
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 12px;
}
.compare-winner-wrap strong { color: var(--accent); }
.compare-winner-wrap i {
  font-size: 14px;
  color: var(--accent);
  margin-right: 4px;
  vertical-align: -2px;
}

.compare-co2-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  padding: 8px 0;
}
.compare-co2-note i {
  flex-shrink: 0;
  color: var(--success);
  font-size: 13px;
  margin-top: 1px;
}

/* ==========================================================================
   Ajustements responsive complémentaires
   ========================================================================== */

@media (max-width: 700px) {
  .date-row {
    grid-template-columns: 1fr 1fr;
  }
  .compare-grid {
    grid-template-columns: 1fr;
  }
  .modal {
    max-height: 95vh;
  }
  .modal-body {
    padding: 16px;
  }
  .modal-header { padding: 14px 16px; }
  .modal-footer { padding: 12px 16px; }
}
