/* 销售助手 —— 对话式布局（复用 styles.css 的设计变量） */
.aid-app { display:flex; flex-direction:column; height:100dvh; background:var(--bg); }

.aid-top { flex:0 0 56px; display:flex; align-items:center; justify-content:space-between;
  padding:0 18px; background:var(--panel); border-bottom:1px solid var(--line); }
.aid-brand { display:flex; align-items:center; gap:10px; }
.aid-brand .aid-logo { width:34px; height:34px; border-radius:9px;
  background:var(--brand); color:#fff; display:grid; place-items:center;
  font-weight:700; font-size:16px; }
.aid-brand strong { font-size:15px; }
.aid-brand small { display:block; font-size:11.5px; color:var(--ink3); }
.aid-user { display:flex; align-items:center; gap:8px; }
/* [ui-v3c] 角色标签排到按钮左边，让「话术库」「新对话」贴住右边缘（与左侧 logo 的 18px 对称） */
.aid-top .aid-user .role-tag { order:-1; }

.aid-wrap { flex:1 1 auto; display:flex; min-height:0; max-width:1080px;
  width:100%; margin:0 auto; }
.aid-scenes { flex:0 0 200px; padding:16px 14px; border-right:1px solid var(--line);
  background:var(--panel); overflow-y:auto; }
