/* Field chrome also improves the native fallback on older browsers. */
select:not([multiple]) {
  appearance: none;
  background-color: var(--card, #fff);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23686d66' stroke-width='1.6' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .8rem center;
  padding-right: 2.4rem;
  min-height: 44px;
  max-width: 100%;
  color: var(--ink, #16191c);
}
[dir="rtl"] select:not([multiple]) { background-position: left .8rem center; padding-left: 2.4rem; padding-right: .8rem; }
select option, select optgroup { background: var(--card, #fff); color: var(--ink, #16191c); }
select:disabled { opacity: .6; cursor: not-allowed; }
select[multiple] { max-width: 100%; background: var(--card, #fff); color: var(--ink, #16191c); }
select[size]:not([size="0"]):not([size="1"]) { background-image: none; }
.theme-dark .choice-field, .theme-dark .choice-popover { --choice-accent: #6ec0a8; }

:where(.choice-field) { width: min(100%, 18rem); }
.choice-field {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  max-width: 100%;
  min-width: 0;
  height: auto !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.choice-field[hidden], .choice-popover [hidden] { display: none !important; }
.choice-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  clip-path: inset(50%);
  pointer-events: none;
}
.choice-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line, #e8e6df);
  border-radius: 10px;
  background: var(--card, #fff);
  color: var(--ink, #16191c);
  text-align: start;
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.choice-trigger:hover:not(:disabled) { border-color: #8ca69d; }
.choice-trigger:focus-visible, .choice-trigger[aria-expanded="true"] {
  border-color: var(--choice-accent, var(--accent, #0f6b5c));
  outline: 2px solid var(--choice-accent, var(--accent, #0f6b5c));
  outline-offset: 2px;
}
.choice-trigger[aria-invalid="true"] { border-color: #dc2626; }
.choice-trigger:disabled { cursor: not-allowed; opacity: .6; }
.choice-value, .choice-copy { display: block; min-width: 0; flex: 1; overflow-wrap: anywhere; white-space: normal; }
.choice-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 10px; }
.choice-title { overflow-wrap: anywhere; }
.choice-detail {
  display: block;
  margin-top: 4px;
  color: var(--ink-2, #686d66);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.choice-copy:has(.choice-detail) .choice-title { font-weight: 600; }
.choice-badge {
  flex-shrink: 0;
  border-radius: 5px;
  padding: 1px 6px;
  background: var(--accent-soft, #e8f1ee);
  color: var(--sb-fg-active, #0f6b5c);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
}
.choice-arrow { flex: none; width: 8px; height: 8px; margin: -4px 3px 0; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(45deg); color: var(--ink-2, #686d66); transition: transform 120ms ease; }
.choice-trigger[aria-expanded="true"] .choice-arrow { transform: translateY(4px) rotate(225deg); }
.choice-popover {
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line, #e8e6df);
  border-radius: 12px;
  background: var(--card, #fff);
  color: var(--ink, #16191c);
  box-shadow: 0 12px 36px rgb(22 25 28 / 16%), 0 2px 6px rgb(22 25 28 / 6%);
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  text-align: start;
  letter-spacing: normal;
  text-transform: none;
}
.choice-popover:popover-open { display: flex; flex-direction: column; animation: choice-enter 100ms ease-out; }
.choice-search {
  display: block;
  flex-shrink: 0;
  width: calc(100% - 20px);
  min-height: 44px;
  margin: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line, #e8e6df);
  border-radius: 7px;
  background: var(--bg, #f7f6f2);
  color: var(--ink, #16191c);
  font-size: 16px;
  line-height: 1.5;
  font-weight: 400;
}
.choice-search:focus { outline: 2px solid var(--choice-accent, var(--accent, #0f6b5c)); outline-offset: 0; box-shadow: none; }
.choice-search::placeholder { color: var(--ink-2, #686d66); opacity: 1; }
.choice-list { min-height: 0; padding: 5px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.choice-list:focus-visible { outline: 0; }
.choice-option { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px; border: 1px solid transparent; border-radius: 7px; cursor: pointer; white-space: normal; }
.choice-option + .choice-option { margin-top: 2px; }
.choice-option[aria-selected="true"] { background: var(--accent-soft, #e8f1ee); }
.choice-option[data-active] { border-color: var(--choice-accent, var(--accent, #0f6b5c)); background: var(--accent-soft, #e8f1ee); }
.choice-option:hover:not([aria-disabled="true"]) { background: var(--accent-soft, #e8f1ee); }
.choice-option[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.choice-check { flex: none; width: 18px; color: var(--sb-fg-active, #0f6b5c); font-size: 17px; font-weight: 700; }
.choice-group-label { padding: 9px 11px 5px; color: var(--ink-2, #686d66); font-size: 12px; font-weight: 600; }
.choice-empty { margin: 0; padding: 16px; color: var(--ink-2, #686d66); font-size: 13px; }
.choice-error { margin: 0; padding: 10px 14px; color: #b91c1c; font-size: 13px; }
.theme-dark .choice-error { color: #fca5a5; }
.choice-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line, #e8e6df); padding: 5px 10px; color: var(--ink-2, #686d66); font-size: 12px; }
.choice-done { min-height: 44px; padding: 8px 12px; border-radius: 6px; color: var(--sb-fg-active, #0f6b5c); font-size: 14px; font-weight: 600; }
.choice-done:hover { background: var(--accent-soft, #e8f1ee); }
@keyframes choice-enter { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .choice-popover:popover-open { animation: none; }
  .choice-trigger, .choice-arrow { transition: none; }
}
@media (forced-colors: active) {
  .choice-option[data-active] { outline: 2px solid Highlight; outline-offset: -2px; }
  .choice-option[aria-selected="true"] .choice-check { color: Highlight; }
}
