/* ── 全局主题与设计系统（现代临床医疗工作台风格）────────────────────── */

:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-subtle: #f1f5f9;
  --ink: #0f172a;
  --ink-soft: #475569;
  --ink-muted: #94a3b8;
  --line: #e2e8f0;
  --line-subtle: #f1f5f9;

  /* 警示与级别语义色 */
  --l1: #dc2626;
  --l1-bg: #fef2f2;
  --l1-border: #fecaca;
  --l2: #ea580c;
  --l2-bg: #fff7ed;
  --l2-border: #fed7aa;
  --l3: #16a34a;
  --l3-bg: #f0fdf4;
  --l3-border: #bbf7d0;

  /* 泳道与功能色 */
  --anchor: #7c3aed;
  --lane-1: #2563eb;
  --lane-2: #8b5cf6;
  --lane-3: #ea580c;
  --lane-4: #0d9488;
  --lane-5: #be185d;
  --unconfirmed: #94a3b8;

  /* 布局圆角与阴影 */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.05), 0 1px 2px -1px rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14.5px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* 医生工作台顶通视口约束 */
body.doctor-dashboard {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* 顶部演示横幅：克制琥珀色 */
.demo-notice {
  background: #fffbeb;
  border-bottom: 1px solid #fef08a;
  color: #92400e;
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 20px;
  text-align: center;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

/* ── 顶部 Patient Banner ────────────────────────────────────────── */
.patient-banner {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  padding: 10px 24px;
}

.patient-identity {
  align-items: center;
  display: flex;
  gap: 12px;
}

.patient-avatar-badge {
  background: #e0e7ff;
  border-radius: var(--radius-sm);
  color: #3730a3;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 7px;
}

.patient-titles {
  align-items: baseline;
  display: flex;
  gap: 10px;
}
.patient-titles h1 {
  color: var(--ink);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}
.patient-titles .sub {
  color: var(--ink-soft);
  font-size: 13px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 2px 8px;
}

.banner-right-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.btn-drawer-trigger {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.03);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 600;
  gap: 6px;
  padding: 6px 12px;
  transition: all 0.15s ease;
}
.btn-drawer-trigger:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: var(--lane-1);
}
.btn-drawer-trigger .btn-icon { font-size: 13.5px; }

/* ── 一屏全览主工作区 ────────────────────────────────────────────── */
.dashboard-viewport {
  display: grid;
  flex: 1;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) 350px;
  min-height: 0;
  overflow: hidden;
  padding: 14px 20px 16px;
}

@media (max-width: 1100px) {
  body.doctor-dashboard {
    height: auto;
    overflow: auto;
  }
  .dashboard-viewport {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    overflow: visible;
  }
}

.main-stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.panel.timeline-card {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 16px 18px;
}

.panel-header {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 10px;
}
.panel-header h2 {
  margin: 0;
}

.timeline-zoom-controls {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}
.zoom-label {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
}
.zoom-btn-group {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  display: inline-flex;
  padding: 2px;
}
.zoom-btn {
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  transition: all 0.15s ease;
}
.zoom-btn:hover {
  color: var(--ink);
}
.zoom-btn.active {
  background: #ffffff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
  color: var(--lane-1);
}

.sidebar-stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.panel.stream-panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}

.stream-section h2 {
  align-items: baseline;
  color: var(--ink);
  display: flex;
  font-size: 14.5px;
  font-weight: 700;
  gap: 6px;
  margin: 0 0 10px;
}

.stream-section h2 .hint {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: normal;
}

.stream-divider {
  background: #f1f5f9;
  height: 1px;
  margin: 2px 0;
}

/* 兼容原有 .layout 类 */
.layout {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) 340px;
  padding: 0 28px 36px;
}

/* 沉稳面板通用 */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
}

.panel h2 {
  align-items: baseline;
  color: var(--ink);
  display: flex;
  flex-wrap: wrap;
  font-size: 16px;
  font-weight: 700;
  gap: 8px;
  margin: 0 0 12px;
}

