/* A visible native select remains the single painted field; the trigger only handles input. */
.choice-host {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  vertical-align: middle;
  min-width: 0;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.choice-host > select {
  pointer-events: none;
}

.model-picker > .choice-host,
.parameter-field > .choice-host,
.support-pages .support-form > .choice-host,
.billing-pages .bill-filters label > .choice-host {
  display: flex;
  width: 100%;
}

.billing-pages .bill-filters label > .choice-host > select {
  width: 100%;
}

.workspace-pages .ws-setting-row > .choice-host {
  flex-shrink: 0;
}

/* The contact field's spacing belongs outside the clickable select rectangle. */
.support-pages .support-form > .choice-host {
  margin-bottom: 24px;
}

.support-pages .support-form > .choice-host > select {
  margin-bottom: 0;
}

.choice-host > button.choice-trigger {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm, 6px);
  background: transparent;
  color: inherit;
  box-shadow: none;
  appearance: none;
  cursor: pointer;
  font: inherit;
  line-height: inherit;
  text-align: inherit;
  transform: none;
  transition: none;
  -webkit-tap-highlight-color: transparent;
}

.choice-host > button.choice-trigger:is(:hover, :active, [aria-expanded="true"]) {
  background: transparent;
  border: 0;
  box-shadow: none;
  transform: none;
}

.choice-host > button.choice-trigger:disabled {
  cursor: not-allowed;
  opacity: 1;
  pointer-events: none;
}

.choice-popover {
  position: fixed;
  z-index: 220;
  display: flex;
  flex-direction: column;
  width: 240px;
  min-width: 0;
  max-width: min(360px, calc(100vw - 24px));
  max-height: min(420px, calc(100dvh - 24px));
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 2px 4px #00000008, 0 8px 24px #00000014;
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: 0;
  text-align: left;
  color-scheme: inherit;
}

.choice-popover:has(.choice-option-description:not(:empty)) {
  width: 360px;
}

.choice-popover[hidden],
.choice-popover [hidden] {
  display: none;
}

.choice-popover .choice-search-wrap {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 48px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.choice-popover .choice-search-wrap > svg {
  position: static;
  display: block;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  margin: 0;
  color: var(--muted);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.choice-popover .choice-search-wrap > input.choice-search {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 32px;
  height: auto;
  max-width: none;
  margin: 0;
  padding: 4px 2px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  font: 400 13px/1.5 var(--font);
  letter-spacing: 0;
  appearance: none;
  -webkit-appearance: none;
}

.choice-popover .choice-search::placeholder {
  color: var(--subtle);
  opacity: 1;
}

.choice-popover .choice-options {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 6px;
  scroll-padding-block: 6px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.choice-popover .choice-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 40px;
  margin: 0;
  padding: 9px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

.choice-popover .choice-option[aria-selected="true"] {
  background: var(--accent-soft);
}

.choice-popover .choice-option:not([aria-disabled="true"]):hover,
.choice-popover .choice-option.is-active {
  background: var(--accent-soft);
}

.choice-popover .choice-option.is-active {
  box-shadow: inset 0 0 0 1px var(--line);
}

.choice-popover .choice-option[aria-disabled="true"] {
  cursor: not-allowed;
  color: var(--subtle);
}

.choice-popover .choice-check {
  position: static;
  display: block;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  margin: 0;
  visibility: hidden;
  color: var(--ink);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.choice-popover .choice-option[aria-selected="true"] > .choice-check {
  visibility: visible;
}

.choice-popover .choice-option-copy {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
}

.choice-popover .choice-option-label {
  display: block;
  margin: 0;
  padding: 0;
  color: inherit;
  font: 400 13px/1.5 var(--font);
  letter-spacing: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

.choice-popover .choice-option[aria-selected="true"] .choice-option-label {
  font-weight: 500;
}

.choice-popover .choice-option-description {
  display: block;
  margin: 3px 0 0;
  padding: 0;
  color: var(--muted);
  font: 400 11px/1.6 var(--font);
  letter-spacing: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

.choice-popover .choice-option-description:empty {
  display: none;
}

.choice-popover .choice-option:has(.choice-option-description:not(:empty)) {
  align-items: flex-start;
  min-height: 64px;
  padding-block: 10px;
}

.choice-popover .choice-option:has(.choice-option-description:not(:empty)) > .choice-check {
  margin-top: 2px;
}

.choice-popover .choice-empty {
  padding: 24px 16px;
  color: var(--muted);
  font: 400 12px/1.7 var(--font);
  text-align: center;
  overflow-wrap: anywhere;
}

.choice-popover .choice-empty strong,
.choice-popover .choice-empty span { display: block; }

.choice-popover .choice-footer {
  flex: 0 0 auto;
  min-width: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  color: var(--subtle);
  font: 400 10px/1.6 var(--font);
  overflow-wrap: anywhere;
}

@media (max-width: 600px) {
  .choice-popover .choice-option { min-height: 44px; }
  .choice-popover .choice-search-wrap { min-height: 52px; }
  .choice-popover .choice-search-wrap > input.choice-search { min-height: 36px; font-size: 16px; }
  .choice-popover .choice-option:has(.choice-option-description:not(:empty)) { min-height: 68px; }
}

@media (prefers-reduced-motion: reduce) {
  .choice-popover,
  .choice-host > button.choice-trigger { animation: none; transition: none; }
}
