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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 0;
    margin: 0;
    color: #333;
}

/* Menú Superior */
.main-nav {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.nav-container {
    max-width: 100%;
    margin: 0;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.nav-title {
    font-size: 1.5rem;
    font-weight: 400;
    margin: 0;
    color: #222;
    flex: 1;
    min-width: 200px;
}

.nav-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid transparent;
}

.nav-tab {
    padding: 10px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 0.95rem;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 400;
}

.nav-tab:hover {
    color: #222;
    background: #f5f5f5;
}

.nav-tab.active {
    color: #222;
    border-bottom-color: #333;
    font-weight: 500;
}

.header-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    min-width: 200px;
}

/* Pantallas */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

.screen header {
    margin-bottom: 30px;
    padding-top: 20px;
}

.container {
    max-width: 100%;
    margin: 0;
    padding: 0 20px;
}

/* header ya está definido arriba en .screen header */

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    position: relative;
}

header h1 {
    font-size: 2rem;
    font-weight: 400;
    margin: 0;
    color: #222;
    flex: 1;
}

.header-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.filters {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-empresas {
    position: relative;
    display: inline-block;
}

.btn-empresas {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    background: white;
    color: #333;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-empresas:hover {
    background: #f5f5f5;
}

.dropdown-empresas {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    min-width: 200px;
    max-width: 300px;
    max-height: 400px;
    overflow: hidden;
    flex-direction: column;
}

.dropdown-empresas.show {
    display: flex;
}

.dropdown-search {
    padding: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.dropdown-search input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
}

.dropdown-search input:focus {
    outline: none;
    border-color: #666;
}

.empresas-list {
    flex: 1;
    max-height: 250px;
    overflow-y: auto;
}

.empresas-list .empresa-item {
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.empresas-list .empresa-item:hover {
    background: #f5f5f5;
}

.empresas-list .empresa-item input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.empresas-list .empresa-item label {
    cursor: pointer;
    flex: 1;
    margin: 0;
    font-weight: 400;
}

.empresas-actions {
    margin-top: 8px;
    padding: 8px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-aplicar-empresas,
.btn-limpiar-empresas {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-aplicar-empresas {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.btn-aplicar-empresas:hover {
    background: #45a049;
}

.btn-limpiar-empresas {
    background: white;
    color: #333;
}

.btn-limpiar-empresas:hover {
    background: #f5f5f5;
}

.empresas-selected {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    min-height: 24px;
}

/* Filtro de Almacenes */
.filter-almacenes {
    position: relative;
    display: inline-block;
}


.btn-almacenes {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    background: white;
    color: #333;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-almacenes:hover {
    background: #f5f5f5;
}

.dropdown-almacenes {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    min-width: 200px;
    max-width: 300px;
    max-height: 400px;
    overflow: hidden;
    flex-direction: column;
}

.dropdown-almacenes.show {
    display: flex;
}

.almacenes-list {
    flex: 1;
    max-height: 250px;
    overflow-y: auto;
}

.almacenes-list .almacen-item {
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.almacenes-list .almacen-item:hover {
    background: #f5f5f5;
}

.almacenes-list .almacen-item input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.almacenes-list .almacen-item label {
    cursor: pointer;
    flex: 1;
    margin: 0;
    font-weight: 400;
}

.almacenes-actions {
    margin-top: 8px;
    padding: 8px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-aplicar-almacenes,
.btn-limpiar-almacenes {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-aplicar-almacenes {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.btn-aplicar-almacenes:hover {
    background: #45a049;
}

.btn-limpiar-almacenes {
    background: white;
    color: #333;
}

.btn-limpiar-almacenes:hover {
    background: #f5f5f5;
}

.almacenes-selected {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    min-height: 24px;
}

.almacen-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 12px;
    font-size: 0.75rem;
    color: #333;
}

.almacen-chip .chip-remove {
    cursor: pointer;
    color: #999;
    font-weight: bold;
    line-height: 1;
}

.almacen-chip .chip-remove:hover {
    color: #333;
}

/* Filtro de Ubicaciones */
.filter-ubicaciones {
    position: relative;
    display: inline-block;
}

.btn-ubicaciones {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    background: white;
    color: #333;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-ubicaciones:hover {
    background: #f5f5f5;
}

.dropdown-ubicaciones {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    min-width: 200px;
    max-width: 300px;
    max-height: 400px;
    overflow: hidden;
    flex-direction: column;
}

.dropdown-ubicaciones.show {
    display: flex;
}

.ubicaciones-list {
    flex: 1;
    max-height: 250px;
    overflow-y: auto;
}

.ubicaciones-list .ubicacion-item {
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ubicaciones-list .ubicacion-item:hover {
    background: #f5f5f5;
}

.ubicaciones-list .ubicacion-item input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.ubicaciones-list .ubicacion-item label {
    cursor: pointer;
    flex: 1;
    margin: 0;
    font-weight: 400;
}

.ubicaciones-actions {
    margin-top: 8px;
    padding: 8px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-aplicar-ubicaciones,
.btn-limpiar-ubicaciones {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-aplicar-ubicaciones {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.btn-aplicar-ubicaciones:hover {
    background: #45a049;
}

.btn-limpiar-ubicaciones {
    background: white;
    color: #333;
}

.btn-limpiar-ubicaciones:hover {
    background: #f5f5f5;
}

.ubicaciones-selected {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    min-height: 24px;
}

.ubicacion-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 12px;
    font-size: 0.75rem;
    color: #333;
}

.ubicacion-chip .chip-remove {
    cursor: pointer;
    color: #999;
    font-weight: bold;
    line-height: 1;
}

.ubicacion-chip .chip-remove:hover {
    color: #333;
}

.empresa-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 12px;
    font-size: 0.75rem;
    color: #333;
}

.empresa-chip .chip-remove {
    cursor: pointer;
    color: #999;
    font-weight: bold;
    line-height: 1;
}

.empresa-chip .chip-remove:hover {
    color: #333;
}

/* Filtros Avanzados */
.filter-avanzados {
    position: relative;
    display: inline-block;
}

.btn-filtros-avanzados {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    background: white;
    color: #333;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-filtros-avanzados:hover {
    background: #f5f5f5;
}

.panel-filtros-avanzados {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    padding: 16px;
    min-width: 600px;
    max-width: 900px;
}

.panel-filtros-avanzados.show {
    display: block;
}

.filtros-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.filtro-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filtro-item label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #555;
}

.filtro-dropdown {
    position: relative;
}

.filtro-search {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
}

.filtro-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 2px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1003;
    max-height: 200px;
    overflow-y: auto;
}

.filtro-list.show {
    display: block;
}

.filtro-list-item {
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filtro-list-item:hover {
    background: #f5f5f5;
}

.filtro-list-item input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.filtro-list-item label {
    cursor: pointer;
    flex: 1;
    margin: 0;
    font-weight: 400;
}

.filtro-select-all {
    padding: 8px 12px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 0.85rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.filtro-select-all input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.filtro-select-all label {
    cursor: pointer;
    margin: 0;
    font-weight: 500;
}

.filtros-actions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-aplicar-filtros,
.btn-limpiar-filtros {
    padding: 8px 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-aplicar-filtros {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.btn-aplicar-filtros:hover {
    background: #45a049;
}

.btn-limpiar-filtros {
    background: white;
    color: #333;
}

.btn-limpiar-filtros:hover {
    background: #f5f5f5;
}

.filtro-selected {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 20px;
}

.filtro-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 10px;
    font-size: 0.7rem;
    color: #333;
}

.filtro-chip .chip-remove {
    cursor: pointer;
    color: #999;
    font-weight: bold;
    line-height: 1;
    font-size: 0.75rem;
}

.filtro-chip .chip-remove:hover {
    color: #333;
}

/* Loading Overlay */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    text-align: center;
}

.loading-spinner p {
    margin-top: 20px;
    font-size: 1rem;
}

/* Ocultar filtros avanzados en la pantalla de Inventario */
#screen-inventario .filter-avanzados {
    display: none !important;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4CAF50;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .filtros-grid {
        grid-template-columns: 1fr;
    }
    
    .panel-filtros-avanzados {
        min-width: 300px;
        max-width: 100%;
    }
}

.last-update {
    font-size: 0.85rem;
    color: #666;
    font-weight: 300;
    text-align: right;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
    margin-bottom: 30px;
    align-items: stretch;
}

@media (min-width: 1921px) {
    .kpi-grid {
        gap: 16px;
    }
}

@media (max-width: 1600px) {
    .kpi-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
}

.kpi-card {
    background: white;
    border-radius: 4px;
    padding: 18px;
    border: 1px solid #e0e0e0;
    transition: border-color 0.2s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 380px;
}

.kpi-card:hover {
    border-color: #999;
}

.kpi-card.kpi-total {
    cursor: default;
}

.kpi-total {
    background: #fafafa;
    border-color: #ccc;
}

/* Bloque 1: Estado y Cantidad */
.kpi-header {
    margin-bottom: 8px;
    flex-shrink: 0;
}

.kpi-header h2 {
    font-size: 0.9rem;
    font-weight: 500;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 2.8rem;
    font-weight: 300;
    margin-bottom: 8px;
    color: #222;
    line-height: 1;
    flex-shrink: 0;
}

.kpi-description {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.4;
    min-height: 2.8em;
    margin-bottom: 0;
    padding-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-shrink: 0;
    box-sizing: border-box;
}

/* Separador entre bloques */
.kpi-separator {
    height: 1px;
    background: #e0e0e0;
    margin: 12px 0;
    border: none;
    flex-shrink: 0;
}

/* Bloque 3: Semáforo */
.kpi-semaforo {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 0;
    margin-bottom: 0;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    height: 80px;
    flex-shrink: 0;
    margin-top: auto;
}

.semaforo-luz-sidebar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin: 0 auto;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.semaforo-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 50px;
    position: relative;
    transition: transform 0.2s ease;
}

.semaforo-item:hover {
    transform: scale(1.05);
}

.semaforo-item[style*="cursor: pointer"] {
    cursor: pointer;
}

.semaforo-luz {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), inset 0 2px 4px rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    position: relative;
}

.semaforo-luz::after {
    content: '';
    position: absolute;
    top: 20%;
    left: 20%;
    width: 40%;
    height: 40%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.semaforo-verde .semaforo-luz {
    background: #4CAF50;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.3);
}

.semaforo-naranja .semaforo-luz {
    background: #FF9800;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.3);
}

.semaforo-rojo .semaforo-luz {
    background: #f44336;
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.3);
}

.semaforo-cantidad {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    min-height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.semaforo-item:hover .semaforo-cantidad {
    color: #000;
    font-weight: 700;
}

.semaforo-verde .semaforo-cantidad {
    color: #2e7d32;
}

.semaforo-naranja .semaforo-cantidad {
    color: #f57c00;
}

.semaforo-rojo .semaforo-cantidad {
    color: #c62828;
}

/* Animación de pulso para semáforos activos */
.semaforo-item.semaforo-activo .semaforo-luz {
    animation: semaforoPulse 2s ease-in-out infinite;
}

@keyframes semaforoPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

/* Bloque 2: Subcantidades */
.kpi-subvalue {
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
    font-size: 0.8rem;
    min-height: 3.2em;
    line-height: 1.6;
    display: flex;
    flex-wrap: wrap;
    align-content: center;
    gap: 8px 12px;
    flex-shrink: 0;
    box-sizing: border-box;
}

.kpi-subvalue .sub-label {
    white-space: nowrap;
}

.kpi-subvalue .sub-value {
    white-space: nowrap;
}

.sub-label {
    color: #666;
    font-weight: 400;
}

.sub-value {
    color: #222;
    font-weight: 500;
    margin-left: 6px;
    margin-right: 8px;
}

.loading {
    font-size: 0.9rem;
    color: #999;
    font-weight: 400;
}

/* Animación de carga */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

.kpi-card {
    cursor: pointer;
}

.kpi-card.active {
    border-color: #333;
    background: #fafafa;
}

.tiempos-section {
    margin-top: 40px;
    margin-bottom: 40px;
}

.tiempos-section h2 {
    font-size: 1.3rem;
    font-weight: 400;
    margin-bottom: 24px;
    color: #222;
    text-align: center;
}

.tiempos-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.tiempo-card {
    min-height: auto !important;
    padding: 16px !important;
    cursor: default !important;
}

.tiempo-card .kpi-header {
    margin-bottom: 8px;
}

.tiempo-card .kpi-header h2 {
    font-size: 0.85rem;
    line-height: 1.3;
}

.tiempo-card .kpi-value {
    font-size: 2rem !important;
    margin-bottom: 8px !important;
}

.tiempo-card .kpi-description {
    font-size: 0.75rem !important;
    min-height: auto !important;
    height: auto !important;
    padding: 0 !important;
    margin-bottom: 0 !important;
    line-height: 1.4;
    display: block;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    -webkit-box-orient: unset;
    overflow: visible;
}

.tiempo-card .kpi-separator {
    display: none !important;
}

.tiempo-card .kpi-subvalue {
    display: none !important;
}

.tiempo-card .kpi-semaforo {
    display: none !important;
}

.pedidos-aprobados-section {
    margin-top: 40px;
    margin-bottom: 40px;
    background: white;
    border-radius: 4px;
    padding: 24px;
    border: 1px solid #e0e0e0;
    width: 100%;
    box-sizing: border-box;
}

.pedidos-aprobados-section h2 {
    font-size: 1.3rem;
    font-weight: 400;
    margin-bottom: 20px;
    color: #222;
    text-align: center;
}

.pedidos-aprobados-warning {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    margin-bottom: 20px;
    color: #856404;
}

.pedidos-aprobados-warning .warning-icon {
    font-size: 1.2rem;
}

.pedidos-aprobados-warning .warning-text {
    font-size: 0.95rem;
    font-weight: 500;
}

.chart-container-pedidos {
    position: relative;
    height: 400px;
    width: 100%;
    margin-top: 20px;
    max-width: 100%;
    box-sizing: border-box;
}

.pedidos-aprobados-section .chart-container-pedidos canvas {
    max-width: 100% !important;
    width: 100% !important;
}

.cumplimiento-section {
    margin-top: 40px;
    background: white;
    border-radius: 4px;
    padding: 24px;
    border: 1px solid #e0e0e0;
}

.cumplimiento-section h2 {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 20px;
    color: #222;
}

.cumplimiento-filtros {
    margin-bottom: 24px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-filtro-cumplimiento {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-filtro-cumplimiento:hover {
    background: #f5f5f5;
}

.btn-filtro-cumplimiento.active {
    background: #333;
    color: white;
    border-color: #333;
}

.cumplimiento-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.cumplimiento-grid-row2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-top: 24px;
}

@media (max-width: 1200px) {
    .cumplimiento-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cumplimiento-grid-row2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .cumplimiento-grid,
    .cumplimiento-grid-row2 {
        grid-template-columns: 1fr;
    }
}

.cumplimiento-card {
    text-align: center;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.cumplimiento-card h3 {
    font-size: 1rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.cumplimiento-desc {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 20px;
}

.chart-container {
    position: relative;
    height: 200px;
    margin: 20px 0;
}

.cumplimiento-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.cumplimiento-stats span {
    font-size: 0.9rem;
    color: #666;
}

.cumplimiento-stats .stat-label {
    font-weight: 500;
    color: #333;
}

.cumplimiento-stats .stat-value {
    font-weight: 600;
    color: #222;
}

.resumen-section {
    margin-top: 40px;
    background: white;
    border-radius: 4px;
    padding: 24px;
    border: 1px solid #e0e0e0;
}

.resumen-section h2 {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 20px;
    color: #222;
}

.resumen-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.resumen-tab {
    padding: 10px 20px;
    border: none;
    background: transparent;
    border-bottom: 2px solid transparent;
    font-size: 0.9rem;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.resumen-tab:hover {
    color: #222;
    background: #f5f5f5;
}

.resumen-tab.active {
    color: #222;
    border-bottom-color: #333;
    font-weight: 500;
}

.resumen-content {
    overflow-x: auto;
}

.resumen-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.resumen-table thead {
    background: #f5f5f5;
}

.resumen-table th {
    padding: 12px;
    text-align: left;
    font-weight: 500;
    color: #666;
    border-bottom: 2px solid #e0e0e0;
}

.estados-tiempos-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.estados-tiempos-table thead {
    background: #f5f5f5;
}

.estados-tiempos-table th {
    padding: 12px;
    text-align: left;
    font-weight: 500;
    color: #666;
    border-bottom: 2px solid #e0e0e0;
    white-space: nowrap;
    background: #f5f5f5;
    position: sticky;
    top: 0;
    z-index: 10;
}

.estados-tiempos-table th:not(:first-child) {
    text-align: center;
}

.estados-tiempos-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e0e0e0;
    color: #333;
    text-align: center;
}

.estados-tiempos-table td:first-child {
    text-align: left;
    font-weight: 500;
}

.estado-tiempo-clickable {
    cursor: pointer;
    transition: background-color 0.2s;
}

.estado-tiempo-clickable:hover {
    background-color: #f0f0f0;
}

.estados-tiempos-table tr:hover {
    background: #fafafa;
}

.estados-tiempos-table tbody tr:last-child td {
    border-bottom: 2px solid #e0e0e0;
    font-weight: 600;
}

.resumen-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e0e0e0;
    color: #333;
}

.resumen-table tbody tr:hover {
    background: #f9f9f9;
}

.resumen-table tbody tr.resumen-row-clickable {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.resumen-table tbody tr.resumen-row-clickable:hover {
    background: #e8f5e9;
}

.resumen-table tbody tr.resumen-row-clickable.active {
    background: #c8e6c9;
    font-weight: 500;
}

.resumen-table td .cumplimiento-porcentaje {
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-block;
    margin-right: 5px;
}

.resumen-table td .cumplimiento-detalle {
    font-size: 0.85rem;
    color: #666;
}

.resumen-table td.cumplimiento-alto .cumplimiento-porcentaje {
    color: #4CAF50;
}

.resumen-table td.cumplimiento-medio .cumplimiento-porcentaje {
    color: #FF9800;
}

.resumen-table td.cumplimiento-bajo .cumplimiento-porcentaje {
    color: #f44336;
}

.resumen-table td.loading {
    text-align: center;
    color: #999;
    padding: 20px;
}

.table-section {
    margin-top: 40px;
    background: white;
    border-radius: 4px;
    padding: 24px;
    border: 1px solid #e0e0e0;
}

.table-section h2 {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 16px;
    color: #222;
}

.table-controls {
    margin-bottom: 16px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-filtro {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    background: white;
    color: #333;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-filtro:hover {
    background: #f5f5f5;
}

.btn-filtro.active {
    background: #333;
    color: white;
    border-color: #333;
}

.table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 400px);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

table thead {
    background: #f5f5f5;
}

table th {
    padding: 10px 8px;
    text-align: left;
    font-weight: 500;
    color: #666;
    border-bottom: 2px solid #e0e0e0;
    white-space: nowrap;
    background: #f5f5f5;
    position: sticky;
    top: 0;
    z-index: 10;
}

table td {
    padding: 8px;
    border-bottom: 1px solid #e0e0e0;
    color: #333;
}

table tbody tr:hover {
    background: #f9f9f9;
}

table td.loading {
    text-align: center;
    color: #999;
    padding: 20px;
}

/* Sidebar para pedidos no cumplidos */
.sidebar {
    position: fixed;
    top: 0;
    right: -1000px;
    width: 1000px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
    z-index: 10000;
    transition: right 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar.open {
    right: 0;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
}

.sidebar-overlay.show {
    display: block;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9f9f9;
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 500;
    color: #222;
    margin: 0;
}

.sidebar-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.sidebar-close:hover {
    background: #e0e0e0;
}

.sidebar-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.sidebar-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.sidebar-table th {
    padding: 10px 8px;
    text-align: left;
    font-weight: 500;
    color: #666;
    border-bottom: 2px solid #e0e0e0;
    background: #f5f5f5;
    position: sticky;
    top: 0;
    z-index: 5;
}

.sidebar-table td {
    padding: 8px;
    border-bottom: 1px solid #e0e0e0;
    color: #333;
}

.sidebar-table tbody tr:hover {
    background: #f9f9f9;
}

.sidebar-table .loading {
    text-align: center;
    color: #999;
    padding: 20px;
}

/* Hacer los gráficos clickeables */
.cumplimiento-card {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cumplimiento-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Responsive - ya definido arriba */

@media (max-width: 768px) {
    body {
        padding: 20px 0;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .sidebar {
        width: 100%;
        right: -100%;
    }
    
    .header-top {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-info {
        margin-top: 10px;
        align-self: flex-end;
    }
    
    header h1 {
        font-size: 1.75rem;
    }
    
    .kpi-card {
        min-height: auto;
    }
    
    .kpi-value {
        font-size: 2.5rem;
    }
    
    .kpi-semaforo {
        gap: 12px;
        padding: 10px;
    }
    
    .semaforo-luz {
        width: 28px;
        height: 28px;
    }
    
    .semaforo-cantidad {
        font-size: 0.8rem;
    }
    
    .table-container {
        overflow-x: scroll;
    }
    
    table {
        font-size: 0.75rem;
    }
    
    table th,
    table td {
        padding: 6px 4px;
    }
}

/* Estilos específicos para tabla de inventario */
.inventario-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 400px);
    margin-top: 20px;
}

.inventario-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.inventario-table thead {
    background: #f5f5f5;
    position: sticky;
    top: 0;
    z-index: 10;
}

.inventario-table th {
    padding: 12px;
    text-align: center;
    font-weight: 500;
    color: #666;
    border-bottom: 2px solid #e0e0e0;
    background: #f5f5f5;
    white-space: nowrap;
}

.inventario-table th:first-child {
    text-align: left;
}

.inventario-table th:not(:first-child) {
    text-align: center;
}

.inventario-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e0e0e0;
    color: #333;
    text-align: center;
}

.inventario-table td:first-child {
    text-align: left;
    font-weight: 500;
}

.inventario-table tbody tr:hover {
    background: #fafafa;
}

.inventario-table .number-cell {
    text-align: right;
}

.inventario-table .total-cell {
    background: #e8f5e9;
    font-weight: 600;
}

.inventario-table .total-general-cell {
    background: #c8e6c9;
    font-weight: 600;
}

.inventario-table tbody tr:last-child td {
    border-bottom: 2px solid #e0e0e0;
    font-weight: 600;
}

.inventario-empresa-almacen {
    margin-bottom: 40px;
}

.inventario-empresa-almacen h3 {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 12px;
    color: #222;
    padding-bottom: 8px;
    border-bottom: 2px solid #e0e0e0;
}

/* Información del SLA y Semáforo */
.sla-info-section {
    background: white;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    margin-bottom: 30px;
    overflow: hidden;
}

.sla-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.sla-info-header:hover {
    background: #eeeeee;
}

.sla-info-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #333;
}

.sla-info-icon {
    font-size: 1.2rem;
}

.sla-info-toggle {
    display: flex;
    align-items: center;
}

.sla-info-chevron {
    font-size: 0.9rem;
    color: #666;
    transition: transform 0.3s ease;
}

.sla-info-section.collapsed .sla-info-chevron {
    transform: rotate(-90deg);
}

.sla-info-content {
    padding: 20px;
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.sla-info-section.collapsed .sla-info-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.sla-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.sla-info-card {
    background: #fafafa;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    padding: 16px;
}

.sla-info-card-header {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.sla-info-card-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #222;
    margin: 0;
}

.sla-info-card-body {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.6;
}

.sla-info-card-body p {
    margin: 8px 0;
}

.sla-info-example {
    font-style: italic;
    color: #888;
    font-size: 0.8rem;
    margin-top: 8px;
}

.semaforo-info-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.semaforo-info-title {
    font-size: 1rem;
    font-weight: 600;
    color: #222;
    margin-bottom: 16px;
}

.semaforo-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.semaforo-info-item {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    text-align: center;
    padding: 16px;
    background: #fafafa;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.semaforo-info-color {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.semaforo-info-color.semaforo-verde {
    background: #4CAF50;
}

.semaforo-info-color.semaforo-naranja {
    background: #FF9800;
}

.semaforo-info-color.semaforo-rojo {
    background: #f44336;
}

.semaforo-info-text {
    flex: 1;
    font-size: 0.85rem;
    color: #666;
    line-height: 1.6;
}

.semaforo-info-text strong {
    display: block;
    color: #222;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.semaforo-info-text p {
    margin: 4px 0;
}

.sla-info-note {
    margin-top: 20px;
    padding: 12px;
    background: #f0f7ff;
    border-left: 3px solid #2196F3;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #555;
    line-height: 1.6;
}

.sla-info-note strong {
    color: #1976D2;
}

@media (max-width: 768px) {
    .sla-info-grid {
        grid-template-columns: 1fr;
    }
    
    .semaforo-info-grid {
        grid-template-columns: 1fr;
    }
}

