/* Single-select typeahead. Visual tokens kept in sync with chips.css. */
/* Selectors prefixed with `.typeahead` so `.field input { ... }` in forms.css
   doesn't fight the inline picker styling when the macro lives inside .field */
.typeahead { position: relative; }
.typeahead .typeahead-input,
.field .typeahead .typeahead-input {
  width: 100%; padding: .55rem .85rem; padding-right: 2.2rem;
  border: 1px solid var(--c-border); border-radius: 8px;
  background: var(--c-surface); font-size: .9rem; color: var(--c-text);
  font-family: inherit;
  transition: border-color .12s, box-shadow .12s;
}
.typeahead .typeahead-input:focus {
  border-color: var(--c-accent); outline: 0;
  box-shadow: 0 0 0 3px rgba(30,64,175,.15);
}
.typeahead-clear[hidden] { display: none; }
.typeahead-clear {
  position: absolute; right: .4rem; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border: 0; background: transparent;
  color: var(--c-muted); cursor: pointer; border-radius: 50%; font-size: 1rem;
  line-height: 1; padding: 0;
}
.typeahead-clear:hover { background: #f1f5f9; color: var(--c-error); }

/* ── shared dropdown styling ─────────────────────────────────────── */
.typeahead-dropdown[hidden] { display: none; }
.typeahead-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 100;
  max-height: 300px; overflow-y: auto;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: 8px; box-shadow: 0 12px 28px rgba(15,23,42,.15);
  padding: .3rem;
}
.typeahead-item {
  display: flex; align-items: baseline; gap: .55rem;
  padding: .5rem .7rem; border-radius: 5px; cursor: pointer; font-size: .88rem;
}
.typeahead-item:hover, .typeahead-item.active {
  background: #f1f5f9; color: var(--c-accent);
}
.typeahead-item .ta-name { font-weight: 500; }
.typeahead-item .ta-alias { color: var(--c-muted); font-size: .8rem; font-style: italic; }
.typeahead-item .ta-meta { color: var(--c-muted); font-size: .75rem; margin-left: auto; }
.typeahead-empty { padding: .55rem .7rem; color: var(--c-muted); font-size: .85rem; }
.typeahead-create {
  display: flex; align-items: center; gap: .4rem; width: 100%;
  padding: .55rem .7rem; margin-top: .25rem;
  background: rgba(30,64,175,.06); border: 0; border-top: 1px solid var(--c-border);
  border-radius: 0 0 6px 6px;
  color: var(--c-accent); font-weight: 600; cursor: pointer;
  font-family: inherit; font-size: .85rem; text-align: left;
}
.typeahead-create:hover { background: rgba(30,64,175,.12); }
.typeahead-create:disabled { opacity: .5; cursor: progress; }
.typeahead-status { padding: .45rem .7rem; font-size: .8rem; color: var(--c-error); }
