.search-overlay { z-index: 15; background: var(--bg); color: var(--text); }
/* .hidden lives in overlays.css for index.html, but the standalone search.html
   doesn't load that file; define it here so #searchPage hides on both hosts. */
.hidden { display: none !important; }
.search-page {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 14px;
  width: min(920px, 100%);
  height: 100dvh;
  margin: 0 auto;
  padding: 28px 24px 0;
}
/* Header with the "Back to chats" link, mirroring the system-prompts page. */
.search-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}
.search-header h1 { margin: 0; font-size: 22px; text-align: center; }
.search-header-spacer { justify-self: end; }
.search-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-self: start;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
.search-back:hover { border-color: var(--accent); }
.search-back svg { width: 18px; height: 18px; }
.search-field { position: relative; display: block; }
.search-field svg {
  position: absolute;
  left: 16px;
  top: 50%;
  width: 22px;
  height: 22px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}
.search-field input {
  width: 100%;
  padding: 16px 18px 16px 48px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  color: var(--text);
  font-size: 18px;
  box-shadow: 0 12px 30px rgba(0,0,0,.08);
}
.search-field input:focus { border-color: var(--accent); outline: 1px solid var(--accent); outline-offset: 0; }
.search-tags, .selected-tags, .tag-choice-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-filter, .tag-chip, .tag-choice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  line-height: 1.2;
}
.tag-filter, .tag-choice, .tag-chip.removable { cursor: pointer; }
.tag-filter.active, .tag-choice.active, .tag-chip {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  color: var(--text);
}
.search-results { min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 8px; margin: 0 -8px; }
/* The system-prompt picker reuses .prompt-card markup, so lay its results out
   in the same multi-column grid as the /#prompts page instead of a list. */
#systemPromptResults { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); align-content: start; gap: 12px; }
#systemPromptResults .search-empty { grid-column: 1 / -1; }
.search-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.search-result:hover, .search-result:focus-visible { border-color: var(--accent); outline: none; }
.search-result.active { box-shadow: inset 0 0 0 2px var(--accent), 0 1px 4px rgba(0,0,0,.06); }
.search-result-main { display: grid; min-width: 0; gap: 7px; }
.search-result-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.search-result-tags { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.search-result time { color: var(--muted); font-size: 13px; white-space: nowrap; }
.system-prompt-result-preview {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
}
.search-empty, .tag-empty { color: var(--muted); }
.tag-editor { display: grid; gap: 14px; }
.tag-editor label { display: grid; gap: 7px; color: var(--muted); }
.tag-add-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.tag-add-row button {
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  cursor: pointer;
}
.tag-add-row button.ready { border-color: var(--accent); background: var(--accent); color: #fff; }

