/* Tabla desglose nómina */

/* Wrapper con scroll horizontal como red de seguridad en pantallas muy pequeñas */
#desgloseDetalle .table-wrapper,
#desgloseDetalle>div {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#desgloseDetalle table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-primary);
    font-size: 0.9rem;
}

#desgloseDetalle thead th {
    background: var(--primary-color);
    color: #fff;
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    /* cabeceras nunca se parten */
}

#desgloseDetalle tbody td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    white-space: nowrap;
    /* valores numéricos en una sola línea */
}

/* Columna CONCEPTO: sí puede partir texto, es la única descriptiva */
#desgloseDetalle tbody td:first-child {
    white-space: normal;
    min-width: 110px;
    font-weight: 600;
    color: var(--primary-color);
}

/* Columnas numéricas: alineadas a la derecha */
#desgloseDetalle tbody td:not(:first-child),
#desgloseDetalle thead th:not(:first-child) {
    text-align: right;
}

/* Columna % s/ bruto: ancho mínimo para no cortarse */
#desgloseDetalle thead th:last-child,
#desgloseDetalle tbody td:last-child {
    min-width: 72px;
}

/* Filas alternas */
#desgloseDetalle tbody tr:nth-child(even) {
    background: #f9fafb;
}

/* Fila totales (salario neto) */
#desgloseDetalle tbody tr:last-child td {
    border-bottom: none;
    border-top: 2px solid var(--border-color);
}

.td-neg {
    color: #dc2626;
}

.td-info {
    color: #6b7280;
    font-style: italic;
    font-size: 0.85em;
}

.td-total {
    font-weight: 700;
}

#calcError {
    color: #dc2626;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    font-weight: 600;
}

/* Responsive móvil */
@media (max-width: 479px) {

    #desgloseDetalle table {
        font-size: 0.82rem;
    }

    #desgloseDetalle thead th,
    #desgloseDetalle tbody td {
        padding: 0.5rem 0.55rem;
    }

    /* En móvil la columna CONCEPTO puede ser algo más estrecha */
    #desgloseDetalle tbody td:first-child {
        min-width: 90px;
    }

    /* Ocultar columna MENSUAL en pantallas muy estrechas
       para que CONCEPTO, ANUAL y % s/bruto sean legibles sin scroll */
    #desgloseDetalle thead th:nth-child(3),
    #desgloseDetalle tbody td:nth-child(3) {
        display: none;
    }
}