/* ============================================
   AI 销售副驾驶原型 v0.3 · 视觉系统重做
   设计语言：现代 SaaS（柔和投影 / 圆角层级 / 微动效）
   ============================================ */

:root {
  --brand: #49647a;
  --brand-hover: #344b60;
  --brand-soft: #edf1f4;
  --ink: #20262d;
  --ink-2: #505a64;
  --ink-3: #7b858e;
  --ink-4: #a1a8af;
  --bg-app: #f3f4f5;
  --bg-panel: #ffffff;
  --line: #e1e4e7;
  --line-soft: #eceef0;
  --green: #547565;
  --green-soft: #edf3f0;
  --amber: #806a49;
  --amber-soft: #f4f1eb;
  --red: #865e5e;
  --red-soft: #f5eeee;
  --purple: #6d657d;
  --purple-soft: #f1eff4;
  --teal: #527176;
  --teal-soft: #edf3f3;
  --shadow-sm: 0 1px 2px rgba(29, 35, 42, .04), 0 3px 10px rgba(29, 35, 42, .035);
  --shadow-md: 0 2px 5px rgba(29, 35, 42, .05), 0 10px 24px rgba(29, 35, 42, .055);
  --r-lg: 10px;
  --r-md: 8px;
  --r-sm: 6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
::selection { background: #dce4e8; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  font-size: 13px; color: var(--ink); background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  height: 100vh; display: flex; flex-direction: column; overflow: hidden;
}

/* 细滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d3d7de; border-radius: 4px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b9bfc9; background-clip: content-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

/* 按钮体系 */
button {
  cursor: pointer; font-size: 12px; font-family: inherit;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: var(--r-sm); padding: 6px 13px;
  transition: all .16s ease; font-weight: 500;
}
button:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
button:active { transform: scale(.97); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.btn-secondary { background: #f5f6f8; border-color: transparent; }
.btn-mini { padding: 3px 10px; font-size: 11px; border-radius: 6px; }

textarea, input {
  font-family: inherit; font-size: 13px; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 8px 10px; width: 100%; background: #fff;
  transition: border-color .16s, box-shadow .16s;
}
textarea:focus, input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(52, 104, 246, .12);
}
textarea { resize: vertical; line-height: 1.6; }
ul { list-style: none; }
.hidden { display: none !important; }

/* 顶部原型标识 */
.proto-banner {
  background: #f5f3ee; color: #74644e;
  border-bottom: 1px solid #e5e0d6;
  padding: 7px 16px; font-size: 12px; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  position: sticky; top: 0; z-index: 20;
}
.banner-dot { width: 6px; height: 6px; border-radius: 50%; background: #8a7656; flex: none; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.banner-actions { margin-left: auto; display: flex; gap: 6px; }
.banner-btn { background: #fff; white-space: nowrap; }

/* 三栏布局 */
.layout { display: flex; flex: 1; min-height: 0; }
.col { overflow-y: auto; }
.col-left { width: 238px; min-width: 195px; background: var(--bg-panel); border-right: 1px solid var(--line); }
.col-chat { flex: 1; display: flex; flex-direction: column; background: #f7f8fa; min-width: 300px; }
.col-copilot { width: 372px; min-width: 330px; background: var(--bg-app); border-left: 1px solid var(--line); padding: 12px; }

.col-title {
  padding: 13px 16px 11px; font-weight: 600; color: var(--ink-3);
  border-bottom: 1px solid var(--line); font-size: 11px; letter-spacing: .8px;
}

/* ===== 客户列表 ===== */
.customer-item {
  padding: 11px 14px; cursor: pointer; display: flex; gap: 10px; align-items: flex-start;
  border-left: 3px solid transparent; transition: background .14s;
}
.customer-item:hover { background: #f7f9fc; }
.customer-item.active { background: var(--brand-soft); border-left-color: var(--brand); }
.ci-avatar {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: #fff; margin-top: 1px;
}
.av-0 { background: #64798b; } .av-1 { background: #617b73; } .av-2 { background: #756f80; }
.ci-main { flex: 1; min-width: 0; }
.ci-name { font-weight: 600; font-size: 13px; }
.ci-contact { color: var(--ink-3); font-size: 11.5px; margin: 2px 0 3px; }
.ci-last { color: var(--ink-4); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== 聊天区 ===== */
.chat-header {
  padding: 11px 18px; background: var(--bg-panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.chat-title { font-weight: 600; font-size: 14px; }
.chat-tag { font-size: 11px; color: var(--amber); background: var(--amber-soft); border-radius: 5px; padding: 2px 7px; font-weight: 500; }
.chat-messages { flex: 1; overflow-y: auto; padding: 18px; }
.msg { margin-bottom: 16px; display: flex; gap: 9px; }
.msg-out { flex-direction: row-reverse; }
.msg-avatar {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff;
}
.msg-in .msg-avatar { background: #9aa7ba; }
.msg-out .msg-avatar { background: var(--brand); }
.msg-body { max-width: 72%; display: flex; flex-direction: column; }
.msg-out .msg-body { align-items: flex-end; }
.msg-bubble { padding: 9px 13px; border-radius: 12px; line-height: 1.65; box-shadow: var(--shadow-sm); }
.msg-in .msg-bubble { background: #fff; border: 1px solid var(--line-soft); border-top-left-radius: 4px; }
.msg-out .msg-bubble { background: #e6ecef; border-top-right-radius: 4px; }
.msg-sim { font-size: 10px; color: var(--amber); background: var(--amber-soft); border-radius: 4px; padding: 1px 5px; margin-left: 6px; font-weight: 500; }
.msg-time { font-size: 10.5px; color: var(--ink-4); margin-top: 4px; }
.chat-input-row { display: flex; gap: 8px; padding: 12px 16px; background: var(--bg-panel); border-top: 1px solid var(--line); }
.chat-input-row textarea { flex: 1; }
.chat-input-row button { padding: 0 20px; border-radius: var(--r-sm); background: var(--brand); border-color: var(--brand); color: #fff; }
.chat-input-row button:hover { background: var(--brand-hover); color: #fff; }
.chat-hint { font-size: 11px; color: var(--ink-4); padding: 7px 16px; }

/* ===== 副驾驶头部 ===== */
.copilot-header {
  display: flex; gap: 10px; align-items: center;
  background: var(--bg-panel); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 11px 13px; margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  position: sticky; top: 0; z-index: 5;
}
.cp-logo {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: #465d70; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; letter-spacing: .5px;
}
.copilot-title { font-size: 14px; font-weight: 600; }
.tag-proto { font-size: 10.5px; color: var(--amber); background: var(--amber-soft); border-radius: 5px; padding: 2px 6px; vertical-align: middle; margin-left: 4px; font-weight: 500; }
.copilot-sub { color: var(--ink-3); font-size: 12px; margin-top: 2px; }

/* ===== 关键功能演示 ===== */
.demo-toolbar {
  display: none; background: #fff; border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 10px; margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.demo-toolbar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.demo-toolbar-head strong { font-size: 12.5px; }
.demo-toolbar-head span { color: var(--ink-4); font-size: 10.5px; margin-left: 7px; }
.icon-btn { width: 28px; height: 28px; padding: 0; display: grid; place-items: center; font-size: 17px; }
.scenario-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.scenario-tab { padding: 6px 5px; background: #f5f6f8; border-color: transparent; font-size: 11.5px; }
.scenario-tab.active { color: #fff; background: var(--brand); border-color: var(--brand); }
.demo-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; margin-top: 8px; }
.demo-steps span {
  position: relative; text-align: center; color: var(--ink-4); font-size: 10.5px;
  padding-top: 7px; border-top: 2px solid var(--line);
}
.demo-steps span.done { color: var(--green); border-top-color: var(--green); }
.demo-steps span.active { color: var(--brand-hover); border-top-color: var(--brand); font-weight: 600; }
body.presentation-mode .demo-toolbar { display: block; }
body.presentation-mode .col-left { display: none; }
body.presentation-mode .col-chat { flex: 0 0 48%; min-width: 420px; }
body.presentation-mode .col-copilot { width: auto; min-width: 460px; flex: 1; padding-left: 18px; padding-right: 18px; }
body.presentation-mode .flywheel-bar,
body.presentation-mode [data-panel="profile"],
body.presentation-mode [data-panel="timeline"],
body.presentation-mode [data-panel="ledger"],
body.presentation-mode [data-panel="delegate"],
body.presentation-mode [data-panel="writeback"],
body.presentation-mode [data-panel="log"] { display: none; }
body.presentation-mode .paste-row,
body.presentation-mode .analysis-disclosure,
body.presentation-mode #opportunity-body > .detail-disclosure,
body.presentation-mode .ai-src { display: none; }

/* ===== 手风琴面板 ===== */
.panel {
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--bg-panel); margin-bottom: 10px;
  box-shadow: var(--shadow-sm); overflow: hidden;
  transition: box-shadow .2s;
}
.panel:hover { box-shadow: var(--shadow-md); }
.acc-head {
  display: flex; align-items: center; gap: 9px; padding: 11px 13px;
  cursor: pointer; user-select: none; transition: background .14s;
}
.acc-head:hover { background: #f8f9fc; }
.acc-icon {
  width: 24px; height: 24px; border-radius: 7px; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.ic-blue { background: var(--brand-soft); color: var(--brand); }
.ic-green { background: var(--green-soft); color: var(--green); }
.ic-purple { background: var(--purple-soft); color: var(--purple); }
.ic-amber { background: var(--amber-soft); color: var(--amber); }
.ic-teal { background: var(--teal-soft); color: var(--teal); }
.ic-indigo { background: #edf1f4; color: #596f80; }
.ic-gray { background: #eff0f3; color: var(--ink-3); }
.acc-title { font-weight: 600; font-size: 13px; flex: none; }
.acc-summary {
  flex: 1; text-align: right; font-size: 11px; color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.acc-chevron {
  width: 7px; height: 7px; flex: none;
  border-right: 1.6px solid var(--ink-4); border-bottom: 1.6px solid var(--ink-4);
  transform: rotate(45deg); transition: transform .22s ease; margin-top: -3px;
}
.panel.open .acc-chevron { transform: rotate(225deg); margin-top: 3px; }
.panel.open .acc-head { border-bottom: 1px solid var(--line-soft); }
.acc-body { display: none; padding: 12px 13px 13px; }
.panel.open .acc-body { display: block; animation: accIn .24s ease; }
@keyframes accIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }

.row-gap { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.paste-row { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px dashed var(--line); }

/* ===== 档案 ===== */
.p-row { display: flex; margin-bottom: 7px; align-items: baseline; gap: 8px; }
.p-row label { width: 92px; min-width: 92px; color: var(--ink-3); font-size: 12px; }
.p-label { width: 68px; min-width: 68px; color: var(--ink-4); font-size: 12px; }
.p-value { flex: 1; font-size: 12.5px; }
.p-sub { font-weight: 600; color: var(--ink-2); margin: 12px 0 5px; font-size: 12px; }
.src-list li { font-size: 12px; color: var(--ink-2); padding: 5px 0; border-bottom: 1px dashed var(--line-soft); }
.src-time { color: var(--ink-4); font-size: 11px; }
.file-input { font-size: 12px; padding: 5px; }

/* ===== 机会推进器 ===== */
.opp-block { margin-bottom: 12px; }
.opp-block:last-child { margin-bottom: 0; }
.opp-label { font-size: 11px; color: var(--ink-4); margin-bottom: 6px; letter-spacing: .5px; font-weight: 500; }
.opp-kpis {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px;
  margin-bottom: 10px;
}
.opp-kpi { background: #f7f8fb; border: 1px solid var(--line-soft); border-radius: var(--r-sm); padding: 8px; min-width: 0; }
.opp-kpi span { display: block; color: var(--ink-4); font-size: 10.5px; margin-bottom: 3px; }
.opp-kpi strong { display: block; color: var(--ink); font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.decision-snapshot { display: grid; gap: 6px; margin-bottom: 10px; }
.decision-brief { border: 1px solid var(--line-soft); background: #fafbfb; border-radius: var(--r-sm); padding: 9px 10px; margin-bottom: 9px; }
.brief-head { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.brief-head > span:first-child { color: var(--ink-3); font-size: 10.5px; font-weight: 600; }
.decision-brief > p { color: var(--ink-2); font-size: 12px; line-height: 1.55; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.evidence-actions { display: flex; gap: 5px; margin-top: 7px; }
.evidence-actions button { flex: 1; padding: 5px 4px; color: var(--ink-3); background: #fff; border-color: var(--line-soft); font-size: 10.5px; }
.evidence-actions button:hover { color: var(--brand-hover); border-color: #bdc7cf; background: var(--brand-soft); }
.evidence-actions b { color: var(--ink-2); font-size: 11.5px; }
.decision-label { font-size: 10.5px; font-weight: 600; border-radius: 5px; padding: 2px 5px; text-align: center; }
.decision-label.fact { color: var(--green); background: var(--green-soft); }
.decision-label.inference { color: var(--brand-hover); background: var(--brand-soft); }
.decision-label.unknown { color: var(--ink-3); background: #eff0f3; }
.next-block { margin-bottom: 9px; }
.detail-disclosure { border-top: 1px solid var(--line-soft); padding-top: 8px; }
.detail-disclosure summary, .sg-details summary {
  cursor: pointer; color: var(--brand-hover); font-size: 11.5px; font-weight: 500;
  list-style-position: inside;
}
.detail-body { padding-top: 10px; }
.flow-row { margin-top: 7px; }
.state-change-banner {
  border-left: 3px solid var(--green); background: var(--green-soft);
  border-radius: var(--r-sm); padding: 8px 10px; margin-bottom: 10px;
}
.state-change-label { color: var(--green); font-size: 10.5px; font-weight: 600; }
.state-change-progress { display: flex; align-items: baseline; gap: 7px; margin: 3px 0; }
.state-change-progress b { color: var(--ink-3); font-size: 14px; }
.state-change-progress span { color: var(--ink-4); }
.state-change-progress strong { color: var(--green); font-size: 19px; }
.state-change-banner p { color: var(--ink-2); font-size: 11.5px; line-height: 1.5; }

/* 阶段步骤条 */
.stepper { display: flex; align-items: flex-start; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; }
.step::before {
  content: ""; position: absolute; top: 5px; left: -50%; width: 100%; height: 2px;
  background: var(--line);
}
.step:first-child::before { display: none; }
.step.done::before { background: #aebdc6; }
.step .dot {
  width: 12px; height: 12px; border-radius: 50%; background: #dfe3ea;
  border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); z-index: 1;
}
.step.done .dot { background: #7e97a9; box-shadow: 0 0 0 1px #7e97a9; }
.step.current .dot { background: var(--brand); box-shadow: 0 0 0 3px rgba(52,104,246,.22); }
.step .lbl { font-size: 10.5px; color: var(--ink-4); margin-top: 5px; text-align: center; line-height: 1.3; }
.step.done .lbl { color: var(--ink-3); }
.step.current .lbl { color: var(--brand); font-weight: 600; }

.intent-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 13px; border-radius: 12px; font-weight: 600; font-size: 12px; }
.intent-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.intent-low { background: #f1f2f5; color: var(--ink-3); }
.intent-medium { background: var(--amber-soft); color: var(--amber); }
.intent-high { background: var(--brand-soft); color: var(--brand-hover); }
.intent-very_high { background: var(--red-soft); color: var(--red); }

.progress-wrap { display: flex; align-items: center; gap: 9px; }
.progress-bar { flex: 1; height: 7px; background: #eef0f4; border-radius: 4px; overflow: hidden; }
.progress-fill {
  height: 100%; background: var(--brand); border-radius: 4px;
  transition: width .5s ease;
}
.progress-scale { display: flex; justify-content: space-between; font-size: 10px; color: var(--ink-4); margin-top: 3px; }
.progress-num { font-weight: 700; color: var(--brand-hover); font-size: 14px; min-width: 38px; text-align: right; }
.opp-expl { margin-top: 8px; color: var(--ink-2); line-height: 1.7; background: #f7f8fb; border: 1px solid var(--line-soft); border-radius: var(--r-sm); padding: 8px 10px; font-size: 12.5px; }
.opp-list li { padding: 4px 0 4px 15px; position: relative; line-height: 1.6; font-size: 12.5px; color: var(--ink-2); }
.opp-list li::before { content: ""; position: absolute; left: 2px; top: 11px; width: 6px; height: 6px; border-radius: 50%; }
.opp-list.evidence li::before { background: var(--green); }
.opp-list.blocker li::before { background: #9a805d; }
.opp-list.unknown li::before { background: var(--ink-4); }
.next-step {
  background: var(--brand-soft); border-left: 3px solid var(--brand);
  padding: 8px 11px; border-radius: var(--r-sm); font-weight: 600; font-size: 12.5px; color: var(--brand-hover);
}

/* ===== 分析 + 话术 ===== */
.ana-block { margin-bottom: 10px; }
.analysis-head { display: flex; align-items: center; gap: 4px; color: var(--ink-3); font-size: 10.5px; margin-bottom: 5px; }
.analysis-head > span:first-child { font-weight: 600; }
.context-brief {
  width: 100%; display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 7px;
  padding: 7px 9px; margin-bottom: 7px; text-align: left; background: #f7f9fa;
  border-color: var(--line-soft); color: var(--ink-2); box-shadow: none;
}
.context-brief:hover { color: var(--ink); border-color: #bdc7cf; background: var(--brand-soft); }
.context-brief span { color: var(--ink-4); font-size: 10.5px; }
.context-brief strong { font-size: 11.5px; font-weight: 600; }
.context-brief em { justify-self: end; color: var(--ink-3); font-size: 10.5px; font-style: normal; }
.ana-intent { background: #fafbfb; border: 1px solid var(--line-soft); border-radius: var(--r-sm); padding: 8px 10px; line-height: 1.6; margin-bottom: 6px; font-size: 12px; color: var(--ink-2); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.analysis-detail-btn { padding: 3px 0; border: 0; background: transparent; color: var(--brand-hover); font-size: 11px; }
.analysis-detail-btn:hover { border: 0; background: transparent; color: var(--ink); }
.analysis-disclosure { margin-top: 6px; }
.ana-row { display: flex; gap: 7px; margin-bottom: 5px; }
.ana-label { min-width: 56px; color: var(--ink-4); font-size: 11.5px; font-weight: 500; }
.ana-row ul li { font-size: 12px; line-height: 1.6; color: var(--ink-2); }

.sg-card {
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 11px 12px; margin-bottom: 9px; background: #fff;
  box-shadow: var(--shadow-sm); transition: box-shadow .18s, transform .18s;
}
.sg-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.sg-blocked { background: var(--red-soft); }
.sg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; flex-wrap: wrap; }
.sg-strategy { font-weight: 600; font-size: 11.5px; padding: 3px 10px; border-radius: 11px; }
.sg-澄清型 .sg-strategy { background: var(--brand-soft); color: var(--brand-hover); }
.sg-推进型 .sg-strategy { background: var(--green-soft); color: var(--green); }
.sg-顾问型 .sg-strategy { background: var(--purple-soft); color: var(--purple); }
.sg-objective { font-size: 11.5px; color: var(--ink-3); }
.sg-draft { background: #f7f8fb; border: 1px solid var(--line-soft); border-radius: var(--r-sm); padding: 8px 10px; line-height: 1.7; margin-bottom: 6px; font-size: 12.5px; }
.sg-meta { font-size: 11.5px; color: var(--green); margin-bottom: 3px; line-height: 1.5; }
.sg-risk { font-size: 11.5px; color: var(--red); margin-bottom: 8px; line-height: 1.5; }
.sg-details { margin: 2px 0 8px; }
.sg-details .sg-meta { margin-top: 7px; }
.strategy-switcher { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: var(--r-md); background: #f3f4f5; margin-bottom: 8px; }
.strategy-tab { border: 0; background: transparent; color: var(--ink-3); padding: 6px 4px; box-shadow: none; }
.strategy-tab:hover { border: 0; background: #eceff1; color: var(--ink-2); }
.strategy-tab.active { color: var(--ink); background: #fff; box-shadow: var(--shadow-sm); }
.strategy-focus { padding: 12px; margin-bottom: 0; border-color: var(--line-soft); box-shadow: none; }
.strategy-focus:hover { transform: none; box-shadow: none; }
.strategy-objective { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.strategy-objective span { color: var(--ink-3); font-size: 10.5px; white-space: nowrap; }
.strategy-objective strong { color: var(--ink); font-size: 12.5px; line-height: 1.45; }
.strategy-actions { display: flex; justify-content: flex-end; gap: 6px; }
.strategy-actions button { min-width: 88px; }
.btn-adopt { font-weight: 600; }

/* ===== 跟进结果闭环 ===== */
.draft-actions { justify-content: flex-end; }
.draft-actions .btn-primary { min-width: 150px; }
.draft-footer { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line-soft); margin-top: 9px; padding-top: 9px; }
.draft-footer > span { color: var(--ink-4); font-size: 10.5px; }
.btn-outcome { color: var(--green); border-color: #cddbd4; background: var(--green-soft); }
.btn-outcome:hover { color: #3e6252; border-color: #aebfb6; background: #e5eee9; }
.session-record-status { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; margin-top: 8px; padding: 8px 10px; border: 1px solid #d8e1dd; border-radius: var(--r-sm); background: #f3f7f5; }
.session-record-status strong { color: var(--green); font-size: 11.5px; }
.session-record-status span { justify-self: end; color: var(--ink-2); font-size: 11px; }
.session-record-status small { grid-column: 1 / -1; color: var(--ink-4); font-size: 10px; }
.session-context-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 9px 11px; margin: 0 0 12px; border: 1px solid var(--line-soft); border-radius: var(--r-sm); background: #f7f9fa; }
.session-context-meta span { color: var(--ink-4); font-size: 10.5px; }
.session-context-meta strong { color: var(--ink-2); font-size: 11.5px; }
.session-context-meta i { color: var(--brand-hover); background: var(--brand-soft); border-radius: 4px; padding: 2px 6px; font-size: 10px; font-style: normal; }
.record-field { display: block; margin-bottom: 12px; }
.record-field > span { display: flex; align-items: baseline; gap: 5px; color: var(--ink-2); font-size: 11.5px; font-weight: 600; margin-bottom: 5px; }
.record-field > span small { color: var(--ink-4); font-size: 10px; font-weight: 400; }
.record-field textarea, .record-field select { width: 100%; }
.record-field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.record-field-head > span { color: var(--ink-2); font-size: 11.5px; font-weight: 600; }
.record-field-head small { color: var(--ink-4); font-size: 10.5px; }
.session-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.session-action { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 9px; align-items: start; padding: 10px; border: 1px solid var(--line-soft); border-radius: var(--r-sm); background: #fafbfb; cursor: pointer; min-height: 84px; }
.session-action:hover { border-color: #c8d0d5; background: #f7f9fa; }
.session-action input { margin-top: 3px; accent-color: var(--brand); }
.session-action > span { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 7px; min-width: 0; }
.session-action b { color: var(--brand-hover); background: var(--brand-soft); border-radius: 4px; padding: 1px 5px; font-size: 9.5px; font-weight: 600; align-self: start; }
.session-action strong { color: var(--ink); font-size: 11.5px; line-height: 1.45; min-width: 0; overflow-wrap: anywhere; }
.session-action small, .session-action em { grid-column: 2; color: var(--ink-3); font-size: 10.5px; line-height: 1.45; font-style: normal; }
.session-action em { color: var(--amber); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); }

/* ===== 沟通记录工作台 ===== */
.session-dialog {
  width: min(760px, calc(100vw - 40px)); max-height: min(820px, calc(100vh - 32px));
  margin: auto; padding: 0; border: 1px solid #d7dcdf; border-radius: 8px;
  background: #fff; color: var(--ink); box-shadow: 0 24px 72px rgba(24, 31, 37, .24);
  overflow-y: auto;
}
.session-dialog::backdrop { background: rgba(27, 34, 39, .38); backdrop-filter: blur(3px); }
.session-dialog > :not(.dialog-close) { margin-left: 24px; margin-right: 24px; }
.session-dialog .dialog-close { position: sticky; float: right; top: 12px; right: 12px; z-index: 3; margin: 12px 12px -42px 0; }
.record-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 24px 44px 16px 0; border-bottom: 1px solid var(--line-soft); }
.record-dialog-head .dialog-eyebrow { margin-bottom: 6px; }
.record-dialog-head h2 { font-size: 20px; margin-bottom: 5px; letter-spacing: 0; }
.record-dialog-head p { color: var(--ink-3); font-size: 11.5px; line-height: 1.55; max-width: 510px; }
.ai-draft-badge { flex: none; color: var(--brand-hover); background: var(--brand-soft); border: 1px solid #d8e0e5; border-radius: 5px; padding: 4px 8px; font-size: 10.5px; font-weight: 600; }
.session-dialog .session-context-meta { margin-top: 14px; }
.record-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.record-toolbar > span { color: var(--ink-3); font-size: 10.5px; }
.btn-link { border: 0; padding: 3px 0; color: var(--brand-hover); background: transparent; box-shadow: none; font-weight: 600; }
.btn-link:hover { border: 0; color: var(--ink); background: transparent; }
.session-dialog textarea { resize: vertical; min-height: 58px; line-height: 1.6; background: #fbfcfc; }
.session-dialog textarea:focus { background: #fff; }
.session-dialog .dialog-boundary { margin-top: 4px; }
.session-dialog .dialog-actions { position: sticky; bottom: 0; z-index: 2; margin: 16px 0 0; padding: 14px 24px; background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line); backdrop-filter: blur(6px); }
.session-dialog .dialog-actions .btn-primary { min-width: 96px; }

/* ===== 证据抽屉 ===== */
.evidence-dialog {
  width: min(560px, calc(100vw - 28px)); max-height: min(720px, calc(100vh - 32px));
  margin: auto; padding: 20px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: #fff; color: var(--ink); box-shadow: 0 18px 60px rgba(23, 28, 38, .22);
  overflow-y: auto;
}
.evidence-dialog::backdrop { background: rgba(31, 38, 44, .30); backdrop-filter: blur(2px); }
.dialog-close {
  position: absolute; top: 10px; right: 10px; width: 30px; height: 30px;
  padding: 0; font-size: 20px; line-height: 1; border-color: transparent; background: #f5f6f8;
}
.dialog-eyebrow { color: var(--brand); font-size: 10.5px; font-weight: 600; margin-bottom: 5px; }
.evidence-dialog h2 { font-size: 17px; padding-right: 34px; margin-bottom: 14px; }
.evidence-section { border-left: 3px solid var(--line); padding: 8px 10px; margin-bottom: 9px; background: #f8f9fb; }
.evidence-section.focused { border-left-color: var(--brand); background: #f1f4f6; }
.evidence-section h3 { font-size: 12px; margin-bottom: 6px; }
.evidence-section p, .evidence-section li { color: var(--ink-2); font-size: 12px; line-height: 1.65; }
.evidence-section li + li { margin-top: 7px; }
.evidence-section small { display: block; color: var(--ink-4); font-size: 10.5px; margin-top: 5px; }
.evidence-section blockquote { margin-top: 4px; padding: 6px 8px; background: #fff; border: 1px solid var(--line-soft); border-radius: 5px; }
.evidence-section blockquote span { color: var(--brand); font-size: 10.5px; margin-right: 5px; }
.dialog-boundary { color: var(--amber); background: var(--amber-soft); padding: 8px 10px; border-radius: var(--r-sm); font-size: 11px; line-height: 1.55; }

/* ===== 统一时间线 ===== */
.tl-list { max-height: 250px; overflow-y: auto; padding-right: 2px; }
.tl-item { display: flex; flex-wrap: wrap; gap: 3px 7px; padding: 7px 0; border-bottom: 1px dashed var(--line-soft); font-size: 12px; align-items: baseline; }
.tl-time { color: var(--ink-4); min-width: 62px; font-size: 11px; font-variant-numeric: tabular-nums; }
.tl-channel { font-size: 10.5px; border-radius: 5px; padding: 1.5px 6px; background: var(--brand-soft); color: var(--brand-hover); font-weight: 500; }
.tl-会议 { background: var(--amber-soft); color: var(--amber); }
.tl-电话 { background: var(--green-soft); color: var(--green); }
.tl-邮件 { background: var(--purple-soft); color: var(--purple); }
.tl-承诺 { background: var(--red-soft); color: var(--red); }
.tl-content { flex: 1; min-width: 55%; line-height: 1.6; color: var(--ink-2); }
.tl-source { width: 100%; color: var(--ink-4); font-size: 10.5px; }

/* ===== 销售事实层与日报/周报 ===== */
.ledger-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: var(--r-md); background: #f3f4f5; margin-bottom: 10px; }
.ledger-tab { border: 0; background: transparent; color: var(--ink-3); padding: 6px 5px; box-shadow: none; }
.ledger-tab:hover { border: 0; background: #eceff1; color: var(--ink-2); }
.ledger-tab.active { color: var(--ink); background: #fff; box-shadow: var(--shadow-sm); }
.ledger-flow { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr) auto; align-items: center; gap: 5px; padding: 8px; margin-bottom: 10px; border: 1px solid #dce3e1; border-radius: var(--r-sm); background: #f3f7f5; }
.ledger-flow span { display: grid; gap: 1px; min-width: 0; }
.ledger-flow b { color: var(--ink-2); font-size: 10.5px; font-weight: 600; overflow-wrap: anywhere; }
.ledger-flow small { color: var(--ink-4); font-size: 9px; }
.ledger-flow i { color: var(--green); font-size: 11px; font-style: normal; }
.ledger-caption, .digest-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.ledger-caption strong, .digest-head strong { color: var(--ink); font-size: 12px; }
.ledger-caption span, .digest-head span { color: var(--ink-4); font-size: 10.5px; }
.ledger-table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--r-sm); }
.ledger-table { width: 100%; border-collapse: collapse; min-width: 610px; }
.ledger-table th { color: var(--ink-4); background: #f7f9fa; font-size: 10px; font-weight: 600; text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.ledger-table td { color: var(--ink-2); font-size: 11px; line-height: 1.4; padding: 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.ledger-table tr:last-child td { border-bottom: 0; }
.ledger-table td strong { display: block; color: var(--ink); font-size: 11px; }
.ledger-table td small { display: block; color: var(--ink-4); font-size: 10px; margin-top: 2px; }
.ledger-progress { color: var(--brand-hover); font-variant-numeric: tabular-nums; }
.ledger-note { margin-top: 8px; padding: 7px 9px; color: var(--ink-3); background: #f7f9fa; border: 1px solid var(--line-soft); border-radius: var(--r-sm); font-size: 10.5px; line-height: 1.55; }
.digest-head > div { display: grid; gap: 2px; }
.digest-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.digest-stats > div { display: grid; gap: 2px; padding: 8px; background: #f7f9fa; border: 1px solid var(--line-soft); border-radius: var(--r-sm); }
.digest-stats span { color: var(--ink-4); font-size: 10px; }
.digest-stats strong { color: var(--ink); font-size: 14px; line-height: 1.25; }
.digest-section { margin-top: 12px; }
.digest-section h4 { color: var(--ink-2); font-size: 11.5px; margin-bottom: 6px; }
.digest-list, .review-list { display: grid; gap: 5px; }
.digest-list li { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 3px 8px; padding: 7px 8px; border-left: 2px solid var(--brand); background: #fafbfb; border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.digest-list li strong { color: var(--ink); font-size: 11px; }
.digest-list li span { color: var(--ink-2); font-size: 11px; }
.digest-list li small { grid-column: 1 / -1; color: var(--ink-3); font-size: 10.5px; line-height: 1.45; }
.review-list li { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px dashed var(--line-soft); }
.review-list li b { flex: none; color: var(--brand-hover); background: var(--brand-soft); border-radius: 4px; padding: 2px 5px; font-size: 9.5px; }
.review-list li span { flex: 1; min-width: 0; color: var(--ink-2); font-size: 10.5px; overflow-wrap: anywhere; }
.review-list li em { flex: none; color: var(--amber); font-size: 10px; font-style: normal; }
.empty-row { color: var(--ink-4); font-size: 11px; padding: 8px; }

/* ===== 后台助手委托 ===== */
.cap-row .btn-cap { flex: 1; padding: 6px 4px; }
.delegate-output {
  background: #f7f8fb; border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 12px; margin-top: 9px; font-size: 12px; line-height: 1.75;
  white-space: pre-wrap; word-break: break-word;
  max-height: 300px; overflow-y: auto; font-family: inherit; color: var(--ink-2);
}

/* ===== 事件日志 ===== */
.event-log { max-height: 190px; overflow-y: auto; }
.event-log li { font-size: 11px; color: var(--ink-3); padding: 5px 0; border-bottom: 1px dashed var(--line-soft); line-height: 1.55; }

/* ===== 窄侧边栏模式（模拟企微嵌入，约 360px） ===== */
body.narrow-mode { background: #e9ebef; }
body.narrow-mode .col-left, body.narrow-mode .col-chat { display: none; }
body.narrow-mode .col-copilot {
  width: 360px; min-width: 360px; margin: 12px auto;
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 4px 24px rgba(23, 28, 38, .10);
}

/* 响应式 */
@media (max-width: 1000px) {
  .col-left { width: 185px; min-width: 155px; }
  .col-copilot { width: 340px; min-width: 315px; }
}

/* 置信度徽章（v0.4） */
.conf-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 500; padding: 1.5px 8px; border-radius: 9px;
  vertical-align: middle; margin-left: 4px; letter-spacing: 0;
}
.conf-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.conf-high { background: var(--green-soft); color: var(--green); }
.conf-medium { background: var(--amber-soft); color: var(--amber); }
.conf-low { background: #f1f2f5; color: var(--ink-3); }
.conf-basis { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); font-size: 11.5px; color: var(--ink-3); }

/* AI 来源标注（v0.5） */
.ai-src { display: inline-flex; align-items: center; font-size: 10.5px; font-weight: 500; padding: 1.5px 8px; border-radius: 9px; vertical-align: middle; margin-left: 4px; }
.ai-src-real { background: var(--brand-soft); color: var(--brand-hover); }
.ai-src-offline { background: #f1f2f5; color: var(--ink-3); }

/* 数据回流状态条（v0.6） */
.flywheel-bar {
  display: flex; align-items: center; gap: 7px;
  background: #f0f3f2;
  border: 1px solid #dbe2df;
  border-radius: var(--r-md); padding: 7px 12px; margin-bottom: 10px;
  font-size: 11.5px; cursor: pointer; transition: box-shadow .18s;
}
.flywheel-bar:hover { box-shadow: var(--shadow-sm); }
.fw-icon { color: var(--green); display: flex; align-items: center; flex: none; animation: spin 8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fw-text { color: var(--ink-2); font-weight: 500; }
.fw-text span { color: var(--green); font-weight: 600; }
.fw-detail { margin-left: auto; color: var(--brand); font-weight: 500; font-size: 11px; }

/* 流向标签 */
.flow-tag {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 500; padding: 2px 7px;
  border-radius: 8px; margin-left: 4px; vertical-align: middle;
  line-height: 1.4; max-width: 100%; white-space: normal; overflow-wrap: anywhere;
}
.flow-ready { background: var(--green-soft); color: var(--green); }
.flow-pending { background: #fdf3e3; color: var(--amber); }

/* 数据回流面板 */
.wb-section { margin-bottom: 14px; }
.wb-section:last-child { margin-bottom: 0; }
.wb-section-title {
  font-size: 12px; font-weight: 600; color: var(--ink);
  margin-bottom: 6px; display: flex; align-items: center; gap: 6px;
}
.wb-target {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; margin-bottom: 4px; border-radius: var(--r-sm);
  font-size: 11.5px; background: #f7f8fb; border: 1px solid var(--line-soft);
}
.wb-target-name { flex: 1; color: var(--ink-2); }
.wb-method { color: var(--ink-4); font-size: 10.5px; }
.wb-status {
  font-size: 10px; font-weight: 600; padding: 2px 7px;
  border-radius: 8px; white-space: nowrap;
}
.wb-status-ready { background: var(--green-soft); color: var(--green); }
.wb-status-pending { background: var(--amber-soft); color: var(--amber); }
.wb-divider {
  height: 1px; background: var(--line-soft); margin: 12px 0;
}
.wb-note {
  font-size: 11px; color: var(--ink-3); line-height: 1.6;
  background: #f7f8fb; border-radius: var(--r-sm); padding: 8px 10px;
  margin-top: 8px;
}

@media (max-width: 420px) {
  .proto-banner { padding: 6px 9px; gap: 6px; font-size: 11px; line-height: 1.4; }
  .proto-banner > span:not(.banner-dot) { display: none; }
  .banner-actions { width: 100%; }
  .banner-btn { padding: 5px 7px; min-width: 0; flex: 1; }
  body.narrow-mode .col-copilot {
    width: calc(100vw - 12px); min-width: 0; margin: 6px auto;
    border-radius: 12px;
  }
  .col-copilot { padding: 10px; }
  .copilot-header { padding: 9px 10px; }
  .copilot-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 250px; }
  .acc-head { padding: 10px; gap: 7px; }
  .acc-body { padding: 10px; }
  .opp-kpi { padding: 7px 6px; }
  .opp-kpi strong { font-size: 12px; }
  .demo-toolbar-head span { display: none; }
  body.presentation-mode .col-chat { display: none; }
  body.presentation-mode .col-copilot { width: calc(100vw - 12px); min-width: 0; margin: 6px auto; padding: 10px; }
  .evidence-dialog { padding: 16px 14px; }
  .session-dialog { width: calc(100vw - 20px); max-height: calc(100vh - 20px); }
  .session-dialog > :not(.dialog-close) { margin-left: 14px; margin-right: 14px; }
  .record-dialog-head { padding: 18px 38px 13px 0; }
  .record-dialog-head h2 { font-size: 17px; }
  .record-dialog-head p { font-size: 10.5px; }
  .ai-draft-badge { display: none; }
  .session-actions { grid-template-columns: 1fr; }
  .session-action { min-height: 0; }
  .session-dialog .dialog-actions { margin-left: 0; margin-right: 0; padding: 12px 14px; }
  .context-brief { grid-template-columns: auto 1fr; }
  .context-brief em { grid-column: 1 / -1; justify-self: start; }
  .draft-footer { align-items: flex-start; gap: 8px; }
  .draft-footer > span { max-width: 130px; line-height: 1.45; }
  .session-action > span { grid-template-columns: auto minmax(0, 1fr); }
  .ledger-table { min-width: 560px; }
  .ledger-flow { grid-template-columns: 1fr auto 1fr; }
  .ledger-flow span:nth-of-type(3), .ledger-flow span:nth-of-type(4) { margin-top: 4px; }
  .digest-list li { grid-template-columns: 86px minmax(0, 1fr); }
}
