/* =====================================================================
   悦健 HealthFlow · 移动端 App
   设计令牌 100% 对齐 PRD §1.3《视觉设计规范表》
   ===================================================================== */

/* ---------- 1. 设计令牌 ---------- */
:root{
  /* 色彩体系 §1.3.1 */
  --teal:#12B49A;          /* 品牌主色 Health Teal */
  --teal-deep:#0A8F79;     /* 品牌深色 Teal Deep */
  --teal-soft:#E7F7F2;     /* 主色浅底 */
  --teal-tint:#F2FBF8;
  --blue:#3B82F6;          /* 辅助色 Data Blue */
  --blue-soft:#EAF2FE;
  --orange:#FF7A45;        /* 强调色 Action Orange */
  --orange-soft:#FFF0EA;
  --success:#16A34A;       /* 语义-正常 */
  --success-text:#15803D;
  --warning:#F59E0B;       /* 语义-关注 */
  --warning-text:#B45309;  /* 文字加深变体，满足 4.5:1 */
  --warning-soft:#FFF7E8;
  --danger:#EF4444;        /* 语义-异常 */
  --danger-text:#B42318;
  --danger-soft:#FFF1F0;
  --violet:#8B5CF6;

  --t1:#1A1D1F;            /* 一级文字 */
  --t2:#6B7280;            /* 正文 */
  --t3:#9CA3AF;            /* 辅助文字 */
  --bg:#F6F7F9;            /* 页面底 */
  --surface:#FFFFFF;       /* 卡片底 */
  --surface-sunken:#F1F2F4;/* 内凹底（输入框/分段器） */
  --divider:#E9EBEE;

  /* 圆角 §1.3.2 */
  --r-chip:999px;
  --r-btn:12px;
  --r-input:12px;
  --r-card:16px;
  --r-sheet:24px;
  --r-modal:20px;

  /* 阴影 §1.3.2 */
  --e0:0 0 0 1px var(--divider);
  --e1:0 1px 2px rgba(16,24,40,.06);
  --e2:0 4px 12px rgba(16,24,40,.08);
  --e3:0 12px 32px rgba(16,24,40,.16);

  /* 动效 §1.3.3 */
  --d-micro:120ms;
  --d-fade:160ms;
  --d-press:160ms;
  --d-page:280ms;
  --d-morph:420ms;
  --d-sheet:320ms;
  --ease-std:cubic-bezier(.4,0,.2,1);
  --ease-overshoot:cubic-bezier(.34,1.56,.64,1);
  --ease-page:cubic-bezier(.2,0,0,1);
  --ease-sheet:cubic-bezier(.32,.72,0,1);

  /* 字号 §1.3.4 */
  --fs-display:44px;
  --fs-h1:28px;
  --fs-h2:22px;
  --fs-h3:18px;
  --fs-metric:24px;
  --fs-body:15px;
  --fs-caption:13px;
  --fs-micro:11px;

  /* 结构 */
  --sb-h:54px;
  --tabbar-h:62px;
  /* 安全区：桌面 / 模拟器没有安全区概念（env 返回 0），取 max 保住外框呼吸感；
     真机（iPhone 底部 home indicator = 34px）自动抬到系统值之上 */
  --safe-b:max(22px, env(safe-area-inset-bottom, 22px));
  /* 顶部安全区：仅 standalone（从主屏幕图标启动）时由 .phone 让出给系统状态栏 */
  --safe-t:env(safe-area-inset-top, 0px);

  --font-cn:"PingFang SC","HarmonyOS Sans SC","MiSans","Noto Sans SC","Microsoft YaHei","Source Han Sans SC",sans-serif;
  --font-num:"Inter","SF Pro Display","Roboto",system-ui,sans-serif;
}

/* 深色模式 §1.3.1 */
:root[data-theme="dark"]{
  --t1:#F2F4F6;
  --t2:#A1A7B3;
  --t3:#6B7280;
  --bg:#101214;
  --surface:#1A1D1F;
  --surface-sunken:#22262A;
  --divider:#2A2F35;
  --teal-soft:#12312C;
  --teal-tint:#122A26;
  --blue-soft:#14243C;
  --warning-soft:#33280F;
  --danger-soft:#3A1E1C;
  --orange-soft:#3A2418;
  --e1:0 1px 2px rgba(0,0,0,.4);
  --e2:0 4px 12px rgba(0,0,0,.45);
  --e3:0 12px 32px rgba(0,0,0,.6);
  --success-text:#4ADE80;
  --warning-text:#FBBF24;
  --danger-text:#FCA5A5;
}

/* ---------- 2. 基础重置 ---------- */
*,*::before,*::after{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--font-cn);
  font-size:var(--fs-body);
  line-height:24px;
  color:var(--t1);
  background:#E7EAEE;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
  /* iOS 手势防御：长按是本应用的核心交互（卡片编辑态），
     不禁掉 callout 的话 iOS 会弹文本放大镜 / 复制菜单把它抢走 */
  -webkit-touch-callout:none;
  -webkit-user-select:none;user-select:none;
  /* 禁双击缩放（保留捏合缩放的可访问性），消除移动端点击延迟 */
  touch-action:manipulation;
  /* 阻止 iOS 橡皮筋把整个页面拽出底色 */
  overscroll-behavior:none;
}
/* 输入控件恢复文本选择，否则 iOS 上无法选中 / 长按粘贴 */
input,textarea{-webkit-user-select:text;user-select:text}
:root[data-theme="dark"] body{background:#070809}
button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:pointer}
input,textarea{font:inherit;color:inherit}
ul{margin:0;padding:0;list-style:none}
h1,h2,h3,h4,p{margin:0}
svg{display:block}
::-webkit-scrollbar{width:0;height:0}

/* ---------- 3. 舞台与设备框架 ---------- */
.stage{
  min-height:100dvh;
  display:grid;
  place-items:center;
  padding:24px 24px 24px 24px;
}
.device{
  width:390px;height:844px;
  transform-origin:center center;
  border-radius:46px;
  background:#0B0D0F;
  padding:10px;
  box-shadow:0 32px 80px rgba(16,24,40,.28),0 0 0 1px rgba(16,24,40,.06);
  position:relative;
}
/* 侧边实体键 */
.device::before,.device::after{
  content:"";position:absolute;width:3px;background:#2A2F35;border-radius:2px;
}
.device::before{left:-2px;top:186px;height:64px}
.device::after{left:-2px;top:266px;height:64px}

.phone{
  position:relative;
  width:100%;height:100%;
  border-radius:38px;
  overflow:hidden;
  background:var(--bg);
  display:flex;flex-direction:column;
  transition:background var(--d-fade) var(--ease-std);
}

/* 桌面端说明卡 */
.stage__note{
  position:fixed;left:32px;bottom:32px;
  padding:16px 18px;border-radius:16px;
  background:rgba(255,255,255,.72);
  backdrop-filter:blur(14px);
  border:1px solid rgba(16,24,40,.06);
  box-shadow:var(--e2);
  max-width:250px;color:var(--t2);
}
.stage__note-title{font-size:14px;font-weight:600;color:var(--t1)}
.stage__note-sub{font-size:11px;color:var(--t3);margin-top:2px}
.stage__note-list{margin-top:12px;display:grid;gap:6px;font-size:11px;line-height:16px}
.stage__note-list li{display:flex;align-items:center;gap:6px}
kbd{
  display:inline-flex;align-items:center;justify-content:center;
  min-width:18px;height:18px;padding:0 5px;
  font-family:var(--font-num);font-size:10px;font-weight:600;
  background:#fff;border:1px solid var(--divider);border-radius:5px;
  box-shadow:0 1px 0 var(--divider);color:var(--t1);
}

/* ---------- 4. 状态栏 ---------- */
.statusbar{
  flex:0 0 auto;height:var(--sb-h);
  padding:16px 26px 0;
  display:flex;align-items:center;justify-content:space-between;
  color:var(--t1);
}
.statusbar__time{
  font-family:var(--font-num);font-size:15px;font-weight:600;
  font-variant-numeric:tabular-nums;letter-spacing:.2px;
}
.statusbar__icons{display:flex;align-items:center;gap:5px}

