/**
 * 辨证服务嵌入页 · hud-premium-all-2026-06-02（高端 glass HUD · 暗色玻璃卡 · SaaS 级表单）
 * **cache-bust** ``mobile-opt-2026-06-09``（与 ``tcm.html`` / ``tcm_ai_embed.js`` 同参）：reverify-ui-fix、mobile-layout-fix、mobile-voice-ux、mobile-opt-2026-06-09、tongue-hybrid 置信度条。
 */

#tcm-ai-pane.tcm-ai-root {
  --tcm-font: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --tcm-mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --tcm-bg: rgba(6, 20, 40, 0.5);
  --tcm-panel: rgba(8, 28, 52, 0.82);
  --tcm-border: rgba(0, 212, 255, 0.25);
  --tcm-muted: rgba(148, 210, 230, 0.78);
  --tcm-text: #e0f7ff;
  --tcm-accent: #00d4ff;
  --tcm-accent-2: #00ffff;
  --tcm-accent-soft: rgba(0, 212, 255, 0.14);
  --tcm-accent-gradient: linear-gradient(135deg, #0099cc 0%, #00d4ff 50%, #00ffff 100%);
  --tcm-danger: #fca5a5;
  --tcm-radius: 14px;
  --tcm-radius-sm: 12px;
  --tcm-shadow-sm: 0 2px 8px rgba(11, 18, 32, 0.05);
  --tcm-shadow: 0 4px 16px rgba(11, 18, 32, 0.07);
  --tcm-shadow-md: 0 8px 28px rgba(11, 18, 32, 0.09);
  --tcm-transition: 0.14s ease;
  /* 单列 composer：上下文折叠正文 / 合议滚动区保底高度（可被 JS 重写，见 ``applyLayoutCssVars``） */
  --tcm-ai-ctx-sheet-body-min-h: clamp(17rem, 38vh, 480px);
  --tcm-ai-chat-scroll-min-h: clamp(340px, 56vh, 960px);
  --tcm-z-content: 1;
  --tcm-z-sticky-footer: 50;
  --tcm-z-toast: 120;
  --tcm-z-modal: 200;
  box-sizing: border-box;
  font-family: var(--tcm-font);
  color: var(--tcm-text);
  line-height: 1.55;
  font-size: 15px;
  background: transparent;
}

#tcm-ai-pane.tcm-ai-root *,
#tcm-ai-pane.tcm-ai-root *::before,
#tcm-ai-pane.tcm-ai-root *::after {
  box-sizing: inherit;
}

#tcm-ai-pane .tcm-ai-status-block {
  margin-top: 0.5rem;
}
#tcm-ai-pane .tcm-ai-status-block--lg {
  margin-top: 0.75rem;
}
#tcm-ai-pane .tcm-ai-demo-lead {
  margin: 0.25rem 0;
}
#tcm-ai-pane .tcm-ai-rec-label {
  margin-bottom: 0.2rem;
  font-weight: 600;
}
#tcm-ai-pane .tcm-ai-textarea-step4 {
  min-height: 5rem;
}
#tcm-ai-pane .tcm-ai-qa-out-hidden,
#tcm-ai-pane .tcm-ai-sup-out-hidden {
  display: none !important;
}
#tcm-ai-pane pre.tcm-ai-result-box:not(.tcm-ai-sup-out-hidden) {
  font-size: 0.95rem;
  margin-top: 0.75rem;
}

#tcm-ai-pane .tcm-ai-banner {
  display: none;
  padding: 0.6rem 0.95rem;
  border-radius: 12px;
  background: rgba(120, 80, 20, 0.35);
  border: 1px solid rgba(180, 130, 40, 0.35);
  border-left: 4px solid #d4a017;
  color: #fde68a;
  margin-bottom: 0.85rem;
  font-size: 0.86rem;
  line-height: 1.5;
}
#tcm-ai-pane .tcm-ai-banner.is-visible {
  display: block;
}

#tcm-ai-pane .tcm-ai-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

#tcm-ai-pane .tcm-ai-step-pill {
  /* redesign: 干净圆润药丸，当前步 teal 实底白字 */
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #f1f5f9;
  font-size: 0.78rem;
  color: #475569;
  cursor: default;
  font-weight: 600;
}

#tcm-ai-pane .tcm-ai-step-pill .idx {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: #64748b;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
}

#tcm-ai-pane .tcm-ai-step-pill.is-current {
  border-color: #0f766e;
  color: #ffffff;
  background: #0f766e;
  box-shadow: 0 1px 2px rgba(15,118,110,0.25);
}
#tcm-ai-pane .tcm-ai-step-pill.is-current .idx {
  background: #ffffff;
  color: #0f766e;
}

#tcm-ai-pane .tcm-ai-step-pill.is-done {
  border-color: #10b981;
  background: #ecfdf5;
  color: #166534;
}
#tcm-ai-pane .tcm-ai-step-pill.is-done .idx {
  background: #10b981;
  color: #fff;
}

#tcm-ai-pane .tcm-ai-step-panel {
  display: none;
}

#tcm-ai-pane .tcm-ai-step-panel.is-visible {
  display: block;
}

#tcm-ai-pane .tcm-ai-card {
  background: var(--tcm-panel);
  border: 1px solid var(--tcm-border);
  border-radius: var(--tcm-radius);
  padding: 1rem 1.15rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--tcm-shadow-sm);
  transition: box-shadow var(--tcm-transition);
}
#tcm-ai-pane .tcm-ai-card:hover {
  box-shadow: var(--tcm-shadow);
}

#tcm-ai-pane .tcm-ai-card.tcm-ai-card-clean {
  padding: 1.5rem;
  border-radius: 12px;
}

#tcm-ai-pane .tcm-ai-card .lead {
  margin-top: 0;
  color: #475569;
  font-size: 0.88rem;
  line-height: 1.4;
}

#tcm-ai-pane .tcm-ai-step3-card {
  padding-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

@media (min-height: 720px) {
  #tcm-ai-pane .tcm-ai-step-panel[data-step="3"].is-visible .tcm-ai-step3-card {
    min-height: calc(100vh - 9.5rem);
  }
}

#tcm-ai-pane .tcm-ai-step3-lead {
  line-height: 1.62;
}

#tcm-ai-pane .tcm-ai-step3-card .tcm-ai-legal-strong {
  color: #92400e;
  font-weight: 800;
}

#tcm-ai-pane .tcm-ai-step3-lead code {
  font-family: var(--tcm-mono);
  font-size: 0.88em;
  background: var(--tcm-bg);
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
}

#tcm-ai-pane .tcm-ai-legal-strong {
  color: var(--tcm-danger);
}

#tcm-ai-pane .tcm-ai-callout {
  padding: 0.75rem 1rem;
  border-radius: var(--tcm-radius-sm);
  border: 1px dashed var(--tcm-border);
  background: var(--tcm-bg);
  font-size: 0.92rem;
  color: var(--tcm-muted);
  margin-bottom: 1rem;
}

#tcm-ai-pane .tcm-ai-label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  color: #94a3b8;
  margin: 1rem 0 0.45rem;
  letter-spacing: 0.01em;
}

#tcm-ai-pane .tcm-ai-label-inline {
  display: inline-block;
  margin-top: 0.35rem;
}

.tcm-ai-input,
.tcm-ai-select,
#tcm-ai-pane .tcm-ai-textarea {
  width: 100%;
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  font-family: inherit;
  font-size: 0.92rem;
  background: rgba(4, 16, 32, 0.75);
  color: #f1f5f9;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: border-color var(--tcm-transition), box-shadow var(--tcm-transition);
}
.tcm-ai-input:focus,
.tcm-ai-select:focus,
#tcm-ai-pane .tcm-ai-textarea:focus {
  outline: none;
  border-color: var(--tcm-accent);
  box-shadow: 0 0 0 3px var(--tcm-accent-soft);
}

#tcm-ai-pane .tcm-ai-textarea {
  min-height: 5rem;
  resize: vertical;
}

#tcm-ai-pane .tcm-ai-textarea-compact {
  min-height: 4rem;
}

#tcm-ai-pane .tcm-ai-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

#tcm-ai-pane .tcm-ai-btn {
  appearance: none;
  border: 1px solid var(--tcm-accent);
  background: linear-gradient(135deg, #0891b2 0%, #06b6d4 45%, #22d3ee 100%);
  color: #fff;
  font-weight: 700;
  padding: 0.6rem 1.15rem;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.9rem;
  min-height: 2.55rem;
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.25);
  transition: filter var(--tcm-transition), box-shadow var(--tcm-transition);
}
#tcm-ai-pane .tcm-ai-btn:hover {
  filter: brightness(1.06);
  box-shadow: 0 0 22px rgba(0, 212, 255, 0.35);
}

#tcm-ai-pane .tcm-ai-btn.tcm-ai-btn-redeem-busy {
  pointer-events: none;
  cursor: progress;
  opacity: 0.88;
}

#tcm-ai-pane .tcm-ai-btn.secondary {
  background: #f8fafc;
  color: #0f766e;
  border-color: #0f766e;
}

#tcm-ai-pane .tcm-ai-btn.secondary:hover {
  background: #ecfdf5;
}

#tcm-ai-pane .tcm-ai-status {
  font-size: 0.88rem;
  color: var(--tcm-muted);
}

#tcm-ai-pane .tcm-ai-status.loading {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex-shrink: 0;
  align-self: stretch;
  min-height: 2.5rem;
  line-height: 1.45;
}

#tcm-ai-pane .tcm-ai-status.loading > span:not(.tcm-ai-spinner) {
  flex: 1 1 12rem;
  min-width: 0;
}

#tcm-ai-pane .tcm-ai-status.err {
  color: var(--tcm-danger);
}

#tcm-ai-pane .tcm-ai-status.ok {
  color: #166534;
}

#tcm-ai-pane .tcm-ai-status .check {
  margin-right: 0.35rem;
}

/* 第三步「辨证结果状态」行已自嵌入脚本移除；若缓存页或宿主仍含节点则不占位 */
#tcm-ai-pane #tcm-ai-s3-status {
  display: none !important;
  margin: 0 !important;
  min-height: 0 !important;
}

#tcm-ai-pane .tcm-ai-spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--tcm-border);
  border-top-color: var(--tcm-accent);
  border-radius: 50%;
  animation: tcm-ai-spin 0.75s linear infinite;
}

@keyframes tcm-ai-spin {
  to {
    transform: rotate(360deg);
  }
}

#tcm-ai-pane .tcm-ai-quota {
  font-size: 0.88rem;
  color: var(--tcm-muted);
  margin-top: 0.5rem;
}

/* 第一步 · 档位说明（三列卡片，小屏单列） */
#tcm-ai-pane .tcm-ai-tier-intro {
  margin-top: 0.85rem;
  padding: 1.05rem 1.1rem 1.15rem;
  border-radius: var(--tcm-radius);
  border: 1px solid rgba(13, 148, 136, 0.18);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.98) 0%, rgba(240, 253, 250, 0.55) 55%, rgba(255, 255, 255, 0.96) 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 6px 22px rgba(13, 148, 136, 0.06);
}

#tcm-ai-pane .tcm-ai-tier-intro-head {
  margin-bottom: 0.15rem;
}

#tcm-ai-pane .tcm-ai-tier-intro-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  color: var(--tcm-text);
}

#tcm-ai-pane .tcm-ai-tier-intro-sub {
  margin: 0;
  font-size: 0.78rem;
  color: var(--tcm-muted);
  line-height: 1.52;
  max-width: 52rem;
}

#tcm-ai-pane .tcm-ai-tier-intro-strong {
  color: var(--tcm-text);
  font-weight: 650;
}

#tcm-ai-pane .tcm-ai-tier-intro-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.85rem;
}

@media (max-width: 720px) {
  #tcm-ai-pane .tcm-ai-tier-intro-grid {
    grid-template-columns: 1fr;
  }
}

#tcm-ai-pane .tcm-ai-tier-intro-card {
  padding: 0.85rem 0.95rem;
  border-radius: var(--tcm-radius-sm);
  border: 1px solid rgba(226, 229, 235, 0.95);
  background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  min-width: 0;
}

#tcm-ai-pane .tcm-ai-tier-intro-card.is-current {
  border-color: var(--tcm-accent);
  box-shadow: 0 0 0 1px var(--tcm-accent-soft), 0 10px 26px rgba(13, 148, 136, 0.07);
}

#tcm-ai-pane .tcm-ai-tier-intro-card-title {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--tcm-text);
}

#tcm-ai-pane .tcm-ai-tier-intro-list {
  margin: 0;
  padding-left: 1.05rem;
  font-size: 0.8rem;
  color: var(--tcm-muted);
  line-height: 1.48;
}

#tcm-ai-pane .tcm-ai-tier-intro-list li + li {
  margin-top: 0.32rem;
}

#tcm-ai-pane .tcm-ai-mad-extra {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem 1rem;
  margin-top: 0.75rem;
}

#tcm-ai-pane .tcm-ai-mad-extra-lead {
  grid-column: 1 / -1;
  margin: 0 0 0.35rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--tcm-radius-sm);
  border: 1px solid var(--tcm-border);
  background: var(--tcm-bg);
  font-size: 0.82rem;
  line-height: 1.55;
}
#tcm-ai-pane .tcm-ai-mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 1rem 0 0.65rem;
}

#tcm-ai-pane .tcm-ai-mode-tab {
  border: 1px solid var(--tcm-border);
  background: var(--tcm-bg);
  padding: 0.5rem 0.85rem;
  min-height: 2.65rem;
  border-radius: var(--tcm-radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

#tcm-ai-pane .tcm-ai-mode-tab.is-current {
  border-color: var(--tcm-accent);
  background: var(--tcm-accent-soft);
  font-weight: 600;
}

#tcm-ai-pane .tcm-ai-mode-panel {
  display: none;
}

#tcm-ai-pane .tcm-ai-mode-panel.is-visible {
  display: block;
}

#tcm-ai-pane .tcm-ai-catalog-line {
  font-size: 0.88rem;
  color: var(--tcm-muted);
  margin-bottom: 0.5rem;
}

#tcm-ai-pane .tcm-ai-sym-wrap {
  margin-top: 0.5rem;
}

#tcm-ai-pane .tcm-ai-sym-cat {
  margin-bottom: 0.65rem;
  border: 1px solid var(--tcm-border);
  border-radius: var(--tcm-radius-sm);
  overflow: hidden;
}

#tcm-ai-pane .tcm-ai-sym-cat-toggle {
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border: none;
  background: var(--tcm-bg);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
}

#tcm-ai-pane .tcm-ai-sym-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.65rem;
  border-top: 1px solid var(--tcm-border);
  background: #fff;
}

#tcm-ai-pane .tcm-ai-sym-chip {
  border: 1px solid var(--tcm-border);
  background: #fff;
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.82rem;
  cursor: pointer;
  user-select: none;
}

#tcm-ai-pane .tcm-ai-sym-chip.is-on {
  border-color: var(--tcm-accent);
  background: var(--tcm-accent-soft);
  font-weight: 600;
}

/* 第二步 · 用户标定的「主症状」：更明显描边 + 星标 + 「主」字（区别于普通已选）。 */
#tcm-ai-pane .tcm-ai-sym-chip.is-primary {
  border-width: 2px;
  border-color: #a855f7;
  box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.25);
}

#tcm-ai-pane .tcm-ai-sym-chip.is-primary::before {
  content: "★";
  margin-right: 0.15rem;
  font-size: 0.76em;
  color: #eab308;
  vertical-align: 0.05em;
}

#tcm-ai-pane .tcm-ai-sym-chip.is-primary::after {
  content: "主";
  margin-left: 0.35rem;
  font-size: 0.72em;
  font-weight: 800;
  color: var(--tcm-accent, #0369a1);
  opacity: 0.95;
  letter-spacing: 0.06em;
  border-radius: 0.2rem;
  border: 1px solid rgba(3, 105, 161, 0.45);
  padding: 0 0.2rem;
  line-height: 1;
  vertical-align: 0.12em;
}

#tcm-ai-pane .tcm-ai-ref-grid {
  max-height: 320px;
  overflow: auto;
}

#tcm-ai-pane .tcm-ai-ref-actions {
  margin-top: 0.5rem;
}

#tcm-ai-pane .tcm-ai-selected-summary {
  padding: 0.65rem;
  border-radius: var(--tcm-radius-sm);
  border: 1px dashed var(--tcm-border);
  font-size: 0.88rem;
  min-height: 2.75rem;
  color: var(--tcm-muted);
}

#tcm-ai-pane .tcm-ai-selected-summary-primary-block .tcm-ai-selected-summary-sub-label {
  margin-right: 0.35rem;
  color: #6b21a8;
}

#tcm-ai-pane .tcm-ai-selected-summary-block + .tcm-ai-selected-summary-block {
  margin-top: 0.45rem;
}

#tcm-ai-pane .tcm-ai-hint {
  font-size: 0.82rem;
  color: var(--tcm-muted);
  margin: 0.35rem 0 0;
}

#tcm-ai-pane .tcm-ai-result-box {
  padding: 0.75rem;
  border-radius: var(--tcm-radius-sm);
  border: 1px solid var(--tcm-border);
  background: var(--tcm-bg);
  white-space: pre-wrap;
  font-family: var(--tcm-mono);
  font-size: 0.88rem;
}

/* 第四步追问答复：Markdown 正文用普通段落排版，勿沿用技术 JSON 区的等宽 pre-wrap */
#tcm-ai-pane .tcm-ai-qa-out-root.tcm-ai-result-box {
  white-space: normal;
  font-family: var(--tcm-font);
  font-size: 0.95rem;
}

/* —— 第三步 · Composer —— */

#tcm-ai-pane .tcm-ai-wb-actions-top {
  margin-bottom: 0.85rem;
}

#tcm-ai-pane .tcm-ai-wb-actions-bottom {
  margin-top: 1rem;
}

#tcm-ai-pane .tcm-ai-composer-shell {
  display: flex;
  flex-direction: column;
  /* basis 0 + grow: fill step-3 card slack; flex-shrink:0 + min-height 防止被外层 flex 压低后 ctx/chat 塌陷 */
  flex: 1 1 0;
  flex-shrink: 0;
  min-height: clamp(24rem, 60vh, 1200px);
  max-height: min(96vh, 76rem);
  border: 1px solid var(--tcm-border);
  border-radius: var(--tcm-radius);
  background: var(--tcm-panel);
  overflow-x: hidden;
  overflow-y: auto;
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.05);
}

