/* Mobile-first accident map */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --header-h: 52px;
    --search-h: 48px;
    --bar-h: 64px;
    --bg: #0C0F14;
    --surface: #141922;
    --surface-muted: #1A2030;
    --border: #2A3142;
    --border-subtle: #222938;
    --text: #F1F3F7;
    --text-secondary: #C4CBD8;
    --text-muted: #8B95A8;
    --accent: #3B82F6;
    --accent-hover: #2563EB;
}

html, body.map-body {
    font-family: 'Source Sans 3', system-ui, -apple-system, sans-serif;
    overflow: hidden;
    height: 100%;
    height: 100dvh;
    background: var(--bg);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    color-scheme: dark;
}

/* Header */
.map-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: calc(8px + var(--safe-top)) 12px 8px;
    background: rgba(12, 15, 20, 0.94);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text);
    min-height: calc(var(--header-h) + var(--safe-top));
}

.map-home {
    color: var(--text); text-decoration: none;
    width: 40px; height: 40px; min-width: 40px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px; background: var(--surface-muted); border: 1px solid var(--border);
}

.map-header-title { flex: 1; min-width: 0; }
.map-header-title h1 {
    font-size: 0.925rem; font-weight: 600; line-height: 1.2;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    letter-spacing: -0.01em;
}
.map-badge {
    font-size: 10px; padding: 2px 7px; border-radius: 4px;
    background: rgba(59, 130, 246, 0.15); color: #93C5FD; border: 1px solid rgba(59, 130, 246, 0.25);
    display: inline-block; margin-top: 2px; font-weight: 600;
}

.map-panel-toggle {
    width: 40px; height: 40px; min-width: 40px;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface-muted); color: #93C5FD;
    font-size: 1rem; cursor: pointer;
}

.map-about-link {
    padding: 8px 10px; border-radius: 8px;
    color: var(--text-muted); text-decoration: none;
    font-size: 13px; font-weight: 600; white-space: nowrap;
}
.map-about-link:hover { color: var(--text); background: var(--surface-muted); }
.map-header-whatsapp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #25D366;
    color: #052e16;
    text-decoration: none;
    flex-shrink: 0;
}
.map-header-whatsapp i { font-size: 1.1rem; }

