/* Keep the resting border and background when fields receive focus. */
:is(input, textarea, select):focus {
  outline: none;
}

/* Keep the native controls for keyboard, touch and form behavior. */
select:not([multiple]):not([size]) {
  appearance: none;
  padding-inline-end: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%23a1a1a1' d='M0 1h12L6 7z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 11px 8px;
  cursor: pointer;
}

select:not([multiple]):not([size]):disabled {
  opacity: .65;
  cursor: default;
}

@supports (appearance: base-select) and selector(select::picker(select)) {
  select:not([multiple]):not([size]),
  select:not([multiple]):not([size])::picker(select) {
    appearance: base-select;
  }

  select:not([multiple]):not([size]) {
    align-items: center;
    gap: 8px;
    padding-inline-end: 10px;
    background-image: none;
  }

  select:not([multiple]):not([size])::picker-icon {
    content: "";
    align-self: center;
    border: 5px solid transparent;
    border-bottom: 0;
    border-top: 6px solid #a1a1a1;
  }

  select:not([multiple]):not([size]):open::picker-icon {
    transform: rotate(180deg);
  }

  select:not([multiple]):not([size])::picker(select) {
    margin-block: 4px;
    padding: 4px 0;
    border: 1px solid #ebebeb;
    border-radius: 3px;
    background: #fff;
    color: #263445;
    box-shadow: 0 2px 8px #0002;
    font: inherit;
  }

  select:not([multiple]):not([size]) option {
    min-height: 33px;
    padding: 6px 10px;
    white-space: normal;
    overflow-wrap: anywhere;
    cursor: pointer;
  }

  select:not([multiple]):not([size]) option::checkmark {
    display: none;
  }

  select:not([multiple]):not([size]) option:not(:checked, :disabled):is(:hover, :focus-visible) {
    background: #f6f6f6;
  }

  select:not([multiple]):not([size]) option:checked {
    color: #fff;
    background: #5fb878;
    font-weight: 600;
  }

  select:not([multiple]):not([size]) option:disabled {
    cursor: default;
  }
}

@media (forced-colors: active) {
  select:not([multiple]):not([size]) {
    appearance: auto;
    padding-inline-end: 6px;
    background-image: none;
  }
}
