/* Background modes are independent of the accent and texture palettes. */
:root {
    --gtx-page-bg: var(--gtx-default-page-bg, ghostwhite);
    --gtx-page-tint-amount: 10%;
    --gtx-panel-tint-amount: 30%;
    --gtx-field-base: white;
    --gtx-field-depth: white;
    --gtx-field-background: var(--gtx-field-base);
    --gtx-input-background: var(--gtx-field-background);
    --gtx-field-ink: var(--bs-body-color);
    --gtx-field-placeholder: var(--bs-secondary-color);
}

/* Review links and ratings stay readable on charcoal surfaces. */
html[data-background-theme="dark"] .home-reviews {
    --home-reviews-link: #8ab4f8;
    --bs-secondary-color: var(--gtx-steel-panel-ink);
    opacity: 1;
}

html[data-background-theme="dark"] .home-reviews :is(.home-reviews-filter-note, #homeReviewsError) {
    --home-reviews-link: var(--gtx-steel-panel-ink);
}

/* Match home inventory specs and Hibu business replies to the dark field surface. */
html[data-background-theme="dark"] .home-inventory-specs > div,
html[data-background-theme="dark"] .home-reviews-card #fdnReviewsWidget .review > div:has(> div > span + p) {
    background: var(--gtx-dark-field-background);
    color: var(--bs-body-color);
}

html[data-background-theme="dark"] .home-reviews-card #fdnReviewsWidget .review > div:has(> div > span + p) :is(span, p) {
    color: var(--bs-body-color);
}

html[data-background-theme="dark"] .footer-strip.btn-gradient-grey :is(.text-muted, .footer-copyright, .footer-call-terms) {
    color: var(--gtx-gradient-ink) !important;
}

html[data-background-theme="dark"] .footer-strip.btn-gradient-grey .link-primary {
    color: var(--gtx-gradient-ink) !important;
    color: color-mix(in srgb, var(--gtx-gradient-ink) 85%, var(--bs-primary-text-emphasis, #9ec5fe)) !important;
    text-decoration-color: currentColor !important;
}

/* Chrome-inspired neutral charcoal surfaces and light foregrounds. */
html[data-background-theme="dark"] {
    color-scheme: dark;
    --gtx-default-page-bg: #202124;
    --gtx-page-tint-amount: 14%;
    --gtx-addgrid-header-background: var(--gtx-steel-header-background);
    --gtx-addgrid-header-ink: var(--bs-black, #000);
    --gtx-raised-surface-shadow: 0 16px 32px rgba(24, 29, 34, 0.22), inset 0 1px rgba(255, 255, 255, 0.12);
    --bs-body-bg: #292a2d;
    --bs-body-bg-rgb: 41, 42, 45;
    --bs-body-color: #e8eaed;
    --bs-body-color-rgb: 232, 234, 237;
    --bs-emphasis-color: #e8eaed;
    --bs-emphasis-color-rgb: 232, 234, 237;
    --bs-secondary-color: #bdc1c6;
    --bs-secondary-color-rgb: 189, 193, 198;
    --bs-secondary-bg: #35363a;
    --bs-secondary-bg-rgb: 53, 54, 58;
    --bs-tertiary-bg: #323337;
    --bs-tertiary-bg-rgb: 50, 51, 55;
    --gtx-tinted-panel-background: var(--bs-body-bg);
    --gtx-tinted-panel-background-alt: var(--bs-tertiary-bg);
    --gtx-grid-content-background: linear-gradient(180deg, var(--gtx-tinted-panel-background), var(--gtx-tinted-panel-background-alt));
    --pg-color-bg-row-selected: var(--inventory-selected-bg);
    --gtx-dropdown-surface: var(--gtx-tinted-panel-background-alt);
    --gtx-dropdown-hover: var(--bs-secondary-bg);
    --gtx-steel-panel-shade: rgb(0 0 0 / 30%);
    --gtx-steel-panel-ink: #fff;
    --gtx-tinted-steel-panel-background:
        linear-gradient(var(--gtx-steel-panel-shade), var(--gtx-steel-panel-shade)),
        var(--gtx-addgrid-header-background);
    --gtx-field-base: #3c3c3c;
    --gtx-field-depth: black;
    --gtx-field-border-base: #181818;
    --gtx-field-ink: var(--gtx-dark-field-ink);
    --gtx-field-placeholder: var(--gtx-dark-field-placeholder);
    --gtx-dark-field-background: var(--gtx-field-background);
    --gtx-dark-input-background: var(--gtx-input-background);
    --gtx-dark-field-border: var(--gtx-field-border-base);
    --gtx-dark-field-ink: #f8fbff;
    --gtx-dark-field-placeholder: #dce6f3;
}

@supports (color: color-mix(in srgb, white, black)) {
    html[data-background-theme] {
        --gtx-page-bg: color-mix(in srgb,
            var(--palette-canvas, var(--gtx-palette-tint-color)) var(--gtx-page-tint-amount),
            var(--gtx-default-page-bg, ghostwhite));
    }

    :root {
        --gtx-field-background: color-mix(in srgb,
            color-mix(in srgb, var(--gtx-palette-tint-color) 24%, var(--gtx-field-base)) 75%, var(--gtx-field-depth));
        --gtx-input-background: color-mix(in srgb, var(--gtx-field-background), white 18%);
    }

    html[data-background-theme="dark"] {
        --gtx-dropdown-hover: color-mix(in srgb, var(--bs-body-color) 10%, var(--gtx-dropdown-surface));
        --gtx-tinted-panel-background: color-mix(in srgb, var(--gtx-palette-tint-color) var(--gtx-panel-tint-amount), var(--bs-body-bg));
        --gtx-tinted-panel-background-alt: color-mix(in srgb, var(--gtx-palette-tint-color) var(--gtx-panel-tint-amount), var(--bs-tertiary-bg));
        --gtx-dark-field-border: color-mix(in srgb, var(--gtx-palette-tint-color) 20%, var(--gtx-field-border-base));
        --gtx-steel-panel-shade: rgb(0 0 0 / 28%);
        --gtx-steel-panel-tint: color-mix(in srgb,
            color-mix(in srgb, var(--gtx-palette-tint-color) 60%, #f6f6f6) calc(var(--gtx-panel-tint-amount) / .6),
            transparent);
        --gtx-tinted-steel-panel-background:
            linear-gradient(var(--gtx-steel-panel-shade), var(--gtx-steel-panel-shade)),
            linear-gradient(var(--gtx-steel-panel-tint), var(--gtx-steel-panel-tint)),
            var(--gtx-addgrid-header-background);
    }
}

/* Keep the original field lightness and let the active palette supply the hue. */
@supports (color: oklch(from red .3544 min(c, .0299) h)) {
    html[data-background-theme="dark"] {
        --gtx-field-base: oklch(from var(--gtx-palette-tint-color) .3544 min(c, .0299) h);
        --gtx-field-border-base: oklch(from var(--gtx-palette-tint-color) .2097 min(c, .024) h);
    }
}

/* Silver needs a deeper shade to keep white text readable across the gradient. */
html.theme-silver[data-background-theme="dark"] {
    --gtx-steel-panel-shade: rgb(0 0 0 / 37%);
}

html[data-background-theme] body {
    background-color: var(--gtx-page-bg);
}

html[data-background-theme="dark"] body {
    color: var(--bs-body-color);
}

html[data-background-theme="dark"] .btn:is(.gradient, .btn-gradient-grey:not(.active)):is(.light-gradient-action, [data-bs-toggle="dropdown"]),
html[data-background-theme="dark"] #sortDirection[aria-pressed="false"] {
    --gtx-button-background: var(--gtx-light-control-background);
    --gtx-button-ink: var(--gtx-light-control-ink);
}

/* Keep a readable fill for controls that are transparent in light mode. */
html[class][data-background-theme="dark"] body .btn:is(.gradient, .btn-gradient-grey:not(.active)):not(:where(.nav.nav-tabs.no-wrap-group > .btn[role="tab"])) {
    --gtx-gradient-background: var(--gtx-button-background, var(--gtx-palette-header-background));
    --gtx-gradient-ink: var(--gtx-button-ink, var(--gtx-palette-header-ink));
    background: var(--gtx-gradient-background) !important;
    color: var(--gtx-gradient-ink) !important;
    text-shadow: none !important;
}

html[data-background-theme="dark"] .dropdown-toggle[data-bs-toggle="dropdown"]::after {
    filter: none;
}

html[data-background-theme="dark"] :is(.pg-filter-btn, .pg-chips-clear-all):focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 1px;
}

html[class][data-background-theme="dark"] body .btn-gradient-grey:not(.btn) {
    --gtx-gradient-background: linear-gradient(180deg, #747c84, #555d65);
    --gtx-gradient-ink: #fff;
    border-color: #4f565e !important;
    color: var(--gtx-gradient-ink) !important;
    background: var(--gtx-gradient-background) !important;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.2), 0 2px 5px rgba(31, 37, 43, 0.24) !important;
}

html[data-background-theme="dark"] .btn.btn-gradient-grey,
html[data-background-theme="dark"] #inventorySidebarPane .inventory-clear-btn.btn-gradient-grey {
    border-width: 0 !important;
}

html[data-background-theme="dark"] #inventorySidebarPane .inventory-clear-btn.btn-gradient-grey,
html[class][data-background-theme="dark"] body .btn:is(.gradient, .btn-gradient-grey:not(.active)):not(:where(.gtx-compare-toggle.is-selected, .nav.nav-tabs.no-wrap-group > .btn[role="tab"])) {
    border-color: rgb(255 255 255 / var(--gtx-button-border-opacity, 25%)) !important;
    border-color: color-mix(in srgb, currentColor var(--gtx-button-border-opacity, 25%), transparent) !important;
    box-shadow: var(--gtx-button-shadow, 0 .9rem 2rem rgba(0, 0, 0, .2)) !important;
}

html[data-background-theme="dark"] .btn:is(.gradient, .btn-gradient-grey:not(.active)):not(:disabled, .disabled, [aria-disabled="true"], .scroll-button):is(:hover, :focus-visible) {
    --gtx-button-border-opacity: 52%;
    --gtx-button-shadow: 0 1.1rem 2.5rem rgba(0, 0, 0, .3);
}

html[data-background-theme="dark"] .btn-gradient-grey.active[role="tab"],
.nav.nav-tabs.no-wrap-group > .btn-gradient-grey.active[role="tab"] {
    text-decoration: underline;
    text-underline-offset: .2em;
}

html[class][data-background-theme="dark"] .btn:is(.gradient, .btn-gradient-grey:not(.active)):not(:where(.nav.nav-tabs.no-wrap-group > .btn[role="tab"])):focus-visible {
    outline: 2px solid currentColor;
    outline-offset: -3px;
}

html[data-background-theme="dark"] :is(.inventory-dashboard-period-control, .inventory-dashboard-card, .inventory-dashboard-grid-header) {
    background: var(--gtx-tinted-steel-panel-background);
    box-shadow: var(--gtx-raised-surface-shadow);
}

html[data-background-theme="dark"] .inventory-dashboard-card :is(.inventory-dashboard-title, .inventory-dashboard-legend > .text-muted, #inventoryDashboardStatusEmpty) {
    color: var(--gtx-steel-panel-ink) !important;
}

html[data-background-theme="dark"] .pg-grid-table > thead {
    --gtx-addgrid-header-background: var(--gtx-palette-tint-overlay, none), var(--pg-color-bg-muted);
    --gtx-addgrid-header-ink: var(--pg-color-text-header);
}

/* Use the palette's light finish for themed column headers and matching surfaces. */
html[data-background-theme="dark"] :is(
    .gtx-admin-add-grid,
    .inventory-dashboard-add-grid,
    .majordome-add-grid,
    .majordome-management-add-grid,
    .majordome-inventory-grid-style
) .pg-grid-table > thead,
html[data-background-theme="dark"] .majordome-workspace > #myTab {
    --gtx-addgrid-header-background: var(--gtx-palette-header-background);
    --gtx-addgrid-header-ink: var(--gtx-palette-header-ink);
}

