/* 儒创 · 智能体：菜单、对话窗、表单卡片、结果卡片、对话历史、我的形象（变量来自 style.css） */

/* ── 智能体菜单 ─────────────────────────────────────────── */
.sidebar { overflow-y: auto; gap: 10px; }
.nav-label { font-size: 12px; color: var(--muted); letter-spacing: 1px; padding: 4px 10px 0; font-weight: 600; }
.agent-nav { display: flex; flex-direction: column; gap: 2px; }
.agent-link {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 12px;
  background: transparent; color: var(--text); text-align: left; cursor: pointer; transition: background .15s;
}
.agent-link:hover { background: var(--chip); }
.agent-link.active { background: var(--primary-soft); }
.agent-link.active b { color: var(--primary-strong); }
.agent-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.agent-text b { font-size: 14px; }
.agent-text small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-text .lock { font-style: normal; font-size: 11px; }
.ag-avatar {
  flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 15px; font-family: STKaiti, KaiTi, "Kaiti SC", serif;
}
.ag-avatar.lg { width: 44px; height: 44px; font-size: 21px; border-radius: 13px; }
.ag-avatar.img { object-fit: cover; background: none; } /* 自定义图标：填满圆角方块，尺寸跟随 sm/lg */
.ws-group { border-top: 1px solid var(--border); padding-top: 6px; }
.ws-group > summary { cursor: pointer; list-style: none; padding: 6px 10px; }
.ws-group > summary::-webkit-details-marker { display: none; }
.ws-group > summary::after { content: " ▸"; }
.ws-group[open] > summary::after { content: " ▾"; }
.ws-group .step-link { padding: 7px 10px; }
.ws-group .step-num { width: 24px; height: 24px; font-size: 12px; }
.ws-group .step-text b { font-size: 14px; }
.ws-group .step-link + .step-link::before { left: 21px; top: -8px; height: 14px; }

