/* Elite admin surfaces. Light and dark share the same shapes; --mx-* supplies the color. ESS stays on its own chrome. */

html[data-mx-theme="light"] {
    --mx-nav-accent: #f7a833;
}

html[data-mx-theme="dark"] {
    --mx-nav-accent: #6d83ff;
}

html[data-mx-theme="dark"] body:not(.ess-page) {
    background: var(--mx-bg);
    color: var(--mx-text);
}

html[data-mx-theme="dark"] body.popup:not(.ess-page) {
    background: var(--mx-surface);
}

/* Page card. Home and the bare login layout keep their own canvas. */
html[data-mx-theme] body:not(.ess-page):not(.popup):not(.minimal-admin):not(:has(#admin-home)) #content {
    background-color: var(--mx-surface);
    border: 1px solid var(--mx-hair);
    border-radius: 16px;
    box-shadow: var(--mx-shadow);
}

html[data-mx-theme="dark"] body:not(.ess-page):not(.popup):not(.minimal-admin):not(:has(#admin-home)) #content {
    color: var(--mx-text);
}

html[data-mx-theme="dark"] body.popup:not(.ess-page) #content {
    background-color: var(--mx-surface);
    color: var(--mx-text);
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

html[data-mx-theme] body:not(.ess-page):not(.popup) .section-header.sticky {
    background: var(--mx-glass-strong);
    border-bottom: 1px solid var(--mx-hair);
    box-shadow: none;
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    backdrop-filter: blur(20px) saturate(160%);
}

html[data-mx-theme="dark"] body:not(.ess-page) .section-header,
html[data-mx-theme="dark"] body:not(.ess-page) .section-header .title,
html[data-mx-theme="dark"] body:not(.ess-page) .section-header .title a:not(.btn):not(.k-button) {
    color: var(--mx-text);
}

/* Side menus. The definition rail keeps bg-side.jpg; the employee card stays a surface. */
html[data-mx-theme] body:not(.ess-page) .detailed-sidebar {
    background-color: var(--mx-sidebar-bg);
    background-image: none;
}

html[data-mx-theme="dark"] body:not(.ess-page) .sidebar-left,
html[data-mx-theme="dark"] body:not(.ess-page) .detailed-sidebar {
    color: var(--mx-text);
}

html[data-mx-theme] body:not(.ess-page) .detailed-sidebar > .dcw,
html[data-mx-theme] body:not(.ess-page) .detailed-sidebar > .dcw .entity,
html[data-mx-theme] body:not(.ess-page) .detailed-sidebar > .dcw .entity::before,
html[data-mx-theme] body:not(.ess-page) .detailed-sidebar > .empty,
html[data-mx-theme] body:not(.ess-page) .detailed-sidebar > .spinner.active {
    background: var(--mx-surface);
}

html[data-mx-theme="dark"] body.has-left-sidebar:not(.ess-page) .sidebar-left {
    position: relative;
    background-position: -720px -70px;
}

html[data-mx-theme="dark"] body.has-left-sidebar:not(.ess-page) .sidebar-left::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: rgba(6, 10, 24, .7);
}

html[data-mx-theme="dark"] body:not(.ess-page) .sidebar-left > .menu.tabbable {
    position: relative;
    z-index: 1;
    background: var(--mx-surface);
    border: 1px solid var(--mx-hair);
    border-top-left-radius: 0.3rem;
    border-bottom-left-radius: 0.3rem;
    box-shadow: none;
}

html[data-mx-theme="dark"] body:not(.ess-page) .sidebar-left > .menu.tabbable,
html[data-mx-theme="dark"] body:not(.ess-page) .detailed-sidebar > .dcw,
html[data-mx-theme="dark"] body:not(.ess-page) .detailed-sidebar > .dcw .entity,
html[data-mx-theme="dark"] body:not(.ess-page) .detailed-sidebar > .empty {
    color: var(--mx-text);
}

html[data-mx-theme] body:not(.ess-page) .detailed-sidebar > .dcw {
    border: 1px solid var(--mx-hair);
    border-radius: 16px;
}

html[data-mx-theme="dark"] body:not(.ess-page) .sidebar-left .nav-tabs-line {
    border-right-color: var(--mx-hair-strong);
}

html[data-mx-theme] body:not(.ess-page) .detailed-sidebar > .dcw::after {
    display: none;
}

html[data-mx-theme] body:not(.ess-page) .detailed-sidebar > .dcw .employee .employee-img::after {
    border-color: var(--mx-surface);
    background-color: var(--mx-surface);
}

html[data-mx-theme="dark"] body:not(.ess-page) .sidebar-left .nav-item {
    width: auto;
    margin-inline: 6px;
}

html[data-mx-theme="dark"] body:not(.ess-page) .sidebar-left .nav-link,
html[data-mx-theme="dark"] body:not(.ess-page) .tabs-left > .nav-aside > .nav-tabs-line .nav-link {
    border-radius: 12px;
}

html[data-mx-theme="dark"] body:not(.ess-page) .sidebar-left .nav-link,
html[data-mx-theme="dark"] body:not(.ess-page) .tabs-left > .nav-aside > .nav-tabs-line .nav-link {
    color: var(--mx-muted);
}

html[data-mx-theme="dark"] body:not(.ess-page) .tabs-left > .nav-aside > .nav-tabs-line .nav-link.active,
html[data-mx-theme="dark"] body:not(.ess-page) .tabs-left > .nav-aside > .nav-tabs-line .nav-link.active:focus,
html[data-mx-theme="dark"] body:not(.ess-page) .tabs-left > .nav-aside > .nav-tabs-line .nav-item.open .nav-link,
html[data-mx-theme="dark"] body:not(.ess-page) .sidebar-left .nav-link.active {
    background: var(--mx-chip-strong);
    border-color: transparent;
    border-inline-start: 2px solid var(--mx-nav-accent);
    border-radius: 12px;
}

/* Same horizontal crop as the header, plus the header's bottom wash, so the photo in the margin meets the header as one color. Square the menu corner so it stays the menu background. */
html[data-mx-theme="light"] body.has-left-sidebar:not(.ess-page) .sidebar-left {
    position: relative;
    background-position: -720px -70px;
}

html[data-mx-theme="light"] body.has-left-sidebar:not(.ess-page) .sidebar-left::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: rgba(12, 36, 88, .7);
}

html[data-mx-theme="light"] body:not(.ess-page) .sidebar-left > .menu.tabbable {
    position: relative;
    z-index: 1;
    border-top-left-radius: 0.3rem;
    border-bottom-left-radius: 0;
}

html[data-mx-theme="light"] body:not(.ess-page) .sidebar-left .nav-item {
    width: 101%;
    margin-inline: 0;
}

html[data-mx-theme="light"] body:not(.ess-page) .sidebar-left .nav-link {
    border-radius: 0;
    background-color: transparent;
}

html[data-mx-theme="light"] body:not(.ess-page) .sidebar-left .nav-link.active,
html[data-mx-theme="light"] body:not(.ess-page) .sidebar-left .nav-link.active:focus {
    background: transparent;
    border-color: transparent;
    border-top-color: #e1e4e8;
    border-bottom-color: #e1e4e8;
    border-inline-start: 2px solid #f7a833;
    border-radius: 0;
    color: #22262a;
}