@media (min-width: 561px) {
  /* 桌面：解除封顶，保底靠 min-height + 两段 scrollport；整页纵向滚动承接超高内容 */
  #tcm-ai-pane .tcm-ai-composer-shell {
    max-height: none;
  }
  /* 长上下文在本区内部滚动，把纵向份额让给下方 chat / 读本 / footer */
  #tcm-ai-pane details.tcm-ai-ctx-sheet[open] > .tcm-ai-ctx-sheet-body {
    max-height: min(42vh, 28rem);
  }
  /* 仅「读本指引」一行时勿保留 max-height 夹断空壳 */
  #tcm-ai-pane details.tcm-ai-ctx-sheet._tcm-ctx-sheet-compact[open] > .tcm-ai-ctx-sheet-body,
  #tcm-ai-pane details.tcm-ai-ctx-sheet[open]:has(#tcm-ai-wb-prescription-holder[hidden])
    > .tcm-ai-ctx-sheet-body {
    max-height: none;
  }
}

/* 折叠态可随列压缩；展开态禁止被会诊区 min-height 挤扁（否则正文被 shell overflow:hidden 裁切且无滚动条） */
#tcm-ai-pane .tcm-ai-composer-shell > details.tcm-ai-ctx-sheet:not([open]) {
  flex: 0 1 auto;
  min-height: 0;
}

#tcm-ai-pane .tcm-ai-composer-shell > details.tcm-ai-ctx-sheet[open] {
  flex: 0 0 auto;
  min-height: 0;
}

#tcm-ai-pane .tcm-ai-ctx-sheet {
  border-bottom: 1px solid var(--tcm-border);
  background: var(--tcm-panel);
}

#tcm-ai-pane .tcm-ai-ctx-sheet-sum {
  list-style: none;
  cursor: pointer;
  padding: 0.85rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

#tcm-ai-pane .tcm-ai-ctx-sheet-sum::-webkit-details-marker {
  display: none;
}

#tcm-ai-pane .tcm-ai-ctx-sheet-sum::before {
  content: "\25B8 ";
  flex-shrink: 0;
  color: #94a3b8;
  font-size: 0.9rem;
  line-height: 1;
  transition: transform 0.14s ease;
}

#tcm-ai-pane details.tcm-ai-ctx-sheet[open] > .tcm-ai-ctx-sheet-sum::before {
  transform: rotate(90deg);
}

#tcm-ai-pane .tcm-ai-ctx-sheet-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0f766e;
  flex: 0 0 auto;
  padding: 0.14rem 0.38rem;
  border-radius: 6px;
  border: 1px solid rgba(13, 148, 136, 0.22);
  background: rgba(13, 148, 136, 0.08);
}

#tcm-ai-pane .tcm-ai-ctx-sheet-head {
  flex: 1;
  min-width: 200px;
}

#tcm-ai-pane .tcm-ai-wb-summary-patient-caption {
  margin: 0;
}

#tcm-ai-pane .tcm-ai-wb-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--tcm-accent-soft);
  color: #0f766e;
  margin-right: 0.35rem;
}

#tcm-ai-pane .tcm-ai-wb-formula-title,
#tcm-ai-pane .tcm-ai-ctx-formula-title {
  margin: 0.35rem 0 0;
  font-size: 1.05rem;
}

#tcm-ai-pane .tcm-ai-ctx-sheet-meta {
  font-size: 0.82rem;
  color: var(--tcm-muted);
  align-self: center;
}

#tcm-ai-pane details.tcm-ai-ctx-sheet[open] {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#tcm-ai-pane details.tcm-ai-ctx-sheet[open] > .tcm-ai-ctx-sheet-sum {
  flex-shrink: 0;
}

/* 展开后正文可滚动，确保针灸/摘要始终可达（长君臣佐使列表场景） */
#tcm-ai-pane details.tcm-ai-ctx-sheet[open] > .tcm-ai-ctx-sheet-body {
  flex: 1 1 0%;
  flex-shrink: 0;
  min-height: var(--tcm-ai-ctx-sheet-body-min-h);
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* 未展开工作台快照时：正文仅为隐藏占位或无实质 markdown，不向 flex 主轴索取余量 — 避免大块空白（clamp vh/flex-grow 叠加）*/
#tcm-ai-pane details.tcm-ai-ctx-sheet._tcm-ctx-sheet-compact[open] > .tcm-ai-ctx-sheet-body,
#tcm-ai-pane details.tcm-ai-ctx-sheet[open]:has(#tcm-ai-wb-prescription-holder[hidden]) > .tcm-ai-ctx-sheet-body {
  flex: 0 1 auto;
  align-self: stretch;
  min-height: min-content;
  overflow-x: hidden;
  overflow-y: visible;
  padding-top: 0;
  padding-bottom: 0.35rem;
}

#tcm-ai-pane .tcm-ai-ctx-sheet-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--tcm-bg);
}

#tcm-ai-pane .tcm-ai-wb-muted-block {
  font-size: 0.92rem;
  color: var(--tcm-muted);
  padding: 0.65rem 0;
}

#tcm-ai-pane .tcm-ai-ctx-sheet-subhd {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  margin-bottom: 0.35rem;
  font-weight: 700;
  font-size: 0.92rem;
}

#tcm-ai-pane .tcm-ai-ctx-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--tcm-border);
  color: var(--tcm-muted);
}

#tcm-ai-pane .tcm-ai-wb-table-hint {
  margin-bottom: 0.65rem !important;
}

#tcm-ai-pane .tcm-ai-renji-tier-caption {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--tcm-muted);
  margin-bottom: 0.5rem;
}

#tcm-ai-pane .tcm-ai-patient-rx-gate {
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(180, 83, 9, 0.35);
  background: rgba(255, 251, 235, 0.92);
}

#tcm-ai-pane .tcm-ai-patient-rx-gate-msg {
  margin: 0 0 0.35rem;
  font-weight: 650;
  color: #92400e;
}

/* doctor-layout-bottom-2026-06-07: 医师工作台置顶 · 患者读本置底 */
#tcm-ai-pane .tcm-ai-doctor-workspace {
  margin: 0.65rem 0 0.5rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--tcm-radius-sm);
  border: 1px solid rgba(0, 212, 255, 0.42);
  background: linear-gradient(165deg, rgba(4, 20, 40, 0.94) 0%, rgba(8, 32, 58, 0.88) 100%);
  box-shadow: 0 0 28px rgba(0, 212, 255, 0.12), inset 0 1px 0 rgba(0, 255, 255, 0.08);
}

#tcm-ai-pane .tcm-ai-doctor-workspace-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem 0.75rem;
  margin-bottom: 0.45rem;
}

#tcm-ai-pane .tcm-ai-doctor-workspace-kicker {
  font-weight: 750;
  font-size: 0.98rem;
  color: #e0f7ff;
  letter-spacing: 0.02em;
}

#tcm-ai-pane .tcm-ai-doctor-workspace-sub {
  font-size: 0.82rem;
  color: #94a3b8;
}

#tcm-ai-pane .tcm-ai-doctor-workspace-toolbar {
  margin: 0;
}

#tcm-ai-pane .tcm-ai-doctor-workspace-toolbar .tcm-ai-toolbar-btn--primary,
#tcm-ai-pane .tcm-ai-doctor-workspace-toolbar .tcm-ai-toolbar-btn--accent,
#tcm-ai-pane .tcm-ai-patient-delivery-toolbar .tcm-ai-toolbar-btn--primary,
#tcm-ai-pane .tcm-ai-patient-delivery-toolbar .tcm-ai-toolbar-btn--accent {
  min-height: 2.55rem;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

#tcm-ai-pane .tcm-ai-patient-delivery--bottom {
  margin-top: 1rem;
}

#tcm-ai-pane .tcm-ai-patient-delivery--bottom-secondary {
  border-color: color-mix(in srgb, var(--tcm-border) 88%, var(--tcm-accent));
  background: color-mix(in srgb, var(--tcm-surface) 96%, #f8fafc);
  box-shadow: none;
}

#tcm-ai-pane .tcm-ai-patient-delivery--bottom-secondary > summary {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--tcm-muted);
}

#tcm-ai-pane .tcm-ai-patient-delivery--bottom-secondary .tcm-ai-patient-delivery-body {
  min-height: min(36vh, 18rem);
  max-height: min(58vh, 34rem);
}

#tcm-ai-pane .tcm-ai-patient-delivery-guidance-secondary {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  color: var(--tcm-muted);
}

/* doctor-ui-rx-2026-06-04: 医师读本 / 开方工具条与合议节卡片 */
#tcm-ai-pane .tcm-ai-patient-delivery--doctor {
  border-color: rgba(0, 212, 255, 0.42);
  background: linear-gradient(165deg, rgba(4, 20, 40, 0.94) 0%, rgba(8, 32, 58, 0.88) 100%);
  box-shadow: 0 0 28px rgba(0, 212, 255, 0.12), inset 0 1px 0 rgba(0, 255, 255, 0.08);
}

#tcm-ai-pane .tcm-ai-patient-delivery--doctor > summary {
  color: #e0f7ff;
  font-size: 0.98rem;
  letter-spacing: 0.02em;
}

#tcm-ai-pane .tcm-ai-patient-delivery--doctor .tcm-ai-patient-delivery-guidance {
  color: #94a3b8;
  border-left: 3px solid rgba(0, 212, 255, 0.55);
  padding-left: 0.65rem;
  margin-bottom: 0.65rem;
}

#tcm-ai-pane .tcm-ai-doctor-workspace-toolbar .tcm-ai-toolbar-btn--primary,
#tcm-ai-pane .tcm-ai-patient-delivery-toolbar .tcm-ai-toolbar-btn--primary {
  background: linear-gradient(135deg, #0e7490 0%, #06b6d4 50%, #22d3ee 100%);
  border: 1px solid #67e8f9;
  color: #f0fdfa;
  font-weight: 750;
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.35);
}

#tcm-ai-pane .tcm-ai-doctor-workspace-toolbar .tcm-ai-toolbar-btn--primary:hover,
#tcm-ai-pane .tcm-ai-patient-delivery-toolbar .tcm-ai-toolbar-btn--primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.45);
}

#tcm-ai-pane .tcm-ai-doctor-workspace-toolbar .tcm-ai-toolbar-btn--accent,
#tcm-ai-pane .tcm-ai-patient-delivery-toolbar .tcm-ai-toolbar-btn--accent {
  background: rgba(15, 118, 110, 0.92);
  border: 1px solid #5eead4;
  color: #ecfdf5;
  font-weight: 700;
}

#tcm-ai-pane .tcm-ai-doctor-workspace-toolbar .tcm-ai-toolbar-btn--accent:hover,
#tcm-ai-pane .tcm-ai-patient-delivery-toolbar .tcm-ai-toolbar-btn--accent:hover {
  background: rgba(13, 148, 136, 1);
}

#tcm-ai-pane .tcm-ai-patient-delivery--doctor .tcm-ai-patient-delivery-body {
  background: rgba(2, 10, 22, 0.55);
  border-radius: var(--tcm-radius-sm);
  border: 1px solid rgba(0, 212, 255, 0.2);
  padding: 0.5rem 0.65rem;
}

#tcm-ai-pane .tcm-ai-patient-delivery--doctor details.tcm-ai-md-section {
  border-color: rgba(0, 212, 255, 0.28);
  background: rgba(8, 28, 52, 0.82);
  margin: 0.55rem 0;
}

#tcm-ai-pane .tcm-ai-patient-delivery--doctor .tcm-ai-md-section-sum {
  color: #e0f7ff;
  font-size: 0.95rem;
  padding: 0.45rem 0.65rem;
}

#tcm-ai-pane .tcm-ai-patient-delivery--doctor .tcm-ai-md-section-body {
  color: #cbd5e1;
  line-height: 1.6;
  font-size: 0.92rem;
}

#tcm-ai-pane .tcm-ai-patient-delivery--doctor .tcm-ai-md-h2 {
  color: #67e8f9;
  font-size: 1.02rem;
  margin: 0.75rem 0 0.4rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid rgba(0, 212, 255, 0.25);
}

#tcm-ai-pane .tcm-ai-patient-delivery--doctor .tcm-ai-md-h3 {
  color: #a5f3fc;
  font-size: 0.94rem;
  margin: 0.55rem 0 0.3rem;
}

#tcm-ai-pane .tcm-ai-step3-card--doctor .tcm-ai-ctx-sheet {
  border-color: rgba(0, 212, 255, 0.32);
}

#tcm-ai-pane .tcm-ai-step3-card--doctor .tcm-ai-renji-herb-strip {
  background: linear-gradient(90deg, rgba(8, 28, 52, 0.95) 0%, rgba(4, 20, 40, 0.9) 100%);
  border-color: rgba(0, 212, 255, 0.28);
}

#tcm-ai-pane .tcm-ai-step3-card--doctor .tcm-ai-renji-name {
  color: #f0f9ff;
}

#tcm-ai-pane .tcm-ai-step3-card--doctor .tcm-ai-renji-g {
  color: #5eead4;
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-doctor-workspace,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-patient-delivery--doctor {
  background: linear-gradient(165deg, rgba(4, 20, 40, 0.96) 0%, rgba(8, 32, 58, 0.9) 100%);
  border-color: rgba(0, 212, 255, 0.38);
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-doctor-workspace-toolbar .tcm-ai-toolbar-btn--primary,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-doctor-workspace-toolbar .tcm-ai-toolbar-btn--accent,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-patient-delivery-toolbar .tcm-ai-toolbar-btn--primary,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-patient-delivery-toolbar .tcm-ai-toolbar-btn--accent {
  border-radius: 6px;
  min-height: 2.65rem;
  padding: 0.55rem 1.1rem;
}

#tcm-ai-pane .tcm-ai-renji-herbs {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

#tcm-ai-pane .tcm-ai-renji-empty {
  padding: 0.65rem;
  color: var(--tcm-muted);
  font-size: 0.9rem;
}

#tcm-ai-pane .tcm-ai-renji-herb-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem 0.65rem;
  padding: 0.45rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--tcm-border);
  background: linear-gradient(90deg, #fff 0%, #f9fafb 100%);
}

#tcm-ai-pane .tcm-ai-renji-tier {
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #0d9488, #14b8a6);
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
}

#tcm-ai-pane .tcm-ai-renji-name {
  font-weight: 700;
}

#tcm-ai-pane .tcm-ai-renji-g {
  font-family: var(--tcm-mono);
  font-size: 0.88rem;
  color: var(--tcm-accent);
  font-weight: 600;
}

#tcm-ai-pane .tcm-ai-renji-fn {
  flex: 1 1 220px;
  font-size: 0.82rem;
  color: var(--tcm-muted);
}

#tcm-ai-pane .tcm-ai-renji-mod-block {
  margin-top: 0.85rem;
}

#tcm-ai-pane .tcm-ai-renji-mod-title {
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 0.35rem;
}

#tcm-ai-pane .tcm-ai-renji-mod-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

#tcm-ai-pane .tcm-ai-renji-mod-chip {
  padding: 0.35rem 0.65rem;
  border-radius: var(--tcm-radius-sm);
  border: 1px dashed var(--tcm-border);
  font-size: 0.82rem;
  background: #fff;
}

#tcm-ai-pane .tcm-ai-renji-acu-panel {
  padding: 0.65rem;
  border-radius: var(--tcm-radius-sm);
  border: 1px solid var(--tcm-border);
  background: #fff;
}

#tcm-ai-pane .tcm-ai-renji-acu-panel.tcm-ai-wb-demo-fill {
  border-style: dashed;
  background: #fffefb;
}

#tcm-ai-pane .tcm-ai-renji-acu-sub {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--tcm-muted);
}

#tcm-ai-pane .tcm-ai-renji-acu-sub-gap {
  margin-top: 0.85rem;
}

#tcm-ai-pane .tcm-ai-renji-acu-list {
  margin: 0.35rem 0 0;
  padding-left: 1.15rem;
}

#tcm-ai-pane .tcm-ai-renji-acu-li {
  margin-bottom: 0.35rem;
  font-size: 0.88rem;
}

#tcm-ai-pane .tcm-ai-renji-muted {
  color: var(--tcm-muted);
  font-style: italic;
}

/* 对话滚动区 */

#tcm-ai-pane .tcm-ai-chat-scroll {
  flex: 1 1 0;
  flex-shrink: 0;
  min-height: var(--tcm-ai-chat-scroll-min-h);
  overflow: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 0.85rem 1.35rem;
  padding-bottom: calc(0.85rem + max(0.65rem, env(safe-area-inset-bottom, 0px)));
  background: rgba(248, 250, 252, 0.98);
}

#tcm-ai-pane .tcm-ai-chat-scroll .tcm-ai-peer-chat {
  max-height: none;
}

#tcm-ai-pane .tcm-ai-chat-thread-intro {
  margin-bottom: 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--tcm-radius-sm);
  border: 1px solid var(--tcm-border);
  background: var(--tcm-panel);
}

#tcm-ai-pane .tcm-ai-chat-thread-cap {
  display: block;
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

#tcm-ai-pane .tcm-ai-chat-thread-sub {
  font-size: 0.82rem;
  color: var(--tcm-muted);
}

#tcm-ai-pane .tcm-ai-peer-rounds-cap {
  margin: 0 0 1rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--tcm-radius-sm);
  border-left: 3px solid var(--tcm-accent);
  background: var(--tcm-accent-soft);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--tcm-text);
  line-height: 1.45;
  transition:
    border-color 0.35s ease,
    background-color 0.35s ease,
    box-shadow 0.35s ease;
}

@keyframes tcm-ai-peer-cap-flash-pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--tcm-accent) 28%, transparent);
  }
  100% {
    box-shadow: 0 0 0 6px transparent;
  }
}

#tcm-ai-pane .tcm-ai-peer-rounds-cap.tcm-ai-peer-rounds-cap--flash {
  border-left-color: color-mix(in srgb, var(--tcm-accent) 75%, var(--tcm-border));
  background: color-mix(in srgb, var(--tcm-accent-soft) 88%, var(--tcm-panel));
  animation: tcm-ai-peer-cap-flash-pulse 0.55s ease-out 1;
}

#tcm-ai-pane .tcm-ai-peer-verify-rerun-status {
  margin: -0.65rem 0 1rem;
  padding: 0.38rem 0.75rem;
  border-radius: var(--tcm-radius-sm);
  border: 1px solid var(--tcm-border);
  background: var(--tcm-panel);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--tcm-muted);
  line-height: 1.4;
}

