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

body {
    font-family: 'Montserrat', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.dashboard-header {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.dashboard-header h1 {
    font-size: 2.2em;
    font-weight: 700;
    color: #2c3e50;
}

.sheet-selector {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sheet-selector label {
    font-weight: 600;
    color: #555;
}

.sheet-selector select {
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    background: white;
    cursor: pointer;
}

.sheet-selector button {
    padding: 10px 20px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sheet-selector button:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.loading {
    text-align: center;
    padding: 60px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    margin: 20px 0;
}

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

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

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 3em;
    opacity: 0.8;
}

.stat-info h3 {
    font-size: 1em;
    color: #666;
    margin-bottom: 8px;
    font-weight: 600;
}

.stat-number {
    font-size: 2.2em;
    font-weight: 700;
    color: #2c3e50;
}

.charts-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Cuando solo hay un gráfico visible, que ocupe todo el ancho */
.chart-container {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.chart-container:only-of-type {
    grid-column: 1 / -1; /* Ocupar todo el ancho disponible */
}

.chart-container h3 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 1.3em;
    font-weight: 600;
}

.chart-wrapper {
    position: relative;
    height: 400px;
}

/* Estilos específicos para la tabla */
.table-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    margin-top: 2rem;
}

.table-section h2 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 1.5em;
    font-weight: 700;
}

.data-table {
    width: 100% !important;
    border-collapse: collapse !important;
    background: white !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
    margin: 0 !important;
    border: none !important;
}

.data-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
}

.data-table th {
    padding: 15px 12px !important;
    text-align: left !important;
    font-weight: 600 !important;
    font-size: 0.95em !important;
    letter-spacing: 0.5px !important;
    border: none !important;
    color: white !important;
    background: transparent !important;
}

.data-table tbody tr {
    transition: all 0.3s ease !important;
    border-bottom: 1px solid #f0f0f0 !important;
    background: white !important;
}

.data-table tbody tr:nth-child(even) {
    background: #f8f9fa !important;
}

.data-table tbody tr:hover {
    background-color: #e3f2fd !important;
    transform: none !important;
}

.data-table tbody tr:last-child {
    border-bottom: none !important;
}

.data-table td {
    padding: 12px !important;
    border-right: 1px solid #eee !important;
    font-size: 0.9em !important;
    color: #555 !important;
    border-top: none !important;
    border-bottom: none !important;
    border-left: none !important;
}

.data-table td:last-child {
    border-right: none !important;
}

.data-table td:nth-child(3) {
    font-weight: 600 !important;
    color: #2c3e50 !important;
}

.data-table td:nth-child(4) {
    color: #3498db !important;
    font-weight: 600 !important;
}

/* RESETEAR CUALQUIER ESTILO CONFLICTIVO */
.table-section table,
.table-section table * {
    border-collapse: collapse !important;
    box-sizing: border-box !important;
}

.table-section {
    background: rgba(255, 255, 255, 0.95) !important;
    border-radius: 15px !important;
    padding: 25px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
    overflow-x: auto !important;
    margin-top: 2rem !important;
}

.table-section h2 {
    margin-bottom: 20px !important;
    color: #2c3e50 !important;
    font-size: 1.5em !important;
    font-weight: 700 !important;
}

/* Mensaje de error */
.error-message {
    background: rgba(231, 76, 60, 0.1);
    border: 2px solid #e74c3c;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
    color: #c0392b;
    font-weight: 600;
}

.error-message p {
    margin: 0;
    font-size: 1.1em;
}

/* Animaciones */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Estados de las tarjetas según el contenido */
.stat-card.success .stat-icon {
    color: #27ae60;
}

.stat-card.warning .stat-icon {
    color: #f39c12;
}

.stat-card.error .stat-icon {
    color: #e74c3c;
}

.stat-card.info .stat-icon {
    color: #3498db;
}

.stat-card.purple .stat-icon {
    color: #9b59b6;
}

/* Responsive general */
@media (max-width: 1200px) {
    .charts-section {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .dashboard-container {
        padding: 15px;
    }
    
    .dashboard-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .dashboard-header h1 {
        font-size: 1.8em;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-icon {
        font-size: 2.5em;
    }
    
    .stat-number {
        font-size: 1.8em;
    }
}

@media (max-width: 480px) {
    .sheet-selector {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .sheet-selector select,
    .sheet-selector button {
        width: 100%;
    }
    
    .table-section {
        padding: 15px;
    }
    
    .chart-container {
        padding: 15px;
    }
}