/* ============================================================
   view-chat.css · 对话工作台
   ============================================================ */

/* ---------------- 空态 ----------------
   对齐主流对话产品的做法：整块垂直居中，一句问候 + 一个固定宽度的输入框 + 一排建议。
   不再堆"常用技能""最近产出物"两个网格——那些内容在侧栏和「技能」模块里都有，
   摆在首屏只会把注意力从"我要做什么"上移开。 */
.chat-home {
  position: relative;
  min-height: 100%;
  display: flex;
  padding: 40px 28px 72px;
  overflow: auto;
}
/* 顶部一层极淡的 AI 品牌光晕，让欢迎区不至于是纯白一片 */
.chat-home::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 420px;
  background:
    radial-gradient(90% 100% at 50% 0%, rgba(99, 102, 241, .08) 0%, rgba(14, 165, 233, .05) 42%, rgba(255, 255, 255, 0) 76%);
  pointer-events: none;
}
/* margin:auto 让两个方向都居中；内容超出视口时也不会裁掉顶部 */
.chat-home__inner {
  position: relative;
  margin: auto;
  width: 100%;
  max-width: 820px;
}
/* 首屏品牌标识：只留图标，名称在侧栏已有 */
.chat-home__brand {
  display: flex; flex-direction: column;
  align-items: center;
  margin-bottom: 26px;
}
.chat-home__mark {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: var(--ai-grad);
  color: #fff;
  display: grid; place-items: center;
  font-size: 26px; font-weight: 700; letter-spacing: -.02em;
  box-shadow: 0 8px 22px rgba(99, 102, 241, .28);
  user-select: none;
}
.chat-home__sub {
  font-size: var(--fs-14); color: var(--text-3);
  margin: 10px auto 26px; max-width: 560px;
  line-height: var(--lh-base); text-align: center;
}
.chat-home .composer { max-width: none; }

/* 一排建议：点一下填进输入框 */
.chat-home__chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center;
  margin-top: 16px;
}
.chat-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: var(--fs-12); color: var(--text-2);
  transition: all .15s var(--ease);
}
.chat-chip:hover { border-color: var(--brand-300); background: var(--brand-50); color: var(--brand-700); }
.chat-chip > svg { color: var(--text-4); }
.chat-chip:hover > svg { color: var(--brand-500); }

.chat-home__foot {
  text-align: center;
  font-size: var(--fs-11); color: var(--text-4);
  margin-top: 26px;
  display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap;
}

/* ---------------- 输入区 ---------------- */
.composer { width: 100%; }
.composer__box {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xl);
  padding: 12px 12px 8px;
  box-shadow: var(--sh-2);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.composer__box:focus-within { border-color: var(--brand-400); box-shadow: var(--sh-3), var(--ring); }
.composer--compact .composer__box { border-radius: var(--r-lg); }

.composer__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.composer__chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 25px; padding: 0 6px 0 9px;
  border-radius: var(--r-full);
  background: var(--brand-50); color: var(--brand-700);
  border: 1px solid var(--brand-100);
  font-size: var(--fs-11); font-weight: 600;
}
.composer__chip-x {
  display: grid; place-items: center;
  width: 16px; height: 16px; border-radius: 50%;
  color: var(--brand-500); cursor: pointer;
}
.composer__chip-x:hover { background: var(--brand-100); color: var(--brand-800); }

.composer__ta {
  width: 100%; border: 0; outline: none; resize: none;
  font-size: var(--fs-14); line-height: var(--lh-base);
  color: var(--text); background: none;
  min-height: 30px; max-height: 200px;
  padding: 2px 2px 4px;
}
.composer__ta::placeholder { color: var(--text-4); }

.composer__bar {
  display: flex; align-items: center; gap: 2px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}
.composer__toggle {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 10px;
  border-radius: var(--r-full);
  border: 1px solid var(--line-strong);
  font-size: var(--fs-11); font-weight: 400; color: var(--text-3);
  transition: all .15s var(--ease);
  white-space: nowrap;
}
.composer__toggle:hover { border-color: var(--brand-300); color: var(--brand-700); }
.composer__toggle.is-on {
  background: var(--ai-grad-soft); border-color: #e0d6fd; color: var(--violet); font-weight: 600;
}
.composer__model {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: var(--fs-11); color: var(--text-4);
  padding: 3px 7px;
  white-space: nowrap; user-select: none;
}

