/* Ported to the React build from css/search.css — tokens reconciled to the
   Pursuit DS 2026 canonical sheet (legacy --border/--radius/--secondary names
   replaced; see react/css/bridge.css for remaining aliases). */

/* ========================================================================
   CONTENT PANEL
   ======================================================================== */
.content-panel {
  flex: 1; display: flex; flex-direction: column;
  gap: 20px; min-width: 0; overflow-y: auto;
  padding-right: 32px;
  padding-bottom: 24px;
}
#work-area {
  flex: 1; display: flex; flex-direction: column; gap: 16px;
  min-height: 0;
}
#work-area > [data-role="empty"] {
  flex: 1; display: flex; min-height: 0;
}
/* In the search empty state the empty pane is a direct child of
   .content-panel (not #work-area) — make it fill the panel height. */
.content-panel > [data-role="empty"] {
  flex: 1; display: flex; min-height: 0;
}
/* Decorative Parallelo lattice — a full-width background band pinned to
   the bottom of the whole work area (spans behind both the floating
   filter panel and the content panel). Neutral lines, peak-horizon top
   edge. Layered behind the two columns, which the filter card overlays. */
.search-bg-parallelo,
.parallelo-band {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 42%;
  min-height: 220px;
  pointer-events: none;
  z-index: 0;
}
.body:has(> .parallelo-band) { position: relative; }
.body:has(> .parallelo-band) > .floating-widget-spacer,
.body:has(> .parallelo-band) > .content-panel {
  position: relative;
  z-index: 1;
}
/* Inbox body container behaves like the Search empty pane when it
   contains an .empty-prompt — flex into available height so the
   "Your Opportunities inbox" hero vertically centers. */
#work-area > [data-role="inbox"]:has(.empty-prompt) {
  flex: 1; display: flex; min-height: 0;
}
.page-header {
  display: flex; flex-direction: column; gap: 8px;
}
.page-title-row {
  display: flex; align-items: baseline; gap: 16px;
}
.page-title {
  font-size: 26px; font-weight: 600; letter-spacing: -0.01em;
  line-height: 1.2; color: var(--foreground);
  flex: 1 1 auto; min-width: 0;
}
.page-subtitle {
  font-size: 13px; color: var(--muted-foreground);
}
.entity-row {
  display: flex; align-items: center; gap: 12px;
  margin-top: 4px;
}

/* ========================================================================
   SEARCH BAR — three variation shells share this wrap. Style picker
   floats top-right of the wrap. Popover anchors to the bar.
   ======================================================================== */
.search-bar-wrap {
  position: relative;
  margin: 12px 0 4px;
}

/* Shared: input element looks the same in all variations. */
.sb-input {
  flex: 1 1 auto; min-width: 0;
  border: none; outline: none; background: transparent;
  font: inherit; color: var(--foreground);
}
.sb-input::placeholder { color: var(--muted-foreground); }



/* -- Search bar — Search Input Large pattern -- */
.sb-tokens {
  display: flex; align-items: center; gap: 12px;
  min-height: 52px;
  padding: 0 20px;
  background: var(--card);
  border: 1px solid #fff;
  border-bottom-width: 1.5px;
  border-radius: 12px;
  box-shadow: 0 0 16px rgba(146, 146, 151, 0.1);
  transition: box-shadow 120ms;
}
.sb-tokens:focus-within { border-color: var(--primary); border-bottom-color: var(--primary); }
.sb-tokens > i,
.sb-tokens > .sb-leading { color: var(--muted-foreground); flex-shrink: 0; align-self: flex-start; margin-top: 16px; display: inline-flex; }
/* Leading icon wrapper: the search glyph swaps to a spinner during
   smart parse. Both icons live in the DOM; CSS shows one or the other
   based on the `.parsing` class on the bar wrapper. */
.sb-leading .sb-leading-spinner { display: none; }
.sb-tokens.parsing .sb-leading-search  { display: none; }
.sb-tokens.parsing .sb-leading-spinner {
  display: inline-flex;
  animation: sp-spin 1.2s linear infinite;
  color: var(--primary);
}
.sb-tokens.parsing { border-color: var(--ps-primary-75); }
.sb-tokens > .sb-clear-all {
  flex-shrink: 0; align-self: flex-start;
  margin-top: 18px;
  border: 0; background: transparent;
  color: var(--primary); font: inherit; font-size: 12px; font-weight: 500;
  cursor: pointer;
  padding: 0;
}
.sb-tokens > .sb-clear-all:hover { color: #2e3999; }
.sb-tokens > .sb-clear-all[hidden] { display: none; }
.sb-tokens-row {
  flex: 1 1 auto; min-width: 0;
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
  padding: 3px 0;
}
.sb-tokens-row .sb-input { min-width: 120px; flex: 1; font-size: 15px; font-weight: 400; padding: 6px 0; }
.sb-token-chip {
  display: inline-flex; align-items: center;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  font-size: 11px;
  overflow: hidden;
  height: 26px;
}
.sb-token-chip > span { padding: 0 7px; display: inline-flex; align-items: center; }
.sb-token-chip .sb-token-label {
  background: var(--accent);
  color: var(--accent-foreground);
  font-weight: 500;
  border-right: 1px solid var(--hairline);
}
.sb-token-chip .sb-token-op {
  color: var(--muted-foreground);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  border-right: 1px solid var(--hairline);
}
.sb-token-chip .sb-token-val { color: var(--foreground); font-weight: 500; }
.sb-token-chip > button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 100%;
  border: none; background: transparent;
  border-left: 1px solid var(--hairline);
  color: var(--muted-foreground);
  font-size: 14px; cursor: pointer; padding: 0;
}
.sb-token-chip > button:hover { background: var(--muted); color: var(--destructive); }
.sb-apply {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px;
  border-radius: 6px;
  font: inherit; font-size: 12px; font-weight: 500;
  background: var(--primary); color: var(--primary-foreground);
  border: none; cursor: pointer;
  white-space: nowrap;
}
.sb-apply:disabled { opacity: 0.4; cursor: not-allowed; }
.sb-apply:not(:disabled):hover { opacity: 0.9; }

