@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

/* ══ CHARTE PLEINSMALINS — Blanc cassé + Bleu marine ══════════════════════ */
:root {
    --bg: #F0F4FA;
    --surface: #FFFFFF;
    --surface2: #F8FAFD;
    --border: #E2E8F0;
    --accent: #2563EB;
    /* bleu marine premium */
    --accent2: #0F4DA8;
    /* bleu foncé hover */
    --accent3: #64748B;
    /* gris ardoise */
    --text: #1A2744;
    /* marine profond */
    --muted: #94A3B8;
    --danger: #DC2626;
    --success: #16A34A;
    --pm-light: #EFF6FF;
    /* bleu très clair — surfaces premium */
    --pm-mid: #BFDBFE;
    /* bleu clair — bordures premium */
}

/* ── MODE SOMBRE (conservé pour compatibilité) ── */
[data-theme="dark"] {
    --bg: #0d0f14;
    --surface: #151820;
    --surface2: #1c2030;
    --border: #252a3a;
    --accent: #3B82F6;
    --accent2: #2563EB;
    --accent3: #7b8cff;
    --text: #e8eaf6;
    --muted: #6b7280;
    --danger: #ff4d4d;
    --pm-light: rgba(59, 130, 246, 0.12);
    --pm-mid: rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] header {
    background: rgba(13, 15, 20, 0.97);
}

[data-theme="dark"] .sidebar {
    background: var(--surface);
}

/* Bouton toggle thème */
.theme-toggle {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.28rem 0.7rem;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--muted);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ── Auth / Compte ── */
.auth-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.28rem 0.65rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface2);
    font-size: 0.62rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--muted);
}

.auth-bar.connected {
    border-color: rgba(79, 255, 176, 0.35);
    color: var(--accent);
}

.auth-bar:hover {
    border-color: var(--accent3);
    color: var(--accent3);
}

.auth-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
}

/* ── Modal auth ── */
.auth-modal .modal {
    max-width: 380px;
    text-align: center;
}

.auth-google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.75rem;
    margin: 0.8rem 0 0.4rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    color: #333;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-google-btn:hover {
    background: #f5f5f5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.auth-google-btn img {
    width: 18px;
    height: 18px;
}

.auth-divider {
    color: var(--muted);
    font-size: 0.6rem;
    margin: 0.5rem 0;
}

.auth-email-form input {
    width: 100%;
    padding: 0.55rem 0.7rem;
    margin-bottom: 0.4rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.72rem;
}

.auth-email-form button {
    width: 100%;
    padding: 0.6rem;
    background: var(--accent3);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.auth-email-form button:hover {
    background: #6272ff;
}

/* ── Indicateur sync ── */
.sync-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.58rem;
    padding: 0.15rem 0.45rem;
    border-radius: 10px;
    border: 1px solid rgba(79, 255, 176, 0.25);
    color: var(--accent);
    background: rgba(79, 255, 176, 0.06);
}

.sync-badge.local {
    border-color: rgba(251, 191, 36, 0.3);
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.06);
}

.sync-badge.syncing {
    border-color: rgba(123, 140, 255, 0.3);
    color: var(--accent3);
    background: rgba(123, 140, 255, 0.06);
}

/* ── Mode carte légère (plein au départ) ── */
#map-container.light-map-active {
    opacity: 1 !important;
    pointer-events: all !important;
    z-index: 20 !important;
}

/* ── Sélecteur 3 modes stratégie ── */
/* ── Sélecteur 3 modes stratégie ── */
.strategy-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.strategy-btn {
    position: relative;
    padding: 0.85rem 0.4rem 0.7rem;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: var(--surface2);
    cursor: pointer;
    text-align: center;
    transition: all 0.22s cubic-bezier(.4, 0, .2, 1);
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.strategy-btn:hover {
    border-color: rgba(37, 99, 235, 0.4);
    background: var(--pm-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.1);
}

.strategy-btn.active {
    border-color: #2563EB;
    background: rgba(37, 99, 235, 0.07);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12), 0 4px 20px rgba(37, 99, 235, 0.15);
    transform: translateY(-1px);
}

.strategy-btn .s-badge {
    position: absolute;
    top: -0.55rem;
    left: 50%;
    transform: translateX(-50%);
    background: #2563EB;
    color: #fff;
    font-size: 0.48rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    white-space: nowrap;
    text-transform: uppercase;
}

.strategy-btn .s-icon {
    font-size: 1.4rem;
    line-height: 1;
    margin-top: 0.15rem;
}

.strategy-btn .s-name {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

.strategy-btn .s-desc {
    font-size: 0.56rem;
    color: var(--muted);
    line-height: 1.4;
}

.strategy-btn.active .s-name {
    color: #2563EB;
}

/* Bandeau comparaison modes */
#strategy-compare {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.65rem 0.85rem;
    font-size: 0.65rem;
    color: var(--muted);
    line-height: 1.7;
    margin-bottom: 0.8rem;
}

#strategy-compare strong {
    color: var(--text);
}

