/* 商企亿脉 AI 助手 - H5 对话页面样式（适配移动端 / 小程序 web-view） */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f6fa;
  color: #333;
}

/* 头部 */
.chat-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 14px;
  background: linear-gradient(135deg, #4f6ef7, #6a5cf7);
  color: #fff;
}
.header-brand { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  font-size: 18px;
}
.brand-name { font-size: 15px; font-weight: 600; }
.brand-sub { font-size: 11px; opacity: 0.85; }

/* 消息区 */
.msg-list {
  padding: 68px 12px 70px;
  overflow-y: auto;
  height: 100vh;
}
.msg { display: flex; margin-bottom: 12px; }
.msg-user { justify-content: flex-end; }
.msg-ai { justify-content: flex-start; }
.bubble {
  max-width: 78%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-ai .bubble {
  background: #fff;
  border: 1px solid #eee;
  border-top-left-radius: 4px;
}
.msg-user .bubble {
  background: #4f6ef7;
  color: #fff;
  border-top-right-radius: 4px;
}

/* AI 消息的 Markdown 渲染样式 */
.msg-ai .bubble.md { white-space: normal; }
.bubble.md p { margin: 0 0 6px; }
.bubble.md p:last-child { margin-bottom: 0; }
.bubble.md ul,
.bubble.md ol { margin: 4px 0 6px; padding-left: 18px; }
.bubble.md li { margin-bottom: 3px; }
.bubble.md strong { font-weight: 600; }
.bubble.md a { color: #4f6ef7; text-decoration: underline; }
.bubble.md h1,
.bubble.md h2,
.bubble.md h3,
.bubble.md h4 { margin: 6px 0; font-size: 15px; }
.bubble.md code {
  background: #f0f0f0;
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 12px;
}

/* 推荐问题 */
.quick-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.q-chip {
  padding: 7px 12px;
  font-size: 13px;
  color: #4f6ef7;
  background: #eef1ff;
  border: 1px solid #d6ddff;
  border-radius: 16px;
  cursor: pointer;
}

/* 输入区 */
.chat-input-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #eee;
}
.chat-input {
  flex: 1;
  height: 38px;
  padding: 0 12px;
  border: 1px solid #ddd;
  border-radius: 20px;
  font-size: 14px;
  outline: none;
}
.send-btn {
  height: 38px;
  padding: 0 18px;
  border: none;
  border-radius: 20px;
  background: #4f6ef7;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
.send-btn:disabled { opacity: 0.6; }

/* 留资弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
}
.modal {
  width: 84%;
  max-width: 360px;
  padding: 22px 18px;
  background: #fff;
  border-radius: 14px;
}
.modal h3 { font-size: 17px; margin-bottom: 4px; }
.modal-tip { font-size: 12px; color: #888; margin-bottom: 14px; }
.lead-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  margin-bottom: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}
.lead-textarea { height: 68px; padding-top: 10px; resize: none; }
.lead-submit {
  width: 100%;
  height: 42px;
  border: none;
  border-radius: 8px;
  background: #4f6ef7;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}
.lead-close {
  width: 100%;
  height: 36px;
  margin-top: 8px;
  border: none;
  background: none;
  color: #999;
  font-size: 13px;
  cursor: pointer;
}