/* ========= 私人健康档案 · Neumorphism =========
   柔雾鼠尾草单色基底，双向柔影雕刻凸凹：
   凸（raised）= 卡片/按钮；凹（inset）= 输入/选中/容器。
   红线：正文对比 ≥4.5:1，焦点可见，尊重 reduced-motion。 */

:root {
  --base: #e4ece7;            /* 全站唯一基底色 */
  --base-2: #dde7e1;
  --ink: #1f2e27;             /* 正文 ~11:1 */
  --muted: #56685e;           /* 次要 ~5.2:1 */
  --faint: #7c8d83;
  --pine: #0e5c4c;
  --pine-deep: #0a443a;
  --cinnabar: #b14223;
  --indigo: #33598f;
  --gold: #8a6f2a;

  /* 双向柔影 */
  --sh-dark: rgba(146, 164, 155, .62);
  --sh-light: rgba(255, 255, 255, .92);
  --raise: 7px 7px 14px var(--sh-dark), -7px -7px 14px var(--sh-light);
  --raise-sm: 4px 4px 8px var(--sh-dark), -4px -4px 8px var(--sh-light);
  --raise-lg: 10px 10px 22px var(--sh-dark), -10px -10px 22px var(--sh-light);
  --inset: inset 4px 4px 8px var(--sh-dark), inset -4px -4px 8px var(--sh-light);
  --inset-sm: inset 2.5px 2.5px 5px var(--sh-dark), inset -2.5px -2.5px 5px var(--sh-light);

  --font-display: "LXGW WenKai Screen", "Noto Serif SC", "Songti SC", serif;
  --font-body: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-num: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r: 16px;
  --r-lg: 22px;
}

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

body {
  font-family: var(--font-body);
  background: var(--base);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
  min-height: 100vh;
}

/* 极淡的环境光晕，强化单色基底的体积感 */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(255, 255, 255, .55), transparent 60%),
    radial-gradient(900px 600px at 105% 110%, rgba(146, 164, 155, .28), transparent 55%);
}

::selection { background: rgba(14, 92, 76, .22); }

:focus-visible {
  outline: 2.5px solid var(--pine);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ========= 布局骨架 ========= */
.shell { display: flex; min-height: 100vh; position: relative; z-index: 1; }

.side {
  width: 224px;
  flex: 0 0 224px;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky; top: 0; height: 100vh;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand .seal {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  color: var(--pine);
  font-family: var(--font-display);
  font-size: 23px;
  border-radius: 14px;
  background: var(--base);
  box-shadow: var(--raise-sm);
}

.brand-text b {
  display: block;
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: .06em;
}
.brand-text span { font-size: 11.5px; color: var(--muted); letter-spacing: .14em; }

.side nav { display: flex; flex-direction: column; gap: 10px; }

.side nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 15px;
  border-radius: 13px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14.5px;
  letter-spacing: .04em;
  transition: box-shadow .2s ease, color .2s ease;
}
.side nav a svg { width: 17px; height: 17px; flex: none; stroke: currentColor; }
.side nav a:hover { box-shadow: var(--raise-sm); color: var(--pine-deep); }
.side nav a.active {
  box-shadow: var(--inset-sm);
  color: var(--pine);
  font-weight: 600;
}

.side-foot {
  margin-top: auto;
  font-size: 11.5px;
  color: var(--faint);
  line-height: 1.9;
  letter-spacing: .05em;
  padding: 14px 16px;
  border-radius: 13px;
  box-shadow: var(--inset-sm);
}

main { flex: 1; padding: 36px 42px 64px; max-width: 1060px; }

/* ========= 标题 ========= */
.kicker {
  font-size: 11px;
  letter-spacing: .32em;
  color: var(--pine);
  text-transform: uppercase;
  margin-bottom: 6px;
  font-weight: 700;
}
h1 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: .04em;
}
.sub { color: var(--muted); font-size: 13.5px; margin: 0 0 28px; }

h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 16px;
  letter-spacing: .05em;
  display: flex; align-items: center; gap: 10px;
}
.h3i { width: 18px; height: 18px; stroke: var(--pine); flex: none; }

/* ========= 卡片（凸起） ========= */
.card {
  background: var(--base);
  border-radius: var(--r-lg);
  padding: 24px 26px;
  margin-bottom: 24px;
  box-shadow: var(--raise);
  position: relative;
}

