:root {
    --bg-color: #0f172a; /* Slate 900 */
    --text-main: #f8fafc; /* Slate 50 */
    --text-muted: #94a3b8; /* Slate 400 */
    --primary: #3b82f6; /* Blue 500 */
    --primary-hover: #2563eb; /* Blue 600 */
    --glass-bg: rgba(30, 41, 59, 0.7); /* Slate 800 with opacity */
    --glass-border: rgba(255, 255, 255, 0.1);
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* subtle gradient background */
    background: radial-gradient(circle at top right, #1e293b, #0f172a);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Glassmorphism utility */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Typography */
h1, h2, h3 {
    font-weight: 600;
    margin-bottom: 0.5rem;
}
p {
    color: var(--text-muted);
    line-height: 1.5;
}

/* ========================
   NAVBAR
   ======================== */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 200;
}
.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #fff;
}
.nav-icon {
    width: 24px;
    height: 24px;
    color: var(--primary);
}
.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}
.nav-user {
    color: #94a3b8;
    font-size: 0.85rem;
    margin-right: 0.5rem;
    display: flex;
    align-items: center;
    gap: 6px;
}
.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}
.nav-link:hover {
    color: #fff;
}
.nav-dropdown-wrap {
    position: relative;
    display: inline-block;
    margin-right: 0.5rem;
}
.nav-dropdown-btn {
    outline: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #e2e8f0;
    padding: 0.35rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    transition: border-color 0.2s, background 0.2s;
}
.nav-dropdown-btn:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(15, 23, 42, 0.75);
}
.nav-dropdown-btn svg {
    transition: transform 0.2s;
    color: #94a3b8;
}
.nav-dropdown-btn.open svg {
    transform: rotate(180deg);
}
.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 260px;
    max-height: 300px;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0.5rem 0;
    z-index: 300;
    display: none;
}
.nav-dropdown-menu.open {
    display: block;
}
.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.5rem 1rem;
    color: #cbd5e1;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    user-select: none;
}
.nav-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}
.nav-dropdown-item input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--primary);
    width: 14px;
    height: 14px;
}
.nav-dropdown-item label {
    cursor: pointer;
    flex: 1;
}

/* Hamburger button — hidden on desktop */
.hamburger-btn {
    display: none;
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: background 0.2s;
}
.hamburger-btn:hover {
    background: rgba(255,255,255,0.1);
}

/* ========================
   MOBILE NAV DRAWER
   ======================== */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 300;
    opacity: 0;
    transition: opacity 0.25s;
}
.mobile-nav-overlay.open {
    opacity: 1;
}

.mobile-nav-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 260px;
    height: 100%;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid var(--glass-border);
    z-index: 400;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    gap: 0.5rem;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.mobile-nav-drawer.open {
    transform: translateX(0);
}
.mobile-nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 0.5rem;
}
.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.75rem 0.75rem;
    border-radius: 10px;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: background 0.2s;
}
.mobile-nav-link:hover, .mobile-nav-link:active {
    background: rgba(255,255,255,0.08);
}
.mobile-nav-logout {
    margin-top: auto;
    color: var(--danger);
}

/* ========================
   BUTTONS
   ======================== */
.btn-primary, .btn-secondary {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 0.95rem;
    /* iOS tap highlight */
    -webkit-tap-highlight-color: transparent;
}
.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.23);
}
.btn-secondary {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}
.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.2);
}
.btn-large {
    padding: 0.8rem 1.5rem;
    font-size: 1.1rem;
}
.btn-icon {
    width: 20px;
    height: 20px;
}
.btn-icon-danger {
    background: transparent;
    color: var(--danger);
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 6px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-icon-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}
.w-full { width: 100%; }
.mt-4 { margin-top: 1rem; }

/* Fix 4: Clear Route button */
.btn-clear-route {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}
.btn-clear-route:hover {
    background: rgba(239, 68, 68, 0.22);
    border-color: rgba(239, 68, 68, 0.5);
}

/* ========================
   MAIN CONTAINER
   ======================== */
.container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ========================
   LOGIN PAGE
   ======================== */
.login-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}
.login-card {
    border-radius: 16px;
    padding: 3rem;
    max-width: 480px;
    width: 100%;
    text-align: center;
    animation: fadeUp 0.6s ease-out;
}
.login-header {
    margin-bottom: 2.5rem;
}
.login-header h1 {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    background: linear-gradient(to right, #60a5fa, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.login-hint {
    margin-top: 1.5rem;
    font-size: 0.875rem;
}

/* ========================
   MAP PAGE
   ======================== */
.map-wrapper {
    flex: 1;
    display: flex;
    margin: 1rem 1.5rem 1.5rem;
    border-radius: 16px;
    overflow: hidden;
    animation: fadeUp 0.5s ease-out;
    min-height: 0; /* Prevent flex overflow */
}

.map-sidebar {
    width: 300px;
    background: rgba(15, 23, 42, 0.6);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}
.sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}
.legend-stats {
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.pulse-dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    background-color: var(--primary);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}
.legend-container {
    padding: 0.75rem;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}