html[data-mx-theme="dark"] body:not(.ess-page) .tabs-left > .nav-aside > .nav-tabs-line .nav-link.active,
html[data-mx-theme="dark"] body:not(.ess-page) .tabs-left > .nav-aside > .nav-tabs-line .nav-link.active:focus,
html[data-mx-theme="dark"] body:not(.ess-page) .tabs-left > .nav-aside > .nav-tabs-line .nav-item.open .nav-link,
html[data-mx-theme="dark"] body:not(.ess-page) .sidebar-left .nav-link.active {
    color: var(--mx-text);
}

/* Dark dialogs, menus, and leftover light panels */
html[data-mx-theme="dark"] body:not(.ess-page) .card,
html[data-mx-theme="dark"] body:not(.ess-page) .card-header,
html[data-mx-theme="dark"] body:not(.ess-page) .card-footer,
html[data-mx-theme="dark"] body:not(.ess-page) .card-body,
html[data-mx-theme="dark"] body:not(.ess-page) .list-group-item,
html[data-mx-theme="dark"] body:not(.ess-page) .panel,
html[data-mx-theme="dark"] body:not(.ess-page) .panel-body,
html[data-mx-theme="dark"] body:not(.ess-page) .panel-heading,
html[data-mx-theme="dark"] body:not(.ess-page) .well {
    background-color: var(--mx-surface);
    color: var(--mx-text);
    border-color: var(--mx-hair-strong);
}

html[data-mx-theme] body:not(.ess-page) .modal-content {
    background-color: var(--mx-modal-bg);
    border: 1px solid var(--mx-hair);
    border-radius: 18px;
    overflow: hidden;
}

html[data-mx-theme="dark"] body:not(.ess-page) .modal-content {
    color: var(--mx-text);
}

html[data-mx-theme="dark"] body:not(.ess-page) .modal-header,
html[data-mx-theme="dark"] body:not(.ess-page) .modal-footer,
html[data-mx-theme="dark"] body:not(.ess-page) .modal-body,
html[data-mx-theme="dark"] body:not(.ess-page) .offcanvas,
html[data-mx-theme="dark"] body:not(.ess-page) #offcanvas-menu {
    background-color: transparent;
    color: var(--mx-text);
    border-color: var(--mx-hair);
}

html[data-mx-theme="dark"] body:not(.ess-page) .offcanvas,
html[data-mx-theme="dark"] body:not(.ess-page) #offcanvas-menu {
    background-color: var(--mx-surface);
}

html[data-mx-theme="dark"] body:not(.ess-page) .dropdown-menu {
    background-color: var(--mx-menu);
    color: var(--mx-text);
    border-color: var(--mx-hair-strong);
}

html[data-mx-theme="dark"] body:not(.ess-page) .dropdown-item {
    color: var(--mx-text);
}

html[data-mx-theme="dark"] body:not(.ess-page) .dropdown-item:hover,
html[data-mx-theme="dark"] body:not(.ess-page) .dropdown-item:focus {
    background-color: var(--mx-chip-strong);
    color: var(--mx-text);
}

html[data-mx-theme="dark"] body:not(.ess-page) .bg-white,
html[data-mx-theme="dark"] body:not(.ess-page) .bg-light {
    background-color: var(--mx-surface-2) !important;
    color: var(--mx-text);
}

html[data-mx-theme="dark"] body:not(.ess-page) .text-muted,
html[data-mx-theme="dark"] body:not(.ess-page) .text-secondary {
    color: var(--mx-muted) !important;
}

html[data-mx-theme="dark"] body:not(.ess-page) .text-dark,
html[data-mx-theme="dark"] body:not(.ess-page) .text-body {
    color: var(--mx-text) !important;
}

html[data-mx-theme="dark"] body:not(.ess-page) hr,
html[data-mx-theme="dark"] body:not(.ess-page) .border,
html[data-mx-theme="dark"] body:not(.ess-page) .border-top,
html[data-mx-theme="dark"] body:not(.ess-page) .border-bottom {
    border-color: var(--mx-hair-strong) !important;
}

html[data-mx-theme="dark"] body:not(.ess-page) .nav-tabs {
    border-bottom-color: var(--mx-hair-strong);
}

html[data-mx-theme="dark"] body:not(.ess-page) .nav-tabs .nav-link {
    color: var(--mx-muted);
}

html[data-mx-theme="dark"] body:not(.ess-page) .nav-tabs .nav-link.active {
    background-color: var(--mx-surface);
    color: var(--mx-text);
    border-color: var(--mx-hair-strong) var(--mx-hair-strong) var(--mx-surface);
}

html[data-mx-theme="dark"] body:not(.ess-page) .sidebar-left .nav-tabs .nav-link.active,
html[data-mx-theme="dark"] body:not(.ess-page) .tabs-left > .nav-aside > .nav-tabs-line .nav-link.active {
    background: var(--mx-chip-strong);
    color: var(--mx-text);
    border-color: transparent;
    border-inline-start: 2px solid var(--mx-nav-accent);
}

html[data-mx-theme="dark"] body:not(.ess-page) .table,
html[data-mx-theme="dark"] body:not(.ess-page) .table > :not(caption) > * > * {
    background-color: var(--mx-surface);
    color: var(--mx-text);
    border-color: var(--mx-table-border);
}

html[data-mx-theme="dark"] body:not(.ess-page) .table thead th {
    background-color: var(--mx-table-header);
    color: var(--mx-muted);
}

/* Fields */
html[data-mx-theme] body:not(.ess-page) .form-control,
html[data-mx-theme] body:not(.ess-page) .custom-select,
html[data-mx-theme] body:not(.ess-page) textarea,
html[data-mx-theme] body:not(.ess-page) select,
html[data-mx-theme] body:not(.ess-page) .select2-container--default .select2-selection--single,
html[data-mx-theme] body:not(.ess-page) .select2-container--default .select2-selection--multiple {
    background-color: var(--mx-input-bg);
    border-color: var(--mx-input-border);
    border-radius: 10px;
}

html[data-mx-theme="dark"] body:not(.ess-page) .form-control,
html[data-mx-theme="dark"] body:not(.ess-page) .custom-select,
html[data-mx-theme="dark"] body:not(.ess-page) textarea,
html[data-mx-theme="dark"] body:not(.ess-page) select,
html[data-mx-theme="dark"] body:not(.ess-page) .select2-container--default .select2-selection--single,
html[data-mx-theme="dark"] body:not(.ess-page) .select2-container--default .select2-selection--multiple {
    color: var(--mx-input-text);
}

html[data-mx-theme] body:not(.ess-page) .form-control:focus,
html[data-mx-theme] body:not(.ess-page) .custom-select:focus,
html[data-mx-theme] body:not(.ess-page) select:focus,
html[data-mx-theme] body:not(.ess-page) textarea:focus,
html[data-mx-theme] body:not(.ess-page) .dg-toolbar-contextual .dg-quick-search-input:focus,
html[data-mx-theme] body:not(.ess-page) .dg-page-size-chooser:focus,
html[data-mx-theme] body:not(.ess-page) .select2-container--default.select2-container--focus .select2-selection,
html[data-mx-theme] body:not(.ess-page) .select2-container--default.select2-container--open .select2-selection {
    border-color: #6d83ff;
    box-shadow: 0 0 0 3px rgba(109, 131, 255, .35);
}

