.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  cursor: pointer;
  font-size: var(--fs-sm);
  color: var(--text);
}

.switch__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.switch__track {
  display: inline-flex;
  align-items: center;
  width: 36px;
  height: 20px;
  padding: 2px;
  flex-shrink: 0;
  border-radius: var(--r-full);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.switch__thumb {
  width: 14px;
  height: 14px;
  border-radius: var(--r-full);
  background: var(--text-muted);
  transition: transform var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.switch__input:checked + .switch__track {
  background: var(--brand);
  border-color: var(--brand);
}

.switch__input:checked + .switch__track .switch__thumb {
  transform: translateX(16px);
  background: #ffffff;
}

.switch__input:focus-visible + .switch__track {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.switch__input:disabled + .switch__track {
  opacity: 0.5;
}

.switch:has(.switch__input:disabled) {
  cursor: not-allowed;
}

@media (pointer: coarse) {
  .switch,
  .checkbox {
    min-height: var(--tap);
  }
}
