:root {
    --odata-grid-panel-top: 0px;
    --odata-grid-panel-left: 0px;
}

.mud-popover.mud-popover-open.mud-popover-top-left.mud-popover-anchor-top-left.mud-popover-overflow-flip-always.mud-paper.mud-elevation-4.overflow-y-auto.filters-panel.pa-2 {
    position: fixed;
    top: var(--odata-grid-panel-top) !important;
    left: var(--odata-grid-panel-left) !important;
    max-height: 50vh !important;
    overflow-y: auto;
    z-index: 3099 !important;
}

.mud-popover.mud-popover-open.mud-popover-top-left.mud-popover-anchor-top-left.mud-popover-overflow-flip-always.mud-paper.mud-elevation-4.overflow-y-auto.mud-data-grid-columns-panel.px-2 {
    position: fixed;
    top: var(--odata-grid-panel-top) !important;
    left: var(--odata-grid-panel-left) !important;
    max-height: 50vh !important;
    overflow-y: auto;
}

div.odata-grid {
    overflow: unset !important;
}

    div.odata-grid > div.mud-table-container {
        overflow: auto !important;
        width: unset !important;
        background-color: inherit;
    }

        div.odata-grid > div.mud-table-container > div.mud-drop-container {
            width: max-content;
            min-width: 100%;
            background-color: inherit;
        }

            div.odata-grid > div.mud-table-container > div.mud-drop-container > table.mud-table-root {
                background-color: inherit;
            }

                div.odata-grid > div.mud-table-container > div.mud-drop-container > table.mud-table-root > tbody.mud-table-body {
                    background-color: inherit;
                }

                    div.odata-grid > div.mud-table-container > div.mud-drop-container > table.mud-table-root > tbody.mud-table-body > tr {
                        background-color: inherit;
                    }

.mud-data-grid .mud-table-cell .mud-resizer:hover, .mud-data-grid .mud-table-cell .mud-resizing {
    cursor: col-resize;
    margin-top: -17px; /*Need a better solution for this. When grid overflows on the x-axis, resizing the column causes a y-scrollbar to appear.
                        This is due to MudBlazor's JS not considering whether or not a horizontal scrollbar is present within the data grid.
                        Drawbacks of this approach are: 
                        1. Magic Number--not all scrollbars are created equal and 
                        2. This doesn't happen when there's no overflow-x, so we're left with a 17px gap at the bottom of the grid.*/
}


/*#region Grid Row Striping Fix */

/*This fixes the rows jumping when a table loader is present since MudBlazor inserts it as a tr in the tbody.*/
/*Sadly 'nth-child(even of .mud-table-row)' can't be used because of an oversight in minification producing invalid css 'nth-child(evenof.mud-table-row)'.*/
div.odata-grid div.mud-table-container div.mud-drop-container table.mud-table-root tbody.mud-table-body > tr:has(td.mud-table-loading) ~ tr:nth-child(even) {
    background-color: var(--custom-palette-odata-background)
}

div.odata-grid div.mud-table-container div.mud-drop-container table.mud-table-root tbody.mud-table-body > tr:has(td.mud-table-loading) ~ tr:nth-child(odd) {
    background-color: unset
}

div.odata-grid div.mud-table-container div.mud-drop-container table.mud-table-root tbody.mud-table-body > tr:nth-child(odd) {
    background-color: var(--custom-palette-odata-background)
}

/*#endregion */

div.odata-grid.total-row-grid div.mud-table-container div.mud-drop-container table.mud-table-root tbody.mud-table-body > tr:last-of-type {
    background-color: var(--custom-palette-odata-background);
    position: sticky;
    bottom: 0;
    z-index: 1;
}

    div.odata-grid.total-row-grid div.mud-table-container div.mud-drop-container table.mud-table-root tbody.mud-table-body > tr:last-of-type > td:first-of-type::before {
        position: absolute;
        content: 'Total';
        top: 10px;
        z-index: 1;
    }

