/* Keep dialog paint in the shared controls layer above legacy important rules. */
@layer throne-controls {
    html[data-throne-theme="dark"] :is(.listing-dialog-overlay, .direct-merge-dialog-overlay, #loadingOverlay) {
        background: rgba(0, 0, 0, 0.72) !important;
    }

    html[data-throne-theme="dark"] :is(.listing-dialog, .direct-merge-dialog, .direct-ebay-dock, #loadingOverlay .loading-box) {
        background: #1c1c1c !important;
        border-color: #444 !important;
        box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5) !important;
    }

    html[data-throne-theme="dark"] :is(.listing-dialog-header, .direct-merge-dialog-header) {
        background: #1c1c1c !important;
        border-color: #383838 !important;
    }

    html[data-throne-theme="dark"] :is(.listing-dialog-footer, .direct-merge-dialog-footer, .direct-merge-dialog-tools) {
        background: #202020 !important;
        border-color: #383838 !important;
    }

    html[data-throne-theme="dark"] :is(.listing-dialog-icon.info, .direct-ebay-dock:not(.is-warning):not(.is-complete) .direct-ebay-dock-icon) {
        color: #e5e5e5 !important;
        background: #303030 !important;
    }

    html[data-throne-theme="dark"] :is(.listing-dialog-options-compact .listing-dialog-option, .direct-merge-row, .direct-merge-comparison-card) {
        background: #202020 !important;
        border-color: #404040 !important;
    }

    html[data-throne-theme="dark"] .listing-dialog-options-compact .listing-dialog-option:hover {
        background: #292929 !important;
        border-color: #626262 !important;
    }

    html[data-throne-theme="dark"] :is(.listing-dialog-options-compact .listing-dialog-option-checkbox:has(input:checked), .direct-merge-row.selected) {
        background: #282828 !important;
        border-color: #686868 !important;
        box-shadow: inset 3px 0 0 #b8b8b8 !important;
    }

    html[data-throne-theme="dark"] :is(.listing-dialog-select-control, .direct-merge-target-control select, .direct-merge-segmented) {
        background: #171717 !important;
        color: #ededed !important;
        border-color: #505050 !important;
    }

    html[data-throne-theme="dark"] .listing-dialog-checkbox-control {
        accent-color: #b8b8b8 !important;
    }

    html[data-throne-theme="dark"] :is(.listing-dialog-checkbox-control, .listing-dialog-select-control, .direct-merge-target-control select, .direct-merge-segmented button):focus-visible {
        outline: 2px solid #d4d4d4 !important;
        outline-offset: 2px !important;
    }

    html[data-throne-theme="dark"] .direct-merge-dialog .direct-merge-segmented button:is(.selected, [aria-pressed="true"]) {
        background: #414141 !important;
        color: #fafafa !important;
        border-color: #737373 !important;
        box-shadow: inset 0 -2px 0 #b8b8b8 !important;
    }

    html[data-throne-theme="dark"] .direct-merge-list {
        background: #141414 !important;
    }

    html[data-throne-theme="dark"] :is(.direct-merge-result, .direct-merge-summary-pill.merge, .direct-merge-evidence-badge:not(.catalog)) {
        background: #303030 !important;
        color: #ededed !important;
        border-color: #505050 !important;
    }

    html[data-throne-theme="dark"] .direct-merge-result.create {
        background: #202020 !important;
        border-color: #404040 !important;
    }

    html[data-throne-theme="dark"] :is(.direct-merge-eyebrow, .direct-merge-ebay-item-link) {
        color: #d4d4d4 !important;
    }

    html[data-throne-theme="dark"] .direct-merge-ebay-item-link:hover {
        color: #fff !important;
    }

    html[data-throne-theme="dark"] :is(#loadingOverlay .progress-container, .direct-ebay-dock-progress) {
        background: #3a3a3a !important;
    }

    html[data-throne-theme="dark"] :is(#loadingOverlay .progress-bar, .direct-ebay-dock:not(.is-warning):not(.is-complete) .direct-ebay-dock-progress-bar) {
        background: linear-gradient(90deg, #737373, #d4d4d4) !important;
    }

    html[data-throne-theme="dark"] :is(#loadingOverlay .spinner, .direct-ebay-dock:not(.is-warning):not(.is-complete) .spinner) {
        border-color: #454545 !important;
        border-top-color: #e5e5e5 !important;
    }
}
