/* ═══════════════════════════════════════════════════════════════
   4TRoute — App CSS
   Design: Dark mode, glassmorphism, mobile-first
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset & Custom Properties ─────────────────────────────── */
:root {
    --primary:       #6C5CE7;
    --primary-dark:  #5A4BD1;
    --primary-light: #A29BFE;
    --accent:        #00D2D3;
    --accent-glow:   rgba(0, 210, 211, 0.3);
    --success:       #00B894;
    --success-glow:  rgba(0, 184, 148, 0.3);
    --warning:       #FDCB6E;
    --warning-glow:  rgba(253, 203, 110, 0.3);
    --danger:        #FF6B6B;
    --danger-glow:   rgba(255, 107, 107, 0.3);

    --bg-body:       #0A0A1A;
    --bg-card:       #12122A;
    --bg-card-hover: #1A1A3A;
    --bg-glass:      rgba(255, 255, 255, 0.04);
    --bg-input:      #16163A;
    --bg-navbar:     rgba(10, 10, 26, 0.92);

    --border:        rgba(255, 255, 255, 0.06);
    --border-accent: rgba(108, 92, 231, 0.3);

    --text:          #EAEAEF;
    --text-muted:    #8B8BA7;
    --text-weak:     #5A5A7A;

    --radius:        12px;
    --radius-sm:     8px;
    --radius-lg:     16px;
    --radius-xl:     24px;
    --radius-full:   9999px;

    --shadow:        0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg:     0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow:   0 0 30px rgba(108, 92, 231, 0.15);

    --transition:    0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.15s ease;

    --navbar-h:      60px;
    --bottomnav-h:   68px;
    --safe-bottom:   env(safe-area-inset-bottom, 0px);

    --font:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

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

body {
    font-family: var(--font);
    background: var(--bg-body);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

img { max-width: 100%; height: auto; }

/* ── Container ─────────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ── Navbar ─────────────────────────────────────────────────── */
.app-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-h);
    background: var(--bg-navbar);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    display: flex;
    align-items: center;
}

.nav-inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 700;
    font-size: 1.1rem;
}
.nav-brand:hover { color: var(--text); }

.brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}
.brand-icon svg { width: 20px; height: 20px; }

.nav-actions {
    position: relative;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius-full);
    transition: background var(--transition-fast);
}
.nav-user:hover {
    background: var(--bg-glass);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
}

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

.nav-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-fast);
    z-index: 1001;
    overflow: hidden;
}
.nav-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text);
    font-size: 0.88rem;
    transition: background var(--transition-fast);
}
.dropdown-item:hover {
    background: var(--bg-glass);
    color: var(--text);
}
.dropdown-item svg { width: 18px; height: 18px; color: var(--text-muted); }
.dropdown-item.text-danger { color: var(--danger); }
.dropdown-item.text-danger svg { color: var(--danger); }

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

/* ── Main Content ──────────────────────────────────────────── */
.app-main {
    padding-top: calc(var(--navbar-h) + 20px);
    padding-bottom: calc(var(--bottomnav-h) + var(--safe-bottom) + 20px);
    min-height: 100vh;
    min-height: 100dvh;
}
.main-fullscreen {
    padding: 0;
}

