.grid-view .grid-scroll {
    border: 1px solid #dde4ee;
    border-radius: 6px;
    background-color: #fff;
}

.grid-filter-dropdown {
    width: auto;
    min-width: 100%;
    max-width: min(560px, calc(100vw - 20px));
}

.grid-filter-dropdown .select2-results > .select2-results__options {
    max-height: 60vh;
}

.grid-filter-dropdown .select2-results__option,
.multi-select-filter .select2-selection__choice {
    overflow-wrap: anywhere;
}

.admin-cards > thead > tr.filters .select2-selection--multiple {
    max-height: 78px;
    overflow-y: auto;
}

@media (min-width: 768px) {
    .admin-cards > tbody > tr > td.grid-id:has(> .not-set) {
        white-space: nowrap;
    }

    .admin-cards > thead > tr:not(.filters) > th {
        position: sticky;
        top: var(--sticky-top, 0px);
        z-index: 3;
    }

    .admin-cards > thead > tr.filters > td {
        position: sticky;
        top: calc(var(--sticky-top, 0px) + var(--grid-head-h, 40px) - 1px);
        z-index: 2;
        box-shadow: 0 -32px 0 #e2eaf6;
    }
}

.grid-view .grid-scroll > .table {
    margin-bottom: 0;
    border: 0;
    font-variant-numeric: tabular-nums;
}

.grid-view .table-bordered > thead > tr > th,
.grid-view .table-bordered > thead > tr > td,
.grid-view .table-bordered > tbody > tr > th,
.grid-view .table-bordered > tbody > tr > td {
    border-left: 0;
    border-right: 0;
    border-top-color: #eaeff7;
}

.grid-view .table-bordered > tbody > tr:first-child > td {
    border-top: 0;
}

.admin-cards > thead > tr > th {
    background-color: #c8d6ec;
    border-bottom: 1px solid #aec3de;
    box-shadow: inset 0 -1px 0 #aec3de;
    padding: 9px 12px;
    color: #555555;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
    vertical-align: middle;
    white-space: normal;
}

.admin-cards > thead > tr > th a {
    color: #0f4fb5;
}

.admin-cards > thead > tr > th a:hover,
.admin-cards > thead > tr > th a:focus {
    color: #0b3f95;
}

.admin-cards > thead > tr > th.grid-id,
.admin-cards > thead > tr.filters > td.grid-id,
.admin-cards > tbody > tr > td.grid-id {
    width: 1%;
}

.admin-cards > tbody > tr > td.grid-id {
    overflow-wrap: normal;
}

.admin-cards > thead > tr > th.grid-actions,
.admin-cards > tbody > tr > td.grid-actions {
    width: 1%;
    white-space: nowrap;
}

.admin-cards > thead > tr.filters > td {
    background-color: #e2eaf6;
    border-bottom: 1px solid #c9d8ea;
    padding: 7px 10px;
}

.admin-cards > thead > tr.filters .form-control {
    height: 30px;
    padding: 4px 9px;
    font-size: 13px;
    border-color: #dbe2ec;
    box-shadow: none;
}

.admin-cards > tbody > tr > td {
    padding: 7px 12px;
    color: #29394f;
    vertical-align: middle;
}

.admin-cards.table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: #f6f9fd;
}

.admin-cards > tbody > tr > td {
    transition: background-color .12s ease-out;
}

.admin-cards > tbody > tr:hover > td,
.admin-cards.table-striped > tbody > tr:nth-of-type(odd):hover > td {
    background-color: #e6effc;
}

.admin-cards > tbody > tr:hover > td:first-child {
    box-shadow: inset 3px 0 0 #2f6fed;
}

.admin-cards > tbody > tr > td:last-child a + a {
    margin-left: 7px;
}

.grid-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 16px;
    margin-top: 14px;
}

.grid-foot:empty {
    display: none;
}

.grid-view .summary {
    margin: 0 0 0 auto;
    color: #7b8a9c;
    font-size: 13px;
}

.grid-view .pagination {
    margin: 0;
}

.wrap > .container-fluid > div:has(> h1 + p .btn) {
    display: grid;
    grid-template-columns: minmax(min(100%, 340px), 1fr) minmax(0, auto);
    align-items: center;
    gap: 14px 20px;
}

