* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

body {
    background: #f0f7f0;
    padding: 24px 20px;
}

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

.header {
    margin-bottom: 28px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}
.title-section h1 {
    font-size: 1.9rem;
    color: #1e3a2f;
    font-weight: 700;
}
.title-section p {
    color: #2d5a3f;
    margin-top: 6px;
    font-weight: 500;
}
.badge-year {
    background: #1e5c3a;
    color: white;
    padding: 8px 18px;
    border-radius: 40px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.controls-panel {
    background: white;
    border-radius: 28px;
    padding: 18px 24px;
    margin-bottom: 32px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.toggle-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.toggle-btn {
    background: #e8f0ea;
    border: none;
    padding: 8px 16px;
    border-radius: 40px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    color: #1e3a2f;
}
.toggle-btn.active {
    background: #1e5c3a;
    color: white;
}
.toggle-btn.inactive {
    background: #cbdcd0;
    color: #5a6e62;
    opacity: 0.6;
}
.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}
.filter-select {
    background: #e8f0ea;
    padding: 5px 12px;
    border-radius: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.filter-select label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #1e3a2f;
}
select {
    padding: 6px 10px;
    border-radius: 30px;
    border: 1px solid #bdd4c5;
    background: white;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
}
.reset-btn {
    background: #2c3e35;
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 40px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}
.kpi-card {
    background: white;
    border-radius: 24px;
    padding: 18px 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border-left: 5px solid #1e5c3a;
}
.kpi-card.hidden-card { display: none; }
.kpi-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    color: #4b6b58;
    margin-bottom: 8px;
}
.kpi-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: #1e3a2f;
}
.kpi-sub {
    font-size: 0.7rem;
    color: #5a6e62;
    margin-top: 6px;
}

.projection-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 28px;
}
.projection-card {
    flex: 1;
    min-width: 260px;
    background: white;
    border-radius: 24px;
    padding: 18px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border: 1px solid #1e5c3a20;
}
.projection-card h3 {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 14px;
    color: #1e3a2f;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 2px solid #e8f0ea;
    padding-bottom: 10px;
}
.projection-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px dashed #cbdcd0;
    font-size: 0.85rem;
}
.stat-label {
    font-weight: 600;
    color: #4b6b58;
}
.stat-value {
    font-weight: 700;
}
.stat-value.ingreso { color: #15803d; }
.stat-value.egreso { color: #b91c1c; }
.projection-note {
    margin-top: 12px;
    font-size: 0.65rem;
    color: #5a6e62;
    text-align: center;
    font-style: italic;
}

.composition-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 28px;
}
.composition-card {
    flex: 1;
    min-width: 280px;
    background: white;
    border-radius: 24px;
    padding: 18px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.composition-card h3 {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 14px;
    color: #1e3a2f;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 2px solid #e8f0ea;
    padding-bottom: 10px;
}
.comp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.comp-table th, .comp-table td {
    padding: 8px 6px;
    text-align: left;
    border-bottom: 1px solid #e8f0ea;
}
.comp-table th {
    font-weight: 700;
    color: #1e5c3a;
    background: #f8fcf9;
}
.number-cell {
    text-align: right;
    font-weight: 500;
}
.percentage-cell {
    text-align: right;
    font-weight: 600;
    color: #1e5c3a;
}
.total-row {
    background: #e8f0ea;
    font-weight: bold;
}

.charts-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 28px;
}
.chart-box {
    background: white;
    border-radius: 24px;
    padding: 18px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    flex: 1;
    min-width: 280px;
}
.full-width {
    flex: 100%;
}
.table-box {
    background: white;
    border-radius: 24px;
    padding: 18px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    margin-top: 0;
}
.hidden-component { display: none; }
h3 i { width: 24px; }
canvas { max-height: 260px; width: 100%; }

.tabs-container { margin-top: 10px; }
.tabs-header { display: flex; gap: 6px; border-bottom: 2px solid #e8f0ea; margin-bottom: 16px; flex-wrap: wrap; }
.tab-btn { background: none; border: none; padding: 8px 18px; font-size: 0.85rem; font-weight: 600; cursor: pointer; border-radius: 30px 30px 0 0; color: #5a6e62; display: inline-flex; align-items: center; gap: 8px; }
.tab-btn.active { color: #1e5c3a; background: #e8f0ea; border-bottom: 3px solid #1e5c3a; }
.tab-content { display: none; }
.tab-content.active { display: block; }

.search-bar { margin-bottom: 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-bar input { flex: 1; min-width: 180px; padding: 8px 14px; border: 1px solid #bdd4c5; border-radius: 30px; font-size: 0.8rem; outline: none; }
.search-bar input:focus { border-color: #1e5c3a; box-shadow: 0 0 0 2px #1e5c3a20; }
.search-bar button { background: #e8f0ea; border: none; padding: 8px 16px; border-radius: 30px; cursor: pointer; font-weight: 500; font-size: 0.8rem; }
.clear-search { background: #f0e0d0; }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.75rem; }
.data-table th, .data-table td { padding: 8px 5px; text-align: left; border-bottom: 1px solid #dde5e0; }
.data-table th { font-weight: 700; color: #1e5c3a; background: #f8fcf9; position: sticky; top: 0; }
.table-wrapper { max-height: 400px; overflow-y: auto; border-radius: 16px; }

.quota-card { background: linear-gradient(135deg, #1e5c3a08, #ffffff); border: 1px solid #1e5c3a20; }
.remuneraciones-card { background: linear-gradient(135deg, #b91c1c08, #ffffff); border: 1px solid #b91c1c20; }
.regular-card { background: linear-gradient(135deg, #2e9e7308, #ffffff); border: 1px solid #2e9e7320; }

.metric-cards {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.metric-card {
    flex: 1;
    min-width: 120px;
    text-align: center;
    padding: 12px;
    background: #e8f0ea;
    border-radius: 18px;
}
.metric-card .label {
    font-size: 0.7rem;
    color: #5a6e62;
}
.metric-card .value {
    font-size: 1.3rem;
    font-weight: 800;
}

.stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}
.stats-card {
    flex: 1;
    min-width: 220px;
    background: white;
    border-radius: 20px;
    padding: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid #e8f0ea;
}
.stats-card h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    color: #4b6b58;
    margin-bottom: 10px;
    text-align: center;
}
.stats-grid {
    display: flex;
    justify-content: space-around;
    gap: 12px;
}
.stat-item {
    text-align: center;
    flex: 1;
}
.stat-item .stat-label-sm {
    font-size: 0.65rem;
    color: #5a6e62;
}
.stat-item .stat-number {
    font-size: 1rem;
    font-weight: 700;
}
.stat-number.ingreso { color: #15803d; }
.stat-number.egreso { color: #b91c1c; }

.footer { text-align: center; margin-top: 30px; font-size: 0.7rem; color: #5a6e62; border-top: 1px solid #cbdcd0; padding-top: 16px; }

#projectionSection {
    display: none !important;
}        

@media (max-width: 900px) { .composition-row { flex-direction: column; } .charts-row { flex-direction: column; } }

/* Loading Overlay & Spinner Styles */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(240, 247, 240, 0.95);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay p {
    margin-top: 20px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e3a2f;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #bdd4c5;
    border-top: 5px solid #1e5c3a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

