/* ============================================================
   暖婴纪 · 样式 v3 —— iOS / Apple HIG 风格
   设计基调：系统灰底 #F2F2F7 + 纯白分组卡片 + 珊瑚着色
   全部平涂、毛发线、毛玻璃，无渐变按钮、无彩色投影
   ============================================================ */

:root {
  /* iOS 系统色板（浅色） */
  --bg:        #F2F2F7;
  --surface:   #FFFFFF;
  --surface-2: #EFEFF3;           /* iOS fill：输入框、灰底块 */
  --fill:      rgba(118, 118, 128, .12);
  --line:      rgba(60, 60, 67, .24);   /* iOS separator 毛发线 */
  --line-soft: rgba(60, 60, 67, .10);

  --ink:       #1C1C1E;           /* label */
  --ink-2:     #6C6C70;           /* secondaryLabel */
  --ink-3:     #AEAEB2;           /* tertiaryLabel */

  /* 品牌着色（tint）：珊瑚橘，全局唯一强调色 */
  --primary:   #FF6B4A;
  --primary-d: #E14E2C;
  --primary-l: #FFEDE7;

  /* iOS 语义色（浅底用深字版本） */
  --green:     #34A853;
  --green-l:   #E6F7EC;
  --sun:       #F5A623;
  --sun-l:     #FFF4E0;
  --cool:      #5A9BD8;
  --cool-l:    #EAF3FB;
  --earth:     #B08A66;
  --earth-l:   #F7F0E8;

  /* 渐变只留给头卡（Wallet 卡片风），按钮一律平涂 */
  --grad:      linear-gradient(160deg, #FF8A5C 0%, #FF6240 55%, #F04E28 100%);
  --grad-mint: linear-gradient(160deg, #6FCF87 0%, #34B36B 55%, #1F9E56 100%);
  --grad-sun:  linear-gradient(160deg, #FFC53D 0%, #F5A623 60%, #E8971A 100%);

  --radius:    14px;
  --radius-l:  18px;
  --radius-s:  10px;
  --shadow:    none;              /* iOS 分组卡靠底色对比，不靠投影 */
  --shadow-l:  0 12px 40px rgba(0, 0, 0, .18);

  --safe-b:    env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --blur: saturate(180%) blur(20px);
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  /* iOS 的排版签名：标题收紧 */
  letter-spacing: -.1px;
  /* 数字全部等宽对齐：时间、奶量、金额在列表里上下对齐才扫得快 */
  font-variant-numeric: tabular-nums;
  /* 微信 web-view 里下拉会露出「网页由 xxx 提供」，用 contain 挡掉这层露白 */
  overscroll-behavior-y: contain;
}

a { color: var(--primary); text-decoration: none; }
b, strong { font-weight: 600; }
h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; letter-spacing: -.4px; }
p { margin: 0; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }

/* ---------------- 骨架 ---------------- */

/* iOS 导航栏：毛玻璃 + 毛发线，无重投影 */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  /* viewport-fit=cover 会让页面顶到刘海下面，不补这块 padding 顶栏就被裁掉了 */
  padding: calc(10px + env(safe-area-inset-top, 0px)) 18px 10px;
  background: rgba(249, 249, 251, .82);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-bottom: .5px solid var(--line);
}

/* iOS Large Title 气质：大号粗标 */
.brand {
  display: flex; align-items: center; gap: 9px;
  font-size: 21px; font-weight: 700; color: var(--ink); letter-spacing: -.5px;
}
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary);
}

.who {
  display: flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 8px 14px; border-radius: 19px;
  background: var(--fill); border: none;
  font-size: 13.5px; font-weight: 500; color: var(--ink);
  transition: background .15s;
}
.who:active { background: rgba(118, 118, 128, .2); }
.who em { font-style: normal; font-size: 11px; color: var(--ink-3); }

