/* ===================== EDIT DRIVER MODAL ===================== */
#edit-driver-modal-overlay.fleet-modal-overlay {
    z-index: 3000;
}
#edit-driver-modal .fleet-modal-header {
    background: var(--fleet-gray-50);
}
#edit-driver-modal .btn-primary {
    background: var(--fleet-primary);
    color: #fff;
    border: none;
    border-radius: var(--fleet-radius);
    padding: 10px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--fleet-transition);
}
#edit-driver-modal .btn-primary:hover {
    background: var(--fleet-primary-dark);
}
#edit-driver-modal .btn-secondary {
    background: var(--fleet-gray-200);
    color: var(--fleet-gray-700);
    border: none;
    border-radius: var(--fleet-radius);
    padding: 10px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--fleet-transition);
}
#edit-driver-modal .btn-secondary:hover {
    background: var(--fleet-gray-300);
}
/**
 * Fleet Tracker v2.0 - Modern CSS
 * Premium design with smooth animations and responsive layout
 */

/* =============================================================================
   CSS VARIABLES - Design Tokens
   ============================================================================= */
:root {
    --fleet-primary: #3b82f6;
    --fleet-primary-dark: #2563eb;
    --fleet-primary-light: #60a5fa;
    --fleet-success: #10b981;
    --fleet-warning: #f59e0b;
    --fleet-danger: #ef4444;
    --fleet-gray-50: #f9fafb;
    --fleet-gray-100: #f3f4f6;
    --fleet-gray-200: #e5e7eb;
    --fleet-gray-300: #d1d5db;
    --fleet-gray-400: #9ca3af;
    --fleet-gray-500: #6b7280;
    --fleet-gray-600: #4b5563;
    --fleet-gray-700: #374151;
    --fleet-gray-800: #1f2937;
    --fleet-gray-900: #111827;
    --fleet-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --fleet-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --fleet-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --fleet-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --fleet-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --fleet-radius: 8px;
    --fleet-radius-lg: 12px;
    --fleet-transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* =============================================================================
   SIDEBAR COLLAPSE FOR FLEET MODE
   ============================================================================= */
.sidebar.fleet-collapsed {
    transform: translateX(-100%);
}

body.fleet-mode .main-content {
    margin-left: 0 !important;
}

/* =============================================================================
   FULLSCREEN MAP LAYOUT
   ============================================================================= */
#fleet-section {
    position: fixed;
    top: 0;
    left: 260px;
    right: 0;
    bottom: 0;
    z-index: 100;
    background: var(--fleet-gray-100);
}

/* On mobile, fleet section takes full width */
@media (max-width: 768px) {
    #fleet-section {
        left: 0;
    }
}

.fleet-fullscreen {
    position: relative;
    width: 100%;
    height: 100%;
}

.fleet-map-fullscreen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

/* =============================================================================
   SIDEBAR TOGGLE BUTTON (Burger Menu)
   ============================================================================= */
.fleet-sidebar-toggle {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 1000;
    width: 44px;
    height: 44px;
    background: white;
    border: none;
    border-radius: var(--fleet-radius);
    box-shadow: var(--fleet-shadow-lg);
    cursor: pointer;
    display: none; /* hidden by default, shown on mobile map view via JS */
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--fleet-gray-700);
    transition: all var(--fleet-transition);
}

.fleet-sidebar-toggle.visible {
    display: flex;
}

.fleet-sidebar-toggle:hover {
    background: var(--fleet-gray-50);
    transform: scale(1.05);
}

/* =============================================================================
   MAP CONTROLS
   ============================================================================= */
.fleet-map-controls {
    width: 44px;
    height: 44px;
    box-sizing: border-box;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    position: relative;
    z-index: 2;
    transition: transform var(--fleet-transition);
    color: white;
    border: 2px solid white;
    position: relative;
}

/* Hide empty map controls container to remove stray circle */
.fleet-map-controls:not(:has(button)) { display: none !important; }
.fleet-map-controls:empty { display: none !important; }

/* Status color variants — use classes on the parent .fleet-marker */
.fleet-marker.moving .fleet-marker-icon { background: var(--fleet-success); }
.fleet-marker.idle .fleet-marker-icon { background: var(--fleet-warning); }
.fleet-marker.stopped .fleet-marker-icon { background: var(--fleet-danger); }


/* =============================================================================
   FLOATING PANELS (Draggable)
   ============================================================================= */
.fleet-floating-panel {
    position: absolute;
    z-index: 500;
    background: white;
    border-radius: var(--fleet-radius-lg);
    box-shadow: var(--fleet-shadow-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.2s, transform 0.2s;
}

.fleet-floating-panel.dragging {
    opacity: 0.9;
    cursor: grabbing;
}

.fleet-floating-panel.minimized .fleet-panel-body {
    display: none;
}

.fleet-floating-panel.minimized {
    height: auto !important;
}

/* Panel Header (Drag Handle) */
.fleet-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--fleet-gray-800), var(--fleet-gray-900));
    color: white;
    /* Default header should not show grab cursor unless explicitly draggable */
    cursor: default;
    user-select: none;
}

/* If a panel header is explicitly draggable, use grab cursor */
.fleet-panel-header[data-draggable="true"] { cursor: grab; }

.fleet-panel-header:active {
    cursor: grabbing;
}