#tcm-ai-pane .tcm-ai-peer-step2-peer-visibility {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--tcm-text);
  line-height: 1.45;
}

#tcm-ai-pane .tcm-ai-renji-opt {
  margin-bottom: 0.85rem;
  border-radius: var(--tcm-radius-sm);
  border: 1px solid var(--tcm-border);
  background: var(--tcm-panel);
  padding: 0 0.65rem;
}

#tcm-ai-pane .tcm-ai-renji-opt summary {
  cursor: pointer;
  padding: 0.55rem 0;
  font-weight: 600;
  font-size: 0.88rem;
}

#tcm-ai-pane .tcm-ai-renji-opt-body {
  padding-bottom: 0.65rem;
}

#tcm-ai-pane .tcm-ai-peer-inline-ta {
  margin-top: 0.35rem;
}

#tcm-ai-pane .tcm-ai-peer-keyhint {
  font-size: 0.78rem;
  color: var(--tcm-muted);
  margin-top: 0.35rem;
}

#tcm-ai-pane .tcm-ai-peer-intake-gap-wrap {
  margin: 0.25rem 0 0.35rem;
}

#tcm-ai-pane .tcm-ai-peer-intake-gap-wrap .tcm-ai-peer-intake-gap-continue-btn {
  margin-top: 0.45rem;
}

#tcm-ai-pane .tcm-ai-peer-intake-gap-wrap--blocking {
  padding: 0.5rem 0.65rem;
  border-radius: var(--tcm-radius-sm);
  border: 1px solid rgba(251, 191, 36, 0.85);
  background: rgba(254, 249, 231, 0.72);
}

#tcm-ai-pane .tcm-ai-peer-intake-gap-hint {
  font-size: 0.78rem;
  color: var(--tcm-muted);
  margin: 0.25rem 0 0.15rem;
  line-height: 1.35;
}

#tcm-ai-pane .tcm-ai-peer-status-line {
  margin-top: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  flex-shrink: 0;
}

#tcm-ai-pane .tcm-ai-peer-status-line .tcm-ai-spinner {
  width: 0.95rem;
  height: 0.95rem;
  border-width: 2px;
}

#tcm-ai-pane .tcm-ai-peer-chat {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 48rem;
  margin-left: auto;
  margin-right: auto;
}

#tcm-ai-pane .tcm-ai-ephemeral-content-hint {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  box-sizing: border-box;
  width: 100%;
  max-width: 48rem;
  margin: 0.35rem auto 0.6rem;
  padding: 0.45rem 0.55rem 0.45rem 0.65rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--tcm-text, #1e293b);
  background: rgba(241, 245, 249, 0.92);
  border: 1px solid var(--tcm-border, #e2e8f0);
  border-left: 3px solid rgba(100, 116, 139, 0.55);
  border-radius: var(--tcm-radius-sm, 6px);
}

#tcm-ai-pane .tcm-ai-ephemeral-content-hint-text {
  flex: 1;
  min-width: 0;
}

#tcm-ai-pane .tcm-ai-ephemeral-content-hint-dismiss {
  flex-shrink: 0;
  min-width: 2rem;
  padding: 0.15rem 0.45rem;
  font-size: 1.05rem;
  line-height: 1;
  font-weight: 600;
}

#tcm-ai-pane .tcm-ai-ephemeral-content-hint--inline {
  margin-left: 0;
  margin-right: 0;
  margin-top: 0.45rem;
  margin-bottom: 0.55rem;
  max-width: none;
}

#tcm-ai-pane .tcm-ai-ephemeral-content-hint[hidden] {
  display: none !important;
}

#tcm-ai-pane .tcm-ai-peer-chat > .tcm-ai-chat-turn.tcm-ai-chat-turn-round + .tcm-ai-chat-turn.tcm-ai-chat-turn-round {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

#tcm-ai-pane .tcm-ai-peer-chat-empty {
  font-size: 0.88rem;
  color: var(--tcm-muted);
  padding: 1rem;
  text-align: left;
  min-height: 5.5rem;
  border-radius: var(--tcm-radius-sm);
  border: 1px dashed var(--tcm-border);
  background: rgba(255, 255, 255, 0.65);
}

#tcm-ai-pane .tcm-ai-peer-chat-progress {
  padding: 0.85rem 1rem;
  text-align: left;
  border-radius: var(--tcm-radius-sm);
  border: 1px solid var(--tcm-brand-border, rgba(96, 165, 250, 0.45));
  background: linear-gradient(
    165deg,
    rgba(239, 246, 255, 0.95) 0%,
    rgba(255, 255, 255, 0.88) 100%
  );
  min-height: 5.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

#tcm-ai-pane .tcm-ai-peer-chat-progress-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--tcm-text, #0f172a);
}

#tcm-ai-pane .tcm-ai-peer-chat-progress-body {
  font-size: 0.86rem;
  line-height: 1.52;
  color: var(--tcm-muted);
}

#tcm-ai-pane .tcm-ai-peer-chat-progress-elapsed {
  font-size: 0.8rem;
  color: #475569;
  font-variant-numeric: tabular-nums;
}

#tcm-ai-pane .tcm-ai-peer-chat-progress-foot {
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.45;
}

#tcm-ai-pane .tcm-ai-chat-turn {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

/* 核验四轮：整轮可折叠（追问 + 答复 + 思考） */

#tcm-ai-pane .tcm-ai-chat-turn-round {
  gap: 0;
}

#tcm-ai-pane details.tcm-ai-peer-round {
  border-radius: var(--tcm-radius-sm);
  border: 1px solid var(--tcm-border);
  background: rgba(255, 255, 255, 0.85);
  overflow: hidden;
}

#tcm-ai-pane .tcm-ai-peer-round-sum {
  list-style: none;
  cursor: pointer;
  padding: 0.55rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  background: rgba(248, 250, 252, 0.98);
}

#tcm-ai-pane details.tcm-ai-peer-round[open] > .tcm-ai-peer-round-sum {
  border-bottom: 1px solid var(--tcm-border);
}

#tcm-ai-pane .tcm-ai-peer-round-sum::-webkit-details-marker {
  display: none;
}

#tcm-ai-pane .tcm-ai-peer-round-sum::before {
  content: "\25B8 ";
  flex-shrink: 0;
  color: #94a3b8;
  font-size: 0.9rem;
  line-height: 1;
  transition: transform 0.14s ease;
}

#tcm-ai-pane details.tcm-ai-peer-round[open] > .tcm-ai-peer-round-sum::before {
  transform: rotate(90deg);
}

#tcm-ai-pane .tcm-ai-peer-round-sum-label {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  font-weight: 600;
  font-size: 0.8rem;
  color: #0f172a;
}

#tcm-ai-pane .tcm-ai-peer-round-idx {
  font-family: var(--tcm-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.04em;
}

#tcm-ai-pane .tcm-ai-peer-round-sum-title {
  font-weight: 600;
}

#tcm-ai-pane .tcm-ai-peer-round-sum-status {
  margin-left: auto;
  font-size: 0.76rem;
  color: var(--tcm-muted);
  max-width: min(52%, 17rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#tcm-ai-pane .tcm-ai-peer-round-body {
  padding: 0.65rem 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

#tcm-ai-pane .tcm-ai-msg-row {
  border-radius: var(--tcm-radius-sm);
  padding: 0.65rem 0.85rem;
  border: 1px solid transparent;
}

#tcm-ai-pane .tcm-ai-msg-user {
  background: #ffffff;
  border-color: var(--tcm-border);
  align-self: flex-end;
  max-width: min(100%, 26rem);
}

#tcm-ai-pane .tcm-ai-msg-asst {
  background: #ffffff;
  border-color: #c8ebe7;
  box-shadow: 0 1px 2px rgba(15, 118, 110, 0.08);
  align-self: stretch;
  max-width: min(100%, 44rem);
}

#tcm-ai-pane .tcm-ai-msg-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}

#tcm-ai-pane .tcm-ai-msg-asst .tcm-ai-msg-meta {
  margin-bottom: 0.25rem;
}

#tcm-ai-pane .tcm-ai-md-body {
  font-family: var(--tcm-font);
  font-size: 0.9rem;
  line-height: 1.68;
  color: var(--tcm-text);
  white-space: normal;
  max-width: 100%;
}

#tcm-ai-pane .tcm-ai-md-h3 {
  font-size: 0.97rem;
  font-weight: 700;
  margin: 0.9rem 0 0.4rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid #e8ecf1;
  color: #0f172a;
}

#tcm-ai-pane .tcm-ai-md-h3:first-child {
  margin-top: 0;
}

#tcm-ai-pane .tcm-ai-md-h4 {
  font-size: 0.86rem;
  font-weight: 700;
  margin: 0.72rem 0 0.3rem;
  color: #1e293b;
}

#tcm-ai-pane .tcm-ai-md-p {
  margin: 0 0 0.55rem;
}

#tcm-ai-pane .tcm-ai-md-ul {
  margin: 0 0 0.6rem;
  padding-left: 1.2rem;
}

#tcm-ai-pane .tcm-ai-md-ul li {
  margin-bottom: 0.28rem;
}

#tcm-ai-pane .tcm-ai-md-muted {
  color: var(--tcm-muted);
  font-style: italic;
  margin: 0;
}

#tcm-ai-pane .tcm-ai-md-table-pre {
  font-family: var(--tcm-mono);
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--tcm-radius-sm);
  background: #f8fafc;
  border: 1px solid var(--tcm-border);
  overflow-x: auto;
}

#tcm-ai-pane .tcm-ai-msg-auto-pill {
  display: inline-block;
  max-width: 100%;
  margin: 0;
  padding: 0.36rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--tcm-border);
  background: #f8fafc;
  font-size: 0.8rem;
  color: var(--tcm-muted);
  line-height: 1.35;
}

#tcm-ai-pane .tcm-ai-msg-chip {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: var(--tcm-bg);
  color: var(--tcm-muted);
}

#tcm-ai-pane .tcm-ai-msg-chip-asst {
  background: var(--tcm-accent-soft);
  color: #0f766e;
}

#tcm-ai-pane .tcm-ai-msg-seq {
  font-family: var(--tcm-mono);
  font-size: 0.72rem;
  color: var(--tcm-muted);
}

#tcm-ai-pane .tcm-ai-msg-route {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--tcm-muted);
}

#tcm-ai-pane .tcm-ai-msg-pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--tcm-font);
  font-size: 0.9rem;
  line-height: 1.6;
}

#tcm-ai-pane .tcm-ai-brain-verify-pre {
  margin-top: 0.35rem;
}

/* 思考过程折叠 */

#tcm-ai-pane .tcm-ai-peer-think {
  margin-bottom: 0.65rem;
  border-radius: var(--tcm-radius-sm);
  border: 1px dashed #94a3b8;
  background: #f8fafc;
  padding: 0 0.55rem 0.55rem;
}

#tcm-ai-pane .tcm-ai-peer-think-sum {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.55rem 0;
  color: #475569;
  list-style: none;
}

#tcm-ai-pane .tcm-ai-peer-think-sum::-webkit-details-marker {
  display: none;
}

#tcm-ai-pane .tcm-ai-think-pre {
  font-family: var(--tcm-mono);
  font-size: 0.82rem;
  color: #64748b;
  margin: 0;
  border-top: 1px solid var(--tcm-border);
  padding-top: 0.55rem;
}

#tcm-ai-pane .tcm-ai-tech {
  margin-top: 0.85rem;
  border-radius: var(--tcm-radius-sm);
  border: 1px solid var(--tcm-border);
  background: var(--tcm-panel);
}

#tcm-ai-pane .tcm-ai-tech summary {
  cursor: pointer;
  padding: 0.55rem 0.75rem;
  font-weight: 600;
  font-size: 0.82rem;
}

#tcm-ai-pane .tcm-ai-tech pre {
  margin: 0;
  padding: 0.65rem 0.75rem;
  max-height: min(55vh, 28rem);
  min-height: 5rem;
  overflow: auto;
  resize: vertical;
  font-size: 0.78rem;
  border-top: 1px solid var(--tcm-border);
}

#tcm-ai-pane .tcm-ai-composer-footer {
  flex: 0 0 auto;
  flex-shrink: 0;
  border-top: 1px solid var(--tcm-border);
  background: var(--tcm-panel);
  padding: 0.65rem 1rem 1rem;
}

/* 会诊验证状态紧贴输入区，避免落在上方滚动区内被卷出视口 */
#tcm-ai-pane .tcm-ai-composer-footer #tcm-ai-peer-status {
  margin-top: 0;
  margin-bottom: 0.45rem;
}

#tcm-ai-pane .tcm-ai-patient-delivery-banner {
  flex-shrink: 0;
  margin: 0 0 0.45rem;
  padding: 0.4rem 0.55rem;
  border-radius: var(--tcm-radius-sm);
  border: 1px solid var(--tcm-border);
  background: color-mix(in srgb, var(--tcm-accent) 8%, var(--tcm-panel));
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

#tcm-ai-pane .tcm-ai-patient-delivery-banner.is-loading {
  border-color: color-mix(in srgb, var(--tcm-accent) 40%, var(--tcm-border));
}

#tcm-ai-pane .tcm-ai-patient-delivery-banner.is-ready {
  border-color: color-mix(in srgb, #22c55e 35%, var(--tcm-border));
  background: color-mix(in srgb, #22c55e 7%, var(--tcm-panel));
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.28rem 0.45rem;
  gap: 0.35rem 0.55rem;
}

#tcm-ai-pane .tcm-ai-patient-delivery-banner.is-error {
  border-color: #fecaca;
  background: #fef2f2;
}

#tcm-ai-pane .tcm-ai-patient-delivery-banner-msg {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--tcm-text);
}

#tcm-ai-pane .tcm-ai-patient-delivery-banner.is-ready .tcm-ai-patient-delivery-banner-msg {
  line-height: 1.25;
  flex: 1 1 10rem;
  min-width: 0;
}

#tcm-ai-pane .tcm-ai-patient-delivery-banner.is-ready .tcm-ai-patient-delivery-banner-actions {
  flex-shrink: 0;
}

#tcm-ai-pane .tcm-ai-patient-delivery-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

#tcm-ai-pane .tcm-ai-patient-delivery-banner.is-sup-regen-hint {
  border-color: color-mix(in srgb, var(--tcm-accent) 35%, var(--tcm-border));
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.28rem 0.45rem;
  gap: 0.35rem 0.55rem;
}

#tcm-ai-pane .tcm-ai-patient-delivery-banner.is-sup-regen-hint .tcm-ai-patient-delivery-banner-msg {
  line-height: 1.25;
  flex: 1 1 10rem;
  min-width: 0;
}

#tcm-ai-pane .tcm-ai-intake-gap-more-ref {
  margin-top: 0.35rem;
  padding: 0.25rem 0.35rem;
  border-radius: 6px;
  border: 1px dashed color-mix(in srgb, var(--tcm-muted) 50%, var(--tcm-border));
  background: var(--tcm-bg);
}

#tcm-ai-pane .tcm-ai-intake-gap-more-ref > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.84rem;
  color: var(--tcm-muted);
}

#tcm-ai-pane .tcm-ai-peer-delivery-notice {
  margin: 0.5rem 0 0.35rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--tcm-radius-sm);
  border: 1px dashed color-mix(in srgb, var(--tcm-accent) 45%, var(--tcm-border));
  background: color-mix(in srgb, var(--tcm-accent) 5%, var(--tcm-bg));
  font-size: 0.84rem;
  color: var(--tcm-muted);
  line-height: 1.45;
}

#tcm-ai-pane .tcm-ai-composer-ft-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.65rem;
  flex: 0 0 auto;
  flex-shrink: 0;
}

#tcm-ai-pane .tcm-ai-composer-ft-btn {
  flex-shrink: 0;
}

#tcm-ai-pane .tcm-ai-peer-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

#tcm-ai-pane .tcm-ai-chip-btn {
  border: 1px solid var(--tcm-border);
  background: var(--tcm-bg);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  font-size: 0.78rem;
  cursor: pointer;
}

#tcm-ai-pane .tcm-ai-chip-btn:hover {
  border-color: var(--tcm-accent);
}

#tcm-ai-pane .tcm-ai-composer-bar {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  flex: 0 0 auto;
  flex-shrink: 0;
  min-height: fit-content;
}

#tcm-ai-pane .tcm-ai-peer-compose-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 6.25rem;
  resize: vertical;
  border-radius: var(--tcm-radius-sm);
  border: 1px solid var(--tcm-border);
  padding: 0.55rem 0.65rem;
  font-family: inherit;
  font-size: 0.92rem;
}

#tcm-ai-pane .tcm-ai-composer-send {
  flex-shrink: 0;
  align-self: stretch;
}

#tcm-ai-pane .tcm-ai-composer-side {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex-shrink: 0;
  align-items: stretch;
  justify-content: flex-end;
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

#tcm-ai-pane .tcm-ai-peer-voice-btn {
  min-width: 2.75rem;
  min-height: 2.75rem;
  border-radius: var(--tcm-radius-sm);
  border: 1px solid var(--tcm-border);
  background: var(--tcm-panel);
  cursor: pointer;
  font-size: 1.12rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  color: inherit;
  font-family: inherit;
}

#tcm-ai-pane .tcm-ai-peer-voice-btn:hover {
  border-color: var(--tcm-accent);
}

#tcm-ai-pane .tcm-ai-peer-voice-btn:focus-visible {
  outline: 2px solid var(--tcm-accent);
  outline-offset: 2px;
}

#tcm-ai-pane .tcm-ai-peer-voice-btn.is-recording {
  border-color: var(--tcm-danger);
  background: rgba(180, 35, 24, 0.07);
  box-shadow: 0 0 0 2px rgba(180, 35, 24, 0.12);
}

#tcm-ai-pane .tcm-ai-peer-voice-btn.is-error {
  border-color: var(--tcm-danger);
}

#tcm-ai-pane .tcm-ai-peer-voice-btn.is-voice-unavailable,
#tcm-ai-pane .tcm-ai-peer-voice-btn[hidden],
#tcm-ai-pane .tcm-ai-voice-hold-btn.is-voice-unavailable,
#tcm-ai-pane .tcm-ai-voice-hold-btn[hidden] {
  display: none !important;
}

#tcm-ai-pane .tcm-ai-peer-voice-btn.is-recording .tcm-ai-peer-voice-icon--stop {
  color: var(--tcm-danger);
  font-size: 1rem;
}

