button.theme-switch {
  -webkit-appearance: none;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  box-shadow: none;
  cursor: pointer;
  color: inherit;
  font: inherit;
  line-height: 1;
}

button.theme-switch:focus {
  outline: none;
}

button.theme-switch:focus-visible .theme-switch__shell {
  outline: 2px solid var(--theme-switch-focus, #46c96f);
  outline-offset: 2px;
}

.theme-switch__shell {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--theme-switch-border, #3d4048);
  border-radius: 999px;
  background: var(--theme-switch-bg, #2b2d31);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.theme-switch__icon {
  font-size: 1rem;
  line-height: 1;
  opacity: 0.4;
  transition: opacity 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

[data-theme="light"] .theme-switch__icon--sun,
[data-bs-theme="light"] .theme-switch__icon--sun {
  opacity: 1;
  color: var(--theme-switch-active, #2d8a4d);
  transform: scale(1.05);
}

[data-theme="dark"] .theme-switch__icon--moon,
[data-bs-theme="dark"] .theme-switch__icon--moon {
  opacity: 1;
  color: var(--theme-switch-active, #46c96f);
  transform: scale(1.05);
}

.theme-switch__track {
  position: relative;
  width: 3.1rem;
  height: 1.55rem;
  background: var(--theme-switch-track, #3d4048);
  border-radius: 999px;
  flex-shrink: 0;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.22);
}

.theme-switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1.2rem;
  height: 1.2rem;
  background: var(--theme-switch-thumb, #f2f3f5);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
  transition: transform 0.2s ease;
}

[data-theme="dark"] .theme-switch__thumb,
[data-bs-theme="dark"] .theme-switch__thumb {
  transform: translateX(1.45rem);
}

@media (prefers-reduced-motion: reduce) {
  .theme-switch__thumb,
  .theme-switch__icon {
    transition: none;
  }
}

[data-theme="light"],
[data-bs-theme="light"] {
  --theme-switch-border: #d8dde5;
  --theme-switch-bg: #ffffff;
  --theme-switch-track: #e4e8ee;
  --theme-switch-thumb: #ffffff;
  --theme-switch-active: #2d8a4d;
  --theme-switch-focus: #248042;
}

[data-theme="dark"],
[data-bs-theme="dark"] {
  --theme-switch-border: #3d4048;
  --theme-switch-bg: #2b2d31;
  --theme-switch-track: #1e1f22;
  --theme-switch-thumb: #f2f3f5;
  --theme-switch-active: #46c96f;
  --theme-switch-focus: #46c96f;
}