/* ---------- 5. 页面容器 ---------- */
.screen{
  flex:1 1 auto;
  position:relative;
  overflow-y:auto;overflow-x:hidden;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;
}
.screen.is-tabbed{padding-bottom:calc(var(--tabbar-h) + var(--safe-b) + 24px)}
/* AI 页：整页不滚动，仅对话区内部滚动 */
.screen.is-fixed{overflow:hidden}
.page{min-height:100%;display:flex;flex-direction:column}
.page--chat{height:100%;min-height:0}

/* 页面转场 §1.3.3 */
@keyframes pagePushIn{from{transform:translateX(28px);opacity:0}to{transform:none;opacity:1}}
@keyframes pagePopIn{from{transform:translateX(-20px);opacity:0}to{transform:none;opacity:1}}
@keyframes pageFadeIn{from{opacity:0}to{opacity:1}}
.screen.anim-push>.page{animation:pagePushIn var(--d-page) var(--ease-page) both}
.screen.anim-pop>.page{animation:pagePopIn var(--d-page) var(--ease-page) both}
.screen.anim-fade>.page{animation:pageFadeIn var(--d-fade) var(--ease-std) both}

/* ---------- 6. 排版工具 ---------- */
.t-display{font-family:var(--font-num);font-size:var(--fs-display);line-height:52px;font-weight:700;font-variant-numeric:tabular-nums}
.t-h1{font-size:var(--fs-h1);line-height:36px;font-weight:600}
.t-h2{font-size:var(--fs-h2);line-height:30px;font-weight:600}
.t-h3{font-size:var(--fs-h3);line-height:26px;font-weight:500}
.t-metric{font-family:var(--font-num);font-size:var(--fs-metric);line-height:32px;font-weight:700;font-variant-numeric:tabular-nums}
.t-body{font-size:var(--fs-body);line-height:24px}
.t-cap{font-size:var(--fs-caption);line-height:20px;color:var(--t2)}
.t-micro{font-size:var(--fs-micro);line-height:16px;font-weight:500;color:var(--t3)}
.c1{color:var(--t1)}.c2{color:var(--t2)}.c3{color:var(--t3)}
.c-teal{color:var(--teal-deep)}.c-danger{color:var(--danger-text)}.c-warn{color:var(--warning-text)}
.c-success{color:var(--success-text)}
.num{font-family:var(--font-num);font-variant-numeric:tabular-nums}
.mt2{margin-top:2px}.mt4{margin-top:4px}.mt6{margin-top:6px}.mt8{margin-top:8px}
.mt12{margin-top:12px}.mt16{margin-top:16px}

/* ---------- 7. 顶部导航（子页面） ---------- */
.navbar{
  position:sticky;top:0;z-index:20;
  display:flex;align-items:center;gap:8px;
  padding:2px 16px 14px;
  background:linear-gradient(var(--bg) 72%,transparent);
  backdrop-filter:blur(8px);
}
.navbar__btn{
  width:44px;height:44px;margin-left:-10px;
  display:grid;place-items:center;color:var(--t1);
  border-radius:50%;transition:background var(--d-micro) var(--ease-std);
}
.navbar__btn:active{background:var(--surface-sunken)}
.navbar__title{
  flex:1;text-align:center;font-size:17px;font-weight:600;color:var(--t1);
}
.navbar__action{
  min-width:44px;height:44px;margin-right:-10px;
  display:grid;place-items:center;
  font-size:13px;font-weight:500;color:var(--t3);
  border-radius:50%;transition:background var(--d-micro) var(--ease-std);
}
.navbar__action:active{background:var(--surface-sunken)}

/* ---------- 8. 内容区与卡片 ---------- */
.content{padding:0 20px;display:flex;flex-direction:column;gap:10px}
.content--gap12{gap:12px}
.card{
  background:var(--surface);
  border-radius:var(--r-card);
  box-shadow:var(--e1);
  transition:background var(--d-fade) var(--ease-std),transform var(--d-press) var(--ease-overshoot);
}
.card--flat{box-shadow:var(--e0)}
.card--pad{padding:14px}
.card--pad16{padding:16px}
.card--pad20{padding:20px}
.card-row{
  display:flex;align-items:center;justify-content:space-between;
  gap:8px;
}
.card-title{font-size:14px;font-weight:600;color:var(--t1)}

/* 可点击卡片：按下缩放 §1.4.1 */
.tappable{cursor:pointer;user-select:none;-webkit-tap-highlight-color:transparent}
.tappable:active{transform:scale(.98)}

/* 列表行 */
.row{
  display:flex;align-items:center;gap:10px;
  min-height:44px;
}
.row__label{flex:1;font-size:13px;color:var(--t1)}
.row__chev{flex:0 0 auto;color:var(--t3);transition:transform var(--d-micro) var(--ease-std)}
.row.tappable:active .row__chev{transform:translateX(2px)}
.list-divider{height:1px;background:var(--divider);margin:2px 0}

