/* ============================================================
   Formula Helper — reference / inserter
   ============================================================ */

.fh-overlay {
  position: fixed;
  inset: 0;
  z-index: 720;
  background: rgba(12, 14, 30, 0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 16px;
  backdrop-filter: blur(2px);
}
html[data-theme="dark"] .fh-overlay { background: rgba(4, 5, 14, 0.62); }

.fh-modal {
  width: min(560px, 96vw);
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: var(--radius-pane);
  box-shadow: var(--shadow-popover);
  overflow: hidden;
  animation: fh-in 0.14s ease;
}
@keyframes fh-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.fh-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.fh-title {
  font-family: var(--font-display, "Space Grotesk", sans-serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}
.fh-sub { font-size: 12.5px; color: var(--text-light); margin-top: 2px; }
.fh-close {
  border: none;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  font-size: 15px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
}
.fh-close:hover { background: var(--bg-hover); color: var(--text); }

.fh-search-wrap { padding: 12px 18px; }
.fh-search {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-ctl);
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
}
.fh-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }

.fh-list { overflow-y: auto; padding: 0 12px 14px; }
.fh-group { margin-top: 6px; }
.fh-group-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 10px 6px 4px;
}
.fh-item {
  padding: 10px 12px;
  border-radius: var(--radius-card);
  border: 1px solid transparent;
}
.fh-item + .fh-item { margin-top: 2px; }
.fh-item-insert { cursor: pointer; transition: background 0.1s, border-color 0.1s; }
.fh-item-insert:hover { background: var(--bg-hover); border-color: var(--border); }
.fh-item-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fh-sig {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
}
.fh-insert-hint { font-size: 11px; color: var(--text-faint); opacity: 0; transition: opacity 0.1s; }
.fh-item-insert:hover .fh-insert-hint { opacity: 1; }
.fh-desc { font-size: 12.5px; color: var(--text-light); margin: 4px 0 5px; line-height: 1.45; }
.fh-ex {
  display: block;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 11.5px;
  color: var(--text-faint);
  background: var(--bg-code);
  padding: 5px 8px;
  border-radius: 6px;
  overflow-x: auto;
  white-space: pre;
}
.fh-empty { padding: 24px 12px; text-align: center; color: var(--text-faint); font-size: 13px; }
