/* Keep the DataTables body as the only scroll owner, including on mobile. */
.table-responsive.table-responsive-datatable {
    overflow: visible !important;
}

.cb-table-layout-wrapper {
    min-width: 0;
    max-width: 100%;
}

.cb-table-layout-wrapper > .dataTables_scroll > .dataTables_scrollBody {
    min-height: 0;
    scrollbar-width: thin;
}

/* Cell padding and wrapping belong to the theme and page-specific classes. */

/* Bound only enhanced modal tables; do not resize the dialog or its forms. */
.modal .cb-table-layout-wrapper > .dataTables_scroll > .dataTables_scrollBody {
    max-height: min(40vh, 320px) !important;
}

.modal .table-responsive.table-responsive-datatable {
    overflow: auto !important;
}

@media print {
    .table-responsive-datatable,
    .modal .table-responsive.table-responsive-datatable,
    .cb-table-layout-wrapper,
    .cb-table-layout-wrapper > .dataTables_scroll,
    .cb-table-layout-wrapper > .dataTables_scroll > .dataTables_scrollBody,
    .modal .cb-table-layout-wrapper > .dataTables_scroll > .dataTables_scrollBody {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    /* Print the original table sections, not the separate scrolling clones. */
    .cb-table-layout-wrapper > .dataTables_scroll > .dataTables_scrollHead,
    .cb-table-layout-wrapper > .dataTables_scroll > .dataTables_scrollFoot {
        display: none !important;
    }

    .cb-table-layout-wrapper .dataTables_scrollBody > table.dataTable > thead > tr > th,
    .cb-table-layout-wrapper .dataTables_scrollBody > table.dataTable > tfoot > tr > th,
    .cb-table-layout-wrapper .dataTables_scrollBody > table.dataTable > tfoot > tr > td,
    .cb-table-layout-wrapper .dataTables_scrollBody > table.dataTable > thead > tr > th > .dataTables_sizing,
    .cb-table-layout-wrapper .dataTables_scrollBody > table.dataTable > tfoot > tr > td > .dataTables_sizing,
    .cb-table-layout-wrapper .dataTables_scrollBody > table.dataTable > tfoot > tr > th > .dataTables_sizing {
        height: auto !important;
        overflow: visible !important;
        padding: 0.4rem 0.9rem !important;
    }
}
