﻿/* ==========================================================
   患者随访管理系统 · 手机端样式
   ========================================================== */
:root {
  --teal: #2563eb;
  --teal-600: #1d4ed8;
  --teal-700: #1e40af;
  --teal-50: #eaf1ff;
  --teal-100: #d7e5ff;
  --ink: #111c2e;
  --text: #253345;
  --muted: #6b7c8f;
  --line: #e4eaf2;
  --bg: #f3f6fb;
  --card: #ffffff;
  --amber: #d97706;
  --amber-bg: #fef3c7;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --blue: #2563eb;
  --blue-bg: #dbeafe;
  --violet: #0284c7;
  --violet-bg: #e0f2fe;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 20px -12px rgba(15, 23, 42, .18);
  --topbar-h: 58px;
  --tabbar-h: 62px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font-family: inherit; font-size: 16px; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
svg { display: block; }

.app-shell { min-height: 100dvh; }

/* ------------------------------ 顶部栏 ------------------------------ */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 10px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(243, 247, 245, .92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(227, 236, 233, .8);
}
.topbar-side { width: 52px; flex: none; display: flex; align-items: center; }
.topbar-side.right { justify-content: flex-end; }
.topbar-main { flex: 1; min-width: 0; text-align: center; }
.topbar-main h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-main p {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.back-btn {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}
.back-btn:active { background: var(--teal-50); }
.back-btn svg { width: 22px; height: 22px; }
.top-action {
  border: none;
  background: var(--teal);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  padding: 7px 13px;
  white-space: nowrap;
}
.top-action:active { background: var(--teal-700); }
.top-share {
  width: 36px;
  height: 36px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
}
.top-share:active { background: var(--teal-50); }
.top-share svg { width: 19px; height: 19px; }
.share-wx p { font-size: 14px; color: var(--text); line-height: 1.9; }
.share-wx p.tip { font-size: 12.5px; color: var(--muted); margin-top: 4px; line-height: 1.7; }
.share-wx-tip {
  font-size: 12.5px; color: var(--muted); background: #f1f5f9; border-radius: 10px;
  padding: 10px 12px; line-height: 1.65; margin-bottom: 14px;
}
.share-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 6px; padding: 2px 0 6px;
}
.share-item {
  border: 0; background: none; padding: 0; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
}
.share-ico {
  width: 48px; height: 48px; border-radius: 14px; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 700; font-style: normal;
}
.share-item em { font-style: normal; font-size: 12px; color: var(--text); }
.share-item.wx .share-ico { background: #07c160; }
.share-item.qq .share-ico { background: #12b7f5; }
.share-item.wb .share-ico { background: #e6162d; }
.share-item.sys .share-ico { background: #14b8a6; }
.share-item.copy .share-ico { background: #64748b; }
.share-item:active .share-ico { opacity: 0.78; }

/* ------------------------------ 内容区 ------------------------------ */
.view {
  padding: calc(var(--topbar-h) + env(safe-area-inset-top) + 14px) 14px
           calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 22px);
  max-width: 640px;
  margin: 0 auto;
}
body.no-tabs .view { padding-bottom: calc(env(safe-area-inset-bottom) + 96px); }
body.no-tabs .tabbar { display: none; }

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 70px 0;
  color: var(--muted);
  font-size: 14px;
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2.4px solid var(--teal-100);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------ 底部导航 ------------------------------ */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #8a9a94;
  font-size: 10.5px;
  font-weight: 600;
}
.tab svg { width: 23px; height: 23px; }
.tab.active { color: var(--teal); }
.tab:active { background: var(--teal-50); }

/* ------------------------------ 通用组件 ------------------------------ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(227, 236, 233, .7);
  overflow: hidden;
}
.card + .card { margin-top: 12px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 0;
}
.card-head h2 { font-size: 15px; font-weight: 700; }
.card-head .link { color: var(--teal); font-size: 12.5px; font-weight: 600; }
.card-body { padding: 12px 16px 16px; }

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 2px 9px;
}
.section-title h2 { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.section-title .link { color: var(--teal); font-size: 12.5px; font-weight: 600; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 5px 8px;
  border-radius: 999px;
  background: #eef2f1;
  color: #55655f;
  white-space: nowrap;
}
.badge.green { background: var(--teal-50); color: var(--teal-700); }
.badge.amber { background: var(--amber-bg); color: #b45309; }
.badge.red { background: var(--red-bg); color: #b91c1c; }
.badge.blue { background: var(--blue-bg); color: #1d4ed8; }
.badge.violet { background: var(--violet-bg); color: #0284c7; }
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.muted { color: var(--muted); }
.small { font-size: 12px; }

.avatar {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  background: var(--teal-50);
  color: var(--teal-700);
}
.avatar.f { background: #fdeaea; color: #b91c1c; }
.avatar.m { background: var(--blue-bg); color: #1d4ed8; }
.avatar.sm { width: 36px; height: 36px; border-radius: 11px; font-size: 14px; }

/* 行列表 */
.row-list { display: flex; flex-direction: column; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: none; }
.row:active { background: #f7fbfa; }
.row-main { flex: 1; min-width: 0; }
.row-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14.5px;
  font-weight: 650;
  color: var(--ink);
}
.row-title .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.row-sub .ellipsis { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-side { flex: none; display: flex; align-items: center; gap: 6px; }
.row-arrow { color: #b7c4c0; font-size: 20px; line-height: 1; }

/* 工作台统计 */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat {
  position: relative;
  border: 1px solid rgba(227, 236, 233, .8);
  background: var(--card);
  border-radius: 15px;
  padding: 13px 14px;
  box-shadow: var(--shadow);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 84px;
}
.stat:active { transform: scale(.985); }
.stat .num { font-size: 25px; font-weight: 750; color: var(--ink); line-height: 1.15; }
.stat .label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.stat .mark {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--teal);
}
.stat.amber .mark { background: var(--amber); }
.stat.amber .num { color: #b45309; }
.stat.red .mark { background: var(--red); }
.stat.red .num { color: #b91c1c; }
.stat.blue .mark { background: var(--blue); }
.stat .hint { font-size: 11px; color: #93a5a0; margin-top: auto; }

/* 问候卡 */
.hello {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  padding: 18px;
  color: #fff;
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 58%, #3b82f6 100%);
  box-shadow: 0 14px 28px -16px rgba(37, 99, 235, .55);
}
.hello::after {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  right: -42px;
  top: -58px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
}
.hello .hi { font-size: 12.5px; opacity: .82; }
.hello .title { font-size: 20px; font-weight: 700; margin-top: 3px; letter-spacing: .3px; }
.hello .meta { font-size: 12.5px; opacity: .9; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.hello .meta b { font-weight: 700; }

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.quick {
  background: var(--card);
  border: 1px solid rgba(227, 236, 233, .8);
  border-radius: 15px;
  padding: 13px 6px 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.quick:active { transform: scale(.97); background: #fbfefd; }
.quick .ic {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--teal-50);
  color: var(--teal);
}
.quick .ic svg { width: 20px; height: 20px; }
.quick.amber .ic { background: var(--amber-bg); color: var(--amber); }
.quick.blue .ic { background: var(--blue-bg); color: var(--blue); }

/* 搜索 */
.search {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 13px;
  height: 46px;
  box-shadow: var(--shadow);
}
.search svg { width: 17px; height: 17px; color: #9aaba6; flex: none; }
.search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  min-width: 0;
}
.search input::placeholder { color: #a5b5b0; }
.search .clear {
  border: none;
  background: #eef3f1;
  color: #7b8d87;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 13px;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  flex: none;
}
.search.has-value .clear { display: flex; }

/* 筛选 chips */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 4px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip b { font-weight: 700; }
.chip.active { background: var(--teal); border-color: var(--teal); color: #fff; }
.chip.active b { color: #fff; }
.chip .n { font-size: 11px; background: rgba(0, 0, 0, .06); border-radius: 999px; padding: 1px 6px; }
.chip.active .n { background: rgba(255, 255, 255, .22); }

/* 按钮 */
.btn {
  border: none;
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 14.5px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #eef3f1;
  color: var(--text);
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:active { background: var(--teal-700); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn-soft { background: var(--teal-50); color: var(--teal-700); }
.btn-danger { background: var(--red-bg); color: #b91c1c; }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn .ld { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }

.icon-btn {
  width: 36px;
  height: 36px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--teal);
}
.icon-btn:active { background: var(--teal-50); }
.icon-btn svg { width: 18px; height: 18px; }

/* 患者详情 */
.profile {
  border-radius: 20px;
  padding: 16px;
  background: linear-gradient(150deg, #ffffff 0%, #f1faf7 100%);
  border: 1px solid rgba(204, 235, 229, .9);
  box-shadow: var(--shadow);
}
.profile-top { display: flex; align-items: center; gap: 13px; }
.profile-top .avatar { width: 52px; height: 52px; border-radius: 16px; font-size: 20px; }
.profile-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile-name h2 { font-size: 19px; font-weight: 750; color: var(--ink); }
.profile-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.profile-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 14px; }
.profile-actions .btn { padding: 10px 8px; font-size: 13px; }
.profile-actions .btn.danger { color: var(--red); border-color: #f3c1bd; background: #fff; }
.profile-actions .btn.danger:active { background: #fff1f0; }

.kv-list { display: flex; flex-direction: column; }
.kv {
  display: flex;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13.5px;
}
.kv:last-child { border-bottom: none; }
.kv .k { width: 72px; flex: none; color: var(--muted); }
.kv .v { flex: 1; min-width: 0; word-break: break-all; }

.tabs {
  display: flex;
  gap: 0;
  background: #eaf1ef;
  border-radius: 12px;
  padding: 3px;
  margin: 16px 0 12px;
}
.tabs button {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: 9px;
  padding: 9px;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--muted);
}
.tabs button.active { background: var(--card); color: var(--teal-700); box-shadow: 0 1px 3px rgba(16,40,34,.12); }

.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--teal-100);
  border-radius: 2px;
}
.tl-item { position: relative; margin-bottom: 12px; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 18px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--teal-600);
}
.tl-item.follow::before { border-color: #f59e0b; }
.tl-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  box-shadow: var(--shadow);
}
.tl-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tl-head b { font-size: 13.5px; color: var(--ink); }
.tl-date { font-size: 12px; color: var(--muted); }
.tl-body { margin-top: 8px; font-size: 13px; color: #33453f; }
.tl-body .line { display: flex; gap: 8px; margin-top: 5px; }
.tl-body .line .k { color: var(--muted); flex: none; width: 36px; }
.tl-body .line .v { flex: 1; min-width: 0; white-space: pre-wrap; word-break: break-word; }

/* 空状态 */
.empty {
  text-align: center;
  padding: 38px 20px;
  color: var(--muted);
  font-size: 13.5px;
}
.empty .ic {
  width: 54px;
  height: 54px;
  margin: 0 auto 10px;
  border-radius: 18px;
  background: var(--teal-50);
  color: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 23px;
  font-weight: 700;
}

/* 悬浮新建按钮 */
.fab {
  position: fixed;
  right: 18px;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 18px);
  z-index: 40;
  width: 54px;
  height: 54px;
  border: none;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 27px;
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 22px -8px rgba(37, 99, 235, .6);
}
.fab:active { transform: scale(.94); }

/* ------------------------------ 表单 ------------------------------ */
.form-card {
  background: var(--card);
  border: 1px solid rgba(227, 236, 233, .8);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.form-card + .form-card { margin-top: 12px; }
.form-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
}
.form-title .idx {
  width: 21px;
  height: 21px;
  border-radius: 7px;
  background: var(--teal-50);
  color: var(--teal-700);
  font-size: 11.5px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.form-title .hint { font-size: 11.5px; color: var(--muted); font-weight: 500; margin-left: auto; }

.field { margin-bottom: 13px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #4c5f59;
  margin-bottom: 6px;
}
.field label .req { color: var(--red); margin-left: 2px; }
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfdfc;
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
  font-size: 16px;
  transition: border-color .15s, background .15s;
}
.field textarea { resize: vertical; min-height: 74px; line-height: 1.6; }
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--teal-600); background: #fff; }
.field input::placeholder, .field textarea::placeholder { color: #a9b8b3; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.seg { display: flex; gap: 8px; }
.seg label { flex: 1; margin: 0; }
.seg input { display: none; }
.seg span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border: 1px solid var(--line);
  background: #fbfdfc;
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 600;
  color: #4c5f59;
}
.seg input:checked + span {
  border-color: var(--teal);
  background: var(--teal-50);
  color: var(--teal-700);
}

.form-foot {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
}
.form-foot .btn { flex: 1; height: 48px; font-size: 15.5px; }
.form-foot .btn-secondary { flex: 0 0 96px; }
body.has-form-foot .view { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }

/* ------------------------------ 底部弹层 ------------------------------ */
.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(9, 24, 20, .45);
  opacity: 0;
  transition: opacity .22s;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-mask.open { opacity: 1; }
.sheet {
  width: 100%;
  max-width: 640px;
  max-height: 92dvh;
  background: #fff;
  border-radius: 22px 22px 0 0;
  padding: 8px 18px calc(18px + env(safe-area-inset-bottom));
  transform: translateY(24px);
  transition: transform .26s cubic-bezier(.2, .8, .3, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.sheet-mask.open .sheet { transform: translateY(0); }
.sheet .grab {
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: #e0e8e5;
  margin: 0 auto 12px;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.sheet-head h2 { font-size: 17px; font-weight: 700; color: var(--ink); }
.sheet-head p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sheet-close {
  width: 32px;
  height: 32px;
  flex: none;
  border: none;
  border-radius: 50%;
  background: #f0f4f2;
  color: #6b7f79;
  font-size: 15px;
}
.sheet-foot { display: flex; gap: 10px; margin-top: 16px; }
.sheet-foot .btn { flex: 1; height: 47px; font-size: 15px; }
.sheet-foot .btn-secondary { flex: 0 0 100px; }

.effects { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.effects label { margin: 0; }
.effects input { display: none; }
.effects span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdfc;
  font-size: 14px;
  font-weight: 600;
  color: #4c5f59;
}
.effects input:checked + span.good { border-color: #2563eb; background: var(--teal-50); color: #1e40af; }
.effects input:checked + span.stable { border-color: #3b82f6; background: var(--blue-bg); color: #1d4ed8; }
.effects input:checked + span.bad { border-color: #f59e0b; background: var(--amber-bg); color: #b45309; }
.effects input:checked + span.worse { border-color: #ef4444; background: var(--red-bg); color: #b91c1c; }

/* ------------------------------ 提示 ------------------------------ */
.toast-root {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 26px);
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  padding: 0 20px;
}
.toast {
  max-width: 92%;
  background: rgba(18, 33, 30, .92);
  color: #fff;
  font-size: 13.5px;
  padding: 11px 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
  animation: toastIn .22s ease;
}
.toast.error { background: rgba(153, 27, 27, .95); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ------------------------------ 更多 / 知识 ------------------------------ */
.menu-list { border-radius: var(--radius); overflow: hidden; background: var(--card); box-shadow: var(--shadow); border: 1px solid rgba(227,236,233,.8); }
.menu-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.menu-item:last-child { border-bottom: none; }
.menu-item:active { background: #f7fbfa; }
.menu-item .ic {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--teal-50);
  color: var(--teal);
  font-size: 16px;
  font-weight: 700;
}
.menu-item .ic.amber { background: var(--amber-bg); color: var(--amber); }
.menu-item .ic.blue { background: var(--blue-bg); color: var(--blue); }
.menu-item .ic.violet { background: var(--violet-bg); color: var(--violet); }
.menu-main { flex: 1; min-width: 0; }
.menu-main b { display: block; font-size: 14.5px; font-weight: 650; color: var(--ink); }
.menu-main span { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }

.kb-hero {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 17px 16px;
  background: linear-gradient(140deg, #f0faf7, #ffffff);
  border-bottom: 1px solid var(--line);
}
.kb-hero .kb-ic {
  width: 50px;
  height: 50px;
  flex: none;
  border-radius: 15px;
  background: var(--teal);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 8px 16px -8px rgba(37,99,235,.6);
}
.kb-hero h2 { font-size: 17px; font-weight: 750; color: var(--ink); }
.kb-hero p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kb-items { display: flex; flex-wrap: wrap; gap: 8px; }
.kb-item {
  font-size: 12.5px;
  color: #44574f;
  background: #f3f8f6;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
}
.kb-note { font-size: 12px; color: var(--muted); line-height: 1.8; margin-top: 12px; }

.book-row { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.book-row:last-child { border-bottom: none; }
.book-row:active { background: #f7fbfa; }
.book-cover {
  width: 46px;
  height: 62px;
  flex: none;
  border-radius: 8px;
  background: linear-gradient(160deg, #1e40af, #2563eb);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  padding: 4px;
  text-align: center;
  box-shadow: 0 5px 10px -5px rgba(37,99,235,.6);
}
.book-cover b { font-size: 9.5px; line-height: 1.25; max-height: 36px; overflow: hidden; }
.book-info { flex: 1; min-width: 0; }
.book-info b { font-size: 14.5px; color: var(--ink); font-weight: 650; }
.book-info .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.book-info .intro {
  font-size: 12px;
  color: #5a6d66;
  margin-top: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.book-info .count { font-size: 11px; color: var(--teal); margin-top: 5px; font-weight: 600; }

.reader-head { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.reader-head h2 { font-size: 18px; font-weight: 750; color: var(--ink); }
.reader-head p { font-size: 12px; color: var(--muted); margin-top: 3px; }
.reader-toc { max-height: 168px; overflow-y: auto; border-bottom: 1px solid var(--line); background: #fbfdfc; }
.reader-toc button {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 10px 16px;
  font-size: 13px;
  color: #4b5e57;
  border-bottom: 1px dashed var(--line);
  display: flex;
  gap: 9px;
}
.reader-toc button:last-child { border-bottom: none; }
.reader-toc button.active { background: var(--teal-50); color: var(--teal-700); font-weight: 700; }
.reader-toc button .no { flex: none; font-size: 11px; color: #9aaba6; width: 18px; }
.reader-content { padding: 16px; }
.reader-content h3 { font-size: 17px; font-weight: 750; color: var(--ink); text-align: center; margin-bottom: 4px; }
.reader-content .rc-sub { text-align: center; font-size: 11.5px; color: var(--muted); margin-bottom: 14px; }
.reader-content p {
  font-size: 15.5px;
  line-height: 2.05;
  color: #2a3b35;
  margin: 0 0 12px;
  text-align: justify;
}
.reader-nav { display: flex; gap: 10px; padding: 0 16px 16px; }
.reader-nav .btn { flex: 1; font-size: 12.5px; }

/* ------------------------------ 开方治疗 ------------------------------ */
.rx-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.rx-tools .btn { flex: 1; }
.med-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.med-row { display: grid; grid-template-columns: 1fr 62px 58px 38px; gap: 6px; align-items: center; }
.med-row input[name="med_name"],
.med-row input[name="med_dose"],
.med-row select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfdfc;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 16px;
  outline: none;
}
.med-row select { padding: 10px 6px; font-size: 14.5px; }
.med-row input[name="med_dose"] { padding: 10px 6px; text-align: center; }
.med-row input:focus,
.med-row select:focus { border-color: var(--teal-600); background: #fff; }
.med-del {
  width: 38px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: #f1f5f4;
  color: #8a9a94;
  font-size: 13px;
}
.med-del:active { background: var(--red-bg); color: var(--red); }

.taboo-box {
  margin: 12px 0;
  border: 1px solid #fecaca;
  background: #fff8f8;
  border-radius: 12px;
  padding: 10px 12px;
}
.taboo-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  font-weight: 700;
  color: #b91c1c;
  margin-bottom: 4px;
}
.taboo-item { padding: 8px 0; border-top: 1px dashed #f3d0d0; font-size: 12px; }
.taboo-item:first-of-type { border-top: none; padding-top: 4px; }
.taboo-head { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; color: #b91c1c; }
.taboo-head em { font-style: normal; font-weight: 600; color: #8a5a5a; }
.taboo-item p { margin: 3px 0; line-height: 1.6; color: #5f3b3b; }
.taboo-item > span { font-size: 11px; color: #a08b8b; }

.fee-summary {
  margin-top: 12px;
  background: #f3f8f6;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fee-summary > div { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.fee-summary > div b { color: var(--ink); font-weight: 700; }
.fee-summary .fee-total {
  border-top: 1px dashed var(--line);
  margin-top: 2px;
  padding-top: 7px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.fee-summary .fee-total b { color: var(--teal-700); }

.tp-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.tp-chip {
  border: 1px solid var(--line);
  background: #fbfdfc;
  color: #4c5f59;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.tp-chip em { font-style: normal; font-size: 10.5px; font-weight: 500; color: #9aaba6; }
.tp-chip.active { background: var(--teal-50); border-color: var(--teal); color: var(--teal-700); }
.tp-chip.active em { color: var(--teal-600); }
.tp-picked { display: flex; flex-direction: column; gap: 7px; }
.tp-empty { font-size: 12.5px; color: var(--muted); padding: 4px 2px; }
.tp-row {
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 7px 9px;
  font-size: 11.5px;
  color: var(--muted);
}
.tp-line {
  display: grid;
  grid-template-columns: 1fr 76px 70px 48px 30px;
  gap: 6px;
  align-items: center;
}
.tp-name { font-size: 13px; font-weight: 650; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-row label { display: flex; align-items: center; gap: 2px; margin: 0; color: #8a9a94; }
.tp-row input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 4px 5px;
  font-size: 12px;
  background: #fff;
  outline: none;
}
.tp-sub { text-align: right; font-weight: 700; color: var(--teal-700); }
.tp-qty em { font-style: normal; font-size: 10px; color: #8a9a94; }
.tp-price input::placeholder { color: #c0392b; }
.tp-del {
  width: 30px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: #eef3f1;
  color: #8a9a94;
  font-size: 11px;
}
.tp-detail { display: flex; flex-direction: column; gap: 5px; margin-top: 7px; }
.tp-drow { display: flex; align-items: center; gap: 7px; }
.tp-drow span { width: 52px; flex: none; font-size: 11px; color: #8a9a94; white-space: nowrap; }
.tp-drow input { flex: 1; min-width: 0; font-size: 11.5px; padding: 5px 7px; background: #fff; }

.tp-picker {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px dashed #bfd8d0;
  background: #f6fbf9;
  border-radius: 11px;
  padding: 10px 12px;
  color: var(--teal-700);
  font-size: 13.5px;
  font-weight: 650;
}
.tp-picker em { font-style: normal; font-size: 11.5px; font-weight: 500; color: var(--muted); }
.tp-pick-list { display: flex; flex-direction: column; gap: 6px; }
.tp-pick-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  background: #fff;
  font-size: 13px;
}
.tp-pick-row input { width: 15px; height: 15px; accent-color: var(--teal); flex: none; }
.tp-pick-row span { flex: 1; min-width: 0; color: var(--ink); }
.tp-pick-row em { font-style: normal; font-size: 11.5px; color: var(--muted); flex: none; }
.tp-pick-row.on { border-color: var(--teal); background: var(--teal-50); }
.tp-pick-row.on span { color: var(--teal-700); font-weight: 600; }
.tp-custom { display: flex; gap: 8px; margin-top: 11px; }
.tp-custom input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  background: #fbfdfc;
  border-radius: 11px;
  padding: 9px 11px;
  font-size: 15px;
  outline: none;
}
.tp-custom input:focus { border-color: var(--teal-600); background: #fff; }

.fx-list { display: flex; flex-direction: column; gap: 8px; }
.fx-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fx-item:active { background: var(--teal-50); }
.fx-item-head { display: flex; align-items: baseline; gap: 7px; }
.fx-item-head b { font-size: 14.5px; color: var(--ink); }
.fx-item-head em { font-style: normal; font-size: 11px; color: var(--muted); }
.fx-item-herbs { font-size: 11.5px; color: #5a6d66; line-height: 1.5; }
.fx-item-foot { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--muted); }
.fx-item-foot i { font-style: normal; color: var(--teal); font-weight: 700; }
.fx-item.rec { border-color: #bfe0d6; background: linear-gradient(180deg, #f4fbf8, #fff); }
.fx-warn { font-size: 10.5px; color: #b45309; background: #fff7ed; border-radius: 7px; padding: 4px 7px; line-height: 1.5; }
.fx-label {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--muted);
  margin: 4px 0 8px;
  display: flex;
  gap: 6px;
  align-items: baseline;
}
.fx-label em { font-style: normal; font-weight: 400; font-size: 10.5px; color: #9aa8a3; }
#fxRec .fx-list { margin-bottom: 14px; }

.sg-sec { padding: 12px 0; border-bottom: 1px dashed var(--line); }
.sg-sec:last-child { border-bottom: none; }
.sg-sec h4 {
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 8px;
  display: flex;
  gap: 6px;
  align-items: baseline;
  flex-wrap: wrap;
}
.sg-sec h4 span { font-size: 11px; color: var(--muted); font-weight: 500; }
.sg-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sg-chip { font-size: 11.5px; background: var(--teal-50); color: var(--teal-700); border-radius: 999px; padding: 5px 9px; }
.sg-chip i { font-style: normal; margin-left: 5px; color: var(--teal-600); opacity: .8; }
.sg-src { margin-top: 8px; font-size: 11px; color: var(--muted); line-height: 1.6; }
.sg-formula { border: 1px solid var(--line); border-radius: 11px; padding: 9px 10px; margin-bottom: 8px; }
.sg-f-head { display: flex; gap: 6px; align-items: baseline; }
.sg-f-head b { font-size: 13.5px; color: var(--ink); }
.sg-f-head em { font-style: normal; font-size: 11px; color: var(--muted); }
.sg-f-herbs { font-size: 11.5px; color: #5a6d66; margin-top: 3px; line-height: 1.5; }
.sg-warn {
  margin-top: 5px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: #b91c1c;
  background: #fff5f5;
  border-radius: 8px;
  padding: 6px 8px;
}
.sg-f-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 7px; font-size: 11px; color: var(--muted); }
.sg-therapy { display: flex; gap: 9px; align-items: flex-start; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.sg-therapy:last-child { border-bottom: none; }
.sg-therapy input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--teal); }
.sg-therapy span { display: flex; flex-direction: column; gap: 2px; }
.sg-therapy b { font-size: 13.5px; color: var(--ink); }
.sg-therapy em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.sg-advice { display: flex; flex-direction: column; gap: 7px; }
.sg-advice label { display: flex; gap: 7px; align-items: flex-start; }
.sg-advice em { font-style: normal; font-size: 11.5px; color: var(--muted); width: 30px; flex: none; padding-top: 8px; }
.sg-advice textarea {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 9px;
  font-size: 12.5px;
  background: #fbfdfc;
}
.sg-empty { font-size: 12px; color: var(--muted); }

/* 关于 */
.about-list { padding: 4px 0; }
.stat-card-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.stat-card-row:last-child { border-bottom: none; }
.stat-card-row .k { color: var(--muted); }

/* ------------------------------ 管理页通用 ------------------------------ */
.seg button {
  flex: 1;
  height: 40px;
  border: 1px solid var(--line);
  background: #fbfdfc;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: #4c5f59;
}
.seg button.active {
  border-color: var(--teal);
  background: var(--teal-50);
  color: var(--teal-700);
}
.profile-actions .full { grid-column: 1 / -1; }
.danger-text { color: #b91c1c !important; }

.tl-actions { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tl-act {
  border: none;
  background: #eef3f1;
  color: #5a6d66;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 8px;
}
.tl-act.danger { background: #fef2f2; color: #b91c1c; }

.attach-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.attach-item { position: relative; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: #fbfdfc; }
.attach-open { display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.attach-open img { width: 100%; height: 82px; object-fit: cover; display: block; background: #eef3f1; }
.attach-file { height: 82px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
.attach-name {
  font-size: 10.5px;
  color: #5a6d66;
  padding: 5px 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attach-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 21px;
  height: 21px;
  border: none;
  border-radius: 7px;
  background: rgba(15, 23, 42, .55);
  color: #fff;
  font-size: 10.5px;
  line-height: 21px;
  padding: 0;
}
.attach-picks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.pick-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  font-size: 11.5px;
  background: var(--teal-50);
  color: var(--teal-700);
  border-radius: 999px;
  padding: 4px 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pick-chip button { border: none; background: none; color: var(--teal-700); font-size: 10.5px; padding: 0; }

/* 费用管理 */
.bill-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  margin-top: 12px;
  background: #eef3f1;
  border-radius: 13px;
}
.bill-tab {
  flex: 1;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: #5a6d66;
}
.bill-tab.on { background: #fff; color: var(--teal-700); box-shadow: 0 2px 6px rgba(15, 40, 34, .08); }

.sum-list { display: flex; flex-direction: column; gap: 8px; }
.sum-card { border: 1px solid var(--line); border-radius: 13px; padding: 11px 12px; background: #fff; }
.sum-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sum-head b { font-size: 14.5px; color: var(--ink); }
.sum-head span { font-size: 15px; font-weight: 750; color: var(--teal-700); }
.sum-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.sum-items { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.sum-chip { font-size: 11px; background: #f3f7f5; color: #4c5f59; border-radius: 7px; padding: 3px 7px; }
.sum-chip b { color: var(--ink); }
.sum-chip.rx { background: #fff7ed; color: #b45309; }

.charge-card { border: 1px solid var(--line); border-radius: 13px; padding: 11px 12px; background: #fff; margin-bottom: 8px; }
.charge-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.charge-top b { font-size: 14px; color: var(--ink); }
.charge-top span { font-size: 15px; font-weight: 750; color: var(--teal-700); }
.charge-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.charge-items { font-size: 12px; color: #4c5f59; margin-top: 6px; line-height: 1.55; }
.charge-note { font-size: 11px; color: var(--muted); margin-top: 5px; }
.charge-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

.price-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.price-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #fbfdfc;
  border-radius: 10px;
  padding: 8px 9px;
  text-align: left;
}
.price-item span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.price-item b { font-size: 12.5px; color: var(--ink); }
.price-item em { font-style: normal; font-size: 10.5px; color: var(--muted); }
.price-item i { font-style: normal; font-size: 12.5px; font-weight: 700; color: var(--teal-700); flex: none; }
.price-item.active { border-color: var(--teal); background: var(--teal-50); }
.selected-items { display: flex; flex-direction: column; gap: 6px; margin-top: 9px; }
.selected-row { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.selected-row .sel-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-row .sel-name em { font-style: normal; color: var(--muted); font-size: 10.5px; margin-left: 3px; }
.selected-row label { display: flex; align-items: center; gap: 2px; color: var(--muted); font-size: 11px; flex: none; }
.selected-row input { width: 52px; border: 1px solid var(--line); border-radius: 7px; padding: 4px 5px; font-size: 12px; background: #fbfdfc; }
.selected-row button { border: none; background: #fef2f2; color: #b91c1c; width: 22px; height: 22px; border-radius: 7px; font-size: 10px; flex: none; }
.custom-item { display: flex; gap: 6px; margin-top: 8px; }
.custom-item input { min-width: 0; border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; font-size: 13px; background: #fbfdfc; }
.custom-item input:first-child { flex: 1; }
.custom-item input:nth-child(2) { width: 78px; flex: none; }

.range-row { display: flex; gap: 6px; margin: 12px 0; }
.range-row button {
  flex: 1;
  height: 34px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  font-size: 12.5px;
  color: #5a6d66;
}
.range-row button.on { border-color: var(--teal); background: var(--teal-50); color: var(--teal-700); font-weight: 650; }
.kpi-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 10px; }
.kpi-mini {
  background: var(--card);
  border: 1px solid rgba(227, 236, 233, .8);
  border-radius: 12px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.kpi-mini span { font-size: 10.5px; color: var(--muted); }
.kpi-mini b { font-size: 15px; color: var(--ink); white-space: nowrap; }
.doc-card { border: 1px solid var(--line); border-radius: 13px; padding: 11px 12px; background: #fff; margin-bottom: 8px; }
.doc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.doc-head b { font-size: 14.5px; color: var(--ink); }
.doc-head span { font-size: 15px; font-weight: 750; color: var(--teal-700); }
.doc-meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.doc-meta b { color: #b45309; }
.doc-items { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.doc-chip { font-size: 10.5px; background: #f3f7f5; color: #4c5f59; border-radius: 7px; padding: 4px 7px; }
.doc-chip em { font-style: normal; color: var(--muted); }
.doc-chip b { color: var(--ink); }

/* 数据分析 */
.bar-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 12px; }
.bar-label { width: 74px; flex: none; color: #4c5f59; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 8px; border-radius: 999px; background: #eef3f1; overflow: hidden; }
.bar-track i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #60a5fa, #2563eb); }
.bar-row b { width: 38px; text-align: right; flex: none; font-size: 11.5px; color: var(--ink); }

/* 系统设置 */
.backup-links { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.backup-links p { flex-basis: 100%; margin: 2px 0 0; }
.backup-links a { text-decoration: none; }
.log-list { display: flex; flex-direction: column; }
.log-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 11.5px; }
.log-row:last-child { border-bottom: none; }
.log-row span { color: var(--muted); }
.log-row b { color: var(--ink); font-weight: 600; }
.log-row em { font-style: normal; color: #5a6d66; }

/* 系统设置 · 账号 */
.acct-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px 14px;
  background: linear-gradient(135deg, #f2faf6, #fff);
  border-color: #d9ede4;
}
.acct-avatar {
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.acct-main { min-width: 0; flex: 1; }
.acct-name { display: flex; align-items: center; gap: 7px; font-size: 15px; font-weight: 700; color: var(--ink); }
.acct-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.acct-hint { font-size: 10.5px; color: #8a9a94; margin-top: 4px; line-height: 1.5; }
.acct-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 10px 0 14px; }
.acct-actions .btn { padding: 9px 4px; font-size: 12px; }
.acct-actions .btn.danger { color: var(--red); border-color: #f3c1bd; background: #fff; }

.op-list { display: flex; flex-direction: column; }
.op-row { padding: 11px 12px; border-bottom: 1px dashed var(--line); }
.op-row:last-child { border-bottom: none; }
.op-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.op-name { font-size: 13.5px; font-weight: 650; color: var(--ink); }
.op-name i { font-style: normal; font-size: 9.5px; font-weight: 600; color: var(--teal-600); background: #e8f6f0; border-radius: 5px; padding: 1px 5px; margin-left: 5px; }
.op-sub { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.op-actions { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.op-actions button {
  border: 1px solid var(--line);
  background: #fff;
  color: #52645d;
  border-radius: 7px;
  padding: 4px 9px;
  font-size: 11.5px;
  cursor: pointer;
}
.op-actions button.danger { color: var(--red); border-color: #f3c1bd; }
.op-actions button:active { background: #f4f8f6; }

.card-head .hint { font-size: 11px; color: var(--muted); }
.add-form { padding: 0 12px 12px; }
.add-form-title { font-size: 12.5px; font-weight: 650; color: var(--teal-700); margin-bottom: 8px; }
.add-grid { display: flex; flex-direction: column; gap: 8px; }
.perm-box { margin-top: 10px; border: 1px dashed #cfe6dc; background: #f7fbf9; border-radius: 10px; padding: 9px 10px; }
.perm-head { font-size: 12px; font-weight: 650; color: #3f5a51; margin-bottom: 7px; }
.perm-head em { font-style: normal; font-weight: 400; font-size: 10.5px; color: var(--muted); margin-left: 4px; }
.perm-tools { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.perm-tools button { border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 3px 9px; font-size: 11px; color: #52645d; cursor: pointer; }
.perm-row { display: flex; flex-direction: column; gap: 4px; padding: 6px 0; border-top: 1px dashed #e3efe9; }
.perm-row:first-child { border-top: none; padding-top: 0; }
.perm-name { font-size: 11.5px; color: #4d635b; font-weight: 600; }
.perm-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.perm-chip { display: inline-flex; }
.perm-chip input { display: none; }
.perm-chip span {
  border: 1px solid var(--line);
  background: #fff;
  color: #6b7d76;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  line-height: 1.4;
}
.perm-chip input:checked + span { background: var(--teal); border-color: var(--teal); color: #fff; }

.setting-card .card-body { padding: 13px 14px; }
.setting-card .setting-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.setting-card .setting-line b { font-size: 13.5px; color: var(--ink); }
.setting-card .setting-line p { margin: 3px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.setting-card .chev { color: #b9c6c0; font-size: 20px; line-height: 1; }

.set-section { margin: 16px 3px 7px; font-size: 11.5px; font-weight: 600; color: #8a9a94; letter-spacing: 0.3px; }
.setting-list { padding: 0; overflow: hidden; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.setting-row:first-child { border-top: none; }
.setting-row:active { background: #f5faf8; }
.setting-row b { display: block; font-size: 13.5px; color: var(--ink); }
.setting-row p { margin: 3px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.setting-row .chev { color: #b9c6c0; font-size: 20px; line-height: 1; flex: none; }
.sheet .backup-links { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 12px 16px 16px; }
.sheet .kv-list { padding: 10px 16px 16px; }
.sheet .log-list { padding: 4px 16px 16px; }

body.login-mode .topbar,
body.login-mode #tabbar { display: none; }
body.login-mode #view { padding: 0; }
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: stretch; padding: 16vh 26px 40px; background: linear-gradient(180deg, #eef4ff 0%, #f8fbff 60%); }
.login-logo { width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 18px; background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; font-size: 28px; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 24px rgba(37, 99, 235, 0.25); }
.login-wrap h1 { margin: 0; text-align: center; font-size: 19px; color: var(--ink); }
.login-tip { margin: 8px 0 22px; text-align: center; font-size: 12px; color: var(--muted); }
.login-field { display: block; margin-bottom: 12px; }
.login-field span { display: block; margin-bottom: 6px; font-size: 12px; color: var(--muted); }
.login-field input { width: 100%; box-sizing: border-box; padding: 12px 13px; border: 1px solid var(--line); border-radius: 11px; font-size: 14px; background: #fff; }
.login-field input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
.login-btn { margin-top: 8px; padding: 13px; font-size: 15px; border-radius: 12px; }
.login-foot { margin-top: 18px; text-align: center; font-size: 11.5px; color: #9aa8a3; }

.me-profile { display: flex; align-items: center; gap: 14px; padding: 20px 16px; border-radius: 16px; background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; box-shadow: 0 10px 24px rgba(29, 78, 216, 0.18); }
.me-avatar { width: 56px; height: 56px; border-radius: 50%; background: rgba(255, 255, 255, 0.22); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; flex: none; }
.me-info h2 { margin: 0; font-size: 17px; }
.me-info p { margin: 4px 0 0; font-size: 11.5px; opacity: 0.85; }
.me-logout b { color: #c0392b; }
.me-logout .chev { color: #e2a79f; }
.me-foot { margin: 20px 0 8px; text-align: center; font-size: 11px; color: #a9b6b1; }

/* 五运六气 */
.gz-body { display: flex; flex-direction: column; gap: 9px; }
.gz-pillars, .gz-wuyun { display: flex; flex-wrap: wrap; gap: 6px; }
.gz-chip {
  font-size: 12.5px;
  background: #f3f7f5;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 5px 9px;
  color: #5a6d66;
}
.gz-chip b { margin-left: 5px; color: var(--teal-700); font-size: 14px; }
.gz-wuyun span { font-size: 11.5px; color: var(--muted); }
.gz-wuyun b { margin-left: 4px; color: var(--ink); font-weight: 650; }
.gz-advice { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.gz-advice-block {
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
}
.gz-advice-block.wide { grid-column: 1 / -1; background: #fff7ed; border-color: #fde8cf; }
.gz-advice-block h4 { font-size: 11px; color: #8a9a94; font-weight: 600; margin-bottom: 3px; }
.gz-advice-block p { font-size: 12px; color: #3f514b; line-height: 1.6; }
.gz-advice-block.wide p { color: #9a5b13; }

/* 十问歌 */
.inq-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbfa;
  padding: 11px 12px;
  margin: 2px 0 4px;
}
.inq-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 9px; }
.inq-head b { font-size: 12.5px; color: var(--teal-700); }
.inq-head em { font-style: normal; font-size: 11px; color: var(--muted); }
.inq-grid { display: flex; flex-direction: column; gap: 9px; }
.inq-item { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.inq-item span { font-size: 11.5px; color: #5a6d66; }
.inq-item input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 12.5px;
  background: #fff;
  outline: none;
}

/* 出生日期：年 / 月 / 日 / 时 / 分 分段输入 */
.birth-field .birth-parts { display: flex; align-items: center; gap: 4px; }
.birth-field .birth-parts input { width: auto; min-width: 0; flex: 1 1 0; padding: 11px 2px; text-align: center; }
.birth-field .birth-parts input[data-birth="y"] { flex: 1.5 1 0; }
.birth-field .birth-parts i { font-style: normal; font-size: 12px; color: #7f918b; flex: none; }

/* ===================== 趣味闯关 ===================== */
.games { --games-accent: var(--teal); }
.games .btn { min-height: 44px; }
.games-stars { letter-spacing: 2px; font-size: 13px; white-space: nowrap; }
.games-stars i { font-style: normal; color: #cbd8e8; }
.games-stars i.on { color: var(--games-accent); }

.games-hero {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
  padding: 16px; border-radius: 16px;
  background: linear-gradient(135deg, #eef4ff, #f9fbff 62%, #e9f1ff);
  border: 1px solid #d8e6fb;
}
.games-hero h2 { font-size: 18px; font-weight: 700; }
.games-hero p { margin-top: 4px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.games-total { display: flex; align-items: baseline; gap: 4px; padding: 6px 12px; border-radius: 12px; background: #fff; border: 1px solid #d8e6fb; }
.games-total span { font-size: 11px; color: var(--muted); margin-right: 3px; }
.games-total b { font-size: 22px; line-height: 1; color: var(--teal-700); }
.games-total em { font-style: normal; font-size: 11px; color: var(--muted); }
.games-cards { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 12px; }
.games-card {
  display: flex; align-items: center; gap: 11px; padding: 13px;
  border: 1px solid var(--line); border-radius: 14px; background: #fff;
  text-align: left; box-shadow: 0 2px 10px rgba(15, 23, 42, .05);
}
.games-card:active { background: #f7faff; transform: scale(.99); }
.games-card-ic {
  width: 40px; height: 40px; flex: none; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; background: var(--teal-50); color: var(--teal-700);
}
.games-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.games-card-main b { font-size: 14.5px; color: var(--ink); }
.games-card-main span { font-size: 11px; color: var(--muted); line-height: 1.5; }
.games-card-meta { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: 11.5px; font-weight: 600; color: var(--text); }
.games-card-meta em { font-style: normal; font-size: 11.5px; color: var(--teal); }
.games-hall-note { margin-top: 12px; font-size: 11px; color: var(--muted); }

.games-topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.games-topbar-title { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.games-back {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px;
  border: 0; background: none; color: var(--teal-700); font-size: 13px; font-weight: 600;
}
.games-back:active { opacity: .65; }

.games-levels { display: grid; grid-template-columns: 1fr; gap: 10px; }
.games-level {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 14px; border: 1px solid var(--line); border-radius: 14px;
  background: #fff; text-align: left;
}
.games-level:active:not(.locked) { background: #f7faff; }
.games-level-no {
  font-size: 10.5px; font-weight: 700; letter-spacing: 1px;
  padding: 2px 8px; border-radius: 99px; background: var(--teal-50); color: var(--teal-700);
}
.games-level b { font-size: 15px; color: var(--ink); }
.games-level-sub { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.games-level-foot { margin-top: 6px; display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }
.games-level-foot em { font-style: normal; }
.games-level.locked { background: #f7f9fc; border-style: dashed; color: #93a1b0; }
.games-level.locked .games-level-no { background: #eef2f6; color: #93a1b0; }
.games-level.locked b { color: #8d9aa8; }

.games-quiz-head { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.games-quiz-head b { color: var(--teal-700); }
.games-progress { height: 7px; border-radius: 99px; background: #e6edf7; overflow: hidden; }
.games-progress i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #60a5fa, var(--teal)); transition: width .25s ease; }
.games-qcard { margin-top: 12px; padding: 15px 14px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.games-qtitle { margin: 0 0 12px; font-size: 15px; font-weight: 700; line-height: 1.6; color: var(--ink); }
.games-opts { display: grid; gap: 8px; }
.games-opt {
  display: flex; align-items: center; gap: 9px; width: 100%; min-height: 48px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
  text-align: left; font-size: 14px; color: var(--ink);
}
.games-opt:active { background: #f7faff; transform: scale(.995); }
.games-opt-key {
  width: 26px; height: 26px; flex: none; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700; background: var(--teal-50); color: var(--teal-700);
}
.games-opt-text { flex: 1; min-width: 0; line-height: 1.5; word-break: break-word; }
.games-opt.ok { border-color: #86efac; background: #f0fdf4; color: #166534; }
.games-opt.ok .games-opt-key { background: #dcfce7; color: #15803d; }
.games-opt.bad { border-color: #fca5a5; background: #fef2f2; color: #991b1b; }
.games-opt.bad .games-opt-key { background: #fee2e2; color: #b91c1c; }
.games-opt.locked { pointer-events: none; }
.games-tip { margin-top: 11px; padding: 10px 12px; border: 1px solid; border-radius: 12px; font-size: 12.5px; line-height: 1.65; }
.games-tip b { display: block; margin-bottom: 3px; font-size: 12.5px; }
.games-tip.ok { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.games-tip.bad { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.games-tip[hidden], .games-foot[hidden] { display: none; }
.games-foot { display: flex; justify-content: flex-end; margin-top: 12px; }

.games-result { padding: 22px 14px 20px; border: 1px solid var(--line); border-radius: 14px; background: #fff; text-align: center; }
.games-result-label { font-size: 14.5px; font-weight: 700; color: var(--teal-700); }
.games-result-score { display: flex; align-items: baseline; justify-content: center; gap: 5px; margin: 8px 0 2px; }
.games-result-score b { font-size: 34px; line-height: 1; color: var(--teal); }
.games-result-score span { font-size: 12px; color: var(--muted); }
.games-result > .games-stars { display: inline-block; margin: 5px 0 2px; font-size: 19px; }
.games-result-tip { margin-top: 9px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.games-result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 15px; }

.games-panel { padding: 16px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.games-duel-fields { display: grid; grid-template-columns: 1fr; gap: 10px; }
.games-field { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--muted); }
.games-field input {
  height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px;
  background: #fff; font-size: 15px; color: var(--ink); outline: none;
}
.games-field input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.games-rules { margin: 14px 0 0; padding-left: 18px; font-size: 12px; line-height: 1.85; color: var(--text); }
.games-duel-best { margin-top: 10px; font-size: 12px; color: var(--muted); }
.games-duel-best b { font-size: 15px; color: var(--teal-700); }
.games-main-btn { width: 100%; min-height: 46px; margin-top: 14px; }

.games-duel-bar { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 8px; margin-bottom: 12px; }
.games-duel-round { order: -1; grid-column: 1 / -1; font-size: 11.5px; color: var(--muted); text-align: center; }
.games-duel-player {
  display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0;
  padding: 8px 10px; border: 2px solid var(--line); border-radius: 12px; background: #fff;
  font-size: 12.5px; font-weight: 600; color: var(--ink);
}
.games-duel-player span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.games-duel-player b { font-size: 18px; color: var(--teal-700); }
.games-duel-player.on { border-color: var(--teal); background: var(--teal-50); }
.games-duel-turn { text-align: center; font-size: 12px; color: var(--muted); }
.games-duel-turn b { color: var(--teal-700); }
.games-ring {
  position: relative; width: 52px; height: 52px; margin: 9px auto 11px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: conic-gradient(var(--games-accent) var(--p, 100%), #e6ecf1 0);
}
.games-ring::before { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: #fff; }
.games-ring span { position: relative; font-size: 16px; font-weight: 700; color: var(--teal-700); }
.games-ring.low { background: conic-gradient(var(--red) var(--p, 100%), #f3e0de 0); }
.games-ring.low span { color: var(--red); }
.games-wait { font-size: 12px; color: var(--muted); }
.games-duel-result { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 12px; }
.games-duel-result .games-duel-player { flex: 1; max-width: none; }
.games-vs { flex: none; font-size: 11.5px; font-weight: 700; color: var(--muted); }

.games-match-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.games-match-bar span { padding: 4px 9px; border: 1px solid var(--line); border-radius: 99px; background: #fff; }
.games-match-bar b { color: var(--teal-700); }
.games-board-wrap { position: relative; width: 100%; margin-top: 12px; }
.games-board { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 6px; }
.games-tile {
  position: relative; aspect-ratio: 1 / 1; min-width: 0; padding: 3px 2px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 1px solid #dbe7fb; border-radius: 10px; background: #fff; color: var(--text);
  transition: transform .12s, box-shadow .15s, background .15s, opacity .2s;
}
.games-tile.effect { background: #f4f8ff; }
.games-tile em { font-style: normal; font-size: 9px; line-height: 1.2; padding: 0 3px; border-radius: 4px; background: var(--teal-50); color: var(--teal-700); }
.games-tile.effect em { background: #e0f2fe; color: #0369a1; }
.games-tile b { font-size: 11.5px; font-weight: 600; line-height: 1.2; word-break: break-all; }
.games-tile:active { transform: scale(.96); }
.games-tile.sel { border-color: var(--teal); background: var(--teal-50); box-shadow: 0 0 0 2px rgba(37, 99, 235, .2); }
.games-tile.wrong { border-color: #f87171; background: #fef2f2; animation: games-shake .3s; }
.games-tile.gone { opacity: 0; transform: scale(.72); pointer-events: none; }
.games-board[data-cols="5"] .games-tile b, .games-board[data-cols="6"] .games-tile b { font-size: 10.5px; }
/* 7/8 列高难关：药名、归经文字较长，缩小字号并隐藏角标，避免溢出 */
.games-board[data-cols="7"] .games-tile, .games-board[data-cols="8"] .games-tile { padding: 2px 1px; }
.games-board[data-cols="7"] .games-tile em, .games-board[data-cols="8"] .games-tile em { display: none; }
.games-board[data-cols="7"] .games-tile b, .games-board[data-cols="8"] .games-tile b { font-size: 9.5px; line-height: 1.15; word-break: break-all; }
.games-board[data-cols="5"], .games-board[data-cols="6"] { gap: 5px; }
.games-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
@keyframes games-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.games-match-tip { margin-top: 10px; font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.games-match-tip.bad { color: #dc2626; }

/* 百草竞速 / 方剂配伍 */
.games-speed-head { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; font-size: 12px; color: var(--muted); }
.games-speed-time { font-size: 20px; font-weight: 700; color: var(--teal-700); font-variant-numeric: tabular-nums; }
.games-speed-score b { color: var(--teal-700); font-size: 16px; }
.games-qsub { margin: 0 0 10px; font-size: 11.5px; color: var(--muted); }
.games-picks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.games-pick {
  min-height: 44px; padding: 9px 6px; border: 1px solid #dbe7fb; border-radius: 10px; background: #fff;
  font-size: 12.5px; color: var(--text); transition: border-color .15s, background .15s, color .15s;
}
.games-pick.on { border-color: var(--teal); background: var(--teal-50); color: var(--teal-700); font-weight: 600; }
.games-pick.ok { border-color: #86efac; background: #f0fdf4; color: #15803d; }
.games-pick.bad { border-color: #fca5a5; background: #fef2f2; color: #b91c1c; }
.games-pick.miss { border-style: dashed; border-color: #86efac; color: #15803d; }
.games-form-foot { display: flex; justify-content: flex-end; margin-top: 12px; }
.games-match-foot { margin-top: 12px; }
.games-match-sum { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 12px 0 2px; }
.games-match-sum > div {
  display: flex; flex-direction: column; gap: 2px; min-width: 72px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 11px; background: #f9fbff;
}
.games-match-sum b { font-size: 17px; color: var(--teal-700); }
.games-match-sum span { font-size: 11px; color: var(--muted); }

/* 大厅积分概览 */
.games-hero-stats { display: flex; gap: 8px; width: 100%; }
.games-hero-stats .games-total { flex: 1; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 12px; }
.games-hero-stats .games-total span { margin-right: 0; }
.games-hero-stats .games-total b { font-size: 20px; }

/* 积分规则与最近记录 */
.games-pts-guide { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 12px; }
.games-pts-guide > div { padding: 13px 14px; border: 1px solid var(--line); border-radius: 13px; background: #fff; box-shadow: var(--shadow); }
.games-pts-guide h3 { font-size: 12.5px; font-weight: 700; margin-bottom: 6px; color: var(--ink); }
.games-pts-guide ul { margin: 0; padding-left: 16px; font-size: 11.5px; line-height: 1.85; color: var(--text); }
.games-pts-note { margin-top: 7px; font-size: 11px; color: var(--muted); }
.games-pts-log ul { list-style: none; margin: 0; padding: 0; }
.games-pts-log li { display: flex; align-items: center; gap: 7px; padding: 5px 0; border-bottom: 1px dashed #eef3f6; font-size: 11.5px; }
.games-pts-log li:last-child { border-bottom: 0; }
.games-pts-log li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.games-pts-log li em { flex: none; font-style: normal; font-size: 10.5px; color: var(--muted); }
.games-pts-log li b { flex: none; font-size: 12px; color: #b45309; }
.games-pts-log .games-pts-empty { border-bottom: 0; color: var(--muted); font-size: 11px; }

/* 养生判断 */
.games-tf-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.games-tf-btn {
  min-height: 50px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff;
  font-size: 15px; font-weight: 700; color: var(--text); cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.games-tf-btn.ok:active { border-color: #34d399; background: #f0fdf4; color: #15803d; }
.games-tf-btn.bad:active { border-color: #f87171; background: #fef2f2; color: #b91c1c; }
.games-tf-btn.locked { pointer-events: none; opacity: 0.62; }
.games-tf-btn.picked-ok { border-color: #34d399; background: #f0fdf4; color: #15803d; opacity: 1; }
.games-tf-btn.picked-bad { border-color: #f87171; background: #fef2f2; color: #b91c1c; opacity: 1; }

/* ===== 费用五字段 / 辅助检查 / 方剂作用 / 理疗单 ===== */
.fee-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin-top: 10px; }
.fee-fields .field input[readonly] { background: #f8fafb; color: #c0392b; font-weight: 700; }
.fee-fill {
  align-self: flex-start; margin-top: 4px; border: 1px dashed var(--teal-700);
  background: #f3f8f6; color: var(--teal-700); border-radius: 9px;
  padding: 5px 10px; font-size: 12px; font-weight: 600;
}
.exam-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.exam-upload {
  display: inline-flex; align-items: center; height: 34px; padding: 0 13px;
  border-radius: 9px; background: #eef3f1; color: #46594f; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.exam-upload.busy { opacity: 0.55; pointer-events: none; }
.exam-bar select {
  height: 34px; border: 1px solid var(--line); border-radius: 9px;
  background: #fbfdfc; color: #4c5f59; font-size: 12.5px; padding: 0 8px;
}
.exam-findings { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.exam-tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px;
  border-radius: 999px; background: #fff7ed; color: #b45309;
  border: 1px solid #fed7aa; font-size: 11.5px;
}
.rx-effect {
  margin-top: 12px; padding: 11px 13px; border: 1px solid #dbe7e2;
  border-radius: 12px; background: #f8fbfa;
}
.rx-effect[hidden] { display: none; }
.rx-effect-head { display: flex; align-items: baseline; gap: 8px; font-size: 13.5px; }
.rx-effect-head b { color: var(--ink); }
.rx-effect-head span { font-size: 11.5px; color: var(--muted); }
.rx-effect-line { margin: 6px 0 0; font-size: 12.5px; line-height: 1.75; color: #4c5f59; }
.rx-effect-line em { font-style: normal; font-weight: 700; color: var(--teal-700); }
.rx-herbs { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.rx-herb { display: flex; gap: 8px; font-size: 12px; line-height: 1.6; color: #5b6b7a; }
.rx-herb b { flex: 0 0 62px; color: #2f3d38; }
.rx-herb span { flex: 1; min-width: 0; }
.rx-herb.hit { color: #15803d; }
.rx-herb.hit b { color: #15803d; }
.rx-herb i {
  font-style: normal; margin-left: 6px; padding: 1px 6px; border-radius: 999px;
  background: #dcfce7; color: #15803d; font-size: 10.5px;
}
.tl-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.tl-tools button {
  border: 1px solid var(--line); background: #fbfdfc; color: #46594f;
  border-radius: 8px; padding: 5px 9px; font-size: 11.5px; font-weight: 600;
}
.tl-tools button.warn { background: #fff7ed; border-color: #fed7aa; color: #b45309; }
.fee-line .unpaid { color: #c0392b; }
.fee-summary-card { display: flex; justify-content: space-between; gap: 8px; text-align: center; }
.fee-summary-card > div { flex: 1; }
.fee-summary-card span { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.fee-summary-card b { font-size: 15px; color: var(--ink); }
.fee-summary-card b.unpaid { color: #c0392b; }
.gz-plain p { color: #4c5f59; line-height: 1.8; }
/* 智能组方（优先推荐） */
.sg-formula.gen { border-color: #39a97c; background: #f3fbf7; box-shadow: 0 2px 10px rgba(57, 169, 124, .12); }
.sg-f-pick { display: inline-block; margin-right: 5px; padding: 1px 5px; border-radius: 4px; background: #39a97c; color: #fff; font-style: normal; font-size: 10.5px; font-weight: 600; }
.sg-f-reason { margin-top: 6px; font-size: 12px; line-height: 1.6; color: #4a5a6a; background: #eef9f3; border-radius: 6px; padding: 6px 8px; }
#printArea { display: none; }
@media print {
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; }
}

/* ===== 双臂血压 ===== */
.bp-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.bp-table th, .bp-table td { border: 1px solid #e2e8f0; padding: 5px 6px; }
.bp-table thead th { background: #eef2f7; color: #4a5a6a; font-weight: 600; font-size: 12px; text-align: center; }
.bp-table thead th.bp-corner { background: #f8fafc; }
.bp-table tbody th { width: 48px; color: #c0392b; font-weight: 600; background: #fbfcfe; text-align: center; white-space: nowrap; font-size: 12.5px; }
.bp-table td { background: #fff; padding: 4px 5px; }
.bp-table td input { width: 100%; height: 34px; padding: 0 6px; border: 1px solid #d6dee7; border-radius: 7px; background: #fff; font-size: 14px; text-align: center; }
.bp-table td input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59, 130, 246, .12); }
.bp-diff-row td { background: #f8fafc; text-align: center; padding: 5px 3px; }
.bp-diff-row em { display: block; font-style: normal; font-size: 10.5px; color: #8899a8; }
.bp-diff-row b { font-size: 14px; color: #b45309; }
.bp-diff-row small { font-size: 10px; color: #8899a8; margin-left: 1px; }
.bp-analysis { margin-top: 8px; font-size: 12.5px; color: #40505f; line-height: 1.7; }
.bp-empty { color: #93a2b1; }
.bp-summary { display: flex; flex-direction: column; gap: 2px; padding: 6px 0 8px; border-bottom: 1px dashed #dbe3ec; margin-bottom: 6px; }
.bp-summary b { color: #b45309; font-size: 13.5px; }
.bp-summary span { color: #5b6b7a; font-size: 12px; }
.bp-row { display: flex; gap: 6px; margin-top: 2px; }
.bp-row em { flex: none; width: 58px; font-style: normal; color: #8a97a5; }
.bp-row p { margin: 0; flex: 1; word-break: break-all; }
.bp-warn { background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 6px 9px; margin: 0 0 8px; }
.bp-warn p { margin: 0; color: #b91c1c; font-weight: 600; line-height: 1.55; }
.bp-warn p + p { margin-top: 2px; }

/* 舌象拍照识别 */
/* 文件选择：透明 input 覆盖在按钮上，避免部分安卓浏览器点击 label 无法唤起相机 / 相册 */
.tongue-shot, .exam-upload { position: relative; overflow: hidden; }
.tongue-shot > input[type='file'], .exam-upload > input[type='file'] {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  opacity: 0; font-size: 100px; cursor: pointer; z-index: 2;
}
.tongue-input { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tongue-input input { flex: 1 1 110px; min-width: 0; }
.tongue-shot { flex: none; display: inline-flex; align-items: center; height: 44px; padding: 0 10px; border-radius: 9px; background: #eef5ff; border: 1px solid #bcd6f5; color: #1b5fa8; font-size: 13px; font-weight: 600; white-space: nowrap; }
.tongue-shot:active { background: #dfeafd; }
.tongue-shot.tongue-upload { background: #f1f8f3; border-color: #bfe0cb; color: #1f7a4a; }
.tongue-hint { display: block; margin-top: 5px; font-style: normal; font-size: 11.5px; line-height: 1.5; color: #7b8a99; }
.tongue-field.busy .tongue-shot { opacity: .55; pointer-events: none; }
.tongue-field.busy .tongue-hint { color: #1b5fa8; }

/* 费用填写：五类金额分色，未收红色醒目 */
.fee-fields .field label { font-weight: 600; }
.fee-fields .fee-due input { border-color: #4a90e2; background: #f2f8ff; }
.fee-fields .fee-paid input { border-color: #2e9e5b; background: #f2fbf5; }
.fee-fields .fee-cash input { border-color: #d99a1f; background: #fffaf0; }
.fee-fields .fee-wechat input { border-color: #12a1a1; background: #f0fbfb; }
.fee-fields .fee-unpaid input { border-color: #e53935; background: #fff1f0; color: #c62828; font-weight: 700; }
.fee-fields .fee-due label { color: #1b5fa8; }
.fee-fields .fee-paid label { color: #1e7a45; }
.fee-fields .fee-cash label { color: #8a6320; }
.fee-fields .fee-wechat label { color: #0e7c7c; }
.fee-fields .fee-unpaid label { color: #c62828; }
.fee-gift { display: none; margin: 6px 2px 0; font-size: 12px; color: #1e8e5a; background: #eefaf2; border: 1px dashed #9fd9b6; border-radius: 8px; padding: 5px 8px; }
.fee-gift.on { display: block; }
.gift { color: #1e8e5a; font-weight: 700; }
