@import url('design-tokens.css');
/* Importar Inter (Google font similar a SF Pro de Apple) */
@import url('../vendor/inter/inter.css');

:root {
    /* Paleta base estilizada Apple */
    --apple-bg: #f5f5f7;
    --apple-text-dark: #1d1d1f;
    --apple-text-muted: #86868b;
    --accent-color: #FF6600; /* Naranja corporativo GasFlow */
    --butane-orange: #FF6600; /* Naranja Butano corporativo */
    --border-color: rgba(0, 0, 0, 0.08);
    
    /* Superficies */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: 1px solid rgba(255, 255, 255, 0.5);
    
    /* Variables de estructura */
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
    --bezier: cubic-bezier(0.25, 1, 0.5, 1);
    --transition-fast: 0.2s var(--bezier);
    --transition-base: 0.4s var(--bezier);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

/* --- Global Premium Scrollbar (Mac Style) --- */
::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 4px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--apple-bg);
    color: var(--apple-text-dark);
    -webkit-font-smoothing: antialiased;
    overflow: hidden; /* Prevent body scroll, container will handle it */
    background: linear-gradient(135deg, #f5f5f7 0%, #e8e8ed 100%);
    height: 100vh;
}

/* Tipografía */
h1 { font-weight: 700; font-size: 1.75rem; letter-spacing: -0.02em; }
h2 { font-weight: 700; font-size: 2rem; letter-spacing: -0.03em; margin: 8px 0; }
h3 { font-weight: 600; font-size: 1rem; color: var(--apple-text-muted); }
p { font-size: 0.95rem; line-height: 1.5; color: var(--apple-text-muted); }

/* --- Utilidades --- */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(25px) saturate(200%);
    -webkit-backdrop-filter: blur(25px) saturate(200%);
    border: var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--elevation-glass);
}

/* --- New Blueprint Components --- */

.macos-glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-xl);
    box-shadow: var(--elevation-3);
    padding: 24px;
    transition: var(--transition-smooth);
}

.macos-glass-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 30px 60px rgba(0,0,0,0.1);
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    grid-auto-rows: minmax(180px, auto);
    gap: 20px;
}

.btn-apple-primary {
    background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 4px 12px var(--color-primary-soft);
    transition: var(--transition-fast);
    border: none;
    cursor: pointer;
}

.btn-apple-primary:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 16px rgba(255, 102, 0, 0.3);
}

.btn-apple-primary:active {
    transform: scale(0.98);
}

/* Animations */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s var(--bezier), transform 0.8s var(--bezier);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.stagger-1 { transition-delay: 0.1s; }
.stagger-2 { transition-delay: 0.2s; }
.stagger-3 { transition-delay: 0.3s; }
.stagger-4 { transition-delay: 0.4s; }

/* Ambient Glow */
.ambient-glow {
    position: relative;
    overflow: hidden;
}

.ambient-glow::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--glow-color, rgba(255, 102, 0, 0.1)) 0%, transparent 70%);
    opacity: 0.5;
    z-index: -1;
    pointer-events: none;
}

.glow-comunicaciones { --glow-color: rgba(0, 122, 255, 0.15); }
.glow-pedidos { --glow-color: rgba(255, 102, 0, 0.15); }
.glow-flota { --glow-color: rgba(52, 199, 89, 0.15); }

.hover-scale {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.hover-scale:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

/* --- Layout --- */
.app-container {
    display: flex;
    height: 100vh;
    padding: 16px;
    gap: 16px;
}

/* --- Sidebar --- */
.sidebar {
    width: 260px;
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    height: 100%;
}

.sidebar-header {
    margin-bottom: 40px;
    padding: 0 12px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.logo i { font-size: 1.5rem; }

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
    overflow-y: auto;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.sidebar-nav::-webkit-scrollbar {
    display: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--apple-text-muted);
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.nav-item i {
    font-size: 1.25rem;
    transition: transform var(--transition-fast);
}

.nav-item:hover {
    color: var(--apple-text-dark);
    background: rgba(0, 0, 0, 0.04);
}
.nav-item:hover i {
    transform: scale(1.1);
}

.nav-item.active {
    color: var(--accent-color);
    background: rgba(255, 102, 0, 0.1);
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 16px;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}
.user-profile:hover { background: rgba(0, 0, 0, 0.04); }
.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}
.user-info { display: flex; flex-direction: column; }
.user-info strong { font-size: 0.9rem; }
.user-info span { font-size: 0.8rem; color: var(--apple-text-muted); }

/* --- Main Content --- */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    padding-bottom: 40px; /* Spacing at the bottom */
}
/* Estilo de barra de scroll Apple */


/* Top Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    margin: 0 16px;
    border-radius: var(--radius-lg);
    z-index: 1000;
    position: sticky;
    top: 0;
    background: rgba(255,255,255,0.8) !important;
    backdrop-filter: blur(25px) saturate(200%);
}
.header-actions {
    display: flex;
    gap: 12px;
}

/* Botones */
button {
    font-family: inherit;
    border: none;
    cursor: pointer;
    outline: none;
}
.primary-button {
    background: var(--accent-color);
    color: white;
    padding: 10px 20px;
    border-radius: 20px; /* Pill shape */
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast);
}
.primary-button:hover {
    background: #e65c00;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 102, 0, 0.3);
}
.primary-button:active { transform: translateY(1px) scale(0.98); }

/* --- ZENMAP ENGINE v4.3 - PERFECT ALIGNMENT --- */
.zen-map-wrapper {
    position: relative;
    width: 100%;
    height: 600px; /* Fixed height for dashboard view */
    border-radius: 32px;
    overflow: hidden;
    background: #f5f5f7;
    box-shadow: 0 40px 100px rgba(0,0,0,0.12);
    border: 1px solid rgba(0,0,0,0.08);
    margin-bottom: 24px;
}

#ops-map {
    width: 100% !important;
    height: 100% !important;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    outline: none;
}