.fleet-panel-title {
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.fleet-panel-title i {
    opacity: 0.8;
}

.fleet-panel-subtitle {
    font-size: 12px;
    opacity: 0.7;
    margin-left: auto;
}

.fleet-panel-stats {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    margin-left: auto;
}

.fleet-stat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 8px;
}

.fleet-stat-dot.moving { background: var(--fleet-success); }
.fleet-stat-dot.idle { background: var(--fleet-warning); }
.fleet-stat-dot.stopped { background: var(--fleet-gray-400); }

.fleet-panel-minimize,
.fleet-panel-close {
    background: none;
    border: none;
    color: white;
    opacity: 0.7;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all var(--fleet-transition);
}

.fleet-panel-minimize:hover,
.fleet-panel-close:hover {
    opacity: 1;
    background: rgba(255,255,255,0.06);
}

/* Prominent circular red close button specifically for the Journeys panel (smaller and clearer) */
.fleet-journey-panel .fleet-panel-close {
    background: var(--fleet-danger);
    color: #fff;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    box-shadow: 0 3px 8px rgba(239,68,68,0.14);
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
    margin-left: 8px;
    font-size: 12px;
    box-sizing: border-box;
}
.fleet-journey-panel .fleet-panel-close i {
    font-size: 12px;
    line-height: 1;
    color: #fff;
    display: inline-block;
}
.fleet-journey-panel .fleet-panel-close:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(220,38,38,0.18);
}

/* Fit button - make it stand out and readable */
.fleet-panel-fit-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.fleet-panel-fit-btn .btn-label {
    display: inline-block;
    font-size: 13px;
}

.fleet-panel-fit-btn:hover {
    background: rgba(255,255,255,0.12);
}

/* When the Journeys panel wants a prominent labelled close button, use the fit-button look instead of the circular red icon */
.fleet-journey-panel .fleet-panel-close.fleet-panel-fit-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    width: auto;
    height: auto;
    box-shadow: none;
    font-size: 13px;
}
.fleet-journey-panel .fleet-panel-close.fleet-panel-fit-btn .btn-label {
    display: inline-block;
    font-size: 13px;
}
.fleet-journey-panel .fleet-panel-close.fleet-panel-fit-btn:hover {
    background: rgba(255,255,255,0.12);
    transform: translateY(0);
    box-shadow: none;
}

/* Apply the same labeled fit-button look anywhere it's used as a panel-close + fit-btn combo */
.fleet-panel-fit-btn.fleet-panel-close {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    width: auto;
    height: auto;
    box-shadow: none;
    font-size: 13px;
    box-sizing: border-box;
}
.fleet-panel-fit-btn.fleet-panel-close .btn-label {
    display: inline-block;
    font-size: 13px;
}
.fleet-panel-fit-btn.fleet-panel-close:hover {
    background: rgba(255,255,255,0.12);
    transform: translateY(0);
    box-shadow: none;
}

.fleet-panel-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
}

.fleet-panel-minimize:hover,
.fleet-panel-close:hover {
    opacity: 1;
    background: rgba(255,255,255,0.1);
}

/* Panel Body */
.fleet-panel-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* =============================================================================
   VEHICLE PANEL (Right Side - Fixed position)
   ============================================================================= */
.fleet-vehicle-panel {
    top: 16px;
    right: 16px;
    width: 320px; /* slightly narrower to fit more map */
    max-height: calc(100vh - 32px);
}

/* Remove drag cursor from vehicle panel header */
.fleet-vehicle-panel .fleet-panel-header {
    cursor: default;
}

.fleet-vehicle-panel .fleet-search {
    padding: 12px;
    border-bottom: 1px solid var(--fleet-gray-100);
}

.fleet-vehicle-panel .fleet-search-input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1px solid var(--fleet-gray-200);
    border-radius: var(--fleet-radius);
    font-size: 13px;
    background: var(--fleet-gray-50) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") 10px center / 16px no-repeat;
    transition: all var(--fleet-transition);
}

.fleet-vehicle-panel .fleet-search-input:focus {
    outline: none;
    border-color: var(--fleet-primary);
    background-color: white;
}

.fleet-vehicle-panel .fleet-vehicle-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    max-height: calc(100vh - 180px);
}

/* =============================================================================
   JOURNEY PANEL (Left Side)
   ============================================================================= */
.fleet-journey-panel {
    top: 16px;
    left: 16px;
    width: 320px; /* match vehicle panel width */
    max-height: calc(100vh - 32px);
    display: none;
}

.fleet-journey-panel.open {
    display: flex;
}

.fleet-history-controls {
    display: flex;
    gap: 6px;
    padding: 12px;
    border-bottom: 1px solid var(--fleet-gray-100);
    align-items: center;
}

/* Make prev/next match header gradient and be more visible */
.fleet-history-step-btn {
    background: linear-gradient(135deg, var(--fleet-gray-800), var(--fleet-gray-900));
    color: #fff;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(16,24,40,0.06);
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
    border: none;
}
.fleet-history-step-btn .fleet-step-svg { width: 16px; height: 16px; color: #fff; display: block; }
.fleet-history-step-btn { padding: 6px 8px; }
.fleet-history-step-btn:hover {
    box-shadow: 0 6px 18px rgba(7,12,17,0.12);
    transform: translateY(-1px);
}
.fleet-history-step-btn:active { transform: translateY(0); }
.fleet-history-step-btn[disabled] { opacity: 0.55; cursor: default; }

.fleet-history-date {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--fleet-gray-200);
    border-radius: var(--fleet-radius);
    font-size: 13px;
} 