.aid-scene-title { font-size:12px; color:var(--ink3); margin-bottom:10px; font-weight:600; }
.aid-scene-list { display:flex; flex-direction:column; gap:8px; }
.aid-scene { text-align:left; padding:9px 12px; border-radius:9px;
  background:#f7fafc; border:1px solid var(--line); font-size:13px; }
.aid-scene:hover { border-color:var(--brand); color:var(--brand); background:#f2f7ff; }

.aid-main { flex:1 1 auto; display:flex; flex-direction:column; min-width:0; }
.aid-chat { flex:1 1 auto; overflow-y:auto; padding:18px 20px; display:flex;
  flex-direction:column; gap:14px; }

/* [ui-v3c] 电脑端：对话区右侧一条淡竖线，位置与输入框右边缘对齐（输入区左右留 16px） */
@media (min-width: 821px) {
  .aid-chat { margin-right:16px; border-right:1px solid #edf2f7; }
}
.aid-hello { background:#eef5ff; border:1px solid #d6e7ff; border-radius:12px;
  padding:14px 16px; font-size:13.5px; color:var(--ink2); line-height:1.7; }
.aid-hello b { color:var(--ink); }

.aid-msg { max-width:82%; }
.aid-msg.user { align-self:flex-end; }
.aid-msg.user .aid-bubble { background:var(--brand); color:#fff; border-bottom-right-radius:4px; }
.aid-msg.assistant { align-self:flex-start; }
.aid-msg.assistant .aid-bubble { background:var(--panel); border:1px solid var(--line);
  border-bottom-left-radius:4px; white-space:pre-wrap; }
.aid-bubble { padding:11px 14px; border-radius:12px; font-size:14px; line-height:1.75; }

.aid-meta { margin-top:8px; display:flex; flex-direction:column; gap:6px; }
.aid-tag { display:inline-block; font-size:11px; padding:1px 8px; border-radius:20px;
  background:#f2f4f7; color:var(--ink3); }
.aid-next { font-size:13px; color:var(--ok); border-left:3px solid var(--ok);
  padding:4px 10px; background:#e9f8f1; border-radius:6px; }
.aid-next b { margin-right:4px; }

.aid-warn { border:1px solid #f6d9a0; background:#fff8e8; border-left:4px solid var(--warn);
  border-radius:8px; padding:8px 12px; font-size:12.5px; color:#7a5210; }
.aid-warn .aid-warn-head { font-weight:700; color:var(--warn); margin-bottom:3px; }
.aid-src { border:1px solid var(--line); border-left:3px solid var(--brand);
  background:#fbfcfe; border-radius:8px; padding:7px 11px; font-size:12px; }
.aid-src .aid-src-type { font-size:10.5px; color:var(--brand); font-weight:600; margin-right:6px; }
.aid-src .aid-src-title { color:var(--ink2); }
.aid-src .aid-src-body { color:var(--ink3); margin-top:3px; line-height:1.6;
  display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }

/* 依据折叠：默认只显示「依据 N 条 ▾」，点开才展开，避免每轮堆一大段 */
.aid-src-toggle { font:inherit; font-size:11.5px; color:var(--ink2); background:#f2f5f9;
  border:1px solid var(--line); border-radius:14px; padding:2px 10px; cursor:pointer; }
.aid-src-toggle:hover { color:var(--brand); border-color:var(--brand); }
.aid-src-list { display:flex; flex-direction:column; gap:6px; margin-top:6px; }
.aid-src-list.hidden { display:none; }

/* ===== 二期：产品对比卡（客户说"别家更便宜"时直接出表格） ===== */
.aid-cmp { border:1px solid #cfe3f6; background:#fbfdff; border-radius:10px;
  padding:10px 12px; font-size:12.5px; }
.aid-cmp-head { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:8px; }
.aid-cmp-head b { font-size:13px; color:var(--ink); }
.aid-cmp-head .aid-tag { background:#e6f1fb; color:#1160a8; }
.aid-cmp table { width:100%; border-collapse:collapse; }
.aid-cmp th, .aid-cmp td { border-bottom:1px solid #e3eef8; padding:5px 7px;
  text-align:left; vertical-align:top; font-size:12px; line-height:1.55; }
.aid-cmp th { color:var(--ink3); font-weight:600; background:#f4f9ff; white-space:nowrap; }
.aid-cmp td.dim { color:var(--ink2); white-space:nowrap; font-weight:600; }
.aid-cmp tr.our td { background:#f2fbf5; }
.aid-cmp .vd { white-space:nowrap; font-weight:600; }
.aid-cmp .vd.our_better { color:var(--ok); }
.aid-cmp .vd.rival_better { color:var(--err); }
.aid-cmp .vd.equal, .aid-cmp .vd.different { color:var(--ink3); }
.aid-cmp-foot { margin-top:6px; font-size:11px; color:var(--ink3); }

/* ===== 二期：收藏按钮 / 话术库抽屉 ===== */
  border:1px solid var(--line); border-radius:14px; padding:2px 10px; cursor:pointer; }

.aid-drawer { position:fixed; inset:0 0 0 auto; width:min(520px, 94vw);
  background:#fff; z-index:60; display:flex; flex-direction:column;
  box-shadow:-14px 0 44px rgba(16,32,58,.18); }
.aid-drawer.hidden { display:none; }
.aid-drawer-head { display:flex; align-items:center; justify-content:space-between;
  padding:12px 16px; border-bottom:1px solid var(--line); }
.aid-drawer-body { flex:1 1 auto; overflow-y:auto; padding:12px 16px; }
  margin-bottom:10px; font-size:12.5px; line-height:1.7; }
  font-size:11px; color:var(--ink3); }
  border-radius:13px; border:1px solid var(--line); background:#fff; cursor:pointer; }
.aid-gap { font-size:11.5px; color:#8a6d1f; background:#fffaeb;
  border:1px dashed #e8cf94; border-radius:8px; padding:5px 9px; }

/* ===== 联网：勾选框 + 过程折叠 ===== */
.aid-webcheck { display:inline-flex; align-items:center; gap:5px; margin-left:auto;
  font-size:12.5px; color:var(--ink2); cursor:pointer; user-select:none;
  border:1px solid #d9e2ec; border-radius:8px; padding:5px 10px; background:#fff; }
.aid-webcheck:hover { border-color:var(--brand); color:var(--brand); }
.aid-webcheck input { margin:0; accent-color:var(--brand); }
/* [P8] 「全局」勾选框别抢 margin-left:auto */
.aid-globalcheck { margin-left:8px; }

.aid-wt { border:1px solid #d9e2ec; background:#fbfcfe; border-radius:10px; padding:8px 10px; }
.aid-wt-toggle { background:none; border:0; padding:0; cursor:pointer;
  font-size:12.5px; font-weight:600; color:var(--brand); }
.aid-wt-list { margin-top:7px; }
.aid-wt-row { display:flex; flex-wrap:wrap; align-items:baseline; gap:6px;
  padding:5px 0; border-top:1px dashed #e3eaf2; font-size:12px; }
.aid-wt-row:first-child { border-top:0; }
.aid-wt-badge { flex:0 0 auto; padding:1px 6px; border-radius:6px; font-size:11px; font-weight:600; }
.aid-wt-badge.ok { background:#e6f6ec; color:#1a7f45; }
.aid-wt-badge.fail { background:#fdeaea; color:#b42318; }
.aid-wt-url { color:#1160a8; word-break:break-all; flex:1 1 220px; }
.aid-wt-meta { color:var(--ink3); font-size:11px; }
.aid-wt-pv { flex:1 1 100%; color:var(--ink2); line-height:1.55;
  background:#f4f8fc; border-radius:6px; padding:4px 7px; word-break:break-all; }
.aid-wt-foot { margin-top:6px; font-size:11px; color:var(--ink3); }

/* ===== 北京在售清单卡 ===== */
.aid-bj { border:1px solid #cfe3f6; background:#fbfdff; border-radius:10px;
  padding:10px 12px; font-size:12.5px; }
.aid-bj-head { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:8px; }
.aid-bj-head b { font-size:13px; color:var(--ink); }
.aid-bj-head .aid-tag { background:#e6f1fb; color:#1160a8; }
.aid-bj table { width:100%; border-collapse:collapse; }
.aid-bj th, .aid-bj td { border-bottom:1px solid #e3eef8; padding:5px 7px;
  text-align:left; vertical-align:top; font-size:12px; line-height:1.55; }
.aid-bj th { color:var(--ink3); font-weight:600; background:#f4f9ff; white-space:nowrap; }
.aid-bj td.dim { color:var(--ink2); white-space:nowrap; font-weight:600; }

/* ===== 价格对比卡：同等保额年化成本 + 差在哪 + 反问 ===== */
.aid-price { border:1px solid #d9e6f2; background:#f7fbff; border-radius:10px;
  padding:9px 12px; font-size:12.5px; }
.aid-price-head { display:flex; align-items:center; gap:8px; margin-bottom:6px; }
.aid-price-head b { font-size:13px; color:var(--ink); }
.aid-price-row { display:flex; gap:8px; padding:2px 0; line-height:1.6; }
.aid-price-row > span { flex:0 0 40px; color:var(--ink3); }
.aid-price-row > b { color:var(--ink); font-weight:600; }
.aid-price-gap { margin-top:5px; padding-top:5px; border-top:1px dashed #dbe7f2;
  color:var(--ink2); line-height:1.6; }
.aid-price-ask { margin-top:6px; background:#fff8e6; border-radius:7px;
  padding:5px 9px; color:#8a6d1f; line-height:1.6; }
.aid-price-fresh { margin-top:5px; font-size:11px; color:var(--ink3); }
/* 价格超过 90 天未更新：必须红黄醒目，别让销售拿旧价去报 */
.aid-price-stale { margin-top:6px; font-size:11.5px; line-height:1.6;
  color:#8a3b00; background:#fff1e0; border:1px solid #f6d9a0;
  border-left:3px solid var(--warn); border-radius:7px; padding:5px 9px; }

.aid-stream-body { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.aid-stream-body .aid-bubble { white-space: normal; }
.aid-stream-body .aid-card-wide { width: 100%; }
.aid-status { color: var(--ink3); }
.aid-preview { white-space: pre-wrap; word-break: break-word; }
.aid-preview-text { white-space: pre-wrap; }
.aid-preview-text.aid-status { color: var(--ink3); }
.aid-caret {
  display: inline-block; width: 2px; height: 1.05em; margin-left: 2px;
  background: #0f1423; vertical-align: -0.15em;
  animation: aid-caret-blink 1s step-end infinite;
}
@keyframes aid-caret-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.aid-backtop {
  position: sticky; bottom: 10px; float: right; display: none;
  margin: 4px 8px 4px auto; padding: 5px 12px;
  border: 1px solid var(--line, #d6dfec); border-radius: 14px;
  background: #fff; color: var(--ink2, #4a5566); font-size: 12px;
  cursor: pointer; box-shadow: 0 2px 8px rgba(15, 20, 35, .08);
}
.aid-typing { align-self:flex-start; color:var(--ink3); font-size:13px; padding:6px 4px; }

.aid-input { flex:0 0 auto; border-top:1px solid var(--line); background:var(--panel);
  padding:12px 16px; }
/* 产品选择栏：手动指定比自动识别更稳，选完即锁定整个会话 */
/* [fix-v9d] 产品锁样式已弃用 */

/* [ui-v3 2026-10-27] 输入框 + 图形发送键（豆包式）；文字按钮与语音条一并隐去 */
.aid-composer { display:flex; align-items:flex-end; gap:8px; background:#fff;
  border:1px solid #d3dbe6; border-radius:14px; padding:6px 8px 6px 12px;
  transition:border-color .15s ease, box-shadow .15s ease; }
.aid-composer:focus-within { border-color:var(--brand); box-shadow:0 0 0 3px rgba(0,133,208,.10); }
.aid-composer textarea { flex:1 1 auto; width:100%; box-sizing:border-box; resize:none;
  border:0; outline:0; background:transparent; min-height:44px; max-height:140px;
  padding:9px 0; font:inherit; font-size:14px; line-height:1.5; }
/* [ui-v4 2026-10-27] 修 bug：styles.css 的全局 button:hover 会把 color 改成品牌蓝，
   而本键底色就是品牌蓝、箭头用 currentColor → hover 时白箭头“消失”。这里逐态钉死白字。 */
.aid-send { flex:0 0 auto; width:44px; height:44px; box-sizing:border-box; padding:0;
  border-radius:50%; border:0; background:var(--brand); color:#fff;
  display:inline-flex; align-items:center; justify-content:center; cursor:pointer;
  box-shadow:0 2px 8px rgba(0,133,208,.28);
  transition:transform .08s ease, background-color .15s ease, box-shadow .15s ease; }
.aid-send svg { width:34px; height:34px; display:block; }
.aid-send, .aid-send:link, .aid-send:visited,
.aid-send:hover, .aid-send:focus, .aid-send:active, .aid-send:focus-visible {
  color:#fff; border-color:transparent; }
.aid-send:hover { background:var(--brand2); box-shadow:0 3px 12px rgba(0,133,208,.34); }
.aid-send:active { transform:scale(.94); }
.aid-send:focus-visible { outline:2px solid rgba(0,133,208,.45); outline-offset:2px; }
.aid-send[disabled] { opacity:.45; cursor:default; transform:none; box-shadow:none; }
.aid-send[disabled]:hover { background:var(--brand); box-shadow:none; }

/* [stream] 处理中：白箭头隐藏，居中显示红色方块（不整键置灰，保证方块可见） */
.aid-send.is-busy { cursor:pointer; }   /* 红方块可点=停止生成 */
.aid-send.is-busy svg { display:none; }
.aid-send.is-busy::after {
    content:""; width:14px; height:14px; border-radius:3px;
    background:#ff4d4f; box-shadow:0 0 0 2px rgba(255,77,79,.20);
    animation:aidBusyPulse 1.15s ease-in-out infinite;
  }
.aid-send.is-busy:hover { background:var(--brand2); box-shadow:0 3px 12px rgba(0,133,208,.34); }
.aid-send.is-busy:active { transform:none; }
@keyframes aidBusyPulse { 0%,100% { opacity:1; } 50% { opacity:.55; } }

/* [ui-v3] 隐去但不删除：语音条、联网/全局勾选、培训/管理员登录入口 —— 完全不占布局 */
.aid-hide, .aid-actions, .voice-bar { display:none !important; }

/* [ui-v3] 品牌标题＝全局开关，开启时带下划线（等同原来勾上「全局」） */
.aid-brand-title { cursor:pointer; user-select:none; -webkit-user-select:none; }
.aid-brand-title.on { text-decoration:underline; text-underline-offset:3px;
  text-decoration-thickness:2px; }
.aid-foot { flex:0 0 auto; text-align:center; font-size:11.5px; color:var(--ink3);
  padding:8px 12px; }

@media (max-width:760px) {
  .aid-scenes { display:none; }
  .aid-msg { max-width:92%; }
}

/* [compact 2026-10-26] 坐席窗口：压缩气泡内空行 */
.aid-msg.assistant .aid-bubble { line-height:1.6; }
.aid-bubble p { margin:0 0 5px; }
.aid-bubble p:last-child { margin-bottom:0; }
.aid-bubble ul, .aid-bubble ol { margin:2px 0 5px; padding-left:17px; }
.aid-bubble li { margin:0; }
.aid-bubble li > p { margin:0; }
.aid-bubble h1, .aid-bubble h2, .aid-bubble h3, .aid-bubble h4 {
  font-size:14px; font-weight:700; margin:7px 0 3px; color:var(--ink);
}
.aid-bubble h1:first-child, .aid-bubble h2:first-child, .aid-bubble h3:first-child { margin-top:0; }
.aid-bubble hr { margin:6px 0; border:0; border-top:1px solid var(--line); }
.aid-bubble blockquote { margin:4px 0; padding:2px 0 2px 8px; border-left:2px solid var(--line); color:var(--ink2); }
.aid-bubble table { font-size:12.5px; }
.aid-bubble strong { font-weight:700; }
.aid-bubble code { font-size:12.5px; }

/* [ui-v2 2026-10-26] 整宽卡片（从气泡里搬出来的对比/资费表）+ 操作按钮 */
.aid-msg.assistant.has-card { max-width:100%; width:100%; }
.aid-card-wide { width:100%; box-sizing:border-box; overflow-x:auto; background:#fbfdff;
  border:1px solid #cfe3f6; border-radius:10px; padding:8px 10px; margin:0; }
.aid-card-wide table { width:100%; border-collapse:collapse; font-size:13px; margin:0;
  table-layout:auto; }
.aid-card-wide th, .aid-card-wide td { padding:6px 7px; vertical-align:top; line-height:1.5;
  text-align:left; border-bottom:1px solid #e3eef8; word-break:break-word; }
.aid-card-wide th { background:#f4f9ff; font-weight:700; color:#16212f; white-space:nowrap; }
.aid-card-wide tr:last-child td { border-bottom:0; }
.aid-card-wide br + br { display:none; }
.aid-msg.assistant .aid-bubble + .aid-card-wide,
.aid-card-wide + .aid-bubble { margin-top:6px; }

/* [fix-v7 2026-10-26] 对比卡行底色：我方有利淡绿，对方有利淡粉，其余不变色 */
.aid-card-wide tr.row-ours td { background:#f2fbf5; }
.aid-card-wide tr.row-rival td { background:#fdeceb; }
.aid-card-wide tr.row-ours td:first-child { box-shadow:inset 3px 0 0 #bfe6d3; }
.aid-card-wide tr.row-rival td:first-child { box-shadow:inset 3px 0 0 #f3c9c5; }

button.is-busy { opacity: .5; cursor: not-allowed; }

/* [ui] 对比卡折叠：默认只显示前 5 行 */
tr.aid-folded { display: none; }
.aid-cmp-more {
  display: block; width: 100%; margin: 6px 0 0; padding: 7px 0;
  border: 0; border-top: 1px dashed var(--line, #d6dfec); background: transparent;
  color: var(--brand, #0085d0); font: inherit; font-size: 12px; cursor: pointer;
}
.aid-cmp-more:hover { background: rgba(0,133,208,.06); }