/* 输入框里的工作目录：显示末尾两段，点击可切换 */
.composer__cwd {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; max-width: 220px;
  padding: 0 8px; margin-left: 3px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  font-size: var(--fs-11); color: var(--text-3);
  transition: background .15s var(--ease), color .15s var(--ease);
}
.composer__cwd:hover { background: var(--brand-50); color: var(--brand-700); }
.composer__cwd > svg { flex: none; }
.composer__cwd > svg:first-child { color: var(--text-4); }
.composer__cwd:hover > svg:first-child { color: var(--brand-500); }
.composer__cwd > svg:last-child { opacity: .7; }
.composer__cwd > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 弹出层里的说明与底部操作 */
.popover__note {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 9px; margin: 2px 2px 6px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: var(--fs-11); color: var(--text-4);
  line-height: 1.5;
}
.popover__note > svg { flex: none; }
.popover__foot {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  flex: none;
}
.popover__ico {
  width: 26px; height: 26px; flex: none;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-3);
}
.popover__item.is-active .popover__ico { background: #fff; color: var(--brand-600); box-shadow: var(--sh-1); }
.composer__send { margin-left: 6px; }
.composer__hint {
  display: flex; align-items: center; gap: 5px;
  font-size: var(--fs-11); color: var(--text-4);
  margin-top: 8px; padding-left: 4px;
}

/* ---------------- 弹出选择器 ---------------- */
.popover {
  position: fixed; z-index: 260;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-4);
  overflow: hidden;
  animation: popIn .18s var(--ease-out) both;
  max-height: 60vh;
  display: flex; flex-direction: column;
}
.popover__head {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-12); font-weight: 600; color: var(--text-2);
  background: var(--surface-2);
  flex: none;
}
.popover__body { overflow: auto; padding: 5px; }
.popover__item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 9px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .13s var(--ease);
}
.popover__item:hover { background: var(--surface-3); }
.popover__item.is-active { background: var(--brand-50); }
.popover__title { display: block; font-size: var(--fs-12); font-weight: 600; color: var(--text); }
.popover__desc { display: block; font-size: var(--fs-11); color: var(--text-4); margin-top: 1px; }

/* ---------------- 会话视图 ---------------- */
.chat-view { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-view__scroll { flex: 1; min-height: 0; overflow: auto; scroll-behavior: smooth; }
.chat-view__inner {
  padding: 24px 28px 32px;
  display: flex; flex-direction: column; gap: 22px;
}
.chat-view__composer {
  flex: none;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 12px 28px 14px;
}
/* 会话里的输入框固定宽度并居中：底部这条 bar 仍铺满，只有输入框本身有固定长度 */
.chat-view__composer .composer {
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}

/* AI 消息整体放宽 */
.msg--ai .msg__body { max-width: 100%; flex: 1; min-width: 0; }
.msg__bubble--ai {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm) var(--r-lg) var(--r-lg) var(--r-lg);
  font-size: var(--fs-14);
  line-height: var(--lh-loose);
  color: var(--text);
  padding: 14px 16px;
  box-shadow: var(--sh-1);
}
.msg__bubble--ai b { font-weight: 600; }
.msg__bubble--ai .hl-2 { background: var(--brand-50); color: var(--brand-800); border-radius: 3px; padding: 1px 4px; }

/* 用户消息附件 */
.msg__attach { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; justify-content: flex-end; }
.msg__file {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 11px 7px 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  max-width: 260px;
  text-align: left;
}
.msg__file-name { display: block; font-size: var(--fs-12); font-weight: 600; color: var(--text); }
.msg__file-size { display: block; font-size: var(--fs-11); color: var(--text-4); }

/* ---------------- 执行轨迹（思考 / 文本 / 工具 交错） ----------------
   一轮里模型会交替「想一想 → 说一句 → 调工具 → 再说一句 → 再调工具」，
   所以这里是一个有序序列，而不是"先思考后工具"两段固定结构。
   整段折叠成一个「执行过程」，结论单独渲染在下面、始终可见。 */
.ai-trace {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  margin-bottom: 10px;
  overflow: hidden;
}
.ai-trace__head {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 12px;
  font-size: var(--fs-12); font-weight: 600; color: var(--text-2);
  cursor: pointer; user-select: none;
}
.ai-trace__head:hover { background: var(--surface-3); }
.ai-trace__sum { font-weight: 400; color: var(--text-4); }
.ai-trace__caret { color: var(--text-4); transition: transform .2s var(--ease); }
.ai-trace.is-collapsed .ai-trace__caret { transform: rotate(-90deg); }
.ai-trace__body { border-top: 1px dashed var(--line); padding: 8px 8px 8px; }
.ai-trace.is-collapsed .ai-trace__body { display: none; }