.zen-map-sidebar.ultra-premium {
    position: absolute;
    top: 24px;
    left: 24px;
    width: 320px;
    z-index: 1000;
    padding: 24px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(40px) saturate(210%);
    -webkit-backdrop-filter: blur(40px) saturate(210%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 28px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.15);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.zen-map-sidebar.collapsed {
    width: 140px;
    padding: 16px;
    backdrop-filter: blur(20px) saturate(180%);
}

/* --- ZENMAP ENGINE v4.5 - COLOR HARMONY --- */
.repsol-marker-target .target-box { background: #007AFF; color: white; border-radius: 8px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(0, 122, 255, 0.4); }
.repsol-marker-station .station-dot { background: #FF9500; width: 12px; height: 12px; border-radius: 50%; border: 2px solid white; box-shadow: 0 0 10px rgba(255, 149, 0, 0.5); }
.repsol-marker-agency .marker-inner-glow { background: #FF3B30; width: 100%; height: 100%; border-radius: 50%; border: 2px solid white; box-shadow: 0 0 15px rgba(255, 59, 48, 0.6); }
.repsol-marker-base .base-diamond { background: #AF52DE; width: 14px; height: 14px; transform: rotate(45deg); border: 2px solid white; box-shadow: 0 0 12px rgba(175, 82, 222, 0.5); }

/* --- ZENMAP ENGINE v4.6 - NIGHT MODE OVERRIDES --- */
body.night-mode .repsol-marker-target .target-box { background: #007AFF !important; box-shadow: 0 0 25px #007AFF; border: 1px solid rgba(255,255,255,0.4); }
body.night-mode .repsol-marker-station .station-dot { background: #FF9500 !important; box-shadow: 0 0 20px #FF9500; border: 2px solid white; }
body.night-mode .repsol-marker-agency .marker-inner-glow { background: #FF3B30 !important; box-shadow: 0 0 25px #FF3B30; border: 2px solid white; }
body.night-mode .repsol-marker-base .base-diamond { background: #AF52DE !important; box-shadow: 0 0 20px #AF52DE; border: 2px solid white; }
body.night-mode .leaflet-tile-pane { 
    filter: invert(100%) hue-rotate(180deg) brightness(1.15) contrast(1.2); 
} /* Mapa oscuro de alto contraste con textos en blanco puro */

/* Botones de Alto Contraste (Ficha Técnica vs Agendar) */
.btn-tech-sheet {
    background: #007aff; /* Azul Apple */
    color: white;
    padding: 8px 14px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 122, 255, 0.3);
}
.btn-tech-sheet:hover {
    background: #0062cc;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 122, 255, 0.4);
}

.btn-schedule-tech {
    background: #ff9500; /* Naranja Apple / Butano */
    color: white;
    padding: 8px 14px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(255, 149, 0, 0.3);
}
.btn-schedule-tech:hover {
    background: #e68600;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 149, 0, 0.4);
}

.btn-apple-secondary.small {
    padding: 6px 12px;
    font-size: 0.8rem;
    background: rgba(0,0,0,0.05);
    border-radius: 10px;
}

.icon-button {
    background: white;
    color: var(--apple-text-dark);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.icon-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Dashboard Views */
.view-section {
    display: none;
    flex-direction: column;
    padding: 16px 24px;
    min-height: min-content; /* Allow content to dictate height */
}
.view-section.active { display: flex; }

.dashboard-main {
    flex: 1;
    background: #f5f5f7;
    overflow-y: auto;
    position: relative;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.metric-card {
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    cursor: pointer;
}
.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.metric-details { display: flex; flex-direction: column; }
.trend { font-size: 0.85rem; display: flex; align-items: center; gap: 4px; font-weight: 500;}
.trend.positive { color: #34c759; }
.trend.negative { color: #ff3b30; }
.trend.neutral { color: var(--apple-text-muted); }

/* Table Widget */
.widget { padding: 24px; }
.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.text-button {
    background: none;
    color: var(--accent-color);
    font-weight: 500;
    transition: opacity var(--transition-fast);
}
.text-button:hover { opacity: 0.7; }

/* Tabla estilo Apple */
.table-container {
    overflow-x: auto;
}
.apple-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}
.apple-table th {
    padding: 12px 16px;
    color: var(--apple-text-muted);
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}
.apple-table td {
    padding: 16px;
    font-size: 0.95rem;
    font-weight: 500;
    border-bottom: 1px solid rgba(0,0,0,0.02);
}
.hover-row { transition: background var(--transition-fast); }
.hover-row:hover { background: rgba(0,0,0,0.02); }

.status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}
.badge-pending { background: rgba(255, 149, 0, 0.1); color: #ff9500; }
.badge-success { background: rgba(52, 199, 89, 0.1); color: #34c759; }
.badge-neutral { background: rgba(142, 142, 147, 0.1); color: #8e8e93; }

.icon-button.small {
    width: 32px; height: 32px; font-size: 1rem;
}

/* --- Common View Header --- */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

/* Buscador estilo Spotlight */
.apple-search {
    padding: 10px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--apple-text-dark);
    outline: none;
    transition: all var(--transition-fast);
    width: 250px;
}
.apple-search:focus {
    width: 300px;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.2);
}

/* --- ZenMap: Torre de Control Estilo Apple --- */
.zen-map-wrapper {
    display: block;
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 600px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--elevation-3);
    border: 1px solid rgba(0,0,0,0.05);
}

#ops-map {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 550px !important;
    z-index: 1;
    background: #f5f5f7;
    border-radius: var(--radius-lg);
}

.zen-map-sidebar.ultra-premium {
    position: absolute;
    top: 24px;
    left: 24px;
    width: 290px;
    max-height: calc(100% - 48px);
    z-index: 1000;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(30px) saturate(210%);
    -webkit-backdrop-filter: blur(30px) saturate(210%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 28px;
    padding: 20px;
    box-shadow: 0 40px 80px rgba(0,0,0,0.12);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
    overflow-x: hidden;
}



.zen-map-sidebar.ultra-premium.collapsed {
    width: 160px;
    padding: 16px;
    backdrop-filter: blur(20px) saturate(180%);
}

.map-chip {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(0,0,0,0.05);
    background: rgba(255,255,255,0.7);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.map-chip.active {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 4px 15px var(--color-primary-soft);
}

/* --- UI Apple Switches --- */
.ios-layer-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.ios-layer-text {
    font-size: 0.85rem;
    font-weight: 700;
    transition: transform 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
}
.ios-layer-row:hover .ios-layer-text {
    transform: translateX(4px);
}

/* iOS Switch Controls */
.ios-switch-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid rgba(0,0,0,0.05);
    margin-bottom: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}
.ios-switch-label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--apple-text-dark);
}
.ios-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
}
.ios-switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #e9e9ea;
    transition: .3s;
    border-radius: 34px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 22px; width: 22px;
    left: 2px; bottom: 2px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.ios-switch input:checked + .slider { background-color: #34c759; }
.ios-switch input:checked + .slider:before { transform: translateX(20px); }

.status-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #ffffff;
    border-radius: 14px;
    margin-top: 15px;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

/* Markers Stylized v3.1 */
.repsol-marker-agency {
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-inner-glow {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 15px rgba(255, 102, 0, 0.8), inset 0 0 10px rgba(255,255,255,0.5);
    background: linear-gradient(135deg, #FF6600 0%, #FF3300 100%);
}

.station-box {
    background: linear-gradient(135deg, #FF9500 0%, #E68600 100%);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(255,149,0,0.5);
    border: 2px solid white;
    font-size: 16px;
}

.station-dot {
    background: #FF9500;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: 0 0 0 2px white, 0 2px 5px rgba(0,0,0,0.3);
}

.btn-streetview {
    background: white;
    padding: 4px 8px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
}

.target-box {
    background: #1d1d1f;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.2);
    font-size: 18px;
}

/* Fleet Telemetry */
.fleet-truck-marker {
    display: flex;
    align-items: center;
    justify-content: center;
}

.truck-icon {
    background: #1d1d1f;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    border: 2px solid white;
}

.pulse-fleet::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    animation: marker-pulse-fleet 2s infinite;
}

@keyframes marker-pulse-fleet {
    0% { transform: scale(0.8); opacity: 0.8; }
    100% { transform: scale(1.8); opacity: 0; }
}

/* Glow en Modo Noche */
.night-mode .marker-inner-glow {
    box-shadow: 0 0 30px #FF6600, 0 0 60px rgba(255, 102, 0, 0.3);
    border-color: #ff9500;
}

.night-mode .target-box {
    background: #fff !important;
    color: #000 !important;
    box-shadow: 0 0 25px rgba(255,255,255,0.6);
}

/* ZenMap Premium Clusters */
.apple-cluster-marker {
    display: flex;
    align-items: center;
    justify-content: center;
}

.apple-cluster-orange {
    width: 40px;
    height: 40px;
    background: rgba(255, 149, 0, 0.7);
    backdrop-filter: blur(8px) saturate(180%);
    -webkit-backdrop-filter: blur(8px) saturate(180%);
    border: 2px solid white;
    border-radius: 50%;
    color: white;
    font-weight: 800;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(255, 149, 0, 0.4), inset 0 0 10px rgba(255,255,255,0.3);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.apple-cluster-orange:hover {
    transform: scale(1.15);
    background: rgba(255, 149, 0, 0.9);
    box-shadow: 0 12px 30px rgba(255, 149, 0, 0.6);
}

.map-chip {
    padding: 8px 14px;
    border-radius: 12px;
    background: rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.05);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.map-chip.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    box-shadow: 0 4px 10px rgba(255, 102, 0, 0.3);
}

.map-chip:hover:not(.active) {
    background: rgba(0,0,0,0.08);
}

/* Modo Noche: Mapa (Sin Invertir) y Controles Oscuros */
.zen-map-wrapper.night-mode {
    background: #000;
}

.zen-map-wrapper.night-mode .zen-map-sidebar {
    background: rgba(15, 15, 18, 0.75);
    backdrop-filter: blur(30px) saturate(200%);
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.zen-map-wrapper.night-mode .zen-map-sidebar .ios-layer-text {
    color: #ffffff !important;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.zen-map-wrapper.night-mode .zen-map-sidebar .map-layer-control > div:first-child {
    color: #ffffff !important; /* "Inteligencia Comercial" y "Estado Global" puros blancos */
    opacity: 0.9;
}

.zen-map-wrapper.night-mode .map-control-btn {
    background: rgba(40, 40, 45, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.map-control-btn {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0,0,0,0.05);
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    cursor: pointer;
}

.map-control-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* --- ZENMAP ULTRA-PREMIUM: THE BEST MAP EVER --- */

/* Animación de Pulso de Vida */
@keyframes marker-pulse {
    0% { transform: scale(1); opacity: 0.8; box-shadow: 0 0 0 0 rgba(255, 102, 0, 0.7); }
    70% { transform: scale(1.5); opacity: 0; box-shadow: 0 0 0 15px rgba(255, 102, 0, 0); }
    100% { transform: scale(1); opacity: 0; box-shadow: 0 0 0 0 rgba(255, 102, 0, 0); }
}

.pulse-marker {
    position: relative;
}

.pulse-marker::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    background: var(--color-primary);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: marker-pulse 2s infinite;
    pointer-events: none;
    z-index: -1;
}

/* Rutas Animadas (Dash Array Animation) */
.leaflet-ant-path {
    stroke-dasharray: 10, 20;
    animation: ant-path-animation 30s linear infinite;
}

@keyframes ant-path-animation {
    from { stroke-dashoffset: 1000; }
    to { stroke-dashoffset: 0; }
}

/* Panel Bento v2 */
.zen-map-sidebar.ultra-premium {
    width: 320px;
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 30px 60px rgba(0,0,0,0.15), inset 0 0 0 1px rgba(255,255,255,0.5);
}

.network-health-bar {
    height: 6px;
    background: rgba(0,0,0,0.05);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 5px;
}

.health-fill {
    height: 100%;
    background: linear-gradient(90deg, #34c759, #32ade6);
    width: 85%; /* Simulado */
}

/* Tooltips e iOS Cards */
.ios-card-popup {
    min-width: 220px;
    padding: 15px;
}

.ios-card-popup .btn-action {
    margin-top: 12px;
    padding: 10px;
    background: var(--color-primary);
    color: white;
    border-radius: 12px;
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: transform 0.2s;
}

/* Leyenda ZenMap Elite */
.map-legend {
    position: absolute;
    bottom: 30px;
    left: 30px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    padding: 12px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--apple-text-dark);
}

.legend-dot { width: 10px; height: 10px; border-radius: 50%; }

/* Progress Bars en Popups */
.popup-stock-bar {
    height: 8px;
    background: rgba(0,0,0,0.05);
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}

.stock-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6600, #ff3b30);
    transition: width 1s ease-out;
}

/* Forzar GPU */
.leaflet-container {
    transform: translateZ(0);
    will-change: transform;
}

.zen-map-sidebar h3 {
    font-size: 1.1rem;
    color: var(--apple-text-dark);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Estilo Popups iOS Card (Ultra-Premium) */
.leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.75) !important;
    backdrop-filter: blur(25px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(25px) saturate(200%) !important;
    border-radius: 20px !important;
    padding: 0 !important;
    box-shadow: 0 20px 40px rgba(0,0,0,0.12), inset 0 0 0 1px rgba(255,255,255,0.6) !important;
    border: none !important;
}

.leaflet-popup-content {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
    font-size: 0.9rem !important;
    color: #1d1d1f !important;
    line-height: 1.4 !important;
    margin: 14px 18px !important;
}

.leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1) !important;
}

.ios-card-header {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--apple-text-dark);
}

.ios-card-body {
    font-size: 0.85rem;
    color: var(--apple-text-muted);
    line-height: 1.4;
}

.stock-indicator {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    padding: 8px;
    background: rgba(0,0,0,0.03);
    border-radius: 10px;
}

.btn-streetview {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 8px 12px;
    background: #007AFF;
    color: white !important;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    transition: background 0.2s;
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
}
.btn-streetview:hover {
    background: #0056b3;
}

/* Control de Capas Custom */
.map-layer-control {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.layer-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    transition: background 0.2s;
}

.layer-toggle:hover {
    background: rgba(0,0,0,0.03);
}

.layer-toggle input {
    accent-color: var(--color-primary);
}

/* Tabs estilo Apple (Segmented Control) */
/* --- Premium Tabs (Glassmorphism) --- */
.premium-tabs-wrapper {
    display: inline-flex;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 6px;
    border-radius: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
    gap: 5px;
    margin-top: 10px;
}
.premium-tabs-wrapper .tab {
    border: none;
    background: transparent;
    padding: 10px 24px;
    border-radius: 24px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--apple-text-muted);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.premium-tabs-wrapper .tab:hover {
    color: var(--apple-text-dark);
    background: rgba(255, 255, 255, 0.5);
}
.premium-tabs-wrapper .tab.active {
    background: white;
    color: var(--color-primary);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.tabs-apple {
    display: flex;
    background: rgba(118, 118, 128, 0.12);
    padding: 2px;
    border-radius: 8px;
}
.tab {
    padding: 6px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--apple-text-dark);
    border-radius: 6px;
    background: transparent;
    transition: background var(--transition-fast);
}
.tab.active {
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* --- Orders Grid --- */
.orders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}
.order-card {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.order-id { font-size: 0.85rem; color: var(--apple-text-muted); font-weight: 600; }
.order-client { font-size: 1.1rem; font-weight: 600; }
.order-details { display: flex; align-items: center; gap: 8px; font-weight: 500;}
.order-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

/* ========================================================== */
/* ESTILOS DE LANDING PAGE COMERCIAL */
/* ========================================================== */

body.landing-page {
    display: block; /* Override flex */
    height: auto;
    overflow-y: auto;
    background: #ffffff;
}

/* Navbar */
.landing-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5%;
    z-index: 1000;
    border-radius: 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a { text-decoration: none; color: var(--apple-text-dark); font-weight: 500; font-size: 0.95rem; }
.login-link { background: rgba(0,0,0,0.05); padding: 8px 16px; border-radius: 20px; }

/* Global Utilities Landing */
.text-center { text-align: center; }
.section-title { margin-bottom: 40px; }
.section-title h2 { font-size: 2.5rem; letter-spacing: -0.04em; }
.primary-orange { background: var(--butane-orange) !important; box-shadow: 0 8px 24px rgba(255,102,0,0.3) !important; }
.primary-orange:hover { background: #e65c00 !important; transform: translateY(-2px); }

/* Buttons */
.cta-button {
    color: white;
    padding: 14px 28px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-base);
    border: none;
    cursor: pointer;
}
.cta-button.massive { padding: 18px 40px; font-size: 1.25rem; }

/* 1. Hero Section */
.hero-section {
    padding: 160px 5% 80px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
    max-width: 1300px;
    margin: 0 auto;
}
.hero-content h1 { font-size: 3.5rem; line-height: 1.1; margin-bottom: 20px; }
.hero-content p { font-size: 1.2rem; margin-bottom: 30px; max-width: 450px; }
.badge-new {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,102,0,0.1);
    color: var(--butane-orange);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.hero-mockup img {
    width: 100%;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
}
.floating {
    animation: floating 6s ease-in-out infinite;
}
@keyframes floating {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
    100% { transform: translateY(0px); }
}

/* 2. Problem vs Solution Grid */
.problem-solution-section {
    padding: 100px 5%;
    background: var(--apple-bg);
}
.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    max-width: 1100px;
    margin: 0 auto;
}
.comparison-card {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.comparison-card .card-image-wrap { position: relative; height: 300px; }
.comparison-card img { width: 100%; height: 100%; object-fit: cover; }
.overlay-badge {
    position: absolute; top: 16px; left: 16px;
    padding: 8px 16px; border-radius: 20px;
    font-weight: 700; font-size: 0.9rem;
    display: flex; align-items: center; gap: 6px;
    backdrop-filter: blur(10px);
}
.overlay-badge.negative { background: rgba(255,59,48,0.9); color: white; }
.overlay-badge.positive { background: rgba(52,199,89,0.9); color: white; }
.card-text { padding: 30px; }
.active-pulse { box-shadow: 0 0 0 4px rgba(52,199,89,0.2); }

/* 3. Features ZigZag */
.features-section { padding: 100px 5%; max-width: 1200px; margin: 0 auto; }
.feature-zigzag {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
    margin-bottom: 120px;
}
.feature-zigzag.reverse { direction: rtl; }
.feature-zigzag.reverse > * { direction: ltr; }
.feature-icon {
    width: 60px; height: 60px; border-radius: 16px;
    background: rgba(255,102,0,0.1); color: var(--butane-orange);
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; margin-bottom: 20px;
}
.feature-text h2 { font-size: 2.2rem; margin-bottom: 16px; }
.feature-text p { font-size: 1.1rem; margin-bottom: 24px; }
.feature-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.feature-list li { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 1.05rem; }
.feature-list i { color: #34c759; font-size: 1.2rem; }

.feature-visual {
    padding: 40px;
    background: linear-gradient(135deg, rgba(255,255,255,0.8), rgba(245,245,247,0.5));
    display: flex; justify-content: center; align-items: center;
    min-height: 350px;
}

/* Fake Widget UI */
.fake-widget { background: white; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.08); width: 100%; padding: 20px; border: 1px solid rgba(0,0,0,0.05);}
.fw-header { display: flex; justify-content: space-between; border-bottom: 1px solid var(--border-color); padding-bottom: 12px; margin-bottom: 16px; font-weight: 600;}
.fw-body { display: flex; flex-direction: column; gap: 16px;}
.stock-item { display: flex; justify-content: space-between; align-items: center; font-size: 1.1rem; }
.fw-value { font-weight: 700; font-size: 1.4rem; }
.highlight-orange { color: var(--butane-orange); }

/* Fake Whatsapp UI */
.fake-whatsapp { background: #e5ddd5; border-radius: 20px; padding: 20px; width: 100%; max-width: 300px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); }
.wa-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; background: white; padding: 10px; border-radius: 12px;}
.wa-header img { width: 36px; border-radius: 50%; }
.wa-header span { font-weight: 600; }
.wa-bubble { background: #dcf8c6; padding: 12px 16px; border-radius: 16px 16px 16px 0; font-size: 0.95rem; line-height: 1.4; color: #111; position: relative; }
.wa-time { display: block; text-align: right; font-size: 0.75rem; color: rgba(0,0,0,0.4); margin-top: 4px;}

/* Fake Offline UI */
.fake-mobile-offline { background: #1d1d1f; color: white; display: flex; flex-direction: column; align-items: center; padding: 40px; border-radius: 30px; border: 8px solid #333; text-align: center; }
.massive-icon { font-size: 4rem; color: #ff3b30; margin-bottom: 16px; }
.fake-mobile-offline h3 { color: white; font-size: 1.2rem; margin-bottom: 8px;}
.fake-mobile-offline p { color: #86868b; margin-bottom: 24px; }
.sync-loader { background: rgba(255,255,255,0.1); padding: 8px 16px; border-radius: 20px; font-size: 0.85rem; animation: pulse 2s infinite; }

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* 4. Trust Section */
.trust-section { padding: 40px 5%; background: var(--apple-bg); }
.trust-container { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; border-radius: var(--radius-lg); max-width: 1200px; margin: 0 auto; }
.trust-content { padding: 60px; display: flex; flex-direction: column; justify-content: center;}
.logos-strip { display: flex; gap: 20px; margin-top: 30px; flex-wrap: wrap; }
.logo-placeholder { font-weight: 700; color: #aaa; text-transform: uppercase; font-size: 0.9rem; border: 1px solid #ddd; padding: 10px 20px; border-radius: 8px;}
.trust-image img { width: 100%; height: 100%; object-fit: cover; }

/* 5. Final CTA */
.final-cta { padding: 120px 5%; background: #111; color: white; }
.final-cta h2 { font-size: 3rem; margin-bottom: 16px; }
.final-cta p { color: #888; font-size: 1.2rem; margin-bottom: 40px; }
.subtext-cta { margin-top: 20px !important; font-size: 0.95rem !important; }

.landing-footer { text-align: center; padding: 40px; color: var(--apple-text-muted); font-size: 0.9rem; }

/* ========================================================== */
/* ESTILOS DE LOGIN Y SPA */
/* ========================================================== */

/* Ocultar vistas por defecto en SPA */
.spa-view { display: none; }
.spa-view.active-spa-view { display: block; }
#spa-dashboard-view.active-spa-view { display: block; /* app-container will handle flex */ }

/* Para asegurar que las vistas de login se centren 100% tanto en PC como en móvil */
.login-body .spa-view.active-spa-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* Modificadores de body para cada vista */
body.dashboard-body {
    overflow: hidden;
}

body.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, #f5f5f7 0%, #e8e8ed 100%);
    margin: 0;
    overflow: hidden;
}

/* Círculos decorativos desenfocados en el fondo del login */
.bg-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    z-index: 0;
}
.c1 { width: 400px; height: 400px; background: rgba(255, 102, 0, 0.4); top: 10%; left: 10%; }
.c2 { width: 500px; height: 500px; background: rgba(0, 113, 227, 0.3); bottom: -10%; right: -5%; }

.login-card {
    background: var(--glass-bg);
    backdrop-filter: blur(30px) saturate(200%);
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 32px;
    padding: 50px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.08);
    z-index: 10;
    text-align: center;
    animation: slideUp 0.6s var(--bezier) forwards;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-card .logo {
    justify-content: center;
    margin-bottom: 30px;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
    position: relative;
}
.input-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--apple-text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}
.apple-input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: rgba(255,255,255,0.7);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: all var(--transition-fast);
}
.apple-input:focus {
    background: white;
    border-color: var(--butane-orange);
}
select.apple-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff6600' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 18px center;
    background-size: 14px;
    padding: 14px 20px;
    padding-right: 45px;
    cursor: pointer;
    border-radius: 24px !important;
    font-weight: 600;
    color: var(--apple-text-dark);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: none;
    transition: all 0.2s ease;
}

select.apple-input:hover {
    background-color: rgba(255, 255, 255, 0.95);
    transform: translateY(-1px);
    box-shadow: none;
}

select.apple-input:focus {
    border-radius: 24px !important;
    border-color: rgba(0, 0, 0, 0.2);
    box-shadow: none;
}

.apple-input:focus {
    box-shadow: none;
}

/* ★ Date Input Premium Styling ★ */
input[type="date"].apple-input {
    border-radius: 24px !important;
    border: 1px solid rgba(0, 0, 0, 0.1);
    font-weight: 600;
    color: var(--apple-text-dark);
    cursor: pointer;
    padding: 14px 20px;
    transition: all 0.2s ease;
}

input[type="date"].apple-input:hover {
    background-color: rgba(255, 255, 255, 0.95);
    transform: translateY(-1px);
    box-shadow: none;
}

input[type="date"].apple-input:focus {
    border-color: var(--butane-orange);
    box-shadow: none;
}

/* Webkit date picker icon color */
input[type="date"].apple-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    border-radius: 8px;
    padding: 4px;
    transition: background 0.2s;
    filter: none;
    opacity: 0.6;
}

input[type="date"].apple-input::-webkit-calendar-picker-indicator:hover {
    background: rgba(255, 102, 0, 0.1);
    opacity: 1;
}

/* ★ Custom Date Picker Component ★ */
.custom-date-wrap {
    position: relative;
    width: 100%;
}

.custom-date-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: 24px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    font-weight: 600;
    color: var(--apple-text-dark);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none;
    font-family: inherit;
    min-height: 50px;
    box-sizing: border-box;
}

.custom-date-trigger:hover {
    background-color: rgba(255, 255, 255, 0.95);
    transform: translateY(-1px);
    box-shadow: none;
}

.custom-date-trigger.open {
    border-color: rgba(0, 0, 0, 0.2);
    box-shadow: none;
}

.custom-date-trigger.placeholder {
    color: var(--apple-text-muted);
    font-weight: 500;
}

.custom-date-panel {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(30px) saturate(200%);
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0,0,0,0.04);
    z-index: 99999;
    padding: 20px;
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.custom-date-panel.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.cdp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.cdp-month-year {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--apple-text-dark);
    letter-spacing: -0.02em;
}

.cdp-nav {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 102, 0, 0.08);
    color: var(--butane-orange);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.15s ease;
}

.cdp-nav:hover {
    background: rgba(255, 102, 0, 0.18);
    transform: scale(1.1);
}

.cdp-days-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 8px;
}

.cdp-days-header span {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--apple-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 0;
}

.cdp-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cdp-day {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--apple-text-dark);
    cursor: pointer;
    transition: all 0.15s ease;
}

.cdp-day:hover:not(.other) {
    background: rgba(255, 102, 0, 0.1);
    color: var(--butane-orange);
    transform: scale(1.1);
}

.cdp-day.other {
    color: rgba(0,0,0,0.15);
    cursor: default;
    pointer-events: none;
}

.cdp-day.today {
    background: rgba(255, 102, 0, 0.08);
    color: var(--butane-orange);
    font-weight: 700;
}

.cdp-day.selected {
    background: var(--butane-orange) !important;
    color: white !important;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(255, 102, 0, 0.35);
    transform: scale(1.05);
}

.cdp-footer {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.cdp-today-btn, .cdp-clear-btn {
    flex: 1;
    padding: 10px;
    border-radius: 12px;
    border: none;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cdp-today-btn {
    background: var(--butane-orange);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 102, 0, 0.25);
}

.cdp-today-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(255, 102, 0, 0.35);
}

.cdp-clear-btn {
    background: rgba(0,0,0,0.05);
    color: var(--apple-text-muted);
}

.cdp-clear-btn:hover {
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
}

/* ★ Custom Dropdown Component ★ */
.custom-select-wrap {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    padding-right: 45px;
    border-radius: 24px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    font-weight: 600;
    color: var(--apple-text-dark);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff6600' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 18px center;
    background-size: 14px;
    font-family: inherit;
    min-height: 50px;
    box-sizing: border-box;
}

.custom-select-trigger:hover {
    background-color: rgba(255, 255, 255, 0.95);
    transform: translateY(-1px);
    box-shadow: none;
}

.custom-select-trigger.open {
    border-color: rgba(0, 0, 0, 0.2);
    box-shadow: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff6600' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 15 12 9 18 15'%3e%3c/polyline%3e%3c/svg%3e");
}

.custom-select-trigger.placeholder {
    color: var(--apple-text-muted);
    font-weight: 500;
}

.custom-select-dropdown {
    position: absolute;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(30px) saturate(200%);
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0,0,0,0.04);
    z-index: 99999;
    max-height: 280px;
    overflow-y: auto;
    padding: 6px;
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.custom-select-dropdown.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}



.custom-select-option {
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--apple-text-dark);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.custom-select-option:hover {
    background: rgba(255, 102, 0, 0.08);
    color: var(--butane-orange);
}

.custom-select-option.selected {
    background: rgba(255, 102, 0, 0.12);
    color: var(--butane-orange);
    font-weight: 700;
}

.custom-select-option.selected::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--butane-orange);
    flex-shrink: 0;
}

.custom-select-option.create-new {
    color: var(--butane-orange);
    font-weight: 700;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    margin-bottom: 4px;
}

.custom-select-option.create-new::before {
    content: '+';
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 102, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    flex-shrink: 0;
}

.custom-select-group-label {
    padding: 8px 16px 4px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--apple-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.custom-select-search {
    padding: 10px 14px;
    margin: 4px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.08);
    background: rgba(255,255,255,0.8);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    width: calc(100% - 8px);
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.custom-select-search:focus {
    border-color: var(--butane-orange);
}

.login-btn {
    width: 100%;
    background: var(--butane-orange);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 14px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-top: 10px;
    box-shadow: 0 4px 14px rgba(255,102,0,0.3);
}
.login-btn:hover {
    background: #e65c00;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255,102,0,0.4);
}

#error-msg {
    color: #ff3b30;
    font-size: 0.85rem;
    margin-top: 12px;
    min-height: 20px;
    font-weight: 500;
}

.back-link {
    display: inline-block;
    margin-top: 24px;
    color: var(--apple-text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}
.back-link:hover { color: var(--apple-text-dark); }

/* ========================================== */
/* ESTILOS DE MODALES (Glassmorphism) */
/* ========================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none; /* Se activa por JS */
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.modal-card {
    width: 100%;
    max-width: 450px;
    padding: 30px;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.85) !important;
    box-shadow: 0 40px 80px rgba(0,0,0,0.15);
    transform: scale(0.9);
    animation: modalPop 0.4s var(--bezier) forwards;
    
    /* Ocultar barra de scroll nativa para un look más limpio (Apple) */
    -ms-overflow-style: none;
    scrollbar-width: none;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalPop { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.modal-header h2 { font-size: 1.4rem; font-weight: 700; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
}

.apple-input {
    margin-top: 5px;
}

/* ==========================================
   DRIVER APP (MOBILE FIRST STYLES)
   ========================================== */
.driver-app-container {
    background: #f5f5f7; /* Apple background */
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    position: relative;
    display: flex;
    flex-direction: column;
}

#spa-driver-view {
    background: #f5f5f7;
}

.driver-header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.driver-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    transition: transform 0.2s ease, opacity 0.3s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(0,0,0,0.02);
}

.driver-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}