/* ── Bottom Navigation ─────────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottomnav-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--bg-navbar);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 1000;
}

.bnav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 500;
    padding: 6px 12px;
    transition: color var(--transition-fast);
    position: relative;
}
.bnav-item svg { width: 22px; height: 22px; }
.bnav-item.active {
    color: var(--primary);
}
.bnav-item:hover {
    color: var(--text);
}

.bnav-add-btn {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    margin-top: -20px;
    box-shadow: 0 4px 20px rgba(108, 92, 231, 0.4);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.bnav-add:hover .bnav-add-btn {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(108, 92, 231, 0.6);
}
.bnav-add-btn svg { width: 24px; height: 24px; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all var(--transition);
}
.card:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-glow);
}

.card-glass {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 16px rgba(108, 92, 231, 0.3);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(108, 92, 231, 0.5);
    color: #fff;
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), #00B5B6);
    color: #000;
    box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-accent:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(0, 210, 211, 0.5);
    color: #000;
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #00A080);
    color: #fff;
    box-shadow: 0 4px 16px var(--success-glow);
}
.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(0, 184, 148, 0.5);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #E55555);
    color: #fff;
    box-shadow: 0 4px 16px var(--danger-glow);
}
.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px var(--danger-glow);
    color: #fff;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #F0B040);
    color: #000;
}
.btn-warning:hover {
    transform: translateY(-1px);
    color: #000;
}

.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-ghost:hover {
    background: var(--bg-glass);
    border-color: var(--border-accent);
    color: var(--text);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.82rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1rem;
    border-radius: var(--radius);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-sm);
}

.btn-icon-round {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-full);
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.92rem;
    transition: all var(--transition-fast);
    outline: none;
}
.form-control::placeholder {
    color: var(--text-weak);
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

.form-control-icon {
    position: relative;
}
.form-control-icon .form-control {
    padding-left: 44px;
}
.form-control-icon .icon-left {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}
.form-control-icon .icon-left svg { width: 18px; height: 18px; }

.form-hint {
    font-size: 0.78rem;
    color: var(--text-weak);
    margin-top: 4px;
}

select.form-control {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238B8BA7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

/* ── Toggle / Switch ───────────────────────────────────────── */
.toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}
.toggle input { display: none; }
.toggle-track {
    width: 44px;
    height: 24px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    position: relative;
    transition: all var(--transition);
    flex-shrink: 0;
}
.toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--text-muted);
    border-radius: var(--radius-full);
    transition: all var(--transition);
}
.toggle input:checked + .toggle-track {
    background: var(--primary);
    border-color: var(--primary);
}
.toggle input:checked + .toggle-track::after {
    transform: translateX(20px);
    background: #fff;
}
.toggle-label {
    font-size: 0.88rem;
    color: var(--text);
}

/* ── Flash Messages ────────────────────────────────────────── */
.flash-msg {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin: 0 16px 12px;
    font-size: 0.88rem;
    animation: slideDown 0.3s ease;
    position: relative;
    transition: opacity 0.3s, transform 0.3s;
}
.flash-msg svg { width: 20px; height: 20px; flex-shrink: 0; }
.flash-close {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.6;
}
.flash-close:hover { opacity: 1; }

.flash-success { background: rgba(0, 184, 148, 0.12); color: var(--success); border: 1px solid rgba(0, 184, 148, 0.2); }
.flash-danger  { background: rgba(255, 107, 107, 0.12); color: var(--danger); border: 1px solid rgba(255, 107, 107, 0.2); }
.flash-warning { background: rgba(253, 203, 110, 0.12); color: var(--warning); border: 1px solid rgba(253, 203, 110, 0.2); }
.flash-info    { background: rgba(0, 210, 211, 0.12); color: var(--accent); border: 1px solid rgba(0, 210, 211, 0.2); }

/* ── Stats Cards ───────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    transition: all var(--transition);
}
.stat-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-2px);
}
.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.2;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* ── Route Cards ───────────────────────────────────────────── */
.route-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 14px;
}
.route-card:hover {
    border-color: var(--border-accent);
    background: var(--bg-card-hover);
    transform: translateX(4px);
}

.route-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.route-icon svg { width: 22px; height: 22px; }
.route-icon-planning  { background: rgba(108, 92, 231, 0.15); color: var(--primary); }
.route-icon-active    { background: rgba(0, 210, 211, 0.15); color: var(--accent); }
.route-icon-completed { background: rgba(0, 184, 148, 0.15); color: var(--success); }

.route-info {
    flex: 1;
    min-width: 0;
}
.route-name {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.route-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.route-arrow {
    color: var(--text-weak);
    flex-shrink: 0;
}
.route-arrow svg { width: 18px; height: 18px; }

/* ── Stop Items ────────────────────────────────────────────── */
.stop-list {
    list-style: none;
}

.stop-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    position: relative;
}
.stop-item:last-child { border-bottom: none; }

.stop-number {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--bg-input);
    border: 2px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}
.stop-item:not(:last-child) .stop-number::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: calc(100% + 14px);
    background: var(--border);
    z-index: 0;
}

.stop-number.priority {
    border-color: var(--danger);
    color: var(--danger);
    animation: pulse 2s infinite;
}

.stop-info { flex: 1; min-width: 0; }
.stop-address {
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.3;
}
.stop-recipient {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.stop-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 4px;
}
.stop-badge.priority-badge {
    background: rgba(255, 107, 107, 0.15);
    color: var(--danger);
}