.page {
  max-width: 720px;
  margin: 0 auto;
  /* 底部 iOS Tab 栏高度 49 + 安全区 */
  padding: 16px 16px calc(78px + var(--safe-b));
}
.page.no-tab { padding-bottom: calc(32px + var(--safe-b)); }

/* ---------------- 底部标签栏（iOS 全宽毛玻璃 Tab Bar） ---------------- */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex;
  max-width: 720px; margin: 0 auto;
  padding: 5px 6px calc(5px + var(--safe-b));
  background: rgba(249, 249, 251, .82);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-top: .5px solid var(--line);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 5px 0 3px;
  color: var(--ink-3); font-size: 10px; letter-spacing: .2px;
  transition: color .16s, transform .1s;
}
.tab:active { transform: scale(.94); }
.tab svg { width: 23px; height: 23px; }
.tab.on { color: var(--primary); font-weight: 600; }
.tab.on svg { stroke-width: 2.1; }

/* ---------------- 通用块 ---------------- */

/* iOS 分组卡片：纯白、无边框、无投影 */
.card {
  background: var(--surface);
  border-radius: var(--radius-l);
  padding: 18px;
  box-shadow: none;
  border: none;
}
.card + .card { margin-top: 14px; }

/* iOS 分组节标题：普通灰字、左对齐卡片内缩进 */
.sec-title {
  display: flex; align-items: center; justify-content: space-between;
  margin: 26px 0 10px;
  padding-left: 2px;
  font-size: 14px; font-weight: 600; color: var(--ink-2); letter-spacing: .3px;
}
.sec-title::before { content: none; }
.sec-title:first-child { margin-top: 0; }
.sec-title a { font-weight: 500; font-size: 13.5px; color: var(--primary); }

