/* AI 工作台（默认页 /，旧链接 /ai 同页）—— P0 只读：任务卡 → 结论卡 → 过程/回放。
   颜色沿用项目深色面板：底 #020617 / 边 #475569 / 主色 #38bdf8。 */

body[data-view="/"] {
  background: #0b1120;
  color: #e2e8f0;
}

#ai-app {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(56, 189, 248, .12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, .35);
}

.panel {
  background: #0f172a;
  border: 1px solid var(--ai-line);
  border-radius: 10px;
  padding: 16px;
}

.panel h2 {
  font-size: 14px;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.muted { color: #64748b; font-size: 12px; }
.hidden { display: none !important; }

label {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 10px;
}

input, select, textarea {
  width: 100%;
  box-sizing: border-box;
  margin-top: 6px;
  background: #020617;
  border: 1px solid #475569;
  border-radius: 6px;
  color: #e2e8f0;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
}

textarea {
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  line-height: 1.55;
  resize: vertical;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, .2);
}

.row { display: flex; gap: 12px; }
.grow { flex: 1; min-width: 0; }

button {
  cursor: pointer;
  border: 1px solid #475569;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 13px;
}

button:hover { border-color: #38bdf8; }

button.primary {
  background: #0284c7;
  border-color: #0284c7;
  color: #f8fafc;
  font-weight: 600;
}

button.ghost { background: transparent; color: #94a3b8; }
button:disabled { opacity: .5; cursor: not-allowed; }

.status { font-size: 12px; color: #94a3b8; }
.status.err { color: #f87171; }
.status.ok { color: #4ade80; }

/* ---------- 1 · 任务卡 ---------- */
.tasks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.task {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: #0b1120;
  border: 1px solid #1e293b;
  border-radius: 8px;
  color: inherit;
}

.task:hover { border-color: #475569; }

.task.active {
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, .35) inset;
  background: #0d1b2e;
}

.task-label { font-size: 14px; font-weight: 600; color: #e2e8f0; }
.task-desc { font-size: 12px; color: #94a3b8; line-height: 1.6; }
.task-foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }

.task-chip {
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid #334155;
  color: #94a3b8;
}

.task-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

label.inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  white-space: nowrap;
}

label.inline select { width: auto; margin-top: 0; }

details { margin-top: 12px; }
details summary { cursor: pointer; font-size: 12px; color: #94a3b8; }
details.adv { border-top: 1px solid #1e293b; padding-top: 10px; }
details.adv[open] summary { margin-bottom: 12px; }

details.cap > summary { font-size: 14px; color: #e2e8f0; font-weight: 600; }
details.proc > summary { color: #64748b; }

/* 右栏「策略采纳率」：与工具箱同级的折叠块，summary 用面板标题字号，副标题弱化 */
details.stat > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #e2e8f0;
  font-weight: 600;
  cursor: pointer;
}
details.stat > summary .muted { font-weight: 400; }
details.stat[open] > summary { margin-bottom: 10px; }

/* ---------- 2 · 结论 ---------- */
.result { display: flex; flex-direction: column; gap: 12px; }

.empty {
  margin: 0;
  padding: 22px 16px;
  text-align: center;
  color: #64748b;
  font-size: 13px;
  border: 1px solid var(--ai-line-soft);
  border-radius: 8px;
}

.result-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  border-bottom: 1px solid #1e293b;
}

.rh-goal { font-size: 14px; font-weight: 600; color: #e2e8f0; }
.rh-id { font-size: 11px; color: #475569; font-family: ui-monospace, Consolas, monospace; margin-left: auto; }

.warnbox {
  background: #1c1408;
  border: 1px solid #78350f;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: #fde68a;
}

.warnbox-ok {
  background: #0b1c14;
  border-color: #14532d;
  color: #86efac;
}

.warnbox-title { font-weight: 600; margin-bottom: 6px; }
.warnbox ul { margin: 0; padding-left: 18px; }
.warnbox li { line-height: 1.7; }
.warn-sec {
  display: inline-block;
  margin-right: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(251, 191, 36, .14);
  font-size: 10.5px;
}

.rcards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 12px;
}

.rcard {
  background: #0b1120;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 12px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rcard-head { display: flex; align-items: center; gap: 8px; }
.rcard-title { font-size: 13px; font-weight: 600; color: #cbd5e1; }
.rcard-head .verdict { margin-left: auto; }
.rcard-sub { font-size: 11px; color: #64748b; margin-top: 2px; }
.rcard-err { margin: 0; font-size: 12px; color: #f87171; }

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 8px;
}

.kpi {
  background: #020617;
  border: 1px solid #1e293b;
  border-radius: 6px;
  padding: 8px 10px;
}

.kpi-v { font-size: 19px; font-weight: 700; line-height: 1.2; color: #e2e8f0; }
.kpi-l { font-size: 11px; color: #64748b; margin-top: 2px; }

.bars { display: flex; flex-direction: column; gap: 5px; }

.bar-row {
  display: grid;
  grid-template-columns: minmax(60px, 96px) minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: center;
  font-size: 11.5px;
}

.bar-k { color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 7px; background: #020617; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: #38bdf8; border-radius: 999px; }
.bar-v { color: #cbd5e1; text-align: right; font-variant-numeric: tabular-nums; }

/* 策略采纳率（/ai 面板）：标签 + 采纳进度 + 「采纳/产出 · 百分比」 */
.adopt-rows { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }

.adopt-row {
  display: grid;
  grid-template-columns: minmax(64px, 110px) minmax(0, 1fr) 96px;
  gap: 8px;
  align-items: center;
  font-size: 11.5px;
}

.adopt-k { color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adopt-v { color: #cbd5e1; text-align: right; font-variant-numeric: tabular-nums; }
.bar-fill.zero { background: #334155; }

.mini-rows { display: flex; flex-direction: column; gap: 4px; }

.mini-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 10px;
  align-items: center;
  font-size: 11.5px;
  padding: 4px 0;
  border-bottom: 1px solid var(--ai-line-soft);
}

.mini-row:last-child { border-bottom: none; }
.mini-k { color: #cbd5e1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-v { color: #64748b; white-space: nowrap; }
.mini-ok { color: #4ade80; white-space: nowrap; }
.mini-ok.bad { color: #f87171; }

/* 批量产出报告（/ai）：SKU / 产品 / 策略 / 草稿 / 校验结论 */
.batch-row {
  display: grid;
  grid-template-columns: minmax(96px, 140px) minmax(0, 1.4fr) 72px 88px 96px;
  gap: 10px;
  align-items: center;
  font-size: 11.5px;
  padding: 5px 0;
  border-bottom: 1px solid var(--ai-line-soft);
}

.batch-row:last-child { border-bottom: none; }

/* 产品特写一条龙（/ai 顶部入口）：表单 + 结果表 + 人工审核清单 */
.mf-form {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto auto auto;
  gap: 10px;
  align-items: end;
  margin: 10px 0;
}

.mf-form .grow { min-width: 0; }

.mf-chs {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 12px;
  color: #cbd5e1;
}

.mf-chs label { display: flex; align-items: center; gap: 6px; }

.mf-rows {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--ai-line-soft);
  border-radius: 8px;
  overflow: hidden;
  margin: 10px 0;
}

.mf-row {
  display: grid;
  grid-template-columns: minmax(110px, 1.3fr) minmax(0, 1.6fr) 60px minmax(110px, 130px) 84px minmax(88px, 108px);
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  font-size: 12px;
  border-top: 1px solid var(--ai-line-soft);
}

.mf-row:first-child { border-top: 0; }
.mf-head { background: #111c33; color: #94a3b8; font-weight: 600; }
.mf-sku { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: #7dd3fc; }
.mf-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mf-todo {
  margin: 0 0 8px;
  padding-left: 18px;
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.8;
}

@media (max-width: 900px) {
  .mf-form { grid-template-columns: 1fr 1fr; }
  .mf-row { grid-template-columns: 1.2fr 1.6fr 60px 70px; }
  .mf-row span:nth-child(n + 5) { display: none; }
}

/* ImportYeti 采购商明细：5 列（公司 / 线索 / 邮箱 / 电话 / 状态），一行不换行、超长省略；
   线索与状态压到最小可用宽度，省下的宽度给公司 / 邮箱 / 电话（2026-11-25 用户口径） */
.iy-rows .mf-row {
  grid-template-columns: minmax(120px, 1.25fr) 76px minmax(120px, 1.4fr) minmax(140px, 1fr) 68px;
  gap: 10px;
  align-items: center;
}
.iy-rows .mf-row > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.iy-rows .mf-row > span:nth-child(3),
.iy-rows .mf-row > span:nth-child(4) {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #cbd5e1;
}
.iy-rows .mf-row > span:nth-child(5) { justify-self: start; }

/* 首轮触达结果表（潜客 / 评分 / 状态 / 说明）：潜客列再收 30%、状态列压到最小可用，
   省下的宽度全部给说明列；说明**完整换行显示不截断**（2026-11-16 用户口径）。 */
.ot-rows .mf-row {
  grid-template-columns: minmax(77px, 105px) 40px 56px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  line-height: 1.55;
}
.ot-rows .mf-row > span:nth-child(1) { overflow-wrap: anywhere; }
.ot-rows .mf-row > span:nth-child(2) { text-align: right; color: #cbd5e1; white-space: nowrap; }
.ot-rows .mf-row > span:nth-child(3) { justify-self: start; white-space: nowrap; padding: 0 4px; }
.ot-rows .ot-detail {
  color: #94a3b8;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

@media (max-width: 1100px) {
  .ot-rows .mf-row { grid-template-columns: minmax(68px, 92px) 36px 52px minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .iy-rows .mf-row {
    grid-template-columns: minmax(96px, 1.2fr) 64px minmax(96px, 1fr) minmax(110px, 1fr) 60px;
    gap: 8px;
  }
  .ot-rows .mf-row { grid-template-columns: minmax(68px, 1fr) 36px 52px; }
  .ot-rows .ot-detail { grid-column: 1 / -1; padding-left: 2px; }
}

.raw {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  background: #020617;
  border: 1px solid #1e293b;
  border-radius: 6px;
  padding: 8px;
  font-size: 11px;
  color: #94a3b8;
  font-family: ui-monospace, Consolas, monospace;
}

/* 结果栏折叠区（明细表 / 原始 JSON）：默认收起，结论与 KPI 保持在最上方 */
.res-fold {
  margin-top: 10px;
  background: #0b1120;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 8px 10px;
}

.res-fold > summary {
  font-size: 12px;
  color: #94a3b8;
  cursor: pointer;
  list-style: none;
}
.res-fold > summary::-webkit-details-marker { display: none; }

.res-fold > summary::before { content: "▸ "; color: #64748b; }
.res-fold[open] > summary::before { content: "▾ "; }
.res-fold[open] > summary { margin-bottom: 8px; }
.res-fold .raw { max-height: 260px; }
.res-fold .mf-rows { margin: 0; }
.res-fold .mf-todo { margin: 0; }

/* ---------- 过程轨迹 ---------- */
.trace { display: flex; flex-direction: column; margin-top: 8px; }

.step {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid #1e293b;
  align-items: start;
}

.step:last-child { border-bottom: none; }

.step-no { color: #64748b; font-size: 12px; padding-top: 2px; }
.step-tool { color: #38bdf8; font-size: 12px; font-family: ui-monospace, Consolas, monospace; }
.step-summary { font-size: 12px; color: #cbd5e1; margin-top: 4px; line-height: 1.6; word-break: break-all; }
.step-defect { font-size: 12px; color: #fbbf24; margin-top: 3px; }
.step-meta { font-size: 11px; color: #64748b; text-align: right; white-space: nowrap; }

.verdict { font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid; }
.verdict-pass, .verdict-done { color: #4ade80; border-color: rgba(74, 222, 128, .4); }
.verdict-retry, .verdict-escalate { color: #fbbf24; border-color: rgba(251, 191, 36, .4); }
.verdict-failed, .verdict-stopped { color: #f87171; border-color: rgba(248, 113, 113, .4); }
.verdict-error, .verdict-blocked { color: #a78bfa; border-color: rgba(167, 139, 250, .4); }

/* ---------- 系统能力 ---------- */
.tools { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; max-height: 340px; overflow: auto; }

.tool {
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 8px 10px;
  background: #0b1120;
}

.tool code { color: #38bdf8; font-size: 12px; }

.tool p {
  margin: 4px 0 0;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.6;
}

.chip {
  display: inline-block;
  margin-left: 8px;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid #334155;
  color: #94a3b8;
}

.chip.read { color: #4ade80; border-color: rgba(74, 222, 128, .35); }
.chip.external { color: #fbbf24; border-color: rgba(251, 191, 36, .35); }

.rubric-domain { margin: 10px 0 4px; font-size: 12px; color: #38bdf8; }
.rubric-item { font-size: 12px; color: #94a3b8; padding: 3px 0; line-height: 1.6; }

@media (max-width: 760px) {
  .rcards { grid-template-columns: 1fr; }
  .rh-id { margin-left: 0; width: 100%; }
}

/* ---------- P6 对话式左中右布局（2026-11-13） ---------- */
/* 左：任务导航 · 中：对话框 · 右：结果与日志 */

.ai-shell {
  display: grid;
  /* 左栏按比例加宽（280–360px），标题能显示更完整 */
  grid-template-columns: clamp(280px, 18vw, 360px) minmax(0, 1fr) minmax(380px, 480px);
  gap: 16px;
  align-items: stretch;
  /* 自适应屏幕高度：视口 - 固定导航(56) - #ai-app 上/下留白(12 + 12) */
  height: calc(100vh - 80px);
  min-height: 560px;
}

/* 深色结构线（2026-11-25 用户口径：去掉毛边、边缘更明显、中栏对话更显性）
   底色 #020617 下 #1e293b 的 1px 线几乎不可见 → 统一提亮（见 .trae/rules/dark-ui-borders.md） */
body[data-view="/"] {
  --ai-line: #46597c;         /* 栏 / 大面板边框 */
  --ai-line-soft: #3b4d66;    /* 面板内分隔线 / 气泡边框 */
  --ai-line-strong: #5b7ba6;  /* 中栏对话：焦点面板，比两侧更亮 */
}

.ai-nav, .ai-chat, .side-card {
  background: #0f172a;
  border-radius: 10px;
  box-shadow: none;           /* 去大面板阴影：边缘不再被晕影糊化 */
}

/* 左栏 / 中栏不再画外围框线（2026-11-25 用户口径：整体外框看着扎眼），
   仅保留底色差异让中栏对话与左栏区分；内部标题分隔线、气泡边线仍然保留 */
.ai-nav, .ai-chat {
  border: none;
}

.ai-chat {
  background: #0d1626;
}

.side-card {
  border: 1px solid var(--ai-line);
}

.ai-nav {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* 左栏「任务」与中栏「对话」标题同高：44px 内容区（中栏含 12px 上留白 = 56px），
   两者标题垂直中心一致，并为标题区后续按钮/筛选预留空间 */
.nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  box-sizing: border-box;
}
.nav-head h2, .chat-head h2 { font-size: 13px; margin: 0; color: #e2e8f0; }

/* 对话栏标题：与左栏「任务」标题同字号同色同高，状态文字靠右且超长省略 */
.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  height: 56px;
  box-sizing: border-box;
  padding: 12px 16px 0;
  padding-bottom: 10px;
}
.chat-head .status {
  min-width: 0;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-list {
  display: flex; flex-direction: column; gap: 6px;
  flex: 1 1 auto; min-height: 0; overflow: auto;
  /* 滚动条贴右：负外边距吃回 .ai-nav 的 12px 内边距（右缘距面板 4px），
     再用 padding-right 给任务卡与滚动条留 10px 空隙 */
  margin-right: -8px;
  padding-right: 10px;
}

.task-item {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  background: #0b1120;
  border: 1px solid var(--ai-line-soft);
  border-radius: 8px;
  color: inherit;
  cursor: pointer;
}

.task-item.active { border-color: #38bdf8; background: #0d1b2e; }

.ti-row { display: flex; align-items: flex-start; gap: 6px; }
.ti-icon {
  flex: 0 0 16px;
  width: 16px;
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
}
.ti-done { color: #34d399; }
.ti-running { color: #38bdf8; }
.ti-escalate { color: #fbbf24; }
.ti-need_input { color: #7dd3fc; }
.ti-failed { color: #f87171; }
.ti-stopped { color: #94a3b8; }
.ti-goal {
  font-size: 12px; color: #e2e8f0; line-height: 1.5; word-break: break-all;
  flex: 1 1 auto; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.ti-rename {
  flex: 0 0 auto; font-size: 12px; line-height: 1.5; color: #64748b;
  cursor: pointer; opacity: 0; transition: opacity .15s, color .15s;
}
.task-item:hover .ti-rename { opacity: 1; }
.ti-rename:hover { color: #38bdf8; }
.ti-goal-input {
  flex: 1 1 auto; min-width: 0; font-size: 12px; line-height: 1.5;
  background: #020617; border: 1px solid #475569; border-radius: 6px;
  color: #e2e8f0; padding: 2px 6px; outline: none;
}
.ti-goal-input:focus { border-color: #38bdf8; box-shadow: 0 0 0 2px rgba(56, 189, 248, .18); }
.ti-foot { padding-left: 22px; font-size: 11px; }

.ai-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  min-width: 0;
}

.chat-log {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.msg-meta { font-size: 11px; color: #64748b; }

.msg-body {
  font-size: 13px;
  line-height: 1.75;
  color: #e2e8f0;
  background: #0b1120;
  border: 1px solid var(--ai-line-soft);
  border-radius: 10px;
  padding: 9px 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg.user { align-items: flex-end; }
.msg.user .msg-body { background: #0c2b45; border-color: #0e7490; }

/* 执行中（边执行边输出）：实时步骤列表 + 计时，避免「假死 / 没发出去」误判 */
.msg.running .msg-body { border-color: #0e7490; }
.run-box { display: flex; flex-direction: column; gap: 8px; }
.run-head { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.run-toggle { margin-left: auto; font-size: 11px; color: #38bdf8; }
.run-events.collapsed { display: none; }
.typing {
  color: #38bdf8; letter-spacing: 2px; font-size: 10px;
  animation: typing-pulse 1.2s ease-in-out infinite;
}
.msg:not(.running) .typing { display: none; }
@keyframes typing-pulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
.run-timer { font-size: 11px; color: #7dd3fc; }
.run-events { display: flex; flex-direction: column; gap: 6px; }
.run-event { display: flex; gap: 8px; align-items: flex-start; }
.run-mark {
  flex: 0 0 12px; width: 12px; font-size: 11px; line-height: 1.7; color: #22c55e;
}
.run-event.stage .run-mark { color: #38bdf8; }
.run-event.bad .run-mark { color: #f87171; }
.run-text { min-width: 0; }
.run-thought { font-size: 12.5px; color: #cbd5e1; line-height: 1.6; }
.run-sub {
  font-size: 10.5px; color: #64748b;
  font-family: ui-monospace, Consolas, monospace;
}

/* 对话内的执行过程（思考 → 工具 → 结果） */
.msg-trace {
  margin-top: 8px;
  padding: 8px 10px;
  gap: 6px;
}
.mt-head {
  font-size: 11px; color: #64748b;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
}
.mt-head:hover .mt-title { color: #94a3b8; }
.mt-toggle { color: #38bdf8; }
.msg-trace.collapsed .mt-body { display: none; }
.mt-body { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.mt-row { border-top: 1px solid var(--ai-line-soft); padding-top: 6px; }
.mt-row:first-of-type { border-top: none; padding-top: 0; }
.mt-line { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: #cbd5e1; }
.mt-mark { color: #64748b; }
.mt-mark.ok { color: #34d399; }
.mt-mark.bad { color: #f87171; }
.mt-step { color: #64748b; }
.mt-tool { font-family: ui-monospace, Consolas, monospace; color: #7dd3fc; }
.mt-ms { margin-left: auto; color: #475569; font-size: 10.5px; }
.mt-thought { font-size: 11.5px; color: #e2e8f0; margin-top: 2px; }
.mt-sum {
  font-size: 11px; color: #94a3b8; margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* 执行计划 / 执行过程块：统一「实线 + 纯底色 + 无阴影」
   （2026-11-25 Mac 反馈：低对比边框 + 圆角在 macOS 上会渲染成发虚的阴影感、圆角断断续续，
    故改为与「用户消息气泡」同族的实色底 + 高对比实线边框，#1e3a5f 这类近底色一律不用） */
.plan-box, .msg-trace {
  background: #0f2233;
  border: 1px solid #2f7391;
  border-radius: 10px;
  box-shadow: none;
  -webkit-appearance: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plan-box {
  padding: 10px 12px;
}

.plan-title { font-size: 11px; color: #7dd3fc; letter-spacing: .04em; }
/* 执行计划默认折叠：标题行可点开（与「执行过程」同一交互） */
.plan-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; cursor: pointer; user-select: none;
}
.plan-toggle { font-size: 11px; color: #38bdf8; flex: none; }
.plan-box.collapsed .plan-step { display: none; }
.plan-step { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 8px; }

.plan-no {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #0b1120;
  border: 1px solid #38bdf8;
  color: #38bdf8;
  font-size: 10.5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.plan-t { font-size: 12.5px; color: #e2e8f0; }
.plan-sub { font-size: 11px; color: #94a3b8; margin-top: 1px; line-height: 1.6; }

/* 对话输入区（参照豆包：圆角卡片 + 底部一行「工具芯片 + 发送/急停」） */
.chat-compose {
  margin: 0 16px 14px;
  padding: 10px 12px 8px;
  background: #0b1120;
  border: 1px solid var(--ai-line-soft);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.chat-compose textarea {
  margin-top: 0;
  resize: none;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 2px 2px 4px;
  box-shadow: none;
}

.chat-compose textarea:focus {
  outline: none;
  border: none;
  box-shadow: none;
}

/* 底部一行：快捷项 + 急停/发送 同高对齐；放不下的快捷项收进「更多」上浮列表 */
.chat-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 0;
}

.chat-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
  overflow: hidden;
}

.chat-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; margin-left: auto; }

.chip {
  font-size: 11.5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: transparent;
  color: #7dd3fc;
  border: 1px solid #1e3a5f;
}

.chat-tools .chip { cursor: pointer; }
.chip:hover { border-color: #38bdf8; }

/* 高度统一 28px：快捷项 / 更多 / 急停 / 发送 在同一水平线上 */
.chat-tools .chip,
.chat-more-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  box-sizing: border-box;
  margin: 0; /* 覆盖通用 .chip 的 margin-left:8px，否则宽度计算与间距都不准 */
  padding: 0 11px;
  font-size: 11.5px;
  line-height: 1;
  white-space: nowrap;
}

.chat-bar .chat-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  box-sizing: border-box;
  padding: 0 14px;
  font-size: 12px;
  line-height: 1;
  border-radius: 8px;
}

.chat-tools .chip.is-hidden { display: none; }

.chat-more { position: relative; flex: 0 0 auto; }
.chat-more .chat-more-btn { color: #94a3b8; border-color: #334155; }
.chat-more.open .chat-more-btn { color: #7dd3fc; border-color: #38bdf8; }

/* 向上弹出的「更多」列表 */
.chat-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  display: none;
  flex-direction: column;
  gap: 2px;
  min-width: 210px;
  max-width: 320px;
  max-height: 280px;
  overflow: auto;
  padding: 6px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .5);
}

.chat-more.open .chat-menu { display: flex; }

.chat-menu-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12px;
  color: #cbd5e1;
  white-space: normal;
}

.chat-menu-item:hover { background: #16233a; border-color: #1e3a5f; color: #e2e8f0; }

/* 右栏：与页面同高，内容超出时在板块内垂直滚动 */
.ai-side {
  display: flex; flex-direction: column; gap: 14px; min-width: 0;
  height: 100%; min-height: 0; overflow-y: auto; padding-right: 4px;
}
.side-card { padding: 14px; }
.side-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.side-head h2 { font-size: 14px; margin: 0; }

.verdict-need_input { color: #7dd3fc; border-color: rgba(125, 211, 252, .4); }

/* 续跑原句：结论里直接给出原句，避免用户往上翻找 */
.resume-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 10px 0 4px; padding: 8px 10px; border-radius: 8px;
  background: #0b1220; border: 1px solid #334155;
}
.resume-bar .resume-label { color: #94a3b8; font-size: 12px; flex: none; }
.resume-bar .resume-text {
  color: #e2e8f0; font-size: 12px; flex: 1 1 240px;
  white-space: pre-wrap; word-break: break-all;
}
.resume-bar .resume-fill { flex: none; cursor: pointer; }


@media (max-width: 1240px) {
  .ai-shell { grid-template-columns: 240px minmax(0, 1fr); height: auto; }
  .ai-side { grid-column: 1 / -1; }
  .ai-nav, .ai-chat { height: 620px; }
  .ai-chat { min-height: 520px; }
}

@media (max-width: 860px) {
  .ai-shell { grid-template-columns: 1fr; }
  .ai-nav, .ai-chat { height: auto; }
  .ai-chat { height: 560px; }
}