/* -- Popover, shared but with per-style accents -- */
.search-popover {
  position: absolute;
  top: calc(100% + 6px); left: 0; right: 0;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  box-shadow: 0 14px 36px rgba(15,19,51,0.16), 0 2px 6px rgba(15,19,51,0.05);
  padding: 6px;
  z-index: 40;
  max-height: 360px;
  overflow-y: auto;
  animation: pop-in 120ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.search-popover[hidden] { display: none; }
.sp-empty {
  padding: 16px 12px;
  color: var(--muted-foreground); font-style: italic; font-size: 12px;
  text-align: center;
}
.sp-section {
  padding: 6px 10px 2px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted-foreground);
}
.sp-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px; color: var(--foreground);
}
.sp-item:hover, .sp-item.active { background: var(--accent); }
.sp-item.active { box-shadow: inset 0 0 0 1px var(--ps-primary-75); }
.sp-icon {
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; flex-shrink: 0;
  background: var(--popover); color: var(--muted-foreground);
  border: 1px solid var(--hairline);
}
.sp-item.active .sp-icon { color: var(--primary); }
.sp-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sp-body-row { display: flex; align-items: baseline; gap: 8px; }
.sp-type {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted-foreground); flex-shrink: 0;
}
.sp-match { font-weight: 500; color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-match em { font-style: normal; background: var(--ps-primary-60); color: var(--ps-primary-700); padding: 0 1px; border-radius: 2px; }
.sp-trail {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--muted-foreground); flex-shrink: 0;
  opacity: 0; transition: opacity 100ms;
}
.sp-item.active .sp-trail { opacity: 1; }
.sp-item.disabled {
  /* Mutual-exclusion: Contact items while on Signals, Signal items
     while on Contacts. Visible (so the user knows the option exists
     from the other toggle) but non-interactive and muted. */
  opacity: 0.4;
  cursor: not-allowed;
}
.sp-item.disabled:hover { background: transparent; }
.sp-item.disabled .sp-type,
.sp-item.disabled .sp-match { color: var(--muted-foreground); }


/* ========================================================================
   ENTITY SWITCHER — what kind of records am I browsing?
   ======================================================================== */
/* ========================================================================
   ENTITY SWITCHER — segmented control from Pursuit button spec
   ======================================================================== */
.entity-switch {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px;
  background: var(--UI-elements-hollow);
  border-radius: 8px;
  border: 0.5px solid #fff;
  border-bottom-width: 1px;
  overflow: hidden;
}
.entity-switch button {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 16px;
  background: transparent;
  border: 0; border-radius: 4px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14px; font-weight: 600;
  line-height: 1.4286;
  color: var(--muted-foreground);
  cursor: pointer;
  white-space: nowrap;
}
.entity-switch button:hover { background: rgba(0,0,0,0.03); }
.entity-switch button.disabled,
.entity-switch button[disabled] {
  /* Disabled toggles stay in the row to preserve the layout and
     remind the user the option exists — they just can't act on
     it from the current mode. Opacity carries the disabled state;
     the helper-tip popover (data-helper-tip) carries the
     explanation on hover. No not-allowed cursor — the helper tip
     is the affordance. */
  color: var(--muted-foreground);
  opacity: 0.45;
  pointer-events: auto;       /* keep hover so helper-tip fires */
}
.entity-switch button.disabled:hover,
.entity-switch button[disabled]:hover { background: transparent; }
.entity-switch button.disabled .es-count,
.entity-switch button[disabled] .es-count { opacity: 0.6; }
.entity-switch button.active {
  background: var(--card);
  border: 0.5px solid #fff;
  border-top-width: 1px;
  box-shadow: 0 1px 1.75px rgba(0,0,0,0.05);
  color: var(--foreground);
}
.entity-switch button .es-count {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 4px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 12px; font-weight: 600;
  background: #f6f7ff;
  color: var(--accent-foreground);
  border: 0.5px solid transparent;
}
.entity-switch button.active .es-count {
  background: var(--ps-primary-60);
  color: var(--primary);
}

/* In-bar chip rail — `display: contents` so each chip becomes a
   direct flex child of the search bar's tokens row. The row is
   already `flex-wrap: wrap`, so chips wrap naturally when they
   don't fit, and the input itself can wrap to a new line too. */
.chip-rail--inline {
  display: contents;
}
.chip-rail--inline .filter-chip {
  height: 26px;
}

/* ========================================================================
   CHIPS  (active filters)
   ======================================================================== */
.chip-rail {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  min-height: 32px;
}
.chip-rail .label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted-foreground);
  flex-shrink: 0;
}
/* Filter chip — flat, low-contrast pill with no internal dividers.
   Field name + operator both muted, value pops in accent purple. */
.filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--accent);
  border-radius: 8px;
  border: 0.5px solid #fff;
  border-top-width: 1px;
  font-size: 12px; line-height: 1.3;
  cursor: pointer;
  transition: box-shadow 120ms, background 120ms;
  white-space: nowrap;
  height: auto;
  overflow: visible;
}
.filter-chip:hover { background: var(--ps-primary-75); }
.filter-chip.accent { box-shadow: 0 0 0 2px var(--ps-primary-75); }
.filter-chip .fc-part {
  padding: 0;
  display: inline-flex; align-items: center;
  white-space: nowrap;
  font-size: 12px;
}
.filter-chip .fc-field {
  background: transparent;
  color: var(--muted-foreground);
  font-weight: 600;
  border: 0;
}
.filter-chip .fc-op {
  background: transparent;
  color: var(--muted-foreground);
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 400;
  font-size: 12px;
  border: 0;
  white-space: nowrap;
}
.filter-chip .fc-val {
  color: var(--accent-foreground);
  font-weight: 500;
}
.filter-chip .fc-val em {
  font-style: italic; font-weight: 400; color: var(--muted-foreground);
}
.filter-chip .fc-x {
  padding: 0;
  color: var(--muted-foreground);
  display: inline-flex; align-items: center; justify-content: center;
  border: 0;
  background: transparent;
  width: 14px; height: 14px;
  font-size: 14px; line-height: 1;
  min-width: 0;
  margin-left: 2px;
}
.filter-chip .fc-x:hover { background: transparent; color: var(--foreground); }

