/* ============================================================
   聊天页样式（迁移自参考项目 vant-chat-demo）
   蓝图：参考项目 src/style.css + views/ChatView.vue +
        components/chat/* + components/cards/*
   —— 只在 #chat-view 聊天面板内生效，不污染整站框架。
   ============================================================ */

/* ---------- 蓝白科技风设计 tokens -------- */
:root {
  --brand-600: #2563eb;
  --brand-500: #3b82f6;
  --brand-400: #60a5fa;
  --brand-300: #93c5fd;
  --brand-200: #bfdbfe;
  --brand-100: #dbeafe;
  --brand-50:  #eff6ff;

  --user-gradient: linear-gradient(135deg, #2b8cff 0%, #4fa5ff 55%, #74bdff 100%);

  --text-strong: #16233d;
  --text-main:   #24324e;
  --text-sub:    #5c6b8a;
  --text-weak:   #98a4bd;

  --bg-page:  #eef4fc;
  --bg-card:  #ffffff;
  --bg-soft:  #f4f8fe;
  --bg-soft-2:#e9f1fc;

  --border:    #dbe7f7;
  --divider:   #e8f0fb;

  --shadow-xs: 0 1px 2px rgba(37, 99, 235, 0.05);
  --shadow-sm: 0 2px 8px rgba(37, 99, 235, 0.07);
  --shadow-md: 0 8px 24px rgba(37, 99, 235, 0.10);
  --shadow-lg: 0 12px 32px rgba(37, 99, 235, 0.14);

  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-xl: 24px;

  --glow-brand: 0 6px 18px rgba(59, 130, 246, 0.28);
  --glow-soft:  0 8px 22px rgba(59, 130, 246, 0.16);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- 聊天页容器 -------- */
#chat-view { padding: 0; height: 100%; min-height: 0; overflow: hidden; }
/* 高度继承自 app-shell(--vh 真实可视区)：Hero 固定在上，仅消息区内部滚动 */
.chat-page {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-page);
  overflow: hidden;
  padding: 0;
}
.chat-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: var(--bg-page);
  overflow: hidden;
}

/* 顶部 Hero 区：很矮，只露图中部 3/5；无生硬底边，底部用轻透明渐变过渡到消息区 */
.chat-header {
  position: relative;
  flex-shrink: 0;
  height: calc(100vw / 5);
  min-height: 78px;
  overflow: hidden;
  background: var(--bg-page);
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-image: url('hero-bg.jpg');
  background-repeat: no-repeat;
  background-size: 100% auto;
  background-position: center 50%;
}
.hero-halo {
  position: absolute;
  left: 50%;
  bottom: 16%;
  width: 46%;
  height: 18%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse 50% 100% at center,
    rgba(96, 165, 250, 0.30) 0%, rgba(96, 165, 250, 0.10) 45%, transparent 70%);
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
}
.hero-mask {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.78) 0%, rgba(255, 255, 255, 0.42) 34%,
    rgba(255, 255, 255, 0.05) 60%, rgba(255, 255, 255, 0) 100%);
}
.hero-fade {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 60px;
  background: linear-gradient(180deg, rgba(238, 244, 252, 0) 0%, rgba(238, 244, 252, 0.55) 62%, var(--bg-page) 100%);
  pointer-events: none;
}
.hero-content {
  position: absolute;
  left: 58px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}
/* 左上角：历史对话入口（汉堡按钮，左侧抽屉） */
.hero-menu-button {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--text-sub);
  background: rgb(255 255 255 / 82%);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: all .2s;
}
.hero-menu-button:active { transform: translateY(-50%) scale(.95); }
.hero-menu-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* 右上角：返回键外观（与左上角历史按钮对称），实际功能为新建对话 */
.hero-back-button {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  color: var(--text-sub);
  background: rgb(255 255 255 / 82%);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-xs);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}
