:where(
  [data-slot="select-trigger"],
  [data-slot="switch"],
  [data-slot="toggle-group-item"]
):focus-visible {
  outline: 2px solid var(--pmx-color-focus);
  outline-offset: 2px;
}

.pmx-ui-positioner {
  z-index: 1002;
}

.pmx-ui-dialog-overlay {
  position: fixed;
  z-index: 1000;
  inset: 0;
  min-height: 100dvh;

  transition: opacity var(--pmx-motion-duration) var(--pmx-motion-ease);
}

.pmx-ui-dialog-overlay[data-starting-style],
.pmx-ui-dialog-overlay[data-ending-style] {
  opacity: 0;
}

.pmx-ui-dialog-viewport {
  position: fixed;
  z-index: 1001;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  overflow-y: auto;
}

.pmx-ui-dialog-content {
  outline: none;
  transition:
    opacity var(--pmx-motion-duration) var(--pmx-motion-ease),
    transform var(--pmx-motion-duration) var(--pmx-motion-ease);
}

.pmx-ui-dialog-content[data-starting-style],
.pmx-ui-dialog-content[data-ending-style] {
  opacity: 0;
  transform: translateY(0.4rem) scale(0.98);
}

.pmx-ui-dialog-header {
  display: grid;
  gap: 0.35rem;
  margin-block-end: 1rem;
}

.pmx-ui-dialog-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
}

.pmx-ui-dialog-description {
  margin: 0;
  color: var(--pmx-color-muted);
  font-size: 0.9rem;
}

.pmx-ui-popover-content,
.pmx-ui-select-content,
.pmx-ui-drawer-popup {
  box-sizing: border-box;
  color: var(--pmx-color-fg, CanvasText);
  border: 1px solid var(--pmx-color-border, #d4d4d8);
  background: var(--pmx-color-surface, Canvas);
  box-shadow: var(--pmx-shadow-lg);
}

.pmx-ui-popover-content {
  width: min(22.5rem, calc(100vw - 2rem));
  padding: 1rem;
  border-radius: var(--pmx-radius-xl);
  transform-origin: var(--transform-origin);
  transition:
    opacity var(--pmx-motion-duration) var(--pmx-motion-ease),
    transform var(--pmx-motion-duration) var(--pmx-motion-ease);
}

.pmx-ui-popover-content[data-starting-style],
.pmx-ui-popover-content[data-ending-style] {
  opacity: 0;
  transform: translateY(0.35rem) scale(0.97);
}

.pmx-ui-popover-header {
  margin-block-end: 0.75rem;
}

.pmx-ui-popover-title,
.pmx-ui-drawer-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
}

.pmx-ui-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.pmx-ui-drawer-overlay {
  background: rgb(0 0 0 / 44%);
  position: fixed;
  z-index: 1000;
  inset: 0;
  min-height: 100dvh;

  opacity: calc(1 - var(--drawer-swipe-progress, 0));
  transition: opacity var(--pmx-motion-duration) var(--pmx-motion-ease);
  touch-action: none;
}

.pmx-ui-drawer-overlay[data-starting-style],
.pmx-ui-drawer-overlay[data-ending-style] {
  opacity: 0;
}

.pmx-ui-drawer-viewport {
  position: fixed;
  z-index: 1001;
  inset: 0;
  pointer-events: none;
}

.pmx-ui-drawer-popup {
  --pmx-drawer-translate: calc(
    var(--drawer-swipe-movement-y, 0px) + var(--drawer-snap-point-offset, 0px)
  );
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  display: flex;
  max-height: calc(100dvh - 2rem);
  margin: 0;
  overflow: hidden;
  border-radius: var(--pmx-radius-xl) var(--pmx-radius-xl) 0 0;
  pointer-events: auto;
  outline: none;
  transform: translate3d(0, var(--pmx-drawer-translate), 0);
  transition: transform var(--pmx-motion-duration) var(--pmx-motion-ease);
  touch-action: none;
}

.pmx-ui-drawer-popup[data-starting-style],
.pmx-ui-drawer-popup[data-ending-style] {
  transform: translate3d(0, 100%, 0);
}

.pmx-ui-drawer-popup[data-swiping] {
  transition: none;
}