#strategy-compare .s-savings {
    color: var(--accent);
    font-weight: 700;
}

#strategy-compare .s-time {
    color: #f59e0b;
    font-weight: 700;
}

.fuel-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.3rem;
    margin-bottom: 0.5rem;
}

.fuel-btn {
    padding: 0.45rem 0.2rem;
    font-size: 0.65rem;
    font-family: 'Inter', sans-serif;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface2);
    color: var(--muted);
    cursor: pointer;
    text-align: center;
    transition: all 0.18s;
    font-weight: 500;
}

.fuel-btn.active {
    border-color: var(--accent);
    color: #fff;
    background: var(--accent);
    font-weight: 600;
}

.fuel-btn:hover:not(.active) {
    border-color: var(--accent);
    color: var(--accent);
}

/* ── Alerte carburant ── */
/* ── Alerte réserve faible ─────────────────────────────────────────────── */
.fuel-alert {
    display: none;
    margin: 0.5rem 0;
    border-radius: 10px;
    overflow: hidden;
    font-size: 0.68rem;
    line-height: 1.55;
}

.fuel-alert.show {
    display: block;
}

/* Niveau WARN (orange) : réservoir faible mais non dangereux */
.fuel-alert .fa-inner {
    padding: 0.75rem 0.9rem 0.7rem;
    background: #FFF7ED;
    border: 1px solid #FDBA74;
    border-radius: 10px;
    color: #14233B;
}

/* Niveau CRITICAL (rouge) : réservoir très bas, risque réel */
.fuel-alert.critical .fa-inner {
    background: rgba(255, 77, 77, 0.08);
    border-color: rgba(255, 77, 77, 0.45);
    color: var(--danger, #ff4d4d);
    animation: alertPulse 2.5s ease-in-out infinite;
}

@keyframes alertPulse {

    0%,
    100% {
        border-color: rgba(255, 77, 77, 0.35);
    }

    50% {
        border-color: rgba(255, 77, 77, 0.80);
    }
}

.fuel-alert .fa-title {
    font-weight: 700;
    font-size: 0.72rem;
    margin-bottom: 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.fuel-alert .fa-detail {
    font-size: 0.66rem;
    opacity: 0.85;
    margin-bottom: 0.15rem;
}

.fuel-alert .fa-tip {
    font-size: 0.60rem;
    opacity: 0.65;
    margin-top: 0.2rem;
}

.fuel-alert .fa-action {
    margin-top: 0.55rem;
    padding-top: 0.45rem;
    border-top: 1px solid rgba(253, 186, 116, 0.4);
}

.fuel-alert.critical .fa-action {
    border-top-color: rgba(255, 77, 77, 0.2);
}

.fa-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    background: #F97316;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.62rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, transform 0.1s;
}

.fa-action-btn:active {
    transform: scale(0.97);
}

.fuel-alert.critical .fa-action-btn {
    background: var(--danger, #ff4d4d);
}

[data-theme="dark"] .fuel-alert .fa-inner {
    background: rgba(249, 115, 22, 0.08);
    border-color: rgba(249, 115, 22, 0.30);
    color: #FDBA74;
}

[data-theme="dark"] .fuel-alert .fa-action {
    border-top-color: rgba(249, 115, 22, 0.15);
}

/* Variante verte — plein prévu à destination */
.fuel-alert.planned .fa-inner {
    background: rgba(79,255,176,0.07);
    border-color: rgba(37,163,74,0.35);
    color: var(--text);
    animation: none;
}

.fuel-alert.planned .fa-title {
    color: #16a34a;
}

[data-theme="dark"] .fuel-alert.planned .fa-inner {
    background: rgba(79,255,176,0.06);
    border-color: rgba(79,255,176,0.25);
}

[data-theme="dark"] .fuel-alert.planned .fa-title {
    color: var(--accent);
}

/* ── Bouton rafraîchir ── */
.btn-refresh {
    width: 100%;
    padding: 0.45rem;
    font-size: 0.65rem;
    font-family: inherit;
    background: rgba(79, 255, 176, 0.06);
    border: 1px solid rgba(79, 255, 176, 0.25);
    border-radius: 6px;
    color: var(--accent);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn-refresh:hover {
    background: rgba(79, 255, 176, 0.14);
}

.btn-refresh:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spin {
    display: inline-block;
    animation: spin 0.8s linear infinite;
}

/* ── Profils véhicule ── */
.profiles-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.profile-card {
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface2);
    cursor: pointer;
    transition: all 0.18s;
    font-size: 0.62rem;
}

.profile-card:hover {
    border-color: var(--accent3);
}

.profile-card.active {
    border-color: var(--accent);
    background: rgba(79, 255, 176, 0.07);
}

.profile-card .p-name {
    font-weight: 600;
    color: var(--text);
    font-size: 0.68rem;
}

.profile-card .p-meta {
    color: var(--muted);
    margin-top: 0.15rem;
}

.profile-card .p-del {
    float: right;
    color: var(--muted);
    font-size: 0.7rem;
    padding: 0 0.2rem;
}

.profile-card .p-del:hover {
    color: var(--danger);
}

/* ── Mode station rapide ── */
.quick-station-modal .modal {
    max-width: 440px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

#qs-results {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 55vh;
}

/* ── Modal export : bouton Fermer toujours visible ── */
#export-modal .modal {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

#nav-options-list {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.qs-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.7rem;
    margin-bottom: 0.35rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    color: inherit;
}

.qs-result:hover {
    border-color: var(--accent);
    background: rgba(79, 255, 176, 0.05);
}

.qs-result.best {
    border-color: rgba(79, 255, 176, 0.5);
    background: rgba(79, 255, 176, 0.07);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

header {
    padding: 0 1.5rem;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 1100;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.06);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.03em;
    color: var(--text);
    text-decoration: none;
    cursor: default;
    user-select: none;
}

.logo-symbol {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
}

.logo-text {
    line-height: 1;
}

.logo-text span {
    color: var(--accent);
}

/* Icône PWA — visible uniquement dans le <head> meta, non affiché dans la page */

.header-badges {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.badge {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--muted);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.25rem 0.6rem;
}

.badge.green {
    border-color: var(--pm-mid);
    color: var(--accent);
    background: var(--pm-light);
}

.dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: 0.3
    }
}

