/* Presentación de tablas y tarjetas de resumen. Solo pantalla: la impresión conserva sus estilos propios. */
@media screen {
    .data-table-wrap {
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 18px rgba(8, 37, 97, 0.06);
        padding-bottom: 0;
    }

    .data-table {
        border-collapse: separate;
        border-spacing: 0;
        font-variant-numeric: tabular-nums;
        color: #1e293b;
    }

    .data-table thead th,
    .pc-window .data-table thead th {
        position: sticky;
        top: 0;
        z-index: 1;
        padding: 0.62rem 0.8rem;
        background: #f6f8fc;
        color: #082561;
        font-weight: 700;
        font-size: 0.66rem;
        letter-spacing: 0.06em;
        border-bottom: 2px solid #dbe3f0;
    }

    .data-table td,
    .pc-window .data-table td {
        padding: 0.6rem 0.8rem;
        border-top: none;
        border-bottom: 1px solid #eef2f7;
        line-height: 1.4;
    }

    .data-table th:not(:last-child),
    .data-table td:not(:last-child) {
        border-right: none;
    }

    .data-table tbody tr:nth-child(2n) td {
        background: #fafbfd;
    }

    .data-table tbody tr:hover td {
        background: #eef3ff;
    }

    .data-table tbody tr:last-child td {
        border-bottom: none;
    }

    .data-table th.pc-col-num,
    .data-table td.pc-col-num {
        text-align: right;
        white-space: nowrap;
    }

    .data-table td.pc-col-num {
        font-weight: 700;
        color: #0f172a;
    }

    .data-table td.pc-col-cod {
        white-space: nowrap;
        color: #475569;
        font-weight: 600;
    }

    .data-table td.pc-col-cod:first-child {
        color: #082561;
        font-weight: 700;
    }

    .data-table td.pc-col-fecha {
        white-space: nowrap;
        color: #334155;
    }

    .data-table td.pc-col-texto {
        min-width: 13rem;
        max-width: 30rem;
        white-space: normal;
    }

    .data-table:has(thead th:nth-child(8)) thead th,
    .pc-window .data-table:has(thead th:nth-child(8)) thead th,
    .data-table:has(thead th:nth-child(8)) td,
    .pc-window .data-table:has(thead th:nth-child(8)) td {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .data-table:has(thead th:nth-child(8)) td.pc-col-texto {
        min-width: 10rem;
    }

    .data-table th.pc-col-acc,
    .data-table td.pc-col-acc {
        text-align: right;
        white-space: nowrap;
    }

    .data-table .btn {
        padding: 0.34rem 0.75rem;
        border-radius: 8px;
        font-size: 0.72rem;
    }

    .data-table .badge-pill {
        padding: 0.14rem 0.5rem;
        border-radius: 999px;
    }

    .stat-box {
        background: #fff;
        border: 1px solid #e2e8f0;
        border-left: 4px solid #4f46e5;
        border-radius: 10px;
        box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(8, 37, 97, 0.05);
    }

    .stat-box:hover {
        transform: none;
        border-color: #c7d2fe;
        border-left-color: #4f46e5;
    }

    .stat-box b {
        background: none;
        -webkit-background-clip: border-box;
        background-clip: border-box;
        color: #082561;
    }
}

/* En pantallas angostas cada fila se muestra como tarjeta con su etiqueta. */
@media screen and (max-width: 640px) {
    .data-table:has(td[data-label]) thead {
        display: none;
    }

    .data-table:has(td[data-label]),
    .data-table:has(td[data-label]) tbody,
    .data-table:has(td[data-label]) tr {
        display: block;
        width: 100%;
    }

    .data-table:has(td[data-label]) tr {
        padding: 0.35rem 0;
        border-bottom: 1px solid #e2e8f0;
    }

    .data-table:has(td[data-label]) td[data-label] {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.75rem;
        padding: 0.32rem 0.8rem;
        border: none;
        text-align: right;
        width: auto;
        max-width: none;
        min-width: 0;
        white-space: normal;
    }

    .data-table:has(td[data-label]) td[data-label]::before {
        content: attr(data-label);
        flex: 0 0 auto;
        font-size: 0.66rem;
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        color: #64748b;
        text-align: left;
    }

    .data-table:has(td[data-label]) tbody tr:nth-child(2n) td,
    .data-table:has(td[data-label]) tbody tr:hover td {
        background: transparent;
    }
}