html[data-background-theme="dark"] .pg-grid-table > thead,
html[data-background-theme="dark"] .pg-search-bar,
html[data-background-theme="dark"] .pg-grid-footer {
    background: var(--gtx-addgrid-header-background) !important;
}

html[data-background-theme="dark"] :is(.pg-search-bar, .pg-grid-footer) {
    --gtx-addgrid-header-background: var(--gtx-tinted-steel-panel-background);
    --gtx-addgrid-header-ink: var(--gtx-steel-panel-ink);
}

html[data-background-theme="dark"] .pg-grid-table > thead > tr > th {
    background: transparent !important;
    color: var(--gtx-addgrid-header-ink) !important;
}

html[data-background-theme="dark"] :is(#blogsAddGrid, #specialsAddGrid, .majordome-inventory-grid-style) .pg-grid-table > thead > tr > th {
    background: var(--gtx-addgrid-header-background) !important;
}

html[data-background-theme="dark"] .pg-grid-table > thead :is(.pg-th-label, .pg-sort-icon, .pg-filter-btn) {
    color: var(--gtx-addgrid-header-ink) !important;
}

html[data-background-theme="dark"] #modalShortcuts,
html[data-background-theme="dark"] .gtx-vehicle-gallery {
    background: var(--gtx-addgrid-header-background);
}

html[data-background-theme="dark"] .inventory-player-title .page-title-inventory-address.copied {
    color: inherit;
    text-decoration: underline;
}

html[data-background-theme="dark"] .pg-grid-table > thead .pg-th-sortable .pg-th-label:hover {
    text-decoration: underline;
}

html[data-background-theme="dark"] :is(
    .inventory-dashboard-trend-chart,
    .pg-grid-scroll,
    #majordomeInventoryTable:not(.pg-grid-table),
    .majordome-logs-table-wrap,
    .sitemap-table
) {
    background: var(--gtx-grid-content-background);
}

html[data-background-theme="dark"] :is(.pg-grid-table, #majordomeInventoryTable, #logsTable, .sitemap-table) > tbody {
    --bs-table-bg: transparent;
    --pg-color-text: var(--bs-body-color);
    --pg-color-text-muted: var(--bs-secondary-color);
    --pg-color-text-subtle: var(--bs-secondary-color);
}

/* Let the scroll area's gradient show through regular rows with a subtle stripe. */
html[data-background-theme="dark"] :is(.pg-grid-table, #majordomeInventoryTable) > tbody > :is(.pg-row-even, .pg-row-odd, .majordome-vehicle-row) {
    background: transparent;
    --gtx-grid-cell-overlay: transparent;
}

html[data-background-theme="dark"] :is(.pg-grid-table, #majordomeInventoryTable) > tbody > :is(.pg-row-odd, .majordome-vehicle-row.is-alt) {
    background-color: rgb(255 255 255 / 3%);
}

html[data-background-theme="dark"] :is(.pg-grid-table, #majordomeInventoryTable) > tbody > :is(.pg-row-even, .pg-row-odd, .majordome-vehicle-row):hover {
    --gtx-grid-cell-overlay: rgb(255 255 255 / 7%);
}

html[data-background-theme="dark"] :is(.pg-grid-table, #majordomeInventoryTable) > tbody > :is(.pg-row-even, .pg-row-odd, .majordome-vehicle-row):not(.pg-row-selected, .is-selected, .is-expanded, .appraisal-subject-row) > td {
    background-color: var(--gtx-grid-cell-overlay);
}

html[data-background-theme="dark"] .pg-grid-wrapper {
    --pg-color-bg-row-selected: var(--inventory-selected-bg);
}

html[data-background-theme="dark"] :is(.pg-grid-table, #majordomeInventoryTable) > tbody > :is(.pg-row-selected, .is-selected) {
    box-shadow: inset .32rem 0 var(--inventory-selected-accent);
}

html[data-background-theme="dark"] :is(.pg-grid-table, #majordomeInventoryTable) > tbody > :is(.pg-row-selected, .is-selected) > td {
    background: var(--inventory-selected-bg);
    border-color: rgba(108, 117, 125, .24);
}

html[data-background-theme="dark"] :is(.pg-grid-table, #majordomeInventoryTable) > tbody > :is(.pg-row-selected, .is-selected) > td:first-child {
    box-shadow: inset .22rem 0 var(--inventory-selected-accent);
}

html[data-background-theme="dark"] .pg-grid-footer .pg-pager-num:not(.pg-pager-active):not(:hover) {
    color: var(--gtx-steel-panel-ink);
    border-color: currentColor;
}

html[data-background-theme="dark"] .pg-grid-footer .pg-pager-ellipsis {
    color: var(--gtx-steel-panel-ink);
}

html[data-background-theme="dark"] .pg-grid-footer .pg-pager-active {
    color: var(--bs-black, #000);
}

html[data-background-theme="dark"] .pg-grid-footer .pg-pager-info-of {
    color: inherit;
}

html[data-background-theme="dark"] .pg-grid-footer .pg-pager-info-empty {
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
}

/* Keep Management sidebar controls on the dark palette. */
html[data-background-theme]:not([data-background-theme="light"]) .majordome-management-sidebar-pane {
    --inventory-ink: var(--bs-body-color);
    --inventory-muted: var(--bs-secondary-color);
    --inventory-border: var(--bs-border-color);
    --inventory-line: var(--bs-border-color);
    --inventory-surface-alt: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
    scrollbar-color: var(--bs-secondary-color) transparent;
}

html[data-background-theme]:not([data-background-theme="light"]) .majordome-management-sidebar-pane::-webkit-scrollbar-thumb {
    background: var(--bs-secondary-color);
}

/* Quick-search matches keep dark ink on their yellow highlight in dark mode. */
html[data-background-theme="dark"] .pg-search-match {
    color: #212529;
}

/* AddGrid appends filter popups to the body, outside the themed grids. */
html[data-background-theme="dark"] .pg-filter-dropdown {
    --pg-color-bg: var(--gtx-dropdown-surface);
    --pg-color-border-accent: var(--bs-border-color);
    --pg-color-border-subtle: var(--bs-tertiary-bg);
    --pg-color-text: var(--bs-body-color);
    --pg-color-text-dark: var(--bs-body-color);
    color: var(--bs-body-color);
}

html[data-background-theme="dark"] .pg-filter-footer .btn-link {
    color: var(--bs-secondary-color) !important;
}

/* Bootstrap button states and the grid's label/border overrides share the palette. */
html[data-background-theme]:not([data-background-theme="light"]) .pg-search-clear {
    --pg-color-border: var(--bs-border-color);
    --pg-color-text-subtle: var(--bs-secondary-color);
    --pg-color-text-dark: var(--bs-body-color);
    --bs-btn-color: var(--bs-body-color);
    --bs-btn-bg: var(--bs-body-bg);
    --bs-btn-border-color: var(--bs-border-color);
    --bs-btn-hover-color: var(--bs-body-color);
    --bs-btn-hover-bg: var(--bs-secondary-bg);
    --bs-btn-hover-border-color: var(--bs-border-color);
    --bs-btn-focus-shadow-rgb: var(--bs-body-color-rgb);
    --bs-btn-active-color: var(--bs-body-color);
    --bs-btn-active-bg: var(--bs-tertiary-bg);
    --bs-btn-active-border-color: var(--bs-border-color);
    --bs-btn-disabled-color: var(--bs-secondary-color);
    --bs-btn-disabled-bg: var(--bs-body-bg);
    --bs-btn-disabled-border-color: var(--bs-border-color);
}

/* Grouping controls use the same surfaces and readable labels as other controls. */
html[data-background-theme]:not([data-background-theme="light"]) .pg-group-bar {
    --pg-color-bg-muted: var(--bs-tertiary-bg);
    --pg-color-text-muted: var(--bs-secondary-color);
    color: var(--bs-body-color);
}

html[data-background-theme]:not([data-background-theme="light"]) .pg-group-bar:not(.pg-drag-over) {
    border-color: var(--bs-border-color);
}

html[data-background-theme]:not([data-background-theme="light"]) .pg-group-bar :is(.pg-group-bar-label, .pg-group-bar-placeholder) {
    color: var(--bs-secondary-color);
    text-shadow: none;
}

html[data-background-theme]:not([data-background-theme="light"]) .pg-group-bar .pg-group-chip {
    background: var(--bs-body-bg);
    border-color: var(--bs-border-color);
    border-left-color: var(--bs-secondary-color);
}

html[data-background-theme]:not([data-background-theme="light"]) .pg-group-bar .pg-group-chip-label {
    color: var(--bs-body-color);
}

html[data-background-theme]:not([data-background-theme="light"]) .pg-group-bar .pg-group-chip-remove:not(:hover) {
    color: var(--bs-secondary-color);
}

/* Keep dark borders and progress tracks on their corresponding palettes. */
html[data-background-theme]:not([data-background-theme="light"]) .health-card {
    border-color: var(--bs-border-color);
}

html[data-background-theme]:not([data-background-theme="light"]) .health-card .progress {
    background: var(--bs-secondary-bg);
}

html[data-background-theme]:not([data-background-theme="light"]) .health-card-maintenance.is-offline {
    border-color: var(--bs-danger-border-subtle);
}

/* Keep the light-surface details shortcut consistent in every palette. */
html[data-background-theme] .gtx-open.text-dark {
    color: #212529 !important;
}

html[data-background-theme]:not([data-background-theme="light"]) #inventory,
html[data-background-theme]:not([data-background-theme="light"]) .inventory-results-zone {
    color: var(--bs-body-color);
}

html[data-background-theme] #inventorySidebarPane :is(.inventory-filter-panel-body, .inventory-dependent-panel-empty) {
    background-color: var(--gtx-page-bg, ghostwhite);
}

