/* =========================================================================
   Live call — Real-time KB context block (inside alert cards)
   Styled as the v2 KnowledgeDock: surface fill, cyan (whisper) left edge.
   All colour comes from rta-theme.css via var(--rta-*).
   ========================================================================= */

.alert-kb {
  margin-top: 0.5rem;
  padding: 0.5rem 0.65rem;
  border-left: 2px solid var(--rta-whisper);
  background: var(--rta-surface);
  border-radius: 0 var(--rta-radius-sm) var(--rta-radius-sm) 0;
  font-size: 0.78rem;
  line-height: 1.5;
}

.alert-kb-title {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--rta-fg3);
  margin-bottom: 0.35rem;
  font-weight: 700;
}

/* Click target version of the title — KB section is collapsed by default
   and the title acts as the toggle. Mirrors .alert-kb-toggle so per-chunk
   and section-level toggles feel consistent. */
button.alert-kb-title.alert-kb-section-toggle {
  display: block;
  width: 100%;
  padding: 0;
  margin-bottom: 0;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: opacity var(--dur-micro) var(--ease);
}
button.alert-kb-title.alert-kb-section-toggle:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}
button.alert-kb-title.alert-kb-section-toggle:focus-visible {
  outline: 1px dashed var(--rta-accent);
  outline-offset: 2px;
}

.alert-kb-body { display: none; }
.alert-kb-body.expanded {
  display: block;
  margin-top: 0.35rem;
}

.alert-kb-chunk         { margin-bottom: 0.4rem; }
.alert-kb-chunk:last-child { margin-bottom: 0; }

.alert-kb-text { color: var(--rta-fg); }

/* Markdown-rendered KB content — scoped to prevent global leakage */
.alert-kb-text > *:first-child { margin-top: 0; }
.alert-kb-text > *:last-child  { margin-bottom: 0; }
.alert-kb-text p               { margin: 0.3rem 0; }
.alert-kb-text h1, .alert-kb-text h2,
.alert-kb-text h3, .alert-kb-text h4,
.alert-kb-text h5, .alert-kb-text h6 {
  font-size: 0.875rem; font-weight: 700;
  margin: 0.6rem 0 0.3rem; color: var(--rta-fg);
}
.alert-kb-text ul,
.alert-kb-text ol  { margin: 0.3rem 0 0.3rem 1.2rem; padding: 0; }
.alert-kb-text li  { margin: 0.1rem 0; }
.alert-kb-text code {
  font-family: var(--rta-font-mono);
  font-size: 0.85em;
  background: color-mix(in srgb, var(--rta-fg) 8%, transparent);
  padding: 1px 4px;
  border-radius: 3px;
}
.alert-kb-text pre {
  font-size: 0.78em;
  background: color-mix(in srgb, var(--rta-fg) 6%, transparent);
  padding: 0.5rem;
  border-radius: var(--rta-radius-xs);
  overflow-x: auto;
  margin: 0.4rem 0;
}
.alert-kb-text pre code { background: transparent; padding: 0; }
.alert-kb-text a {
  color: var(--rta-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.alert-kb-text blockquote {
  margin: 0.4rem 0;
  padding: 0.2rem 0.6rem;
  border-left: 2px solid var(--rta-rule-strong);
  color: var(--rta-fg2);
}
.alert-kb-text hr {
  border: none;
  border-top: 1px solid var(--rta-rule);
  margin: 0.6rem 0;
}
.alert-kb-text table {
  display: block; max-width: 100%;
  overflow-x: auto; border-collapse: collapse; margin: 0.4rem 0;
}
.alert-kb-text th,
.alert-kb-text td {
  border: 1px solid var(--rta-rule-strong);
  padding: 0.25rem 0.5rem;
  text-align: left;
  font-size: 0.75rem;
}
.alert-kb-text th { background: color-mix(in srgb, var(--rta-fg) 6%, transparent); font-weight: 700; }

.alert-kb-source {
  margin-top: 0.15rem;
  font-size: 0.68rem;
  color: var(--rta-fg3);
  font-style: italic;
}
.alert-kb-empty { color: var(--rta-fg3); font-style: italic; }

/* ---- LLM-summarized bullet lists -------------------------------------- */
.alert-kb-bullets,
.alert-display-bullets {
  margin: 0.2rem 0 0.3rem 0;
  padding-left: 1.05rem;
  font-size: 0.78rem;
  color: var(--rta-fg2);
  line-height: 1.5;
}
.alert-kb-bullets li,
.alert-display-bullets li { margin-bottom: 0.15rem; }
.alert-kb-bullets li:last-child,
.alert-display-bullets li:last-child { margin-bottom: 0; }

/* ---- Click-to-expand toggle ------------------------------------------- */
.alert-kb-toggle {
  display: block;
  width: 100%;
  padding: 0.15rem 0;
  margin-top: 0.25rem;
  background: none;
  border: none;
  color: var(--rta-accent);
  font: inherit;
  font-size: 0.78rem;
  text-align: left;
  cursor: pointer;
  transition: opacity var(--dur-micro) var(--ease);
}
.alert-kb-toggle:hover { text-decoration: underline; text-underline-offset: 2px; }
.alert-kb-toggle:focus-visible { outline: 1px dashed var(--rta-accent); outline-offset: 2px; }

.alert-kb-detail {
  display: none;
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px dashed color-mix(in srgb, var(--rta-whisper) 40%, transparent);
}
.alert-kb-detail.expanded { display: block; }
