/* ==========================================================================
   健康助理 · Health Coach  |  移动端优先 (Mobile First)
   ========================================================================== */

:root {
  /* 亮色主题 · 适老化：白底黑字、高对比度 */
  --bg: #f2f5f8;
  --elev: #ffffff;
  --elev-2: #f7f9fb;
  --elev-3: #eaEFF4;
  --line: #e2e8ee;
  --line-2: #cfd8e1;

  --t1: #17222e;
  --t2: #4d5a6a;
  --t3: #7c8896;

  --ac: #1f9d44;
  --ac-bg: rgba(31, 157, 68, 0.1);
  --blue: #1668c7;
  --blue-bg: rgba(22, 104, 199, 0.09);
  --yel: #a87408;
  --yel-bg: rgba(196, 138, 15, 0.12);
  --red: #d43c31;
  --red-bg: rgba(212, 60, 49, 0.09);
  --pur: #7c4dd4;
  --pur-bg: rgba(124, 77, 212, 0.09);
  --teal: #0e9aa5;
  --org: #d97a1f;

  --r: 14px;
  --rs: 10px;
  --rl: 20px;
  --sh: 0 2px 10px rgba(23, 43, 70, 0.07);
  --sh-l: 0 10px 34px rgba(23, 43, 70, 0.16);

  --f: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;

  --tabbar-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--f);
  background: var(--bg);
  color: var(--t1);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
button {
  border: none;
  background: none;
  cursor: pointer;
}
input,
select,
textarea {
  -webkit-appearance: none;
  appearance: none;
}
::selection {
  background: rgba(31,157,68, 0.3);
}

::-webkit-scrollbar {
  width: 0;
  height: 0;
}
@media (min-width: 900px) {
  ::-webkit-scrollbar {
    width: 9px;
    height: 9px;
  }
  ::-webkit-scrollbar-thumb {
    background: var(--line-2);
    border-radius: 5px;
    border: 2px solid var(--bg);
  }
}

/* ====================== 应用框架 ====================== */

#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- 顶栏 ---------- */
.hdr {
  position: sticky;
  top: 0;
  z-index: 60;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: rgba(242, 245, 248, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.hdr-title {
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.hdr-title .logo {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--ac), var(--teal));
  display: grid;
  place-items: center;
  font-size: 13px;
}

.hdr-date {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--t3);
  font-variant-numeric: tabular-nums;
}

.hdr-score {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--ac-bg);
  color: var(--ac);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 20px;
  font-variant-numeric: tabular-nums;
}

/* ---------- 内容区 ---------- */
.wrap {
  flex: 1;
  padding: 14px 14px calc(var(--tabbar-h) + var(--safe-b) + 18px);
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
}

@media (min-width: 900px) {
  .wrap {
    padding: 20px 24px 24px;
  }
}

/* ---------- 底部标签栏（手机）/ 侧边栏（桌面） ---------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex;
  background: rgba(255, 255, 255, 0.93);
  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: var(--t3);
  font-size: 10.5px;
  font-weight: 500;
  transition: color 0.15s;
  position: relative;
}

.tab .ti {
  font-size: 19px;
  line-height: 1;
  transition: transform 0.18s;
}

.tab.on {
  color: var(--ac);
  font-weight: 600;
}

.tab.on .ti {
  transform: translateY(-1px) scale(1.08);
}

.tab .dot {
  position: absolute;
  top: 6px;
  right: 50%;
  margin-right: -17px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
}

/* 中央记录按钮（凸起） */
.tab-fab .ti {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ac), #2f9c47);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 25px;
  font-weight: 300;
  box-shadow: 0 4px 14px rgba(31,157,68, 0.42);
  margin-top: -22px;
  border: 3px solid var(--bg);
  transition: transform 0.16s, box-shadow 0.16s;
}
.tab-fab:active .ti {
  transform: scale(0.9);
}
.tab-fab.on .ti,
.tab-fab:hover .ti {
  box-shadow: 0 6px 20px rgba(31,157,68, 0.6);
}

