:root {
    --topbar-height: 72px;
    --app-footer-height: 0px;
    --bottom-nav-height: 0px;
}

html,
body {
    height: auto;
}

.app-content,
#page-content-wrapper,
#page-content-wrapper > main {
    min-height: 0;
}

#page-content-wrapper {
    height: auto;
}

#page-content-wrapper > main {
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - var(--topbar-height, 72px));
}

.app-content {
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    height: auto;
}

.app-main,
.main-content,
.content-wrapper,
.page-content,
.gmt-main,
#page-content-wrapper {
    min-height: calc(100dvh - var(--topbar-height, 72px));
}

.data-page,
.data-page-container,
.table-page-container,
.global-listing-page {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.data-page,
.data-page-container,
.table-page-container {
    min-height: calc(100dvh - var(--topbar-height, 72px) - var(--app-footer-height, 0px) - var(--bottom-nav-height, 0px));
    height: auto;
}

.global-listing-page {
    min-height: 0 !important;
}

.data-card,
.table-card,
.records-card,
.global-listing-page .content-card {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.data-toolbar,
.table-toolbar,
.global-listing-page .filters-section {
    flex: 0 0 auto;
}

.data-results-wrapper,
.table-scroll-wrapper,
.table-pro-wrapper,
.global-listing-page .listing-table-container {
    flex: 1 1 auto;
    min-height: 0;
    overflow: visible;
    display: flex;
    flex-direction: column;
}

.data-page.compact-data-page .data-results-wrapper,
.data-page.compact-data-page .table-scroll-wrapper,
.data-page.compact-data-page .table-pro-wrapper,
.global-listing-page.compact-data-page .listing-table-container {
    min-height: 0;
}

body.advanced-hidden .data-results-wrapper,
body.advanced-hidden .table-scroll-wrapper,
body.advanced-hidden .table-pro-wrapper,
body.advanced-hidden .global-listing-page .listing-table-container {
    min-height: 0;
}

.data-footer,
.table-footer,
.pagination-wrapper,
.table-pagination-wrapper,
.global-listing-page .pagination-wrapper {
    flex: 0 0 auto;
}

@media (max-width: 768px) {
    .data-results-wrapper,
    .table-scroll-wrapper,
    .table-pro-wrapper,
    .global-listing-page .listing-table-container {
        min-height: 0;
    }
}

.container,
.container-fluid,
.page-container {
    max-width: 100% !important;
}

.data-page {
    width: 100%;
}

.data-card {
    width: 100%;
}

.table-pro,
.data-table,
.global-listing-page .listing-table {
    min-width: max-content;
}

.global-listing-page .table-scroll-lock,
.global-listing-page .table-responsive.table-scroll-lock,
.table-pro-wrapper {
    flex: 1 1 auto;
    min-height: 0;
}

.global-listing-page .table-responsive.table-scroll-lock,
.data-results-wrapper .table-responsive,
.table-scroll-wrapper .table-responsive,
.table-pro-wrapper .table-responsive {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto !important;
}

.data-page .table-scroll-lock,
.data-page-container .table-scroll-lock,
.table-page-container .table-scroll-lock,
.global-listing-page .table-scroll-lock {
    height: auto !important;
    min-height: 480px !important;
    max-height: calc(100dvh - 320px) !important;
    overflow-y: auto !important;
    overflow-x: auto !important;
    display: block !important;
}

.global-listing-page .content-card {
    margin-bottom: 0 !important;
}

.global-listing-page .listing-table thead th,
.table-pro thead th {
    position: sticky;
    top: 0;
    z-index: 15;
    background: #f8fafc;
}

.global-listing-page table.listing-table tbody {
    display: table-row-group !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.global-listing-page table.listing-table tbody tr {
    display: table-row !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.global-listing-page table.listing-table tbody td {
    display: table-cell !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.global-listing-page .listing-table tfoot th,
.global-listing-page .listing-table tfoot td {
    position: static !important;
}

.table-pro tfoot th,
.table-pro tfoot td {
    position: static !important;
}

.pagination-wrapper,
.table-pagination-wrapper {
    padding: 10px 14px !important;
}

.pagination-wrapper .pagination {
    margin-bottom: 0 !important;
}

.dataTables_wrapper,
.datatable-wrapper {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.dataTables_scroll,
.datatable-scroll {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.dataTables_scrollBody {
    flex: 1 1 auto;
    min-height: 0 !important;
    max-height: none !important;
}

.data-table-area,
.data-results-wrapper,
.table-scroll-wrapper,
.table-pro-wrapper,
.dataTables_scrollBody,
.global-listing-page .listing-table-container,
.global-listing-page .table-responsive.table-scroll-lock,
.global-listing-page .table-scroll-lock {
    height: auto !important;
    min-height: 520px !important;
    max-height: calc(100dvh - var(--topbar-height, 72px) - 120px) !important;
    overflow-y: auto !important;
    overflow-x: auto !important;
    display: block !important;
}

@media (max-width: 991.98px) {
    .data-table-area,
    .data-results-wrapper,
    .table-scroll-wrapper,
    .table-pro-wrapper,
    .dataTables_scrollBody,
    .global-listing-page .listing-table-container,
    .global-listing-page .table-responsive.table-scroll-lock,
    .global-listing-page .table-scroll-lock {
        min-height: 360px !important;
        max-height: calc(100dvh - var(--topbar-height, 72px) - 140px) !important;
    }
}

.table-pro tbody,
.data-table tbody,
table tbody {
    display: table-row-group !important;
    visibility: visible !important;
    height: auto !important;
}

.table-pro tbody tr,
.data-table tbody tr,
table tbody tr {
    display: table-row !important;
    visibility: visible !important;
    height: 54px !important;
    min-height: 54px !important;
}

/* Shared smooth data-page viewing:
   keep vertical scrolling on the page itself and avoid sticky table parts
   that can overlap headers, pagination, and surrounding content. */
.global-listing-page [data-data-results],
.global-listing-page .data-results-wrapper,
.global-listing-page .table-scroll-wrapper,
.global-listing-page .table-pro-wrapper,
.global-listing-page .listing-table-container,
.global-listing-page .pro-table-zone,
.global-listing-page .pro-data-panel {
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    display: block !important;
}

.global-listing-page .table-scroll-lock,
.global-listing-page .table-responsive.table-scroll-lock,
.global-listing-page .table-responsive.table-scroll-lock.pro-grid-wrapper,
.global-listing-page .pro-grid-wrapper,
.global-listing-page .pro-grid-wrapper.table-scroll-lock {
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto;
    scrollbar-gutter: stable;
    display: block !important;
}

.global-listing-page .listing-table thead th,
.global-listing-page .table-pro thead th,
.global-listing-page .pro-table thead th,
.global-listing-page .pro-grid-table thead th {
    position: static !important;
    top: auto !important;
    z-index: auto !important;
    background: #f8fafc !important;
    white-space: nowrap;
}

.global-listing-page .listing-table td,
.global-listing-page .table-pro td,
.global-listing-page .pro-table td,
.global-listing-page .pro-grid-table td {
    vertical-align: top;
}

.global-listing-page .listing-table .col-actions,
.global-listing-page .listing-table .action-cell,
.global-listing-page .listing-table th:last-child,
.global-listing-page .listing-table td:last-child,
.global-listing-page .table-pro .col-actions,
.global-listing-page .table-pro .action-cell,
.global-listing-page .pro-table .col-actions,
.global-listing-page .pro-table .action-cell,
.global-listing-page .pro-grid-table .action-cell {
    position: static !important;
    right: auto !important;
    z-index: auto !important;
    box-shadow: none !important;
}

@media (max-width: 991.98px) {
    .global-listing-page [data-data-results],
    .global-listing-page .data-results-wrapper,
    .global-listing-page .table-scroll-wrapper,
    .global-listing-page .table-pro-wrapper,
    .global-listing-page .listing-table-container,
    .global-listing-page .pro-table-zone,
    .global-listing-page .pro-data-panel,
    .global-listing-page .table-scroll-lock,
    .global-listing-page .table-responsive.table-scroll-lock,
    .global-listing-page .table-responsive.table-scroll-lock.pro-grid-wrapper,
    .global-listing-page .pro-grid-wrapper,
    .global-listing-page .pro-grid-wrapper.table-scroll-lock {
        min-height: 0 !important;
        max-height: none !important;
    }
}