#tcm-ai-pane .tcm-ai-peer-voice-btn,
#tcm-ai-pane .tcm-ai-voice-hold-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

#tcm-ai-pane .tcm-ai-step4-q-composer .tcm-ai-step4-q-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 5rem;
  resize: vertical;
}

@media (max-width: 560px) {
  #tcm-ai-pane details.tcm-ai-peer-round {
    overflow: visible;
  }

  #tcm-ai-pane .tcm-ai-peer-round-body {
    min-width: 0;
    overflow: visible;
  }

  #tcm-ai-pane .tcm-ai-msg-asst {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  #tcm-ai-pane .tcm-ai-composer-bar {
    flex-direction: column;
    align-items: stretch;
  }

  #tcm-ai-pane .tcm-ai-msg-user {
    align-self: stretch;
    max-width: none;
  }
}

  /* 打印：由 JS 在 #tcm-ai-pane 上临时添加 .tcm-ai-printing */
@media print {
  /* 列印白底可读、避免背景/子像素渲染吞字；保留有色强调 */
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* 读本：根容器解除宿主/嵌入页里常见的视口高与滚动夹断 */
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  /* 纪要/读本均在第三步面板内：若用户停留在其他步骤，避免因 display:none 整段丢失 */
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing .tcm-ai-step-panel:not([data-step="3"]),
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-step-panel:not([data-step="3"]) {
    display: none !important;
  }

  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing .tcm-ai-step-panel[data-step="3"],
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-step-panel[data-step="3"] {
    display: block !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing .tcm-ai-banner,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing .tcm-ai-steps,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-banner,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-steps {
    display: none !important;
  }

  /* 患者读本单独打印：display:none 剥离非交付 DOM（visibility:hidden 仍占位 → 合议 R0–R8 数百空白页） */
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-step3-card > h3,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-step3-card > .lead,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-step3-card > .tcm-ai-callout,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-wb-actions-top,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-ctx-sheet,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-chat-scroll > *:not(#tcm-ai-patient-delivery-wrap),
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-composer-footer,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-wb-actions-bottom {
    display: none !important;
  }

  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-patient-delivery-no-print,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet #tcm-ai-patient-delivery-wrap > summary,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-patient-delivery-guidance,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet
    .tcm-ai-patient-delivery-print-zone
    > .tcm-ai-hint:not(.tcm-ai-patient-delivery-warn):not(.tcm-ai-patient-delivery-cap),
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-patient-delivery-print-zone > .tcm-ai-label-inline {
    display: none !important;
  }

  /* hidden 属性在列印时仍会 display:none；解除 step3/composer 滚动夹断以便读本全文排版 */
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-step3-card,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-composer-shell,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-chat-scroll {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
    flex: none !important;
  }

  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet #tcm-ai-patient-delivery-wrap {
    display: block !important;
    position: static !important;
    width: 100%;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    border: none !important;
    background: #fff !important;
    box-shadow: none !important;
    color: #111 !important;
    opacity: 1 !important;
  }

  /* <details> 患者读本：避免 UA/屏幕样式在列印时保留 disclosure 滚动夹断 */
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet #tcm-ai-patient-delivery-wrap.tcm-ai-patient-delivery {
    overflow: visible !important;
  }

  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing .tcm-ai-wb-actions-top,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing .tcm-ai-wb-actions-bottom,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing .tcm-ai-composer-footer,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing .tcm-ai-composer-tech,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing .tcm-ai-renji-opt,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-wb-actions-top,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-wb-actions-bottom,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-composer-footer,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-composer-tech,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-renji-opt {
    display: none !important;
  }

  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing .tcm-ai-chat-scroll,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-chat-scroll {
    max-height: none !important;
    overflow: visible !important;
  }

  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing .tcm-ai-peer-round {
    break-inside: avoid-page;
  }

  /* 患者读本：打印时解除内层滚动，适度版面 */
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing .tcm-ai-patient-delivery-body,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-patient-delivery-body {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing .tcm-ai-patient-delivery-print-zone,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-patient-delivery-print-zone {
    max-width: none !important;
    max-height: none !important;
    overflow: visible !important;
  }

  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing .tcm-ai-patient-delivery-md-root,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-patient-delivery-md-root {
    font-family: ui-sans-serif, system-ui, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
      "Noto Sans CJK SC", "Source Han Sans SC", SimSun, sans-serif !important;
    font-size: 11pt !important;
    line-height: 1.45 !important;
    color: #111 !important;
    max-height: none !important;
    min-height: 0 !important;
    content-visibility: visible !important;
    contain-intrinsic-size: unset !important;
    overflow: visible !important;
  }

  /* 屏幕态用 content-visibility 省渲染；列印须整段排版，否则常见「后半空白/缺字」 */
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing .tcm-ai-patient-delivery-md-root .tcm-ai-md-preamble,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-patient-delivery-md-root .tcm-ai-md-preamble,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing .tcm-ai-patient-delivery-md-root details.tcm-ai-md-section,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-patient-delivery-md-root details.tcm-ai-md-section,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing .tcm-ai-patient-delivery-md-root .tcm-ai-md-section-body,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-patient-delivery-md-root .tcm-ai-md-section-body {
    max-height: none !important;
    content-visibility: visible !important;
    contain-intrinsic-size: unset !important;
    contain: none !important;
    overflow: visible !important;
    page-break-inside: auto !important;
    break-inside: auto !important;
  }

  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing .tcm-ai-patient-delivery-body .tcm-ai-patient-delivery-md-root *,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-patient-delivery-body .tcm-ai-patient-delivery-md-root * {
    max-height: none !important;
    overflow: visible !important;
  }

  /* 列印全开小节：<details> 隐藏 slot 在非 open 时可裁切正文；open 已由 beforeprint / trigger 保证 */
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-patient-delivery-md-root details.tcm-ai-md-section,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-patient-delivery-md-root details.tcm-ai-md-section .tcm-ai-md-section-sum,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-patient-delivery-md-root details.tcm-ai-md-section .tcm-ai-md-section-body {
    display: block !important;
    max-height: none !important;
    overflow: visible !important;
    contain: none !important;
  }

  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-patient-delivery-md-root details.tcm-ai-md-section .tcm-ai-md-section-sum {
    cursor: default;
  }

  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing .tcm-ai-patient-delivery-md-root .tcm-ai-md-h2,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-patient-delivery-md-root .tcm-ai-md-h2 {
    font-size: 13pt !important;
    margin-top: 0.6rem !important;
    break-after: auto;
    page-break-after: auto;
  }

  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing .tcm-ai-patient-delivery-md-root .tcm-ai-md-h3,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-patient-delivery-md-root .tcm-ai-md-h3 {
    font-size: 11.5pt !important;
    break-after: auto;
    page-break-after: auto;
  }

  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing .tcm-ai-patient-delivery-md-root hr,
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-patient-delivery-md-root hr {
    break-inside: auto;
    page-break-inside: auto;
  }

  /* 纪要单列：扫读纲要、信息补缺等区域解除屏幕态 max-height scrollport 导致的列印半截 */
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing:not(.tcm-ai-printing-patient-booklet) .tcm-ai-research-sweep-body {
    max-height: none !important;
    overflow: visible !important;
  }

  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing:not(.tcm-ai-printing-patient-booklet) details.tcm-ai-intake-sup {
    break-inside: avoid-page;
    page-break-inside: avoid;
  }

  /* 纪要印刷：隐藏的就诊补充摘要块仅在列印时铺开（内容与 freeze 快照 user_intake_supplements_canonical_zh 同源） */
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing:not(.tcm-ai-printing-patient-booklet)
    .tcm-ai-print-summary-supplements:not([hidden]) {
    display: block !important;
    visibility: visible !important;
    margin: 0 0 0.55rem;
    padding: 0.42rem 0.55rem;
    border-radius: 6px;
    border: 1px solid #bfdbfe;
    background: #f8fafc;
    page-break-inside: avoid;
    break-inside: avoid-page;
  }

  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing:not(.tcm-ai-printing-patient-booklet) .tcm-ai-print-summary-supplements:not([hidden]) .tcm-ai-print-user-supplements-pre {
    font-family: ui-sans-serif, system-ui, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif !important;
    font-size: 10.5pt !important;
    line-height: 1.45 !important;
  }

  /* 患者读本单列：读本 print-zone 内就诊补充紧挨导读，避免夹在 checkbox 后与正文断层 */
  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-print-booklet-supplements:not([hidden]) {
    page-break-after: avoid;
    break-after: avoid-page;
    border: 1px solid #e2e5eb !important;
    padding: 0.35rem 0.45rem !important;
    margin: 0.35rem 0 0.5rem !important;
    background: #fafbfc !important;
    border-radius: 4px !important;
  }

  #tcm-ai-pane.tcm-ai-root.tcm-ai-printing-patient-booklet .tcm-ai-print-booklet-supplements:not([hidden]) .tcm-ai-print-user-supplements-pre {
    font-family: ui-sans-serif, system-ui, "Segoe UI", "PingFang SC", "Microsoft YaHei",
      "Noto Sans CJK SC", SimSun, sans-serif !important;
    font-size: 10.5pt !important;
    line-height: 1.45 !important;
  }

  @page {
    size: auto;
    margin: 8mm 10mm;
  }

  /* 宿主页（tcm.html）：读本单列时隐藏顶栏/声明/页签，避免与嵌入区重复占页 */
  body.tcm-ai-host-printing-patient-booklet .brain-atmosphere,
  body.tcm-ai-host-printing-patient-booklet .brain-top,
  body.tcm-ai-host-printing-patient-booklet .brain-disclaimer,
  body.tcm-ai-host-printing-patient-booklet .brain-module-tabstrip,
  body.tcm-ai-host-printing-patient-booklet .brain-tab-panel:not(#brain-panel-diag-ai) {
    display: none !important;
  }

  body.tcm-ai-host-printing-patient-booklet #brain-panel-diag-ai .glass-panel__head,
  body.tcm-ai-host-printing-patient-booklet #brain-panel-diag-ai .panel-intro {
    display: none !important;
  }
}

/* 纪要旁的「就诊补充」打印补丁块仅在列印时出现，避免与普通「信息补缺」折叠重复占屏 */
@media screen {
  #tcm-ai-pane .tcm-ai-print-summary-supplements {
    display: none !important;
  }
}

/* 现代医学 / 古籍对照扫读（Markdown 纯文本示意） */
#tcm-ai-pane .tcm-ai-research-sweep {
  margin: 0.75rem 0 0.35rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--tcm-radius-sm);
  border: 1px solid var(--tcm-border);
  background: #fafbfd;
}

#tcm-ai-pane .tcm-ai-research-sweep > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--tcm-muted);
}

#tcm-ai-pane .tcm-ai-research-sweep-body {
  margin-top: 0.65rem;
  max-height: min(55vh, 30rem);
  overflow: auto;
  overscroll-behavior: contain;
  white-space: normal;
  word-break: break-word;
  font-size: 0.92rem;
  color: var(--tcm-text);
  line-height: 1.5;
  /* Avoid content-visibility: auto scroll thrash with nested accordions inside scroll surfaces */
  content-visibility: visible;
}

#tcm-ai-pane .tcm-ai-research-sweep-md-root .tcm-ai-md-table-pre {
  white-space: pre-wrap;
}

/* 患者交付页（科普纲要，markdown-lite 渲染容器） */
#tcm-ai-pane .tcm-ai-patient-delivery {
  scroll-margin-top: 0.75rem;
  margin: 0.75rem 0 0.35rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--tcm-radius-sm);
  border: 1px solid color-mix(in srgb, var(--tcm-accent) 35%, var(--tcm-border));
  background: color-mix(in srgb, var(--tcm-accent) 6%, #fafbfd);
}

#tcm-ai-pane .tcm-ai-patient-delivery > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--tcm-text);
}

#tcm-ai-pane .tcm-ai-patient-delivery-body {
  margin-top: 0.55rem;
  min-height: min(48vh, 26rem);
  max-height: min(72vh, 43rem);
  overflow: auto;
  overscroll-behavior: contain;
  font-size: 0.9rem;
  line-height: 1.55;
}

/* Taller narrow viewports: modest extra room without crowding step-3 footer */
@media (min-height: 620px) {
  #tcm-ai-pane .tcm-ai-patient-delivery-body {
    min-height: min(54vh, 30rem);
    max-height: min(76vh, 46rem);
  }
}

/* Desktop ≥720×720: larger viewport share; footer stays outside this scroll pane */
@media (min-height: 720px) and (min-width: 720px) {
  #tcm-ai-pane .tcm-ai-patient-delivery-body {
    min-height: min(58vh, 36rem);
    max-height: min(84vh, 52rem);
  }
}

#tcm-ai-pane .tcm-ai-patient-delivery-guidance {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  color: var(--tcm-muted);
}

#tcm-ai-pane .tcm-ai-patient-delivery-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin: 0.35rem 0 0.5rem;
}

#tcm-ai-pane .tcm-ai-patient-delivery-toolbar-toast {
  flex: 1 1 8rem;
  min-width: 0;
  font-size: 0.82rem;
  color: var(--tcm-muted);
}

#tcm-ai-pane .tcm-ai-patient-delivery-toolbar-toast.is-error {
  color: #b45309;
}

#tcm-ai-pane .tcm-ai-patient-delivery-print-zone .tcm-ai-patient-delivery-body {
  margin-top: 0.35rem;
}

#tcm-ai-pane .tcm-ai-patient-delivery-body .tcm-ai-patient-delivery-warn {
  margin-bottom: 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--tcm-radius-sm);
  border: 1px solid #fdba74;
  background: #fffbeb;
  color: #7c2d12;
}

#tcm-ai-pane .tcm-ai-patient-delivery-body .tcm-ai-patient-delivery-md-root {
  min-height: 0;
  content-visibility: visible;
}

/* Segment long markdown: accordion sections + cheaper off-screen layout */
#tcm-ai-pane .tcm-ai-md-preamble {
  margin-bottom: 0.45rem;
  content-visibility: visible;
}

#tcm-ai-pane details.tcm-ai-md-section {
  margin: 0.45rem 0;
  border: 1px solid var(--tcm-border);
  border-radius: var(--tcm-radius-sm);
  background: #fff;
}

#tcm-ai-pane .tcm-ai-md-section-sum {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.35rem 0.55rem;
  color: var(--tcm-text);
}

#tcm-ai-pane .tcm-ai-md-section-body {
  padding: 0.35rem 0.65rem 0.65rem;
  border-top: 1px solid var(--tcm-bg);
  content-visibility: visible;
  contain: layout style;
}

#tcm-ai-pane .tcm-ai-md-h2 {
  font-size: 1.08rem;
  font-weight: 700;
  margin: 0.85rem 0 0.4rem;
  color: var(--tcm-text);
}

#tcm-ai-pane .tcm-ai-brain-verify-md {
  content-visibility: visible;
}

#tcm-ai-pane .tcm-ai-md-expand-rest-hint {
  margin: 0 0 0.45rem;
}

#tcm-ai-pane .tcm-ai-patient-delivery-body .tcm-ai-md-h3 {
  font-size: 1.02rem;
  margin: 0.75rem 0 0.35rem;
}

#tcm-ai-pane #tcm-ai-patient-ack {
  margin-right: 0.35rem;
}

/* 症状互斥提示（挂载 document.body，不在 #tcm-ai-pane 内） */
.tcm-ai-symptom-conflict-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(15, 23, 42, 0.45);
  font-family: ui-sans-serif, system-ui, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.tcm-ai-symptom-conflict-overlay.is-open {
  display: flex;
}

.tcm-ai-symptom-conflict-panel {
  width: min(34rem, 100%);
  max-height: min(85vh, 640px);
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e2e5eb;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
  padding: 1.25rem 1.35rem 1.1rem;
  color: #1a1d26;
}

.tcm-ai-symptom-conflict-title {
  margin: 0 0 0.75rem;
  font-size: 1.12rem;
  font-weight: 700;
}

.tcm-ai-symptom-conflict-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.tcm-ai-symptom-conflict-item {
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid #e2e5eb;
  background: #f8fafc;
}

.tcm-ai-symptom-conflict-item.sev-block {
  border-color: #f9b4b4;
  background: #fff5f5;
}

.tcm-ai-symptom-conflict-item-title {
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.tcm-ai-symptom-conflict-rationale,
.tcm-ai-symptom-conflict-suggestion {
  margin: 0.25rem 0 0;
  font-size: 0.94rem;
  line-height: 1.5;
  color: #334155;
}

.tcm-ai-symptom-conflict-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.tcm-ai-symptom-conflict-actions .tcm-ai-btn {
  margin: 0;
  appearance: none;
  border: 1px solid #0d9488;
  background: #0d9488;
  color: #fff;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.92rem;
}

.tcm-ai-symptom-conflict-actions .tcm-ai-btn.secondary {
  background: #fff;
  color: #1a1d26;
  border-color: #e2e5eb;
}

.tcm-ai-symptom-conflict-actions .tcm-ai-btn:hover {
  filter: brightness(1.05);
}

.tcm-ai-symptom-conflict-actions .tcm-ai-btn.secondary:hover {
  background: #f6f7f9;
  filter: none;
}

/* 信息补缺模态（挂载 document.body） */
.tcm-ai-intake-gap-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2147483001;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(15, 23, 42, 0.45);
  font-family: ui-sans-serif, system-ui, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.tcm-ai-intake-gap-overlay.is-open {
  display: flex;
}

.tcm-ai-intake-gap-panel {
  width: min(36rem, 100%);
  max-height: min(88vh, 680px);
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e2e5eb;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
  padding: 1.25rem 1.35rem 1.1rem;
  color: #1a1d26;
}

.tcm-ai-intake-gap-title {
  margin: 0 0 0.45rem;
  font-size: 1.12rem;
  font-weight: 700;
}

.tcm-ai-intake-gap-lead {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  line-height: 1.48;
  color: #475569;
}

.tcm-ai-intake-gap-hint {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #64748b;
}

.tcm-ai-intake-gap-modal-checklist {
  margin: 0 0 0.75rem;
  max-height: min(28vh, 240px);
  overflow: auto;
  padding-right: 0.25rem;
}

.tcm-ai-intake-gap-modal-checklist .tcm-ai-intake-gap-cat {
  margin-bottom: 0.45rem;
}

.tcm-ai-intake-gap-modal-checklist .tcm-ai-intake-gap-cat-title {
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 0.2rem;
  color: var(--tcm-text, #1a1d26);
}

.tcm-ai-intake-gap-modal-checklist .tcm-ai-intake-gap-cat ul {
  margin: 0;
  padding-left: 1.1rem;
}

.tcm-ai-intake-gap-modal-checklist .tcm-ai-intake-gap-cat li {
  margin: 0.15rem 0;
  font-size: 0.86rem;
  color: #334155;
}

.tcm-ai-intake-gap-modal-ul {
  margin: 0 0 0.35rem;
  padding-left: 1.05rem;
  list-style-type: disc;
}

.tcm-ai-intake-gap-modal-ul li {
  margin: 0.12rem 0;
  font-size: 0.86rem;
  color: #334155;
  line-height: 1.42;
}

.tcm-ai-intake-gap-modal-expand {
  margin-top: 0.1rem !important;
  padding: 0.35rem 0.85rem !important;
  font-size: 0.84rem !important;
}

.tcm-ai-intake-gap-panel .tcm-ai-label {
  display: block;
  margin: 0.55rem 0 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--tcm-text, #1a1d26);
}

.tcm-ai-intake-gap-panel .tcm-ai-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid #e2e5eb;
  font-size: 0.92rem;
  line-height: 1.45;
  resize: vertical;
  font-family: inherit;
}

.tcm-ai-intake-gap-panel .tcm-ai-status {
  margin-top: 0.35rem;
}

.tcm-ai-intake-gap-modal-ta {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 0.35rem;
}

.tcm-ai-intake-gap-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.65rem;
}

