:root {
    /* Color Palette - Clean Light Theme */
    --bg-dark: #f0f9ff; /* Ultra light sky blue / celeste background */
    --bg-panel: #ffffff; /* White panels */
    --bg-panel-hover: #f0f9ff;
    
    --primary: #0ea5e9; /* Sky Blue / Celeste */
    --primary-hover: #0284c7; /* Deep Celeste Hover */
    --primary-glow: rgba(14, 165, 233, 0.25);
    
    --accent: #eab308; /* Sunflower Golden Yellow */
    --warning: #d97706; /* Amber */
    --danger: #dc2626; /* Red */
    
    --text-main: #0f172a; /* Very dark slate */
    --text-muted: #64748b; /* Slate gray */
    
    --border: #e0f2fe; /* Cohesive light blue border */
    
    --font-family: 'Outfit', sans-serif;
    
    /* Layout */
    --sidebar-width: 280px;
    --radius: 16px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
    overflow-y: auto;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* --- Login Overlay --- */
.login-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-dark);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    padding: 2rem 1rem;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s;
}

.login-overlay.active {
    visibility: visible;
    opacity: 1;
}

.login-card {
    background: var(--bg-panel);
    padding: 3rem;
    border-radius: var(--radius);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    width: 90%;
    max-width: 450px;
    border: 1px solid var(--border);
    margin: auto;
}

/* Typography */
h1 { font-size: 2rem; font-weight: 600; letter-spacing: -0.5px; }
h2 { font-size: 1.25rem; font-weight: 500; color: var(--text-main); }
p { color: var(--text-muted); }

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
    overflow-y: auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 3rem;
    letter-spacing: 1px;
}

.logo-icon {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    box-shadow: 0 0 15px var(--primary-glow);
}

.logo-img {
    height: 55px;
    width: auto;
    display: block;
    margin: 0 auto;
    transition: var(--transition);
}

.logo-img-large {
    max-width: 180px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-links li {
    padding: 1rem 1.2rem;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    color: var(--text-muted);
    transition: var(--transition);
}

.nav-links li i {
    font-size: 1.25rem;
}

.nav-links li:hover {
    background-color: var(--bg-panel-hover);
    color: var(--text-main);
}

.nav-links li.active {
    background: linear-gradient(90deg, rgba(14, 165, 233, 0.15), transparent);
    color: var(--primary);
    border-left: 4px solid var(--primary);
}

/* --- Main Content --- */
.content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2.5rem 3rem;
    position: relative;
    max-width: 1400px;
}

.view {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.view.active {
    display: block;
}

.view-header {
    margin-bottom: 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

/* Stats */
.header-stats {
    display: flex;
    gap: 1rem;
}
.stat-box {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    text-align: center;
    min-width: 120px;
}
.stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}
.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Grid & Cards */
.cards-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}
.admin-grid {
    grid-template-columns: 300px 1fr;
}

