/* ══════════════════════════════════════════════════════════════════════
   BespaarBrandstof.nl — ACC Redesign
   Design: Modern Dutch consumer app (Flitsmeister × ANWB aesthetic)
   Fonts: Outfit (headings) + DM Sans (body)
   ══════════════════════════════════════════════════════════════════════ */

/* ── 1. CSS Custom Properties ────────────────────────────────────── */
:root {
    /* Brand palette */
    --primary: #0d9488;
    --primary-hover: #0f766e;
    --primary-light: #ccfbf1;
    --primary-subtle: #f0fdfa;
    --accent: #f59e0b;
    --accent-hover: #d97706;
    --accent-light: #fef3c7;
    --teal: #0d9488;
    --green: #16a34a;
    --green-light: #dcfce7;
    --green-bg: #f0fdf4;
    --orange: #ea580c;
    --orange-light: #fff7ed;
    --red: #dc2626;
    --red-light: #fef2f2;

    /* Warm neutrals (not cool slate) */
    --bg: #faf9f7;
    --panel-bg: #ffffff;
    --text: #292524;
    --text-secondary: #57534e;
    --text-muted: #635d58;
    --border: #e7e5e4;
    --border-hover: #d6d3d1;
    --surface: #f5f5f4;
    --surface-hover: #e7e5e4;

    /* Spacing scale */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;
    --space-2xl: 32px;

    /* Layout */
    --panel-width: 440px;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(41, 37, 36, 0.05);
    --shadow: 0 1px 3px rgba(41, 37, 36, 0.08), 0 1px 2px rgba(41, 37, 36, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(41, 37, 36, 0.08), 0 2px 4px -2px rgba(41, 37, 36, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(41, 37, 36, 0.08), 0 4px 6px -4px rgba(41, 37, 36, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(41, 37, 36, 0.1), 0 8px 10px -6px rgba(41, 37, 36, 0.06);

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;

    /* Mobile bottom sheet */
    --sheet-handle-height: 28px;
    --footer-height: 32px;
}

/* ── 2. Base Reset ───────────────────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Global button reset — prevent browser-default styling on ALL buttons.
   Specific button styles (btn-primary, btn-secondary, etc.) add back
   backgrounds, borders and colors as needed. */
button {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', 'DM Sans', sans-serif;
    line-height: 1.25;
    font-weight: 600;
}

img {
    max-width: 100%;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
}

/* ── 3. Skip to Content (Accessibility) ──────────────────────────── */
.skip-to-content {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    z-index: 99999;
    padding: var(--space-sm) var(--space-lg);
    background: var(--primary);
    color: white;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
}

.skip-to-content:focus {
    position: fixed;
    top: var(--space-lg);
    left: var(--space-lg);
    width: auto;
    height: auto;
    overflow: visible;
}

/* ── 4. Focus Styles (Accessibility) ─────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

/* ── 5. Layout ───────────────────────────────────────────────────── */
#app {
    display: flex;
    height: 100vh;
}

#panel {
    width: var(--panel-width);
    min-width: 280px;
    max-width: 720px;
    background: var(--panel-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    box-shadow: 2px 0 12px rgba(41, 37, 36, 0.06);
    padding-bottom: var(--footer-height);
    position: relative;
}
#panel-resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    background: transparent;
    z-index: 1001;
    transition: background 0.15s;
}
#panel-resizer:hover, #panel-resizer.dragging {
    background: var(--primary);
    opacity: 0.4;
}
@media (max-width: 768px) {
    #panel-resizer { display: none; }
}

#main-content {
    flex: 1;
    min-width: 0;
}

#map {
    flex: 1;
    height: 100vh;
}

/* ── 6. Mobile Panel Toggle ──────────────────────────────────────── */
.mobile-panel-toggle {
    display: none;
    position: fixed;
    bottom: calc(var(--footer-height) + var(--space-md));
    left: 50%;
    transform: translateX(-50%);
    z-index: 1100;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    font-size: 1.5rem;
    box-shadow: var(--shadow-lg), 0 0 0 4px rgba(13, 148, 136, 0.15);
    transition: transform var(--duration-normal) var(--ease-spring),
                box-shadow var(--duration-normal);
}

.mobile-panel-toggle:hover {
    transform: translateX(-50%) scale(1.08);
    box-shadow: var(--shadow-xl), 0 0 0 6px rgba(13, 148, 136, 0.2);
}

.mobile-panel-toggle:active {
    transform: translateX(-50%) scale(0.95);
}

/* Hamburger icon lines */
.hamburger-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    pointer-events: none;
}

.hamburger-icon span {
    display: block;
    width: 22px;
    height: 2.5px;
    background: white;
    border-radius: 2px;
    transition: transform var(--duration-normal) var(--ease-out),
                opacity var(--duration-fast);
}

.mobile-panel-toggle.active .hamburger-icon span:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
}

.mobile-panel-toggle.active .hamburger-icon span:nth-child(2) {
    opacity: 0;
}

.mobile-panel-toggle.active .hamburger-icon span:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
}

/* ── 7. Panel Header ─────────────────────────────────────────────── */
.panel-header {
    padding: var(--space-xl) var(--space-xl) var(--space-lg);
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, var(--primary-subtle) 0%, var(--panel-bg) 100%);
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}

.panel-header .header-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin: 0;
}

.panel-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
    flex: 1;
    min-width: 0;
    line-height: 1.3;
}

.panel-header .subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 2px;
    margin-bottom: var(--space-sm);
    font-weight: 400;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.btn-help {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    font-size: 0.875rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--duration-fast), transform var(--duration-fast);
    margin-top: 2px;
    flex-shrink: 0;
}

.btn-help:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
}

.btn-home {
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    text-decoration: none;
}
.btn-home:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    color: var(--primary);
    transform: scale(1.1);
}
.btn-home svg {
    stroke: currentColor;
}

/* ── 8. Sections ─────────────────────────────────────────────────── */
.panel-section {
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--border);
}

.panel-section h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--text);
    letter-spacing: -0.005em;
}

/* Collapsible section: H2 wrapping a button needs no bottom margin */
.collapsible > h2 {
    margin-bottom: 0;
}

/* Collapsible section toggle */
.section-toggle {
    cursor: pointer;
    user-select: none;
    display: flex;
    width: 100%;
    min-height: 44px;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    background: none;
    border: none;
    border-radius: 0;
    color: inherit;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: -0.005em;
    text-align: left;
    transition: color var(--duration-fast);
    -webkit-appearance: none;
    appearance: none;
}

.section-toggle:hover {
    color: var(--primary);
}

.section-toggle::after {
    content: '';
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg);
    transition: transform var(--duration-normal) var(--ease-out);
    flex-shrink: 0;
}

.section-toggle.collapsed::after {
    transform: rotate(-45deg);
}

.section-collapsed {
    display: none;
}

/* ── 9. Form Elements ────────────────────────────────────────────── */
.input-group {
    margin-bottom: var(--space-md);
}

.input-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
    letter-spacing: 0.01em;
}

.input-group input[type="text"],
.input-group select {
    width: 100%;
    padding: 10px var(--space-md);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-family: inherit;
    background: var(--panel-bg);
    color: var(--text);
    outline: none;
    transition: border-color var(--duration-fast),
                box-shadow var(--duration-fast),
                background var(--duration-fast);
}

.input-group input[type="text"]::placeholder {
    color: var(--text-muted);
}

.input-group input[type="text"]:hover,
.input-group select:hover {
    border-color: var(--border-hover);
}

.input-group input[type="text"]:focus,
.input-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
    background: var(--panel-bg);
}

/* ── 9b. My Location Button ──────────────────────────────────────── */
.btn-my-location {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--duration-fast), background var(--duration-fast);
    z-index: 2;
}

.btn-my-location:hover {
    color: var(--primary);
    background: rgba(13, 148, 136, 0.08);
}

.btn-my-location.loading {
    color: var(--primary);
    animation: pulse-location 1s ease-in-out infinite;
}

.btn-my-location.active {
    color: var(--primary);
}

@keyframes pulse-location {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Ensure input has padding-right for the button */
#input-from {
    padding-right: 34px;
}

/* ── 10. Autocomplete ────────────────────────────────────────────── */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--panel-bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    list-style: none;
    z-index: 2000;
    max-height: 220px;
    overflow-y: auto;
    display: none;
    margin-top: var(--space-xs);
}

.autocomplete-list.active {
    display: block;
    animation: slideDown var(--duration-normal) var(--ease-out);
}

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

.autocomplete-list li {
    padding: 10px var(--space-md);
    font-size: 0.85rem;
    cursor: pointer;
    min-height: 44px;
    border-bottom: 1px solid var(--border);
    transition: background var(--duration-fast);
}

.autocomplete-list li:last-child {
    border-bottom: none;
}

.autocomplete-list li:hover,
.autocomplete-list li.selected {
    background: var(--primary-subtle);
    color: var(--primary-hover);
}

/* ── 11. Waypoint ────────────────────────────────────────────────── */
.waypoint-row {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    align-items: flex-end;
    animation: fadeIn var(--duration-normal) var(--ease-out);
}

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

.waypoint-row .input-group {
    flex: 1;
    margin-bottom: 0;
}

.waypoint-row .btn-remove {
    width: 44px;
    height: 44px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel-bg);
    color: var(--red);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--duration-fast);
}

.waypoint-row .btn-remove:hover {
    background: var(--red-light);
    border-color: var(--red);
    transform: scale(1.05);
}

/* ── 12. Buttons ─────────────────────────────────────────────────── */
.btn-primary {
    width: 100%;
    padding: 11px var(--space-lg);
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: background var(--duration-fast),
                transform var(--duration-fast),
                box-shadow var(--duration-fast);
    margin-top: var(--space-sm);
    letter-spacing: 0.01em;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    width: 100%;
    padding: 8px var(--space-md);
    background: var(--surface);
    color: var(--text-secondary);
    border: 1.5px dashed var(--border);
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-family: inherit;
    transition: all var(--duration-fast);
    margin-bottom: var(--space-xs);
}

