.ert-grid {
    --ert-grid-border: #e4e7ec;
    --ert-grid-muted: #667085;
    --ert-grid-row-hover: #f5f5ff;
    overflow: visible;
}

.dark-style .ert-grid {
    --ert-grid-border: #3d3e5e;
    --ert-grid-muted: #a8a8c5;
    --ert-grid-row-hover: #373852;
}

.ert-grid__header {
    min-height: 72px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--ert-grid-border);
}

.ert-grid__body {
    padding: 2rem 1.5rem 1.25rem;
}

.ert-grid__table-wrap {
    min-height: 180px;
    overflow: visible;
}

.ert-grid__table {
    margin-bottom: 0;
}

.ert-grid__table thead th {
    position: relative;
    padding: .7rem .65rem;
    color: #5d6b82;
    background: #f8f9fb;
    border-bottom: 1px solid #aeb4bc;
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
}

.dark-style .ert-grid__table thead th {
    color: #a8a8c5;
    background: #2f3050;
    border-bottom-color: var(--ert-grid-border);
}

.ert-grid__table tbody td {
    height: 46px;
    padding: .35rem .65rem;
    vertical-align: middle;
    border-bottom-color: #e1e5ea;
    line-height: 1.25;
    white-space: nowrap;
    transition: background-color .15s ease, border-color .15s ease;
}

.ert-grid__table tbody td:first-child {
    border-left: 0px solid transparent;
}

.ert-grid__table tbody tr.ert-grid__row--owner > td {
    background-color: rgba(var(--bs-info-rgb), .08);
}

.ert-grid__table tbody tr.ert-grid__row--tenant > td {
    background-color: rgba(var(--bs-warning-rgb), .08);
}

@media (hover: hover) and (pointer: fine) {
    .ert-grid__table tbody tr:hover > td {
        background-color: var(--ert-grid-row-hover);
    }

    .ert-grid__table tbody tr:hover > td.ert-grid__actions-column {
        background: var(--ert-grid-row-hover);
    }

    .ert-grid__table tbody tr:hover > td:first-child {
        border-left-color: var(--bs-primary);
        box-shadow: none;
    }
}

.ert-grid__table .ert-grid__actions-column {
    position: sticky;
    left: 0;
    width: 104px;
    min-width: 104px;
    text-align: center;
    background: var(--bs-body-bg);
}

.ert-grid__table thead .ert-grid__actions-column {
    z-index: 4;
    background: #f8f9fb;
}

.dark-style .ert-grid__table thead .ert-grid__actions-column {
    background: #2f3050;
}

.ert-grid__table tbody .ert-grid__actions-column {
    z-index: 2;
}

.ert-grid__new-button {
    width: 42px;
    height: 30px;
    padding: 0;
    font-size: 1.15rem;
}

.ert-grid__row-actions .btn {
    width: 38px;
    height: 30px;
    padding-right: 0;
    padding-left: 0;
    color: #7890aa;
    font-size: 1rem;
    line-height: 1;
}

.ert-grid__row-actions .ert-grid__update-button:hover,
.ert-grid__row-actions .ert-grid__update-button:focus-visible {
    color: var(--bs-primary);
}

.ert-grid__row-actions .ert-grid__delete-button:hover,
.ert-grid__row-actions .ert-grid__delete-button:focus-visible {
    color: var(--bs-danger);
    border-color: var(--bs-danger);
}

.ert-grid__column-heading {
    display: flex;
    align-items: center;
    gap: .15rem;
}

.ert-grid__sort,
.ert-grid__filter-toggle {
    border: 0;
    color: inherit;
    background: transparent;
}

.ert-grid__sort {
    display: inline-flex;
    flex: 1;
    align-items: center;
    justify-content: space-between;
    gap: .4rem;
    padding: 0;
    text-align: left;
    font: inherit;
}

.ert-grid__sort:disabled {
    opacity: 1;
}

.ert-grid__sort:not(:disabled):hover,
.ert-grid__sort:not(:disabled):focus-visible,
.ert-grid__filter-toggle:hover,
.ert-grid__filter-toggle:focus-visible {
    color: var(--bs-primary);
}

.ert-grid__sort-icon {
    color: #cfd4dc;
    font-size: 1rem;
}

.ert-grid th.is-sorted .ert-grid__sort-icon {
    color: var(--bs-primary);
}

.ert-grid__filter-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .15rem;
    color: #bdcad8;
    font-size: 1rem;
}

.ert-grid__filter-toggle.is-active {
    color: var(--bs-primary);
}

.ert-grid__filter-panel {
    position: absolute;
    z-index: 1090;
    top: calc(100% - .1rem);
    left: .4rem;
    width: min(260px, calc(100vw - 3rem));
    padding: .85rem;
    color: var(--bs-body-color);
    background: var(--bs-body-bg);
    border: 1px solid var(--ert-grid-border);
    border-radius: .55rem;
    box-shadow: 0 .45rem 1.5rem rgba(34, 48, 62, .16);
    white-space: normal;
}

