/* EVSmartRoute visual system shared with the presentation website. */
:root {
    --brand-blue: #0284c7;
    --brand-sky: #0ea5e9;
    --brand-green: #22c55e;
    --brand-green-light: #4ade80;
    --brand-gradient: linear-gradient(120deg, #0284c7 0%, #0ea5e9 38%, #22c55e 100%);
    --brand-gradient-soft: linear-gradient(120deg, rgba(2, 132, 199, .14), rgba(14, 165, 233, .12) 38%, rgba(34, 197, 94, .14));
    --brand-action-border: rgba(56, 189, 248, .48);
    --brand-action-shadow: 0 0 18px rgba(14, 165, 233, .28), 0 0 24px rgba(34, 197, 94, .24), inset 0 1px 0 rgba(255, 255, 255, .3);
    --brand-action-shadow-hover: 0 0 26px rgba(14, 165, 233, .45), 0 0 34px rgba(34, 197, 94, .38), 0 12px 28px rgba(2, 132, 199, .2);
    --app-bg: #f8fafc;
    --app-panel: rgba(255, 255, 255, .94);
    --app-panel-strong: #ffffff;
    --app-surface: #ffffff;
    --app-surface-soft: #f8fafc;
    --app-text: #1e293b;
    --app-muted: #64748b;
    --app-border: rgba(15, 23, 42, .1);
    --app-shadow: 0 10px 40px rgba(0, 0, 0, .06);
    --app-shadow-raised: 0 18px 55px rgba(15, 23, 42, .12);
    --app-input: rgba(255, 255, 255, .96);
    --app-input-hover: #ffffff;
    --app-track: #dbe3ea;
    --text: var(--app-text);
    --muted: var(--app-muted);
    --glass: var(--app-panel);
    --glass-strong: var(--app-panel-strong);
    --line: var(--app-border);
    --shadow: var(--app-shadow-raised);
    --shadow-soft: var(--app-shadow);
}

html[data-theme='dark'] {
    --app-bg: #0b0f19;
    --app-panel: rgba(17, 24, 39, .7);
    --app-panel-strong: rgba(17, 24, 39, .92);
    --app-surface: rgba(30, 41, 59, .7);
    --app-surface-soft: rgba(15, 23, 42, .62);
    --app-text: #f1f5f9;
    --app-muted: #9aa7ba;
    --app-border: rgba(255, 255, 255, .1);
    --app-shadow: 0 24px 70px rgba(0, 0, 0, .36);
    --app-shadow-raised: 0 28px 78px rgba(0, 0, 0, .48);
    --app-input: rgba(2, 6, 23, .42);
    --app-input-hover: rgba(15, 23, 42, .76);
    --app-track: #334155;
}

html,
body,
.app-shell,
.map-canvas {
    background-color: var(--app-bg);
}

body {
    color: var(--app-text);
}

/* Theme-aware brand assets. */
.toolbar-brand-badge .brand-asset-light {
    display: none !important;
}

html[data-theme='light'] .toolbar-brand-badge .brand-asset-dark {
    display: none !important;
}

html[data-theme='light'] .toolbar-brand-badge .brand-asset-light {
    display: block !important;
}

html[data-theme='dark'] .toolbar-brand-badge .brand-asset-dark {
    display: block !important;
}

/* Header and search surface. */
.map-toolbar.floating {
    min-height: 66px;
    padding: 7px 9px !important;
    gap: 9px;
    border: 1px solid var(--app-border) !important;
    border-radius: 20px;
    background: var(--app-panel) !important;
    box-shadow: var(--app-shadow-raised) !important;
    -webkit-backdrop-filter: blur(20px) saturate(135%) !important;
    backdrop-filter: blur(20px) saturate(135%) !important;
}

.toolbar-brand-badge {
    height: 50px;
    gap: 12px;
}

.brand-mini,
.brand-wordmark {
    min-width: 0;
    padding: 0 !important;
}

.brand-mini .brand-logo {
    width: 112px;
    height: 40px;
    object-fit: contain;
}

.brand-wordmark {
    width: 224px;
    height: 42px;
    flex-basis: 224px;
}

.brand-wordmark .brand-wordmark-image {
    width: 224px;
    height: 38px;
    object-fit: contain;
    object-position: left center;
}

.map-toolbar .toolbar-search {
    min-width: 238px;
    height: 46px;
    border: 1px solid var(--app-border);
    color: var(--app-text);
    background: var(--app-input);
    box-shadow: none;
    transition: border-color .22s ease, background .22s ease, box-shadow .22s ease, transform .22s ease;
}

.map-toolbar .toolbar-search svg {
    stroke: currentColor;
}

.map-toolbar .toolbar-search:hover,
.map-toolbar .toolbar-search:focus-visible {
    border-color: rgba(34, 197, 94, .72);
    background: var(--app-input-hover);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, .12), 0 0 24px rgba(14, 165, 233, .12), 0 0 22px rgba(34, 197, 94, .12);
    outline: 0;
    transform: translateY(-1px);
}

