/* ========== 全局变量 ========== */
:root {
  --bg: #f7f5f0;
  --bg-card: #ffffff;
  --bg-soft: #f0ede5;
  --text: #2c2825;
  --text-secondary: #6b645e;
  --text-light: #9a938b;
  --primary: #8b6f47;
  --primary-dark: #6d5836;
  --primary-light: #d4c4a8;
  --accent: #b85450;
  --accent-light: #d97b77;
  --success: #5a8a5a;
  --warning: #c4923a;
  --border: #e5dfd3;
  --shadow: 0 2px 12px rgba(139, 111, 71, 0.08);
  --shadow-lg: 0 8px 30px rgba(139, 111, 71, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
}

/* ========== Reset ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ========== 布局 ========== */
.container { max-width: 680px; margin: 0 auto; padding: 24px 20px; }
.container-wide { max-width: 1000px; margin: 0 auto; padding: 24px 20px; }

/* ========== 顶部标题（水墨意境）========== */
.page-header {
  position: relative;
  text-align: center;
  padding: 60px 20px 52px;
  background: #fbfaf7;
  border-bottom: 1px solid #ebe5d8;
  overflow: hidden;
}

/* 淡墨晕染纹理 · 三处散落 */
.page-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle 200px at 12% 28%, rgba(58, 42, 26, 0.11), transparent 62%),
    radial-gradient(circle 240px at 88% 72%, rgba(58, 42, 26, 0.07), transparent 65%),
    radial-gradient(circle 160px at 50% 100%, rgba(58, 42, 26, 0.05), transparent 70%);
  pointer-events: none;
}

.page-header h1 {
  position: relative;
  font-family: "STKaiti", "KaiTi", "宋体", "PingFang SC", serif;
  font-size: 36px;
  font-weight: 400;
  color: #1f1a14;
  letter-spacing: 8px;
  padding-left: 8px; /* 字距对齐中心 */
  margin-bottom: 0;
}

/* 标题下短横分隔线 */
.page-header h1::after {
  content: '';
  display: block;
  width: 36px;
  height: 1px;
  background: #2a221a;
  margin: 20px auto 16px;
}

.page-header .subtitle {
  font-family: "STKaiti", "KaiTi", "宋体", "PingFang SC", serif;
  font-size: 14px;
  color: #7a6d5a;
  letter-spacing: 3px;
  font-weight: 300;
  margin-top: 0;
}

/* 移动端微调 */
@media (max-width: 600px) {
  .page-header { padding: 44px 16px 38px; }
  .page-header h1 { font-size: 26px; letter-spacing: 4px; padding-left: 4px; }
  .page-header h1::after { width: 28px; margin: 14px auto 12px; }
  .page-header .subtitle { font-size: 13px; letter-spacing: 2px; }
}

/* ========== 进度条 ========== */
.progress-bar {
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 20px 20px 0;
  background: var(--bg-card);
}
.progress-step {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--text-light);
}
.progress-step .num {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  background: var(--bg-soft);
  color: var(--text-light);
  transition: all 0.3s;
  flex-shrink: 0;
}
.progress-step.active .num {
  background: var(--primary);
  color: #fff;
}
.progress-step.done .num {
  background: var(--success);
  color: #fff;
}
.progress-step .label { margin-left: 8px; white-space: nowrap; }
.progress-step .connector {
  width: 40px; height: 2px;
  background: var(--border);
  margin: 0 12px;
}

/* ========== 表单卡片 ========== */
.form-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
  margin-top: 16px;
}
.form-section { display: none; }
.form-section.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.section-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary-light);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title .icon { font-size: 20px; }

/* ========== 表单元素 ========== */
.form-group { margin-bottom: 18px; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-group label .required { color: var(--accent); margin-left: 2px; }

input[type="text"],
input[type="tel"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.2s, background 0.2s;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}
textarea { resize: vertical; min-height: 100px; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: var(--text-light); }

/* 性别选择 */
.radio-group { display: flex; gap: 12px; }
.radio-group label {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 400;
  transition: all 0.2s;
}
.radio-group input[type="radio"] { accent-color: var(--primary); }
.radio-group label:has(input:checked) {
  border-color: var(--primary);
  background: var(--bg-soft);
  color: var(--primary-dark);
}

/* ========== 照片上传 ========== */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg);
  position: relative;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.upload-area:hover { border-color: var(--primary); background: var(--bg-soft); }
.upload-area .upload-icon { font-size: 36px; color: var(--text-light); margin-bottom: 8px; }
.upload-area .upload-text { font-size: 14px; color: var(--text-secondary); }
.upload-area .upload-hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.upload-area input[type="file"] { display: none; }
.upload-preview {
  position: relative;
  width: 100%;
  max-width: 300px;
}
.upload-preview img {
  width: 100%;
  border-radius: var(--radius-sm);
  display: block;
}
.upload-preview .remove-btn {
  position: absolute;
  top: 8px; right: 8px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}

/* ========== 按钮 ========== */
.btn {
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg-soft); color: var(--text-secondary); }
.btn-secondary:hover { background: var(--border); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-light); }
.btn-sm { padding: 6px 16px; font-size: 13px; }
.btn-lg { padding: 14px 36px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.form-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ========== 成功页面 ========== */
.success-page {
  text-align: center;
  padding: 60px 24px;
}
.success-page .success-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-size: 36px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.success-page h2 { font-size: 22px; color: var(--primary-dark); margin-bottom: 8px; }
.success-page p { color: var(--text-secondary); font-size: 15px; }
.success-page .consultation-id {
  display: inline-block;
  margin-top: 16px;
  padding: 8px 20px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--primary-dark);
  font-family: "SF Mono", monospace;
  letter-spacing: 1px;
}