.card {
    background-color: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.card-header i {
    color: var(--primary);
    font-size: 1.5rem;
}

/* Forms */
.input-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.row {
    display: flex;
    gap: 1rem;
}
.half { flex: 1; }

label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

input, textarea, select {
    width: 100%;
    background-color: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Buttons */
.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-glow {
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}
.btn-secondary:hover {
    background-color: rgba(14, 165, 233, 0.1);
}

.icon-btn {
    width: 45px;
    padding: 0;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.5px;
}

tr:hover td {
    background-color: var(--bg-panel-hover);
}

/* Badges / Status */
.status {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}
.status.pending { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.status.transit { background: rgba(14, 165, 233, 0.15); color: var(--primary); }
.status.delivered { background: rgba(234, 179, 8, 0.15); color: var(--accent); }

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    text-align: center;
}
.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}
.modal-backdrop {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
}
.modal-content {
    position: relative;
    background: var(--bg-panel);
    padding: 2rem;
    border-radius: var(--radius);
    z-index: 1001;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.15);
    border: 1px solid var(--border);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.close-btn {
    background: none; border: none; color: var(--text-muted);
    font-size: 1.5rem; cursor: pointer; transition: var(--transition);
}
.close-btn:hover { color: var(--text-main); }

/* Shipping Label (Printable Area) */
.shipping-label {
    background: white;
    color: black;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-family: monospace, sans-serif;
}
.label-header {
    display: flex; justify-content: space-between;
    border-bottom: 2px solid black; padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    font-weight: bold;
}
.label-barcode-top {
    text-align: center;
    margin-bottom: 1rem;
}
.label-id { font-size: 1.2rem; font-weight: bold; margin-top: 5px; }
.label-section {
    margin-bottom: 1rem;
    padding: 0.5rem;
    border: 1px solid #ccc;
}
.label-tag { font-size: 0.7rem; font-weight: bold; color: #666; }
.lbl-main { font-size: 1.4rem; font-weight: bold; margin: 5px 0; }
.label-footer {
    display: flex; justify-content: space-between; align-items: flex-end;
    margin-top: 1rem; border-top: 2px solid black; padding-top: 1rem;
}
.qr-placeholder i { font-size: 3rem; }
.service-type { font-size: 1.2rem; font-weight: bold; }

/* Flex Form */
.flex-form {
    display: flex; gap: 10px; margin-bottom: 1.5rem;
}

/* Driver List */
.list-group { list-style: none; }
.list-group li {
    padding: 1rem;
    background: var(--bg-dark);
    margin-bottom: 0.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border);
}
.list-group li i { color: var(--accent); }

/* Driver App Packages */
.packages-list {
    display: flex; flex-direction: column; gap: 1rem;
}
.package-card {
    background: var(--bg-panel);
    border-left: 4px solid var(--warning);
    padding: 1.5rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}
.package-card.delivered {
    border-left-color: var(--accent);
    opacity: 0.7;
}
.pkg-info h3 { margin-bottom: 5px; }
.pkg-info p { font-size: 0.9rem; margin-bottom: 2px;}
.pkg-actions select {
    width: auto;
    background: var(--bg-dark);
    border-color: var(--border);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

.slide-up {
    animation: fadeIn 0.5s ease forwards;
}
.delay-1 { animation-delay: 0.1s; opacity: 0; }

/* Responsive */
@media (max-width: 900px) {
    .app-container {
        flex-direction: column !important;
    }
    .cards-grid, .admin-grid { grid-template-columns: 1fr; }
    .sidebar { 
        width: 100% !important; 
        height: auto !important; 
        position: relative !important; 
        padding: 0.75rem 1rem !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border) !important;
        overflow-y: visible !important;
        background-color: var(--bg-panel) !important;
        display: flex !important;
    }
    .sidebar-brand {
        display: flex !important;
        width: 100% !important;
        justify-content: space-between !important;
        align-items: center !important;
    }
    .logo-img {
        height: 38px !important;
        width: auto !important;
        margin: 0 !important;
    }
    .sidebar-brand span { display: none; }
    .nav-links { display: none; } /* Hide main nav links, use bottom nav instead */
    .sidebar-footer { display: none; }
    .content { 
        margin-left: 0 !important; 
        padding: 0 !important; 
        max-width: 100% !important;
    }
    .view {
        padding: 1.25rem 1rem 5rem 1rem !important;
        box-sizing: border-box !important;
    }
    
    .view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .header-stats {
        width: 100%;
    }
    
    .stat-box {
        flex: 1;
    }
}

@media (max-width: 600px) {
    .sidebar {
        padding: 0.5rem 1rem;
    }
    .logo-icon {
        width: 32px;
        height: 32px;
        font-size: 1.2rem;
    }
    h1 { font-size: 1.5rem; }
    .card { padding: 1rem; }
    
    .table-container table {
        font-size: 0.85rem;
    }
    
    .btn { padding: 0.6rem 1rem; font-size: 0.9rem; }
}

/* Mobile Logout Button */
.mobile-only-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
}

@media (max-width: 900px) {
    .mobile-only-btn {
        display: block;
    }
}

.mobile-only-btn:hover {
    color: var(--danger);
}
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg-panel);
    border-top: 1px solid var(--border);
    z-index: 1000;
    padding: 0.5rem 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

@media (max-width: 900px) {
    .mobile-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
    }
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    padding: 0.5rem;
    flex: 1;
}

.mobile-nav-item i {
    font-size: 1.4rem;
}

.mobile-nav-item.active {
    color: var(--primary);
}

