/* Shared native selects: filters, forms and dynamically created dialogs. */
:root {
  --select-text: #173b34;
  --select-accent: #087d5b;
  --select-border: #cfdfd9;
  --select-selected: #e8f6ef;
}
body select {
  font: inherit;
  color: var(--select-text);
  accent-color: var(--select-accent);
}
body select:not([multiple]):not([size]),
body select[size="1"]:not([multiple]) {
  appearance: none;
  box-sizing: border-box;
  min-height: 44px;
  max-width: 100%;
  padding: 10px 38px 10px 14px;
  border: 1px solid var(--select-border);
  border-radius: 10px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2355756b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  box-shadow: 0 1px 2px #173b3405;
  line-height: 1.5;
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
body select:hover:not(:disabled) { border-color: #79ab98; }
body select:focus-visible:not([multiple]) {
  outline: 2px solid var(--select-accent);
  outline-offset: 2px;
  border-color: var(--select-accent);
}
body select:disabled:not([multiple]):not([size]),
body select[size="1"]:disabled {
  color: #768b83;
  background-color: #f2f5f3;
  border-color: #e0e8e4;
  box-shadow: none;
  cursor: not-allowed;
}
body select[aria-invalid="true"]:not([multiple]),
body select:user-invalid:not([multiple]) { border-color: #bb423e; }
body select option { color: var(--select-text); background: #fff; }

@supports (appearance: base-select) {
  body select:not([multiple]):not([size]),
  body select[size="1"]:not([multiple]),
  body select:not([multiple]):not([size])::picker(select),
  body select[size="1"]:not([multiple])::picker(select) {
    appearance: base-select;
  }
  body select:not([multiple]):not([size]),
  body select[size="1"]:not([multiple]) {
    background-image: none;
    padding-right: 12px;
    gap: 16px;
    align-items: center;
  }
  body select::picker-icon {
    content: "";
    width: 8px;
    height: 8px;
    flex-shrink: 0;
    margin: -4px 3px 0 auto;
    border-right: 2px solid #55756b;
    border-bottom: 2px solid #55756b;
    rotate: 45deg;
    transition: rotate 140ms ease;
  }
  body select:open:not([multiple]) { border-color: var(--select-accent); }
  body select:open::picker-icon { rotate: 225deg; margin-top: 4px; }
  body select::picker(select) {
    margin-block: 6px;
    padding: 6px;
    border: 1px solid var(--select-border);
    border-radius: 12px;
    min-width: min(max(anchor-size(width), 9rem), calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    max-height: min(320px, 60dvh);
    overflow: auto;
    overscroll-behavior: contain;
    background: #fff;
    box-shadow: 0 12px 32px #173b341c, 0 2px 6px #173b340a;
    scrollbar-width: thin;
    scrollbar-color: #bfd3c9 transparent;
  }
  body select option {
    box-sizing: border-box;
    min-height: 40px;
    padding: 9px 12px;
    border-radius: 7px;
    gap: 16px;
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: anywhere;
    cursor: pointer;
  }
  body select option + option { margin-top: 2px; }
  body select option:hover,
  body select option:focus { background: #f0f7f3; outline: none; }
  body select option:checked {
    color: #076448;
    background: var(--select-selected);
    font-weight: 600;
  }
  body select option:focus-visible {
    outline: 2px solid var(--select-accent);
    outline-offset: -2px;
  }
  body select option::checkmark {
    order: 1;
    margin-left: auto;
    color: var(--select-accent);
  }
  body select option:disabled { color: #87988f; cursor: not-allowed; }
  body select optgroup { padding: 4px; }
  body select optgroup::label { padding: 8px 12px; color: #657d72; font-size: .85em; }
}
@media (pointer: coarse) {
  body select { font-size: 16px; }
  body select option { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  body select, body select::picker-icon { transition: none; }
}
@media (forced-colors: active) {
  body select { border-color: ButtonText; }
  body select::picker-icon { border-color: ButtonText; }
  body select option:checked { color: HighlightText; background: Highlight; }
}
