/* Accessible switches: native input, keyboard focus, generous click target. */
.touch-switch {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  gap: 18px; min-height: 54px; padding: 9px 0; margin: 0;
  cursor: pointer; border-bottom: 1px solid #e6edf2; box-sizing: border-box;
}
.touch-switch + .touch-switch { margin-bottom: 12px; }
.touch-switch__label { font-size: .92rem; font-weight: 550; line-height: 1.4; color: #243f53; }
.touch-switch input {
  position: absolute; width: 1px; height: 1px; margin: 0;
  opacity: 0; clip-path: inset(50%); overflow: hidden;
}
.touch-switch__control { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.touch-switch__track {
  position: relative; display: block; width: 46px; height: 28px; border-radius: 20px;
  background: #94a3b8; box-shadow: inset 0 0 0 1px #00000008;
  transition: background .18s ease;
}
.touch-switch__track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #0f172a30;
  transition: transform .18s ease;
}
.touch-switch input:checked ~ .touch-switch__control .touch-switch__track { background: #147d92; }
.touch-switch input:checked ~ .touch-switch__control .touch-switch__track::after { transform: translateX(18px); }
.touch-switch input:focus-visible ~ .touch-switch__control .touch-switch__track { outline: 3px solid #f59e0b; outline-offset: 3px; }
.touch-switch:has(input:disabled) { cursor: not-allowed; }
.touch-switch input:disabled ~ .touch-switch__control { opacity: .65; }
@media (prefers-reduced-motion: reduce) {
  .touch-switch__track, .touch-switch__track::after { transition: none; }
}

/* Same control for existing and dynamically inserted application preferences. */
input.ui-switch[type="checkbox"] {
  -webkit-appearance: none; appearance: none; display: inline-block;
  width: 46px !important; height: 28px !important; min-width: 46px;
  padding: 0 !important; border: 0 !important; border-radius: 20px !important;
  background-color: #94a3b8; background-image: radial-gradient(circle, #fff 10px, transparent 11px);
  background-repeat: no-repeat; background-size: 22px 22px; background-position: 3px center;
  box-shadow: inset 0 0 0 1px #00000008; vertical-align: middle; flex-shrink: 0;
  cursor: pointer; transition: background-color .18s ease, background-position .18s ease;
}
input.ui-switch[type="checkbox"]:checked { background-color: #147d92; background-position: 21px center; }
input.ui-switch[type="checkbox"]:focus-visible { outline: 3px solid #f59e0b; outline-offset: 3px; }
input.ui-switch[type="checkbox"]:disabled { opacity: .55; cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) { input.ui-switch[type="checkbox"] { transition: none; } }
