:root { color-scheme: light; }

.theme-toggle {
  position: fixed;
  top: 27px;
  right: 18px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--rule, rgba(28, 38, 28, .12));
  border-radius: 999px;
  background: var(--surface, #ffffff);
  color: var(--ink-faint, #7c8a7c);
  box-shadow: none;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.theme-toggle:hover {
  background: var(--surface-soft, #f6f8f4);
  color: var(--ink, #142015);
}

.theme-toggle span {
  font-size: 17px;
  line-height: 1;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #10120f;
  --surface: #1a1f19;
  --surface-soft: #121711;
  --ink: #eef7ec;
  --ink-soft: #c1d2c5;
  --ink-faint: #849784;
  --rule: rgba(238,247,236,.16);
  --rule-soft: rgba(238,247,236,.1);
  --gold: #d9c073;
  --gold-soft: rgba(217,192,115,.14);
  --green: #86c99a;
  --green-soft: rgba(134,201,154,.16);
  --terracotta: #dc8968;
  --shadow: rgba(0,0,0,.34);
}

html[data-theme="dark"],
html[data-theme="dark"] body {
  background: var(--canvas);
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .module,
  .practice-card,
  .portal-card,
  .settings-panel,
  .drawer,
  .modal,
  .session-card,
  .checkin-card,
  .day-tooltip,
  .schedule-card,
  .audio-card,
  .cohort-card
) {
  background-color: var(--surface);
  border-color: var(--rule);
  color: var(--ink);
  box-shadow: 0 18px 48px rgba(0,0,0,.28);
}

html[data-theme="dark"] :is(input, textarea, select) {
  background-color: var(--surface-soft);
  border-color: var(--rule);
  color: var(--ink);
}

html[data-theme="dark"] :is(input, textarea, select)::placeholder {
  color: var(--ink-faint);
}

html[data-theme="dark"] :is(.settings:hover, .pill, .session-pill, .filter-btn, .tab-btn) {
  background-color: var(--surface-soft);
  border-color: var(--rule);
  color: var(--ink-soft);
}

html[data-theme="dark"] :is(.settings:hover, .filter-btn:hover, .tab-btn:hover) {
  background-color: #222a21;
  color: var(--ink);
}

html[data-theme="dark"] :is(h1, h2, h3, .module-title, .practice-title) {
  color: var(--ink);
}

html[data-theme="dark"] :is(.hero-meta, .module-copy, .practice-copy, .muted, .empty, .session-meta) {
  color: var(--ink-soft);
}

html[data-theme="dark"] :is(.pill, .kicker) {
  color: var(--gold);
}

html[data-theme="dark"] :is(.primary-btn, .session-pill.join, .checkin-done) {
  background: var(--green);
  color: #071009;
}

html[data-theme="dark"] .theme-toggle {
  background: var(--surface);
  border-color: var(--rule);
  color: var(--ink-soft);
  box-shadow: none;
}

html[data-theme="dark"] .theme-toggle:hover {
  background: #222a21;
  color: var(--ink);
}