.ert-grid__filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    margin-top: .75rem;
}

.ert-grid__range-controls {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: .4rem;
}

.ert-grid__range-controls .form-control {
    min-width: 0;
}

.ert-grid__filter-panel:has(.ert-grid__range-controls) {
    width: min(420px, calc(100vw - 3rem));
}

.ert-grid__table thead th:last-child .ert-grid__filter-panel {
    right: .4rem;
    left: auto;
}

.ert-grid__filter-panel--align-right {
    right: .4rem;
    left: auto;
}

.ert-grid__filter-apply {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}

.ert-grid__message {
    height: 150px;
    color: var(--ert-grid-muted);
    text-align: center;
    vertical-align: middle !important;
}

.ert-grid__message .spinner-border {
    margin-right: .5rem;
}

.ert-grid__footer {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto minmax(260px, 1fr);
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
    color: var(--ert-grid-muted);
    font-size: .875rem;
}

.ert-grid__page-size label {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin: 0;
    white-space: nowrap;
}

.ert-grid__page-size-select {
    width: auto;
}

.ert-grid__pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .1rem;
}

.ert-grid__page-button {
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 .55rem;
    color: #566a7f;
    background: transparent;
    border: 1px solid transparent;
    border-radius: .3rem;
}

.ert-grid__page-button:hover:not(:disabled),
.ert-grid__page-button:focus-visible,
.ert-grid__page-button.is-active {
    color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), .08);
    border-color: rgba(var(--bs-primary-rgb), .3);
}

.ert-grid__page-button:disabled {
    color: #a8b0b9;
    cursor: default;
}

.ert-grid-toast-container {
    position: fixed;
    z-index: 2000;
    top: 1.25rem;
    right: 1.25rem;
    display: flex;
    width: min(380px, calc(100vw - 2.5rem));
    flex-direction: column;
    gap: .65rem;
    pointer-events: none;
}

.ert-grid-toast {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .9rem 1rem;
    color: #fff;
    border-radius: .5rem;
    box-shadow: 0 .5rem 1.5rem rgba(34, 48, 62, .22);
    animation: ert-grid-toast-in .2s ease-out;
    pointer-events: auto;
}

.ert-grid-toast i {
    flex: 0 0 auto;
    font-size: 1.25rem;
}

.ert-grid-toast__message {
    min-width: 0;
    flex: 1 1 auto;
}

.ert-grid-toast__close {
    display: inline-flex;
    width: 1.8rem;
    height: 1.8rem;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-left: auto;
    color: #fff;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 50%;
    opacity: .9;
    cursor: pointer;
    transition: background-color .15s ease, box-shadow .15s ease, opacity .15s ease, transform .15s ease;
}

.ert-grid-toast__close i {
    font-size: 1.25rem;
    line-height: 1;
}

.ert-grid-toast__close:hover,
.ert-grid-toast__close:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, .25);
    border-color: rgba(255, 255, 255, .55);
    box-shadow: 0 .2rem .65rem rgba(34, 48, 62, .25);
    opacity: 1;
    transform: scale(1.08);
}

.ert-grid-toast__close:focus-visible {
    outline: 2px solid rgba(255, 255, 255, .9);
    outline-offset: 2px;
}

.ert-grid-toast__close:active {
    transform: scale(.96);
}

.ert-grid-toast--success {
    background: #28a745;
}

.ert-grid-toast--error {
    background: #dc3545;
}

.ert-grid-toast--info {
    background: #566a7f;
}

.ert-grid-toast.is-hiding {
    opacity: 0;
    transform: translateY(-.35rem);
    transition: opacity .2s ease, transform .2s ease;
}

@keyframes ert-grid-toast-in {
    from {
        opacity: 0;
        transform: translateY(-.35rem);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 991.98px) {
    .ert-grid__body {
        padding: 1.25rem 1rem 1rem;
    }

    .ert-grid__table-wrap {
        overflow-x: auto;
    }

    .ert-grid__table .ert-grid__actions-column {
        width: 96px;
        min-width: 96px;
    }

    .ert-grid__row-actions .btn {
        width: 38px;
        height: 34px;
    }

    .ert-grid__footer {
        grid-template-columns: 1fr;
    }

    .ert-grid__pagination {
        justify-content: flex-start;
        overflow-x: auto;
    }
}

@media (max-width: 575.98px) {
    .ert-grid__header {
        min-height: 60px;
    }

    .ert-grid__body {
        padding: 1rem .75rem .75rem;
    }

    .ert-grid__table thead th,
    .ert-grid__table tbody td {
        padding-right: .5rem;
        padding-left: .5rem;
    }

    .ert-grid__footer {
        gap: .75rem;
    }
}