.wrap > .container-fluid > div:has(> h1 + p .btn) > * {
    grid-column: 1 / -1;
    min-width: 0;
}

.wrap > .container-fluid > div:has(> h1 + p .btn) > h1 {
    grid-column: 1;
    margin: 0;
}

.wrap > .container-fluid > div:has(> h1 + p .btn) > h1 + p {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    grid-column: 2;
    justify-self: end;
    margin: 0;
}

.grid-view .empty {
    padding: 18px 12px;
    color: #7b8a9c;
}

.grid-filters-toggle {
    display: none;
}

.detail-view {
    max-width: 1100px;
    margin-bottom: 20px;
    border: 1px solid #dde4ee;
    border-radius: 6px;
    background-color: #fff;
    font-variant-numeric: tabular-nums;
    table-layout: fixed;
}

.detail-view.table-bordered > tbody > tr > th,
.detail-view.table-bordered > tbody > tr > td {
    padding: 9px 14px;
    border-left: 0;
    border-right: 0;
    border-top-color: #eaeff7;
    vertical-align: top;
}

.detail-view.table-bordered > tbody > tr:first-child > th,
.detail-view.table-bordered > tbody > tr:first-child > td {
    border-top: 0;
}

.detail-view > tbody > tr > th {
    width: 280px;
    background-color: #c8d6ec;
    color: #33425a;
    font-size: 13px;
    font-weight: 600;
}

.detail-view > tbody > tr > td {
    background-color: #fff;
    color: #29394f;
}

.detail-view > tbody > tr:first-child > th {
    border-top-left-radius: 5px;
}

.detail-view > tbody > tr:first-child > td {
    border-top-right-radius: 5px;
}

.detail-view > tbody > tr:last-child > th {
    border-bottom-left-radius: 5px;
}

.detail-view > tbody > tr:last-child > td {
    border-bottom-right-radius: 5px;
}

.detail-view > tbody > tr > td,
.detail-view > tbody > tr > th,
.admin-cards > tbody > tr > td {
    overflow-wrap: break-word;
}

.admin-cards > thead > tr > th.grid-wide,
.admin-cards > tbody > tr > td.grid-wide {
    min-width: 240px;
}

