@layer env.components {
  @property --env-switch-container {
    syntax: '*';
    inherits: false;
  }
  @property --env-switch-content {
    syntax: '*';
    inherits: false;
  }
  @property --env-switch-outline {
    syntax: '*';
    inherits: false;
  }
  @property --env-switch-selected {
    syntax: '*';
    inherits: false;
  }
  @property --env-switch-selected-content {
    syntax: '*';
    inherits: false;
  }
  .env-switch {
    --env-switch-handle: var(--env-switch-content, var(--env-color-fg-control));
    --env-switch-on-handle: var(--env-switch-selected-content, var(--env-color-fg-on-emphasis));
    --env-switch-ring: var(--env-switch-outline, var(--env-color-border-default));
    --env-switch-off-gate: color-mix(
      in srgb,
      var(--env-switch-content) 0%,
      var(--env-color-bg-neutral-muted)
    );
    --env-switch-off-base: var(--env-switch-container, var(--env-switch-off-gate));
    --env-switch-on-gate: color-mix(
      in srgb,
      var(--env-switch-selected-content) 0%,
      var(--env-color-bg-primary-emphasis)
    );
    --env-switch-on-base: var(--env-switch-selected, var(--env-switch-on-gate));
    min-inline-size: 0;
    max-inline-size: 100%;
    overflow-wrap: break-word;
    --env-switch-row: var(--env-control-target-min);
    box-sizing: border-box;
    display: inline-flex;
    align-items: flex-start;
    gap: var(--env-space-3);
    min-block-size: var(--env-switch-row);
    padding-block: max(0%, (var(--env-switch-row) - 1lh) / 2);
    font: var(--env-type-body-sm);
    font-size: var(--env-font-size-body-sm);
    color: var(--env-color-fg-default);
    cursor: pointer;
  }
  .env-switch > span {
    min-inline-size: 0;
  }
  .env-switch:has(input:disabled) {
    cursor: default;
  }
  .env-switch:has(input:disabled) > :where(.env-switch-input, .env-switch-label) {
    opacity: var(--env-state-disabled-opacity);
  }
  @media (pointer: coarse) {
    .env-switch {
      --env-switch-row: var(--env-control-height-touch);
    }
  }
  .env-switch-input {
    --env-switch-thumb: calc(var(--env-control-height-sm) / 2);
    appearance: none;
    box-sizing: border-box;
    flex: 0 0 auto;
    width: calc(2 * var(--env-switch-thumb) + 2 * var(--env-space-1));
    height: calc(var(--env-switch-thumb) + 2 * var(--env-space-1));
    font: inherit;
    margin: calc((1lh - var(--env-switch-thumb) - 2 * var(--env-space-1)) / 2) 0 0;
    padding: var(--env-space-1);
    --env-switch-layer: initial;
    --env-switch-off-layered: color-mix(
      in srgb,
      var(--env-switch-off-base),
      var(--env-switch-handle) var(--env-switch-layer)
    );
    --env-switch-off-fill: var(--env-switch-off-layered, var(--env-switch-off-base));
    --env-switch-on-layered: color-mix(
      in srgb,
      var(--env-switch-on-base),
      var(--env-switch-on-handle) var(--env-switch-layer)
    );
    --env-switch-on-fill: var(--env-switch-on-layered, var(--env-switch-on-base));
    border: 0;
    border-radius: var(--env-radius-full);
    background: var(--env-switch-off-fill, var(--env-color-bg-neutral-muted));
    --env-switch-halo: 0 0 0 0 transparent;
    box-shadow:
      inset 0 0 0 1px var(--env-switch-ring, var(--env-color-border-default)),
      var(--env-switch-halo);
    cursor: inherit;
    transition: background-color var(--env-motion-duration-fast) var(--env-motion-ease-enter);
  }
  .env-switch-input::before {
    content: '';
    display: block;
    width: var(--env-switch-thumb);
    height: var(--env-switch-thumb);
    border-radius: 50%;
    background: var(
      --env-switch-handle,
      var(--env-switch-thumb-off, var(--env-color-border-default-pressed))
    );
    transition:
      transform var(--env-motion-duration-fast) var(--env-motion-ease),
      background-color var(--env-motion-duration-fast) var(--env-motion-ease-enter);
  }
  .env-switch-input:checked {
    background: var(--env-switch-on-fill, var(--env-color-bg-primary-emphasis));
    box-shadow: var(--env-switch-halo);
  }
  .env-switch-input:checked::before {
    transform: translateX(100%);
    background: var(--env-switch-on-handle, var(--env-color-fg-on-emphasis));
  }
  .env-switch-input:checked:dir(rtl)::before {
    transform: translateX(-100%);
  }
  .env-switch-input:hover:not(:disabled) {
    --env-switch-layer: calc(var(--env-state-hover-opacity) * 100%);
    --env-switch-halo: 0 0 0 0.25rem var(--env-color-bg-neutral-subtle-pressed);
    --env-switch-ring: var(--env-switch-outline, var(--env-color-fg-muted));
    --env-switch-thumb-off: var(--env-color-fg-muted);
    background: var(--env-switch-off-fill, var(--env-color-bg-neutral-muted-hover));
  }
  .env-switch-input:active:not(:disabled) {
    --env-switch-layer: calc(var(--env-state-pressed-opacity) * 100%);
    --env-switch-halo:
      0 0 0 0.25rem var(--env-color-bg-neutral-subtle-pressed),
      0 0 0 0.25rem var(--env-color-bg-neutral-subtle-pressed);
    --env-switch-ring: var(--env-switch-outline, var(--env-color-fg-muted-hover));
    --env-switch-thumb-off: var(--env-color-fg-muted);
    background: var(--env-switch-off-fill, var(--env-color-bg-neutral-muted-pressed));
  }
  .env-switch-input:checked:hover:not(:disabled) {
    background: var(--env-switch-on-fill, var(--env-color-bg-primary-emphasis-hover));
  }
  .env-switch-input:checked:active:not(:disabled) {
    background: var(--env-switch-on-fill, var(--env-color-bg-primary-emphasis-pressed));
  }
  .env-switch-input:focus-visible {
    outline: 2px solid var(--env-color-border-focus);
    outline-offset: 2px;
  }
  @media (prefers-reduced-motion: reduce) {
    .env-switch-input,
    .env-switch-input::before {
      transition: none;
    }
  }
  @media (prefers-reduced-motion: no-preference) {
    .env-switch-input {
      transition-property: background-color, color, border-color, box-shadow, transform;
      transition-duration: var(--env-motion-duration-fast);
      transition-timing-function: var(--env-motion-ease-enter);
    }
    .env-switch:active:not(:has(input:disabled)) .env-switch-input {
      transform: scale(0.9);
    }
  }
  @media (forced-colors: active) {
    .env-switch-input {
      outline: 1px solid CanvasText;
      outline-offset: -1px;
    }
    .env-switch-input::before {
      background-color: CanvasText;
    }
    .env-switch-input:checked {
      background-color: Highlight;
      outline-color: Highlight;
    }
    .env-switch-input:checked::before {
      background-color: HighlightText;
    }
    .env-switch-input:disabled {
      outline-color: GrayText;
    }
    .env-switch-input:disabled::before {
      background-color: GrayText;
    }
    .env-switch-input:checked:disabled {
      background-color: GrayText;
      outline-color: GrayText;
    }
    .env-switch-input:checked:disabled::before {
      background-color: Canvas;
    }
  }
  .env-switch-description {
    display: block;
    color: var(--env-color-fg-muted);
    font: var(--env-type-body-sm);
  }
}