/* ══ LAYOUT DEUX ÉTATS ══════════════════════════════════════════════════════
     État 1 : .app (home)   — formulaire centré pleine largeur
     État 2 : .app.results  — carte plein écran + drawer résultats
  ══════════════════════════════════════════════════════════════════════════ */
.app {
    position: relative;
    height: calc(100vh - 54px);
    overflow: hidden;
}

/* ── ÉTAT HOME : formulaire centré ── */
#home-screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow-y: auto;
    overflow-x: visible;
    /* ne pas clipper les listes déroulantes */
    padding: 2.5rem 1rem calc(2rem + env(safe-area-inset-bottom));
    background: var(--bg);
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 5;
}

#home-screen.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-20px);
}

.home-card {
    width: 100%;
    max-width: 520px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 24px rgba(37, 99, 235, 0.08);
}

.home-hero {
    text-align: center;
    margin-bottom: 1.5rem;
}

.home-hero-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.03em;
    margin-bottom: 0.3rem;
}

.home-hero-title span {
    color: var(--accent);
}

.home-hero-sub {
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.6;
}

/* ── ÉTAT RESULTS : carte + drawer ── */
#map-container {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.app.results #map-container {
    opacity: 1;
    pointer-events: all;
}

/* ── DESKTOP : drawer latéral gauche ── */
#results-drawer {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 400px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    box-shadow: 4px 0 24px rgba(37, 99, 235, 0.08);
    z-index: 10;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
}

.app.results #results-drawer {
    transform: translateX(0);
}

#results-drawer-scroll {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

#results-drawer-scroll::-webkit-scrollbar {
    width: 3px;
}

#results-drawer-scroll::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

/* Barre du haut du drawer — résumé + bouton retour */
#drawer-topbar {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
    box-shadow: 0 1px 0 var(--border);
}

#btn-back-home {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.45rem 0.85rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.2s;
}

#btn-back-home:hover {
    background: var(--pm-light);
    border-color: var(--accent);
    color: var(--accent);
}

#drawer-summary {
    flex: 1;
    min-width: 0;
}

#drawer-route-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.02em;
}

#drawer-quick-stats {
    font-size: 0.65rem;
    color: var(--muted);
    margin-top: 0.15rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#drawer-quick-cost {
    font-weight: 700;
    color: var(--accent);
}

/* Handle mobile peek */
#drawer-handle-mobile {
    cursor: pointer;
    user-select: none;
    touch-action: none;
    padding: 0.5rem 1rem 0.2rem;
    flex-shrink: 0;
}

#drawer-handle-mobile .handle-bar {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    margin: 0 auto 0.45rem;
}

#drawer-peek-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding-bottom: 0.3rem;
    gap: 0.5rem;
}

#drawer-peek-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#drawer-peek-cost {
    font-size: 1rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.02em;
    white-space: nowrap;
}

/* Sections dans le drawer */
#results-drawer-scroll .section {
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--border);
}

#results-drawer-scroll .section:last-child {
    border-bottom: none;
}

#results-drawer-scroll .section-title {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#results-drawer-scroll .section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Stats cards drawer */
#results-drawer-scroll .stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0;
}

#results-drawer-scroll .stat-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem 0.85rem;
    position: relative;
    overflow: hidden;
}

#results-drawer-scroll .stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
}

#results-drawer-scroll .stat-card.orange::before {
    background: var(--accent2);
}

#results-drawer-scroll .stat-card.blue::before {
    background: var(--accent3);
}

#results-drawer-scroll .stat-card.red::before {
    background: var(--danger);
}

#results-drawer-scroll .stat-label {
    font-size: 0.58rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 0.3rem;
}

#results-drawer-scroll .stat-value {
    font-family: 'Inter', sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.03em;
    line-height: 1;
}