.stop-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ── Status Badges ─────────────────────────────────────────── */
.status-pending    { color: var(--text-muted); }
.status-navigating { color: var(--accent); }
.status-arrived    { color: var(--warning); }
.status-confirmed  { color: var(--success); }
.status-skipped    { color: var(--text-weak); }

/* ── Vehicle Selector ──────────────────────────────────────── */
.vehicle-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.vehicle-option {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}
.vehicle-option:hover {
    border-color: var(--border-accent);
    background: var(--bg-card-hover);
}
.vehicle-option.selected {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(108, 92, 231, 0.2);
}
.vehicle-option svg {
    width: 28px;
    height: 28px;
    margin-bottom: 6px;
    color: var(--primary-light);
}
.vehicle-option .label {
    font-size: 0.82rem;
    font-weight: 600;
}

/* ── Map ───────────────────────────────────────────────────── */
.map-container {
    width: 100%;
    height: 400px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.map-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    border: none;
    z-index: 1;
}

/* Leaflet overrides */
.leaflet-control-attribution {
    background: rgba(10, 10, 26, 0.7) !important;
    color: var(--text-muted) !important;
    font-size: 0.65rem !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.leaflet-control-attribution a { color: var(--accent) !important; }
.leaflet-control-zoom {
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow) !important;
}
.leaflet-control-zoom a {
    background: var(--bg-card) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.2rem !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    transition: all 0.2s !important;
    text-decoration: none !important;
}
.leaflet-control-zoom a:hover {
    background: var(--bg-card-hover) !important;
    color: var(--primary-light) !important;
}
.leaflet-control-zoom-in:before { content: '+'; }
.leaflet-control-zoom-out:before { content: '−'; } /* Unicode minus sign */
.leaflet-control-zoom-in span, .leaflet-control-zoom-out span { display: none; }

.leaflet-popup-content-wrapper {
    background: var(--bg-card) !important;
    color: var(--text) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow) !important;
    border: 1px solid var(--border) !important;
}
.leaflet-popup-tip { background: var(--bg-card) !important; }

/* ── Specific Icon Fixes ─────────────────────────────────────── */
[data-lucide] {
    display: inline-block;
    vertical-align: middle;
    width: 1em;
    height: 1em;
}

/* Priority Pulse */
.priority-pulse {
    animation: pulse 2s infinite;
}


/* ── Bottom Sheet (for route page) ─────────────────────────── */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 70vh;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    z-index: 100;
    transition: transform var(--transition);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
}

.sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--text-weak);
    border-radius: var(--radius-full);
    margin: 12px auto;
}

.sheet-content {
    padding: 0 20px 32px;
}

/* ── Navigate Card (during active navigation) ──────────────── */
.nav-card {
    position: fixed;
    bottom: 20px;
    left: 16px;
    right: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    z-index: 200;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: slideUp 0.4s ease;
}

.nav-card-next {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.nav-card-stop-num {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    color: #fff;
    flex-shrink: 0;
}
.nav-card-stop-num.priority {
    background: linear-gradient(135deg, var(--danger), #FF4444);
    animation: pulse 2s infinite;
}

.nav-card-info { flex: 1; min-width: 0; }
.nav-card-address {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.3;
}
.nav-card-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 2px;
    display: flex;
    gap: 12px;
}

.nav-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* ── Search Bar ────────────────────────────────────────────── */
.search-bar {
    position: relative;
}
.search-bar input {
    width: 100%;
    padding: 14px 16px 14px 46px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.92rem;
    outline: none;
    transition: all var(--transition-fast);
}
.search-bar input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}
.search-bar .search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.search-bar .search-icon svg { width: 18px; height: 18px; }

.search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    max-height: 250px;
    overflow-y: auto;
    z-index: 500;
    box-shadow: var(--shadow-lg);
    display: none;
}
.search-results.show { display: block; }

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition-fast);
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-glass); }
.search-result-item svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; margin-top: 2px; }

/* ── Section Headers ───────────────────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.section-title {
    font-size: 1.1rem;
    font-weight: 700;
}
.section-action {
    font-size: 0.82rem;
    color: var(--accent);
    font-weight: 500;
}

/* ── Auth Pages ────────────────────────────────────────────── */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 20px;
}
.auth-container {
    width: 100%;
    max-width: 420px;
}
.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}
.auth-logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 8px 32px rgba(108, 92, 231, 0.3);
}
.auth-logo-icon svg { width: 32px; height: 32px; color: #fff; }
.auth-title {
    font-size: 1.5rem;
    font-weight: 800;
}
.auth-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
}

