.commune-autocomplete {
  max-width: 100%;
  min-width: 0;
  position: relative;
}

.profile-dropdown {
  display: block;
  position: relative;
}

.profile-dropdown::after {
  border-right: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  content: "";
  height: 0.5rem;
  pointer-events: none;
  position: absolute;
  right: 0.9rem;
  top: 1rem;
  transform: rotate(45deg);
  width: 0.5rem;
  z-index: 2;
}

.profile-dropdown.is-open::after {
  top: 1.3rem;
  transform: rotate(225deg);
}

.profile-dropdown select,
.profile-dropdown input[data-commune-input] {
  appearance: none;
  min-height: 44px;
  padding-right: 2.75rem;
}

.profile-dropdown select:focus,
.profile-dropdown input[data-commune-input]:focus {
  border-color: var(--color-action);
  box-shadow: 0 0 0 3px var(--color-action-selected);
  outline: none;
}

.profile-custom-select__button {
  width: 100%;
  min-height: 44px;
  padding: 9px 2.75rem 9px 11px;
  border: 1px solid var(--palette-neutral-300);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--palette-neutral-800);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.profile-custom-select__button:focus-visible {
  border-color: var(--color-action);
  box-shadow: 0 0 0 3px var(--color-action-selected);
  outline: none;
}

.profile-custom-select.is-enhanced select {
  display: none;
}

.profile-custom-select__options {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  box-shadow: 0 0.5rem 1.5rem var(--color-scrim-16);
  display: none;
  left: 0;
  overflow: hidden;
  position: absolute;
  right: 0;
  top: calc(100% + 0.25rem);
  z-index: 31;
}

.profile-custom-select.is-open .profile-custom-select__options {
  display: grid;
}

.profile-custom-select__options button {
  background: var(--color-surface);
  border: 0;
  color: var(--color-text);
  cursor: pointer;
  font: inherit;
  min-height: 44px;
  padding: 0.65rem 2.5rem 0.65rem 0.8rem;
  position: relative;
  text-align: left;
}

.profile-custom-select__options button + button {
  border-top: 1px solid var(--color-border);
}

.profile-custom-select__options button:hover,
.profile-custom-select__options button:focus-visible,
.profile-custom-select__options button.is-selected {
  background: var(--color-action-selected);
  outline: none;
}

.profile-custom-select__options button.is-selected::after {
  color: var(--color-action-hover);
  content: "✓";
  font-weight: 700;
  position: absolute;
  right: 0.9rem;
}

.commune-autocomplete__results {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  box-shadow: 0 0.5rem 1.5rem var(--color-scrim-16);
  display: none;
  left: 0;
  max-height: 18rem;
  overflow-y: auto;
  position: absolute;
  right: 0;
  top: calc(100% + 0.25rem);
  z-index: 30;
  box-sizing: border-box;
  overscroll-behavior-x: none;
}

.commune-autocomplete.is-open .commune-autocomplete__results {
  display: grid;
}

.commune-autocomplete__results button {
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  padding: 0.65rem 0.8rem;
  text-align: left;
  overflow-wrap: anywhere;
  width: 100%;
}

.commune-autocomplete__results button + button {
  border-top: 1px solid var(--color-border);
}

.commune-autocomplete__results button:hover,
.commune-autocomplete__results button:focus-visible {
  background: var(--color-action-selected);
  outline: none;
}

.commune-autocomplete__hint {
  display: block;
  font-size: 0.82rem;
  margin-top: 0.3rem;
  color: var(--color-text-muted);
}

@media screen and (max-width: 600px) {
  .profile-editor__panel {
    overflow-x: hidden;
    overscroll-behavior-x: none;
  }

  .commune-autocomplete.is-open,
  .commune-autocomplete.is-open .commune-autocomplete__results {
    touch-action: pan-y;
  }

  .profile-editor__panel .commune-autocomplete__results {
    margin-top: 0.25rem;
    max-height: min(18rem, 40dvh);
    position: static;
  }

  .profile-editor__panel .profile-custom-select__options {
    margin-top: 0.25rem;
    position: static;
  }
}