/* ── 对话窗 ─────────────────────────────────────────────── */
body.in-agent .container { max-width: none; padding: 0; }
.agent-shell { display: grid; grid-template-columns: minmax(0, 1fr) 260px; height: 100vh; }
.chat { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--border); background: var(--card); }
.chat-head h2 { margin: 0; font-size: 18px; }
.chat-head p { margin: 0; font-size: 13px; }
.chat-head .ch-toggle { margin-left: auto; display: none; }
.chat-body { flex: 1; overflow-y: auto; padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 10px; align-items: flex-start; max-width: 860px; width: 100%; margin: 0 auto; }
.msg.user { justify-content: flex-end; }
.bubble {
  background: var(--card); border: 1px solid var(--border); border-radius: 4px 14px 14px 14px;
  padding: 10px 14px; max-width: 100%; min-width: 0; box-shadow: var(--shadow);
}
.msg.user .bubble { background: var(--primary); color: #fff; border-color: var(--primary); border-radius: 14px 4px 14px 14px; max-width: 75%; }
.bubble.form, .bubble.card { flex: 1; }
.bubble.error { border-color: color-mix(in srgb, var(--err) 40%, var(--border)); }
.bubble.progress { box-shadow: none; background: transparent; border-style: dashed; color: var(--muted); }
.progress.done { color: var(--ok); }
.spin {
  display: inline-block; width: 12px; height: 12px; border: 2px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: ag-spin 1s linear infinite; vertical-align: -1px;
}
@keyframes ag-spin { to { transform: rotate(360deg); } }
/* 分步进度：完成的划横线、当前的高亮转圈 */
.psteps ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.pstep { display: flex; align-items: center; gap: 8px; font-size: 13px; line-height: 1.5; }
.pstep > span { transition: color .2s; }
.pstep.active > span { color: var(--primary-strong); font-weight: 600; }
.pstep.done > span { color: var(--muted); text-decoration: line-through; }
.pstep .spin, .pstep .pdone { flex: none; }
.pstep .pdone { color: var(--ok); font-weight: 700; width: 12px; text-align: center; }
.pstep-sum { margin-top: 9px; padding-top: 8px; border-top: 1px dashed var(--border); font-size: 13px; font-weight: 600; color: var(--ok); }
.pstep-sum.failed { color: var(--warn); }
/* 图表/表格下方的「对你的用处·该怎么做」提示：用浅底+左色条+💡感，别让它灰到被忽略 */
.card-note { margin: 10px 0 0; font-size: 13px; line-height: 1.7; color: var(--text);
  background: var(--primary-soft); border-left: 3px solid var(--primary); border-radius: 0 8px 8px 0;
  padding: 8px 12px; }
.typing { display: flex; gap: 4px; padding: 14px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: ag-blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes ag-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.starters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip-btn { border: 1px solid var(--border); background: var(--chip); color: var(--text); border-radius: 20px; padding: 4px 12px; font-size: 13px; }
.chip-btn:hover { border-color: var(--primary); color: var(--primary-strong); }
.msg-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; display: block; }
.thumb.video-thumb { width: 160px; height: auto; max-height: 240px; background: #000; }
.action-note { margin-left: 8px; }
.thumb.sm { width: 22px; height: 22px; border-radius: 4px; display: inline-block; vertical-align: middle; }
.file-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--chip); color: var(--text); border-radius: 8px; padding: 2px 8px; font-size: 12px; }
.msg.user .file-chip { background: rgba(255, 255, 255, .2); color: #fff; }

/* 表单卡片 */
.ag-form h4, .rcard h4 { margin: 0 0 4px; font-size: 15px; }
.ag-form > p { margin: 0 0 10px; }
.f-row { margin: 10px 0; }
.f-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.req { color: var(--err); font-style: normal; }
.f-row input:not([type=checkbox]):not([type=radio]), .f-row select, .f-row textarea { width: 100%; }
.f-multi { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border); border-radius: 20px; padding: 3px 12px; font-size: 13px; cursor: pointer; }
.pill input { display: none; }
.pill.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-strong); }
.pill.disabled { opacity: .5; cursor: not-allowed; background: var(--border); }
.f-avatars { display: flex; flex-wrap: wrap; gap: 8px; }
.av-opt {
  display: flex; flex-direction: column; align-items: center; gap: 4px; width: 92px; padding: 6px;
  border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 12px; text-align: center;
}
.av-opt input { display: none; }
.av-opt img, .av-ph { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; display: grid; place-items: center; background: var(--chip); font-size: 26px; }
.av-opt.on { border-color: var(--primary); background: var(--primary-soft); }
.f-file { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.f-file-list { display: flex; flex-wrap: wrap; gap: 6px; }
.f-prev { position: relative; display: inline-flex; align-items: center; gap: 2px; }
.f-prev img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
label.attach {
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer; border: 1px dashed var(--border);
  border-radius: 8px; padding: 4px 10px; font-size: 12px; color: var(--muted);
}
label.attach:hover { border-color: var(--primary); color: var(--primary-strong); }
label.attach.busy { opacity: .5; pointer-events: none; }
.f-section { display: flex; flex-direction: column; gap: 2px; margin: 18px 0 4px; padding-top: 12px; border-top: 1px solid var(--border); }
.f-section:first-of-type { border-top: 0; padding-top: 0; margin-top: 8px; }
.f-section b { font-size: 14px; }
.f-section span { font-size: 12px; }
.f-choice { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.choice-opt { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.choice-opt input { display: none; }
.choice-opt small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.choice-opt.on { border-color: var(--primary); background: var(--primary-soft); }
.choice-opt.on b { color: var(--primary-strong); }
.form-done { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.bubble.form:has(.form-done) { box-shadow: none; background: var(--chip); }

/* 结果卡片 */
.rcard h4 { line-height: 1.4; }
/* 小节之间留白 + 细分隔线，告别"一大坨" */
.rcard section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.rcard section:first-of-type { margin-top: 10px; padding-top: 0; border-top: 0; }
/* 小节标题：左侧细色条做层级，标题本身降噪（不再满屏粗绿） */
.rcard h5 { margin: 0 0 8px; font-size: 13.5px; font-weight: 600; color: var(--primary-strong);
  display: flex; gap: 8px; align-items: center; padding-left: 10px; position: relative; }
.rcard h5::before { content: ""; position: absolute; left: 0; top: 1px; bottom: 1px; width: 3px;
  border-radius: 3px; background: var(--primary); opacity: .55; }
.rcard p { margin: 0; line-height: 1.8; }
/* 长文（口播稿 / 正文）包成柔和阅读块，一大段也不累 */
.rep-text { background: var(--chip); border-radius: 10px; padding: 12px 14px; line-height: 1.9;
  font-size: 13.5px; word-break: break-word; }
.rcard ul { margin: 0; padding-left: 20px; }
.rcard li { margin: 4px 0; line-height: 1.7; }
/* 复制按钮：安静一点，hover 才显色 */
.rcard h5 .copy { margin-left: auto; font-weight: 500; color: var(--muted); }
.rcard h5 .copy:hover { color: var(--primary-strong); }
/* 表格：更大行高 + 斑马纹 + 宽松内边距，分镜脚本更好读 */
.rcard table { font-size: 13px; border-collapse: collapse; width: 100%; }
.rcard thead th { background: var(--chip); font-weight: 600; text-align: left; padding: 8px 10px;
  color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
.rcard tbody td { padding: 9px 10px; line-height: 1.65; vertical-align: top; border-bottom: 1px solid var(--border); }
.rcard tbody tr:nth-child(even) { background: color-mix(in srgb, var(--chip) 45%, transparent); }
.rcard tbody tr:last-child td { border-bottom: 0; }
/* 审核打分 / 可折叠小节：做成安静的可点横条 */
.rep-fold { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.rep-fold > summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--muted);
  list-style: none; display: flex; align-items: center; gap: 6px; }
.rep-fold > summary::-webkit-details-marker { display: none; }
.rep-fold > summary::before { content: "▸"; font-size: 11px; color: var(--muted); }
.rep-fold[open] > summary::before { content: "▾"; }
.rep-fold.tone-good > summary { color: var(--ok); }
.rep-fold.tone-bad > summary { color: var(--warn); }
.rep-fold > summary + * { margin-top: 12px; }
.rcard video { width: 100%; max-height: 70vh; border-radius: 10px; background: #000; margin-top: 6px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 8px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; border-radius: 10px; display: block; background: var(--chip); }
.gallery figcaption { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); padding-top: 4px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
a.btn-like { display: inline-block; }

/* 输入框 */
.composer { border-top: 1px solid var(--border); background: var(--card); padding: 10px 24px 14px; }
.composer textarea { width: 100%; max-width: 860px; display: block; margin: 0 auto; border-radius: 12px; resize: none; }
.composer-bar, .composer-files { display: flex; align-items: center; gap: 10px; max-width: 860px; margin: 6px auto 0; flex-wrap: wrap; }
.composer-files:empty { display: none; }
.composer-tip { flex: 1; font-size: 12px; }

/* 对话历史 */
.chat-history { border-left: 1px solid var(--border); background: var(--card); overflow-y: auto; height: 100vh; }
.ch-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 14px 10px; position: sticky; top: 0; background: var(--card); }
.ch-item { position: relative; display: flex; flex-direction: column; padding: 9px 14px; cursor: pointer; border-left: 3px solid transparent; }
.ch-item:hover { background: var(--chip); }
.ch-item.active { background: var(--primary-soft); border-left-color: var(--primary); }
.ch-title { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 16px; }
.ch-meta { font-size: 11px; color: var(--muted); }
.ch-del { position: absolute; right: 10px; top: 8px; display: none; }
.ch-item:hover .ch-del { display: block; }
.ch-empty { padding: 0 14px; }
.dot-run { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); margin-right: 4px; }

/* 我的形象 */
.av-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 16px; }
.av-card { display: flex; gap: 12px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.av-card img, .av-ph.lg { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; flex: none; }
.av-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.av-actions { display: flex; gap: 10px; align-items: center; margin-top: auto; }
.av-qr { display: flex; gap: 16px; align-items: center; margin-top: 14px; padding: 12px; background: var(--chip); border-radius: 12px; }
.av-qr img { width: 160px; height: 160px; background: #fff; padding: 6px; border-radius: 8px; }

/* ── 手机 ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .nav-label, .ws-group { display: none; }
  .agent-nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .agent-link { flex: none; width: auto; padding: 5px 8px; gap: 6px; }
  .agent-text small { display: none; }
  .ag-avatar { width: 26px; height: 26px; font-size: 13px; border-radius: 8px; }
  .agent-shell { grid-template-columns: 1fr; height: auto; }
  .chat { height: calc(100vh - 150px); }
  .chat-head, .chat-body, .composer { padding-left: 16px; padding-right: 16px; }
  .chat-head .ch-toggle { display: inline-block; }
  .chat-history { display: none; position: fixed; inset: 0 0 0 auto; width: min(300px, 85vw); z-index: 30; box-shadow: var(--shadow); }
  .chat-history.open { display: block; }
  .msg.user .bubble { max-width: 88%; }
  .av-qr { flex-direction: column; align-items: flex-start; }
}

/* ── 多智能体协作：下一步按钮、交接单、面板（docs/agents-collaboration.md）────────── */
.next-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.next-steps .muted { font-size: 12.5px; margin-left: 4px; }
.handoff-from {
  align-self: center; max-width: 860px; width: 100%; margin: 0 auto; text-align: left; padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--primary-soft); color: var(--text); font: inherit; font-size: 13px; cursor: pointer;
}
.handoff-from:hover { border-color: var(--primary); }
.handoff-to { max-width: 860px; width: 100%; margin: 0 auto; font-size: 13px; }
.handoff-card h4 { font-size: 14px; }
.pkg-items { list-style: none; padding: 0; margin: 6px 0; display: flex; flex-direction: column; gap: 6px; }
.pkg-items li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pkg-items .chip { flex: none; }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; margin: 8px 0; }
.mini-stat { background: var(--chip); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; }
.mini-stat b { font-size: 20px; }
.mini-stat span { font-size: 12px; color: var(--muted); }
.mini-stat.warn b { color: var(--err); }
.rcard h4 .expand { float: right; font-weight: 500; }
.ch-title-box { min-width: 0; }
.ch-panels { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.ch-panels .active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-strong); }
.chat { position: relative; }
.work-panel { position: absolute; inset: 77px 0 0 0; background: var(--bg); display: flex; flex-direction: column; z-index: 5; border-top: 1px solid var(--border); }
.work-panel[hidden] { display: none; }
.wp-head { display: flex; align-items: center; gap: 10px; padding: 10px 24px; background: var(--card); border-bottom: 1px solid var(--border); }
.wp-head .filter-tabs { flex: 1; }
.wp-body { flex: 1; overflow-y: auto; padding: 18px 24px; }
.wp-body > .tab-panel { max-width: 1100px; margin: 0 auto; }
/* 面板里的详情抽屉（如线索详情）只盖住面板内容，不挡顶部的「收起，回到对话」 */
.work-panel .drawer { position: absolute; top: 54px; height: auto; }
@media (max-width: 900px) {
  .ch-panels { order: 3; width: 100%; margin-left: 0; }
  .work-panel { inset: 0; position: fixed; z-index: 30; }
  .wp-head, .wp-body { padding-left: 16px; padding-right: 16px; }
}

/* 数字人卡片：提交信息缩略图 */
.rcard .submitted{margin-top:6px}
.rcard .sub-thumb{max-width:120px;max-height:120px;border-radius:8px;margin:6px 0;display:block}
