/* Shared HTML controls. Native form behaviour remains authoritative. */
:root { --dd-control-height: 2.75rem; --dd-control-radius: .75rem; --dd-control-focus: #765438; }
:where(button, input, select, textarea) { font-family: var(--dd-font-ui, Inter, system-ui, sans-serif); }
:where(button, a, input, select, textarea, summary):focus-visible { outline: 3px solid var(--dd-control-focus); outline-offset: 3px; }
:where(button, [role=button], summary) { touch-action: manipulation; }
input[type=checkbox][role=switch] {
  appearance: none; -webkit-appearance: none; display: inline-block; position: relative;
  flex: 0 0 2.75rem; width: 2.75rem !important; min-width: 2.75rem; max-width: 2.75rem;
  height: 1.625rem !important; min-height: 1.625rem !important; padding: 0 !important;
  margin: .125rem 0; border: 1px solid #8b8479 !important; border-radius: 999px !important;
  background: #ded9d0 !important; box-shadow: none; vertical-align: middle; cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}
input[type=checkbox][role=switch]::after {
  content: ''; position: absolute; inset: 3px auto auto 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fffdf9; box-shadow: 0 1px 2px #17171430;
  transform: translateX(0); transition: transform 160ms ease;
}
input[type=checkbox][role=switch]:checked { background: #765438 !important; border-color: #765438 !important; }
input[type=checkbox][role=switch]:checked::after { transform: translateX(18px); }
input[type=checkbox][role=switch]:disabled { opacity: .5; cursor: not-allowed; }
label:has(> input[role=switch]) { display: flex; align-items: center; gap: .75rem; min-height: 2.75rem; cursor: pointer; }
label:has(> input[role=switch]) small { display: block; font-weight: 400; line-height: 1.5; }
input[aria-invalid=true], select[aria-invalid=true], textarea[aria-invalid=true] { border-color: #853b36; }
[aria-busy=true] { cursor: progress; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  input[type=checkbox][role=switch] { forced-color-adjust: none; background: Canvas !important; border-color: ButtonText !important; }
  input[type=checkbox][role=switch]::after { background: ButtonText; }
  input[type=checkbox][role=switch]:checked { background: Highlight !important; border-color: Highlight !important; }
  input[type=checkbox][role=switch]:checked::after { background: HighlightText; }
}