.btn-secondary:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-subtle);
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    padding: var(--space-xs) 0;
    transition: color var(--duration-fast);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.btn-link:hover {
    color: var(--primary);
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    transition: background var(--duration-fast), transform var(--duration-fast);
    min-width: 44px;
    min-height: 44px;
}

.btn-icon:hover {
    background: var(--surface);
    transform: scale(1.1);
}

/* ── 13. Toggle Switch ───────────────────────────────────────────── */
.toggle-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.toggle {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}

.toggle input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 1;
    margin: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border-hover);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background var(--duration-normal) var(--ease-out);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: transform var(--duration-normal) var(--ease-spring);
    box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle input:focus-visible + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2);
}

/* ── 14. Range Slider ────────────────────────────────────────────── */
input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, var(--primary-light), var(--border));
    border-radius: 3px;
    outline: none;
    margin: var(--space-sm) 0 var(--space-xs);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid white;
    box-shadow: var(--shadow);
    transition: transform var(--duration-fast) var(--ease-spring),
                box-shadow var(--duration-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: var(--shadow-md);
}

input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid white;
    box-shadow: var(--shadow);
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ── 15. Fuel Stop Info ──────────────────────────────────────────── */
.fuel-stop-info {
    margin-top: var(--space-md);
    padding: var(--space-md);
    background: var(--green-bg);
    border: 1px solid #bbf7d0;
    border-radius: var(--radius);
    animation: fadeIn var(--duration-normal) var(--ease-out);
}

[data-theme="dark"] .fuel-stop-info {
    border-color: #166534;
}

.fuel-stop-badge {
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--green);
    margin-bottom: var(--space-sm);
}

#fuel-stop-details {
    font-size: 0.8rem;
    color: var(--text);
    line-height: 1.6;
}

#fuel-stop-details .stop-name {
    font-weight: 600;
}

#fuel-stop-details .stop-price {
    font-weight: 700;
    color: var(--green);
    font-family: 'Outfit', sans-serif;
}

#fuel-stop-details .stop-detour {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ── 16. Fuel Stop Marker ────────────────────────────────────────── */
.fuel-stop-marker {
    border-radius: 50%;
    border: 3px solid #16a34a;
    background: white;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.5);
    text-align: center;
    font-size: 1rem;
    line-height: 32px;
    animation: pulse-green 2s ease-in-out infinite;
}

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 2px 8px rgba(22, 163, 74, 0.4); }
    50%      { box-shadow: 0 2px 16px rgba(22, 163, 74, 0.7); }
}

/* ── 17. Route Info ──────────────────────────────────────────────── */
.route-info {
    margin-top: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: var(--primary-subtle);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 500;
    text-align: center;
    border: 1px solid var(--primary-light);
    font-family: 'Outfit', sans-serif;
}

/* ── 18. Results List ────────────────────────────────────────────── */
.results-status {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
    padding: var(--space-md) 0;
}

.results-list {
    list-style: none;
    max-height: 350px;
    overflow-y: auto;
}

.results-list li {
    padding: var(--space-md);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: var(--space-sm);
    cursor: pointer;
    transition: all var(--duration-fast);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.results-list li:hover {
    border-color: var(--primary);
    background: var(--primary-subtle);
    transform: translateX(2px);
}

.results-list li:focus {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.results-list li:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.station-info {
    flex: 1;
    min-width: 0;
}

.station-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text);
}

.station-brand {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.station-distance {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.station-price {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-sm);
    text-align: right;
    white-space: nowrap;
}

.price-cheap {
    color: var(--green);
    background: var(--green-bg);
}

.price-cheap::before { content: "\25BC "; font-size: 0.7em; }

.price-average {
    color: var(--accent);
    background: var(--accent-light);
}

.price-average::before { content: "\25CF "; font-size: 0.7em; }

.price-expensive {
    color: var(--red);
    background: var(--red-light);
}

.price-expensive::before { content: "\25B2 "; font-size: 0.7em; }

/* ── 19. POI Markers ─────────────────────────────────────────────── */
.poi-marker span {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    text-align: center;
    line-height: 28px;
    font-size: 0.875rem;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.poi-link {
    text-decoration: none;
    font-size: 1.2rem;
    padding: var(--space-xs);
    flex-shrink: 0;
    transition: transform var(--duration-fast);
}

.poi-link:hover {
    transform: scale(1.15);
}

.poi-actions {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
}

/* ── 20. Speed Camera Markers ────────────────────────────────────── */
.speedcam-marker {
    font-size: 1rem;
    text-align: center;
    line-height: 24px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.speedcam-marker.waze-marker {
    font-size: 1.25rem;
    line-height: 28px;
    animation: waze-pulse 2s ease-in-out infinite;
}

@keyframes waze-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.2); opacity: 0.8; }
}

.speedcam-legend {
    margin-top: var(--space-sm);
    padding: var(--space-sm);
    background: var(--surface);
    border-radius: var(--radius);
    font-size: 0.8rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 3px 0;
}

.legend-icon {
    font-size: 1rem;
    width: 24px;
    text-align: center;
}

/* Traffic legend */
.traffic-legend {
    margin-top: var(--space-sm);
    padding: var(--space-sm);
    background: var(--surface);
    border-radius: var(--radius);
    font-size: 0.8rem;
}

.legend-swatch {
    display: inline-block;
    width: 24px;
    height: 6px;
    border-radius: 3px;
    flex-shrink: 0;
}

.traffic-green  { background: #00c853; }
.traffic-yellow { background: #ffd600; }
.traffic-orange { background: #ff9100; }
.traffic-red    { background: #d50000; }

.traffic-refresh-note {
    margin-top: var(--space-xs);
    font-size: 0.72rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ── 21. Chain Filter Chips ──────────────────────────────────────── */
.chain-filter {
    margin-bottom: var(--space-sm);
}

.chain-filter-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.chain-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    max-height: 120px;
    overflow-y: auto;
    padding: 2px;
}

.chain-chip {
    padding: 6px 12px;
    min-height: 36px;
    font-size: 0.72rem;
    font-family: inherit;
    font-weight: 500;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--panel-bg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
}

.chain-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-subtle);
}

.chain-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* ── 22. Navigation Panel ────────────────────────────────────────── */
.nav-section {
    background: var(--primary-subtle);
    border: 1px solid var(--primary-light);
    border-radius: var(--radius);
    margin: var(--space-sm);
}

.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.nav-header h2 {
    margin-bottom: 0;
}

.nav-header-buttons {
    display: flex;
    gap: var(--space-xs);
}

.nav-header-buttons .btn-icon.nav-active {
    background: var(--primary);
    color: white;
    border-radius: 50%;
}

.nav-distance {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    margin-bottom: var(--space-xs);
    letter-spacing: -0.02em;
}

.nav-instruction {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    padding: var(--space-md);
    background: var(--panel-bg);
    border-radius: var(--radius);
    margin-bottom: var(--space-sm);
    line-height: 1.4;
    box-shadow: var(--shadow-sm);
}

.nav-next {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: var(--space-sm);
}

.nav-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}

.btn-nav-step {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border: 1.5px solid var(--border);
    background: var(--panel-bg);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    transition: all var(--duration-fast);
}

.btn-nav-step:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

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

.nav-steps {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
}

/* ── 23. Route Buttons ───────────────────────────────────────────── */
.route-buttons {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
}

.route-buttons .btn-primary {
    flex: 1;
    margin-top: 0;
}

.btn-nav {
    padding: 10px var(--space-md);
    background: var(--panel-bg);
    color: var(--text);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--duration-fast);
    white-space: nowrap;
}

.btn-nav:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-subtle);
}

.btn-nav.nav-active {
    background: var(--red);
    color: white;
    border-color: var(--red);
}

.btn-reset {
    padding: 10px var(--space-md);
    min-width: 40px;
    color: var(--red);
    font-weight: 700;
    font-size: 1rem;
}

.btn-reset:hover {
    background: var(--red-light);
    border-color: var(--red);
    color: var(--red);
}

/* ── 24. Station Markers ─────────────────────────────────────────── */
.station-marker {
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    text-align: center;
    line-height: 24px;
    font-size: 0.6875rem;
    font-weight: 700;
    color: white;
}

.marker-cheap { background: var(--green); }
.marker-average { background: var(--accent); }
.marker-expensive { background: var(--red); }
.marker-unknown { background: var(--text-muted); }

/* Cheapest station highlight */
.marker-cheapest {
    width: 42px !important;
    height: 42px !important;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 600 !important;
    font-size: 1.125rem !important;
    line-height: 42px !important;
    animation: cheapest-pulse 2s infinite;
}

.marker-cheapest .cheapest-badge {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--green);
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: var(--radius-full);
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    font-family: 'Outfit', sans-serif;
}

@keyframes cheapest-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.4); }
    50%      { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0.2); }
}

/* ── 24b. EV Charger Markers ─────────────────────────────────────── */
.charger-marker {
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    text-align: center;
    line-height: 24px;
    font-size: 0.875rem;
    cursor: pointer;
}

.charger-marker-cheap { background: #0d9488; }
.charger-marker-average { background: #0891b2; }
.charger-marker-expensive { background: #dc2626; }
.charger-marker-unknown { background: var(--text-muted); }

.charger-marker-cheapest {
    width: 42px !important;
    height: 42px !important;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 600 !important;
    font-size: 1.125rem !important;
    line-height: 42px !important;
    animation: charger-cheapest-pulse 2s infinite;
}

.charger-marker-cheapest .cheapest-badge {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    background: #0d9488;
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: var(--radius-full);
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    font-family: 'Outfit', sans-serif;
}

@keyframes charger-cheapest-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.4); }
    50%      { box-shadow: 0 0 0 8px rgba(13, 148, 136, 0.2); }
}