.map-toolbar .icon-button,
.user-control .icon-button,
.user-control .login-button,
.user-control .select,
.user-control .user-chip {
    border-color: var(--app-border);
    color: var(--app-text);
    background: var(--app-input);
}

.map-toolbar .icon-button:hover,
.user-control .icon-button:hover,
.user-control .login-button:hover {
    border-color: rgba(14, 165, 233, .5);
    background: var(--app-input-hover);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, .1), 0 0 20px rgba(34, 197, 94, .1);
}

/* Glass panels and modal surfaces. */
.route-drawer,
.vehicle-dock,
.filter-popover,
.quick-filter-bar,
.user-control,
.preview,
.login-modal {
    border-color: var(--app-border) !important;
    color: var(--app-text);
    background: var(--app-panel) !important;
    box-shadow: var(--app-shadow) !important;
    -webkit-backdrop-filter: blur(20px) saturate(135%) !important;
    backdrop-filter: blur(20px) saturate(135%) !important;
}

html[data-theme='dark'] .route-drawer,
html[data-theme='dark'] .vehicle-dock,
html[data-theme='dark'] .filter-popover,
html[data-theme='dark'] .quick-filter-bar,
html[data-theme='dark'] .user-control,
html[data-theme='dark'] .preview,
html[data-theme='dark'] .login-modal {
    background: rgba(17, 24, 39, .7) !important;
    border: 1px solid rgba(255, 255, 255, .1) !important;
}

.route-drawer,
.vehicle-dock,
.filter-popover,
.preview,
.login-modal {
    border-radius: 16px;
}

.panel-head,
.filter-title,
.login-modal > header,
.vehicle-summary {
    border-color: var(--app-border);
}

.panel-head h1,
.panel-head h2,
.filter-title h2,
.login-modal h2,
.vehicle-expanded h2 {
    color: var(--app-text);
    font-weight: 800;
    letter-spacing: 0;
}

.panel-head h1,
.panel-head h2 {
    font-size: 1.32rem;
    line-height: 1.15;
}

.panel-head p,
.panel-kicker,
.section-label,
.field > span,
.tech-grid span,
.summary-grid span,
.timeline-copy span,
.count,
.stat span,
.subscription-footnote {
    color: var(--app-muted);
}

.panel-kicker,
.section-label,
.field > span,
.tech-grid span,
.summary-grid span {
    letter-spacing: .025em;
}

/* Internal cards keep a clear hierarchy without nesting heavy shadows. */
.route-input-card,
.trip-summary,
.timeline-panel,
.vehicle-card,
.guest-box,
.garage-car-card,
.saved-route-card,
.subscription-current,
.subscription-notice {
    border: 1px solid var(--app-border);
    border-radius: 14px;
    background: var(--app-surface);
    box-shadow: 0 4px 12px rgba(15, 23, 42, .05);
}