html[data-background-theme]:not([data-background-theme="light"]) #inventorySidebarPane .inventory-dependent-empty {
    color: var(--bs-body-color);
}

html[data-background-theme]:not([data-background-theme="light"]) #inventorySidebarPane :is(.inventory-filter-panel-count, .inventory-range-values, .inventory-range-output, .inventory-check-row) {
    color: var(--gtx-gradient-ink);
}

html[data-background-theme]:not([data-background-theme="light"]) #inventorySidebarPane .inventory-check-row:hover,
html[data-background-theme="dark"] #majordomeManagementLogMenu .majordome-management-log-status:not(.is-selected, .is-active, :disabled):is(:hover, :focus) {
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color);
}

html[data-background-theme="dark"] #inventorySidebarPane :is(.inventory-check-hit, .inventory-filter-check:not(:checked, :indeterminate)) {
    background-color: var(--gtx-dark-field-background);
    color: var(--gtx-dark-field-ink);
}

html[data-background-theme="dark"] #inventorySidebarPane .inventory-filter-check {
    background-image: var(--bs-form-check-bg-image, none);
}

html[data-background-theme] :is(.inventory-filter-panel-toggle, .majordome-management-log-date-toggle, .theme-group-toggle)::after,
html[data-background-theme] .gtx-overview-toggle .toggle-icons,
html[data-background-theme] .collapse-toggle:not(.gtx-overview-toggle) .toggle-icons > :is(.icon-plus, .icon-minus) {
    background: var(--gtx-palette-header-background);
    color: var(--gtx-palette-header-ink);
}

html[data-background-theme] .collapse-toggle:not(.gtx-overview-toggle) .toggle-icons > :is(.icon-plus, .icon-minus) {
    padding: .25em;
    border-radius: var(--bs-border-radius-sm);
    line-height: 1;
}

html[data-background-theme]:not([data-background-theme="light"]) .majordome-management-log-tree::-webkit-scrollbar-track {
    background: var(--bs-tertiary-bg);
}

html[data-background-theme]:not([data-background-theme="light"]) .majordome-management-log-tree::-webkit-scrollbar-thumb {
    border-color: var(--bs-tertiary-bg);
}

html[data-background-theme]:not([data-background-theme="light"]) .inventory-empty-filter {
    background: var(--bs-body-bg);
    color: var(--bs-secondary-color);
}

html[data-background-theme]:not([data-background-theme="light"]) .marketing-page {
    --mp-ink: var(--bs-body-color);
    --mp-muted: var(--bs-secondary-color);
}

/* Staff cards and the contact dialog share the selected background palette. */
html[data-background-theme]:not([data-background-theme="light"]) .staff-page {
    --staff-ink: var(--bs-body-color);
    --staff-line: var(--bs-border-color);
}

html[data-background-theme]:not([data-background-theme="light"]) :is(.staff-card, .staff-empty-state) {
    border-color: var(--bs-border-color);
}

html[data-background-theme="dark"] :is(.staff-card, .staff-empty-state) {
    --staff-ink: var(--gtx-steel-panel-ink);
}

html[data-background-theme]:not([data-background-theme="light"]) .staff-card-photo {
    background: var(--bs-tertiary-bg);
}

html[data-background-theme]:not([data-background-theme="light"]) .staff-contact-error strong {
    color: var(--bs-body-color);
}

html[data-background-theme]:not([data-background-theme="light"]) :is(.staff-contact-loading, .staff-contact-error) {
    color: var(--bs-secondary-color);
}

html[data-background-theme]:not([data-background-theme="light"]) .staff-contact-footer {
    background: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-secondary-color);
}

html[data-background-theme]:not([data-background-theme="light"]) .staff-modal-close {
    background: var(--bs-secondary-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

html[data-background-theme]:not([data-background-theme="light"]) .staff-contact-error i {
    color: var(--bs-danger-text-emphasis);
}

html[data-background-theme]:not([data-background-theme="light"]) .about-value {
    background: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

html[data-background-theme]:not([data-background-theme="light"]) .vehicle-detail-page {
    --vdp-ink: var(--bs-body-color);
    --vdp-muted: var(--bs-secondary-color);
}

html[data-background-theme]:not([data-background-theme="light"]) :is(.gtx-card, .home-inventory-card-body, .blog-list-card, .blog-empty, .legal-document, .ui-widget-content, .chosen-container-single .chosen-single, .chosen-container-multi .chosen-choices) {
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
}

html[data-background-theme="dark"] :is(
    .contact-form-panel,
    .contact-showroom,
    .marketing-section-label,
    .home-reviews,
    .staff-card,
    .staff-empty-state,
    .about-story,
    .majordome-editor-section
),
html[data-background-theme="dark"] .marketing-section-label > small,
html[data-background-theme="dark"] :where(.majordome-inventory-appraisal) :is(.inventory-appraisal-intro, .pr-market-overview, .pr-demand, .pr-grid-section),
html[data-background-theme="dark"] .testimonials-page .t-card,
html[data-background-theme="dark"] .health-card-col > .health-card,
html[data-background-theme="dark"] :is(#openHours, #menuScheduleMobile, #mobileMenuVisit) .open-hours-content {
    background: var(--gtx-tinted-steel-panel-background);
    color: var(--gtx-steel-panel-ink);
}

html[data-background-theme="dark"] :is(.contact-form-panel .contact-panel-heading, .contact-showroom .contact-address, .staff-card-identity small, .staff-empty-state p) {
    color: var(--gtx-steel-panel-ink);
}

html[data-background-theme="dark"] .testimonials-page .t-card {
    --mp-ink: var(--gtx-steel-panel-ink);
    --bs-secondary-color: var(--gtx-steel-panel-ink);
}

html[data-background-theme="dark"] .contact-form-panel .contact-panel-heading small {
    opacity: 1;
}

html[data-background-theme="dark"] .contact-form-consent {
    --bs-secondary-color: var(--gtx-steel-panel-ink);
    background: var(--gtx-tinted-steel-panel-background) !important;
}

html[data-background-theme="dark"] .contact-form-consent a {
    color: var(--gtx-steel-panel-ink) !important;
    text-decoration: underline;
    text-decoration-color: currentColor !important;
}

/* Blend the stock silhouette into the photo frame, keeping uploaded photos intact. */
html[data-background-theme="dark"] #employeeModalBody .bg-light:has(> #photoPreview[src$="/staff/empty.jpg" i]) {
    background: var(--gtx-dark-field-background) !important;
    isolation: isolate;
}

html[data-background-theme="dark"] #employeeModalBody #photoPreview[src$="/staff/empty.jpg" i] {
    filter: invert(1) brightness(1.8);
    mix-blend-mode: screen;
}

html[data-background-theme="dark"] #blogModalBody .bg-light:has(> #imagePreview) {
    background: var(--gtx-dark-field-background) !important;
}

html[data-background-theme="dark"] .modal-body :is(.form-label, .card-header) i.text-primary,
html[data-background-theme="dark"] :is(#rolesPage, .sitemap-header) i.text-primary {
    color: var(--gtx-steel-panel-ink) !important;
}

html[data-background-theme="dark"] .modal-body .input-group-text i:is(.text-primary, .text-secondary) {
    color: inherit !important;
}

html[data-background-theme="dark"] .gtx-palette-badge {
    background: var(--gtx-palette-header-background) !important;
    color: var(--gtx-palette-header-ink) !important;
    border-color: color-mix(in srgb, currentColor 28%, transparent) !important;
}

html[data-background-theme="dark"] :is(#openHours, #menuScheduleMobile, #mobileMenuVisit) .open-hours-content > :is(.open-hours-content-heading, .open-hours-days, .open-hours-footnote) {
    --oh-ink: var(--gtx-steel-panel-ink);
    --oh-muted: var(--oh-ink);
    --oh-accent-ink: var(--oh-ink);
    --oh-marker: var(--oh-ink);
    --oh-stripe: rgb(0 0 0 / 5%);
    --oh-accent-soft: rgb(0 0 0 / 12%);
}

html[data-background-theme="dark"] :is(#openHours, #menuScheduleMobile) .open-hours-content .open-hours-day-name small {
    color: var(--bs-body-color);
}

html[data-background-theme]:not([data-background-theme="light"]) :is(.bg-white, .bg-light) {
    background-color: var(--bs-tertiary-bg) !important;
    color: var(--bs-body-color);
}

html[data-background-theme="dark"] .dropdown-menu {
    --bs-dropdown-bg: var(--gtx-dropdown-surface);
    --bs-dropdown-color: var(--bs-body-color);
    --bs-dropdown-link-color: var(--bs-body-color);
    --bs-dropdown-link-hover-color: var(--bs-body-color);
    --bs-dropdown-link-hover-bg: var(--gtx-dropdown-hover);
    --bs-dropdown-header-color: var(--bs-secondary-color);
}