/* =============================================================================
   VEHICLE CARDS (Compact for floating panel)
   ============================================================================= */
.fleet-vehicle-card {
    display: grid;
    grid-template-columns: 1fr 120px; /* slightly narrower meta column to save space */
    gap: 8px;
    padding: 6px 10px; /* reduced padding for a tighter card */
    margin-bottom: 6px;
    background: white;
    border: 1px solid var(--fleet-gray-100);
    border-radius: calc(var(--fleet-radius));
    cursor: pointer;
    transition: box-shadow var(--fleet-transition), border-color var(--fleet-transition), background var(--fleet-transition);
    position: relative;
    overflow: visible; /* allow content to wrap naturally */
    align-items: center; /* vertically center content */
}

.fleet-vehicle-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 2px; /* slimmer status indicator */
    background: var(--fleet-gray-300);
    transition: background var(--fleet-transition);
}

.fleet-vehicle-card.moving::before { background: var(--fleet-success); }
.fleet-vehicle-card.idle::before { background: var(--fleet-warning); }
.fleet-vehicle-card.stopped::before { background: var(--fleet-gray-400); }

.fleet-vehicle-card:hover {
    border-color: var(--fleet-primary-light);
    box-shadow: var(--fleet-shadow);
    background: var(--fleet-gray-50);
}

.fleet-vehicle-card.selected {
    border-color: var(--fleet-primary);
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
}

.fleet-vehicle-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

/* Driver name is now the primary label */
.fleet-vehicle-driver {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px; /* slightly smaller to save space */
    font-weight: 700; /* Bold driver name */
    color: var(--fleet-gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default;
    padding: 0 4px 0 0;
    margin: 0;
    border-radius: var(--fleet-radius);
    transition: background var(--fleet-transition);
    pointer-events: none; /* not interactive */
}

.fleet-vehicle-driver:hover {
    background: none;
}

.fleet-vehicle-driver .driver-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
    font-size: 13px;
    pointer-events: none;
}

.fleet-vehicle-driver .driver-edit-icon {
    display: none; /* hide edit icon since name is not clickable */
}

.fleet-vehicle-driver i:first-child {
    font-size: 13px;
    color: var(--fleet-gray-400);
    pointer-events: none;
    display: none; /* hide decorative user icon to align name flush left */
}

.fleet-vehicle-driver .driver-name {
    margin-left: 0;
    padding-left: 0;
}

/* Registration is secondary and subtler */
.fleet-vehicle-reg {
    font-size: 11px;
    font-weight: 600;
    color: var(--fleet-gray-600);
    letter-spacing: 0.4px;
    margin-top: 0;
}

/* Top-centered toolbar above map */
.fleet-top-toolbar {
    position: absolute;
    top: 12px;
    /* positioning will be set dynamically to sit between left controls and the right panel */
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, var(--fleet-gray-800), var(--fleet-gray-900));
    color: #fff;
    border-radius: 8px;
    padding: 6px 10px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
    z-index: 1200;
    min-width: 420px; /* a bit wider */
    max-width: 70%;
}

.fleet-top-toolbar.hidden { display: none; }

.fleet-top-left, .fleet-top-right { display:flex; gap:8px; align-items:center; }

.fleet-top-btn .btn-label { display: none; margin-left:6px; font-weight:700; font-size:13px; }

/* make some buttons slightly wider when labeled */
.fleet-top-btn.wide { min-width:88px; padding:6px 10px; }

/* show labels for right-side buttons on larger screens */
.fleet-top-right .btn-label { display: inline-block; }

/* make some buttons slightly wider when labeled */
.fleet-top-btn.wide { min-width:88px; padding:6px 10px; }

@media (max-width: 900px) {
    .fleet-top-toolbar { left: 12px; transform: none; right: 12px; min-width: auto; max-width: calc(100% - 24px); }
    .fleet-top-title { max-width: 40%; }
    .fleet-top-btn .btn-label { display: none; }
}

@media (min-width: 900px) {
    .fleet-top-toolbar { left: 12px; transform: none; right: 12px; min-width: auto; max-width: calc(100% - 24px); }
    .fleet-top-title { max-width: 45%; }
    .fleet-top-toolbar .btn-label { display: inline-block; }
}

.fleet-top-title {
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    text-align: center;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fleet-top-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    color: #fff;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width:36px;
    height:32px;
}

.fleet-top-close { background: transparent; border: none; color: rgba(255,255,255,0.8); cursor: pointer; }

.fleet-toolbar-btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Address should be compact — show on a single line with ellipsis */
.fleet-vehicle-address {
    font-size: 12px;
    color: var(--fleet-gray-700);
    margin-top: 2px;
    white-space: nowrap;
    overflow: visible; /* show full single-line address */
    text-overflow: unset;
    line-height: 1.28;
}

/* Tidy spacing for the left info column */
.fleet-vehicle-info {
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* align items to top so content lines up with meta */
    gap: 4px;
    min-width: 0;
}


.fleet-vehicle-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    align-self: flex-start; /* keep meta aligned to top of card */
}

