/* Solo los listados habilitados explícitamente adoptan las tarjetas. */
.tabla-card__label,
.tabla-card__subject-preview,
.tabla-card__subject-toggle,
.tabla-card-empty,
.tabla-card-sort[hidden] {
    display: none !important;
}

/* Al salir de las tarjetas, el zoom no debe dejar los controles móviles visibles. */
.tabla-card-sort {
    display: none;
}

/* Pie compartido de los listados; los enlaces conservan los filtros del servidor. */
.tabla-paginacion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
    margin-top: 16px;
    padding: 12px 0;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}

.tabla-paginas {
    min-width: 0;
    overflow-x: auto;
}

.tabla-paginas .pagination {
    margin: 0;
}

.tabla-por-pagina {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
}

.tabla-por-pagina label {
    margin: 0;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.tabla-por-pagina #ItemsPerPageList {
    width: 4.8rem;
}

@media screen and (max-width: 991.98px) {
    .tabla-paginas .pagination {
        display: flex;
        flex-wrap: nowrap;
        width: max-content;
        gap: 4px;
        white-space: nowrap;
    }

    .tabla-paginas .pagination > li {
        flex: 0 0 auto;
    }

    .tabla-paginas .pagination > .tabla-page--mobile-hidden {
        display: none !important;
    }

    .tabla-paginas .pagination .page-link {
        min-width: 32px;
        min-height: 36px;
        padding-right: 8px;
        padding-left: 8px;
        margin-left: 0;
        border-radius: 6px;
        text-align: center;
        font-size: 0.85rem;
    }

    .insumos-index .tabla-card-wrapper--ready {
        border: 0;
        border-radius: 0;
        overflow: visible;
    }

    .tabla-card-sort {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin: 8px 0 10px;
        padding: 10px;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        background: #fff;
    }

    .tabla-card-sort__field {
        flex: 2 1 140px;
        min-width: 0;
    }

    .tabla-card-sort__direction {
        flex: 1 1 115px;
        min-width: 0;
    }

    .tabla-card-sort label {
        display: block;
        margin-bottom: 3px;
        color: #475569;
        font-size: 0.8rem;
        font-weight: 600;
    }

    .tabla-card-sort select.form-control {
        width: 100%;
        max-width: 100%;
        min-height: 38px;
    }

    .tabla-card-sort .select2-container {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Mayor especificidad que Site.css, incluidas sus filas alternas y hover. */
    .container table.table.tabla-adaptable--ready {
        display: block;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        table-layout: auto;
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        white-space: normal;
    }

    /* Los encabezados siguen asociados a sus celdas para lectores de pantalla. */
    table.tabla-adaptable--ready > thead {
        position: absolute;
        width: 1px !important;
        min-width: 0 !important;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        clip-path: inset(50%);
        white-space: nowrap;
        border: 0;
    }

    .container table.table.tabla-adaptable--ready > tbody {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .container table.table.tabla-adaptable--ready > tbody > tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 8px 12px;
        width: 100%;
        min-width: 0;
        margin: 0 0 10px;
        padding: 12px;
        border: 1px solid #dce5ee;
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 3px 10px rgba(15, 23, 42, 0.04);
    }

    .container table.table.tabla-adaptable--ready > tbody > tr.tabla-card--muted {
        background: #edf0f3;
        border-color: #cbd5e1;
    }

    .container table.table.tabla-adaptable--ready > tbody > tr > td {
        display: block;
        float: none;
        order: 3;
        grid-column: 1 / -1;
        width: auto !important;
        min-width: 0 !important;
        max-width: 100%;
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
        color: #334155;
        font-size: 0.95rem !important;
        line-height: 1.35;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .tabla-adaptable--ready .tabla-card__label {
        display: block !important;
        margin-bottom: 1px;
        color: #64748b;
        font-size: 0.73rem;
        font-weight: 600;
        line-height: 1.35;
    }

    .tabla-adaptable--ready .tabla-card__value,
    .tabla-adaptable--ready .tabla-card__value > * {
        min-width: 0;
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .tabla-adaptable--ready .tabla-card__value .preline {
        white-space: pre-line;
    }

    .container table.table.tabla-adaptable--ready .tabla-card__subject .tabla-caracteristicas {
        font-size: inherit;
        line-height: inherit;
        white-space: pre-line;
    }

    #tableSolicitud.tabla-adaptable--ready .tabla-card__title .solicitud-oficio {
        font-size: inherit;
    }

    .container table.table.tabla-adaptable--ready > tbody > tr > .tabla-card__title {
        order: 0;
        grid-column: 1 / -1;
        font-size: 1.05rem !important;
        font-weight: 700;
        align-self: start;
    }

    .container table.table.tabla-adaptable--ready > tbody > tr.tabla-card--has-status > .tabla-card__title {
        grid-column: 1;
    }

    .container table.table.tabla-adaptable--ready > tbody > tr > .tabla-card__status {
        order: 1;
        grid-column: 2;
        align-self: start;
    }

    .container table.table.tabla-adaptable--ready > tbody > tr > .tabla-card__subject {
        order: 4;
        padding: 8px 0 0;
        border-top: 1px solid #edf2f7;
        color: #475569 !important;
        font-size: 0.78rem !important;
        line-height: 1.45;
    }

    .container table.table.tabla-adaptable--ready > tbody > tr > .tabla-card__field {
        grid-column: auto;
    }

    .container table.table.tabla-adaptable--ready > tbody > tr > .tabla-card__field--wide {
        grid-column: 1 / -1;
    }

    .tabla-adaptable--ready .tabla-card__subject-preview {
        display: inline !important;
    }

    .tabla-adaptable--ready .tabla-card__subject-toggle {
        display: flex !important;
        align-items: center;
        gap: 7px;
        width: max-content;
        min-height: 32px;
        margin: 2px 0 0 auto;
        padding: 4px 1px;
        border: 0;
        border-radius: 2px;
        background: transparent;
        color: #475569;
        font-size: 0.78rem;
        font-weight: 600;
        line-height: 1.3;
        text-decoration: none;
        cursor: pointer;
    }

    .tabla-adaptable--ready .tabla-card__subject-toggle::after {
        content: '';
        width: 6px;
        height: 6px;
        margin-top: -3px;
        border-right: 1.5px solid currentColor;
        border-bottom: 1.5px solid currentColor;
        transform: rotate(45deg);
    }

    .tabla-adaptable--ready .tabla-card__subject-toggle[aria-expanded="true"]::after {
        margin-top: 3px;
        transform: rotate(225deg);
    }

    .tabla-adaptable--ready .tabla-card__subject-toggle:hover {
        color: #1e293b;
        text-decoration: underline;
        text-underline-offset: 3px;
    }

    .tabla-adaptable--ready .tabla-card__value:not(.is-expanded) > .tabla-card__subject-full,
    .tabla-adaptable--ready .tabla-card__value.is-expanded > .tabla-card__subject-preview {
        display: none !important;
    }

    .container table.table.tabla-adaptable--ready > tbody > tr > .tabla-card__actions {
        order: 5;
        padding-top: 8px;
        border-top: 1px solid #e2e8f0;
        min-width: 0;
        max-width: 100%;
    }

    .container table.table.tabla-adaptable--ready .tabla-card__actions > .tabla-card__value,
    .container table.table.tabla-adaptable--ready .insumos-actions-grid,
    .container table.table.tabla-adaptable--ready .solicitud-acciones {
        display: flex;
        flex-wrap: wrap;
        align-items: stretch;
        justify-content: flex-end;
        gap: 6px;
        width: 100%;
    }

    .tabla-adaptable--ready .tabla-card__actions > .tabla-card__label {
        display: none !important;
    }

    .container table.table.tabla-adaptable--ready .tabla-card__actions .btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0;
        flex: 0 1 auto;
        width: 44px;
        min-width: 44px;
        max-width: 100%;
        min-height: 44px;
        height: auto;
        margin: 0;
        padding: 10px;
        font-size: 1rem;
        line-height: 1.3;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .tabla-adaptable--ready .btn:focus-visible,
    .tabla-adaptable--ready .tabla-card__subject-toggle:focus-visible,
    .tabla-card-sort .select2-selection:focus-visible,
    .tabla-card-sort select:focus-visible {
        outline: 3px solid #2266a8;
        outline-offset: 3px;
    }

    .tabla-card-empty {
        display: block !important;
        padding: 20px;
        border: 1px solid #dce5ee;
        border-radius: 12px;
        color: #64748b;
        text-align: center;
        background: #fff;
    }
}

@media screen and (max-width: 767.98px) {
    .tabla-paginacion {
        align-items: stretch;
        flex-direction: column;
    }

    .tabla-por-pagina {
        justify-content: space-between;
    }
}

@media print {
    .tabla-card-sort {
        display: none !important;
    }
}
