/* 站内对话 Agent 页面的样式（独立资产，随 AGENT_CHAT.css 一起指纹化发布）。
 *
 * 为什么单独一个文件而不是并进 research-styles.css
 * ----------------------------------------------
 * research-styles.css 是**切片源**（style-src/*.css 才是可编辑的切片），
 * 往里加东西要重切、要重算 manifest。这里是全新页面的样式，单独成文件
 * 改动面最小，也更好回滚。
 *
 * 颜色沿用站点的 --yan-* 变量；变量缺失时给回退值，保证在
 * 经典版（classic-overrides.css）与 Clear 版都能读。
 */

.agent-chat-card {
  display: flex;
  flex-direction: column;
  min-height: 68vh;
}

.agent-chat-card .card-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.agent-chat-card .card-header .agent-chat-title {
  font-weight: 600;
}

.agent-chat-model-badge {
  background: var(--yan-primary-subtle, #e8eefc);
  color: var(--yan-primary, #1f4fd8);
  border: 1px solid var(--yan-primary-subtle, #c7d7f7);
  font-weight: 600;
}

.agent-chat-body {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  flex: 1 1 auto;
  min-height: 0;
}

/* ── 左侧栏：项目 + 对话（2026-10-30 用户诉求「把项目和对话放在左侧，
 *    同时可以折叠」）─────────────────────────────────────────────────
 *
 * 为什么不用 Bootstrap 栅格（col-lg-3 / col-lg-9）：
 *
 * 1. **窄屏退化**。col-lg-* 只在 ≥992px 才并排，更窄的窗口（笔记本分屏、
 *    平板、2x 屏的 960 CSS px）会退化成上下堆叠 —— 项目树压在对话上面，
 *    对话区被推到屏幕外。
 * 2. **被内容撑宽**。Bootstrap 5 的 col 是 ``flex: 0 0 auto; width: 25%``，
 *    **没有 max-width**（Bootstrap 4 有）。flex item 的 ``min-width: auto``
 *    让长对话内容（长表格 / 长 URL）成为最小宽度基准 —— 实测 1600px 视口下
 *    侧栏被撑到 1323px（应为 331px），对话区被挤到下一行。
 *
 * 所以这里自管 flex：侧栏固定宽度、可折叠；主区 ``min-width: 0`` 允许收缩，
 * 对话内容自己在内部滚动，不再撑破外层。
 */
.agent-chat-layout {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
  gap: 0;
}

.agent-chat-side {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  flex: 0 0 268px;
  width: 268px;
  min-width: 0;
  max-width: 268px;
  padding-right: .65rem;
  border-right: 1px solid var(--yan-border, #e2e8f0);
  overflow: hidden auto;
}

/* 折叠态：侧栏收成 0 宽，展开按钮贴在左边缘。 */
.agent-chat-layout.is-collapsed .agent-chat-side {
  flex-basis: 0;
  width: 0;
  max-width: 0;
  padding-right: 0;
  border-right: 0;
  overflow: hidden;
}

.agent-chat-layout.is-collapsed .agent-chat-side__edge {
  display: inline-flex;
}

.agent-chat-side__edge {
  display: none;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: center;
  width: 1.4rem;
  margin-left: .15rem;
  padding: .35rem 0;
  border: 1px solid var(--yan-border, #e2e8f0);
  border-radius: .4rem;
  background: transparent;
  color: var(--yan-muted, #64748b);
  cursor: pointer;
  font: inherit;
  line-height: 1;
}

.agent-chat-side__edge:hover {
  background: rgba(31, 79, 216, .08);
  color: var(--yan-primary, #1f4fd8);
}

.agent-chat-main {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  flex: 1 1 auto;
  min-width: 0;
  padding-left: .65rem;
}

.agent-chat-layout.is-collapsed .agent-chat-main {
  padding-left: 0;
}

.agent-chat-side {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.agent-chat-side__label {
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--yan-muted, #64748b);
  font-weight: 700;
}

.agent-chat-side__empty {
  font-size: .82rem;
  color: var(--yan-muted, #64748b);
  padding: .5rem .25rem;
}

.agent-chat-session-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  /* 在左侧栏里滚动（外层 .agent-chat-project-tree 已经是滚动容器）。 */
  max-height: none;
  overflow: visible;
}

.agent-chat-session {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
  width: 100%;
  padding: .35rem .5rem;
  border: 1px solid transparent;
  border-radius: .45rem;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.agent-chat-session:hover {
  background: rgba(31, 79, 216, .07);
}

.agent-chat-session.is-active {
  background: var(--yan-primary, #1f4fd8);
  color: #fff;
}

.agent-chat-session__title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .84rem;
}

.agent-chat-session__time {
  font-size: .7rem;
  opacity: .7;
  flex: 0 0 auto;
}

/* ── 项目树（DeepSeek Harness 式：左侧一列项目，展开是它的对话）──────
 *
 * 原来是「项目下拉框 + 会话列表」两段。下拉框只能选一个项目，看不见
 * 「我有哪些项目、每个项目里有哪些对话」，也没有新建项目的地方。
 * 改成树：项目是节点，对话挂在项目下；没有归属的对话进「未归档对话」。
 */
.agent-chat-side__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.agent-chat-side__action {
  border: 1px solid transparent;
  background: transparent;
  color: var(--yan-muted, #64748b);
  border-radius: .4rem;
  padding: .1rem .3rem;
  cursor: pointer;
  font: inherit;
  line-height: 1;
}

.agent-chat-side__action:hover {
  background: rgba(31, 79, 216, .08);
  color: var(--yan-primary, #1f4fd8);
}

.agent-chat-project-tree {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  /* 侧栏自己滚动（不再给固定 vh —— 侧栏高度由布局决定）。 */
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.agent-chat-project {
  border-radius: .5rem;
}

.agent-chat-project.is-active > .agent-chat-project__row {
  background: rgba(31, 79, 216, .09);
}

.agent-chat-project__row {
  display: flex;
  align-items: center;
  gap: .3rem;
  padding: .3rem .25rem;
  border-radius: .45rem;
}

.agent-chat-project__row:hover {
  background: rgba(31, 79, 216, .05);
}

.agent-chat-project__toggle {
  flex: 0 0 auto;
  width: 1.1rem;
  border: 0;
  background: transparent;
  color: var(--yan-muted, #64748b);
  cursor: pointer;
  font: inherit;
  line-height: 1;
  padding: 0;
}

.agent-chat-project__title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-size: .86rem;
  font-weight: 600;
  padding: 0;
}

.agent-chat-project__count {
  flex: 0 0 auto;
  font-size: .7rem;
  color: var(--yan-muted, #64748b);
}

.agent-chat-project__more {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--yan-muted, #64748b);
  cursor: pointer;
  font: inherit;
  line-height: 1;
  padding: 0 .2rem;
  border-radius: .3rem;
}

.agent-chat-project__more:hover {
  background: rgba(31, 79, 216, .12);
  color: var(--yan-primary, #1f4fd8);
}

.agent-chat-project__sessions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: .1rem 0 .35rem .9rem;
  padding-left: .5rem;
  border-left: 1px solid var(--yan-border, #e2e8f0);
}

.agent-chat-project.is-collapsed .agent-chat-project__sessions {
  display: none;
}

.agent-chat-project--loose .agent-chat-project__title {
  font-weight: 500;
  opacity: .85;
}

.agent-chat-project__editor {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding: .35rem;
  border: 1px solid var(--yan-border, #e2e8f0);
  border-radius: .5rem;
  background: rgba(31, 79, 216, .04);
}

.agent-chat-project__editor-actions {
  display: flex;
  gap: .35rem;
}

.agent-chat-project-menu {
  position: absolute;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  min-width: 8.5rem;
  padding: .25rem;
  border: 1px solid var(--yan-border, #e2e8f0);
  border-radius: .5rem;
  background: #fff;
  box-shadow: 0 .5rem 1.2rem rgba(15, 23, 42, .16);
}

.agent-chat-project-menu__item {
  border: 0;
  background: transparent;
  text-align: left;
  padding: .35rem .55rem;
  border-radius: .35rem;
  cursor: pointer;
  font: inherit;
  font-size: .84rem;
  color: inherit;
}

.agent-chat-project-menu__item:hover {
  background: rgba(31, 79, 216, .08);
}

.agent-chat-project-menu__item--danger {
  color: #b42318;
}

.agent-chat-project-menu__item--danger:hover {
  background: rgba(180, 35, 24, .08);
}

.agent-chat-log {
  flex: 1 1 auto;
  min-height: 18rem;
  max-height: 56vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  padding: .5rem;
  border: 1px solid var(--yan-border, #e2e8f0);
  border-radius: .6rem;
  background: var(--yan-surface, #f8fafc);
}

.agent-chat-log.is-dragging {
  outline: 2px dashed var(--yan-primary, #1f4fd8);
  outline-offset: -4px;
}

.agent-chat-empty {
  margin: auto;
  max-width: 34rem;
  text-align: center;
  color: var(--yan-muted, #64748b);
}

.agent-chat-empty__title {
  font-weight: 700;
  color: var(--yan-text, #0f172a);
  margin-bottom: .35rem;
}

.agent-chat-empty__text {
  font-size: .86rem;
  line-height: 1.6;
}

.agent-chat-empty__hint {
  font-size: .8rem;
  margin-top: .5rem;
}

.agent-chat-msg {
  max-width: 92%;
}

.agent-chat-msg--user {
  align-self: flex-end;
}

.agent-chat-msg--assistant,
.agent-chat-msg--system {
  align-self: flex-start;
}

.agent-chat-msg--tool {
  align-self: flex-start;
  max-width: 100%;
  width: 100%;
}

.agent-chat-bubble {
  padding: .55rem .75rem;
  border-radius: .7rem;
  border: 1px solid var(--yan-border, #e2e8f0);
  background: #fff;
  font-size: .88rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.agent-chat-msg--user .agent-chat-bubble {
  background: var(--yan-primary, #1f4fd8);
  border-color: var(--yan-primary, #1f4fd8);
  color: #fff;
}

.agent-chat-bubble__meta {
  font-size: .7rem;
  color: var(--yan-muted, #64748b);
  margin-bottom: .25rem;
}

/* 复制按钮：贴在气泡右上角，默认低调，悬停/复制成功时再显形。 */
.agent-chat-bubble {
  position: relative;
}

.agent-chat-copy {
  position: absolute;
  top: .3rem;
  right: .3rem;
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: .35rem;
  background: transparent;
  color: var(--yan-muted, #64748b);
  font-size: .78rem;
  line-height: 1;
  cursor: pointer;
  opacity: .35;
  transition: opacity .15s ease, color .15s ease, background .15s ease;
}

.agent-chat-bubble:hover .agent-chat-copy,
.agent-chat-copy:focus-visible {
  opacity: 1;
}

.agent-chat-copy:hover {
  background: var(--yan-surface, #f1f5f9);
  color: var(--yan-primary, #1f4fd8);
}

.agent-chat-copy--done {
  opacity: 1;
  color: #16a34a;
  background: transparent;
  border-color: transparent;
}

.agent-chat-bubble__text--muted {
  color: var(--yan-muted, #64748b);
}

.agent-chat-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin: 0 .3rem .3rem 0;
  padding: .18rem .45rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, .06);
  font-size: .78rem;
}

.agent-chat-msg--user .agent-chat-attachment-chip {
  background: rgba(255, 255, 255, .22);
}

.agent-chat-attachment-chip__remove {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: .9rem;
  line-height: 1;
  padding: 0 .1rem;
}

.agent-chat-tool {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .55rem;
  border: 1px solid var(--yan-border, #e2e8f0);
  border-radius: .5rem;
  background: #fff;
  cursor: pointer;
  font-size: .82rem;
}

.agent-chat-tool--ok { color: #15803d; }
.agent-chat-tool--bad { color: #b91c1c; }

.agent-chat-tool__hint {
  margin-left: auto;
  font-size: .72rem;
  color: var(--yan-muted, #64748b);
}

.agent-chat-tool__body {
  margin: .4rem 0 0;
  padding: .5rem;
  max-height: 18rem;
  overflow: auto;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: .45rem;
  font-size: .74rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.agent-chat-typing {
  align-self: flex-start;
  font-size: .8rem;
  color: var(--yan-muted, #64748b);
  padding: .2rem .4rem;
}

.agent-chat-approval {
  border: 1px solid #f59e0b;
  background: #fffbeb;
  border-radius: .6rem;
  padding: .7rem .8rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.agent-chat-approval__head {
  display: flex;
  align-items: center;
  gap: .4rem;
  color: #92400e;
}

.agent-chat-approval__tool {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .82rem;
  font-weight: 700;
}

.agent-chat-approval__reason {
  font-size: .84rem;
  line-height: 1.55;
}

.agent-chat-approval__args {
  margin: 0;
  max-height: 12rem;
  overflow: auto;
  background: rgba(15, 23, 42, .05);
  padding: .45rem .55rem;
  border-radius: .4rem;
  font-size: .72rem;
  white-space: pre-wrap;
  word-break: break-all;
}

.agent-chat-approval__actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.agent-chat-composer {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.agent-chat-composer__attachments {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
}

.agent-chat-composer__row {
  display: flex;
  gap: .5rem;
  align-items: flex-end;
}

.agent-chat-composer__input {
  flex: 1 1 auto;
  min-height: 3.2rem;
  max-height: 12rem;
  resize: vertical;
}

.agent-chat-status {
  font-size: .8rem;
  color: var(--yan-muted, #64748b);
  min-height: 1.1rem;
}

.agent-chat-status--error {
  color: #b91c1c;
}

.agent-chat-hint {
  font-size: .74rem;
  color: var(--yan-muted, #64748b);
}

@media (max-width: 991.98px) {
  .agent-chat-card { min-height: 0; }
  .agent-chat-log { max-height: 52vh; }
  .agent-chat-msg { max-width: 100%; }
  /* 窄屏：侧栏窄一点，但仍然在左侧（不再退回上下堆叠）。 */
  .agent-chat-side { flex-basis: 210px; width: 210px; max-width: 210px; }
}

/* ── 会员闸门 ──────────────────────────────────────────────────────────
 * AI Agent 是会员功能。过不了闸门时整块对话区换成这张引导卡 ——
 * 会员与游客看到的是两个不同的界面，而不是"游客看到一堆报错"。
 */
.agent-chat-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  min-height: 16rem;
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--yan-muted, #64748b);
}

.agent-chat-gate__icon {
  font-size: 2.4rem;
  color: var(--yan-primary, #1f4fd8);
  opacity: .85;
}

.agent-chat-gate__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--yan-text, #1f2937);
}

.agent-chat-gate__text {
  margin: 0;
  max-width: 30rem;
  font-size: .88rem;
}

/* ── 账户级设置 ───────────────────────────────────────────────────────
 * 「扣款要不要问」是用户自己定的，所以它得摆在对话页顶部、点一下就能改。
 */
.agent-chat-settings {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  margin: 0 0 .75rem;
  padding: .85rem 1rem;
  border: 1px solid var(--yan-border, #dfe6f2);
  border-radius: .6rem;
  background: var(--yan-surface, #f8fafc);
}

.agent-chat-settings__row {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.agent-chat-settings__label {
  min-width: 4.5rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--yan-text, #1f2937);
}

.agent-chat-settings__row .form-select {
  width: auto;
  min-width: 14rem;
}

.agent-chat-settings__hint {
  font-size: .76rem;
  line-height: 1.5;
  color: var(--yan-muted, #64748b);
}

.agent-chat-settings__actions {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}

.agent-chat-settings__quota {
  flex: 1 1 auto;
  font-size: .78rem;
  color: var(--yan-muted, #64748b);
}

/* ── 2026-10-28：模型选择 / 正在思考 / 产出链接 / 会话重命名 ────────── */

.agent-chat-model-select {
  width: auto;
  min-width: 11rem;
  max-width: 18rem;
  font-size: .8rem;
  padding: .15rem 1.6rem .15rem .5rem;
}

/* 运行状态条：Agent 干活时一直显示，让人知道它在工作而不是卡住了。 */
.agent-chat-activity {
  display: flex;
  align-items: center;
  gap: .45rem;
  align-self: flex-start;
  padding: .3rem .65rem;
  border: 1px solid var(--yan-primary-subtle, #c7d7f7);
  border-radius: 999px;
  background: var(--yan-primary-subtle, #e8eefc);
  color: var(--yan-primary, #1f4fd8);
  font-size: .8rem;
}

.agent-chat-activity__dot {
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: currentColor;
  animation: agentChatPulse 1.1s ease-in-out infinite;
}

/* 运行状态条里的「停止」按钮。
   为什么用描边而不是实心：它是"中断"动作，不是"确认"动作 —— 放在一个
   正在跳动的状态条里，实心红底会让人以为出了错。 */
.agent-chat-activity__stop {
  margin-left: .15rem;
  padding: .1rem .5rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-size: .75rem;
  line-height: 1.4;
  cursor: pointer;
}

.agent-chat-activity__stop:hover {
  background: rgba(31, 79, 216, .12);
}

.agent-chat-activity__stop:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 1px;
}

@keyframes agentChatPulse {
  0%, 100% { opacity: .35; transform: scale(.8); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* 产出链接：报告页 / 任务跳转 */
.agent-chat-links {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .45rem;
}

.agent-chat-link {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .22rem .6rem;
  border: 1px solid var(--yan-primary-subtle, #c7d7f7);
  border-radius: 999px;
  background: var(--yan-primary-subtle, #e8eefc);
  color: var(--yan-primary, #1f4fd8);
  font-size: .78rem;
  font-weight: 600;
  text-decoration: none;
}

.agent-chat-link:hover {
  color: #fff;
  background: var(--yan-primary, #1f4fd8);
}

/* 会话重命名按钮：默认低调，hover 时出现。 */
.agent-chat-session__rename {
  flex: 0 0 auto;
  font-size: .72rem;
  opacity: .25;
  cursor: pointer;
  padding: 0 .15rem;
}

.agent-chat-session:hover .agent-chat-session__rename,
.agent-chat-session.is-active .agent-chat-session__rename {
  opacity: .85;
}

/* ── 2026-10-29：助手消息 Markdown / 工具摘要 / 产出链接卡片 ────────────
 *
 * 助手消息里存的是 **Markdown 源码**。以前前端直接当纯文本贴进气泡，用户
 * 看到的是满屏 "**当前状态**"、"|---|---|" 这种原始符号（用户抱怨"输出
 * 格式很乱"的主因）。现在气泡里承载一段轻量 Markdown 渲染出来的 HTML，
 * 配套样式在这里。
 */

/* Markdown 容器接管气泡的 pre-wrap，否则段落之间会多出一堆空行。 */
.agent-chat-bubble__md {
  white-space: normal;
  line-height: 1.7;
}

.agent-chat-bubble__md > :first-child {
  margin-top: 0;
}

.agent-chat-bubble__md > :last-child {
  margin-bottom: 0;
}

.agent-chat-md__p {
  margin: 0 0 .5rem;
}

/* 标题在气泡里要收敛：Markdown 的 h1~h6 原尺寸会把一行话撑成三行。 */
.agent-chat-bubble__md h1,
.agent-chat-bubble__md h2,
.agent-chat-bubble__md h3,
.agent-chat-bubble__md h4,
.agent-chat-bubble__md h5,
.agent-chat-bubble__md h6 {
  margin: .65rem 0 .3rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--yan-text, #0f172a);
}

.agent-chat-bubble__md h1 { font-size: 1.06rem; }
.agent-chat-bubble__md h2 { font-size: 1rem; }
.agent-chat-bubble__md h3 { font-size: .95rem; }
.agent-chat-bubble__md h4 { font-size: .92rem; }
.agent-chat-bubble__md h5 { font-size: .89rem; }
.agent-chat-bubble__md h6 { font-size: .86rem; }

.agent-chat-bubble__md ul,
.agent-chat-bubble__md ol {
  margin: .25rem 0 .5rem;
  padding-left: 1.2rem;
}

.agent-chat-bubble__md li {
  margin: .12rem 0;
}

.agent-chat-md__quote {
  margin: .4rem 0;
  padding: .3rem .6rem;
  border-left: 3px solid var(--yan-primary-subtle, #c7d7f7);
  border-radius: 0 .4rem .4rem 0;
  background: rgba(31, 79, 216, .05);
  color: var(--yan-muted, #475569);
}

.agent-chat-md__hr {
  border: 0;
  border-top: 1px solid var(--yan-border, #e2e8f0);
  margin: .6rem 0;
}

/* 围栏代码块：按原样显示，不做高亮。 */
.agent-chat-md__code {
  margin: .45rem 0;
  padding: .5rem .6rem;
  border-radius: .45rem;
  background: #0f172a;
  color: #e2e8f0;
  font-size: .74rem;
  line-height: 1.55;
  overflow: auto;
}

.agent-chat-md__code-inline {
  padding: .05rem .32rem;
  border-radius: .25rem;
  background: rgba(15, 23, 42, .07);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .86em;
  word-break: break-all;
}

/* 表格：外层包裹 div 好让它能横向滚动，而不是把气泡撑破。 */
.agent-chat-md__table-wrap {
  margin: .45rem 0;
  overflow-x: auto;
  border: 1px solid var(--yan-border, #e2e8f0);
  border-radius: .45rem;
}

.agent-chat-md__table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}

.agent-chat-md__table th,
.agent-chat-md__table td {
  padding: .32rem .55rem;
  border-bottom: 1px solid var(--yan-border, #e2e8f0);
  text-align: left;
  white-space: nowrap;
}

.agent-chat-md__table thead th {
  background: rgba(31, 79, 216, .07);
  font-weight: 600;
}

.agent-chat-md__table tbody tr:last-child td {
  border-bottom: 0;
}

.agent-chat-md__cell--right { text-align: right; }
.agent-chat-md__cell--center { text-align: center; }
.agent-chat-md__cell--left { text-align: left; }

.agent-chat-md__link {
  color: var(--yan-primary, #1f4fd8);
  font-weight: 600;
  text-decoration: underline;
  word-break: break-all;
}

/* ── 工具消息：摘要块 + 可展开的原始返回 ───────────────────────────── */
.agent-chat-tool__content {
  margin: .45rem 0 0;
}

.agent-chat-tool__summary {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: .45rem .55rem;
  border: 1px solid var(--yan-border, #e2e8f0);
  border-radius: .45rem;
  background: rgba(248, 250, 252, .9);
  font-size: .8rem;
}

.agent-chat-tool__row {
  display: flex;
  gap: .45rem;
  align-items: baseline;
}

.agent-chat-tool__key {
  flex: 0 0 auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .74rem;
  color: var(--yan-muted, #64748b);
}

.agent-chat-tool__value {
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-word;
}

.agent-chat-tool__link {
  color: var(--yan-primary, #1f4fd8);
  word-break: break-all;
}

.agent-chat-tool__raw {
  margin-top: .35rem;
}

.agent-chat-tool__raw-summary {
  cursor: pointer;
  font-size: .76rem;
  color: var(--yan-muted, #64748b);
}

.agent-chat-tool__raw-summary:hover {
  color: var(--yan-primary, #1f4fd8);
}

/* ── 产出链接卡片（报告页 / 任务跳转）──────────────────────────────── */
.agent-chat-links--card {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-top: .45rem;
  max-width: 100%;
}

.agent-chat-link-card {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  min-width: 13rem;
  padding: .45rem .65rem;
  border: 1px solid var(--yan-primary-subtle, #c7d7f7);
  border-radius: .55rem;
  background: var(--yan-primary-subtle, #e8eefc);
  color: inherit;
  text-decoration: none;
}

.agent-chat-link-card:hover {
  background: #fff;
  border-color: var(--yan-primary, #1f4fd8);
  box-shadow: 0 .2rem .6rem rgba(31, 79, 216, .14);
}

.agent-chat-link-card__title {
  font-size: .84rem;
  font-weight: 600;
  color: var(--yan-primary, #1f4fd8);
}

.agent-chat-link-card__url {
  font-size: .7rem;
  color: var(--yan-muted, #64748b);
  word-break: break-all;
}