.tcm-ai-intake-gap-actions .tcm-ai-btn {
  margin: 0;
  appearance: none;
  border: 1px solid #0d9488;
  background: #0d9488;
  color: #fff;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.92rem;
}

.tcm-ai-intake-gap-actions .tcm-ai-btn.secondary {
  background: #fff;
  color: #1a1d26;
  border-color: #e2e5eb;
}

.tcm-ai-intake-gap-actions .tcm-ai-btn:hover {
  filter: brightness(1.05);
}

.tcm-ai-intake-gap-actions .tcm-ai-btn.secondary:hover {
  background: #f6f7f9;
  filter: none;
}

/* 终方核验（R5）：与会诊 rounds 同款 `<details>`，正文托管于 `#tcm-ai-peer-chat` */
#tcm-ai-pane details.tcm-ai-peer-round.tcm-ai-final-audit-peer-round {
  margin-top: 0.35rem;
  background: #fafbfc;
}
#tcm-ai-pane .tcm-ai-final-audit-toolbar {
  margin: 0.35rem 0 0.5rem;
}
#tcm-ai-pane .tcm-ai-final-audit-subhd {
  font-size: 0.96rem;
  font-weight: 700;
  margin: 0.55rem 0 0.3rem;
  color: var(--tcm-text);
}
#tcm-ai-pane .tcm-ai-final-audit-status-line.err {
  color: #991b1b;
}
#tcm-ai-pane .tcm-ai-final-audit-status-line.is-loading {
  font-weight: 600;
  color: #1e293b;
}

/* 用户全流程补充（信息补缺） */
#tcm-ai-pane details.tcm-ai-intake-sup {
  margin: 0.5rem 0 0.35rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid #e2e5eb;
  background: #fafbfc;
}
#tcm-ai-pane .tcm-ai-intake-sup-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.08rem 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}
#tcm-ai-pane .tcm-ai-intake-gap-checklist {
  margin: 0.35rem 0 0.6rem;
}
#tcm-ai-pane .tcm-ai-intake-gap-cat {
  margin-bottom: 0.45rem;
}
#tcm-ai-pane .tcm-ai-intake-gap-cat-title {
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 0.2rem;
  color: var(--tcm-text);
}
#tcm-ai-pane .tcm-ai-intake-gap-cat ul {
  margin: 0;
  padding-left: 1.1rem;
}
#tcm-ai-pane .tcm-ai-intake-gap-cat li {
  margin: 0.15rem 0;
  font-size: 0.86rem;
  color: #334155;
}

/* 第一步：接诊人口学 + 第二步：病情描述（紧凑型麦克风语音行） */
#tcm-ai-pane .tcm-ai-demo-fields {
  margin: 1.25rem 0 0.35rem;
  padding: 0;
  border: none;
  border-top: 1px solid rgba(0, 212, 255, 0.12);
  border-radius: 0;
  background: transparent;
}
#tcm-ai-pane .tcm-ai-demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 1rem 1.25rem;
  margin-top: 0.5rem;
}
#tcm-ai-pane .tcm-ai-demo-cell .tcm-ai-label {
  margin: 0 0 0.4rem;
}
#tcm-ai-pane .tcm-ai-chief-narrative-block {
  margin: 0.5rem 0 0.25rem;
}
#tcm-ai-pane .tcm-ai-chief-narrative-row {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}
#tcm-ai-pane .tcm-ai-chief-narrative-ta {
  flex: 1;
  min-height: 4.25rem;
  resize: vertical;
}
#tcm-ai-pane .tcm-ai-chief-narrative-side {
  flex-shrink: 0;
  padding-top: 0.15rem;
}
#tcm-ai-pane .tcm-ai-chief-narrative-mic {
  width: 2.5rem;
  height: 2.5rem;
  min-width: 2.5rem;
  min-height: 2.5rem;
  border-radius: 999px;
}
#tcm-ai-pane .tcm-ai-chief-narrative-meta {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--tcm-muted);
}
#tcm-ai-pane .tcm-ai-tongue-coaching {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}
#tcm-ai-pane .tcm-ai-tongue-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.25rem 0 0.35rem;
}
#tcm-ai-pane .tcm-ai-tongue-row input[type="file"] {
  flex: 1 1 180px;
  min-width: 0;
  font-size: 0.85rem;
}
#tcm-ai-pane .tcm-ai-tongue-details {
  margin-top: 0.5rem;
  padding: 0.35rem 0.35rem 0.75rem;
  border-radius: var(--tcm-radius-md, 10px);
  background: rgba(0, 0, 0, 0.025);
}
#tcm-ai-pane .tcm-ai-tongue-details > summary {
  cursor: pointer;
  font-weight: 600;
}
#tcm-ai-pane .tcm-ai-tongue-body {
  margin: 0.5rem 0 0;
  font-size: 0.92rem;
  line-height: 1.55;
}
#tcm-ai-pane .tcm-ai-tongue-observation {
  white-space: pre-wrap;
  word-break: break-word;
}
#tcm-ai-pane .tcm-ai-tongue-hints-line {
  margin-top: 0.65rem;
  color: var(--tcm-muted);
  font-size: 0.88rem;
}
#tcm-ai-pane .tcm-ai-tongue-disclaimer {
  margin: 0.5rem 0 0;
}

/* 老年模式：由 body.tcm-elderly-mode 与嵌入根同步 class 驱动 */
body.tcm-elderly-mode #tcm-ai-pane.tcm-ai-root.tcm-elderly-mode,
body.tcm-elderly-mode #tcm-ai-pane.tcm-ai-root.tcm-elderly-mode .tcm-ai-root {
  font-size: calc(15px * 1.28);
  line-height: 1.62;
  --tcm-text: #0a0c10;
  --tcm-muted: #3d4656;
  --tcm-border: #94a3b8;
  overflow-x: hidden;
  word-break: break-word;
}

body.tcm-elderly-mode #tcm-ai-pane.tcm-ai-root .tcm-ai-hint-dense {
  display: none !important;
}

body.tcm-elderly-mode #tcm-ai-pane .tcm-ai-btn,
body.tcm-elderly-mode #tcm-ai-pane .tcm-ai-peer-voice-btn,
body.tcm-elderly-mode #tcm-ai-pane .tcm-ai-voice-hold-btn,
body.tcm-elderly-mode #tcm-ai-pane .tcm-ai-step-pill,
body.tcm-elderly-mode #tcm-ai-pane .tcm-ai-mode-tab,
body.tcm-elderly-mode #tcm-ai-pane .tcm-ai-input,
body.tcm-elderly-mode #tcm-ai-pane .tcm-ai-textarea {
  min-height: 48px;
}

#tcm-ai-pane .tcm-ai-voice-hold-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.35rem 0 0.5rem;
}

#tcm-ai-pane .tcm-ai-voice-hold-btn {
  min-width: 6.75rem;
  min-height: 2.5rem;
  border-radius: var(--tcm-radius-sm);
  border: 1px solid var(--tcm-border);
  background: var(--tcm-panel);
  color: var(--tcm-text);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

body.tcm-elderly-mode #tcm-ai-pane .tcm-ai-voice-hold-btn {
  min-width: 9.5rem;
  min-height: 3rem;
  border-radius: 999px;
  border: 2px solid var(--tcm-accent);
  background: var(--tcm-accent-soft);
  font-size: 1.12rem;
  font-weight: 650;
  padding: 0.65rem 1.25rem;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.12);
}

/* P1: 方言偏好徽章在elderly下更大、更清晰（靠近按住说话） */
body.tcm-elderly-mode #tcm-ai-pane .tcm-ai-dialect-badge,
body.tcm-elderly-mode .tcm-ai-dialect-badge {
  font-size: 0.92rem !important;
  padding: 0.2rem 0.5rem !important;
  min-height: 28px;
  line-height: 1.3;
}

/* ASR确认提示在elderly下稍大 */
body.tcm-elderly-mode .tcm-ai-asr-confirm-hint {
  font-size: 0.9rem !important;
  opacity: 0.85;
}

/* P1移动端增强：方言徽章基础样式（防横滚、触控预留、窄屏自适应）+ 确认提示窄屏可读 */
.tcm-ai-dialect-badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.08rem 0.3rem;
  border: 1px solid rgba(100,116,139,0.4);
  border-radius: 4px;
  background: rgba(241,245,249,0.6);
  color: #475569;
  white-space: normal; /* 允许窄屏折行 */
  max-width: 8.5em;
  vertical-align: middle;
  line-height: 1.2;
  touch-action: manipulation;
  cursor: pointer;
}
@media (max-width: 560px) {
  .tcm-ai-dialect-badge {
    font-size: 0.78rem;
    padding: 0.2rem 0.45rem;
    max-width: none;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }
}
@media (max-width: 360px) {
  .tcm-ai-dialect-badge { font-size: 0.64rem; }
}
@media (max-width: 560px) {
  .tcm-ai-asr-confirm-hint {
    font-size: 0.84rem !important;
    line-height: 1.35;
    margin: 0.1rem 0 0.05rem !important;
  }
  .tcm-ai-asr-confirm-card {
    padding: 1rem 1.1rem !important;
  }
}

#tcm-ai-pane .tcm-ai-voice-hold-btn.is-recording {
  border-color: var(--tcm-danger);
  background: rgba(180, 35, 24, 0.1);
  color: var(--tcm-danger);
}

/* ASR 确认模态（挂载 document.body，与 intake-gap 同级） */
.tcm-ai-asr-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147482999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.55);
  font-family: var(--tcm-font, ui-sans-serif, system-ui, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif);
}

.tcm-ai-asr-confirm-overlay[hidden] {
  display: none !important;
}

.tcm-ai-asr-confirm-card {
  width: min(28rem, 100%);
  padding: 1.25rem 1.35rem;
  border-radius: var(--tcm-radius, 12px);
  background: #fff;
  border: 2px solid #e2e5eb;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
  color: #1a1d26;
}

body.tcm-elderly-mode .tcm-ai-asr-confirm-card {
  font-size: 1.15rem;
}

.tcm-ai-asr-confirm-card .tcm-ai-label {
  margin: 0 0 0.35rem;
  font-weight: 700;
  font-size: 1.05em;
}

.tcm-ai-asr-confirm-text {
  margin: 0.75rem 0 1rem;
  font-size: 1.05em;
  line-height: 1.55;
  word-break: break-word;
}

.tcm-ai-asr-confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.tcm-ai-asr-confirm-actions .tcm-ai-btn {
  margin: 0;
  appearance: none;
  border: 1px solid #0d9488;
  background: #0d9488;
  color: #fff;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.92rem;
  min-height: 2.75rem;
}

.tcm-ai-asr-confirm-actions .tcm-ai-btn.secondary {
  background: #fff;
  color: #1a1d26;
  border-color: #e2e5eb;
}

#tcm-ai-pane .tcm-ai-tier-quota-hint {
  margin: 0.35rem 0 0.65rem;
  line-height: 1.45;
  color: var(--tcm-ai-muted, #64748b);
}

#tcm-ai-pane .tcm-ai-sym-selection-hint--warn {
  color: var(--tcm-ai-warn, #b45309);
  font-weight: 600;
}

#tcm-ai-pane .tcm-ai-step3-compliance-wrap {
  margin-bottom: 0.65rem;
}

#tcm-ai-pane .tcm-ai-step3-compliance-summary {
  cursor: pointer;
  font-weight: 600;
  margin: 0.35rem 0;
}

#tcm-ai-pane .tcm-ai-step3-tts-brief {
  margin-top: 0.45rem;
}

body.tcm-elderly-mode #tcm-ai-pane .tcm-ai-step3-compliance-details:not([open]) .tcm-ai-step3-lead-full {
  display: none;
}

body.tcm-elderly-mode .tcm-ai-asr-confirm-actions .tcm-ai-btn {
  font-size: 1.08rem;
  min-height: 52px;
}

/* === Phase2: 辨证结果结构化总结卡片（专业 vs 通俗） === */
.tcm-result-card-popular {
  margin: 0.75rem 0;
  padding: 0.85rem 1rem;
  border: 2px solid #b91c1c;
  border-radius: 12px;
  background: linear-gradient(180deg, #fef2f2 0%, #fff7ed 100%);
  font-size: 0.95rem;
  line-height: 1.55;
}
.tcm-result-card-popular .pop-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #9f1239;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.tcm-result-card-popular .pop-item {
  margin: 0.35rem 0;
}
.tcm-result-card-popular .pop-label {
  font-weight: 700;
  color: #854d0e;
}
.tcm-result-card-popular .pop-redline {
  margin-top: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: #fee2e2;
  border-left: 5px solid #dc2626;
  font-weight: 700;
  color: #991b1b;
}
.tcm-result-card-popular .pop-disclaimer {
  font-size: 0.78rem;
  color: #854d0e;
  margin-top: 0.4rem;
  border-top: 1px dashed #f59e0b;
  padding-top: 0.3rem;
}
.tcm-result-version-toggle {
  display: inline-flex;
  gap: 0.25rem;
  margin: 0.3rem 0;
}
.tcm-result-version-toggle button {
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  border: 1px solid #64748b;
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
}
.tcm-result-version-toggle button.is-active {
  background: #0f766e;
  color: #fff;
  border-color: #0f766e;
}

/* 移动端卡片自适应 */
@media (max-width: 640px) {
  .tcm-result-card-popular {
    font-size: 0.92rem;
    padding: 0.65rem 0.8rem;
  }
}

/* === Phase1: 语音主症智能推荐 chips（老人/移动友好，复用现有 voice 流） === */
#tcm-ai-pane .tcm-ai-rec-main-btn {
  margin: 0.35rem 0 0.25rem;
  width: 100%;
  font-weight: 600;
  background: linear-gradient(180deg, #f0fdfa 0%, #e0f2fe 100%);
  border-color: #14b8a6;
  color: #134e4a;
}
#tcm-ai-pane .tcm-ai-rec-main-btn:hover,
#tcm-ai-pane .tcm-ai-rec-main-btn:focus-visible {
  background: linear-gradient(180deg, #ccfbf1 0%, #bae6fd 100%);
  transform: translateY(-1px);
}
#tcm-ai-pane .tcm-ai-main-sym-rec {
  margin: 0.25rem 0 0.5rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid rgba(20, 184, 166, 0.25);
  border-radius: 10px;
  background: rgba(240, 253, 250, 0.6);
}
#tcm-ai-pane .tcm-ai-rec-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.3rem 0;
}
#tcm-ai-pane .tcm-ai-rec-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.6rem;
  border: 1px solid rgba(13, 148, 136, 0.25);
  border-radius: 999px;
  background: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
  min-height: 36px;
}
#tcm-ai-pane .tcm-ai-rec-chip input {
  accent-color: #14b8a6;
}
#tcm-ai-pane .tcm-ai-rec-chip-label {
  font-weight: 500;
}
#tcm-ai-pane .tcm-ai-rec-chip.is-high {
  border-color: #0f766e;
  background: #f0fdfa;
}
#tcm-ai-pane .tcm-ai-rec-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}
#tcm-ai-pane .tcm-ai-rec-action-primary {
  background: #0f766e;
  color: #fff;
  border-color: #0f766e;
}
#tcm-ai-pane .tcm-ai-rec-hint {
  font-size: 0.78rem;
  color: #64748b;
  margin: 0.2rem 0 0;
}

/* 老年模式：更大触控、更醒目 */
body.tcm-elderly-mode #tcm-ai-pane .tcm-ai-rec-main-btn {
  min-height: 56px;
  font-size: 1.05rem;
  border-radius: 12px;
}
body.tcm-elderly-mode #tcm-ai-pane .tcm-ai-main-sym-rec {
  padding: 0.65rem;
  border-radius: 12px;
}
body.tcm-elderly-mode #tcm-ai-pane .tcm-ai-rec-chip {
  min-height: 44px;
  font-size: 1.0rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
}
body.tcm-elderly-mode #tcm-ai-pane .tcm-ai-rec-chip input {
  width: 1.25rem;
  height: 1.25rem;
}
body.tcm-elderly-mode #tcm-ai-pane .tcm-ai-rec-actions .tcm-ai-btn {
  min-height: 48px;
  font-size: 1.0rem;
}

/* 移动端/小屏：更紧凑但仍可点，优先 voice */
@media (max-width: 640px) {
  #tcm-ai-pane .tcm-ai-rec-chip {
    min-height: 40px;
    font-size: 0.92rem;
  }
  #tcm-ai-pane .tcm-ai-rec-main-btn {
    font-size: 0.95rem;
  }
  /* 移动端 voice 优先 + 密度降低 */
  #tcm-ai-pane .tcm-ai-voice-hold-btn,
  #tcm-ai-pane .tcm-ai-rec-main-btn {
    min-height: 52px;
    font-size: 1.02rem;
    padding: 0.45rem 0.9rem;
  }
  #tcm-ai-pane .tcm-ai-chief-narrative-ta {
    min-height: 5.5em;
  }
}