html[data-mx-theme="dark"] body:not(.ess-page) .form-control:focus,
html[data-mx-theme="dark"] body:not(.ess-page) .custom-select:focus,
html[data-mx-theme="dark"] body:not(.ess-page) select:focus,
html[data-mx-theme="dark"] body:not(.ess-page) textarea:focus,
html[data-mx-theme="dark"] body:not(.ess-page) .dg-toolbar-contextual .dg-quick-search-input:focus,
html[data-mx-theme="dark"] body:not(.ess-page) .dg-page-size-chooser:focus {
    background-color: var(--mx-input-bg);
    color: var(--mx-input-text);
}

html[data-mx-theme="dark"] body:not(.ess-page) .form-control:disabled,
html[data-mx-theme="dark"] body:not(.ess-page) .form-control[readonly] {
    background-color: var(--mx-surface-2);
    color: var(--mx-muted);
}

html[data-mx-theme="dark"] body:not(.ess-page) .form-control::placeholder {
    color: var(--mx-muted);
}

html[data-mx-theme="dark"] body:not(.ess-page) label,
html[data-mx-theme="dark"] body:not(.ess-page) .control-label,
html[data-mx-theme="dark"] body:not(.ess-page) .col-form-label {
    color: var(--mx-text);
}

html[data-mx-theme="dark"] body:not(.ess-page) .input-group-text {
    background-color: var(--mx-surface-2);
    color: var(--mx-muted);
    border-color: var(--mx-input-border);
}

html[data-mx-theme] body:not(.ess-page) .form-check-input:not(:checked):not(:indeterminate),
html[data-mx-theme] body:not(.ess-page) .dg-cell-selector-checkbox:not(:checked) {
    background-color: var(--mx-input-bg);
    border-color: var(--mx-hair-strong);
}

/* Off switches need a grey track so the white knob reads on dark surfaces. On stays orange. */
html[data-mx-theme="dark"] body:not(.ess-page) .switch > input[type="checkbox"]:not(:checked) ~ .switch-toggle {
    background-color: #8d96ad;
    border-color: #6e778f;
}

html[data-mx-theme="dark"] body:not(.ess-page) .switch > input[type="checkbox"]:is(:disabled, [readonly]):not(:checked) ~ .switch-toggle {
    background-color: #8d96ad;
    border-color: #6e778f;
    opacity: 0.72;
}

html[data-mx-theme="dark"] body:not(.ess-page) .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--mx-input-text);
}

html[data-mx-theme="dark"] body:not(.ess-page) .select2-search__field {
    background-color: var(--mx-input-bg);
    color: var(--mx-input-text);
    border-color: var(--mx-input-border);
}

html[data-mx-theme="dark"] body:not(.ess-page) .select2-dropdown {
    background-color: var(--mx-menu);
}

html[data-mx-theme="dark"] body:not(.ess-page) .select2-container--default .select2-results__option--highlighted[aria-selected],
html[data-mx-theme="dark"] body:not(.ess-page) .select2-container--default .select2-results__option[aria-selected="true"] {
    background-color: var(--mx-chip-strong);
    color: var(--mx-text);
}

/* Name groups: one field in both themes */
html[data-mx-theme] #employee-name-fields .employee-name-inputs {
    border: 1px solid var(--mx-hair-strong);
    border-radius: 10px;
    overflow: hidden;
    background: var(--mx-input-bg);
}

html[data-mx-theme] #employee-name-fields .employee-name-inputs:focus-within {
    border-color: #6d83ff;
    box-shadow: 0 0 0 3px rgba(109, 131, 255, .35);
}

html[data-mx-theme] #employee-name-fields .employee-name-inputs > .form-control,
html[data-mx-theme] #employee-name-fields .employee-name-inputs > .form-control:first-child,
html[data-mx-theme] #employee-name-fields .employee-name-inputs > .form-control:last-child,
html[data-mx-theme] #employee-name-fields .employee-name-inputs > .form-control:focus {
    background: transparent;
    border-color: var(--mx-hair);
    box-shadow: none;
    border-radius: 0;
}

html[data-mx-theme="dark"] #employee-name-fields .employee-name-inputs > .form-control {
    color: var(--mx-input-text);
}

html[data-mx-theme] #employee-name-fields .employee-name-preview {
    background: var(--mx-surface-2) !important;
    border: 1px solid var(--mx-hair);
}

html[data-mx-theme="dark"] #employee-name-fields .employee-name-preview {
    color: var(--mx-text);
}

/* Uploads. The photo is not recolored. */
html[data-mx-theme] body:not(.ess-page) .fileupload-container {
    background: var(--mx-surface-2) !important;
    border: 1px dashed var(--mx-hair-strong) !important;
    border-radius: 14px;
}

html[data-mx-theme="dark"] body:not(.ess-page) .fileupload-container {
    color: var(--mx-text);
}

html[data-mx-theme] body:not(.ess-page) .fileupload-container .fileupload-thumb-wrapper {
    border-color: var(--mx-hair-strong) !important;
    background: transparent;
}

html[data-mx-theme="dark"] body:not(.ess-page) .fileupload-container .file-icon {
    color: color-mix(in srgb, var(--mx-muted) 70%, transparent);
}

html[data-mx-theme] body:not(.ess-page) .fileupload-container img {
    filter: none;
}

/* Datagrid */
html[data-mx-theme] .datagrid-root {
    --dg-border-radius: 12px;
}

html[data-mx-theme="light"] .datagrid-root {
    --dg-border-color: var(--mx-hair-strong);
    --dg-header-bg: #f7f8fb;
    --dg-footer-bg: var(--mx-surface);
    --dg-pager-bg: var(--mx-surface);
    --dg-toolbar-bg: var(--mx-surface);
    --dg-row-bg: var(--mx-surface);
    --dg-row-even-bg: #f7f8fb;
    --dg-row-hover-color: #eef2f8;
    --dg-row-active-color: #e7eef8;
    --dg-row-inactive-color: #fbfcfd;
}

