.ui-select {
  position: relative;
  min-width: 0;
}

.ui-select__trigger {
  display: flex;
  width: 100%;
  min-height: 2.75rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--hausl-radius-control);
  background: transparent;
  color: var(--hausl-text-secondary);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

.ui-select__trigger:hover,
.ui-select.is-open .ui-select__trigger {
  border-color: var(--hausl-border-default);
  background: var(--hausl-surface-subtle);
  color: var(--hausl-text-primary);
}

.ui-select__trigger:focus-visible {
  outline: 2px solid var(--hausl-accent);
  outline-offset: 2px;
}

.ui-select__trigger:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.ui-select__label,
.ui-select__option-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-select__option-label {
  flex: 1 1 auto;
}

.ui-select__option-meta {
  max-width: 42%;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  padding-left: 0.75rem;
  border-left: 1px solid var(--hausl-border-default);
  color: var(--hausl-text-faint);
  font-size: var(--hausl-text-micro);
  font-weight: var(--hausl-weight-medium);
  line-height: var(--hausl-leading-ui);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-select__chevron {
  width: 0.55rem;
  height: 0.55rem;
  flex: none;
  margin-right: 0.2rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  color: var(--hausl-text-faint);
  transform: translateY(-0.15rem) rotate(45deg);
}

.ui-select__native {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  opacity: 0;
  pointer-events: none;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.ui-select__menu {
  position: fixed;
  z-index: var(--hausl-layer-dropdown);
  min-width: 12rem;
  max-width: calc(100vw - 2rem);
  padding: 0;
}

.ui-select__menu[hidden] {
  display: none;
}

.ui-select__menu .ui-menu {
  max-height: min(22rem, calc(100dvh - 2rem));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ui-select__option {
  width: 100%;
  min-height: 2.75rem;
  justify-content: space-between;
  font: inherit;
  cursor: pointer;
}

.ui-select__option.is-active,
.ui-select__option:focus-visible {
  color: var(--hausl-accent-deep);
  background: var(--hausl-accent-soft);
}

.ui-select__option:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.ui-select__check {
  display: grid;
  width: 1rem;
  height: 1rem;
  flex: none;
  place-items: center;
  color: var(--hausl-accent-deep);
  opacity: 0;
}

.ui-select__check::after {
  width: 0.45rem;
  height: 0.7rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  content: "";
  transform: translateY(-0.1rem) rotate(45deg);
}

.ui-select__option.is-selected .ui-select__check {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .ui-select__trigger {
    transition: none;
  }
}