#results-drawer-scroll .stat-unit {
    font-size: 0.6rem;
    color: var(--muted);
    margin-top: 0.2rem;
}

/* Stop items drawer */
#results-drawer-scroll .stop-item {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem;
    margin-bottom: 0.5rem;
    transition: border-color 0.2s;
}

#results-drawer-scroll .stop-item:hover {
    border-color: var(--pm-mid);
}

#results-drawer-scroll .stop-badge {
    background: #2563EB;
    color: #fff;
    font-size: 0.58rem;
    font-weight: 700;
    padding: 0.18rem 0.5rem;
    border-radius: 4px;
}

#results-drawer-scroll .stop-badge.depot {
    background: var(--accent3);
}

#results-drawer-scroll .stop-badge.arrivee {
    background: #16a34a;
}

#results-drawer-scroll .stop-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

/* Sidebar héritée — cachée dans le nouveau layout */
.sidebar {
    display: none;
}

/* ── Éléments mobile : masqués par défaut sur desktop ── */
#mobile-topbar {
    display: none;
}

.sidebar-handle {
    display: none;
}

.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
}

/* ══ RESPONSIVE MOBILE ═══════════════════════════════════════════════════ */
@media (max-width: 768px) {

    header {
        display: none;
    }

    #mobile-topbar {
        display: flex !important;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 48px;
        z-index: 1100;
        align-items: center;
        justify-content: space-between;
        padding: 0 0.9rem;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        box-shadow: 0 1px 3px rgba(37, 99, 235, 0.06);
    }

    .app {
        height: calc(100dvh - 48px);
        margin-top: 48px;
    }

    /* ── Carte plein écran sur mobile ── */
    #map-container {
        position: absolute;
        inset: 0;
        z-index: 1;
    }

    #map {
        width: 100% !important;
        height: 100% !important;
    }

    /* ── Home screen mobile ── */
    #home-screen {
        padding: 1.5rem 0.9rem 5rem;
        justify-content: flex-start;
    }

    .home-card {
        max-width: 100%;
        border-radius: 12px;
        padding: 1.2rem;
    }

    .home-hero-title {
        font-size: 1.25rem;
    }

    /* ── Drawer mobile : bottom sheet ── */
    #results-drawer {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: calc(100dvh - 48px);
    border-right: none;
    border-top: 2px solid var(--accent);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -6px 32px rgba(37, 99, 235, 0.15);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 12px);
    }

    .app.results #results-drawer {
        transform: translateY(calc(100% - 70px - env(safe-area-inset-bottom, 0px)));
    }

    .app.results #results-drawer.drawer-open {
    transform: translateY(0);
    padding-top: 0;
    }

    /* Compensation visuelle : premier contenu scrollable sous le handle */
    @media (max-width: 768px) {
    #drawer-topbar {
        padding-top: 0.6rem;
        padding-bottom: 0.6rem;
    }
    }

    /* Handle swipe mobile */
    #drawer-handle-mobile {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 0.6rem 1rem 0.3rem;
        cursor: pointer;
        flex-shrink: 0;
        touch-action: none;
    }

    #drawer-handle-mobile .handle-bar {
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: var(--border);
        margin-bottom: 0.4rem;
    }

    #drawer-peek-summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 0 0.2rem 0.5rem;
    }

    #drawer-peek-label {
        font-size: 0.78rem;
        font-weight: 600;
        color: var(--text);
    }

    #drawer-peek-cost {
        font-size: 0.9rem;
        font-weight: 700;
        color: var(--accent);
    }

    /* Sur desktop : le handle mobile est caché */
    #drawer-handle-mobile {
        display: flex;
    }

    #drawer-topbar {
        display: none;
    }
}

@media (min-width: 769px) {
    #drawer-handle-mobile {
        display: none;
    }
}

.section-title {
    font-family: 'Inter', sans-serif;
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.input-group {
    margin-bottom: 0.75rem;
}

label {
    display: block;
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

input,
select {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input::placeholder {
    color: var(--muted);
}

select option {
    background: var(--surface);
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
}

.btn {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background: var(--accent2);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: var(--border);
    color: var(--muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

.autocomplete-wrapper {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--accent);
    border-top: none;
    border-radius: 0 0 8px 8px;
    z-index: 9999;
    max-height: 180px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.12);
}

.autocomplete-list.open {
    display: block;
}

.autocomplete-item {
    padding: 0.55rem 0.85rem;
    font-size: 0.78rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
    line-height: 1.4;
    color: var(--text);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: var(--pm-light);
    color: var(--accent);
}

.btn-secondary:hover {
    border-color: var(--accent3);
    color: var(--accent3);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.stat-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.8rem;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
}

.stat-card.orange::before {
    background: var(--accent2);
}

.stat-card.blue::before {
    background: var(--accent3);
}

.stat-card.red::before {
    background: var(--danger);
}

.stat-label {
    font-size: 0.58rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-family: 'Inter', sans-serif;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text);
}

.stat-unit {
    font-size: 0.6rem;
    color: var(--muted);
    margin-top: 0.1rem;
}

.stop-item {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.9rem;
    margin-bottom: 0.55rem;
    animation: slideIn 0.3s ease forwards;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-8px)
    }

    to {
        opacity: 1;
        transform: translateX(0)
    }
}

