/* Shared table styling for application pages (Bootstrap 5 / Bootstrap Table). */
main.container {
    --chips-table-border: #e2e8f0;
    --chips-table-accent: #1e3a5f;
}

main .table {
    --bs-table-bg: #ffffff;
    --bs-table-striped-bg: #f8fafc;
    --bs-table-striped-color: #334155;
    --bs-table-hover-bg: #edf7f5;
    --bs-table-hover-color: #0f172a;
    color: #334155;
    border-color: var(--chips-table-border);
    font-size: .9rem;
    line-height: 1.55;
    vertical-align: middle;
    margin-bottom: 0;
    width: 100%;
    table-layout: auto;
}

/* Fill the available width while keeping wide tables in a scrollable viewport. */
main .bootstrap-table,
main .table-responsive {
    width: 100%;
    max-width: 100%;
}

main .bootstrap-table .fixed-table-container .table {
    width: 100%;
    table-layout: auto;
}

main .table > :not(caption) > * > * {
    padding: .9rem 1rem;
    border-bottom-color: var(--chips-table-border);
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
}

main .table > thead > tr > th {
    background: #f1f5f9;
    color: #475569;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .045em;
    text-transform: uppercase;
    vertical-align: middle;
    border-bottom: 1px solid var(--chips-table-border);
}

main .table > :not(:first-child) {
    border-top: 0;
}

main .table > tbody > tr:hover > *,
main .table > tbody > tr:focus-within > * {
    --bs-table-accent-bg: var(--bs-table-hover-bg);
}

main .table > tbody > tr.selected > * {
    --bs-table-accent-bg: #dff2ee;
}

main .table > tbody > tr > th {
    color: #475569;
    font-weight: 600;
}

/* Let descriptive content wrap without making one column dominate the table. */
main .table > tbody > tr > td {
    max-width: 28rem;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
}

main .table > tbody > tr > td span,
main .table > tbody > tr > td a {
    word-break: normal;
}

main .table .btn,
main .table .badge,
main .table time,
main .table .local-datetime {
    white-space: nowrap;
}

main .table-sm > :not(caption) > * > * {
    padding: .65rem .8rem;
}

main .bootstrap-table .fixed-table-container,
main .table-responsive {
    border: 1px solid var(--chips-table-border);
    border-radius: .75rem;
    background: #ffffff;
    box-shadow: 0 3px 12px rgba(15, 23, 42, .04);
}

main .table-responsive {
    margin: 1rem 0;
}

main .bootstrap-table .fixed-table-container .fixed-table-body {
    border-radius: .75rem;
}

main .bootstrap-table .fixed-table-container .table thead th .th-inner {
    padding: .9rem 1rem;
    line-height: 1.5;
}

main .bootstrap-table .fixed-table-container .table thead th .sortable {
    padding-right: 1.9rem;
}

main .bootstrap-table .fixed-table-toolbar {
    padding: .35rem 0 .7rem;
}

main .bootstrap-table .fixed-table-toolbar .search input,
main .bootstrap-table .filter-control input,
main .bootstrap-table .filter-control select {
    min-height: 2.5rem;
    border: 1px solid #cbd5e1;
    border-radius: .5rem;
    background-color: #ffffff;
    font-size: .875rem;
    color: #334155;
}

main .bootstrap-table .fixed-table-toolbar .search input:focus,
main .bootstrap-table .filter-control input:focus,
main .bootstrap-table .filter-control select:focus {
    border-color: var(--chips-table-accent);
    box-shadow: 0 0 0 .2rem rgba(15, 118, 110, .15);
}

main .table .btn,
main .bootstrap-table .fixed-table-toolbar .btn,
main .bootstrap-table .fixed-table-pagination .btn {
    min-height: 2rem;
    border-radius: .5rem;
    font-size: .8125rem;
    font-weight: 600;
    padding: .4rem .8rem;
}

main .table .btn {
    margin: .2rem .25rem .2rem 0;
    white-space: nowrap;
}

main .table .btn-group .btn {
    margin: 0;
}

main .table .btn-group > .btn:not(:last-child):not(.dropdown-toggle) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

main .table .btn-group > .btn:nth-child(n + 3),
main .table .btn-group > :not(.btn-check) + .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

main .table .badge {
    padding: .4em .65em;
    border-radius: .4rem;
    font-weight: 600;
    line-height: 1.3;
}

main .table input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--chips-table-accent);
    vertical-align: middle;
}

main .table a:focus-visible,
main .table input:focus-visible,
main .table-responsive:focus-visible,
main .fixed-table-body:focus-visible {
    outline: 2px solid var(--chips-table-accent);
    outline-offset: 2px;
}

main .bootstrap-table .fixed-table-pagination {
    padding: .75rem .15rem 0;
    color: #64748b;
    font-size: .85rem;
}

main .bootstrap-table .fixed-table-pagination .pagination {
    gap: .3rem;
}

main .bootstrap-table .page-item .page-link {
    border: 1px solid var(--chips-table-border);
    border-radius: .45rem;
    color: #475569;
    padding: .4rem .75rem;
}

main .bootstrap-table .page-item.active .page-link {
    background-color: var(--chips-table-accent);
    border-color: var(--chips-table-accent);
    color: #ffffff;
}

main .bootstrap-table .page-item.disabled .page-link {
    background-color: #f8fafc;
    color: #64748b;
}

main .bootstrap-table .page-item:not(.active):not(.disabled) .page-link:hover {
    background-color: #edf7f5;
    border-color: #99c9c2;
}

main .bootstrap-table .no-records-found td {
    padding: 3rem 1rem;
    color: #64748b;
    text-align: center;
}

@media (max-width: 575.98px) {
    main .table > :not(caption) > * > * {
        padding: .7rem .75rem;
    }

    main .bootstrap-table .fixed-table-toolbar .search {
        width: 100%;
        margin-left: 0;
    }

    main .bootstrap-table .fixed-table-pagination > .pagination-detail,
    main .bootstrap-table .fixed-table-pagination > .pagination {
        float: none !important;
        margin: .5rem 0;
    }

    main .bootstrap-table .fixed-table-pagination .pagination {
        flex-wrap: wrap;
    }
}
