/* =========================================================
   9. TABLAS
   ========================================================= */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--ds-ink-900);
    --bs-table-hover-bg: var(--ds-ink-50);
    --bs-table-hover-color: var(--ds-ink-900);
    --bs-table-striped-bg: #FAFBFC;
    --bs-table-striped-color: var(--ds-ink-900);
    --bs-table-border-color: var(--ds-ink-150);
    width: 100%;
    margin-bottom: 0;
    color: var(--ds-ink-900);
    font-size: 13.5px;
    background: transparent;
    border-collapse: separate;
    border-spacing: 0;
}

.table > :not(caption) > * > * {
    padding: 10px 12px;
    border-bottom-width: 0;
    box-shadow: none;
}

.table thead > tr > th,
.table > thead > tr > th,
.table thead > tr > td {
    padding: 10px 12px;
    font-size: var(--ds-text-xs);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    vertical-align: bottom;
    color: var(--ds-ink-600);
    background-color: var(--ds-ink-50);
    border-top: 0;
    border-bottom: 1px solid var(--ds-ink-200);
}

.table thead > tr > th:first-child {
    border-top-left-radius: var(--ds-radius-sm);
}

.table thead > tr > th:last-child {
    border-top-right-radius: var(--ds-radius-sm);
}

.table tbody > tr > td,
.table tbody > tr > th,
.table tfoot > tr > td,
.table tfoot > tr > th {
    padding: 10px 12px;
    vertical-align: middle;
    border-top: 0;
    border-bottom: 1px solid var(--ds-ink-150);
}

.table tbody > tr:last-child > td,
.table tbody > tr:last-child > th {
    border-bottom: 0;
}

.table tfoot > tr > td,
.table tfoot > tr > th {
    font-weight: 600;
    background: var(--ds-ink-50);
    border-top: 1px solid var(--ds-ink-200);
}

.table tbody > tr {
    transition: background-color var(--ds-dur-fast) var(--ds-ease);
}

.table-hover > tbody > tr:hover > *,
table.dataTable tbody > tr:hover > * {
    --bs-table-bg-state: var(--ds-ink-50);
    background-color: var(--ds-ink-50);
}

/* Sin cebra por defecto: divisor + realce al pasar. */
table.dataTable tbody tr.odd,
table.dataTable tbody tr.even,
table.dataTable tbody tr.odd > td,
table.dataTable tbody tr.even > td {
    background-color: transparent;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-bg-type: #FAFBFC;
}

.table-bordered,
.table-bordered > :not(caption) > * > *,
.table-bordered > thead > tr > th,
.table-bordered > tbody > tr > td {
    border-left: 0;
    border-right: 0;
}

.table-bordered {
    border: 1px solid var(--ds-ink-200);
    border-radius: var(--ds-radius-sm);
}

.table-condensed > :not(caption) > * > *,
.table-sm > :not(caption) > * > * {
    padding: 6px 10px;
}

.table td strong {
    font-weight: 600;
}

.table .text-center {
    text-align: center;
}

/* Las primeras columnas de los listados son identidad, carnet o codigo:
   sin salto en el guion. */
table.dataTable tbody td:nth-child(-n+2):not(:has(*)) {
    white-space: nowrap;
}

/* Acciones de fila: botones de icono 32 px sin relleno. */
.table td:has(> .btn),
.table td:has(> form > .btn),
.table td:has(> a.btn) {
    white-space: nowrap;
}

.table td .btn {
    --ds-btn-h: 32px;
    --bs-btn-padding-x: 8px;
    min-width: 32px;
    margin: 0;
    vertical-align: middle;
}

.table td > .btn + .btn,
.table td > .btn + form,
.table td > form + .btn,
.table td > form + form {
    margin-left: 4px;
}

.table td .btn-success,
.table td .btn-info,
.table td .btn-danger,
.table td .btn-warning,
.table td .btn-primary {
    --bs-btn-bg: transparent;
    --bs-btn-border-color: transparent;
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-border-color: transparent;
}

.table td .btn-success {
    --bs-btn-color: var(--ds-success-fill);
    --bs-btn-hover-color: var(--ds-success);
    --bs-btn-hover-bg: var(--ds-success-soft);
    --bs-btn-active-color: var(--ds-success);
    --bs-btn-active-bg: #D3EBDD;
}

.table td .btn-info {
    --bs-btn-color: var(--ds-info-fill);
    --bs-btn-hover-color: var(--ds-info);
    --bs-btn-hover-bg: var(--ds-info-soft);
    --bs-btn-active-color: var(--ds-info);
    --bs-btn-active-bg: #D6E4F5;
}

.table td .btn-danger,
.table td .btn-primary {
    --bs-btn-color: var(--ds-danger-fill);
    --bs-btn-hover-color: var(--ds-danger);
    --bs-btn-hover-bg: var(--ds-danger-soft);
    --bs-btn-active-color: var(--ds-danger);
    --bs-btn-active-bg: #F9D9DA;
}