div.odata-grid .mud-toolbar.mud-toolbar-gutters.mud-table-toolbar {
    padding-left: unset;
    padding-inline-start: unset;
    background-color: var(--custom-palette-odata-background);
    height:fit-content;
}

    div.odata-grid .mud-toolbar.mud-toolbar-gutters.mud-table-toolbar .mud-menu {
        padding-left: 10px;
        padding-right: 8px;
        order: -1;
    }

div.odata-grid div.mud-table-container > div > table > thead {
    position: sticky;
    top: 0px;
    z-index: 2;
    background-color: var(--custom-palette-odata-background);
}

div.odata-grid div.mud-table-pagination div.mud-toolbar.mud-toolbar-gutters.mud-table-pagination-toolbar {
    background-color: var(--custom-palette-odata-background);
    padding-left: 16px;
    padding-right: 16px;
}

    div.odata-grid div.mud-table-pagination div.mud-toolbar.mud-toolbar-gutters.mud-table-pagination-toolbar .mud-table-pagination-spacer {
        flex: unset;
    }

    div.odata-grid div.mud-table-pagination div.mud-toolbar.mud-toolbar-gutters.mud-table-pagination-toolbar .mud-select {
        display: block;
        flex-grow: unset;
    }

div.odata-grid > * > .mud-table-cell.invalid-data-format {
    border: 1px solid red;
}

div.odata-grid div.mud-table-container > div > table > * > tr > .sticky-override.mud-table-cell {
    position: sticky;
    z-index: 1;
    background-color: var(--custom-palette-odata-background)
}

div.odata-grid div.mud-table-container > div > table > * > tr > .sticky-left-override.mud-table-cell {
    left: 0;
}

div.odata-grid div.mud-table-container > div > table > * > tr > .sticky-right-override.mud-table-cell {
    right: 0;
}

div.odata-grid >
div.mud-table-container >
div.mud-drop-container >
table.mud-table-root >
tbody.mud-table-body >
tr.mud-table-row.selected-row {
    background-color: var(--custom-palette-omni-blue) !important;
}

div.odata-grid >
div.mud-table-container >
div.mud-drop-container >
table.mud-table-root >
tbody.mud-table-body >
tr.mud-table-row.selected-row:has(td.mud-table-loading) {
    background-color: var(--custom-palette-omni-blue);
}

div.odata-grid.mobile-grid >
div.mud-table-container >
div.mud-drop-container >
table.mud-table-root >
thead.mud-table-head >
tr.mud-table-row >
th.mud-table-cell >
div.mud-drop-zone >
div.mud-drop-item >
span.column-header >
span.column-options >
button.mud-button-root.filter-button {
    display: none;
}

div.odata-grid >
div.mud-table-container >
div.mud-drop-container >
table.mud-table-root >
thead.mud-table-head >
tr.mud-table-row >
th.mud-table-cell >
div.mud-drop-zone >
div.mud-drop-item >
span.column-header >
span.column-options >
button.mud-button-root.sort-direction-icon {
    display: none;
}

div.odata-grid.row-hover-grid >
div.mud-table-container >
div.mud-drop-container >
table.mud-table-root >
tbody.mud-table-body >
tr.mud-table-row:hover {
    background-color: var(--custom-palette-omni-accent);
    cursor: pointer;
}

div.odata-grid >
div.mud-table-container >
div.mud-drop-container >
table.mud-table-root >
tbody.mud-table-body >
tr td {
    border-bottom: unset;
}

div.preferences-autocomplete >
div.mud-list >
div.mud-list-item {
    padding:4px !important
}

div.odata-grid >
div.mud-table-container >
div.mud-drop-container >
table.mud-table-root >
* >
tr.mud-table-row >
td.text-align-right {
    text-align: right;
}

div.odata-grid >
div.mud-table-container >
div.mud-drop-container >
table.mud-table-root >
tbody.mud-table-body >
tr.mud-table-foot,
td.mud-table-foot {
    background-color: #00bbff
}