/* v18.1: pair foregrounds with their actual native surfaces. Layout and artwork stay separate.
   The scope attribute is emitted by every native HTML shell. Screen fixes leave invoice print styles alone. */
@media screen {
  html[data-theme="halloween"] :is(strong,b) {font-weight:600}
  html[data-theme][data-theme-scope] {
    --theme-success-bg:#e4f3eb;--theme-success-ink:#1b6143;--theme-success-line:#a8d2ba;
    --theme-warning-bg:#fff1d7;--theme-warning-ink:#785210;--theme-warning-line:#dfc797;
    --theme-error-bg:#fce8e8;--theme-error-ink:#972c34;--theme-error-line:#dfb2b6;
  }
  html[data-theme][data-theme-scope]:is([data-theme="midnight"],[data-theme="halloween"],[data-theme="aurora"]) {
    --theme-success-bg:#17382b;--theme-success-ink:#a8e9bf;--theme-success-line:#3d7559;
    --theme-warning-bg:#3a2e1d;--theme-warning-ink:#f4d39a;--theme-warning-line:#836841;
    --theme-error-bg:#3b2029;--theme-error-ink:#ffc1c6;--theme-error-line:#87505c;
  }

  /* Missed fixed-blue copy and white tiles on the public catalog and builder. */
  html[data-theme]:not([data-theme="classic"]) :is(.tier,.plan-flag,.portal-pre,.request-snapshot,.notice) {background:var(--theme-soft);color:var(--theme-text);border-color:var(--theme-border)}
  html[data-theme]:not([data-theme="classic"]) .tier:hover {background:var(--theme-surface);border-color:var(--theme-accent)}
  html[data-theme]:not([data-theme="classic"]) :is(.plan-price,.slip-head,.setup-product,.tier .mono,.configuration-grid dd,.workspace-crumb strong) {color:var(--theme-text)}
  html[data-theme]:not([data-theme="classic"]) :is(.plan li,.tier span:first-child,.tier .cap,:where(.tier) .mono.ask,.price-from,.slip-ref,.slip-text,.status,.summary-help summary,.send-request summary,.seg button,.faq summary,.consent-label,.policy-card>span,.setup-facts span,.summary-total>span,.service-hero-facts>div>span,.reply-actions>span,.verification-state,.check-state,.section-label,.filter-empty,.setup-steps,.activity-list li,.launch-list li,.readiness-list li,.profile-save>span,.admin-savebar span,.workspace-crumb,.service-chevron .icon) {color:var(--theme-muted)}
  html[data-theme]:not([data-theme="classic"]) .seg button.active {background:var(--theme-surface);color:var(--theme-accent)}
  html[data-theme]:not([data-theme="classic"]) :is(.setup-preview-label,.setup-facts span,.attention-list b) {background:var(--theme-soft);color:var(--theme-muted);border-color:var(--theme-border)}
  html[data-theme]:not([data-theme="classic"]) .preview-note {color:var(--theme-muted)!important}
  html[data-theme]:not([data-theme="classic"]) .invoice-grand-total {color:var(--theme-text)!important}
  html[data-theme]:not([data-theme="classic"]) .service-list-item:hover {background:var(--theme-soft)}

  /* Controls inherit their own foreground, rather than a surrounding banner or heading rule. */
  html[data-theme][data-theme-scope] .btn :is(span,strong,b,small,.icon) {color:inherit}
  html[data-theme][data-theme-scope] .btn.primary :is(span,strong,b,small,.icon) {color:inherit}
  html[data-theme][data-theme-scope] :is(.nav,.admin-nav,.auth-story,.foot) .btn:not(.primary) {background:var(--theme-nav-active);color:var(--theme-nav-text);border-color:var(--theme-nav-line)}
  html[data-theme][data-theme-scope] :is(.nav,.admin-nav,.auth-story,.foot) .btn:not(.primary):hover {background:var(--theme-nav-active);color:var(--theme-nav-text);border-color:var(--theme-nav-text)}
  html[data-theme][data-theme-scope] .btn.primary:disabled,
  html[data-theme][data-theme-scope] .btn:disabled {opacity:1;background:var(--theme-soft);color:var(--theme-muted);border-color:var(--theme-border-strong)}
  html[data-theme][data-theme-scope] .choice input:disabled+.choice-body {opacity:1;background:var(--theme-soft);border-style:dashed}
  html[data-theme][data-theme-scope] .choice input:disabled+.choice-body :is(strong,span) {color:var(--theme-muted)}
  html[data-theme][data-theme-scope] .home-hero .pill {background:var(--theme-nav-active);color:var(--theme-nav-text);border-color:var(--theme-nav-line)}
  html[data-theme][data-theme-scope] .home-hero .pill :is(span,.icon) {color:inherit}

  /* Keep status meanings and readable nested copy on the same background. */
  html[data-theme][data-theme-scope] .admin-alert {background:var(--theme-soft);color:var(--theme-text);border-color:var(--theme-border)}
  html[data-theme][data-theme-scope] :is(.admin-alert.success,.payment-confirmation,.status-active,.portal-status.paid,.portal-status.active,.portal-status.completed,.portal-status.accepted,.portal-status.done) {background:var(--theme-success-bg);color:var(--theme-success-ink);border-color:var(--theme-success-line)}
  html[data-theme][data-theme-scope] :is(.admin-alert.warning,.operations-public-notice,.client-announcement.maintenance,.sandbox-label,.attention-list b.has-items,.status-quoted,.portal-status.unpaid,.portal-status.pending,.portal-status.review,.portal-status.held,.portal-status.awaiting_payment) {background:var(--theme-warning-bg);color:var(--theme-warning-ink);border-color:var(--theme-warning-line)}
  html[data-theme][data-theme-scope] :is(.admin-alert.error,.notice.error,.priority-high,.priority-urgent,.btn.danger,.portal-status.failed,.portal-status.cancelled,.portal-status.disabled,.portal-status.void,.portal-status.revoked,.portal-status.suspended) {background:var(--theme-error-bg);color:var(--theme-error-ink);border-color:var(--theme-error-line)}
  html[data-theme][data-theme-scope] :is(.status-new,.status-closed) {background:var(--theme-soft);color:var(--theme-text);border-color:var(--theme-border)}
  html[data-theme][data-theme-scope] :is(.admin-alert,.admin-alert.success,.notice,.notice.error,.payment-confirmation,.operations-public-notice,.client-announcement,.portal-status,.sandbox-label) :is(p,strong,b,span,small,code) {color:inherit}
  html[data-theme][data-theme-scope] :is(.admin-alert,.notice,.payment-confirmation,.operations-public-notice,.client-announcement) a {color:inherit;text-decoration:underline}
  html[data-theme][data-theme-scope] .admin-body .danger {color:var(--theme-error-ink)!important}

  /* Classic keeps its original layout and assets; only weak small-text/action colors change. */
  html[data-theme="classic"][data-theme-scope] body {--muted:var(--theme-muted)}
  html[data-theme="classic"][data-theme-scope] .btn.primary {background:var(--theme-accent);color:var(--theme-on-accent);border-color:var(--theme-accent)}
  html[data-theme="classic"][data-theme-scope] .btn.primary:hover {background:var(--theme-accent-hover);border-color:var(--theme-accent-hover)}
  html[data-theme="classic"][data-theme-scope] .btn.primary:disabled {background:var(--theme-soft);color:var(--theme-muted);border-color:var(--theme-border-strong)}
  html[data-theme="classic"][data-theme-scope] .home-hero {--muted:var(--theme-hero-muted)}
  html[data-theme="classic"][data-theme-scope] .home-hero :is(.checks,.hero-caption) {color:var(--theme-hero-muted)}
  html[data-theme="classic"][data-theme-scope] .home-hero .grad {color:var(--theme-hero-text)}
  html[data-theme="classic"][data-theme-scope] .home-hero .workspace-preview {--text:var(--theme-text);--muted:var(--theme-muted)}
  html[data-theme="classic"][data-theme-scope] .foot :is(p,a,small,.foot-bottom,.foot-legal) {color:var(--theme-nav-muted)}
  html[data-theme="classic"][data-theme-scope] .foot :is(h4,strong,a:hover) {color:var(--theme-nav-text)}
  html[data-theme="classic"][data-theme-scope] :is(.nav-heading,.nav-person small,.admin-brand small,.brand small,.auth-story p,.auth-story-footer) {color:var(--theme-nav-muted)!important}
  html[data-theme="classic"][data-theme-scope] .auth-benefits {color:var(--theme-nav-text)}
}
