/* ═══════════════════════════════════════════════════
   PREVISIO — Cálculo de reajuste (motor completo)
   Puerto de reajustes-web/frontend/style.css, remapeado a
   las variables de design system de determination.css.
   ═══════════════════════════════════════════════════ */

/* ── Cajas de resumen (grilla de estadísticas) ── */
.resumen-caja {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.resumen-item {
    background: var(--surface);
    padding: 8px 12px;
}
.resumen-item .k {
    font-size: var(--fs-xs); color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .3px;
}
.resumen-item .v {
    font-size: var(--fs-md); font-weight: 700; margin-top: 2px; color: var(--text);
}

/* ── Banners de resultado (ok / confiscatorio / informativo) ── */
.resultado-banner {
    padding: 8px 12px;
    font-weight: 600;
    font-size: var(--fs-sm);
    border-radius: var(--radius-sm);
}
.resultado-banner.ok   { background: var(--success-bg); color: var(--success); }
.resultado-banner.bad  { background: var(--danger-bg);  color: var(--danger); }
.resultado-banner.info { background: var(--warning-bg); color: var(--warning); }
.resultado-banner + .resultado-banner { margin-top: 4px; }

.texto-malo { color: var(--danger);  font-weight: 700; }
.texto-info { color: var(--warning); font-weight: 700; }

/* ── "Ver cálculo" desplegable ── */
.detalle-calculo { margin-top: 8px; }
.detalle-calculo summary {
    cursor: pointer;
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--accent);
    padding: 4px 0;
    list-style: none;
}
.detalle-calculo summary::-webkit-details-marker { display: none; }
.detalle-calculo summary::before { content: "\25B6 "; font-size: 9px; }
.detalle-calculo[open] summary::before { content: "\25BC "; }
.detalle-calculo .resumen-caja { margin-top: 6px; }

/* ── Topes en columnas (art. 9, 24, 26) ── */
.topes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}
.topes-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.topes-col-titulo {
    font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .3px;
}

/* ── Cálculo en formato de ecuación (PBU / PC / PAP, etc.) ── */
.formula-caja {
    display: flex; flex-direction: column; gap: 14px;
    margin-top: 6px;
}
.formula-bloque {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}
.formula-titulo {
    font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .3px; margin-bottom: 6px;
}
.formula-linea {
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: 12.5px; line-height: 1.6; color: var(--text);
    white-space: normal; word-break: break-word;
}
.formula-linea.formula-resultado { font-weight: 700; margin-top: 2px; }
.formula-nota { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 6px; }

/* ── Tablas de datos del reajuste (remuneraciones, aportes, movilidad) ── */
/* determination.css define `table { table-layout: fixed }` a nivel global;
   estas tablas tienen muchas columnas de ancho variable, así que se
   revierte a "auto" y se deja scroll horizontal dentro de su wrapper. */
.tabla-reajuste {
    table-layout: auto;
    width: max-content;
    min-width: 100%;
}
.tabla-reajuste th, .tabla-reajuste td {
    white-space: nowrap;
    font-size: var(--fs-sm);
}
.tabla-reajuste thead tr:first-child th {
    padding: 4px 8px;
    line-height: 1.3;
}
.tabla-reajuste tfoot td {
    padding: 4px 8px;
    line-height: 1.3;
}
.tabla-reajuste td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tabla-reajuste td.calc { background: var(--row-alt); color: var(--text); }
/* las celdas con input/select no llevan padding propio: el control ocupa toda la celda */
.tabla-reajuste td:has(> input), .tabla-reajuste td:has(> select) { padding: 0; }
.tabla-reajuste input, .tabla-reajuste select {
    font-family: inherit; font-size: var(--fs-sm); color: var(--text);
    border: 1.5px solid var(--border); border-radius: 0;
    padding: 5px 6px; background: var(--surface); width: 100%; height: 100%;
    outline: none; box-sizing: border-box; display: block;
    transition: border-color .15s, box-shadow .15s;
}
.tabla-reajuste input:focus, .tabla-reajuste select:focus {
    position: relative; z-index: 1;
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1.5px var(--accent);
}

.tabla-scroll-x {
    overflow-x: auto;
    max-height: 480px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}
.tabla-scroll-x table.tabla-reajuste thead th {
    position: sticky; top: 0; z-index: 2;
}

.marca-ventana td {
    background: var(--warning-bg) !important;
    font-weight: 700;
}

.filas-controles {
    padding: 6px 8px;
    background: var(--row-alt);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ── Botón secundario/peligro chico, para filas de tabla ──
   Discreto por defecto: aparece al pasar el cursor por la fila (mismo
   criterio que las acciones de la tabla de aportes en Determinación),
   en vez de mostrarse siempre como una columna más. */
.btn-fila {
    font-family: inherit; font-size: var(--fs-xs); font-weight: 700;
    color: var(--danger); background: transparent; border: none;
    cursor: pointer; padding: 2px 6px; border-radius: var(--radius-sm);
    opacity: 0; transition: opacity .15s ease, background .12s;
}
.btn-fila:hover { background: var(--danger-bg); }
tbody tr:hover .btn-fila,
tbody tr:focus-within .btn-fila {
    opacity: 1;
}

.oculto { display: none !important; }
