/* ============================================
   健康 tab - 成员列表与成员详情
   ============================================ */

/* 内容容器：面板内滚动，居中限宽 */
.health-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 20px 40px;
}

/* 页头（返回按钮 + 标题） */
.health-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.health-header h2 {
  margin: 0;
  font-size: 20px;
}

.health-header .health-sub {
  color: var(--text-muted);
  font-size: 13px;
}

/* ========== 成员卡片网格 ========== */
.health-member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.health-member-card {
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
}

.health-member-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.health-member-name {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 4px;
}

.health-member-meta {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 10px;
}

.health-count-badges {
  display: flex;
  gap: 8px;
}

.health-count-badge {
  background: var(--bg-light);
  color: var(--text-secondary);
  border-radius: 10px;
  padding: 2px 10px;
  font-size: 12px;
}

/* ========== 区块卡片 ========== */
.health-section {
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin-bottom: 16px;
}

.health-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
  flex-wrap: wrap;
}

.health-section-title h3 {
  margin: 0;
  font-size: 16px;
}

.health-section-title .health-hint {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: normal;
  margin-left: 8px;
}

.health-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 20px 0;
}

.health-subsection {
  margin-top: 16px;
}

.health-subsection h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* ========== 成员详情头部信息 ========== */
.health-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px 16px;
}

.health-info-item .health-info-label {
  color: var(--text-muted);
  font-size: 12px;
}

.health-info-item .health-info-value {
  font-size: 14px;
  word-break: break-all;
}

/* ========== 通用表格 ========== */
.health-table-wrap {
  overflow-x: auto;
}

.health-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.health-table th {
  background: var(--bg-lighter);
  color: var(--text-secondary);
  font-weight: 500;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.health-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}

.health-table tr:last-child td {
  border-bottom: none;
}

.health-table tbody tr:hover {
  background: var(--bg-lighter);
}

/* 可点击行（文档报告） */
.health-table tr.health-clickable {
  cursor: pointer;
}

.health-abnormal {
  color: var(--danger-color);
  font-weight: 600;
}

.health-muted {
  color: var(--text-muted);
}

/* ========== 检验指标趋势 ========== */
.health-indicator-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.health-indicator-bar select {
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #fff;
  max-width: 320px;
}

.health-chart-wrap {
  width: 100%;
  margin-bottom: 12px;
}

.health-chart-legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.health-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.health-legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

/* 指标多选面板（按分类分组） */
.health-indicator-panel {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 12px;
  margin-bottom: 12px;
  max-height: 320px;
  overflow-y: auto;
}

.health-ind-cat {
  margin-bottom: 10px;
}

.health-ind-cat:last-child {
  margin-bottom: 0;
}

.health-ind-cat-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.health-ind-cat-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.health-ind-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
  background: var(--bg-color);
}

.health-ind-item:has(input:checked) {
  border-color: var(--primary-color);
  background: rgba(25, 118, 210, 0.08);
}

.health-ind-item-count {
  color: var(--text-muted);
  font-size: 11px;
}

/* 可点击的来源报告链接 */
.health-link {
  color: var(--primary-color);
  text-decoration: none;
  cursor: pointer;
}

.health-link:hover {
  text-decoration: underline;
}

/* ========== 手工检查记录 ========== */
.health-exam-block {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
}

.health-exam-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-lighter);
  flex-wrap: wrap;
}

.health-exam-head .health-exam-date {
  font-weight: 600;
}

.health-exam-head .health-exam-meta {
  color: var(--text-secondary);
  font-size: 13px;
}

.health-exam-head .btn {
  margin-left: auto;
}

.health-exam-notes {
  padding: 8px 12px;
  color: var(--text-secondary);
  font-size: 13px;
  border-top: 1px solid #eee;
}

/* ========== 弹窗：预览 / 检查表单 ========== */
.health-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.health-preview-body {
  text-align: center;
  min-height: 200px;
}

.health-preview-body img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.health-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px 16px;
  margin-bottom: 16px;
}

.health-form-grid label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.health-form-grid input,
.health-form-grid textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.health-form-grid .health-form-full {
  grid-column: 1 / -1;
}

/* 指标动态行 */
.health-ind-table input[type="text"] {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.health-ind-table td {
  padding: 6px 6px;
}

.health-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

/* 小屏适配 */
@media (max-width: 640px) {
  .health-container {
    padding: 12px 10px 32px;
  }

  .health-member-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* 小节折叠 */
.health-collapse-head {
  cursor: pointer;
  user-select: none;
}

.health-collapse-head:hover {
  color: var(--primary-color);
}

.health-collapse-arrow {
  display: inline-block;
  width: 14px;
  color: var(--text-muted);
}

.health-more-btn {
  margin-left: 8px;
}

/* 打卡弹窗 */
.health-checkin-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.health-checkin-progress b {
  color: var(--primary-color);
}

.health-checkin-done {
  text-align: center;
  padding: 10px;
  color: var(--success-color);
  font-weight: 600;
  border: 1px dashed var(--success-color);
  border-radius: var(--radius-sm);
  background: rgba(40, 167, 69, 0.06);
}

/* 已停药样式 */
.health-med-stopped td {
  color: var(--text-muted);
  text-decoration: line-through;
}

.health-med-stopped td:last-child,
.health-med-stopped td:nth-last-child(2) {
  text-decoration: none;
}

/* 时间范围切换 */
.health-range-bar {
  display: inline-flex;
  gap: 4px;
  margin-right: 8px;
}

.health-range {
  padding: 3px 10px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
}

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