.table-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--theme-border);
}

[data-table-view-toggle] {
    display: flex;
    gap: 0.25rem;
}

[data-table-pagination] {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

[data-table-pagination] [data-table-page-label] {
    min-width: 6.5rem;
    text-align: center;
}

[data-table-pagination] [data-table-page-size] {
    width: auto;
    min-width: 5.5rem;
}

@media (max-width: 767.98px) {
    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    [data-table-pagination] {
        justify-content: space-between;
        flex-wrap: wrap;
    }

    [data-table-view-toggle] {
        justify-content: flex-end;
    }
}

.table-summary-cell .table-summary-content {
    display: inline-block;
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-table-engine="true"][data-active-view="cards"],
[data-table-engine="true"][data-active-view="cards"] .table-responsive {
    overflow: visible !important;
}

[data-table-engine="true"][data-active-view="cards"] .table-responsive-cards thead {
    display: none;
}

[data-table-engine="true"][data-active-view="cards"] .table-responsive-cards tbody,
[data-table-engine="true"][data-active-view="cards"] .table-responsive-cards tr,
[data-table-engine="true"][data-active-view="cards"] .table-responsive-cards td {
    display: block;
    width: 100%;
}

[data-table-engine="true"][data-active-view="cards"] .table-responsive-cards tr {
    border: 1px solid var(--theme-border);
    border-radius: 0.75rem;
    margin: 0.75rem;
    padding: 0.5rem;
    background: #fff;
    width: calc(100% - 1.5rem);
    box-sizing: border-box;
}

[data-table-engine="true"][data-active-view="cards"] .table-responsive-cards td {
    text-align: right;
    border: none;
    border-bottom: 1px solid var(--theme-border);
    position: relative;
    padding: 0.75rem 0.5rem 0.75rem 45%;
    min-height: 48px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
}

[data-table-engine="true"][data-active-view="cards"] .table-responsive-cards td::before {
    content: attr(data-label);
    position: absolute;
    left: 0.5rem;
    top: 0.875rem;
    font-weight: 600;
    color: var(--theme-text-muted);
    text-align: left;
    white-space: nowrap;
    max-width: calc(45% - 1rem);
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-table-engine="true"][data-active-view="cards"] .table-responsive-cards td:last-child {
    border-bottom: none;
}

[data-table-engine="true"][data-active-view="cards"] .table-responsive-cards .text-end,
[data-table-engine="true"][data-active-view="cards"] .table-responsive-cards .text-center {
    text-align: right !important;
}

[data-table-engine="true"][data-active-view="cards"] .table-responsive-cards .btn-group {
    width: 100%;
    justify-content: flex-end;
}

[data-table-engine="true"][data-active-view="cards"] .table-responsive-cards audio,
[data-table-engine="true"][data-active-view="cards"] .table-responsive-cards midi-player {
    max-width: 100%;
}

[data-table-engine="true"][data-active-view="cards"] .table-responsive-cards .table-summary-cell {
    justify-content: flex-start;
    text-align: left;
}

[data-table-engine="true"][data-active-view="cards"] .table-responsive-cards .table-summary-cell .table-summary-content {
    display: block;
    width: 100%;
    max-width: 100%;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
}

th[data-sort-key] {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

th[data-sort-key]:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.te-sort-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.35rem;
    font-size: 0.8em;
}

.te-sort-order {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    background: rgba(13, 110, 253, 0.12);
    color: var(--bs-primary, #0d6efd);
    font-size: 0.75rem;
    font-weight: 700;
}

.te-sort-icon.te-sort-inactive {
    opacity: 0.35;
}

.te-sort-icon.te-sort-active {
    opacity: 0.9;
}

.table-sort-panel {
    min-width: 18rem;
    max-width: min(22rem, 90vw);
    padding: 0.875rem;
}

.table-sort-panel-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.table-sort-panel-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.table-sort-panel-main,
.table-sort-panel-add {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
}

.table-sort-panel-main {
    flex: 1 1 auto;
}

.table-sort-panel-label {
    flex: 1 1 auto;
    text-align: left;
}

.table-sort-order-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    background: rgba(13, 110, 253, 0.12);
    color: var(--bs-primary, #0d6efd);
    font-size: 0.75rem;
    font-weight: 700;
}

.table-sort-panel-remove {
    flex: 0 0 auto;
}