html[data-background-theme="dark"] .majordome-batch-actions-menu {
    --inventory-surface: var(--gtx-dropdown-surface);
    --inventory-surface-alt: var(--gtx-dropdown-hover);
    --gtx-menu-icon-background: var(--gtx-palette-header-background);
    --gtx-menu-icon-ink: var(--gtx-palette-header-ink);
}

html[data-background-theme="dark"] .chosen-container .chosen-drop,
html[data-background-theme="dark"] #mobileMenuOffcanvas :is(#menuAboutMobile, .mobile-menu-address-card),
html[data-background-theme="dark"] select:not([multiple], [size]:not([size="1"])) :is(option, optgroup):not(:disabled) {
    background: var(--gtx-dropdown-surface);
    color: var(--bs-body-color);
}

html[data-background-theme="dark"] .chosen-container .chosen-results {
    color: var(--bs-body-color);
}

html[data-background-theme="dark"] .chosen-container .chosen-results li.highlighted {
    background: var(--gtx-dropdown-hover);
    color: var(--bs-body-color);
}

html[data-background-theme="dark"] .chosen-container .chosen-results :is(.disabled-result, .no-results) {
    color: var(--bs-secondary-color);
}

html[data-background-theme="dark"] .chosen-container .chosen-results .no-results {
    background: var(--gtx-dropdown-hover);
}

html[data-background-theme="dark"] #mobileMenuOffcanvas .mobile-menu-address-text :is(.text-dark, .text-secondary) {
    color: var(--bs-body-color) !important;
}

html[data-background-theme] #mobileMenuOffcanvas {
    --bs-offcanvas-bg: var(--gtx-field-background);
    --bs-offcanvas-color: var(--gtx-field-ink);
}

html[data-background-theme] #mobileMenuOffcanvas > .offcanvas-header {
    background: var(--gtx-palette-header-background);
    color: var(--gtx-palette-header-ink);
}

html[data-background-theme="light"] #mobileMenuOffcanvas .mobile-menu-brand-light,
html[data-background-theme="dark"] #mobileMenuOffcanvas .mobile-menu-brand-dark {
    display: none;
}

html[data-background-theme]:not([data-background-theme="light"]) :is(
    .card,
    .modal-content,
    .offcanvas,
    .list-group-item:not(:where(:is(.inventory-management-upload-log, .majordome-bulk-progress-log) > .list-group-item)),
    .accordion
) {
    --bs-card-bg: var(--bs-body-bg);
    --bs-card-color: var(--bs-body-color);
    --bs-modal-bg: var(--bs-body-bg);
    --bs-modal-color: var(--bs-body-color);
    --bs-offcanvas-bg: var(--bs-body-bg);
    --bs-offcanvas-color: var(--bs-body-color);
    --bs-list-group-bg: var(--bs-body-bg);
    --bs-list-group-color: var(--bs-body-color);
    --bs-accordion-bg: var(--bs-body-bg);
    --bs-accordion-color: var(--bs-body-color);
}

html[data-background-theme]:not([data-background-theme="light"]) :is(.form-control, .form-select, .input-group-text) {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}

html[data-background-theme]:not([data-background-theme="light"]) :is(.form-control, .form-select):disabled {
    background-color: var(--bs-secondary-bg);
    color: var(--bs-secondary-color);
}

html[data-background-theme="dark"] .gtx-status-switch {
    padding-left: 2.5em;
}

html[data-background-theme="dark"] .gtx-status-switch > .form-check-input {
    width: 2em;
    margin-left: -2.5em;
    border-radius: 2em;
    background-position: left center;
}

@media (prefers-reduced-motion: no-preference) {
    html[data-background-theme="dark"] .gtx-status-switch > .form-check-input {
        transition: background-position 0.15s ease-in-out;
    }
}

html[data-background-theme="dark"] .gtx-status-switch > .form-check-input:checked,
html[data-background-theme] #pr-multiple-mode {
    --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
    background-image: var(--bs-form-switch-bg);
}

html[data-background-theme="dark"] .gtx-status-switch > .form-check-input:checked {
    background-position: right center;
}

/* The appraisal switch selects between two modes. */
html[data-background-theme="dark"] :is(.form-switch, .gtx-status-switch) .form-check-input:not(:checked):where(:not(#pr-multiple-mode)) {
    background-color: transparent;
    border-color: #6c7889;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2.25' fill='none' stroke='%23808da0' stroke-width='1.25'/%3e%3c/svg%3e");
}

html[data-background-theme="dark"] :is(.form-switch, .gtx-status-switch) .form-check-input:checked,
html[data-background-theme] #pr-multiple-mode {
    background-color: var(--gtx-palette-tint-color);
    border-color: var(--gtx-palette-tint-color);
    border-color: color-mix(in srgb, var(--gtx-palette-tint-color) 56%, white);
}

html.theme-silver[data-background-theme="dark"] :is(.form-switch, .gtx-status-switch) .form-check-input:checked,
html.theme-silver[data-background-theme] #pr-multiple-mode {
    --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23111827'/%3e%3c/svg%3e");
}

html[data-background-theme="dark"] :is(.form-switch, .gtx-status-switch) .form-check-input:focus,
html[data-background-theme] #pr-multiple-mode:focus {
    box-shadow: none;
}

html[data-background-theme="dark"] :is(.form-switch, .gtx-status-switch) .form-check-input:focus-visible {
    outline: 2px solid var(--gtx-dark-field-placeholder);
    outline-offset: 2px;
}

html[data-background-theme] #pr-multiple-mode:focus-visible {
    outline: 2px solid var(--bs-body-color);
    outline-offset: 2px;
}

html[data-background-theme="dark"] select:not(:disabled, [multiple], [size]:not([size="1"]), .gtx-chat select) {
    background-image: var(--gtx-light-control-background);
    color: var(--gtx-light-control-ink);
    color-scheme: light;
}

/* Keep Bootstrap's caret and validation icon above both gradient layers. */
html[data-background-theme="dark"] select.form-select:not(:disabled, [multiple], [size]:not([size="1"]), .gtx-chat select) {
    --bs-form-select-bg-img: var(--gtx-light-select-caret);
    background-image: var(--bs-form-select-bg-img), var(--bs-form-select-bg-icon, none), var(--gtx-light-control-background);
    background-position: right .75rem center, right 2.25rem center, center, center;
    background-size: 16px 12px, calc(.75em + .375rem) calc(.75em + .375rem), auto, auto;
}

html[data-background-theme="dark"] .chosen-container:not(.chosen-disabled) > :is(.chosen-single, .chosen-choices) {
    background: var(--gtx-light-control-background);
    color: var(--gtx-light-control-ink);
}

html[data-background-theme="dark"] .chosen-container:not(.chosen-disabled) .chosen-choices .search-field input[type="text"] {
    color: var(--gtx-light-control-ink);
}

/* Base typography has literal light-mode colors; component/hero colors still win. */
:where(html[data-background-theme]:not([data-background-theme="light"])) :is(h1, h2, h3, h4, h5, h6, h7, h8, p) {
    color: var(--bs-body-color);
}

html[data-background-theme]:not([data-background-theme="light"]) :is(.about-story > p, .legal-content, .legal-content h3, .legal-content p, .legal-content .text-secondary, .testimonials-page .t-card p) {
    color: var(--bs-body-color) !important;
}

html[data-background-theme="dark"] .legal-page {
    --mp-line: var(--bs-border-color-translucent);
}

html[data-background-theme="dark"] .legal-page :is(.legal-toc, :is(.legal-toc, .legal-page-nav) .btn-outline-secondary, .legal-content .border.rounded-4:not(.alert)) {
    background: var(--gtx-tinted-panel-background-alt);
    color: var(--mp-ink);
}

html[data-background-theme="dark"] .legal-page .legal-document .legal-document-header::after,
html[data-background-theme="dark"] .legal-page :is(.legal-page-nav .btn-secondary, .legal-back-to-top) {
    background: var(--gtx-palette-header-background);
    color: var(--gtx-palette-header-ink);
}

html[data-background-theme="dark"] .legal-page .legal-toc a.link-secondary {
    color: var(--mp-ink) !important;
}

html[data-background-theme="dark"] .legal-page :is(.legal-toc a.link-secondary, :is(.legal-toc, .legal-page-nav) .btn-outline-secondary):is(:hover, :focus-visible) {
    background: var(--gtx-dropdown-hover);
}

html[data-background-theme="dark"] .legal-page :is(.legal-toc a, .legal-page-nav a, .legal-back-to-top):focus-visible {
    outline: 2px solid var(--bs-primary-text-emphasis);
    outline-offset: 2px;
}

html[data-background-theme="dark"] .legal-page .legal-toc a.link-secondary i {
    color: currentColor;
}

html[data-background-theme="dark"] .legal-page .legal-document a:not(.btn, .link-secondary, .legal-back-to-top) {
    color: var(--bs-link-color);
}

html[data-background-theme="dark"] .legal-page .legal-document .alert {
    background: var(--bs-alert-bg);
    border-color: var(--bs-alert-border-color) !important;
    color: var(--bs-body-color);
}

html[data-background-theme="dark"] .legal-page .legal-notice::before,
html[data-background-theme="dark"] .legal-page .legal-document .alert :is(.fw-bold, .fw-semibold, i) {
    color: var(--bs-alert-color);
}

html[data-background-theme="dark"] .terms-page .legal-document :is(p.text-secondary, .list-group-item .text-secondary) {
    color: var(--mp-ink) !important;
}

html[data-background-theme="dark"] .terms-page .legal-document .list-group-item .text-danger {
    color: var(--bs-danger-text-emphasis) !important;
}

html[data-background-theme="dark"] .legal-page .legal-back-to-top {
    bottom: calc(var(--gtx-footer-height) + 5rem);
}

/* Home card copy stays white on dark surfaces; offers retain their accent-theme colors. */
html[data-background-theme="dark"] .home-inventory-card .home-inventory-card-body,
html[data-background-theme="dark"] .home-inventory-card-body :is(.home-inventory-card-heading, h2, p, dt, dd, dt i) {
    color: #fff;
}