/* Status badge - shows mph when moving, "Idle" or "Stopped" otherwise */
.fleet-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    min-width: 55px;
    text-align: center;
}

.fleet-status-badge.moving {
    background: var(--fleet-success);
    color: white;
}

.fleet-status-badge.idle {
    background: var(--fleet-warning);
    color: white;
}

.fleet-status-badge.stopped {
    background: var(--fleet-danger);
    color: white;
}

.fleet-vehicle-time {
    font-size: 11px;
    color: var(--fleet-gray-400);
}

.fleet-vehicle-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.fleet-vehicle-history-btn {
    padding: 4px 8px;
    min-width: 56px;
    height: 28px;
    border-radius: 6px;
    background: var(--fleet-primary);
    color: white;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    font-size: 12px;
}

.fleet-vehicle-history-btn i { font-size: 12px; }

.fleet-vehicle-history-btn:hover { background: var(--fleet-primary-dark); }

.fleet-vehicle-edit-driver-btn {
    padding: 4px 8px;
    min-width: 56px;
    height: 28px;
    border-radius: 6px;
    background: var(--fleet-gray-100);
    color: var(--fleet-gray-700);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    font-size: 12px;
}

.fleet-vehicle-edit-driver-btn i { font-size: 12px; }

.fleet-vehicle-edit-driver-btn:hover { background: var(--fleet-gray-200); }

.fleet-vehicle-history-btn i { font-size: 12px; }

.fleet-vehicle-settings-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid var(--fleet-gray-200);
    color: var(--fleet-gray-600);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.fleet-vehicle-settings-btn:hover { background: var(--fleet-gray-100); }

/* Small screens - make actions stack */
@media (max-width: 420px) {
    .fleet-vehicle-actions { flex-direction: column; align-items: stretch; }
    .fleet-vehicle-history-btn { width: 100%; }
    .fleet-vehicle-settings-btn { width: 100%; }
}

.fleet-vehicle-history-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--fleet-gray-100);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--fleet-gray-500);
    transition: all var(--fleet-transition);
    margin-top: 4px;
}

.fleet-vehicle-history-btn:hover {
    background: var(--fleet-primary);
    color: white;
}

.fleet-vehicle-list::-webkit-scrollbar {
    width: 5px;
}

.fleet-vehicle-list::-webkit-scrollbar-thumb {
    background: var(--fleet-gray-300);
    border-radius: 3px;
}

/* Ensure Leaflet works properly in fullscreen */
#fleet-map .leaflet-container {
    width: 100%;
    height: 100%;
}

/* Fix Leaflet default marker icon path issue */
.leaflet-default-icon-path {
    background-image: url(https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png);
}

/* =============================================================================
   CUSTOM MARKERS
   ============================================================================= */
.fleet-marker {
    width: 48px;
    height: 48px;
    position: relative;
    display: inline-block; /* ensure marker element keeps its box */
    text-align: center;
}

.fleet-marker .fleet-marker-icon {
    width: 44px;
    height: 44px;
    box-sizing: border-box;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    position: relative;
    z-index: 2;
    transition: transform var(--fleet-transition);
    color: white;
    border: 2px solid white;
    background: var(--fleet-gray-500); /* default background if status missing */
    line-height: 44px; /* compatibility fallback for centering */
    font-weight: 700;
}
.fleet-marker.stopped .fleet-marker-icon { background: var(--fleet-danger); }

.fleet-marker.selected .fleet-marker-icon {
    transform: scale(1.15);
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.35);
}

/* pulse intentionally removed for a simpler marker */
.fleet-marker-pulse { display: none; }

/* Ensure SVG icon images render at correct size and are not stretched */


@keyframes marker-pulse {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
    100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

.fleet-marker-label { display: none; }

.fleet-marker:hover .fleet-marker-label,
.fleet-marker.selected .fleet-marker-label {
    opacity: 1;
    background: var(--fleet-primary);
}

/* =============================================================================
   VEHICLE POPUP
   ============================================================================= */
.fleet-popup {
    min-width: 300px;
    max-width: 350px;
    padding: 16px;
    background: white;
    border-radius: var(--fleet-radius-lg);
}

.fleet-popup-wrapper .leaflet-popup-content-wrapper {
    background: white;
    border-radius: var(--fleet-radius-lg);
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    padding: 0;
}

/* Ensure popups appear above the sidebar and other UI */
.fleet-popup-wrapper,
.fleet-popup-wrapper .leaflet-popup {
    z-index: 2100 !important;
}

.leaflet-popup-pane .fleet-popup-wrapper {
    z-index: 2100 !important;
}

/* Circle marker label (permanent tooltip) styling */
.fleet-circle-label.leaflet-tooltip {
    background: transparent;
    border: none;
    box-shadow: none;
    color: white;
    font-weight: 700;
    font-size: 14px;
    padding: 0;
    pointer-events: none;
    transform: translateY(-1px);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
    border-radius: 50%;
}

/* Slight border/outline around label text for readability on light maps */
.fleet-circle-label.leaflet-tooltip { text-shadow: 0 1px 0 rgba(0,0,0,0.45); }

/* Ensure circle markers have consistent z-index above map layers */
.fleet-circle-marker { z-index: 1200; }

/* Make selected circle slightly larger visually */
.fleet-circle-marker.leaflet-interactive.leaflet-clickable {
    transition: transform 120ms ease;
}



.fleet-popup-wrapper .leaflet-popup-content {
    margin: 0;
    width: auto !important;
}

.fleet-popup-wrapper .leaflet-popup-tip {
    background: white;
}

.fleet-popup-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--fleet-gray-100);
    margin-bottom: 12px;
}