/* ========== 管理端表格 ========== */
.admin-header {
  background: var(--bg-card);
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-header .title { font-size: 20px; font-weight: 600; color: var(--primary-dark); }
.admin-header .stats { font-size: 13px; color: var(--text-light); }

.admin-toolbar {
  padding: 16px 24px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.admin-toolbar input { max-width: 240px; }

.consultation-list { padding: 0 24px 40px; }
.consultation-item {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 4px solid transparent;
}
.consultation-item:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.consultation-item.status-pending { border-left-color: var(--warning); }
.consultation-item.status-in_progress { border-left-color: var(--primary); }
.consultation-item.status-completed { border-left-color: var(--success); }

.ci-info { flex: 1; }
.ci-info .ci-name { font-size: 16px; font-weight: 600; color: var(--text); }
.ci-info .ci-meta { font-size: 13px; color: var(--text-light); margin-top: 4px; }
.ci-info .ci-complaint { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.ci-right { display: flex; align-items: center; gap: 12px; }
.ci-date { font-size: 12px; color: var(--text-light); text-align: right; }

/* 状态标签 */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.badge-pending { background: #fdf6e9; color: var(--warning); }
.badge-in_progress { background: #f0ede5; color: var(--primary); }
.badge-completed { background: #eef5ee; color: var(--success); }

/* ========== 问诊单页面 ========== */
.consultation-sheet {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
  max-width: 800px;
  margin: 24px auto;
}
.sheet-header {
  text-align: center;
  padding-bottom: 20px;
  border-bottom: 3px double var(--primary);
  margin-bottom: 28px;
}
.sheet-header h1 {
  font-size: 26px;
  color: var(--primary-dark);
  letter-spacing: 4px;
}
.sheet-header .sheet-id {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 8px;
  font-family: "SF Mono", monospace;
}

.sheet-section { margin-bottom: 28px; }
.sheet-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary-dark);
  background: var(--bg-soft);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--primary);
  margin-bottom: 14px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
}
.info-item { display: flex; font-size: 14px; }
.info-item .label {
  color: var(--text-light);
  min-width: 70px;
  flex-shrink: 0;
}
.info-item .value { color: var(--text); font-weight: 500; }

.content-block {
  font-size: 14px;
  color: var(--text);
  line-height: 1.8;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
}

.tongue-photos {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.tongue-photo-item {
  text-align: center;
}
.tongue-photo-item img {
  width: 200px;
  height: 150px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.tongue-photo-item .label { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }

/* 可编辑区域 */
.editable-area {
  width: 100%;
  min-height: 80px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  background: #fff;
  resize: vertical;
  font-family: inherit;
}
.editable-area:focus {
  outline: none;
  border-color: var(--primary);
}

.analysis-result {
  background: #faf8f3;
  border: 1px solid var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-wrap;
  color: var(--text);
}
.analysis-result .syndrome-tag {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 12px;
  margin: 2px 4px 2px 0;
}

.sheet-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.status-select {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.status-select select {
  width: auto;
  padding: 6px 14px;
  font-size: 14px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }

/* ========== 提示 ========== */
.alert {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-info { background: #eef5f8; color: #3a6a8a; }
.alert-warning { background: #fdf6e9; color: var(--warning); }

/* ========== 响应式 ========== */
@media (max-width: 600px) {
  .form-row { flex-direction: column; gap: 0; }
  .info-grid { grid-template-columns: 1fr; }
  .progress-step .label { display: none; }
  .progress-step .connector { width: 20px; margin: 0 6px; }
  .consultation-sheet { padding: 20px; }
  .tongue-photos { flex-direction: column; }
  .admin-toolbar { flex-wrap: wrap; }
}

/* ========== 打印 ========== */
@media print {
  body { background: #fff; }
  .sheet-actions, .status-select, .admin-header, .admin-toolbar, .no-print { display: none !important; }
  .consultation-sheet { box-shadow: none; padding: 20px; max-width: 100%; }
  .editable-area { border: none; background: none; resize: none; }
}

/* ========== 字段提示 ========== */
.hint {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 400;
  margin-left: 6px;
}

/* ========== 症状勾选（chip 组件）========== */
.symptom-groups {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.symptom-group {
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.group-title {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 8px;
}
.group-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.chip:hover { border-color: var(--primary-light); color: var(--primary); }
.chip input { display: none; }
.chip input:checked + span {
  color: #fff;
  font-weight: 500;
}
.chip:has(input:checked) {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ========== 多图上传 ========== */
.upload-area-multi {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-soft);
  transition: all 0.2s;
}
.upload-area-multi:hover { border-color: var(--primary-light); background: #fff; }
.upload-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.upload-item {
  position: relative;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 1;
}
.upload-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.upload-item .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.upload-item .item-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 11px;
  text-align: center;
  padding: 2px 0;
}

/* ========== 示例提示（拍摄标准）========== */
.example-tip {
  background: #fdf9f0;
  border: 1px solid #f0e2c0;
  border-left: 4px solid var(--warning);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-secondary);
}
.example-tip strong { color: var(--text); }
.example-img {
  margin-top: 10px;
  text-align: center;
}
.example-img img {
  max-width: 240px;
  max-height: 180px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* ========== 首诊/复诊标签 ========== */
.badge.visit-new { background: #e3f2fd; color: #1976d2; }
.badge.visit-followup { background: #fff3e0; color: #e65100; }

/* ========== 问诊单详情页 - 症状显示 ========== */
.symptom-display {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
}
.symptom-chip {
  display: inline-block;
  padding: 3px 10px;
  background: #fff;
  border: 1px solid var(--primary-light);
  border-radius: 14px;
  font-size: 12px;
  color: var(--primary-dark);
}