html[data-background-theme] :is(.pe-editor, .pe-context-menu) {
    --pe-color-bg: var(--gtx-input-background);
    --pe-color-bg-toolbar: var(--gtx-field-background);
    --pe-color-bg-group: var(--gtx-input-background);
    --pe-color-bg-btn-active: color-mix(in srgb, var(--gtx-palette-tint-color) 38%, var(--gtx-field-background));
    --pe-color-placeholder: var(--gtx-field-placeholder);
}

/* AddEdit's detached context menu shares the editor's dark palette. */
html[data-background-theme="dark"] :is(.pe-editor, .pe-context-menu) {
    --pe-color-border: var(--bs-border-color);
    --pe-color-border-strong: #69717c;
    --pe-color-border-focus: #8ab4f8;
    --pe-color-bg-btn-hover: var(--gtx-dropdown-hover);
    --pe-color-text: var(--bs-body-color);
    --pe-color-text-muted: var(--bs-secondary-color);
    --pe-color-text-subtle: var(--bs-secondary-color);
    --pe-color-accent: #8ab4f8;
    --pe-color-shadow-focus: rgba(138, 180, 248, .25);
    --pe-color-shadow-toolbar: rgba(0, 0, 0, .18);
    --pe-color-shadow-group: rgba(0, 0, 0, .2);
    --pe-text-shadow: none;
    color: var(--pe-color-text);
}

html[data-background-theme="dark"] .pe-context-menu {
    --pe-color-bg: var(--gtx-dropdown-surface);
}

html[data-background-theme="dark"] .pe-toolbar {
    --pe-color-bg-toolbar: var(--gtx-tinted-steel-panel-background);
}

html:where([data-background-theme="dark"]) .pe-settings-btn {
    background-color: var(--pe-color-bg-group);
}

html[data-background-theme="dark"] #blogModalBody .pe-toolbar :is(.pe-btn, .pe-select):focus-visible {
    outline: 2px solid var(--gtx-dark-field-placeholder);
    outline-offset: -2px;
}

html[data-background-theme="dark"] :is(.pe-editor, .pe-context-menu) .pe-select:disabled {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23bdc1c6' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
}

html[data-background-theme="dark"] :is(.pe-editor, .pe-context-menu) .pe-select:not(:disabled) {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2364748b' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E"), var(--gtx-light-control-background);
    background-position: right .55rem center, center, center;
    color: var(--gtx-light-control-ink);
}

html[data-background-theme="dark"] :is(.pe-editor, .pe-context-menu) .pe-select option {
    background: var(--pe-color-bg);
    color: var(--pe-color-text);
}

html[data-background-theme="dark"] .pe-editor .pe-btn.pe-active {
    box-shadow: inset 0 0 0 1px var(--pe-color-border-focus);
}

html[data-background-theme="dark"] .pe-editor .pe-body .strong-story {
    color: var(--pe-color-text);
}

html[data-background-theme] .pe-editor .pe-source {
    background-color: var(--gtx-input-background);
    color: var(--gtx-field-ink);
}

html[data-background-theme] .pe-editor.pe-readonly .pe-source {
    background-color: var(--gtx-field-background);
}

html[data-background-theme="light"] .pe-editor :is(.pe-body[contenteditable="true"], .pe-source):focus-visible {
    outline: 2px solid var(--pe-color-accent);
    outline-offset: -2px;
}

html[data-background-theme] .pe-editor .pe-body :where(p, a) {
    color: inherit;
}

html[data-background-theme] .pe-editor .pe-body a {
    text-decoration: underline;
}

html[data-background-theme] :is(
    .majordome-workspace #tab-details, .vehicle-detail-page,
    .gtx-vehicle-profile, .gtx-vehicle-gallery-body, .gtx-vin-report,
    .inventory-management-upload-log, .majordome-bulk-preview, .majordome-bulk-progress-log
) {
    --gtx-detail-panel-surface: var(--gtx-tinted-panel-background, #f8fafc);
    --gtx-detail-panel-surface-alt: var(--gtx-tinted-panel-background-alt, #fff);
    --gtx-detail-panel-finish: linear-gradient(180deg, var(--gtx-detail-panel-surface-alt), var(--gtx-detail-panel-surface));
}

@supports (color: color-mix(in srgb, white, black)) {
    html[data-background-theme="light"] :is(
        .majordome-workspace #tab-details, .vehicle-detail-page,
        .gtx-vehicle-profile, .gtx-vehicle-gallery-body, .gtx-vin-report,
        .inventory-management-upload-log, .majordome-bulk-preview, .majordome-bulk-progress-log
    ) {
        --gtx-detail-panel-surface: color-mix(in srgb, var(--gtx-palette-tint-color) var(--gtx-panel-tint-amount), #f8fafc);
        --gtx-detail-panel-surface-alt: color-mix(in srgb, var(--gtx-palette-tint-color) var(--gtx-panel-tint-amount), white);
    }
}

html[data-theme-finish="solid"] :is(
    .majordome-workspace #tab-details, .vehicle-detail-page,
    .gtx-vehicle-profile, .gtx-vehicle-gallery-body, .gtx-vin-report,
    .inventory-management-upload-log, .majordome-bulk-preview, .majordome-bulk-progress-log
) {
    --gtx-detail-panel-finish: none;
}

html[data-background-theme] .majordome-workspace #tab-details .majordome-story-panel,
html[data-background-theme] .vehicle-detail-page .vdp-concierge-heading,
html[data-background-theme] .gtx-vin-report .avd-report,
html[data-background-theme] :is(
    .gtx-vehicle-profile-body, .gtx-vehicle-gallery-body,
    .inventory-management-upload-log, .majordome-bulk-progress-log,
    .majordome-remove-bg-filterbar, .majordome-remove-bg-token-card, .majordome-background-preview-card
) {
    background-color: var(--gtx-detail-panel-surface);
    background-image: var(--gtx-detail-panel-finish);
    color: var(--gtx-steel-panel-ink, var(--bs-body-color));
}

@media (max-width: 767.98px) {
    html[data-background-theme] .vehicle-detail-page :is(.gtx-story-body, .vdp-photo-pending) {
        background-color: var(--gtx-detail-panel-surface);
        background-image: var(--gtx-detail-panel-finish);
    }

    html[data-background-theme] .vehicle-detail-page .vdp-photo-pending {
        border-color: var(--vdp-line);
        color: var(--vdp-ink);
    }

    html[data-background-theme] .vehicle-detail-page .vdp-photo-pending-camera {
        border-color: var(--vdp-line);
        background: var(--gtx-palette-header-background);
        color: var(--gtx-palette-header-ink);
    }

    html[data-background-theme] .vehicle-detail-page .vdp-photo-pending :is(.vdp-photo-pending-kicker, small) {
        color: var(--vdp-ink);
        color: color-mix(in srgb, var(--vdp-ink) 65%, var(--vdp-muted));
    }
}

html[data-background-theme] :is(.inventory-management-upload-log, .majordome-bulk-progress-log) > .list-group-item-light {
    --bs-list-group-bg: transparent;
    --bs-list-group-color: inherit;
}

html[data-background-theme] :is(#inventoryManagementUploadTrack, #majordomeBulkProgressTrack) {
    --bs-progress-bg: var(--gtx-field-background, var(--bs-secondary-bg));
}

html[data-background-theme] .gtx-vehicle-profile {
    --overview-surface: var(--gtx-detail-panel-surface);
    --overview-soft: var(--gtx-detail-panel-surface-alt);
    --overview-line: var(--bs-border-color);
    --overview-accent: color-mix(in srgb, var(--gtx-palette-tint-color) 35%, var(--bs-body-color));
}

.gtx-dataone-body .table {
    --bs-table-bg: transparent;
}

html[data-background-theme="dark"] .gtx-vehicle-profile-body {
    --bs-secondary-color: var(--gtx-dark-field-placeholder);
}

.gtx-dataone-body .gtx-price-table .gtx-retail-muted {
    color: var(--bs-secondary-color);
}

.gtx-dataone-body .gtx-price-table .text-danger {
    color: var(--bs-danger-text-emphasis) !important;
}

html[data-background-theme="dark"] .gtx-dataone-body .gtx-price-table .text-danger {
    color: color-mix(in srgb, var(--bs-danger-text-emphasis) 45%, white) !important;
}

html[data-background-theme="dark"] :is(.inventory-dashboard-expand-button, .inventory-dashboard-history-change-toggle),
html[data-background-theme="dark"] :is(.inventory-dashboard-expand-button, .inventory-dashboard-history-change-toggle) i {
    color: #212529;
}

html[data-background-theme="dark"] :is(.inventory-dashboard-expand-button, .inventory-dashboard-history-change-toggle):focus-visible {
    outline: 2px solid var(--gtx-dark-field-placeholder);
    outline-offset: 2px;
}

/* Expanded history shares the grid's palette, including nested changes. */
html[data-background-theme="dark"] .inventory-dashboard-history-panel {
    --dashboard-line: var(--bs-border-color);
    --dashboard-muted: var(--bs-secondary-color);
    background: var(--gtx-grid-content-background);
    color: var(--bs-body-color);
}

html[data-background-theme="dark"] .majordome-management-detail-panel {
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

html[data-background-theme="dark"] .inventory-dashboard-history-panel :is(.inventory-dashboard-history-table, .inventory-dashboard-change-table),
html[data-background-theme="dark"] .majordome-management-detail-panel .inventory-dashboard-change-table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--bs-body-color);
    --bs-table-border-color: var(--bs-border-color);
    --bs-table-striped-color: var(--bs-body-color);
    --bs-table-hover-color: var(--bs-body-color);
    background: var(--gtx-grid-content-background);
}

html[data-background-theme="dark"] .inventory-dashboard-history-panel .inventory-dashboard-change-detail-panel,
html[data-background-theme="dark"] .majordome-management-detail-panel {
    background: var(--gtx-grid-content-background);
}

html[data-background-theme="dark"] .inventory-dashboard-change-table > thead {
    background: var(--gtx-palette-header-background) !important;
}

html[data-background-theme="dark"] .inventory-dashboard-change-table > thead > tr > th {
    background: transparent !important;
    border-color: var(--bs-border-color);
    color: var(--gtx-palette-header-ink);
}

html[data-background-theme="dark"] .inventory-dashboard-history-panel .inventory-dashboard-change-table td,
html[data-background-theme="dark"] .majordome-management-detail-panel .inventory-dashboard-change-table td {
    background: transparent !important;
}

html[data-background-theme="dark"] :is(.inventory-dashboard-history-panel .inventory-dashboard-history-status, .majordome-background-preview-date) {
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color);
}

html[data-background-theme="dark"] :is(.inventory-dashboard-history-panel .inventory-dashboard-history-status, .majordome-background-preview-date).is-added {
    background: var(--bs-success-bg-subtle);
    color: var(--bs-success-text-emphasis);
}

html[data-background-theme="dark"] .inventory-dashboard-history-panel .inventory-dashboard-history-status.is-removed {
    background: var(--bs-danger-bg-subtle);
    color: var(--bs-danger-text-emphasis);
}

html[data-background-theme="dark"] .inventory-dashboard-history-panel .inventory-dashboard-history-status.is-updated {
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
}

html[data-background-theme="dark"] :is(.inventory-dashboard-history-panel .inventory-dashboard-history-status, .majordome-background-preview-date).is-purchased {
    background: var(--bs-warning-bg-subtle);
    color: var(--bs-warning-text-emphasis);
}

html[data-background-theme="dark"] .vin-decoder-input-group {
    border-color: #8a9099;
}

html[data-background-theme="dark"] body .gradient,
html[data-background-theme="dark"] .card-body.gradient > .card-subtitle.text-muted {
    color: var(--gtx-gradient-ink) !important;
}

html[data-background-theme="dark"] .main-menu.no-wrap-group .btn:not(.gradient, .btn-gradient, .btn-gradient-grey) {
    --bs-btn-color: #212529;
    --bs-btn-hover-color: #212529;
    --bs-btn-active-color: #212529;
    --bs-btn-disabled-color: #212529;
}

html[data-background-theme="dark"] .page-title:is(.standard-page-title, :has(> .vdp-page-title-status-slot)) {
    background: var(--gtx-field-background) !important;
    color: var(--gtx-field-ink) !important;
}

html[data-background-theme="dark"] .page-title:is(.standard-page-title, :has(> .vdp-page-title-status-slot)) #title .main-title {
    color: var(--gtx-field-ink) !important;
}

