/* ===== 中医智能健康管理平台 - 公共样式 ===== */

:root {
  --bg: #F7F3EA;
  --bg-soft: #F8F6F0;
  --card: #FFFFFF;
  --primary: #3F7D58;
  --primary-dark: #1F4D36;
  --primary-light: #E7F2EA;
  --gold: #C9A24D;
  --gold-soft: #F3EBD6;
  --warning: #D97706;
  --danger: #DC2626;
  --text: #1F2933;
  --text-2: #667085;
  --text-3: #98A2B3;
  --border: #E4E0D8;
  --shadow-sm: 0 1px 4px rgba(20, 35, 25, 0.06);
  --shadow-md: 0 4px 16px rgba(20, 35, 25, 0.08);
  --shadow-lg: 0 12px 40px rgba(20, 35, 25, 0.12);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-btn: 12px;
  --tab-h: 62px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--primary); text-decoration: none; }
/* 不要用全局 a:hover 覆盖 .btn / .follow-chip 的文字色 ——
   之前 bug：<a class="btn btn-primary"> hover 时文字被这条改成了 primary-dark，
   加上背景也是 primary-dark → 整个按钮变绿看不见字。 */
a:not(.btn):not(.follow-chip):hover { color: var(--primary-dark); }
img { max-width: 100%; display: block; }
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { border: none; background: none; cursor: pointer; }
ul, ol { list-style: none; }

/* ===== 布局框架 ===== */
.app { min-height: 100vh; display: flex; flex-direction: column; }

/* 顶部栏 */
.topbar {
  height: 56px; background: rgba(255,255,255,0.85); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 16px; gap: 12px;
  position: sticky; top: 0; z-index: 50;
}
.topbar .logo { font-weight: 700; color: var(--primary-dark); font-size: 17px; display: flex; align-items: center; gap: 8px; }
.topbar .logo svg { width: 24px; height: 24px; color: var(--primary); }
.topbar .spacer { flex: 1; }
.topbar .user-chip { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--primary-light); color: var(--primary-dark); font-size: 13px; font-weight: 500; }
.topbar .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; }

/* 主内容 */
.main { flex: 1; padding: 16px; padding-bottom: calc(var(--tab-h) + 24px); max-width: 1200px; width: 100%; margin: 0 auto; }

/* 底部 Tab Bar (mobile) */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; height: var(--tab-h);
  background: rgba(255,255,255,0.92); backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; z-index: 40;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--text-3); font-size: 11px; font-weight: 500;
  transition: color .15s;
}
.tabbar a { position: relative; }
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a.active { color: var(--primary); }
.tabbar a:hover { color: var(--primary); }

/* 批次 3-2 / 3-4：关怀通知徽章
 *   .nav-badge → 侧边栏 / 底部 tab 入口的小红点（数字）
 *   .followup-fab → 永久固定在右下角的浮动按钮（登录 + 有未处理回访时才显示）
 */