.route-input-card,
.trip-summary,
.timeline-panel {
    padding: 16px;
}

.route-input-card:first-of-type {
    padding-top: 16px;
}

html[data-theme='dark'] .route-input-card,
html[data-theme='dark'] .trip-summary,
html[data-theme='dark'] .timeline-panel,
html[data-theme='dark'] .vehicle-card,
html[data-theme='dark'] .guest-box,
html[data-theme='dark'] .garage-car-card,
html[data-theme='dark'] .saved-route-card,
html[data-theme='dark'] .subscription-current,
html[data-theme='dark'] .subscription-notice {
    background: rgba(30, 41, 59, .58);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035), 0 12px 28px rgba(0, 0, 0, .14);
}

.summary-grid > div,
.timeline-item,
.tech-grid > div,
.stat,
.check-row,
.vehicle-summary,
.subscription-prices > button {
    border-color: var(--app-border);
    color: var(--app-text);
    background: var(--app-surface-soft);
}

html[data-theme='dark'] .summary-grid > div,
html[data-theme='dark'] .timeline-item,
html[data-theme='dark'] .tech-grid > div,
html[data-theme='dark'] .stat,
html[data-theme='dark'] .check-row,
html[data-theme='dark'] .vehicle-summary,
html[data-theme='dark'] .subscription-prices > button {
    background: rgba(15, 23, 42, .56);
}

/* Inputs and focused states. */
.field input,
.field select,
.select,
.login-modal input,
.auth-field,
.settings-segment span,
.route-mode-option span {
    border-color: var(--app-border);
    color: var(--app-text);
    background: var(--app-input);
}

html[data-theme='dark'] .field input,
html[data-theme='dark'] .field select,
html[data-theme='dark'] .select,
html[data-theme='dark'] .login-modal input,
html[data-theme='dark'] .auth-field,
html[data-theme='dark'] .settings-segment span,
html[data-theme='dark'] .route-mode-option span {
    color: #f1f5f9;
    background: rgba(2, 6, 23, .42);
}

.field input:hover,
.field select:hover,
.select:hover,
.login-modal input:hover {
    border-color: rgba(14, 165, 233, .45);
}

.field input:focus,
.field select:focus,
.select:focus,
.login-modal input:focus,
.auth-field:focus-within {
    border-color: var(--brand-sky);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, .18), 0 0 22px rgba(34, 197, 94, .09);
}

html[data-theme='dark'] select option {
    color: #f1f5f9;
    background: #111827;
}

/* Primary actions use the same blue-to-green energy gradient as the website. */
.plan-btn,
.auth-primary,
.demo-login-btn,
.filter-apply-btn,
.subscription-upgrade,
.garage-add-toggle,
.garage-select-car,
.route-load,
.link-btn.primary,
.login-button.primary,
.geo-icon-btn,
.route-mode-option input:checked + span,
.settings-segment input:checked + span {
    border: 1px solid var(--brand-action-border);
    color: #ffffff;
    background: var(--brand-gradient);
    text-shadow: 0 1px 8px rgba(3, 25, 40, .25);
    box-shadow: var(--brand-action-shadow);
    transition: transform .22s ease, box-shadow .22s ease, filter .22s ease;
}

html[data-theme='light'] .plan-btn,
html[data-theme='dark'] .plan-btn {
    border: 1px solid var(--brand-action-border);
    color: #ffffff;
    background: var(--brand-gradient);
    box-shadow: var(--brand-action-shadow);
}

.plan-btn:hover,
.auth-primary:hover,
.demo-login-btn:hover,
.filter-apply-btn:hover,
.subscription-upgrade:hover,
.garage-add-toggle:hover,
.garage-select-car:hover,
.route-load:hover,
.link-btn.primary:hover,
.login-button.primary:hover {
    color: #ffffff;
    box-shadow: var(--brand-action-shadow-hover);
    filter: saturate(1.08) brightness(1.04);
    transform: translateY(-1px);
}