.auth-link {
    text-align: center;
    margin-top: 20px;
    font-size: 0.88rem;
    color: var(--text-muted);
}
.auth-link a {
    color: var(--accent);
    font-weight: 600;
}

.auth-error {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.2);
    color: var(--danger);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.auth-error svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ── Password Strength ─────────────────────────────────────── */
.pw-strength-bar {
    height: 4px;
    background: var(--border);
    border-radius: var(--radius-full);
    margin-top: 8px;
    overflow: hidden;
}
.pw-strength-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: all 0.3s ease;
    width: 0%;
}
.pw-strength-text {
    font-size: 0.72rem;
    margin-top: 4px;
    color: var(--text-weak);
}

/* ── Password Toggle ───────────────────────────────────────── */
.pw-toggle-wrap { position: relative; }
.pw-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}
.pw-toggle:hover { color: var(--text); }
.pw-toggle svg { width: 18px; height: 18px; }

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 20px;
}
.empty-icon {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-full);
    background: var(--bg-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}
.empty-icon svg { width: 32px; height: 32px; color: var(--text-muted); }
.empty-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 6px;
}
.empty-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
}
.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 24px;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform var(--transition);
}
.modal-overlay.show .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
}
.modal-close {
    width: 36px;
    height: 36px;
    background: var(--bg-glass);
    border: none;
    border-radius: var(--radius-full);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-close svg { width: 18px; height: 18px; }

/* ── Settings ──────────────────────────────────────────────── */
.settings-group {
    margin-bottom: 24px;
}
.settings-group-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 600;
}

.settings-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    transition: all var(--transition-fast);
}
.settings-item:hover { border-color: var(--border-accent); }

.settings-item-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.settings-item-icon svg { width: 20px; height: 20px; }

.settings-item-info { flex: 1; }
.settings-item-label {
    font-size: 0.9rem;
    font-weight: 500;
}
.settings-item-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ── Footer ────────────────────────────────────────────────── */
.app-footer {
    padding: 24px 0;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: calc(var(--bottomnav-h) + var(--safe-bottom));
}
.footer-sub {
    margin-top: 4px;
    color: var(--text-weak);
}
.footer-sub a { color: var(--accent); }

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

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

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

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 var(--danger-glow); }
    50%      { box-shadow: 0 0 0 8px transparent; }
}

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

.fade-in {
    animation: fadeIn 0.5s ease;
}
.slide-up {
    animation: slideUp 0.4s ease;
}

/* ── Loading Spinner ───────────────────────────────────────── */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: var(--radius-full);
    animation: spin 0.6s linear infinite;
}
.spinner-lg { width: 40px; height: 40px; border-width: 3px; }

/* ── Utilities ─────────────────────────────────────────────── */
.text-center   { text-align: center; }
.text-muted    { color: var(--text-muted); }
.text-accent   { color: var(--accent); }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.text-warning  { color: var(--warning); }
.fw-500        { font-weight: 500; }
.fw-600        { font-weight: 600; }
.fw-700        { font-weight: 700; }
.fw-800        { font-weight: 800; }

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.p-16  { padding: 16px; }
.p-20  { padding: 20px; }

.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }

.d-flex     { display: flex; }
.d-grid     { display: grid; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1     { flex: 1; }

.w-full { width: 100%; }

.hidden { display: none !important; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 480px) {
    .d-none-mobile { display: none !important; }

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

    .nav-card {
        left: 8px;
        right: 8px;
        bottom: 12px;
    }

    .auth-card { padding: 20px; }
    .modal-content { padding: 20px; }
}

@media (min-width: 481px) and (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 769px) {
    .bottom-nav { display: none; }

    .app-main {
        padding-bottom: 20px;
    }

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

    .modal-content {
        max-width: 500px;
        border-radius: var(--radius-xl);
        margin-bottom: 10vh;
    }

    .modal-overlay {
        align-items: center;
    }

    .app-footer {
        margin-bottom: 0;
    }

    .vehicle-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 32px;
    }
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--text-weak);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ── Selection ─────────────────────────────────────────────── */
::selection {
    background: rgba(108, 92, 231, 0.3);
    color: var(--text);
}
