@layer components {
    :where(html[data-ds]) .radio-group {
        min-width: 0;
        margin: 0;
        padding: 0;
        border: 0;
    }

    :where(html[data-ds]) .radio-group legend {
        padding: 0;
    }

    :where(html[data-ds]) .radio-group-items {
        display: flex;
        flex-direction: column;
    }

    :where(html[data-ds]) .switch {
        display: flex;
        align-items: center;
        gap: var(--ds-space-3);
        min-height: var(--ds-layout-tap-target);
        cursor: pointer;
    }

    :where(html[data-ds]) .switch-input {
        appearance: none;
        position: relative;
        flex: none;
        width: calc(var(--ds-space-8) + var(--ds-space-2));
        height: var(--ds-space-6);
        margin: 0;
        border: var(--ds-border-width-1) solid var(--ds-color-border-strong);
        border-radius: var(--ds-radius-pill);
        background-color: var(--ds-color-background);
        cursor: pointer;
        transition: background-color var(--ds-duration-fast) var(--ds-easing-standard), border-color var(--ds-duration-fast) var(--ds-easing-standard);
    }

    :where(html[data-ds]) .switch-input::before {
        content: "";
        position: absolute;
        inset-block-start: calc(var(--ds-space-1) - var(--ds-border-width-1));
        inset-inline-start: calc(var(--ds-space-1) - var(--ds-border-width-1));
        width: var(--ds-space-4);
        height: var(--ds-space-4);
        border-radius: var(--ds-radius-pill);
        background-color: var(--ds-color-text);
        transition: translate var(--ds-duration-fast) var(--ds-easing-out), background-color var(--ds-duration-fast) var(--ds-easing-standard);
    }

    :where(html[data-ds]) .switch-input:checked {
        border-color: var(--ds-color-primary);
        background-color: var(--ds-color-primary);
    }

    :where(html[data-ds]) .switch-input:checked::before {
        background-color: var(--ds-color-on-primary);
        translate: var(--ds-space-4) 0;
    }

    :where(html[data-ds]) .switch-input:dir(rtl):checked::before {
        translate: calc(var(--ds-space-4) * -1) 0;
    }

    :where(html[data-ds]) .switch-input:disabled {
        border-color: var(--ds-color-disabled);
        background-color: var(--ds-color-disabled);
        cursor: not-allowed;
    }

    :where(html[data-ds]) .switch-input:focus-visible {
        outline: var(--ds-focus-width) solid var(--ds-color-focus);
        outline-offset: var(--ds-focus-offset);
    }

    :where(html[data-ds]) .field.is-error .switch-input {
        border-color: var(--ds-color-danger);
        border-width: var(--ds-border-width-2);
    }

    :where(html[data-ds]) .switch-label {
        font-size: var(--ds-text-body-size);
        line-height: var(--ds-text-body-line-height);
    }

    :where(html[data-ds]) .combobox-wrap {
        position: relative;
    }

    :where(html[data-ds]) .listbox {
        position: absolute;
        inset-inline: 0;
        inset-block-start: calc(100% + var(--ds-space-1));
        z-index: var(--ds-z-overlay);
        max-height: calc(var(--ds-space-32) * 2);
        margin: 0;
        padding: var(--ds-space-1);
        overflow-y: auto;
        border: var(--ds-border-width-1) solid var(--ds-color-border);
        border-radius: var(--ds-radius-md);
        background-color: var(--ds-color-background);
        list-style: none;
    }

    :where(html[data-ds]) .listbox-option {
        display: flex;
        align-items: center;
        min-height: var(--ds-layout-tap-target);
        padding: 0 var(--ds-space-3);
        border-radius: var(--ds-radius-sm);
        cursor: pointer;
    }

    :where(html[data-ds]) .listbox-option.is-active {
        background-color: var(--ds-color-surface);
    }

    :where(html[data-ds]) .listbox-option[aria-selected="true"] {
        font-weight: var(--ds-font-weight-medium);
    }

    :where(html[data-ds]) .listbox-option[aria-selected="true"]::after {
        content: "✓" / "";
        margin-inline-start: auto;
    }

    :where(html[data-ds]) .listbox-empty {
        padding: var(--ds-space-3);
        color: var(--ds-color-text-muted);
        font-size: var(--ds-text-body-sm-size);
    }

    @media (hover: hover) {
        :where(html[data-ds]) .switch:hover .switch-input:not(:checked, :disabled) {
            border-color: var(--ds-color-text);
        }

        :where(html[data-ds]) .listbox-option:hover {
            background-color: var(--ds-color-surface);
        }
    }
}