.panel h2 .hint {
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: normal;
}

/* ── 顶部仪表盘式关键指标行（Summary Bar）────────────────────────── */
.summary {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 12px;
  padding: 8px 10px;
}

.summary span {
  align-items: center;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.02);
  color: var(--ink);
  display: flex;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
}

.summary span.flag {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #c2410c;
}

/* ── 时间线 SVG 容器 ───────────────────────────────────────────── */
.timeline-wrap {
  background: #ffffff;
  border: 1px solid #f1f5f9;
  border-radius: var(--radius-md);
  flex: 1;
  min-height: 380px;
  overflow: auto;
  padding: 4px;
}

svg.timeline { display: block; min-width: 940px; }
svg.timeline .lane-band { fill: #fcfdfe; }
svg.timeline .lane-band.alt { fill: #f8fafc; }
svg.timeline .lane-label { font-size: 14px; font-weight: 600; }
svg.timeline .axis-line { stroke: #cbd5e1; stroke-width: 1; }
svg.timeline .tick-label { fill: #64748b; font-size: 13px; }
svg.timeline .lane-rule { stroke: #e2e8f0; stroke-width: 1; }

svg.timeline .anchor-line {
  stroke: var(--anchor);
  stroke-dasharray: 5 4;
  stroke-width: 1.6;
}
svg.timeline .anchor-label {
  fill: var(--anchor);
  font-size: 13px;
  font-weight: 700;
}

svg.timeline .ev-bar { rx: 5; }
svg.timeline .ev-dot { stroke: #fff; stroke-width: 2; }
svg.timeline .ev-label { font-size: 14px; }
svg.timeline .ev-label.muted { fill: var(--unconfirmed); }

svg.timeline .unconfirmed .ev-dot,
svg.timeline .unconfirmed .ev-bar {
  fill: #fff;
  stroke: var(--unconfirmed);
  stroke-dasharray: 4 3;
  stroke-width: 2;
}

/* 事件可点：完整标题、剂量、来源与确认状态在下方面板 */
svg.timeline .event { cursor: pointer; }
svg.timeline .event:focus { outline: none; }
svg.timeline .event:hover .ev-label,
svg.timeline .event:focus-visible .ev-label { text-decoration: underline; }
svg.timeline .event:focus-visible .ev-dot { stroke: var(--ink); stroke-width: 3; }

/* 新录入/补录事件温和高亮呼吸，方便演示时定位 */
svg.timeline .event.event-fresh .ev-dot {
  stroke: #2563eb;
  stroke-width: 3.5;
  filter: drop-shadow(0 0 5px rgba(37, 99, 235, 0.7));
}
svg.timeline .event.event-fresh .ev-label {
  font-weight: 700;
  fill: #1d4ed8;
}

.timeline-detail {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: flex;
  flex-shrink: 0;
  gap: 12px;
  justify-content: space-between;
  margin-top: 8px;
  padding: 8px 10px;
}
.timeline-detail[hidden] { display: none; }
.timeline-detail .detail-body { min-width: 0; }
.timeline-detail .detail-head {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  font-size: 14px;
  gap: 8px;
}
.timeline-detail .detail-lane {
  border: 1px solid;
  border-radius: 999px;
  font-size: 11.5px;
  padding: 1px 8px;
  white-space: nowrap;
}
.timeline-detail .detail-row {
  color: var(--ink-soft);
  font-size: 12.5px;
  margin-top: 3px;
}
.timeline-detail .detail-note { color: var(--ink); }
.timeline-detail .detail-unconfirmed { color: var(--unconfirmed); font-weight: 600; }
.timeline-detail .detail-close { flex-shrink: 0; font-size: 12px; padding: 3px 10px; }

.legend {
  border-top: 1px solid #f1f5f9;
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  font-size: 12.5px;
  gap: 8px 16px;
  margin-top: 10px;
  padding-top: 8px;
}
.legend span {
  align-items: center;
  display: inline-flex;
}
.legend i {
  border-radius: 50%;
  display: inline-block;
  height: 9px;
  margin-right: 6px;
  width: 9px;
}
.legend .dashed {
  background: #fff;
  border: 1.5px dashed var(--unconfirmed);
  border-radius: 3px;
  height: 9px;
  margin-right: 6px;
  width: 13px;
}

/* ── 抽屉式侧滑面板（Drawer）──────────────────────────────────── */
.drawer-backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: fixed;
  transition: opacity 0.25s ease;
  z-index: 998;
}
.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer-slide {
  background: #ffffff;
  bottom: 0;
  box-shadow: -4px 0 28px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  max-width: 640px;
  position: fixed;
  right: -680px;
  top: 0;
  transition: right 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  width: 88vw;
  z-index: 999;
}
.drawer-slide.open {
  right: 0;
}

.drawer-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 16px 22px;
}
.drawer-title-group h2 {
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  margin: 4px 0 0;
}
.drawer-title-group h2 .hint {
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: normal;
  margin-left: 6px;
}
.drawer-badge {
  background: #f1f5f9;
  border-radius: 4px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
}

.drawer-close {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  font-size: 14px;
  height: 30px;
  justify-content: center;
  transition: all 0.15s ease;
  width: 30px;
}
.drawer-close:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
}

/* ── 症状分级表（三级阶梯卡片）──────────────────────────────────── */
.grading-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.grading-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.grading-card.lv1 { background: #fffcfc; border-left: 4px solid var(--l1); }
.grading-card.lv2 { background: #fffdfb; border-left: 4px solid var(--l2); }
.grading-card.lv3 { background: #fbfdfc; border-left: 4px solid var(--l3); }

.grading-card-head {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.grading-badge {
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
}
.grading-badge.lv1 { background: var(--l1); }
.grading-badge.lv2 { background: var(--l2); }
.grading-badge.lv3 { background: var(--l3); }

.grading-action {
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
}

.grading-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
}

.symptom-tag {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 12.5px;
  padding: 3px 8px;
}
.grading-card.lv1 .symptom-tag { background: #fee2e2; border-color: #fecaca; color: #991b1b; }
.grading-card.lv2 .symptom-tag { background: #ffedd5; border-color: #fed7aa; color: #9a3412; }
.grading-card.lv3 .symptom-tag { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }

.provenance {
  background: #f8fafc;
  border-left: 3px solid var(--lane-1);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-soft);
  font-size: 13px;
  margin-bottom: 12px;
  padding: 8px 12px;
}

/* ── 实时上报与主动问询卡片 ──────────────────────────────────────── */
.report-list { display: flex; flex-direction: column; gap: 10px; }

.report {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--ink-soft);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.02);
  padding: 10px 12px;
}
.report.l1 { background: #fffcfc; border-left-color: var(--l1); }
.report.l2 { background: #fffdfa; border-left-color: var(--l2); }
.report.l3 { border-left-color: var(--l3); }
.report.l0 { border-left-color: #94a3b8; }

.report .badge {
  border-radius: 4px;
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 7px;
}
.report.l1 .badge { background: var(--l1); }
.report.l2 .badge { background: var(--l2); }
.report.l3 .badge { background: var(--l3); }
.report.l0 .badge { background: #64748b; }

.report .names {
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  margin: 5px 0 2px;
}

.report .when {
  color: var(--ink-muted);
  font-size: 11.5px;
  margin-top: 5px;
}

.report .combo {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  color: #334155;
  font-size: 12px;
  margin-top: 5px;
  padding: 5px 8px;
}
.report .combo.note-box {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #1e293b;
}

.tag-pill {
  border-radius: 4px;
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 7px;
}
.tag-positive { background: #fee2e2; color: #991b1b; }
.tag-change { background: #ffedd5; color: #9a3412; }
.tag-unknown { background: #fef3c7; color: #92400e; }

.missing-details { margin-top: 5px; }
.missing-details summary {
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 12px;
  user-select: none;
}
.missing-details summary:hover { color: var(--ink); }
.missing-tag-cloud {
  background: #f8fafc;
  border-radius: var(--radius-sm);
  color: #64748b;
  font-size: 11.5px;
  line-height: 1.5;
  margin-top: 4px;
  padding: 5px 8px;
}

@keyframes flash {
  from { background: #fff3cd; }
  to { background: #ffffff; }
}
.report.fresh { animation: flash 2.5s ease-out; }

.empty { color: var(--ink-muted); font-size: 13px; padding: 10px 0; }

/* ── 指南对照（链路 D）──────────────────────────────────────────── */
.guideline-picker {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.guideline-picker label { color: var(--ink-soft); font-size: 13.5px; }
.guideline-picker select {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  padding: 5px 10px;
}

.guideline-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}
.guideline-list li {
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  padding: 8px 12px;
}
.guideline-list .cat {
  color: var(--lane-1);
  font-size: 12px;
  font-weight: 600;
  margin-right: 6px;
}
.guideline-list .src {
  color: var(--ink-muted);
  font-size: 11.5px;
  margin-left: 4px;
}

/* ── 通用按钮 ──────────────────────────────────────────────────── */
button.primary {
  background: var(--lane-1);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  cursor: pointer;
  font-size: 17px;
  font-weight: 600;
  margin-top: 18px;
  padding: 14px;
  transition: background 0.15s ease;
  width: 100%;
}
button.primary:hover:not(:disabled) { background: #1d4ed8; }
button.primary:disabled { background: #94a3b8; cursor: not-allowed; }

button.ghost {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  transition: all 0.15s ease;
}
button.ghost:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

/* ── 患者端（手机端）───────────────────────────────────────────── */
.phone {
  margin: 0 auto;
  max-width: 520px;
  padding: 0 16px 40px;
}

.phone h1 { font-size: 22px; font-weight: 700; }
.phone p.lead { color: var(--ink-soft); font-size: 15px; }

.symptom-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.symptom {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 16px;
  padding: 12px 10px;
  text-align: center;
  transition: all 0.15s ease;
  user-select: none;
}
.symptom:hover { border-color: #94a3b8; }
.symptom[aria-pressed="true"] {
  background: #eff6ff;
  border-color: var(--lane-1);
  color: var(--lane-1);
  font-weight: 600;
}

.result-card {
  border-radius: var(--radius-lg);
  color: #fff;
  margin: 18px 0;
  padding: 18px;
}
.result-card.l1 { background: var(--l1); }
.result-card.l2 { background: var(--l2); }
.result-card.l3 { background: var(--l3); }
.result-card.l0 { background: #64748b; }
.result-card .lv-name { font-size: 14px; opacity: .9; }
.result-card .action { font-size: 18px; font-weight: 600; margin-top: 6px; }
.result-card .why { font-size: 14px; margin-top: 10px; opacity: .95; }

.on-screen-note {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  color: #166534;
  font-size: 14px;
  padding: 10px 12px;
}

/* 自由文本 */
.free-text {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin-top: 16px;
  padding: 14px;
}
.free-text-head {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}
.free-text textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 15px;
  padding: 10px;
  width: 100%;
}

.map-result { margin-top: 12px; }
.map-result .confirm-head {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}
.map-result .quote { color: var(--ink-soft); font-size: 13px; }
.map-result .escalated {
  background: #fff7ed;
  border-radius: var(--radius-sm);
  color: #9a3412;
  font-size: 14px;
  padding: 9px 12px;
}

/* 追问 */
.followup-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  padding: 14px;
}
.followup-item .q { font-size: 17px; font-weight: 600; margin-bottom: 10px; }
.followup-item .choices { display: flex; gap: 10px; }
.followup-item .choices button { flex: 1; font-size: 16px; padding: 12px; }

.provenance-inline {
  color: var(--ink-soft);
  font-size: 13px;
  margin-top: 8px;
}

/* 补充病史：Tab 分栏与手动填空表单 */
.record-tabs {
  display: flex;
  gap: 6px;
  background: var(--panel-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 3px;
  margin: 14px 0 16px;
}
.record-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 4px;
  transition: all 0.15s ease;
  text-align: center;
}
.record-tab:hover {
  color: var(--ink);
}
.record-tab.active {
  background: #ffffff;
  color: var(--lane-1);
  box-shadow: var(--shadow-sm);
}

.record-tab-pane {
  display: none;
}
.record-tab-pane.active {
  display: block;
}

.manual-form {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 14px;
}
.manual-form-group {
  margin-bottom: 14px;
}
.manual-form-group label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.manual-form-group input,
.manual-form-group textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14.5px;
  font-family: inherit;
  transition: border-color 0.15s ease;
}
.manual-form-group input:focus,
.manual-form-group textarea:focus {
  outline: none;
  border-color: var(--lane-1);
}
.manual-form-group .hint {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 4px;
}

.quick-preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.quick-preset-chips .chip {
  background: var(--panel-subtle);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 12px;
  padding: 3px 10px;
  transition: all 0.15s ease;
}
.quick-preset-chips .chip:hover {
  background: #eff6ff;
  border-color: var(--lane-1);
  color: var(--lane-1);
}

/* 链路 A：上传病历 */
.sample-btn {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  font-size: 16px;
  gap: 12px;
  margin-bottom: 10px;
  padding: 10px;
  text-align: left;
  width: 100%;
}
.sample-btn img { border-radius: 6px; height: 68px; object-fit: cover; width: 54px; }
.sample-btn .hint { color: var(--ink-soft); display: block; font-size: 13px; }

.upload-label { cursor: pointer; display: block; margin-top: 4px; text-align: center; }

.rec-card {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  padding: 14px;
}
.rec-card.decided-confirm { border-color: var(--l3); }
.rec-card.decided-pending { border-color: var(--unconfirmed); border-style: dashed; }
.rec-card.decided-reject { background: #f1f2f4; opacity: .65; }
.rec-card .rec-head { color: var(--ink-soft); font-size: 13px; }
.rec-card .rec-title { font-size: 17px; font-weight: 600; margin: 4px 0 8px; }
.rec-card .rec-meta { font-size: 14px; }
.rec-card .rec-warn {
  background: #fff7ed;
  border-radius: var(--radius-sm);
  color: #9a3412;
  font-size: 13.5px;
  margin-top: 8px;
  padding: 8px 10px;
}
.rec-card select {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 15px;
  margin-top: 8px;
  padding: 8px;
  width: 100%;
}
.rec-card .choices { display: flex; gap: 8px; margin-top: 10px; }
.rec-card .choices button { flex: 1; font-size: 14px; padding: 9px 4px; }

label.upload-label.primary {
  background: var(--lane-1);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  margin-top: 18px;
  padding: 14px;
}

.hidden { display: none !important; }

/* ── 核心对话框（Chat Agent） ──────────────────────────────────── */
#step-chat {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 40px);
  max-height: 844px;
  position: relative;
}

.chat-header {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-shrink: 0;
  gap: 10px;
  justify-content: space-between;
  margin: 0 -16px;
  padding: 10px 16px;
}
.chat-title-group h1 {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}
.chat-subtitle {
  color: var(--ink-soft);
  font-size: 11.5px;
  margin-top: 2px;
}
.chat-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.chat-header-actions button.small {
  font-size: 12px;
  padding: 4px 7px;
}

/* 子界面统一顶部返回按钮 */
.back-to-chat {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 500;
  gap: 4px;
  margin: 10px 0 14px;
  padding: 6px 12px;
  transition: all 0.15s ease;
}
.back-to-chat:hover {
  background: var(--panel-subtle);
  border-color: #cbd5e1;
  color: var(--lane-1);
}

.chat-messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  margin: 0 -16px;
  overflow-y: auto;
  padding: 14px 16px;
  -webkit-overflow-scrolling: touch;
}

.chat-time-divider {
  align-self: center;
  background: var(--panel-subtle);
  border: 1px solid var(--line-subtle);
  border-radius: 999px;
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 500;
  margin: 2px 0 4px;
  padding: 2px 10px;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
}
.chat-msg.agent {
  align-self: flex-start;
}
.chat-msg.user {
  align-self: flex-end;
}

.chat-bubble {
  border-radius: var(--radius-lg);
  font-size: 14.5px;
  line-height: 1.55;
  padding: 10px 13px;
  word-break: break-word;
}
.chat-msg.agent .chat-bubble {
  background: #ffffff;
  border: 1px solid var(--line);
  border-bottom-left-radius: 3px;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.03);
  color: var(--ink);
}
.chat-msg.user .chat-bubble {
  background: var(--lane-1);
  border-bottom-right-radius: 3px;
  color: #ffffff;
}

.chat-typing {
  color: var(--ink-muted);
  font-size: 13px;
  font-style: italic;
  padding: 6px 12px;
}

/* 气泡内嵌卡片：候选核对与每日简报 */
.chat-card {
  background: #ffffff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-top: 6px;
  padding: 12px 14px;
  width: 100%;
}
.chat-card.highlight {
  border-color: var(--lane-1);
  background: #fbfdff;
}
.chat-card-title {
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 700;
  margin-bottom: 4px;
}
.chat-card-desc {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 10px;
}
.chat-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chat-card-actions button {
  flex: 1;
  font-size: 13px;
  min-height: 36px;
  min-width: 72px;
  padding: 6px 10px;
}

.chat-card-badge {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  color: var(--lane-1);
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  padding: 3px 8px;
}

/* 答完后的结果卡：级别 → 动作 → 依据 → 保存状态，一屏内读完 */
.chat-result {
  border-radius: var(--radius-md);
  color: #ffffff;
  padding: 12px 14px;
}
.chat-result.l1 { background: var(--l1); }
.chat-result.l2 { background: var(--l2); }
.chat-result.l3 { background: var(--l3); }
.chat-result.l0 { background: #64748b; }
.chat-result-level {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  font-size: 15px;
  font-weight: 700;
  gap: 8px;
}
.chat-result-chip {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  font-size: 13px;
  padding: 2px 9px;
}
.chat-result-action {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  margin-top: 8px;
}
.chat-result-why {
  font-size: 12.5px;
  line-height: 1.5;
  margin-top: 8px;
  opacity: 0.95;
}
.chat-result-save {
  background: rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.5;
  margin-top: 10px;
  padding: 6px 9px;
}

/* 底部输入与快捷药丸 */
.chat-footer {
  background: #ffffff;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 8px;
  margin: 0 -16px;
  padding: 10px 16px 12px;
}
.chat-quick-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.chat-quick-chips::-webkit-scrollbar { display: none; }
.chat-quick-chips .chip {
  background: var(--panel-subtle);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  cursor: pointer;
  flex-shrink: 0;
  font-size: 12px;
  padding: 4px 10px;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.chat-quick-chips .chip:hover {
  background: #eff6ff;
  border-color: var(--lane-1);
  color: var(--lane-1);
}

.chat-input-row {
  align-items: flex-end;
  display: flex;
  gap: 8px;
}
.chat-input-row textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-sizing: border-box;
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  max-height: 80px;
  min-height: 40px;
  padding: 9px 12px;
  resize: none;
  width: 100%;
}
.chat-input-row textarea:focus {
  border-color: var(--lane-1);
  outline: none;
}
.chat-input-row button.primary {
  flex-shrink: 0;
  font-size: 14.5px;
  margin: 0;
  min-height: 40px;
  padding: 8px 18px;
  width: auto;
}

/* ── 主动问询 · 今日随访简报（对话流内嵌卡） ─────────────────────── */
/* 卡片外观统一走 .chat-card，这里只留简报卡里的进度条。 */
.elicit-track {
  background: var(--line);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
}
.elicit-fill {
  background: var(--lane-1);
  border-radius: 999px;
  height: 100%;
  transition: width 0.25s ease;
  width: 0;
}
.elicit-fill.done { background: var(--l3); }

/* 日历页底部的演示操作区：合成日期与历史排序都不进患者主视野。 */
.cal-demo {
  border-top: 1px dashed var(--line);
  color: var(--ink-soft);
  font-size: 13px;
  margin-top: 16px;
  padding-top: 10px;
}
.cal-demo > summary {
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 12.5px;
  user-select: none;
}
.cal-demo > summary:hover { color: var(--ink-soft); }
.cal-demo-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}
.cal-demo-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cal-demo-row label { font-size: 12.5px; }
.cal-demo-row input[type="date"] {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font: inherit;
  font-size: 12.5px;
  padding: 4px 6px;
}
.cal-demo-row button { font-size: 12.5px; padding: 5px 10px; }
.cal-demo-note {
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
}
.cal-demo-status {
  color: var(--lane-1);
  font-size: 12.5px;
  min-height: 18px;
}
.cal-demo-status:empty { display: none; }

/* ── 症状日历 · 按天回看 ────────────────────────────────────────── */
.cal-head {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin: 4px 0 10px;
}
.cal-head h1 { font-size: 18px; margin: 0; text-align: center; }
.cal-nav {
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1;
  padding: 5px 11px;
}

.cal-summary {
  background: var(--panel-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: 12.5px;
  margin-bottom: 10px;
  padding: 7px 10px;
}

.cal-weekdays {
  color: var(--ink-muted);
  display: grid;
  font-size: 11.5px;
  gap: 4px;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
  text-align: center;
}

.cal-grid {
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(7, 1fr);
}
.cal-cell {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
  display: flex;
  flex-direction: column;
  font-size: 12.5px;
  gap: 2px;
  justify-content: center;
  min-height: 40px;
  padding: 3px 0;
}
.cal-cell.blank { visibility: hidden; }
.cal-cell.future { opacity: .35; }
.cal-cell.has-data {
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
  cursor: pointer;
}
.cal-cell.has-data:hover { border-color: #94a3b8; }
.cal-cell.today { box-shadow: inset 0 0 0 1.5px var(--lane-1); }
.cal-cell.selected { border-color: var(--lane-1); background: #eff6ff; }

.cal-dot {
  border-radius: 50%;
  display: inline-block;
  height: 6px;
  width: 6px;
}
.cal-dot.l3 { background: var(--l3); }
.cal-dot.l2 { background: var(--l2); }
.cal-dot.l1 { background: var(--l1); }
.cal-dot.unknown { background: #f59e0b; }
.cal-dot.progress { background: var(--lane-1); }
.cal-dot.report { background: var(--lane-2); }
.cal-dot.none { background: var(--ink-muted); }

.cal-legend {
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  font-size: 11.5px;
  gap: 8px 12px;
  margin-top: 10px;
}
.cal-legend span { align-items: center; display: inline-flex; gap: 5px; }

.cal-detail {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  margin-top: 12px;
  padding: 12px 14px;
}
.cal-detail:empty { display: none; }
.cal-detail .cal-detail-title {
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 700;
  margin-bottom: 6px;
}
.cal-detail .cal-detail-row {
  border-top: 1px solid var(--line-subtle);
  color: var(--ink-soft);
  line-height: 1.5;
  margin-top: 6px;
  padding-top: 6px;
}
.cal-detail .cal-detail-row:first-of-type { border-top: none; margin-top: 0; }
.cal-detail .cal-detail-note {
  background: var(--panel-subtle);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 12.5px;
  padding: 6px 8px;
}
