:host {
  min-inline-size: min(220px, 100%);
  max-inline-size: 100%;
}
.field {
  inline-size: 100%;
  gap: 0;
}
[part=label] {
  margin-block-end: 6px;
  color: var(--bythium-text-secondary);
  font-weight: 500;
}
.hint {
  display: contents;
  font-size: 12px;
  color: var(--bythium-text-muted);
}
::slotted([slot=help]) {
  display: block;
  margin-block-start: 4px;
}
.error {
  margin-block-start: 4px;
  font-size: 12px;
}
.error:empty {
  display: none;
}
label.row {
  inline-size: fit-content;
  gap: 8px;
  color: var(--bythium-text-secondary);
  cursor: pointer;
}
input[role=switch] {
  appearance: none;
  position: relative;
  flex: none;
  inline-size: 28px;
  block-size: 16px;
  margin: 0;
  border: 1px solid var(--bythium-border-strong);
  border-radius: 999px;
  background: var(--bythium-surface-raised);
  cursor: pointer;
}
input[role=switch]::before {
  content: "";
  position: absolute;
  inset-block-start: 2px;
  inset-inline-start: 2px;
  inline-size: 10px;
  block-size: 10px;
  border-radius: 50%;
  background: var(--bythium-text-secondary);
}
input[role=switch]:hover:not(:disabled):not(:checked) {
  border-color: var(--bythium-text-muted);
}
input[role=switch]:checked {
  background: var(--bythium-brand-primary);
  border-color: color-mix(in oklch,var(--bythium-brand-primary) 60%,var(--bythium-text-primary));
}
input[role=switch]:checked::before {
  transform: translateX(12px);
  background: var(--bythium-on-brand-primary);
}
input[role=switch]:checked:disabled {
  background: var(--bythium-text-muted);
  border-color: var(--bythium-text-muted);
}
input[role=switch]:checked:disabled::before {
  background: var(--bythium-surface-base);
}
input[role=switch]:disabled,:host([disabled]) label.row {
  cursor: not-allowed;
}
input[role=switch]:focus-visible {
  outline-offset: 2px;
}
@media (pointer:coarse) {
  label.row {
    min-block-size: 44px;
  }
  input[role=switch] {
    inline-size: 36px;
    block-size: 20px;
  }
  input[role=switch]::before {
    inline-size: 14px;
    block-size: 14px;
  }
  input[role=switch]:checked::before {
    transform: translateX(16px);
  }
}
@media (forced-colors:active) {
  input[role=switch] {
    border-color: ButtonText;
  }
  input[role=switch]::before {
    background: ButtonText;
  }
  input[role=switch]:checked {
    background: Highlight;
    border-color: Highlight;
  }
  input[role=switch]:checked::before {
    background: HighlightText;
  }
}
:host([disabled]) {
  opacity: 1;
}
:host([disabled]) [part=label] {
  color: var(--bythium-text-muted);
}
:host([disabled]) label.row {
  color: var(--bythium-text-muted);
}
input[role=switch]:disabled:not(:checked) {
  border-color: var(--bythium-border-subtle);
}
input[role=switch]:disabled:not(:checked)::before {
  background: var(--bythium-text-muted);
}
@media (prefers-reduced-motion: no-preference) {
  input[role=switch]:hover {
    transition: background-color var(--duration-fast) var(--ease-standard),border-color var(--duration-fast) var(--ease-standard);
  }
  input[role=switch]::before {
    transition: transform var(--duration-fast) var(--ease-standard);
  }
  input[role=switch]:hover::before {
    transition: transform var(--duration-fast) var(--ease-standard),background-color var(--duration-fast) var(--ease-standard);
  }
}
/* Sens de lecture de droite à gauche : la pastille part de la droite et glisse vers la gauche. */
:host(:dir(rtl)) input[role=switch]:checked::before {
  transform: translateX(-12px);
}
@media (pointer: coarse) {
  :host(:dir(rtl)) input[role=switch]:checked::before {
    transform: translateX(-16px);
  }
}