@media (min-width: 900px) {
  .tabbar {
    position: sticky;
    top: 0;
    left: 0;
    height: auto;
    flex-direction: column;
    width: 178px;
    flex-shrink: 0;
    padding: 18px 10px;
    gap: 2px;
    border-top: none;
    border-right: 1px solid var(--line);
    background: var(--elev);
    align-self: flex-start;
    max-height: 100dvh;
    overflow-y: auto;
  }
  .tab {
    flex: none;
    flex-direction: row;
    gap: 11px;
    padding: 9px 12px;
    border-radius: var(--rs);
    font-size: 13.5px;
    align-items: center;
  }
  .tab:hover {
    background: var(--elev-2);
    color: var(--t1);
  }
  .tab.on {
    background: var(--ac-bg);
  }
  .tab.on .ti {
    transform: none;
  }
  .tab .dot {
    top: 8px;
    right: 10px;
    margin: 0;
  }
  .tabbar .rail-brand {
    display: flex;
  }
  .tabbar .rail-foot {
    display: block;
  }
  .desk {
    display: flex;
    align-items: flex-start;
  }
  .hdr {
    display: none;
  }
}

.rail-brand,
.rail-foot {
  display: none;
}

.rail-brand {
  align-items: center;
  gap: 10px;
  padding: 2px 10px 14px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.rail-brand .b-ico {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--ac), var(--teal));
  display: grid;
  place-items: center;
  font-size: 17px;
}

.rail-brand b {
  font-size: 14px;
  display: block;
}
.rail-brand span {
  font-size: 10.5px;
  color: var(--t3);
}

.rail-foot {
  margin-top: auto;
  padding-top: 14px;
  font-size: 10.5px;
  color: var(--t3);
  text-align: center;
  border-top: 1px solid var(--line);
}

/* ====================== 卡片 ====================== */

.card {
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
  margin-bottom: 12px;
}

.card-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.card-t {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
}

.card-t .d {
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--ac);
}
.card-t .d.blue { background: var(--blue); }
.card-t .d.red { background: var(--red); }
.card-t .d.yel { background: var(--yel); }
.card-t .d.pur { background: var(--pur); }

.card-s {
  font-size: 11px;
  color: var(--t3);
  font-weight: 400;
}

.grid {
  display: grid;
  gap: 12px;
}
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
@media (min-width: 640px) {
  .g4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .g4 { grid-template-columns: repeat(4, 1fr); }
  .g3 { grid-template-columns: repeat(3, 1fr); }
}
.g2 > .card, .g3 > .card, .g4 > .card {
  margin-bottom: 0;
}

/* ====================== 数据块 ====================== */

.stat {
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 13px;
}

