/* ============================================================================
 * 安康智护（MedCare+）V2 用户端 H5 临床高定样式
 * 温润瓷白画布 · 极细边框纯白卡片 · 克制植物翠玉主色 · 瑞士医疗留白美学
 * ========================================================================== */

body {
  background: #ecefeb;
  min-height: 100vh;
}

.h5-shell {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg-canvas);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 1px rgba(17, 31, 27, 0.05), 0 18px 50px rgba(17, 31, 27, 0.06);
}

/* 顶部导航 */
.h5-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 58px;
  padding: 0 16px;
  background: rgba(244, 246, 245, 0.9);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.topbar-title {
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 4px 11px 4px 5px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 126px;
}

.profile-chip span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-avatar-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #6c7c77;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* 主滚动区 */
.h5-main {
  flex: 1;
  padding: 6px 14px 158px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

/* ===== 家庭成员切换条 ===== */
.member-switcher {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.member-switcher::-webkit-scrollbar {
  display: none;
}

.member-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
  transition: all var(--transition);
}

.member-pill.active {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: #fff;
}

.member-pill .rel {
  font-size: 10.5px;
  opacity: 0.72;
}

/* ===== 登录卡片 ===== */
.auth-card {
  margin-top: 10px;
  padding: 26px 20px 22px;
}

.auth-hero {
  text-align: center;
  margin-bottom: 22px;
}

.auth-hero h2 {
  margin: 10px 0 4px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.auth-hero p {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.seg-tabs {
  display: flex;
  background: var(--bg-muted);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
  margin-bottom: 16px;
}

.seg-tab {
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.seg-tab.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(17, 31, 27, 0.06);
}

.code-row {
  display: flex;
  gap: 8px;
}

.code-row .input {
  flex: 1;
}

.captcha-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.captcha-svg-box {
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  flex-shrink: 0;
  background: #f3f7f5;
  display: flex;
  align-items: center;
}

.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 12px 0 14px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.55;
  cursor: pointer;
}

.consent-check input {
  margin-top: 2px;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.portal-links-box {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.portal-links-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.portal-link-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.portal-link-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ===== 首页：个人健康概览 Hero 卡片 ===== */
.profile-hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.profile-hero-name {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.profile-hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 8px 0 18px;
  font-size: 13px;
  color: var(--text-secondary);
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.ring-progress-grid {
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
}

.radial-score-box {
  position: relative;
  width: 92px;
  height: 92px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radial-score-val {
  position: absolute;
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.progress-tracks {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.track-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.track-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  width: 58px;
  flex-shrink: 0;
}

.track-right {
  flex: 1;
}

.seg-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 3px;
}

.seg-dash {
  flex: 1;
  height: 4.5px;
  border-radius: 99px;
  background: #e1e7e4;
}

.seg-dash.done-indigo { background: var(--indigo); }
.seg-dash.done-emerald { background: var(--emerald); }
.seg-dash.done-rose { background: var(--rose); }

.track-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.hero-footer-strip {
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.hero-footer-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.hero-footer-val {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 1px;
}

/* ===== 通用模块化卡片头 ===== */
.section-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.section-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.section-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.section-card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

.section-card-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.pill-arrow {
  width: 36px;
  height: 26px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* 健康指标双列圆点矩阵 */
.biomarker-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px 14px;
  margin-top: 15px;
}

.bio-cat-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 6px;
  border-radius: 10px;
  cursor: pointer;
  transition: background var(--transition);
}

.bio-cat-row:hover {
  background: var(--bg-subtle);
}

.bio-cat-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bio-dots {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.bio-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dot-empty);
}

.bio-dot.ok { background: var(--dot-ok); }
.bio-dot.warn { background: var(--dot-warn); }

.bio-cat-legend {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* 用药 & 既往史精简行 */
.compact-list {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.compact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 11px;
  background: var(--bg-subtle);
}

/* ===== 悬浮底部在线客服快捷栏 ===== */
.floating-support-wrap {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 480px);
  padding: 0 12px;
  z-index: 45;
  pointer-events: none;
}

.floating-support-bar {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  border-radius: 20px;
  padding: 6px 7px 6px 14px;
  box-shadow: 0 4px 20px rgba(17, 31, 27, 0.08);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
}

.support-prompt-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  min-width: 0;
  padding: 4px 0;
}

.spark-icon {
  color: var(--primary);
  display: inline-flex;
  flex-shrink: 0;
}

.prompt-placeholder {
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.unread-dot-pill {
  background: var(--danger);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.support-voice-btn {
  width: 40px;
  height: 32px;
  border-radius: 99px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ===== 底部 5 槽导航栏 + 中央圆形 + FAB ===== */
.h5-tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 480px);
  height: 64px;
  padding: 0 8px env(safe-area-inset-bottom, 4px);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  z-index: 50;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 48px;
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 600;
  transition: all var(--transition);
}

.tab-item.active {
  color: var(--primary);
  background: var(--primary-tint);
}

.tab-fab-slot {
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab-fab {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-fab);
  transform: translateY(-5px);
  transition: transform var(--transition), background var(--transition);
}

.tab-fab:active {
  transform: translateY(-3px) scale(0.95);
}

/* ===== 辅助样式 ===== */
.pill-scroll {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.pill-scroll::-webkit-scrollbar { display: none; }

.filter-pill {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.stat-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.stat-mini {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}

.stat-mini-label {
  font-size: 11px;
  color: var(--text-muted);
}

.stat-mini-val {
  font-size: 15.5px;
  font-weight: 700;
  margin-top: 2px;
  color: var(--text-primary);
}

.doc-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.doc-item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.doc-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--bg-muted);
  color: var(--text-secondary);
}

.stepper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin: 14px 0;
}

.step-node {
  text-align: center;
}

.step-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  margin: 0 auto 4px;
  background: var(--bg-muted);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-node.done .step-dot {
  background: var(--primary);
  color: #fff;
}

.step-label {
  font-size: 11px;
  color: var(--text-muted);
}

.step-node.done .step-label {
  color: var(--primary);
  font-weight: 600;
}

/* 星级评价 */
.star-picker {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 10px 0 14px;
}

.star-btn {
  color: #d4dcd9;
  padding: 4px;
  transition: transform 0.15s, color 0.15s;
}

.star-btn.lit {
  color: #d9822b;
}

.star-btn.lit svg {
  fill: #d9822b;
}

/* ===== 内置在线客服抽屉 ===== */
.chat-drawer {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(14, 24, 21, 0.44);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.chat-sheet {
  width: min(100%, 480px);
  height: 88vh;
  background: var(--bg-canvas);
  border-radius: 22px 22px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-float);
  animation: slideUp 0.22s ease;
}

.chat-header {
  background: var(--bg-surface);
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 82%;
}

.msg-row.mine {
  align-self: flex-end;
  align-items: flex-end;
}

.msg-row.theirs {
  align-self: flex-start;
  align-items: flex-start;
}

.msg-bubble {
  padding: 10px 13px;
  border-radius: 15px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.msg-row.mine .msg-bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 5px;
}

.msg-row.theirs .msg-bubble {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 5px;
}

.msg-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 10.5px;
  color: var(--text-muted);
  padding: 0 3px;
}

.msg-read-tag.read {
  color: var(--primary);
  font-weight: 600;
}

.msg-read-tag.unread {
  color: var(--amber);
}

.msg-img {
  max-width: 210px;
  max-height: 220px;
  border-radius: 11px;
  display: block;
  cursor: zoom-in;
}

.msg-voice-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 96px;
  font-weight: 600;
  color: inherit;
}

.msg-video {
  max-width: 230px;
  max-height: 220px;
  border-radius: 11px;
  background: #000;
  display: block;
}

.chat-order-card {
  background: #fff;
  color: var(--text-primary);
  border-radius: 14px;
  padding: 12px;
  width: 248px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
}

.chat-toolbar {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 8px 12px env(safe-area-inset-bottom, 10px);
}

.chat-media-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chat-media-actions::-webkit-scrollbar {
  display: none;
}

.chat-tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 99px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.chat-tool-chip.recording {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-input-row .input {
  padding: 9px 13px;
  border-radius: 99px;
}

.chat-order-picker {
  max-height: 190px;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg-subtle);
  border-radius: 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border-subtle);
}

.proofread-row {
  border: 1px solid var(--border-subtle);
  border-radius: 13px;
  padding: 10px;
  background: var(--bg-subtle);
  margin-bottom: 10px;
}

.proofread-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}

.upload-progress-bar {
  height: 5px;
  border-radius: 99px;
  background: var(--bg-muted);
  overflow: hidden;
  margin-top: 8px;
}

.upload-progress-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.15s ease;
}