/* 轨迹里的每个块，用一条细线串成时间顺序 */
.ai-trace__seg { position: relative; padding: 0 4px; }
.ai-trace__seg + .ai-trace__seg { margin-top: 4px; padding-top: 8px; border-top: 1px dashed var(--line); }
.ai-trace__text { font-size: var(--fs-12); line-height: 1.85; color: var(--text-2); }

/* 思考块：紫色调，和时间线上的其它块区分开；标题行可点击单独展开/收起 */
.ai-trace__seg--think {
  background: linear-gradient(180deg, #fbfaff 0%, #fdfcff 100%);
  border-radius: var(--r-sm);
  padding: 7px 10px 9px;
}
.ai-trace__seg--think + .ai-trace__seg { border-top: 0; }
.ai-trace__seg--think .ai-trace__text { color: #6b5f96; }
.ai-trace__tag {
  display: flex; align-items: center; gap: 5px;
  width: 100%;
  font-size: var(--fs-11); font-weight: 600; color: var(--violet);
  cursor: pointer; user-select: none;
}
.ai-trace__tag:hover { color: #5b3fd0; }
.ai-trace__secs { font-weight: 400; color: #a99bd6; }
.ai-trace__secs:empty { display: none; }
.ai-trace__caret { transition: transform .2s var(--ease); opacity: .75; }
.ai-trace__seg--think.is-collapsed .ai-trace__caret { transform: rotate(-90deg); }
.ai-trace__seg--think.is-collapsed .ai-trace__text { display: none; }
.ai-trace__seg--think.is-collapsed { padding-bottom: 7px; }
.ai-trace__seg--think .ai-trace__text.is-typing::after {
  content: ""; display: inline-block;
  width: 2px; height: 1em; background: var(--violet);
  vertical-align: -.14em; margin-left: 2px;
  animation: blink 1s steps(2) infinite;
}

/* 中间插话（模型边说边做的那几句） */
.ai-trace__seg--say .ai-trace__text { color: var(--text-2); }

/* 工具组：紧贴在一起，不额外加边框 */
.ai-trace__seg--tools { padding: 2px 0; }

/* 循环最终落到的那份产出 */
.trace-art {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  margin: 4px 0 6px 36px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--brand-200, #c7d9ff);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-1);
  transition: all .15s var(--ease);
}
.trace-art:hover { border-color: var(--brand-400); box-shadow: var(--sh-2); }
.trace-art__title { display: block; font-size: var(--fs-12); font-weight: 600; color: var(--text); }
.trace-art__path { display: block; font-size: var(--fs-11); color: var(--text-4); margin-top: 2px; }
.trace-art__go {
  flex: none; display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--fs-11); color: var(--brand-600); font-weight: 600;
}

.ai-tool {
  position: relative; overflow: hidden;
  display: flex; align-items: center;
  min-height: 28px; padding: 2px 8px;
  border-radius: var(--r-sm);
  transition: background .14s var(--ease);
}
.ai-tool[data-tool-toggle] { cursor: pointer; }
.ai-tool:hover { background: var(--surface-3); }

.ai-tool__mark {
  width: 14px; height: 14px; flex: none;
  border-radius: 50%;
  background: var(--success); color: #fff;
  display: grid; place-items: center;
  margin-right: 7px;
}
.ai-tool.is-running .ai-tool__mark { background: var(--brand-500); }
.ai-tool__ico { color: var(--text-4); flex: none; margin-right: 7px; }
.ai-tool__name { font-size: var(--fs-12); color: var(--text); flex: none; }

/* 标题与摘要之间的分隔：2px 圆点（对齐 DSH） */
.ai-tool__sep {
  width: 2px; height: 2px; border-radius: 1px;
  background: var(--text-4);
  margin: 0 8px; flex: none;
}
.ai-tool__summary {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: var(--fs-12); color: var(--text-3);
}
.ai-tool__dur {
  flex: none; margin-left: 8px;
  font-size: var(--fs-12); color: var(--text-4);
}
.ai-tool__caret {
  flex: none; margin-left: 4px; color: var(--text-4);
  transition: transform .18s var(--ease);
}
.ai-tool.is-open .ai-tool__caret { transform: rotate(90deg); }

/* 运行中：一道高光从左扫过整行 */
.ai-tool.is-running::after {
  content: "";
  position: absolute; top: 0; bottom: 0; left: 0;
  width: 300px;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, .9) 55%, transparent 100%);
  pointer-events: none;
  animation: toolSweep 2.6s ease-out infinite;
}
@keyframes toolSweep {
  0% { left: -300px; }
  90%, 100% { left: 100%; }
}

/* 展开后的 body */
.ai-tool__detail { display: none; padding: 2px 8px 8px 36px; }
.ai-tool.is-open + .ai-tool__detail { display: block; }
.ai-tool__line { display: flex; gap: 8px; font-size: var(--fs-12); line-height: 1.75; padding: 2px 0; }
.ai-tool__k { flex: none; width: 32px; color: var(--text-4); }
.ai-tool__line > span, .ai-tool__line > code { min-width: 0; color: var(--text-2); word-break: break-word; }
.ai-tool__line > code { font-family: var(--mono); font-size: var(--fs-11); }

/* ---------------- 引用来源 ---------------- */
.ai-cites {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  margin-top: 10px; padding: 9px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.ai-cites__label {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-11); font-weight: 600; color: var(--text-4);
  margin-right: 2px;
}
.ai-cite {
  display: inline-flex; align-items: center; gap: 6px;
  height: 25px; padding: 0 10px 0 5px;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  font-size: var(--fs-11); color: var(--text-2);
  transition: all .15s var(--ease);
}
.ai-cite:hover { border-color: var(--brand-400); background: var(--brand-50); color: var(--brand-700); }
.ai-cite__n {
  width: 15px; height: 15px; border-radius: var(--r-xs);
  background: var(--brand-600); color: #fff;
  font-size: 10px; font-weight: 700;
  display: grid; place-items: center; flex: none;
}

/* ---------------- 产出物卡 ---------------- */
.artifact-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.artifact-card {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--sh-1);
  transition: box-shadow .18s var(--ease), border-color .18s var(--ease);
}
.artifact-card:hover { border-color: var(--brand-300); box-shadow: var(--sh-3); }
.artifact-card__head { display: flex; align-items: center; gap: 11px; padding: 13px 14px 10px; }
.artifact-card__title { font-size: var(--fs-14); font-weight: 600; color: var(--text); }
.artifact-card__meta { font-size: var(--fs-11); color: var(--text-4); margin-top: 4px; }
.artifact-card__skills {
  display: flex; flex-wrap: wrap; gap: 5px;
  padding: 0 14px 12px;
}
.artifact-card__foot {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
}