.charge-stop-marker {
    border-radius: 50%;
    border: 3px solid #0d9488;
    background: white;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.5);
    text-align: center;
    line-height: 30px;
    font-size: 1.125rem;
    cursor: pointer;
    animation: charge-stop-pulse 2s infinite;
}

@keyframes charge-stop-pulse {
    0%, 100% { box-shadow: 0 2px 8px rgba(13, 148, 136, 0.5); }
    50%      { box-shadow: 0 2px 16px rgba(13, 148, 136, 0.8); }
}

/* ── 24c. Marker Clusters ─────────────────────────────────────── */
.fuel-cluster,
.charger-cluster,
.poi-eating-cluster,
.poi-shopping-cluster,
.poi-groceries-cluster {
    border-radius: 50%;
    text-align: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.75rem;
    color: white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fuel-cluster div,
.charger-cluster div,
.poi-eating-cluster div,
.poi-shopping-cluster div,
.poi-groceries-cluster div {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fuel-cluster-small { background: rgba(22, 163, 74, 0.85); width: 36px; height: 36px; }
.fuel-cluster-medium { background: rgba(22, 163, 74, 0.9); width: 44px; height: 44px; font-size: 0.8125rem; }
.fuel-cluster-large { background: rgba(22, 163, 74, 0.95); width: 52px; height: 52px; font-size: 0.875rem; }

.charger-cluster-small { background: rgba(13, 148, 136, 0.85); width: 36px; height: 36px; }
.charger-cluster-medium { background: rgba(13, 148, 136, 0.9); width: 44px; height: 44px; font-size: 0.8125rem; }
.charger-cluster-large { background: rgba(13, 148, 136, 0.95); width: 52px; height: 52px; font-size: 0.875rem; }

/* POI clusters: eating (orange), shopping (purple), groceries (cyan) */
.poi-eating-cluster-small { background: rgba(249, 115, 22, 0.85); width: 36px; height: 36px; }
.poi-eating-cluster-medium { background: rgba(249, 115, 22, 0.9); width: 44px; height: 44px; font-size: 0.8125rem; }
.poi-eating-cluster-large { background: rgba(249, 115, 22, 0.95); width: 52px; height: 52px; font-size: 0.875rem; }

.poi-shopping-cluster-small { background: rgba(139, 92, 246, 0.85); width: 36px; height: 36px; }
.poi-shopping-cluster-medium { background: rgba(139, 92, 246, 0.9); width: 44px; height: 44px; font-size: 0.8125rem; }
.poi-shopping-cluster-large { background: rgba(139, 92, 246, 0.95); width: 52px; height: 52px; font-size: 0.875rem; }

.poi-groceries-cluster-small { background: rgba(6, 182, 212, 0.85); width: 36px; height: 36px; }
.poi-groceries-cluster-medium { background: rgba(6, 182, 212, 0.9); width: 44px; height: 44px; font-size: 0.8125rem; }
.poi-groceries-cluster-large { background: rgba(6, 182, 212, 0.95); width: 52px; height: 52px; font-size: 0.875rem; }

/* NDW traffic clusters */
.poi-road_closures-cluster,
.poi-bridge_openings-cluster,
.poi-roadworks-cluster,
.poi-incidents-cluster,
.poi-emission_zones-cluster {
    border-radius: 50%;
    text-align: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.75rem;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}
.poi-road_closures-cluster div,
.poi-bridge_openings-cluster div,
.poi-roadworks-cluster div,
.poi-incidents-cluster div,
.poi-emission_zones-cluster div {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.poi-road_closures-cluster-small { background: rgba(239, 68, 68, 0.85); width: 36px; height: 36px; }
.poi-road_closures-cluster-medium { background: rgba(239, 68, 68, 0.9); width: 44px; height: 44px; font-size: 0.8125rem; }
.poi-road_closures-cluster-large { background: rgba(239, 68, 68, 0.95); width: 52px; height: 52px; font-size: 0.875rem; }

.poi-bridge_openings-cluster-small { background: rgba(59, 130, 246, 0.85); width: 36px; height: 36px; }
.poi-bridge_openings-cluster-medium { background: rgba(59, 130, 246, 0.9); width: 44px; height: 44px; font-size: 0.8125rem; }
.poi-bridge_openings-cluster-large { background: rgba(59, 130, 246, 0.95); width: 52px; height: 52px; font-size: 0.875rem; }

.poi-roadworks-cluster-small { background: rgba(245, 158, 11, 0.85); width: 36px; height: 36px; }
.poi-roadworks-cluster-medium { background: rgba(245, 158, 11, 0.9); width: 44px; height: 44px; font-size: 0.8125rem; }
.poi-roadworks-cluster-large { background: rgba(245, 158, 11, 0.95); width: 52px; height: 52px; font-size: 0.875rem; }

.poi-incidents-cluster-small { background: rgba(220, 38, 38, 0.85); width: 36px; height: 36px; }
.poi-incidents-cluster-medium { background: rgba(220, 38, 38, 0.9); width: 44px; height: 44px; font-size: 0.8125rem; }
.poi-incidents-cluster-large { background: rgba(220, 38, 38, 0.95); width: 52px; height: 52px; font-size: 0.875rem; }

.poi-emission_zones-cluster-small { background: rgba(16, 185, 129, 0.85); width: 36px; height: 36px; }
.poi-emission_zones-cluster-medium { background: rgba(16, 185, 129, 0.9); width: 44px; height: 44px; font-size: 0.8125rem; }
.poi-emission_zones-cluster-large { background: rgba(16, 185, 129, 0.95); width: 52px; height: 52px; font-size: 0.875rem; }

/* Override default markercluster styles (but not our custom cluster backgrounds) */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large { background: none !important; }
.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div { background: none !important; }

/* ── 25. Map Popup ───────────────────────────────────────────────── */
.fuel-popup {
    min-width: 200px;
}

.fuel-popup h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    margin-bottom: var(--space-xs);
}

.fuel-popup .popup-brand {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.fuel-popup .popup-address {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.fuel-popup table {
    width: 100%;
    font-size: 0.85rem;
    border-collapse: collapse;
}

.fuel-popup td {
    padding: 3px 0;
}

.fuel-popup td:last-child {
    text-align: right;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
}

.fuel-popup .popup-distance {
    margin-top: var(--space-sm);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.popup-updated {
    margin-top: var(--space-sm);
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Popup inline style replacements */
.popup-price { font-weight: 700; color: var(--primary); }
.popup-price-charge { font-weight: 700; color: var(--teal, #0d9488); }
.popup-price-estimated { font-weight: 400; font-size: 0.85em; color: var(--text-muted, #888); }

/* Add-to-route button in popup */
.btn-add-stop {
    display: block;
    width: 100%;
    margin-top: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    transition: background var(--duration-fast), transform var(--duration-fast);
}

.btn-add-stop:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-remove-from-route {
    background: var(--red) !important;
}

.btn-remove-from-route:hover {
    background: #991b1b !important;
}

/* Small add button in list */
.btn-add-stop-small {
    background: none;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    padding: 2px 6px;
    line-height: 1;
    transition: all var(--duration-fast);
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-add-stop-small:hover {
    background: var(--surface);
    border-color: var(--primary);
}

.btn-add-stop-small.added {
    color: var(--red);
    border-color: var(--red);
}

.btn-add-stop-small.added:hover {
    background: var(--red-light);
}

/* ── 26. Auto-generated Stop Inputs ──────────────────────────────── */
.stop-input {
    background: var(--green-bg) !important;
    border-color: #bbf7d0 !important;
    cursor: default;
}

.fuel-stop-input {
    background: var(--accent-light) !important;
    border-color: #fde68a !important;
    font-weight: 600;
}

.charge-stop-input {
    background: #ccfbf1 !important;
    border-color: #5eead4 !important;
    color: #0f766e !important;
    font-weight: 600;
}

/* ── 27. Speed Camera Warning ────────────────────────────────────── */
.speedcam-warning {
    position: fixed;
    top: var(--space-lg);
    left: 50%;
    transform: translateX(-50%);
    background: var(--red);
    color: white;
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-lg);
    font-family: 'Outfit', sans-serif;
    font-size: 1.125rem;
    font-weight: 700;
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(220, 38, 38, 0.5);
    animation: warning-flash 1s infinite;
    transition: opacity 0.3s;
}

.speedcam-warning.hidden {
    opacity: 0;
    pointer-events: none;
}

@keyframes warning-flash {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.7; }
}

/* ── 28. Data Info Panel ─────────────────────────────────────────── */
.data-info-panel {
    position: fixed;
    bottom: calc(var(--footer-height) + var(--space-sm));
    right: var(--space-lg);
    padding: var(--space-md) var(--space-lg);
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.75rem;
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    min-width: 280px;
    animation: slideUp var(--duration-normal) var(--ease-out);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.data-info-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    gap: var(--space-sm);
}

.data-info-row + .data-info-row {
    border-top: 1px solid var(--border);
}

.data-info-label {
    font-weight: 600;
    white-space: nowrap;
}

.data-info-value {
    color: var(--text-muted);
    text-align: right;
}

/* ── 29. Simulation ──────────────────────────────────────────────── */
.btn-simulate {
    flex: 1;
}

.btn-simulate.simulating {
    background: var(--red);
    color: white;
    border-color: var(--red);
}

.sim-car-marker {
    width: 32px;
    height: 32px;
    font-size: 1.5rem;
    text-align: center;
    line-height: 32px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
    transition: transform 0.1s linear;
}

/* ── 30. Panel Footer ────────────────────────────────────────────── */
.panel-footer {
    padding: var(--space-md) var(--space-xl);
    margin-top: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
}

/* ── 31. Site Footer ─────────────────────────────────────────────── */
.panel-mobile-footer {
    display: none;
}

.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--footer-height);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    font-size: 0.6875rem;
    color: var(--text-muted);
    z-index: 1000;
}

.site-footer a,
.site-footer button {
    color: var(--text-muted);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color var(--duration-fast);
}

.site-footer a:hover,
.site-footer button:hover {
    color: var(--primary);
}

.site-footer .footer-sep {
    color: var(--border);
}

/* ── 32. Loading Overlay ─────────────────────────────────────────── */
#loading.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(250, 249, 247, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    pointer-events: auto;
}

[data-theme="dark"] #loading.loading {
    background: rgba(28, 25, 23, 0.85);
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading p {
    margin-top: var(--space-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-family: 'Outfit', sans-serif;
}

/* Loading skeleton (for future use) */
.skeleton {
    background: linear-gradient(90deg, var(--surface) 25%, var(--border) 50%, var(--surface) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── 33. Modals ──────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(41, 37, 36, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    animation: modalOverlayIn var(--duration-normal) var(--ease-out);
}

@keyframes modalOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background: var(--panel-bg);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    max-width: 700px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-xl);
    animation: modalContentIn var(--duration-slow) var(--ease-spring);
}

@keyframes modalContentIn {
    from { opacity: 0; transform: scale(0.95) translateY(12px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-lg);
    background: var(--surface);
    border: none;
    font-size: 1.125rem;
    cursor: pointer;
    color: var(--text-secondary);
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--duration-fast);
}

.modal-close:hover {
    background: var(--surface-hover);
    color: var(--text);
    transform: rotate(90deg);
}

.modal-content h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.375rem;
    margin-bottom: var(--space-xl);
    color: var(--text);
}

/* Disclaimer text */
.disclaimer-text h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9375rem;
    font-weight: 600;
    margin: var(--space-lg) 0 var(--space-sm);
    color: var(--text-secondary);
}

.disclaimer-text p {
    font-size: 0.8125rem;
    line-height: 1.65;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.disclaimer-update {
    margin-top: var(--space-xl);
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ── 34. Onboarding Modal ────────────────────────────────────────── */
.onboarding-modal {
    max-width: 560px;
    padding: var(--space-xl) var(--space-2xl) var(--space-xl);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.onboarding-slides {
    overflow-y: auto;
    overflow-x: hidden;
}

.onboarding-icon {
    font-size: 3rem;
    text-align: center;
    margin-bottom: var(--space-sm);
}

.onboarding-slide {
    display: none;
}

.onboarding-slide.active {
    display: block;
    animation: fadeIn var(--duration-normal) var(--ease-out);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.onboarding-slide h2 {
    font-size: 1.25rem;
    text-align: center;
    margin-bottom: var(--space-sm);
}

.onboarding-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    margin-bottom: var(--space-xl);
}

.onboarding-features {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.onboarding-feature {
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
}

.onboarding-feature .feature-icon {
    font-size: 1.5rem;
    min-width: 32px;
    text-align: center;
    flex-shrink: 0;
}

.onboarding-feature strong {
    display: block;
    font-size: 0.875rem;
    margin-bottom: 2px;
}

.onboarding-feature p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

/* Onboarding legend */
.onboarding-legend {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.legend-group h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.875rem;
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
}

.legend-entry {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    font-size: 0.8125rem;
    color: var(--text-secondary);
    padding: 3px 0;
}

.legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5625rem;
    min-width: 14px;
    flex-shrink: 0;
    overflow: hidden;
}

/* Onboarding tips */
.onboarding-tips {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.onboarding-tip {
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
}

.onboarding-tip .tip-icon {
    font-size: 1.25rem;
    min-width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.onboarding-tip > div > strong {
    display: block;
    font-size: 0.8125rem;
    margin-bottom: 1px;
}

.onboarding-tip p strong {
    display: inline;
    font-size: inherit;
}

.onboarding-tip p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin-bottom: 2px;
}
.onboarding-tip p:last-child {
    margin-bottom: 0;
}

/* Onboarding navigation */
.onboarding-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
}

.onboarding-dots {
    display: flex;
    gap: var(--space-sm);
}

.onboarding-dots .dot {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--border);
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
    background-clip: content-box;
    padding: 17px;
    box-sizing: border-box;
}

.onboarding-dots .dot.active {
    background: var(--primary);
    background-clip: content-box;
    transform: scale(1.2);
}

.onboarding-buttons {
    display: flex;
    gap: var(--space-sm);
}

.btn-onboarding-prev,
.btn-onboarding-next,
.btn-onboarding-start {
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius);
    border: none;
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all var(--duration-fast);
}

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

.btn-onboarding-prev:hover {
    background: var(--surface-hover);
}

.btn-onboarding-next {
    background: var(--primary);
    color: #fff;
}

.btn-onboarding-next:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-onboarding-start {
    background: var(--green);
    color: #fff;
}

.btn-onboarding-start:hover {
    background: #15803d;
    transform: translateY(-1px);
}

.onboarding-remember {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
}

.onboarding-remember input {
    cursor: pointer;
    accent-color: var(--primary);
}

/* ── 35. User Login / Profile ────────────────────────────────────── */
.user-floating {
    position: fixed;
    top: var(--space-md);
    right: var(--space-md);
    z-index: 2000;
}

.btn-google-login {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--panel-bg);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast);
    font-family: inherit;
    box-shadow: var(--shadow);
}

.btn-google-login:hover {
    background: var(--surface);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2.5px solid var(--panel-bg);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    padding: 0;
    background: var(--panel-bg);
    overflow: hidden;
    transition: box-shadow var(--duration-fast), transform var(--duration-fast);
}

.btn-avatar:hover {
    box-shadow: var(--shadow-lg);
    transform: scale(1.05);
}

.user-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: block;
    object-fit: cover;
}
.user-avatar[src=""] {
    display: none;
}

.user-dropdown {
    position: absolute;
    top: 52px;
    right: 0;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    min-width: 290px;
    overflow: hidden;
    animation: dropdownIn var(--duration-normal) var(--ease-out);
}

@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: var(--surface);
}

.user-dropdown-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.user-dropdown-name {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
}

.user-dropdown-email {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.user-dropdown-section {
    padding: var(--space-md) var(--space-lg);
}

.user-dropdown-section h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-sm);
}

.pref-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.pref-select,
.pref-input {
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-family: inherit;
    background: var(--panel-bg);
    color: var(--text);
    transition: border-color var(--duration-fast);
}

.pref-select:focus,
.pref-input:focus {
    border-color: var(--primary);
}

.pref-input {
    width: 60px;
    text-align: center;
}

.user-dropdown hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0;
}