.stat-l {
  font-size: 11px;
  color: var(--t3);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.stat-v {
  font-size: 25px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.6px;
  font-variant-numeric: tabular-nums;
}

.stat-v .u {
  font-size: 12px;
  color: var(--t3);
  font-weight: 500;
  margin-left: 2px;
  letter-spacing: 0;
}

.stat-f {
  font-size: 11px;
  color: var(--t3);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.up { color: var(--red); }
.dn { color: var(--ac); }
.flat { color: var(--t3); }

.bar {
  height: 6px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.bar i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--ac);
  transition: width 0.55s cubic-bezier(0.34, 1.3, 0.64, 1);
}

/* ====================== 精力评分 ====================== */

.hero {
  background: linear-gradient(140deg, var(--elev) 0%, var(--elev-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--rl);
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  gap: 16px;
  align-items: center;
}

.ring {
  position: relative;
  width: 116px;
  height: 116px;
  flex-shrink: 0;
}
.ring svg { transform: rotate(-90deg); display: block; }
.ring-c {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ring-n {
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.ring-l {
  font-size: 10.5px;
  color: var(--t3);
  margin-top: 2px;
}

.hero-b { flex: 1; min-width: 0; }
.hero-b h2 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 4px;
}
.hero-b p {
  font-size: 12px;
  color: var(--t2);
  line-height: 1.6;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.chip {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--elev-2);
  border: 1px solid var(--line);
  color: var(--t2);
  white-space: nowrap;
}
.chip.g { background: var(--ac-bg); color: var(--ac); border-color: rgba(31,157,68,.3); }
.chip.b { background: var(--blue-bg); color: var(--blue); border-color: rgba(22,104,199,.3); }
.chip.y { background: var(--yel-bg); color: var(--yel); border-color: rgba(168,116,8,.3); }
.chip.r { background: var(--red-bg); color: var(--red); border-color: rgba(212,60,49,.3); }
.chip.p { background: var(--pur-bg); color: var(--pur); border-color: rgba(124,77,212,.3); }

@media (max-width: 400px) {
  .hero { flex-direction: column; text-align: center; }
  .chips { justify-content: center; }
}

/* ====================== 分段控件 ====================== */

.seg {
  display: flex;
  gap: 4px;
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: var(--rs);
  padding: 3px;
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }

.seg-b {
  flex: 1;
  min-width: fit-content;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--t2);
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.15s;
}

.seg-b.on {
  background: var(--elev-3);
  color: var(--t1);
  font-weight: 600;
}

/* ====================== 按钮 ====================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  min-height: 38px;
  border-radius: var(--rs);
  background: var(--elev-2);
  color: var(--t1);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--line-2);
  transition: all 0.14s;
}
.btn:active { transform: scale(0.975); }
.btn:hover { background: var(--elev-3); }

.btn-p {
  background: var(--ac);
  border-color: var(--ac);
  color: #ffffff;
  font-weight: 600;
}
.btn-p:hover { background: #1b8a3c; }

/* 拍照识别（OCR） */
.btn-o {
  background: transparent;
  border: 1.5px dashed rgba(31,157,68, 0.5);
  color: var(--ac);
  font-weight: 600;
  margin-bottom: 8px;
}
.btn-o:active { transform: scale(0.98); }
.ocr-prog {
  height: 6px;
  border-radius: 3px;
  background: var(--elev-2);
  overflow: hidden;
  margin: 14px 0 8px;
}
.ocr-prog-i {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: var(--ac);
  transition: width 0.25s;
}
.ocr-stage { font-size: 12px; color: var(--t3); text-align: center; }
/* 识别填入后的高亮提示 */
.inp.flash {
  border-color: var(--ac);
  box-shadow: 0 0 0 2px rgba(31,157,68, 0.25);
  transition: box-shadow 0.4s;
}
.ocr-err {
  background: var(--red-bg);
  border: 1px solid rgba(212,60,49, 0.35);
  color: var(--red);
  border-radius: var(--rs);
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.6;
  margin: 12px 0;
}

.btn-r {
  background: var(--red-bg);
  border-color: rgba(212,60,49, 0.4);
  color: var(--red);
}
.btn-b {
  background: var(--blue-bg);
  border-color: rgba(22,104,199, 0.4);
  color: var(--blue);
}
.btn-full { width: 100%; }
.btn-sm { padding: 5px 10px; min-height: 30px; font-size: 12px; }
.btn-lg { padding: 12px 18px; min-height: 48px; font-size: 14.5px; font-weight: 600; }

/* ====================== 表单 ====================== */

.f { margin-bottom: 12px; }
.f > label {
  display: block;
  font-size: 11.5px;
  color: var(--t2);
  margin-bottom: 5px;
  font-weight: 500;
}
.f > label .req { color: var(--red); }

.inp,
.sel {
  width: 100%;
  padding: 10px 12px;
  min-height: 42px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--rs);
  outline: none;
  transition: border-color 0.15s;
  font-variant-numeric: tabular-nums;
}
.inp:focus,
.sel:focus { border-color: var(--ac); }
.inp::placeholder { color: var(--t3); }

.sel {
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='7' viewBox='0 0 11 7'%3E%3Cpath fill='%2368758a' d='M0 0l5.5 7L11 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
}

.row { display: flex; gap: 9px; }
.row > * { flex: 1; min-width: 0; }

.hint {
  font-size: 11px;
  color: var(--t3);
  margin-top: 5px;
  line-height: 1.5;
}

/* 开关 */
.sw {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 20px;
  background: var(--elev-3);
  border: 1px solid var(--line-2);
  transition: background 0.2s, border-color 0.2s;
  cursor: pointer;
}
.sw::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--t2);
  transition: transform 0.2s, background 0.2s;
}
.sw.on { background: var(--ac); border-color: var(--ac); }
.sw.on::after { transform: translateX(18px); background: #fff; }

.set-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.set-row:last-child { border-bottom: none; }
.set-row .sr-b { flex: 1; min-width: 0; }
.set-row .sr-b b { font-size: 13px; font-weight: 500; display: block; }
.set-row .sr-b span { font-size: 11px; color: var(--t3); }

/* ====================== 列表 ====================== */

.list-i {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.list-i:last-child { border-bottom: none; }
.list-m { flex: 1; min-width: 0; }
.list-t {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-s { font-size: 11px; color: var(--t3); margin-top: 1px; }
.list-v {
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.empty {
  text-align: center;
  padding: 26px 12px;
  color: var(--t3);
  font-size: 12.5px;
}
.empty .e-i {
  font-size: 30px;
  display: block;
  margin-bottom: 7px;
  opacity: 0.35;
}

.del {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--t3);
  font-size: 15px;
  flex-shrink: 0;
}
.del:hover { color: var(--red); background: var(--red-bg); }

/* ====================== 习惯打卡 ====================== */

.habits {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}
@media (min-width: 560px) {
  .habits { grid-template-columns: 1fr 1fr; }
}

.habit {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--rs);
  text-align: left;
  width: 100%;
  transition: all 0.15s;
}
.habit:active { transform: scale(0.99); }
.habit.on {
  border-color: rgba(31,157,68, 0.38);
  background: var(--ac-bg);
}

.habit .ck {
  width: 21px;
  height: 21px;
  border-radius: 6px;
  border: 1.5px solid var(--line-2);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 11px;
  color: transparent;
  margin-top: 1px;
  transition: all 0.16s;
}
.habit.on .ck {
  background: var(--ac);
  border-color: var(--ac);
  color: #ffffff;
}
.habit .hb { flex: 1; min-width: 0; }
.habit .hn {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.habit.on .hn { color: var(--ac); }
.habit .hd {
  font-size: 11px;
  color: var(--t3);
  line-height: 1.55;
}
.habit .st {
  font-size: 10.5px;
  color: var(--yel);
  background: var(--yel-bg);
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
}

/* 习惯卡：勾选区 / 正文区 / 详情区 三块分离，均可点 */
.habit-ck {
  flex-shrink: 0;
  padding: 0;
  margin-top: 1px;
  line-height: 0;
}
.habit-body {
  flex: 1;
  min-width: 0;
  text-align: left;
  display: block;
  padding: 0;
}
.habit-info {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--t3);
  align-self: center;
  transition: all 0.15s;
}
.habit-info:hover {
  color: var(--blue);
  background: var(--blue-bg);
}

/* 处方星期标记 */
.rx-d {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--t3);
}
.rx-d.on {
  background: var(--ac-bg);
  border-color: rgba(31,157,68, 0.4);
  color: var(--ac);
}

/* ---------- 亲友关怀 ---------- */
.care-i {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.care-i:last-child { border-bottom: none; }

.care-av {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 17px;
  flex-shrink: 0;
  background: var(--elev-2);
  border: 1px solid var(--line);
}

.care-b { flex: 1; min-width: 0; }
.care-b b {
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.care-b span {
  font-size: 11px;
  color: var(--t3);
  display: block;
  margin-top: 1px;
}

.care-acts {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.care-empty {
  text-align: center;
  padding: 6px 0 2px;
}

/* ---------- 记录类型选择网格 ---------- */
.pick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}

.pick-b {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 13px 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--rs);
  font-size: 11.5px;
  color: var(--t2);
  font-weight: 500;
  transition: all 0.15s;
}
.pick-b .pi {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 18px;
}
.pick-b:active { transform: scale(0.96); }
.pick-b:hover { border-color: var(--line-2); color: var(--t1); }

/* ---------- 大数字展示（参考天天测） ---------- */
.big-num {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.big-num .n {
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -1.5px;
  font-variant-numeric: tabular-nums;
}
.big-num .u {
  font-size: 13px;
  color: var(--t3);
}

.ref-range {
  font-size: 11.5px;
  color: var(--t3);
  margin-top: 6px;
  line-height: 1.5;
}
.ref-range b { color: var(--t2); font-weight: 500; }

/* ---------- 周报评分条 ---------- */
.wk-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.wk-row:last-child { border-bottom: none; }
.wk-row .wk-l {
  font-size: 12px;
  color: var(--t2);
  width: 62px;
  flex-shrink: 0;
}
.wk-row .wk-bar {
  flex: 1;
}
.wk-row .wk-v {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  width: 74px;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* ====================== 热力图 ====================== */

.heat {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}
.heat-c {
  aspect-ratio: 1;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 9.5px;
  color: var(--t3);
  font-variant-numeric: tabular-nums;
}
.heat-c.l1 { background: rgba(31,157,80,.14); border-color: rgba(31,157,80,.28); color: #2b7a3e; }
.heat-c.l2 { background: rgba(31,157,80,.38); border-color: rgba(31,157,80,.48); color: #124d20; }
.heat-c.l3 { background: rgba(31,157,80,.8); border-color: rgba(31,157,80,.9); color: #ffffff; }
.heat-c.today { box-shadow: 0 0 0 2px var(--blue); }

/* ====================== 图表 ====================== */

.chart-b { position: relative; width: 100%; }
.chart-b svg { display: block; width: 100%; height: auto; overflow: visible; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 11px;
  color: var(--t2);
  margin-top: 9px;
}
.legend i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  display: inline-block;
  margin-right: 5px;
  vertical-align: -1px;
}

/* ====================== 底部弹层 ====================== */

.mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(2px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s;
}
.mask.show { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 210;
  background: var(--elev);
  border-radius: var(--rl) var(--rl) 0 0;
  border-top: 1px solid var(--line-2);
  max-height: 88dvh;
  overflow-y: auto;
  transform: translateY(102%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  padding-bottom: calc(16px + var(--safe-b));
}
.sheet.show { transform: translateY(0); }

.sheet-h {
  position: sticky;
  top: 0;
  background: var(--elev);
  padding: 16px 18px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  z-index: 2;
}
.sheet-h b { font-size: 15.5px; }
.sheet-x {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--elev-2);
  color: var(--t2);
  display: grid;
  place-items: center;
  font-size: 17px;
}
.sheet-b { padding: 16px 18px; }

@media (min-width: 640px) {
  .sheet {
    left: 50%;
    bottom: auto;
    top: 50%;
    width: 520px;
    transform: translate(-50%, -46%) scale(0.97);
    border-radius: var(--rl);
    border: 1px solid var(--line-2);
    opacity: 0;
    transition: transform 0.24s cubic-bezier(0.32,0.72,0,1), opacity 0.2s;
    max-height: 84vh;
    max-height: 84dvh;
  }
  .sheet.show { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.sheet.wide { max-width: 720px; }

/* ====================== 食谱 ====================== */

.recipes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 11px;
}
@media (min-width: 560px) { .recipes { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .recipes { grid-template-columns: repeat(3, 1fr); } }

.recipe {
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  text-align: left;
  width: 100%;
  transition: all 0.16s;
}
.recipe:active { transform: scale(0.985); }
.recipe:hover { border-color: var(--line-2); }

.recipe-img {
  height: 92px;
  display: grid;
  place-items: center;
  font-size: 42px;
  position: relative;
}
.recipe-img .slot {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 600;
}
.recipe-b { padding: 11px 12px 13px; }
.recipe-n { font-size: 13.5px; font-weight: 600; margin-bottom: 5px; }
.recipe-m { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.recipe-w {
  font-size: 11.5px;
  color: var(--t3);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.steps { counter-reset: st; list-style: none; }
.steps li {
  counter-increment: st;
  padding: 8px 0 8px 30px;
  position: relative;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--t2);
  border-bottom: 1px solid var(--line);
}
.steps li:last-child { border-bottom: none; }
.steps li::before {
  content: counter(st);
  position: absolute;
  left: 0;
  top: 10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ac-bg);
  color: var(--ac);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
}

.ings {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 12px;
}
.ings span {
  font-size: 11.5px;
  background: var(--elev-2);
  border: 1px solid var(--line);
  padding: 3px 9px;
  border-radius: 20px;
  color: var(--t2);
}

/* ====================== 垃圾食品 ====================== */

.junk-box {
  display: none;
  margin-top: 9px;
}
.junk-box.show { display: block; animation: shake 0.3s; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.junk-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.junk-chip {
  padding: 4px 10px;
  background: var(--elev-2);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 11.5px;
  color: var(--t2);
  transition: all 0.14s;
}
.junk-chip:hover, .junk-chip:active {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-bg);
}

/* ====================== 提示条 ====================== */

.alert {
  display: flex;
  gap: 9px;
  padding: 10px 12px;
  border-radius: var(--rs);
  font-size: 12.5px;
  line-height: 1.55;
  border: 1px solid;
  align-items: flex-start;
  margin-bottom: 10px;
}
.alert .ai { flex-shrink: 0; font-size: 14px; line-height: 1.45; }
.alert.i { background: var(--blue-bg); border-color: rgba(22,104,199,.3); color: #134f92; }
.alert.w { background: var(--yel-bg); border-color: rgba(168,116,8,.3); color: #7c5706; }
.alert.d { background: var(--red-bg); border-color: rgba(212,60,49,.3); color: #a5281f; }
.alert.s { background: var(--ac-bg); border-color: rgba(31,157,68,.3); color: #167035; }
.alert b { font-weight: 600; }

/* ====================== Toast ====================== */

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: calc(100% - 28px);
  max-width: 360px;
  pointer-events: none;
}
@media (min-width: 900px) {
  .toasts { bottom: 24px; }
}

.toast {
  background: var(--elev-2);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--ac);
  border-radius: var(--rs);
  padding: 10px 14px;
  font-size: 13px;
  box-shadow: var(--sh-l);
  animation: tIn 0.26s cubic-bezier(0.34, 1.3, 0.64, 1);
  display: flex;
  gap: 9px;
  align-items: center;
  width: fit-content;
  max-width: 100%;
}
.toast.w { border-left-color: var(--yel); }
.toast.d { border-left-color: var(--red); }
@keyframes tIn {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to { opacity: 1; transform: none; }
}

/* ====================== 视图 ====================== */

.view { display: none; }
.view.on { display: block; animation: vIn 0.2s ease; }
@keyframes vIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.st-title {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--t3);
  font-weight: 600;
  margin: 18px 0 10px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.st-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.st-title:first-child { margin-top: 0; }

/* ====================== 表格 ====================== */

.tbl-w { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th {
  text-align: left;
  padding: 7px 9px;
  color: var(--t3);
  font-weight: 600;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td {
  padding: 8px 9px;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: var(--elev-2); }

/* ====================== 计时器 ====================== */

.timer {
  text-align: center;
  padding: 20px 14px;
}
.timer-n {
  font-family: var(--mono);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  margin: 6px 0 14px;
}
.timer-b { display: flex; gap: 9px; justify-content: center; }

/* ====================== 快捷操作 ====================== */

.quick {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}

.quick-b {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 13px 6px;
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: 11.5px;
  color: var(--t2);
  font-weight: 500;
  transition: all 0.15s;
}
.quick-b .qi {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 19px;
}
.quick-b:active { transform: scale(0.96); }
.quick-b:hover { border-color: var(--line-2); color: var(--t1); }

/* 安装 PWA 横幅 */
.install {
  display: none;
  align-items: center;
  gap: 11px;
  background: linear-gradient(135deg, var(--blue-bg), var(--pur-bg));
  border: 1px solid rgba(22,104,199, 0.3);
  border-radius: var(--r);
  padding: 12px 14px;
  margin-bottom: 12px;
}
.install.show { display: flex; }
.install .ii {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--blue);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}
.install .ib { flex: 1; min-width: 0; }
.install .ib b { font-size: 13px; display: block; }
.install .ib span { font-size: 11px; color: var(--t2); }

/* 键值对 */
.kv { display: flex; justify-content: space-between; font-size: 12.5px; padding: 6px 0; gap: 12px; }
.kv span { color: var(--t2); }
.kv b { font-variant-numeric: tabular-nums; text-align: right; }

@media print {
  .tabbar, .hdr { display: none; }
}
/* ==========================================================================
   适老化大字覆写（置于末尾，同优先级下覆盖前文）
   目标：正文 ≥15px、辅助文字 ≥12.5px、触控目标 ≥44px、输入框 ≥48px
   ========================================================================== */

body { font-size: 15.5px; line-height: 1.65; }

/* 顶栏与底部导航 */
.hdr-title { font-size: 17.5px; }
.hdr-date { font-size: 12.5px; }
.tab { font-size: 11.5px; }
.tab .ti { font-size: 21px; }

/* 卡片与列表 */
.card-t { font-size: 15.5px; }
.card-s { font-size: 12.5px; }
.list-t { font-size: 15px; }
.list-s { font-size: 12.5px; }
.list-v { font-size: 15.5px; }
.hint { font-size: 13px; }
.alert { font-size: 14px; }
.alert .ai { font-size: 15.5px; }
.chip { font-size: 12.5px; }
.kv { font-size: 14px; }
.tbl { font-size: 13.5px; }
.install .ib b { font-size: 14.5px; }
.install .ib span { font-size: 12.5px; }

/* 表单与触控目标 */
.f > label { font-size: 13.5px; }
.inp, .sel { font-size: 16px; min-height: 48px; padding: 11px 13px; }
.sel { background-position: right 13px center; padding-right: 34px; }
.seg-b { font-size: 13.5px; padding: 9px 11px; min-height: 40px; }
.btn { font-size: 14.5px; min-height: 44px; padding: 10px 16px; }
.btn-lg { min-height: 54px; font-size: 16px; padding: 14px 18px; }
.btn-sm { min-height: 36px; font-size: 13px; }
.set-row { padding: 13px 0; }
.set-row .sr-b b { font-size: 14.5px; }
.set-row .sr-b span { font-size: 12.5px; }

/* 习惯打卡 */
.habit .hn { font-size: 14.5px; }
.habit .hd { font-size: 12.5px; }
.habit .ck { width: 24px; height: 24px; font-size: 13px; }
.sheet-h b { font-size: 16.5px; }

/* 报表大数字保持原有 40px，单位加大 */
.big-num .u { font-size: 14px; }

/* ==========================================================================
   假期日历 · 头部徽章 · 健康月历
   ========================================================================== */

/* 头部「休 / 班」徽章 */
.hdr-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  flex-shrink: 0;
  line-height: 1.4;
}
.hdr-badge.rest { background: var(--red-bg); color: var(--red); border: 1px solid rgba(212,60,49,.25); }
.hdr-badge.work { background: var(--blue-bg); color: var(--blue); border: 1px solid rgba(22,104,199,.25); }

/* 月历翻页 */
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nv {
  width: 32px; height: 32px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--t2);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  display: grid; place-items: center;
}
.cal-nv:active { background: var(--bg); }
#calTitle { font-size: 13.5px; min-width: 78px; text-align: center; color: var(--t1); }

/* 月历网格 */
.cal-wk {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}
.cal-wk span { text-align: center; font-size: 11.5px; color: var(--t3); padding: 3px 0; }
.cal-wk span.rest { color: var(--red); }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-c {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
}
.cal-c b { font-size: 13px; font-weight: 500; color: var(--t2); }
.cal-c.blank { background: transparent; border-color: transparent; }
.cal-c.wknd b { color: var(--t3); }
.cal-c.l1 { background: rgba(31,157,80,.12); border-color: rgba(31,157,80,.25); }
.cal-c.l1 b { color: #2b7a3e; }
.cal-c.l2 { background: rgba(31,157,80,.34); border-color: rgba(31,157,80,.45); }
.cal-c.l2 b { color: #124d20; font-weight: 700; }
.cal-c.l3 { background: rgba(31,157,80,.8); border-color: rgba(31,157,80,.9); }
.cal-c.l3 b { color: #ffffff; font-weight: 700; }
.cal-c.today { box-shadow: 0 0 0 2px var(--blue); }

/* 月历上的 休 / 班 角标 */
.cal-hd {
  position: absolute;
  top: 2px; left: 3px;
  font-size: 8.5px;
  font-weight: 700;
  font-style: normal;
  line-height: 1;
  padding: 1.5px 3.5px;
  border-radius: 5px;
}
.cal-hd.rest { background: var(--red-bg); color: var(--red); }
.cal-hd.work { background: var(--blue-bg); color: var(--blue); }
.cal-name {
  position: absolute;
  bottom: 2px; left: 0; right: 0;
  font-size: 8.5px;
  font-style: normal;
  color: var(--red);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
}
.cal-demo {
  width: 14px; height: 14px;
  border-radius: 4px;
  background: rgba(31,157,80,.34);
  border: 1px solid rgba(31,157,80,.45);
  display: inline-block;
}

/* 适老化字号覆盖 */
.cal-c b { font-size: 13.5px; }
.cal-hd { font-size: 9.5px; }
.cal-name { font-size: 9.5px; }

/* ==========================================================================
   应用锁
   ========================================================================== */
.lock {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: grid;
  place-items: center;
  padding: 24px;
}
/* hidden 属性必须真正隐藏，否则遮罩会吞掉整页点击 */
.lock[hidden] { display: none !important; }
.lock-box {
  width: 100%;
  max-width: 320px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--rl);
  box-shadow: var(--sh-l);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.lock-ic { font-size: 40px; }
.lock-t { font-size: 17px; }
.lock-s { font-size: 12.5px; color: var(--t3); }
.lock-inp {
  width: 100%;
  text-align: center;
  letter-spacing: 6px;
  font-size: 20px;
  margin-top: 4px;
}
.lock-err { font-size: 12.5px; color: var(--red); min-height: 18px; }

/* 家庭成员列表 */
.fam-i.fam-cur { background: var(--ac-bg); border-color: rgba(31,157,80,.3); }

/* ==========================================================================
   v4.0.0 手机端体验与适老化重构（最终覆写层）
   ========================================================================== */
body { font-size: 17px; }
.alert { font-size: 15px; line-height: 1.65; }
.kv { font-size: 15px; padding: 8px 0; }
.list-s { font-size: 14px; line-height: 1.55; }
.card-s { font-size: 14px; }
.tab { font-size: 13px; }
.tab .ti { font-size: 23px; }
.st-title { font-size: 17px; }
.stat-l { font-size: 14px; }
.stat-v { font-size: 26px; line-height: 1.25; }
.stat-f { font-size: 13px; }
.chip { font-size: 13px; }
.hero-b h2 { font-size: 21px; }
.hero-b p { font-size: 15px; line-height: 1.6; }
.legend { font-size: 13px; }

/* 首屏记录区 */
.quick-panel {
  background: linear-gradient(145deg, #f0faf3, #ffffff);
  border: 1px solid rgba(31,157,80,.22);
  border-radius: var(--rl);
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: 0 4px 18px rgba(30,80,45,.05);
}
.quick-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.quick-head b { font-size: 20px; }
.quick-head span { color: var(--t2); font-size: 14px; }
.quick { gap: 9px; }
.quick-b {
  min-height: 100px;
  padding: 10px 5px;
  font-size: 16px;
  font-weight: 600;
  border-color: #dce7df;
  background: #fff;
}
.quick-b.primary { border: 2px solid var(--blue); background: #f4f9ff; }
.quick-b .qi { width: 46px; height: 46px; font-size: 24px; margin-bottom: 5px; }
.quick-b small { display: block; color: var(--t3); font-size: 11px; font-weight: 400; line-height: 1.2; }

/* 今日状态与指标合并 */
.today-merged {
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: var(--rl);
  padding: 16px 14px 12px;
  margin-bottom: 16px;
}
.today-merged .hero { background: transparent; border: 0; padding: 0 0 14px; margin: 0; }
.today-merged .home-metrics-title {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border-top: 1px solid var(--line); padding: 13px 2px 10px;
}
.home-metrics-title b { font-size: 17px; }
.home-metrics-title span { font-size: 13px; color: var(--t3); }
.today-merged #homeStats { gap: 8px; }
.today-merged .stat { padding: 10px 8px; }

/* 习惯：整卡可打卡，详情独立 */
.habit { padding: 13px; min-height: 84px; align-items: center; }
.habit-ck { width: 44px; height: 48px; margin: 0; display: grid; place-items: center; }
.habit .ck { width: 30px; height: 30px; font-size: 17px; margin: 0; }
.habit .hn { font-size: 17px; line-height: 1.45; }
.habit .hd { font-size: 14px; line-height: 1.6; margin-top: 4px; }
.habit .st { font-size: 12px; }
.habit-info {
  width: 44px; height: 48px; font-size: 18px;
  background: transparent; border: 0; cursor: pointer;
}
.optional-habits, .tool-group, .info-details {
  margin: 12px 0 18px; background: var(--elev); border: 1px solid var(--line); border-radius: var(--rs);
}
.optional-habits summary, .tool-group summary, .info-details summary {
  cursor: pointer; padding: 15px; font-size: 16px; font-weight: 600; color: var(--t2);
}
.optional-habits .habits, .tool-group > .st-title, .info-details > div { margin-left: 12px; margin-right: 12px; }
.info-details { padding-bottom: 8px; }
.account-note { color: var(--t2); font-size: 14px; line-height: 1.6; margin-bottom: 12px; }

/* 所有关键触控目标不小于 44px */
.btn-sm { min-height: 44px; font-size: 14px; padding: 9px 13px; }
.seg-b { min-height: 44px; font-size: 15px; }
.sheet-x { width: 44px; height: 44px; font-size: 19px; }
.del { width: 44px; height: 44px; font-size: 17px; }
.cal-nv { width: 44px; height: 44px; }
.sw { min-width: 52px; min-height: 32px; }
.sheet { max-height: 88vh; max-height: 88dvh; pointer-events: none; visibility: hidden; }
.sheet.show { pointer-events: auto; visibility: visible; }
.sheet-h b { font-size: 18px; }
.hint { font-size: 14px; }
.f > label { font-size: 15px; }
.set-row .sr-b b { font-size: 16px; }
.set-row .sr-b span { font-size: 14px; }
.toast { font-size: 15px; }
.lock-forgot {
  margin-top: 10px; background: none; border: none; padding: 10px;
  font-size: 15px; color: var(--t3); text-decoration: underline; cursor: pointer;
}
.lock-forgot.warn { color: var(--red); font-weight: 600; text-decoration: none; }

@media (max-width: 480px) {
  .wrap { padding-left: 12px; padding-right: 12px; }
  .today-merged .hero { gap: 12px; }
  .ring { transform: scale(.9); transform-origin: left center; margin-right: -8px; }
  .hero-b p { font-size: 14px; }
  .today-merged .stat-v { font-size: 23px; }
  .quick-head b { font-size: 19px; }
  .quick-head span { font-size: 13px; }
}

@media (min-width: 900px) {
  body { font-size: 16px; }
  .quick-panel { padding: 18px; }
  .quick-b { min-height: 108px; }
}
