:root {
  color-scheme: dark;
  --night: #171717;
  --ink: #f0f0f0;
  --muted: #b2b2b2;
  --action: #d9d9d9;
  --action-ink: #202020;
  --ui-overlay: 255 255 255;
  --ui-focus: #d6d6d6;
  --ui-action-hover: #e7e7e7;
  --ui-action-pressed: #cfcfcf;
  --theme-control-bg: #ffffff0b;
}

:root[data-theme="light"] {
  color-scheme: light;
  --night: #f1f3f7;
  --ink: #252837;
  --muted: #555e70;
  --action: #2b3042;
  --action-ink: #fff;
  --ui-overlay: 34 40 59;
  --ui-focus: #5c5291;
  --ui-action-hover: #3a4159;
  --ui-action-pressed: #25293a;
  --theme-control-bg: #ffffffc9;
}

:root[data-theme="light"] .workspace-page { --workspace-glow: 132 145 181; }

.theme-toggle {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid rgb(var(--ui-overlay) / .15);
  border-radius: 10px;
  background: var(--theme-control-bg);
  color: var(--ink);
  font-size: 12px;
  font-weight: 720;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.theme-toggle[hidden], .theme-to-dark,
:root[data-theme="light"] .theme-to-light { display: none; }
:root[data-theme="light"] .theme-to-dark { display: inline; }
.theme-toggle svg { flex: none; }
.theme-toggle:hover { border-color: rgb(var(--ui-overlay) / .36); }
.theme-toggle:focus-visible { outline: 2px solid var(--ui-focus); outline-offset: 3px; }

@media (max-width: 400px) {
  .theme-toggle { min-width: 40px; min-height: 40px; }
  .access-header .theme-toggle-labels { display: none; }
}