.user-menu-item {
    display: block;
    width: 100%;
    padding: 10px var(--space-lg);
    border: none;
    background: none;
    text-align: left;
    font-size: 0.8125rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-family: inherit;
    transition: background var(--duration-fast);
    text-decoration: none;
}

a.user-menu-item {
    color: var(--text-secondary);
}

.user-menu-item:hover {
    background: var(--surface);
}

.user-menu-delete {
    color: var(--red);
    font-size: 0.75rem;
}

.user-menu-delete:hover {
    background: var(--red-light);
}

.btn-save-inline {
    background: none;
    border: none;
    font-size: 1.125rem;
    cursor: pointer;
    padding: 2px var(--space-xs);
    margin-left: var(--space-sm);
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast);
    vertical-align: middle;
    opacity: 0.5;
}

.btn-save-inline:hover {
    opacity: 1;
    background: var(--surface);
    transform: scale(1.15);
}

.user-menu-logout {
    color: #ef4444;
}

.user-menu-logout:hover {
    background: var(--red-light);
}

/* ── 36. Saved Routes Panel ──────────────────────────────────────── */
.saved-routes-panel {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: var(--space-sm) 0;
    max-height: 300px;
    overflow-y: auto;
}

.saved-routes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    border-bottom: 1px solid var(--border);
}

.saved-routes-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
}

.saved-routes-list {
    padding: var(--space-xs);
}

.saved-route-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--duration-fast);
}

.saved-route-item:hover {
    background: var(--surface);
}

.saved-route-info {
    flex: 1;
    min-width: 0;
}

.saved-route-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text);
}

.saved-route-detail {
    font-size: 0.6875rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-delete-route {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: var(--border-hover);
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    transition: color var(--duration-fast);
}

.btn-delete-route:hover {
    color: var(--red);
}

.empty-state {
    text-align: center;
    padding: var(--space-lg);
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* ── 37. Utility ─────────────────────────────────────────────────── */
.hidden {
    display: none !important;
}


/* ── 37b. SEO Content & FAQ ─────────────────────────────────────── */
.seo-content {
    padding: var(--space-md) var(--space-md) var(--space-sm);
    margin-top: var(--space-sm);
    border-top: 1px solid var(--border);
}

.seo-content .seo-intro {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-md);
}

.seo-content .seo-intro h2 {
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text);
    letter-spacing: -0.01em;
}

.seo-content .seo-intro p {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 0;
}

.seo-content h2 {
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text);
    letter-spacing: -0.01em;
}