/* Search */
.map-search-bar {
    position: fixed;
    top: calc(var(--header-h) + var(--safe-top) + 4px);
    left: 12px; right: 12px;
    z-index: 100;
    display: flex; align-items: center; gap: 8px;
    padding: 0 14px;
    height: var(--search-h);
    background: var(--surface);
    border-radius: 10px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.map-search-bar i { color: var(--text-muted); font-size: 0.9rem; flex-shrink: 0; }

.place-autocomplete-host {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.place-autocomplete-host gmp-place-autocomplete {
    width: 100%;
    color-scheme: dark;
}

.map-search-bar input {
    flex: 1; border: none; outline: none;
    font-size: 16px;
    font-family: inherit; min-width: 0;
    width: 100%;
    background: transparent;
    color: var(--text);
}
.map-search-bar input::placeholder { color: var(--text-muted); }
.map-search-bar button {
    border: none; background: none; color: var(--text-muted);
    cursor: pointer; padding: 8px; min-width: 44px; min-height: 44px;
    display: flex; align-items: center; justify-content: center;
}

/* Route planner panel (replaces explore search when active) */
.route-planner {
    position: fixed;
    top: calc(var(--header-h) + var(--safe-top) + 4px);
    left: 12px; right: 12px;
    z-index: 120;
}
.route-planner-inner {
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.route-travel-modes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 4px;
    background: var(--surface-muted);
    border-radius: 10px;
}
.route-mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 52px;
    padding: 8px 6px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.route-mode-btn i {
    font-size: 1rem;
}
.route-mode-btn.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
.route-mode-btn:active:not(.active) {
    background: rgba(59, 130, 246, 0.1);
    color: #93C5FD;
}
.route-endpoints {
    display: flex;
    align-items: center;
    gap: 8px;
}
.route-endpoints-fields {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.route-swap-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    min-width: 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-muted);
    color: var(--text-muted);
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease, background 0.15s ease, color 0.15s ease;
}
.route-swap-btn:active,
.route-swap-btn.swapped {
    background: rgba(59, 130, 246, 0.12);
    color: #93C5FD;
}
.route-swap-btn.swapped {
    transform: rotate(180deg);
}
.route-field {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
}
.route-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.route-dot.from { background: #4ADE80; box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.25); }
.route-dot.to { background: #F87171; box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.25); }
.route-dot.when {
    background: transparent; color: #93C5FD; font-size: 10px;
    box-shadow: none; width: auto; display: flex; align-items: center;
}
.route-when-inputs {
    flex: 1; min-width: 0;
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.route-when-part {
    display: flex; flex-direction: column; gap: 2px;
    min-width: 0;
}
.route-date-input,
.route-time-input {
    border: none; outline: none; background: var(--surface-muted);
    color: var(--text); font-size: 16px; font-family: inherit;
    border-radius: 10px; padding: 10px 12px; width: 100%;
    color-scheme: dark;
}
.route-when-label {
    flex: 1; display: flex; flex-direction: column; gap: 2px;
    cursor: default;
}
.route-time-input {
    border: none; outline: none; background: var(--surface-muted);
    color: var(--text); font-size: 16px; font-family: inherit;
    border-radius: 10px; padding: 10px 12px; width: 100%;
    color-scheme: dark;
}
.route-from-host {
    flex: 1; min-width: 0; display: flex; align-items: center;
}
.route-from-host gmp-place-autocomplete,
.route-to-host gmp-place-autocomplete { width: 100%; color-scheme: dark; }
.route-locate-btn {
    flex-shrink: 0;
    width: 40px; height: 40px; min-width: 40px;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface-muted); color: #93C5FD;
    font-size: 1rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.route-locate-btn:active { background: rgba(59, 130, 246, 0.12); }
.route-field-label {
    display: block; font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-muted); margin-bottom: 2px;
}
.route-field-value {
    display: block; font-size: 15px; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.route-to-host {
    flex: 1; min-width: 0; display: flex; align-items: center;
}
.route-to-host gmp-place-autocomplete { width: 100%; color-scheme: dark; }
.route-fallback-input {
    width: 100%; border: none; outline: none;
    font-size: 16px; font-family: inherit;
    background: var(--surface-muted); color: var(--text);
    border-radius: 10px; padding: 10px 12px;
}
.plan-route-btn {
    width: 100%; border: none; border-radius: 10px;
    padding: 12px 16px; min-height: 48px;
    background: var(--accent); color: #fff;
    font-size: 15px; font-weight: 600; font-family: inherit;
    cursor: pointer; display: flex; align-items: center;
    justify-content: center; gap: 8px;
}
.plan-route-btn:disabled { opacity: 0.65; cursor: wait; }
.plan-route-btn:active:not(:disabled) { background: var(--accent-hover); }

.cancel-route-btn {
    position: fixed;
    top: calc(var(--header-h) + var(--search-h) + var(--safe-top) + 12px);
    right: 12px;
    z-index: 110;
    border: 1px solid rgba(248, 113, 113, 0.35);
    border-radius: 999px;
    background: rgba(20, 25, 34, 0.94);
    color: #FCA5A5;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    min-height: 42px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cancel-route-btn[hidden] { display: none; }
.cancel-route-btn:active {
    background: rgba(248, 113, 113, 0.14);
    transform: scale(0.98);
}

.route-analysis-header {
    margin-bottom: 14px; padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}
.route-analysis-title {
    font-size: 14px; font-weight: 600; color: var(--text);
    display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.route-analysis-meta {
    display: flex; flex-wrap: wrap; gap: 12px;
    font-size: 12px; color: var(--text-muted); margin-bottom: 10px;
}
.route-safety-score {
    padding: 10px 12px; border-radius: 10px; font-size: 13px;
}
.route-safety-score .score {
    display: block; font-size: 22px; font-weight: 700; line-height: 1.1;
}
.route-safety-score .label {
    display: block; font-size: 11px; margin-top: 4px; opacity: 0.9;
}
.route-safety-score.risk-low { background: rgba(74, 222, 128, 0.12); color: #86EFAC; border: 1px solid rgba(74, 222, 128, 0.2); }
.route-safety-score.risk-medium { background: rgba(251, 146, 60, 0.12); color: #FDBA74; border: 1px solid rgba(251, 146, 60, 0.2); }
.route-safety-score.risk-high { background: rgba(248, 113, 113, 0.12); color: #FCA5A5; border: 1px solid rgba(248, 113, 113, 0.2); }

/* SafePath composite factor breakdown */
.safepath-breakdown { margin-top: 12px; }
.safepath-breakdown h4 {
    font-size: 13px; font-weight: 600; color: var(--text);
    display: flex; align-items: center; gap: 8px; margin: 0 0 8px;
}
.safepath-composite {
    padding: 8px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 10px;
}
.safepath-composite .score { display: block; font-size: 19px; font-weight: 700; line-height: 1.1; }
.safepath-composite .label { display: block; font-size: 11px; margin-top: 3px; opacity: 0.9; }
.safepath-composite.risk-low { background: rgba(74, 222, 128, 0.12); color: #86EFAC; border: 1px solid rgba(74, 222, 128, 0.2); }
.safepath-composite.risk-medium { background: rgba(251, 146, 60, 0.12); color: #FDBA74; border: 1px solid rgba(251, 146, 60, 0.2); }
.safepath-composite.risk-high { background: rgba(248, 113, 113, 0.12); color: #FCA5A5; border: 1px solid rgba(248, 113, 113, 0.2); }
.safepath-factors { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.safepath-factors li {
    display: grid; grid-template-columns: 26px 1fr 64px 28px;
    align-items: center; gap: 8px;
}
.safepath-factors li.unavailable { opacity: 0.55; }
.safepath-factors .sp-icon {
    width: 26px; height: 26px; border-radius: 8px;
    background: rgba(96, 165, 250, 0.12); color: #93C5FD;
    display: flex; align-items: center; justify-content: center; font-size: 12px;
}
.safepath-factors .sp-info { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.safepath-factors .sp-label { font-size: 12px; font-weight: 600; color: var(--text); }
.safepath-factors .sp-label em {
    font-style: normal; font-weight: 500; font-size: 10px;
    color: var(--text-muted, #8B95A8); margin-left: 4px;
}
.safepath-factors .sp-detail {
    font-size: 10.5px; color: var(--text-muted, #8B95A8);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.safepath-factors .sp-bar {
    height: 6px; border-radius: 3px; overflow: hidden;
    background: rgba(42, 49, 66, 0.8);
}
.safepath-factors .sp-bar span { display: block; height: 100%; border-radius: 3px; }
.safepath-factors .sp-bar .lvl-low { background: #4ADE80; }
.safepath-factors .sp-bar .lvl-medium { background: #FBBF24; }
.safepath-factors .sp-bar .lvl-high { background: #F87171; }
.safepath-factors .sp-bar .lvl-none { background: transparent; }
.safepath-factors .sp-score {
    font-size: 12px; font-weight: 700; color: var(--text); text-align: right;
}
.safepath-note {
    margin: 8px 0 0; font-size: 10px; color: var(--text-muted, #8B95A8);
}

#map {
    position: absolute;
    inset: 0;
    top: 0;
    bottom: calc(var(--bar-h) + var(--safe-bottom));
    background: var(--bg);
}

/* Google Maps custom location control (API has no built-in my-location button) */
.gmaps-control-wrap {
    margin: 0 10px 72px 0;
}
.gmaps-control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    transition: background 0.15s, color 0.15s;
}
.gmaps-control-btn:hover {
    background: var(--surface-muted);
    color: #93C5FD;
}
.gmaps-control-btn:active {
    transform: scale(0.96);
}

@media (min-width: 768px) {
    .gmaps-control-wrap {
        margin-bottom: 10px;
    }
}

.gmaps-layers-wrap {
    margin: 0 0 72px 10px;
}
@media (min-width: 768px) {
    .gmaps-layers-wrap {
        margin-bottom: 10px;
    }
}

.map-layers-panel {
    position: fixed;
    left: 12px;
    bottom: calc(var(--bar-h, 64px) + var(--safe-bottom, 0px) + 12px);
    z-index: 140;
    width: min(320px, calc(100vw - 24px));
    padding: 12px;
    border-radius: 16px;
    background: rgba(12, 15, 20, 0.96);
    border: 1px solid var(--border);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
}
.map-layers-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    color: var(--text);
    font-size: 14px;
}
.map-layers-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: var(--surface-muted);
    color: var(--text);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.map-layers-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.map-layer-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 4px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 650;
    cursor: pointer;
}
.map-layer-option.is-active {
    color: #93C5FD;
    border-color: rgba(147, 197, 253, 0.45);
    background: rgba(147, 197, 253, 0.08);
}
.map-layer-preview {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    background-size: cover;
    background-position: center;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.map-layer-option.is-active .map-layer-preview {
    border-color: #93C5FD;
}
.map-layer-preview.is-map {
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.15), rgba(15, 23, 42, 0.35)),
        linear-gradient(135deg, #1e293b 25%, #334155 25% 50%, #1e293b 50% 75%, #475569 75%);
    background-size: auto, 16px 16px;
}
.map-layer-preview.is-satellite {
    background:
        radial-gradient(circle at 30% 30%, #64748b, transparent 40%),
        radial-gradient(circle at 70% 60%, #334155, transparent 35%),
        linear-gradient(160deg, #0f172a, #1e293b 40%, #334155);
}
.map-layer-preview.is-hybrid {
    background:
        linear-gradient(180deg, transparent 55%, rgba(15, 23, 42, 0.55)),
        radial-gradient(circle at 35% 35%, #94a3b8, transparent 42%),
        linear-gradient(160deg, #0b1220, #1e293b 45%, #475569);
}
.map-layer-preview.is-terrain {
    background:
        linear-gradient(160deg, #14532d, #166534 35%, #854d0e 70%, #1e3a8a);
}

@media (min-width: 768px) {
    .map-layers-panel {
        left: 16px;
        bottom: 24px;
    }
}

/* Bottom toolbar */
.map-bottom-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 110;
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    padding-bottom: var(--safe-bottom);
    background: rgba(12, 15, 20, 0.98);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--border-subtle);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
}

.bar-btn {
    position: relative;
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; padding: 8px 4px;
    border: none; background: none;
    color: var(--text-muted); font-size: 10px; font-weight: 600;
    cursor: pointer; min-height: var(--bar-h);
    transition: color 0.15s;
}
.bar-btn i { font-size: 1.2rem; }
.bar-btn.active { color: #93C5FD; }
#fuelStationsBtn.active { color: #5EEAD4; }
#mapLayersBtn.active { color: #93C5FD; }

/* Small persistent pulse so it's obvious fuel prices are still syncing even
   if the loading sheet has been dismissed or hasn't been opened yet. */
#fuelStationsBtn.is-loading::after {
    content: '';
    position: absolute;
    top: 8px;
    right: calc(50% - 20px);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #5EEAD4;
    animation: fuelLoadingPulse 1.4s ease-out infinite;
}
@keyframes fuelLoadingPulse {
    0% { box-shadow: 0 0 0 0 rgba(94, 234, 212, 0.6); }
    70% { box-shadow: 0 0 0 8px rgba(94, 234, 212, 0); }
    100% { box-shadow: 0 0 0 0 rgba(94, 234, 212, 0); }
}
.bar-btn.bar-btn-hint {
    color: #4ADE80;
    animation: routeHintPulse 1.6s ease-in-out infinite;
}
@keyframes routeHintPulse {
    0%, 100% { box-shadow: inset 0 0 0 0 rgba(74, 222, 128, 0); }
    50% { box-shadow: inset 0 0 0 2px rgba(74, 222, 128, 0.55); }
}
.bar-btn:active { opacity: 0.7; }

/* First-visit route planner hint */
.map-onboarding-tip {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(var(--bar-h) + var(--safe-bottom) + 12px);
    z-index: 120;
    display: flex;
    justify-content: center;
    pointer-events: none;
    animation: tipSlideUp 0.35s ease-out;
}
.map-onboarding-tip-inner {
    pointer-events: auto;
    max-width: 360px;
    width: 100%;
    padding: 14px 16px;
    background: rgba(20, 25, 34, 0.98);
    border: 1px solid rgba(74, 222, 128, 0.35);
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
    position: relative;
}
.map-onboarding-tip-inner::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -8px;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid rgba(74, 222, 128, 0.35);
}
.map-onboarding-tip-inner p {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary);
}
.map-onboarding-tip-inner p i {
    color: #4ADE80;
    margin-right: 6px;
}
.map-onboarding-tip-inner strong {
    color: var(--text);
}
.map-onboarding-tip-actions {
    display: flex;
    gap: 8px;
}
.map-onboarding-try,
.map-onboarding-dismiss {
    flex: 1;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}
.map-onboarding-try {
    background: #4ADE80;
    color: #052e16;
}
.map-onboarding-dismiss {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}
@keyframes tipSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 768px) {
    .map-onboarding-tip {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: min(420px, calc(100% - 32px));
    }
}

/* Bottom sheet for analysis panel */
.sheet-backdrop {
    position: fixed; inset: 0; z-index: 140;
    background: rgba(0,0,0,0.5);
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.collision-data-panel {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 150;
    width: 100%;
    max-height: 78vh;
    max-height: 78dvh;
    background: var(--surface);
    border-radius: 20px 20px 0 0;
    border-top: 1px solid var(--border-subtle);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
    display: flex; flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    padding-bottom: calc(var(--bar-h) + var(--safe-bottom));
}
.collision-data-panel.sheet-open {
    transform: translateY(0);
}

.collision-data-panel .sheet-handle {
    width: 40px; height: 4px; border-radius: 2px;
    background: var(--border); margin: 10px auto 4px; flex-shrink: 0;
}

.collision-data-panel .panel-header {
    background: var(--surface-muted);
    color: var(--text);
    padding: 14px 16px;
    display: flex; justify-content: space-between; align-items: center;
    flex-shrink: 0;
    border-radius: 0;
    border-bottom: 1px solid var(--border-subtle);
}
.collision-data-panel .panel-header h3 { margin: 0; font-size: 15px; font-weight: 600; }
.collision-data-panel .panel-close-btn {
    background: rgba(255,255,255,0.08); border: none; color: var(--text-secondary);
    cursor: pointer; padding: 8px 12px; border-radius: 6px;
    min-width: 44px; min-height: 44px;
    display: flex; align-items: center; justify-content: center;
}
.collision-data-panel .panel-content {
    padding: 16px; overflow-y: auto; flex: 1;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    color: var(--text-secondary);
}

/* Desktop: side panel (same toolbar + features as mobile) */
@media (min-width: 768px) {
    .map-search-bar {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: min(560px, calc(100% - 24px));
    }

    .map-bottom-bar {
        max-width: 580px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 14px 14px 0 0;
        border: 1px solid var(--border-subtle);
        border-bottom: none;
    }

    .route-planner {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: min(560px, calc(100% - 24px));
    }

    .bar-btn {
        font-size: 11px;
        min-height: 56px;
    }

    .bar-btn i { font-size: 1.15rem; }

    .collision-data-panel {
        top: calc(var(--header-h) + var(--search-h) + var(--safe-top) + 16px);
        right: 16px; left: auto; bottom: auto;
        width: 400px; max-height: calc(100vh - var(--header-h) - var(--search-h) - var(--bar-h) - 48px);
        border-radius: 16px;
        border: 1px solid var(--border-subtle);
        transform: translateX(calc(100% + 24px));
        padding-bottom: 0;
        transition: transform 0.35s ease;
    }
    .collision-data-panel.sheet-open { transform: translateX(0); }
    .collision-data-panel .sheet-handle { display: none; }
    .sheet-backdrop { display: none; }

    .notification-container {
        left: auto;
        right: 16px;
        width: min(360px, calc(100% - 32px));
    }

    .gmaps-control-wrap {
        margin-bottom: calc(var(--bar-h) + 16px);
    }
}

/* Stats & charts in panel */
.collision-stats-row {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px;
}
.collision-stat {
    text-align: center; padding: 10px 4px; background: var(--surface-muted);
    border-radius: 10px; border: 1px solid var(--border-subtle);
}
.collision-stat .val { display: block; font-size: 17px; font-weight: 700; color: var(--text); }
.collision-stat .lbl { font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.collision-stat.fatal .val { color: #F87171; }
.collision-stat.serious .val { color: #FB923C; }
.collision-stat.slight .val { color: #FBBF24; }

.collision-year-filter {
    display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 14px;
    color: var(--text-secondary);
}
.collision-year-filter select {
    flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
    font-size: 16px; font-family: inherit; background: var(--surface-muted);
    color: var(--text);
}

.collision-risk {
    padding: 12px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 10px;
}
.collision-risk.risk-low { background: rgba(34, 197, 94, 0.12); color: #86EFAC; border: 1px solid rgba(34, 197, 94, 0.2); }
.collision-risk.risk-medium { background: rgba(251, 146, 60, 0.12); color: #FDBA74; border: 1px solid rgba(251, 146, 60, 0.2); }
.collision-risk.risk-high { background: rgba(248, 113, 113, 0.12); color: #FCA5A5; border: 1px solid rgba(248, 113, 113, 0.2); }
.collision-risk .sub { display: block; font-size: 12px; margin-top: 4px; opacity: 0.85; }

.collision-radius-note { font-size: 12px; color: var(--text-muted); margin: 0 0 12px; }
.collision-charts h4 { font-size: 14px; margin: 16px 0 8px; color: var(--text); font-weight: 600; }
.collision-charts canvas { max-height: 140px; margin-bottom: 8px; width: 100% !important; }

.collision-breakdown { margin-top: 12px; }
.collision-breakdown h4 {
    font-size: 13px; margin: 0 0 8px; color: var(--text); font-weight: 600;
}
.breakdown-list { list-style: none; padding: 0; margin: 0; }
.breakdown-list li {
    display: grid; grid-template-columns: minmax(72px, 38%) 1fr auto;
    gap: 8px; align-items: center; font-size: 12px;
    padding: 6px 0; border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}
.breakdown-list li:last-child { border-bottom: none; }
.breakdown-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breakdown-bar {
    height: 6px; background: var(--surface-muted); border-radius: 999px; overflow: hidden;
}
.breakdown-bar span {
    display: block; height: 100%; background: rgba(59, 130, 246, 0.75); border-radius: 999px;
}
.breakdown-count { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

.collision-hotspots-list h4 { font-size: 14px; margin: 16px 0 10px; color: var(--text); font-weight: 600; }
.collision-hotspots-list ul { list-style: none; padding: 0; }
.collision-hotspots-list .hotspot-jump {
    width: 100%; text-align: left; border: 1px solid var(--border-subtle); background: var(--surface-muted);
    border-radius: 12px; padding: 14px; margin-bottom: 8px; cursor: pointer;
    font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
    min-height: 48px; color: var(--text-secondary);
}
.collision-hotspots-list .hotspot-jump:active { background: rgba(59, 130, 246, 0.12); }
.collision-hotspots-list .rank { font-weight: 700; color: #93C5FD; }
.collision-hotspots-list .tag.fatal { font-size: 10px; padding: 2px 8px; border-radius: 6px; background: #7f1d1d; color: #fff; }
.collision-hotspots-list .tag.serious { font-size: 10px; padding: 2px 8px; border-radius: 6px; background: #ea580c; color: #fff; }

.collision-footer {
    margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border-subtle);
    display: flex; flex-direction: column; gap: 10px;
}
.collision-footer button {
    width: 100%; padding: 14px; border: none; border-radius: 12px;
    font-size: 14px; font-weight: 600; cursor: pointer; color: #fff;
    min-height: 48px;
}
.btn-clear-collision { background: #475569; }
.btn-refresh-collision { background: var(--accent); }

.collision-hotspot-marker span {
    display: flex; align-items: center; justify-content: center;
    background: rgba(59, 130, 246, 0.92); color: #fff; font-weight: 700; font-size: 12px;
    border-radius: 50%; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}
.collision-point-marker span {
    display: block; width: 12px; height: 12px; border-radius: 50%;
    border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.loading-collision, .no-collision-data, .error-collision {
    text-align: center; padding: 32px 16px; color: var(--text-muted);
}
.no-collision-data i { font-size: 2.5rem; color: #4ADE80; margin-bottom: 12px; display: block; }

/* Loading & notifications */
.map-loading {
    position: fixed; inset: 0; z-index: 200;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: var(--bg); color: var(--text-muted);
}
.map-loading.hidden { display: none; }

.spinner {
    width: 40px; height: 40px;
    border: 2px solid var(--border);
    border-top-color: var(--accent); border-radius: 50%;
    animation: spin 0.8s linear infinite; margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.map-error {
    display: flex; align-items: center; justify-content: center;
    height: 100%; padding: 2rem; text-align: center; color: var(--text-muted);
}

.notification-container {
    position: fixed;
    top: calc(var(--header-h) + var(--search-h) + var(--safe-top) + 16px);
    left: 12px; right: 12px;
    z-index: 300;
    display: flex; flex-direction: column; gap: 8px;
    pointer-events: none;
}
.notification {
    padding: 12px 16px; border-radius: 12px; font-size: 13px; color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    animation: slideDown 0.3s ease;
    pointer-events: auto;
}
.notification-info { background: #334155; }
.notification-success { background: #15803d; }
.notification-warning { background: #b45309; }
.notification-error { background: #b91c1c; }
.notification.fade-out { opacity: 0; transition: opacity 0.3s; }

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

/* Route summary card — Google-Maps-style quick glance for the selected route */
.route-summary-card {
    position: fixed;
    bottom: calc(var(--bar-h) + var(--safe-bottom) + 12px);
    left: 12px; right: 12px;
    z-index: 95;
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: 18px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.55);
    padding: 12px 14px;
    transform: translateY(calc(100% + 90px));
    opacity: 0;
    transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.25s ease;
    pointer-events: none;
}
.route-summary-card.visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}
@media (min-width: 768px) {
    .route-summary-card {
        left: 16px; right: auto;
        width: 420px;
        bottom: calc(var(--bar-h) + 16px);
    }
}

.rsc-alts {
    display: flex; gap: 8px; margin-bottom: 10px;
    overflow-x: auto; scrollbar-width: none;
}
.rsc-alts::-webkit-scrollbar { display: none; }
.rsc-alt {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 10px 5px 5px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface-muted);
    color: var(--text-secondary); font-family: inherit;
    font-size: 12px; font-weight: 700; cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    flex-shrink: 0;
}
.rsc-alt.active { border-color: #60A5FA; background: rgba(96, 165, 250, 0.14); color: var(--text); }
.rsc-alt-letter {
    width: 20px; height: 20px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #0C0F14; font-size: 11px; font-weight: 800;
}
.rsc-alt.rsc-low .rsc-alt-score { color: #4ADE80; }
.rsc-alt.rsc-medium .rsc-alt-score { color: #FBBF24; }
.rsc-alt.rsc-high .rsc-alt-score { color: #F87171; }

.rsc-main {
    display: flex; align-items: center; gap: 12px;
}
.rsc-score {
    min-width: 56px; padding: 7px 8px; border-radius: 12px; text-align: center;
}
.rsc-score strong { display: block; font-size: 21px; font-weight: 800; line-height: 1.05; }
.rsc-score span { display: block; font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; margin-top: 2px; opacity: 0.9; }
.rsc-score.rsc-low { background: rgba(74, 222, 128, 0.13); color: #86EFAC; border: 1px solid rgba(74, 222, 128, 0.25); }
.rsc-score.rsc-medium { background: rgba(251, 191, 36, 0.13); color: #FCD34D; border: 1px solid rgba(251, 191, 36, 0.25); }
.rsc-score.rsc-high { background: rgba(248, 113, 113, 0.13); color: #FCA5A5; border: 1px solid rgba(248, 113, 113, 0.25); }

.rsc-trip { flex: 1; min-width: 0; }
.rsc-trip-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rsc-duration { font-size: 19px; font-weight: 800; color: var(--text); }
.rsc-traffic {
    font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
    display: inline-flex; align-items: center; gap: 5px;
}
.rsc-traffic-light { background: rgba(74, 222, 128, 0.13); color: #86EFAC; }
.rsc-traffic-moderate { background: rgba(251, 191, 36, 0.14); color: #FCD34D; }
.rsc-traffic-heavy { background: rgba(248, 113, 113, 0.15); color: #FCA5A5; }
.rsc-trip-sub {
    font-size: 11.5px; color: var(--text-muted); margin-top: 3px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rsc-close {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.07); border: 1px solid var(--border);
    color: var(--text-muted); width: 28px; height: 28px; border-radius: 50%;
    cursor: pointer; font-size: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}

.rsc-chips {
    display: flex; gap: 6px; margin-top: 10px;
    overflow-x: auto; scrollbar-width: none; padding-bottom: 2px;
}
.rsc-chips::-webkit-scrollbar { display: none; }
.rsc-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 10px; border-radius: 999px; flex-shrink: 0;
    background: var(--surface-muted); border: 1px solid var(--border-subtle);
    color: var(--text-secondary); font-size: 11px; font-weight: 600;
}
.rsc-chip i { font-size: 10px; color: #93C5FD; }
.rsc-chip.rsc-low { border-color: rgba(74, 222, 128, 0.3); }
.rsc-chip.rsc-low i { color: #4ADE80; }
.rsc-chip.rsc-medium { border-color: rgba(251, 191, 36, 0.32); }
.rsc-chip.rsc-medium i { color: #FBBF24; }
.rsc-chip.rsc-high { border-color: rgba(248, 113, 113, 0.34); }
.rsc-chip.rsc-high i { color: #F87171; }

.rsc-actions { display: flex; gap: 8px; margin-top: 10px; }
.rsc-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 10px; border-radius: 12px; cursor: pointer;
    background: var(--surface-muted); border: 1px solid var(--border);
    color: var(--text-secondary); font-family: inherit; font-size: 12px; font-weight: 700;
}
.rsc-btn-primary {
    background: rgba(59, 130, 246, 0.16); border-color: rgba(59, 130, 246, 0.4);
    color: #93C5FD;
}
.rsc-btn:active { transform: scale(0.98); }

/* Route severity legend — appears below the chips row in the summary card */
.rsc-severity-legend {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin-top: 8px; padding: 6px 10px; border-radius: 10px;
    background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border-subtle);
    font-size: 10.5px;
}
.rsc-legend-title {
    color: var(--text-muted); font-weight: 600; margin-right: 2px; flex-shrink: 0;
    letter-spacing: 0.02em;
}
.rsc-legend-item {
    display: inline-flex; align-items: center; gap: 4px;
    color: var(--text-secondary); font-weight: 600; flex-shrink: 0;
}
.rsc-legend-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

/* Traffic delay badge in analysis panel meta row */
.route-traffic-delay { font-weight: 700; }
.route-traffic-delay.traffic-light { color: #86EFAC; }
.route-traffic-delay.traffic-moderate { color: #FCD34D; }
.route-traffic-delay.traffic-heavy { color: #FCA5A5; }

/* Route Time-of-Day Safety Panel */
.route-tod-panel {
    position: fixed;
    bottom: calc(var(--bar-h) + var(--safe-bottom) + 12px);
    left: 12px; right: 12px;
    z-index: 90;
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.55);
    padding: 14px 16px;
    transform: translateY(calc(100% + 90px));
    opacity: 0;
    transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.25s ease;
    pointer-events: none;
}
.route-tod-panel.visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}
@media (min-width: 768px) {
    .route-tod-panel {
        left: 16px; right: auto;
        width: 420px;
        bottom: calc(var(--bar-h) + 16px);
    }
}

.tod-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 3px;
}
.tod-title {
    display: flex; align-items: center; gap: 7px;
    font-size: 14px; font-weight: 700; color: var(--text);
}
.tod-title i { color: #60A5FA; font-size: 13px; }
.tod-close-btn {
    background: rgba(255, 255, 255, 0.07); border: 1px solid var(--border);
    color: var(--text-muted); cursor: pointer;
    padding: 5px 9px; border-radius: 6px; font-size: 12px;
    min-width: 30px; min-height: 30px;
    display: flex; align-items: center; justify-content: center;
}
.tod-close-btn:active { background: rgba(255, 255, 255, 0.12); }

.tod-subtitle {
    font-size: 11px; color: var(--text-muted); margin-bottom: 10px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.tod-chart-wrap {
    position: relative; height: 88px; margin-bottom: 6px;
    cursor: pointer;
}

.tod-cursor-info {
    display: flex; align-items: center; gap: 8px;
    min-height: 26px; margin-bottom: 8px; font-size: 13px;
    padding: 5px 8px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px; border: 1px solid var(--border-subtle);
}
.tod-scanning-hour { font-weight: 700; color: var(--text); font-size: 14px; min-width: 44px; }
.tod-scanning-count { color: var(--text-secondary); font-size: 12px; }
.tod-risk-badge {
    font-size: 10px; padding: 3px 9px; border-radius: 20px;
    font-weight: 700; letter-spacing: 0.02em; margin-left: auto; white-space: nowrap;
}
.tod-risk-safe    { background: rgba(74, 222, 128, 0.15); color: #4ADE80; border: 1px solid rgba(74, 222, 128, 0.3); }
.tod-risk-moderate{ background: rgba(251, 191, 36, 0.15);  color: #FBBF24; border: 1px solid rgba(251, 191, 36, 0.3);  }
.tod-risk-risky   { background: rgba(248, 113, 113, 0.15); color: #F87171; border: 1px solid rgba(248, 113, 113, 0.3); }

.tod-recommendation {
    display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 8px;
}
.tod-rec-item {
    display: flex; align-items: center; gap: 7px;
    font-size: 12px; padding: 8px 10px; border-radius: 10px;
}
.tod-rec-item i { font-size: 13px; flex-shrink: 0; }
.tod-rec-item strong { font-weight: 700; }
.tod-rec-item .tod-rec-sub { font-size: 10px; opacity: 0.8; display: block; margin-top: 1px; }
.tod-rec-item.safe  { background: rgba(74, 222, 128, 0.1); color: #86EFAC; border: 1px solid rgba(74, 222, 128, 0.2); }
.tod-rec-item.risky { background: rgba(248, 113, 113, 0.1); color: #FCA5A5; border: 1px solid rgba(248, 113, 113, 0.2); }

.tod-your-time {
    font-size: 12px; color: var(--text-secondary); margin-bottom: 8px;
    padding: 8px 10px; border-radius: 10px;
    background: rgba(59, 130, 246, 0.09); border: 1px solid rgba(59, 130, 246, 0.2);
    display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
}
.tod-your-time i { color: #60A5FA; font-size: 12px; flex-shrink: 0; }
.tod-risk-inline {
    font-size: 11px; padding: 2px 8px; border-radius: 12px; font-weight: 700;
    display: inline-flex; align-items: center;
}

.tod-hint-bar {
    font-size: 11px; color: var(--text-muted); margin-bottom: 8px; text-align: center;
}

.tod-actions { display: flex; gap: 8px; }
.tod-btn-full {
    flex: 1; padding: 12px 10px; background: var(--accent); color: #fff;
    border: none; border-radius: 10px; font-size: 13px; font-weight: 600;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    gap: 6px; min-height: 44px; transition: background 0.15s;
}
.tod-btn-full:active { background: var(--accent-hover); }

/* Google Places dropdown above bottom bar */
.pac-container { z-index: 200 !important; border-radius: 12px; margin-top: 4px; font-family: inherit; }

/* Accident marker info popup */
.collision-info-window {
    position: relative;
    padding: 12px 36px 12px 14px;
    max-width: 300px;
    background: #fff;
    color: #0f172a;
    font-family: 'Source Sans 3', system-ui, sans-serif;
    font-size: 13px;
    line-height: 1.45;
}
.collision-info-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 8px;
    background: #e2e8f0;
    color: #0f172a;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 2;
}
.collision-info-close:hover { background: #cbd5e1; }
.collision-info-close:active { background: #94a3b8; }

/* Google Maps InfoWindow shell */
.gm-style .gm-style-iw-c {
    padding: 0 !important;
    border-radius: 12px !important;
    overflow: visible !important;
}
.gm-style .gm-style-iw-d {
    overflow: auto !important;
    max-height: 280px !important;
}
.gm-style .gm-style-iw-chr {
    display: none !important;
}
.gm-style .gm-style-iw-tc::after {
    background: #fff !important;
}

/* ── Fuel Finder stations ─────────────────────────────────────────────── */
.fuel-brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid rgba(255, 255, 255, 0.92);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
    flex-shrink: 0;
    line-height: 0;
    overflow: hidden;
    user-select: none;
}
.fuel-brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.fuel-brand-logo.logo-sm {
    width: 28px;
    height: 28px;
}
.fuel-brand-logo.logo-lg {
    width: 44px;
    height: 44px;
}
.fuel-brand-logo.logo-marker {
    width: 34px;
    height: 34px;
}

.fuel-station-marker {
    width: 78px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
    transform: translateZ(0);
}
.fuel-station-marker.is-closed {
    filter: grayscale(1) drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
    opacity: 0.72;
}
.fuel-station-marker.is-closed .fuel-marker-card {
    background: linear-gradient(180deg, rgba(40, 44, 52, 0.96), rgba(28, 31, 38, 0.96));
    border-color: rgba(148, 163, 184, 0.28);
}
.fuel-station-marker.is-closed .fuel-marker-price.is-petrol,
.fuel-station-marker.is-closed .fuel-marker-price.is-diesel {
    background: rgba(100, 116, 139, 0.18);
    border-color: rgba(148, 163, 184, 0.3);
}
.fuel-station-marker.is-closed .fuel-marker-kind,
.fuel-station-marker.is-closed .fuel-marker-price strong,
.fuel-station-marker.is-closed .fuel-marker-best {
    color: #CBD5E1 !important;
}
.fuel-station-marker.is-closed .fuel-marker-pointer {
    background: #2a303a;
    border-color: rgba(148, 163, 184, 0.28);
}
.fuel-marker-card {
    position: relative;
    display: grid;
    gap: 3px;
    min-width: 74px;
    padding: 5px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(16, 24, 38, 0.96), rgba(10, 16, 28, 0.96));
    border: 1px solid rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(8px);
}
.fuel-marker-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto 1px;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.2;
}
.fuel-marker-status.is-open {
    background: rgba(34, 197, 94, 0.22);
    color: #86EFAC;
    border: 1px solid rgba(74, 222, 128, 0.35);
}
.fuel-marker-status.is-closed {
    background: rgba(100, 116, 139, 0.28);
    color: #E2E8F0;
    border: 1px solid rgba(148, 163, 184, 0.35);
}
.fuel-marker-status.is-unknown {
    background: rgba(148, 163, 184, 0.16);
    color: #94A3B8;
    border: 1px solid rgba(148, 163, 184, 0.25);
}
.fuel-marker-price {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 2px 6px;
    padding: 5px 7px;
    border-radius: 10px;
    line-height: 1.05;
}
.fuel-marker-price.is-petrol {
    background: linear-gradient(135deg, rgba(245, 185, 66, 0.22), rgba(245, 185, 66, 0.08));
    border: 1px solid rgba(245, 185, 66, 0.35);
}
.fuel-marker-price.is-diesel {
    background: linear-gradient(135deg, rgba(45, 212, 191, 0.2), rgba(45, 212, 191, 0.07));
    border: 1px solid rgba(45, 212, 191, 0.35);
}
.fuel-marker-price.is-best {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.fuel-marker-kind {
    grid-column: 1 / -1;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.9;
}
.fuel-marker-price.is-petrol .fuel-marker-kind { color: #F5B942; }
.fuel-marker-price.is-diesel .fuel-marker-kind { color: #5EEAD4; }
.fuel-marker-price strong {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #F8FAFC;
}
.fuel-marker-best {
    font-style: normal;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 2px 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #FDE68A;
}
.fuel-marker-pointer {
    position: absolute;
    left: 50%;
    bottom: -5px;
    width: 10px;
    height: 10px;
    transform: translateX(-50%) rotate(45deg);
    background: #101826;
    border-right: 1px solid rgba(255, 255, 255, 0.16);
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}
.fuel-marker-prices {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 58px;
    padding: 3px 5px;
    border-radius: 8px;
    background: rgba(12, 15, 20, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.14);
}
.fuel-marker-price-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px;
    line-height: 1.15;
    white-space: nowrap;
}
.fuel-marker-price-row em {
    font-style: normal;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.02em;
    opacity: 0.85;
}
.fuel-marker-price-row strong {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #F8FAFC;
}
.fuel-marker-price-row.is-petrol em { color: #5EEAD4; }
.fuel-marker-price-row.is-diesel em { color: #FBBF24; }

.fuel-stations-panel .panel-header h3 i { color: #5EEAD4; }
.fuel-map-follow-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(94, 234, 212, 0.1);
    border: 1px solid rgba(94, 234, 212, 0.22);
    color: #99F6E4;
    font-size: 12px;
    font-weight: 600;
}

.fuel-summary {
    padding: 4px 0 12px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 12px;
}
.fuel-summary-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 10px;
}
.fuel-refresh-btn {
    border: 1px solid var(--border);
    background: var(--surface-muted);
    color: var(--text);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.fuel-cheap-grid,
.fuel-cheap-grid-duo {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.fuel-cheap-chip {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 8px;
    padding: 10px;
    border-radius: 12px;
    background: var(--surface-muted);
    border: 1px solid var(--border-subtle);
    align-items: center;
}
.fuel-cheap-chip.is-clickable {
    width: 100%;
    text-align: left;
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}
.fuel-cheap-chip.is-clickable:hover,
.fuel-cheap-chip.is-clickable:focus-visible {
    border-color: rgba(94, 234, 212, 0.45);
    background: rgba(94, 234, 212, 0.08);
    outline: none;
}
.fuel-cheap-chip.is-clickable:active {
    transform: scale(0.98);
}
.fuel-cheap-chip .fuel-brand-logo,
.fuel-cheap-chip i {
    grid-row: span 2;
    align-self: center;
}
.fuel-cheap-chip i { font-size: 1rem; }
.fuel-cheap-chip strong {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}
.fuel-cheap-chip span {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}
.fuel-cheap-chip small {
    grid-column: 2;
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fuel-cheap-chip.is-empty span { color: var(--text-muted); }
.fuel-cheap-chip.tone-petrol i { color: #5EEAD4; }
.fuel-cheap-chip.tone-super i { color: #7DD3FC; }
.fuel-cheap-chip.tone-diesel i { color: #FBBF24; }
.fuel-cheap-chip.tone-premium i { color: #FDBA74; }

.fuel-station-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.fuel-station-row {
    display: flex;
    gap: 12px;
    width: 100%;
    text-align: left;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid var(--border-subtle);
    background: var(--surface-muted);
    color: var(--text);
    cursor: pointer;
}
.fuel-station-row:active { background: #222938; }
.fuel-station-row.is-closed {
    opacity: 0.78;
    filter: grayscale(0.85);
    background: #1a1f28;
    border-color: rgba(148, 163, 184, 0.22);
}
.fuel-station-row.is-closed .fuel-price-pill {
    background: rgba(100, 116, 139, 0.16) !important;
    border-color: rgba(148, 163, 184, 0.28) !important;
    color: #CBD5E1 !important;
}
.fuel-station-status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 4px 0 6px;
}
.fuel-station-status-row small {
    color: var(--text-muted);
    font-size: 11px;
}
.fuel-open-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}
.fuel-open-badge.is-open {
    background: rgba(34, 197, 94, 0.18);
    color: #86EFAC;
    border: 1px solid rgba(74, 222, 128, 0.3);
}
.fuel-open-badge.is-closed {
    background: rgba(100, 116, 139, 0.25);
    color: #E2E8F0;
    border: 1px solid rgba(148, 163, 184, 0.35);
}
.fuel-open-badge.is-unknown {
    background: rgba(148, 163, 184, 0.12);
    color: #94A3B8;
    border: 1px solid rgba(148, 163, 184, 0.22);
}
.fuel-station-icon {
    display: flex;
    align-items: flex-start;
    padding-top: 2px;
    background: transparent;
    border: none;
    width: auto;
    height: auto;
    min-width: 0;
}
.fuel-station-title {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
}
.fuel-station-title strong {
    font-size: 14px;
    font-weight: 650;
}
.fuel-station-title span {
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}
.fuel-station-address {
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 8px;
    line-height: 1.35;
}
.fuel-price-pills,
.fuel-price-duo {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.fuel-price-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
}
.fuel-price-pill em {
    font-style: normal;
    font-weight: 600;
    opacity: 0.8;
    font-size: 11px;
}
.fuel-price-pill.tone-petrol { color: #99F6E4; border-color: rgba(94, 234, 212, 0.3); }
.fuel-price-pill.tone-super { color: #BAE6FD; border-color: rgba(125, 211, 252, 0.3); }
.fuel-price-pill.tone-diesel { color: #FDE68A; border-color: rgba(251, 191, 36, 0.3); }
.fuel-price-pill.tone-premium { color: #FED7AA; border-color: rgba(253, 186, 116, 0.3); }

.fuel-source-note {
    margin-top: 14px;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}
.loading-fuel, .no-fuel-data, .error-fuel {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
}
.loading-fuel i, .no-fuel-data i, .error-fuel i {
    font-size: 2rem;
    margin-bottom: 12px;
    display: block;
}
.loading-fuel-hint {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
    opacity: 0.85;
}
.error-fuel button, .loading-fuel button {
    margin-top: 12px;
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}
.fuel-setup-hint {
    margin-top: 12px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
}
.fuel-setup-hint a { color: #5EEAD4; }
.fuel-setup-hint code {
    font-size: 11px;
    background: var(--surface);
    padding: 1px 5px;
    border-radius: 4px;
}

.fuel-info-window {
    position: relative;
    padding: 14px 36px 12px 14px;
    max-width: 300px;
    background: #fff;
    color: #0f172a;
    font-family: 'Source Sans 3', system-ui, sans-serif;
    font-size: 13px;
    line-height: 1.4;
}
.fuel-info-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 8px;
    background: #e2e8f0;
    color: #0f172a;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.fuel-info-brand {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 12px;
}
.fuel-info-brand .fuel-brand-logo {
    border-color: #e2e8f0;
    box-shadow: none;
}
.fuel-info-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #ccfbf1;
    color: #0f766e;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.fuel-info-brand strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
}
.fuel-info-address {
    color: #64748b;
    font-size: 12px;
    margin-top: 2px;
}
.fuel-info-prices {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.fuel-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}
.fuel-info-grade {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #334155;
}
.fuel-info-row.tone-petrol .fuel-info-grade i { color: #0f766e; }
.fuel-info-row.tone-super .fuel-info-grade i { color: #0369a1; }
.fuel-info-row.tone-diesel .fuel-info-grade i { color: #b45309; }
.fuel-info-row.tone-premium .fuel-info-grade i { color: #9a3412; }
.fuel-info-price {
    text-align: right;
}
.fuel-info-price strong {
    display: block;
    font-size: 15px;
    font-weight: 750;
    color: #0f172a;
}
.fuel-info-price small {
    color: #94a3b8;
    font-size: 10px;
}
.fuel-info-meta {
    margin-top: 10px;
    color: #64748b;
    font-size: 12px;
}
.fuel-info-empty {
    color: #94a3b8;
    margin: 0;
}

/* Station details modal */
body.fuel-modal-open { overflow: hidden; }
.fuel-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 220;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 12px 12px calc(12px + var(--safe-bottom, 0px));
    background: rgba(2, 6, 12, 0.62);
    opacity: 0;
    transition: opacity 0.18s ease;
}
.fuel-modal-backdrop.is-open { opacity: 1; }
.fuel-station-modal,
.fuel-modal-sheet {
    width: min(440px, 100%);
    max-height: min(88vh, 760px);
}
.fuel-modal-sheet {
    position: relative;
    overflow: auto;
    border-radius: 22px 22px 18px 18px;
    background: #101826;
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    color: #F8FAFC;
    padding: 10px 16px 18px;
    transform: translateY(18px);
    transition: transform 0.2s ease;
}
.fuel-modal-backdrop.is-open .fuel-modal-sheet { transform: none; }
.fuel-modal-handle {
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.35);
    margin: 4px auto 12px;
}
.fuel-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: #F8FAFC;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.fuel-modal-header {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding-right: 36px;
    margin-bottom: 14px;
}
.fuel-modal-brand {
    margin: 0;
    color: #F5B942;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.fuel-modal-heading h2 {
    margin: 2px 0 6px;
    font-size: 1.15rem;
    line-height: 1.25;
}
.fuel-modal-address,
.fuel-modal-distance {
    margin: 0;
    color: #94A3B8;
    font-size: 13px;
    line-height: 1.4;
}
.fuel-modal-distance {
    margin-top: 6px;
}
.fuel-modal-distance i { margin-right: 4px; color: #5EEAD4; }

.fuel-modal-status {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px 14px;
    border-radius: 14px;
    margin-bottom: 12px;
    border: 1px solid transparent;
}
.fuel-modal-status i { font-size: 1.1rem; }
.fuel-modal-status strong { display: block; font-size: 14px; }
.fuel-modal-status span { color: #CBD5E1; font-size: 12px; }
.fuel-modal-status.is-open {
    background: rgba(45, 212, 191, 0.12);
    border-color: rgba(45, 212, 191, 0.28);
    color: #5EEAD4;
}
.fuel-modal-status.is-closed {
    background: rgba(248, 113, 113, 0.12);
    border-color: rgba(248, 113, 113, 0.28);
    color: #FCA5A5;
}
.fuel-modal-status.is-unknown {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.22);
    color: #CBD5E1;
}

.fuel-modal-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}
.fuel-modal-flag {
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(245, 185, 66, 0.12);
    border: 1px solid rgba(245, 185, 66, 0.28);
    color: #F5B942;
    font-size: 11px;
    font-weight: 700;
}

.fuel-modal-section {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.14);
}
.fuel-modal-section h3 {
    margin: 0 0 10px;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94A3B8;
}
.fuel-modal-prices { display: grid; gap: 8px; }
.fuel-modal-price {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.14);
}
.fuel-modal-price strong { display: block; font-size: 13px; }
.fuel-modal-price small { color: #64748B; font-size: 11px; }
.fuel-modal-price span { font-size: 1.05rem; font-weight: 800; }
.fuel-modal-price.tone-petrol span { color: #99F6E4; }
.fuel-modal-price.tone-diesel span { color: #FDE68A; }
.fuel-modal-price.tone-super span { color: #BAE6FD; }
.fuel-modal-price.tone-premium span { color: #FED7AA; }

.fuel-hours-list { display: grid; gap: 6px; }
.fuel-hours-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 2px;
    color: #CBD5E1;
    font-size: 13px;
}
.fuel-hours-row.is-today {
    color: #F8FAFC;
    font-weight: 700;
}
.fuel-hours-row.is-today span::after {
    content: ' · today';
    color: #5EEAD4;
    font-weight: 650;
}
.fuel-hours-bank { border-top: 1px dashed rgba(148, 163, 184, 0.2); margin-top: 4px; padding-top: 10px; }

.fuel-amenity-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.fuel-amenity-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(148, 163, 184, 0.18);
    font-size: 12px;
    font-weight: 650;
    color: #E2E8F0;
}
.fuel-amenity-chip i { color: #5EEAD4; }

.fuel-modal-empty {
    margin: 0;
    color: #64748B;
    font-size: 13px;
}
.fuel-modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 16px;
}
.fuel-modal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(255, 255, 255, 0.05);
    color: #F8FAFC;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
}
.fuel-modal-btn.primary {
    background: linear-gradient(135deg, #F5B942, #E89A1C);
    color: #1A1205;
    border-color: transparent;
}
.fuel-modal-btn.whatsapp {
    background: #25D366;
    border-color: transparent;
    color: #052e16;
    grid-column: 1 / -1;
}
.fuel-modal-actions:has(> :only-child) {
    grid-template-columns: 1fr;
}

/* Floating WhatsApp share (map) */
.map-whatsapp-share {
    position: fixed;
    right: 14px;
    bottom: calc(var(--bar-h, 64px) + var(--safe-bottom, 0px) + 18px);
    z-index: 120;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 14px;
    border-radius: 999px;
    background: #25D366;
    color: #052e16;
    font-weight: 800;
    font-size: 13px;
    text-decoration: none;
    box-shadow: 0 10px 28px rgba(37, 211, 102, 0.35);
}
.map-whatsapp-share i { font-size: 1.15rem; }
@media (min-width: 768px) {
    .map-whatsapp-share { bottom: 24px; }
}

@media (min-width: 720px) {
    .fuel-modal-backdrop {
        align-items: center;
        padding: 24px;
    }
    .fuel-modal-sheet {
        border-radius: 20px;
        max-height: min(82vh, 740px);
    }
    .fuel-modal-handle { display: none; }
}

@media (max-width: 420px) {
    .map-bottom-bar .bar-btn span { font-size: 9px; }
    .map-bottom-bar .bar-btn { padding: 6px 2px; }
}