/* ---------- 9. 组件：标签 / 按钮 / 开关 / 分段器 ---------- */
.chip{
  display:inline-flex;align-items:center;gap:4px;
  height:26px;padding:0 10px;border-radius:var(--r-chip);
  font-size:var(--fs-micro);font-weight:500;
  background:var(--surface-sunken);color:var(--t2);white-space:nowrap;
}
.chip--teal{background:var(--teal-soft);color:var(--teal-deep)}
.chip--warn{background:var(--warning-soft);color:var(--warning-text)}
.chip--danger{background:var(--danger-soft);color:var(--danger-text)}
.chip--success{background:#E9F7EE;color:var(--success-text)}
:root[data-theme="dark"] .chip--success{background:#13291B;color:#4ADE80}
.chip--outline{background:transparent;box-shadow:inset 0 0 0 1px var(--divider);color:var(--t2)}
.chip--onwhite{background:rgba(255,255,255,.2);color:#fff}

.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
  min-height:44px;padding:0 20px;border-radius:var(--r-btn);
  font-size:14px;font-weight:600;
  transition:transform var(--d-micro) var(--ease-std),opacity var(--d-micro) var(--ease-std),background var(--d-micro) var(--ease-std);
}
.btn:active{transform:scale(.97)}
.btn--block{display:flex;width:100%}
.btn--primary{background:var(--teal);color:#fff;box-shadow:0 6px 16px -4px rgba(18,180,154,.5)}
.btn--primary:active{background:var(--teal-deep)}
.btn--ghost{background:var(--surface);color:var(--t2);box-shadow:var(--e0)}
.btn--ghost:active{background:var(--surface-sunken)}
.btn--danger{background:var(--surface);color:var(--danger-text);box-shadow:inset 0 0 0 1px #F3BABA}
:root[data-theme="dark"] .btn--danger{box-shadow:inset 0 0 0 1px #6B2E29}
.btn--sm{min-height:36px;padding:0 14px;font-size:13px;font-weight:500;border-radius:var(--r-chip)}
.btn[disabled]{opacity:.45;pointer-events:none}

/* 开关 */
.switch{
  position:relative;flex:0 0 auto;
  width:46px;height:27px;border-radius:var(--r-chip);
  background:#E5E7EB;padding:2px;
  display:flex;align-items:center;
  transition:background var(--d-micro) var(--ease-std);
  cursor:pointer;
}
:root[data-theme="dark"] .switch{background:#3A4046}
.switch__knob{
  width:23px;height:23px;border-radius:50%;background:#fff;
  box-shadow:0 1px 3px rgba(16,24,40,.24);
  transition:transform var(--d-micro) var(--ease-overshoot);
}
.switch[aria-checked="true"]{background:var(--teal)}
.switch[aria-checked="true"] .switch__knob{transform:translateX(19px)}
.switch[disabled]{opacity:.5;pointer-events:none}

/* 时间维度分段器 §1.2.2 */
.seg{
  display:inline-flex;gap:2px;padding:3px;border-radius:var(--r-chip);
  background:var(--surface-sunken);
}
.seg__item{
  padding:5px 12px;border-radius:var(--r-chip);
  font-size:12px;color:var(--t2);
  transition:background var(--d-fade) var(--ease-std),color var(--d-fade) var(--ease-std);
  white-space:nowrap;
}
.seg__item[aria-selected="true"]{
  background:var(--surface);color:var(--t1);font-weight:600;
  box-shadow:0 1px 3px rgba(16,24,40,.1);
}

/* ---------- 10. 底部胶囊导航 ---------- */
.tabbar{
  position:absolute;left:20px;right:20px;
  bottom:var(--safe-b);height:var(--tabbar-h);
  display:none;
  border-radius:36px;
  background:rgba(255,255,255,.86);
  backdrop-filter:blur(20px) saturate(180%);
  box-shadow:0 4px 12px rgba(16,24,40,.08),0 0 0 1px rgba(16,24,40,.05);
  padding:4px;gap:2px;z-index:30;
}
:root[data-theme="dark"] .tabbar{background:rgba(26,29,31,.9);box-shadow:0 4px 12px rgba(0,0,0,.5),0 0 0 1px rgba(255,255,255,.06)}
.tabbar.is-visible{display:flex}
.tabbar__item{
  flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
  border-radius:26px;color:var(--t3);
  transition:background var(--d-fade) var(--ease-std),color var(--d-fade) var(--ease-std);
  min-width:0;
}
.tabbar__item span{font-size:10px;font-weight:500;line-height:12px}
.tabbar__item[aria-selected="true"]{background:var(--teal);color:#fff}
.tabbar__item[aria-selected="true"] span{font-weight:600}
.tabbar__item:active{opacity:.75}

/* ---------- 11. 弹层 ---------- */
.overlay-root{position:absolute;inset:0;z-index:60;pointer-events:none}
.overlay-root.is-open{pointer-events:auto}
.scrim{
  position:absolute;inset:0;background:rgba(16,24,40,.42);
  opacity:0;transition:opacity var(--d-fade) var(--ease-std);
}
.overlay-root.is-open .scrim{opacity:1}
.sheet{
  position:absolute;left:0;right:0;bottom:0;
  max-height:86%;overflow-y:auto;
  background:var(--surface);
  border-radius:var(--r-sheet) var(--r-sheet) 0 0;
  padding:10px 20px calc(20px + var(--safe-b));
  box-shadow:var(--e3);
  transform:translateY(100%);
  transition:transform var(--d-sheet) var(--ease-sheet);
}
.overlay-root.is-open .sheet{transform:none}
.sheet__handle{
  width:36px;height:4px;border-radius:2px;background:var(--divider);
  margin:0 auto 14px;
}
.sheet__title{font-size:17px;font-weight:600;color:var(--t1)}
.sheet__sub{font-size:12px;line-height:18px;color:var(--t2);margin-top:6px}

.modal-wrap{position:absolute;inset:0;display:grid;place-items:center;padding:32px}
.modal{
  width:100%;max-width:300px;
  background:var(--surface);border-radius:var(--r-modal);
  padding:22px 20px 16px;box-shadow:var(--e3);
  transform:scale(.92);opacity:0;
  transition:transform var(--d-sheet) var(--ease-overshoot),opacity var(--d-fade) var(--ease-std);
}
.overlay-root.is-open .modal{transform:none;opacity:1}
.modal__title{font-size:16px;font-weight:600;color:var(--t1);text-align:center}
.modal__body{font-size:13px;line-height:20px;color:var(--t2);text-align:center;margin-top:8px}
.modal__actions{display:flex;gap:8px;margin-top:18px}
.modal__actions .btn{flex:1;min-height:42px;font-size:14px}

/* Toast */
.toast-root{
  position:absolute;left:0;right:0;bottom:calc(var(--tabbar-h) + var(--safe-b) + 28px);
  display:flex;flex-direction:column;align-items:center;gap:8px;
  z-index:80;pointer-events:none;
}
.toast{
  max-width:82%;padding:10px 16px;border-radius:var(--r-chip);
  background:rgba(26,29,31,.92);color:#fff;
  font-size:12px;line-height:18px;text-align:center;
  box-shadow:var(--e2);
  animation:toastIn var(--d-fade) var(--ease-std) both;
}
.toast.is-out{animation:toastOut var(--d-fade) var(--ease-std) both}
@keyframes toastIn{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
@keyframes toastOut{to{opacity:0;transform:translateY(-6px)}}

/* ---------- 12. 首页：健康评分卡 ---------- */
.hero{
  position:relative;overflow:hidden;
  border-radius:var(--r-card);
  padding:18px;
  color:#fff;
  background:linear-gradient(135deg,#12B49A 0%,#0B8E78 58%,#0A7A67 100%);
  box-shadow:0 8px 24px -6px rgba(18,180,154,.45);
}
/* 柔光装饰 */
.hero::after{
  content:"";position:absolute;right:-56px;top:-70px;
  width:190px;height:190px;border-radius:50%;
  background:radial-gradient(circle,rgba(255,255,255,.24),transparent 68%);
  pointer-events:none;
}
.hero__row{display:flex;align-items:center;justify-content:space-between;gap:8px}
.hero__score{display:flex;align-items:flex-end;gap:12px;margin-top:10px;position:relative;z-index:1}
.hero__num{font-family:var(--font-num);font-size:46px;line-height:50px;font-weight:700;font-variant-numeric:tabular-nums;letter-spacing:-1px}
.hero__unit{font-size:13px;opacity:.82;padding-bottom:7px}
.hero__meta{font-size:11px;opacity:.85;padding-bottom:9px;line-height:15px}
.hero__divider{height:1px;background:rgba(255,255,255,.2);margin:14px 0 12px}
.hero__summary{font-size:12px;line-height:18px;opacity:.9;position:relative;z-index:1}
/* 评分环 */
.hero__ring{position:absolute;right:18px;top:52px;opacity:.9}

/* ---------- 13. 指标卡 ---------- */
.metrics{
  display:grid;grid-auto-flow:column;grid-auto-columns:calc(50% - 5px);
  gap:10px;overflow-x:auto;scroll-snap-type:x mandatory;
  padding-bottom:2px;margin:0 -20px;padding-left:20px;padding-right:20px;
}
.metrics::-webkit-scrollbar{display:none}
.metric-card{
  position:relative;
  scroll-snap-align:start;
  background:var(--surface);border-radius:var(--r-card);
  padding:13px;box-shadow:var(--e1);
  display:flex;flex-direction:column;gap:7px;
  cursor:pointer;user-select:none;-webkit-tap-highlight-color:transparent;
  transition:transform var(--d-press) var(--ease-overshoot),box-shadow var(--d-fade) var(--ease-std);
}
.metric-card:active{transform:scale(.97)}
.metric-card__head{display:flex;align-items:center;gap:5px}
.metric-card__label{font-size:12px;font-weight:500;color:var(--t2)}
.metric-card__dot{
  width:6px;height:6px;border-radius:50%;margin-left:auto;flex:0 0 auto;
}
.metric-card__value{display:flex;align-items:flex-end;gap:3px}
.metric-card__num{font-family:var(--font-num);font-size:23px;line-height:26px;font-weight:700;font-variant-numeric:tabular-nums;letter-spacing:-.3px}
.metric-card__unit{font-size:10px;color:var(--t3);padding-bottom:3px}
.metric-card__spark{height:26px}

/* ---------- 13b. 主面板指标区：分组 / 增删 ----------
   平时是横向滑动轮播（沿用原设计）；进入编辑态换成两列宫格，
   因为「看不见的卡片删不掉」—— 必须让所有卡片和 × 一屏可见。 */
.home-metrics .section-head .btn{align-self:center}
.metric-group__head{
  display:flex;align-items:baseline;justify-content:space-between;gap:10px;
  padding:2px 2px 0;margin:14px 0 8px;
}
.section-head+.metric-group__head{margin-top:8px}
.metric-group__name{
  display:flex;align-items:center;gap:7px;
  font-size:13px;font-weight:600;color:var(--t1);
}
.metric-group__name::before{
  content:'';width:3px;height:12px;border-radius:2px;
  background:var(--teal);flex:0 0 auto;
}
.home-metrics.is-editing .metrics{
  grid-auto-flow:row;grid-template-columns:repeat(2,1fr);
  overflow:visible;scroll-snap-type:none;margin:0;padding:0;
}
.home-metrics.is-editing .metric-card{
  animation:cardFade var(--d-page) var(--ease-std) both;
}
/* 只做透明度渐入：留出 transform 给 :active 的按压反馈 */
@keyframes cardFade{from{opacity:.35}to{opacity:1}}

/* 移除按钮：只在编辑态出现，压在卡片右上角 */
.metric-card__remove{
  position:absolute;top:-7px;right:-7px;z-index:2;
  width:22px;height:22px;padding:0;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  background:var(--danger);border:2px solid var(--surface);
  box-shadow:0 2px 6px rgba(16,24,40,.22);
  cursor:pointer;-webkit-tap-highlight-color:transparent;
  animation:removeIn var(--d-fade) var(--ease-overshoot) both;
}
.metric-card__remove:active{transform:scale(.88)}
@keyframes removeIn{from{transform:scale(.3);opacity:0}to{transform:none;opacity:1}}

/* 化验类卡片：底色轻微区分，让「体检批次数据」和日常体征一眼可辨 */
.metric-card--lab{background:var(--teal-tint)}

/* 有这项指标、但一条读数都没有：与「未授权」占位区分开 ——
   未授权是「你没让我看」，空数据是「确实还没采到」，用户的下一步动作不同 */
.metric-card--empty{background:var(--surface-sunken)}

/* 「添加指标」入口：虚线描边，与真实卡片区分开，避免被误当成数据卡 */
.metric-add{
  display:flex;align-items:center;justify-content:center;gap:8px;
  width:100%;min-height:46px;margin-top:12px;padding:0 14px;
  border-radius:var(--r-card);border:1px dashed var(--divider);
  background:transparent;color:var(--teal-deep);
  font-size:13px;font-weight:600;
}
.metric-add .t-micro{font-weight:500}
.metric-add:active{border-color:var(--teal);background:var(--teal-tint)}

/* ---------- 13c. 指标选择面板（底部弹层内） ---------- */
.picker-group__head{
  display:flex;align-items:baseline;justify-content:space-between;gap:10px;
  margin:16px 0 4px;
}
.picker-group__name{font-size:13px;font-weight:600;color:var(--t1)}
.picker-group__head .t-micro{text-align:right;max-width:62%}
.picker-list{display:flex;flex-direction:column}
.picker-row{
  display:flex;align-items:center;gap:10px;width:100%;
  padding:8px 6px;margin:0 -6px;border-radius:10px;
  background:transparent;text-align:left;
}
.picker-row+.picker-row{border-top:1px solid var(--divider)}
.picker-row:active{background:var(--surface-sunken)}
.picker-row__icon{
  width:30px;height:30px;border-radius:9px;flex:0 0 auto;
  display:flex;align-items:center;justify-content:center;
  background:var(--surface-sunken);
  transition:background var(--d-fade) var(--ease-std);
}
.picker-row.is-on .picker-row__icon{background:var(--teal-soft)}
.picker-row__body{flex:1;min-width:0;display:flex;flex-direction:column}
.picker-row__name{
  display:flex;align-items:center;gap:6px;
  font-size:14px;font-weight:500;color:var(--t1);
}
.picker-row.is-on .picker-row__name{font-weight:600}
.picker-row__tag{
  font-size:10px;line-height:16px;font-weight:500;padding:0 6px;
  border-radius:var(--r-chip);background:var(--blue-soft);color:var(--blue);
}
.picker-row__tick{
  width:20px;height:20px;border-radius:50%;flex:0 0 auto;
  display:flex;align-items:center;justify-content:center;
  border:1.5px solid var(--divider);
  transition:background var(--d-fade) var(--ease-std),border-color var(--d-fade) var(--ease-std);
}
.picker-row.is-on .picker-row__tick{background:var(--teal);border-color:var(--teal)}

/* ---------- 13d. 化验项目：参考区间标尺 + 历次记录 ---------- */
.ref-band{position:relative;height:10px}
.ref-band__track{
  position:absolute;inset:0;border-radius:var(--r-chip);
  background:var(--surface-sunken);
}
.ref-band__ok{
  position:absolute;top:0;bottom:0;border-radius:var(--r-chip);
  background:var(--teal-soft);
}
.ref-band__mark{
  position:absolute;top:50%;width:13px;height:13px;margin-left:-6.5px;
  border-radius:50%;transform:translateY(-50%);
  background:var(--success);border:2px solid var(--surface);
  box-shadow:0 1px 3px rgba(16,24,40,.24);
}
.ref-band__mark.is-out{background:var(--danger)}
.ref-band__labels{
  display:flex;align-items:baseline;justify-content:space-between;
  margin-top:7px;font-size:11px;color:var(--t3);
}
.ref-band__labels span:nth-child(2){color:var(--t2);font-weight:600}

.lab-list{display:flex;flex-direction:column}
.lab-row{
  display:flex;align-items:center;gap:10px;
  padding:9px 0;border-bottom:1px solid var(--divider);
}
.lab-row:last-child{border-bottom:0}
.lab-row__day{
  flex:0 0 88px;font-size:12px;color:var(--t3);
  font-variant-numeric:tabular-nums;
}
.lab-row__val{
  flex:1;min-width:0;font-family:var(--font-num);
  font-size:15px;font-weight:600;color:var(--t1);
  font-variant-numeric:tabular-nums;
}
.lab-row__chip{flex:0 0 auto;font-size:11px;text-align:right}

/* ---------- 14. 图表 ---------- */
.chart{width:100%;display:block;overflow:visible}
.chart path.line{
  fill:none;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round;
  stroke-dasharray:1;stroke-dashoffset:1;
  animation:draw var(--d-morph) var(--ease-page) forwards;
}
/* 虚线系列（对比项）不参与描边动画，否则虚线样式会被覆盖 */
.chart path.line[stroke-dasharray="5 5"]{
  stroke-dasharray:5 5;stroke-dashoffset:0;animation:fadeIn var(--d-morph) var(--ease-std) forwards;
}
@keyframes draw{to{stroke-dashoffset:0}}
.chart .area{opacity:0;animation:fadeIn var(--d-morph) var(--ease-std) 120ms forwards}
@keyframes fadeIn{to{opacity:1}}
.chart .grid{stroke:var(--divider);stroke-width:1;stroke-dasharray:3 4}
.chart .tick{fill:var(--t3);font-size:10px;font-family:var(--font-num)}
.chart .dot{stroke:var(--surface);stroke-width:2.5}
.chart .cursor{stroke:var(--teal);stroke-width:1.4;stroke-dasharray:4 4;opacity:.75}
.chart .band{fill:var(--teal);opacity:.06}

/* 多轴图例 */
.legend{display:flex;flex-wrap:wrap;gap:10px}
.legend__item{display:inline-flex;align-items:center;gap:5px;font-size:11px;color:var(--t2);cursor:pointer}
.legend__swatch{width:10px;height:3px;border-radius:2px}
.legend__item[data-off="true"]{opacity:.38;text-decoration:line-through}

/* ---------- 15. 智能洞察 / 异常 ---------- */
.insight{
  display:flex;align-items:center;gap:10px;
  padding:13px;border-radius:var(--r-card);
  background:var(--surface);box-shadow:var(--e1);
  cursor:pointer;-webkit-tap-highlight-color:transparent;
  transition:transform var(--d-press) var(--ease-overshoot);
}
.insight:active{transform:scale(.985)}
.insight__icon{
  flex:0 0 auto;width:32px;height:32px;border-radius:10px;
  display:grid;place-items:center;background:var(--warning-soft);
}
.insight__body{flex:1;min-width:0}
.insight__title{font-size:13px;font-weight:600;color:var(--t1);display:flex;align-items:center;gap:6px}
.insight__desc{font-size:11px;line-height:16px;color:var(--t2);margin-top:2px}
.insight__chev{flex:0 0 auto;color:var(--t3)}

.alert-card{
  padding:14px;border-radius:var(--r-card);
  background:var(--danger-soft);
  box-shadow:inset 0 0 0 1px #FBD9D6;
}
:root[data-theme="dark"] .alert-card{box-shadow:inset 0 0 0 1px #5A2A26}
.alert-card__head{display:flex;align-items:flex-start;gap:8px}
.alert-card__title{flex:1;font-size:13px;font-weight:600;color:var(--danger-text);line-height:19px}
.alert-card__body{font-size:12px;line-height:19px;color:#8A625C;margin-top:8px}
:root[data-theme="dark"] .alert-card__body{color:#C4A9A4}
.alert-card__actions{display:flex;gap:8px;margin-top:12px}

/* ---------- 16. 今日任务 ---------- */
.task{
  display:flex;align-items:center;gap:10px;
  min-height:40px;cursor:pointer;user-select:none;border-radius:10px;
  -webkit-tap-highlight-color:transparent;
}
.task__box{
  flex:0 0 auto;width:20px;height:20px;border-radius:6.5px;
  box-shadow:inset 0 0 0 1.8px var(--divider);
  display:grid;place-items:center;
  transition:background var(--d-micro) var(--ease-std),box-shadow var(--d-micro) var(--ease-std),transform var(--d-micro) var(--ease-overshoot);
}
.task[aria-checked="true"] .task__box{background:var(--teal);box-shadow:none;animation:checkPop var(--d-press) var(--ease-overshoot)}
@keyframes checkPop{0%{transform:scale(.82)}60%{transform:scale(1.12)}100%{transform:scale(1)}}
.task__box svg{opacity:0;transition:opacity var(--d-micro) var(--ease-std)}
.task[aria-checked="true"] .task__box svg{opacity:1}
.task__label{flex:1;font-size:13px;color:var(--t1);transition:color var(--d-micro) var(--ease-std)}
.task[aria-checked="true"] .task__label{color:var(--t3);text-decoration:line-through}
.task__time{font-size:11px;color:var(--t3)}

/* 进度条 */
.progress{height:5px;border-radius:3px;background:var(--surface-sunken);overflow:hidden}
.progress__bar{height:100%;border-radius:3px;background:var(--teal);transition:width var(--d-morph) var(--ease-page)}

/* ---------- 17. AI 助手 ---------- */
.chat{flex:1 1 auto;min-height:0;overflow-y:auto;padding:0 16px 12px;display:flex;flex-direction:column;gap:14px}
.msg{display:flex;flex-direction:column;gap:6px;max-width:100%}
.msg--user{align-items:flex-end}
.bubble{
  padding:11px 13px;border-radius:16px;
  font-size:13px;line-height:20px;
  animation:msgIn var(--d-page) var(--ease-page) both;
}
@keyframes msgIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
.bubble--ai{
  background:var(--surface);box-shadow:var(--e1);
  border-top-left-radius:6px;color:var(--t1);max-width:100%;
}
.bubble--user{
  background:var(--teal);color:#fff;
  border-top-right-radius:6px;max-width:252px;
}
.bubble--danger{background:var(--danger-soft);box-shadow:inset 0 0 0 1px #FBD9D6;color:var(--t1)}
.ai-head{display:flex;align-items:center;gap:6px}
.ai-avatar{
  width:20px;height:20px;border-radius:50%;background:var(--teal);
  display:grid;place-items:center;flex:0 0 auto;
}
.ai-name{font-size:12px;font-weight:600;color:var(--teal-deep)}
.ai-sec{margin-top:9px}
.ai-sec__label{font-size:11px;font-weight:600;color:var(--teal-deep);margin-bottom:3px}
.ai-sec__text{font-size:12.5px;line-height:19px;color:var(--t2)}
.ai-sec--warn .ai-sec__label{color:var(--warning-text)}
.ai-sec--danger .ai-sec__label{color:var(--danger-text)}
.ai-sec--danger .ai-sec__text{color:var(--danger-text)}
.disclaimer{
  margin-top:10px;padding:9px 10px;border-radius:8px;
  background:var(--surface-sunken);
  font-size:10px;line-height:15px;color:var(--t2);
}
.ai-quick{display:flex;gap:8px;overflow-x:auto;padding:2px 16px 10px}
.ai-quick::-webkit-scrollbar{display:none}
.typing{display:flex;gap:4px;align-items:center;height:20px}
.typing i{
  width:6px;height:6px;border-radius:50%;background:var(--t3);
  animation:blink 1.2s var(--ease-std) infinite;
}
.typing i:nth-child(2){animation-delay:.18s}
.typing i:nth-child(3){animation-delay:.36s}
@keyframes blink{0%,60%,100%{opacity:.3;transform:translateY(0)}30%{opacity:1;transform:translateY(-3px)}}

/* 输入区 */
.composer{
  flex:0 0 auto;
  padding:8px 16px calc(10px + var(--safe-b));
  background:linear-gradient(transparent,var(--bg) 26%);
  display:flex;flex-direction:column;gap:10px;
}
.composer__row{display:flex;align-items:center;gap:10px}
.composer__field{
  flex:1;min-height:46px;padding:12px 16px;
  border-radius:var(--r-chip);background:var(--surface-sunken);
  border:0;outline:none;font-size:13px;color:var(--t1);
}
.composer__field::placeholder{color:var(--t3)}
.composer__send{
  flex:0 0 auto;width:46px;height:46px;border-radius:50%;
  background:var(--teal);color:#fff;display:grid;place-items:center;
  box-shadow:0 6px 16px -6px rgba(18,180,154,.6);
  transition:transform var(--d-micro) var(--ease-std),opacity var(--d-micro) var(--ease-std);
}
.composer__send:active{transform:scale(.92)}
.composer__send[disabled]{opacity:.4;box-shadow:none}

/* 能力边界矩阵 */
.bounds{display:grid;gap:8px}
.bound{display:flex;gap:9px;padding:11px;border-radius:12px;background:var(--surface);box-shadow:var(--e0)}
.bound__mark{flex:0 0 auto;font-size:13px;line-height:20px}
.bound__text{font-size:12.5px;line-height:19px;color:var(--t2)}
.bound__text b{color:var(--t1);font-weight:600}

/* ---------- 18. 隐私与授权 ---------- */
.safe-hero{
  padding:16px;border-radius:var(--r-card);
  background:var(--teal-tint);
  box-shadow:inset 0 0 0 1px #CDEDE5;
  display:flex;flex-direction:column;gap:12px;
}
:root[data-theme="dark"] .safe-hero{box-shadow:inset 0 0 0 1px #1E4A42}
.safe-hero__head{display:flex;gap:12px;align-items:center}
.safe-hero__title{font-size:14px;font-weight:600;color:var(--teal-deep)}
.safe-hero__desc{font-size:11px;line-height:16px;color:#3F7F72;margin-top:3px}
:root[data-theme="dark"] .safe-hero__desc{color:#7FBFAF}
.safe-hero__tags{display:flex;flex-wrap:wrap;gap:6px}
.tag-pill{
  padding:5px 10px;border-radius:var(--r-chip);background:var(--surface);
  font-size:11px;font-weight:500;color:var(--teal-deep);
}

/* 分级徽标 */
.lv{
  flex:0 0 auto;width:26px;height:26px;border-radius:8px;
  display:grid;place-items:center;
  font-family:var(--font-num);font-size:11px;font-weight:700;color:#fff;
}
.lv--1{background:#16A34A}.lv--2{background:#3B82F6}
.lv--3{background:#F59E0B}.lv--4{background:#EF4444}

/* ---------- 19. 设备绑定 ---------- */
.brand-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.brand{
  padding:12px 8px;border-radius:var(--r-btn);
  background:var(--surface);box-shadow:var(--e0);
  display:flex;flex-direction:column;align-items:center;gap:7px;
  cursor:pointer;transition:box-shadow var(--d-fade) var(--ease-std),background var(--d-fade) var(--ease-std),transform var(--d-micro) var(--ease-std);
  -webkit-tap-highlight-color:transparent;
}
.brand:active{transform:scale(.96)}
.brand[aria-selected="true"]{
  background:var(--teal-tint);
  box-shadow:inset 0 0 0 1.5px var(--teal);
}
.brand__name{font-size:11px;font-weight:500;color:var(--t1);text-align:center;line-height:14px}
.brand[aria-selected="true"] .brand__name{color:var(--teal-deep);font-weight:600}

/* 同步状态条 */
.sync-bar{
  display:flex;align-items:center;gap:10px;padding:12px 14px;
  border-radius:var(--r-card);background:var(--surface);box-shadow:var(--e1);
}
.sync-bar__pulse{
  width:8px;height:8px;border-radius:50%;background:var(--success);position:relative;flex:0 0 auto;
}
.sync-bar__pulse::after{
  content:"";position:absolute;inset:-4px;border-radius:50%;
  background:var(--success);opacity:.28;animation:pulse 1.8s var(--ease-std) infinite;
}
@keyframes pulse{0%{transform:scale(.7);opacity:.4}70%{transform:scale(1.6);opacity:0}100%{opacity:0}}

/* ---------- 20. 骨架屏 §1.3.3 ---------- */
.skeleton{
  border-radius:var(--r-card);background:var(--surface-sunken);
  position:relative;overflow:hidden;
}
.skeleton::after{
  content:"";position:absolute;inset:0;
  background:linear-gradient(90deg,transparent,rgba(255,255,255,.6),transparent);
  animation:shimmer 1200ms linear infinite;
}
:root[data-theme="dark"] .skeleton::after{background:linear-gradient(90deg,transparent,rgba(255,255,255,.09),transparent)}
@keyframes shimmer{from{transform:translateX(-100%)}to{transform:translateX(100%)}}

/* ---------- 21. 减弱动效 §1.3.3 铁律 ---------- */
:root[data-reduce-motion="true"] *,
:root[data-reduce-motion="true"] *::before,
:root[data-reduce-motion="true"] *::after{
  animation-duration:1ms !important;
  animation-iteration-count:1 !important;
  transition-duration:1ms !important;
}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{
    animation-duration:1ms !important;animation-iteration-count:1 !important;
    transition-duration:1ms !important;
  }
}

/* ---------- 22. 小屏适配 ---------- */
@media (max-width:880px){.stage__note{display:none}}
@media (max-width:520px){
  .stage{padding:0}
  .device{
    width:100vw;height:100dvh;border-radius:0;padding:0;
    box-shadow:none;background:var(--bg);
  }
  .device::before,.device::after{display:none}
  .phone{border-radius:0}
}

/* ---------- 22b. standalone（从主屏幕图标启动的 App 形态） ----------
   由 app.js 检测后给 <html> 挂 .is-standalone：
   - 隐藏应用自绘的假状态栏，真机的系统状态栏顶在 --safe-t 区域里
   - iPad 等宽屏设备从主屏幕启动时也强制全屏，不走桌面外框分支 */
.is-standalone .statusbar{display:none}
.is-standalone .phone{padding-top:var(--safe-t)}
.is-standalone .stage{padding:0}
.is-standalone .device{
  width:100vw;height:100dvh;border-radius:0;padding:0;
  box-shadow:none;background:var(--bg);
}
.is-standalone .device::before,.is-standalone .device::after{display:none}
.is-standalone .phone{border-radius:0}
.is-standalone .stage__note{display:none}

/* =====================================================================
   23. 组件补充（视图层使用）
   ===================================================================== */

/* 文字补充层级 */
.t-caption{font-size:var(--fs-caption);line-height:20px}

/* 顶部问候 */
.greet{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:2px 0 4px}
.greet__title{font-size:20px;line-height:28px;font-weight:600;color:var(--t1)}
.greet__sub{font-size:13px;line-height:20px;color:var(--t2);margin-top:2px}
.icon-btn{
  flex:0 0 auto;width:44px;height:44px;margin-right:-10px;
  display:grid;place-items:center;border-radius:50%;color:var(--t1);
  transition:background var(--d-micro) var(--ease-std);
}
.icon-btn:active{background:var(--surface-sunken)}

/* 页头与大标题 */
.page-head{padding:2px 0 6px}
.section-head{
  display:flex;align-items:baseline;justify-content:space-between;
  padding:6px 2px 0;font-size:15px;font-weight:600;color:var(--t1);
}
.section-title{font-size:14px;font-weight:600;color:var(--t1);padding:4px 2px 0}

/* 指标详情：数值行 */
.value-row{display:flex;align-items:flex-end;gap:6px;margin:8px 0 6px}
.value-row__num{
  font-family:var(--font-num);font-size:44px;line-height:48px;font-weight:700;
  font-variant-numeric:tabular-nums;letter-spacing:-1px;color:var(--t1);
}
.value-row__unit{font-size:13px;font-weight:500;color:var(--t3);padding-bottom:8px}

/* 统计摘要 */
.stat-row{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.stat-cell{
  padding:12px;border-radius:var(--r-btn);background:var(--surface);
  box-shadow:var(--e1);display:flex;flex-direction:column;gap:4px;
}
.stat-cell__num{font-family:var(--font-num);font-size:18px;font-weight:700;font-variant-numeric:tabular-nums;color:var(--t1)}

/* 滑动提示 */
.swipe-hint{
  display:flex;align-items:center;justify-content:center;gap:10px;
  padding:10px 0 4px;color:var(--t3);
}

/* 数据页：指标宫格 */
.metric-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}
.metric-tile{
  padding:13px;border-radius:var(--r-card);background:var(--surface);
  box-shadow:var(--e1);display:flex;flex-direction:column;gap:7px;
  cursor:pointer;transition:transform var(--d-press) var(--ease-overshoot);
}
.metric-tile:active{transform:scale(.97)}

/* 指标选择器 */
.picker{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:12px}
.picker__item{
  display:inline-flex;align-items:center;gap:6px;height:30px;padding:0 12px;
  border-radius:var(--r-chip);background:var(--surface-sunken);
  font-size:12px;color:var(--t2);
  transition:background var(--d-fade) var(--ease-std),color var(--d-fade) var(--ease-std);
}
.picker__item[aria-pressed="true"]{background:var(--teal-soft);color:var(--teal-deep);font-weight:600}
.picker__dot{width:7px;height:7px;border-radius:50%;flex:0 0 auto}

/* 授权行 */
.auth-row{display:flex;align-items:center;gap:10px;min-height:48px;padding:4px 0}
.auth-row__body{flex:1;min-width:0}
.auth-row__name{font-size:13px;color:var(--t1);display:flex;align-items:center;gap:6px}

/* 键值行 */
.kv{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:30px;font-size:13px;color:var(--t2)}
.kv b{color:var(--t1);font-weight:600;font-size:13px}

/* 行内图标 */
.row__icon{flex:0 0 auto;width:24px;display:grid;place-items:center;color:var(--t2)}

/* 档案 */
.profile{display:flex;align-items:center;gap:12px}
.profile__avatar{
  flex:0 0 auto;width:48px;height:48px;border-radius:50%;
  background:linear-gradient(135deg,#12B49A,#0A7A67);color:#fff;
  display:grid;place-items:center;font-size:19px;font-weight:600;
}
.profile__name{font-size:16px;font-weight:600;color:var(--t1)}
.chip-row{display:flex;flex-wrap:wrap;gap:8px}

/* 设备行 */
.device-row{display:flex;align-items:center;gap:10px}
.device-row__icon{
  flex:0 0 auto;width:38px;height:38px;border-radius:12px;
  background:var(--teal-tint);display:grid;place-items:center;
}

/* 权限用途 / 说明行 */
.perm-row{display:flex;align-items:flex-start;gap:10px;padding:9px 0}
.perm-row + .perm-row{border-top:1px solid var(--divider)}

/* 授权范围勾选 */
.scope-list{display:flex;flex-wrap:wrap;gap:8px}
.scope{
  display:inline-flex;align-items:center;gap:7px;height:32px;padding:0 12px;
  border-radius:var(--r-chip);background:var(--surface-sunken);
  font-size:12px;color:var(--t2);
  transition:background var(--d-fade) var(--ease-std);
}
.scope[aria-pressed="true"]{background:var(--teal-soft);color:var(--teal-deep);font-weight:500}
.scope__tick{
  width:16px;height:16px;border-radius:5px;flex:0 0 auto;
  display:grid;place-items:center;background:transparent;
  box-shadow:inset 0 0 0 1.5px var(--divider);
}

/* 按钮组 */
.btn-stack{display:flex;flex-direction:column;gap:10px;padding:2px 0 4px}

/* 反馈选项网格 */
.feedback-grid{display:flex;flex-wrap:wrap;gap:8px}

/* 分级 / 安全 / 步骤项 */
.level-item,.sec-item,.step-item{display:flex;gap:11px;padding:12px 0}
.level-item + .level-item,.sec-item + .sec-item,.step-item + .step-item{border-top:1px solid var(--divider)}
.level-item,.step-item{align-items:flex-start}
.step-item__n{
  flex:0 0 auto;width:22px;height:22px;border-radius:50%;
  background:var(--teal-soft);color:var(--teal-deep);
  display:grid;place-items:center;font-family:var(--font-num);font-size:11px;font-weight:700;
}

/* 能力边界 */
.bounds-title{font-size:13px;font-weight:600;color:var(--t1);margin:16px 0 8px}
.bounds-title:first-of-type{margin-top:2px}
.bound__text b{color:var(--t1);font-weight:600}

/* 系统权限前置弹窗 */
.perm-dialog{
  border-radius:var(--r-modal);background:var(--surface-sunken);
  padding:18px;box-shadow:inset 0 0 0 1px var(--divider);
}
.perm-dialog__app{display:flex;align-items:center;gap:10px;margin-bottom:10px}
.perm-dialog__icon{
  flex:0 0 auto;width:40px;height:40px;border-radius:12px;
  background:var(--surface);display:grid;place-items:center;box-shadow:var(--e1);
}
.perm-dialog__title{font-size:14px;font-weight:600;color:var(--t1);line-height:20px}
.perm-dialog__branch{
  display:flex;align-items:center;justify-content:space-between;gap:8px;
  padding:10px 0;border-top:1px solid var(--divider);
  font-size:13px;font-weight:500;color:var(--t1);
}
.perm-dialog__branch .t-micro{font-weight:400;text-align:right;max-width:60%}

/* 急症提示列表 */
.tip-list{margin:10px 0 0;padding-left:0;counter-reset:tip;list-style:none}
.tip-list li{
  position:relative;padding-left:22px;margin-bottom:7px;
  font-size:12.5px;line-height:19px;color:var(--danger-text);counter-increment:tip;
}
.tip-list li::before{
  content:counter(tip);position:absolute;left:0;top:1px;
  width:16px;height:16px;border-radius:50%;background:var(--danger);color:#fff;
  font-family:var(--font-num);font-size:9.5px;font-weight:700;
  display:grid;place-items:center;
}

/* 消息内快捷追问 */
.msg__chips{display:flex;flex-wrap:wrap;gap:7px;padding-left:26px}

/* ---- 修正项 ---- */
/* 慢病标签等长文本不被 flex 压缩而换行 */
.chip-row .chip{flex:0 0 auto}
/* AI 页：快捷问句在 composer 内做通栏横向滚动，避免双重内边距 */
.composer .ai-quick{margin:0 -16px;padding:2px 16px 6px}
/* 首页评分环与标题行错开，不与变化标签叠压 */
.hero__label{font-size:13px;font-weight:500;letter-spacing:.2px}

/* =====================================================================
   锻炼 Tab（运动记录 / 轨迹地图）
   ===================================================================== */
/* 记录列表容器：行自己带内边距，容器只留一点余量 */
.card--pad0{padding:4px}

/* 运动类型入口 */
.act-grid{display:grid;grid-template-columns:1fr;gap:8px;margin-top:8px}
.act-card{
  display:flex;align-items:center;gap:12px;width:100%;text-align:left;
  padding:12px 13px;border-radius:var(--r-card);background:var(--surface);
  box-shadow:var(--e1);cursor:pointer;
  transition:transform var(--d-press) var(--ease-overshoot);
}
.act-card:active{transform:scale(.985)}
.act-card__ico{flex:0 0 auto;width:38px;height:38px;border-radius:11px;display:grid;place-items:center}
.act-card__body{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.act-card__name{display:flex;align-items:center;gap:6px;font-size:14px;font-weight:600;color:var(--t1)}
.act-card__tag{
  font-size:9.5px;font-weight:600;line-height:15px;padding:0 6px;
  border-radius:var(--r-chip);background:var(--blue-soft);color:#1D4ED8;
}
.act-card__chev{flex:0 0 auto;color:var(--t3);display:flex}

/* 记录行 */
.wrow{
  display:flex;align-items:center;gap:11px;width:100%;text-align:left;
  padding:11px 12px;background:transparent;cursor:pointer;
  transition:background var(--d-fade) var(--ease-std);
}
/* 分隔线用 inset 阴影：不占高度，也不破坏首尾行的圆角 */
.wrow + .wrow{box-shadow:inset 0 1px 0 var(--divider)}
.wrow:active{background:var(--surface-sunken)}
.wrow__ico{flex:0 0 auto;width:32px;height:32px;border-radius:9px;display:grid;place-items:center}
.wrow__body{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}
.wrow__name{font-size:13.5px;font-weight:600;color:var(--t1)}
.wrow__right{flex:0 0 auto;display:flex;flex-direction:column;align-items:flex-end;gap:1px}
.wrow__dist{
  font-family:var(--font-num);font-size:13px;font-weight:700;
  font-variant-numeric:tabular-nums;color:var(--t1);
}

/* 轨迹地图：SVG 按容器宽度等比缩放，容器给圆角与底色 */
.route-wrap{width:100%;border-radius:14px;overflow:hidden;background:#F1F5F9}
.route-map{display:block;width:100%;height:auto}
.route-meta{
  display:flex;flex-wrap:wrap;gap:4px 14px;margin-top:9px;
  font-size:11px;line-height:16px;color:var(--t3);
  font-variant-numeric:tabular-nums;
}

/* =====================================================================
   首页模块（吃药小贴士）与用药页
   ===================================================================== */
.mod-card{margin-top:12px;padding:14px;border-radius:var(--r-card);background:var(--surface);box-shadow:var(--e1)}
.mod-card__head{display:flex;align-items:center;gap:8px}
.mod-card__ico{
  flex:0 0 auto;width:26px;height:26px;border-radius:9px;
  background:var(--teal-soft);display:grid;place-items:center;
}
.mod-card__title{flex:1;font-size:14px;font-weight:600;color:var(--t1)}
.mod-card__hide{flex:0 0 auto;width:24px;height:24px;border-radius:50%;color:var(--t3);display:grid;place-items:center}
.mod-card__hide:active{background:var(--surface-sunken)}
.mod-card__foot{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  margin-top:10px;padding-top:10px;border-top:1px solid var(--divider);
}
.mod-card__note{display:flex;align-items:center;gap:5px;font-size:11px;line-height:16px;color:var(--t3)}
.mod-card__more{margin-top:8px;text-align:center}
.link-btn{font-size:12px;font-weight:600;color:var(--teal-deep)}

/* 剂量行 */
.dose-list{display:flex;flex-direction:column}
.dose-row{display:flex;align-items:center;gap:10px;padding:9px 0}
.dose-row + .dose-row{border-top:1px solid var(--divider)}
.dose-row__time{
  flex:0 0 auto;width:42px;font-family:var(--font-num);font-size:13px;font-weight:700;
  font-variant-numeric:tabular-nums;color:var(--t1);
}
.dose-row__body{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}
.dose-row__name{
  font-size:13px;font-weight:600;color:var(--t1);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.dose-row__acts{flex:0 0 auto;display:flex;align-items:center;gap:6px}
.dose-row__btn{height:28px;padding:0 12px;border-radius:var(--r-chip);background:var(--teal);color:#fff;font-size:12px;font-weight:600}
.dose-row__btn--ghost{background:var(--surface-sunken);color:var(--t2)}
.dose-row__state{
  display:flex;align-items:center;gap:4px;height:28px;padding:0 11px;
  border-radius:var(--r-chip);font-size:12px;font-weight:600;
}
.dose-row__state.is-taken{background:var(--success);color:#fff}
.dose-row__state.is-skip{background:var(--surface-sunken);color:var(--t3)}
/* 已服的药名划掉：一眼分辨「这剂处理过了」 */
.dose-row.is-done .dose-row__name{color:var(--t3);text-decoration:line-through}

/* 贴士 */
.mod-tip{
  margin-top:10px;padding:10px 11px;border-radius:var(--r-btn);
  background:var(--teal-tint);display:flex;flex-direction:column;gap:3px;
}
.mod-tip b{font-size:12px;font-weight:600;color:var(--teal-deep)}
.mod-tip span{font-size:11.5px;line-height:17px;color:var(--t2)}

/* 吃药小闹钟 */
.alarm{
  width:100%;max-width:298px;padding:26px 20px 20px;border-radius:var(--r-modal);
  background:var(--surface);box-shadow:var(--e3);text-align:center;
}
.alarm__ico{
  display:grid;place-items:center;width:56px;height:56px;margin:0 auto 12px;
  border-radius:50%;background:var(--teal);box-shadow:0 6px 18px rgba(18,180,154,.34);
  animation:alarmPulse 1.6s var(--ease-std) infinite;
}
@keyframes alarmPulse{0%,100%{transform:scale(1)}50%{transform:scale(1.06)}}
.alarm__time{font-family:var(--font-num);font-size:13px;font-weight:700;color:var(--teal-deep);letter-spacing:.5px}
.alarm__name{font-size:19px;font-weight:700;color:var(--t1);margin-top:3px}
.alarm__med{font-size:14px;font-weight:600;color:var(--t2);margin-top:6px;line-height:20px}
.alarm__tag{
  display:inline-block;margin-top:8px;padding:2px 10px;border-radius:var(--r-chip);
  background:var(--surface-sunken);font-size:11px;font-weight:600;color:var(--t2);
}
.alarm__acts{margin-top:18px;display:flex;flex-direction:column;gap:8px}
.btn-pair{display:flex;gap:8px}
.btn-pair .btn{flex:1;padding-left:0;padding-right:0;font-size:12.5px}

/* 新增用药计划的表单 */
.section-head__acts{display:flex;align-items:center;gap:10px}
.med-form{max-height:86%;overflow-y:auto;text-align:left}
.med-form .modal__title{text-align:center;margin-bottom:6px}
.med-field{display:block;margin-top:10px}
.med-field__label{
  display:block;font-size:12px;font-weight:600;color:var(--t2);margin-bottom:5px;
}
.med-field__label--head{margin-top:14px}
.med-field__label i{font-style:normal;font-weight:500;color:var(--t3);margin-left:4px;font-size:11px}
.med-field__input{
  width:100%;height:38px;padding:0 12px;
  border:1px solid var(--divider);border-radius:10px;background:var(--surface-sunken);
  font-size:13.5px;color:var(--t1);font-family:inherit;
}
.med-field__input::placeholder{color:var(--t3)}
.med-field__input:focus{outline:none;border-color:var(--teal);background:var(--surface)}
/* 原生勾选态直接驱动样式：这样点选不必重绘弹层，
   也就不会把用户已经敲进去的药名清掉 */
.med-chips{display:flex;flex-wrap:wrap;gap:6px}
.med-chip{position:relative;display:inline-flex}
.med-chip input{position:absolute;opacity:0;width:100%;height:100%;margin:0;cursor:pointer}
.med-chip span{
  display:inline-flex;align-items:center;height:30px;padding:0 11px;
  border:1px solid var(--divider);border-radius:15px;
  font-size:12.5px;color:var(--t2);background:var(--surface);
  font-variant-numeric:tabular-nums;
  transition:background var(--d-fade) var(--ease-std),color var(--d-fade) var(--ease-std);
}
.med-chip input:checked + span{
  background:var(--teal);border-color:var(--teal);color:#fff;font-weight:600;
}
.med-chip input:focus-visible + span{box-shadow:0 0 0 2px rgba(20,160,150,.35)}
.med-form__error{
  margin-top:10px;font-size:12px;line-height:17px;color:var(--danger-text);
  background:var(--danger-soft);border-radius:8px;padding:7px 10px;
}

/* =====================================================================
   账号体系（登录 / 注册 / 云端保存 / 注销）
   ===================================================================== */

/* 「我的」页顶部账号卡 */
.acct{display:flex;align-items:center;gap:11px}
.acct__avatar{
  flex:0 0 auto;width:42px;height:42px;border-radius:50%;
  display:inline-flex;align-items:center;justify-content:center;
  background:var(--teal);color:#fff;font-size:17px;font-weight:600;
}
.acct__avatar--guest{background:var(--surface-sunken);color:var(--t3)}
.acct__acts{display:flex;gap:8px;margin-top:12px}
.acct__acts .btn{flex:1;font-size:12.5px;padding-left:0;padding-right:0}
.acct__note{
  margin-top:10px;padding:9px 11px;border-radius:10px;
  background:var(--surface-sunken);
  font-size:11.5px;line-height:17px;color:var(--t2);
}
.acct__note--warn{background:var(--warning-soft);color:var(--warning-text)}

/* 同步状态：一个小圆点 + 文案，比纯文字好扫一眼 */
.sync-state{display:inline-flex;align-items:center;gap:5px}
.sync-dot{width:7px;height:7px;border-radius:50%;background:var(--t3);flex:0 0 auto}
.sync-dot--ok{background:var(--success)}
.sync-dot--syncing{background:var(--warning);animation:syncPulse 1s ease-in-out infinite}
.sync-dot--error{background:var(--danger)}
@keyframes syncPulse{0%,100%{opacity:1}50%{opacity:.3}}
@media (prefers-reduced-motion:reduce){.sync-dot--syncing{animation:none}}

/* 登录 / 注册弹层 */
.auth-modal{max-height:88%;overflow-y:auto;text-align:left}
.auth-tabs{
  display:flex;gap:4px;padding:3px;margin-bottom:14px;
  background:var(--surface-sunken);border-radius:11px;
}
.auth-tab{
  flex:1;height:32px;border:0;border-radius:8px;background:transparent;
  font-size:13px;font-weight:600;color:var(--t2);font-family:inherit;cursor:pointer;
  transition:background var(--d-fade) var(--ease-std),color var(--d-fade) var(--ease-std);
}
.auth-tab.is-on{background:var(--surface);color:var(--t1);box-shadow:var(--e1)}
.auth-modal .modal__title{margin-bottom:4px}
.auth-sub{font-size:12px;line-height:18px;color:var(--t2);margin-bottom:4px}
.auth-error{
  margin-top:10px;font-size:12px;line-height:17px;color:var(--danger-text);
  background:var(--danger-soft);border-radius:8px;padding:7px 10px;
}
.auth-error[hidden]{display:none}

/* 只读横幅：桌面端登录后常驻，避免「点了没反应」被当成 bug。
   贴在自绘状态栏下沿（--sb-h），背景不透明，内容从它下面滚过。 */
.ro-banner{
  position:absolute;left:0;right:0;top:var(--sb-h);z-index:60;
  display:flex;align-items:center;justify-content:center;gap:6px;
  padding:7px 14px;background:var(--warning-soft);
  color:var(--warning-text);font-size:11.5px;font-weight:600;line-height:16px;
  border-bottom:1px solid rgba(245,158,11,.28);
}
.ro-banner[hidden]{display:none}
.ro-banner span{font-weight:500}
/* 横幅占位：不顶开的话，首页问候语会被压在横幅底下 */
.screen.is-ro{padding-top:30px}
.is-standalone .ro-banner{top:0}

/* =====================================================================
   蓝牙直连（扫描 / 已连接设备卡 / 实时心率）
   ===================================================================== */

/* 扫描引导区：居中的一只表 + 一句人话，别让「开始搜索」像个黑盒 */
.ble-scan{text-align:center;padding:6px 0 2px}
.ble-scan__icon{
  display:inline-flex;align-items:center;justify-content:center;
  width:54px;height:54px;border-radius:50%;
  background:var(--teal-soft);margin-bottom:10px;
}
.ble-scan__ring{
  display:inline-block;width:26px;height:26px;margin-bottom:10px;
  border-radius:50%;border:2px solid var(--teal);border-top-color:transparent;
  animation:bleSpin .9s linear infinite;
}
@keyframes bleSpin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){.ble-scan__ring{animation:none;opacity:.5}}

/* 实时心率：数字要够大，一眼可见「还在跳」 */
.hr-live{display:flex;align-items:baseline;gap:6px;margin:12px 0 2px}
.hr-live__num{
  font-size:40px;font-weight:700;line-height:1;color:var(--teal);
  font-variant-numeric:tabular-nums;letter-spacing:-.5px;
}
.hr-live__unit{font-size:12px;color:var(--t2)}

/* 设备身份清单：dt 固定宽，dd 允许换行（序列号可能很长） */
.ble-facts{
  display:grid;grid-template-columns:56px 1fr;gap:7px 12px;margin:12px 0 0;
}
.ble-facts dt{font-size:11.5px;color:var(--t3);line-height:17px}
.ble-facts dd{margin:0;font-size:12px;color:var(--t1);line-height:17px;word-break:break-all}
.ble-none{color:var(--t3)}

/* 设备提供的 GATT 服务 */
.ble-tags{display:flex;flex-wrap:wrap;gap:6px}
.ble-tag{
  font-size:11px;line-height:16px;padding:3px 9px;border-radius:999px;
  background:var(--surface-sunken);color:var(--t2);
}
