/* ==========================================================================
   苏大附一院 IBS 患者量表评估系统 · 设计系统
   ========================================================================== */
:root {
  --bg: #f4f7fa;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-2: #1e293b;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e2e8f0;
  --line-2: #eef2f7;
  --teal: #0f766e;
  --teal-2: #115e59;
  --teal-3: #0d9488;
  --teal-soft: #ecfdf5;
  --teal-line: #99f6e4;
  --amber: #b45309;
  --amber-soft: #fffbeb;
  --red: #b91c1c;
  --red-soft: #fef2f2;
  --green: #15803d;
  --green-soft: #f0fdf4;
  --blue: #1d4ed8;
  --blue-soft: #eff6ff;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 12px 34px rgba(15, 23, 42, .07);
  --shadow-sm: 0 2px 10px rgba(15, 23, 42, .05);
  --font: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
a { color: var(--teal); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
::selection { background: #99f6e4; color: #0b3b37; }
:focus-visible { outline: 2px solid var(--teal-3); outline-offset: 2px; }

/* ---------- 布局 ---------- */
.wrap { width: min(1120px, 100%); margin: 0 auto; padding: 0 20px; }
.wrap-narrow { width: min(760px, 100%); margin: 0 auto; padding: 0 20px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; }
.hide { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 20px; }
.mt-4 { margin-top: 30px; }
.mb-0 { margin-bottom: 0; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { height: 58px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px; flex: 0 0 auto;
  background: linear-gradient(140deg, #0b3b37, #0f766e 55%, #0d9488);
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 6px 16px rgba(15, 118, 110, .28);
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-text { min-width: 0; }
.brand-title { font-size: 14px; font-weight: 750; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 10.5px; color: var(--muted); letter-spacing: .6px; text-transform: uppercase; white-space: nowrap; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.version-chip {
  font-size: 10.5px; color: var(--muted); border: 1px solid var(--line);
  padding: 2px 8px; border-radius: 999px; background: #fff;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  background: #fff; color: var(--ink); font-weight: 650; font-size: 14px;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
  white-space: nowrap; user-select: none;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn-primary {
  background: linear-gradient(135deg, #0f766e, #0d9488);
  color: #fff; box-shadow: 0 10px 22px rgba(15, 118, 110, .24);
}
.btn-primary:hover { box-shadow: 0 14px 26px rgba(15, 118, 110, .3); }
.btn-ghost { border-color: var(--line); background: #fff; color: var(--ink-2); }
.btn-ghost:hover { border-color: #cbd5e1; background: #fbfdff; }
.btn-soft { background: var(--teal-soft); color: var(--teal-2); }
.btn-danger { background: var(--red-soft); color: var(--red); border-color: #fecaca; }
.btn-lg { height: 52px; font-size: 15.5px; border-radius: 14px; padding: 0 24px; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: 11px; }
.btn .spin { animation: spin 1s linear infinite; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 22px; }
.card-hover { transition: box-shadow .2s ease, transform .15s ease, border-color .2s ease; }
.card-hover:hover { box-shadow: var(--shadow); border-color: #cfe3e0; transform: translateY(-1px); }
.section-title { font-size: 12px; font-weight: 750; letter-spacing: 1.6px; color: var(--muted); text-transform: uppercase; margin: 0 0 10px; }
.h1 { font-size: clamp(26px, 6vw, 38px); line-height: 1.16; font-weight: 820; letter-spacing: -.5px; margin: 0; }
.h2 { font-size: 21px; font-weight: 780; letter-spacing: -.2px; margin: 0; }
.h3 { font-size: 16px; font-weight: 720; margin: 0; }
.lead { color: var(--muted); font-size: 14.5px; line-height: 1.7; }
.divider { height: 1px; background: var(--line); border: 0; margin: 18px 0; }

/* ---------- 标签 / 徽章 ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; background: var(--line-2); color: var(--muted);
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.chip-teal { background: var(--teal-soft); color: var(--teal-2); }
.chip-amber { background: var(--amber-soft); color: var(--amber); }
.chip-red { background: var(--red-soft); color: var(--red); }
.chip-blue { background: var(--blue-soft); color: var(--blue); }
.chip-good { background: var(--green-soft); color: var(--green); }
.chip-line { background: #fff; border: 1px solid var(--line); color: var(--muted); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.label .opt { font-weight: 500; color: var(--muted-2); margin-left: 4px; }
.input, .textarea {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 12px;
  padding: 12px 14px; font-size: 15px; transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .textarea:focus { outline: none; border-color: var(--teal-3); box-shadow: 0 0 0 3px rgba(13, 148, 136, .12); }
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.input-suffix { position: relative; }
.input-suffix .input { padding-right: 52px; }
.input-suffix .suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; }
.picker-btn {
  width: 100%; height: 48px; border: 1px solid var(--line); background: #fff; border-radius: 12px;
  display: flex; align-items: center; gap: 10px; padding: 0 14px; text-align: left; color: var(--ink);
}
.picker-btn .ph { color: var(--muted-2); }
.picker-btn svg { width: 18px; height: 18px; color: var(--teal); }
.picker-btn:hover { border-color: #cbd5e1; }

/* ---------- 选项 ---------- */
.options { display: grid; gap: 8px; }
.options.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.options.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.options.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.opt-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 46px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; text-align: left; color: var(--ink-2); font-size: 14px; line-height: 1.45;
  transition: border-color .14s ease, background .14s ease, box-shadow .14s ease;
}
.opt-row:hover { border-color: #b6d9d3; background: #fbfefd; }
.opt-row .mark {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid #cbd5e1;
  display: grid; place-items: center; color: #fff; transition: all .14s ease;
}
.opt-row .mark svg { width: 12px; height: 12px; opacity: 0; }
.opt-row .num {
  flex: 0 0 auto; min-width: 22px; height: 22px; border-radius: 7px; background: var(--line-2);
  color: var(--muted); font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.opt-row .txt { flex: 1; }
.opt-row.selected { border-color: var(--teal-3); background: var(--teal-soft); box-shadow: 0 0 0 2px rgba(13, 148, 136, .08); }
.opt-row.selected .mark { background: var(--teal-3); border-color: var(--teal-3); }
.opt-row.selected .mark svg { opacity: 1; }
.opt-row.selected .num { background: #ccfbf1; color: var(--teal-2); }
.opt-row.small { min-height: 40px; padding: 7px 10px; font-size: 13px; }
.options.cols-2 > .opt-row:last-child:nth-child(odd) { grid-column: 1 / -1; }
.opt-row:disabled { opacity: .45; pointer-events: none; }

.seg { display: inline-flex; padding: 3px; background: #eef2f7; border-radius: 11px; gap: 2px; align-self: flex-start; }
.seg button {
  border: 0; background: transparent; padding: 7px 13px; border-radius: 9px;
  font-size: 12.5px; font-weight: 650; color: var(--muted);
}
.seg button.active { background: #fff; color: var(--teal-2); box-shadow: 0 1px 4px rgba(15, 23, 42, .1); }

/* ---------- 开关 ---------- */
.switch { width: 44px; height: 26px; border-radius: 999px; background: #cbd5e1; border: 0; position: relative; transition: background .18s ease; flex: 0 0 auto; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .18s ease; }
.switch.on { background: var(--teal-3); }
.switch.on::after { transform: translateX(18px); }

/* ---------- 首页 ---------- */
.hero { padding: 46px 0 26px; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; width: 520px; height: 520px; right: -220px; top: -300px;
  background: radial-gradient(circle, rgba(13, 148, 136, .16), transparent 66%); pointer-events: none;
}
.hero-eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--teal-2); font-size: 12px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; margin-bottom: 14px; }
.hero-eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--teal-3); border-radius: 2px; }
.hero .lead { max-width: 560px; margin-top: 12px; }
.entry-card { max-width: 520px; margin-top: 24px; padding: 26px; }
#resultArea { scroll-margin-top: 74px; }
.q-card { scroll-margin-top: 80px; }
.entry-card .btn-lg { margin-top: 6px; }
.privacy-note { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 11.5px; line-height: 1.55; margin-top: 14px; }
.privacy-note svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 1px; color: var(--teal); }

.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode-card {
  text-align: left; padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: #fff;
  display: flex; flex-direction: column; gap: 8px; transition: all .16s ease;
}
.mode-card:hover { border-color: var(--teal-3); box-shadow: var(--shadow); transform: translateY(-2px); }
.mode-card .mc-icon { width: 36px; height: 36px; border-radius: 11px; background: var(--teal-soft); color: var(--teal-2); display: grid; place-items: center; flex: 0 0 auto; }
.mode-card .mc-icon svg { width: 19px; height: 19px; }
.mode-card h4 { margin: 0; font-size: 15px; font-weight: 750; }
.mode-card p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.55; }
.mode-card .mc-time { font-size: 11px; font-weight: 700; color: var(--teal-2); }

.record-list { display: flex; flex-direction: column; gap: 10px; }
.record-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line);
  border-radius: 14px; background: #fff; transition: all .16s ease; color: inherit;
}
.record-item:hover { border-color: var(--teal-3); box-shadow: var(--shadow-sm); }
.record-item .ri-date { font-size: 12px; color: var(--muted); }
.record-item .ri-main { flex: 1; min-width: 0; }
.record-item .ri-title { font-weight: 700; font-size: 14px; }
.record-item .ri-scores { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.record-item .ri-score { font-size: 11.5px; color: var(--muted); }
.record-item .ri-score b { color: var(--ink); font-weight: 750; }

/* ---------- 问卷 ---------- */
.qbody { padding-bottom: calc(94px + var(--safe-bottom)); }
.progress-track { height: 4px; background: #e6edf3; position: fixed; top: 58px; left: 0; right: 0; z-index: 59; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #0f766e, #2dd4bf); width: 0; transition: width .3s ease; }
.qhead { padding: 18px 0 6px; }
.qhead .h2 { font-size: 20px; }
.qhead .lead { font-size: 13px; margin-top: 4px; }
.page-tabs { display: flex; gap: 7px; overflow-x: auto; padding: 10px 0 12px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.page-tabs::-webkit-scrollbar { display: none; }
.page-tab {
  flex: 0 0 auto; border: 1px solid var(--line); background: #fff; color: var(--muted);
  padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 650;
}
.page-tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.page-tab.done { border-color: var(--teal-line); color: var(--teal-2); background: var(--teal-soft); }
.page-tab.active.done { background: var(--teal-2); border-color: var(--teal-2); color: #fff; }

.q-group { margin: 18px 0 8px; display: flex; align-items: center; gap: 10px; }
.q-group h3 { margin: 0; font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--teal-2); font-weight: 800; }
.q-group .line { flex: 1; height: 1px; background: var(--line); }

.q-card { padding: 17px 18px 18px; border: 1px solid var(--line); border-radius: 15px; background: #fff; margin-bottom: 10px; transition: border-color .15s ease, box-shadow .15s ease; }
.q-card:focus-within { border-color: #c7e6e1; box-shadow: 0 0 0 3px rgba(13, 148, 136, .06); }
.q-card.invalid { border-color: #fca5a5; background: #fffafa; }
.q-card .q-top { display: flex; gap: 10px; align-items: flex-start; }
.q-num { flex: 0 0 auto; min-width: 30px; height: 24px; border-radius: 8px; background: var(--teal-soft); color: var(--teal-2); font-size: 11px; font-weight: 800; display: grid; place-items: center; padding: 0 6px; }
.q-text { font-size: 15px; font-weight: 650; line-height: 1.5; flex: 1; }
.q-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.q-help { color: var(--muted); font-size: 11.5px; margin-top: 6px; line-height: 1.55; }
.q-error { color: var(--red); font-size: 11.5px; margin-top: 7px; display: none; }
.q-card.invalid .q-error { display: block; }
.q-body { margin-top: 13px; }
.q-ref { margin-top: 10px; font-size: 11.5px; color: var(--muted); background: #f8fafc; border: 1px dashed var(--line); border-radius: 9px; padding: 7px 10px; }

.qfoot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: rgba(255,255,255,.94); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  padding: 10px 0 calc(10px + var(--safe-bottom));
}
.qfoot-inner { display: flex; align-items: center; gap: 10px; }
.qfoot .count { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.qfoot .btn { flex: 1; }
.qfoot .btn-icon { flex: 0 0 44px; }

/* 复合题 */
.subq { background: #f8fafc; border: 1px solid var(--line-2); border-radius: 11px; padding: 12px; }
.subq + .subq { margin-top: 9px; }
.subq-label { font-size: 11.5px; font-weight: 700; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.vas-wrap { padding-top: 4px; }
.vas-value { display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px; }
.vas-value b { font-size: 30px; font-weight: 820; color: var(--teal-2); line-height: 1; }
.vas-value span { font-size: 12px; color: var(--muted); }
.vas-range { -webkit-appearance: none; appearance: none; width: 100%; height: 10px; border-radius: 999px; outline: none; background: linear-gradient(90deg, #10b981, #eab308 55%, #ef4444); }
.vas-range::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 3px solid var(--teal-2); box-shadow: 0 2px 8px rgba(15,23,42,.22); cursor: pointer; }
.vas-range::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 3px solid var(--teal-2); box-shadow: 0 2px 8px rgba(15,23,42,.22); cursor: pointer; }
.vas-scale { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted-2); margin-top: 5px; }

.freq-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.freq-row .input { width: 92px; text-align: center; }
.freq-row .unit { font-size: 12px; color: var(--muted); }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.stepper button { width: 42px; height: 44px; border: 0; background: #fff; font-size: 19px; color: var(--teal-2); }
.stepper button:hover { background: var(--teal-soft); }
.stepper input { width: 64px; height: 44px; border: 0; text-align: center; font-size: 16px; font-weight: 700; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }

.bristol-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.bristol-card { border: 1px solid var(--line); border-radius: 11px; background: #fff; padding: 8px 6px 9px; text-align: center; transition: all .14s ease; }
.bristol-card img { height: 50px; margin: 0 auto 5px; object-fit: contain; }
.bristol-card b { display: block; font-size: 11.5px; }
.bristol-card span { display: block; font-size: 10px; color: var(--muted); line-height: 1.35; margin-top: 1px; }
.bristol-card.selected { border-color: var(--teal-3); background: var(--teal-soft); box-shadow: 0 0 0 2px rgba(13,148,136,.08); }

/* ---------- 日期选择 ---------- */
.sheet-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .42); z-index: 100; display: none; }
.sheet-mask.open { display: block; animation: fadeIn .18s ease; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 101;
  background: #fff; border-radius: 22px 22px 0 0; box-shadow: 0 -20px 50px rgba(15,23,42,.18);
  transform: translateY(105%); transition: transform .24s cubic-bezier(.22,.8,.3,1);
  max-height: 88vh; display: flex; flex-direction: column; padding-bottom: var(--safe-bottom);
}
.sheet.open { transform: translateY(0); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; }
.sheet-title { font-weight: 780; font-size: 16px; }
.sheet-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.sheet-close { width: 34px; height: 34px; border-radius: 10px; border: 0; background: var(--line-2); display: grid; place-items: center; }
.sheet-close svg { width: 16px; height: 16px; }
.sheet-body { padding: 4px 18px 12px; overflow: auto; }
.sheet-foot { padding: 10px 18px 16px; border-top: 1px solid var(--line); display: flex; gap: 10px; }
.decade-nav { display: flex; gap: 6px; overflow-x: auto; padding: 6px 0 10px; scrollbar-width: none; }
.decade-nav::-webkit-scrollbar { display: none; }
.decade-nav button { flex: 0 0 auto; border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px; padding: 4px 10px; font-size: 11.5px; }
.decade-nav button.active { background: var(--teal-soft); color: var(--teal-2); border-color: var(--teal-line); }
.wheels { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; position: relative; }
.wheel-label { text-align: center; font-size: 10.5px; color: var(--muted); padding-bottom: 4px; }
.wheel { height: 210px; overflow-y: auto; scroll-snap-type: y mandatory; border-radius: 12px; background: #f8fafc; border: 1px solid var(--line-2); scrollbar-width: none; }
.wheel::-webkit-scrollbar { display: none; }
.wheel button { display: block; width: 100%; height: 42px; border: 0; background: transparent; color: var(--muted); font-size: 15px; scroll-snap-align: center; }
.wheel button.sel { color: var(--teal-2); font-weight: 800; background: #fff; border-radius: 9px; box-shadow: inset 0 0 0 1px var(--teal-line); }
.wheel::before, .wheel::after { content: ""; display: block; height: 84px; }

/* ---------- 报告 ---------- */
.report-hero { padding: 26px 0 10px; }
.report-hero .h1 { font-size: clamp(24px, 5.4vw, 32px); }
.report-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.score-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.score-card { padding: 15px 15px 13px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.score-card .sc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.score-card .sc-name { font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-card .sc-val { font-size: 27px; font-weight: 830; line-height: 1.15; margin-top: 4px; letter-spacing: -.5px; }
.score-card .sc-val small { font-size: 11px; font-weight: 600; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.score-card .sc-bar { height: 6px; border-radius: 999px; background: #edf2f7; margin-top: 10px; overflow: hidden; }
.score-card .sc-bar i { display: block; height: 100%; border-radius: 999px; }
.score-card .sc-note { font-size: 10.5px; color: var(--muted); margin-top: 7px; line-height: 1.45; }
.tone-good { color: var(--green); } .bg-good { background: #22c55e; }
.tone-mild { color: #a16207; } .bg-mild { background: #eab308; }
.tone-warn { color: var(--amber); } .bg-warn { background: #f59e0b; }
.tone-bad { color: var(--red); } .bg-bad { background: #ef4444; }
.tone-info { color: var(--muted); } .bg-info { background: #94a3b8; }
.score-card.unavailable { background: #fbfcfd; border-style: dashed; }

.ai-panel { border: 1px solid #c7e6e1; border-radius: var(--radius); background: linear-gradient(180deg, #f3fbf9, #fff 55%); padding: 20px; }
.ai-head { display: flex; align-items: center; gap: 10px; }
.ai-badge { width: 36px; height: 36px; border-radius: 11px; background: linear-gradient(135deg, #0f766e, #2dd4bf); color: #fff; display: grid; place-items: center; }
.ai-badge svg { width: 19px; height: 19px; }
.ai-pending { display: flex; align-items: center; gap: 12px; padding: 16px 0 4px; color: var(--muted); font-size: 13px; }
.pulse-dots { display: inline-flex; gap: 4px; }
.pulse-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--teal-3); animation: pulse 1.2s infinite ease-in-out; }
.pulse-dots i:nth-child(2) { animation-delay: .15s; }
.pulse-dots i:nth-child(3) { animation-delay: .3s; }
.md { font-size: 14px; line-height: 1.78; color: var(--ink-2); }
.md h1, .md h2, .md h3 { font-size: 15.5px; margin: 16px 0 6px; color: var(--teal-2); }
.md p { margin: 0 0 9px; }
.md ul, .md ol { margin: 4px 0 10px; padding-left: 20px; }
.md li { margin: 3px 0; }
.md strong { color: var(--ink); }
.md blockquote { margin: 10px 0 4px; padding: 9px 12px; border-left: 3px solid var(--teal-line); background: var(--teal-soft); color: var(--teal-2); border-radius: 0 8px 8px 0; font-size: 12.5px; }
.disclaimer { display: flex; gap: 9px; align-items: flex-start; background: var(--amber-soft); border: 1px solid #fde68a; color: #92400e; border-radius: 11px; padding: 10px 12px; font-size: 11.5px; line-height: 1.6; }
.disclaimer svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; }

.qalist { display: flex; flex-direction: column; gap: 0; }
.qa-sec { border-top: 1px solid var(--line); padding: 12px 0 4px; }
.qa-sec:first-child { border-top: 0; }
.qa-sec h4 { margin: 0 0 6px; font-size: 12px; color: var(--teal-2); letter-spacing: .6px; }
.qa-item { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line-2); font-size: 12.5px; }
.qa-item:last-child { border-bottom: 0; }
.qa-item .qt { color: var(--muted); }
.qa-item .qa { color: var(--ink); font-weight: 600; text-align: right; }
.qa-item .qa.pre { color: var(--muted); }

/* ---------- 医生端 ---------- */
.doctor-shell { padding: 24px 0 80px; }
.doctor-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 14px; scrollbar-width: none; }
.doctor-tabs::-webkit-scrollbar { display: none; }
.doctor-tab { flex: 0 0 auto; border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px; padding: 8px 14px; font-size: 12.5px; font-weight: 650; }
.doctor-tab.active { background: var(--teal-2); color: #fff; border-color: var(--teal-2); }
.doctor-tab .badge { display: inline-block; min-width: 16px; height: 16px; border-radius: 8px; background: #fff; color: var(--teal-2); font-size: 10px; line-height: 16px; text-align: center; margin-left: 5px; padding: 0 3px; }
.phase-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 0 4px; }
.phase-bar .seg button { padding: 8px 18px; }
.compare-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.compare-table th, .compare-table td { padding: 8px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.compare-table th { background: var(--teal-soft); color: var(--teal-2); font-size: 11px; letter-spacing: .4px; }
.compare-table td:first-child { color: var(--muted); width: 46%; }
.compare-table .same { color: var(--muted); }
.compare-table .diff { color: var(--ink); font-weight: 650; }
.phase-progress { display: flex; gap: 8px; align-items: center; font-size: 11.5px; color: var(--muted); }

/* ---------- 管理端 ---------- */
.admin-body { background: #f1f5f9; }
.admin-shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: #0b3b37; color: #d1fae5; padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.sidebar .brand-title { color: #fff; }
.sidebar .brand-sub { color: #6ee7b7; }
.side-nav { margin-top: 26px; display: flex; flex-direction: column; gap: 4px; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: #a7f3d0; font-size: 13px; font-weight: 600; border: 0; background: transparent; text-align: left; }
.side-link svg { width: 17px; height: 17px; opacity: .9; }
.side-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-link.active { background: rgba(45, 212, 191, .16); color: #fff; box-shadow: inset 0 0 0 1px rgba(94,234,212,.22); }
.side-foot { margin-top: auto; font-size: 10.5px; color: #6ee7b7; line-height: 1.6; }
.admin-main { padding: 26px 30px 60px; min-width: 0; }
.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.admin-head .h2 { font-size: 24px; }
.mobile-admin-nav { display: none; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-card { padding: 17px 18px; border-radius: 14px; background: #fff; border: 1px solid var(--line); }
.stat-card .st-label { font-size: 11px; color: var(--muted); letter-spacing: .8px; text-transform: uppercase; font-weight: 700; }
.stat-card .st-val { font-size: 30px; font-weight: 830; letter-spacing: -.6px; margin-top: 3px; line-height: 1.1; }
.stat-card .st-sub { font-size: 11px; color: var(--muted-2); margin-top: 3px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 15px; padding: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h3 { margin: 0; font-size: 14px; font-weight: 750; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 8px; }
.chart .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; height: 100%; }
.chart .bar i { width: 100%; max-width: 26px; background: linear-gradient(180deg, #2dd4bf, #0f766e); border-radius: 5px 5px 2px 2px; min-height: 2px; transition: height .4s ease; }
.chart .bar b { font-size: 9.5px; color: var(--muted); font-weight: 600; }
.chart .bar span { font-size: 9px; color: var(--muted-2); }
.chart .bar .d-day { display: none; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 760px; }
.table th { position: sticky; top: 0; background: #f8fafc; color: var(--muted); font-size: 10.5px; letter-spacing: .6px; text-transform: uppercase; text-align: left; padding: 9px 11px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 11px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #f8fbfd; }
.table .link { color: var(--teal-2); font-weight: 700; cursor: pointer; border: 0; background: none; padding: 0; font-size: inherit; }
select.input { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.drawer-mask { position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 90; display: none; }
.drawer-mask.open { display: block; animation: fadeIn .16s ease; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100%); background: #f8fafc; z-index: 91; transform: translateX(102%); transition: transform .26s cubic-bezier(.22,.8,.3,1); display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }
.drawer-head { padding: 16px 20px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.drawer-body { overflow: auto; padding: 18px 20px 40px; }
.kv { display: grid; grid-template-columns: 88px 1fr; gap: 6px 12px; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.settings-grid .full { grid-column: 1 / -1; }
.code-box { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11.5px; background: #0f172a; color: #a7f3d0; padding: 10px 12px; border-radius: 9px; word-break: break-all; line-height: 1.6; }

/* ---------- 登录 ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(700px 420px at 50% -10%, #d7f5ef, transparent), var(--bg); }
.auth-card { width: min(400px, 100%); padding: 28px; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }

/* ---------- Toast / 加载 ---------- */
.toast { position: fixed; left: 50%; bottom: calc(28px + var(--safe-bottom)); transform: translate(-50%, 20px); z-index: 200; background: #0f172a; color: #fff; font-size: 13px; padding: 11px 18px; border-radius: 999px; box-shadow: 0 12px 30px rgba(15,23,42,.24); opacity: 0; pointer-events: none; transition: all .2s ease; max-width: 86vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #7f1d1d; }
.loading-screen { min-height: 60vh; display: grid; place-items: center; color: var(--muted); gap: 12px; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid #d1e7e3; border-top-color: var(--teal-3); animation: spin 0.9s linear infinite; }
.empty { border: 1px dashed var(--line); border-radius: 14px; padding: 26px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- 动画 ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-up { animation: fadeUp .35s ease both; }
.fade-up-2 { animation: fadeUp .35s .08s ease both; }
.fade-up-3 { animation: fadeUp .35s .16s ease both; }

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
  .score-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .admin-main { padding: 18px 16px 50px; }
  .mobile-admin-nav { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 14px; }
  .mobile-admin-nav button { flex: 0 0 auto; border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px; padding: 7px 13px; font-size: 12px; font-weight: 650; }
  .mobile-admin-nav button.active { background: var(--teal-2); color: #fff; border-color: var(--teal-2); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-grid .full { grid-column: auto; }
  .ov-grid, .stats-grid { grid-template-columns: 1fr !important; }
  .ov-grid > *, .stats-grid > * { min-width: 0; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .wrap, .wrap-narrow { padding: 0 14px; }
  .topbar-inner { height: 54px; }
  .progress-track { top: 54px; }
  .brand-title { font-size: 13px; }
  .brand-sub { display: none; }
  .hero { padding: 30px 0 18px; }
  .hero .lead { font-size: 13.5px; }
  .entry-card { padding: 20px; margin-top: 18px; }
  .mode-grid { grid-template-columns: 1fr; }
  .mode-note { display: none; }
  .score-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .score-card { padding: 12px 12px 11px; }
  .score-card .sc-val { font-size: 23px; }
  .q-card { padding: 15px 14px 16px; border-radius: 14px; }
  .q-text { font-size: 14.5px; }
  .options.cols-3, .options.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .options.days-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .bristol-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .qfoot-inner { gap: 8px; }
  .qfoot .count { display: none; }
  .admin-head { flex-direction: column; align-items: flex-start; gap: 6px; }
  .stat-grid { gap: 8px; }
  .chart .bar .d-full { display: none; }
  .chart .bar .d-day { display: block; }
  .chart { gap: 4px; }
  .stat-card { padding: 13px 14px; }
  .stat-card .st-val { font-size: 25px; }
  .drawer { width: 100%; }
  .table { min-width: 640px; }
  .qa-item { grid-template-columns: 1fr; gap: 2px; }
  .qa-item .qa { text-align: left; }
  .compare-table { font-size: 11.5px; }
  .compare-table th, .compare-table td { padding: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* 打印（报告页可直接打印） */
@media print {
  .topbar, .qfoot, .no-print, .toast { display: none !important; }
  body { background: #fff; }
  .card, .ai-panel { box-shadow: none; border-color: #ddd; }
  .report-hero { padding-top: 0; }
}