/* 产出物落在哪个目录：把"文件写到哪"显式化 */
.artifact-card__path {
  display: flex; align-items: center; gap: 6px;
  padding: 0 14px 11px;
  font-size: var(--fs-11); color: var(--text-4);
  min-width: 0;
}
.artifact-card__path > svg { flex: none; color: var(--brand-500); }
.artifact-card__path .mono { font-size: var(--fs-11); }
.artifact-card__lock {
  display: inline-flex; align-items: center; gap: 3px;
  margin-left: auto; flex: none;
  padding: 1px 6px; border-radius: var(--r-xs);
  background: var(--success-bg); color: var(--success);
  font-size: var(--fs-11); font-weight: 600;
}

/* ---------------- 资料列表 ----------------
   检索回复在正文之后直接给一份可点的资料列表：类型块 + 文件名 + 出处 + 命中片段。
   铺满整行；每条整行可点（远大于 24×24），底部两个动作与上方 chips 是同一套机制。 */
.ai-lib {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-1);
  overflow: hidden;
  animation: libIn .3s var(--ease) both;
}
@keyframes libIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .ai-lib { animation: none; } }

.ai-lib__head {
  display: flex; align-items: center; flex-wrap: wrap; gap: 7px;
  padding: 11px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-12); color: var(--text-2);
}
.ai-lib__ico {
  width: 24px; height: 24px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: var(--brand-50); color: var(--brand-600);
}
.ai-lib__count { font-size: var(--fs-13); font-weight: 600; color: var(--text); }
.ai-lib__scope { color: var(--text-3); }
.ai-lib__sep { color: var(--text-4); }