.legend-item {
    display: flex;
    align-items: center;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 0.4rem;
    transition: background 0.2s;
    gap: 0.5rem;
}
.legend-item:hover {
    background: rgba(255, 255, 255, 0.08);
}
.color-dot {
    width: 12px;
    height: 12px;
    min-width: 12px;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(255,255,255,0.2);
}
.legend-name {
    flex: 1;
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.legend-count {
    background: rgba(255,255,255,0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* Fix 5: Eye toggle button in legend */
.legend-eye-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 3px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.legend-eye-btn.visible {
    color: var(--primary);
}
.legend-eye-btn.hidden {
    color: rgba(148, 163, 184, 0.4);
}
.legend-eye-btn:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.map-container {
    flex: 1;
    background: #000; /* Placeholder for loading */
}

/* Mobile panel toggle FAB — positioned inside the map area, top-right */
.mobile-panel-toggle {
    display: none; /* hidden on desktop */
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 20;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid var(--glass-border);
    color: #fff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.2s, background 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.mobile-panel-toggle:hover, .mobile-panel-toggle.panel-open {
    transform: scale(1.08);
    background: var(--primary);
    border-color: var(--primary);
}
.panel-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--primary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
}

/* Mobile drag handle */
.mobile-drag-handle {
    display: none;
    justify-content: center;
    padding: 8px 0 2px;
    flex-shrink: 0;
}
.drag-bar {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.25);
}

/* ===== Sidebar tab bar (mobile & desktop) ===== */
.sidebar-tabs {
    display: flex;
    flex-shrink: 0;
    flex-direction: row;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.2);
}
.sidebar-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0.6rem 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.2s, border-bottom 0.2s;
    border-bottom: 2px solid transparent;
    -webkit-tap-highlight-color: transparent;
}
.sidebar-tab.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}
.tab-badge {
    background: var(--primary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    padding: 0 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ===== Sidebar panels ===== */
.sidebar-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Route stops scrollable area */
.route-stops-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.75rem 1rem 0;
}

/* ========================
   INFO WINDOW (Google Maps)
   ======================== */
.info-window {
    color: #1e293b;
    font-family: 'Inter', sans-serif;
    padding: 0.5rem;
    max-width: 260px;
}
.info-window h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.05rem;
    color: #0f172a;
}
.info-details {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

/* ========================
   SETTINGS PAGE
   ======================== */
.settings-container {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}
.settings-header {
    margin-bottom: 2rem;
    text-align: center;
}
.settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}
.settings-card {
    padding: 2rem;
    border-radius: 16px;
    animation: fadeUp 0.6s ease-out;
}
.settings-card h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.75rem;
}
.form-group {
    margin-bottom: 1.25rem;
}
.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}
.form-row {
    display: flex;
    gap: 1rem;
}
.form-row .form-group {
    flex: 1;
}
select, input[type="text"] {
    width: 100%;
    padding: 0.75rem;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--glass-border);
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    /* Prevent iOS zoom on focus (font-size must be >= 16px) */
    font-size: 16px;
}
select:focus, input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
}
.color-picker {
    width: 100%;
    height: 42px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}
.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}
.color-picker::-webkit-color-swatch {
    border: 1px solid var(--glass-border);
    border-radius: 8px;
}
.radio-group {
    display: flex;
    gap: 1.5rem;
    background: rgba(0,0,0,0.2);
    padding: 0.75rem;
    border-radius: 8px;
}
.radio-group label {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: #fff;
}
.mapping-section {
    background: rgba(255,255,255,0.03);
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
    border: 1px dashed var(--glass-border);
}
.mapping-section h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
}

/* Mappings List */
.mappings-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.mapping-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.03);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    transition: background 0.2s;
}
.mapping-item:hover {
    background: rgba(255,255,255,0.06);
}
.mapping-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.mapping-details {
    display: flex;
    flex-direction: column;
}
.mapping-type {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ========================
   ANIMATIONS
   ======================== */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(59, 130, 246, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

/* ========================
   TOGGLE SWITCH
   ======================== */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255,255,255,0.2);
  transition: .4s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
}
input:checked + .slider {
  background-color: var(--primary);
}
input:checked + .slider:before {
  transform: translateX(26px);
}
.slider.round {
  border-radius: 24px;
}
.slider.round:before {
  border-radius: 50%;
}

/* ========================
   DEBUG CONSOLE
   ======================== */
