/* Layered important paint overrides legacy page and inline button colors. */
@layer throne-controls {
html[data-throne-theme="dark"] {
    --throne-button-bg: #242424;
    --throne-button-hover: #343434;
    --throne-button-border: #505050;
    --throne-button-ink: #ededed;
}

/* Paint actions without changing the geometry of tabs, menus, switches, or rows. */
html[data-throne-theme="dark"] body :is(button, input[type="button"], input[type="submit"], a[class*="btn"], a[class*="button"], a[role="button"]):not(:where(
    .smooth-select-trigger, .smooth-select-option, [role="switch"], [role="tab"],
    .toggle, .sidebar-toggle, .nav-group-toggle, .nav-section-toggle,
    .nav-item, .theme-toggle-btn, .public-theme-toggle, .billing-action-button,
    .config-section-nav-button, .config-scope-tab-button,
    .range-btn, .tab-btn, .filter-btn, .view-btn, .scope-btn, .game-btn,
    .price-basis-btn, .language-btn, .tr-segment, .tr-workspace-nav-item,
    .active, .is-active, [aria-pressed="true"], [aria-selected="true"]
)) {
    background: var(--throne-button-bg) !important;
    border-color: var(--throne-button-border) !important;
    color: var(--throne-button-ink) !important;
    box-shadow: none !important;
    text-shadow: none;
    transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

html[data-throne-theme="dark"] body :is(
    .btn, .tr-button, .inventory-btn, .ea-btn, .er-btn, .ar-btn, .tcg-btn,
    .action-btn, .batch-btn, .topbar-batch-icon-button, .cs-action-btn,
    .lv-affiliate-btn, .export-btn, .save-btn, .pct-apply-btn,
    .harvested-refresh, .guide-button, .guide-nav-cta,
    .dashboard-primary-action, .dashboard-secondary-action, .dashboard-row-action,
    .bulk-action-btn, .truncation-btn-primary, .truncation-btn-secondary,
    .throne-theme-button-secondary, button[style*="background"]
):not(:where(.active, .is-active, [aria-pressed="true"], [aria-selected="true"])):not(:disabled) {
    background: var(--throne-button-bg) !important;
    border-color: var(--throne-button-border) !important;
    color: var(--throne-button-ink) !important;
    box-shadow: none !important;
    transform: none;
}

html[data-throne-theme="dark"] body :is(
    .btn-primary, .tr-button-primary, .button-primary, .button-light,
    .inventory-btn.primary, .ea-btn.primary, .er-btn.primary, .tcg-btn.primary,
    .ar-btn:not(.secondary):not(.danger), .batch-btn.save,
    .topbar-batch-icon-button.save, .btn-open-batch, .batch-create-btn, .bulk-action-btn.done,
    .dashboard-primary-action, .dashboard-row-action-primary,
    .truncation-btn-primary, .login-btn,
    .auth-email-submit, .guide-nav-cta
) {
    --throne-button-bg: #ededed;
    --throne-button-hover: #d7d7d7;
    --throne-button-border: #ededed;
    --throne-button-ink: #161616;
}

html[data-throne-theme="dark"] body :is(
    .btn-danger, .btn-danger-icon, .tr-button-danger, .inventory-btn.danger,
    .batch-btn.delete, .batch-btn.danger, .topbar-batch-icon-button.delete,
    .bulk-action-btn.delete, .lv-btn-icon.confirming, .collections-action.danger,
    .collection-tab-delete, .btn-reject, .btn-stop, #StopBtn,
    button[style*="background: #ef4444"], button[style*="background:#ef4444"]
) {
    --throne-button-bg: #351f22;
    --throne-button-hover: #48272c;
    --throne-button-border: #75454d;
    --throne-button-ink: #ffbcc4;
    background: var(--throne-button-bg) !important;
    border-color: var(--throne-button-border) !important;
    color: var(--throne-button-ink) !important;
    box-shadow: none !important;
}

html[data-throne-theme="dark"] body :is(button, input[type="button"], input[type="submit"], a[class*="btn"], a[class*="button"], a[role="button"]):not(:where(
    .smooth-select-trigger, .smooth-select-option, [role="switch"], [role="tab"],
    .toggle, .sidebar-toggle, .nav-group-toggle, .nav-section-toggle,
    .nav-item, .theme-toggle-btn, .public-theme-toggle, .billing-action-button,
    .config-section-nav-button, .config-scope-tab-button,
    .range-btn, .tab-btn, .filter-btn, .view-btn, .scope-btn, .game-btn,
    .price-basis-btn, .language-btn, .tr-segment, .tr-workspace-nav-item,
    .active, .is-active, [aria-pressed="true"], [aria-selected="true"],
    .disabled, [aria-disabled="true"], .direct-ebay-locked
)):hover:not(:disabled) {
    background: var(--throne-button-hover) !important;
    border-color: var(--throne-button-ink) !important;
    color: var(--throne-button-ink) !important;
    box-shadow: none !important;
    transform: none;
}

html[data-throne-theme="dark"] body :is(
    .btn, .tr-button, .inventory-btn, .ea-btn, .er-btn, .ar-btn, .tcg-btn,
    .action-btn, .batch-btn, .topbar-batch-icon-button, .cs-action-btn,
    .lv-affiliate-btn, .export-btn, .save-btn, .pct-apply-btn, .guide-button,
    .guide-nav-cta, .bulk-action-btn
):is(:disabled, [aria-disabled="true"], .disabled, .direct-ebay-locked),
html[data-throne-theme="dark"] body button:disabled:not(.tr-workspace-nav-item):not(.inventory-tab) {
    --throne-button-bg: #202020 !important;
    --throne-button-border: #383838 !important;
    --throne-button-ink: #a3a3a3 !important;
    background: #202020 !important;
    border-color: #383838 !important;
    color: var(--throne-button-ink) !important;
    opacity: 1 !important;
    box-shadow: none !important;
    cursor: not-allowed;
    transform: none;
}

/* Nested labels must use the button's ink, including light primary actions. */
html[data-throne-theme="dark"] body :is(
    .btn, .tr-button, .inventory-btn, .ea-btn, .er-btn, .ar-btn, .tcg-btn,
    .action-btn, .batch-btn, .topbar-batch-icon-button, .cs-action-btn,
    .lv-affiliate-btn, .export-btn, .save-btn, .guide-button, .guide-nav-cta,
    .bulk-action-btn
) :is(span:not([class*="badge"]):not([class*="status"]), .tr-icon, svg) {
    color: inherit !important;
}

html[data-throne-theme="dark"] body :is(
    .btn, .tr-button, .inventory-btn, .ea-btn, .er-btn, .ar-btn, .tcg-btn,
    .action-btn, .batch-btn, .cs-action-btn, .export-btn, .save-btn,
    .pct-apply-btn, .guide-button, .truncation-btn-primary, .truncation-btn-secondary
):not(:where(.btn-icon, .btn-danger-icon, .btn-sm, .tr-button-sm, .tr-button-icon, .icon-only)) {
    border-radius: 9px !important;
    font-weight: 650;
    letter-spacing: 0;
}

html[data-throne-theme="dark"] body .lv-affiliate-btn {
    min-height: 24px;
    letter-spacing: .015em;
    font-weight: 650;
}

html[data-throne-theme="dark"] body :is(
    .btn, .tr-button, .inventory-btn, .ea-btn, .er-btn, .ar-btn, .tcg-btn,
    .action-btn, .batch-btn, .topbar-batch-icon-button, .cs-action-btn,
    .lv-affiliate-btn, .export-btn, .save-btn, .guide-button, .guide-nav-cta,
    .bulk-action-btn
):focus-visible {
    outline: 2px solid #ededed !important;
    outline-offset: 3px;
    box-shadow: none !important;
}

@media (prefers-reduced-motion: reduce) {
    html[data-throne-theme="dark"] body :is(button, a[class*="btn"], a[class*="button"]) {
        transition: none;
    }
}
}