.driver-card.completed {
    transform: scale(0.95);
    opacity: 0.5;
    pointer-events: none;
}

.btn-massive {
    padding: 16px 32px;
    border-radius: 16px;
    border: none;
    background: var(--color-primary);
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.25);
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    min-width: 250px;
}

.btn-massive:active {
    transform: scale(0.97);
    box-shadow: 0 2px 6px rgba(0, 122, 255, 0.2);
}

.btn-sos {
    width: 60px;
    height: 60px;
    border-radius: 30px;
    background: var(--color-danger);
    color: white;
    border: none;
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(255, 59, 48, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ═══════════════════════════════════════════════════════
   ★★★ DASHBOARD CLASSES ★★★
   ═══════════════════════════════════════════════════════ */
.dash-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px;
}
.dash-chart-card {
    padding: 30px;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.05);
    position: relative;
}
.dash-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 16px;
}
.dash-chart-subtitle {
    margin: 0;
    font-size: 0.9rem;
    color: var(--apple-text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.dash-chart-value-row {
    display: flex;
    align-items: baseline;
    gap: 15px;
    margin-top: 5px;
}
.dash-chart-value {
    margin: 0;
    font-size: 2.5rem;
    color: #1d1d1f;
    font-weight: 800;
    letter-spacing: -0.03em;
}
.dash-trend-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    background: rgba(52, 199, 89, 0.1);
    color: #34c759;
}
.dash-period-tabs {
    margin: 0;
    padding: 4px;
    border-radius: 16px;
    flex-shrink: 0;
}
.dash-chart-canvas-wrap {
    position: relative;
    height: 350px;
    width: 100%;
}
.dash-metrics-section {
    margin-top: 50px;
    padding: 40px;
    background: rgba(255,255,255,0.4);
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,0.6);
    backdrop-filter: blur(10px);
}
.dash-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
}
.dash-section-title h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--apple-text-dark);
}
.dash-section-bar {
    width: 4px;
    height: 24px;
    background: var(--color-primary);
    border-radius: 2px;
}
.dash-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    width: 100%;
}
.dash-metrics-grid .metric-details h3 {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-bottom: 4px;
}
.dash-metrics-grid .metric-details h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
}
.dash-metrics-grid .trend {
    font-size: 0.7rem;
    opacity: 0.6;
}
.dash-metrics-grid .trend.positive {
    color: #34c759;
    opacity: 1;
}
.dash-orders-section {
    margin-top: 40px;
}
.dash-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.dash-widget-header h3 {
    margin: 0;
    font-weight: 700;
}
.dash-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.dash-mobile-orders {
    display: none;
}
.dash-show-mobile {
    display: none;
}

