/* Reference search on the homepage and directory. */
.ref-select-trigger { position: relative; padding-right: 36px; background-image: none; text-align: start; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-hero .search-panel .ref-select-trigger { position: relative; padding-right: 36px; background-image: none; }
.ref-select-trigger::after { content: ""; position: absolute; right: 16px; top: calc(50% - 5px); width: 7px; height: 7px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(45deg); pointer-events: none; }
.ref-select-native[hidden], .home-hero .search-panel select[hidden] { display: none; }
.ref-select-popup {
  position: fixed; z-index: 1100; display: flex; flex-direction: column; gap: 8px;
  padding: 10px; border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); background: var(--surface); box-shadow: 0 16px 48px #0004;
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  font-size: .875rem; box-sizing: border-box;
}
.ref-select-popup[hidden] { display: none; }
.ref-select-popup .ref-select-query { flex: 0 0 auto; min-height: 44px; font-size: 16px; background-color: var(--surface-2); }
/* Keep at least one touch target visible when retry/clear controls need room.
   On very short viewports the surrounding popup can scroll its controls. */
.ref-select-list { position: relative; list-style: none; margin: 0; padding: 0; overflow-y: auto; min-height: 44px; overscroll-behavior: contain; scrollbar-width: thin; }
.ref-select-list:empty { display: none; }
.ref-select-group { margin: 0; padding: 0; list-style: none; }
.ref-select-group + .ref-select-group { margin-top: 8px; }
.ref-select-group-label { padding: 7px 12px; border-bottom: 1px solid var(--border); color: var(--text-2); background: var(--surface-2); font-size: .8rem; font-weight: 700; line-height: 1.5; }
.ref-select-group-options { margin: 0; padding: 4px 0 0; list-style: none; }
.ref-select-option { padding: 10px 12px; min-height: 44px; border-radius: 6px; cursor: pointer; display: flex; flex-direction: column; justify-content: center; gap: 2px; line-height: 1.5; }
.ref-select-option small { color: var(--text-3); font-size: .8rem; }
.ref-select-option:hover,.ref-select-option.is-active { background: var(--surface-2); outline: 1px solid var(--primary); outline-offset: -1px; }
.ref-select-option[aria-selected="true"] { background: var(--surface-2); color: var(--primary); font-weight: 600; }
.ref-select-status { flex: 0 0 auto; padding: 2px 10px; color: var(--text-3); font-size: .78rem; }
.ref-select-clear { flex: 0 0 auto; background: transparent; color: var(--primary); padding: 8px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; font: inherit; }
.ref-select-clear[hidden] { display: none; }
.ref-select-clear:hover { background: var(--surface-2); }