[data-slot="drawer-swipe-handle"] {
  position: absolute;
  z-index: 1;
  top: 0.75rem;
  left: 50%;
  width: 2.4rem;
  height: 0.28rem;
  border-radius: var(--pmx-radius-full);
  background: var(--pmx-color-border, #d4d4d8);
  transform: translateX(-50%);
}

.pmx-ui-drawer-content {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: contain;
}

.pmx-ui-drawer-header {
  flex: none;
  padding: 1.7rem 1.25rem 0.5rem;
}

.pmx-ui-select-trigger {
  box-sizing: border-box;
  display: inline-flex;
  width: 100%;
  min-height: var(--pmx-control-size);
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-inline: 0.75rem;
  color: inherit;
  border: 1px solid var(--pmx-color-border, #d4d4d8);
  border-radius: var(--pmx-radius-lg);
  background: var(--pmx-color-bg, Canvas);
  font: inherit;
  cursor: pointer;
}

.pmx-ui-select-content {
  min-width: var(--anchor-width);
  max-height: min(20rem, var(--available-height));
  padding: 0.3rem;
  overflow-y: auto;
  border-radius: var(--pmx-radius-xl);
  transform-origin: var(--transform-origin);
}

.pmx-ui-select-item {
  position: relative;
  display: flex;
  min-height: var(--pmx-control-size-sm);
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 2rem 0.45rem 0.65rem;
  border-radius: var(--pmx-radius-md);
  cursor: default;
  outline: none;
}

.pmx-ui-select-item[data-highlighted] {
  color: var(--pmx-color-fg, CanvasText);
  background: var(--pmx-color-hover);
}

[data-slot="select-item-indicator"] {
  position: absolute;
  right: 0.55rem;
}

.pmx-ui-label {
  min-height: var(--pmx-control-size);
  gap: 0.5rem;
  display: flex;
  align-items: center;
  color: inherit;
  font: inherit;
  user-select: none;
}

.pmx-ui-switch {
  position: relative;
  display: inline-flex;
  width: 2.45rem;
  height: 1.4rem;
  flex: none;
  align-items: center;
  padding: 0.12rem;
  border-radius: var(--pmx-radius-full);
  border: 1px solid var(--pmx-color-border, #d4d4d8);
  background: var(--pmx-color-border, #d4d4d8);
  cursor: pointer;
  transition: background-color var(--pmx-motion-duration) var(--pmx-motion-ease);
}

.pmx-ui-switch[data-checked] {
  background: var(--pmx-color-accent, #3897ff);
}

[data-slot="switch-thumb"] {
  display: block;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: var(--pmx-radius-full);
  background: var(--pmx-color-surface, white);
  box-shadow: var(--pmx-shadow-sm);
  transform: translateX(0);
  transition: transform var(--pmx-motion-duration) var(--pmx-motion-ease);
}

.pmx-ui-switch[data-checked] [data-slot="switch-thumb"] {
  transform: translateX(1.05rem);
}

.pmx-ui-toggle-group {
  display: flex;
  width: 100%;
  gap: calc(var(--pmx-ui-group-gap, 0) * 0.25rem);
}

.pmx-ui-toggle-group-item {
  min-height: var(--pmx-control-size-sm);
  flex: 1;
  padding: 0.4rem 0.7rem;
  color: inherit;
  border: 1px solid var(--pmx-color-border, #d4d4d8);
  background: var(--pmx-color-bg, Canvas);
  font: inherit;
  cursor: pointer;
}

.pmx-ui-toggle-group-item:first-child {
  border-radius: var(--pmx-radius-lg) 0 0 var(--pmx-radius-lg);
}

.pmx-ui-toggle-group-item:last-child {
  border-radius: 0 var(--pmx-radius-lg) var(--pmx-radius-lg) 0;
}

.pmx-ui-toggle-group-item:not(:first-child) {
  margin-inline-start: -1px;
}

.pmx-ui-toggle-group-item[data-pressed] {
  position: relative;
  z-index: 1;
  color: var(--pmx-color-accent, #3897ff);
  border-color: currentColor;
  background: color-mix(in oklab, currentColor 8%, transparent);
}

.pmx-ui-separator {
  display: block;
  width: 100%;
  height: 1px;
  flex: none;
  background: var(--pmx-color-border, #d4d4d8);
}

.pmx-ui-tooltip-content {
  max-width: 15rem;
  padding: 0.35rem 0.5rem;
  color: var(--pmx-color-bg, Canvas);
  border-radius: var(--pmx-radius-md);
  background: var(--pmx-color-fg, CanvasText);
  box-shadow: var(--pmx-shadow-md);
  font: 600 0.72rem/1.2 var(--pmx-font-body, system-ui, sans-serif);
}

[data-slot="tooltip-arrow"] {
  width: 0.5rem;
  height: 0.5rem;
  background: var(--pmx-color-fg, CanvasText);
  transform: rotate(45deg);
}

@media (prefers-reduced-motion: reduce) {
  :where([data-slot="button"], [data-slot="action-button"]),
  .pmx-ui-dialog-overlay,
  .pmx-ui-dialog-content,
  .pmx-ui-popover-content,
  .pmx-ui-drawer-overlay,
  .pmx-ui-drawer-popup,
  [data-slot="switch-thumb"] {
    transition: none;
  }
}

.pmx-ui-switch::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: max(100%, 44px);
  height: max(100%, 44px);
  transform: translate(-50%, -50%);
}
@media (pointer: coarse) {
  .pmx-ui-select-item,
  .pmx-ui-toggle-group-item {
    min-height: max(44px, var(--pmx-control-size-sm));
  }
}
