/* Auditoría técnica — matriz Card 4 (estilo Resumen ejecutivo) */

#audit-matriz-root {
    display: flex;
    flex-direction: column;
    min-height: 400px;
    height: calc(100vh - 320px);
}

.audit-mm-toolbar {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color, rgba(51, 65, 85, 0.8));
    background: rgba(0, 0, 0, 0.15);
}
.audit-mm-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    font-size: 10px;
}
.audit-mm-toolbar label,
.audit-mm-lbl-months {
    color: #64748b;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 9px;
}
.audit-mm-lbl-months { margin-left: 8px; }

.audit-mm-scale,
.audit-mm-month {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 999px;
    padding: 2px;
}
.audit-mm-scale button,
.audit-mm-month button {
    padding: 5px 12px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.15s;
}
.audit-mm-scale button.is-on,
.audit-mm-month button.is-on {
    background: #1e40af;
    color: #fff;
    box-shadow: 0 1px 6px rgba(30, 64, 175, 0.4);
}
.audit-mm-month button.is-corte.is-on {
    background: rgba(245, 158, 11, 0.25);
    color: #fbbf24;
    box-shadow: none;
    border: 1px solid rgba(251, 191, 36, 0.35);
}
.audit-mm-month button:hover:not(.is-on),
.audit-mm-scale button:hover:not(.is-on) {
    color: #cbd5e1;
}

.audit-mm-section-hdr {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 16px 8px;
    border-bottom: 1px solid rgba(39, 46, 61, 0.6);
}
.audit-mm-section-hdr h3 {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #60a5fa;
}
.audit-mm-section-hdr span {
    font-size: 9px;
    color: #64748b;
}

.audit-mm-scroll {
    flex: 1;
    overflow: auto;
    min-height: 0;
    padding: 0 0 12px;
}
.audit-mm-empty {
    padding: 24px 16px;
    color: #64748b;
    font-size: 12px;
}

#mm-table-wrap,
.mm-table-wrap {
    overflow: visible;
    padding: 0 12px 8px;
    min-width: 100%;
}

/* Tabla — crece horizontal al agregar meses; scroll en .audit-mm-scroll */
#audit-matriz-root table.mm-audit-screen {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto;
}

#audit-matriz-root .mm-scale-banner {
    font-size: 9px;
    color: #64748b;
    margin: 12px 16px 8px;
    padding: 6px 10px;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 6px;
    border: 1px solid rgba(51, 65, 85, 0.5);
}
#audit-matriz-root .mm-detalle-hint {
    font-size: 9px;
    color: #475569;
    margin: 0 16px 10px;
}

#audit-matriz-root table.mm-audit-screen thead th {
    background-color: var(--bg-table-header, #0f111a);
    color: var(--text-muted, #64748b);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
    border-bottom: 1px solid var(--border-color, #272e3d);
    padding: 10px 12px;
    vertical-align: bottom;
    position: sticky;
    top: 0;
    z-index: 10;
}
#audit-matriz-root table.mm-audit-screen thead tr:nth-child(2) th {
    top: 34px;
    font-size: 0.6rem;
    padding: 6px 10px;
}

#audit-matriz-root table.mm-audit-screen th.col-estructura {
    text-align: left;
    left: 0;
    z-index: 30;
    min-width: 280px;
    width: 280px;
    max-width: 320px;
}
#audit-matriz-root table.mm-audit-screen th.month-hdr {
    text-align: center;
    background: rgba(15, 23, 42, 0.85);
    min-width: 120px;
}
#audit-matriz-root table.mm-audit-screen th.sub-hdr.num {
    min-width: 90px;
}
#audit-matriz-root table.mm-audit-screen th.num {
    text-align: right;
}
#audit-matriz-root table.mm-audit-screen th.ytd-hdr-band {
    text-align: center;
    color: #60a5fa;
    background: rgba(30, 58, 138, 0.12);
    border-left: 1px solid rgba(59, 130, 246, 0.25);
}
#audit-matriz-root table.mm-audit-screen th.ytd-block {
    background: rgba(30, 58, 138, 0.1);
    border-left: 1px solid rgba(59, 130, 246, 0.15);
}
#audit-matriz-root table.mm-audit-screen th.col-prev-rem-hdr {
    color: #38bdf8;
}
#audit-matriz-root table.mm-audit-screen th.col-proy-hdr {
    color: #fbbf24;
}
#audit-matriz-root table.mm-audit-screen th.col-cumpl-hdr {
    text-align: center;
    min-width: 76px;
}
#audit-matriz-root .hdr-sub {
    display: block;
    font-size: 8px;
    font-weight: 500;
    color: #64748b;
    text-transform: none;
    letter-spacing: normal;
    margin-top: 2px;
}

#audit-matriz-root table.mm-audit-screen td {
    padding: 8px 12px;
    font-size: 0.75rem;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    border-bottom: 1px solid rgba(39, 46, 61, 0.5);
    vertical-align: middle;
}
#audit-matriz-root table.mm-audit-screen td.cell-label {
    text-align: left;
    position: sticky;
    left: 0;
    z-index: 6;
    min-width: 280px;
    width: 280px;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.35);
    font-weight: 700;
}
#audit-matriz-root table.mm-audit-screen td.num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    min-width: 90px;
}
#audit-matriz-root table.mm-audit-screen td.ytd-block.num {
    min-width: 100px;
}

