/* Shared WHMCS list tables. Keep the controls outside the scrollable data. */
body.th-body .dataTables_wrapper :is(.th-table-toolbar, .th-table-footer) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem 1.25rem;
    padding: .9rem clamp(.875rem, 2vw, 1.375rem);
}

body.th-body .dataTables_wrapper .th-table-toolbar { border-bottom: 1px solid var(--th-border); }
body.th-body .dataTables_wrapper .th-table-footer { border-top: 1px solid var(--th-border); }
body.th-body .dataTables_wrapper :is(.th-table-toolbar, .th-table-footer):empty { display: none; }
body.th-body .dataTables_wrapper .th-table-viewport { min-width: 0; overflow-x: auto; }
body.th-body .dataTables_wrapper .th-table-viewport > table.dataTable { width: 100% !important; min-width: 0; margin: 0 !important; }
body.th-body .table-container:has(.th-table-viewport) { overflow: hidden; }

body.th-body .dataTables_wrapper :is(.th-table-toolbar, .th-table-footer) > :is(.dataTables_info, .dataTables_filter, .dataTables_length, .dataTables_paginate) {
    float: none;
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    text-align: start;
}

body.th-body .dataTables_wrapper .th-table-toolbar > .dataTables_filter,
body.th-body .dataTables_wrapper .th-table-footer > .dataTables_paginate { margin-inline-start: auto; }
body.th-body .dataTables_wrapper :is(.dataTables_filter, .dataTables_length) label { max-width: 100%; margin: 0; }
body.th-body .dataTables_wrapper .dataTables_filter input { width: min(100%, 15rem); padding-inline: .75rem !important; }
body.th-body .dataTables_wrapper .dataTables_length select { min-width: 4rem; }

body.th-body table:is(.table, .table-list, .dataTable) > thead > tr > th {
    padding-block: .85rem !important;
    vertical-align: middle;
}

body.th-body table:is(.table, .table-list, .dataTable) > tfoot > tr > :is(th, td) {
    padding-block: .85rem;
    vertical-align: middle;
}

body.th-body .dataTables_wrapper .dataTables_paginate :is(ul.pagination, span) {
    gap: .25rem;
    margin: 0;
    padding: 0;
}

body.th-body .dataTables_wrapper .dataTables_paginate ul.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Bootstrap applies paginate_button to the list item, not the actual control. */
body.th-body .dataTables_wrapper .dataTables_paginate li.paginate_button {
    display: block;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    opacity: 1;
}

body.th-body .dataTables_wrapper .dataTables_paginate :is(.page-link, a.paginate_button, button.paginate_button) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    min-height: 2.5rem;
    margin: 0;
    padding: .4rem .65rem !important;
    border: 0 !important;
    border-radius: .55rem !important;
    background: transparent !important;
    color: var(--th-text, #f1f4f8) !important;
    box-shadow: none !important;
    line-height: 1.15;
    text-decoration: none;
}

body.th-body .dataTables_wrapper .dataTables_paginate :is(.page-link, a.paginate_button, button.paginate_button):hover {
    background: rgba(255, 255, 255, .075) !important;
}

body.th-body .dataTables_wrapper .dataTables_paginate :is(.page-item.active > .page-link, .paginate_button.current, [aria-current="page"]) {
    background: var(--th-accent, #ff6500) !important;
    color: #16100b !important;
    font-weight: 700;
}

body.th-body .dataTables_wrapper .dataTables_paginate :is(.page-item.disabled > .page-link, .paginate_button.disabled:not(li), [aria-disabled="true"]) {
    background: transparent !important;
    color: var(--th-subtle, #a6adb9) !important;
    opacity: .66;
    pointer-events: none;
}

/* No permanent ring. The visible outline appears only for keyboard focus. */
body.th-body .dataTables_wrapper .dataTables_paginate :is(.page-link, a.paginate_button, button.paginate_button):focus:not(:focus-visible) {
    outline: none !important;
}

body.th-body .dataTables_wrapper :is(.dataTables_paginate a, .dataTables_paginate button, .dataTables_filter input, .dataTables_length select):focus-visible,
body.th-body table:is(.table, .table-list, .dataTable) :is(th[tabindex], a, button, input, select, [role="button"]):focus-visible {
    outline: 2px solid #ffad72 !important;
    outline-offset: 2px !important;
}

body.th-body table:is(.table, .table-list, .dataTable) th[tabindex]:focus-visible { outline-offset: -3px !important; }

@media (max-width: 600px) {
    body.th-body .dataTables_wrapper .th-table-toolbar > .dataTables_filter { flex: 1 1 100%; margin-inline-start: 0; }
    body.th-body .dataTables_wrapper .th-table-toolbar .dataTables_filter label { display: flex; padding: 0; }
    body.th-body .dataTables_wrapper .th-table-toolbar .dataTables_filter input { flex: 1; width: auto; min-width: 0; font-size: 1rem; }
    body.th-body .dataTables_wrapper .dataTables_paginate :is(.page-link, a.paginate_button, button.paginate_button) { min-width: 2.75rem; min-height: 2.75rem; }
}

@media (forced-colors: active) {
    body.th-body .dataTables_wrapper :is(.dataTables_paginate a, .dataTables_paginate button, .dataTables_filter input, .dataTables_length select):focus-visible,
    body.th-body table:is(.table, .table-list, .dataTable) :is(th[tabindex], a, button, input, select, [role="button"]):focus-visible { outline-color: Highlight !important; }
    body.th-body .dataTables_wrapper .dataTables_paginate [aria-current="page"] { text-decoration: underline; }
}
