/* Public site and customer console dark surfaces. Scope changes to known
   components; provider artwork, uploaded images and payment QR pixels stay intact. */
html[data-theme="dark"] .public-workspace :is(.hero,.product-stage,.start-stage,.home-next,.section.home-guide,.section.trust-section) {
  background: radial-gradient(ellipse at 80% 0%, #1a385044, transparent 58%), var(--soft);
}
html[data-theme="dark"] .public-workspace #product.product-stage { background:radial-gradient(ellipse at 15% 12%,#1a385044,transparent 58%),var(--soft); }
html[data-theme="dark"] .public-workspace .hero::after { background: linear-gradient(180deg,transparent,#18304844); }
html[data-theme="dark"] .public-workspace .home-next { --hn-ink:var(--ink); --hn-muted:var(--muted); --hn-line:var(--line); --hn-blue:var(--sky); --hn-green:var(--green); }
html[data-theme="dark"] .public-workspace :is(.hero-copy,.hero-points span,.product-stage-note,.product-card p,.product-card-kicker + p,.start-stage-head p,.start-path-card p,.home-next .hn-plus) { color:var(--muted); }
html[data-theme="dark"] .public-workspace :is(.hero-console,.hero-points span,.route-card,.route-steps>div,.provider-item,.console-bottom>div,.proof-grid>div,.product-stage-signal,.start-path-card,.start-path-link) {
  background:var(--bg); border-color:var(--line); color:var(--ink); box-shadow:var(--surface-shadow);
}
html[data-theme="dark"] .public-workspace #product .product-card {
  background:linear-gradient(145deg,var(--bg),var(--soft2)); border-color:var(--line); box-shadow:var(--surface-shadow);
}
html[data-theme="dark"] .public-workspace :is(.provider-logo-openai,.provider-logo-mono) { color:var(--ink); }
html[data-theme="dark"] .public-workspace :is(.product-card-kicker,.start-path-kicker,.health-failover) { color:var(--sky); }
html[data-theme="dark"] .public-workspace :is(.product-card-reliability .product-card-kicker,.start-path-workspace .start-path-kicker,.health-failover strong,.security-row b) { color:var(--green); }
html[data-theme="dark"] .public-workspace .product-card-billing .product-card-kicker { color:var(--amber); }
html[data-theme="dark"] .public-workspace .product-card-security .product-card-kicker { color:#75d4dc; }
html[data-theme="dark"] .public-workspace :is(.health-visual,.billing-visual,.security-visual) {
  background:var(--soft); border-color:var(--line); box-shadow:none;
}
html[data-theme="dark"] .public-workspace :is(.health-route,.gateway-providers>span) { background:var(--bg); border-color:var(--line-strong); color:var(--ink); }
html[data-theme="dark"] .public-workspace :is(.health-visual-head,.health-route code,.billing-total>small,.billing-row,.security-row,.start-stage-head>p) { color:var(--muted); }
html[data-theme="dark"] .public-workspace :is(.billing-total strong,.billing-row b) { color:var(--ink); }
html[data-theme="dark"] .public-workspace :is(.billing-row,.security-row) { border-color:var(--line); }
html[data-theme="dark"] .public-workspace .billing-meter { background:var(--line); }
html[data-theme="dark"] .public-workspace .health-route.is-degraded em { background:var(--theme-warning-bg); color:var(--amber); }
html[data-theme="dark"] .public-workspace .health-route.is-healthy em { background:var(--theme-success-bg); color:var(--green); }
html[data-theme="dark"] .public-workspace .security-shield { background:var(--sky-soft); color:#75d4dc; border-color:var(--line-strong); box-shadow:none; }
html[data-theme="dark"] .public-workspace .start-path-api { background:linear-gradient(145deg,var(--sky-soft),var(--bg) 68%); border-color:var(--line-strong); }
html[data-theme="dark"] .public-workspace .start-path-link:hover { background:var(--sky-soft); border-color:var(--sky); color:var(--sky-dark); }
html[data-theme="dark"] .public-workspace .start-path-card .start-path-link-primary,
html[data-theme="dark"] .public-workspace .start-path-card .start-path-link-primary:hover { background:var(--theme-primary); border-color:var(--theme-primary); color:var(--theme-on-primary); }

/* Documentation, legal reading, model recommendations and pricing. */
html[data-theme="dark"] .public-workspace :is(.dash-card,.price-card,.pricing-recharge,.docs-try-card,.docs-info-panel,.docs-api-panel,.legal-grid article,.email-unsubscribe-card,.model-scene-tab,.model-catalog-copy,.model-chip,.model-row span) {
  background:var(--bg); border-color:var(--line); color:var(--ink);
}
html[data-theme="dark"] .public-workspace :is(.price-card.featured,.docs-api-panel-accent,.model-recommendation-card.is-featured) { border-color:var(--line-strong); }
html[data-theme="dark"] .public-workspace :is(.price-card ul,.pricing-equation span,.legal-meta,.model-recommendation-title code,.model-catalog-status,.email-unsubscribe-email) { color:var(--muted); }
html[data-theme="dark"] .public-workspace .pricing-rate-updated { color:var(--muted)!important; }
html[data-theme="dark"] .public-workspace .pricing-rate-details summary em { color:var(--muted); }
html[data-theme="dark"] .public-workspace :is(.table,.card) :not(pre)>code { color:var(--sky-dark); }
html[data-theme="dark"] .public-workspace :is(.pricing-equation span,.doc-pill-row span,.model-recommendation-meta span,.model-scene-tab>span,.model-provider-locks>summary::after) {
  background:var(--soft2); border-color:var(--line); color:var(--muted);
}
html[data-theme="dark"] .public-workspace :is(.docs-try-features span,.pricing-rate-toggle-icon,.pricing-rate-details[open] .pricing-rate-toggle-icon,.model-route-guide-item span) {
  background:var(--sky-soft); border-color:var(--line-strong); color:var(--sky-dark); box-shadow:none;
}
html[data-theme="dark"] .public-workspace :is(.model-scene-tab.is-active,.model-catalog-copy:hover) { background:var(--sky-soft); border-color:var(--sky); color:var(--sky-dark); }
html[data-theme="dark"] .public-workspace .model-scene-tab.is-active>span { background:var(--theme-primary); color:var(--theme-on-primary); }
html[data-theme="dark"] .public-workspace .model-scene-intro-symbol { background:var(--sky-soft); color:var(--sky); }
html[data-theme="dark"] .public-workspace :is(.model-catalog-help a,.model-catalog-help a:hover) { color:var(--sky-dark); }
html[data-theme="dark"] .public-workspace .model-recommendation-price { border-color:var(--line); }
html[data-theme="dark"] .public-workspace :is(.docs-method,.model-role-recommended,.model-chip-auto,.model-route-guide-item.is-auto span) {
  background:var(--theme-success-bg); border-color:var(--theme-success-line); color:var(--green);
}
html[data-theme="dark"] .public-workspace :is(.model-role-value,.model-advanced-warning) { background:var(--theme-warning-bg); border-color:var(--theme-warning-line); color:var(--amber); }
html[data-theme="dark"] .public-workspace .model-advanced-warning strong { color:var(--amber); }
html[data-theme="dark"] .public-workspace .model-role-fast { background:var(--sky-soft); color:var(--sky-dark); }
html[data-theme="dark"] .public-workspace .model-role-powerful { background:var(--theme-violet-bg); color:var(--theme-violet); }
html[data-theme="dark"] .public-workspace :is(.model-role-new,.model-campaign-badge) { background:#3d2838; border-color:#654158; color:var(--pink); }
html[data-theme="dark"] .public-workspace .model-kind-dot { background:var(--green); box-shadow:0 0 0 4px var(--theme-success-bg); }
html[data-theme="dark"] .public-workspace .model-kind-dot.is-image { background:var(--theme-violet); box-shadow:0 0 0 4px var(--theme-violet-bg); }
html[data-theme="dark"] .public-workspace .code-card { background:#0c1420; color:#e6edf7; border:1px solid var(--line); }
html[data-theme="dark"] .public-workspace .code-top { background:#121d2c; border-color:var(--line); color:var(--muted); }
html[data-theme="dark"] .public-workspace .code-top .copy-btn { background:var(--soft2); border-color:var(--line-strong); color:var(--ink); }
html[data-theme="dark"] .public-workspace .code-top .copy-btn:hover { background:var(--sky-soft); border-color:var(--sky); }
html[data-theme="dark"] .public-workspace .status-responsive-table tr { background:var(--bg); border-color:var(--line); }

/* Authentication includes disabled controls and consent, without recoloring
   third-party identity-provider logos or embedded verification widgets. */
html[data-theme="dark"] .auth-page :is(.auth-trust,.signup-referral-bonus,.signup-referral-code code) { color:var(--muted); }
html[data-theme="dark"] .auth-page .signup-referral-code code { background:var(--bg); border-color:var(--line); }
html[data-theme="dark"] .auth-page .oauth-button { background:var(--bg); border-color:var(--line-strong); color:var(--ink); }
html[data-theme="dark"] .auth-page .oauth-button:hover { background:var(--soft2); border-color:var(--sky); }
html[data-theme="dark"] .auth-page :is(.signup-fields input:disabled,.oauth-button:disabled,.code-send-btn:disabled,.code-send-btn:disabled:hover,.form-submit:disabled,.form-submit:disabled:hover) {
  background:var(--soft2); border-color:var(--line); color:var(--muted); box-shadow:none;
}
html[data-theme="dark"] .auth-page .form .err { background:var(--theme-danger-bg); border-color:var(--theme-danger-line); color:var(--red); }
html[data-theme="dark"] :is(.google-onetap-legal,.google-onetap-consent-close) { color:var(--ink); }
html[data-theme="dark"] .google-onetap-consent-close { background:var(--soft2); }
html[data-theme="dark"] .google-onetap-mark { border-color:var(--line); }
html[data-theme="dark"] .google-onetap-consent-card .google-onetap-consent-error { background:var(--theme-danger-bg); border-color:var(--theme-danger-line); }
html[data-theme="dark"] :is(.page-expired-card-icon,.page-expired-notice-icon,.legal-version-tip) { background:var(--sky-soft); color:var(--sky); border-color:var(--line-strong); }
html[data-theme="dark"] :is(.page-expired-notice-copy p,.page-expired-notice-dismiss) { color:var(--muted); }
html[data-theme="dark"] .page-expired-notice-dismiss:hover { background:var(--soft2); color:var(--ink); }

/* Dashboard / billing / logs. Status chips keep green, amber and red meaning. */
html[data-theme="dark"] .console-body :is(.dashboard-welcome,.dashboard-welcome-key,.dashboard-welcome-steps li) { border-color:var(--line); }
html[data-theme="dark"] .console-body .dashboard-welcome { background:linear-gradient(135deg,var(--sky-soft),var(--bg) 70%); }
html[data-theme="dark"] .console-body :is(.dashboard-welcome-main>p,.dashboard-welcome-key>span,.dashboard-welcome-dismiss) { color:var(--muted); }
html[data-theme="dark"] .console-body .dashboard-welcome-dismiss { background:var(--bg); border-color:var(--line); }
html[data-theme="dark"] .console-body :is(.dashboard-welcome-key code,.dashboard-welcome-steps b) { color:var(--ink); }
html[data-theme="dark"] .console-body .dashboard-welcome-key code { background:var(--soft); }
html[data-theme="dark"] .console-body :is(.dashboard-copy-id:hover,.dash-link-card,.ticket-summary>div,.balance-alert-amount,.balance-alert-recipients textarea) { background:var(--soft2); border-color:var(--line); }
html[data-theme="dark"] .console-body :is(.amt-preset,.paypal-btn) { background:var(--bg); border-color:var(--line-strong); color:var(--ink); }
html[data-theme="dark"] .console-body :is(.amt-preset:hover,.paypal-btn:hover) { background:var(--sky-soft); border-color:var(--sky); color:var(--sky-dark); }
html[data-theme="dark"] .console-body :is(.payment-unavailable,.flash-warn) { background:var(--theme-warning-bg); border-color:var(--theme-warning-line); color:var(--amber); }
html[data-theme="dark"] :is(.console-body,.public-workspace) :is(.status-pill.ok,.badge.ok,.badge.sale,.promo-badge) { background:var(--theme-success-bg); border-color:var(--theme-success-line); color:var(--green); }
html[data-theme="dark"] :is(.console-body,.public-workspace) .badge.warn { background:var(--theme-warning-bg); color:var(--amber); }
html[data-theme="dark"] :is(.console-body,.public-workspace) .badge.err { background:var(--theme-danger-bg); color:var(--red); }
html[data-theme="dark"] :is(.console-body,.public-workspace) .badge.mute { background:var(--soft2); color:var(--muted); }
html[data-theme="dark"] :is(.console-body,.public-workspace) .promo-price strong { color:var(--green); }
html[data-theme="dark"] :is(.console-body,.public-workspace) .promo-price del { color:var(--muted); }
html[data-theme="dark"] :is(.promo-tip,.promo-tip::after,.floating-promo-tooltip) { background:var(--bg); border-color:var(--line-strong); color:var(--ink); }
html[data-theme="dark"] .console-body :is(.table code,.card code,.newkey-banner code) { color:var(--sky-dark); }
html[data-theme="dark"] .console-body :is(.log-bug-report-link,.log-error-copy) { background:var(--sky-soft); border-color:var(--line-strong); color:var(--sky-dark); }
html[data-theme="dark"] .console-body .log-detail-label { color:var(--amber); }
html[data-theme="dark"] .console-body .log-detail-label.log-detail-error { color:var(--red); }
html[data-theme="dark"] .console-body .row-err td { background:var(--theme-danger-bg); }
html[data-theme="dark"] .console-body .row-warn td { background:var(--theme-warning-bg); }
html[data-theme="dark"] .console-body .balance-alert-switch-track { background:var(--line-strong); border-color:var(--line-strong); }
html[data-theme="dark"] .console-body .balance-alert-switch input:checked + .balance-alert-switch-track { background:#21835f; border-color:#21835f; }
html[data-theme="dark"] .console-body .balance-alert-switch-on { color:var(--green); }
html[data-theme="dark"] .console-body .payment-checkout-status[data-state="paid"] { color:var(--green); }
html[data-theme="dark"] .console-body .payment-checkout-status[data-state="pending"] { color:var(--amber); }
html[data-theme="dark"] .console-body .payment-checkout-status[data-state="failed"] { color:var(--red); }

/* Usage charts are SVG/CSS: no reinitialization or polling on a theme change. */
html[data-theme="dark"] .console-body :is(.usage-empty-state>span,.usage-donut-placeholder,.mini-bar) { background:var(--soft2); border-color:var(--line); color:var(--muted); }
html[data-theme="dark"] .console-body .usage-empty-state strong { color:var(--ink); }
html[data-theme="dark"] .console-body .usage-window-copy strong { color:var(--ink); }
html[data-theme="dark"] .console-body .usage-details-toggle { color:var(--sky-dark); }
html[data-theme="dark"] .console-body .usage-donut-track { stroke:var(--line); }
html[data-theme="dark"] .console-body .usage-donut-segment-1 { stroke:#64b8f0; }
html[data-theme="dark"] .console-body .usage-donut-segment-2 { stroke:#66d7cc; }
html[data-theme="dark"] .console-body .usage-donut-segment-3 { stroke:#b5a2f3; }
html[data-theme="dark"] .console-body .usage-donut-segment-4 { stroke:#efbe72; }
html[data-theme="dark"] .console-body .usage-model-swatch-1 { background:#64b8f0; }
html[data-theme="dark"] .console-body .usage-model-swatch-2 { background:#66d7cc; }
html[data-theme="dark"] .console-body .usage-model-swatch-3 { background:#b5a2f3; }
html[data-theme="dark"] .console-body .usage-model-swatch-4 { background:#efbe72; }

/* Support and messages retain distinguishable user/staff/system responses. */
html[data-theme="dark"] .console-body :is(.support-reward-notice,.support-reward-notice>summary,.support-reward-hint) { color:var(--muted); }
html[data-theme="dark"] .console-body .support-upload-field { color:var(--ink); }
html[data-theme="dark"] .console-body .support-reward-notice>summary:hover .support-reward-hint { color:var(--ink); }
html[data-theme="dark"] .console-body .support-reward-details { border-color:var(--line-strong); color:var(--muted); }
html[data-theme="dark"] .console-body .support-thread .thread-message { background:var(--bg); border-color:var(--line); }
html[data-theme="dark"] .console-body .support-thread .thread-message.role-admin { background:var(--theme-success-bg); border-color:var(--theme-success-line); border-left-color:var(--green); }
html[data-theme="dark"] .console-body .support-thread .thread-message.role-user { background:var(--sky-soft); border-color:var(--line-strong); border-left-color:var(--sky); }
html[data-theme="dark"] .console-body .support-thread .thread-message.role-system { background:var(--soft2); border-color:var(--line); border-left-color:var(--muted); }
html[data-theme="dark"] .console-body .support-thread .thread-message.is-focused { background:var(--theme-success-bg); border-color:var(--green); box-shadow:0 0 0 3px #67d8ae26; }
html[data-theme="dark"] .console-body :is(.support-resolution-notice,.support-ticket-resolve-form .btn) { background:var(--theme-success-bg); border-color:var(--theme-success-line); color:var(--green); }
html[data-theme="dark"] .console-body .support-resolution-notice :is(strong,p,small) { color:var(--green); }
html[data-theme="dark"] .console-body .support-ticket-resolve-form .btn:hover { background:#21835f; color:#fff; }
html[data-theme="dark"] .console-body .support-thread-latest { background:var(--bg); border-color:var(--line-strong); color:var(--sky-dark); }
html[data-theme="dark"] .console-body .support-thread-latest:hover { background:var(--sky-soft); border-color:var(--sky); }
html[data-theme="dark"] .console-body :is(.message-item,.message-summary-item):hover { background:var(--soft2); }

/* Public shared answers, images and audio use the same reading surfaces. */
html[data-theme="dark"] .console-body .shared-speech-icon { background:var(--theme-primary); color:var(--theme-on-primary); }
html[data-theme="dark"] .console-body .shared-image-grid img { background:var(--soft); }
html[data-theme="dark"] .console-body .shared-markdown :is(h1,h2,h3,h4,h5,h6,p,li,blockquote) { color:var(--ink); }
html[data-theme="dark"] .console-body .shared-markdown :not(pre)>code { background:var(--soft2); border-color:var(--line-strong); color:var(--sky-dark); }
html[data-theme="dark"] .console-body .shared-markdown blockquote { background:var(--soft2); border-color:var(--line-strong); }
html[data-theme="dark"] .console-body .shared-markdown :is(th,td) { border-color:var(--line); }
html[data-theme="dark"] .console-body .shared-markdown th { background:var(--soft2); }

@media(max-width:640px) {
  html[data-theme="dark"] .dashboard-mobile-ready .request-log-table-wrap tbody tr.row-err { background:var(--theme-danger-bg); border-color:var(--theme-danger-line); }
  html[data-theme="dark"] .dashboard-mobile-ready .request-log-table-wrap tbody tr.row-warn { background:var(--theme-warning-bg); border-color:var(--theme-warning-line); }
}
