/* Chat tags (frontend/tags/tags.js): chips in the chat header, search results and Settings. */

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 180px;
  height: 20px;
  padding: 0 7px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: none;
  color: var(--text-secondary);
  font: inherit;
  font-size: 11.5px;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.tag-chip--match { border-color: var(--accent-color); color: var(--text-primary); }
.tag-chip--pick,
.search-chat-tags .tag-chip,
.tag-pop__chips .tag-chip,
.tag-settings__chip { cursor: pointer; }
.tag-chip--pick:hover,
.search-chat-tags .tag-chip:hover,
.tag-pop__chips .tag-chip:hover,
.tag-settings__chip:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.tag-chip__count { margin-left: 4px; font-size: 10.5px; color: var(--text-muted); }
.tag-chip__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin: 0 -3px 0 3px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.tag-chip__remove:hover { background: var(--bg-tertiary); color: var(--text-primary); }

/* Header: an icon button after the title, before a team chat's participants; its popover holds the summary
   and tags. Fixed size: the title gives way, never the button. */
.tag-bar { display: flex; align-items: center; flex: none; margin-left: 4px; }
.tag-bar:empty { display: none; }
.tag-pop > summary { list-style: none; }
.tag-pop > summary::-webkit-details-marker { display: none; }
.tag-bar__trigger {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 6px;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
}
.tag-bar__trigger:hover,
.tag-pop[open] > .tag-bar__trigger { background: var(--bg-tertiary); color: var(--text-primary); }
.tag-bar__trigger > svg { width: 15px; height: 15px; flex: none; }

.tag-pop__panel {
  width: 300px;
  max-width: calc(100vw - 24px);
  padding: 10px;
  /* Same surface as the team chat popover (team-chat.css .team-pop__panel). */
  background: var(--chat-composer-popover-background, var(--bg-elevated));
  border: 1px solid var(--chat-composer-popover-border, var(--overlay-border));
  border-radius: var(--chat-composer-popover-radius, var(--radius-lg));
  box-shadow: var(--overlay-shadow);
}
.tag-pop__summary { margin-bottom: 8px; font-size: 13px; line-height: 1.45; color: var(--text-primary); }
.tag-pop__chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.tag-pop__chips .tag-chip { max-width: 100%; }
.tag-pop__none { font-size: 12px; color: var(--text-muted); }
.tag-pop__add { display: flex; gap: 6px; }
.tag-pop__input {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--input-bg, var(--bg-secondary));
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
}
.tag-pop__input:focus { outline: none; border-color: var(--accent-color); }
.tag-pop__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.tag-pop__hint { font-size: 11px; color: var(--text-muted); }
.tag-pop__retag {
  flex: none;
  padding: 2px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-secondary);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.tag-pop__retag:hover { background: var(--bg-tertiary); color: var(--text-primary); }

/* Search: a chat's summary and tags under its title; tag suggestions and the browse row above. */
.search-chat-about { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; flex-basis: 100%; min-width: 0; margin-top: 3px; }
.search-chat-summary { flex: 1 1 260px; min-width: 0; font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-chat-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.search-tags-row { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 8px 12px 4px; }
.search-tags-row__label { margin-right: 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.search-offer-slot:empty { display: none; }
.tag-offer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin: 8px 12px 4px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  font-size: 13px;
  color: var(--text-primary);
}
.tag-offer__text { flex: 1 1 280px; }
.tag-offer__actions { display: inline-flex; gap: 6px; }

/* Settings → General → Tags */
/* (Two classes: settings-page.css loads after this file.) */
.settings-row.settings-row--stack { flex-direction: column; align-items: stretch; gap: 10px; }
.settings-row--stack > .settings-row__text { flex: none; }
#tagsBackfillBtn[hidden] { display: none; }
.tag-settings__list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.tag-settings__row { display: flex; align-items: center; gap: 8px; min-height: 34px; }
.tag-settings__row .tag-settings__chip { max-width: 240px; }
.tag-settings__count { flex: 1; font-size: 12px; color: var(--text-muted); }
.tag-settings__row .settings-btn { height: 26px; font-size: 12px; }
.tag-settings__rename { display: flex; flex: 1; align-items: center; gap: 6px; }
.tag-settings__rename .settings-input { flex: 1; width: auto; height: 28px; }
.tag-settings__empty { font-size: 12px; color: var(--text-muted); }
#tagsModel code { padding: 1px 4px; border-radius: 4px; background: var(--bg-tertiary); font-size: 11.5px; word-break: break-all; }