.reveal { animation: rise .5s cubic-bezier(.22, .8, .3, 1) both; animation-delay: var(--d, 0s); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ========= 统计块 ========= */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-bottom: 24px; }
.stat {
  background: var(--base);
  border-radius: var(--r-lg);
  padding: 18px 22px 15px;
  box-shadow: var(--raise);
}
.stat .label { font-size: 12px; color: var(--muted); letter-spacing: .12em; }
.stat .value {
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 1.25;
  color: var(--pine-deep);
}
.stat .value.warn { color: var(--cinnabar); }
.stat .hint { font-size: 11.5px; color: var(--faint); }

/* ========= 表格 ========= */
table { border-collapse: collapse; width: 100%; }
th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .18em;
  color: var(--faint);
  padding: 6px 10px 10px;
}
td {
  padding: 12px 10px;
  font-size: 14px;
  vertical-align: middle;
  border-top: 1px solid rgba(146, 164, 155, .25);
}
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: rgba(255, 255, 255, .35); }
.num { font-family: var(--font-num); font-size: 13.5px; letter-spacing: -.01em; }

/* 标记 chip：微凸药片 */
.chip {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .08em;
  padding: 3px 11px;
  border-radius: 99px;
  background: var(--base);
  box-shadow: var(--raise-sm);
}
.chip.high { color: var(--cinnabar); }
.chip.low { color: var(--indigo); }
.chip.normal { color: var(--pine); }
.chip.unknown { color: var(--gold); }

td.v-high, .v-high { color: var(--cinnabar); font-weight: 700; }
td.v-low, .v-low { color: var(--indigo); font-weight: 700; }

/* 参考范围微型条：凹槽 + 凸点 */
.range {
  position: relative;
  width: 86px; height: 8px;
  border-radius: 4px;
  background: var(--base);
  box-shadow: var(--inset-sm);
}
.range i {
  position: absolute; top: 50%;
  width: 12px; height: 12px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--pine);
  box-shadow: 2px 2px 4px var(--sh-dark), -1px -1px 3px var(--sh-light);
}
.range i.out { background: var(--cinnabar); }

/* ========= 按钮 / 输入 ========= */
button, .btn {
  font-family: var(--font-body);
  background: var(--base);
  color: var(--pine);
  border: 0;
  padding: 10px 22px;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .08em;
  cursor: pointer;
  box-shadow: var(--raise-sm);
  transition: box-shadow .18s ease, color .18s ease, transform .12s ease;
}
button:hover { box-shadow: var(--raise); color: var(--pine-deep); }
button:active { box-shadow: var(--inset-sm); transform: scale(.985); }
button.ghost { color: var(--muted); }
button.ghost:hover { color: var(--pine); }
button.danger { color: var(--cinnabar); padding: 7px 14px; }
button:disabled { opacity: .45; cursor: not-allowed; box-shadow: var(--raise-sm); transform: none; }