.mobile-nav-item.active i {
    transform: translateY(-2px);
}

/* Fix for overlapping map and nav */
#driver-map-container, #routing-map-container, #driver-collections-map-container {
    z-index: 1;
}

/* GPS Pulsating Dot for Driver Location */
.gps-marker-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.gps-pulsating-dot {
    position: relative;
    width: 14px;
    height: 14px;
    background-color: var(--primary);
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.8);
}

.gps-pulsating-dot::after {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    opacity: 0;
    animation: gps-pulse 2s infinite;
    box-sizing: border-box;
}

@keyframes gps-pulse {
    0% {
        transform: scale(0.6);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

/* Premium Live Driver Car Marker */
.driver-car-marker-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.driver-car-marker-pin {
    width: 32px;
    height: 32px;
    background-color: var(--primary);
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25), 0 0 12px rgba(14, 165, 233, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    position: relative;
    transition: background-color var(--transition);
}

.driver-car-marker-pin::after {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    opacity: 0;
    animation: gps-pulse 2s infinite;
    box-sizing: border-box;
}

/* ==========================================
   NUEVOS ESTILOS: PROCESO (CLASIFICACIÓN)
   ========================================== */

/* Switch para Alertas de Audio */
.switch input:checked + .slider {
    background-color: var(--primary);
}
.switch input:checked + .slider:before {
    transform: translateX(20px);
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Diseños del Resolvedor Dinámico */
.process-neutral-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Tarjeta de Ruta Encontrada (Éxito) */
.process-route-card {
    width: 100%;
    background: #fff;
    border-radius: var(--radius);
    border-left: 6px solid var(--primary);
    box-shadow: 0 10px 25px -5px rgba(14, 165, 233, 0.08), 0 8px 10px -6px rgba(14, 165, 233, 0.05);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    animation: slideUp 0.3s ease;
    border-top: 1px solid rgba(14, 165, 233, 0.1);
    border-right: 1px solid rgba(14, 165, 233, 0.1);
    border-bottom: 1px solid rgba(14, 165, 233, 0.1);
}

.route-header {
    display: flex;
    align-items: center;
    gap: 15px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    padding: 1rem 1.25rem;
    border-radius: 12px;
    border: 1px solid rgba(14, 165, 233, 0.15);
}

.route-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background-color: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
}

.route-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.route-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary);
}

.route-driver-name {
    font-size: 1.4rem;
    font-weight: 800;
    color: #0369a1;
    margin: 0;
}

.route-driver-plate {
    font-size: 0.85rem;
    font-weight: 600;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 5px;
}

.route-details {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 0.25rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 8px;
    background-color: #f8fafc;
    border: 1px solid #f1f5f9;
    font-size: 0.95rem;
}

.detail-row strong {
    color: var(--text-muted);
    font-weight: 600;
}

.detail-row span {
    color: var(--text-main);
    font-weight: 700;
}

.detail-row .product-tag {
    background-color: rgba(234, 179, 8, 0.12);
    color: #854d0e;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.9rem;
    border: 1px solid rgba(234, 179, 8, 0.2);
}

/* Alertas de Advertencia y Error */
.process-alert {
    width: 100%;
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    animation: slideUp 0.3s ease;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.05);
}

.process-alert.alert-warning {
    background-color: #fffbeb;
    border: 1px solid #fde68a;
    border-left: 6px solid var(--accent);
}

.process-alert.alert-warning .alert-icon {
    color: var(--accent);
    font-size: 2.2rem;
}

