table {
    border-collapse: separate;
    min-width: 100%;
    transition: opacity var(--baseAnimationSpeed);
    .form-field {
        margin: 0;
        line-height: 1;
    }
    td, th {
        outline: 0;
        vertical-align: middle;
        position: relative;
        text-align: left;
        padding: 10px;
        border-bottom: 1px solid var(--baseAlt2Color);
        &:first-child {
            padding-left: 20px;
        }
        &:last-child {
            padding-right: 20px;
        }
    }
    th {
        color: var(--txtHintColor);
        font-weight: 600;
        font-size: 1rem;
        user-select: none;
        height: 50px;
        line-height: var(--smLineHeight);
        i {
            font-size: inherit;
        }
    }
    td {
        height: 60px;
        word-break: break-word;
    }

    .min-width {
        width: 1% !important;
        white-space: nowrap;
    }
    .nowrap {
        white-space: nowrap;
    }

    .col-sort {
        $pos: 10px;
        $iconSize: 25px;
        cursor: pointer;
        border-top-left-radius: var(--baseRadius);
        border-top-right-radius: var(--baseRadius);
        padding-right: $iconSize + $pos - 5;
        transition: color var(--baseAnimationSpeed),
                    background var(--baseAnimationSpeed);
        &:after {
            // content: '\ea74';
            content: '\ea4c';
            position: absolute;
            right: $pos;
            top: 50%;
            margin-top: -($iconSize * 0.5);
            line-height: $iconSize;
            height: $iconSize;
            font-family: var(--iconFontFamily);
            font-weight: normal;
            color: var(--txtHintColor);
            opacity: 0;
            transition: color var(--baseAnimationSpeed),
                        opacity var(--baseAnimationSpeed);
        }
        &.sort-desc:after {
            content: '\ea4c';
        }
        &.sort-asc:after {
            content: '\ea76';
        }
        &.sort-active {
            &:after {
                opacity: 1;
            }
        }
        &:hover,
        &:focus-visible {
            background: var(--baseAlt1Color);
            &:after {
                opacity: 1;
            }
        }
        &:active {
            transition-duration: var(--activeAnimationSpeed);
            background: var(--baseAlt2Color);
        }
        &.col-sort-disabled {
            cursor: default;
            background: none;
            &:after {
                display: none;
            }
        }
    }

    .col-header-content {
        display: inline-flex;
        align-items: center;
        flex-wrap: nowrap;
        gap: 5px;
        .txt {
            max-width: 140px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
    }

    // column types
    %minColWidth {
        width: 1% !important;
        white-space: nowrap;
    }
    .col-type-action {
        @extend %minColWidth;
        white-space: nowrap;
        text-align: right;
        color: var(--txtHintColor);
        i {
            display: inline-block;
            vertical-align: top;
            transition: transform var(--baseAnimationSpeed);
        }
    }
    td.col-type-json {
        font-family: monospace;
        font-size: var(--smFontSize);
        line-height: var(--smLineHeight);
        max-width: 300px;
    }
    .col-type-text {
        max-width: 300px;
    }
    .col-type-select {
        min-width: 150px;
    }
    .col-type-email {
        min-width: 120px;
    }
    .col-type-file {
        min-width: 100px;
    }

    // field name specific columns
    td.col-field-id {
        width: 0;
        white-space: nowrap;
    }
    .col-field-created,
    .col-field-updated {
        @extend %minColWidth;
    }

    tr {
        outline: 0;
        background: var(--bodyColor);
        transition: background var(--baseAnimationSpeed);
    }
    tr.row-handle {
        cursor: pointer;
        user-select: none;
        &:focus-visible,
        &:hover,
        &:active {
            background: var(--baseAlt1Color);
            .action-col {
                color: var(--txtPrimaryColor);
                i {
                    transform: translateX(3px);
                }
            }
        }
        &:active {
            transition-duration: var(--activeAnimationSpeed);
        }
    }

    // styles
    &.table-compact {
        td, th {
            height: auto;
        }
    }
    &.table-border {
        border: 1px solid var(--baseAlt2Color);
        tr {
            background: var(--baseColor);
        }
        th {
            background: var(--baseAlt1Color);
        }
        > :last-child > :last-child {
            th, td {
                border-bottom: 0;
            }
        }
    }

    // states
    &.table-loading {
        pointer-events: none;
    }
}

.table-wrapper {
    width: auto;
    padding: 0;
    overflow-x: auto;
    max-width: calc(100% + 2*var(--baseSpacing));
    margin-left: calc(var(--baseSpacing) * -1);
    margin-right: calc(var(--baseSpacing) * -1);
    .bulk-select-col {
        input[type="checkbox"] ~ label {
            opacity: 0.7;
        }
        label:hover,
        label:focus-within,
        input[type="checkbox"]:checked ~ label {
            opacity: 1 !important;
        }
    }
    td, th {
        &:first-child {
            padding-left: calc(var(--baseSpacing) + 3px);
        }
        &:last-child {
            padding-right: calc(var(--baseSpacing) + 3px);
        }
    }

    // horizontal scrolling
    .bulk-select-col,
    .col-type-action {
        position: sticky;
        z-index: 99;
    }
    .bulk-select-col {
        left: 0px;
    }
    .col-type-action {
        right: 0;
    }
    .bulk-select-col,
    .col-type-action {
        background: inherit;
    }
    th.bulk-select-col,
    th.col-type-action {
        background: var(--bodyColor);
    }
}
