/* Public pages only. Load after page styles. No media filters, layout reset or admin styling. */
html:root {
  --theme-scheme: light;
  --theme-bg: #f4f2f0;
  --theme-surface: #ffffff;
  --theme-surface-alt: #f6f4f2;
  --theme-panel: #eeebe7;
  --theme-text: #26252a;
  --theme-muted: #625f66;
  --theme-dim: #6d6870;
  --theme-border: #d6d0d4;
  --theme-control-border: #8c858d;
  --theme-accent: #b5215b;
  --theme-accent-fill: #b5215b;
  --theme-accent-hover: #941644;
  --theme-accent-soft: #fcebf2;
  --theme-on-accent: #ffffff;
  --theme-field-bg: #ffffff;
  --theme-gold: #76551e;
  --theme-gold-bg: #faf1df;
  --theme-success: #176342;
  --theme-success-bg: #e9f5ee;
  --theme-danger: #a5233c;
  --theme-danger-bg: #fcebef;
  --theme-info: #255982;
  --theme-info-bg: #eaf2fa;
  --theme-focus: #b5215b;
  --theme-overlay: rgba(31, 23, 29, .56);
  --theme-shadow: 0 12px 40px rgba(53, 34, 43, .14);
  --theme-hero: linear-gradient(120deg, #fff7ed, #ffffff 78%);
  --theme-category-panel: linear-gradient(145deg, #ffffff, #f6f2ee);
  --theme-category-0: #76551e; --theme-category-rgb-0: 118,85,30;
  --theme-category-1: #974631; --theme-category-rgb-1: 151,70,49;
  --theme-category-2: #2f617e; --theme-category-rgb-2: 47,97,126;
  --theme-category-3: #4b5387; --theme-category-rgb-3: 75,83,135;
  --theme-category-4: #246a4d; --theme-category-rgb-4: 36,106,77;
  --theme-category-5: #72518d; --theme-category-rgb-5: 114,81,141;
  color-scheme: var(--theme-scheme);
  background: var(--theme-bg);
  color: var(--theme-text);
}

html:root[data-theme="dark"] {
  --theme-scheme: dark;
  --theme-bg: #202124;
  --theme-surface: #2b2d31;
  --theme-surface-alt: #33343a;
  --theme-panel: #26282d;
  --theme-text: #f0edf2;
  --theme-muted: #c0bcc5;
  --theme-dim: #aaa5b0;
  --theme-border: #56515d;
  --theme-control-border: #8b8392;
  --theme-accent: #ff9fc3;
  --theme-accent-fill: #c03168;
  --theme-accent-hover: #ac245a;
  --theme-accent-soft: #482638;
  --theme-field-bg: #23252a;
  --theme-gold: #e4c18d;
  --theme-gold-bg: #3b3326;
  --theme-success: #abe3c2;
  --theme-success-bg: #203a30;
  --theme-danger: #ffb8ca;
  --theme-danger-bg: #4b2733;
  --theme-info: #b7d8ff;
  --theme-info-bg: #243549;
  --theme-focus: #ff9fc3;
  --theme-overlay: rgba(8, 9, 13, .76);
  --theme-shadow: 0 18px 54px rgba(0, 0, 0, .38);
  --theme-hero: linear-gradient(120deg, #34313a, #2b2d31 78%);
  --theme-category-panel: linear-gradient(145deg, #303137, #25262b);
  --theme-category-0: #e4c18d; --theme-category-rgb-0: 228,193,141;
  --theme-category-1: #f1b0a2; --theme-category-rgb-1: 241,176,162;
  --theme-category-2: #a8c9df; --theme-category-rgb-2: 168,201,223;
  --theme-category-3: #adbadd; --theme-category-rgb-3: 173,186,221;
  --theme-category-4: #a7cbbb; --theme-category-rgb-4: 167,203,187;
  --theme-category-5: #cbb8db; --theme-category-rgb-5: 203,184,219;
}

/* JavaScript resolves auto before paint. This branch is the no-script system fallback. */
@media (prefers-color-scheme: dark) {
  html:root:not([data-theme="light"]):not([data-theme="dark"]) {
    --theme-scheme: dark;
    --theme-bg: #202124; --theme-surface: #2b2d31; --theme-surface-alt: #33343a; --theme-panel: #26282d;
    --theme-text: #f0edf2; --theme-muted: #c0bcc5; --theme-dim: #aaa5b0;
    --theme-border: #56515d; --theme-control-border: #8b8392;
    --theme-accent: #ff9fc3; --theme-accent-fill: #c03168; --theme-accent-hover: #ac245a; --theme-accent-soft: #482638;
    --theme-field-bg: #23252a; --theme-gold: #e4c18d; --theme-gold-bg: #3b3326;
    --theme-success: #abe3c2; --theme-success-bg: #203a30;
    --theme-danger: #ffb8ca; --theme-danger-bg: #4b2733; --theme-info: #b7d8ff; --theme-info-bg: #243549;
    --theme-focus: #ff9fc3; --theme-overlay: rgba(8, 9, 13, .76); --theme-shadow: 0 18px 54px rgba(0, 0, 0, .38);
    --theme-hero: linear-gradient(120deg, #34313a, #2b2d31 78%);
    --theme-category-panel: linear-gradient(145deg, #303137, #25262b);
    --theme-category-0: #e4c18d; --theme-category-rgb-0: 228,193,141;
    --theme-category-1: #f1b0a2; --theme-category-rgb-1: 241,176,162;
    --theme-category-2: #a8c9df; --theme-category-rgb-2: 168,201,223;
    --theme-category-3: #adbadd; --theme-category-rgb-3: 173,186,221;
    --theme-category-4: #a7cbbb; --theme-category-rgb-4: 167,203,187;
    --theme-category-5: #cbb8db; --theme-category-rgb-5: 203,184,219;
  }
}

/* Map the existing component families; local member/home variables also need remapping. */
html:root {
  --front-bg: var(--theme-bg); --front-surface: var(--theme-surface); --front-panel: var(--theme-panel);
  --front-text: var(--theme-text); --front-muted: var(--theme-muted); --front-dim: var(--theme-dim);
  --front-accent: var(--theme-accent); --front-accent-soft: var(--theme-accent-soft); --front-border: var(--theme-border);
  --catalog-bg: var(--theme-bg); --catalog-surface: var(--theme-surface); --catalog-surface-raised: var(--theme-surface-alt);
  --catalog-text: var(--theme-text); --catalog-muted: var(--theme-muted); --catalog-line: var(--theme-border); --catalog-accent: var(--theme-accent);
  --kq-bg: var(--theme-bg); --kq-panel: var(--theme-surface); --kq-text: var(--theme-text); --kq-muted: var(--theme-muted); --kq-accent: var(--theme-accent);
}
html body.home-site {
  --home-bg: var(--theme-bg); --home-surface: var(--theme-surface); --home-surface-raised: var(--theme-surface-alt);
  --home-ink: var(--theme-text); --home-muted: var(--theme-muted); --home-line: var(--theme-border);
  --home-accent: var(--theme-accent); --home-accent-solid: var(--theme-accent-fill); --home-accent-hover: var(--theme-accent-hover);
}
html body.kq-page-my .mc-layout {
  --mc-surface: var(--theme-surface); --mc-raised: var(--theme-surface-alt); --mc-line: var(--theme-border);
  --mc-muted: var(--theme-muted); --mc-text: var(--theme-text); --mc-gold: var(--theme-gold);
}
html body:is(.kq-front, .home-site, .catalog-page, .recovery-reset-page) { background: var(--theme-bg); color: var(--theme-text); color-scheme: var(--theme-scheme); }
html body.kq-front :is(input, select, textarea), html .recovery-reset-page :is(input,select,textarea) { color-scheme: var(--theme-scheme); accent-color: var(--theme-accent-fill); }
html body.kq-front :is(a,button,input,select,textarea,summary):focus-visible,
html .home-site :is(a,button,input,select,textarea,summary):focus-visible,
html :is(.flow-notice,.recovery-reset-page,.site-theme-switch) :is(a,button,input,select,textarea,summary):focus-visible { outline: 3px solid var(--theme-focus); outline-offset: 3px; }
html body:is(.kq-front,.home-site,.catalog-page,.recovery-reset-page) ::selection { color: var(--theme-on-accent); background: var(--theme-accent-fill); }

/* Header, native appearance controls, search and announcements. */
html body.kq-front .front-header, html body.home-site .site-header, html body.catalog-page #frontHeader { background: var(--theme-surface); color: var(--theme-text); border-color: var(--theme-border); box-shadow: 0 2px 12px rgba(0,0,0,.06); }
html body.kq-front :is(.front-member-link,.catalog-quota-hint) { color: var(--theme-gold); }
html body.kq-front .front-account-link, html body.home-site :is(.menu-toggle,.library-search), html body.catalog-page #frontHeader .front-search { background: var(--theme-field-bg); border-color: var(--theme-control-border); color: var(--theme-text); }
html body.home-site :is(.brand-caption,.desktop-nav a,.search-icon,.category-chip span,.post-card__meta,.footer-links a) { color: var(--theme-muted); }
html body.home-site :is(.brand-mark,.welcome-strip,.notice) { background: var(--theme-accent-soft); color: var(--theme-accent); border-color: var(--theme-border); }
html body.home-site :is(.mobile-menu,.bottom-nav) { background: var(--theme-surface); border-color: var(--theme-border); }
html body.home-site :is(.welcome-title,.welcome-action,.section-link,.bottom-nav__link.active,.bottom-nav__link[aria-current]) { color: var(--theme-accent); }
html body.home-site .welcome-description, html body.home-site .bottom-nav__link { color: var(--theme-muted); }
html body.home-site :is(.post-card__meta .icon,.category-chip:hover span) { color: var(--theme-accent); }
html body.home-site :is(.welcome-action,.button--quiet,.page-link,.help-banner__links a,.category-chip) { background: var(--theme-surface-alt); color: var(--theme-text); border-color: var(--theme-control-border); }
html body.home-site :is(.category-chip.is-current,.category-chip.active,.category-chip[aria-current],.page-link.is-current,.page-link[aria-current],.mobile-menu a:hover,.button--quiet:hover) { background: var(--theme-accent-soft); border-color: var(--theme-accent); color: var(--theme-accent); }
html body.home-site :is(.welcome-action:hover,.category-chip:hover,.mobile-menu a:focus-visible) { background: var(--theme-accent-soft); border-color: var(--theme-accent); color: var(--theme-accent); }
html body.home-site .category-chip:is(.is-current,.active,[aria-current]) span { color: var(--theme-accent); }
html body.home-site .page-link.is-disabled { background: var(--theme-surface-alt); color: var(--theme-muted); }
html body.home-site :is(.post-card,.category-shelf,.category-section) { border-color: var(--theme-border); }
html body.home-site .empty-state { background: var(--theme-surface); border-color: var(--theme-control-border); }
html body.home-site :is(.empty-state h3,.site-footer .brand-name) { color: var(--theme-text); }
html body.home-site .site-footer .brand-name span { color: var(--theme-muted); }
html body.kq-front .front-site-notice { background: var(--theme-accent-soft); color: var(--theme-muted); border: 1px solid var(--theme-border); }
html :is(#searchOverlay,#downloadOverlay), html #mxSiteFooter .mxf-overlay { background: var(--theme-overlay); }
html #searchOverlay .search-panel { box-shadow: var(--theme-shadow); }

.site-theme-switch { position: relative; flex: 0 0 auto; color: var(--theme-text); font: inherit; }
.site-theme-switch[hidden] { display: none !important; }
.site-theme-icon[hidden] { display: none !important; }
.site-theme-trigger { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; box-sizing: border-box; padding: 10px; border: 1px solid var(--theme-control-border); border-radius: 8px; background: var(--theme-surface-alt); color: var(--theme-text); cursor: pointer; list-style: none; }
.site-theme-trigger::-webkit-details-marker { display: none; }
.site-theme-trigger::marker { content: ''; }
.site-theme-trigger:hover, .site-theme-switch[open] > .site-theme-trigger { color: var(--theme-accent); background: var(--theme-accent-soft); border-color: var(--theme-accent); }
.site-theme-trigger svg, .site-theme-option svg { display: block; width: 20px; height: 20px; flex: 0 0 20px; }
.site-theme-trigger .site-theme-current { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
details.site-theme-switch > .site-theme-menu { display: none; }
details.site-theme-switch[open] > .site-theme-menu { display: grid; }
.site-theme-menu { position: absolute; top: calc(100% + 9px); right: 0; z-index: 6; box-sizing: border-box; width: 196px; max-width: calc(100vw - 24px); gap: 4px; margin: 0; padding: 11px; border: 1px solid var(--theme-control-border); border-radius: 12px; background: var(--theme-surface); color: var(--theme-text); box-shadow: var(--theme-shadow); text-align: left; }
.site-theme-menu > legend { padding: 0 5px; color: var(--theme-muted); font-size: 13px; }
.site-theme-option { display: flex; align-items: center; gap: 9px; box-sizing: border-box; min-height: 44px; min-width: 0; padding: 9px 10px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--theme-text); font: inherit; font-size: 14px; line-height: 1.5; cursor: pointer; }
.site-theme-option:hover, .site-theme-option[data-theme-selected="true"] { background: var(--theme-accent-soft); color: var(--theme-accent); }
.site-theme-option:focus-within { outline: 2px solid var(--theme-focus); outline-offset: 1px; }
.site-theme-option .site-theme-radio { width: 16px; height: 16px; min-width: 16px; margin: 0; flex: 0 0 16px; padding: 0; accent-color: var(--theme-accent-fill); }
.site-theme-switch--mobile { grid-column: 1 / -1; min-width: 0; margin: 10px 0 0; padding: 14px 0 0; border: 0; border-top: 1px solid var(--theme-border); }
.site-theme-switch--mobile > legend { padding: 0 8px 0 0; color: var(--theme-muted); font-size: 13px; }
.site-theme-options { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
.site-theme-options .site-theme-option { justify-content: center; flex-wrap: wrap; gap: 6px; padding: 8px 6px; border-color: var(--theme-control-border); background: var(--theme-surface-alt); text-align: center; }
.site-theme-options .site-theme-option[data-theme-selected="true"] { border-color: var(--theme-accent); background: var(--theme-accent-soft); }
.site-theme-switch--standalone { position: fixed; top: max(14px,env(safe-area-inset-top,0px)); right: max(16px,env(safe-area-inset-right,0px)); z-index: 20; }
@media(max-width:980px) { .site-theme-switch--desktop { display: none; } }

/* Catalog cards, category palettes and direct-content reading. */
html body.kq-front .mx-category-tone-0 { --category-color: var(--theme-category-0); --category-rgb: var(--theme-category-rgb-0); }
html body.kq-front .mx-category-tone-1 { --category-color: var(--theme-category-1); --category-rgb: var(--theme-category-rgb-1); }
html body.kq-front .mx-category-tone-2 { --category-color: var(--theme-category-2); --category-rgb: var(--theme-category-rgb-2); }
html body.kq-front .mx-category-tone-3 { --category-color: var(--theme-category-3); --category-rgb: var(--theme-category-rgb-3); }
html body.kq-front .mx-category-tone-4 { --category-color: var(--theme-category-4); --category-rgb: var(--theme-category-rgb-4); }
html body.kq-front .mx-category-tone-5 { --category-color: var(--theme-category-5); --category-rgb: var(--theme-category-rgb-5); }
html body.kq-front :is(.catalog-home .cat-tag,.catalog-home .badge-cat) { color: var(--category-color,var(--theme-text)); }
html body.kq-front :is(.catalog-article .intro,.catalog-article .toc-content,.catalog-article .pwd-update,.catalog-content .dialogue-text,.catalog-content .reply-text,.catalog-content .group-author-name,.catalog-content .reply-author) { color: var(--theme-text); }
html body.kq-front :is(.catalog-tag-cloud a,.catalog-content .badge:not([class*="mx-category-tone-"])) { color: var(--theme-muted); }
html body.kq-front .catalog-content mark { background: var(--theme-accent-soft); color: var(--theme-accent); }
html body.kq-front .catalog-rank { background: var(--theme-panel); color: var(--theme-text); }
html body.kq-front .catalog-popular-item:nth-of-type(-n+2) .catalog-rank { background: var(--theme-gold-bg); color: var(--theme-gold); }
html body.catalog-page :is(.card-meta,.card-date,.front-category-nav a) { color: var(--theme-muted); }
html body.catalog-page #frontHeader .front-category-nav a { color: var(--theme-muted); }
html body.catalog-page #frontHeader .front-category-nav a:is(:hover,[aria-current]) { color: var(--theme-accent); }
html body.catalog-page #frontHeader .front-account-nav .front-member-link { color: var(--theme-gold); }
html body.catalog-page #frontHeader .front-search input::placeholder { color: var(--theme-dim); opacity: 1; }
html body.catalog-page .card-category { background: var(--theme-panel); color: var(--theme-muted); }
html body.catalog-page .catalog-empty > a { color: var(--theme-accent); }
html body.catalog-page :is(.catalog-toolbar,.catalog-toolbar select,.catalog-search-form input) { background: var(--theme-surface-alt); border-color: var(--theme-control-border); color: var(--theme-text); }
html body.catalog-page :is(.card,.catalog-pagination a) { border-color: var(--theme-border); }
html body.kq-front .catalog-content :is(.group-author-badge,.reply-badge) { color: var(--theme-gold); background: var(--theme-gold-bg); }
html body.kq-front .catalog-article .download-grid a { color: var(--theme-accent); background: var(--theme-accent-soft); border-color: var(--theme-accent); }
html body.kq-front :is(.catalog-article .pan-badge,.catalog-copy-button,.catalog-reading-links a) { border-color: var(--theme-control-border); }
html body.kq-front .catalog-content :is(.page-input,.size-select,.jump-btn) { border-color: var(--theme-control-border); }
html body.kq-front .catalog-content .reply-mention { color: var(--theme-muted); }
html body.kq-front #downloadModal { background: var(--theme-surface); color: var(--theme-text); border-color: var(--theme-control-border); box-shadow: var(--theme-shadow); }
html body.kq-front #downloadModal :is(.modal-desc,.close-btn) { color: var(--theme-muted); }
html body.kq-front .detail-notice { background: var(--theme-accent-soft); color: var(--theme-text); border-color: var(--theme-border); }

/* Comments: include collected discussions, member replies and the star guide. */
html body.kq-front :is(.community-panel,.source-comments,.discussion-composer,.gc-comment) { border-color: var(--theme-border); }
html body.kq-front .community-panel { background: var(--theme-surface); color: var(--theme-text); }
html body.kq-front :is(.community-metrics,.community-message,.community-form-bottom > span,.community-mine,.community-origin-label,.community-empty,.community-comment time,.source-comments > summary,.community-panel > noscript,.discussion-message,.discussion-reply-to) { color: var(--theme-muted); }
html body.kq-front :is(.community-comment,.discussion-reply,.discussion-thread,.growth-feedback) { border-color: var(--theme-border); }
html body.kq-front :is(.community-panel textarea,.discussion-composer textarea,.gc-form textarea) { background: var(--theme-field-bg); color: var(--theme-text); border-color: var(--theme-control-border); }
html body.kq-front :is(.community-actions button,.community-button.secondary,.community-panel .community-actions > a,.discussion-reply-action,.discussion-more,.discussion-cancel,.gc-login,.gc-link) { background: var(--theme-surface-alt); border-color: var(--theme-control-border); color: var(--theme-text); }
html body.kq-front .community-actions button[aria-pressed="true"] { background: var(--theme-accent-soft); border-color: var(--theme-accent); color: var(--theme-accent); }
html body.kq-front .discussion-admin-badge { background: var(--theme-gold-bg); color: var(--theme-gold); border-color: var(--theme-control-border); }
html body.kq-front .gc-comment strong { color: var(--theme-text); }
html body.kq-front .gc-message { background: var(--theme-success-bg); border-color: var(--theme-success); color: var(--theme-success); }
html body.kq-front .gc-message.is-error { background: var(--theme-danger-bg); border-color: var(--theme-danger); color: var(--theme-danger); }

/* Authentication, recovery, membership checkout, order continuation and success. */
html body.kq-front :is(.kq-auth-panel,.query-card,.success-card) { background: var(--theme-surface); color: var(--theme-text); }
html body.kq-front:is(.kq-page-login,.kq-page-register,.kq-page-query_account) :is(.kq-auth-heading p,.kq-line-field small,.kq-line-field label span,.kq-recovery-intro) { color: var(--theme-muted); }
html body.kq-front:is(.kq-page-login,.kq-page-register,.kq-page-query_account) :is(.kq-line-field label,.kq-password-toggle,.kq-captcha-refresh) { color: var(--theme-text); border-color: var(--theme-control-border); }
html body.kq-front:is(.kq-page-login,.kq-page-register,.kq-page-query_account) :is(.kq-inline-action,.kq-secondary-action,.kq-recovery-switch a) { color: var(--theme-text); border-color: var(--theme-control-border); }
html body.kq-front:is(.kq-page-login,.kq-page-register,.kq-page-query_account) :is(.kq-inline-action:hover,.kq-secondary-action:hover,.kq-recovery-switch a[aria-current]) { color: var(--theme-accent); background: var(--theme-accent-soft); border-color: var(--theme-accent); }
html body.kq-front :is(.kq-line-field,.kq-captcha-row,.purchase-plan,.purchase-selected,.purchase-contact,.member-section-heading,.member-order,.member-entitlements,.member-form .member-mail-preference) { border-color: var(--theme-border); }
html body.kq-front :is(.kq-line-field input,.kq-line-field select,.kq-line-field textarea,.form-input,.captcha-input,#searchOverlay #searchInput) { color: var(--theme-text); border-color: var(--theme-control-border); }
html body.kq-front :is(input,textarea)::placeholder, html body.home-site .library-search input::placeholder { color: var(--theme-dim); opacity: 1; }
html body.kq-front :is(.kq-form-error,.query-card .alert-danger,.member-message.is-error,.recovery-reset-message.is-error) { background: var(--theme-danger-bg); border-color: var(--theme-danger); color: var(--theme-danger); }
html body.kq-front :is(.query-card .alert-success,.member-message:not(.is-error),.kq-recovery-confirmation) { background: var(--theme-success-bg); border-color: var(--theme-success); color: var(--theme-success); }
html body.kq-front :is(.kq-recovery-panel,.kq-recovery-result,.kq-recovery-switch,.kq-recovery-bottom) { border-color: var(--theme-border); }
html body.kq-front :is(.kq-recovery-privacy,.kq-recovery-result p,.kq-recovery-support > summary,.kq-page-query_account .kq-auth-heading p) { color: var(--theme-muted); }
html body.kq-front :is(.kq-recovery-result .kq-copy-feedback,.success-icon,.member-order-status.is-paid,.mc-copy-status,[data-mc-copy-status],.unzip-copy-status,.help-copy-card.is-copied .help-copy-action,.help-panel .help-status) { color: var(--theme-success); }
html body.kq-front .help-panel .help-status.is-error { color: var(--theme-danger); }
html body.kq-front .purchase-plan { background: var(--theme-surface-alt); }
html body.kq-front .purchase-plan.is-selected { background: var(--theme-accent-soft); border-color: var(--theme-accent); }
html body.kq-front .purchase-payment-method span { color: var(--theme-success); }
html body.kq-front .success-legacy-note { background: var(--theme-panel); border-color: var(--theme-border); }
html body.kq-page-my .mc-layout :is(.member-hero,.member-invite) { background: var(--theme-hero); border-color: var(--theme-border); }
html body.kq-page-my :is(.member-sidebar-account,.member-payout-progress,.member-invite-rules p,.member-form .member-mail-preference) { background: var(--theme-surface-alt); border-color: var(--theme-border); }
html body.kq-page-my .mc-layout :is(.mc-sidebar-title,.member-invite-code > strong,.member-earning-grid strong,.member-invite-steps strong,.member-payout-progress strong,.mc-order-detail p span,.mc-order-detail code,.mc-details summary,.mc-quota-rule summary) { color: var(--theme-text); }
html body.kq-page-my :is(.member-eyebrow,.member-invite-intro p,.member-earning-grid span,.member-earning-grid small,.member-invite-code > span,.member-invite-link > label,.member-invite-steps small,.member-invite-rules,.member-invite-rules summary,.member-payout-kicker,.member-payout-progress p,.member-account-links > a span,.mc-order-policy) { color: var(--theme-muted); }
html body.kq-page-my :is(.member-hero-welcome,.member-invite-rate,.member-invite-intro p strong,.member-earning-grid > div:first-child strong,.member-avatar,.wu-balances div:first-child strong) { color: var(--theme-gold); }
html body.kq-page-my .mc-layout :is(.member-btn.is-secondary,.member-text-link,.member-copy-inline,.mc-logout) { background: var(--theme-surface-alt); border-color: var(--theme-control-border); color: var(--theme-text) !important; }
/* Existing member styles mark these two declarations important; match only those fields. */
html body.kq-page-my .mc-layout .member-form input:not([type="checkbox"]):not([type="hidden"]),
html body.kq-page-my .member-invite-link input { background: var(--theme-field-bg) !important; border-color: var(--theme-control-border) !important; color: var(--theme-text); }
html body.kq-page-my .mc-layout :is(.mc-referral-strip,.mc-quick-link,.member-invite-label,.member-invite-rules p) { background: var(--theme-surface); border-color: var(--theme-border); }
html body.kq-page-my .mc-layout .mc-quick-link:hover { background: var(--theme-surface-alt); border-color: var(--theme-control-border); }
html body.kq-page-my .mc-layout .member-status { background: var(--theme-gold-bg); color: var(--theme-gold); border-color: var(--theme-border); }
html body.kq-page-my .mc-layout .member-status.is-muted { background: var(--theme-panel); color: var(--theme-muted); }
html body.kq-page-my .mc-layout .member-summary-actions .mc-renew-soon { color: var(--theme-gold) !important; }
html body.kq-page-my .member-invite-feedback { color: var(--theme-success) !important; }
html body.kq-page-my .member-invite-steps li > span, html body.kq-page-my .member-invite-rules summary::before { color: var(--theme-gold); }
html body.kq-front input:-webkit-autofill { -webkit-text-fill-color: var(--theme-text); box-shadow: 0 0 0 1000px var(--theme-field-bg) inset; }

/* One set of filled-button rules; the link accent is intentionally a different token. */
html body.kq-front :is(.kq-submit,.member-btn:not(.is-secondary),.community-button:not(.secondary),.discussion-submit,.gc-form button,.catalog-retry),
html body.kq-front .catalog-content :is(.search-inline button,.pagination-link.active),
html body.kq-front .catalog-article .download-cta-row a:not(.download-login-link),
html body.kq-front #downloadModal .action-btn:not(.btn-login),
html body.kq-front #searchOverlay .do-search-btn,
html body.kq-front .catalog-preview-note a.catalog-preview-note-primary,
html body.kq-front.kq-page-withdrawals .member-layout button.member-btn:not(.is-secondary),
html body.kq-front.kq-page-my .wu-entry a.member-btn,
html body.kq-page-query_account .btn-primary,
html body.kq-page-success :is(.action-btn.login,.payment-state a.primary),
html body.catalog-page :is(.catalog-toolbar button,.catalog-search-form button,.catalog-pagination a.current),
html body.home-site :is(.button--primary,.library-search button) { background: var(--theme-accent-fill); color: var(--theme-on-accent); border-color: var(--theme-accent); }
html body.kq-front :is(.kq-submit,.member-btn:not(.is-secondary),.community-button:not(.secondary),.discussion-submit,.gc-form button,.catalog-retry):hover,
html body.kq-front .catalog-preview-note a.catalog-preview-note-primary:hover,
html body.kq-front.kq-page-withdrawals .member-layout button.member-btn:not(.is-secondary):hover,
html body.kq-front.kq-page-my .wu-entry a.member-btn:hover,
html body.home-site :is(.button--primary,.library-search button):hover { background: var(--theme-accent-hover); color: var(--theme-on-accent); }
html body.kq-front :is(.kq-submit,.member-btn,.community-button,.community-actions button,.discussion-submit,.discussion-reply-action,.discussion-more,.discussion-cancel,.gc-form button,.btn-primary,.help-button):disabled { opacity: 1; background: var(--theme-surface-alt); color: var(--theme-muted) !important; border-color: var(--theme-control-border); }
html body.kq-front :is(.catalog-reading-links a,.help-shortcuts a,.help-button,.help-copy-card,.catalog-copy-button) { border-color: var(--theme-control-border); }
html body.kq-front :is(.unzip-contact,.unzip-passwords button) { border-color: var(--theme-control-border); }
html body.kq-page-unzip code { color: var(--theme-gold); }

/* Footer sheets and legacy modal IDs are kept readable in both palettes. */
html body.kq-front #mxSiteFooter .mxf-category-panel { background: var(--theme-category-panel); border-color: var(--theme-border); box-shadow: var(--theme-shadow); }
html body.kq-front #mxSiteFooter :is(.mxf-category-group,.mxf-category-panel .mxf-panel-links,.mxf-category-panel .mxf-close) { border-color: var(--theme-border); background: var(--theme-surface-alt); }
html body.kq-front #mxSiteFooter :is(.mxf-eyebrow,.mxf-category-index) { color: var(--theme-gold); background: var(--theme-gold-bg); border-color: var(--theme-border); }
html body.kq-front #mxSiteFooter .mxf-category-parent { color: var(--theme-text); }
html body.kq-front #mxSiteFooter :is(.mxf-category-name small,.mxf-category-grid a small,.mxf-category-parent > .mxf-icon,.mxf-category-grid .mxf-icon,.mxf-category-panel .mxf-panel-description,.mxf-category-panel .mxf-close) { color: var(--theme-muted); }
html body.kq-front #mxSiteFooter .mxf-category-grid a { background: var(--theme-surface); color: var(--theme-text); border-color: var(--theme-border); }
html body.kq-front #mxSiteFooter :is(.mxf-category-parent[aria-current="page"],.mxf-category-grid a[aria-current="page"]) { background: var(--theme-accent-soft); color: var(--theme-accent); border-color: var(--theme-accent); box-shadow: inset 3px 0 var(--theme-accent); }
html body.kq-front #mxSiteFooter :is(.mxf-category-parent[aria-current="page"] .mxf-category-name small,.mxf-category-grid a[aria-current="page"] small) { color: var(--theme-accent); }
html body.kq-front #mxSiteFooter .mxf-category-parent:hover { background: var(--theme-accent-soft); }
html body.kq-front #mxSiteFooter :is(.mxf-copy-status,.copy-btn.copied) { color: var(--theme-success); }
html body.kq-front #mxSiteFooter .copy-btn.copied { background: var(--theme-success-bg); }
/* catalog-integrated.css supplies important legacy colors on these exact IDs. */
html body:is(.kq-front,.catalog-page) #mxSiteFooter #bottomNav { background: var(--theme-surface) !important; border-color: var(--theme-border); }
html body:is(.kq-front,.catalog-page) #mxSiteFooter #bottomNav :is(a,.mxf-nav-item) { color: var(--theme-muted) !important; }
html body:is(.kq-front,.catalog-page) #mxSiteFooter #bottomNav :is(a,.mxf-nav-item):is(.active,[aria-current="page"]) { color: var(--theme-accent) !important; }
html body:is(.kq-front,.catalog-page) #contactOverlay :is(.contact-modal,.contact-card,.contact-buy-tip) { background: var(--theme-surface) !important; color: var(--theme-text) !important; }
html body:is(.kq-front,.catalog-page) #contactOverlay :is(.contact-name,.account-text) { color: var(--theme-text) !important; }
html body:is(.kq-front,.catalog-page) #contactOverlay :is(.modal-footer-tip,.contact-buy-tip p) { color: var(--theme-muted) !important; }
html body:is(.kq-front,.catalog-page) #contactOverlay .contact-buy-tip a { color: var(--theme-accent) !important; }

/* Offers and star-only payout surfaces: presentation only, no feature activation. */
html body.kq-front .growth-dialog { background: var(--theme-surface); color: var(--theme-text); border-color: var(--theme-control-border); box-shadow: var(--theme-shadow); }
html body.kq-front .growth-dialog::backdrop { background: var(--theme-overlay); }
html body.kq-front .growth-offer-note { background: var(--theme-accent-soft); color: var(--theme-text); border-color: var(--theme-border); }
html body.kq-front :is(.growth-original,.growth-feedback-status) { color: var(--theme-muted); }
html body.kq-front .growth-saving { color: var(--theme-accent); }
html body.kq-front .growth-feedback select { background: var(--theme-field-bg); color: var(--theme-text); border-color: var(--theme-control-border); }
html body.kq-front .growth-dialog .growth-close { color: var(--theme-text); border-color: var(--theme-control-border); }
html body.kq-front :is(.rpromo-kicker,.rpromo-plan-benefit,.wu-amount) { color: var(--theme-gold); }
html body.kq-front :is(.rpromo-card,.rpromo-hint,.wu-list > li,.wu-note) { border-color: var(--theme-border); }
html body.kq-front .wu-note { background: var(--theme-gold-bg); color: var(--theme-text); }
html body.kq-front :is(.wu-entry-heading p,.wu-balances span,.wu-subtle,.wu-process,.wu-steps p,.wu-facts dt,.wu-empty,.wu-cancel summary) { color: var(--theme-muted); }
html body.kq-front :is(.payout-status,.wu-state) { background: var(--theme-info-bg); color: var(--theme-info); }
html body.kq-front :is(.payout-status.is-approved,.wu-state.is-paid) { background: var(--theme-success-bg); color: var(--theme-success); }
html body.kq-front :is(.payout-status.is-rejected,.payout-review-note,.wu-state.is-rejected) { background: var(--theme-danger-bg); color: var(--theme-danger); }
html body.kq-front :is(.payout-status.is-empty,.wu-state.is-cancelled) { background: var(--theme-panel); color: var(--theme-muted); }
html body.kq-front .wu-state.is-approved { background: var(--theme-gold-bg); color: var(--theme-gold); }
html body.kq-front .payout-upload input::file-selector-button { background: var(--theme-surface-alt); color: var(--theme-text); border: 1px solid var(--theme-control-border); }

/* Standalone recovery and interrupted-flow pages deliberately have no site header. */
html body.recovery-reset-page .recovery-reset-panel, html .flow-notice section { background: var(--theme-surface); color: var(--theme-text); border-color: var(--theme-border); }
html body.recovery-reset-page :is(.recovery-reset-intro,.recovery-reset-note,.recovery-reset-empty p,.recovery-reset-form small,.recovery-password-control .kq-password-toggle), html .flow-notice p { color: var(--theme-muted); }
html body.recovery-reset-page .recovery-reset-form label { color: var(--theme-text); }
html body.recovery-reset-page .recovery-brand { color: var(--theme-accent); }
html body.recovery-reset-page .recovery-password-control input { background: var(--theme-field-bg); color: var(--theme-text); border-color: var(--theme-control-border); }
html body.recovery-reset-page .recovery-password-control input::placeholder { color: var(--theme-dim); opacity: 1; }
html body.recovery-reset-page .recovery-reset-message { background: var(--theme-panel); color: var(--theme-text); border-color: var(--theme-border); }
html body.recovery-reset-page .recovery-reset-message.is-error { background: var(--theme-danger-bg); color: var(--theme-danger); border-color: var(--theme-danger); }
html body.recovery-reset-page .recovery-reset-bottom a, html .flow-notice .flow-action { background: var(--theme-surface-alt); color: var(--theme-text); border-color: var(--theme-control-border); }
html body.recovery-reset-page .recovery-reset-submit, html .flow-notice .flow-action.is-primary { background: var(--theme-accent-fill); color: var(--theme-on-accent); border-color: var(--theme-accent); }
html body.recovery-reset-page .recovery-reset-submit:disabled { opacity: 1; background: var(--theme-surface-alt); color: var(--theme-muted); }
html .account-copy-status { background: var(--theme-surface); color: var(--theme-text); border-color: var(--theme-control-border); box-shadow: var(--theme-shadow); }
@media (prefers-reduced-motion: reduce) { .site-theme-switch :is(summary,label) { transition: none; } }
