/* Общий справочный combobox используется и в статических, и в динамических формах. */
.combobox-option-source {
  display: none;
}

.combobox-field {
  position: relative;
}

.combobox-field:has(input[aria-autocomplete="list"])::after {
  bottom: .68rem;
  color: #64748b;
  content: "⌄";
  font-size: .9rem;
  line-height: 1;
  pointer-events: none;
  position: absolute;
  right: .7rem;
  transition: transform .14s ease;
  z-index: 2;
}

.combobox-field.combobox-open::after {
  transform: rotate(180deg);
}

.combobox-field input[aria-autocomplete="list"] {
  padding-right: 1.8rem;
}

.combobox-field.combobox-open .form-control {
  border-color: #2563eb;
  box-shadow: 0 0 0 .16rem rgba(37, 99, 235, .14);
}

.combobox-listbox {
  background: #fff;
  border: 1px solid #93c5fd;
  border-radius: 6px;
  box-shadow: 0 16px 34px rgba(15, 23, 42, .18);
  display: grid;
  gap: .12rem;
  left: 0;
  max-height: 14rem;
  overflow-y: auto;
  padding: .25rem;
  position: absolute;
  right: 0;
  top: calc(100% + .25rem);
  z-index: 1085;
}

.combobox-listbox[hidden] {
  display: none;
}

.combobox-listbox--above {
  bottom: calc(100% + .25rem);
  top: auto;
}

.combobox-option,
.combobox-empty {
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  font-size: .86rem;
  line-height: 1.2;
  min-height: 2rem;
  overflow: hidden;
  padding: .46rem .58rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combobox-option {
  color: #1f2933;
  cursor: pointer;
}

.combobox-option.is-active {
  background: #eff6ff;
  color: #1d4ed8;
}

.combobox-option.is-selected {
  background: #dbeafe;
  color: #1e40af;
  font-weight: 700;
}

.combobox-option.is-recommended {
  background: #fffbeb;
  box-shadow: inset 3px 0 0 #f59e0b;
  color: #92400e;
}

.combobox-option.is-recommended.is-active,
.combobox-option.is-recommended.is-selected {
  background: #fef3c7;
  color: #78350f;
}

.combobox-option-primary {
  align-items: center;
  display: flex;
  gap: .4rem;
  min-width: 0;
}

.combobox-option-indicator {
  color: #b45309;
  flex: 0 0 auto;
  height: 1rem;
  width: 1rem;
}

.combobox-option-indicator svg {
  fill: none;
  height: 100%;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 100%;
}

.combobox-option-label,
.combobox-option-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combobox-option-meta {
  color: #64748b;
  font-size: .72rem;
  font-weight: 500;
  margin-top: .12rem;
}

.combobox-option.is-selected .combobox-option-meta {
  color: #475569;
}

.combobox-empty {
  color: #64748b;
}

.combobox-listbox::-webkit-scrollbar {
  width: .45rem;
}

.combobox-listbox::-webkit-scrollbar-thumb {
  background: #bfdbfe;
  border-radius: 999px;
}

:root[data-theme="dark"] .combobox-listbox {
  background: var(--app-surface-soft);
  border-color: var(--app-input-border);
  color: var(--app-text);
}

:root[data-theme="dark"] .combobox-field.combobox-open .form-control {
  background: var(--app-primary-soft);
  border-color: var(--app-primary-border);
  box-shadow: 0 0 0 .16rem var(--app-primary-ring);
  color: var(--app-primary-strong);
}

:root[data-theme="dark"] .combobox-empty,
:root[data-theme="dark"] .combobox-option-meta {
  color: var(--app-muted);
}

:root[data-theme="dark"] .combobox-option {
  color: var(--app-text);
}

:root[data-theme="dark"] .combobox-option.is-active {
  background: var(--app-primary-soft);
  color: var(--app-primary-strong);
}

:root[data-theme="dark"] .combobox-option.is-selected {
  background: var(--app-primary-softer);
  color: var(--app-primary-strong);
}

:root[data-theme="dark"] .combobox-option.is-recommended {
  background: #422006;
  box-shadow: inset 3px 0 0 #f59e0b;
  color: #fde68a;
}

:root[data-theme="dark"] .combobox-option.is-recommended.is-active,
:root[data-theme="dark"] .combobox-option.is-recommended.is-selected {
  background: #713f12;
  color: #fef3c7;
}