/* Pending state: filter exists but no value picked yet — soft dashed outline */
.filter-chip.pending {
  border: 1px dashed var(--ps-primary-75);
  background: var(--ps-primary-60, #f6f7ff);
}
.filter-chip.pending .fc-val { color: var(--muted-foreground); font-style: italic; font-weight: 400; }

/* Cross-entity ("related") chip variant — italic, muted field name */
.filter-chip.related .fc-field {
  color: var(--muted-foreground);
  font-style: italic;
  font-weight: 500;
}
.filter-chip .fc-via {
  color: var(--ps-primary-700);
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 500;
  font-size: 10px;
  display: inline-flex; align-items: center;
  padding: 0;
  margin-right: 2px;
  white-space: nowrap;
  border: 0;
  background: transparent;
}

.chip-rail .add-filter {
  margin-left: auto;
  background: transparent; border: 1px dashed var(--ps-neutral-200);
  color: var(--muted-foreground);
  padding: 6px 14px; border-radius: 7px;
  font-size: 12px; font-weight: 500;
  height: 32px;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.chip-rail .add-filter:hover { color: var(--primary); border-color: var(--primary); background: var(--accent); }

/* ========================================================================
   VALUE EDITOR — appears as a popover anchored to the trigger
   (field-list item or chip). The .editor-popover wraps it and handles
   positioning + dismiss-on-outside-click + Escape.
   ======================================================================== */
.editor-popover {
  position: fixed;
  z-index: 60;
  width: max-content;
  min-width: 280px;
  max-width: calc(100vw - 32px);
  animation: pop-in 140ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.editor-popover::before {
  /* Overridden by per-arrow rules below */
  display: none;
}

.value-editor {
  background: var(--card);
  border-radius: 0 12px 12px 12px;
  border: 1.5px solid #fff;
  border-top-width: 2px;
  box-shadow: 0 16px 40px rgba(15,19,51,0.16), 0 2px 6px rgba(15,19,51,0.06);
  padding: 14px 16px 16px;
  display: flex; flex-direction: column; gap: 12px;
  position: relative;
}

/* Pointer tab that visually links the popover back to its trigger.
   For field-list items: a left-pointing notch on the popover's left edge.
   For chips: an upward notch on the top edge. */
.editor-popover::before,
.editor-popover::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  background: var(--card);
  transform: rotate(45deg);
}
.editor-popover[data-arrow="left"]::before {
  left: -7px; top: 18px;
  border-left: 1.5px solid #fff;
  border-bottom: 1.5px solid #fff;
  box-shadow: -2px 2px 4px rgba(15,19,51,0.04);
}
.editor-popover[data-arrow="top"]::before {
  top: -7px; left: 22px;
  border-top: 1.5px solid #fff;
  border-left: 1.5px solid #fff;
  box-shadow: -2px -2px 4px rgba(15,19,51,0.04);
}
.editor-popover::after { display: none; }
.editor-popover[data-arrow="none"]::before { display: none; }
.value-editor .ve-head {
  display: flex; align-items: center; gap: 10px;
}
.value-editor .ve-glyph {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--accent);
  border: 1px solid var(--ps-primary-75);
  color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
}
.value-editor .ve-glyph i { width: 14px; height: 14px; }
.value-editor .ve-title {
  font-size: 14px; font-weight: 600;
  white-space: nowrap;
}
.value-editor .ve-title .ve-prefix {
  color: var(--muted-foreground); font-weight: 400; margin-right: 6px;
  white-space: nowrap;
}
.value-editor .ve-op {
  padding: 4px 8px; font-size: 12px;
  border: 1px solid var(--hairline);
  border-radius: 6px; background: #fff;
  outline: none; color: var(--foreground);
}
.value-editor .ve-op:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--ps-primary-75); }
.value-editor .ve-spacer { flex: 1; }
.value-editor .ve-done {
  background: var(--primary); color: #fff;
  border: 0; padding: 6px 14px; border-radius: 6px;
  font-size: 13px; font-weight: 500;
}
.value-editor .ve-done:hover { background: #3e4ccc; }
.value-editor .ve-done[disabled] { background: var(--muted); color: var(--muted-foreground); cursor: not-allowed; }
.value-editor .ve-cancel {
  background: transparent; color: var(--muted-foreground);
  border: 0; padding: 6px 10px; font-size: 13px;
}
.value-editor .ve-cancel:hover { color: var(--foreground); }

.ve-input {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--hairline);
  border-radius: 7px;
  background: #fff;
  font-family: inherit; font-size: 14px;
  color: var(--foreground); outline: none;
}
.ve-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ps-primary-75); }
/* Combobox: type-ahead suggestions for text fields whose underlying
   data has a known set of values. The popover hosts both the text
   input and the suggestion list. */
.ve-combo {
  position: relative;
  display: flex; flex-direction: column;
}
.ve-combo-list {
  margin-top: 6px;
  border: 1px solid var(--hairline);
  background: #fff;
  border-radius: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
  display: flex; flex-direction: column; gap: 1px;
}
.ve-combo-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  background: transparent;
  border: 0;
  font-family: inherit;
  font-size: 13px; color: var(--foreground);
  text-align: left; cursor: pointer;
  width: 100%;
}
.ve-combo-item:hover, .ve-combo-item.active {
  background: var(--accent);
  color: var(--accent-foreground);
}
.ve-combo-item .vc-match {
  font-weight: 600; color: var(--ps-primary-700);
}
.ve-combo-item .vc-hint {
  margin-left: auto;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; color: var(--muted-foreground);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.ve-combo-empty {
  padding: 8px 10px;
  font-size: 12px; color: var(--muted-foreground); font-style: italic;
}
.ve-pill-row {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.ve-preset-row { max-width: 340px; }
/* Territory value-editor empty state — illustration + define CTA. */
.ve-territory-empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 8px; padding: 6px 6px 4px; max-width: 280px;
}
.ve-territory-empty .ofe-illustration { width: 150px; height: auto; display: block; }
.ve-territory-empty-text {
  font: 400 12.5px/1.5 var(--font-body); color: var(--muted-foreground);
}
.ve-territory-empty-text strong { display: block; color: var(--foreground); font-weight: 600; }
.ve-territory-define { margin-top: 4px; }
.ve-pill {
  padding: 5px 12px; border: 1px solid var(--hairline);
  background: #fff; color: var(--foreground);
  border-radius: 999px; font-size: 12px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
}
.ve-pill:hover { border-color: var(--primary); color: var(--primary); }
/* "My Territory" shortcut pill — icon + subtle accent so it reads as the
   user's own patch, distinct from the named territories beside it. */
.ve-pill-mine span { display: inline-flex; align-items: center; gap: 4px; }
.ve-pill-mine i, .ve-pill-mine svg { width: 12px; height: 12px; }
.ve-pill-mine:not(.on):not(.excluded) {
  background: var(--ps-primary-60); border-color: var(--ps-primary-100); color: var(--ps-primary-700);
}
.ve-pill.on {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
/* Result-count badge — shown after every pickable filter option to
   tell the user how the option will narrow results. Plain neutral pill
   on default state; flips to a white-on-primary inset when the option
   is already selected so it stays legible. */
.ve-pill-count,
.ve-combo-item .vc-count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; font-weight: 600;
  background: var(--muted);
  color: var(--muted-foreground);
  padding: 1px 6px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  line-height: 1.4;
}
.ve-combo-item .vc-count { margin-left: auto; font-weight: 500; }
.ve-pill.on .ve-pill-count {
  background: rgba(255,255,255,0.24);
  color: #fff;
}
.ve-pill.excluded .ve-pill-count {
  background: rgba(231,0,11,0.10);
  color: var(--destructive);
}
.ve-pill-count.zero,
.vc-count.zero { opacity: 0.45; }
/* Excluded pill — red border, strikethrough, "−" prefix. */
.ve-pill.excluded {
  background: #fff5f5; color: var(--destructive);
  border-color: var(--destructive);
  text-decoration: line-through; text-decoration-thickness: 1.5px;
}
.ve-pill.excluded:hover { background: #ffe5e5; color: var(--destructive); border-color: var(--destructive); }
.ve-between-row {
  display: flex; gap: 8px; align-items: center;
}
.ve-between-row .ve-input { flex: 1; }

/* Tag-input area — shared by themes (combobox suggestions) and tokens
   (free-form keywords). Selected values appear as removable chips
   above the input. */
.ve-tag-area {
  display: flex; flex-direction: column;
}
.ve-tag-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 8px;
}
.ve-tag-chips:empty { display: none; }
.ve-tag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 4px 3px 9px;
  border-radius: 14px;
  background: var(--ps-primary-60);
  color: var(--ps-primary-700);
  font-size: 12px; font-weight: 500;
  border: 1px solid var(--ps-primary-75);
  line-height: 1.2;
}
.ve-tag-chip.mono {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  background: var(--muted);
  color: var(--foreground);
  border-color: var(--hairline);
}
.ve-tag-chip > button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border: none; background: transparent;
  color: var(--ps-primary-700); opacity: 0.6;
  font-size: 14px; line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
}
.ve-tag-chip > button:hover { opacity: 1; background: rgba(0,0,0,0.06); }
.ve-tag-chip.mono > button { color: var(--muted-foreground); }
.ve-hint {
  margin-top: 8px;
  font-size: 11px; color: var(--muted-foreground);
  line-height: 1.5;
}

