:root {
  --bg: #f5f2ea;
  --paper: #fffdf8;
  --line: #ded8ca;
  --text: #302a22;
  --muted: #6f675d;
  --primary: #2d6a4f;
  --primary-dark: #1f4f3a;
  --accent: #c97d60;
  --warn: #f3b93f;
  --danger: #c4584d;
  --shadow: 0 10px 28px rgba(48, 42, 34, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(201, 125, 96, 0.12), transparent 30%),
    linear-gradient(180deg, #f7f3eb 0%, #f1ede4 100%);
  color: var(--text);
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
a { color: inherit; text-decoration: none; }
input, select, textarea, button {
  font: inherit;
}
.container {
  width: min(1100px, calc(100vw - 32px));
  margin: 0 auto;
}
.site-header {
  border-bottom: 1px solid rgba(222, 216, 202, 0.8);
  backdrop-filter: blur(10px);
  background: rgba(247, 243, 235, 0.88);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
}
.brand {
  font-weight: 700;
  letter-spacing: 0.02em;
}
.top-nav {
  display: flex;
  gap: 16px;
  color: var(--muted);
}
.page-shell {
  padding: 28px 0 48px;
}
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.hero-card h1, .card h1, .card h2 {
  margin: 0 0 8px;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.muted {
  color: var(--muted);
}
.flash {
  background: rgba(45, 106, 79, 0.12);
  border: 1px solid rgba(45, 106, 79, 0.25);
  color: var(--primary-dark);
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 16px;
}
.grid-2, .stats-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.action-card, .stat-card {
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow);
}
.action-card strong, .stat-card strong {
  font-size: 20px;
}
.stat-card span {
  color: var(--muted);
}
.narrow {
  width: min(760px, 100%);
  margin: 0 auto 20px;
}
.form-stack, .form-grid, .filter-grid {
  display: grid;
  gap: 16px;
}
.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.filter-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 20px;
}
label span {
  display: block;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
}
input[type="text"], input[type="date"], input[type="datetime-local"], input[type="number"], select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
}
.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
}
.checkbox-line span {
  margin: 0;
  color: var(--text);
}
.btn-primary, .btn-secondary, .inline-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border-radius: 999px;
  padding: 12px 20px;
  border: none;
  cursor: pointer;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-secondary {
  background: transparent;
  color: var(--primary-dark);
  border: 1px solid var(--primary);
}
.inline-btn {
  min-width: 120px;
}
.questionnaire-form .card {
  margin-bottom: 16px;
}
.h5-shell {
  width: min(760px, 100%);
  margin: 0 auto;
}
.h5-header {
  margin-bottom: 16px;
}
.h5-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.h5-actions {
  display: grid;
  gap: 14px;
}
.h5-menu-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: rgba(255, 253, 248, 0.95);
  box-shadow: var(--shadow);
}
.h5-menu-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 18px;
}
.progress-wrap {
  margin: 16px 0 0;
}
.progress-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(45, 106, 79, 0.12);
  overflow: hidden;
}
.progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
}
.instrument-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.instrument-chip {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}
.instrument-chip.current {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: rgba(45, 106, 79, 0.08);
}
.instrument-chip.done {
  border-color: rgba(45, 106, 79, 0.25);
  background: rgba(45, 106, 79, 0.12);
  color: var(--primary-dark);
}
.meta-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.helper-text {
  font-size: 13px;
  color: var(--muted);
}
.question-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.answer-stack {
  display: grid;
  gap: 10px;
}
.answer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.panel-soft {
  background: rgba(45, 106, 79, 0.06);
  border: 1px solid rgba(45, 106, 79, 0.12);
  border-radius: 16px;
  padding: 16px;
}
.empty-state {
  padding: 28px 20px;
  text-align: center;
  color: var(--muted);
}
.metric-strip {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.metric-box {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #fff;
}
.metric-box strong {
  display: block;
  font-size: 22px;
  margin-top: 6px;
}
.text-right {
  text-align: right;
}
.mono {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}
.small {
  font-size: 13px;
}
.status-ok {
  color: var(--primary-dark);
}
.status-warn {
  color: #7d5b00;
}
.status-bad {
  color: var(--danger);
}
.question-block {
  padding: 16px 0;
  border-top: 1px dashed rgba(222, 216, 202, 0.8);
}
.question-block:first-of-type {
  border-top: none;
}
.question-label {
  display: flex;
  gap: 8px;
  font-weight: 600;
}
.question-label span {
  margin: 0;
  color: var(--text);
}
.question-domain {
  color: var(--accent);
  margin: 6px 0 10px;
  font-size: 13px;
}
.option-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.option-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: #fff;
}
.sticky-actions {
  position: sticky;
  bottom: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px;
  background: rgba(247, 243, 235, 0.92);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.mini-meta, .info-list, .detail-grid, .action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}
.badge-warn {
  background: rgba(243, 185, 63, 0.18);
  color: #7d5b00;
}
.badge-danger {
  background: rgba(196, 88, 77, 0.15);
  color: var(--danger);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table-link {
  color: var(--primary);
  font-weight: 600;
}
.timeline-item {
  padding: 12px 0;
  border-bottom: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.timeline-list .timeline-item:last-child {
  border-bottom: none;
}

/* 随访进度时间线 */
.followup-timeline {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 8px 0;
}
.timeline-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: inherit;
}
.timeline-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  background: #fff;
}
.timeline-node.done .timeline-dot { background: #22c55e; border-color: #22c55e; }
.timeline-node.current .timeline-dot { background: #2563eb; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.2); }
.timeline-node.future .timeline-dot { background: #f3f4f6; border-color: #d1d5db; }
.timeline-label { font-size: 12px; color: var(--muted, #6b7280); }
.timeline-node.done .timeline-label { color: #22c55e; font-weight: 600; }
.timeline-node.current .timeline-label { color: #2563eb; font-weight: 600; }
.timeline-arrow { color: #d1d5db; font-size: 14px; margin: 0 2px; }

/* 患者首页步骤标签 */
.step-badge {
  display: inline-block;
  background: var(--accent, #2563eb);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  margin-bottom: 4px;
}

/* 量表列表行 */
.instrument-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 12px 0;
}
.instrument-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line, #e5e7eb);
}
.instrument-row:last-child { border-bottom: none; }
.instrument-row.done { opacity: 0.6; }
.instrument-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent, #2563eb);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.instrument-row.done .instrument-num {
  background: #22c55e;
}
.instrument-name { flex: 1; }
.instrument-status {
  font-size: 13px;
  color: var(--muted, #6b7280);
}

@media (max-width: 900px) {
  .grid-2, .stats-grid, .filter-grid, .form-grid, .detail-grid, .meta-grid, .metric-strip {
    grid-template-columns: 1fr;
  }
  .sticky-actions {
    flex-direction: column;
  }
  .h5-title {
    flex-direction: column;
  }
}