.hero-back-button:hover { color: var(--text-main); background: #fff; }
.hero-back-button:active { transform: translateY(-50%) scale(.95); }
.hero-back-button:disabled { opacity: .55; cursor: not-allowed; }
.hero-back-button svg { width: 17px; height: 17px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 480px) {
  .hero-back-button span { display: none; }
  .hero-back-button { padding: 0 9px; }
}

/* 文案中心入口：按业务要求隐藏，保留 DOM 兼容 JS */
.hero-icon-button[hidden] { display: none; }
.hero-icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--text-sub);
  background: rgb(255 255 255 / 82%);
  border: 1px solid var(--border);
  border-radius: 50%;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: all .2s;
}
.hero-icon-button:active { transform: scale(.95); }
.hero-icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.hero-logo { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hero-text { min-width: 0; }
.hero-title { font-size: 16px; font-weight: 800; color: var(--text-strong); letter-spacing: .5px; line-height: 1.25; }
/* 副标题：智能问答 · 快速响应 */
.hero-sub { margin-top: 3px; font-size: 11px; font-weight: 600; color: var(--brand-600); letter-spacing: .5px; white-space: nowrap; }
/* 连接状态点（隐藏元素，供 setConnection 切换；不显示） */
.hero-sub-dot .status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--warning-700);
  box-shadow: 0 0 0 3px var(--warning-100);
}
.hero-sub-dot.is-ready .status-dot { background: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100); }
.hero-sub-dot.is-error .status-dot { background: var(--danger-700); box-shadow: 0 0 0 3px var(--danger-100); }

/* YK 品牌 Logo（蓝渐变圆角方形 + 白色字标 + 顶部高光） */
.yk-logo {
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; letter-spacing: .5px;
  background: linear-gradient(135deg, #3b82f6 0%, #4f8bf7 55%, #7c5cf2 100%);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
  position: relative; overflow: hidden;
}
.yk-logo::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent);
  pointer-events: none;
}

/* ---------- 消息列表 -------- */
.chat-messages {
  flex: 1;
  flex-shrink: 1;
  min-height: 0;
  overflow-y: auto;
  /* 滚动只在本区域内生效：阻止滚动链把整页带动（顶部 Hero / 底部输入栏保持不动） */
  overscroll-behavior: contain;
  padding: 22px 18px 30px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background:
    radial-gradient(64% 34% at 12% 8%, rgba(124, 92, 242, 0.05), transparent 60%),
    radial-gradient(60% 30% at 92% 30%, rgba(96, 165, 250, 0.06), transparent 60%);
}
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* 空态：内容不足时上下留白居中；内容超出时自动归零，改为从顶部开始可滚动。
   不能用 justify-content:center —— flex 居中在内容超高时会把顶部溢出到滚动原点
   上方，那部分永远滚不到（介绍语凭空消失的原因）。auto margin 天然安全。 */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  flex: 1 0 auto; min-height: 50vh; padding: 4vh 20px 2vh; text-align: center;
}
.empty-state > :first-child { margin-top: auto; }
.empty-state > :last-child { margin-bottom: auto; }
.empty-state__rule { width: 56px; height: 4px; margin-bottom: 20px; background: linear-gradient(90deg, var(--brand-500), var(--brand-200)); border-radius: 999px; }
.empty-state h2 { margin: 0; font-size: 24px; font-weight: 800; color: var(--text-strong); }
.empty-state p { max-width: 450px; margin: 12px 0 0; color: var(--text-sub); line-height: 1.75; font-size: 14px; }

/* ---------- 消息渲染器（文本/卡片共用容器） -------- */
.message-renderer { width: 100%; }