/* ═══════════════════════════════════════════════════════
   ★★★ RESPONSIVE — MOBILE & TABLET ★★★
   ═══════════════════════════════════════════════════════ */

/* --- Hamburger Button --- */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--apple-text-dark);
    cursor: pointer;
    padding: 8px;
    border-radius: 12px;
    transition: background 0.2s;
    z-index: 1001;
}
.hamburger-btn:hover {
    background: rgba(0,0,0,0.05);
}

/* --- Mobile Overlay --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ═══════════════════════════════════════════
   TABLET — 768px to 1024px
   ═══════════════════════════════════════════ */
@media (min-width: 769px) and (max-width: 1024px) {
    .app-container {
        padding: 10px;
        gap: 10px;
    }

    .sidebar {
        width: 72px;
        padding: 16px 8px;
        overflow: hidden;
        transition: width 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    }
    .sidebar:hover {
        width: 260px;
    }
    .sidebar .nav-item span,
    .sidebar .sidebar-header span,
    .sidebar .user-info,
    .sidebar .sidebar-footer .nav-item span {
        opacity: 0;
        width: 0;
        overflow: hidden;
        white-space: nowrap;
        transition: opacity 0.2s;
    }
    .sidebar:hover .nav-item span,
    .sidebar:hover .sidebar-header span,
    .sidebar:hover .user-info,
    .sidebar:hover .sidebar-footer .nav-item span,
    .sidebar.mobile-open .nav-item span,
    .sidebar.mobile-open .sidebar-header span,
    .sidebar.mobile-open .user-info,
    .sidebar.mobile-open .sidebar-footer .nav-item span {
        opacity: 1;
        width: auto;
    }

    .sidebar .nav-item {
        justify-content: center;
        padding: 12px;
    }
    .sidebar:hover .nav-item,
    .sidebar.mobile-open .nav-item {
        justify-content: flex-start;
        padding: 12px 16px;
    }
    .sidebar .logo {
        justify-content: center;
    }
    .sidebar:hover .logo,
    .sidebar.mobile-open .logo {
        justify-content: flex-start;
    }

    .top-header {
        margin: 0 8px !important;
    }

    /* Header buttons: hide text */
    .header-actions .btn-apple-primary span {
        display: none;
    }
    .header-actions .btn-apple-primary {
        padding: 10px 14px !important;
    }

    /* Grids: 2 columns */
    .metrics-grid,
    .bento-grid,
    .driver-app-container {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* --- Clients View Layout --- */
.clients-mobile-cards {
    display: none;
}
.clients-table-wrap {
    display: block;
}

/* ═══════════════════════════════════════════
   MOBILE — under 768px
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
    /* --- Kill horizontal scroll globally --- */
    html, body {
        overflow-x: hidden !important;
    }

    /* --- Layout (REAL class is .app-container, NOT .main-container) --- */
    .app-container {
        flex-direction: column;
        padding: 0 !important;
        gap: 0 !important;
        height: 100vh;
        height: 100dvh;
        overflow-x: hidden !important;
    }

    .hamburger-btn {
        display: flex !important;
    }

    /* --- Sidebar: off-canvas overlay --- */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100%;
        height: 100dvh;
        z-index: 9999;
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
        border-radius: 0;
        padding: 24px 16px;
        padding-bottom: calc(24px + env(safe-area-inset-bottom, 20px));
        background: rgba(255,255,255,0.97);
        backdrop-filter: blur(30px);
        box-shadow: 10px 0 40px rgba(0,0,0,0.1);
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }

    /* --- Main Content --- */
    .main-content {
        width: 100%;
        flex-grow: 1;
        padding-bottom: 100px; /* Mucho más espacio para que no corte en móviles */
        gap: 0 !important;
        -ms-overflow-style: none; /* IE and Edge */
        scrollbar-width: none; /* Firefox */
    }
    .main-content::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
    }

    /* --- Top Header: override EVERYTHING from .macos-glass-card --- */
    .top-header.macos-glass-card {
        margin: 0 !important;
        border-radius: 0 !important;
        padding: 14px 16px !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 1000 !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        border: none !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.06) !important;
        background: rgba(255,255,255,0.95) !important;
    }
    .top-header.macos-glass-card:hover {
        transform: none !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.06) !important;
    }

    .top-header .greeting {
        flex: 1;
        min-width: 0;
    }

    .top-header .greeting h1 {
        font-size: 1.1rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .top-header .breadcrumb {
        display: none !important;
    }

    /* Header actions: compact */
    .header-actions {
        gap: 6px !important;
    }
    .header-actions .btn-apple-primary span {
        display: none;
    }
    .header-actions .btn-apple-primary {
        padding: 10px 12px !important;
        min-width: auto;
    }
    .header-actions .btn-apple-primary i {
        margin: 0;
    }

    /* Network status: compact */
    #network-status {
        display: none !important;
    }

    /* Dividers in header: hide */
    .header-actions > div > div[style*="width: 1px"] {
        display: none !important;
    }

    /* --- Dashboard --- */
    .dash-container {
        padding: 12px;
        gap: 16px;
    }
    .dash-chart-card {
        padding: 16px;
        border-radius: 18px;
    }
    .dash-chart-header {
        flex-direction: column;
        gap: 12px;
    }
    .dash-chart-value {
        font-size: 1.8rem;
    }
    .dash-chart-canvas-wrap {
        height: 200px;
    }
    .dash-period-tabs {
        width: 100%;
        display: flex;
        justify-content: space-between;
    }
    .dash-period-tabs .tab {
        flex: 1;
        font-size: 0.65rem !important;
        padding: 6px 4px !important;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .dash-metrics-section {
        margin-top: 20px;
        padding: 16px;
        border-radius: 20px;
    }
    .dash-section-title {
        margin-bottom: 16px;
    }
    .dash-metrics-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .dash-metrics-grid .metric-card {
        align-items: center;
        padding: 20px !important;
        border-radius: 20px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    }
    .dash-metrics-grid .metric-icon {
        width: 54px;
        height: 54px;
        font-size: 1.6rem;
        border-radius: 16px;
    }
    .dash-metrics-grid .metric-details h3 {
        font-size: 0.85rem;
        margin-bottom: 4px;
    }
    .dash-metrics-grid .metric-details h2 {
        font-size: 1.6rem;
        margin-bottom: 2px;
    }
    .dash-orders-section {
        margin-top: 16px;
    }
    
    /* Dashboard Mobile Cards */
    .dash-table-wrap {
        display: none !important;
    }
    .dash-mobile-orders {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    /* Clients Mobile Cards */
    .clients-table-wrap {
        display: none !important;
    }
    .clients-mobile-cards {
        display: flex !important;
        flex-direction: column;
        gap: 12px;
    }
    .mobile-client-card {
        padding: 16px;
        border-radius: 20px;
        display: flex;
        flex-direction: column;
        gap: 12px;
        cursor: pointer;
        background: rgba(255,255,255,0.7);
        border: 1px solid rgba(0,0,0,0.05);
        box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    }
    .mobile-client-card .card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid rgba(0,0,0,0.04);
        padding-bottom: 12px;
    }
    .mobile-client-card .client-name {
        font-weight: 600;
        font-size: 1.1rem;
        display: flex;
        align-items: center;
        gap: 6px;
    }
    .mobile-client-card .card-body {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin-top: 8px;
    }
    .mobile-client-card .info-row {
        display: flex;
        align-items: center;
        gap: 12px;
        font-size: 0.9rem;
        color: var(--apple-text-dark);
    }
    .mobile-client-card .icon-box {
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.3rem;
        flex-shrink: 0;
        background: transparent;
    }
    .mobile-client-card .icon-box.blue {
        color: #007aff;
    }
    .mobile-client-card .icon-box.orange {
        color: #ff9500;
    }
    .mobile-client-card .info-text {
        display: flex;
        flex-direction: column;
    }
    .mobile-client-card .info-label {
        font-size: 0.8rem;
        color: var(--apple-text-dark);
        font-weight: 700;
        margin-bottom: 2px;
    }
    .mobile-client-card .info-text span:not(.info-label) {
        font-size: 0.85rem;
        color: var(--apple-text-muted);
    }
    .mobile-client-card .card-actions {
        display: flex;
        gap: 12px;
        padding-top: 16px;
        border-top: 1px solid rgba(0,0,0,0.06);
        margin-top: 8px;
    }
    .mobile-client-card .card-actions button {
        padding: 12px;
        border-radius: 14px;
        font-weight: 600;
        font-size: 0.9rem;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        transition: transform 0.2s;
    }
    .mobile-client-card .card-actions button:active {
        transform: scale(0.95);
    }
    .mobile-order-card {
        background: rgba(255,255,255,0.7);
        border: 1px solid rgba(0,0,0,0.05);
        border-radius: 20px;
        padding: 16px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.03);
        cursor: pointer;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    .mobile-order-card .mo-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .mobile-order-card .mo-avatar {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: rgba(0, 122, 255, 0.1);
        color: #007aff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
    }
    .mobile-order-card .mo-footer {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-top: 12px;
        border-top: 1px solid rgba(0,0,0,0.04);
    }

    .dash-hide-mobile {
        display: none !important;
    }
    .dash-show-mobile {
        display: block !important;
    }

    /* Tabs: horizontal scroll */
    .premium-tabs-wrapper,
    .tabs-apple {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        white-space: nowrap;
        width: 100%;
    }
    .premium-tabs-wrapper::-webkit-scrollbar,
    .tabs-apple::-webkit-scrollbar {
        display: none;
    }
    .tabs-apple .tab {
        flex-shrink: 0;
        font-size: 0.8rem;
        padding: 8px 14px;
    }

    /* Metric card: compact */
    .metric-card {
        padding: 16px !important;
    }

    /* Table container: horizontal scroll */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .apple-table {
        min-width: 600px;
    }

    /* --- General Views padding --- */
    .view-section {
        padding: 12px !important;
    }

    /* --- All inline grids: force responsive --- */
    /* 3-column fixed grids → 1 column on mobile */
    [style*="grid-template-columns: repeat(3"] {
        grid-template-columns: 1fr !important;
    }

    /* 2-column fixed grids → 1 column on mobile */
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns: repeat(2"] {
        grid-template-columns: 1fr !important;
    }

    /* Auto-fit/fill grids: lower minimums */
    .orders-grid {
        grid-template-columns: 1fr !important;
    }
    .bento-grid {
        grid-template-columns: 1fr !important;
    }

    /* --- Cards & Panels --- */
    .macos-glass-card {
        border-radius: 16px !important;
        padding: 16px !important;
    }

    /* --- Calendar Mobile --- */
    .cal-stats-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }
    #calendar-month-picker-wrapper,
    #dr-month-picker-wrapper {
        justify-content: center !important;
        width: auto !important;
    }
    .cal-grid-wrapper {
        overflow-x: hidden;
        padding: 8px 4px 16px !important;
    }
    .cal-grid-inner {
        min-width: 0 !important; /* Fit screen */
    }
    .cal-grid-inner > div {
        gap: 2px !important; /* Reduce gap between columns */
    }
    .cal-grid-inner .cal-scroll {
        display: flex;
        flex-wrap: wrap;
        gap: 3px;
        justify-content: center;
        padding-right: 0 !important;
    }
    .cal-grid-inner .cal-order-item {
        width: 8px !important;
        height: 8px !important;
        padding: 0 !important;
        border: none !important;
        border-radius: 50% !important;
        color: transparent !important;
        margin-bottom: 0 !important;
    }
    .cal-grid-inner .cal-order-item.status-pending { background: #ff9500 !important; }
    .cal-grid-inner .cal-order-item.status-completed { background: #34c759 !important; }
    .cal-grid-inner .cal-order-icon,
    .cal-grid-inner .cal-order-text {
        display: none !important;
    }
    /* Estilos de las celdas de días en móvil */
    .cal-grid-inner [style*="min-height: 90px"] {
        min-height: 50px !important;
        padding: 4px !important;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    /* --- Global View Header Titles on Mobile (Hidden) --- */
    .view-header h2,
    .view-header > div > h2,
    .view-header p,
    .view-header > div > p {
        display: none !important;
    }

    /* --- Delivery Runs Stats Row --- */
    .view-header[style*="grid-template-columns: 1fr auto 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    /* --- Fleet Section --- */
    #fleet-section {
        padding: 12px !important;
    }

    /* --- Map in Delivery Detail --- */
    .zen-map-wrapper {
        flex-direction: column !important;
        height: auto !important;
    }
    .zen-map-wrapper #ops-map,
    .zen-map-wrapper > div:first-child {
        height: 250px !important;
        min-height: 250px;
    }
    .zen-map-sidebar.ultra-premium {
        width: 100% !important;
        max-height: 300px;
        border-radius: 0 0 20px 20px !important;
    }
    .zen-map-sidebar.collapsed {
        width: 100% !important;
        max-height: 50px;
    }

    /* --- Modals --- */
    .modal-overlay {
        padding: 16px !important;
        align-items: center !important;
    }
    .modal-card {
        max-width: 100% !important;
        width: 100% !important;
        max-height: 85vh !important;
        overflow-y: auto !important;
        border-radius: 24px !important;
        margin: 0 !important;
    }
    .modal-card .input-group {
        margin-bottom: 12px;
    }

    /* --- Custom Select Dropdown --- */
    .custom-select-dropdown {
        max-height: 220px;
    }

    /* --- Custom Date Panel --- */
    .custom-date-panel {
        width: calc(100vw - 20px) !important;
        left: 10px !important;
    }

    /* --- Profile --- */
    #view-profile {
        padding: 12px !important;
    }

    /* --- Buttons: full width in stacked layouts --- */
    .btn-massive {
        font-size: 1rem !important;
        padding: 16px !important;
    }

    /* --- Driver App Container (tech mobile) --- */
    .driver-app-container {
        padding: 10px !important;
    }

    /* --- Font sizes --- */
    h1 { font-size: 1.3rem !important; }
    h2 { font-size: 1.1rem !important; }
    h3 { font-size: 0.95rem !important; }

    /* --- Floating Action Buttons (route detail) --- */
    [style*="position: fixed"][style*="bottom:"] {
        bottom: 16px !important;
        right: 16px !important;
    }

    /* Fix padding on inline-styled divs */
    [style*="padding: 24px"] {
        padding: 12px !important;
    }
    [style*="padding: 30px"] {
        padding: 16px !important;
    }
    [style*="padding: 40px"] {
        padding: 16px !important;
    }

    /* Gap reductions */
    [style*="gap: 30px"] {
        gap: 16px !important;
    }
    [style*="gap: 24px"] {
        gap: 12px !important;
    }

    /* Margin-top reductions */
    [style*="margin-top: 50px"] {
        margin-top: 20px !important;
    }
    [style*="margin-top: 40px"] {
        margin-top: 16px !important;
    }

    /* --- Login Page --- */
    .login-card {
        padding: 30px 20px !important;
        border-radius: 24px;
        margin: 0 12px;
    }
    .login-body {
        padding: 16px;
    }
}

/* ═══════════════════════════════════════════
   SMALL MOBILE — under 400px
   ═══════════════════════════════════════════ */
@media (max-width: 400px) {
    .top-header .greeting h1 {
        font-size: 0.95rem !important;
    }

    .sidebar {
        width: 100%;
    }

    .header-actions .btn-apple-primary {
        padding: 8px 10px !important;
    }

    .tabs-apple .tab {
        font-size: 0.75rem;
        padding: 6px 10px;
    }

    .metric-card h2 {
        font-size: 1.2rem !important;
    }
}

/* --- Minimaps (OpenStreetMap tiles, softened to match the light UI) --- */
.map-tiles-light {
    filter: grayscale(0.85) brightness(1.06) contrast(0.92);
}
.cs-minimap .leaflet-control-attribution,
.os-minimap .leaflet-control-attribution {
    font-size: 9px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 6px 0 0 0;
}

/* --- Modals never show their own scrollbar ---
   Tall modals fit the viewport and scroll invisibly, and the page behind
   does not show its scrollbar while a modal is open. */
.modal-card {
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
}
.modal-card::-webkit-scrollbar { display: none; }
body:has(.modal-overlay) .main-content {
    overflow: hidden !important;
    scrollbar-width: none;
}

/* --- Order payment badge (prepaid / to collect) --- */
.paid-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; white-space: nowrap; }
.paid-badge.paid { background: rgba(52,199,89,0.12); color: #248a3d; }
.paid-badge.unpaid { background: rgba(255,149,0,0.12); color: #c25e00; }
.paid-badge.collected { background: rgba(0,0,0,0.05); color: var(--apple-text-muted); }

/* --- Bottle tiles: commission per bottle type (technician sheet, edit modal, profile) --- */
.bottle-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.bottle-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 10px; background: white; border: 1px solid rgba(0,0,0,0.05); border-radius: 16px; box-shadow: 0 4px 12px rgba(0,0,0,0.03); text-align: center; min-width: 0; }
.bottle-tile-img { height: 44px; display: flex; align-items: flex-end; justify-content: center; }
.bottle-tile-img img { max-height: 44px; width: auto; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.18)); }
.bottle-tile-name { font-size: 0.85rem; font-weight: 700; color: var(--apple-text-dark); line-height: 1.1; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bottle-tile-value { font-size: 1.05rem; font-weight: 800; color: var(--apple-text-dark); letter-spacing: -0.2px; }
.bottle-tile-value.zero { color: var(--apple-text-muted); font-weight: 600; }
.bottle-tile-input { position: relative; width: 100%; }
.bottle-tile-input input { width: 100%; padding: 8px 26px 8px 10px; border-radius: 24px; border: 1px solid rgba(0,0,0,0.1); background: rgba(255,255,255,0.7); text-align: center; font-family: inherit; font-weight: 700; font-size: 0.95rem; color: var(--apple-text-dark); outline: none; transition: border-color var(--transition-fast), background var(--transition-fast); -moz-appearance: textfield; }
.bottle-tile-input input::-webkit-outer-spin-button,
.bottle-tile-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bottle-tile-input input:focus { border-color: var(--butane-orange); background: white; }
.bottle-tile-input span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-weight: 700; color: var(--apple-text-muted); pointer-events: none; font-size: 0.85rem; }
@media (max-width: 420px) { .bottle-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bottle-tile-name small { display: block; margin-top: 2px; font-size: 0.75rem; font-weight: 500; color: var(--apple-text-muted); }

/* --- Commission list (technician sheet, edit modal, profile) ---
   Two-column "price list": coloured dot + bottle name + capacity, amount on the right. */
.comm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }
.comm-item { display: flex; align-items: center; gap: 10px; padding: 11px 2px; border-bottom: 1px solid rgba(0,0,0,0.06); min-width: 0; }
.comm-grid .comm-item:nth-last-child(-n+2) { border-bottom: none; }
.comm-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--butane-orange); }
.comm-name { flex: 1; min-width: 0; font-weight: 600; font-size: 0.92rem; color: var(--apple-text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comm-name small { font-weight: 500; font-size: 0.78rem; color: var(--apple-text-muted); margin-left: 4px; }
.comm-amount { font-weight: 700; font-size: 0.95rem; color: var(--apple-text-dark); font-variant-numeric: tabular-nums; white-space: nowrap; }
.comm-amount.zero { color: var(--apple-text-muted); font-weight: 500; }
/* Inline editable amount: looks like a soft chip, turns into a field on focus */
.comm-input { position: relative; flex-shrink: 0; }
.comm-input input { width: 86px; padding: 7px 24px 7px 8px; border: 1px solid transparent; border-radius: 10px; background: rgba(118,118,128,0.1); text-align: right; font-family: inherit; font-weight: 700; font-size: 0.95rem; color: var(--apple-text-dark); font-variant-numeric: tabular-nums; outline: none; transition: all var(--transition-fast); -moz-appearance: textfield; }
.comm-input input::-webkit-outer-spin-button,
.comm-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.comm-input input:hover { background: rgba(118,118,128,0.16); }
.comm-input input:focus { background: white; border-color: var(--butane-orange); box-shadow: 0 0 0 3px rgba(255,102,0,0.12); }
.comm-input span { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-weight: 600; font-size: 0.85rem; color: var(--apple-text-muted); pointer-events: none; }
@media (max-width: 520px) {
    .comm-grid { grid-template-columns: 1fr; }
    .comm-grid .comm-item:nth-last-child(2) { border-bottom: 1px solid rgba(0,0,0,0.06); }
}
.comm-grid.single { grid-template-columns: 1fr; }
.comm-grid.single .comm-item:nth-last-child(2) { border-bottom: 1px solid rgba(0,0,0,0.06); }