.table td .btn-warning {
    --bs-btn-color: #A35C00;
    --bs-btn-hover-color: var(--ds-warning);
    --bs-btn-hover-bg: var(--ds-warning-soft);
    --bs-btn-active-color: var(--ds-warning);
    --bs-btn-active-bg: #FCE7C2;
}

/* Botones con texto en celdas conservan su variante con borde. */
.table td .btn:has(> span),
.table td .btn-default,
.table td .btn-secondary {
    --bs-btn-padding-x: 10px;
}

/* =========================================================
   9b. DATATABLES
   ========================================================= */
.dataTables_wrapper {
    padding: 0;
}

.dataTables_wrapper > .row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    row-gap: 8px;
    margin-left: 0;
    margin-right: 0;
}

.dataTables_wrapper > .row > [class*="col-"] {
    padding-left: 0;
    padding-right: 0;
}

.dataTables_wrapper > .row:first-child {
    margin-bottom: 12px;
}

.dataTables_wrapper > .row:last-child {
    margin-top: 12px;
}

.dataTables_length label,
.dataTables_filter label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: var(--ds-text-sm);
    font-weight: 400;
    color: var(--ds-ink-600);
}

.dataTables_length select.form-control,
.dataTables_length select {
    display: inline-block;
    width: auto;
    min-width: 76px;
}

.dataTables_filter {
    text-align: right;
}

.dataTables_filter label {
    justify-content: flex-end;
    width: 100%;
}

.dataTables_filter .input-group {
    width: 280px;
    max-width: 100%;
}

.dataTables_filter input.form-control {
    width: 100%;
    margin: 0;
}

.dataTables_info {
    padding: 0;
    font-size: var(--ds-text-sm);
    color: var(--ds-ink-500);
    font-variant-numeric: tabular-nums;
}

.dataTables_info strong {
    font-weight: 600;
    color: var(--ds-ink-700);
}

.dataTables_paginate {
    display: flex;
    justify-content: flex-end;
}

.dataTables_empty,
table.dataTable td.dataTables_empty {
    padding: 32px 12px;
    text-align: center;
    font-size: var(--ds-text-md);
    color: var(--ds-ink-500);
    background: transparent;
}

table.dataTable {
    margin-top: 0;
    margin-bottom: 0;
}

/* Indicadores de orden en SVG (antes PNG). */
table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc {
    padding-right: 28px;
    cursor: pointer;
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 8px 12px;
}

table.dataTable thead .sorting { background-image: var(--ds-sort-both); }
table.dataTable thead .sorting_asc { background-image: var(--ds-sort-asc); color: var(--ds-ink-900); }
table.dataTable thead .sorting_desc { background-image: var(--ds-sort-desc); color: var(--ds-ink-900); }

table.dataTable thead .sorting:hover {
    color: var(--ds-ink-900);
}

/* =========================================================
   9c. PAGINACION
   ========================================================= */
.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pagination > li {
    display: inline-flex;
    margin: 0;
}

.pagination > li > a,
.pagination > li > span,
.pagination .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    margin: 0;
    padding: 0 10px;
    font-size: var(--ds-text-sm);
    font-weight: 500;
    line-height: 1;
    color: var(--ds-ink-700);
    background: var(--ds-surface);
    border: 1px solid var(--ds-ink-200);
    border-radius: var(--ds-radius-sm);
    font-variant-numeric: tabular-nums;
    transition: background-color var(--ds-dur-fast) var(--ds-ease), border-color var(--ds-dur-fast) var(--ds-ease), color var(--ds-dur-fast) var(--ds-ease);
}

.pagination > li > a:hover,
.pagination > li > a:focus,
.pagination .page-link:hover {
    color: var(--ds-ink-900);
    background: var(--ds-ink-100);
    border-color: var(--ds-ink-300);
    text-decoration: none;
}

.pagination > .active > a,
.pagination > .active > span,
.pagination > .active > a:hover,
.pagination > .active > span:hover,
.pagination > .active > a:focus,
.pagination .page-item.active .page-link {
    color: #FFFFFF;
    background: var(--ds-accent);
    border-color: var(--ds-accent);
}

.pagination > .disabled > a,
.pagination > .disabled > span,
.pagination > .disabled > a:hover,
.pagination .page-item.disabled .page-link {
    color: var(--ds-ink-300);
    background: var(--ds-surface);
    border-color: var(--ds-ink-150);
    pointer-events: none;
}

.pagination > li > a i,
.pagination .page-link i {
    font-size: 11px;
}

/* Absolutely positioned helpers inside a table (.visually-hidden header labels) must stay inside its scroll
   container; otherwise they widen the whole page instead of scrolling with the table. */
.table-responsive { position: relative; }