input, textarea, select {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--base);
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  outline: none;
  box-shadow: var(--inset-sm);
  transition: box-shadow .18s ease;
}
input:focus, textarea:focus, select:focus {
  box-shadow: var(--inset-sm), 0 0 0 2.5px rgba(14, 92, 76, .35);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { resize: vertical; }

/* ========= 指标选择 chips ========= */
.chips { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.chips button {
  padding: 7px 18px;
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--muted);
  border-radius: 99px;
}
.chips button:hover { color: var(--pine); }
.chips button.on {
  box-shadow: var(--inset-sm);
  color: var(--pine);
  font-weight: 700;
}

.refband-note { font-size: 12.5px; color: var(--muted); font-family: var(--font-num); margin: 6px 0 0; text-align: right; }

/* ========= 会诊报告 ========= */
.report-grid { display: grid; grid-template-columns: 230px 1fr; gap: 24px; align-items: start; }

.rlist { display: flex; flex-direction: column; gap: 14px; }
.rlist button {
  text-align: left;
  font-family: var(--font-num);
  font-size: 13.5px;
  font-weight: 500;
  padding: 12px 16px;
  color: var(--ink);
  display: flex; justify-content: space-between; align-items: center;
  border-radius: 13px;
}
.rlist button::after { content: "→"; color: var(--faint); transition: transform .15s ease, color .15s ease; }
.rlist button.on {
  box-shadow: var(--inset-sm);
  color: var(--pine);
  font-weight: 700;
}
.rlist button.on::after { color: var(--pine); transform: translateX(2px); }

/* 朱砂印章 */
.stamp {
  position: absolute;
  top: 28px; right: 28px;
  padding: 7px 11px;
  border: 2.5px solid rgba(177, 66, 35, .6);
  border-radius: 8px;
  outline: 1px solid rgba(177, 66, 35, .28);
  outline-offset: 3px;
  color: rgba(177, 66, 35, .78);
  font-family: var(--font-display);
  font-size: 13.5px;
  line-height: 1.5;
  text-align: center;
  letter-spacing: .2em;
  transform: rotate(-7deg);
  pointer-events: none;
  user-select: none;
  mix-blend-mode: multiply;
}

/* markdown 渲染 */
.md { font-size: 14.5px; }
.md h1 { font-size: 24px; margin: 4px 0 16px; padding-right: 120px; }
.md h2 {
  font-family: var(--font-display);
  font-size: 17px;
  margin: 28px 0 10px;
  padding-bottom: 8px;
  letter-spacing: .05em;
  border-bottom: 1px solid rgba(146, 164, 155, .35);
}
.md h3 { font-size: 15px; margin: 18px 0 8px; color: var(--pine-deep); }
.md ul { margin: 8px 0; padding-left: 22px; }
.md li { margin: 5px 0; }
.md blockquote {
  margin: 20px 0 0;
  padding: 13px 17px;
  border-radius: 13px;
  box-shadow: var(--inset-sm);
  color: var(--gold);
  font-size: 13px;
}
.md strong { color: var(--pine-deep); }
.md p { margin: 8px 0; }

/* ========= 对话气泡 ========= */
.chatlog { display: flex; flex-direction: column; gap: 14px; max-height: 420px; overflow-y: auto; padding: 6px 4px 14px; }
.bub { max-width: 78%; padding: 12px 16px; border-radius: 16px; font-size: 14px; }
.bub.user {
  align-self: flex-end;
  background: var(--pine);
  color: #eaf2ee;
  border-bottom-right-radius: 5px;
  box-shadow: 5px 5px 10px var(--sh-dark);
}
.bub.ai {
  align-self: flex-start;
  background: var(--base);
  box-shadow: var(--raise-sm);
  border-bottom-left-radius: 5px;
}
.bub.ai .md { font-size: 14px; }
.bub .who { font-size: 11px; letter-spacing: .15em; opacity: .65; margin-bottom: 3px; }

.chat-input { display: flex; gap: 14px; align-items: flex-end; margin-top: 8px; }
.chat-input textarea { flex: 1; }

.thinking { display: inline-flex; gap: 5px; padding: 4px 2px; }
.thinking i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--pine);
  opacity: .35;
  animation: blink 1.2s infinite;
}
.thinking i:nth-child(2) { animation-delay: .2s; }
.thinking i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