/* 消息容器基线（article.message 保留供滚动/定位） */
.message { margin: 0; }
.message__content { min-width: 0; }
.message.is-revealed .message__content { animation: chat-reveal 220ms var(--ease-out); }
/* 待回复（思考中）时保留占位 */
.message.is-pending .message__content { min-height: 30px; }
@keyframes chat-reveal { from { opacity: .32; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
/* AI 思考中（嵌入气泡内） */
.assistant-thinking { display: inline-flex; align-items: center; min-height: 22px; color: var(--brand-500); }
.assistant-thinking .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* 引导问题区（正式项目 guide 展示，套蓝白卡片）
   列数自适应：窄屏/桌面 480px 面板一律 2 列（3 列会把卡片压成竖条），
   超窄屏回退 1 列。 */
.welcome-guide { max-width: 720px; width: 100%; margin: auto; display: flex; flex-direction: column; gap: 20px; }
.welcome-guide__bubble { margin: 0; padding: 22px 24px; color: var(--text-main); background: var(--bg-card); border: 1px solid var(--border); border-left: 3px solid var(--brand-500); border-radius: 6px 18px 18px 18px; line-height: 1.7; font-size: 17px; box-shadow: var(--shadow-sm); }
.welcome-guide__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; flex: 1; align-content: stretch; }
.welcome-guide__item { display: flex; flex-direction: column; justify-content: center; gap: 8px; align-items: flex-start; padding: 18px 20px; text-align: left; color: var(--text-main); background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-xs); transition: border-color 160ms var(--ease-out), transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out); }
.welcome-guide__item:hover:not(:disabled) { border-color: var(--brand-200); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.welcome-guide__label { font-size: 13px; font-weight: 600; color: var(--brand-600); }
.welcome-guide__question { font-size: 14px; line-height: 1.55; color: var(--text-sub); }
.welcome-guide__note { margin: 10px 0 0; color: var(--text-sub); font-size: 13px; text-align: center; }
@media (max-width: 359px) {
  .welcome-guide__grid { grid-template-columns: 1fr; }
}
.clarify-option { display: block; width: 100%; max-width: 420px; margin: 8px auto; padding: 12px 16px; color: var(--text-main); background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-md); font-size: 14px; text-align: center; cursor: pointer; transition: border-color 160ms var(--ease-out), transform 100ms var(--ease-out); }
.clarify-option:hover { border-color: var(--brand-200); transform: translateY(-1px); }
/* 错误消息气泡 */
.text-msg.is-error .msg-bubble { background: #fef2f2; color: var(--danger, #a53d3d); border: 1px solid rgba(165, 61, 61, 0.2); border-radius: 6px 18px 18px 18px; box-shadow: var(--shadow-sm); }

/* ---------- 文本消息（TextMessage）-------- */
.text-msg { display: flex; align-items: flex-start; gap: 10px; width: 100%; }
.text-msg.is-user { flex-direction: row-reverse; }
.msg-avatar { flex-shrink: 0; width: 36px; height: 36px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.msg-avatar.ai-avatar { width: 36px; height: 36px; border-radius: 50%; background: transparent; overflow: hidden; }
.msg-avatar.ai-avatar .yk-logo { border-radius: 50%; width: 36px; height: 36px; }
.msg-avatar.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #4f8bf7, #2563eb); box-shadow: 0 4px 12px rgba(59, 130, 246, 0.30); border: 2px solid #fff; }
.msg-body { display: flex; flex-direction: column; align-items: flex-start; max-width: 90%; min-width: 0; }
.text-msg:not(.is-user) .msg-body { flex: 1 1 auto; max-width: 100%; }
.text-msg.is-user .msg-body { align-items: flex-end; max-width: 76%; }
.msg-bubble { max-width: 100%; padding: 11px 16px; font-size: 15px; line-height: 1.65; word-break: break-word; white-space: pre-wrap; }
.text-msg:not(.is-user) .msg-bubble { background: var(--bg-card); color: var(--text-main); border-radius: 6px 18px 18px 18px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.text-msg.is-user .msg-bubble { background: var(--user-gradient); color: #fff; border-radius: 18px 6px 18px 18px; box-shadow: 0 8px 20px rgba(37, 99, 235, 0.30); }
.msg-meta { display: inline-flex; align-items: center; gap: 8px; margin-top: 5px; padding: 0 4px; }
.msg-time { font-size: 10.5px; color: var(--text-weak); letter-spacing: .02em; white-space: nowrap; }
.msg-tag { align-self: flex-start; font-size: 10px; font-weight: 700; color: var(--brand-500); background: var(--brand-50); border: 1px solid var(--brand-200); padding: 2px 7px; border-radius: 7px; letter-spacing: .5px; }
/* 复制按钮：沿用 msg-meta 的小字层级，默认无底色（不抢视觉），悬停/聚焦才显形。
   触屏设备没有 hover，故 :active 与 .is-done 也给出明确反馈。
   字号与内边距略大于同一行的 msg-time/msg-tag —— 复制是高频操作，需保证触屏点击热区。 */
.msg-copy {
  flex: none;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px; border-radius: 7px;
  font-family: inherit; font-size: 11px; line-height: 1.3;
  color: var(--text-weak); background: transparent;
  border: 1px solid transparent; cursor: pointer;
  transition: color .16s, background .16s, border-color .16s;
}
.msg-copy svg { width: 13px; height: 13px; flex: none; }
.msg-copy:hover, .msg-copy:focus-visible { color: var(--brand-600); background: var(--brand-50); border-color: var(--brand-200); }
.msg-copy:active { transform: scale(.94); }
.msg-copy.is-done { color: var(--brand-600); background: var(--brand-50); border-color: var(--brand-200); }
.msg-text { word-break: break-word; white-space: pre-wrap; }
/* AI 输出内富文本（标题/列表/代码块/表格）保持 markdown 语义 + 蓝白精排版 */
.text-msg:not(.is-user) .msg-bubble h2, .text-msg:not(.is-user) .msg-bubble h3 { font-family: inherit; line-height: 1.4; }
.text-msg:not(.is-user) .msg-bubble h2 { font-size: 17px; position: relative; padding-left: 12px; margin: 18px 0 10px; }
.text-msg:not(.is-user) .msg-bubble h2::before { content: ''; position: absolute; left: 0; top: 2px; bottom: 2px; width: 4px; border-radius: 3px; background: linear-gradient(180deg, var(--brand-500), var(--brand-300)); }
.text-msg:not(.is-user) .msg-bubble h3 { font-size: 15px; margin: 14px 0 8px; font-weight: 700; color: var(--text-strong); }
.text-msg:not(.is-user) .msg-bubble p { margin: 0 0 .7em; }
.text-msg:not(.is-user) .msg-bubble p:last-child { margin-bottom: 0; }
.text-msg:not(.is-user) .msg-bubble ul, .text-msg:not(.is-user) .msg-bubble ol { padding-left: 1.5em; margin: 0 0 .8em; }
.text-msg:not(.is-user) .msg-bubble li { margin: .35em 0; line-height: 1.7; }
.text-msg:not(.is-user) .msg-bubble li::marker { color: var(--brand-400); }
.text-msg:not(.is-user) .msg-bubble a { color: var(--brand-600); text-underline-offset: 3px; }
.text-msg:not(.is-user) .msg-bubble strong { font-weight: 700; color: var(--text-strong); }
.text-msg:not(.is-user) .msg-bubble code { padding: .15em .35em; background: var(--bg-soft); border-radius: 4px; font-family: "Cascadia Mono", Consolas, monospace; font-size: .9em; }
.text-msg:not(.is-user) .msg-bubble pre { overflow-x: auto; padding: 14px; color: #e9eee9; background: #202723; border-radius: var(--r-md); font-size: 13px; }
.text-msg:not(.is-user) .msg-bubble pre code { padding: 0; background: transparent; }
.text-msg:not(.is-user) .msg-bubble blockquote { margin: 0 0 .8em; padding: 10px 14px; background: var(--bg-soft); border-left: 3px solid var(--brand-400); border-radius: 0 10px 10px 0; color: var(--text-sub); }
/* 表格（后端 markdown 输出时生效） */
.text-msg:not(.is-user) .msg-bubble table { width: 100%; margin: 0 0 .9em; border-collapse: collapse; font-size: 13px; border-radius: 10px; overflow: hidden; }
.text-msg:not(.is-user) .msg-bubble thead th { background: var(--brand-50); color: var(--brand-600); font-weight: 700; text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--brand-100); }
.text-msg:not(.is-user) .msg-bubble td { padding: 9px 12px; border-bottom: 1px solid var(--divider); }
.text-msg:not(.is-user) .msg-bubble tbody tr:nth-child(odd) { background: var(--bg-soft); }

/* 思考中指示器（聊天页内） */
.thinking-row { display: flex; align-items: flex-start; gap: 10px; }
.thinking-avatar { flex-shrink: 0; width: 36px; height: 36px; border-radius: 12px; background: linear-gradient(135deg, #4f8bf7, #2563eb); display: flex; align-items: center; justify-content: center; box-shadow: var(--glow-brand); }
.thinking-bubble { display: flex; align-items: center; gap: 8px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px 18px 18px 18px; box-shadow: var(--shadow-sm); padding: 12px 18px; font-size: 14px; color: var(--text-sub); }
.typing-dots { display: inline-flex; align-items: center; gap: 4px; }
.typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-400); animation: chat-bounce 1.3s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .18s; }
.typing-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes chat-bounce { 0%, 80%, 100% { transform: scale(.6); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }

/* ---------- 底部输入区（ChatInput，完全按参考项目）-------- */
.chat-input {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;   /* 键盘弹起时不压缩输入栏 */
  padding: 12px 14px;
  padding-bottom: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(244, 248, 254, 0.98));
  border-top: 1px solid var(--divider);
  box-shadow: 0 -6px 20px rgba(37, 99, 235, 0.06);
}

.input-btn {
  flex-shrink: 0;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--bg-soft);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all .2s;
  box-shadow: inset 0 0 0 1px var(--divider);
}
.input-btn:active { transform: scale(.95); }
.mic-btn { background: #fff; box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08); }
.send-btn { background: linear-gradient(135deg, #3b82f6 0%, #4f8bf7 55%, #7c5cf2 100%); box-shadow: 0 6px 16px rgba(59, 130, 246, 0.32); }
.send-btn:disabled { background: #c3d5f5; box-shadow: none; cursor: not-allowed; }
.input-wrap {
  flex: 1; min-width: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 16px;
  display: flex; align-items: flex-end;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.06);
}
.input-wrap:focus-within { border-color: var(--brand-300); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12); }
.input-textarea { width: 100%; border: none; outline: none; background: transparent; resize: none; font-size: 16px; line-height: 1.5; color: var(--text-main); max-height: 96px; font-family: inherit; }
.input-textarea::placeholder { color: var(--text-weak); }

/* ---------- 底部版权条（贴底，紧凑，避免露出白边）-------- */
.chat-footer {
  flex-shrink: 0;
  text-align: center;
  font-size: 11px;
  color: var(--text-weak);
  letter-spacing: .5px;
  line-height: 1;
  padding: 8px 20px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  background: transparent;
}

/* ---------- 通用卡片基础 -------- */
.ai-card {
  position: relative;
  width: 100%;
  background: var(--bg-card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  overflow: hidden;
}
.ai-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.16), transparent);
  pointer-events: none;
}
.ai-icon-plate {
  flex-shrink: 0;
  width: 42px; height: 42px;
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eaf2ff, #d7e6ff);
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.10), 0 2px 6px rgba(59, 130, 246, 0.10);
  color: #2f6fe0;
}
.card-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 44px; padding: 0 18px; border-radius: 13px;
  font-size: 14px; font-weight: 600; line-height: 1; border: none; cursor: pointer;
  transition: all .2s ease; flex: 1;
}
.card-btn:active { transform: scale(.97); }
.card-btn--primary { background: linear-gradient(135deg, #3b82f6 0%, #4f8bf7 55%, #7c5cf2 100%); color: #fff; box-shadow: 0 6px 18px rgba(59, 130, 246, 0.32); }
.card-btn--ghost { background: var(--bg-soft); color: var(--brand-600); border: 1px solid var(--border); }
.card-head { display: flex; align-items: center; gap: 12px; padding: 20px 20px 12px; }
.card-head-text { min-width: 0; }
.card-title { font-size: 16px; font-weight: 700; color: var(--text-strong); line-height: 1.35; }
.card-sub { font-size: 12px; color: var(--text-sub); margin-top: 3px; word-break: break-word; }
.card-actions { display: flex; gap: 10px; padding: 0 20px 20px; }
.btn-icon { display: inline-flex; align-items: center; }

/* ---------- 门店信息卡 -------- */
.store-card .card-body { padding: 0 20px 16px; display: flex; flex-direction: column; gap: 10px; }
.store-row { display: flex; align-items: flex-start; gap: 12px; background: var(--bg-soft); border-radius: 12px; padding: 13px 16px; border: 1px solid var(--divider); }
.store-label { flex-shrink: 0; font-size: 13px; color: var(--text-sub); min-width: 0; }
.store-value { flex: 1 1 auto; min-width: 0; font-size: 14px; font-weight: 600; color: var(--text-strong); word-break: break-all; overflow-wrap: anywhere; text-decoration: none; }

/* ---------- 产品卡 -------- */
.product-card .card-body { padding: 0 20px 16px; display: flex; flex-direction: column; gap: 10px; }
.prod-desc { font-size: 14px; color: var(--text-main); line-height: 1.7; background: var(--bg-soft); border-radius: 12px; padding: 13px 16px; border: 1px solid var(--divider); word-break: break-all; overflow-wrap: anywhere; }
.prod-row { display: flex; align-items: flex-start; gap: 12px; background: var(--bg-soft); border-radius: 12px; padding: 12px 16px; border: 1px solid var(--divider); }
.prod-label { flex-shrink: 0; font-size: 13px; color: var(--text-sub); min-width: 0; }
.prod-value { flex: 1 1 auto; min-width: 0; font-size: 14px; font-weight: 600; color: var(--text-strong); word-break: break-all; overflow-wrap: anywhere; }
.prod-price { color: var(--brand-600); }

/* ---------- 引导按钮卡 -------- */
.action-card .card-body { padding: 0 20px 18px; }
.action-body { display: flex; flex-wrap: wrap; gap: 9px; }
.action-chip { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 16px; font-size: 13px; font-weight: 600; color: var(--brand-600); background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px; cursor: pointer; transition: all .2s; }
.action-chip:active { transform: scale(.96); }
.action-chip:hover { border-color: var(--brand-200); }

/* ---------- 品牌总览卡 -------- */
.overview-card .card-head { padding: 20px 20px 12px; }
.overview-card .card-body { padding: 0 20px 18px; display: flex; flex-direction: column; gap: 10px; }
.overview-desc { font-size: 14px; color: var(--text-main); line-height: 1.7; background: var(--bg-soft); border-radius: 12px; padding: 13px 16px; border: 1px solid var(--divider); word-break: break-all; overflow-wrap: anywhere; }
.overview-chip { width: 100%; justify-content: space-between; gap: 10px; padding: 11px 14px 11px 16px; }
.overview-hint { flex-shrink: 0; font-size: 12px; font-weight: 500; color: var(--text-sub); }

/* ---------- 知识讲解卡片 -------- */
.knowledge-card .card-head { padding: 20px 20px 12px; }
.knowledge-card .card-body { padding: 0 20px 14px; display: flex; flex-direction: column; gap: 12px; }
.knowledge-desc { font-size: 14px; color: var(--text-main); line-height: 1.7; background: var(--bg-soft); border-radius: 12px; padding: 14px 16px; border: 1px solid var(--divider); word-break: break-all; overflow-wrap: anywhere; }
.knowledge-points { list-style: none; display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; }
.point-item { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--text-main); line-height: 1.6; }
.point-dot { flex-shrink: 0; margin-top: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--brand-400); }
.point-text { flex: 1 1 auto; min-width: 0; word-break: break-all; overflow-wrap: anywhere; white-space: pre-wrap; }
.knowledge-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-chip { font-size: 12px; font-weight: 600; color: var(--brand-600); background: var(--bg-soft); border: 1px solid var(--border); padding: 5px 12px; border-radius: 16px; }

/* ---------- 桌面端适配：≥768px 居中限宽成独立聊天面板 -------- */
@media (min-width: 768px) {
  .chat-page { padding: 28px 0; background: #e9effa; }
  .chat-shell { max-width: 480px; height: calc(100% - 56px); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
  .chat-header { height: 96px; }
}

/* ============================================================
   事实行增强（2026-09-07）：官方入口 / 公司地址行的图标信息卡
   与价格数字高亮。浅底 + 渐变图标容器，延续蓝白科技风 tokens。
   ============================================================ */
.msg-bubble .fact-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 9px 0;
  padding: 9px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.msg-bubble .fact-row .ai-icon-plate {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 9px;
  margin-top: 1px;
}
.msg-bubble .fact-row .ai-icon-plate svg { width: 17px; height: 17px; }
.msg-bubble .fact-row__text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-main);
  word-break: break-all;
  overflow-wrap: anywhere;
}
.msg-bubble .fact-row__text a {
  color: var(--brand-600);
  font-weight: 600;
  word-break: break-all;
}
.msg-bubble .fact-row--address { border-left: 3px solid var(--brand-500); }
.msg-bubble .fact-row--entry   { border-left: 3px solid #10b981; }
.msg-bubble .fact-row--entry .ai-icon-plate { background: linear-gradient(135deg, #ecfdf5, #d1fae5); color: #059669; box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.12), 0 2px 6px rgba(16, 185, 129, 0.10); }
/* ---------- 精致官方入口卡 ---------- */
.entry-card {
  display: flex; flex-direction: column; gap: 8px;
  margin: 9px 0;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.entry-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(135deg, var(--bg-soft), #f8fbfd);
  text-decoration: none;
  transition: transform 140ms var(--ease-out), border-color 140ms var(--ease-out), box-shadow 140ms var(--ease-out);
}
.entry-item:hover {
  transform: translateY(-1px);
  border-color: var(--brand-200);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.10);
}
.entry-item .ai-icon-plate {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  color: #059669;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.12), 0 2px 6px rgba(16, 185, 129, 0.10);
}
.entry-item .ai-icon-plate svg { width: 19px; height: 19px; }
.entry-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.entry-name { font-size: 14px; font-weight: 650; color: var(--text-strong); line-height: 1.3; }
.entry-url { font-size: 12px; color: var(--text-sub); word-break: break-all; overflow-wrap: anywhere; }
.entry-arrow { margin-left: auto; color: var(--text-sub); flex-shrink: 0; display: flex; }
/* ---------- 官方渠道卡（official_card）--------- */
.official-card .card-body { padding: 0 20px 18px; display: flex; flex-direction: column; gap: 8px; }
.official-card .entry-item { padding: 12px 14px; }
.official-card .entry-name { font-size: 15px; }
.entry-usage { font-size: 12px; color: var(--text-sub); line-height: 1.45; margin-top: 1px; }
.msg-bubble .price-num {
  color: var(--brand-600);
  font-weight: 700;
  white-space: nowrap;
}

/* ============================================================
   长文本装饰（2026-09-07）：列表卡片行 + 标题骨架。
   回答里的长枚举（赋能方向/使用方法/注意事项等）渲染成浅底卡片行：
   ul=渐变圆点、ol=渐变序号徽标；##/### 标题带左色条与层级。
   只装饰结构、不改文字语义，与 fact-row/卡片同一蓝白视觉体系。
   ============================================================ */
.msg-bubble ul.deco-list,
.msg-bubble ol.deco-list {
  list-style: none;
  margin: 10px 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.msg-bubble .deco-list__item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-main);
  word-break: break-word;
  overflow-wrap: anywhere;
  flex-wrap: nowrap;
}
/* 列表项文字块：占满剩余空间并强制任意断行，避免长中文被挤压竖排 */
.msg-bubble .deco-list__text {
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-all;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.msg-bubble ul.deco-list .deco-list__item::before {
  content: "";
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 9px;
  background: linear-gradient(135deg, #3b82f6, #7c5cf2);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}
.msg-bubble ol.deco-list { counter-reset: deco-item; }
.msg-bubble ol.deco-list .deco-list__item { counter-increment: deco-item; }
.msg-bubble ol.deco-list .deco-list__item::before {
  content: counter(deco-item);
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6 0%, #4f8bf7 55%, #7c5cf2 100%);
  box-shadow: 0 3px 8px rgba(59, 130, 246, 0.25);
}
.msg-bubble .deco-list .deco-list {
  margin: 8px 0 2px;
  gap: 6px;
}
.msg-bubble .deco-list .deco-list .deco-list__item {
  padding: 8px 12px;
  background: transparent;
  border-color: transparent;
  font-size: 13px;
}
.msg-bubble .msg-h2 {
  position: relative;
  margin: 16px 0 8px;
  padding-left: 11px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-strong);
  line-height: 1.45;
}
.msg-bubble .msg-h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(180deg, #3b82f6, #7c5cf2);
}
.msg-bubble .msg-h3 {
  margin: 12px 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
  line-height: 1.45;
}

/* ---------- 计算卡（单价×数量=结果）--------- */
.calc-card .card-body { padding: 0 20px 18px; display: flex; flex-direction: column; gap: 10px; }
.calc-expression {
  font-size: 22px;
  font-weight: 800;
  color: var(--brand-600);
  letter-spacing: .5px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  padding: 16px 14px;
  background: linear-gradient(135deg, var(--brand-50), var(--bg-soft));
  border: 1px solid var(--brand-100);
  border-radius: 12px;
}
.calc-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 14px; }
.calc-label { color: var(--text-sub); }
.calc-value { font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; }
