select {
  font: 400 13px/1.4 var(--font);
  color: var(--text);
  background-color: var(--surface);
  border: 1px solid color-mix(in srgb, var(--input-border) 53%, var(--border));
  border-radius: var(--radius);
  min-width: 0;
  max-width: 100%;
  padding: 8px 10px;
}
select:not([multiple]):is(:not([size]), [size="1"]) {
  appearance: none;
  min-height: 38px;
  padding-inline: 11px 34px;
  background-image: url("icons/select-chevron.svg");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 15px;
  cursor: pointer;
}
select:not(:disabled):hover {
  border-color: var(--input-border);
  background-color: var(--sunken);
}
select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
select:disabled {
  opacity: .65;
  cursor: default;
  background-color: var(--sunken);
}
select option { color: var(--text); background: var(--surface); }

.conversation-filters select:not([multiple]),
.conversation-list-heading > select:not([multiple]) {
  min-height: 34px;
  padding-inline: 8px 26px;
  background-position: right 6px center;
  font-size: 11px;
}

/* Native select remains the source of keyboard, form and mobile behavior. */
@supports (appearance: base-select) and selector(::picker(select)) {
  select:not([multiple]):is(:not([size]), [size="1"]),
  select:not([multiple]):is(:not([size]), [size="1"])::picker(select) {
    appearance: base-select;
  }
  select:not([multiple]):is(:not([size]), [size="1"]) {
    align-items: center;
    gap: 8px;
    padding-inline-end: 10px;
    background-image: none;
    text-overflow: ellipsis;
  }
  select::picker-icon {
    flex: 0 0 15px;
    height: 15px;
    margin-inline-start: auto;
    content: url("icons/select-chevron.svg");
  }
  select:open { border-color: var(--primary); }
  select:open::picker-icon { transform: rotate(180deg); }
  select::picker(select) {
    margin-block: 5px;
    padding: 4px;
    max-width: min(430px, calc(100vw - 24px));
    max-height: min(320px, 50dvh);
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
  }
  select option {
    gap: 8px;
    min-height: 34px;
    padding: 7px 9px;
    border-radius: 6px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  select option:checked { background: var(--selected); color: var(--primary-text); }
  select option:not(:disabled):is(:hover, :focus-visible) { background: var(--hover); }
  select option:disabled { color: var(--muted); opacity: .6; }
  select option::checkmark { order: 1; margin-inline-start: auto; }
  .conversation-filters select:not([multiple]),
  .conversation-list-heading > select:not([multiple]) { padding-inline-end: 6px; }
}

@media (max-width: 700px) {
  :is(.op-field, .suite-field) select { font-size: 16px; }
}
@media (forced-colors: active) {
  select:not([multiple]):is(:not([size]), [size="1"]) {
    appearance: auto;
    background-image: none;
  }
}