/* 进一步移动/低端设备 info density 降低（配合 body.tcm-mobile-lite） */
@media (max-width: 480px) {
  body.tcm-elderly-mode #tcm-ai-pane .tcm-ai-label,
  #tcm-ai-pane .tcm-ai-label {
    font-size: 0.95rem;
  }
  #tcm-ai-pane .tcm-ai-sym-wrap {
    font-size: 0.9rem;
  }
}

/* ========== UI 优化 2026-06: 辨证服务嵌入 · 临床专业卡片与并行提示强化 ========== */
/* 病机卡片：大而醒目，锚定于合议前，带中医大脑提要 + 专家共识徽章 */
#tcm-ai-pane .tcm-clinical-patho-card {
  /* redesign: 更醒目临床锚定卡片，浅 teal 边，白底，少影，置顶突出 */
  background: #ffffff;
  border: 2px solid #0f766e;
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  margin: 0.4rem 0 0.6rem;
  box-shadow: 0 1px 3px rgba(15,118,110,0.08);
}
#tcm-ai-pane .tcm-clinical-patho-card .patho-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
  font-weight: 800;
  color: #0f766e;
  font-size: 0.95rem;
}
#tcm-ai-pane .tcm-clinical-patho-card .patho-badges {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.3rem;
  flex-wrap: wrap;
}
#tcm-ai-pane .tcm-clinical-patho-card .patho-badge {
  font-size: 0.66rem;
  padding: 0.08rem 0.4rem;
  border-radius: 999px;
  background: #ecfdf5;
  color: #166534;
  border: 1px solid #10b981;
  font-weight: 700;
}
#tcm-ai-pane .tcm-clinical-patho-card .patho-body {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #0f172a;
}

/* 方剂推荐卡片：可扫描，带角色、溯源 */
#tcm-ai-pane .tcm-clinical-formula-card {
  border: 1px solid var(--tcm-border);
  border-radius: var(--tcm-radius);
  padding: 0.85rem 1rem;
  margin-bottom: 0.65rem;
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}
#tcm-ai-pane .tcm-clinical-formula-card .formula-name {
  font-weight: 800;
  font-size: 1.0rem;
  color: var(--tcm-text);
  margin: 0 0 0.25rem;
}
#tcm-ai-pane .tcm-clinical-formula-card .formula-labels {
  font-size: 0.7rem;
  color: #166534;
  background: #ecfdf5;
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 0.35rem;
}
#tcm-ai-pane .tcm-clinical-formula-card .herb-chip {
  display: inline-block;
  font-size: 0.78rem;
  padding: 0.08rem 0.4rem;
  margin: 0.1rem 0.15rem 0.1rem 0;
  background: var(--tcm-bg);
  border: 1px solid var(--tcm-border);
  border-radius: 6px;
}
#tcm-ai-pane .tcm-clinical-formula-card .formula-rationale {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--tcm-muted);
  border-left: 2px solid var(--tcm-accent);
  padding-left: 0.5rem;
}

/* 并行合议加载强化：清晰传达 22 医者并行 */
#tcm-ai-pane .tcm-ai-peer-chat-progress-body {
  font-weight: 600;
  color: var(--tcm-text);
}
#tcm-ai-pane .tcm-ai-status.loading .parallel-hint {
  font-size: 0.78rem;
  color: #166534;
  background: #ecfdf5;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  display: inline-block;
  margin-top: 0.2rem;
}

/* 证据芯片 */
#tcm-ai-pane .tcm-evidence-chip {
  font-size: 0.68rem;
  padding: 0.05rem 0.35rem;
  border: 1px dashed var(--tcm-border);
  border-radius: 4px;
  color: var(--tcm-muted);
  background: var(--tcm-bg);
  margin-right: 0.25rem;
}

/* ========== hud-no-sidebar-2026-06-02: 单栏全宽 · 横向步骤 + 暗色玻璃内容 ========== */
#tcm-ai-pane .tcm-ai-layout {
  display: block;
  margin-top: 0.15rem;
}
#tcm-ai-pane .tcm-ai-sidebar {
  display: none !important;
}
@media (max-width: 920px) {
  #tcm-ai-pane .tcm-ai-layout {
    gap: 0.65rem;
  }
  #tcm-ai-pane .tcm-ai-step-nav-h {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #tcm-ai-pane .tcm-ai-step-nav-h .tcm-ai-step-pill {
    flex: 0 0 auto;
    min-height: 44px;
  }
}
#tcm-ai-pane .tcm-ai-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #ffffff;
  border: 1px solid var(--tcm-border);
  border-radius: var(--tcm-radius-sm);
  padding: 0.85rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.82rem;
  color: #334155;
  align-self: stretch;
  position: sticky;
  top: 0.35rem;
  box-shadow: var(--tcm-shadow-sm);
}
#tcm-ai-pane .tcm-ai-sidebar .tcm-ai-sidebar-h {
  font-weight: 750;
  font-size: 0.7rem;
  color: var(--tcm-accent);
  margin: 0.1rem 0 0.05rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
#tcm-ai-pane .tcm-ai-patient-avatar {
  display: flex;
  justify-content: center;
  margin: 0.1rem 0 0.25rem;
}
#tcm-ai-pane .tcm-ai-patient-avatar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: var(--tcm-accent-gradient);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 3px 10px rgba(13, 107, 99, 0.22);
}
#tcm-ai-pane .tcm-ai-sidebar-placeholder {
  color: var(--tcm-muted);
  font-size: 0.76rem;
  line-height: 1.45;
}
#tcm-ai-pane .tcm-ai-fourdx-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}
#tcm-ai-pane .tcm-ai-fourdx-card {
  background: #fff;
  border: 1px solid var(--tcm-border);
  border-radius: 8px;
  padding: 0.35rem 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
#tcm-ai-pane .tcm-ai-fourdx-card.is-filled {
  border-color: #10b981;
  background: #ecfdf5;
}
#tcm-ai-pane .tcm-ai-fourdx-card.is-active {
  border-color: var(--tcm-accent);
  box-shadow: 0 0 0 2px var(--tcm-accent-soft);
}
#tcm-ai-pane .tcm-ai-fourdx-card .dx-k {
  font-weight: 800;
  font-size: 0.72rem;
  color: var(--tcm-accent);
}
#tcm-ai-pane .tcm-ai-fourdx-card .dx-v {
  font-size: 0.68rem;
  color: var(--tcm-muted);
  line-height: 1.3;
}
#tcm-ai-pane .tcm-ai-main {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
/* 参考截图：右栏顶部横向四步药丸（非侧栏竖排） */
#tcm-ai-pane .tcm-ai-step-nav-h {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  margin: 0 0 0.75rem;
  padding: 0.35rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(8, 28, 52, 0.72);
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: 12px;
  box-shadow: none;
  position: relative;
}
#tcm-ai-pane .tcm-ai-step-nav-h .tcm-ai-step-pill {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.38rem 0.65rem;
  min-height: 2.35rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 0.8rem;
  color: #64748b;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--tcm-transition), border-color var(--tcm-transition), color var(--tcm-transition), box-shadow var(--tcm-transition);
}
#tcm-ai-pane .tcm-ai-step-nav-h .tcm-ai-step-pill .idx {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: #e2e8f0;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
}
#tcm-ai-pane .tcm-ai-step-nav-h .tcm-ai-step-pill.is-current {
  border-color: #0f766e;
  background: #0f766e;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.22);
}
#tcm-ai-pane .tcm-ai-step-nav-h .tcm-ai-step-pill.is-current .idx {
  background: #ffffff;
  color: #0f766e;
}
#tcm-ai-pane .tcm-ai-step-nav-h .tcm-ai-step-pill.is-done {
  border-color: transparent;
  background: #ecfdf5;
  color: #0f766e;
}
#tcm-ai-pane .tcm-ai-step-nav-h .tcm-ai-step-pill.is-done .idx {
  background: #14b8a6;
  color: #fff;
}
#tcm-ai-pane .tcm-ai-step-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #0f766e;
  background: #ecfdf5;
  border: 1px solid #99f6e4;
  margin-right: 0.4rem;
  vertical-align: 0.05em;
}
#tcm-ai-pane .tcm-ai-main .tcm-ai-step-card,
#tcm-ai-pane .tcm-ai-main .tcm-ai-step-panel[data-step="1"] .tcm-ai-card {
  border: 1px solid rgba(0, 212, 255, 0.25);
  background: rgba(8, 28, 52, 0.82);
  box-shadow: 0 0 24px rgba(0, 212, 255, 0.1), inset 0 1px 0 rgba(0, 255, 255, 0.05);
  border-radius: 12px;
  padding: 1.5rem;
}
#tcm-ai-pane .tcm-ai-step-title {
  margin: 0 0 0.65rem;
  font-size: 1.02rem;
  font-weight: 700;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}
#tcm-ai-pane .tcm-ai-main .tcm-ai-card {
  padding: 1.5rem;
  margin-bottom: 0;
  border-radius: 12px;
  border: 1px solid rgba(0, 212, 255, 0.25);
  background: rgba(8, 28, 52, 0.82);
  box-shadow: 0 0 24px rgba(0, 212, 255, 0.1);
}
#tcm-ai-pane .tcm-ai-main h3 {
  font-size: 1.02rem;
  margin: 0 0 0.35rem;
  color: #f1f5f9;
}
#tcm-ai-pane .tcm-ai-main .lead {
  font-size: 0.86rem;
  color: #94a3b8;
  margin-top: 0;
  line-height: 1.55;
}
#tcm-ai-pane .tcm-ai-patient-summary {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.45rem 0.5rem;
  font-size: 0.76rem;
  line-height: 1.35;
}
#tcm-ai-pane .tcm-ai-patient-summary:empty {
  display: none;
}
#tcm-ai-pane .tcm-ai-patient-summary .sum-row {
  display: flex;
  gap: 0.35rem;
  margin: 0.1rem 0;
  flex-wrap: wrap;
}
#tcm-ai-pane .tcm-ai-patient-summary .sum-k {
  color: #64748b;
  font-weight: 600;
  min-width: 2.2em;
}
#tcm-ai-pane .tcm-ai-patient-summary .sum-v {
  font-weight: 650;
  color: var(--tcm-text);
}
body.tcm-elderly-mode #tcm-ai-pane .tcm-ai-sidebar,
#tcm-ai-pane.tcm-elderly-mode .tcm-ai-sidebar {
  font-size: 0.92rem;
  width: 240px;
}
body.tcm-elderly-mode #tcm-ai-pane .tcm-ai-step-nav-h .tcm-ai-step-pill,
#tcm-ai-pane.tcm-elderly-mode .tcm-ai-step-nav-h .tcm-ai-step-pill {
  min-height: 44px;
  font-size: 0.92rem;
  padding: 0.45rem 0.95rem;
}

/* 移除旧 LR 规则末尾重复块 — 以下保留临床卡片/空状态等增强 */
#tcm-ai-pane .tcm-clinical-patho-card {
  background: var(--clinical-patho-bg, linear-gradient(165deg, #f0fdfa 0%, #ffffff 55%, #f8fafc 100%));
  border: 2px solid var(--tcm-accent);
  border-radius: var(--tcm-radius);
  padding: 1rem 1.1rem;
  margin: 0.5rem 0 0.85rem;
  box-shadow: var(--tcm-shadow-md);
  position: relative;
  overflow: hidden;
}
#tcm-ai-pane .tcm-clinical-patho-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--tcm-accent-gradient);
}
#tcm-ai-pane .tcm-clinical-patho-card .patho-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
  font-weight: 800;
  color: var(--tcm-accent);
  font-size: 1rem;
}
#tcm-ai-pane .tcm-clinical-patho-card .patho-icon {
  font-size: 1.1rem;
}
#tcm-ai-pane .tcm-clinical-patho-card .patho-anchor-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--tcm-accent-soft);
  color: var(--tcm-accent);
}
#tcm-ai-pane .tcm-clinical-patho-card .patho-badge--muted {
  background: #f1f5f9;
  color: var(--tcm-muted);
  border-color: var(--tcm-border);
}
#tcm-ai-pane .tcm-ai-peer-chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem 1.25rem;
  min-height: 8rem;
  border-radius: var(--tcm-radius);
  border: 1px dashed var(--tcm-border);
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}
#tcm-ai-pane .tcm-ai-empty-icon {
  font-size: 2rem;
  opacity: 0.45;
  margin-bottom: 0.5rem;
}
#tcm-ai-pane .tcm-ai-empty-title {
  margin: 0 0 0.35rem;
  font-weight: 750;
  font-size: 0.95rem;
  color: var(--tcm-text);
}
#tcm-ai-pane .tcm-ai-empty-desc {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--tcm-muted);
  max-width: 36rem;
}
#tcm-ai-pane details.tcm-ai-peer-round {
  border-radius: var(--tcm-radius-sm);
  border: 1px solid var(--tcm-border);
  background: #fff;
  box-shadow: var(--tcm-shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--tcm-transition);
}
#tcm-ai-pane details.tcm-ai-peer-round:hover {
  box-shadow: var(--tcm-shadow);
}
#tcm-ai-pane .tcm-ai-peer-round-sum {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}
#tcm-ai-pane .tcm-ai-peer-chat-progress {
  border-radius: var(--tcm-radius);
  border: 1px solid #93c5fd;
  background: linear-gradient(165deg, #eff6ff 0%, #ffffff 100%);
  box-shadow: var(--tcm-shadow-sm);
}
#tcm-ai-pane .tcm-ai-selected-summary {
  background: #f8fafc;
  border: 1px solid var(--tcm-border);
  border-radius: var(--tcm-radius-sm);
  padding: 0.65rem 0.75rem;
  font-size: 0.86rem;
}
#tcm-ai-pane .tcm-ai-patient-summary .sum-v {
  font-weight: 650;
  color: var(--tcm-text);
}
#tcm-ai-pane.tcm-ai-ref-clone .tcm-ai-step-nav-h,
#tcm-ai-pane.tcm-ai-ref-clone .tcm-ai-steps.tcm-ai-step-nav-h {
  display: none !important;
}

#tcm-ai-pane.tcm-ai-ref-clone .tcm-ai-layout {
  gap: 0.75rem;
  margin-top: 0;
}

#tcm-ai-pane.tcm-ai-ref-clone .tcm-ai-main .tcm-ai-card,
#tcm-ai-pane.tcm-ai-ref-clone .tcm-ai-step-card {
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: 12px;
  box-shadow: 0 0 24px rgba(0, 212, 255, 0.1);
  padding: 1.5rem;
  background: rgba(8, 28, 52, 0.82);
}

#tcm-ai-pane.tcm-ai-ref-clone .tcm-ai-actions .tcm-ai-btn:not(.secondary) {
  flex: 0 1 auto;
  width: 100%;
  max-width: 320px;
  justify-content: center;
}

#tcm-ai-pane.tcm-ai-ref-clone .tcm-ai-composer-shell {
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

#tcm-ai-pane.tcm-ai-ref-clone .tcm-ai-tier-intro {
  border: 1px solid var(--tcm-border);
  background: #ffffff;
  box-shadow: none;
}

#tcm-ai-pane.tcm-ai-ref-clone .tcm-ai-patient-avatar-inner {
  background: #0d9488;
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  #tcm-ai-pane * {
    transition-duration: 0.01ms !important;
  }
}