.seo-content h3 {
    font-size: 0.78rem;
    font-weight: 600;
    margin: var(--space-md) 0 var(--space-xs);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.seo-content h3:first-of-type {
    margin-top: 0;
}

.seo-content p {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: var(--space-xs);
}

.seo-content .seo-blog-link {
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
}

.seo-content p:last-child {
    margin-bottom: 0;
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 6px;
    background: var(--surface);
    transition: border-color 0.15s ease;
}

.faq-item:hover {
    border-color: var(--primary-light, var(--primary));
}

.faq-item summary {
    padding: 10px var(--space-md);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text);
    min-height: 44px;
    display: flex;
    align-items: center;
    list-style: none;
    gap: var(--space-sm);
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::before {
    content: '›';
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
    width: 12px;
    text-align: center;
}

.faq-item[open] summary::before {
    transform: rotate(90deg);
}

.faq-item summary:hover {
    color: var(--primary);
}

.faq-item[open] summary {
    border-bottom: 1px solid var(--border);
    color: var(--primary);
}

.faq-item p {
    padding: var(--space-sm) var(--space-md) var(--space-sm) calc(var(--space-md) + 12px + var(--space-sm));
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.55;
}

#seo-city-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: var(--space-sm);
}

#seo-city-links a {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--primary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 10px;
    text-decoration: none;
    transition: all 0.15s ease;
}

#seo-city-links a:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ── 38. Custom Scrollbar ────────────────────────────────────────── */
#panel::-webkit-scrollbar,
.results-list::-webkit-scrollbar,
.chain-filter-chips::-webkit-scrollbar,
.modal-content::-webkit-scrollbar,
.saved-routes-panel::-webkit-scrollbar {
    width: 6px;
}

#panel::-webkit-scrollbar-track,
.results-list::-webkit-scrollbar-track,
.chain-filter-chips::-webkit-scrollbar-track,
.modal-content::-webkit-scrollbar-track,
.saved-routes-panel::-webkit-scrollbar-track {
    background: transparent;
}

#panel::-webkit-scrollbar-thumb,
.results-list::-webkit-scrollbar-thumb,
.chain-filter-chips::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb,
.saved-routes-panel::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

#panel::-webkit-scrollbar-thumb:hover,
.results-list::-webkit-scrollbar-thumb:hover,
.chain-filter-chips::-webkit-scrollbar-thumb:hover,
.modal-content::-webkit-scrollbar-thumb:hover,
.saved-routes-panel::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* Firefox scrollbar */
#panel,
.results-list,
.chain-filter-chips,
.modal-content,
.saved-routes-panel {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* ── 39. Responsive — Tablet ─────────────────────────────────────── */
@media (max-width: 1024px) {
    :root {
        --panel-width: 360px;
    }
}

/* ── 40. Responsive — Mobile (bottom sheet) ──────────────────────── */
@media (max-width: 768px) {
    :root {
        --panel-width: 100%;
    }

    #app {
        flex-direction: column-reverse;
        position: relative;
    }

    #map {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        z-index: 1;
    }

    /* Panel becomes bottom sheet */
    #panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        min-width: unset;
        max-height: 70vh;
        border-right: none;
        border-top-left-radius: var(--radius-lg);
        border-top-right-radius: var(--radius-lg);
        box-shadow: 0 -4px 24px rgba(41, 37, 36, 0.12);
        z-index: 1000;
        transform: translateY(calc(100% - var(--sheet-handle-height)));
        transition: transform var(--duration-slow) var(--ease-out);
        padding-top: var(--sheet-handle-height);
    }

    #panel.panel-open {
        transform: translateY(0);
    }

    /* Sheet drag handle — enlarged touch target */
    #panel::before {
        content: '';
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 5px;
        background: var(--border-hover);
        border-radius: 2px;
        z-index: 1;
    }

    /* Mobile toggle button visible */
    .mobile-panel-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Adjust user floating for mobile */
    .user-floating {
        top: var(--space-sm);
        right: var(--space-sm);
        z-index: 1100;
    }

    .btn-google-login {
        padding: var(--space-sm) var(--space-md);
        font-size: 0.75rem;
    }

    .btn-avatar {
        width: 36px;
        height: 36px;
    }

    /* User dropdown full width on mobile */
    .user-dropdown {
        position: fixed;
        top: 56px;
        right: var(--space-sm);
        left: var(--space-sm);
        min-width: unset;
    }

    /* Panel header compact */
    .panel-header {
        padding: var(--space-lg) var(--space-lg) var(--space-md);
    }

    .panel-header h1 {
        font-size: 1.15rem;
    }

    /* Sections compact */
    .panel-section {
        padding: var(--space-md) var(--space-lg);
    }

    /* Results list shorter */
    .results-list {
        max-height: 200px;
    }

    /* Modal full-width on mobile */
    .modal-overlay {
        padding: var(--space-md);
        align-items: flex-end;
    }

    .modal-content {
        padding: var(--space-xl);
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 85vh;
        overflow-y: auto;
    }

    .onboarding-modal {
        padding: var(--space-lg) var(--space-xl) var(--space-lg);
        max-height: 80vh;
    }

    .onboarding-slide h2 {
        font-size: 1.125rem;
    }

    .onboarding-legend {
        gap: var(--space-md);
    }

    .legend-group h3 {
        font-size: 0.8125rem;
    }

    .legend-entry {
        font-size: 0.75rem;
    }

    /* Footer hidden on mobile — links live inside the panel instead */
    .site-footer {
        display: none;
    }

    /* Mobile footer links inside panel — sticky at bottom */
    .panel-mobile-footer {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
        gap: 4px;
        padding: 8px var(--space-lg) 10px;
        font-size: 0.6875rem;
        color: var(--text-muted);
        border-top: 1px solid var(--border);
        background: var(--panel-bg);
        position: sticky;
        bottom: 0;
        z-index: 1;
        flex-shrink: 0;
    }

    .panel-mobile-footer a,
    .panel-mobile-footer button {
        color: var(--text-muted);
        text-decoration: underline;
        text-underline-offset: 2px;
    }

    .panel-mobile-footer .footer-sep {
        color: var(--border);
    }

    /* Remove desktop footer padding from panel on mobile */
    #panel {
        padding-bottom: 0;
    }

    /* Speed cam warning below user area */
    .speedcam-warning {
        top: 60px;
        font-size: 0.9375rem;
        padding: var(--space-sm) var(--space-lg);
    }

    /* Data info panel at bottom */
    .data-info-panel {
        left: var(--space-sm);
        right: var(--space-sm);
        min-width: unset;
        bottom: calc(28px + var(--space-sm));
    }
}

/* ── 41. Responsive — Small Phone ────────────────────────────────── */
@media (max-width: 380px) {
    .panel-header h1 {
        font-size: 1.05rem;
    }

    .panel-section h2 {
        font-size: 0.82rem;
    }

    .input-group input[type="text"],
    .input-group select {
        font-size: 0.82rem;
        padding: 8px var(--space-sm);
    }

    .btn-primary {
        padding: 10px var(--space-md);
        font-size: 0.85rem;
    }

    .route-buttons {
        flex-direction: column;
    }
}

/* ── 42. Print Styles ────────────────────────────────────────────── */
@media print {
    #map,
    .site-footer,
    .mobile-panel-toggle,
    .user-floating,
    .loading,
    .modal-overlay,
    .speedcam-warning,
    .data-info-panel,
    .btn-primary,
    .btn-secondary,
    .btn-nav,
    .btn-icon,
    .toggle,
    .route-buttons,
    .nav-controls,
    .btn-help {
        display: none !important;
    }

    #panel {
        width: 100% !important;
        min-width: unset !important;
        max-height: unset !important;
        position: static !important;
        transform: none !important;
        border: none !important;
        box-shadow: none !important;
        overflow: visible !important;
    }

    body {
        overflow: visible;
        height: auto;
    }

    .panel-header {
        background: none;
    }

    .results-list {
        max-height: none;
        overflow: visible;
    }
}

/* ── 43. Reduced Motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── 44. High Contrast Mode ──────────────────────────────────────── */
@media (forced-colors: active) {
    .toggle-slider {
        border: 2px solid ButtonText;
    }

    .chain-chip {
        border: 1px solid ButtonText;
    }

    .chain-chip.active {
        forced-color-adjust: none;
        background: Highlight;
        color: HighlightText;
    }

    .btn-primary {
        forced-color-adjust: none;
    }
}

/* ── Tutorial / Guided Tour ─────────────────────────────────────── */
.tutorial-overlay {
    position: fixed;
    inset: 0;
    background: none;
    z-index: 100000;
    pointer-events: none;
    transition: opacity var(--duration-normal, 0.3s);
}

.tutorial-overlay.hidden {
    display: none;
}

.tutorial-highlight {
    position: fixed;
    border: 3px solid var(--primary, #0d9488);
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5),
                0 0 20px rgba(13, 148, 136, 0.4);
    background: transparent;
    z-index: 100001;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}


