/* Searchable select combobox — load on forms with long option lists, not landing. */
.searchable-select {
  position: relative;
  display: block;
  min-width: 0;
  width: 100%;
}
.searchable-select.is-native > .searchable-select-trigger,
.searchable-select.is-native > .searchable-select-panel {
  display: none !important;
}
.searchable-select.is-combobox > select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  opacity: 0;
  pointer-events: none;
}
.searchable-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
  min-height: var(--control-h, 40px);
  margin: 0;
  padding: 0 var(--control-pad-x, 12px);
  box-sizing: border-box;
  border: 1px solid var(--border, var(--line));
  border-radius: var(--control-radius, var(--radius-sm));
  background: var(--card, var(--surface));
  color: var(--text, var(--ink));
  font: inherit;
  font-size: var(--control-font, 0.9rem);
  text-align: left;
  cursor: pointer;
}
.searchable-select-trigger:hover:not(:disabled) {
  border-color: var(--line-strong, var(--border));
}
.searchable-select-trigger:focus {
  outline: none;
  border-color: var(--input-focus-border, var(--primary));
  box-shadow: var(--input-focus-shadow, var(--focus-ring));
}
.searchable-select-trigger:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.searchable-select-trigger-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.searchable-select-trigger.is-placeholder .searchable-select-trigger-label {
  color: var(--muted);
}
.searchable-select-caret {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1;
}
.searchable-select.is-open .searchable-select-trigger {
  border-color: var(--input-focus-border, var(--primary));
  box-shadow: var(--input-focus-shadow, var(--focus-ring));
}
.searchable-select-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 80;
  display: flex;
  flex-direction: column;
  max-height: 280px;
  overflow: hidden;
  border: 1px solid var(--border, var(--line));
  border-radius: var(--control-radius, var(--radius-sm));
  background: var(--card, var(--surface));
  box-shadow: var(--shadow-md);
}
.searchable-select.is-open > .searchable-select-panel:not([hidden]) {
  animation: surface-enter var(--motion-fast, 140ms) var(--motion-ease, ease) both;
}
.searchable-select-panel[hidden] {
  display: none !important;
}
.searchable-select-query {
  flex: 0 0 auto;
  width: 100%;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--border, var(--line));
  border-radius: 0;
  box-shadow: none;
  min-height: var(--control-h, 40px);
}
.searchable-select-query:focus {
  outline: none;
  box-shadow: none;
  border-color: var(--border, var(--line));
}
.searchable-select-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: 220px;
}
.searchable-select-option {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1.3;
}
.searchable-select-option:hover,
.searchable-select-option.is-active {
  background: var(--nav-hover-bg, var(--brand-50));
}
.searchable-select-option.is-selected {
  font-weight: 700;
  color: var(--primary-dark, var(--brand-800));
}
.searchable-select-option.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.searchable-select-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 0.85rem;
}

.searchable-select.is-invalid > .searchable-select-trigger,
.searchable-select-trigger[aria-invalid="true"] {
  border-color: #b4232d;
  border-color: var(--state-danger, #b4232d);
  background: #fff9f9;
  box-shadow: 0 0 0 3px rgba(180, 35, 45, 0.1);
}