.debug-console {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    width: 400px;
    height: 300px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.console-header {
    background: rgba(0,0,0,0.4);
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
}
.console-body {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.75rem;
    color: #4ade80;
    line-height: 1.4;
    user-select: text;
    -webkit-overflow-scrolling: touch;
}
.console-body div {
    margin-bottom: 0.2rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.console-copy-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: #94a3b8;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s, color 0.2s;
}

.console-copy-btn:hover {
    background: rgba(255,255,255,0.2);
    color: white;
}

/* ========================
   ROUTE PLANNER
   ======================== */
.route-stop-item {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    gap: 0.5rem;
}

.route-stop-controls {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.route-btn-small {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.route-btn-small:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.route-stop-name {
    flex: 1;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.route-stop-remove {
    color: #ef4444;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    font-size: 1rem;
    -webkit-tap-highlight-color: transparent;
}

.route-stop-remove:hover {
    background: rgba(239, 68, 68, 0.1);
}

.info-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

/* ========================
   MOBILE RESPONSIVE
   ======================== */
@media (max-width: 768px) {
    /* Navbar */
    .navbar {
        padding: 0.75rem 1rem;
    }
    .nav-links-desktop {
        display: none !important;
    }
    .hamburger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .mobile-nav-overlay {
        display: block;
        pointer-events: none;
    }
    .mobile-nav-overlay.open {
        pointer-events: all;
    }

    /* Settings */
    .settings-container {
        padding: 1rem;
    }
    .settings-grid {
        grid-template-columns: 1fr;
    }
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    /* Map page full-screen */
    .map-wrapper {
        margin: 0;
        border-radius: 0;
        flex-direction: column;
        height: calc(100vh - 58px); /* minus navbar height */
        position: relative;
    }

    /* Sidebar becomes a bottom drawer on mobile */
    .map-sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 55%;
        max-height: 70vh;
        border-right: none;
        border-top: 1px solid var(--glass-border);
        border-radius: 20px 20px 0 0;
        background: rgba(15, 23, 42, 0.97);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        z-index: 100;
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 -8px 30px rgba(0,0,0,0.5);
        overflow: hidden;
    }
    .map-sidebar.mobile-open {
        transform: translateY(0);
    }

    /* Show FAB on mobile (it's inside the map container now) */
    .mobile-panel-toggle {
        display: flex;
    }
    /* Show tab bar */
    .sidebar-tabs {
        display: flex;
    }
    /* Show drag handle */
    .mobile-drag-handle {
        display: flex;
    }

    /* Map takes full space */
    .map-container {
        position: absolute;
        inset: 0;
    }

    /* Debug console */
    .debug-console {
        width: calc(100% - 2rem);
        right: 1rem;
        bottom: 1rem;
        height: 180px;
        z-index: 50;
    }

    /* Login */
    .login-card {
        padding: 2rem 1.5rem;
    }
}

@media (max-width: 400px) {
    .login-card {
        padding: 1.5rem 1rem;
    }
    .login-header h1 {
        font-size: 1.6rem;
    }
}

/* ── Settings Redesign: Tabs & Dual-List Component ── */
.settings-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none; /* Hide scrollbar Firefox */
}
.settings-tabs::-webkit-scrollbar {
    display: none; /* Hide scrollbar Chrome/Safari */
}
.settings-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.settings-tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}
.settings-tab-btn.active {
    color: var(--primary);
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.25);
    font-weight: 600;
}
.settings-tab-content {
    display: none;
    animation: settingsFadeIn 0.3s ease-in-out;
}
.settings-tab-content.active {
    display: block;
}
@keyframes settingsFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dual List Box Layout */
.dual-list-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto;
    gap: 0.75rem;
    align-items: center;
    margin-top: 0.5rem;
}
.dual-list-pane {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.dual-list-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.dual-list-btns, .dual-list-order-btns {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
}
.dual-list-btns button, .dual-list-order-btns button {
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background-color 0.2s, transform 0.1s;
}
.dual-list-btns button:hover, .dual-list-order-btns button:hover {
    background-color: rgba(255, 255, 255, 0.15);
}
.dual-list-btns button:active, .dual-list-order-btns button:active {
    transform: scale(0.95);
}
.dual-list-pane select {
    height: 180px !important;
    padding: 0.5rem !important;
}

@media (max-width: 768px) {
    .dual-list-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .dual-list-btns, .dual-list-order-btns {
        flex-direction: row;
        width: 100%;
        gap: 1rem;
    }
    .dual-list-btns button, .dual-list-order-btns button {
        flex: 1;
        height: 44px;
    }
}

/* ========================
   CALL SELECTOR MODAL
   ======================== */
.call-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.call-modal-overlay.open {
    display: flex;
}

.call-modal-dialog {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1.5rem;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: fadeUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.call-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.call-modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
}

.call-modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-modal-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.call-modal-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.call-option-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    text-align: left;
    font-family: inherit;
}

.call-option-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.call-option-btn svg {
    flex-shrink: 0;
    color: inherit;
}


