* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f5f5f5;
  color: #333;
  font-size: 14px;
  line-height: 1.5;
}

/* === 导航栏 === */
.report-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: white;
  border-bottom: 1px solid #e0e0e0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.nav-back {
  color: #4a90d9;
  text-decoration: none;
  font-size: 14px;
}
.week-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}
.week-nav button {
  background: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 16px;
  cursor: pointer;
  color: #333;
}
.week-label {
  font-size: 15px;
  font-weight: 600;
  min-width: 100px;
  text-align: center;
}
/* 双 tab 视图切换 */
.view-tabs {
  display: flex;
  border: 1px solid #4a90d9;
  border-radius: 4px;
  overflow: hidden;
}
.view-tabs button {
  background: white;
  color: #4a90d9;
  border: none;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.view-tabs button.active {
  background: #4a90d9;
  color: white;
}
.view-tabs button:not(.active):hover {
  background: #eaf3fb;
}

/* === 内容区 === */
.report-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}

.report-loading {
  text-align: center;
  color: #999;
  margin-top: 60px;
  font-size: 16px;
}

/* === 标题 === */
.report-title {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  color: #333;
}
.report-title .subtitle {
  font-size: 13px;
  font-weight: 400;
  color: #888;
  margin-top: 2px;
}

/* === 概览分区 === */
.section {
  margin-bottom: 14px;
  border-radius: 6px;
  overflow: hidden;
}
.section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-weight: 600;
  font-size: 14px;
  color: white;
}
.section-header .icon {
  font-size: 16px;
}
.section-body {
  padding: 8px 12px;
  background: white;
  border: 1px solid #e8e8e8;
  border-top: none;
  font-size: 13px;
}

