@layer modules {
  .select {
    position: relative;
  }

  .select__label {
    margin-block-end: 0.25rem;
  }

  .select__control {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    min-height: 2.5rem;
    padding: 0.375rem 0.5rem;
    background-color: var(--color-white);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
  }

  .select__control:focus-within {
    --focus-ring-color: var(--color-indigo-500);
    border-color: var(--color-indigo-500);
  }

  .select__selections {
    display: contents;
  }

  .select__selection {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    max-width: 100%;
    min-width: 0;
    padding-block: 0.125rem;
    padding-inline: 0.5rem 0.25rem;
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
    color: var(--color-gray-700);
    background-color: var(--color-gray-100);
    border-radius: var(--radius-md);
  }

  .select__selection-label {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .select__selection--locked {
    padding-inline: 0.5rem;
    color: var(--color-gray-900);
    background-color: var(--color-gray-200);
  }

  .select__selection-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.125rem;
    height: 1.125rem;
    font-size: 1rem;
    line-height: 1;
    color: var(--color-gray-500);
    border-radius: var(--radius-full);
    touch-action: manipulation;
  }

  .select__selection-remove:hover {
    color: var(--color-gray-700);
    background-color: var(--color-gray-200);
  }

  .select__input {
    flex: 1 1 8ch;
    min-width: 8ch;
    padding: 0.25rem;
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
    background-color: transparent;
    border: none;
  }

  .select__input:focus {
    outline: none;
    box-shadow: none;
  }

  .select__control:has(.select__selection:not([data-locked])) .select__input::placeholder {
    color: transparent;
  }

  .select__listbox {
    position: absolute;
    z-index: 10;
    inset-inline: 0;
    margin-top: 0.25rem;
    max-height: 14rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.25rem;
    background-color: var(--color-white);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
  }

  .select__hint {
    display: none;
  }

  .select:has(.select__selection + .select__selection) .select__hint {
    display: block;
  }

  .select[data-select-multiple-value="false"]:has(.select__selection) .select__input {
    display: none;
  }

  .select[data-select-multiple-value="false"]:has(.select__selection) .select__control {
    padding-block: 0;
  }

  .select[data-select-multiple-value="false"] .select__selection {
    flex: 1 1 auto;
    padding-block: 0;
    padding-inline: 0.25rem;
    background-color: transparent;
    border-radius: 0;
  }

  .select[data-select-multiple-value="false"] .select__selection-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .select[data-select-multiple-value="false"] .select__selection-remove {
    flex: none;
    width: 2.5rem;
    height: 2.5rem;
    margin-inline-start: auto;
  }
}