.fleet-popup-reg {
    font-size: 18px;
    font-weight: 700;
    color: var(--fleet-gray-900);
}

.fleet-popup-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.fleet-popup-status.moving {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: var(--fleet-success);
}

.fleet-popup-status.idle {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: var(--fleet-warning);
}

.fleet-popup-status.stopped {
    background: var(--fleet-gray-100);
    color: var(--fleet-gray-500);
}

.fleet-popup-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.fleet-popup-row:not(:last-child) {
    border-bottom: 1px solid var(--fleet-gray-50);
}

.fleet-popup-label {
    font-size: 12px;
    color: var(--fleet-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fleet-popup-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--fleet-gray-800);
}

.fleet-popup-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--fleet-gray-100);
}

.fleet-popup-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: var(--fleet-radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all var(--fleet-transition);
}

.fleet-popup-btn.primary {
    background: var(--fleet-primary);
    color: white;
}

.fleet-popup-btn.primary:hover {
    background: var(--fleet-primary-dark);
}

.fleet-popup-btn.secondary {
    background: var(--fleet-gray-100);
    color: var(--fleet-gray-700);
}

.fleet-popup-btn.secondary:hover {
    background: var(--fleet-gray-200);
}

/* =============================================================================
   JOURNEY LIST (Inside floating panel)
   ============================================================================= */
.fleet-journey-list {
    flex: 1;
    overflow-y: auto;
    max-height: calc(100vh - 280px);
}

.fleet-journey-item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--fleet-gray-100);
    cursor: pointer;
    transition: all var(--fleet-transition);
    border-left: 3px solid transparent;
}

.fleet-journey-item:hover {
    background: var(--fleet-gray-50);
    border-left-color: var(--fleet-gray-300);
}

.fleet-journey-item.active {
    background: #eef4ff;
    border-left-color: var(--fleet-primary);
}

/* Time placed beside each location for a denser list */
/* Time placed beside each location for a denser list */
.fleet-journey-location {
    font-size: 12px;
    color: var(--fleet-gray-600);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Ensure the address text always stays the muted gray (override accidental coloring) */
.fleet-journey-location .fleet-journey-address {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--fleet-gray-600) !important;
}

/* Make the time columns smaller and tighten gap so addresses sit closer to times */
.fleet-journey-location { gap: 4px; }
.fleet-journey-time-start,
.fleet-journey-time-end {
    font-weight: 700;
    font-size: 12px;
    flex: 0 0 32px; /* even narrower */
    min-width: 32px;
    display: inline-block;
    text-align: left;
    margin-right: 6px; /* tiny spacing to next element */
}

/* Explicitly scope the start/end colours so they don't affect other text */
.fleet-journey-location.start .fleet-journey-time-start {
    color: var(--fleet-success);
}
.fleet-journey-location.end .fleet-journey-time-end {
    color: var(--fleet-danger);
}

/* Reduce icon spacing so address sits closer */
.fleet-journey-location i { margin-right: 4px; }

.fleet-journey-location i {
    color: var(--fleet-gray-400);
    font-size: 10px;
}

.fleet-journey-location.loading {
    color: var(--fleet-gray-400);
    font-style: italic;
}

.fleet-journey-location.loading .fleet-journey-address {
    color: var(--fleet-gray-400) !important;
    animation: address-pulse 1.5s ease-in-out infinite;
}

@keyframes address-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.fleet-journey-metrics {
    display: flex;
    gap: 10px;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--fleet-gray-700);
}

/* Make each journey item slightly more compact */
.fleet-journey-item {
    padding: 8px 10px;
    border-bottom: 1px solid var(--fleet-gray-100);
    cursor: pointer;
    transition: all var(--fleet-transition);
    border-left: 3px solid transparent;
}

.fleet-journey-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--fleet-gray-500);
}

.fleet-journey-empty i {
    font-size: 32px;
    color: var(--fleet-gray-300);
    margin-bottom: 12px;
}

/* =============================================================================
   SPEED ALERT BADGES & MAP MARKERS
   ============================================================================= */

/* Badge on journey list items */
.fleet-speed-alert-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
    cursor: help;
}

.fleet-speed-alert-badge.minor {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fdba74;
}

.fleet-speed-alert-badge.moderate {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fbbf24;
}

