html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #273348;
  --surface3: #334155;
  --s2: #273348;
  --border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #3b82f6;
  --accent-h: #2563eb;
  --page: #0f172a;
  --card: #1e293b;
  --ink: #e2e8f0;
  --line: #334155;
  --navy: #0f172a;
  --navy-soft: #1e293b;
  --r4u-bg: #0f172a;
  --r4u-surface: #1e293b;
  --r4u-surface-2: #273348;
  --r4u-surface-3: #334155;
  --r4u-border: #334155;
  --r4u-text: #e2e8f0;
  --r4u-muted: #94a3b8;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface2: #e8eef6;
  --surface3: #dbe4ef;
  --s2: #e8eef6;
  --border: #cbd5e1;
  --text: #172033;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-h: #1d4ed8;
  --page: #f1f5f9;
  --card: #ffffff;
  --ink: #172033;
  --line: #d8e0ea;
  --navy: #ffffff;
  --navy-soft: #e8eef6;
  --r4u-bg: #f1f5f9;
  --r4u-surface: #ffffff;
  --r4u-surface-2: #e8eef6;
  --r4u-surface-3: #dbe4ef;
  --r4u-border: #cbd5e1;
  --r4u-text: #172033;
  --r4u-muted: #64748b;
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-glass: rgba(255, 255, 255, 0.92);
  --text-primary: #172033;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-color: #d8e0ea;
}

html[data-theme="light"] body,
html[data-theme="light"] .app {
  background: var(--bg) !important;
  color: var(--text) !important;
}

html[data-theme="light"] .topbar,
html[data-theme="light"] .env-bar {
  background: #ffffff !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

html[data-theme="light"] .topbar a,
html[data-theme="light"] .env-bar a,
html[data-theme="light"] .brand,
html[data-theme="light"] .logout {
  color: var(--text) !important;
}

html[data-theme="light"] .nav a.active,
html[data-theme="light"] .env-pill.active {
  background: #e8eef6 !important;
  color: var(--accent) !important;
}

.r4u-theme-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1000;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--border, #334155);
  border-radius: 50%;
  background: var(--surface, #1e293b);
  color: var(--text, #e2e8f0);
  box-shadow: 0 10px 28px rgba(2, 6, 23, 0.28);
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
}

.r4u-theme-toggle:hover {
  border-color: var(--accent, #3b82f6);
  transform: translateY(-1px);
}
