.balance-page { max-width: 1100px; padding: 1.25rem 1rem 2.5rem; }
.bal-top { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.bal-top h1 { margin: 0; font-size: 1.35rem; }
.bal-top p { margin: 0.2rem 0 0; color: #6b7280; font-size: 0.9rem; }
.bal-nav { display: flex; gap: 0.75rem; font-size: 0.88rem; flex-wrap: wrap; }
.bal-nav a { color: #1d4ed8; font-weight: 600; text-decoration: none; }
.bal-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; padding: 0.65rem; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; }
.bal-bar select { padding: 0.5rem; border: 1px solid #e5e7eb; border-radius: 8px; font: inherit; min-width: 140px; }
.bal-btn { padding: 0.5rem 1rem; background: #1d4ed8; color: #fff; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; }
.bal-kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin-bottom: 1rem; }
.bal-kpi-asp { grid-template-columns: repeat(5, 1fr); margin-bottom: 0; }
.bal-kpi-asp .bal-kpi-item { font-size: 0.72rem; line-height: 1.3; padding: 0.65rem 0.45rem; }
.bal-kpi-asp .bal-kpi-item span { font-size: 1.35rem; margin-bottom: 0.2rem; }
.bal-asp-block { margin-bottom: 1.25rem; }
.bal-asp-block h2 { margin: 0 0 0.35rem; font-size: 1.1rem; }
.bal-kpi-link { text-decoration: none; color: inherit; transition: transform 0.15s, box-shadow 0.15s; display: block; }
.bal-kpi-link:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(15, 23, 42, 0.1); }
.bal-kpi-link.is-active { outline: 2px solid #1d4ed8; outline-offset: 2px; }
.bal-kpi-link small { display: block; font-size: 0.68rem; font-weight: 500; opacity: 0.9; margin-top: 0.15rem; }
.bal-rango-detalle { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #e5e7eb; }
.bal-rango-detalle h3 { margin: 0 0 0.75rem; font-size: 1rem; }
.bal-kpi-item { text-align: center; padding: 0.75rem; background: #f3f4f6; border-radius: 10px; font-size: 0.8rem; font-weight: 600; color: #1f2937; border: 1px solid #e5e7eb; }
.bal-kpi-item span { display: block; font-size: 1.4rem; font-weight: 800; color: inherit; }
.bal-kpi-item.bal-blue { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.bal-kpi-item.bal-blue span { color: #1e3a8a; }
.bal-kpi-item.bal-green { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.bal-kpi-item.bal-green span { color: #047857; }
.bal-kpi-item.bal-purple { background: #ede9fe; color: #5b21b6; border-color: #c4b5fd; }
.bal-kpi-item.bal-purple span { color: #6d28d9; }

/* Indicadores Aspriella (después de .bal-kpi-item para ganar especificidad) */
.bal-kpi-item.bal-asp-70 {
    background: linear-gradient(145deg, #1e3a8a, #2563eb);
    color: #fff;
    border-color: #1e40af;
    box-shadow: 0 2px 8px rgba(30, 58, 138, 0.25);
}
.bal-kpi-item.bal-asp-70 span,
.bal-kpi-item.bal-asp-70 small { color: #eff6ff; }

.bal-kpi-item.bal-asp-60 {
    background: linear-gradient(145deg, #2563eb, #60a5fa);
    color: #fff;
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}
.bal-kpi-item.bal-asp-60 span,
.bal-kpi-item.bal-asp-60 small { color: #f8fafc; }

.bal-kpi-item.bal-asp-60all {
    background: #dbeafe;
    color: #1e40af;
    border-color: #93c5fd;
}
.bal-kpi-item.bal-asp-60all span { color: #1d4ed8; }

.bal-kpi-item.bal-asp-bajo {
    background: #fecaca;
    color: #991b1b;
    border-color: #f87171;
}
.bal-kpi-item.bal-asp-bajo span { color: #b91c1c; }

.bal-kpi-item.bal-asp-crec {
    background: #fde68a;
    color: #92400e;
    border-color: #fbbf24;
}
.bal-kpi-item.bal-asp-crec span { color: #b45309; }

.bal-kpi-link.bal-kpi-item.bal-asp-70:hover,
.bal-kpi-link.bal-kpi-item.bal-asp-60:hover { box-shadow: 0 6px 18px rgba(30, 64, 175, 0.35); }
.bal-kpi-link.bal-kpi-item.is-active { outline: 3px solid #f59e0b; outline-offset: 2px; }
.bal-stats-block { margin-bottom: 1.25rem; }
.bal-stats-block h2 { margin: 0 0 0.35rem; font-size: 1.1rem; }
.bal-stats-block h3 { margin: 0 0 0.5rem; font-size: 0.95rem; color: #374151; }
.bal-pdf-block h2 { margin: 0 0 0.35rem; }

/* Encabezados tabla PDF: clase en <table>, no en el div */
.balance-page table.bal-pdf-table thead th {
    background-color: #1e3a8a !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    font-weight: 700 !important;
    border-bottom: 2px solid #1e40af !important;
    white-space: nowrap;
}

.balance-page table.bal-prov-table thead th {
    background-color: #cbd5e1 !important;
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
    font-weight: 700 !important;
}

.balance-page table.bal-pdf-table tbody td {
    color: #0f172a !important;
    background-color: #ffffff;
}

.balance-page table.bal-pdf-table tbody tr.bal-row-win td {
    background-color: #ecfdf5;
}

.balance-page table.bal-pdf-table tfoot td {
    background-color: #bfdbfe !important;
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
    font-weight: 800 !important;
    border-top: 2px solid #3b82f6 !important;
    border-bottom: none !important;
    font-size: 0.95rem;
}

.balance-page table.bal-pdf-table tfoot .bal-total-label {
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.bal-prov-table { margin-top: 1rem; font-size: 0.88rem; width: 100%; border-collapse: collapse; }
.bal-pdf-table { width: 100%; border-collapse: collapse; }

.bal-filter-active {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: #eff6ff;
    border: 1px solid #93c5fd;
    border-radius: 10px;
    font-size: 0.92rem;
    color: #1e3a8a;
}
.bal-filter-active a {
    margin-left: 0.5rem;
    font-weight: 700;
    color: #1d4ed8;
}
.bal-bar-label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.8rem; font-weight: 600; }
.bal-bar-check { display: flex; align-items: center; gap: 0.4rem; font-size: 0.88rem; font-weight: 600; }
.bal-grid-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.bal-chart { height: 280px; position: relative; }
.bal-highlight { background: #fef3c7 !important; font-weight: 700; color: #0f172a !important; }
.bal-row-win { background: #ecfdf5; }
.bal-form label { display: block; margin-bottom: 1rem; font-weight: 600; }

@media (max-width: 900px) {
    .bal-kpi-asp { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
    .bal-kpi { grid-template-columns: repeat(2, 1fr); }
    .bal-grid-charts { grid-template-columns: 1fr; }
}

.balance-page table.bal-pdf-table thead th {
    background-color: #1e3a8a !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    font-weight: 700 !important;
}
.balance-page table.bal-prov-table thead th {
    background-color: #cbd5e1 !important;
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
    font-weight: 700 !important;
}
.balance-page table.bal-pdf-table tfoot td {
    background-color: #bfdbfe !important;
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
}