.fleet-speed-alert-badge.severe {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

.fleet-speed-alert-badge i {
    font-size: 9px;
}

/* Map marker for speed violations — SVG triangle */
.fleet-speed-marker {
    background: transparent !important;
    border: none !important;
    overflow: visible !important;
    box-shadow: none !important;
}

/* Override Leaflet's default marker icon clipping */
.leaflet-marker-icon.fleet-speed-marker {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    overflow: visible !important;
}

.fleet-speed-marker svg {
    display: block;
    overflow: visible;
    transition: transform 0.15s ease;
    pointer-events: auto;
}

.fleet-speed-marker:hover svg {
    transform: scale(1.2);
}

/* Pulse animation for severe violations */
.fleet-speed-marker.severe {
    animation: speed-marker-pulse 2s ease-in-out infinite;
}

@keyframes speed-marker-pulse {
    0%, 100% { filter: drop-shadow(0 0 0 rgba(220, 38, 38, 0)); }
    50% { filter: drop-shadow(0 0 8px rgba(220, 38, 38, 0.7)); }
}

/* Speed tooltip styling */
.fleet-speed-tooltip-wrap {
    max-width: 220px;
}

.fleet-speed-tooltip strong {
    display: block;
    margin-bottom: 4px;
}

/* Journey item with speed violations gets a subtle left border */
.fleet-journey-item.has-speed-violations {
    border-left-color: #f59e0b;
}

.fleet-journey-item.has-speed-violations.severe {
    border-left-color: #dc2626;
}

/* History Summary Footer */
.fleet-history-summary {
    padding: 12px 16px;
    background: var(--fleet-gray-50);
    border-top: 1px solid var(--fleet-gray-200);
}

.fleet-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
}

.fleet-summary-row span:first-child {
    color: var(--fleet-gray-600);
}

.fleet-summary-row span:last-child {
    font-weight: 700;
    color: var(--fleet-gray-900);
}

/* =============================================================================
   TIMESHEET MODAL
   ============================================================================= */
.fleet-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--fleet-transition);
}

.fleet-modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.fleet-modal {
    background: white;
    border-radius: var(--fleet-radius-lg);
    box-shadow: var(--fleet-shadow-lg);
    width: 90%;
    max-width: 900px;
    max-height: 80vh;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform var(--fleet-transition);
}

.fleet-modal-overlay.open .fleet-modal {
    transform: scale(1);
}

.fleet-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--fleet-gray-100);
}

.fleet-modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--fleet-gray-900);
    margin: 0;
}

.fleet-modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--fleet-gray-100);
    border-radius: var(--fleet-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--fleet-gray-500);
    transition: all var(--fleet-transition);
}

.fleet-modal-close:hover {
    background: var(--fleet-danger);
    color: white;
}

.fleet-modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(80vh - 140px);
}

/* =============================================================================
   TIMESHEET TABLE
   ============================================================================= */
.fleet-timesheet-controls {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.fleet-timesheet-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.fleet-timesheet-table th {
    text-align: left;
    padding: 12px 16px;
    background: var(--fleet-gray-50);
    color: var(--fleet-gray-600);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--fleet-gray-200);
}

.fleet-timesheet-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--fleet-gray-100);
    color: var(--fleet-gray-800);
}

.fleet-timesheet-table tr:hover td {
    background: var(--fleet-gray-50);
}

.fleet-timesheet-table .date-col {
    font-weight: 600;
    color: var(--fleet-gray-900);
}

.fleet-timesheet-table .time-col {
    font-family: monospace;
    font-size: 13px;
}

.fleet-timesheet-table .duration-col {
    font-weight: 600;
    color: var(--fleet-primary);
}

/* =============================================================================
   LOADING STATES
   ============================================================================= */
.fleet-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--fleet-gray-500);
}

.fleet-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--fleet-gray-200);
    border-top-color: var(--fleet-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.fleet-skeleton {
    background: linear-gradient(90deg, var(--fleet-gray-100) 25%, var(--fleet-gray-200) 50%, var(--fleet-gray-100) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--fleet-radius);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.fleet-vehicle-skeleton {
    height: 88px;
    margin-bottom: 8px;
}

/* =============================================================================
   EMPTY STATE
   ============================================================================= */
.fleet-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.fleet-empty-icon {
    font-size: 48px;
    color: var(--fleet-gray-300);
    margin-bottom: 16px;
}

.fleet-empty-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--fleet-gray-700);
    margin-bottom: 8px;
}

.fleet-empty-text {
    font-size: 14px;
    color: var(--fleet-gray-500);
}

/* =============================================================================
   TOAST NOTIFICATIONS
   ============================================================================= */
.fleet-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fleet-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--fleet-gray-800);
    color: white;
    border-radius: var(--fleet-radius);
    box-shadow: var(--fleet-shadow-lg);
    animation: toast-in 0.3s ease;
}

.fleet-toast.success { background: var(--fleet-success); }
.fleet-toast.warning { background: var(--fleet-warning); }
.fleet-toast.error { background: var(--fleet-danger); }

@keyframes toast-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */
@media (max-width: 1024px) {
    #fleet-section {
        left: 0;
    }
}

@media (max-width: 640px) {
    .fleet-header {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }

    .fleet-status-bar {
        width: 100%;
        justify-content: space-between;
    }

    .fleet-stat {
        padding: 6px 10px;
        font-size: 12px;
    }

    .fleet-stat-value {
        font-size: 16px;
    }

    .fleet-history-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .fleet-modal {
        width: 95%;
        max-height: 90vh;
    }

    .fleet-timesheet-controls {
        flex-direction: column;
    }
}

/* =============================================================================
   LEAFLET OVERRIDES
   ============================================================================= */
.leaflet-popup-content-wrapper {
    padding: 0 !important;
    border-radius: var(--fleet-radius-lg) !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25) !important;
    background: white !important;
    overflow: visible !important;
}