.tutorial-balloon {
    position: fixed;
    background: var(--panel-bg);
    border-radius: 16px;
    padding: 20px 22px 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 100002;
    max-width: 340px;
    pointer-events: auto;
    animation: tutorial-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes tutorial-pop {
    from { opacity: 0; transform: scale(0.9) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.tutorial-step-number {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--primary, #0d9488);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.tutorial-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.tutorial-text {
    font-size: 0.844rem;
    line-height: 1.55;
    color: var(--text-secondary, #57534e);
    margin-bottom: 16px;
}

.tutorial-buttons {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.tutorial-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.tutorial-btn-primary {
    background: var(--primary, #0d9488);
    color: white;
}

.tutorial-btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.tutorial-btn-secondary {
    background: var(--surface, #f5f5f4);
    color: var(--text-secondary, #57534e);
}

.tutorial-btn-secondary:hover {
    background: var(--surface-hover, #e7e5e4);
}

.tutorial-btn-finish {
    background: #16a34a;
    color: white;
}

.tutorial-btn-finish:hover {
    background: #15803d;
}

.tutorial-progress {
    font-size: 0.75rem;
    color: var(--text-muted, #a8a29e);
    flex-shrink: 0;
}

.tutorial-skip {
    display: block;
    width: 100%;
    text-align: center;
    background: none;
    border: none;
    color: #a8a29e;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 8px 0 0;
    font-family: inherit;
}

.tutorial-skip:hover {
    color: #78716c;
    text-decoration: underline;
}

.btn-tutorial {
    background: var(--accent, #f59e0b);
    font-size: 0.75rem;
}

.btn-tutorial:hover {
    background: var(--accent-hover, #d97706);
}

.btn-theme-toggle {
    background: var(--surface);
    border: 2px solid var(--border);
    font-size: 1rem;
    position: relative;
}
.btn-theme-toggle:hover {
    background: var(--surface-hover);
    transform: scale(1.1);
}
.btn-theme-toggle .theme-icon-light,
.btn-theme-toggle .theme-icon-dark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: opacity 0.2s;
    line-height: 1;
}
[data-theme="dark"] .btn-theme-toggle .theme-icon-dark { opacity: 0; }
[data-theme="dark"] .btn-theme-toggle .theme-icon-light { opacity: 1; }
:root .btn-theme-toggle .theme-icon-light { opacity: 0; }
:root .btn-theme-toggle .theme-icon-dark { opacity: 1; }
[data-theme="light"] .btn-theme-toggle .theme-icon-light { opacity: 0; }
[data-theme="light"] .btn-theme-toggle .theme-icon-dark { opacity: 1; }
[data-theme="dark"] .btn-theme-toggle {
    border-color: var(--border);
}

/* Mobile tutorial adjustments */
@media (max-width: 768px) {
    .tutorial-balloon {
        position: fixed !important;
        bottom: 20px !important;
        top: auto !important;
        left: 10px !important;
        right: 10px !important;
        max-width: none;
        width: auto !important;
    }

    .tutorial-highlight {
        display: none;
    }
}

/* ── Landing Hero Section ──────────────────────────────────────────── */

.landing-hero {
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.landing-trust-bar {
    display: flex;
    justify-content: space-around;
    background: var(--primary-subtle);
    border: 1px solid var(--primary-light);
    border-radius: var(--radius);
    padding: var(--space-md) var(--space-sm);
}
.trust-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.trust-number {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}
.trust-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.landing-cta-block {
    text-align: center;
}
.landing-intro {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 var(--space-md);
}
.landing-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 14px 32px;
    font-size: 1.05rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.3);
    min-height: 48px;
}
.landing-cta-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.4);
}
.landing-cta-btn:active {
    transform: translateY(0);
}

.landing-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
}
.landing-feature {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: var(--space-sm) var(--space-md);
    background: var(--surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.landing-feature-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    line-height: 1.4;
}
.landing-feature strong {
    display: block;
    font-size: 0.8rem;
    color: var(--text);
}
.landing-feature span {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.landing-link-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--green-bg);
    border: 1px solid var(--green-light);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: box-shadow 0.15s, transform 0.15s;
}
.landing-link-card:hover {
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.15);
    transform: translateY(-1px);
}
.link-card-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}
.landing-link-card strong {
    display: block;
    font-size: 0.9rem;
    color: var(--green);
}
.landing-link-card span {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.link-card-arrow {
    margin-left: auto;
    font-size: 1.2rem;
    color: var(--green);
    font-weight: 700;
}

.landing-heading {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 var(--space-sm);
}

.landing-blog-cards {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}
.landing-blog-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: var(--space-md);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.landing-blog-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.1);
}
.blog-card-category {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
}
.landing-blog-card strong {
    font-size: 0.85rem;
    line-height: 1.3;
}
.blog-card-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}
.landing-blog-all {
    display: inline-block;
    margin-top: var(--space-sm);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}
.landing-blog-all:hover {
    text-decoration: underline;
}

.landing-premium-teaser {
    background: linear-gradient(135deg, var(--accent-light, #fef3c7), var(--accent-light, #fef3c7));
    border: 1px solid var(--accent-light, #fde68a);
    border-radius: var(--radius);
    padding: var(--space-md) var(--space-lg);
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.15s;
}
.landing-premium-teaser:hover {
    box-shadow: 0 2px 12px rgba(245, 158, 11, 0.2);
    transform: translateY(-1px);
}
.premium-teaser-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: 6px;
}
.premium-teaser-badge {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--accent);
    color: #fff;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    letter-spacing: 0.04em;
}
.premium-teaser-header strong {
    font-size: 0.9rem;
    color: var(--accent-hover, #d97706);
}
.landing-premium-teaser p {
    font-size: 0.8rem;
    color: #78716c;
    margin: 0 0 6px;
    line-height: 1.5;
}
.premium-teaser-link {
    font-size: 0.8rem;
    font-weight: 600;
    color: #b45309;
}

.landing-sources {
    background: var(--surface);
    border-radius: var(--radius);
    padding: var(--space-md) var(--space-lg);
    border: 1px solid var(--border);
}
.landing-sources p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 var(--space-sm);
}
.source-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.source-tag {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--panel-bg);
    border: 1px solid var(--border);
    padding: 3px 10px;
    border-radius: var(--radius-full);
}

/* Landing dark mode */
[data-theme="dark"] .landing-trust-bar {
    background: rgba(13, 148, 136, 0.1);
    border-color: rgba(13, 148, 136, 0.2);
}
[data-theme="dark"] .landing-feature {
    background: var(--surface);
    border-color: var(--border);
}
[data-theme="dark"] .landing-link-card {
    background: rgba(22, 163, 74, 0.08);
    border-color: rgba(22, 163, 74, 0.2);
}
[data-theme="dark"] .landing-link-card strong { color: #4ade80; }
[data-theme="dark"] .link-card-arrow { color: #4ade80; }
[data-theme="dark"] .landing-blog-card {
    background: var(--surface);
    border-color: var(--border);
}
[data-theme="dark"] .landing-premium-teaser {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.25);
}
[data-theme="dark"] .premium-teaser-header strong { color: #fbbf24; }
[data-theme="dark"] .landing-premium-teaser p { color: var(--text-muted); }
[data-theme="dark"] .premium-teaser-link { color: #fbbf24; }
[data-theme="dark"] .landing-sources {
    background: var(--surface);
    border-color: var(--border);
}
[data-theme="dark"] .source-tag {
    background: var(--bg);
    border-color: var(--border);
}

/* ── Premium / Upgrade ──────────────────────────────────────────────── */

.premium-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent, #f59e0b), var(--accent-hover, #d97706));
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 99px;
    margin-top: 3px;
    letter-spacing: 0.03em;
}

.upgrade-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--accent-light, #fef3c7), var(--accent-light, #fef3c7));
    border: 1px solid var(--accent-light, #fde68a);
    border-radius: 8px;
    padding: 8px 12px;
    margin: 8px 0 4px;
    font-size: 0.8125rem;
    color: #92400e;
    font-weight: 500;
}

.upgrade-banner.hidden { display: none; }

.btn-upgrade-small {
    background: #f59e0b;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    margin-left: 8px;
    transition: background 0.15s;
}
.btn-upgrade-small:hover { background: #d97706; }

/* Upgrade modal */
.upgrade-modal-content {
    max-width: 480px;
    padding: 32px 28px 24px;
}

.upgrade-hero {
    text-align: center;
    margin-bottom: 20px;
}
.upgrade-icon { font-size: 2.5rem; margin-bottom: 8px; }
.upgrade-hero h2 { font-size: 1.375rem; margin: 0 0 6px; color: var(--text); }
.upgrade-tagline { color: var(--text-secondary); font-size: 0.875rem; margin: 0; }

.upgrade-features {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 22px;
}
.upgrade-feature {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.upgrade-feature-icon { font-size: 1.25rem; flex-shrink: 0; line-height: 1.4; }
.upgrade-feature strong { display: block; font-size: 0.875rem; color: var(--text); }
.upgrade-feature span { font-size: 0.75rem; color: var(--text-secondary); }

.upgrade-plans {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 18px;
}
.upgrade-plan {
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 14px 12px;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s, box-shadow 0.15s;
    position: relative;
}
.upgrade-plan:hover { border-color: #0d9488; }
.upgrade-plan.selected { border-color: #0d9488; box-shadow: 0 0 0 3px rgba(13,148,136,.15); }
.upgrade-plan-featured {
    border-color: #f59e0b;
    background: #fffbeb;
}
.upgrade-plan-featured.selected { border-color: #d97706; box-shadow: 0 0 0 3px rgba(245,158,11,.2); }

.plan-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: #f59e0b;
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 99px;
    white-space: nowrap;
}
.plan-label { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 4px; }
.plan-price { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.plan-period { font-size: 0.8125rem; font-weight: 400; color: var(--text-secondary); }
.plan-note { font-size: 0.6875rem; color: var(--text-muted); margin-top: 3px; }

.upgrade-payment-methods {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.upgrade-payment-methods img {
    height: 20px;
    opacity: 0.7;
}
.payment-method-text { font-size: 0.75rem; color: var(--text-secondary); }

.btn-start-checkout {
    width: 100%;
    background: linear-gradient(135deg, #0d9488, #0f766e);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s;
    margin-bottom: 12px;
}
.btn-start-checkout:hover { opacity: 0.9; }
.btn-start-checkout:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.upgrade-terms {
    text-align: center;
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin: 0;
}
.upgrade-terms a { color: var(--text-secondary); }

/* Coming soon section */
.upgrade-coming-soon {
    text-align: center;
    padding: var(--space-lg);
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    margin-top: 4px;
}
.coming-soon-icon { font-size: 2rem; margin-bottom: 6px; }
.upgrade-coming-soon h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #92400e;
    margin: 0 0 6px;
}
.upgrade-coming-soon p {
    font-size: 0.85rem;
    color: #78716c;
    margin: 0 0 var(--space-sm);
    line-height: 1.5;
}
.coming-soon-pricing {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #57534e;
    flex-wrap: wrap;
}
.coming-soon-sep { color: #d6d3d1; }

/* Payment success toast */
.payment-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #0d9488;
    color: #fff;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.875rem;
    box-shadow: 0 4px 20px rgba(0,0,0,.2);
    z-index: 99999;
    animation: toastIn 0.3s ease;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Settings / Profiel Modal ─────────────────────────────────────── */

.settings-modal-content {
    max-width: 520px;
    padding: 28px 24px 20px;
}

.settings-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.settings-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.settings-section h3 {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0 0 12px;
}

/* Profiel */
.settings-profile { display: flex; align-items: center; gap: 14px; }
.settings-avatar { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; }
.settings-name { font-size: 1rem; font-weight: 600; color: var(--text); }
.settings-email { font-size: 0.8125rem; color: var(--text-muted); }
.settings-member-since { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* Lidmaatschap */
.settings-subscription {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
}
.settings-plan-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}
.settings-plan-label { font-size: 0.8125rem; color: var(--text-muted); }
.settings-plan-value { font-size: 0.8125rem; font-weight: 600; color: var(--text); }

.btn-manage-subscription {
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    background: var(--panel-bg);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.btn-manage-subscription:hover {
    border-color: var(--primary);
    background: var(--primary-subtle);
    color: var(--primary);
}

.settings-plan-note {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin: 8px 0 0;
    line-height: 1.4;
}

/* Upgrade card (niet-premium) */
.settings-upgrade-card {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}
.settings-upgrade-card p { font-size: 0.8125rem; color: #92400e; margin: 0 0 12px; }

.btn-upgrade-settings {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s;
}
.btn-upgrade-settings:hover { opacity: 0.9; }

/* Routes in settings modal */
.settings-routes-list {
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 12px;
}
.settings-route-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    background: var(--surface);
    transition: background 0.15s;
}
.settings-route-item:hover { background: var(--surface-hover); }
.settings-route-info { flex: 1; min-width: 0; }
.settings-route-name {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.settings-route-detail {
    font-size: 0.6875rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.settings-route-actions {
    display: flex;
    gap: 4px;
    margin-left: 8px;
    flex-shrink: 0;
}
.settings-route-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.15s;
}
.settings-route-actions button:hover { background: var(--surface-hover); }
.btn-settings-save-route {
    width: 100%;
    padding: 10px;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.btn-settings-save-route:hover {
    background: var(--surface-hover);
    border-color: var(--text-muted);
}

/* ── App Dialog (custom alert/prompt/confirm) ── */
.app-dialog-content {
    max-width: 400px;
    text-align: center;
    padding: 28px 24px 20px;
}
.app-dialog-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
    line-height: 1;
}
.app-dialog-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 8px;
}
.app-dialog-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 16px;
}
.app-dialog-input-wrap {
    margin-bottom: 16px;
}
.app-dialog-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: 'DM Sans', sans-serif;
    color: var(--text);
    background: var(--panel-bg);
    box-sizing: border-box;
    transition: border-color 0.15s;
}
.app-dialog-input:focus {
    outline: none;
    border-color: #0d9488;
    box-shadow: 0 0 0 3px rgba(13,148,136,0.1);
}
.app-dialog-extra {
    margin-bottom: 8px;
}
.app-dialog-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 4px;
}
.app-dialog-btn {
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    border: none;
    transition: opacity 0.15s, background 0.15s;
    min-width: 100px;
}
.app-dialog-btn:hover { opacity: 0.9; }
.app-dialog-btn-primary {
    background: linear-gradient(135deg, #0d9488, #0f766e);
    color: #fff;
}
.app-dialog-btn-secondary {
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.app-dialog-btn-secondary:hover { background: var(--surface-hover); }
.app-dialog-btn-upgrade {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}
.app-dialog-features-preview {
    text-align: left;
    background: var(--surface);
    border-radius: 8px;
    padding: 12px 16px;
    margin: 12px 0;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Routes in settings */
.settings-routes-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ── Chat Widget ──────────────────────────────────────────────── */

.chat-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(13, 148, 136, 0.35);
    z-index: 9000;
    transition: transform 0.2s, box-shadow 0.2s;
}

.chat-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.45);
}

.chat-bubble-active {
    transform: scale(0.9);
    opacity: 0.7;
}

.chat-bubble-icon {
    font-size: 1.5rem;
    line-height: 1;
}

/* Attention animation on first visit */
.chat-bubble-attention {
    animation: chatAttention 1s ease-in-out 3;
}

@keyframes chatAttention {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.15); }
    50% { transform: scale(1); }
    75% { transform: scale(1.1); }
}

/* Tooltip above bubble */
.chat-tooltip {
    position: fixed;
    bottom: 84px;
    right: 16px;
    background: #292524;
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9000;
    animation: tooltipFadeIn 0.3s ease-out;
    pointer-events: none;
}

.chat-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 24px;
    width: 12px;
    height: 12px;
    background: #292524;
    transform: rotate(45deg);
}

@keyframes tooltipFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .chat-tooltip {
        bottom: 136px;
    }
}

.chat-widget-panel {
    position: fixed;
    bottom: 88px;
    right: 20px;
    width: 380px;
    max-height: 520px;
    background: var(--panel-bg, #fff);
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    z-index: 9001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: chatSlideUp 0.25s ease-out;
}

.chat-widget-panel.hidden {
    display: none;
}

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

.chat-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--primary);
    color: #fff;
}

.chat-widget-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-widget-header h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0;
}

.chat-back-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.125rem;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.8;
}

.chat-back-btn:hover { opacity: 1; }
.chat-back-btn.hidden { display: none; }

.chat-close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.125rem;
    cursor: pointer;
    opacity: 0.8;
    padding: 0 2px;
}

.chat-close-btn:hover { opacity: 1; }

.chat-widget-body {
    flex: 1;
    overflow-y: auto;
    min-height: 200px;
    max-height: 360px;
}

/* Login prompt */
.chat-login-prompt {
    padding: 32px 24px;
    text-align: center;
}

.chat-login-prompt p {
    font-size: 0.875rem;
    color: var(--text-secondary, #57534e);
    margin-bottom: 16px;
    line-height: 1.5;
}

.chat-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text);
    transition: background 0.15s;
}

.chat-login-btn:hover { background: var(--surface); }

/* Conversation list */
.chat-conv-list {
    padding: 8px;
}

.chat-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
}