html[data-mx-theme="dark"] .datagrid-root {
    --dg-border-color: var(--mx-hair-strong);
    --dg-header-bg: var(--mx-surface-2);
    --dg-footer-bg: var(--mx-surface);
    --dg-pager-bg: var(--mx-surface);
    --dg-toolbar-bg: var(--mx-surface);
    --dg-toolbar-accent-soft: rgba(109, 131, 255, .16);
    --dg-row-bg: var(--mx-surface);
    --dg-row-even-bg: color-mix(in srgb, #fff 4%, var(--mx-surface));
    --dg-row-hover-color: var(--mx-chip-strong);
    --dg-row-active-color: var(--mx-chip-strong);
    --dg-row-inactive-color: color-mix(in srgb, #fff 2%, var(--mx-surface));
    --dg-toolbar-muted: var(--mx-muted);
    color: var(--mx-text);
    background: var(--mx-surface);
}

html[data-mx-theme="light"] .dg-striped {
    --dg-row-even-bg: #f7f8fb;
}

html[data-mx-theme="dark"] .dg-striped {
    --dg-row-even-bg: color-mix(in srgb, #fff 4%, var(--mx-surface));
}

html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual,
html[data-mx-theme] .datagrid.datagrid-editing > .dg-grid > .dg-toolbar.dg-toolbar-contextual {
    background: var(--mx-surface);
    box-shadow: none;
}

html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .dg-filter-trigger,
html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .dg-filter-reset-trigger,
html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .dg-import-trigger,
html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .dg-import-menu-trigger,
html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .dg-export-trigger,
html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .dg-tool-cancel,
html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .dg-tool-delete,
html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .dg-delete-selection-menu-trigger,
html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .dg-filter-trigger:not(:disabled):hover,
html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .dg-import-trigger:not(:disabled):hover,
html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .dg-import-menu-trigger:not(:disabled):hover,
html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .dg-export-trigger:not(:disabled):hover,
html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .dg-tool-cancel:not(:disabled):hover,
html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .dg-tool-delete:not(:disabled):hover,
html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .dg-tool-delete:not(:disabled):focus-visible {
    min-height: 36px;
    background: var(--mx-chip);
    border-color: var(--mx-hair-strong);
    border-radius: 999px !important;
}

html[data-mx-theme="dark"] .dg-toolbar.dg-toolbar-contextual .dg-filter-trigger,
html[data-mx-theme="dark"] .dg-toolbar.dg-toolbar-contextual .dg-filter-reset-trigger,
html[data-mx-theme="dark"] .dg-toolbar.dg-toolbar-contextual .dg-import-trigger,
html[data-mx-theme="dark"] .dg-toolbar.dg-toolbar-contextual .dg-import-menu-trigger,
html[data-mx-theme="dark"] .dg-toolbar.dg-toolbar-contextual .dg-export-trigger,
html[data-mx-theme="dark"] .dg-toolbar.dg-toolbar-contextual .dg-tool-cancel,
html[data-mx-theme="dark"] .dg-toolbar.dg-toolbar-contextual .dg-tool-delete,
html[data-mx-theme="dark"] .dg-toolbar.dg-toolbar-contextual .dg-delete-selection-menu-trigger,
html[data-mx-theme="dark"] .dg-toolbar.dg-toolbar-contextual .dg-filter-trigger:not(:disabled):hover,
html[data-mx-theme="dark"] .dg-toolbar.dg-toolbar-contextual .dg-import-trigger:not(:disabled):hover,
html[data-mx-theme="dark"] .dg-toolbar.dg-toolbar-contextual .dg-export-trigger:not(:disabled):hover,
html[data-mx-theme="dark"] .dg-toolbar.dg-toolbar-contextual .dg-tool-cancel:not(:disabled):hover,
html[data-mx-theme="dark"] .dg-toolbar.dg-toolbar-contextual .dg-tool-delete:not(:disabled):hover,
html[data-mx-theme="dark"] .dg-toolbar.dg-toolbar-contextual .dg-tool-delete:not(:disabled):focus-visible {
    color: var(--mx-text);
}

html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .dg-filter-trigger:not(:disabled):hover,
html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .dg-import-trigger:not(:disabled):hover,
html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .dg-export-trigger:not(:disabled):hover,
html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .dg-tool-cancel:not(:disabled):hover,
html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .dg-tool-delete:not(:disabled):hover {
    background: var(--mx-chip-strong);
}

html[data-mx-theme="light"] .dg-toolbar.dg-toolbar-contextual .dg-tool-delete:not(:disabled),
html[data-mx-theme="light"] .dg-toolbar.dg-toolbar-contextual .dg-tool-delete:not(:disabled):hover,
html[data-mx-theme="light"] .dg-toolbar.dg-toolbar-contextual .dg-tool-delete:not(:disabled):focus-visible {
    color: #b42318;
}

html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .dg-filter-trigger.active,
html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .dg-filter-trigger:has(.dg-toolbar-badge) {
    color: var(--dg-toolbar-accent-hover);
    background: var(--dg-toolbar-accent-soft);
    border-color: transparent;
    border-radius: 999px !important;
}

html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .dg-tool-add,
html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .dg-tool-save,
html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .btn.btn-primary {
    min-height: 36px;
    border-radius: 999px !important;
}

html[data-mx-theme] .dg-toolbar.dg-toolbar-contextual .btn:focus-visible,
html[data-mx-theme] .dg-pager-action.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(109, 131, 255, .35);
}

html[data-mx-theme] .dg-toolbar-contextual .dg-quick-search-input,
html[data-mx-theme] .dg-page-size-chooser.form-control {
    background-color: var(--mx-input-bg);
    border-color: var(--mx-input-border);
    border-radius: 10px;
}

html[data-mx-theme="dark"] .dg-toolbar-contextual .dg-quick-search-input,
html[data-mx-theme="dark"] .dg-page-size-chooser.form-control {
    color: var(--mx-input-text);
}

html[data-mx-theme] .dg-pager-action.btn {
    border-radius: 999px;
}

html[data-mx-theme="dark"] .dg-quick-search-icon,
html[data-mx-theme="dark"] .dg-sizechooser-label {
    color: var(--mx-muted);
}

html[data-mx-theme] .dg-table-wrapper,
html[data-mx-theme] .dg-table,
html[data-mx-theme] .dg-no-data > .dg-td {
    background-color: var(--mx-surface);
}

html[data-mx-theme="dark"] .dg-table-wrapper,
html[data-mx-theme="dark"] .dg-table,
html[data-mx-theme="dark"] .dg-no-data > .dg-td {
    color: var(--mx-text);
}

html[data-mx-theme="dark"] .datagrid-loader {
    background-color: var(--mx-surface);
}

html[data-mx-theme="dark"] .dg-table .dg-th,
html[data-mx-theme="dark"] .dg-table .dg-th .dg-cell {
    color: var(--mx-muted);
}

html[data-mx-theme="dark"] .dg-table .dg-td,
html[data-mx-theme="dark"] .dg-table .dg-td .dg-cell {
    color: var(--mx-text);
}

html[data-mx-theme="dark"] .dg-table .dg-td a {
    color: #7eb6ff;
}

html[data-mx-theme] .dg-table .dg-td img,
html[data-mx-theme] .dg-table .dg-td .fi {
    filter: none;
}

html[data-mx-theme="dark"] .dg-table .dg-tr-foot > td {
    background-color: var(--mx-surface-2);
    color: var(--mx-text);
}

html[data-mx-theme="light"] .dg-empty-state {
    border-color: var(--mx-hair);
    border-radius: 12px;
}

html[data-mx-theme="dark"] .dg-empty-state {
    background: var(--mx-surface);
    border-color: var(--mx-hair);
    border-radius: 12px;
    color: var(--mx-text);
}

html[data-mx-theme="dark"] .dg-empty-state-title {
    color: var(--mx-text);
}

html[data-mx-theme="dark"] .dg-empty-state-surface {
    fill: var(--mx-surface-2);
}

html[data-mx-theme="dark"] .dg-empty-state-line,
html[data-mx-theme="dark"] .dg-empty-state-database,
html[data-mx-theme="dark"] .dg-empty-state-spark {
    stroke: var(--mx-muted);
}

/* Grid settings */
html[data-mx-theme] .dg-tools-modal .modal-content {
    border-radius: 18px;
}

html[data-mx-theme="dark"] .dg-tools-modal {
    --dg-toolbar-accent-soft: rgba(109, 131, 255, .16);
}

html[data-mx-theme] .dg-tools-tabs .btn {
    border-radius: 999px;
}

html[data-mx-theme] .dg-tools-tabs .btn:not(.active) {
    background: var(--mx-chip);
    border-color: var(--mx-hair-strong);
}

html[data-mx-theme="dark"] .dg-tools-tabs .btn:not(.active) {
    color: var(--mx-text);
}

html[data-mx-theme="dark"] .dg-tools-tab-count {
    color: var(--mx-text);
    background: var(--mx-chip-strong);
}

html[data-mx-theme="dark"] .dg-tools-tabs .btn.active .dg-tools-tab-count {
    color: #307abe;
    background: #fff;
}

html[data-mx-theme] .dg-tools-pager-setting,
html[data-mx-theme] .dg-columns-toolbar,
html[data-mx-theme] .dg-columns-sticky-stack,
html[data-mx-theme] .dg-column-inspector {
    background-color: var(--mx-surface-2);
    border-color: var(--mx-hair);
    box-shadow: none;
}

html[data-mx-theme="dark"] .dg-tools-pager-setting,
html[data-mx-theme="dark"] .dg-columns-toolbar,
html[data-mx-theme="dark"] .dg-columns-sticky-stack,
html[data-mx-theme="dark"] .dg-column-inspector {
    color: var(--mx-text);
}

html[data-mx-theme] .dg-column-list-item {
    border-bottom-color: var(--mx-hair);
}

html[data-mx-theme] .dg-column-list-item:hover,
html[data-mx-theme] .dg-column-drag-handle:hover:not(:disabled) {
    background-color: var(--mx-chip);
}

html[data-mx-theme="dark"] .dg-column-list-item:hover,
html[data-mx-theme="dark"] .dg-column-drag-handle:hover:not(:disabled) {
    color: var(--mx-text);
}

html[data-mx-theme] .dg-column-list-item.is-selected {
    background-color: var(--mx-chip-strong);
}

html[data-mx-theme] .dg-tools-modal-icon,
html[data-mx-theme] .dg-tools-section-icon,
html[data-mx-theme] .dg-tools-option-icon {
    background-color: var(--mx-chip-strong);
}

html[data-mx-theme="dark"] .dg-tools-option-text strong,
html[data-mx-theme="dark"] .dg-tools-modal .modal-title,
html[data-mx-theme="dark"] .dg-columns-title {
    color: var(--mx-text);
}

html[data-mx-theme="dark"] .dg-tools-option-text small,
html[data-mx-theme="dark"] .dg-columns-count,
html[data-mx-theme="dark"] .dg-column-list-item.is-hidden .dg-column-list-name {
    color: var(--mx-muted);
}

/* Quick Access */
html[data-mx-theme] body:not(.ess-page) .home-quick-access-rail-tab,
html[data-mx-theme] body:not(.ess-page) .home-quick-access-rail-tab:hover {
    background: var(--mx-glass-strong);
    border: 1px solid var(--mx-hair-strong);
    box-shadow: var(--mx-shadow);
}

html[data-mx-theme="dark"] body:not(.ess-page) .home-quick-access-rail-tab,
html[data-mx-theme="dark"] body:not(.ess-page) .home-quick-access-rail-tab:hover {
    color: var(--mx-text);
}

html[data-mx-theme="dark"] body:not(.ess-page) .bootstrap-datetimepicker-widget {
    background-color: var(--mx-menu);
    color: var(--mx-text);
    border-color: var(--mx-hair-strong);
}

html[data-mx-theme="dark"] body:not(.ess-page) .bootstrap-datetimepicker-widget table th,
html[data-mx-theme="dark"] body:not(.ess-page) .bootstrap-datetimepicker-widget table td {
    color: var(--mx-text);
}

html[data-mx-theme="dark"] body:not(.ess-page) .bootstrap-datetimepicker-widget table td.day:hover,
html[data-mx-theme="dark"] body:not(.ess-page) .bootstrap-datetimepicker-widget table td span:hover {
    background: var(--mx-chip-strong);
}

/* Fullscreen MystroX loader. Light preloader.css stays the white wash and charcoal wordmark. */
html[data-mx-theme="dark"] body:not(.ess-page) .preloader {
    background-color: #0a0f24;
    background-image: var(--mx-bg);
}

html[data-mx-theme="dark"] body:not(.ess-page) .preloader::after {
    background-image: url("/images/logo-animated-on-dark.svg");
    filter: drop-shadow(0 12px 28px rgba(0, 0, 0, .45));
}

/* Numeric fields. Same shape in both themes; --mx-* picks the surface. */
html[data-mx-theme] body:not(.ess-page) .k-numerictextbox.k-input,
html[data-mx-theme] body:not(.ess-page) .k-numerictextbox .k-numeric-wrap,
html[data-mx-theme] body:not(.ess-page) .k-numerictextbox .k-numeric-wrap.k-state-focused {
    background-color: var(--mx-input-bg);
    color: var(--mx-input-text);
    border-color: var(--mx-input-border);
    border-radius: 10px;
    overflow: hidden;
}

html[data-mx-theme] body:not(.ess-page) .k-numerictextbox .k-input-inner {
    background-color: transparent;
    color: var(--mx-input-text);
    border-radius: 0;
    box-shadow: none;
}

html[data-mx-theme] body:not(.ess-page) .k-numerictextbox.k-input:focus-within,
html[data-mx-theme] body:not(.ess-page) .k-numerictextbox.k-input.k-focus,
html[data-mx-theme] body:not(.ess-page) .k-numerictextbox .k-numeric-wrap.k-state-focused {
    border-color: #6d83ff;
    box-shadow: 0 0 0 3px rgba(109, 131, 255, .35);
}

html[data-mx-theme] body:not(.ess-page) .k-numerictextbox .k-input-spinner,
html[data-mx-theme] body:not(.ess-page) .k-numerictextbox .k-select {
    background-color: var(--mx-surface-2);
    border-color: var(--mx-hair);
}

html[data-mx-theme] body:not(.ess-page) .k-numerictextbox .k-input-spinner .k-button,
html[data-mx-theme] body:not(.ess-page) .k-numerictextbox .k-input-spinner .k-button:hover,
html[data-mx-theme] body:not(.ess-page) .k-numerictextbox .k-select .k-link,
html[data-mx-theme] body:not(.ess-page) .k-numerictextbox .k-select .k-link:hover {
    background-color: var(--mx-surface-2);
    color: var(--mx-muted);
}

html[data-mx-theme] body:not(.ess-page) .k-numerictextbox .k-input-spinner .k-button .k-icon,
html[data-mx-theme] body:not(.ess-page) .k-numerictextbox .k-select .k-icon {
    color: var(--mx-muted);
}

/* Mystro Select2. The skin is .select2, not .select2-container--default. */
html[data-mx-theme] body:not(.ess-page) .select2 .select2-selection,
html[data-mx-theme] body:not(.ess-page) .select2.select2-container--open .select2-selection--single,
html[data-mx-theme] body:not(.ess-page) .select2.select2-container--focus .select2-selection--single {
    background-color: var(--mx-input-bg);
    color: var(--mx-input-text);
    border-color: var(--mx-input-border);
    border-radius: 10px;
}

html[data-mx-theme] body:not(.ess-page) .select2 .select2-selection .select2-selection__rendered {
    color: var(--mx-input-text);
}

html[data-mx-theme] body:not(.ess-page) .select2 .select2-selection--single .select2-selection__arrow {
    background-color: var(--mx-surface-2);
    border-left-color: var(--mx-input-border);
    border-right-color: var(--mx-input-border);
}

/* Home company filter uses the same pill as the date filter, not the square select arrow. */
html[data-mx-theme] body:not(.ess-page) .admin-home .home-notification-company-wrap .select2 .select2-selection {
    height: 36px;
    padding-inline: 14px 0;
    border: 1px solid var(--h-hair-strong, var(--mx-hair-strong));
    border-radius: 999px;
    background: var(--h-chip, var(--mx-chip));
    box-shadow: none;
    overflow: hidden;
}

html[data-mx-theme] body:not(.ess-page) .admin-home .home-notification-company-wrap .select2.select2-container--focus .select2-selection--single,
html[data-mx-theme] body:not(.ess-page) .admin-home .home-notification-company-wrap .select2.select2-container--open .select2-selection--single {
    border-color: var(--h-hair-strong, var(--mx-hair-strong));
    background: var(--h-glass-strong, var(--mx-glass-strong));
    box-shadow: none;
}

html[data-mx-theme] body:not(.ess-page) .admin-home .home-notification-company-wrap .select2 .select2-selection__rendered,
html[data-mx-theme] body:not(.ess-page) .admin-home .home-notification-company-wrap .select2 .select2-selection__placeholder {
    color: var(--h-text, var(--mx-text));
    font-size: 13px;
    font-weight: 600;
}

html[data-mx-theme] body:not(.ess-page) .admin-home .home-notification-company-wrap .select2 .select2-selection__arrow {
    min-width: 32px;
    background: transparent;
    border: 0;
}

html[data-mx-theme] body:not(.ess-page) .admin-home .home-notification-company-wrap .select2 .select2-selection__arrow > b {
    width: 7px;
    height: 7px;
    margin-top: -4px;
    border: 0;
    border-right: 1.5px solid var(--h-muted, var(--mx-muted));
    border-bottom: 1.5px solid var(--h-muted, var(--mx-muted));
    transform: rotate(45deg);
}

html[data-mx-theme] body:not(.ess-page) .admin-home .home-card__filter--yearly .select2 .select2-selection {
    height: 36px;
    padding-inline: 14px 0;
    border: 1px solid var(--h-hair-strong, var(--mx-hair-strong));
    border-radius: 999px;
    background: var(--h-chip, var(--mx-chip));
    box-shadow: none;
    overflow: hidden;
}

html[data-mx-theme] body:not(.ess-page) .admin-home .home-card__filter--yearly .select2.select2-container--focus .select2-selection--single,
html[data-mx-theme] body:not(.ess-page) .admin-home .home-card__filter--yearly .select2.select2-container--open .select2-selection--single {
    border-color: var(--h-hair-strong, var(--mx-hair-strong));
    background: var(--h-glass-strong, var(--mx-glass-strong));
    box-shadow: none;
}

html[data-mx-theme] body:not(.ess-page) .admin-home .home-card__filter--yearly .select2 .select2-selection__rendered,
html[data-mx-theme] body:not(.ess-page) .admin-home .home-card__filter--yearly .select2 .select2-selection__placeholder {
    color: var(--h-text, var(--mx-text));
    font-size: 13px;
    font-weight: 600;
}

html[data-mx-theme] body:not(.ess-page) .admin-home .home-card__filter--yearly .select2 .select2-selection__arrow {
    min-width: 32px;
    background: transparent;
    border: 0;
}

html[data-mx-theme] body:not(.ess-page) .admin-home .home-card__filter--yearly .select2 .select2-selection__arrow > b {
    width: 7px;
    height: 7px;
    margin-top: -4px;
    border: 0;
    border-right: 1.5px solid var(--h-muted, var(--mx-muted));
    border-bottom: 1.5px solid var(--h-muted, var(--mx-muted));
    transform: rotate(45deg);
}

html[data-mx-theme] body:not(.ess-page) .select2 .select2-selection--single .select2-selection__arrow > b {
    border-top-color: var(--mx-muted);
}

html[data-mx-theme] body:not(.ess-page) .select2.select2-container--open .select2-selection--single .select2-selection__arrow > b {
    border-bottom-color: var(--mx-muted);
}

html[data-mx-theme] body:not(.ess-page) .select2.select2-container--focus .select2-selection--single,
html[data-mx-theme] body:not(.ess-page) .select2.select2-container--open .select2-selection--single {
    border-color: #6d83ff;
    box-shadow: 0 0 0 3px rgba(109, 131, 255, .35);
}

html[data-mx-theme] body:not(.ess-page) .select2-container .select2-dropdown {
    background-color: var(--mx-menu);
    color: var(--mx-text);
    border-color: var(--mx-hair-strong);
}

html[data-mx-theme] body:not(.ess-page) .select2-container .select2-search--dropdown {
    background-color: var(--mx-input-bg);
    border-bottom-color: var(--mx-hair);
}

html[data-mx-theme] body:not(.ess-page) .select2-container .select2-search .select2-search__field {
    background-color: var(--mx-input-bg);
    color: var(--mx-input-text);
}

html[data-mx-theme] body:not(.ess-page) .select2-container .select2-results__option {
    color: var(--mx-text);
    border-bottom-color: var(--mx-hair);
}

html[data-mx-theme] body:not(.ess-page) .select2-container .select2-results__option--highlighted,
html[data-mx-theme] body:not(.ess-page) .select2-container .select2-results__option[aria-selected="true"] {
    background-color: var(--mx-chip-strong);
    color: var(--mx-text);
}

/* Grid Settings light buttons. Tabs and primary stay pills; orange toggles stay orange. */
html[data-mx-theme] body:not(.ess-page) .dg-tools-modal .btn-light:not(.dg-tools-tabs .btn) {
    --btn-base-text: var(--mx-text);
    --btn-base-bg: var(--mx-chip);
    --btn-base-border: var(--mx-hair-strong);
    --btn-hover-bg: var(--mx-chip-strong);
    --btn-hover-border: var(--mx-hair-strong);
    --btn-active-bg: var(--mx-chip-strong);
    --btn-active-border: var(--mx-hair-strong);
    --btn-state-color: var(--mx-text);
    color: var(--mx-text);
    background-color: var(--mx-chip);
    border-color: var(--mx-hair-strong);
}

html[data-mx-theme] body:not(.ess-page) .dg-tools-modal .btn-light:not(.dg-tools-tabs .btn):disabled,
html[data-mx-theme] body:not(.ess-page) .dg-tools-modal .btn-light:not(.dg-tools-tabs .btn).disabled {
    --btn-base-text: var(--mx-muted);
    --btn-base-bg: var(--mx-chip);
    color: var(--mx-muted);
    background-color: var(--mx-chip);
    border-color: var(--mx-hair);
}

html[data-mx-theme="dark"] .dg-column-list-name {
    color: var(--mx-text);
}

html[data-mx-theme="dark"] .dg-column-list-item.is-hidden .dg-column-list-name,
html[data-mx-theme="dark"] .dg-column-drag-handle {
    color: var(--mx-muted);
}

/* Shared widgets. Home keeps its own skin. Loaded last so these beat later widget files. */
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=button]):not([type=submit]):not([type=file]):not([type=image]):not([type=range]),
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) select:not(.select2-hidden-accessible),
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) textarea,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-input,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-input-solid,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-input-solid:focus,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-input-solid:focus-within,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-input-solid.k-focus,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-picker,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-dropdown,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-combobox,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-multiselect,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-datepicker,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-timepicker,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-datetimepicker,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-autocomplete {
    background-color: var(--mx-input-bg);
    border-color: var(--mx-input-border);
    border-radius: 10px;
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=button]):not([type=submit]):not([type=file]):not([type=image]):not([type=range]),
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) select:not(.select2-hidden-accessible),
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) textarea,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-input,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-input-solid,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-picker,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-dropdown,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-combobox,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-multiselect,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-datepicker,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-timepicker,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-datetimepicker,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-autocomplete {
    color: var(--mx-input-text);
}