@media (max-width: 767.98px) {
    html[data-background-theme] .mobile-site-header {
        background: var(--gtx-palette-header-background);
    }

    html[data-background-theme] .inventory-mobile-filter-bar > .inventory-mobile-filter-btn {
        background: var(--gtx-dark-field-background, #fff);
        color: var(--gtx-field-ink) !important;
    }
}

html[data-background-theme="dark"] .page-title .btn:not(:is(.btn-gradient, .btn-gradient-grey)) {
    --bs-btn-color: #212529;
    --bs-btn-hover-color: #212529;
    --bs-btn-active-color: #212529;
    --bs-btn-disabled-color: #212529;
    color: #212529 !important;
}

html[data-background-theme="dark"] .page-title .btn:not(:is(.btn-gradient, .btn-gradient-grey)) :is(i, span, strong) {
    color: #212529 !important;
}

html[data-background-theme="dark"] #filterByTerm .light-gradient-action .text-danger {
    color: var(--gtx-gradient-ink) !important;
    color: color-mix(in srgb, var(--gtx-gradient-ink) 55%, rgb(var(--bs-danger-rgb))) !important;
}

html[data-background-theme="dark"] #filterByTerm .light-gradient-action .text-primary {
    color: var(--gtx-gradient-ink) !important;
    color: color-mix(in srgb, var(--gtx-gradient-ink) 55%, rgb(var(--bs-primary-rgb))) !important;
}

html[data-background-theme="dark"] #modalShortcuts .btn-gradient > .text-white {
    color: inherit !important;
}

html[data-background-theme="dark"] .nav.nav-tabs :is(.nav-link, .btn[role="tab"]:not(.btn-gradient-grey)) {
    color: #fff !important;
}

/* Use the tinted gray finish for these actions in either mode. */
html[data-background-theme] body :is(
    .header .btn.light-gradient-action,
    #mobileMenuOffcanvas .btn.light-gradient-action,
    #myTab > .btn[role="tab"].active,
    .majordome-inventory-actions-toggle,
    #majordomeInventoryDecodeVin,
    .pg-action-cell .btn
) {
    --gtx-gradient-ink: var(--bs-dark, #212529);
    background: var(--gtx-action-button-background, var(--gtx-light-control-background)) !important;
    color: var(--gtx-action-button-ink, var(--gtx-gradient-ink)) !important;
    border-color: rgba(15, 23, 42, .18) !important;
    box-shadow: var(--bs-box-shadow-sm) !important;
    text-shadow: none !important;
}

html[data-background-theme="dark"] .btn[data-button-tone="new"] {
    --gtx-button-background: var(--gtx-light-control-background);
    --gtx-button-ink: var(--gtx-light-control-ink);
}

html[data-background-theme="dark"] .btn[data-button-tone="danger"] {
    --gtx-action-base: var(--bs-danger);
    --gtx-action-shade: #a52834;
}

html[data-background-theme="dark"] .btn[data-button-tone="success"] {
    --gtx-action-base: var(--bs-success);
    --gtx-action-shade: #12633e;
}

html[data-background-theme="dark"] body .btn:is([data-button-tone="danger"], [data-button-tone="success"]) {
    --gtx-action-button-background: linear-gradient(180deg, var(--gtx-action-base), var(--gtx-action-shade));
    --gtx-action-button-ink: #fff;
    --gtx-button-background: var(--gtx-action-button-background);
    --gtx-button-ink: var(--gtx-action-button-ink);
    background: var(--gtx-action-button-background) !important;
    border-color: var(--gtx-action-shade) !important;
    color: var(--gtx-action-button-ink) !important;
    text-shadow: none;
}

html[data-background-theme="dark"] body .btn:is([data-button-tone="danger"], [data-button-tone="success"]):not(:disabled, .disabled, [aria-disabled="true"]):is(:hover, :active) {
    --gtx-action-button-background: linear-gradient(180deg, var(--gtx-action-shade), var(--gtx-action-base));
}

html[data-background-theme="dark"] body .btn:is([data-button-tone="danger"], [data-button-tone="success"]):focus-visible {
    outline: 2px solid currentColor;
    outline-offset: -3px;
}

html[data-background-theme] body :is(
    .header .btn.light-gradient-action,
    #mobileMenuOffcanvas .btn.light-gradient-action,
    #myTab > .btn[role="tab"].active,
    .majordome-inventory-actions-toggle,
    #majordomeInventoryDecodeVin,
    .pg-action-cell .btn
):focus-visible {
    outline: 2px solid currentColor;
    outline-offset: -3px;
}

.majordome-inventory-actions-toggle::after {
    filter: none;
}

/* Public inventory cards: accent text and dark mode surfaces. */
html[data-background-theme="dark"] .gtx-card,
html[data-background-theme="dark"] .gtx-card :is(a, button, div, span, strong, small) {
    color: #ededed !important;
}

html[data-background-theme="dark"] .gtx-card {
    background: #2b2b2b;
    box-shadow: 0 12px 26px rgba(0, 0, 0, .3);
}

html[data-background-theme="dark"] .gtx-card > .gtx-card-content {
    background: var(--gtx-dark-field-background);
}

html[class][data-background-theme="dark"] body .gtx-card .gtx-footer.gradient {
    --bs-card-cap-bg: transparent;
    color: #ededed !important;
    text-shadow: none !important;
}

html[data-background-theme] body .gtx-card .card-header.gradient.gtx-header,
html[data-background-theme] .gtx-card .card-header.gradient.gtx-header :is(.gtx-title, .gtx-trimline) {
    color: var(--gtx-menu-ink) !important;
    text-shadow: none !important;
}

html[data-background-theme="dark"] .gtx-card .gtx-compare-toggle :is(span, i) {
    color: inherit !important;
}

html[data-background-theme="dark"] .gtx-card .text-shadow {
    text-shadow: none !important;
}

html[data-background-theme] .gtx-card .gtx-make-logo-wrap {
    background: linear-gradient(145deg, #f3f3f3, #c9c9c9);
    padding: .15rem .3rem;
}

html[data-background-theme="light"] .gtx-card .gtx-open:focus-visible {
    outline-color: var(--gtx-menu-ink);
}

html[data-background-theme="dark"] .gtx-card :is(.gtx-trimline, .gtx-card-copy) {
    opacity: 1;
}

html[data-background-theme="dark"] .gtx-card :is(.gtx-price-panel, .gtx-price-line, .gtx-price-line span, .gtx-price-line i) {
    color: var(--gtx-addgrid-header-ink) !important;
}

html[data-background-theme="dark"] .gtx-card .gtx-price-muted {
    opacity: 1;
}

html[data-background-theme="dark"] .gtx-card .gtx-price-panel {
    background: var(--gtx-addgrid-header-background);
    border-color: #505050;
    box-shadow: none;
    text-shadow: none;
}

html[data-background-theme="dark"] .gtx-card .gtx-price-panel:is(:hover, :focus-visible) {
    border-color: #e0e0e0;
}

html[data-background-theme="dark"] .gtx-card .gtx-price-panel:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: -3px;
}

html[data-background-theme="dark"] #inventory[data-card-layout="compact"] .gtx-card-specs {
    --gtx-compact-specs-background: var(--gtx-addgrid-header-background);
    --gtx-compact-specs-ink: var(--gtx-addgrid-header-ink);
}

html[data-background-theme="dark"] #inventory[data-card-layout="compact"] .gtx-card-specs :is(div, span) {
    color: inherit !important;
}

html[data-background-theme="dark"] #inventory[data-card-layout="compact"] .gtx-price-panel {
    --gtx-compact-price-background: var(--gtx-dark-field-background);
    --gtx-compact-price-ink: var(--gtx-field-ink);
    --gtx-addgrid-header-ink: var(--gtx-compact-price-ink);
}

html[data-background-theme="dark"] .gtx-card .gtx-transparent-line {
    border-top-color: #505050;
}

html[data-background-theme="dark"] .gtx-card .gtx-no-hidden-fees {
    background: #24483c;
    color: #a7f3d0 !important;
}