/* ========================================================================
   SAVED SEARCHES — combobox at top of Filter panel + Save modal dialog.
   ======================================================================== */
.ss-section {
  padding: 0 12px 10px;
  position: relative;
  flex-shrink: 0;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 6px;
}
.ss-row { display: flex; align-items: center; gap: 6px; }
.ss-combo-wrap {
  position: relative;
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: stretch;
}
.ss-combo {
  flex: 1 1 auto; min-width: 0;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 30px 8px 12px;
  background: var(--card);
  border: 1px solid #fff;
  border-top-width: 1.5px;
  box-shadow: var(--shadow-xs);
  border-radius: 8px;
  font: 500 14px/1 var(--font-body);
  color: var(--foreground);
  cursor: pointer; text-align: left;
  transition: background 120ms, box-shadow 120ms;
}
.ss-combo:hover { background: var(--ps-neutral-100); }
.ss-combo.active { box-shadow: var(--shadow-xs), 0 0 0 2px var(--ps-primary-75); }
.ss-combo-icon { color: var(--ps-primary-500); flex-shrink: 0; }
.ss-combo.active .ss-combo-icon { color: var(--primary); }
.ss-combo-text { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }
.ss-combo-chev { color: var(--muted-foreground); flex-shrink: 0; margin-left: auto; }
.ss-combo.active .ss-combo-chev { display: none; }
.ss-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  border: none; background: var(--muted);
  color: var(--muted-foreground);
  border-radius: 50%; cursor: pointer; padding: 0;
  flex-shrink: 0;
  z-index: 2;
}
.ss-clear:hover { background: var(--ps-neutral-200, #d3d3d5); color: var(--foreground); }
.ss-clear[hidden] { display: none; }
.ss-update-btn {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 10px;
  border-radius: 7px;
  font: inherit; font-size: 12px; font-weight: 500;
  background: var(--primary); color: var(--primary-foreground);
  border: 1px solid #fff;
  border-top-width: 1.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 120ms, transform 120ms;
  animation: pop-in 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ss-update-btn:hover { background: #3e4ccc; }
.ss-update-btn[hidden] { display: none; }
.ss-update-btn i { stroke-width: 2.25; }
.ss-popover {
  position: absolute;
  top: calc(100% - 4px); left: 12px; right: 12px;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15,19,51,0.18), 0 2px 6px rgba(15,19,51,0.06);
  padding: 6px;
  z-index: 50;
  max-height: 320px;
  overflow-y: auto;
  animation: pop-in 120ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ss-popover[hidden] { display: none; }
.ss-folder-header {
  padding: 8px 8px 4px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted-foreground);
  display: flex; align-items: center; gap: 6px;
}
.ss-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px; color: var(--foreground);
}
.ss-item:hover { background: var(--accent); }
.ss-item.active { background: var(--accent); color: var(--primary); font-weight: 500; }
.ss-item-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-item-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; color: var(--muted-foreground);
  flex-shrink: 0;
}
.ss-empty {
  padding: 14px 10px;
  font-size: 12px; color: var(--muted-foreground); font-style: italic;
  text-align: center;
}

/* Modal overlay + dialog (Save this Search) */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,19,51,0.42);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  animation: overlay-in 140ms ease;
}
.modal-overlay[hidden] { display: none; }
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 440px; max-width: calc(100vw - 32px);
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 24px 48px rgba(15,19,51,0.18), 0 2px 8px rgba(15,19,51,0.08);
  display: flex; flex-direction: column;
  animation: pop-in 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 0;
}
.modal-title { font-size: 16px; font-weight: 600; color: var(--foreground); }
.modal-close {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent;
  color: var(--muted-foreground);
  font-size: 22px; line-height: 1;
  border-radius: 6px; cursor: pointer;
}
.modal-close:hover { background: var(--muted); color: var(--foreground); }
.modal-body {
  padding: 16px 22px 4px;
  display: flex; flex-direction: column; gap: 14px;
}
.modal-field { display: flex; flex-direction: column; gap: 6px; position: relative; }
.modal-field[hidden], .modal-badge[hidden] { display: none !important; }
.modal-field-tight { gap: 4px; }
.modal-field-label {
  font-size: 12px; font-weight: 500; color: var(--foreground);
}
.modal-combo-wrap {
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--popover);
  padding: 0 10px;
  transition: border-color 120ms, box-shadow 120ms;
}
.modal-combo-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ps-primary-75); }
.modal-input {
  flex: 1 1 auto; min-width: 0;
  padding: 9px 0;
  border: none; outline: none;
  background: transparent;
  font: inherit; font-size: 14px; color: var(--foreground);
}
.modal-input::placeholder { color: var(--muted-foreground); }
.modal-badge {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 10px;
  background: var(--ps-primary-60); color: var(--ps-primary-700);
}
.modal-input-clear {
  width: 20px; height: 20px;
  border: none; background: var(--muted); color: var(--muted-foreground);
  border-radius: 50%; cursor: pointer;
  font-size: 13px; line-height: 1; padding: 0;
}
.modal-input-clear:hover { background: var(--ps-neutral-200, #d3d3d5); color: var(--foreground); }
.modal-combo-popover {
  position: absolute;
  top: 100%; left: 0; right: 0;
  margin-top: 4px;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15,19,51,0.12);
  padding: 4px;
  z-index: 5;
  max-height: 220px; overflow-y: auto;
}
.modal-combo-popover[hidden] { display: none; }
.modal-combo-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px; color: var(--foreground);
}
.modal-combo-item:hover, .modal-combo-item.active { background: var(--accent); }
.modal-combo-create { color: var(--primary); font-weight: 500; }
.modal-filter-summary {
  background: var(--ps-neutral-75, #f9f9fa);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px; color: var(--muted-foreground);
  line-height: 1.5;
  max-height: 96px; overflow-y: auto;
}
.modal-filter-summary strong { color: var(--foreground); font-weight: 500; }
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 14px 22px 18px;
}
.btn-modal {
  padding: 8px 16px;
  border-radius: 8px;
  font: inherit; font-size: 13px; font-weight: 500;
  border: 1px solid var(--hairline);
  background: var(--popover); color: var(--foreground);
  cursor: pointer;
}
.btn-modal:hover { background: var(--muted); }
.btn-modal-primary {
  background: var(--primary); color: var(--primary-foreground);
  border-color: var(--primary);
  white-space: nowrap;
}
.btn-modal-primary:hover { background: #3e4ccc; border-color: #3e4ccc; }
.btn-modal-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* Source editor — multi-section configuration form for data-source
   filters (Hubspot / Salesforce / Data Enrichment). Width flexes to
   the widest sub-field's content, like the other popovers. */
.value-editor.ve-mode-source { padding: 14px 0 16px; gap: 0; min-width: 280px; }
.value-editor.ve-mode-source .ve-head { padding: 0 16px 12px; border-bottom: 1px solid var(--hairline); }
.ve-source-caption {
  padding: 8px 16px;
  font-size: 11px; color: var(--muted-foreground);
  font-family: 'IBM Plex Mono', monospace;
  border-bottom: 1px solid var(--hairline);
  background: var(--popover);
}
.ve-source {
  display: flex; flex-direction: column;
  max-height: 56vh; overflow-y: auto;
  padding: 14px 16px 4px;
}
.ve-source-section {
  display: flex; flex-direction: column; gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--hairline);
}
.ve-source-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 4px; }
.ve-source-section-title {
  font-size: 13px; font-weight: 600; color: var(--foreground);
  margin-bottom: 2px;
}
.ve-source-field { display: flex; flex-direction: column; gap: 6px; }
.ve-source-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted-foreground);
}
.ve-source-select {
  width: 100%; padding: 8px 28px 8px 12px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--popover);
  font: inherit; font-size: 13px; color: var(--foreground);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 10px) 50%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.ve-source-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ps-primary-75); }