/*
 * Route location actions are absolutely centered with translateY(-50%).
 * Keep that positioning transform intact while applying hover feedback.
 */
.geo-icon-btn:hover,
.geo-icon-btn:focus-visible,
.geo-icon-btn:active {
    transform: translateY(-50%);
}

.geo-icon-btn:hover {
    color: #ffffff;
    box-shadow: var(--brand-action-shadow-hover);
    filter: saturate(1.08) brightness(1.04);
}

.geo-icon-btn:focus-visible {
    outline: 3px solid rgba(14, 165, 233, .28);
    outline-offset: 2px;
}

html[data-theme='light'] .plan-btn:hover,
html[data-theme='dark'] .plan-btn:hover {
    color: #ffffff;
    background: var(--brand-gradient);
    box-shadow: var(--brand-action-shadow-hover);
}

.icon-button:focus-visible,
.toolbar-search:focus-visible,
.vehicle-summary:focus-visible,
.quick-toggle:focus-visible,
.btn-close-modal:focus-visible,
.close-panel:focus-visible {
    outline: 3px solid rgba(14, 165, 233, .28);
    outline-offset: 2px;
}

.mobile-panel-bar button:focus-visible {
    outline: 3px solid rgba(14, 165, 233, .3);
    outline-offset: -2px;
}

.auth-secondary,
.route-mode-option span,
.quick-toggle,
.subscription-prices > button {
    color: var(--app-text);
    background: var(--app-surface-soft);
}

.battery-pill,
.avatar,
.kw-badge,
.effective-range,
.timeline-marker,
.route-pin.charge,
.mobile-nav-badge {
    color: #ffffff;
    background: var(--brand-gradient);
    box-shadow: 0 8px 24px rgba(14, 165, 233, .16), 0 8px 26px rgba(34, 197, 94, .14);
}

.quick-toggle:has(input:checked),
.check-row:has(input:checked) {
    border-color: rgba(34, 197, 94, .46);
    background: var(--brand-gradient-soft);
}

input[type='checkbox'],
input[type='radio'] {
    accent-color: var(--brand-green);
}

/* Neon progress and range controls. */
.range-settings .range-row input[type='range']::-webkit-slider-runnable-track,
.filter-popover input[type='range']::-webkit-slider-runnable-track {
    border-color: rgba(14, 165, 233, .5);
    background: linear-gradient(90deg, #0284c7 0%, #22c55e var(--range-progress, 50%), var(--app-track) var(--range-progress, 50%), var(--app-track) 100%);
    box-shadow: 0 0 16px rgba(14, 165, 233, .12), 0 0 14px rgba(34, 197, 94, .1);
}

.range-settings .range-row input[type='range']::-moz-range-progress,
.filter-popover input[type='range']::-moz-range-progress {
    background: var(--brand-gradient);
}

.range-settings .range-row input[type='range']::-moz-range-track,
.filter-popover input[type='range']::-moz-range-track {
    background: var(--app-track);
}

.range-settings .range-row input[type='range']::-webkit-slider-thumb,
.filter-popover input[type='range']::-webkit-slider-thumb {
    background: #ffffff;
    border-color: var(--brand-green);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, .16), 0 0 18px rgba(14, 165, 233, .24);
}

.range-settings .range-row input[type='range']::-moz-range-thumb,
.filter-popover input[type='range']::-moz-range-thumb {
    background: #ffffff;
    border-color: var(--brand-green);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, .16), 0 0 18px rgba(14, 165, 233, .24);
}

