/* Opt-in preferences only. Native checkbox state keeps keyboard, label and form behavior. */
body input.avuna-switch[type="checkbox"][role="switch"] {
  -webkit-appearance: none;
  appearance: none;
  position: relative !important;
  display: inline-block !important;
  flex: 0 0 54px !important;
  width: 54px !important;
  min-width: 54px !important;
  max-width: 54px;
  height: 44px !important;
  min-height: 44px !important;
  margin: 0;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
  vertical-align: middle;
  cursor: pointer;
  touch-action: manipulation;
}
body input.avuna-switch[type="checkbox"][role="switch"]::before {
  content: "" !important;
  position: absolute !important;
  display: block !important;
  box-sizing: border-box !important;
  left: 0 !important;
  top: 8px !important;
  width: 54px !important;
  height: 28px !important;
  margin: 0 !important;
  border: 1.5px solid var(--muted, #9995ac) !important;
  border-radius: 999px !important;
  background: var(--panel, #201c2b) !important;
  opacity: 1 !important;
  transform: none !important;
  transition: background .18s ease, border-color .18s ease !important;
}
/* The separately loaded interface-polish.css also styles checkbox pseudo-elements.
   Keep this opt-in rail/thumb geometry authoritative in every preference screen. */
body input.avuna-switch[type="checkbox"][role="switch"]::after {
  content: "" !important;
  position: absolute !important;
  display: block !important;
  box-sizing: border-box !important;
  left: 3px !important;
  top: 11px !important;
  width: 22px !important;
  height: 22px !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  opacity: 1 !important;
  background: var(--text, #e9e9e9) !important;
  transform: translateX(0) !important;
  transition: transform .18s ease, background .18s ease !important;
}
body input.avuna-switch[type="checkbox"][role="switch"]:checked::before {
  background: var(--accent, #a37dff) !important;
  border-color: var(--accent, #a37dff) !important;
}
body input.avuna-switch[type="checkbox"][role="switch"]:checked::after {
  background: var(--ink, #1f1636) !important;
  opacity: 1 !important;
  transform: translateX(26px) !important;
}
body input.avuna-switch[type="checkbox"][role="switch"]:focus-visible {
  outline: 2px solid var(--accent, #a37dff);
  outline-offset: 3px;
}
body input.avuna-switch[type="checkbox"][role="switch"]:disabled {
  opacity: .45;
  cursor: not-allowed;
}
body label:has(> input.avuna-switch) {
  min-height: 44px;
  cursor: pointer;
}
body label.toggle-label:has(> input.avuna-switch),
body .settings-page label.toggle-label:has(> input.avuna-switch) {
  align-items: center;
}
@media (prefers-reduced-motion: reduce) {
  body input.avuna-switch[type="checkbox"][role="switch"]::before,
  body input.avuna-switch[type="checkbox"][role="switch"]::after {
    transition: none !important;
  }
}
@media (forced-colors: active) {
  body input.avuna-switch[type="checkbox"][role="switch"]::before {
    background: Canvas !important;
    border-color: CanvasText !important;
  }
  body input.avuna-switch[type="checkbox"][role="switch"]::after {
    background: CanvasText !important;
  }
  body input.avuna-switch[type="checkbox"][role="switch"]:checked::before {
    background: Highlight !important;
    border-color: Highlight !important;
  }
  body input.avuna-switch[type="checkbox"][role="switch"]:checked::after {
    background: HighlightText !important;
  }
}