.ve-source-select:has(option:checked[value=""]) { color: var(--muted-foreground); }
.ve-source-range {
  display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center;
}
.ve-source-rlabel { font-size: 12px; color: var(--muted-foreground); }
.ve-source-rinput {
  padding: 8px 10px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--popover);
  font: inherit; font-size: 13px; color: var(--foreground); outline: none;
}
.ve-source-rinput:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ps-primary-75); }

/* ========================================================================
   EMPTY PROMPT — empty state for content panel
   ======================================================================== */
/* ========================================================================
   EMPTY PROMPT — hero/empty state for content panel
   ======================================================================== */
.empty-prompt {
  background: transparent;
  border: 0;
  border-radius: 0;
  /* Bias the content toward the upper third of the work area. Pure
     vertical centering pushed the search field too low on tall
     viewports — the title + search bar were sitting around 60% down,
     which read as "buried" rather than the obvious first action. */
  padding: 10vh 40px 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 16px; text-align: center;
  flex: 1;
  min-height: 0;
}
.empty-prompt .ep-anim {
  width: 180px; height: 180px;
  margin-bottom: 4px;
  color: var(--primary);
}
.empty-prompt .ep-icon {
  width: 56px; height: 56px;
  background: var(--accent); color: var(--primary);
  border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.empty-prompt .ep-icon i { width: 28px; height: 28px; }
.empty-prompt .ep-title {
  font-size: 32px; font-weight: 600; color: var(--foreground);
  letter-spacing: -0.02em;
}
.empty-prompt .ep-body {
  font-size: 14px; color: var(--muted-foreground);
  max-width: 480px; line-height: 1.5;
}
.empty-prompt .ep-entity {
  margin: 8px 0 4px;
}
/* Tighten the gap specifically between the search bar and the entity
   picker — cancel ~half of the parent flex gap with a negative top. */
.empty-prompt .ep-search-slot + .ep-entity { margin-top: -8px; }
/* Search bar inside the hero gets more breathing room + max width. */
.empty-prompt .ep-search-slot {
  width: 100%; max-width: 560px;
  margin: 6px 0 4px;
}
.search-bar-wrap--hero { margin: 0; }
.empty-prompt .ep-divider {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted-foreground);
  display: flex; align-items: center; gap: 12px;
  margin-top: 4px;
}
.empty-prompt .ep-divider::before,
.empty-prompt .ep-divider::after {
  content: ''; height: 1px; width: 60px; background: var(--hairline);
}
.empty-prompt .ep-suggestions {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
}
.empty-prompt .ep-sugg {
  padding: 6px 14px; background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 999px; font-size: 13px; font-weight: 500;
  color: var(--foreground); cursor: pointer;
}
.empty-prompt .ep-sugg:hover { border-color: var(--primary); color: var(--primary); }

/* ========================================================================
   RESULTS COUNT + TABLE
   ======================================================================== */
.results-bar {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px;
}
.results-count {
  display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px; letter-spacing: 0.04em;
  color: var(--muted-foreground);
}
.results-count strong { color: var(--foreground); font-weight: 600; }
.results-actions { display: flex; gap: 8px; align-items: center; }
/* ========================================================================
   HEADER + TOOLBAR BUTTONS — from Pursuit button spec
   ======================================================================== */

/* Secondary CTA: used in the Global Header for actions like "Ask AI",
   "Save results". Lavender fill + white top stroke. */
.btn-secondary-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4286;
  text-align: center;
  background: var(--UI-elements-hollow);
  color: var(--secondary-foreground);
  border-radius: 8px;
  border: 1px solid #fff;
  border-top-width: 1.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.btn-secondary-cta:hover { opacity: 0.9; }
.btn-secondary-cta:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary-cta .icon-frame {
  display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; flex-shrink: 0;
}

/* Primary CTA — filled --primary background. Sits next to the
   secondary CTAs in the header for headline actions (e.g. Create Agent). */
.btn-primary-cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14px; font-weight: 500; line-height: 1.4286;
  background: var(--primary); color: var(--primary-foreground);
  border-radius: 8px; border: 0;
  cursor: pointer; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(20,20,23,0.06);
  transition: opacity 0.15s;
}
.btn-primary-cta:hover { opacity: 0.92; }
.btn-primary-cta:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary-cta .icon-frame {
  display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; flex-shrink: 0;
}
/* Create Agent is search-mode + signals-entity only. Detail/Inbox/Agent
   modes hide it via these rules; the entity gate is toggled by JS. */
.app-frame[data-mode="detail"] #create-agent-btn,
.app-frame[data-mode="inbox"] #create-agent-btn,
.app-frame[data-mode="agent"] #create-agent-btn { display: none; }

.btn-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  background: var(--UI-elements-hollow);
  color: var(--secondary-foreground);
  border-radius: 8px;
  border: 1px solid #fff;
  border-top-width: 1.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.btn-toolbar:hover { opacity: 0.9; }
.btn-toolbar .toolbar-icon { color: var(--muted-foreground); flex-shrink: 0; }