/* ========== hud-ref-2026-06-02: 宿主 .tcm-hud-shell 下辨证嵌入暗色霓虹 ========== */
.tcm-hud-shell #tcm-ai-pane.tcm-ai-root {
  color: #e8f4fc;
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-banner {
  background: rgba(120, 53, 15, 0.35);
  border-color: rgba(251, 191, 36, 0.45);
  color: #fde68a;
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-pill {
  background: rgba(0, 212, 255, 0.06);
  border-color: rgba(0, 212, 255, 0.28);
  color: rgba(180, 230, 255, 0.85);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-pill .idx {
  background: rgba(0, 212, 255, 0.35);
  color: #021018;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-pill.is-current {
  border-color: #00ffff;
  background: linear-gradient(135deg, rgba(0, 153, 204, 0.9), rgba(0, 212, 255, 0.8));
  color: #021018;
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.35);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-pill.is-current .idx {
  background: #021018;
  color: #00ffff;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-pill.is-done {
  border-color: rgba(45, 212, 191, 0.45);
  background: rgba(45, 212, 191, 0.12);
  color: #99f6e4;
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-card {
  background: rgba(8, 28, 52, 0.82);
  border-color: rgba(0, 212, 255, 0.32);
  box-shadow: 0 0 24px rgba(0, 212, 255, 0.1), inset 0 1px 0 rgba(0, 255, 255, 0.05);
  backdrop-filter: blur(10px);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-card:hover {
  border-color: rgba(0, 255, 255, 0.45);
  box-shadow: 0 0 32px rgba(0, 212, 255, 0.18);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-card .lead {
  color: rgba(148, 210, 230, 0.88);
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-callout {
  background: rgba(0, 212, 255, 0.05);
  border-color: rgba(0, 212, 255, 0.25);
  color: rgba(180, 230, 255, 0.85);
}

.tcm-hud-shell .tcm-ai-input,
.tcm-hud-shell .tcm-ai-select,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-textarea {
  background: rgba(4, 16, 32, 0.8);
  border-color: rgba(0, 212, 255, 0.28);
  color: #e0f7ff;
}
.tcm-hud-shell .tcm-ai-input:focus,
.tcm-hud-shell .tcm-ai-select:focus,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-textarea:focus {
  border-color: #00d4ff;
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.2), 0 0 16px rgba(0, 212, 255, 0.15);
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-btn {
  border-radius: 4px;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-btn:not(.secondary):not(.ghost) {
  background: linear-gradient(135deg, rgba(0, 153, 204, 0.95), rgba(0, 212, 255, 0.85));
  border-color: #00d4ff;
  color: #ffffff;
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.3);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-btn.secondary,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-btn.ghost {
  background: rgba(0, 212, 255, 0.06);
  border-color: rgba(0, 212, 255, 0.35);
  color: #a5f3fc;
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-composer-shell,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-chat-scroll,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-ctx-sheet {
  border-color: rgba(0, 212, 255, 0.25);
  background: rgba(4, 16, 32, 0.55);
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-msg--user {
  background: rgba(0, 212, 255, 0.12);
  border-color: rgba(0, 212, 255, 0.35);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-msg--assistant {
  background: rgba(8, 28, 52, 0.75);
  border-color: rgba(0, 212, 255, 0.22);
}

.tcm-hud-shell #tcm-ai-pane pre.tcm-ai-result-box {
  background: rgba(2, 8, 18, 0.85);
  border-color: rgba(0, 212, 255, 0.28);
  color: #cceeff;
}

.tcm-hud-shell #tcm-ai-pane.tcm-ai-ref-clone .tcm-ai-main .tcm-ai-card,
.tcm-hud-shell #tcm-ai-pane.tcm-ai-ref-clone .tcm-ai-step-card {
  background: rgba(8, 28, 52, 0.82);
  border-color: rgba(0, 212, 255, 0.32);
  box-shadow: 0 0 24px rgba(0, 212, 255, 0.1);
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-tier-intro {
  background: rgba(8, 28, 52, 0.7);
  border-color: rgba(0, 212, 255, 0.28);
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-patient-avatar-inner {
  background: linear-gradient(135deg, #0099cc, #00ffff);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.45);
}

/* ========== hud-panels-unify-2026-06-02: 辨证侧栏/步骤/空态深色统一 ========== */
.tcm-hud-shell #tcm-ai-pane .tcm-ai-sidebar {
  background: rgba(8, 24, 48, 0.92);
  border-color: rgba(0, 212, 255, 0.35);
  color: #e2e8f0;
  box-shadow: 0 0 24px rgba(0, 212, 255, 0.12), inset 0 1px 0 rgba(0, 255, 255, 0.06);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-sidebar .tcm-ai-sidebar-h {
  color: #67e8f9;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-patient-summary {
  background: rgba(4, 16, 32, 0.55) !important;
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: var(--tcm-radius-xs, 4px);
  color: #e2e8f0;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-patient-summary .sum-k {
  color: #94a3b8;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-patient-summary .sum-v {
  color: #e2e8f0;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-fourdx-card {
  background: rgba(4, 16, 32, 0.65) !important;
  border-color: rgba(0, 212, 255, 0.22);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-fourdx-card.is-filled {
  border-color: rgba(45, 212, 191, 0.45);
  background: rgba(45, 212, 191, 0.1) !important;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-fourdx-card .dx-v {
  color: #94a3b8;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-nav-h {
  background: rgba(8, 28, 52, 0.72) !important;
  border-color: rgba(0, 212, 255, 0.28);
}
.tcm-hud-shell #tcm-ai-pane.tcm-ai-ref-clone .tcm-ai-sidebar {
  background: rgba(8, 24, 48, 0.92) !important;
  border-color: rgba(0, 212, 255, 0.35);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-peer-chat-empty {
  background: rgba(8, 24, 48, 0.92);
  border: 1px dashed rgba(0, 212, 255, 0.35);
  color: #e2e8f0;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-empty-title {
  color: #e0f7ff;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-empty-desc {
  color: #94a3b8;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-empty-icon {
  filter: drop-shadow(0 0 12px rgba(0, 212, 255, 0.55));
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-sidebar-placeholder {
  color: #94a3b8;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-patho-panel,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-patho-card {
  background: rgba(8, 24, 48, 0.92) !important;
  border-color: rgba(0, 212, 255, 0.35) !important;
  color: #e2e8f0;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-renji-card,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-renji-panel {
  background: rgba(8, 24, 48, 0.88) !important;
  border-color: rgba(0, 212, 255, 0.28) !important;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-patient-delivery-body .tcm-ai-patient-delivery-md-root {
  background: rgba(4, 16, 32, 0.65) !important;
  border-color: rgba(0, 212, 255, 0.25) !important;
  color: #e2e8f0;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-main .tcm-ai-step-card,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-main .tcm-ai-step-panel[data-step="1"] .tcm-ai-card,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-main .tcm-ai-card {
  background: rgba(8, 24, 48, 0.92) !important;
  border-color: rgba(0, 212, 255, 0.35) !important;
  color: #e2e8f0;
  box-shadow: 0 0 24px rgba(0, 212, 255, 0.1);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-title {
  color: #e0f7ff;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-badge {
  color: #67e8f9;
  background: rgba(0, 212, 255, 0.12);
  border-color: rgba(0, 212, 255, 0.4);
}

/* ========== hud-readability-2026-06-02: 宿主 HUD 下嵌入页全局可读性 ========== */
.tcm-hud-shell #tcm-ai-pane.tcm-ai-root {
  --tcm-text: #e8f4fc;
  --tcm-muted: #94a3b8;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  color: var(--tcm-text);
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-label,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-title,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-main h3 {
  color: #f0f9ff;
  text-shadow: 0 0 20px rgba(0, 212, 255, 0.15);
}

.tcm-hud-shell .tcm-ai-input::placeholder,
.tcm-hud-shell .tcm-ai-select::placeholder,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-textarea::placeholder,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-peer-compose-input::placeholder {
  color: #64748b;
  opacity: 1;
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-btn:not(.secondary):not(.ghost) {
  background: linear-gradient(135deg, #0891b2 0%, #06b6d4 45%, #22d3ee 100%);
  border-color: #00d4ff;
  color: #ffffff;
  font-weight: 650;
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.35);
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-pill {
  background: rgba(4, 16, 32, 0.65);
  border-color: rgba(0, 212, 255, 0.28);
  color: #cbd5e1;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-pill .idx {
  background: rgba(0, 212, 255, 0.35);
  color: #021018;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-pill.is-current {
  border-color: #2dd4bf;
  background: linear-gradient(135deg, #0d9488, #14b8a6);
  color: #ffffff;
  box-shadow: 0 0 16px rgba(45, 212, 191, 0.35);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-pill.is-current .idx {
  background: #ffffff;
  color: #0f766e;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-pill.is-done {
  border-color: rgba(45, 212, 191, 0.45);
  background: rgba(45, 212, 191, 0.15);
  color: #99f6e4;
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-nav-h {
  background: rgba(8, 28, 52, 0.72) !important;
  border-color: rgba(0, 212, 255, 0.28);
  border-radius: 12px;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-nav-h .tcm-ai-step-pill {
  color: #94a3b8;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-nav-h .tcm-ai-step-pill .idx {
  background: rgba(0, 212, 255, 0.2);
  color: #cbd5e1;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-nav-h .tcm-ai-step-pill.is-current {
  color: #ffffff;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-nav-h .tcm-ai-step-pill.is-done {
  color: #5eead4;
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-sidebar {
  border-radius: 12px;
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-card .lead,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-main .lead {
  color: var(--tcm-muted);
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-sym-grid {
  background: transparent !important;
  border-top-color: rgba(0, 212, 255, 0.22);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-sym-chip {
  background: rgba(15, 35, 60, 0.9) !important;
  border-color: rgba(0, 212, 255, 0.38);
  color: #e2e8f0;
  border-radius: 999px;
  transition: border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-sym-chip:hover {
  border-color: rgba(0, 255, 255, 0.55);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.2);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-sym-chip.is-on {
  border-color: #2dd4bf;
  background: linear-gradient(135deg, #0d9488, #14b8a6) !important;
  color: #ffffff;
  font-weight: 650;
  box-shadow: 0 0 14px rgba(45, 212, 191, 0.32);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-sym-cat-toggle {
  color: #f0f9ff;
  background: rgba(0, 212, 255, 0.06);
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-chat-scroll {
  background: rgba(4, 16, 32, 0.55) !important;
  color: var(--tcm-text);
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-msg-user,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-msg-asst {
  background: rgba(8, 28, 52, 0.82);
  border-color: rgba(0, 212, 255, 0.28);
  color: var(--tcm-text);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-md-h3,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-md-h4 {
  color: #f0f9ff;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-md-body,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-md-p {
  color: var(--tcm-text);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-md-table-pre {
  background: rgba(4, 16, 32, 0.75);
  color: #e2e8f0;
  border-color: rgba(0, 212, 255, 0.25);
}

.tcm-hud-shell #tcm-ai-pane details.tcm-ai-peer-round {
  background: rgba(8, 28, 52, 0.82);
  border-color: rgba(0, 212, 255, 0.28);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-peer-round-sum {
  background: rgba(0, 212, 255, 0.06);
  color: var(--tcm-text);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-peer-round-sum-label {
  color: #f0f9ff;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-peer-think {
  background: rgba(4, 16, 32, 0.65);
  border-color: rgba(148, 163, 184, 0.35);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-peer-think-sum {
  color: #cbd5e1;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-think-pre {
  color: var(--tcm-muted);
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-tier-intro {
  background: rgba(8, 28, 52, 0.78);
  border-color: rgba(0, 212, 255, 0.28);
  border-radius: 12px;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-tier-intro-card {
  background: rgba(4, 16, 32, 0.72);
  border-color: rgba(0, 212, 255, 0.22);
  color: var(--tcm-text);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-tier-intro-list {
  color: var(--tcm-muted);
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-demo-fields,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-research-sweep,
.tcm-hud-shell #tcm-ai-pane details.tcm-ai-intake-sup,
.tcm-hud-shell #tcm-ai-pane details.tcm-ai-md-section {
  background: rgba(8, 28, 52, 0.78) !important;
  border-color: rgba(0, 212, 255, 0.28) !important;
  color: var(--tcm-text);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-intake-gap-cat li,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-intake-gap-cat-title {
  color: var(--tcm-text);
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-renji-herb-strip,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-renji-mod-chip,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-renji-acu-panel {
  background: rgba(4, 16, 32, 0.72) !important;
  border-color: rgba(0, 212, 255, 0.25);
  color: var(--tcm-text);
}

.tcm-hud-shell #tcm-ai-pane .tcm-clinical-patho-card,
.tcm-hud-shell #tcm-ai-pane .tcm-clinical-formula-card {
  background: rgba(8, 28, 52, 0.88) !important;
  border-color: rgba(0, 212, 255, 0.35) !important;
  border-radius: 12px;
}
.tcm-hud-shell #tcm-ai-pane .tcm-clinical-patho-card .patho-body,
.tcm-hud-shell #tcm-ai-pane .tcm-clinical-formula-card .formula-name {
  color: var(--tcm-text);
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-peer-chat-empty,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-peer-chat-progress {
  background: rgba(8, 28, 52, 0.82) !important;
  border-color: rgba(0, 212, 255, 0.28) !important;
  color: var(--tcm-text);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-peer-chat-progress-title {
  color: #f0f9ff;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-peer-chat-progress-body,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-peer-chat-progress-foot {
  color: var(--tcm-muted);
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-selected-summary {
  background: rgba(4, 16, 32, 0.65);
  color: var(--tcm-muted);
  border-radius: 12px;
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-main .tcm-ai-card,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-main .tcm-ai-step-card {
  border-radius: 12px;
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-status.ok {
  color: #6ee7b7;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-patient-delivery-body .tcm-ai-patient-delivery-warn {
  background: rgba(120, 53, 15, 0.45);
  border-color: rgba(251, 191, 36, 0.55);
  color: #fde68a;
}

/* ========== hud-mobile-fix-2026-06-02: 辨证嵌入区移动端整页滚动（配合宿主 tcm.html） ========== */
@media (max-width: 920px) {
  .tcm-hud-shell #tcm-ai-pane.tcm-ai-root,
  #tcm-ai-pane.tcm-ai-root {
    min-height: 0;
    height: auto;
    overflow: visible;
  }
  #tcm-ai-pane .tcm-ai-layout {
    gap: 0.65rem;
  }
  #tcm-ai-pane .tcm-ai-main {
    min-width: 0;
    overflow: visible;
  }
  #tcm-ai-pane .tcm-ai-composer-shell {
    flex: none;
    min-height: 0;
    max-height: none !important;
    overflow: visible !important;
    -webkit-overflow-scrolling: touch;
  }
  #tcm-ai-pane .tcm-ai-chat-scroll {
    max-height: none !important;
    overflow: visible !important;
    -webkit-overflow-scrolling: touch;
  }
  #tcm-ai-pane .tcm-ai-step-panel[data-step="3"].is-visible .tcm-ai-step3-card {
    min-height: 0;
  }
  #tcm-ai-pane .tcm-ai-step-nav-h {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
  }
  #tcm-ai-pane .tcm-ai-step-nav-h .tcm-ai-step-pill {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0.42rem 0.75rem;
  }
  #tcm-ai-pane .tcm-ai-btn,
  #tcm-ai-pane .tcm-ai-voice-hold-btn,
  #tcm-ai-pane .tcm-ai-rec-main-btn {
    min-height: 44px;
  }
  #tcm-ai-pane .tcm-ai-rec-chip {
    min-height: 44px;
    padding: 0.35rem 0.7rem;
  }
  #tcm-ai-pane .tcm-ai-peer-round-sum {
    min-height: 44px;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
  }
  #tcm-ai-pane .tcm-ai-peer-voice-btn {
    min-height: 44px;
    min-width: 44px;
  }
}

/* ========== hud-premium-all-2026-06-02: 辨证嵌入 · 高端 glass · 步骤/表单/聊天气泡 ========== */
.tcm-hud-shell #tcm-ai-pane.tcm-ai-root,
.tcm-hud-shell #tcm-ai-pane.tcm-ai-premium {
  --tcm-panel: rgba(12, 28, 52, 0.75);
  --tcm-border: rgba(34, 211, 238, 0.22);
  --tcm-accent: #22d3ee;
  --tcm-accent-2: #0ea5e9;
  --tcm-radius: 14px;
  --tcm-transition: 0.2s ease;
}

@keyframes tcm-ai-page-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-panel.is-visible.tcm-page-enter {
  animation: tcm-ai-page-enter 0.3s ease forwards;
}
@media (prefers-reduced-motion: reduce) {
  .tcm-hud-shell #tcm-ai-pane .tcm-ai-step-panel.is-visible.tcm-page-enter {
    animation: none;
  }
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-nav-h {
  background: rgba(12, 28, 52, 0.72) !important;
  border: 1px solid rgba(34, 211, 238, 0.22) !important;
  border-radius: 999px !important;
  padding: 0.4rem 0.55rem !important;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35) !important;
  backdrop-filter: blur(12px);
  margin-bottom: 1.15rem;
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-nav-h .tcm-ai-step-pill {
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  transition: transform var(--tcm-transition), background var(--tcm-transition), box-shadow var(--tcm-transition);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-nav-h .tcm-ai-step-pill:hover:not(.is-current) {
  transform: translateY(-1px);
  background: rgba(34, 211, 238, 0.08);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-nav-h .tcm-ai-step-pill.is-current {
  background: linear-gradient(135deg, #0891b2, #22d3ee) !important;
  border-color: rgba(34, 211, 238, 0.5) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 16px rgba(34, 211, 238, 0.3) !important;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-nav-h .tcm-ai-step-pill.is-current .idx {
  background: rgba(255, 255, 255, 0.95) !important;
  color: #0e7490 !important;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-nav-h .tcm-ai-step-pill.is-done {
  background: rgba(34, 211, 238, 0.1) !important;
  color: #67e8f9 !important;
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-main .tcm-ai-step-card,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-main .tcm-ai-step-panel[data-step="1"] .tcm-ai-card,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-main .tcm-ai-card {
  background: rgba(12, 28, 52, 0.75) !important;
  border: 1px solid rgba(34, 211, 238, 0.22) !important;
  border-radius: 14px !important;
  padding: 1.5rem 1.65rem !important;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4) !important;
  backdrop-filter: blur(12px);
  transition: transform var(--tcm-transition), box-shadow var(--tcm-transition);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-main .tcm-ai-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 16px rgba(34, 211, 238, 0.08) !important;
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
  font-weight: 650;
  color: #94a3b8;
  margin-top: 1rem;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #f0f9ff;
  text-shadow: 0 0 20px rgba(34, 211, 238, 0.15);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-badge {
  background: rgba(34, 211, 238, 0.12);
  border-color: rgba(34, 211, 238, 0.35);
  color: #67e8f9;
  border-radius: 999px;
}

.tcm-hud-shell .tcm-ai-input,
.tcm-hud-shell .tcm-ai-select,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-textarea {
  background: rgba(4, 16, 32, 0.78) !important;
  border: 1px solid rgba(34, 211, 238, 0.22) !important;
  border-radius: 10px !important;
  color: #e8f4fc !important;
  padding: 0.58rem 0.78rem !important;
  font-size: 0.94rem;
  transition: border-color var(--tcm-transition), box-shadow var(--tcm-transition);
}
.tcm-hud-shell .tcm-ai-input:focus,
.tcm-hud-shell .tcm-ai-select:focus,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-textarea:focus {
  border-color: #22d3ee !important;
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15) !important;
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-btn {
  border-radius: 10px;
  min-height: 2.65rem;
  transition: transform var(--tcm-transition), box-shadow var(--tcm-transition), filter var(--tcm-transition);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-btn:not(.secondary):not(.ghost):hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(34, 211, 238, 0.35);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-btn.secondary,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-btn.ghost {
  background: rgba(34, 211, 238, 0.08) !important;
  border-color: rgba(34, 211, 238, 0.35) !important;
  color: #a5f3fc !important;
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-msg-user,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-msg--user {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.35), rgba(34, 211, 238, 0.22)) !important;
  border: 1px solid rgba(34, 211, 238, 0.35) !important;
  border-radius: 14px 14px 4px 14px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  padding: 0.75rem 1rem;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-msg-asst,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-msg--assistant {
  background: rgba(8, 24, 48, 0.88) !important;
  border: 1px solid rgba(34, 211, 238, 0.18) !important;
  border-radius: 14px 14px 14px 4px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  padding: 0.85rem 1.05rem;
  line-height: 1.68;
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-composer-shell,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-chat-scroll {
  border-radius: var(--tcm-radius);
  border-color: rgba(34, 211, 238, 0.2);
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-peer-chat-empty,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-empty-title {
  border-radius: var(--tcm-radius);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-empty-icon {
  font-size: 2.25rem;
  filter: drop-shadow(0 0 14px rgba(34, 211, 238, 0.5));
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-sym-chip {
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  transition: transform var(--tcm-transition), box-shadow var(--tcm-transition);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-sym-chip:hover {
  transform: translateY(-1px);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-sym-chip.is-on {
  background: linear-gradient(135deg, #0d9488, #14b8a6) !important;
  box-shadow: 0 4px 14px rgba(45, 212, 191, 0.3);
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-callout {
  border-radius: var(--tcm-radius);
  border-style: solid;
  background: rgba(34, 211, 238, 0.05);
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-banner {
  border-radius: var(--tcm-radius);
  backdrop-filter: blur(10px);
}

/* ========== hud-polish-2026-06-02: 第一步表单间距 · 主按钮 · 徽章统一 ========== */
#tcm-ai-pane .tcm-ai-step1-form > .tcm-ai-label:first-of-type {
  margin-top: 0.65rem;
}
#tcm-ai-pane .tcm-ai-step1-actions {
  margin-top: 1.5rem;
}
#tcm-ai-pane .tcm-ai-step-badge {
  color: #67e8f9;
  background: rgba(0, 212, 255, 0.12);
  border: 1px solid rgba(0, 212, 255, 0.35);
}
#tcm-ai-pane .tcm-ai-hint,
#tcm-ai-pane .tcm-ai-demo-lead,
#tcm-ai-pane .tcm-ai-status:not(.err) {
  color: #94a3b8;
}
#tcm-ai-pane .tcm-ai-card .lead {
  color: #94a3b8;
}
#tcm-ai-pane .tcm-ai-actions .tcm-ai-btn:not(.secondary):not(.ghost) {
  max-width: 320px;
}

/* ========== hud-nav-premium-2026-06-02: 步骤药丸 · 与侧栏 HUD 统一暗色玻璃 ========== */
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-nav-h .tcm-ai-step-pill {
  background: rgba(8, 20, 40, 0.72);
  border-color: rgba(0, 212, 255, 0.22);
  color: #94a3b8;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-nav-h .tcm-ai-step-pill .idx {
  background: rgba(0, 212, 255, 0.18);
  color: #cbd5e1;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-nav-h .tcm-ai-step-pill.is-current {
  background: linear-gradient(135deg, rgba(0, 153, 204, 0.95), rgba(0, 212, 255, 0.85)) !important;
  border-color: rgba(0, 255, 255, 0.55) !important;
  color: #f0f9ff !important;
  box-shadow: 0 0 18px rgba(0, 212, 255, 0.35) !important;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-nav-h .tcm-ai-step-pill.is-done {
  border-color: rgba(45, 212, 191, 0.35);
  background: rgba(45, 212, 191, 0.1);
  color: #99f6e4;
}

/* ========== hud-visual-refine-2026-06-04: 辨证嵌入与宿主 HUD 对齐 ========== */
.tcm-hud-shell #panel-diag-ai-service {
  border-radius: 12px;
  border-color: rgba(34, 211, 238, 0.16);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.32);
}
.tcm-hud-shell #panel-diag-ai-service .glass-panel__body,
.tcm-hud-shell #tcm-ai-pane.tcm-ai-root {
  padding: 0;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-card,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-card {
  border-radius: 12px;
  border-color: rgba(34, 211, 238, 0.16) !important;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.28) !important;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-card:hover,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.32), 0 0 20px rgba(34, 211, 238, 0.06) !important;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-title,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-main h3 {
  text-shadow: none;
  font-size: 1.0625rem;
  font-weight: 600;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-step-nav-h .tcm-ai-step-pill.is-current {
  background: rgba(34, 211, 238, 0.2) !important;
  border-color: rgba(34, 211, 238, 0.4) !important;
  box-shadow: none !important;
  color: #e0f2fe !important;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-btn:not(.secondary):not(.ghost) {
  background: rgba(34, 211, 238, 0.18);
  border-color: rgba(34, 211, 238, 0.35);
  box-shadow: none;
  font-weight: 600;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-btn:not(.secondary):not(.ghost):hover {
  background: rgba(34, 211, 238, 0.28);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.15);
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-peer-chat-empty,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-renji-empty {
  border-radius: 12px;
  border: 1px dashed rgba(34, 211, 238, 0.22);
  background: rgba(4, 16, 32, 0.45);
  padding: 1.5rem 1rem;
  text-align: center;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-empty-title {
  font-size: 0.9375rem;
  font-weight: 650;
  text-shadow: none;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-empty-desc {
  font-size: 0.8125rem;
  line-height: 1.65;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}
.tcm-hud-shell #tcm-ai-pane .tcm-ai-chat-scroll,
.tcm-hud-shell #tcm-ai-pane .tcm-ai-composer-shell {
  scrollbar-width: thin;
  scrollbar-color: rgba(34, 211, 238, 0.28) transparent;
}
.tcm-hud-shell .tcm-diag-access-toolbar {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid rgba(34, 211, 238, 0.12);
  gap: 0.75rem;
}

/* ========== mobile-voice-ux-2026-06-08: 语音按钮录音态 · 追问区触控 ========== */
@media (max-width: 768px) {
  #tcm-ai-pane .tcm-ai-composer-send {
    position: relative;
    z-index: 2;
    touch-action: manipulation;
  }

  #tcm-ai-pane .tcm-ai-peer-voice-btn.is-recording {
    animation: tcm-ai-voice-rec-pulse 1.1s ease-in-out infinite;
  }
}

@keyframes tcm-ai-voice-rec-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 2px rgba(180, 35, 24, 0.12);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.22);
  }
}

@media (prefers-reduced-motion: reduce) {
  #tcm-ai-pane .tcm-ai-peer-voice-btn.is-recording {
    animation: none;
  }
}

/* ========== reverify-ui-fix-2026-06-08: 重跑合议/终检 · 加载区可见、footer 不叠挡 ========== */

#tcm-ai-pane .tcm-ai-peer-chat-progress,
#tcm-ai-pane .tcm-ai-peer-verify-rerun-status:not([hidden]) {
  scroll-margin-top: calc(4.5rem + env(safe-area-inset-top, 0px));
  scroll-margin-bottom: calc(11rem + env(safe-area-inset-bottom, 0px));
}

#tcm-ai-pane.tcm-ai-peer-rerun-active .tcm-ai-composer-footer {
  z-index: auto;
  box-shadow: none;
}

@media (max-width: 768px) {
  #tcm-ai-pane.tcm-ai-peer-rerun-active .tcm-ai-peer-chat-progress {
    min-height: 6.5rem;
  }

  #tcm-ai-pane.tcm-ai-peer-rerun-active .tcm-ai-composer-footer {
    position: relative;
    z-index: auto;
  }
}

/* ========== mobile-layout-fix-2026-06-07: 第三步嵌入 · 窄屏单列无叠挡 ========== */

#tcm-ai-pane .tcm-ai-peer-voice-err {
  display: none;
  margin: 0 0 0.45rem;
  padding: 0.38rem 0.55rem;
  border-radius: var(--tcm-radius-sm);
  border: 1px solid rgba(252, 165, 165, 0.65);
  background: rgba(254, 242, 242, 0.96);
  color: #991b1b;
  font-size: 0.8rem;
  line-height: 1.4;
  flex-shrink: 0;
}

#tcm-ai-pane .tcm-ai-peer-voice-err:not([hidden]) {
  display: block;
}

.tcm-hud-shell #tcm-ai-pane .tcm-ai-peer-voice-err:not([hidden]) {
  background: rgba(127, 29, 29, 0.55);
  border-color: rgba(252, 165, 165, 0.45);
  color: #fecaca;
}

#tcm-ai-pane .tcm-ai-patient-delivery-banner-dismiss {
  flex-shrink: 0;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0 0.45rem;
  margin: 0;
  line-height: 1;
  font-size: 1.15rem;
  border-radius: 8px;
}

@media (max-width: 768px) {
  #tcm-ai-pane.tcm-ai-root {
    --tcm-ai-chat-scroll-min-h: min(12rem, 40vh);
    --tcm-ai-ctx-sheet-body-min-h: min(9rem, 28vh);
  }

  #tcm-ai-pane .tcm-ai-step-panel[data-step="3"].is-visible .tcm-ai-step3-card {
    min-height: 0;
    padding-bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
  }

  #tcm-ai-pane .tcm-ai-composer-shell {
    flex: none;
    flex-shrink: 0;
    min-height: 0;
    max-height: none !important;
    overflow: visible !important;
  }

  #tcm-ai-pane .tcm-ai-chat-scroll {
    flex: none;
    min-height: 0;
    max-height: none !important;
    overflow: visible !important;
    padding-bottom: 0.5rem;
  }

  #tcm-ai-pane details.tcm-ai-ctx-sheet[open] > .tcm-ai-ctx-sheet-body {
    min-height: min(9rem, 28vh);
    max-height: min(40vh, 18rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #tcm-ai-pane .tcm-ai-patient-delivery-body,
  #tcm-ai-pane .tcm-ai-patient-delivery--bottom-secondary .tcm-ai-patient-delivery-body {
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  #tcm-ai-pane .tcm-ai-composer-footer {
    position: relative;
    z-index: var(--tcm-z-sticky-footer);
    flex-shrink: 0;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    background: var(--tcm-panel);
  }

  #tcm-ai-pane .tcm-ai-patient-delivery-banner:not([hidden]) {
    position: fixed;
    top: max(0.45rem, env(safe-area-inset-top, 0px));
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: calc(100% - 1rem);
    max-width: 22rem;
    z-index: var(--tcm-z-toast);
    margin: 0;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.22);
    pointer-events: auto;
  }

  #tcm-ai-pane .tcm-ai-patient-delivery-banner.is-loading:not([hidden]),
  #tcm-ai-pane .tcm-ai-patient-delivery-banner.is-error:not([hidden]),
  #tcm-ai-pane .tcm-ai-patient-delivery-banner.is-ready:not([hidden]),
  #tcm-ai-pane .tcm-ai-patient-delivery-banner.is-sup-regen-hint:not([hidden]) {
    flex-direction: row;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 0.45rem 0.5rem;
  }

  #tcm-ai-pane .tcm-ai-patient-delivery-banner.is-loading:not([hidden]) .tcm-ai-patient-delivery-banner-msg,
  #tcm-ai-pane .tcm-ai-patient-delivery-banner.is-error:not([hidden]) .tcm-ai-patient-delivery-banner-msg {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.78rem;
    line-height: 1.35;
    max-height: 4.5rem;
    overflow-y: auto;
  }

  #tcm-ai-pane .tcm-ai-patient-delivery-banner.is-ready:not([hidden]) .tcm-ai-patient-delivery-banner-msg,
  #tcm-ai-pane .tcm-ai-patient-delivery-banner.is-sup-regen-hint:not([hidden]) .tcm-ai-patient-delivery-banner-msg {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.8rem;
    line-height: 1.35;
  }

  #tcm-ai-pane .tcm-ai-patient-delivery-banner.is-ready:not([hidden]) .tcm-ai-patient-delivery-banner-actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 0.35rem;
  }

  #tcm-ai-pane .tcm-ai-composer-footer #tcm-ai-peer-status {
    margin-bottom: 0.35rem;
    padding: 0.28rem 0.4rem;
    border-radius: 8px;
    background: color-mix(in srgb, var(--tcm-panel) 92%, var(--tcm-bg));
    font-size: 0.78rem;
    line-height: 1.35;
  }

  #tcm-ai-pane .tcm-ai-composer-ft-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }

  #tcm-ai-pane .tcm-ai-composer-ft-btn,
  #tcm-ai-pane .tcm-ai-peer-quick {
    width: 100%;
  }

  #tcm-ai-pane .tcm-ai-peer-quick {
    flex-direction: column;
    align-items: stretch;
  }

  #tcm-ai-pane .tcm-ai-chip-btn {
    width: 100%;
    text-align: center;
    min-height: 44px;
  }

  #tcm-ai-pane .tcm-ai-composer-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
  }

  #tcm-ai-pane .tcm-ai-composer-bar .tcm-ai-composer-side {
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
  }

  #tcm-ai-pane .tcm-ai-composer-send {
    align-self: auto;
    flex: 1 1 auto;
    min-height: 44px;
    max-width: none;
  }

  #tcm-ai-pane .tcm-ai-peer-compose-input {
    min-height: 4.25rem;
  }

  #tcm-ai-pane .tcm-ai-wb-actions-bottom {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
    margin-top: 0.75rem;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  #tcm-ai-pane .tcm-ai-wb-actions-bottom .tcm-ai-btn,
  #tcm-ai-pane.tcm-ai-ref-clone .tcm-ai-wb-actions-bottom .tcm-ai-btn {
    width: 100%;
    max-width: none;
  }

  #tcm-ai-pane .tcm-ai-doctor-workspace-toolbar,
  #tcm-ai-pane .tcm-ai-patient-delivery-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  #tcm-ai-pane .tcm-ai-doctor-workspace-toolbar .tcm-ai-btn,
  #tcm-ai-pane .tcm-ai-patient-delivery-toolbar .tcm-ai-btn {
    width: 100%;
    max-width: none;
  }

  #tcm-ai-pane .tcm-ai-wb-actions-top {
    flex-direction: column;
    align-items: stretch;
  }

  #tcm-ai-pane .tcm-ai-wb-actions-top .tcm-ai-btn {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 480px) {
  #tcm-ai-pane .tcm-ai-patient-delivery-banner:not([hidden]) {
    width: calc(100% - 0.75rem);
    max-width: none;
  }

  #tcm-ai-pane .tcm-ai-composer-footer {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  #tcm-ai-pane .tcm-ai-chat-scroll {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  #tcm-ai-pane .tcm-ai-ctx-sheet-sum {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}

/* ========== mobile-opt-2026-06-09: 第三步嵌入 · 390px 触控/安全区/去嵌套滚动 ========== */
@media (max-width: 768px) {
  #tcm-ai-pane.tcm-ai-root {
    font-size: max(14px, 0.9375rem);
  }

  .tcm-ai-asr-confirm-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .tcm-ai-asr-confirm-card {
    width: 100%;
    max-width: none;
    border-radius: 14px 14px 0 0;
    padding-bottom: calc(1.15rem + env(safe-area-inset-bottom, 0px));
  }

  .tcm-ai-asr-confirm-actions .tcm-ai-btn {
    min-height: 44px;
    touch-action: manipulation;
  }

  #tcm-ai-pane .tcm-ai-hint,
  #tcm-ai-pane .tcm-ai-status,
  #tcm-ai-pane .tcm-ai-label {
    font-size: max(14px, 0.875rem);
  }

  #tcm-ai-pane .tcm-ai-peer-compose-input,
  #tcm-ai-pane .tcm-ai-textarea,
  #tcm-ai-pane .tcm-ai-input,
  #tcm-ai-pane .tcm-ai-select {
    font-size: 16px;
  }

  #tcm-ai-pane .tcm-ai-step-panel[data-step="3"].is-visible .tcm-ai-step3-card {
    scroll-padding-top: calc(3.25rem + env(safe-area-inset-top, 0px));
    scroll-padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  }

  #tcm-ai-pane .tcm-ai-patient-delivery,
  #tcm-ai-pane #tcm-ai-patient-delivery-wrap {
    scroll-margin-top: 0.75rem;
    scroll-margin-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
  }

  #tcm-ai-pane .tcm-ai-patient-delivery > summary,
  #tcm-ai-pane .tcm-ai-md-section-sum,
  #tcm-ai-pane .tcm-ai-ctx-sheet-sum {
    min-height: 44px;
    display: flex;
    align-items: center;
    touch-action: manipulation;
  }

  #tcm-ai-pane .tcm-ai-patient-delivery-body,
  #tcm-ai-pane .tcm-ai-patient-delivery--bottom-secondary .tcm-ai-patient-delivery-body,
  #tcm-ai-pane .tcm-ai-patient-delivery--doctor .tcm-ai-patient-delivery-body {
    min-height: 0;
    max-height: none;
    overflow: visible;
    overscroll-behavior: auto;
    font-size: max(14px, 0.9rem);
  }

  #tcm-ai-pane .tcm-ai-composer-shell {
    overflow: visible !important;
  }

  #tcm-ai-pane .tcm-ai-chat-scroll {
    min-height: 0;
    padding-bottom: 0.65rem;
  }

  #tcm-ai-pane .tcm-ai-composer-footer {
    position: relative;
    z-index: var(--tcm-z-sticky-footer);
    box-shadow: none;
  }

  #tcm-ai-pane .tcm-ai-patient-delivery-banner:not([hidden]) {
    top: max(0.45rem, env(safe-area-inset-top, 0px));
  }

  #tcm-ai-pane .tcm-ai-patient-delivery-toolbar-toast:not([hidden]) {
    flex: 1 1 100%;
    width: 100%;
    order: -1;
    padding: 0.38rem 0.5rem;
    border-radius: 8px;
    background: color-mix(in srgb, var(--tcm-panel) 92%, var(--tcm-bg));
    font-size: max(14px, 0.875rem);
    line-height: 1.4;
  }

  #tcm-ai-pane .tcm-ai-doctor-workspace-toolbar,
  #tcm-ai-pane .tcm-ai-patient-delivery-toolbar {
    gap: 0.5rem;
  }

  #tcm-ai-pane .tcm-ai-doctor-workspace-toolbar .tcm-ai-btn,
  #tcm-ai-pane .tcm-ai-patient-delivery-toolbar .tcm-ai-btn,
  #tcm-ai-pane .tcm-ai-toolbar-btn {
    min-height: 44px;
    touch-action: manipulation;
  }

  #tcm-ai-pane details.tcm-ai-ctx-sheet[open] > .tcm-ai-ctx-sheet-body {
    max-height: min(36vh, 16rem);
  }

  #tcm-ai-pane .tcm-ai-peer-voice-err:not([hidden]) {
    font-size: max(14px, 0.875rem);
  }

  #tcm-ai-pane .tcm-ai-peer-voice-btn {
    min-width: 44px;
    min-height: 44px;
    touch-action: manipulation;
  }
}

@media (max-width: 480px) {
  #tcm-ai-pane .tcm-ai-step-nav-h .tcm-ai-step-pill {
    font-size: max(13px, 0.78rem);
    padding: 0.38rem 0.65rem;
  }

  #tcm-ai-pane .tcm-ai-composer-footer {
    padding-left: max(0.65rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.65rem, env(safe-area-inset-right, 0px));
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }

  #tcm-ai-pane .tcm-ai-patient-delivery-banner:not([hidden]) {
    width: calc(100% - 0.75rem - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
    max-width: none;
  }

  #tcm-ai-pane details.tcm-ai-ctx-sheet[open] > .tcm-ai-ctx-sheet-body {
    max-height: min(32vh, 14rem);
  }

  #tcm-ai-pane .tcm-ai-composer-bar .tcm-ai-composer-side {
    flex-wrap: wrap;
    justify-content: stretch;
  }

  #tcm-ai-pane .tcm-ai-peer-voice-btn,
  #tcm-ai-pane .tcm-ai-composer-send {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #tcm-ai-pane .tcm-ai-chat-scroll {
    scroll-behavior: auto;
  }
  #tcm-ai-pane .tcm-ai-peer-voice-btn.is-recording {
    animation: none;
  }
}