html[data-background-theme="dark"] .gtx-card :is(.gtx-open, .gtx-open i) {
    color: #262626 !important;
}

html[data-background-theme="dark"] .gtx-card .gtx-card-action > span {
    color: inherit !important;
}

html[data-background-theme="dark"] .gtx-card .gtx-chip {
    background: rgba(28, 28, 28, .88);
    border-color: #737373;
}

html[data-background-theme="dark"] .gtx-card :is(.gtx-open, .gtx-card-action):focus-visible {
    outline: 2px solid #e0e0e0;
    outline-offset: 3px;
}

html[data-background-theme="dark"] .majordome-status-pill {
    color: #fff;
}

html[data-background-theme="dark"] .majordome-status-pill:is(.majordome-status-dataone, .majordome-status-story):not(.is-on) {
    background: var(--bs-secondary-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-secondary-color);
}

html[data-background-theme="dark"] .majordome-status-pill.majordome-status-counter {
    color: #212529;
}

html[data-background-theme="dark"] .majordome-status-pill.majordome-status-location:not(.is-gtx-x):not(.is-gtx-t):not(.is-gtx-g) {
    background: var(--bs-secondary-bg);
    border-color: var(--bs-secondary-color);
    color: var(--bs-body-color);
}

html[data-background-theme="dark"] .text-dark {
    color: var(--bs-body-color) !important;
}

/* Outline links sit directly on the dark mobile drawer rather than silver buttons. */
html[data-background-theme="dark"] #menuAboutMobile .btn-outline-dark {
    --bs-btn-color: var(--bs-body-color);
    --bs-btn-border-color: var(--bs-secondary-color);
    --bs-btn-hover-color: var(--bs-body-color);
    --bs-btn-hover-bg: var(--bs-secondary-bg);
    --bs-btn-hover-border-color: var(--bs-body-color);
    --bs-btn-focus-shadow-rgb: var(--bs-body-color-rgb);
    --bs-btn-active-color: var(--bs-body-color);
    --bs-btn-active-bg: var(--bs-secondary-bg);
    --bs-btn-active-border-color: var(--bs-body-color);
    --bs-btn-disabled-color: var(--bs-secondary-color);
    --bs-btn-disabled-border-color: var(--bs-border-color);
}

/* Inventory add/edit shares the page's dark palette, including readonly fields. */
html[data-background-theme="dark"] .majordome-editor-body {
    background: linear-gradient(180deg, var(--gtx-page-bg), var(--bs-body-bg));
    color: var(--bs-body-color);
    scrollbar-color: var(--bs-secondary-color) transparent;
}

html[data-background-theme="dark"] .majordome-editor-body::-webkit-scrollbar-thumb {
    background: var(--bs-secondary-color);
}

html[data-background-theme="dark"] .majordome-editor-body::-webkit-scrollbar-thumb:hover {
    background: var(--bs-body-color);
}

html[data-background-theme="light"][data-theme-finish="gradient"] .majordome-editor-section {
    background-image: linear-gradient(180deg, var(--bs-body-bg), var(--gtx-page-bg));
}

html[data-background-theme="dark"] .majordome-editor-section {
    --majordome-editor-section-color: #5eead4;
    border-color: var(--bs-border-color);
    border-left-color: var(--majordome-editor-section-color);
}

html[data-background-theme="dark"][data-theme-finish="solid"] .majordome-editor-section {
    background: var(--gtx-tinted-panel-background);
}

html[data-background-theme="dark"] .majordome-editor-section-pricing {
    --majordome-editor-section-color: #facc15;
}

html[data-background-theme="dark"] .majordome-editor-section-mechanical {
    --majordome-editor-section-color: #cbd5e1;
}

html[data-background-theme="dark"] .majordome-editor-section-dates {
    --majordome-editor-section-color: #a5b4fc;
}

html[data-background-theme="dark"] .majordome-editor-section-title {
    border-bottom-color: var(--bs-border-color);
    color: var(--gtx-steel-panel-ink);
}

html[data-background-theme="dark"] .majordome-editor-modal .form-label,
html[data-background-theme="dark"] .majordome-editor-label-icon {
    color: var(--gtx-steel-panel-ink);
}

html[data-background-theme="dark"] .majordome-editor-modal :is(.form-control, .form-select) {
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
}

html[data-background-theme="dark"] .majordome-editor-modal :is(input, textarea).form-control:not([readonly], :disabled, [type="file"]) {
    background-color: var(--gtx-dark-input-background);
}

html[data-background-theme="dark"] .majordome-editor-modal :is(.form-control, .form-select):is(:hover, :focus) {
    border-color: var(--bs-secondary-color);
}

html[data-background-theme="dark"] .majordome-editor-modal :is(.majordome-editor-stock-locked, .form-control:disabled, .form-select:disabled) {
    background-color: var(--gtx-field-background);
    color: var(--bs-secondary-color);
}

/* Use the modal header's palette finish without its texture, keeping the caret and validation icon above it. */
html[data-background-theme="dark"] .modal {
    --gtx-modal-select-caret: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

html.theme-silver[data-background-theme="dark"] .modal {
    --gtx-modal-select-caret: var(--gtx-light-select-caret);
}

html[data-background-theme="dark"] .modal select:is(.form-select, .pe-select):not(:disabled, [multiple], [size]:not([size="1"])) {
    background:
        var(--gtx-modal-select-caret) right var(--gtx-modal-select-caret-inset, .75rem) center / var(--gtx-modal-select-caret-size, 16px 12px) no-repeat,
        var(--bs-form-select-bg-icon, none) right 2.25rem center / calc(.75em + .375rem) calc(.75em + .375rem) no-repeat,
        var(--gtx-grad);
    color: var(--gtx-palette-header-ink);
    color-scheme: dark;
}

html[data-background-theme] .majordome-editor-modal select.form-select:not(:disabled, [multiple], [size]:not([size="1"])) {
    background:
        var(--gtx-light-select-caret) right .75rem center / 16px 12px no-repeat,
        var(--bs-form-select-bg-icon, none) right 2.25rem center / calc(.75em + .375rem) calc(.75em + .375rem) no-repeat,
        var(--gtx-action-button-background, var(--gtx-light-control-background));
    color: var(--gtx-action-button-ink, var(--bs-dark, #212529));
    color-scheme: light;
}

html[data-background-theme="dark"] .modal .pe-select {
    --gtx-modal-select-caret-inset: .55rem;
    --gtx-modal-select-caret-size: 12px 9px;
}

html[data-background-theme="dark"] .majordome-editor-footer {
    background: var(--bs-body-bg);
    border-top-color: var(--bs-border-color);
}

html[data-background-theme="dark"] .vdp-utility-actions .btn-gradient-grey {
    text-shadow: none;
}

/* Share the palette tint between text fields and their grouped controls. */
html[data-background-theme] :is(
    input:not(:where([type="hidden"], [type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="button"], [type="submit"], [type="reset"], [type="image"])),
    textarea,
    .pe-body[contenteditable="true"]
):not(:where(
    :disabled, [readonly], .form-control-plaintext, .chosen-container input, .pg-search-input,
    .login-shell__input, .vin-decoder-input-group input, .pr-bid-money input, .pe-readonly .pe-source,
    .form-control:is(.is-valid, .is-invalid), .was-validated .form-control,
    .just-validate-error-field, .just-validate-success-field
)) {
    background-color: var(--gtx-input-background);
    color: var(--gtx-field-ink);
}

html[data-background-theme] .form-control:is([readonly], :disabled):not(.form-control-plaintext, [type="file"]) {
    background-color: var(--gtx-field-background);
}

/* Repaint the arrows while retaining the browser's native stepping behavior. */
@supports (mask: none) {
    @media (forced-colors: none) {
        html[data-background-theme] input[type="number"]:not(:disabled, [readonly])::-webkit-inner-spin-button {
            appearance: none;
            inline-size: 1rem;
            block-size: 1.375rem;
            background-color: currentColor;
            mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2012%2020'%3E%3Cpath%20fill%3D'none'%20stroke%3D'white'%20stroke-linecap%3D'round'%20stroke-linejoin%3D'round'%20stroke-width%3D'1.5'%20d%3D'M3%207l3-3%203%203M3%2013l3%203%203-3'%2F%3E%3C%2Fsvg%3E") center / .75rem 1.25rem no-repeat;
        }
    }
}

html[data-background-theme] .pg-search-input-group {
    --bs-border-radius-sm: var(--pg-border-radius-sm);
    border-radius: var(--pg-border-radius-sm);
    background-color: var(--gtx-input-background);
}

html[data-background-theme] .pg-search-input-group > :is(.input-group-text, .pg-search-input, .pg-search-clear) {
    border-color: var(--gtx-dark-field-border, var(--pg-color-border));
    background: transparent;
    color: var(--gtx-field-ink);
}

html[data-background-theme="dark"] .pg-search-input-group > :is(.pg-search-input, .pg-search-clear) {
    border-inline-start-color: rgb(220 230 243 / 28%);
}

html[data-background-theme="dark"] .pg-search-input-group > .pg-search-clear:is(:hover, :active) {
    background-color: rgb(255 255 255 / 10%);
}

html[data-background-theme] .pg-search-input-group:focus-within {
    outline: 2px solid var(--gtx-field-placeholder);
    outline-offset: 2px;
}

/* Preserve validation icons above the palette fill. */
html[data-background-theme] :is(
    .form-control:is(.is-valid, .is-invalid), .was-validated .form-control,
    .just-validate-error-field, .just-validate-success-field
):not(:where(:disabled, [readonly], input[type="file"])) {
    background-color: var(--gtx-input-background);
    color: var(--gtx-field-ink);
}

html[data-background-theme="dark"] :is(input, textarea, .form-control):not(:where(:disabled, .chosen-choices input, .login-shell__input))::placeholder,
html[data-background-theme="dark"] :is(#filterTerm, #price-research .pr-bid-money input)::placeholder {
    color: var(--gtx-dark-field-placeholder);
    opacity: 1 !important;
}

html[data-background-theme="dark"] .pg-search-input::placeholder {
    color: var(--gtx-dark-field-placeholder);
    color: color-mix(in srgb, var(--gtx-dark-field-placeholder) 75%, var(--bs-secondary-color));
}

html[data-background-theme="dark"] :is(.form-control, textarea, .pe-body[contenteditable="true"], .chosen-search input):not(:where(
    .pg-search-input, .login-shell__input, .form-control-color, input[type="file"], .vin-decoder-input-group input
)):focus-visible {
    outline: 2px solid var(--gtx-dark-field-placeholder);
    outline-offset: -2px;
}

html[data-background-theme] .input-group:not(:is(.pg-search-input-group, .vin-decoder-input-group)):has(> input:not(:disabled, [type="hidden"], [type="file"], [type="checkbox"], [type="radio"]), > textarea:not(:disabled)) > .input-group-text:not(.btn) {
    /* Match the field even when the addon carries a Bootstrap background utility. */
    background-color: var(--gtx-input-background) !important;
    color: var(--gtx-field-ink);
}

html[data-background-theme] :is(.vin-decoder-input-group, #price-research .pr-bid-money) {
    background-color: var(--gtx-input-background);
}

html[data-background-theme] :is(.vin-decoder-input-group, #price-research .pr-bid-money) > :is(input, .input-group-text, span):not(:disabled) {
    background: transparent;
    color: var(--gtx-field-ink);
}

html[data-background-theme="dark"] :is(.vin-decoder-input-group, #price-research .pr-bid-money):focus-within {
    outline: 2px solid var(--gtx-dark-field-placeholder);
    outline-offset: -2px;
}

html[data-background-theme] .chosen-container-single .chosen-search {
    background-color: var(--gtx-input-background);
}

html[data-background-theme] .chosen-container-single .chosen-search input {
    background-color: transparent;
    color: var(--gtx-field-ink);
}

/* jQuery UI attaches the shared date picker to the document body. */
#ui-datepicker-div {
    --gtx-calendar-heading: var(--bs-tertiary-bg);
    --gtx-calendar-heading-ink: var(--bs-body-color);
    --gtx-calendar-selection: #294d75;
    box-sizing: border-box;
    width: min(19rem, calc(100vw - 1rem));
    padding: .45rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    box-shadow: var(--bs-box-shadow);
    font: inherit;
    font-size: .875rem;
}

@supports (color: color-mix(in srgb, white, black)) {
    #ui-datepicker-div {
        --gtx-calendar-heading: color-mix(in srgb, var(--gtx-palette-tint-color) 10%, var(--bs-tertiary-bg));
        --gtx-calendar-selection: color-mix(in srgb, var(--gtx-palette-tint-color) 52%, #142438);
    }
}

html[data-background-theme="dark"] #ui-datepicker-div {
    --gtx-calendar-heading: var(--gtx-dark-field-background);
    --gtx-calendar-heading-ink: var(--gtx-dark-field-ink);
}

#ui-datepicker-div .ui-datepicker-header {
    padding: .42rem 0;
    border: 0;
    border-radius: var(--bs-border-radius);
    background: var(--gtx-calendar-heading);
    color: var(--gtx-calendar-heading-ink);
}