#audit-matriz-root table.mm-audit-screen tr.level-1 td {
    background-color: rgba(22, 26, 35, 0.95);
}
#audit-matriz-root table.mm-audit-screen tr.level-1 td.cell-label {
    background-color: rgba(22, 26, 35, 0.98);
}
#audit-matriz-root table.mm-audit-screen tr.level-2 td {
    background-color: rgba(22, 26, 35, 0.55);
}
#audit-matriz-root table.mm-audit-screen tr.level-2 td.cell-label {
    background-color: rgba(22, 26, 35, 0.75);
}
#audit-matriz-root table.mm-audit-screen tr.level-3 td {
    background-color: transparent;
}
#audit-matriz-root table.mm-audit-screen tr.level-3 td.cell-label {
    background-color: var(--bg-panel, #161a23);
    font-weight: 600;
    color: #94a3b8;
}
#audit-matriz-root table.mm-audit-screen tr.row-hover:hover td {
    background-color: rgba(255, 255, 255, 0.03);
}
#audit-matriz-root table.mm-audit-screen tr.row-hover:hover td.cell-label {
    background-color: rgba(22, 26, 35, 0.98);
}

#audit-matriz-root table.mm-audit-screen tr.row-ing .cell-label,
#audit-matriz-root table.mm-audit-screen tr.row-ing.level-1 .cell-label {
    color: var(--color-ingreso, #10b981);
}
#audit-matriz-root table.mm-audit-screen tr.row-gas .cell-label,
#audit-matriz-root table.mm-audit-screen tr.row-gas.level-1 .cell-label {
    color: var(--color-gasto, #f43f5e);
}
#audit-matriz-root table.mm-audit-screen tr.row-neto td {
    font-weight: 800;
}
#audit-matriz-root table.mm-audit-screen tr.row-neto .cell-label {
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

#audit-matriz-root table.mm-audit-screen .cell-indent {
    padding-left: 1.5rem !important;
}
#audit-matriz-root table.mm-audit-screen .cell-indent-2 {
    padding-left: 2.5rem !important;
    font-size: 0.7rem;
}

#audit-matriz-root table.mm-audit-screen td.ytd-block {
    background: rgba(30, 58, 138, 0.06);
    border-left: 1px solid rgba(59, 130, 246, 0.12);
}
#audit-matriz-root table.mm-audit-screen th.ytd-block + th.ytd-block,
#audit-matriz-root table.mm-audit-screen td.ytd-block + td.ytd-block {
    border-left: none;
}
#audit-matriz-root table.mm-audit-screen td.col-prev-rem {
    color: #38bdf8;
}
#audit-matriz-root table.mm-audit-screen td.col-proy {
    color: #fbbf24;
    font-weight: 700;
}
#audit-matriz-root table.mm-audit-screen .val-ing {
    color: #34d399;
}
#audit-matriz-root table.mm-audit-screen .val-gas {
    color: #f87171;
}

#audit-matriz-root table.mm-audit-screen td.col-cumpl {
    text-align: center;
    min-width: 76px;
    padding: 6px 8px;
}
#audit-matriz-root table.mm-audit-screen td.col-cumpl.heat-ok,
#audit-matriz-root table.mm-audit-screen td.col-cumpl.heat-warn,
#audit-matriz-root table.mm-audit-screen td.col-cumpl.heat-bad {
    background: inherit;
}
#audit-matriz-root table.mm-audit-screen .cumpl-badge {
    font-size: 10px;
}
#audit-matriz-root table.mm-audit-screen .cumpl-badge.heat-ok {
    background: rgba(52, 211, 153, 0.18) !important;
    color: #34d399 !important;
    border: 1px solid rgba(52, 211, 153, 0.35) !important;
}
#audit-matriz-root table.mm-audit-screen .cumpl-badge.heat-warn {
    background: rgba(251, 191, 36, 0.18) !important;
    color: #fbbf24 !important;
    border: 1px solid rgba(251, 191, 36, 0.35) !important;
}
#audit-matriz-root table.mm-audit-screen .cumpl-badge.heat-bad {
    background: rgba(248, 113, 113, 0.18) !important;
    color: #f87171 !important;
    border: 1px solid rgba(248, 113, 113, 0.35) !important;
}
#audit-matriz-root table.mm-audit-screen .trend-up,
#audit-matriz-root table.mm-audit-screen .trend-down,
#audit-matriz-root table.mm-audit-screen .trend-flat {
    display: block;
    font-size: 8px;
    margin-top: 2px;
    line-height: 1;
}
#audit-matriz-root table.mm-audit-screen .trend-up { color: #34d399; }
#audit-matriz-root table.mm-audit-screen .trend-down { color: #f87171; }
#audit-matriz-root table.mm-audit-screen .trend-flat { color: #64748b; }

#audit-matriz-root table.mm-audit-screen tr.hidden {
    display: none !important;
}
#audit-matriz-root table.mm-audit-screen tr.is-open > td.cell-label .icon-colapsable {
    transform: rotate(90deg);
}
#audit-matriz-root table.mm-audit-screen .icon-colapsable {
    transition: transform 0.2s ease;
    display: inline-block;
    width: 16px;
    text-align: center;
    margin-right: 2px;
}

#audit-matriz-root .cumpl-legend {
    margin: 4px 16px 12px;
    padding-top: 4px;
    border-top: 1px solid rgba(39, 46, 61, 0.5);
}
