/* GMS Preview canonical theme tokens v2.0.0 */
:root,
html[data-gms-theme="light"],
html[data-bs-theme="light"] {
  color-scheme: light;
  --gms-canvas: #F3F6F8;
  --gms-surface: #FFFFFF;
  --gms-raised: #EAF0F4;
  --gms-divider: #D7E0E8;
  --gms-border: #BECBD6;
  --gms-text: #142130;
  --gms-muted: #526375;
  --gms-primary: #19BCBF;
  --gms-primary-hover: #13999C;
  --gms-link: #007477;
  --gms-focus: #007477;
  --gms-success-bg: #DCF7EA;
  --gms-success-fg: #087A4B;
  --gms-warning-bg: #FFF1D2;
  --gms-warning-fg: #8B5700;
  --gms-danger-bg: #FFE0E5;
  --gms-danger-fg: #A51D36;
  --gms-info-bg: #E2EBFF;
  --gms-info-fg: #3158B7;
  --gms-shadow: 0 8px 24px rgba(20,33,48,.07);

  /* Compatibility aliases for existing modules while they migrate. */
  --bg: var(--gms-canvas);
  --surface: var(--gms-surface);
  --surface2: var(--gms-raised);
  --border: var(--gms-divider);
  --text: var(--gms-text);
  --muted: var(--gms-muted);
  --brand: var(--gms-primary);
  --brand-dark: var(--gms-primary-hover);
  --shadow: var(--gms-shadow);
}

html[data-gms-theme="dark"],
html[data-bs-theme="dark"] {
  color-scheme: dark;
  --gms-canvas: #0B1017;
  --gms-surface: #121A24;
  --gms-raised: #192432;
  --gms-divider: #2A394B;
  --gms-border: #3A4D62;
  --gms-text: #F2F6FA;
  --gms-muted: #A9B7C8;
  --gms-primary: #19BCBF;
  --gms-primary-hover: #36CCCE;
  --gms-link: #53D8DA;
  --gms-focus: #5EE2E4;
  --gms-success-bg: #12382A;
  --gms-success-fg: #75E0AC;
  --gms-warning-bg: #3A2B10;
  --gms-warning-fg: #F3C66F;
  --gms-danger-bg: #3F1D25;
  --gms-danger-fg: #F08EA0;
  --gms-info-bg: #1D2E54;
  --gms-info-fg: #9DB9FF;
  --gms-shadow: 0 10px 26px rgba(0,0,0,.22);
}

html, body { background: var(--gms-canvas); color: var(--gms-text); }

[data-gms-theme-toggle],
[data-gms-theme-set] { transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease; }
[data-gms-theme-set][aria-pressed="true"] { background: var(--gms-raised); color: var(--gms-link); }

/* Dashboard legacy surfaces that previously needed per-release dark-mode patches. */
html[data-gms-theme="dark"] .gms-theme-connected-services,
html[data-gms-theme="dark"] .gms-theme-service-tile,
html[data-gms-theme="dark"] .gms-theme-light-surface,
html[data-gms-theme="dark"] [data-gms-theme-service-tile] {
  background: var(--gms-surface) !important;
  color: var(--gms-text) !important;
  border-color: var(--gms-divider) !important;
}
html[data-gms-theme="dark"] .gms-theme-service-tile,
html[data-gms-theme="dark"] .gms-theme-light-surface,
html[data-gms-theme="dark"] [data-gms-theme-service-tile] {
  background: var(--gms-raised) !important;
}

:focus-visible { outline-color: var(--gms-focus); }

@media (prefers-reduced-motion: reduce) {
  [data-gms-theme-toggle], [data-gms-theme-set] { transition: none; }
}