/* Split button (primary): main action + dropdown trigger. */
.btn-split {
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  overflow: hidden;
}
.btn-split-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 16px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4286;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
}
.btn-split-main .icon-frame {
  display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; flex-shrink: 0;
}
.btn-split-divider {
  width: 1px; height: 20px; opacity: 0.3; flex-shrink: 0;
}
.btn-split-trigger {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 12px; border: 0; cursor: pointer;
}
.btn-split.split-default .btn-split-main,
.btn-split.split-default .btn-split-trigger {
  background: var(--primary); color: var(--primary-foreground);
}
.btn-split.split-default .btn-split-divider {
  background: var(--primary-foreground);
}
.btn-split.split-default .btn-split-trigger:hover,
.btn-split.split-default .btn-split-main:hover { opacity: 0.92; }

/* Secondary variant — matches btn-secondary-cta fill; used for the
   header "Save / Update Saved Search" button. Collapses to a single
   button (no trigger half) when data-mode="single". */
.btn-split.btn-split-secondary {
  position: relative;
  border: 1px solid #fff;
  border-top-width: 1.5px;
  background: var(--UI-elements-hollow);
  transition: opacity 0.15s;
}
.btn-split.btn-split-secondary .btn-split-main,
.btn-split.btn-split-secondary .btn-split-trigger {
  background: transparent;
  color: var(--secondary-foreground);
}
.btn-split.btn-split-secondary .btn-split-main {
  padding: 8px 12px 8px 16px;
}
.btn-split.btn-split-secondary .btn-split-divider {
  background: var(--secondary-foreground); opacity: 0.22;
}
.btn-split.btn-split-secondary[data-mode="single"] {
  /* When there's no active saved search, hide the dropdown half. */
  padding-right: 0;
}
.btn-split.btn-split-secondary[data-mode="single"] .btn-split-divider,
.btn-split.btn-split-secondary[data-mode="single"] .btn-split-trigger {
  display: none;
}
.btn-split.btn-split-secondary[data-disabled="true"] { opacity: 0.5; }
.btn-split.btn-split-secondary[data-disabled="true"] .btn-split-main {
  cursor: not-allowed;
}
.btn-split.btn-split-secondary:not([data-disabled="true"]):hover { opacity: 0.9; }
.btn-split.btn-split-secondary .btn-split-main:disabled {
  /* Update Saved Search is disabled when filters match the saved bundle.
     The dropdown stays active so the user can still "Save this Search". */
  color: var(--muted-foreground);
  cursor: default;
}
.btn-split.btn-split-secondary .btn-split-main[disabled] .icon-frame { opacity: 0.55; }
.btn-split.btn-split-secondary[data-mode="split"][data-dirty="true"] {
  /* Subtle accent ring when there are unsaved edits to the loaded search. */
  box-shadow: 0 0 0 2px var(--ps-primary-75);
}
.btn-split:hover { opacity: 0.9; }

/* Card-style split button — secondary fill, used in the Signals
   results bar for "Save to Opportunities". Mirrors signal-card spec. */
.card-split-btn {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  border-radius: 8px;
  overflow: visible;
  border: 1px solid #fff;
  border-top-width: 1.5px;
}
.card-split-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 16px;
  background: var(--UI-elements-hollow);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14px; font-weight: 500;
  color: var(--secondary-foreground);
  border: none; cursor: pointer; white-space: nowrap;
  border-radius: 8px 0 0 8px;
}
.card-split-main:hover { filter: brightness(0.97); }
.card-split-main .icon-frame {
  display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; flex-shrink: 0;
}
.card-split-divider {
  width: 1px; align-self: center; height: 20px;
  background: var(--secondary-foreground); opacity: 0.3;
}
.card-split-trigger {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 12px;
  background: var(--UI-elements-hollow);
  color: var(--secondary-foreground);
  border: none; cursor: pointer;
  border-radius: 0 8px 8px 0;
}
.card-split-trigger:hover { filter: brightness(0.97); }
.card-split-main:disabled,
.card-split-trigger:disabled { opacity: 0.45; cursor: default; }
.card-split-main:disabled:hover,
.card-split-trigger:disabled:hover { filter: none; }