.muted  { color: var(--ink-2); }
.dim    { color: var(--ink-3); }
.small  { font-size: 13.5px; }
.tiny   { font-size: 12.5px; }
.center { text-align: center; }
.row    { display: flex; align-items: center; gap: 12px; }
.between{ display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap   { flex-wrap: wrap; }

/* ---------------- 按钮（iOS：平涂 tint，无渐变无彩投影） ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 48px;
  padding: 12px 22px; border-radius: 14px;
  background: var(--primary); color: #fff;
  font-size: 16px; font-weight: 600; letter-spacing: -.1px;
  border: none;
  box-shadow: none;
  transition: transform .12s, opacity .15s, background .15s;
}
.btn:active { transform: scale(.97); opacity: .82; }
.btn.ghost {
  background: var(--fill); color: var(--ink);
}
.btn.ghost:active { background: rgba(118, 118, 128, .2); opacity: 1; }
.btn.soft { background: var(--primary-l); color: var(--primary-d); }
.btn.block { width: 100%; }
.btn.lg { min-height: 52px; padding: 14px 26px; font-size: 16px; border-radius: 15px; }
.btn.sm { min-height: 36px; padding: 7px 14px; font-size: 14px; border-radius: 10px; }
.btn[disabled] { opacity: .4; pointer-events: none; }

/* ---------------- 指标卡 ---------------- */

.metrics {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
.metric {
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--fill);
}
.metric .m-label { font-size: 12.5px; color: var(--ink-2); letter-spacing: .2px; }
.metric .m-value { font-size: 26px; font-weight: 700; letter-spacing: -.8px; line-height: 1.2; }
.metric .m-value i { font-style: normal; font-size: 12.5px; font-weight: 400; color: var(--ink-3); margin-left: 2px; }
.metric .m-sub { font-size: 12px; color: var(--ink-3); }
.metric.warm { background: var(--primary-l); }
.metric.warm .m-value { color: var(--primary-d); }
.metric.warn { background: var(--sun-l); }
.metric.warn .m-value { color: #C77700; }

/* ---------------- 记录流（图标行式：圆片图标 + 标题 + 说明 + 右侧时间） ---------------- */

.ev-list { display: flex; flex-direction: column; }

.ev-row {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 0;
}
.ev-row + .ev-row { border-top: .5px solid var(--line-soft); }

/* 表情圆片（跨类着色） */
.ev-row .ev-ico {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
  background: var(--fill);
}
.ev-row .ev-ico.warm  { background: var(--primary-l); }
.ev-row .ev-ico.cool  { background: var(--cool-l); }
.ev-row .ev-ico.earth { background: var(--earth-l); }
.ev-row .ev-ico.sun   { background: var(--sun-l); }
.ev-row .ev-ico.green { background: var(--green-l); }
.ev-row.warn .ev-ico  { background: var(--sun-l); }

.ev-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ev-main b { font-size: 16px; font-weight: 600; letter-spacing: -.2px; }
.ev-main span { font-size: 13.5px; color: var(--ink-2); margin-top: 2px; }
.ev-main em {
  font-style: normal; font-size: 12.5px; color: var(--ink-3);
  margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ev-row time {
  flex: none; font-size: 12.5px; color: var(--ink-3);
  font-variant-numeric: tabular-nums; letter-spacing: 0;
}
.ev-row.warn .ev-main b { color: #C77700; }

/* ---------------- 渐变头卡（工作台顶部，Wallet 卡片风） ---------------- */

.hero-card {
  position: relative; border-radius: 20px;
  padding: 18px 18px 16px; overflow: hidden;
  background: var(--grad);
  color: #fff;
  box-shadow: 0 10px 28px rgba(240, 78, 40, .22);
}
.hero-card::after {
  content: ''; position: absolute; right: -46px; top: -56px;
  width: 168px; height: 168px; border-radius: 50%;
  background: rgba(255, 255, 255, .13);
}
.hero-card .hc-top {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
}
.hero-card .hc-date { font-size: 12.5px; opacity: .85; letter-spacing: .3px; }
.hero-card .hc-day { font-size: 13px; margin-top: 2px; opacity: .95; }
.hero-card .hc-big {
  font-size: 36px; line-height: 1.1; font-weight: 700; letter-spacing: -1.2px;
  margin-top: 10px; font-variant-numeric: tabular-nums;
}
.hero-card .hc-big i {
  font-style: normal; font-size: 14px; font-weight: 500; opacity: .85; margin-left: 3px;
}
.hero-card .hc-sub { font-size: 13px; opacity: .9; margin-top: 3px; }

.ring { width: 62px; height: 62px; flex: 0 0 auto; }
.ring text { font-size: 13px; font-weight: 700; fill: #fff; }

/* ---------------- 宝宝卡 ---------------- */

.baby-face {
  flex: none;
  width: 48px; height: 48px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 700;
}
.baby-face.girl { background: #FFE7E2; color: #D45A45; }
.baby-face.boy  { background: #E3F0FA; color: #3D7EB0; }
.baby-face.lg   { width: 60px; height: 60px; border-radius: 18px; font-size: 24px; }
.baby-face.xs   { width: 32px; height: 32px; border-radius: 10px; font-size: 13px; }

.baby-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; border-radius: var(--radius-l);
  background: var(--surface); border: none;
  box-shadow: none;
  color: var(--ink);
}
.baby-card + .baby-card { margin-top: 12px; }
.baby-card .bc-main { flex: 1; min-width: 0; }
.baby-card .bc-main b { display: block; font-size: 17px; letter-spacing: -.3px; }
.baby-card .bc-main span { font-size: 13.5px; color: var(--ink-2); }
.baby-card .bc-right { text-align: right; font-size: 12.5px; color: var(--ink-3); }
.baby-card .bc-right b { display: block; font-size: 18px; color: var(--primary); font-weight: 700; }

/* ---------------- 徽标 / 标签（iOS 半透明着色 pill） ---------------- */

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 100px;
  font-size: 12.5px; font-weight: 500; letter-spacing: .1px;
  background: var(--fill); color: var(--ink-2);
}
.chip.good      { background: var(--green-l); color: #1E8A3C; }
.chip.attention { background: var(--sun-l);   color: #C77700; }
.chip.neutral   { background: var(--fill); color: var(--ink-2); }
.chip.pro       { background: #F1E8FA; color: #7D4EAC; }
.chip.warn      { background: #FFE9E3; color: #C43A1F; }
.chip.line      { background: transparent; border: 1px solid var(--line); }

/* ---------------- 日报 ---------------- */

.report-hero {
  position: relative;
  padding: 26px 22px 24px;
  border-radius: 20px;
  /* 日报头卡：与工作台一致的珊瑚橙主题色 */
  background: var(--grad);
  color: #fff;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(240, 78, 40, .22);
}
.report-hero::after {
  content: '';
  position: absolute; right: -46px; top: -56px;
  width: 168px; height: 168px; border-radius: 50%;
  background: rgba(255, 255, 255, .13);
}
.report-hero .rh-top { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.report-hero .rh-date { font-size: 12px; color: rgba(255, 255, 255, .88); letter-spacing: .3px; }
.report-hero h2 {
  font-size: 21px; line-height: 1.5; letter-spacing: -.3px;
  font-weight: 700; margin-bottom: 14px; position: relative; z-index: 1;
}
.report-hero .rh-sign {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: rgba(255, 255, 255, .9);
  padding-top: 12px; border-top: 1px dashed rgba(255, 255, 255, .35);
}
.report-hero .rh-sign .sig-face {
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255, 255, 255, .25); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
}
/* 橙底头卡里的状态标签：统一白底深字，避免浅色 chip 糊在渐变上 */
.report-hero .chip { background: rgba(255, 255, 255, .92); color: var(--primary-d); font-weight: 600; }
.report-hero .chip.good      { color: #1E8A3C; }
.report-hero .chip.attention { color: #C77700; }
.report-hero .chip.neutral   { color: var(--ink-2); }

/* 日报正文块 */
.rp-block {
  padding: 20px 18px;
  border-radius: var(--radius-l);
  background: var(--surface);
  border: none;
  box-shadow: none;
}
.rp-block + .rp-block { margin-top: 12px; }
.rp-block h3 {
  font-size: 14px; color: var(--ink-2); font-weight: 600;
  letter-spacing: .3px; margin-bottom: 14px;
  display: flex; align-items: center; gap: 7px;
}
.rp-block h3::before {
  content: ''; width: 3px; height: 13px; border-radius: 2px;
  background: var(--primary); opacity: .9;
}

/* 指标网格（日报用，四列紧凑） */
.rp-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1px; background: var(--line-soft);
  border-radius: 12px; overflow: hidden;
}
.rp-cell {
  background: var(--surface); padding: 13px 8px;
  text-align: center;
}
.rp-cell span { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 3px; }
.rp-cell b { font-size: 18px; font-weight: 700; letter-spacing: -.4px; }
.rp-cell b i { font-style: normal; font-size: 11px; font-weight: 400; color: var(--ink-3); }
.rp-cell em { display: block; font-style: normal; font-size: 11px; color: var(--green); margin-top: 1px; }
.rp-cell em.up { color: var(--sun); }

/* 护理清单 */
.care-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.care-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 11px;
  background: var(--green-l); font-size: 13.5px; font-weight: 500; color: #1E8A3C;
}
.care-item.off { background: var(--fill); color: var(--ink-3); font-weight: 400; }
.care-item .tick {
  flex: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--green); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px;
}
.care-item.off .tick { background: #C7C7CC; }

/* 现象提示 */
.flag-list { display: flex; flex-direction: column; gap: 9px; }
.flag-item {
  display: flex; gap: 9px; align-items: flex-start;
  font-size: 14.5px; color: var(--ink); line-height: 1.65;
}
.flag-item::before {
  content: ''; flex: none; width: 5px; height: 5px; border-radius: 50%;
  background: var(--sun); margin-top: 9px;
}

/* ---------------- 表单（iOS 填充式输入框） ---------------- */

.field { margin-bottom: 16px; }
.field > label {
  display: block; font-size: 13.5px; font-weight: 500; color: var(--ink-2);
  margin-bottom: 7px; letter-spacing: .2px;
}
.input, .select, .textarea {
  width: 100%; padding: 12px 14px;
  background: var(--surface-2); color: var(--ink);
  border: 1.5px solid transparent; border-radius: 12px;
  outline: none; transition: background .16s, border-color .16s;
  /* 16px 是硬底线：低于 16px 时 iOS Safari 会在聚焦瞬间放大整个页面，
     用户填完表单得手动缩回去，这是移动端最烦人的体验问题之一 */
  font-size: 16px;
  /* 键盘弹出时把输入框滚到可视区，避免被挡住 */
  scroll-margin-bottom: 120px;
}
.input:focus, .select:focus, .textarea:focus {
  background: var(--surface);
  border-color: var(--primary);
}
.input::placeholder { color: var(--ink-3); }
.textarea { resize: vertical; min-height: 72px; }

/* iOS 的日期输入框有 UA 固有宽度，width:100% 压不住，
   会直接撑出卡片右边界 —— 必须显式关掉默认外观并清掉最小宽度 */
input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
  width: 100%;
}

/* ---------------- 验证码 ---------------- */

/* 输入框 + 右侧「获取验证码」。
   两列 flex 而不是绝对定位：按钮文字会从「获取验证码」变成「58 秒」，
   绝对定位的话宽度一变就会压到输入框上。 */
.code-row { display: flex; align-items: stretch; gap: 8px; }
.code-row .input { flex: 1 1 auto; min-width: 0; letter-spacing: 2px; }
.code-btn {
  flex: 0 0 auto; padding: 0 14px; border-radius: 12px;
  background: var(--primary-l); color: var(--primary-d);
  border: none; font-size: 13px; font-weight: 600;
  white-space: nowrap; transition: background .16s, opacity .16s;
}
.code-btn:active { opacity: .75; }
.code-btn[disabled] {
  color: var(--ink-3); background: var(--fill); pointer-events: none;
}
.code-btn.done { color: #1E8A3C; background: var(--green-l); }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%23AEAEB2' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 36px;
}

/* 分段选择（时间快选等）：iOS 原生分段控件质感 */
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  /* 44px 是手指能稳稳点中的最小高度，低于这个值误触率会明显上升 */
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 16px; border-radius: 12px;
  background: var(--fill); border: none;
  font-size: 14px; font-weight: 500; color: var(--ink-2);
  transition: all .15s;
}
.seg input:checked + span {
  background: var(--primary);
  color: #fff; font-weight: 600;
}

/* 数字步进：iOS stepper（灰底分段） */
.stepper {
  display: flex; align-items: center; gap: 0;
  border: none; border-radius: 12px;
  background: var(--fill); overflow: hidden;
}
.stepper button {
  width: 46px; height: 48px; font-size: 19px; color: var(--primary-d);
  display: flex; align-items: center; justify-content: center;
}
.stepper button:active { background: rgba(118, 118, 128, .2); }
.stepper input {
  flex: 1; width: 100%; text-align: center;
  border: none; outline: none; background: transparent;
  font-size: 18px; font-weight: 700; letter-spacing: -.4px;
  font-variant-numeric: tabular-nums;
  height: 48px;
}

/* ---------------- 抽屉 / 弹层（iOS Bottom Sheet） ---------------- */

.sheet-mask {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, .38);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none;
  transition: opacity .22s;
}
.sheet-mask.open { opacity: 1; pointer-events: auto; }

.sheet {
  width: 100%; max-width: 720px;
  padding: 22px 20px calc(22px + var(--safe-b));
  border-radius: 16px 16px 0 0;
  background: var(--bg);
  box-shadow: var(--shadow-l);
  color: var(--ink);
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.32, .72, 0, 1);
}
.sheet-mask.open .sheet { transform: translateY(0); }

body.sheet-open { overflow: hidden; }

.sheet-handle {
  width: 38px; height: 5px; border-radius: 3px;
  background: #C7C7CC; margin: -8px auto 16px;
}
.sheet h3 { font-size: 19px; letter-spacing: -.3px; margin-bottom: 16px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 20px; }
.sheet-actions .btn { flex: 1; }

.who-card {
  display: flex; align-items: center; gap: 13px;
  padding: 15px; border-radius: var(--radius-l); background: var(--surface);
}
.who-card b { display: block; font-size: 16px; letter-spacing: -.2px; }
.who-card span { font-size: 12px; color: var(--ink-2); }
.who-avatar {
  width: 44px; height: 44px; border-radius: 14px; flex: none;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700;
}
.hint {
  font-size: 12px; color: var(--ink-3); line-height: 1.7;
  margin-top: 12px;
}

/* ---------------- 浮动录入按钮 ---------------- */

.fab {
  position: fixed; z-index: 41;
  /* 贴着内容区右边缘：内容宽 720 时居中对齐，窄屏时退到 20px，
     一条 max() 就够，不用再写断点 */
  right: max(18px, calc((100vw - 720px) / 2 + 18px));
  bottom: calc(72px + var(--safe-b));
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(240, 78, 40, .32);
  transition: transform .14s;
}
.fab:active { transform: scale(.92); }
.fab svg { width: 24px; height: 24px; }

/* ---------------- 登录 ---------------- */

.login-wrap {
  /* 先写 vh 兜底，再用 dvh 修正 iOS 地址栏收起时的高度跳动 */
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: calc(32px + env(safe-area-inset-top, 0px)) 24px calc(32px + var(--safe-b));
  max-width: 460px; margin: 0 auto;
}
.login-logo {
  width: 88px; height: 88px; border-radius: 22px;
  overflow: hidden;
  margin-bottom: 22px;
  /* iOS App 图标的连续圆角质感 */
  box-shadow: 0 8px 24px rgba(240, 78, 40, .24);
}
.login-logo img { width: 100%; height: 100%; display: block; }
.login-wrap h1 { font-size: 26px; margin-bottom: 8px; letter-spacing: -.5px; }
.login-wrap .sub { font-size: 14px; color: var(--ink-2); margin-bottom: 30px; text-align: center; }
.login-form { width: 100%; }

.demo-accounts { width: 100%; margin-top: 28px; }
.demo-accounts .da-title {
  font-size: 12px; color: var(--ink-3); text-align: center;
  margin-bottom: 12px; letter-spacing: .3px;
}
.da-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.da-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 13px; border-radius: 13px;
  background: var(--surface); border: none;
  text-align: left; color: var(--ink);
  transition: transform .12s, opacity .12s;
}
.da-item:active { transform: scale(.97); opacity: .85; }
.da-item b { font-size: 13px; font-weight: 600; }
.da-item span { font-size: 11px; color: var(--ink-3); }

/* ---------------- 空状态 ---------------- */

.empty {
  text-align: center; padding: 46px 24px;
}
.empty-ico {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--fill);
  display: flex; align-items: center; justify-content: center;
  font-size: 23px; margin: 0 auto 14px;
}
.empty h4 { font-size: 15px; margin-bottom: 6px; }
.empty p { font-size: 12.5px; color: var(--ink-3); line-height: 1.7; margin-bottom: 18px; }

/* ---------------- Toast（iOS 深色胶囊） ---------------- */

.toast-wrap {
  position: fixed; z-index: 90;
  left: 0; right: 0; top: calc(58px + env(safe-area-inset-top, 0px));
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
  transition: opacity .4s;
}
.toast-wrap.out { opacity: 0; }
.toast {
  padding: 11px 20px; border-radius: 100px;
  background: rgba(28, 28, 30, .92);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  color: #fff;
  font-size: 13px; font-weight: 500; box-shadow: var(--shadow-l);
  max-width: 88%;
}
.toast.err { background: rgba(199, 58, 31, .94); }

/* ---------------- 表格（后台） ---------------- */

/* 表格在窄屏不挤压变形，改成容器内横向滚动 */
.tbl-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; padding: 9px 10px; font-weight: 500;
  font-size: 11.5px; color: var(--ink-3); letter-spacing: .2px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.tbl td { padding: 12px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:active { background: var(--fill); }
.tbl .num { font-variant-numeric: tabular-nums; }

/* ---------------- 趋势图 ---------------- */

.chart-card { padding: 20px 16px; }
.bars {
  display: flex; align-items: flex-end; gap: 8px;
  height: 132px; padding-top: 8px;
}
.bar-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.bar-track {
  flex: 1; width: 100%; display: block;
  background: var(--fill); border-radius: 8px; overflow: hidden;
  position: relative;
}
.bar-fill {
  position: absolute; left: 0; right: 0; bottom: 0;
  border-radius: 8px;
  background: var(--primary);
  min-height: 3px;
  transition: height .5s cubic-bezier(.3,.9,.3,1);
}
.bar-fill.zero { background: #D9D9DE; }
.bar-col .bar-val { font-size: 10.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.bar-col .bar-x { font-size: 10.5px; color: var(--ink-3); }
.bar-col.today .bar-x { color: var(--primary); font-weight: 700; }

.trend-line { width: 100%; height: 120px; display: block; }

/* ---------------- 杂项 ---------------- */

.divider { height: 1px; background: var(--line-soft); margin: 16px 0; }

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 13px 15px; border-radius: 13px;
  background: var(--sun-l); font-size: 14px; line-height: 1.7; color: #9A6300;
}
.notice .notice-ico { flex: none; margin-top: 1px; }
.notice.err { background: #FFE9E3; color: #C43A1F; }

.kv-row { display: flex; justify-content: space-between; gap: 16px; font-size: 14.5px; line-height: 1.55; }
.kv-row .k { color: var(--ink-3); flex: none; }
.kv-row .v { text-align: right; }

@media (min-width: 700px) {
  .page { padding-left: 24px; padding-right: 24px; }
  .metrics { grid-template-columns: repeat(4, 1fr); }
}

/* 窄屏表格：保持列宽可读，允许横向滑动 */
@media (max-width: 560px) {
  .tbl-card .tbl { min-width: 460px; }
}

/* 无顶栏的页面（记录/表单），提示条贴顶 */
body.rec-page .toast-wrap { top: 10px; }

/* ---------------- 头像（图片优先，无图显首字） ---------------- */
/* 凡是头像容器，有图时铺满、圆角继承容器本身 */
.me-avatar.has-img,
.tm-av.has-img,
.si-face.has-img,
.who-avatar.has-img,
.baby-face.has-img {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  font-size: 0;              /* 藏掉首字（图片模式下容器里没有文字，保险） */
  border: 0;
}

/* 可直接点击换照片的头像（我的页 / 顶栏身份卡） */
[data-avatar-edit] { cursor: pointer; }
[data-avatar-edit]:active { opacity: .82; }

/* 头像上传控件：预览 + 按钮 + 说明 */
.av-up { display: flex; align-items: flex-start; gap: 14px; padding: 16px; }
.av-up-prev {
  width: 72px; height: 72px; border-radius: 20px; flex: none;
  background: var(--surface-2) center/cover no-repeat;
  border: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: var(--ink-3);
}
.av-up-side { flex: 1; min-width: 0; }
.av-up-btn { position: relative; overflow: hidden; cursor: pointer; }
.av-up-hint { margin: 9px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--ink-3); }
.av-up-msg { margin: 6px 0 0; font-size: 12.5px; line-height: 1.5; min-height: 0; }
.av-up-msg.ok { color: var(--green); }
.av-up-msg.err { color: #C43A1F; }
.av-up.busy .av-up-btn { opacity: .55; pointer-events: none; }