.stop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.4rem;
}

.stop-badge {
    /* [v46] Vert cohérent avec l'arrivée — palette unifiée trajet */
    background: #2563EB;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 0.58rem;
    font-weight: 700;
    padding: 0.18rem 0.45rem;
    border-radius: 3px;
    letter-spacing: 0.05em;
}

.stop-badge.depot {
    background: var(--accent3);
    color: #fff;
}

.stop-badge.arrivee {
    background: #16a34a;
    color: #fff;
}

.stop-name {
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stop-details {
    display: flex;
    gap: 1rem;
    font-size: 0.67rem;
    color: var(--muted);
    flex-wrap: wrap;
}

.saved-item {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.65rem 0.9rem;
    margin-bottom: 0.45rem;
    cursor: pointer;
    transition: border-color 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.saved-item:hover {
    border-color: var(--accent3);
}

.saved-route-name {
    font-size: 0.78rem;
}

.saved-route-meta {
    font-size: 0.62rem;
    color: var(--muted);
    margin-top: 0.1rem;
}

.delete-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.2rem 0.3rem;
    border-radius: 3px;
}

.delete-btn:hover {
    color: var(--danger);
    background: rgba(255, 77, 77, 0.1);
}

.loading {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.8rem;
    font-size: 0.72rem;
    color: var(--accent);
}

.loading.active {
    display: flex;
}

.spinner {
    width: 13px;
    height: 13px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.loading-progress-wrap {
    width: 100%;
    max-width: min(220px, 80vw);
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    height: 3px;
    overflow: hidden;
    box-sizing: border-box;
}

.loading-progress-bar {
    height: 3px;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.4s ease;
    width: 0%;
}

.loading-step {
    font-size: 0.6rem;
    color: var(--muted);
    min-height: 0.9rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg)
    }
}

.alert {
    padding: 0.65rem 0.9rem;
    border-radius: 6px;
    font-size: 0.72rem;
    margin-bottom: 0.7rem;
    display: none;
    line-height: 1.5;
}

.alert.show {
    display: block;
}

.alert-warn {
    background: rgba(255, 107, 53, 0.1);
    border: 1px solid rgba(255, 107, 53, 0.3);
    color: var(--accent2);
}

.alert-info {
    background: rgba(79, 255, 176, 0.07);
    border: 1px solid rgba(79, 255, 176, 0.2);
    color: var(--accent);
}

.empty-state {
    text-align: center;
    padding: 1.5rem 1rem;
    color: var(--muted);
    font-size: 0.72rem;
}

.empty-state .icon {
    font-size: 1.8rem;
    margin-bottom: 0.4rem;
}

#map {
    width: 100%;
    height: 100%;
    background: var(--bg);
}

/* ── Éléments mobile : masqués par défaut sur desktop ── */
#mobile-topbar {
    display: none;
}

.sidebar-handle {
    display: none;
}

.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
}

/* ══════════════════════════════════════════════════
     RESPONSIVE MOBILE — approche bottom-drawer
  ══════════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* ── 1. HEADER DESKTOP : masqué sur mobile ── */
    header {
        display: none;
    }

    /* Réactivation des éléments mobile ── */
    .sidebar-handle {
        display: flex;
    }

    /* ── 2. MINI-BARRE MOBILE en haut ── */
    #mobile-topbar {
        display: flex !important;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 48px;
        z-index: 1100;
        align-items: center;
        justify-content: space-between;
        padding: 0 0.9rem;
        background: rgba(13, 15, 20, 0.96);
        backdrop-filter: blur(10px);
        border-bottom: 1px solid var(--border);
    }

    #mobile-topbar {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    z-index: 1100;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.9rem;
    background: rgba(244, 246, 251, 0.97); /* clair par défaut */
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