/* ========= 会诊直播室 ========= */
.consult-launch { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.consult-launch label { font-size: 13.5px; color: var(--muted); }
.consult-launch select { min-width: 230px; cursor: pointer; }

.liveroom { margin-top: 20px; border-top: 1px solid rgba(146, 164, 155, .3); padding-top: 18px; }
.live-phase { font-size: 13.5px; color: var(--muted); margin-bottom: 16px; display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.live-card {
  border-radius: var(--r);
  padding: 13px 15px;
  box-shadow: var(--inset-sm);
  animation: rise .4s cubic-bezier(.22, .8, .3, 1) both;
}
.live-card.done { box-shadow: var(--raise-sm); }
.live-name { font-family: var(--font-display); font-size: 14.5px; font-weight: 600; margin-bottom: 6px; color: var(--pine-deep); }
.live-body { font-size: 12.5px; color: var(--muted); }
.live-body p { margin: 0 0 6px; }
.live-body ul { margin: 0; padding-left: 16px; }
.live-body li { margin: 3px 0; }

/* ========= 用药清单 ========= */
.medrow { display: grid; grid-template-columns: 1.1fr .8fr 1.3fr .8fr .8fr 1.1fr auto; gap: 10px; margin-bottom: 12px; align-items: center; }
.medrow input { width: 100%; }
.med-actions { display: flex; gap: 16px; margin-top: 18px; }

.medtips { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.medtip {
  border-radius: var(--r);
  padding: 16px 18px;
  box-shadow: var(--raise-sm);
}
.medtip.stopped { opacity: .55; box-shadow: var(--inset-sm); }
.medtip-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.medtip-head b { font-family: var(--font-display); font-size: 15.5px; letter-spacing: .04em; }
.medtip dl { margin: 0; display: grid; grid-template-columns: 56px 1fr; gap: 7px 10px; font-size: 13px; }
.medtip dt { color: var(--faint); letter-spacing: .1em; }
.medtip dd { margin: 0; color: var(--ink); }

/* ========= 上传 ========= */
.drop {
  border-radius: var(--r);
  padding: 46px 20px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--inset);
  transition: box-shadow .2s ease;
}
.drop:hover, .drop.over { box-shadow: var(--inset), 0 0 0 2.5px rgba(14, 92, 76, .3); }
.drop .ico { font-size: 34px; line-height: 1; margin-bottom: 10px; }
.drop b { font-family: var(--font-display); font-size: 16px; letter-spacing: .06em; }
.drop p { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }
.drop input[type="file"] { display: none; }

.upload-form { display: flex; gap: 16px; align-items: center; margin-top: 20px; flex-wrap: wrap; }
.upload-form label { font-size: 13.5px; color: var(--muted); }

.msg-ok { color: var(--pine); font-size: 13.5px; font-weight: 600; }
.msg-err { color: var(--cinnabar); font-size: 13.5px; font-weight: 600; }
.msg-muted { color: var(--muted); font-size: 13px; }

.empty {
  text-align: center;
  color: var(--faint);
  padding: 36px 10px;
  font-size: 13.5px;
  letter-spacing: .05em;
}
.empty .glyph { font-family: var(--font-display); font-size: 30px; display: block; margin-bottom: 8px; opacity: .55; }

.disclaimer {
  margin-top: 30px;
  padding: 13px 18px;
  border-radius: 14px;
  box-shadow: var(--inset-sm);
  color: var(--gold);
  font-size: 12.5px;
  letter-spacing: .04em;
  display: flex; gap: 9px; align-items: center;
}

/* ========= 健康日记 ========= */
.journal-log { max-height: 520px; }
.jdate {
  align-self: center;
  font-family: var(--font-num);
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: .15em;
  padding: 4px 16px;
  border-radius: 99px;
  box-shadow: var(--inset-sm);
  margin: 10px 0 2px;
}

/* ========= 无障碍 ========= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ========= 响应式 ========= */
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .side {
    width: auto; height: auto; position: static;
    flex-direction: row; align-items: center;
    padding: 14px 18px; gap: 18px;
  }
  .side nav { flex-direction: row; overflow-x: auto; padding: 4px; }
  .side nav a { padding: 9px 13px; white-space: nowrap; }
  .side-foot { display: none; }
  .brand { flex: none; }
  .brand .seal { width: 38px; height: 38px; font-size: 19px; }
  .brand-text b { font-size: 15px; white-space: nowrap; }
  .brand-text span { display: none; }
  main { padding: 24px 18px 48px; }
  .stats { grid-template-columns: 1fr; }
  .report-grid { grid-template-columns: 1fr; }
  .medrow { grid-template-columns: 1fr 1fr; }
}


/* ========= 图标 ========= */
.ic { width: 12px; height: 12px; vertical-align: -1.5px; margin-right: 4px; }
.chip .ic { width: 11px; height: 11px; }
.chip.normal:has(.ic:only-child) { padding: 3px 9px; }
.chip .ic:only-child { margin-right: 0; }
.bi { width: 15px; height: 15px; vertical-align: -2.5px; margin-right: 6px; }
.di { width: 17px; height: 17px; flex: none; }
.dropi { width: 36px; height: 36px; stroke: var(--faint); }
.medtip dt .ic { width: 16px; height: 16px; margin: 0; stroke: var(--faint); }
.medtip dl { grid-template-columns: 26px 1fr; }
.live-name .ic.ok { width: 14px; height: 14px; stroke: var(--pine); margin-right: 5px; }