@media (max-width: 767px) {
    .grid-filter-dropdown {
        position: fixed !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
    }

    .grid-view .grid-scroll {
        border: 0;
        border-radius: 0;
        background: none;
        overflow-x: visible;
    }

    .grid-view .grid-scroll > .table,
    .admin-cards,
    .admin-cards > tbody,
    .grid-view .table > tbody,
    .admin-cards > tbody > tr,
    .admin-cards > tbody > tr > td {
        display: block;
        width: auto;
    }

    .admin-cards > thead > tr > th.grid-id,
    .admin-cards > thead > tr > th.grid-actions,
    .admin-cards > thead > tr.filters > td.grid-id,
    .admin-cards > tbody > tr > td.grid-id,
    .admin-cards > tbody > tr > td.grid-actions {
        width: auto;
    }

    .admin-cards > thead > tr:not(.filters) {
        display: flex;
        gap: 6px;
        margin-bottom: 10px;
        padding-bottom: 2px;
        overflow-x: auto;
        white-space: nowrap;
    }

    .admin-cards > thead > tr:not(.filters) > th {
        display: none;
    }

    .admin-cards > thead > tr:not(.filters) > th:has(a[data-sort]) {
        display: block;
        flex: 0 0 auto;
        width: auto;
        padding: 0;
        border: 0;
        box-shadow: none;
        background: none;
        white-space: nowrap;
    }

    .admin-cards > thead > tr:not(.filters) > th > a[data-sort] {
        display: block;
        padding: 6px 11px;
        border: 1px solid #dbe2ec;
        border-radius: 999px;
        background-color: #fafbfe;
        color: #4a5b70;
        font-size: 12px;
        font-weight: 600;
    }

    .admin-cards > thead > tr:not(.filters) > th > a.asc,
    .admin-cards > thead > tr:not(.filters) > th > a.desc {
        border-color: #b9cdf0;
        background-color: #e6effc;
        color: #2f6fed;
    }

    .admin-cards > tbody > tr {
        margin-bottom: 10px;
        border: 1px solid #dde4ee;
        border-radius: 6px;
        background-color: #fff;
        overflow: hidden;
    }

    .admin-cards > tbody > tr > td,
    .admin-cards.table-striped > tbody > tr:nth-of-type(odd) > td {
        display: flex;
        gap: 12px;
        align-items: baseline;
        padding: 8px 12px;
        border-top: 0;
        border-bottom: 1px solid #f0f3f8;
        background-color: transparent;
        white-space: normal;
    }

    .admin-cards > tbody > tr > td:last-child {
        border-bottom: 0;
    }

    .admin-cards > tbody > tr > td[data-label]::before {
        content: attr(data-label);
        flex: 0 0 38%;
        color: #7b8a9c;
        font-size: 12px;
        font-weight: 600;
        line-height: 1.5;
    }

    .admin-cards > tbody > tr > td:not([data-label]) {
        display: none;
    }

    .admin-cards > tbody > tr:hover > td,
    .admin-cards.table-striped > tbody > tr:nth-of-type(odd):hover > td {
        background-color: transparent;
    }

    .admin-cards > tbody > tr:hover > td:first-child {
        box-shadow: none;
    }

    .admin-cards > tbody > tr > td:empty {
        display: none;
    }

    .grid-filters-toggle {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        margin: 0 0 10px;
        padding: 6px 12px;
        border: 1px solid #dbe2ec;
        border-radius: 6px;
        background-color: #fafbfe;
        color: #4a5b70;
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
    }

    .admin-cards > thead {
        display: block;
    }

    .admin-cards > thead > tr.filters {
        display: none;
    }

    .grid-filters-toggle input {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        border: 0;
        overflow: hidden;
        clip-path: inset(50%);
    }

    .grid-filters-toggle::after {
        content: '';
        width: 0;
        height: 0;
        margin-top: 2px;
        border: 4px solid transparent;
        border-top-color: currentColor;
        transition: transform .15s ease-out;
    }

    .grid-filters-toggle:has(input:focus-visible) {
        outline: 2px solid #2f6fed;
        outline-offset: 1px;
    }

    .grid-filters-toggle:has(input:checked) {
        border-color: #b9cdf0;
        background-color: #e6effc;
        color: #2f6fed;
    }

    .grid-filters-toggle:has(input:checked)::after {
        margin-top: -2px;
        transform: rotate(180deg);
    }

    .grid-filters-toggle:has(input:checked) ~ .grid-scroll .admin-cards > thead > tr.filters {
        display: block;
        max-height: 42vh;
        margin-bottom: 12px;
        padding: 6px 0;
        overflow-y: auto;
        border: 1px solid #c9d8ea;
        border-radius: 6px;
        background-color: #e2eaf6;
    }

    .admin-cards > thead > tr.filters > td {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 4px 10px;
        border: 0;
        background: none;
    }

    .admin-cards > thead > tr.filters > td[data-label]::before {
        content: attr(data-label);
        flex: 0 0 38%;
        color: #556376;
        font-size: 12px;
        font-weight: 600;
    }

    .admin-cards > thead > tr.filters .form-control,
    .admin-cards > thead > tr.filters .select2-container {
        flex: 1 1 auto;
        min-width: 0;
    }

    .admin-cards > thead > tr.filters .multi-select-filter,
    .admin-cards > thead > tr.filters .select2-container {
        width: auto !important;
    }

    .admin-cards > thead > tr.filters .multi-select-filter {
        flex: 1 1 auto;
        min-width: 0;
    }

    .admin-cards > thead > tr.filters .select2-search--inline,
    .admin-cards > thead > tr.filters .select2-search--inline .select2-search__field {
        width: 100% !important;
        min-width: 0;
    }

    .admin-cards > thead > tr.filters > td:not([data-label]) {
        display: none;
    }

    .detail-view {
        table-layout: fixed;
        width: 100%;
    }

    .detail-view > tbody > tr > th {
        width: 40%;
    }

    .wrap p:has(> .btn) {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .wrap > .container-fluid > div:has(> h1 + p .btn) {
        grid-template-columns: minmax(0, 1fr);
    }

    .wrap > .container-fluid > div:has(> h1 + p .btn) > h1 + p {
        grid-column: 1;
        justify-content: flex-start;
        justify-self: start;
    }

    .admin-cards > thead > tr > th.grid-wide,
    .admin-cards > tbody > tr > td.grid-wide {
        min-width: 0;
    }
}