[data-theme="dark"] #mobile-topbar {
    background: rgba(13, 15, 20, 0.96);
}



    /* ── 3. APP : plein écran sous la mini-barre ── */
    .app {
        display: flex;
        flex-direction: column;
        height: calc(100dvh - 48px);
        margin-top: 48px;
        position: relative;
        overflow: hidden;
    }

    /* ── 4. CARTE : remplit le .app ── */
    #map-container {
        position: relative !important;
        width: 100%;
        height: 100%;
        z-index: 1;
        overflow: hidden;
        flex-shrink: 0;
    }

    #map {
        width: 100% !important;
        height: 100% !important;
    }

    /* ── 5. DRAWER SIDEBAR depuis le bas ── */
    .sidebar {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: calc(100dvh - 48px);
        --peek: 90px;
        transform: translateY(calc(100% - var(--peek)));
        transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
        border-right: none;
        border-top: 2px solid var(--accent);
        border-radius: 18px 18px 0 0;
        z-index: 10;
        background: var(--surface);
        box-shadow: 0 -6px 32px rgba(0, 0, 0, 0.5);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .sidebar.open {
        transform: translateY(0);
    }

    /* Poignée + zone cliquable en haut du drawer */
    .sidebar-handle {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 10px 1rem 6px;
        cursor: pointer;
        flex-shrink: 0;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }

    .sidebar-handle-bar {
        width: 40px;
        height: 4px;
        background: var(--border);
        border-radius: 2px;
        margin-bottom: 8px;
    }

    .sidebar-handle-label {
        font-family: 'Inter', sans-serif;
        font-size: 0.72rem;
        font-weight: 700;
        color: var(--accent);
        letter-spacing: 0.06em;
        text-transform: uppercase;
    }

    /* Contenu scrollable du drawer */
    .sidebar-scroll {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-scroll::-webkit-scrollbar {
        display: none;
    }

    /* Inputs tactiles */
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    select,
    textarea {
    min-height: 44px;
    font-size: 16px !important; /* ← 16px exact = seuil iOS, pas de zoom auto */
    }

    .btn {
        min-height: 44px;
        font-size: 0.82rem !important;
    }

    .stop-item {
        padding: 0.8rem 1rem;
    }

    .stat-cards {
        grid-template-columns: 1fr 1fr !important;
    }

    .fuel-selector {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

/* Très petits écrans */
@media (max-width: 380px) {
    .fuel-selector {
        grid-template-columns: 1fr 1fr;
    }

    .fuel-btn:last-child {
        grid-column: 1 / -1;
    }

    .section {
        padding: 0.9rem 1rem;
    }
}

@media (max-width: 420px) {
  #mobile-topbar {
    padding: 0 0.4rem;
    gap: 0.2rem;
  }

  #mobile-topbar .header-badges {
    gap: 0.3rem;
  }

  #mobile-topbar .badge {
    padding: 0.2rem 0.4rem;
    font-size: 0.55rem;
    gap: 0.2rem;
  }

  #mobile-topbar .auth-bar {
    padding: 0.2rem 0.4rem;
    font-size: 0.55rem;
  }

  #mobile-topbar .logo-text {
    font-size: 1rem;
  }

  #mobile-topbar .logo-symbol {
    width: 26px;
    height: 26px;
  }
}


/* ── Header mobile : adaptation petits écrans ── */
@media (max-width: 420px) {
  #mobile-topbar {
    padding: 0 0.5rem;
    gap: 0.3rem;
  }

  #mobile-topbar .auth-bar {
    padding: 0.2rem 0.4rem;
    font-size: 0.55rem;
    gap: 0.25rem;
  }

  #mobile-topbar .theme-toggle {
    padding: 0.2rem 0.4rem;
    font-size: 0.55rem;
  }

  #mobile-topbar .badge {
    display: none;
  }

  #mobile-topbar .logo-text {
    font-size: 1rem;
  }

  #mobile-topbar .logo-symbol {
    width: 26px;
    height: 26px;
  }
}

/* Handle du drawer : géré avant le media query (voir plus haut) */
.leaflet-container {
    background: #111520 !important;
    font-family: 'DM Mono', monospace;
}

.leaflet-popup-content-wrapper {
    background: var(--surface2) !important;
    border: 1px solid var(--accent) !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5) !important;
    color: var(--text) !important;
}

.leaflet-popup-tip {
    background: var(--surface2) !important;
}

.leaflet-popup-content {
    margin: 10px 14px !important;
    font-size: 12px !important;
    line-height: 1.7 !important;
}

.leaflet-control-zoom a {
    background: var(--surface2) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

.leaflet-control-zoom a:hover {
    background: var(--accent) !important;
    color: #0d0f14 !important;
}

.leaflet-bar {
    border: 1px solid var(--border) !important;
    box-shadow: none !important;
}

.leaflet-attribution-flag {
    display: none !important;
}

.map-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 0.8rem;
    color: var(--muted);
    font-size: 0.78rem;
}

.map-placeholder .icon {
    font-size: 3rem;
}

.map-placeholder h3 {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: var(--text);
    font-weight: 700;
}

/* STOP ITEM — cliquable */
.stop-item {
    cursor: default;
}

.stop-item.selectable {
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.stop-item.selectable:hover {
    border-color: rgba(79, 255, 176, 0.4);
    background: rgba(79, 255, 176, 0.04);
}

.stop-item.selected {
    border-color: var(--accent) !important;
    background: rgba(79, 255, 176, 0.07) !important;
}

/* KM DÉTOUR badge */
.detour-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: rgba(79, 255, 176, 0.1);
    border: 1px solid rgba(79, 255, 176, 0.3);
    color: var(--accent);
    border-radius: 4px;
    padding: 0.15rem 0.45rem;
    font-size: 0.62rem;
    font-weight: 500;
    margin-top: 0.35rem;
}