.process-alert.alert-warning h3 {
    color: #92400e;
    margin: 0 0 5px 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.process-alert.alert-warning p {
    color: #b45309;
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.4;
}

.process-alert.alert-error {
    background-color: #fff5f5;
    border: 1px solid #fee2e2;
    border-left: 6px solid var(--danger);
    animation: shake 0.4s ease;
}

.process-alert.alert-error .alert-icon {
    color: var(--danger);
    font-size: 2.2rem;
}

.process-alert.alert-error h3 {
    color: #991b1b;
    margin: 0 0 5px 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.process-alert.alert-error p {
    color: #b91c1c;
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.4;
}

/* Animación de vibración (shake) para Errores */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

/* Historial de Escaneo y Filas */
#process-history-table tbody tr {
    transition: background-color var(--transition);
}

.scan-history-row {
    animation: highlightRow 1.2s ease-out;
}

@keyframes highlightRow {
    0% { background-color: rgba(14, 165, 233, 0.12); }
    100% { background-color: transparent; }
}

@media (max-width: 992px) {
    .process-grid-layout {
        grid-template-columns: 1fr !important;
    }
}

/* Tooltip especial para número de parada en Leaflet */
.stop-number-tooltip {
    background: var(--accent) !important;
    border: 2px solid white !important;
    color: var(--text-main) !important;
    font-weight: 700 !important;
    font-size: 0.75rem !important;
    border-radius: 50% !important;
    width: 20px !important;
    height: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3) !important;
    padding: 0 !important;
}

/* ==========================================
   MOBILE DRIVER VIEW REDESIGN (BOTTOM SHEET)
   ========================================== */