.nav-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 22px); /* 底部 tab 默认图标居中，往右偏移约 22px */
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 10px; background: #e53e3e; color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px #fff;
  animation: nav-badge-pulse 1.4s infinite;
}
@media (min-width: 1024px) {
  /* 侧边栏是水平布局，红点贴在右侧；底部 tab 位移在 mobile 生效 */
  .sidebar a { position: relative; }
  .sidebar a .nav-badge { top: 50%; right: 12px; transform: translateY(-50%); }
}
@keyframes nav-badge-pulse {
  0%, 100% { box-shadow: 0 0 0 2px #fff, 0 0 0 0 rgba(229,62,62,0.5); }
  50%      { box-shadow: 0 0 0 2px #fff, 0 0 0 6px rgba(229,62,62,0); }
}
.followup-fab {
  position: fixed;
  right: 20px;
  bottom: calc(var(--tab-h) + 20px); /* mobile 底部 tab 上方；desktop 无 tab，值直接当成 20+tab */
  display: flex; align-items: center; gap: 8px;
  padding: 12px 18px 12px 14px;
  background: var(--primary); color: #fff;
  border-radius: 999px;
  box-shadow: 0 6px 24px rgba(42,120,75,0.35);
  z-index: 900;
  font-size: 14px; font-weight: 600;
  text-decoration: none;
  transition: transform .15s, box-shadow .15s;
}
.followup-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(42,120,75,0.45); color: #fff; }
.followup-fab .followup-fab-icon { font-size: 18px; }
.followup-fab .followup-fab-count {
  min-width: 20px; padding: 0 6px; height: 20px; line-height: 20px;
  border-radius: 10px; background: #e53e3e; color: #fff;
  font-size: 12px; font-weight: 700; text-align: center;
  margin-left: 2px;
}
@media (min-width: 1024px) {
  /* 桌面端没有底部 tabbar，浮动按钮直接贴在右下角即可 */
  .followup-fab { bottom: 24px; right: 24px; }
}
/* 手机端：浮动按钮极简化（不挤压聊天内容），只露 52×52 的圆形
 * 文字隐藏，数字角标 absolute 贴右上，更贴合 iOS/Android 原生手感 */
@media (max-width: 1023px) {
  .followup-fab {
    padding: 0; width: 52px; height: 52px;
    justify-content: center; gap: 0;
    right: 14px;
  }
  .followup-fab .followup-fab-text { display: none; }
  .followup-fab .followup-fab-icon { font-size: 22px; margin: 0; }
  .followup-fab .followup-fab-count {
    position: absolute; top: -4px; right: -4px;
    min-width: 18px; height: 18px; line-height: 18px;
    font-size: 11px; padding: 0 4px;
    margin: 0; border: 2px solid #fff; box-sizing: content-box;
  }
  /* chat 页：手机端输入框 position:fixed bottom:0（~ 120px 高），浮动按钮必须抬到其上方 */
  .followup-fab[data-page="chat"] { bottom: 150px; }
}

/* chat 页顶部 "关怀消息" 通知横幅：仅在 pending > 0 时由 JS 显示
 * - 挂在 .chat-mode-bar 后（sticky top 会跟着 mode-bar 一起贴顶）
 * - 手机端尤其重要：是持续关怀的最显眼入口
 * - PC 端保留但样式更低调，避免干扰主聊天区 */
.followup-banner {
  display: none;
  align-items: center; gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(90deg, #E7F2EA, #FFF);
  border-bottom: 1px solid var(--border);
  color: var(--primary-dark);
  font-size: 13.5px; font-weight: 600;
  text-decoration: none;
  position: sticky; top: 40px; /* mode-bar 高度 40px */
  z-index: 140;
  box-shadow: 0 2px 8px rgba(42,120,75,0.08);
}
.followup-banner:hover { background: linear-gradient(90deg, #D9E9DE, #F3F9F5); }
.followup-banner .followup-banner-ico { font-size: 17px; }
.followup-banner .followup-banner-text { flex: 1; color: var(--primary-dark); }
.followup-banner .followup-banner-text b { color: #e53e3e; font-weight: 800; font-size: 15px; padding: 0 2px; }
.followup-banner .followup-banner-go {
  background: var(--primary); color: #fff;
  padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
}
@media (min-width: 1024px) {
  /* PC 端 chat 顶部有 chat-mode-bar；此 banner 正常流排，不 sticky 更低调 */
  .followup-banner { position: static; }
}

/* 桌面侧边栏 */
.sidebar { display: none; }

@media (min-width: 1024px) {
  .app { flex-direction: row; }
  .topbar { display: none; }
  .tabbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; width: 236px; min-height: 100vh;
    background: rgba(255,255,255,0.65); backdrop-filter: blur(18px);
    border-right: 1px solid var(--border); padding: 24px 18px; gap: 4px;
    position: sticky; top: 0; align-self: flex-start; height: 100vh; overflow-y: auto;
  }
  .sidebar .logo { font-size: 19px; font-weight: 700; color: var(--primary-dark); display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
  .sidebar .logo svg { width: 28px; height: 28px; color: var(--primary); }
  .sidebar a {
    display: flex; align-items: center; gap: 12px; padding: 11px 14px;
    border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; font-size: 14px;
    transition: all .15s;
  }
  .sidebar a svg { width: 20px; height: 20px; }
  .sidebar a:hover { background: var(--primary-light); color: var(--primary-dark); }
  .sidebar a.active { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
  .sidebar .section-title { padding: 18px 14px 6px; font-size: 11px; font-weight: 600; color: var(--text-3); letter-spacing: 1px; text-transform: uppercase; }
  .sidebar .user-card { margin-top: auto; padding: 14px; background: var(--primary-light); border-radius: var(--radius-md); }
  .sidebar .user-card .name { font-weight: 600; color: var(--primary-dark); font-size: 14px; }
  .sidebar .user-card .hint { font-size: 12px; color: var(--text-2); margin-top: 2px; }
  .main { padding: 32px 40px; padding-bottom: 32px; max-width: none; flex: 1; }
}

/* ===== 通用组件 ===== */
.card {
  background: var(--card); border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}
.card-sm { padding: 16px; border-radius: var(--radius-md); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: var(--radius-btn); font-weight: 600; font-size: 14px;
  transition: all .15s; cursor: pointer; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-secondary { background: var(--primary-light); color: var(--primary-dark); }
.btn-secondary:hover { background: var(--gold-soft); color: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-soft); color: var(--text); }
.btn-danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }

.input, .textarea, .select {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: #fff; transition: border-color .15s, box-shadow .15s; font-size: 15px;
}
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(63,125,88,0.12); }
.textarea { resize: vertical; min-height: 80px; }
label.field { display: block; margin-bottom: 14px; }
label.field .label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }

.badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 10px; min-height: 22px; border-radius: 999px;
  font-size: 12px; line-height: 1;
  background: var(--primary-light); color: var(--primary-dark); font-weight: 500;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-gold { background: var(--gold-soft); color: var(--gold); }
.badge-danger { background: #FEE4E2; color: var(--danger); }
.badge-warning { background: #FEF3C7; color: var(--warning); }

/* Section 标题 */
.section-title { font-size: 17px; font-weight: 700; color: var(--text); margin: 24px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title .more { margin-left: auto; font-size: 13px; color: var(--primary); font-weight: 500; }

/* Hero 区 */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; padding: 32px 24px; border-radius: var(--radius-lg); position: relative; overflow: hidden;
  box-shadow: var(--shadow-md);
}
.hero::before {
  content: ''; position: absolute; right: -40px; top: -40px; width: 200px; height: 200px;
  background: rgba(201,162,77,0.18); border-radius: 50%;
}
.hero::after {
  content: ''; position: absolute; left: -60px; bottom: -60px; width: 160px; height: 160px;
  background: rgba(255,255,255,0.08); border-radius: 50%;
}
.hero h1 { font-size: 24px; font-weight: 700; margin-bottom: 8px; position: relative; }
.hero p { font-size: 14px; opacity: .9; position: relative; max-width: 500px; }
.hero .gold-line { width: 40px; height: 3px; background: var(--gold); border-radius: 2px; margin: 14px 0; position: relative; }

/* 功能卡片网格 */
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

.feature-card {
  background: var(--card); border-radius: var(--radius-md); padding: 18px;
  border: 1px solid var(--border); transition: all .2s; cursor: pointer;
  display: flex; flex-direction: column; gap: 8px;
}
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.feature-card .icon {
  width: 44px; height: 44px; border-radius: 12px; background: var(--primary-light);
  display: flex; align-items: center; justify-content: center; color: var(--primary);
}
.feature-card .icon svg { width: 24px; height: 24px; }
.feature-card h3 { font-size: 16px; font-weight: 600; color: var(--text); }
.feature-card p { font-size: 13px; color: var(--text-2); line-height: 1.5; }

.entry-card {
  background: linear-gradient(135deg, #fff 0%, var(--primary-light) 140%);
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px;
  display: flex; flex-direction: column; gap: 10px; transition: all .2s; cursor: pointer;
  position: relative; overflow: hidden;
}
.entry-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.entry-card .icon {
  width: 52px; height: 52px; border-radius: 14px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm);
}
.entry-card .icon svg { width: 28px; height: 28px; }
.entry-card h3 { font-size: 18px; font-weight: 700; color: var(--text); }
.entry-card p { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.entry-card .arrow { position: absolute; right: 18px; bottom: 18px; color: var(--primary); }

/* 免责声明 */
.disclaimer {
  background: var(--gold-soft); color: #7A5A1E; padding: 14px 16px;
  border-radius: var(--radius-md); font-size: 13px; line-height: 1.6;
  border-left: 4px solid var(--gold); margin-top: 20px;
}

/* Toast */
.toast {
  position: fixed; bottom: calc(var(--tab-h) + 20px); left: 50%; transform: translateX(-50%);
  background: #222; color: #fff; padding: 10px 20px; border-radius: 10px;
  font-size: 14px; z-index: 1000; opacity: 0; transition: opacity .25s; pointer-events: none;
  max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; }
@media (min-width: 1024px) { .toast { bottom: 32px; } }

/* Modal */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: none; align-items: center; justify-content: center;
  z-index: 200; padding: 16px;
}
.modal-bg.show { display: flex; }
.modal {
  background: var(--card); border-radius: var(--radius-lg); padding: 24px;
  max-width: 480px; width: 100%; max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal h3 { font-size: 17px; font-weight: 700; margin-bottom: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* Loading */
.loading { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-page { display: flex; align-items: center; justify-content: center; padding: 60px; color: var(--text-2); }
.empty { text-align: center; padding: 60px 20px; color: var(--text-3); font-size: 14px; }

/* 基础动画 */
.fade-in { animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* 上传区 */
.drop-zone {
  border: 2px dashed var(--border); border-radius: var(--radius-md); padding: 24px;
  text-align: center; cursor: pointer; transition: all .2s; color: var(--text-2);
  background: var(--bg-soft);
}
.drop-zone:hover, .drop-zone.over { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); }
.drop-zone svg { width: 32px; height: 32px; margin: 0 auto 8px; color: var(--text-3); }
.drop-zone:hover svg, .drop-zone.over svg { color: var(--primary); }
.drop-zone .hint { font-size: 12px; margin-top: 4px; color: var(--text-3); }

/* 聊天专用 */
/* 手机端：topbar 56 + tabbar var(--tab-h) 都要扣掉，否则底部输入框会被 tabbar 盖住 */
.chat-shell {
  display: flex; flex-direction: column;
  height: calc(100vh - 56px - var(--tab-h));
  height: calc(100dvh - 56px - var(--tab-h));
}
@media (min-width: 1024px) { .chat-shell { height: 100vh; flex-direction: row; } }

.chat-left {
  display: none; width: 260px; padding: 24px 18px; background: var(--bg-soft);
  border-right: 1px solid var(--border); flex-direction: column; gap: 16px;
}
@media (min-width: 1024px) { .chat-left { display: flex; } }

.chat-center { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* 顶部模式条：手机端紧凑 */
.chat-mode-bar {
  padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px; min-height: 44px;
}
.chat-mode-bar .mode-badge {
  background: var(--primary); color: #fff;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center; line-height: 1; height: 22px;
  flex-shrink: 0;
}
/* 手机端：mode-badge 与 mode-info.title 视觉上重复（都显示模式名），
   把手机端的 badge 隐藏，只保留更大号的 title 文字，去掉"问诊治疗 问诊治疗"重复感 */
@media (max-width: 1023px) {
  .chat-mode-bar .mode-badge { display: none; }
  .chat-mode-bar .title { font-size: 15px; font-weight: 700; }
}
.chat-mode-bar .mode-info { flex: 1; min-width: 0; }
.chat-mode-bar .title {
  font-weight: 600; color: var(--text); font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-mode-bar .hint {
  font-size: 11px; color: var(--text-3); line-height: 1.3; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-mode-bar .bar-actions { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
@media (min-width: 1024px) {
  .chat-mode-bar { padding: 14px 16px; min-height: 60px; }
  .chat-mode-bar .mode-badge { font-size: 13px; padding: 4px 12px; height: 26px; }
  .chat-mode-bar .title { font-size: 15px; }
  .chat-mode-bar .hint { font-size: 12px; }
}

.chat-msgs {
  flex: 1; overflow-y: auto; padding: 20px 16px;
  display: flex; flex-direction: column; gap: 14px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.chat-input-wrap { padding: 12px; border-top: 1px solid var(--border); background: #fff; }

.msg { display: flex; gap: 10px; max-width: 85%; animation: fadeIn .3s ease; }
.msg.user { margin-left: auto; flex-direction: row-reverse; }
.msg .msg-stack { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.msg .bubble {
  padding: 11px 14px; border-radius: 16px; line-height: 1.6; word-break: break-word;
  font-size: 14.5px;
}
.msg.user .bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant .bubble { background: #fff; border: 1px solid var(--border); color: var(--text); border-bottom-left-radius: 4px; box-shadow: var(--shadow-sm); }
.msg.system .bubble { background: var(--gold-soft); color: #7A5A1E; font-size: 13px; }
.msg .avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--primary-light); color: var(--primary); font-size: 18px; }
.msg.user .avatar { background: var(--primary); color: #fff; }
.msg .bubble img { margin-top: 8px; border-radius: 8px; max-width: 200px; }
.msg .bubble h1, .msg .bubble h2, .msg .bubble h3,
.msg .bubble h4, .msg .bubble h5, .msg .bubble h6 { margin: 10px 0 4px; font-weight: 700; line-height: 1.4; }
.msg .bubble h1 { font-size: 17px; }
.msg .bubble h2 { font-size: 16px; }
.msg .bubble h3 { font-size: 15px; }
.msg .bubble h4 { font-size: 14.5px; color: var(--primary-dark); }
.msg .bubble h5, .msg .bubble h6 { font-size: 14px; color: var(--text-2); }
.msg .bubble ul { margin: 6px 0 6px 20px; list-style: disc; }
.msg .bubble ol { margin: 6px 0 6px 22px; list-style: decimal; }
.msg .bubble li { margin: 2px 0; }
.msg .bubble li ul, .msg .bubble li ol { margin: 2px 0 2px 18px; }
.msg .bubble p { margin: 4px 0; }
.msg .bubble strong { font-weight: 700; }
.msg .bubble em { font-style: italic; color: var(--text); }
.msg .bubble code { background: rgba(0,0,0,.04); border-radius: 4px; padding: 1px 5px; font-size: 13px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.msg .bubble blockquote {
  margin: 8px 0; padding: 6px 12px;
  border-left: 3px solid var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 0 8px 8px 0; font-size: 13.5px;
}
.msg .bubble hr { border: none; border-top: 1px dashed var(--border); margin: 10px 0; }
.msg .bubble table.md-table {
  border-collapse: collapse; margin: 10px 0; width: 100%;
  font-size: 13px; background: #fff;
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.msg .bubble table.md-table th,
.msg .bubble table.md-table td {
  padding: 6px 10px; text-align: left;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.msg .bubble table.md-table th:last-child,
.msg .bubble table.md-table td:last-child { border-right: none; }
.msg .bubble table.md-table tr:last-child td { border-bottom: none; }
.msg .bubble table.md-table thead th {
  background: var(--primary-light); color: var(--primary-dark); font-weight: 600;
}
.msg.streaming .bubble { position: relative; overflow: hidden; }
.assistant-extras { display: flex; flex-direction: column; gap: 10px; }
.bubble-cursor {
  display: inline-block; width: 8px; height: 1.1em; margin-left: 2px;
  background: linear-gradient(180deg, var(--primary), var(--gold)); border-radius: 999px;
  vertical-align: text-bottom; animation: blinkCursor .9s ease-in-out infinite;
}
@keyframes blinkCursor { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }
.turn-summary {
  padding: 10px 12px; border-radius: 12px; background: var(--bg-soft); color: var(--text-2);
  font-size: 12.5px; border: 1px dashed var(--border);
}
.follow-up-row { display: flex; flex-wrap: wrap; gap: 8px; }
.follow-chip {
  padding: 8px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--border);
  color: var(--primary-dark); font-size: 12.5px; box-shadow: var(--shadow-sm); transition: all .2s;
}
.follow-chip:hover { background: var(--primary-light); border-color: var(--primary); transform: translateY(-1px); }
.card-list { display: flex; flex-direction: column; gap: 10px; }
.mini-card {
  background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 12px;
  box-shadow: var(--shadow-sm);
}
.mini-card-top { display: flex; justify-content: space-between; gap: 12px; }
.mini-card-title { font-size: 14px; font-weight: 700; color: var(--text); }
.mini-card-desc { margin-top: 6px; font-size: 12.5px; color: var(--text-2); line-height: 1.6; }
.mini-card-price { color: var(--danger); font-weight: 700; white-space: nowrap; }
.mini-card-tags { margin-top: 8px; color: var(--text-3); font-size: 12px; }
.mini-card-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.mini-card.media img, .mini-card.media video {
  width: 100%; border-radius: 10px; max-height: 280px; object-fit: cover; background: #000;
}
.mini-card.link { display: block; }

.typing-dots { display: inline-flex; gap: 4px; padding: 8px 4px; }
.typing-dots span { width: 7px; height: 7px; background: var(--text-3); border-radius: 50%; animation: bounce 1.4s infinite ease-in-out both; }
.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }

.chat-quick { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 6px; }
.chat-quick button {
  flex-shrink: 0; padding: 6px 12px; background: var(--primary-light); color: var(--primary-dark);
  border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap;
}
.chat-quick button:hover { background: var(--primary); color: #fff; }

.chat-input-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-input-row textarea { flex: 1; resize: none; min-height: 40px; max-height: 120px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 18px; background: var(--bg-soft); font-size: 14px; }
.chat-input-row textarea:focus { outline: none; border-color: var(--primary); }
.chat-input-row .icon-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background .15s; }
.chat-input-row .icon-btn.primary { background: var(--primary); color: #fff; }
.chat-input-row .icon-btn:hover { opacity: .85; }
/* 录音中：红色脉动，明确告诉用户正在录 */
.chat-input-row .icon-btn.recording {
  background: #E2615A; color: #fff;
  animation: micPulse 1.2s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(226,97,90,.6);
}
@keyframes micPulse {
  0%   { box-shadow: 0 0 0 0 rgba(226,97,90,.7); }
  70%  { box-shadow: 0 0 0 10px rgba(226,97,90,0); }
  100% { box-shadow: 0 0 0 0 rgba(226,97,90,0); }
}

/* 虚拟中医助手 */
.assistant-avatar { width: 88px; height: 88px; margin: 0 auto 8px; position: relative; animation: breathe 4s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
.assistant-avatar.thinking { animation: breathe 1.5s ease-in-out infinite; }
.assistant-status { text-align: center; font-size: 13px; color: var(--text-2); }
.assistant-card { background: #fff; border-radius: var(--radius-md); padding: 16px; text-align: center; box-shadow: var(--shadow-sm); }
.assistant-name { font-weight: 600; color: var(--primary-dark); margin-top: 4px; }

/* 上下文面板（PC） */
.ctx-panel { width: 280px; padding: 20px; border-left: 1px solid var(--border); background: var(--bg-soft); display: none; flex-direction: column; gap: 14px; overflow-y: auto; }
@media (min-width: 1280px) { .ctx-panel { display: flex; } }
.ctx-item { background: #fff; padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); font-size: 13px; }
.ctx-item .label { font-size: 11px; color: var(--text-3); font-weight: 600; text-transform: uppercase; margin-bottom: 4px; letter-spacing: 0.5px; }

/* 舌诊/报告卡片 */
.score-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; padding: 24px; border-radius: var(--radius-lg); text-align: center;
  position: relative; overflow: hidden;
}
.score-card .score { font-size: 56px; font-weight: 800; line-height: 1; }
.score-card .score small { font-size: 18px; opacity: .7; font-weight: 500; }
.score-card .label { font-size: 14px; opacity: .9; margin-top: 6px; }
.score-card .result { margin-top: 14px; padding: 8px 16px; background: rgba(255,255,255,0.2); border-radius: 999px; display: inline-block; font-weight: 600; }

.report-block { background: #fff; border-radius: var(--radius-md); padding: 16px; margin-bottom: 12px; border: 1px solid var(--border); }
.report-block h4 { font-size: 14px; font-weight: 700; color: var(--primary-dark); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.report-block h4::before { content: ''; width: 3px; height: 14px; background: var(--gold); border-radius: 2px; }
.report-block p { color: var(--text-2); font-size: 13.5px; line-height: 1.7; }
.report-block .tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* 商品卡片 */
.product-card {
  background: #fff; border-radius: var(--radius-md); overflow: hidden;
  border: 1px solid var(--border); transition: all .2s; cursor: pointer;
}
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.product-card .product-img { aspect-ratio: 1; background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 46px; color: var(--primary); }
.product-card .product-body { padding: 12px; }
.product-card .product-name { font-weight: 600; font-size: 14px; color: var(--text); }
.product-card .product-price { color: var(--danger); font-weight: 700; font-size: 16px; margin-top: 4px; }
.product-card .product-tags {
  margin-top: 6px; font-size: 11px; color: var(--text-3);
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.5;
}
.product-card .product-img-real {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  background: var(--bg-soft); display: block;
}
.product-card .product-cat-badge {
  display: inline-block; font-size: 11px;
  background: var(--primary-light); color: var(--primary-dark);
  padding: 2px 8px; border-radius: 999px;
  margin-bottom: 6px; font-weight: 600;
}
.product-card .product-name {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 商店工具栏：搜索 + 分类 Tab */
.shop-toolbar {
  background: #fff; border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 14px;
  margin-bottom: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.shop-search-wrap { position: relative; }
.shop-search-input {
  width: 100%; padding: 10px 38px 10px 14px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-soft); color: var(--text);
  font-size: 14px; outline: none;
  transition: all .15s;
}
.shop-search-input:focus {
  border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 3px rgba(63,125,88,.12);
}
.shop-search-clear {
  position: absolute; right: 8px; top: 50%;
  transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--text-3); color: #fff;
  border: none; font-size: 12px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.shop-cats {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.shop-cat {
  background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; font-weight: 600;
  color: var(--text-2); cursor: pointer; transition: all .15s;
  white-space: nowrap;
}
.shop-cat:hover {
  border-color: var(--primary); color: var(--primary-dark);
}
.shop-cat.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.shop-cat span {
  margin-left: 4px; opacity: .75; font-size: 11px;
  background: rgba(255,255,255,.25); padding: 0 6px;
  border-radius: 999px;
}
.shop-cat:not(.active) span {
  background: rgba(0,0,0,.06); color: var(--text-3);
}
.shop-stats {
  font-size: 12.5px; color: var(--text-3);
}

/* 商店模式切换：现金 / 健康币 */
.shop-mode-bar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.shop-mode-tabs {
  display: inline-flex; background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 3px; gap: 2px;
}
.shop-mode-tab {
  background: transparent; border: none; cursor: pointer;
  padding: 8px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 600;
  color: var(--text-2); transition: all .18s;
}
.shop-mode-tab:hover { color: var(--primary-dark); }
.shop-mode-tab.active {
  background: #fff; color: var(--primary-dark);
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
.shop-mode-tab[data-mode="coin"].active,
#shopModeCoin.active {
  color: #b36b0d;
}
.shop-coin-balance {
  margin-left: auto;
  background: linear-gradient(135deg, #fff4de, #ffe1a8);
  color: #8a5a00;
  border: 1px solid #f0c57b;
  border-radius: 999px;
  padding: 7px 16px; font-size: 13.5px; font-weight: 600;
  box-shadow: 0 1px 3px rgba(200,140,0,.12);
}
.shop-coin-balance strong { font-size: 16px; margin: 0 2px; color: #a5620d; }

/* 商品卡片：健康币价格徽记 */
.product-coin-price {
  color: #b36b0d; font-weight: 700; font-size: 15px;
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 2px;
}

/* ===== 面部八段锦卡片（体质辨识完成后出现在 extras 里） ===== */
.bdj-card {
  margin-top: 14px;
  background: linear-gradient(135deg, #fffbf1, #fff5d9);
  border: 1px solid #f0c97d;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(200,140,0,.08);
}
.bdj-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.bdj-head .bdj-ico { font-size: 22px; }
.bdj-head .bdj-title { font-weight: 700; color: #8a5a00; font-size: 15px; flex: 1; }
.bdj-head .bdj-reward {
  background: #fff; border: 1px solid #e7bf71;
  color: #b36b0d; font-size: 12.5px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
}
.bdj-video-wrap {
  position: relative; background: #000;
  border-radius: 10px; overflow: hidden;
  aspect-ratio: 16 / 9;
}
.bdj-video { width: 100%; height: 100%; display: block; }
.bdj-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.5);
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,.1), rgba(0,0,0,.35));
}
.bdj-progress-row {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 0 12px;
}
.bdj-progress-bar {
  flex: 1; height: 8px; border-radius: 999px;
  background: rgba(200,140,0,.15); overflow: hidden;
}
.bdj-progress-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, #f0a642, #d9730d);
  transition: width .3s;
}
.bdj-progress-text {
  font-size: 12px; color: #8a5a00; min-width: 80px; text-align: right;
}
.bdj-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.bdj-actions .btn { flex: 1; min-width: 120px; }

/* ===== 养生小课堂浮层（居中弹窗） ===== */
.mini-lesson-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(20, 30, 20, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: ml-fade-in .2s ease-out;
}
@keyframes ml-fade-in {
  from { opacity: 0; } to { opacity: 1; }
}
.mini-lesson-overlay .ml-card {
  position: relative;
  background: #fff; border-radius: 18px;
  max-width: 640px; width: 100%;
  max-height: calc(100vh - 40px); overflow-y: auto;
  padding: 28px 28px 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  animation: ml-slide-up .3s cubic-bezier(.2,.8,.3,1);
}
@keyframes ml-slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.mini-lesson-overlay .ml-close {
  position: absolute; right: 16px; top: 12px;
  background: transparent; border: none;
  font-size: 20px; cursor: pointer;
  color: var(--text-3);
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.mini-lesson-overlay .ml-close:hover { background: var(--bg-soft); color: var(--text-1); }
.mini-lesson-overlay .ml-badge {
  display: inline-block;
  background: linear-gradient(135deg, #fff4de, #ffd98e);
  color: #8a5a00;
  font-size: 12.5px; font-weight: 600;
  padding: 5px 12px; border-radius: 999px;
  margin-bottom: 10px;
}
.mini-lesson-overlay .ml-title {
  font-size: 20px; font-weight: 700;
  color: var(--primary-dark, #234e2a);
  margin: 4px 0 16px;
  line-height: 1.4;
}
.mini-lesson-overlay .ml-video-wrap {
  position: relative;
  background: #000; border-radius: 12px; overflow: hidden;
  aspect-ratio: 16 / 9;
  margin-bottom: 16px;
}
.mini-lesson-overlay .ml-video { width: 100%; height: 100%; display: block; }
.mini-lesson-overlay .ml-video-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #fdf3de, #f5d9a8);
  pointer-events: none;
}
.mini-lesson-overlay .ml-step-actions {
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
}
.mini-lesson-overlay .ml-step-actions .btn { min-width: 120px; }
@media (max-width: 480px) {
  .mini-lesson-overlay .ml-card { padding: 20px 18px 16px; }
  .mini-lesson-overlay .ml-title { font-size: 17px; }
  .mini-lesson-overlay .ml-step-actions .btn { flex: 1; }
}

.home-insight-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.home-insight-title { font-size: 20px; font-weight: 700; color: var(--primary-dark); }
.home-insight-sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.home-insight-summary { margin-top: 12px; color: var(--text-2); font-size: 14px; line-height: 1.8; }
.home-insight-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 16px; }
.home-insight-block {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.home-insight-block .label { width: 100%; color: var(--text-3); font-size: 12px; font-weight: 600; }
/* 首页"建议行动/近期注意/适合多吃"里是长句子，需要允许换行，不受 .badge 的 nowrap 影响 */
.home-insight-block .badge {
  white-space: normal;
  text-align: left;
  line-height: 1.5;
  min-height: 0;
  padding: 6px 12px;
  border-radius: 12px;
  align-self: flex-start;
  max-width: 100%;
}

.floating-cart {
  position: fixed; right: 20px; bottom: calc(var(--tab-h) + 18px); width: 58px; height: 58px;
  border-radius: 50%; background: var(--primary); color: #fff; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: center; z-index: 120; font-size: 24px;
}
.floating-cart-count {
  position: absolute; top: -4px; right: -2px; min-width: 22px; height: 22px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 12px; display: inline-flex; align-items: center; justify-content: center;
}
.cart-item-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border);
}
.cart-qty-ctl {
  display: inline-flex; align-items: center; border: 1px solid var(--border);
  border-radius: 6px; overflow: hidden; background: var(--bg-soft);
}
.cart-qty-ctl .btn-sm { padding: 2px 8px; font-size: 14px; border-radius: 0; border: none; background: transparent; }
.cart-qty-ctl .btn-sm:hover { background: var(--bg-deeper); }
.cart-qty-ctl span { padding: 0 6px; font-size: 13px; font-weight: 600; }

/* 购物车合并弹窗：稍大一些，支持内部滚动 */
.cart-modal {
  max-width: 560px;
  max-height: min(86vh, 720px);
  overflow-y: auto;
}
.cart-modal .field { margin-bottom: 10px; }
.cart-modal .field .textarea { min-height: 56px; }

@media (max-width: 640px) {
  .cart-item-row { flex-wrap: wrap; gap: 8px; }
  .cart-item-row > div:first-child { flex: 1 1 100%; }
  .cart-qty-ctl .btn-sm { padding: 2px 10px; }
}
.order-card {
  padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: 12px;
  background: #fff; box-shadow: var(--shadow-sm); cursor: pointer;
}
.order-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.order-title { font-size: 15px; font-weight: 700; color: var(--text); }
.order-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.order-price { font-size: 15px; font-weight: 700; color: var(--danger); }
.progress-track {
  width: 100%; height: 10px; border-radius: 999px; background: var(--border); overflow: hidden; margin-top: 12px;
}
.progress-track.large { height: 12px; margin-top: 18px; }
.progress-fill {
  height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--gold));
  transition: width .5s ease;
}
.progress-steps {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; font-size: 12px; color: var(--text-3);
}
.progress-steps span.active { color: var(--primary-dark); font-weight: 700; }
@media (min-width: 1024px) {
  .floating-cart { bottom: 28px; }
}

/* ===== 聊天增强：紧凑操作按钮 ===== */
.msg-actions {
  display:flex; gap:6px; flex-wrap:wrap; margin-top:2px;
}
.msg-action-btn {
  width:26px; height:26px; border-radius:6px;
  display:inline-flex; align-items:center; justify-content:center;
  background:transparent; border:1px solid var(--border);
  color:var(--text-3); cursor:pointer; padding:0;
  transition: all .15s;
}
.msg-action-btn:hover { color:var(--primary); border-color:var(--primary); background:var(--primary-light); }
.msg-action-btn.playing { color:var(--primary-dark); border-color:var(--primary); background:var(--primary-light); }

/* ===== 聊天内联图片/视频/链接 ===== */
.chat-inline-img {
  display:block; max-width:min(260px, 100%); max-height:220px;
  margin:6px 0; border-radius:10px; border:1px solid var(--border);
  cursor:zoom-in; object-fit:cover;
}
.chat-video-chip {
  display:inline-flex; align-items:center; gap:6px;
  margin:4px 4px 4px 0; padding:6px 14px;
  border-radius:999px;
  background:linear-gradient(135deg, var(--primary), var(--primary-dark));
  color:#fff; font-size:13px; font-weight:600;
  text-decoration:none; border:none;
  box-shadow:0 2px 6px rgba(63,125,88,.25);
  cursor:pointer; transition: all .18s;
}
.chat-video-chip:hover {
  transform:translateY(-1px);
  box-shadow:0 4px 12px rgba(63,125,88,.4);
}
.chat-inline-link {
  display:inline-block; margin:2px 4px 2px 0; padding:4px 10px;
  border-radius:999px; background:var(--bg-soft); color:var(--text-2);
  font-size:12px; text-decoration:none; border:1px solid transparent;
  transition: all .15s;
}
.chat-inline-link:hover { border-color:var(--primary); color:var(--primary-dark); }

/* ===== 图片全屏预览 ===== */
.img-preview-layer {
  position:fixed; inset:0; z-index:10000;
  background:rgba(0,0,0,.85); display:none;
  align-items:center; justify-content:center;
  padding:20px; cursor:zoom-out;
}
.img-preview-layer.show { display:flex; }
.img-preview-layer img { max-width:92vw; max-height:88vh; border-radius:8px; object-fit:contain; }
.img-preview-close {
  position:absolute; top:18px; right:22px;
  width:36px; height:36px; border-radius:50%;
  background:rgba(255,255,255,.18); color:#fff;
  border:none; font-size:22px; cursor:pointer;
}

/* ===== 聊天气泡里的商品卡片列表（用户点击才加购物车） ===== */
.chat-product-list {
  background: linear-gradient(135deg, #F8F5EC, #FFFDF8);
  border: 1px solid var(--gold);
  border-radius: 14px; padding: 12px 14px;
  margin-top: 10px;
}
.chat-product-list-title {
  font-size: 13.5px; font-weight: 700; color: var(--primary-dark);
  margin-bottom: 10px;
}
.chat-product-card {
  display: flex; align-items: center; gap: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
  transition: all .15s;
}
.chat-product-card:hover { border-color: var(--primary); box-shadow: 0 2px 10px rgba(63,125,88,.08); }
.chat-product-img {
  width: 56px; height: 56px; border-radius: 8px;
  object-fit: cover; flex-shrink: 0;
  background: var(--bg-soft);
}
.chat-product-img-placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}
.chat-product-info { flex: 1; min-width: 0; }
.chat-product-name {
  font-weight: 600; font-size: 14px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-product-price {
  color: var(--danger); font-weight: 700; font-size: 15px;
  margin-top: 2px;
}
.chat-product-cat {
  font-size: 11px; color: var(--text-3);
  background: var(--bg-soft); display: inline-block;
  padding: 1px 6px; border-radius: 6px; margin-top: 2px;
}
.chat-product-add {
  background: var(--primary); color: #fff;
  border: none; border-radius: 8px;
  padding: 8px 12px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; flex-shrink: 0;
  transition: all .15s;
  white-space: nowrap;
}
.chat-product-add:hover { background: var(--primary-dark); }
.chat-product-add.added {
  background: var(--bg-soft); color: var(--text-3);
  cursor: default;
}
.chat-product-list-foot {
  text-align: center; margin-top: 4px;
}

/* ===== 购物车小卡（聊天中） ===== */
.cart-toast-card {
  background:linear-gradient(135deg,#F3EBD6,#FFF8E5);
  border:1px solid var(--gold);
  border-radius:12px; padding:12px 14px;
  color:#7A5A1E;
}
.cart-toast-title { font-size:13.5px; font-weight:700; }
.cart-toast-list {
  margin-top:6px; display:flex; flex-wrap:wrap; gap:6px;
  font-size:12px;
}
.cart-toast-list span {
  background:rgba(255,255,255,.6); padding:2px 8px; border-radius:6px;
}
.cart-toast-actions { margin-top:10px; display:flex; gap:8px; }

/* ===== 重症推荐就医卡（severity high / emergency） ===== */
.severity-card {
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  border: 1px solid;
  font-size: 13.5px;
  line-height: 1.6;
}
.severity-emergency {
  background: linear-gradient(135deg, #fee2e2, #fef2f2);
  border-color: #fca5a5;
  color: #7f1d1d;
}
.severity-high {
  background: linear-gradient(135deg, #fff7ed, #fffbeb);
  border-color: #fcd34d;
  color: #78350f;
}
.severity-head { font-size: 14.5px; margin-bottom: 8px; }
.severity-sub { font-size: 12px; color: inherit; opacity: 0.8; margin-bottom: 4px; }
.severity-flags {
  margin: 4px 0 8px 18px;
  padding: 0;
  list-style: disc;
}
.severity-flags li { margin: 2px 0; }
.severity-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.severity-actions .btn { font-size: 12.5px; padding: 6px 12px; }

/* ===== 系统消息里的指引图（舌诊等） ===== */
.guide-img {
  margin-top: 10px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}
.guide-img img { display: block; width: 100%; max-height: 320px; object-fit: contain; background: #fff; }
.guide-img-caption { padding: 6px 10px; font-size: 12px; color: var(--text-3); }
/* 快捷按钮里的 emoji 前缀 */
.chat-quick .qk-ico { margin-right: 4px; display: inline-block; }

/* ======================================================= */
/* ===== 中医体质辨识量表（constitution.js 配套样式） ===== */
/* ======================================================= */
.cs-modal-bg {
  position: fixed; inset: 0; background: rgba(15, 30, 20, 0.55);
  display: none; align-items: center; justify-content: center;
  z-index: 9999; padding: 16px;
}
.cs-modal-bg.show { display: flex; }
.cs-modal {
  background: #fff; width: 100%; max-width: 640px;
  border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  display: flex; flex-direction: column; max-height: calc(100vh - 32px);
  overflow: hidden;
  --cs-base: 15px;
}
.cs-modal[data-font="0"] { --cs-base: 13.5px; }
.cs-modal[data-font="1"] { --cs-base: 15px; }
.cs-modal[data-font="2"] { --cs-base: 17.5px; }
.cs-modal[data-font="3"] { --cs-base: 20px; }
.cs-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.cs-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; font-size: 14px; }
.cs-badge span {
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.cs-count { color: var(--text-2); font-size: 13px; }
.cs-head-actions { display: flex; gap: 4px; }
.cs-icobtn {
  border: 1px solid var(--border); background: #fff;
  width: 32px; height: 32px; border-radius: 8px; font-size: 13px;
  cursor: pointer; color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
}
.cs-icobtn:hover { background: var(--primary-light); color: var(--primary-dark); }
/* 总览按钮：主题色，带文字 + 图标 */
.cs-overview-btn {
  width: auto; padding: 0 10px; gap: 4px;
  background: var(--primary-light); color: var(--primary-dark);
  border-color: var(--primary); font-weight: 600;
}
.cs-overview-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary-dark); }
.cs-overview-btn svg { flex-shrink: 0; }
@media (max-width: 640px) {
  /* 手机端只留图标，节省空间 */
  .cs-overview-btn span { display: none; }
  .cs-overview-btn { width: 32px; padding: 0; }
}
.cs-progress {
  height: 3px; background: var(--bg-soft);
}
.cs-progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--primary), var(--gold));
  transition: width 0.25s;
}
.cs-body {
  padding: 32px 28px; flex: 1; overflow-y: auto;
  display: flex; flex-direction: column; gap: 20px;
}
.cs-question-text {
  font-size: calc(var(--cs-base) + 3px);
  line-height: 1.65; color: var(--text);
  font-weight: 600; text-align: left;
}
.cs-options {
  display: flex; flex-direction: column; gap: 10px;
}
.cs-opt {
  display: grid; grid-template-columns: 32px 60px 1fr;
  align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 12px;
  border: 1.5px solid var(--border);
  background: #fff; color: var(--text);
  font-size: var(--cs-base); cursor: pointer; text-align: left;
  transition: all 0.15s;
}
.cs-opt:hover { border-color: var(--primary); background: var(--primary-light); }
.cs-opt.active {
  border-color: var(--primary); background: var(--primary);
  color: #fff; box-shadow: 0 4px 14px rgba(63,125,88,.25);
}
.cs-opt.active .s { color: rgba(255,255,255,0.85); }
.cs-opt .n {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-soft); color: var(--primary-dark);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.cs-opt.active .n { background: rgba(255,255,255,0.25); color: #fff; }
.cs-opt .l { font-weight: 600; }
.cs-opt .s { color: var(--text-3); font-size: calc(var(--cs-base) - 2px); }
.cs-foot {
  padding: 12px 18px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.cs-foot .cs-jumper {
  flex: 1; text-align: center; font-size: 13px; color: var(--text-2);
}
.cs-foot .cs-idx { font-weight: 700; color: var(--primary-dark); }

/* 答题总览抽屉面板（覆盖整个弹窗内容区） */
.cs-overview {
  position: absolute; inset: 0;
  background: #fff;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform .25s ease-out;
  z-index: 2;
}
.cs-overview[data-show="1"] { transform: translateY(0); }
.cs-modal { position: relative; }
.cs-ov-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.cs-ov-title { font-size: 16px; font-weight: 700; color: var(--text); }
.cs-ov-count { color: var(--primary-dark); font-weight: 700; font-size: 14px; margin-left: 4px; }
.cs-ov-grid {
  flex: 1; overflow-y: auto; padding: 16px 18px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
  gap: 10px;
}
.cs-ov-cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1.5px solid transparent;
  background: #F3F4F6;
  color: var(--text-2);
  font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .15s;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.cs-ov-cell.done {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-color: var(--primary);
}
.cs-ov-cell.current {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary-dark);
  box-shadow: 0 4px 14px rgba(63,125,88,.35);
}
.cs-ov-cell.pending {
  background: #F3F4F6;
  color: var(--text-3);
  border-color: #E5E7EB;
}
.cs-ov-cell:hover { transform: translateY(-1px); }
.cs-ov-idx { font-size: 13px; }
.cs-ov-val {
  position: absolute; top: 3px; right: 5px;
  font-size: 10px; font-weight: 700;
  background: rgba(255,255,255,.7); color: var(--primary-dark);
  border-radius: 8px; padding: 0 4px;
  min-width: 14px; text-align: center;
}
.cs-ov-cell.current .cs-ov-val { background: rgba(255,255,255,.3); color: #fff; }
.cs-ov-legend {
  padding: 8px 18px; border-top: 1px solid var(--border);
  display: flex; gap: 16px; font-size: 12px; color: var(--text-2);
  align-items: center; flex-wrap: wrap;
}
.cs-ov-lg {
  width: 14px; height: 14px; border-radius: 4px;
  display: inline-block; margin-right: 4px;
  vertical-align: middle;
}
.cs-ov-lg.done { background: var(--primary-light); border: 1.5px solid var(--primary); }
.cs-ov-lg.current { background: var(--primary); }
.cs-ov-lg.pending { background: #F3F4F6; border: 1.5px solid #E5E7EB; }
.cs-ov-foot {
  padding: 12px 18px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
}
.cs-ov-hint { font-size: 13px; color: var(--text-2); text-align: center; }

@media (max-width: 640px) {
  /* 用 dvh 取代 vh，避免地址栏弹出/收起时 foot 被挤出视口（用户反馈"下一题按钮被截断"） */
  .cs-modal { max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .cs-body { padding: 18px 14px; gap: 16px; }
  .cs-opt { padding: 10px 12px; grid-template-columns: 28px 50px 1fr; gap: 8px; }
  .cs-opt .n { width: 28px; height: 28px; font-size: 13px; }
  .cs-ov-grid { grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 8px; padding: 12px; }
  .cs-ov-idx { font-size: 12px; }

  /* head 压缩：让 title + actions 一行能装得下，不再挤成两行 */
  .cs-head {
    padding: 10px 12px; gap: 8px;
    flex-wrap: nowrap;          /* 强制单行，避免 title 被挤成竖排 */
  }
  .cs-title {
    font-size: 13px; gap: 6px;
    flex: 1; min-width: 0;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  }
  .cs-badge span { padding: 2px 8px; font-size: 11px; }
  .cs-count { font-size: 12px; }
  /* 详情（"题（已答 N）"）手机端隐藏，留 "17/27" 就够了 */
  .cs-count-detail { display: none; }
  .cs-head-actions { gap: 2px; flex-shrink: 0; }
  .cs-icobtn { width: 30px; height: 30px; font-size: 12px; border-radius: 7px; }
  .cs-overview-btn { width: 30px; }

  /* foot 压缩 + 底部 safe-area 适配，防止 iOS 小横条挡"下一题"
   *   jumper 保留 flex:1 居中占位 —— 这样 "← 上一题" 靠左、"3/27" 居中、"下一题 →" 靠右，
   *   用户反馈"三个都挤在左边"就是因为之前 flex:0 1 auto 失去了撑开空间的作用 */
  .cs-foot {
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0));
    gap: 8px; flex-wrap: nowrap; justify-content: space-between;
  }
  .cs-foot .btn { padding: 8px 10px; font-size: 13px; flex-shrink: 0; }
  .cs-foot .cs-jumper { font-size: 12px; flex: 1; text-align: center; }
  .cs-question-text { font-size: calc(var(--cs-base) + 1px); line-height: 1.55; }
}

/* 流式报告气泡顶部的状态提示条 */
.cs-stream-head {
  display: inline-block;
  background: linear-gradient(135deg, rgba(63,125,88,.08), rgba(201,162,77,.08));
  color: var(--text-2); font-size: 13px; line-height: 1.6;
  padding: 8px 12px; border-radius: 10px; margin-bottom: 8px;
  border-left: 3px solid var(--primary);
}
.cs-stream-head b { color: var(--primary-dark); }

/* 体质报告下方"基于此报告继续提问"区 */
.cs-ask-box {
  background: linear-gradient(135deg, rgba(63,125,88,.05), rgba(201,162,77,.05));
  border: 1px solid rgba(63,125,88,.18);
  border-radius: 12px; padding: 12px 14px;
}
.cs-ask-hint { color: var(--text-2); font-size: 12.5px; margin-bottom: 8px; line-height: 1.5; }
.cs-ask-input-row { display: flex; gap: 8px; align-items: stretch; }
.cs-ask-input {
  flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: #fff; font-size: 14px; color: var(--text);
}
.cs-ask-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(63,125,88,.12); }
.cs-ask-send { white-space: nowrap; }
.cs-ask-answers { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.cs-ask-turn {
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-size: 13.5px; line-height: 1.65;
}
.cs-ask-q {
  color: var(--primary-dark); font-weight: 600; font-size: 13px;
  margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px dashed var(--border);
}
.cs-ask-a { color: var(--text); }
.cs-ask-a p { margin: 4px 0; }
.cs-ask-a ul, .cs-ask-a ol { margin: 4px 0 4px 20px; }

/* ===== 右侧历史会话列表 ===== */
.hist-list { display:flex; flex-direction:column; gap:6px; margin-top:8px; max-height:46vh; overflow-y:auto; }
.hist-empty { color:var(--text-3); font-size:12.5px; padding:10px 2px; }
.hist-item {
  text-align:left; padding:8px 10px; border-radius:10px;
  background:#fff; border:1px solid var(--border);
  cursor:pointer; transition: all .15s;
}
.hist-item:hover { border-color:var(--primary); background:var(--primary-light); }
.hist-item.active { border-color:var(--primary); background:var(--primary-light); box-shadow:var(--shadow-sm); }
.hist-item .hist-mode { font-size:11px; color:var(--primary-dark); font-weight:700; }
.hist-item .hist-title {
  font-size:13px; color:var(--text); margin-top:3px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.hist-item .hist-time { font-size:11px; color:var(--text-3); margin-top:3px; }
/* 有 pending 关怀的会话：右上角红点 + 条目左边框高亮 */
.hist-item { position: relative; }
.hist-item.hist-pending {
  border-color: #e53e3e;
  box-shadow: 0 0 0 3px rgba(229,62,62,0.08);
}
.hist-item .hist-badge {
  position: absolute; top: 8px; right: 10px;
  color: #e53e3e; font-size: 14px; line-height: 1;
  animation: nav-badge-pulse 1.4s infinite;
}

/* ===== 健康报告详情 · 附件列表（批次 3 后续补丁） ===== */
.report-attachments {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 14px; margin: 10px 0 18px;
}
.report-attachments > summary {
  cursor: pointer; font-weight: 700; font-size: 14px;
  color: var(--primary-dark); list-style: none;
  display: flex; align-items: center; gap: 6px;
}
.report-attachments > summary::-webkit-details-marker { display: none; }
.report-attachments > summary::before {
  content: '▸'; color: var(--text-3); font-size: 11px;
  transition: transform .15s;
}
.report-attachments[open] > summary::before { transform: rotate(90deg); }
.report-attach-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px; margin-top: 10px;
}
.report-attach-card {
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 6px; cursor: zoom-in; transition: transform .1s, box-shadow .15s;
  display: flex; flex-direction: column; gap: 6px;
}
.report-attach-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.report-attach-card img {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 6px; display: block;
}
.report-attach-caption {
  font-size: 11.5px; color: var(--text-2); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
/* 文字附件卡片（phase_summary 等）：没有图，用 emoji 占位 + 标题 + 摘要 */
.report-attach-card-text {
  background: linear-gradient(180deg, #F5FAF6 0%, #FFF 70%);
  align-items: flex-start; padding: 12px 10px;
}
.report-attach-card-text .report-attach-text-ico {
  width: 100%; aspect-ratio: 1 / 1; display: flex;
  align-items: center; justify-content: center;
  font-size: 36px; color: var(--primary);
  background: var(--primary-light); border-radius: 6px;
}
/* followup 页附件里的文字卡片样式（与 report 的类似但用独立 class） */
.followup-attach-text {
  background: linear-gradient(180deg, #F5FAF6, #FFF);
  display: flex; flex-direction: column; align-items: stretch;
  padding: 8px;
}
.followup-attach-text .followup-attach-text-ico {
  aspect-ratio: 1/1; display: flex; align-items: center; justify-content: center;
  background: var(--primary-light); color: var(--primary);
  font-size: 32px; border-radius: 6px;
}
.followup-attach-text .followup-attach-text-title {
  margin-top: 6px; font-size: 11.5px; font-weight: 600;
  color: var(--primary-dark); text-align: center;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}

/* ==========================================================================
 * 手机端通用紧凑化（<= 1023px）
 * 说明：
 *   - 这里只定义手机端生效的 override，桌面端绝不被波及（用 @media 严格隔离）
 *   - 贯彻"多做一点手机端"的反馈：首页、商城、报告、社区、Profile 都压缩内边距
 *     与字号以腾出更多内容空间；卡片 hover 变 active 态避免手机不支持 hover 的体验问题
 *   - 改完在 PC 端打开什么都应该不变
 * ========================================================================= */
@media (max-width: 1023px) {
  /* --- 页面容器 --- */
  .main { padding: 12px; padding-bottom: calc(var(--tab-h) + 20px); }
  h1 { font-size: 20px !important; }
  .section-title, h3.section-title { font-size: 14px; margin: 14px 0 8px; }

  /* --- 首页 hero --- */
  .hero { padding: 14px 16px; text-align: left; }
  .hero h1 { font-size: 22px !important; margin-bottom: 4px; }
  .hero p { font-size: 13px; line-height: 1.5; }

  /* --- 首页 Grid：entry-card 两列布局保持，但减 padding / 字号 --- */
  .grid { gap: 10px; }
  .grid-2 .entry-card { padding: 14px; gap: 6px; }
  .grid-2 .entry-card .icon { width: 40px; height: 40px; border-radius: 10px; }
  .grid-2 .entry-card .icon svg { width: 22px; height: 22px; }
  .grid-2 .entry-card h3 { font-size: 15px; }
  .grid-2 .entry-card p { font-size: 12px; line-height: 1.45; }
  .grid-2 .entry-card .arrow { right: 10px; bottom: 10px; font-size: 14px; }
  /* feature-card 在手机端，auto-fill minmax(220) 会退化成单列；压缩 padding 即可 */
  .grid-3 .feature-card, .grid-4 .feature-card { padding: 14px; }
  .grid-3 .feature-card .icon, .grid-4 .feature-card .icon { width: 36px; height: 36px; }
  .grid-3 .feature-card h3, .grid-4 .feature-card h3 { font-size: 15px; }
  .grid-3 .feature-card p, .grid-4 .feature-card p { font-size: 12.5px; }

  /* --- 商城 shop --- */
  /* 模式栏手机端改为独占一整行的胶囊，两个 tab 50/50 平分 —— 用户反馈"现金/健康币
   * 两个按钮没占满横条不协调"。让胶囊容器 width:100%，内部两个 button flex:1。 */
  .shop-mode-bar {
    gap: 8px; margin-bottom: 10px; flex-direction: column; align-items: stretch;
  }
  .shop-mode-tabs {
    display: flex; width: 100%;
    padding: 3px; gap: 2px;
  }
  .shop-mode-tab {
    flex: 1 1 0; text-align: center; padding: 9px 8px; font-size: 14px;
  }
  .shop-coin-balance { width: 100%; font-size: 13px; justify-content: center; }
  .shop-toolbar { gap: 8px; }
  .shop-search-input { font-size: 14px; }
  /* 商品网格：手机端默认会根据 auto-fill 规则变 2 列（180px × 2 ≈ 360px）
   * 但用户可能把浏览器缩到 360 以下，强制两列防止单列堆起来太空 */
  .grid.grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  .product-card .product-img { font-size: 36px; }
  .product-card .product-body { padding: 8px 10px; }
  .product-card .product-name { font-size: 13px; }
  .product-card .product-price { font-size: 14px; }
  .product-card .product-tags { display: none; } /* 手机端卡片已经很挤，tags 就不显示了 */
  .product-card .product-cat-badge { font-size: 10px; padding: 1px 6px; margin-bottom: 4px; }

  /* --- 社区 community --- */
  .activity-item { padding: 8px 0; gap: 8px; }
  .activity-headline { font-size: 13.5px; }
  .activity-body { font-size: 12.5px; line-height: 1.5; }
  .activity-user { font-size: 11.5px; }

  /* --- 报告列表（report list 卡片） --- */
  /* 报告卡是 .card 样式 + 内嵌 flex，手机端压缩 padding */
  #reportList .card { padding: 12px; margin-bottom: 10px; }
  /* 报告 modal 在手机端尽量铺满 */
  #rdModal .modal { max-width: 94vw; max-height: 88vh; overflow-y: auto; padding: 16px; }
  #rdBody h2 { font-size: 17px; }
  .report-attach-grid { grid-template-columns: repeat(3, 1fr) !important; gap: 8px; }

  /* --- 关闭/分享按钮行手机端堆叠 --- */
  .modal-actions { flex-wrap: wrap; gap: 6px; }
  .modal-actions .btn { flex: 1 1 auto; min-width: 0; }

  /* --- 上传区 drop-zone（舌诊 / 穴位识别共用） --- */
  /* 手机端 24px padding 太浪费屏幕，压缩到 18px；SVG 尺寸也略小 */
  .drop-zone { padding: 18px 14px; border-radius: 12px; }
  .drop-zone svg { width: 26px; height: 26px; margin-bottom: 6px; }
  .drop-zone .hint { font-size: 11px; }

  /* --- 个人中心 profile --- */
  /* profile.html 里的样式是内联的，这里用同样的 class 在全局手机端做 override，不会波及桌面端 */
  .profile-hero { padding: 16px; gap: 12px; border-radius: 14px; }
  .profile-hero .profile-avatar { width: 56px; height: 56px; font-size: 22px; border-width: 1.5px; }
  .profile-hero h1 { font-size: 19px !important; margin-bottom: 2px; }
  .profile-hero .hero-desc { font-size: 12px; line-height: 1.5; }
  .profile-hero .profile-meta { gap: 6px; margin-top: 6px; }
  .profile-hero .profile-meta .badge { font-size: 11px; padding: 2px 8px; }
  .profile-section-head h2 { font-size: 15px; }
  .profile-section-head .sub { font-size: 11.5px; }
  .profile-grid { gap: 10px; }
  .profile-grid .profile-item { padding: 12px 14px; }
  .profile-item .k { font-size: 11px; margin-bottom: 4px; }
  .profile-item .v { font-size: 17px; }
  .profile-item .sub { font-size: 11.5px; margin-top: 4px; }
  .profile-shortcuts { gap: 8px; }
  .profile-shortcut { padding: 11px 13px; gap: 10px; }
  .profile-shortcut .icon { width: 34px; height: 34px; font-size: 17px; border-radius: 8px; }
  .profile-shortcut .t { font-size: 13.5px; }
  .profile-shortcut .d { font-size: 11.5px; }

  /* --- 舌诊 tongue 页 --- */
  /* tongue 页用 .grid-2 放正反面两个上传区；手机端保持 2 列（窄屏下也不拆），
   * 但 drop-zone padding 已经在上面统一缩小了。再收紧一下两列间距 */
  body:has(#frontDrop) .grid-2 { gap: 10px; }
  body:has(#frontDrop) .card { padding: 14px; }

  /* --- 穴位识别 acupoint 页 --- */
  /* 识别结果 canvas 区 max-height 70vh 手机端太挤，放开到 60vh 并允许 pinch-zoom */
  #canvasWrap > .card { padding: 14px; }
  #canvasWrap .card > div[style*="max-height"] { max-height: 58vh !important; }
  #canvasWrap h3 { font-size: 15px; margin-bottom: 8px; }
  /* 穴位选择的 grid-2（穴位名 + 身体部位）手机端改单列，避免两列挤变形 */
  body:has(#pointName) .grid-2 { grid-template-columns: 1fr; gap: 10px; }
}

/* ===== 手机端聊天页紧凑化 ===== */
@media (max-width: 1023px) {
  .msg { max-width: 92%; gap: 8px; }
  .msg .avatar { width: 30px; height: 30px; font-size: 15px; }
  .msg .bubble { padding: 9px 12px; font-size: 14px; line-height: 1.55; border-radius: 14px; }
  .chat-msgs { padding: 12px 10px; gap: 10px; }
  .chat-input-wrap { padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0)); }
  .chat-input-row { gap: 6px; }
  .chat-input-row textarea {
    padding: 9px 12px; font-size: 15px; min-height: 38px; max-height: 120px;
    border-radius: 18px;
  }
  .chat-input-row .icon-btn { width: 38px; height: 38px; flex-shrink: 0; }
  .chat-quick { gap: 6px; margin-bottom: 6px; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .chat-quick::-webkit-scrollbar { display: none; }
  .chat-quick button {
    flex-shrink: 0; font-size: 12px; padding: 5px 10px;
    white-space: nowrap;
  }
  .chat-inline-img { max-width: 72vw; max-height: 180px; }
  .follow-chip { padding: 6px 10px; font-size: 12px; }
  .msg-actions { gap: 4px; }
  .msg-action-btn { width: 24px; height: 24px; }
}

/* ===== 手机端顶部操作按钮（主要流程 + 历史） ===== */
.chat-mobile-btn {
  width: 34px; height: 34px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-soft); border: 1px solid var(--border);
  color: var(--text-2); cursor: pointer;
}
.chat-mobile-btn:hover, .chat-mobile-btn:active { color: var(--primary-dark); border-color: var(--primary); background: var(--primary-light); }
@media (min-width: 1024px) { .chat-mobile-btn { display: none !important; } }

/* 保存报告按钮：PC 端显示文字，手机端只显示 SVG 图标 */
#saveReportBtn { gap: 6px; }
#saveReportBtn .save-ico { display: none; flex-shrink: 0; }
@media (max-width: 1023px) {
  #saveReportBtn {
    padding: 0 !important; min-width: 0 !important;
    width: 34px; height: 34px; border-radius: 10px;
    gap: 0 !important;
  }
  #saveReportBtn .txt { display: none; }
  #saveReportBtn .save-ico { display: block; }
}

/* ===== 抽屉（移动端主要流程 / 历史对话） ===== */
.chat-drawer-mask {
  position: fixed; inset: 0; z-index: 9990;
  background: rgba(0,0,0,.35); opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.chat-drawer-mask.show { opacity: 1; pointer-events: auto; }
.chat-drawer {
  position: fixed; z-index: 9991;
  top: 0; right: 0; height: 100dvh; width: min(86vw, 360px);
  background: #fff; box-shadow: -8px 0 30px rgba(0,0,0,.12);
  transform: translateX(100%); transition: transform .25s ease;
  display: flex; flex-direction: column;
}
.chat-drawer.show { transform: translateX(0); }
.chat-drawer-head {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.chat-drawer-tabs { display: flex; gap: 4px; padding: 8px 10px 0; }
.chat-drawer-tab {
  flex: 1; padding: 8px 10px; border-radius: 10px 10px 0 0;
  background: transparent; color: var(--text-2); font-size: 13px; font-weight: 600;
  border-bottom: 2px solid transparent;
}
.chat-drawer-tab.active { color: var(--primary-dark); background: var(--primary-light); border-bottom-color: var(--primary); }
.chat-drawer-body { flex: 1; overflow-y: auto; padding: 12px 16px 20px; }
.chat-drawer-close {
  width: 32px; height: 32px; border-radius: 10px; margin-left: auto;
  background: var(--bg-soft); color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px; line-height: 1;
}
@media (min-width: 1024px) { .chat-drawer, .chat-drawer-mask { display: none !important; } }

/* 主要流程样式（PC 左栏 + 抽屉） */
.flow-card {
  background: #fff; border-radius: var(--radius-md);
  padding: 14px 16px; box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.flow-card h4 {
  font-size: 12px; font-weight: 600; color: var(--text-3);
  letter-spacing: 1px; margin-bottom: 10px;
}
.flow-steps { display: flex; flex-direction: column; gap: 0; }
.flow-step {
  position: relative;
  display: flex; gap: 10px; align-items: center;
  padding: 8px 0;
}
/* 用 ::before 画出序号之间的竖直连接线（到上一个 step） */
.flow-step + .flow-step::before {
  content: "";
  position: absolute;
  left: 10px;                /* 对齐 .idx 圆心 (idx width 22 / 2 = 11, -1 校正) */
  top: -6px;
  width: 2px;
  height: 14px;
  background: var(--border);
}
.flow-step .idx {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg-soft); color: var(--text-3);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  position: relative; z-index: 1;
}
.flow-step .txt { flex: 1; font-size: 13.5px; line-height: 1.5; color: var(--text); }

/* 体质辨识（health）跟不适调理统一：所有步骤文字用默认色，不加粗
   （用户明确要求全部改成一样的字体颜色）。
   圆点仍轻微变色作为“当前在进行”的辅助提示。 */
.flow-steps.flow-with-active .flow-step.active .idx {
  background: var(--primary-light); color: var(--primary-dark);
}
.flow-steps.flow-with-active .flow-step.active .txt {
  color: var(--text); font-weight: normal;
}
/* 不适调理（consultation）则不变绿：idx 中性灰、文字普通色 */

/* 调试面板 */
.debug-toggle {
  position: fixed; bottom: 14px; right: 14px; z-index: 9990;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary-dark); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; cursor: pointer; border: none;
  box-shadow: var(--shadow-md); opacity: .7;
  transition: opacity .2s;
}
.debug-toggle:hover { opacity: 1; }
.debug-panel {
  position: fixed; bottom: 56px; right: 14px; z-index: 9989;
  width: min(420px, 90vw); max-height: 50vh; overflow-y: auto;
  background: #1a1a2e; color: #ddd; border-radius: 12px;
  padding: 14px 16px; font-size: 12px; font-family: monospace;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
  display: none; line-height: 1.6;
}
.debug-panel.show { display: block; }
.debug-panel .log-line { border-bottom: 1px solid rgba(255,255,255,.08); padding: 3px 0; word-break: break-all; }
.debug-panel .log-line.error { color: #ff6b6b; }
.debug-panel .log-line.warn { color: #ffd43b; }

/* 语音按钮样式 */
#micBtn.primary { color: var(--danger); }
.select { display: block; width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: #fff; font-size: 14px; color: var(--text); }

/* ===== 悬浮视频播放器 ===== */
.vp-overlay {
  position: fixed; inset: 0; z-index: 10001;
  background: rgba(0,0,0,.82);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
  animation: vpFadeIn .2s ease-out;
}
.vp-overlay.show { display: flex; }
@keyframes vpFadeIn { from { opacity: 0; } to { opacity: 1; } }

.vp-container {
  width: min(920px, 96vw);
  max-height: 92vh;
  background: #13161C; color: #EAEAEA;
  border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}

.vp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,.08);
  background: #1a1e27;
}
.vp-title { font-size: 14px; font-weight: 600; color: #fff; }
.vp-header-actions { display: flex; gap: 8px; }
.vp-btn {
  background: rgba(255,255,255,.08); color: #EAEAEA;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px; padding: 6px 12px;
  font-size: 12px; cursor: pointer; transition: all .15s;
  display: inline-flex; align-items: center; gap: 4px;
}
.vp-btn:hover { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.25); }
.vp-close-btn { font-size: 18px; padding: 4px 10px; line-height: 1; }

.vp-body { position: relative; background: #000; }
.vp-body video {
  width: 100%; max-height: 60vh;
  display: block; background: #000;
}

/* 全屏态：video 撑满，控制栏悬浮在底部 */
.vp-container:fullscreen,
.vp-container:-webkit-full-screen {
  width: 100vw; height: 100vh; max-height: 100vh;
  border-radius: 0; display: flex; flex-direction: column;
}
.vp-container:fullscreen .vp-body,
.vp-container:-webkit-full-screen .vp-body {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
}
.vp-container:fullscreen .vp-body video,
.vp-container:-webkit-full-screen .vp-body video {
  max-height: calc(100vh - 120px); object-fit: contain;
}

.vp-controls {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: #1a1e27;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-wrap: wrap;
}
.vp-ctrl-btn {
  background: transparent; color: #EAEAEA;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 6px; padding: 6px 10px;
  font-size: 13px; cursor: pointer; transition: all .15s;
  line-height: 1; min-width: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none;
}
.vp-ctrl-btn:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.3); }

.vp-progress-wrap {
  flex: 1; min-width: 120px; position: relative;
  height: 6px; background: rgba(255,255,255,.12);
  border-radius: 3px; cursor: pointer;
  margin: 0 4px;
}
.vp-progress-buffered {
  position: absolute; inset: 0 auto 0 0;
  width: 0; background: rgba(255,255,255,.22);
  border-radius: 3px;
}
.vp-progress-played {
  position: absolute; inset: 0 auto 0 0;
  width: 0; background: var(--primary);
  border-radius: 3px;
}
.vp-progress-thumb {
  position: absolute; top: 50%; left: 0;
  transform: translate(-50%, -50%);
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 2px var(--primary);
  pointer-events: none;
}
.vp-progress-wrap:hover .vp-progress-thumb { transform: translate(-50%, -50%) scale(1.2); }

.vp-time {
  font-size: 12px; color: #B5B5B5;
  min-width: 92px; text-align: center;
  font-variant-numeric: tabular-nums;
}

.vp-playlist {
  background: #1a1e27;
  border-top: 1px solid rgba(255,255,255,.08);
  max-height: 240px; overflow-y: auto;
  padding: 10px 14px;
}
.vp-playlist-title {
  font-size: 12px; color: #9A9A9A;
  margin-bottom: 8px; letter-spacing: 1px;
}
.vp-playlist ul { list-style: none; padding: 0; margin: 0; }
.vp-playlist li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  cursor: pointer; font-size: 13px; color: #D5D5D5;
  transition: background .12s;
}
.vp-playlist li:hover { background: rgba(255,255,255,.06); }
.vp-playlist li.active {
  background: rgba(63,125,88,.18);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--primary);
}
.vp-pl-idx {
  min-width: 22px; height: 22px;
  background: rgba(255,255,255,.08);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: #B5B5B5;
}
.vp-playlist li.active .vp-pl-idx { background: var(--primary); color: #fff; }
.vp-pl-name {
  flex: 1; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}

@media (max-width: 768px) {
  .vp-container { width: 100vw; max-height: 100vh; border-radius: 0; }
  .vp-body video { max-height: 45vh; }
  .vp-controls { gap: 6px; padding: 8px 10px; }
  .vp-ctrl-btn { padding: 5px 8px; font-size: 12px; }
  .vp-time { min-width: 78px; font-size: 11px; }
}

/* ===== 分享悬浮窗（share.js） ===== */
.share-modal-bg {
  position: fixed; inset: 0; z-index: 10002;
  background: rgba(0,0,0,.72);
  display: none; align-items: center; justify-content: center;
  padding: 16px;
  animation: vpFadeIn .2s ease-out;
}
.share-modal-bg.show { display: flex; }
.share-modal {
  background: #fff; border-radius: 16px;
  width: min(420px, 96vw); max-height: 94vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  overflow: hidden;
}
.share-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.share-title { font-size: 16px; font-weight: 700; color: var(--text); }
.share-close {
  background: transparent; border: none; color: var(--text-3);
  font-size: 20px; cursor: pointer; padding: 0 8px; line-height: 1;
}
.share-close:hover { color: var(--text); }
.share-preview-wrap {
  padding: 14px 18px; flex: 1; min-height: 0; overflow-y: auto;
  display: flex; justify-content: center;
  background: #F8F9FA;
}
.share-canvas {
  width: 100%; max-width: 340px; height: auto;
  border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.15);
  display: block;
}
.share-tip {
  padding: 10px 18px; font-size: 12.5px; color: var(--text-3);
  text-align: center; background: #FAFAFA;
  border-top: 1px solid var(--border);
}
.share-actions {
  padding: 12px 16px 16px; display: flex; gap: 8px; flex-wrap: wrap;
  border-top: 1px solid var(--border);
}
.share-btn {
  flex: 1; min-width: 110px;
  background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 6px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.share-btn:hover {
  background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark);
}
.share-btn-primary {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.share-btn-primary:hover { background: var(--primary-dark); color: #fff; border-color: var(--primary-dark); }