/* Move Leaflet zoom controls to bottom-left to avoid top-left UI clutter */
/* Use broad selectors and !important to override Leaflet's inline/top positioning */
.leaflet-left .leaflet-control-zoom,
.leaflet-control-zoom.leaflet-control {
    top: auto !important;
    bottom: 12px !important;
    left: 12px !important;
    right: auto !important;
}

/* Slightly reduce control size and add subtle shadow for visual weight */
.leaflet-control-zoom a {
    width: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
    box-shadow: var(--fleet-shadow-sm) !important;
}

/* if leaflet injects transform, reset it */
.leaflet-control-zoom { transform: none !important; }

/* On very small screens keep some spacing from bottom/left edges */
@media (max-width: 420px) {
    .leaflet-top.leaflet-left .leaflet-control-zoom {
        bottom: 72px !important; /* move up a bit if bottom UI exists */
        left: 8px !important;
    }
}

.leaflet-popup-content {
    margin: 0 !important;
    width: auto !important;
    min-width: 300px;
}

.leaflet-popup-tip-container {
    overflow: visible !important;
}

.leaflet-popup-tip {
    box-shadow: none !important;
    background: white !important;
}

/* Ensure popup is on top and visible */
.leaflet-popup {
    z-index: 1000 !important;
}

/* Fix Leaflet div icon container */
.leaflet-marker-icon.fleet-marker {
    background: transparent !important;
    border: none !important;
}

.leaflet-control-zoom {
    border: none !important;
    box-shadow: var(--fleet-shadow-md) !important;
    border-radius: var(--fleet-radius) !important;
    overflow: hidden;
}

.leaflet-control-zoom a {
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    color: var(--fleet-gray-600) !important;
    border-bottom: 1px solid var(--fleet-gray-100) !important;
}

.leaflet-control-zoom a:hover {
    background: var(--fleet-gray-50) !important;
    color: var(--fleet-primary) !important;
}

/* =============================================================================
   HISTORY ROUTE MARKERS
   ============================================================================= */
.fleet-history-marker {
    display: flex;
    align-items: center;
    justify-content: center;
}

.fleet-history-marker-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: block;
    font-size: 10px;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 2px solid white;
}

/* Specific start/end classes to ensure clear colors */
.fleet-history-marker-dot.start-dot { background: var(--fleet-success); }
.fleet-history-marker-dot.end-dot { background: var(--fleet-danger); }

/* Keep old selectors as fallback */
.fleet-history-marker.start .fleet-history-marker-dot { background: var(--fleet-success); }
.fleet-history-marker.end .fleet-history-marker-dot { background: var(--fleet-danger); }

/* Tooltip for start/end markers on the map (card-style) */
.leaflet-tooltip.fleet-tooltip {
    background: #fff;
    color: var(--fleet-gray-900);
    border: 1px solid rgba(16,24,40,0.06);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.2;
    box-shadow: 0 6px 18px rgba(17,24,39,0.12);
    max-width: 320px;
    min-width: 140px; /* prevent collapse to single-char width */
    width: auto !important;
    display: inline-block; /* ensure predictable box sizing */
    box-sizing: border-box;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    text-align: left;
}
/* Ensure the tooltip arrow matches the card background */
.leaflet-tooltip.fleet-tooltip::before {
    border-top-color: #fff;
}
.leaflet-tooltip.fleet-tooltip strong { font-weight: 700; color: var(--fleet-gray-900); }

/* =============================================================================
   TOAST OUT ANIMATION
   ============================================================================= */