@media (max-width: 900px) {
    /* Ocultar encabezados redundantes para maximizar mapa */
    #driver-view .view-header.driver-header {
        display: none !important;
    }
    #driver-route-container .route-header {
        display: flex !important;
        position: absolute;
        top: 72px;
        left: 12px;
        right: 12px;
        z-index: 1010;
        pointer-events: none;
        background: transparent !important;
        border: none !important;
        margin: 0 !important;
        padding: 0 !important;
        justify-content: flex-end !important;
    }
    #driver-route-container .route-header .route-title {
        display: none !important;
    }
    #driver-route-container .route-header div {
        display: flex !important;
        align-items: center;
        gap: 10px;
        pointer-events: none;
    }
    #btn-start-route {
        pointer-events: auto !important;
        box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4) !important;
        border-radius: 12px !important;
        padding: 10px 16px !important;
        font-weight: 700 !important;
        border: none !important;
        transition: all 0.2s ease;
    }
    #btn-start-route:active {
        transform: scale(0.95);
    }

    #driver-view {
        padding: 0 !important;
        margin: 0 !important;
        height: calc(100vh - 115px) !important; /* menos encabezado y barra navegacion */
        position: relative;
        overflow: hidden;
    }

    #driver-del-interface {
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        display: flex;
        flex-direction: column;
    }

    #driver-route-container {
        height: 100% !important;
        display: flex;
        flex-direction: column;
        position: relative;
    }

    /* Controles de Vista flotando sobre el mapa de forma elegante */
    #driver-route-container .view-toggles {
        position: absolute;
        top: 12px;
        left: 12px;
        right: 12px;
        z-index: 1010;
        margin-bottom: 0 !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.15);
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        padding: 4px;
        display: flex !important;
        gap: 6px !important;
        border: 1px solid rgba(255,255,255,0.5);
    }

    #driver-route-container .view-toggles .btn {
        flex: 1;
        padding: 10px 14px !important;
        font-size: 0.85rem !important;
        font-weight: 600 !important;
        border-radius: 8px !important;
        margin: 0 !important;
        border: none !important;
        height: auto !important;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        transition: all 0.2s ease;
    }

    #driver-map-container {
        display: block !important; /* Siempre visible de fondo */
        width: 100% !important;
        height: 100% !important;
        position: absolute !important;
        top: 0;
        left: 0;
        border: none !important;
        border-radius: 0 !important;
        z-index: 1 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    #driver-map {
        height: 100% !important;
        width: 100% !important;
    }

    /* Ubicar el boton de centrar ubicacion arriba de la bottom sheet colapsada */
    #btn-center-user-location {
        bottom: 160px !important;
        right: 12px !important;
        z-index: 1010 !important;
        background: #ffffff !important;
        color: #333333 !important;
        border: 1px solid rgba(0,0,0,0.1) !important;
        box-shadow: 0 4px 10px rgba(0,0,0,0.15) !important;
        padding: 10px 14px !important;
        border-radius: 8px !important;
        font-size: 0.85rem !important;
        font-weight: 600 !important;
    }

    /* HOJA DESLIZABLE (BOTTOM SHEET) */
    #driver-packages-list {
        display: flex !important; /* Siempre visible */
        position: fixed !important;
        bottom: 55px; /* justo sobre el mobile-nav */
        left: 0;
        right: 0;
        height: 60vh !important;
        background: var(--bg-panel) !important;
        border-radius: 24px 24px 0 0 !important;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.18) !important;
        z-index: 1005 !important;
        padding: 0.75rem 1rem 2rem 1rem !important;
        overflow-y: auto !important;
        flex-direction: column !important;
        gap: 12px !important;
        transform: translateY(calc(100% - 90px)); /* Colapsado (Peek) */
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
        border-top: 1px solid var(--border) !important;
    }

    #driver-packages-list.expanded {
        transform: translateY(0) !important;
    }

    /* Indicador tactil (Handle) para deslizar */
    #driver-packages-list::before {
        content: '';
        display: block;
        width: 48px;
        height: 5px;
        background: #cbd5e1;
        border-radius: 3px;
        margin: 0 auto 0.75rem auto;
        flex-shrink: 0;
        cursor: pointer;
        transition: background 0.2s;
    }
    
    #driver-packages-list:active::before {
        background: #94a3b8;
    }

    /* Contenedor vacio en mobile - oculto siempre (el mapa es el fondo) */
    #driver-empty-state {
        display: none !important;
    }

    /* Tarjetas de paquetes rediseñadas para bottom-sheet */
    #driver-packages-list .package-card {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 1.25rem !important;
        border-radius: 14px !important;
        background: var(--surface) !important;
        border: 1px solid var(--border) !important;
        border-left: 6px solid var(--primary) !important;
        box-shadow: 0 4px 10px rgba(0,0,0,0.02) !important;
        margin: 0 !important;
        gap: 12px !important;
        transition: all 0.2s ease !important;
    }

    #driver-packages-list .package-card:active {
        transform: scale(0.99);
        background: var(--bg-color) !important;
    }

    #driver-packages-list .package-card.delivered {
        border-left-color: var(--accent) !important;
        opacity: 0.8 !important;
        background: var(--bg-color) !important;
    }

    #driver-packages-list .package-card .pkg-info h3 {
        font-size: 1.05rem !important;
        font-weight: 600 !important;
        color: var(--text-main) !important;
        margin-bottom: 6px !important;
    }

    #driver-packages-list .package-card .pkg-info p {
        font-size: 0.88rem !important;
        color: var(--text-muted) !important;
        margin-top: 5px !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
    }

    #driver-packages-list .package-card .pkg-info p i {
        font-size: 1.1rem !important;
        color: var(--primary) !important;
        width: 16px;
        text-align: center;
    }

    #driver-packages-list .package-card .pkg-actions {
        margin-top: 10px !important;
        border-top: 1px dashed var(--border) !important;
        padding-top: 10px !important;
    }

    /* Botones grandes y tactiles de accion */
    #driver-packages-list .package-card .btn,
    .leaflet-popup-content .btn {
        padding: 12px 16px !important;
        font-size: 0.9rem !important;
        font-weight: 600 !important;
        border-radius: 10px !important;
        min-height: 46px !important; /* Area de contacto optima */
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
    }

    /* Estilización premium de Leaflet Popups en Móviles */
    .leaflet-popup-content-wrapper {
        border-radius: 16px !important;
        box-shadow: 0 10px 25px rgba(0,0,0,0.15) !important;
        border: 1px solid var(--border) !important;
        background: var(--bg-panel) !important;
        color: var(--text-main) !important;
    }
    .leaflet-popup-tip {
        background: var(--bg-panel) !important;
    }
    .leaflet-popup-content {
        margin: 14px 16px !important;
        font-family: 'Outfit', sans-serif !important;
    }
    .leaflet-popup-content strong {
        font-size: 1.1rem !important;
        color: var(--text-main) !important;
    }
    .leaflet-popup-content .btn {
        margin-top: 4px !important;
        width: 100% !important;
    }
}

/* Route Planning Legend & Switches */
.planning-legend-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.planning-legend-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08) !important;
    border-color: rgba(14, 165, 233, 0.3) !important;
}

.planning-legend-item .switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    flex-shrink: 0;
}

.planning-legend-item .switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.planning-legend-item .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 34px;
}

.planning-legend-item .slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.planning-legend-item .switch input:checked + .slider:before {
    transform: translateX(20px);
}