/* MODAL EXPORT */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.8rem;
    width: 420px;
    max-width: 95vw;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(12px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

.modal-title {
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 0.4rem;
}

.modal-sub {
    font-size: 0.72rem;
    color: var(--muted);
    margin-bottom: 1.4rem;
    line-height: 1.5;
}

.nav-options {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    margin-bottom: 1.2rem;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.18s;
    text-decoration: none;
    color: var(--text);
    position: relative;
    overflow: hidden;
}

.nav-btn::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.18s;
    border-radius: 3px 0 0 3px;
}

.nav-btn:hover {
    border-color: var(--accent);
    background: var(--pm-light);
    transform: none;
    box-shadow: 0 2px 12px rgba(37,99,235,0.10);
}

.nav-btn:hover::before {
    opacity: 1;
}

.nav-btn .nav-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 2.2rem;
    text-align: center;
}

.nav-btn .nav-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
}

.nav-btn .nav-desc {
    font-size: 0.62rem;
    color: var(--muted);
    margin-top: 0.15rem;
    line-height: 1.4;
}

.modal-close {
    width: 100%;
    padding: 0.6rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--muted);
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 0.01em;
}

.modal-close:hover {
    border-color: var(--border);
    background: var(--surface2);
    color: var(--text);
}

/* ÉTAPES INTERMÉDIAIRES */
.waypoints-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-bottom: 0.5rem;
}

.waypoint-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    animation: slideIn 0.2s ease;
}

.waypoint-row .autocomplete-wrapper {
    flex: 1;
}

.waypoint-row input {
    padding: 0.5rem 0.7rem;
    font-size: 0.78rem;
}

.wp-num {
    font-size: 0.62rem;
    color: var(--accent3);
    background: rgba(123, 140, 255, 0.12);
    border: 1px solid rgba(123, 140, 255, 0.25);
    border-radius: 4px;
    padding: 0.3rem 0.45rem;
    flex-shrink: 0;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}

.wp-remove {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.2rem 0.3rem;
    border-radius: 3px;
    flex-shrink: 0;
    transition: all 0.15s;
}

.wp-remove:hover {
    color: var(--danger);
    background: rgba(255, 77, 77, 0.1);
}

/* ── Bouton géolocalisation départ ── */
.btn-geolocate {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    margin-top: 0.4rem;
    padding: 0.38rem 0.7rem;
    font-size: 0.63rem;
    font-family: inherit;
    background: rgba(123, 140, 255, 0.07);
    border: 1px solid rgba(123, 140, 255, 0.3);
    border-radius: 6px;
    color: var(--accent3);
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.02em;
}

.btn-geolocate:hover {
    background: rgba(123, 140, 255, 0.15);
    border-color: var(--accent3);
}

.btn-geolocate:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-geolocate .geo-spinner {
    display: none;
}

.btn-geolocate.loading .geo-spinner {
    display: inline-block;
    animation: spin 0.8s linear infinite;
}

.btn-geolocate.loading .geo-icon {
    display: none;
}

.btn-add-wp {
    width: 100%;
    padding: 0.48rem;
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: 6px;
    color: var(--muted);
    font-family: 'DM Mono', monospace;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-wp:hover {
    border-color: var(--accent3);
    color: var(--accent3);
    background: rgba(123, 140, 255, 0.05);
}

/* SLIDER PRIORITÉ */
.priority-slider-wrap {
    margin-top: 0.6rem;
}

.priority-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.6rem;
    color: var(--muted);
    margin-top: 0.3rem;
}

input[type=range] {
    width: 100%;
    accent-color: var(--accent);
    cursor: pointer;
    height: 4px;
    border-radius: 2px;
}

.priority-value {
    text-align: center;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--accent);
    margin-top: 0.2rem;
}

/* Presets de priorité */
.priority-presets {
    display: flex;
    gap: 0.3rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.priority-preset-btn {
    flex: 1;
    min-width: 0;
    padding: 0.3rem 0.2rem;
    font-size: 0.58rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface2);
    color: var(--muted);
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
    line-height: 1.3;
    white-space: nowrap;
}

.priority-preset-btn:hover {
    border-color: var(--accent3);
    color: var(--accent3);
}

.priority-preset-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(79, 255, 176, 0.07);
    font-weight: 600;
}

/* Bloc impact estimé */
.priority-impact {
    margin-top: 0.45rem;
    padding: 0.35rem 0.55rem;
    background: rgba(123, 140, 255, 0.06);
    border: 1px solid rgba(123, 140, 255, 0.18);
    border-radius: 6px;
    font-size: 0.6rem;
    line-height: 1.6;
    color: var(--muted);
}

.priority-impact strong {
    color: var(--text);
}

/* ── Mode trajet (long / court) ── */
.trip-mode-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem;
    margin-bottom: 0.6rem;
}

.trip-mode-btn {
    padding: 0.5rem 0.3rem;
    font-size: 0.63rem;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface2);
    color: var(--muted);
    cursor: pointer;
    text-align: center;
    transition: all 0.18s;
    line-height: 1.4;
}

.trip-mode-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(79, 255, 176, 0.09);
    font-weight: 700;
}