@keyframes toast-out {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* =============================================================================
   MOBILE RESPONSIVE - Tab-based view switching (≤768px)
   On mobile the vehicle panel and journey panel each become full-screen pages
   accessible via a bottom tab bar. Only one view is visible at a time.
   ============================================================================= */

/* Tab bar hidden on desktop */
.fleet-mobile-tabs {
    display: none;
}

@media (max-width: 768px) {

    /* --- Bottom Tab Bar --- */
    .fleet-mobile-tabs {
        display: flex;
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1500;
        background: linear-gradient(135deg, var(--fleet-gray-800), var(--fleet-gray-900));
        padding: 6px 0;
        padding-bottom: max(6px, env(safe-area-inset-bottom));
        box-shadow: 0 -2px 12px rgba(0,0,0,0.15);
    }

    .fleet-mobile-tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        border: none;
        background: transparent;
        color: rgba(255,255,255,0.45);
        font-size: 10px;
        font-weight: 600;
        cursor: pointer;
        padding: 6px 0;
        transition: color 150ms ease;
        -webkit-tap-highlight-color: transparent;
    }

    .fleet-mobile-tab i {
        font-size: 18px;
    }

    .fleet-mobile-tab.active {
        color: var(--fleet-primary-light);
    }

    .fleet-mobile-tab:active {
        color: var(--fleet-primary);
    }

    /* --- Map adjustments --- */
    .fleet-map-fullscreen {
        bottom: 56px; /* make room for tab bar */
    }

    /* --- Vehicle Panel: full-screen, hidden unless tab active --- */
    .fleet-vehicle-panel {
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 56px !important;
        width: 100% !important;
        max-height: none !important;
        border-radius: 0 !important;
        display: none;
        z-index: 600;
    }

    .fleet-vehicle-panel.fleet-mobile-active {
        display: flex;
    }

    .fleet-vehicle-panel .fleet-vehicle-list {
        max-height: none;
        flex: 1;
    }

    .fleet-vehicle-panel .fleet-search-input {
        font-size: 16px; /* prevent iOS zoom on focus */
    }

    /* --- Journey Panel: full-screen, controlled by tab --- */
    /* Override desktop .open behavior on mobile */
    .fleet-journey-panel.open {
        display: none;
    }

    .fleet-journey-panel.fleet-mobile-active {
        display: flex;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 56px !important;
        width: 100% !important;
        max-height: none !important;
        border-radius: 0 !important;
        z-index: 600;
    }

    .fleet-journey-panel.fleet-mobile-active .fleet-journey-list {
        max-height: none;
        flex: 1;
    }

    /* --- Top Toolbar: hidden on mobile (bottom tabs replace it) --- */
    .fleet-top-toolbar {
        display: none !important;
    }

    /* --- Toast container above tab bar --- */
    .fleet-toast-container {
        bottom: 68px;
        right: 12px;
        left: 12px;
    }

    .fleet-toast {
        font-size: 13px;
        padding: 10px 14px;
    }

    /* --- Leaflet zoom controls above tab bar --- */
    .leaflet-left .leaflet-control-zoom,
    .leaflet-control-zoom.leaflet-control {
        bottom: 16px !important;
    }

    /* --- Map popup adjustments --- */
    .fleet-popup {
        min-width: 220px;
        max-width: 280px;
        padding: 12px;
    }

    .leaflet-popup-content {
        min-width: 220px !important;
    }

    /* --- Vehicle card: full-width stacked layout on mobile --- */
    .fleet-vehicle-card {
        display: flex;
        flex-direction: column;
        gap: 6px;
        padding: 12px 14px;
        margin-bottom: 8px;
        border-radius: 10px;
    }

    .fleet-vehicle-card .fleet-vehicle-info {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 10px;
        min-width: 0;
    }

    .fleet-vehicle-card .fleet-vehicle-driver {
        flex: 1;
        font-size: 15px;
        min-width: 0;
    }

    .fleet-vehicle-card .fleet-vehicle-driver .driver-name {
        font-size: 15px;
    }

    .fleet-vehicle-card .fleet-vehicle-reg {
        font-size: 12px;
        flex-shrink: 0;
    }

    .fleet-vehicle-card .fleet-vehicle-address {
        font-size: 13px;
        color: var(--fleet-gray-600);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .fleet-vehicle-card .fleet-vehicle-meta {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        align-self: stretch;
    }

    .fleet-vehicle-card .fleet-status-badge {
        font-size: 12px;
        padding: 5px 12px;
    }

    .fleet-vehicle-card .fleet-vehicle-time {
        font-size: 12px;
        margin-left: auto;
    }

    /* --- Modal adjustments on mobile --- */
    .fleet-modal {
        width: 95%;
        max-height: 85vh;
    }

    .fleet-modal-body {
        max-height: calc(85vh - 140px);
    }

    /* --- Journey date controls full-width --- */
    .fleet-history-controls {
        padding: 10px 12px;
    }

    .fleet-history-date {
        font-size: 16px; /* prevent iOS zoom */
    }

    /* --- Vehicle selector in journey panel (mobile only) --- */
    .fleet-journey-vehicle-select {
        display: flex;
        padding: 10px 12px;
        border-bottom: 1px solid var(--fleet-gray-100);
    }

    .fleet-journey-vehicle-select select {
        flex: 1;
        padding: 10px 12px;
        border: 1px solid var(--fleet-gray-200);
        border-radius: var(--fleet-radius);
        font-size: 16px; /* prevent iOS zoom */
        font-weight: 600;
        color: var(--fleet-gray-800);
        background: var(--fleet-gray-50);
        appearance: auto;
        cursor: pointer;
    }

    .fleet-journey-vehicle-select select:focus {
        outline: none;
        border-color: var(--fleet-primary);
        background: white;
    }

    /* --- Vehicle card mobile action row --- */
    .fleet-vehicle-card-actions {
        display: flex;
        gap: 8px;
        grid-column: 1 / -1;
        padding-top: 6px;
        border-top: 1px solid var(--fleet-gray-100);
        margin-top: 4px;
    }

    .fleet-vehicle-card-actions .fleet-card-action-btn {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 8px 10px;
        border: none;
        border-radius: 6px;
        font-size: 12px;
        font-weight: 700;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .fleet-card-action-btn.journeys {
        background: var(--fleet-primary);
        color: white;
    }

    .fleet-card-action-btn.navigate {
        background: var(--fleet-gray-100);
        color: var(--fleet-gray-700);
    }

    /* --- Back-to-map button inside panels (for quick nav) --- */
    .fleet-mobile-back {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        background: none;
        border: none;
        color: var(--fleet-primary-light);
        font-size: 12px;
        font-weight: 600;
        cursor: pointer;
        padding: 4px 8px;
        margin-right: auto;
        border-radius: 4px;
        -webkit-tap-highlight-color: transparent;
    }

    .fleet-mobile-back:active {
        background: rgba(255,255,255,0.1);
    }
}

/* Hide mobile-only elements on desktop */
@media (min-width: 769px) {
    .fleet-mobile-back {
        display: none !important;
    }
    .fleet-journey-vehicle-select {
        display: none !important;
    }
    .fleet-vehicle-card-actions {
        display: none !important;
    }
}