/* 分区颜色 */
.section-sleep .section-header { background: #3498db; }
.section-bowel .section-header { background: #e67e22; }
.section-symptom .section-header { background: #e74c3c; }
.section-meal .section-header { background: #8B7355; }
.section-emotion .section-header { background: #9b59b6; }
.section-question .section-header { background: #f39c12; }

/* === 概览条目 === */
.summary-line {
  padding: 3px 0;
}
.summary-line.warning {
  color: #e74c3c;
  font-weight: 600;
}
.summary-line .tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  margin-right: 4px;
  color: white;
}
.tag-normal { background: #27ae60; }
.tag-warning { background: #e74c3c; }
.tag-info { background: #3498db; }

/* === 分隔线 === */
.report-divider {
  border: none;
  border-top: 1px dashed #ccc;
  margin: 16px 0;
}

/* === 每日明细 === */
.daily-title {
  font-size: 14px;
  font-weight: 600;
  margin: 10px 0 4px;
  padding: 4px 8px;
  background: #ACE5E1;
  border-radius: 4px;
  display: inline-block;
}
.daily-grid {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 2px 8px;
  font-size: 12px;
  margin-bottom: 12px;
  padding: 6px 0;
}
.daily-label {
  color: #888;
  font-weight: 600;
}
.daily-value {
  color: #333;
}
.daily-value.symptom { color: #e74c3c; }
.daily-value.snack { color: #4874CB; }
.daily-value.event { color: #30C0B4; }

/* === 打印 === */
@media print {
  body { background: white; font-size: 11px; }
  .report-nav, .report-loading, .no-print { display: none !important; }
  .report-content { max-width: none; padding: 0; }
  .report-title { font-size: 16px; margin-bottom: 8px; }
  .section { margin-bottom: 8px; }
  .section-body { padding: 4px 8px; font-size: 11px; }
  .report-divider { margin: 8px 0; }
  .daily-title { font-size: 12px; margin: 6px 0 2px; }
  .daily-grid { font-size: 10px; margin-bottom: 6px; }

  @page {
    size: A4 portrait;
    margin: 12mm;
  }
  .section { page-break-inside: avoid; }
}

/* === 周回顾新组件 === */
.section-subtitle {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin: 18px 0 8px;
  padding-bottom: 4px;
  border-bottom: 2px solid #4a90d9;
}
.section-subtitle.small {
  font-size: 13px;
  margin-top: 14px;
  border-bottom-color: #cde2f3;
}
.section-subtitle-hint {
  font-size: 12px;
  font-weight: 400;
  color: #888;
  margin-left: 8px;
  border: none;
}

/* 异常卡片 */
.anomaly-section { margin-top: 8px; }
.anomaly-cards {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 8px;
  -webkit-overflow-scrolling: touch;
}
.anomaly-card {
  flex: 0 0 auto;
  min-width: 130px;
  background: white;
  border: 1px solid #e8e8e8;
  border-left: 4px solid #f39c12;
  border-radius: 4px;
  padding: 8px 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.anomaly-card-warn { border-left-color: #e74c3c; }
.anomaly-card-label { font-size: 14px; font-weight: 600; color: #333; }
.anomaly-card-detail { font-size: 12px; color: #888; margin-top: 2px; }
.anomaly-empty {
  background: #eafaf1;
  border: 1px solid #27ae60;
  color: #27ae60;
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
}

/* 睡眠可视化 */
.sleep-viz-section { margin-top: 8px; }
.heatmap-wrap { background: white; border: 1px solid #e8e8e8; border-radius: 4px; padding: 8px; }
.heatmap-svg { width: 100%; height: auto; display: block; }
.heatmap-scale {
  position: relative;
  height: 16px;
  margin-top: 2px;
  font-size: 10px;
  color: #999;
}
.heatmap-scale span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* 饮食分析 */
.meal-analysis-section { margin-top: 8px; }
.meal-empty {
  background: #f5f5f5;
  color: #999;
  text-align: center;
  padding: 12px;
  border-radius: 4px;
  font-size: 13px;
  margin: 6px 0;
}

/* 食材频率榜 */
.meal-freq {
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  padding: 8px 12px;
}
.meal-freq-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 12px;
}
.meal-freq-name { flex: 0 0 90px; color: #555; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meal-freq-bar { flex: 1; height: 14px; background: #f5f5f5; border-radius: 2px; overflow: hidden; }
.meal-freq-fill { height: 100%; background: linear-gradient(90deg, #5dade2, #3498db); border-radius: 2px; }
.meal-freq-count { flex: 0 0 36px; text-align: right; color: #3498db; font-weight: 600; }

/* 烹饪方式分布 */
.cooking-dist {
  display: flex;
  height: 32px;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 4px;
}
.cooking-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 11px;
  min-width: 4px;
}
.cooking-label { font-weight: 600; line-height: 1; }
.cooking-count { font-size: 10px; margin-top: 2px; opacity: 0.95; }

/* 餐次规律 */
.meal-regularity {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.regularity-card {
  flex: 1;
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  padding: 10px 8px;
  text-align: center;
}
.regularity-value { font-size: 22px; font-weight: 700; color: #3498db; line-height: 1.1; }
.regularity-value span { font-size: 13px; color: #999; font-weight: 400; }
.regularity-label { font-size: 12px; color: #666; margin-top: 4px; }
.regularity-label small { display: block; color: #999; font-size: 10px; margin-top: 2px; }

/* 食物-症状共现 */
.food-symptom-warning {
  background: #fff8e1;
  border: 1px solid #ffe082;
  color: #8a6d3b;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 11px;
  margin: 4px 0 8px;
}
.food-symptom-list {
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  padding: 6px 12px;
}
.food-symptom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 12px;
}
.food-symptom-row:last-child { border-bottom: none; }
.fs-food { flex: 0 0 auto; min-width: 60px; max-width: 100px; font-weight: 600; color: #8e44ad; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-arrow { color: #bbb; }
.fs-symptom { flex: 0 0 auto; min-width: 60px; max-width: 100px; font-weight: 600; color: #e74c3c; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-count { flex: 1; color: #888; font-size: 11px; }

/* 每日要点 */
.weekly-timeline-section { margin-top: 8px; }
.weekly-day-details {
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  margin-bottom: 6px;
}
.weekly-day-details .weekly-day-summary {
  padding: 8px 12px;
  font-weight: 600;
  color: #555;
  font-size: 13px;
  border-bottom: 1px solid #eee;
}
.weekly-day-body {
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.8;
}

/* 就诊清单 */
.doctor-list-hint { color: #666; font-size: 13px; margin: 10px 0 6px; }
.doctor-list {
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  padding: 6px 10px;
}
.doctor-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #f0f0f0;
}
.doctor-item:last-child { border-bottom: none; }
.doctor-check { flex: 0 0 auto; width: 18px; height: 18px; cursor: pointer; }
.doctor-text {
  flex: 1;
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 6px;
  font-size: 14px;
  font-family: inherit;
  color: #333;
  border-radius: 3px;
}
.doctor-text:hover { background: #fafbfc; }
.doctor-text:focus { outline: none; border-color: #4a90d9; background: white; }
.doctor-copy-btn {
  display: block;
  margin: 12px auto;
  padding: 8px 24px;
  background: #4a90d9;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
}
.doctor-copy-btn:hover { background: #3a7dc1; }
.doctor-empty {
  background: #eafaf1;
  border: 1px solid #27ae60;
  color: #27ae60;
  padding: 16px;
  border-radius: 4px;
  text-align: center;
  font-size: 14px;
  margin-top: 16px;
}