/* ── Bouton Lancer la route ── */
.btn-launch {
    width: 100%;
    padding: 0.85rem;
    margin-top: 0.5rem;
    background: var(--accent);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.25);
}

/* Bouton trajet courts */
#calc-btn {
  white-space: normal;
  text-align: center;
  line-height: 1.3;
}

.btn-launch:hover {
    background: var(--accent2);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}

.btn-launch:active {
    transform: translateY(0);
}

.btn-launch:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── [v28] PWA Install Prompt ────────────────────────────────────────────── */
#pwa-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    padding: 0 0 env(safe-area-inset-bottom, 0px);
    transform: translateY(110%);
    transition: transform 0.38s cubic-bezier(0.34, 1.20, 0.64, 1);
    pointer-events: none;
}

#pwa-prompt.pwa-visible {
    transform: translateY(0);
    pointer-events: auto;
}

.pwa-card {
    margin: 0 0.75rem 0.75rem;
    background: var(--surface, #fff);
    border: 1px solid var(--border, rgba(0, 0, 0, 0.08));
    border-radius: 18px;
    box-shadow: 0 -2px 24px rgba(0, 0, 0, 0.12), 0 4px 32px rgba(37, 99, 235, 0.08);
    padding: 1.1rem 1.1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.pwa-header {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
}

.pwa-icon {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 11px;
    background: #EEF4FF;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 6px rgba(37, 99, 235, 0.15);
}

.pwa-text {
    flex: 1;
}

.pwa-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text, #14233B);
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.pwa-sub {
    font-size: 0.71rem;
    color: var(--muted, #6b7280);
    margin-top: 0.2rem;
    line-height: 1.45;
}

.pwa-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--muted, #9ca3af);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.1rem;
    line-height: 1;
    margin-top: -0.1rem;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.pwa-close:hover {
    opacity: 1;
}

.pwa-ios-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(37, 99, 235, 0.06);
    border: 1px solid rgba(37, 99, 235, 0.12);
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
    font-size: 0.69rem;
    color: var(--text, #14233B);
    line-height: 1.5;
}

.pwa-ios-hint svg {
    flex-shrink: 0;
}

.pwa-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.pwa-btn-install {
    background: #2563EB;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0.62rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    letter-spacing: -0.01em;
}

.pwa-btn-install:active {
    transform: scale(0.97);
    background: #1d4ed8;
}

.pwa-btn-later {
    background: var(--surface2, rgba(0, 0, 0, 0.04));
    color: var(--muted, #6b7280);
    border: 1px solid var(--border, rgba(0, 0, 0, 0.08));
    border-radius: 10px;
    padding: 0.62rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.pwa-btn-later:active {
    background: var(--border, rgba(0, 0, 0, 0.1));
}

@media (prefers-color-scheme: dark) {
    .pwa-ios-hint {
        background: rgba(37, 99, 235, 0.1);
        border-color: rgba(37, 99, 235, 0.2);
    }
}

/* ── [v36] Comparatif modes ÉCO / ÉQUILIBRÉ ────────────────────────────── */
#mode-compare-modal .modal {
    max-width: 460px;
    padding: 1.4rem 1.6rem;
    max-height: 85dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.mc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.68rem;
    margin: 0.8rem 0;
}

.mc-table th {
    text-align: right;
    padding: 0.3rem 0.5rem;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.60rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
}

.mc-table th:first-child {
    text-align: left;
}

.mc-table td {
    padding: 0.38rem 0.5rem;
    text-align: right;
    border-bottom: 1px solid rgba(var(--border-rgb, 148, 164, 199), 0.15);
    font-size: 0.69rem;
    color: var(--text);
}

.mc-table td:first-child {
    text-align: left;
    color: var(--muted);
}

.mc-table tr:last-child td {
    border-bottom: none;
}

.mc-winner {
    color: var(--accent);
    font-weight: 700;
}

.mc-summary {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.65rem 0.8rem;
    font-size: 0.67rem;
    color: var(--text);
    line-height: 1.55;
    margin-bottom: 0.8rem;
}

.mc-warn {
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 6px;
    padding: 0.45rem 0.65rem;
    font-size: 0.62rem;
    color: #d97706;
    margin-bottom: 0.7rem;
}

.mc-trigger {
    display: none;
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.62rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    font-family: inherit;
    white-space: nowrap;
}

.mc-trigger.visible,
#mode-compare-btn.visible {
    display: inline;
}

/* ── Apparition fluide des sections résultats ── */
.section[style*="display: block"],
.section[style*="display:block"] {
  animation: fadeInUp 0.25s ease forwards;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

#mode-compare-modal .modal {
  max-height: 85dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ── Contenu Premium — flou pour utilisateurs gratuits ── */
.pm-blurred {
    filter: blur(4px);
    user-select: none;
    pointer-events: none;
    transition: filter 0.2s;
}

.pm-lock-hint {
    display: block;
    font-size: 0.58rem;
    color: var(--accent);
    margin-top: 0.25rem;
    font-style: normal;
    opacity: 0.85;
}