#ui-datepicker-div :is(.ui-datepicker-prev, .ui-datepicker-next) {
    top: 50%;
    width: 1.9rem;
    height: 1.9rem;
    transform: translateY(-50%);
    border: 1px solid transparent;
    border-radius: var(--bs-border-radius);
    background: transparent;
    color: inherit;
}

#ui-datepicker-div .ui-datepicker-prev { inset-inline: .25rem auto; }
#ui-datepicker-div .ui-datepicker-next { inset-inline: auto .25rem; }

#ui-datepicker-div :is(.ui-datepicker-prev, .ui-datepicker-next):not(.ui-state-disabled):is(:hover, :focus-visible) {
    border-color: currentColor;
    cursor: pointer;
}

#ui-datepicker-div .ui-datepicker-calendar {
    margin: .15rem 0 0;
    table-layout: fixed;
}
#ui-datepicker-div .ui-datepicker-calendar th { color: var(--bs-secondary-color); }

#ui-datepicker-div .ui-datepicker-calendar td > .ui-state-default {
    display: grid;
    min-height: 2rem;
    place-items: center;
    border: 1px solid transparent;
    border-radius: var(--bs-border-radius);
    background: transparent;
    color: inherit;
}

#ui-datepicker-div .ui-datepicker-calendar .ui-state-disabled { opacity: .45; }

#ui-datepicker-div .ui-datepicker-other-month > a.ui-state-default:not(.ui-state-active) {
    color: var(--bs-secondary-color);
    opacity: 1;
}

#ui-datepicker-div .ui-datepicker-today > a.ui-state-default { border-color: var(--bs-secondary-color); }

#ui-datepicker-div .ui-datepicker-calendar td > a.ui-state-default:where(:hover) {
    background: var(--bs-secondary-bg);
}

#ui-datepicker-div .ui-datepicker-calendar td > a.ui-state-active {
    background: var(--gtx-calendar-selection);
    color: #fff;
    font-weight: 700;
}

#ui-datepicker-div .ui-datepicker-days-cell-over > a.ui-state-default,
#ui-datepicker-div .ui-datepicker-calendar td > a:focus-visible {
    outline: 1px solid currentColor;
    outline-offset: -3px;
}

/* Majordome menu pages and their grids share the Dashboard panel tint. */
html[data-background-theme="dark"] .majordome-panel-page .body-content :is(
    .majordome-inventory-shell,
    .majordome-inventory-header,
    .majordome-inventory-table-wrap,
    .majordome-management-results,
    .majordome-management-table-wrap,
    .chat-command-mobile-lock,
    .sitemap-shell
),
html[data-background-theme="dark"] .majordome-panel-page .vin-decoder-page:not(#price-research) :is(.vin-decoder-console, .vin-decoder-results),
html[data-background-theme="dark"] .majordome-panel-page #profilePage .profile-card,
html[data-background-theme="dark"] .majordome-panel-page #roleModalBody .role-editor-card,
html[data-background-theme="dark"] .majordome-panel-page :is(#tab-announcement, #tab-blog, #tab-special, #tab-employees, #rolesPage) > .shadow,
html[data-background-theme="dark"] .majordome-panel-page :is(#majordomeInventoryGrid, #majordomeManagementGrid, #chatCommandAddGrid, .gtx-admin-add-grid) .pg-grid-wrapper {
    background: var(--gtx-tinted-steel-panel-background);
}

html[data-background-theme="dark"] .majordome-panel-page .bg-white:is(.sitemap-header, .sitemap-footer, .card-header.sticky-top) {
    background: var(--gtx-tinted-steel-panel-background) !important;
    color: var(--gtx-steel-panel-ink);
}

html[data-background-theme="dark"] .majordome-panel-page #sitemapAccordion {
    --bs-accordion-bg: transparent;
}

html[data-background-theme="dark"] :is(#profilePage .profile-card-header, #roleModalBody .role-editor-card-header) {
    border-bottom-color: color-mix(in srgb, currentColor 18%, transparent);
    background: var(--gtx-menu-background);
    color: var(--gtx-menu-ink);
}

html[data-background-theme="dark"] :is(#profilePage .profile-heading-icon, #roleModalBody .role-editor-heading-icon) {
    border-color: color-mix(in srgb, currentColor 22%, transparent);
    background: rgb(255 255 255 / 14%);
    color: inherit;
}

html[data-background-theme="dark"] #roleModalBody .toggle-role-password {
    --bs-btn-color: var(--gtx-dark-field-ink);
}

html[data-background-theme="dark"] .majordome-panel-page :is(#profilePage .profile-card, #roleModalBody .role-editor-card) {
    --bs-secondary-color: var(--bs-body-color);
}

html[data-background-theme="dark"] .majordome-panel-page .chat-command-mobile-lock h1 {
    color: var(--bs-body-color);
}

html[data-background-theme="dark"] .majordome-panel-page .chat-command-mobile-lock p {
    color: var(--bs-secondary-color);
}

html[data-background-theme="dark"] .majordome-panel-page :is(.majordome-management-shell, .majordome-management-sidebar-pane) {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

html[data-background-theme="dark"] .majordome-management-sidebar-pane {
    padding-block-start: 0;
}

html[data-background-theme="dark"] .majordome-management-log-period {
    align-items: center;
    padding-block: .3rem;
}

html[data-background-theme="dark"] #majordomeManagementLogYearMenu > li {
    display: flow-root;
}

html[data-background-theme="dark"] .theme-group-toggle,
html[data-background-theme="dark"] #majordomeManagementLogMenu .majordome-management-log-date,
html[data-background-theme="dark"] #sitemapAccordion .accordion-button,
html[data-background-theme="dark"] #inventorySidebarPane .inventory-filter-panel {
    background: var(--gtx-tinted-steel-panel-background);
}

html[data-background-theme="dark"] #majordomeManagementLogMenu .majordome-management-log-status-list {
    --inventory-ink: var(--gtx-steel-panel-ink);
    --inventory-muted: var(--gtx-steel-panel-ink);
    background-color: rgba(var(--bs-black-rgb), .22);
    border-top: 1px solid rgba(var(--bs-white-rgb), .24);
}

html[data-background-theme="dark"] #majordomeManagementLogMenu .inventory-management-rollback-trigger {
    --bs-btn-color: var(--gtx-steel-panel-ink);
}

html[data-background-theme="dark"] #inventorySidebarPane .inventory-filter-panel :is(.inventory-filter-panel-toggle, .inventory-filter-panel-count, .inventory-range-values, .inventory-range-output, .inventory-dependent-empty, .inventory-check-row:where(:not(:hover))),
html[data-background-theme="dark"] .theme-group-toggle,
html[data-background-theme="dark"] #majordomeManagementLogMenu .majordome-management-log-date,
html[data-background-theme="dark"] #majordomeManagementLogMenu .majordome-management-log-date .majordome-management-log-date-toggle,
html[data-background-theme="dark"] #sitemapAccordion .accordion-button {
    color: var(--gtx-steel-panel-ink);
}

html[data-background-theme="dark"] #sitemapAccordion .accordion-button .bi {
    color: inherit !important;
}

html[data-background-theme="dark"] #sitemapAccordion .accordion-button::after {
    filter: brightness(0) invert(1);
}