.chat-new-btn-row {
    padding: 4px 4px 8px;
}

.chat-new-btn {
    width: 100%;
    padding: 10px;
    background: var(--primary-light, #ccfbf1);
    color: var(--primary);
    border: 1px dashed var(--primary);
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.chat-new-btn:hover { background: var(--primary-light, rgba(20, 184, 166, 0.15)); }

.chat-conv-item {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    margin-bottom: 4px;
    border: 1px solid var(--border);
}

.chat-conv-item:hover { background: var(--surface); }

.chat-conv-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.chat-conv-category {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
}

.chat-conv-time {
    font-size: 0.6875rem;
    color: var(--text-muted, #a8a29e);
}

.chat-conv-status {
    font-size: 0.6875rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.chat-status-open { background: #dcfce7; color: #166534; }
.chat-status-resolved { background: #dbeafe; color: #1e40af; }
.chat-status-closed { background: var(--surface); color: var(--text-secondary); }

/* Messages view */
.chat-messages-view {
    height: 100%;
}

.chat-messages-scroll {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 200px;
    max-height: 360px;
    overflow-y: auto;
}

.chat-msg {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.8125rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-msg-user {
    background: #14b8a6;
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.chat-msg-user .chat-msg-time { color: rgba(255,255,255,0.85); }

.chat-msg-admin {
    background: #f0fdfa;
    color: #134e4a;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid #99f6e4;
}

.chat-msg-system {
    background: var(--surface);
    color: var(--text-secondary);
    align-self: center;
    font-size: 0.75rem;
    font-style: italic;
    text-align: center;
    max-width: 90%;
}

[data-theme="dark"] .chat-msg-admin {
    background: #134e4a;
    color: #ccfbf1;
    border-color: #14b8a6;
}
[data-theme="dark"] .chat-msg-admin .chat-msg-label { color: #5eead4; }
[data-theme="dark"] .chat-msg-admin .chat-msg-time { color: #99f6e4; }
[data-theme="dark"] .chat-msg-system {
    background: var(--surface);
    color: var(--text-secondary);
}
[data-theme="dark"] .chat-msg-system .chat-msg-time { color: var(--text-muted); }

.chat-msg-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 2px;
}

.chat-msg-text {
    white-space: pre-wrap;
}

.chat-msg-time {
    font-size: 0.625rem;
    color: var(--text-muted, #a8a29e);
    margin-top: 2px;
    text-align: right;
}

/* Footer / input */
.chat-widget-footer {
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    background: var(--panel-bg, #fff);
}

.chat-widget-footer.hidden { display: none; }

.chat-category-select {
    margin-bottom: 8px;
}

.chat-category-select.hidden { display: none; }

.chat-category-select select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8125rem;
    font-family: inherit;
    color: var(--text);
    background: var(--panel-bg);
}

.chat-input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input-row textarea {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    resize: none;
    font-size: 0.8125rem;
    font-family: inherit;
    min-height: 38px;
    max-height: 80px;
    line-height: 1.4;
}

.chat-input-row textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.chat-send-btn:hover { background: var(--primary-hover, #0f766e); }

/* Mobile responsive */
@media (max-width: 480px) {
    .chat-widget-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 85vh;
        border-radius: 16px 16px 0 0;
    }

    .chat-bubble {
        bottom: 16px;
        right: 16px;
    }
}

/* Ensure chat is above mobile panel toggle but below modals */
@media (max-width: 768px) {
    .chat-bubble {
        bottom: 72px; /* Above mobile panel toggle */
    }

    .chat-widget-panel {
        bottom: 136px;
    }
}

/* ══════════════════════════════════════════════════════════════════════
   SAVINGS BANNER
   ══════════════════════════════════════════════════════════════════════ */
.savings-banner {
    background: var(--green-bg);
    border: 1px solid var(--green);
    border-radius: var(--radius);
    padding: var(--space-md) var(--space-lg);
    margin: var(--space-sm) 0;
    font-size: 0.85rem;
    color: var(--text);
    line-height: 1.5;
}

.savings-banner strong {
    color: var(--green);
}

/* ══════════════════════════════════════════════════════════════════════
   SKELETON LOADING
   ══════════════════════════════════════════════════════════════════════ */
.skeleton-item {
    padding: var(--space-md);
}

.skeleton-text {
    display: block;
}

/* ══════════════════════════════════════════════════════════════════════
   DARK MODE
   ══════════════════════════════════════════════════════════════════════ */
/* ── Dark Theme ─────────────────────────────────────────────────── */
/* Applied via data-theme="dark" on <html>. JS handles auto/manual. */
:root[data-theme="dark"] {
    --bg: #1c1917;
    --panel-bg: #292524;
    --text: #fafaf9;
    --text-secondary: #d6d3d1;
    --text-muted: #c4bfba;
    --border: #44403c;
    --border-hover: #57534e;
    --surface: #1c1917;
    --surface-hover: #44403c;
    --primary-light: #134e4a;
    --primary-subtle: #1a2e2b;
    --accent-light: #451a03;
    --green-light: #14532d;
    --green-bg: #052e16;
    --orange-light: #431407;
    --red-light: #450a0a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] body {
    color-scheme: dark;
}

/* Panel */
[data-theme="dark"] #panel {
    background: var(--panel-bg);
    border-color: var(--border);
}

/* Login button & avatar */
[data-theme="dark"] .btn-google-login {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text-secondary);
}

[data-theme="dark"] .btn-google-login:hover {
    background: var(--surface-hover);
}

[data-theme="dark"] .btn-avatar {
    border-color: var(--surface);
    background: var(--surface);
}

[data-theme="dark"] .upgrade-banner {
    background: var(--surface);
    border-color: var(--border);
}

[data-theme="dark"] .user-menu-item:hover {
    background: var(--surface-hover);
}

[data-theme="dark"] .user-menu-delete {
    color: var(--red);
}

/* Inputs */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] select {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

[data-theme="dark"] input::placeholder {
    color: var(--text-muted);
}

/* Cards and results */
[data-theme="dark"] .results-list li {
    background: var(--surface);
    border-color: var(--border);
}

[data-theme="dark"] .results-list li:hover {
    background: var(--surface-hover);
}

/* Autocomplete dropdown */
[data-theme="dark"] .autocomplete-list {
    background: var(--panel-bg);
    border-color: var(--border);
}

[data-theme="dark"] .autocomplete-list li:hover,
[data-theme="dark"] .autocomplete-list li.selected {
    background: var(--surface-hover);
}

/* Modals */
[data-theme="dark"] .modal-content {
    background: var(--panel-bg);
    color: var(--text);
}

[data-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, 0.7);
}

/* Toggle switch */
[data-theme="dark"] .toggle-slider {
    background: var(--border);
}

/* Buttons */
[data-theme="dark"] .btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

[data-theme="dark"] .btn-secondary:hover {
    background: var(--surface-hover);
}

/* Route info */
[data-theme="dark"] .route-info {
    background: var(--surface);
    color: var(--text-secondary);
}

/* Section toggle */
[data-theme="dark"] .section-toggle {
    color: var(--text);
}

/* Disclaimer / FAQ text */
[data-theme="dark"] .disclaimer-text {
    color: var(--text-secondary);
}

[data-theme="dark"] .disclaimer-text h3 {
    color: var(--text);
}

/* FAQ items & SEO content */
[data-theme="dark"] .faq-item,
[data-theme="dark"] .seo-content,
[data-theme="dark"] .seo-content .seo-intro,
[data-theme="dark"] .faq-item[open] summary {
    border-color: var(--border);
}

[data-theme="dark"] .faq-item,
[data-theme="dark"] .seo-content .seo-intro {
    background: var(--surface);
}

[data-theme="dark"] #seo-city-links a {
    background: var(--surface);
    border-color: var(--border);
    color: var(--primary);
}

[data-theme="dark"] #seo-city-links a:hover {
    background: var(--primary);
    color: #fff;
}

/* Data info panel */
[data-theme="dark"] .data-info-panel {
    background: var(--surface);
    color: var(--text-secondary);
}

/* Chain filter chips */
[data-theme="dark"] .chain-chip {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text-secondary);
}

[data-theme="dark"] .chain-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Leaflet popups */
[data-theme="dark"] .leaflet-popup-content-wrapper {
    background: var(--panel-bg);
    color: var(--text);
}

[data-theme="dark"] .leaflet-popup-tip {
    background: var(--panel-bg);
}

/* Scrollbar dark mode */
[data-theme="dark"] #panel::-webkit-scrollbar-track,
[data-theme="dark"] .results-list::-webkit-scrollbar-track,
[data-theme="dark"] .chain-filter-chips::-webkit-scrollbar-track,
[data-theme="dark"] .autocomplete-list::-webkit-scrollbar-track {
    background: var(--bg);
}

[data-theme="dark"] #panel::-webkit-scrollbar-thumb,
[data-theme="dark"] .results-list::-webkit-scrollbar-thumb,
[data-theme="dark"] .chain-filter-chips::-webkit-scrollbar-thumb,
[data-theme="dark"] .autocomplete-list::-webkit-scrollbar-thumb {
    background: #57534e;
}

/* Firefox scrollbar */
[data-theme="dark"] #panel,
[data-theme="dark"] .results-list,
[data-theme="dark"] .chain-filter-chips,
[data-theme="dark"] .autocomplete-list {
    scrollbar-color: #57534e var(--bg);
}

/* Chat widget */
[data-theme="dark"] .chat-widget-panel {
    background: var(--panel-bg);
    border-color: var(--border);
}

[data-theme="dark"] .chat-widget-footer {
    border-color: var(--border);
}

[data-theme="dark"] .chat-status-closed {
    background: var(--surface);
    color: var(--text-muted);
}

[data-theme="dark"] .chat-message.user {
    background: var(--primary);
}

[data-theme="dark"] .chat-message.bot {
    background: var(--surface);
    color: var(--text);
}

/* Chat login button */
[data-theme="dark"] .chat-login-btn {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

[data-theme="dark"] .chat-login-btn:hover {
    background: var(--surface-hover);
}

/* Saved routes panel */
[data-theme="dark"] .saved-routes-panel {
    background: var(--surface);
    border-color: var(--border);
}

/* Tutorial balloon */
[data-theme="dark"] .tutorial-balloon {
    background: var(--panel-bg);
}

/* Upgrade modal dark mode */
[data-theme="dark"] .upgrade-hero h2 { color: var(--text); }
[data-theme="dark"] .upgrade-tagline { color: var(--text-muted); }
[data-theme="dark"] .upgrade-feature strong { color: var(--text); }
[data-theme="dark"] .upgrade-feature span { color: var(--text-muted); }
[data-theme="dark"] .upgrade-plan { border-color: var(--border); }
[data-theme="dark"] .upgrade-plan:hover { border-color: var(--primary); }
[data-theme="dark"] .upgrade-plan.selected { border-color: var(--primary); }
[data-theme="dark"] .plan-price { color: var(--text); }
[data-theme="dark"] .plan-label { color: var(--text-muted); }
[data-theme="dark"] .plan-period { color: var(--text-muted); }
[data-theme="dark"] .plan-note { color: var(--text-muted); }
[data-theme="dark"] .upgrade-payment-methods { color: var(--text-muted); }
[data-theme="dark"] .payment-method-text { color: var(--text-muted); }
[data-theme="dark"] .upgrade-terms { color: var(--text-muted); }
[data-theme="dark"] .upgrade-terms a { color: var(--text-secondary); }
[data-theme="dark"] .upgrade-coming-soon { background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.2); }
[data-theme="dark"] .coming-soon-pricing { color: var(--text-muted); }
[data-theme="dark"] .upgrade-plan-featured {
    background: rgba(245, 158, 11, 0.1);
    border-color: #b45309;
}

/* App dialog dark mode */
[data-theme="dark"] .app-dialog-content {
    background: var(--panel-bg);
}
[data-theme="dark"] .app-dialog-input {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}
[data-theme="dark"] .app-dialog-features-preview {
    background: var(--surface);
    color: var(--text-secondary);
}

/* Onboarding modal */
[data-theme="dark"] .onboarding-modal {
    background: var(--panel-bg);
}

/* Settings modal */
[data-theme="dark"] .settings-panel {
    background: var(--panel-bg);
}

/* Footer */
[data-theme="dark"] .site-footer {
    background: rgba(41, 37, 36, 0.92);
    border-color: var(--border);
    color: var(--text-muted);
}

[data-theme="dark"] .site-footer a,
[data-theme="dark"] .site-footer button {
    color: var(--text-muted);
}
[data-theme="dark"] .site-footer a:hover,
[data-theme="dark"] .site-footer button:hover {
    color: var(--text);
}

/* Savings banner dark mode */
[data-theme="dark"] .savings-banner {
    background: var(--green-bg);
    border-color: #16a34a;
}

[data-theme="dark"] .savings-banner strong {
    color: #4ade80;
}

/* ── Theme toggle styling ──────────────────────────────────────── */
.theme-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text);
}

.theme-toggle-row .theme-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-toggle-row .theme-icon {
    font-size: 1rem;
}

/* ── Offline Banner ── */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: #ef4444;
    color: white;
    text-align: center;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

[data-theme="dark"] .offline-banner {
    background: #dc2626;
}