/* Modal depth and readable overlays. */
.modal-overlay {
    background: rgba(3, 7, 18, .58);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.login-modal > header {
    background: var(--brand-gradient-soft);
}

.btn-close-modal,
.close-panel {
    border-color: var(--app-border);
    color: var(--app-muted);
    background: var(--app-surface-soft);
}

.btn-close-modal:hover,
.close-panel:hover {
    border-color: rgba(239, 68, 68, .4);
    color: #ef4444;
    background: rgba(239, 68, 68, .1);
}

/* Loading visuals stay consistent with the cyber-night palette. */
.route-calc-card {
    border-color: var(--app-border);
    color: var(--app-text);
    background: var(--app-panel-strong);
    box-shadow: var(--app-shadow-raised);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

.route-calc-tire,
.route-calc-road {
    color: var(--brand-green-light);
}

.route-drawer,
.vehicle-dock,
.filter-popover,
.operator-list,
.login-modal-body,
.subscription-body {
    scrollbar-color: rgba(14, 165, 233, .42) transparent;
    scrollbar-width: thin;
}

.route-drawer::-webkit-scrollbar,
.vehicle-dock::-webkit-scrollbar,
.filter-popover::-webkit-scrollbar,
.operator-list::-webkit-scrollbar,
.login-modal-body::-webkit-scrollbar,
.subscription-body::-webkit-scrollbar {
    width: 8px;
}

.route-drawer::-webkit-scrollbar-track,
.vehicle-dock::-webkit-scrollbar-track,
.filter-popover::-webkit-scrollbar-track,
.operator-list::-webkit-scrollbar-track,
.login-modal-body::-webkit-scrollbar-track,
.subscription-body::-webkit-scrollbar-track {
    background: transparent;
}

.route-drawer::-webkit-scrollbar-thumb,
.vehicle-dock::-webkit-scrollbar-thumb,
.filter-popover::-webkit-scrollbar-thumb,
.operator-list::-webkit-scrollbar-thumb,
.login-modal-body::-webkit-scrollbar-thumb,
.subscription-body::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(14, 165, 233, .72), rgba(34, 197, 94, .72)) padding-box;
}

/* Keep the desktop station filter as tall and usable as the route and vehicle panels. */
@media (min-width: 1101px) {
    .filter-popover {
        top: 98px;
        bottom: 74px;
        height: auto;
        max-height: none;
        grid-template-rows: auto minmax(0, 1fr) auto;
        overflow: hidden;
    }

    .filter-panel-scroll {
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-gutter: stable;
    }

    .filter-panel-scroll .operator-list {
        max-height: none;
        overflow: visible;
    }
}

@media (max-width: 1100px) {
    .brand-wordmark {
        width: 184px;
        flex-basis: 184px;
    }

    .brand-wordmark .brand-wordmark-image {
        width: 184px;
        height: 34px;
    }

    .map-toolbar .toolbar-search {
        min-width: 190px;
    }
}

@media (max-width: 760px) {
    .map-toolbar.floating {
        min-height: 48px;
        padding: 6px !important;
        border-radius: 16px;
    }

    .map-toolbar .toolbar-brand-badge {
        height: 36px;
    }

    .map-toolbar .brand-mini .brand-logo {
        width: 88px;
        height: 30px;
    }

    .map-toolbar .brand-wordmark,
    .map-toolbar .toolbar-search,
    .map-toolbar .toolbar-website-link {
        display: none !important;
    }

    .route-drawer,
    .vehicle-dock,
    .filter-popover {
        background: var(--app-panel-strong) !important;
        -webkit-backdrop-filter: blur(22px) saturate(140%) !important;
        backdrop-filter: blur(22px) saturate(140%) !important;
    }

    .panel-head {
        background: var(--app-panel-strong);
    }

    .route-input-card,
    .trip-summary,
    .timeline-panel,
    .route-input-card:first-of-type {
        padding: 13px;
    }
}

@media (max-width: 520px) {
    .map-toolbar .brand-mini {
        display: flex !important;
        max-width: 84px;
    }

    .map-toolbar .brand-mini .brand-logo {
        width: 82px;
        height: 28px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .plan-btn,
    .auth-primary,
    .demo-login-btn,
    .filter-apply-btn,
    .subscription-upgrade,
    .toolbar-search {
        transition: none;
    }
}
