/* Shared semantic palette. Page skins follow this file; theme changes never
   invert uploaded media, logos, charts, or third-party payment content. */
:root {
  color-scheme: light;
  --theme-primary: #1769c2;
  --theme-on-primary: #fff;
  --theme-success-bg: #edf8f3;
  --theme-success-line: #badfce;
  --theme-warning-bg: #fff8eb;
  --theme-warning-line: #ead1a2;
  --theme-danger-bg: #fff1f1;
  --theme-danger-line: #e9bbbb;
  --theme-violet: #7753ad;
  --theme-violet-bg: #f3effa;
  --surface: var(--bg);
  --text: var(--ink);
  --border: var(--line);
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141e2c;
  --soft: #0d1520;
  --soft2: #1a2637;
  --ink: #e6edf7;
  --muted: #a2b1c6;
  --line: #2a3a50;
  --line-strong: #405674;
  --sky: #74b6ff;
  --sky-dark: #a7d2ff;
  --sky-soft: #1a3049;
  --blue: #85b9ff;
  --pink: #ed9bc2;
  --green: #67d8ae;
  --amber: #f0c273;
  --red: #ff9696;
  --shadow: 0 18px 44px #0005;
  --theme-primary: #2369b7;
  --theme-success-bg: #16392f;
  --theme-success-line: #30604d;
  --theme-warning-bg: #382d1d;
  --theme-warning-line: #6b5531;
  --theme-danger-bg: #3c252e;
  --theme-danger-line: #70404b;
  --theme-violet: #c3a6ef;
  --theme-violet-bg: #302740;
  background: var(--soft);
}
html[data-theme="dark"] body {
  --surface-shadow: 0 4px 20px #0002;
  --workspace-shadow: 0 4px 20px #0002;
  --workspace-float-shadow: 0 16px 48px #0006;
  background-color: var(--soft);
  color: var(--ink);
}
html[data-theme="dark"] ::selection { background: #315d86; color: #fff; }
html[data-theme="dark"] :is(input,textarea)::placeholder { color: var(--muted); opacity: 1; }
html[data-theme="dark"] :is(input,select,textarea) { accent-color: var(--sky); }
html[data-theme="dark"] :is(input,select,textarea):where(:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="hidden"]):not([type="submit"])) {
  background-color: var(--bg); color: var(--ink); border-color: var(--line-strong);
}
html[data-theme="dark"] :is(input,select,textarea):focus-visible { outline-color: var(--sky); }
html[data-theme="dark"] :is(.btn-primary,.page-expired-action) {
  background: var(--theme-primary); border-color: var(--theme-primary); color: var(--theme-on-primary);
}
html[data-theme="dark"] :is(.btn-primary,.page-expired-action):hover:not(:disabled) { background: #2c78cc; border-color: #2c78cc; color: #fff; }
html[data-theme="dark"] .btn-danger { background: var(--theme-danger-bg); border-color: var(--theme-danger-line); color: var(--red); }
html[data-theme="dark"] .btn-danger:hover:not(:disabled) { background: #512c36; border-color: var(--red); color: var(--red); }
html[data-theme="dark"] :is(.btn-secondary,.btn-quiet,.lang-switch,.hamburger,.notification-button,.updates-toggle) {
  background: var(--bg); color: var(--ink); border-color: var(--line-strong);
}
html[data-theme="dark"] :is(.btn-secondary,.btn-quiet,.lang-switch,.hamburger,.notification-button,.updates-toggle):hover {
  background: var(--sky-soft); color: var(--sky-dark); border-color: var(--sky);
}
html[data-theme="dark"] :is(.card,.form,.notification-popover,.updates-popover,.topbar-notification-center .unified-notification-panel,.page-expired-card,.page-expired-notice,.google-onetap-consent-card) {
  background: var(--bg); color: var(--ink); border-color: var(--line);
}
html[data-theme="dark"] .site-header { background: #141e2cf5; border-color: var(--line); }
html[data-theme="dark"] .site-header::before { opacity: .4; }
html[data-theme="dark"] .nav-links { background-color: var(--bg); }
html[data-theme="dark"] :is(.site-footer,.dashboard-subnav[data-secondary-nav]) { background: var(--soft); border-color: var(--line); }
html[data-theme="dark"] :is(.nav-links a,.footer-links a,.footer-legal a,.footer-legal button) { color: var(--muted); }
html[data-theme="dark"] :is(.nav-links a,.footer-links a,.footer-legal a,.footer-legal button):hover,
html[data-theme="dark"] .nav-links a.active { color: var(--ink); }
html[data-theme="dark"] .hamburger span { background: var(--ink); }
html[data-theme="dark"] .table :is(th,td) { border-color: var(--line); }
html[data-theme="dark"] .table th { background: var(--soft); color: var(--muted); }
html[data-theme="dark"] .table tbody tr:hover { background: var(--soft2); }
html[data-theme="dark"] :is(.flash-ok,.form-msg.ok) { background: var(--theme-success-bg); border-color: var(--theme-success-line); color: var(--green); }
html[data-theme="dark"] :is(.flash-err,.form-msg.err) { background: var(--theme-danger-bg); border-color: var(--theme-danger-line); color: var(--red); }
html[data-theme="dark"] .site-announcement { background: var(--sky-soft); color: var(--sky-dark); border-color: var(--line-strong); }
html[data-theme="dark"] .site-announcement.notice-warning { background: var(--theme-warning-bg); color: var(--amber); }
html[data-theme="dark"] .site-announcement.notice-critical { background: var(--theme-danger-bg); color: var(--red); }
html[data-theme="dark"] :is(.notification-item,.updates-retry) { background: var(--bg); color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] .notification-item:hover { background: var(--soft2); }
html[data-theme="dark"] .notification-item.unread { background: var(--sky-soft); }
html[data-theme="dark"] .notification-center.has-unread .notification-button { background: var(--theme-danger-bg); color: var(--red); border-color: var(--theme-danger-line); box-shadow: none; }
html[data-theme="dark"] .notification-count { background: #b83448; color: #fff; }
html[data-theme="dark"] :is(.notification-item span,.updates-row-body,.update-entry-body) { color: var(--muted); }
html[data-theme="dark"] .updates-dot { box-shadow: 0 0 0 2px var(--bg); }
html[data-theme="dark"] .notification-center-tab .updates-dot { box-shadow: none; }
html[data-theme="dark"] .updates-refresh { background: var(--sky-soft); border-color: var(--line-strong); }
html[data-theme="dark"] .updates-refresh:hover { background: var(--soft2); }
html[data-theme="dark"] :is(.updates-row,.update-entry) { --update-accent: var(--sky); --update-tint: var(--sky-soft); --update-label-border: var(--line-strong); }
html[data-theme="dark"] :is(.updates-row,.update-entry)[data-update-severity="warning"] { --update-accent: var(--amber); --update-tint: var(--theme-warning-bg); --update-label-border: var(--theme-warning-line); }
html[data-theme="dark"] :is(.updates-row,.update-entry)[data-update-severity="critical"] { --update-accent: var(--red); --update-tint: var(--theme-danger-bg); --update-label-border: var(--theme-danger-line); }

/* Consent is a necessary shared surface on public pages and in both consoles. */
html[data-theme="dark"] [data-privacy-settings] {
  --privacy-line: var(--line); --privacy-text: var(--ink); --privacy-muted: var(--muted);
  --privacy-accent: var(--sky); --privacy-soft: var(--soft2);
}
html[data-theme="dark"] :is(.privacy-choice-banner,.privacy-preferences-dialog,.privacy-choice-button) { background: var(--bg); color: var(--ink); border-color: var(--line-strong); }
html[data-theme="dark"] .privacy-choice-button:hover { background: var(--sky-soft); border-color: var(--sky); }
html[data-theme="dark"] .privacy-choice-custom { background: var(--soft2); }
html[data-theme="dark"] .privacy-choice-save { background: var(--theme-primary); border-color: var(--theme-primary); color: #fff; }
html[data-theme="dark"] .privacy-choice-save:hover { background: #2c78cc; color: #fff; }
html[data-theme="dark"] :is(.privacy-category,.account-preferences-privacy-manage) { border-color: var(--line); }
html[data-theme="dark"] .privacy-category-badge { background: var(--sky-soft); color: var(--sky-dark); }
html[data-theme="dark"] :is(.privacy-signal-note,.account-preferences-privacy-manage small) { color: var(--muted); }
html[data-theme="dark"] .privacy-choice-status { background: var(--theme-warning-bg); color: var(--amber)!important; }
html[data-theme="dark"] dialog::backdrop { background: #030912a6; }
html[data-theme="dark"] :is(.page-expired-notice-icon,.google-onetap-consent-close) { background: var(--sky-soft); color: var(--sky); }
html[data-theme="dark"] .page-expired-notice { box-shadow: var(--shadow); }

/* Provider notices share semantic warning/info/maintenance tokens everywhere. */
html[data-theme="dark"] :is(.provider-notice-badge,.provider-notice-item,.public-model-provider-notice) {
  --notice-ink: var(--amber); --notice-accent: var(--amber); --notice-line: var(--theme-warning-line);
  --notice-surface: var(--theme-warning-bg); --notice-tag: #49381f;
}
html[data-theme="dark"] :is(.provider-notice,.provider-notice [data-provider-notice-restore]) { background: var(--bg); color: var(--muted); border-color: var(--line); }
html[data-theme="dark"] .provider-notice [data-provider-notice-restore]:hover { background: var(--soft2); color: var(--sky-dark); }
html[data-theme="dark"] .provider-notice [data-provider-notice-dismiss]:hover { background: #ffffff0d; }
html[data-theme="dark"] .provider-notice-item+.provider-notice-item { border-color: var(--line); }
html[data-theme="dark"] [data-provider-notice-level="maintenance"] {
  --notice-ink: var(--theme-violet); --notice-accent: var(--theme-violet); --notice-line: #534168;
  --notice-surface: var(--theme-violet-bg); --notice-tag: #403252;
}
html[data-theme="dark"] [data-provider-notice-level="info"] {
  --notice-ink: var(--sky-dark); --notice-accent: var(--sky); --notice-line: var(--line-strong);
  --notice-surface: var(--sky-soft); --notice-tag: #233f5c;
}