.ai-lib__list { display: block; }
.ai-lib__row {
  display: flex; align-items: flex-start; gap: 11px;
  width: 100%; padding: 12px 14px;
  text-align: left; background: transparent;
  border-bottom: 1px solid var(--line);
  transition: background .15s var(--ease);
}
.ai-lib__row:last-child { border-bottom: 0; }
.ai-lib__row:hover { background: var(--brand-50); }
.ai-lib__main { flex: 1; min-width: 0; display: block; }
.ai-lib__name { display: block; font-size: var(--fs-13); font-weight: 600; color: var(--text); }
.ai-lib__meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  margin-top: 5px;
  font-size: var(--fs-12); color: var(--text-4);
}
.ai-lib__kb { color: var(--text-3); font-weight: 600; }
.ai-lib__quote {
  display: block; margin-top: 7px; padding: 7px 9px;
  border-radius: var(--r-sm);
  border-left: 2px solid var(--brand-300);
  background: var(--surface-2);
  font-size: var(--fs-12); line-height: 1.7;
  color: var(--text-2);
  word-break: break-word;
}
.ai-lib__quote mark {
  background: #fef3c7; color: var(--text);
  font-weight: 600; padding: 0 1px; border-radius: 2px;
}
.ai-lib__go { flex: none; margin-top: 3px; color: var(--text-4); }
.ai-lib__row:hover .ai-lib__go { color: var(--brand-600); }

.ai-lib__foot {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
}
.ai-lib__hint { margin-left: auto; font-size: var(--fs-12); color: var(--text-4); }

/* ---------------- 后续建议 ---------------- */
.ai-followups { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }

/* ---------------- 流式生成 ---------------- */
.spin {
  width: 9px; height: 9px; border-radius: 50%;
  border: 1.6px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  animation: spin .7s linear infinite;
  display: block;
}
/* 逐字输出时的光标 */
.msg__bubble--ai.is-typing::after {
  content: "";
  display: inline-block;
  width: 2px; height: 1em;
  background: var(--brand-500);
  vertical-align: -.14em;
  margin-left: 2px;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* 生成中：发送按钮变为停止 */
.btn--ai.is-stop {
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}
.btn--ai.is-stop:hover { background: var(--surface-3); filter: none; }

/* ---------------- 会话列表项 ---------------- */
.conv-item { align-items: flex-start; margin-bottom: 2px; }
.nav-item__ico--file { background: transparent !important; width: 30px; height: 30px; }
.nav-item__ico--file .ftile { width: 30px; height: 30px; font-size: 10px; border-radius: var(--r-sm); }

/* 「需要处理」入口 */
.inbox-entry {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 11px;
  border-radius: var(--r-md);
  background: var(--warn-bg);
  border: 1px solid var(--warn-bd);
  text-align: left;
  transition: background .15s var(--ease), box-shadow .15s var(--ease);
}
.inbox-entry:hover { background: #ffeccd; box-shadow: var(--sh-1); }
.inbox-entry__ico {
  width: 28px; height: 28px; flex: none;
  border-radius: var(--r-sm);
  background: #fff; color: var(--warn);
  display: grid; place-items: center;
}
.inbox-entry__main { flex: 1; min-width: 0; display: block; }
.inbox-entry__title { display: block; font-size: var(--fs-13); font-weight: 600; color: var(--text); }
.inbox-entry__sub { display: block; font-size: var(--fs-11); color: var(--warn); margin-top: 2px; }

/* 对话内的任务状态条：把"这个对话产生了什么任务与产出物"显式化 */
.conv-status {
  flex: none;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 28px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-12);
}
.conv-status__item {
  display: inline-flex; align-items: center; gap: 7px;
  height: 27px; padding: 0 11px;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-2);
  max-width: 100%;
  min-width: 0;
}
.conv-status__item b { color: var(--text); font-weight: 600; }
.conv-status__track { width: 62px; flex: none; }
.conv-status__item.is-running {
  border-color: var(--brand-200);
  background: var(--brand-50);
  color: var(--brand-700);
}
.conv-status__item.is-running .thinking i { background: var(--brand-500); }
.conv-status__item.is-pending {
  border-color: var(--warn-bd);
  background: var(--warn-bg);
  color: var(--warn);
  cursor: pointer;
}
.conv-status__item.is-pending:hover { background: #ffeccd; }
button.conv-status__item { cursor: pointer; }
button.conv-status__item:hover { border-color: var(--brand-300); color: var(--brand-700); }
.conv-status__go { display: inline-flex; align-items: center; gap: 1px; font-weight: 600; flex: none; }

.conv-model {
  font-size: var(--fs-11); color: var(--text-4);
  white-space: nowrap; flex: none;
  padding: 2px 7px; border-radius: var(--r-sm);
  background: var(--surface-3);
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 1280px) {
  .chat-home__inner { max-width: 760px; }
  .chat-view__inner { padding: 20px 22px 28px; }
  .chat-view__composer { padding: 10px 22px 12px; }
}

/* ============================================================
   参考文档模板
   使用在对话里（输入框工具栏的「参考」→ chip → 轨迹里多一步解析），
   管理在独立路由 templates。模板不进知识库、不参与检索。
   ============================================================ */

/* ---- 输入框上方的参考 chip：名字可能很长，超过就省略 ---- */
.composer__chip--ref > .truncate { max-width: 260px; }
.composer__chip--ref > svg { flex: none; }

/* ---- 用户消息上的参考标记：回看对话时知道"这份东西照着哪份模板写的" ---- */
.msg__ref {
  display: flex; align-items: center; gap: 6px;
  width: fit-content; max-width: 100%;
  margin-top: 8px; padding: 4px 11px;
  border-radius: var(--r-full);
  background: var(--brand-50); border: 1px solid var(--brand-100);
  font-size: var(--fs-12); font-weight: 600; color: var(--brand-700);
}
.msg__ref > svg { flex: none; }
.msg--me .msg__ref { margin-left: auto; }

/* ---- 选择器底部：三个动作在窄视口下换行，不撑出弹层 ---- */
.tpl-pop__foot { flex-wrap: wrap; }

/* ---- 管理页 ---- */
.tpls { display: flex; flex-direction: column; gap: 14px; }

.tpls__bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.tpls__search { height: 32px; width: 300px; max-width: 100%; flex: none; }
.tpls__bar .chip.is-on {
  background: var(--brand-50); border-color: var(--brand-300); color: var(--brand-700); font-weight: 600;
}
.tpls__count { font-size: var(--fs-12); color: var(--text-3); white-space: nowrap; }
.tpls__count b { font-weight: 600; color: var(--text); }

.tpls__list { display: flex; flex-direction: column; gap: 10px; }

.tpl-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.tpl-row:hover { border-color: var(--brand-300); box-shadow: var(--sh-2); }
.tpl-row.is-open { border-color: var(--brand-300); box-shadow: var(--sh-2); }
.tpl-row__main { display: flex; align-items: center; gap: 12px; flex: 1 1 340px; min-width: 0; }
.tpl-row__tile { flex: none; display: grid; place-items: center; }
.tpl-row__info { min-width: 0; flex: 1; }
.tpl-row__name {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: var(--fs-14); font-weight: 600; color: var(--text);
}
.tpl-row__meta {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  margin-top: 4px;
  font-size: var(--fs-12); color: var(--text-4);
}
.tpl-row__type { color: var(--text-3); font-weight: 600; }
.tpl-row__acts { display: flex; align-items: center; gap: 8px; flex: none; }

/* ---- 解析出的画像：章节骨架 + 字段 + 格式 + 措辞 + 详略 ---- */
.tpl-profile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 18px 24px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--brand-100);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}
.tpl-profile__col { min-width: 0; }
.tpl-profile__head {
  display: flex; align-items: center; gap: 6px;
  margin: 14px 0 6px;
  font-size: var(--fs-12); font-weight: 600; color: var(--text-2);
}
.tpl-profile__col > .tpl-profile__head:first-child { margin-top: 0; }
.tpl-profile__head > svg { color: var(--brand-500); flex: none; }
.tpl-profile__n { font-weight: 400; color: var(--text-4); }
.tpl-profile__secs {
  margin: 0; padding-left: 20px;
  display: flex; flex-direction: column; gap: 5px;
  font-size: var(--fs-12); color: var(--text-2); line-height: 1.6;
}
.tpl-profile__secs li::marker { color: var(--brand-400); font-weight: 600; }
.tpl-profile__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tpl-profile__text { font-size: var(--fs-12); color: var(--text-2); line-height: 1.7; }
.tpl-profile__foot {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
}
.tpl-profile__src {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  font-size: var(--fs-12); color: var(--text-4);
}
.tpl-profile__src > svg { flex: none; }

.tpls__empty { padding: 48px 24px; }
.tpls__empty .empty__desc { max-width: 460px; }
/* .empty 自带 display:flex，会盖掉 [hidden] 的 UA 规则，这里补一条 */
.tpls__empty[hidden] { display: none; }

@media (max-width: 1080px) {
  .tpl-profile { grid-template-columns: minmax(0, 1fr); }
  .tpls__search { width: 100%; }
}