html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) input[readonly],
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) textarea[readonly],
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .form-control[readonly],
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .form-control:disabled,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) input:disabled:not([type=checkbox]):not([type=radio]) {
    background-color: var(--mx-surface-2) !important;
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) input[readonly],
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) textarea[readonly],
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .form-control[readonly],
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .form-control:disabled,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) input:disabled:not([type=checkbox]):not([type=radio]) {
    color: var(--mx-muted) !important;
}

html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .input-group.edit-control,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .input-group.datetimepicker-group,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-timepicker {
    border: 1px solid var(--mx-input-border);
    border-radius: 10px;
    overflow: hidden;
    background-color: var(--mx-input-bg);
}

html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .input-group.edit-control .select2-selection,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .input-group.edit-control .form-control,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .input-group.datetimepicker-group .form-control,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-timepicker > .k-input-inner {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background-color: transparent;
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .select2.select2-container--disabled {
    background: var(--mx-surface-2);
    color: var(--mx-muted);
}

html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .input-group.edit-control > .select2,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .input-group.edit-control > .select2.select2-container--disabled {
    background: transparent;
    align-self: stretch;
}

html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .input-group.edit-control .select2-selection__arrow,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .input-group.datetimepicker-group .input-group-text,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-timepicker > .k-input-button,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .input-group-append > button[data-add-new-option],
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .input-group-append > button[data-target="#organization-structure-selection"],
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .input-group.edit-control .btn-os-picker {
    --btn-base-bg: var(--mx-surface-2);
    --btn-base-text: var(--mx-muted);
    --btn-base-border: transparent;
    --btn-hover-bg: var(--mx-chip-strong);
    --btn-hover-border: transparent;
    --btn-active-bg: var(--mx-chip-strong);
    --btn-state-color: var(--mx-text);
    background-color: var(--mx-surface-2);
    color: var(--mx-muted);
    border-color: transparent;
    border-inline-start: 1px solid var(--mx-input-border);
    border-start-start-radius: 0 !important;
    border-end-start-radius: 0 !important;
    border-start-end-radius: 10px !important;
    border-end-end-radius: 10px !important;
    box-shadow: none;
}

html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-popup,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-list-container,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-calendar {
    background-color: var(--mx-menu);
    color: var(--mx-text);
    border-color: var(--mx-hair-strong);
}

html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-list .k-item:hover,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-list .k-item.k-state-selected,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-list-item:hover,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-list-item.k-selected {
    background-color: var(--mx-chip-strong);
    color: var(--mx-text);
}

/* Kendo grids and pivot tables. */
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-grid {
    background-color: var(--mx-surface);
    border-color: var(--mx-hair);
    border-radius: 12px;
    overflow: hidden;
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-grid {
    color: var(--mx-text);
}

html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-grid-header,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-grid-header-wrap,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-grid th,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-grid-footer,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-pager-wrap,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-grid-pager {
    background-color: var(--mx-surface-2);
    border-color: var(--mx-hair);
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-grid th,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-grid-header {
    color: var(--mx-muted);
}

html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-grid td,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-grid tr {
    background-color: var(--mx-surface);
    border-color: var(--mx-hair);
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-grid td {
    color: var(--mx-text);
}

html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-grid .k-alt,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-grid .k-alt > td {
    background-color: var(--mx-table-row-alt);
}

html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-grid tbody > tr:hover,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-grid tbody > tr:hover > td,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-grid tbody > tr.k-hover > td {
    background-color: var(--mx-chip);
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-grid .k-state-hover,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-grid .k-state-selected,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-grid tbody > tr:hover > td {
    color: var(--mx-text) !important;
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-grid a:not(.btn):not(.k-button) {
    color: #7eb6ff;
}

html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-pager-sizes .k-dropdown,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-pager-wrap select,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-pager-numbers-wrap select {
    background-color: var(--mx-input-bg);
    border-color: var(--mx-input-border);
    border-radius: 10px;
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-pager-sizes .k-dropdown,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-pager-wrap,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-grid-pager {
    color: var(--mx-text);
}

html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .pivot-table {
    --pivot-border: var(--mx-hair-strong);
    --pivot-header: var(--mx-surface-2);
    --pivot-group: var(--mx-chip);
    --pivot-empty: var(--mx-muted);
    background: var(--mx-surface);
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .pivot-table {
    color: var(--mx-text);
}

html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .pivot-table__table th,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .pivot-table__table td,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .pivot-table__head th,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .pivot-table__column-toggle,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .pivot-table__row-label {
    background: var(--mx-surface);
    border-color: var(--mx-hair);
}

html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .pivot-table__head th,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .pivot-table__row-label,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .pivot-table__section-title-cell,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .pivot-table__group-summary th,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .pivot-table__group-summary td {
    background: var(--mx-surface-2) !important;
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .pivot-table__table th,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .pivot-table__table td,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .pivot-table__row-label,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .pivot-table__column-toggle {
    color: var(--mx-text);
}

html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .pivot-table__summary-cell .pivot-table__value {
    background: var(--mx-chip);
    border-color: var(--mx-hair);
}

/* Pickers and editor. */
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .entpicker-filter,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .entpicker .modal-header,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .entpicker-item,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .typeahead-drop,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .entitychooser-item .card,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .entitychooser-item .card .card-header,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .note-editor.note-frame,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .note-toolbar,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .note-editable {
    background-color: var(--mx-surface);
    border-color: var(--mx-hair-strong) !important;
}

html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .entpicker .modal-header,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .entpicker-filter,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .note-toolbar {
    background-color: var(--mx-surface-2) !important;
}

html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .note-editable {
    background-color: var(--mx-input-bg);
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .entpicker-item,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .typeahead-drop,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .typeahead-item,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .entitychooser-item .card,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .note-editable,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-treeview {
    color: var(--mx-text);
}

html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .entpicker-item:hover,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .entpicker-item.selected,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .typeahead-item:hover,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-treeview .k-hover,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-treeview .k-state-hover,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .k-treeview .k-state-hover:hover {
    background-color: var(--mx-chip-strong) !important;
    border-color: var(--mx-hair) !important;
    color: var(--mx-text) !important;
}

html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .entpicker-item img,
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .entitychooser-item img {
    filter: none;
}

/* Popup frame. The iframe page uses the same widget rules. */
html[data-mx-theme] body:not(.ess-page) .modal-dialog-app > .modal-content,
html[data-mx-theme] body:not(.ess-page) .modal-dialog-app .modal-body,
html[data-mx-theme] body:not(.ess-page) .modal-flex-fill-area {
    background-color: var(--mx-modal-bg);
}

html[data-mx-theme="dark"] body:not(.ess-page) .modal-closer {
    color: var(--mx-text);
}

html[data-mx-theme] body.popup:not(.ess-page) #content .section-header,
html[data-mx-theme] body.popup:not(.ess-page) #content .section-header.sticky {
    background: var(--mx-glass-strong);
    background-color: var(--mx-glass-strong);
    border-bottom: 1px solid var(--mx-hair);
    box-shadow: none;
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    backdrop-filter: blur(20px) saturate(160%);
}

/* Language name block and audit menu. Flags and the green marker stay as they are. */
html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .locale-editor {
    background-color: var(--mx-surface);
    border-color: var(--mx-hair-strong);
    color: var(--mx-text);
}

html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .locale-editor .nav-locales > .nav {
    background-color: var(--mx-surface-2);
    border-bottom-color: var(--mx-hair);
}

html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .locale-editor .nav-locales > .nav .nav-link {
    color: var(--mx-muted);
}

html[data-mx-theme] body:not(.ess-page):not(:has(#admin-home)) .locale-editor .nav-locales > .nav .nav-link.active {
    background-color: var(--mx-surface);
    border-color: var(--mx-hair-strong);
    border-bottom-color: var(--mx-surface);
    color: var(--mx-text);
}

html[data-mx-theme] body:not(.ess-page) .entity-audit-log .entity-audit-log-menu {
    background-color: var(--mx-menu);
    color: var(--mx-text);
    border-color: var(--mx-hair);
}

html[data-mx-theme] body:not(.ess-page) .entity-audit-log .entity-audit-log-actor,
html[data-mx-theme] body:not(.ess-page) .entity-audit-log .entity-audit-log-footer,
html[data-mx-theme] body:not(.ess-page) .entity-audit-log .entity-audit-log-footer:hover,
html[data-mx-theme] body:not(.ess-page) .entity-audit-log .entity-audit-log-footer:focus {
    background-color: var(--mx-surface-2);
    border-color: var(--mx-hair);
    color: var(--mx-text);
}

html[data-mx-theme] body:not(.ess-page) .entity-audit-log .entity-audit-log-actor-name,
html[data-mx-theme] body:not(.ess-page) .entity-audit-log .entity-audit-log-event-heading {
    color: var(--mx-text);
}

html[data-mx-theme] body:not(.ess-page) .entity-audit-log .entity-audit-log-event:not(:last-child)::before {
    background-color: var(--mx-hair-strong);
}

/* Neutral buttons. Primary, danger, and warning keep their colors. Hover tokens on btn-to-* stay. */
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .btn-light:not(.btn-to-primary):not(.btn-to-danger):not(.btn-to-warning):not(.btn-to-success):not(.btn-to-info),
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .btn-secondary:not(.btn-to-primary):not(.btn-to-danger):not(.btn-to-warning):not(.btn-to-success):not(.btn-to-info),
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-grid tbody .k-command-cell .k-button:not(.btn):not(.k-grid-delete):not(.k-grid-danger) {
    --btn-base-text: var(--mx-text);
    --btn-base-bg: var(--mx-surface-2);
    --btn-base-border: var(--mx-hair-strong);
    --btn-hover-bg: var(--mx-chip-strong);
    --btn-hover-border: var(--mx-hair-strong);
    --btn-active-bg: var(--mx-chip-strong);
    --btn-active-border: var(--mx-hair-strong);
    --btn-state-color: var(--mx-text);
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .btn-light.btn-to-danger,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .btn-light.btn-to-warning,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .btn-light.btn-to-primary,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .btn-secondary.btn-to-danger {
    --btn-base-text: var(--mx-text);
    --btn-base-bg: var(--mx-surface-2);
    --btn-base-border: var(--mx-hair-strong);
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .btn-outline-light,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .btn-outline-secondary {
    --btn-base-text: var(--mx-text);
    --btn-base-bg: transparent;
    --btn-base-border: var(--mx-hair-strong);
    --btn-hover-bg: var(--mx-chip);
    --btn-hover-border: var(--mx-hair-strong);
    --btn-active-bg: var(--mx-chip-strong);
    --btn-active-border: var(--mx-hair-strong);
    --btn-state-color: var(--mx-text);
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .btn-group > .btn-light.active,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .btn-group-toggle > .btn-light.active,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) label.btn-light.active {
    --btn-base-bg: var(--mx-chip-strong);
    --btn-active-bg: var(--mx-chip-strong);
    box-shadow: inset 0 0 0 1px var(--mx-hair-strong);
}

/* Pager page chip. Icon font on the arrows stays. */
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-grid-pager .k-link,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-pager-nav {
    color: var(--mx-text);
    background-color: transparent;
    border-color: transparent;
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-grid-pager .k-link:hover,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-pager-nav:hover {
    color: var(--mx-text);
    background-color: var(--mx-chip);
    border-color: transparent;
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-grid-pager .k-pager-numbers .k-link.k-selected,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-grid-pager .k-pager-numbers .k-link.k-selected:hover,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-pager-numbers .k-link.k-state-selected,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-pager-numbers .k-link.k-state-selected:hover,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-grid-pager .k-state-selected {
    color: var(--mx-text);
    background-color: var(--mx-chip-strong);
    border-color: var(--mx-hair-strong);
    box-shadow: none;
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-grid-pager .k-pager-sizes {
    border-color: var(--mx-hair);
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-grid-toolbar {
    background: var(--mx-surface-2);
    border-color: var(--mx-hair);
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-grid-toolbar .btn,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-grid-toolbar .k-button {
    color: var(--mx-muted);
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-grid-toolbar .btn:hover,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-grid-toolbar .k-button:hover {
    color: var(--mx-text);
    background-color: transparent;
}

/* Role chips, type badges, and the organization tree. */
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .select2 .select2-selection--multiple .select2-selection__choice {
    color: var(--mx-text);
    background: var(--mx-chip);
    border-color: var(--mx-hair-strong);
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .select2 .select2-selection--multiple .select2-selection__choice__remove {
    color: var(--mx-muted);
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .badge-secondary,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .badge-light {
    color: var(--mx-text);
    background-color: var(--mx-chip-strong);
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-treeview,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .tree,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-content,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-editable-area,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-group,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .rulegroup {
    background-color: var(--mx-surface);
    color: var(--mx-text);
    border-color: var(--mx-hair);
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-treeview .k-treeview-leaf,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-treeview .k-in {
    color: var(--mx-text);
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-treeview .k-treeview-leaf.k-selected,
html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .k-treeview .k-in.k-state-selected {
    background-color: var(--mx-chip-strong) !important;
    color: var(--mx-text) !important;
    border-color: transparent !important;
}

html[data-mx-theme="dark"] body:not(.ess-page):not(:has(#admin-home)) .rulegroup .rulegroup {
    background-color: var(--mx-surface-2);
}