/* Primary variant — used when at least one row is selected. */
.card-split-btn--primary {
  border-color: var(--primary);
}
.card-split-btn--primary .card-split-main,
.card-split-btn--primary .card-split-trigger {
  background: var(--primary);
  color: var(--primary-foreground);
}
.card-split-btn--primary .card-split-divider {
  background: var(--primary-foreground);
  opacity: 0.35;
}
.card-split-btn--primary .card-split-main:hover,
.card-split-btn--primary .card-split-trigger:hover { background: #3e4ccc; filter: none; }
/* Disabled primary split button — the inner halves dim to 0.45 opacity, so a
   full-opacity blue container border would read as a hard ring around a washed
   fill. Drop back to the white lifted-surface edge while disabled so the whole
   control reads as one cohesive dimmed block. */
.card-split-btn--primary:has(> .card-split-main:disabled) { border-color: #fff; }

/* Dropdown menu for the split-button. Anchored bottom-right. */
.btn-split-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15,19,51,0.16), 0 2px 6px rgba(15,19,51,0.06);
  padding: 6px;
  z-index: 50;
  display: flex; flex-direction: column;
  animation: pop-in 120ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.btn-split-menu[hidden] { display: none; }
.btn-split-item {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border: 0; background: transparent;
  font: inherit; font-size: 13px; color: var(--foreground);
  border-radius: 6px; cursor: pointer; text-align: left;
}
.btn-split-item:hover { background: var(--accent); }
.btn-split-item i { color: var(--muted-foreground); }

/* "Save to worksheet" — primary button without the split-trigger half. */
.btn-save-worksheet {
  background: var(--primary);
  color: var(--primary-foreground);
  border-radius: 8px;
  padding: 8px 16px;
}
.btn-save-worksheet:hover { opacity: 0.9; }
.btn-save-worksheet:disabled,
.btn-save-worksheet[disabled] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.results-card {
  border-radius: 16px;
  background: var(--card);
  border: 1px solid #fff;
  border-top-width: 2px;
  border-left-width: 1.5px;
  border-right-width: 1.5px;
  box-shadow: 0 0 8px #EEF0FF;
  overflow: hidden;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table thead th {
  padding: 16px;
  text-align: left;
  font-size: 13px; font-weight: 600;
  color: var(--foreground);
  letter-spacing: 0;
  background: linear-gradient(180deg, #EEEEEF 49%, #f2f2f3 100%);
  border-bottom: 1px solid #fff;
  text-transform: none;
  font-family: 'IBM Plex Sans', sans-serif;
}
.data-table tbody td {
  padding: 16px;
  border-bottom: 1px solid #fff;
  vertical-align: top;
  font-size: 14px; font-weight: 400; color: var(--foreground);
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: rgba(77,95,255,0.03); }

/* Selection column — narrow, round checkbox with primary fill state. */
.data-table .cell-select {
  width: 32px;
  padding: 16px 0 16px 16px;
}
.cb-wrap {
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.data-table .cell-select .row-check {
  /* Hide the native checkbox; we render a custom round one. */
  position: absolute; opacity: 0; pointer-events: none;
  width: 0; height: 0;
}
.data-table .cell-select .cb-box {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1px solid var(--ps-neutral-200);
  background: var(--primary-foreground, #fcfcfd);
  cursor: pointer;
  transition: background 100ms, border-color 100ms;
}
.data-table .cell-select .cb-box:hover { border-color: var(--primary); }
.data-table .cell-select .cb-box.checked {
  background: var(--primary);
  border-color: var(--primary);
}
.data-table .cell-select .cb-box.indeterminate {
  background: var(--primary);
  border-color: var(--primary);
}
.data-table .cell-select .cb-box,
.data-table .cell-select .cb-box i,
.data-table .cell-select .cb-box svg {
  color: var(--primary-foreground);
  stroke: var(--primary-foreground);
}
.data-table .cell-select .cb-box {
  /* Override the inherited stroke for the box border itself. */
  stroke: none;
}

/* Primary text column (first data column after checkbox). Names link
   to a record detail view — always primary-colored. */
.data-table tbody td.cell-link {
  font-size: 14px; font-weight: 500;
  color: var(--primary);
  cursor: pointer;
}
.data-table tbody td.cell-link:hover { text-decoration: underline; }
/* "Associated account" links — smaller, primary-blue. */
.data-table tbody td.cell-link-secondary {
  font-size: 13px; font-weight: 400;
  color: var(--primary);
  cursor: pointer;
}
.data-table tbody td.cell-link-secondary:hover { text-decoration: underline; }
.data-table .cell-synopsis {
  color: var(--muted-foreground);
  font-size: 13px; font-weight: 400;
  line-height: 1.45;
  max-width: 420px;
  white-space: normal;
}
.data-table .cell-mono {
  font-family: 'IBM Plex Mono', monospace; font-size: 13px;
  white-space: nowrap;
  width: 1%;
  color: var(--foreground);
}
.data-table .cell-muted { color: var(--muted-foreground); }

/* Match score pill — appears in results when a Keywords filter is
   active. Score is the weighted hit count from keywordScore(). */
.data-table .cell-match { white-space: nowrap; width: 72px; }
.match-pill {
  display: inline-flex; align-items: baseline; gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--accent); color: var(--accent-foreground);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px; font-weight: 600;
}
.match-pill .mp-cap {
  font-size: 10px; font-weight: 500;
  color: var(--muted-foreground); letter-spacing: 0.04em;
}

/* Selection badge — sits in the results bar when any rows are selected. */
.selection-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--ps-primary-50, #f6f7ff);
  border: 1px solid var(--primary);
  border-radius: 8px;
  white-space: nowrap;
  font-size: 13px; font-weight: 600; color: var(--primary);
  flex-shrink: 0;
}
.selection-badge i { color: var(--primary); flex-shrink: 0; }

.empty-table {
  padding: 36px 24px; text-align: center;
  color: var(--muted-foreground); font-size: 13px;
}
.empty-table strong { display: block; font-size: 15px; color: var(--foreground); font-weight: 600; margin-bottom: 4px; }

/* ========================================================================
   POPOVER  (column picker, fired by "+ Add filter")
   ======================================================================== */
.popover {
  position: absolute; z-index: 50;
  background: var(--popover);
  border-radius: 10px;
  border: 1px solid var(--hairline);
  box-shadow: 0 16px 40px rgba(15,19,51,0.16);
  width: 320px; max-height: 380px;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.popover .pop-head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline);
  display: flex; align-items: center; gap: 8px;
}
.popover .pop-head input {
  flex: 1; border: 0; outline: none; background: transparent;
  font-family: inherit; font-size: 13px; color: var(--foreground);
}
.popover .pop-list {
  overflow-y: auto; padding: 6px 0;
}
.popover .pop-sec {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted-foreground);
  padding: 8px 14px 2px;
}
.popover .pop-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; cursor: pointer;
  border: 0; background: transparent; width: 100%; text-align: left;
  font-size: 13px; color: var(--foreground);
}
.popover .pop-item:hover { background: var(--muted); }
.popover .pop-item .pi-glyph {
  width: 22px; height: 22px; border-radius: 5px;
  background: #fff; border: 1px solid var(--hairline);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted-foreground);
}
.popover .pop-item .pi-glyph i { width: 13px; height: 13px; }
.popover .pop-item .pi-name { flex: 1; }
.popover .pop-item .pi-type {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; color: var(--muted-foreground);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.popover .pop-item.related .pi-name { font-style: italic; color: var(--muted-foreground); }

/* ========================================================================
   MISC
   ======================================================================== */
.dot {
  display: inline-block; width: 5px; height: 5px;
  background: var(--muted-foreground); border-radius: 999px;
  margin: 0 6px; vertical-align: middle; opacity: 0.5;
}
.scroll-y { overflow-y: auto; }

/* ========================================================================
   SMART SEARCH PARSE — popover variants for the AI-assisted parsing
   pipeline. Reuses .sp-* base classes; adds a distinct visual treatment
   so the AI affordance is clearly separate from lexical autocomplete.
   ======================================================================== */
.sp-item.sp-smart {
  background: linear-gradient(135deg, #f3f4ff 0%, #ecf0ff 100%);
  border: 1px solid var(--ps-primary-75);
  margin-bottom: 6px;
  padding: 10px 10px;
}
.sp-item.sp-smart.active {
  background: linear-gradient(135deg, #e8eaff 0%, #dde4ff 100%);
  box-shadow: 0 0 0 2px var(--ps-primary-75);
}
.sp-item.sp-smart .sp-icon {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.sp-item.sp-smart .sp-type {
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.06em;
}
.sp-item.sp-smart .sp-match strong { color: var(--foreground); font-weight: 600; }
.sp-item.sp-smart .sp-match .sp-q {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  background: rgba(77,95,255,0.10);
  color: var(--ps-primary-700);
  padding: 1px 5px;
  border-radius: 4px;
}
.sp-item.sp-smart .sp-trail { color: var(--primary); opacity: 1; font-weight: 600; }

/* Preview / parsing / error panels */
.sp-preview {
  display: flex; flex-direction: column;
  gap: 10px;
  padding: 4px 4px 6px;
}
.sp-preview-head {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 2px;
}
.sp-preview-glyph {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sp-preview-glyph.sp-error-glyph { background: var(--destructive); }
.sp-preview-glyph.sp-spin { animation: sp-spin 1.2s linear infinite; }
@keyframes sp-spin { to { transform: rotate(360deg); } }
.sp-preview-title {
  font-size: 14px; font-weight: 600; color: var(--foreground);
  flex: 1 1 auto; min-width: 0;
}
.sp-preview-source {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted-foreground);
  background: var(--muted);
  padding: 2px 7px;
  border-radius: 999px;
}
.sp-preview-list {
  display: flex; flex-direction: column; gap: 4px;
}
.sp-preview-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  background: var(--popover);
  border: 1px solid var(--hairline);
}
.sp-preview-item .sp-icon {
  background: var(--accent); color: var(--primary);
  border-color: var(--ps-primary-75);
}
.sp-preview-item .sp-body {
  flex: 1 1 auto; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.sp-preview-item .sp-body-row { display: flex; align-items: baseline; gap: 8px; }
.sp-preview-item .sp-type {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted-foreground);
}
.sp-preview-item .sp-match { color: var(--foreground); font-size: 13px; }
.sp-preview-item .sp-match strong { font-weight: 600; }
.sp-preview-item .sp-why {
  font-size: 11px; color: var(--muted-foreground);
  font-style: italic;
}
.sp-confidence {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; font-weight: 600;
  padding: 3px 7px;
  border-radius: 999px;
  flex-shrink: 0;
}
.sp-conf-high { background: #e4f4ec; color: #1f6b40; }
.sp-conf-mid  { background: #fff4dc; color: #8a5a00; }
.sp-conf-low  { background: var(--muted); color: var(--muted-foreground); }
.sp-preview-item.sp-pi-low { opacity: 0.85; border-style: dashed; }
.sp-preview-item.disabled {
  /* Mutual-exclusion: a parsed filter that can't be applied from
     the current toggle (e.g. a Signal hit while on Contacts).
     Stays in the list so the user sees what was detected, but the
     row reads as muted and won't commit on Apply. */
  opacity: 0.45;
  border-style: dashed;
  background: transparent;
}
.sp-preview-item.disabled .sp-icon {
  background: var(--muted); color: var(--muted-foreground);
  border-color: var(--hairline);
}
.sp-preview-item .sp-why-blocked {
  color: var(--destructive);
  font-style: normal;
  font-weight: 500;
}

.sp-parsing-body { display: flex; flex-direction: column; gap: 6px; padding: 2px 8px; }
.sp-skel {
  height: 36px; border-radius: 7px;
  background: linear-gradient(90deg, var(--muted) 0%, #f5f5f7 50%, var(--muted) 100%);
  background-size: 200% 100%;
  animation: sp-shimmer 1.3s ease-in-out infinite;
}
.sp-skel-short { width: 60%; }
@keyframes sp-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.sp-preview-actions {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px;
  padding: 4px 4px 0;
  border-top: 1px solid var(--hairline);
  margin-top: 2px;
  padding-top: 8px;
}
.sp-preview-cancel {
  background: transparent;
  border: 0;
  color: var(--muted-foreground);
  font: inherit; font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.sp-preview-cancel:hover { background: var(--muted); color: var(--foreground); }
.sp-preview-apply {
  background: var(--primary); color: var(--primary-foreground);
  border: 0; padding: 7px 14px;
  border-radius: 7px;
  font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
}
.sp-preview-apply:hover { background: #3e4ccc; }
.sp-preview-apply[disabled] { opacity: 0.5; cursor: not-allowed; }
.sp-preview-apply .sp-kbd {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  background: rgba(255,255,255,0.18);
  padding: 1px 6px;
  border-radius: 4px;
}

.sp-error-body {
  font-size: 12px; color: var(--destructive);
  background: #fff5f5;
  border: 1px solid #ffd9d9;
  border-radius: 7px;
  padding: 8px 10px;
  font-family: 'IBM Plex Mono', monospace;
  word-break: break-word;
}
.sp-error-hint {
  font-size: 11px; color: var(--muted-foreground);
  font-style: italic;
  padding: 0 4px;
}

/* ========================================================================
   SMART PARSE — in-page progress card. Replaces the empty hero while the
   LLM is parsing the user's query so the user is already in the results
   state by the time the filters land.
   ======================================================================== */
.smart-parsing-card {
  background: var(--card);
  border: 1px solid #fff;
  border-top-width: 2px;
  border-left-width: 1.5px;
  border-right-width: 1.5px;
  border-radius: 16px;
  box-shadow: 0 0 8px #EEF0FF;
  padding: 24px 28px;
  display: flex; flex-direction: column; gap: 18px;
}
.spc-head {
  display: flex; align-items: center; gap: 14px;
}
.spc-spinner {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.spc-spinner i { width: 22px; height: 22px; animation: sp-spin 1.2s linear infinite; }
.spc-text { flex: 1 1 auto; min-width: 0; }
.spc-title {
  font-size: 16px; font-weight: 600; color: var(--foreground);
  letter-spacing: -0.005em;
}
.spc-query {
  margin-top: 4px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--muted-foreground);
}
.spc-source {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--primary);
  background: var(--accent);
  padding: 4px 10px;
  border-radius: 999px;
  flex-shrink: 0;
}
.spc-steps {
  display: flex; flex-direction: column; gap: 6px;
}
.spc-step {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--popover);
  border: 1px solid var(--hairline);
}
.spc-step i { width: 16px; height: 16px; flex-shrink: 0; }
.spc-step .spc-step-detail {
  color: var(--muted-foreground);
  margin-left: auto;
  font-size: 11px;
  font-family: 'IBM Plex Mono', monospace;
}
.spc-step.done    { color: #1f6b40; background: #f0f8f3; border-color: #d4ebe0; }
.spc-step.done    i { color: #2c8f5a; }
.spc-step.active  { color: var(--primary); background: var(--accent); font-weight: 500; border-color: var(--ps-primary-75); }
.spc-step.active  i { color: var(--primary); animation: sp-spin 1.2s linear infinite; }
.spc-step.pending { color: var(--muted-foreground); }
.spc-step.pending i { color: var(--muted-foreground); }

.spc-skel-grid { display: flex; flex-direction: column; gap: 6px; }
.spc-skel-row {
  height: 56px;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--muted) 0%, #f5f5f7 50%, var(--muted) 100%);
  background-size: 200% 100%;
  animation: sp-shimmer 1.3s ease-in-out infinite;
}
.spc-cancel {
  align-self: flex-end;
  background: transparent;
  border: 0;
  color: var(--muted-foreground);
  font: inherit; font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}
.spc-cancel:hover { background: var(--muted); color: var(--foreground); }

/* Skeleton results table shown while smart parse is in flight. Sits
   inside an empty .results-card so it matches the real table's chrome
   exactly — when filters land and the real table renders, the swap is
   visually a content-only transition. */
.parsing-status {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px; letter-spacing: 0.04em;
  color: var(--muted-foreground);
}
.parsing-status strong { color: var(--foreground); font-weight: 600; }
.parsing-status em {
  font-style: normal;
  color: var(--ps-primary-700);
  background: var(--ps-primary-60);
  padding: 1px 5px; border-radius: 4px;
}
.parsing-skel-table {
  padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.parsing-skel-row {
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--muted) 0%, #f5f5f7 50%, var(--muted) 100%);
  background-size: 200% 100%;
  animation: sp-shimmer 1.3s ease-in-out infinite;
}
.parsing-skel-row.parsing-skel-head { height: 32px; opacity: 0.7; }


