/* ===== 全局重置 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
  background: #f7f8fa;
  color: #333;
  font-size: 14px;
  overflow: hidden;
}
#app {
  height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  background: #f7f8fa;
  position: relative;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 96px;
}
input, button, select { font-family: inherit; font-size: inherit; outline: none; border: none; }
button { cursor: pointer; }
a { text-decoration: none; color: #1e80ff; }

/* ===== 登录/注册 ===== */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  background: linear-gradient(160deg, #eaf4ff 0%, #f7f8fa 60%);
}
.auth-logo { text-align: center; margin-bottom: 48px; }
.logo-icon {
  width: 80px; height: 80px;
  border-radius: 22px;
  background: linear-gradient(135deg, #1e80ff, #5aa7ff);
  color: #fff; font-size: 40px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(30, 128, 255, 0.35);
}
.auth-logo h1 { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.auth-logo p { color: #999; font-size: 14px; }
.auth-form { width: 100%; max-width: 340px; }
.input-wrap {
  display: flex; align-items: center;
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border: 1px solid #eef0f3;
  transition: border-color 0.2s;
}
.input-wrap:focus-within { border-color: #1e80ff; }
.input-icon { margin-right: 10px; font-size: 18px; }
.input-wrap input { flex: 1; border: none; background: transparent; font-size: 15px; }
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #1e80ff, #4d9dff);
  color: #fff;
  border-radius: 12px;
  padding: 14px 0;
  font-size: 16px;
  font-weight: 600;
  margin-top: 8px;
  box-shadow: 0 6px 16px rgba(30, 128, 255, 0.3);
}
.btn-primary:active { transform: scale(0.98); opacity: 0.9; }
.btn-wx {
  width: 100%;
  background: #fff;
  color: #07c160;
  border: 1px solid #07c160;
  border-radius: 12px;
  padding: 14px 0;
  font-size: 16px;
  font-weight: 600;
  margin-top: 12px;
}
.btn-wx:active { transform: scale(0.98); opacity: 0.9; }
.auth-switch { text-align: center; margin-top: 20px; color: #999; font-size: 14px; }

/* ===== 底部导航 ===== */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: 56px;
  background: #fff;
  border-top: 1px solid #f0f0f0;
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar .tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 10px;
}
.tabbar .tab-item.active { color: #1e80ff; }
.tabbar .tab-item .tab-ico { font-size: 22px; margin-bottom: 2px; }
.tabbar .tab-item .tab-add {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e80ff, #4d9dff);
  color: #fff; font-size: 26px;
  display: flex; align-items: center; justify-content: center;
  margin-top: -20px;
  box-shadow: 0 6px 16px rgba(30, 128, 255, 0.4);
}

/* ===== 首页 ===== */
.home-header {
  background: linear-gradient(135deg, #1e80ff, #5aa7ff);
  padding: 20px;
  color: #fff;
  border-radius: 0 0 24px 24px;
}
.home-header .row { display: flex; justify-content: space-between; align-items: center; }
.home-header .hello { font-size: 15px; opacity: 0.9; }
.home-header .date { font-size: 12px; opacity: 0.75; margin-top: 2px; }
.balance-box { margin-top: 16px; }
.balance-box .label { font-size: 12px; opacity: 0.8; }
.balance-box .amount { font-size: 34px; font-weight: 700; margin-top: 4px; }
.income-outcome { display: flex; margin-top: 18px; gap: 12px; }
.income-outcome .io-item {
  flex: 1;
  background: rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 10px 14px;
}
.income-outcome .io-item .io-label { font-size: 11px; opacity: 0.8; }
.income-outcome .io-item .io-amount { font-size: 18px; font-weight: 600; margin-top: 3px; }

.bill-list { padding: 12px 0; }
.bill-group { margin-bottom: 16px; }
.bill-group .group-date {
  display: flex; justify-content: space-between;
  padding: 8px 16px;
  font-size: 13px; color: #666;
}
.bill-group .group-date .gd-right { color: #999; }
.bill-item {
  display: flex; align-items: center;
  background: #fff;
  padding: 12px 16px;
  margin-bottom: 1px;
}
.bill-item .bi-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #f2f6ff;
  display: flex; align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.bill-item .bi-info { flex: 1; margin-left: 12px; min-width: 0; }
.bill-item .bi-name { font-size: 15px; color: #333; }
.bill-item .bi-note { font-size: 12px; color: #999; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bill-item .bi-amount { font-size: 16px; font-weight: 600; flex-shrink: 0; }
.bill-item .bi-amount.expense { color: #ff5b4d; }
.bill-item .bi-amount.income { color: #12b76a; }
.bill-item:active { background: #fafafa; }

/* ===== 通用 ===== */
.page-loading { text-align: center; color: #999; padding: 60px 0; font-size: 14px; }
.empty { text-align: center; color: #999; padding: 60px 20px; }
.empty .empty-ico { font-size: 44px; margin-bottom: 12px; }
.empty p { font-size: 15px; }
.empty .empty-sub { font-size: 12px; margin-top: 6px; color: #bbb; }

/* 轻提示 */
.toast {
  position: fixed;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 14px;
  padding: 12px 20px;
  border-radius: 10px;
  z-index: 9999;
  max-width: 70%;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.toast.show { opacity: 1; }

/* ===== 页面头部 ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  background: #fff;
  padding: 0 16px;
  border-bottom: 1px solid #f0f0f0;
  position: sticky;
  top: 0;
  z-index: 50;
}
.ph-back { font-size: 24px; color: #333; width: 40px; }
.ph-title { font-size: 16px; font-weight: 600; }
.ph-right { width: 40px; }

/* ===== 首页：月份切换/拍照记账 ===== */
.month-switch { display: flex; align-items: center; gap: 6px; }
.ms-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  user-select: none;
}
.ms-btn:active { background: rgba(255, 255, 255, 0.35); }
.ms-text { font-size: 13px; opacity: 0.9; min-width: 70px; text-align: center; }
.photo-entry {
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}
.photo-entry:active { background: rgba(255, 255, 255, 0.32); }
.home-header .amount.neg { color: #ffd6d0; }

/* ===== 记账页 ===== */
.add-amount {
  font-size: 38px;
  font-weight: 700;
  text-align: center;
  padding: 18px 20px 12px;
  color: #222;
  background: #fff;
}
.type-tabs {
  display: flex;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
}
.type-tab {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  font-size: 15px;
  color: #999;
  position: relative;
  cursor: pointer;
}
.type-tab.active { color: #333; font-weight: 600; }
.type-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  border-radius: 2px;
}
.type-tab.active.expense::after { background: #ff5b4d; }
.type-tab.active.income::after { background: #12b76a; }

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 10px 12px;
  background: #fff;
  /* 分类过多时内部滚动，保证记账页单屏 */
  max-height: 175px;
  overflow-y: auto;
}
.cat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  border-radius: 10px;
  cursor: pointer;
}
.cat-item .cat-ico {
  width: 46px; height: 46px;
  border-radius: 14px;
  background: #f5f6f8;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  margin-bottom: 5px;
  transition: transform 0.1s;
}
.cat-item .cat-name {
  font-size: 12px;
  color: #666;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 2px;
}
.cat-item.active .cat-ico {
  background: #eaf1ff;
  transform: scale(1.08);
  box-shadow: 0 0 0 2px #1e80ff;
}
.cat-item.active .cat-name { color: #1e80ff; font-weight: 600; }

.add-form { margin-top: 8px; background: #fff; }
.form-row {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid #f5f6f8;
}
.form-label { width: 60px; font-size: 15px; color: #666; }
.form-input { flex: 1; font-size: 15px; background: transparent; }
.btn-save {
  display: block;
  width: calc(100% - 32px);
  margin: 14px auto 0;
  background: linear-gradient(135deg, #1e80ff, #4d9dff);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  border-radius: 12px;
  padding: 11px 0;
  box-shadow: 0 6px 16px rgba(30, 128, 255, 0.3);
}
.btn-save:active { transform: scale(0.98); opacity: 0.9; }

/* ===== 分类管理 ===== */
.cat-manage {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 16px 12px;
  background: #fff;
}
.cat-manage-item {
  position: relative;
  background: #f7f8fa;
  border-radius: 12px;
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.cat-manage-item .cm-ico { font-size: 26px; }
.cat-manage-item .cm-name { font-size: 13px; color: #444; }
.cat-manage-item .cm-del {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #ff5b4d;
  color: #fff;
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
}
.cat-manage-item .cm-sys { font-size: 10px; color: #bbb; }
.cat-add { margin: 16px; background: #fff; border-radius: 14px; padding: 16px; }
.cat-add-title { font-size: 14px; color: #666; margin-bottom: 12px; }
.cat-add-row { display: flex; gap: 10px; }
.cat-add-input {
  flex: 1;
  background: #f5f6f8;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
}
.cat-add-btn {
  background: #1e80ff;
  color: #fff;
  border-radius: 10px;
  padding: 0 22px;
  font-size: 14px;
}
.cat-emoji {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.emoji-item {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: #f5f6f8;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  cursor: pointer;
}
.emoji-item.active { background: #eaf1ff; box-shadow: 0 0 0 2px #1e80ff; }

/* ===== 统计页 ===== */
.stat-month {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
}
.stat-month .ms-btn {
  background: #fff;
  color: #333;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.stat-month .ms-text { color: #333; min-width: 90px; font-size: 15px; font-weight: 600; }
.stat-cards { display: flex; gap: 10px; padding: 0 16px; }
.stat-card {
  flex: 1;
  background: #fff;
  border-radius: 12px;
  padding: 14px 12px;
}
.stat-card .sc-label { font-size: 12px; color: #999; }
.stat-card .sc-num { font-size: 18px; font-weight: 700; margin-top: 6px; }
.stat-card.expense .sc-num { color: #ff5b4d; }
.stat-card.income .sc-num { color: #12b76a; }
.stat-card.balance .sc-num { color: #1e80ff; }
.stat-card.balance .sc-num.neg { color: #ff5b4d; }
.stat-section { margin: 16px; background: #fff; border-radius: 14px; padding: 16px; }
.stat-sec-title { font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.stat-row { display: flex; gap: 12px; padding: 10px 0; }
.stat-row .sr-ico {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #f5f6f8;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.stat-row .sr-main { flex: 1; min-width: 0; }
.sr-top { display: flex; justify-content: space-between; align-items: center; }
.sr-name { font-size: 14px; color: #333; }
.sr-num { font-size: 14px; font-weight: 600; }
.sr-bar {
  height: 6px;
  background: #f0f1f3;
  border-radius: 3px;
  margin-top: 8px;
  overflow: hidden;
}
.sr-fill { height: 100%; border-radius: 3px; }
.sr-fill.fill-expense { background: linear-gradient(90deg, #ff8a7a, #ff5b4d); }
.sr-fill.fill-income { background: linear-gradient(90deg, #4ade80, #12b76a); }
.sr-pct { font-size: 11px; color: #aaa; margin-top: 5px; }

/* ===== 我的 ===== */
.mine-header {
  background: linear-gradient(135deg, #1e80ff, #5aa7ff);
  padding: 36px 24px 44px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: #fff;
  border-radius: 0 0 24px 24px;
}
.mine-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  font-weight: 700;
  border: 2px solid rgba(255, 255, 255, 0.6);
}
.mine-name { font-size: 20px; font-weight: 700; }
.mine-username { font-size: 13px; opacity: 0.85; margin-top: 4px; }
.menu-list { margin: 16px; background: #fff; border-radius: 14px; overflow: hidden; }
.menu-item {
  display: flex;
  align-items: center;
  padding: 15px 16px;
  border-bottom: 1px solid #f5f6f8;
  color: #333;
  cursor: pointer;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:active { background: #fafafa; }
.menu-ico { font-size: 20px; margin-right: 12px; }
.menu-label { flex: 1; font-size: 15px; }
.menu-arrow { color: #ccc; font-size: 18px; }
.btn-logout {
  display: block;
  width: calc(100% - 32px);
  margin: 24px auto 0;
  background: #fff;
  color: #ff5b4d;
  border-radius: 12px;
  padding: 14px 0;
  font-size: 15px;
  font-weight: 600;
}
.btn-logout:active { background: #fff5f4; }

/* ===== 金额键盘 ===== */
.keyboard-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.keyboard-mask.show { display: flex; }
.keyboard {
  width: 100%;
  max-width: 480px;
  background: #f7f8fa;
  border-radius: 16px 16px 0 0;
  padding: 14px 12px calc(14px + env(safe-area-inset-bottom));
  animation: kbUp 0.2s ease;
}
@keyframes kbUp {
  from { transform: translateY(30%); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}
.keyboard-title {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 13px;
  color: #999;
  margin-bottom: 6px;
}
.keyboard-value {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  color: #222;
  margin-bottom: 14px;
  min-height: 36px;
}
.keyboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.key-btn {
  height: 52px;
  border-radius: 12px;
  background: #fff;
  font-size: 22px;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  user-select: none;
}
.key-btn:active { background: #eef0f3; }
.key-btn.del, .key-btn.clear { font-size: 18px; color: #666; background: #eef0f3; }
.key-btn.ok {
  background: linear-gradient(135deg, #1e80ff, #4d9dff);
  color: #fff;
  font-size: 18px;
  font-weight: 600;
}
.key-btn.ok:active { background: #1e80ff; }

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  width: 280px;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
}
.modal-title {
  text-align: center;
  padding: 22px 18px;
  font-size: 15px;
  color: #333;
  line-height: 1.5;
}
.modal-btns { display: flex; border-top: 1px solid #f0f0f0; }
.modal-btn {
  flex: 1;
  padding: 13px 0;
  font-size: 15px;
  background: #fff;
}
.modal-btn.cancel { color: #999; border-right: 1px solid #f0f0f0; }
.modal-btn.ok { color: #1e80ff; font-weight: 600; }
.modal-btn:active { background: #f7f8fa; }

/* ===== 底部导航增强 ===== */
.tabbar .tab-item-add { justify-content: flex-end; }
.tabbar .tab-item-add .tab-add { margin-bottom: 6px; }

/* ===== 记账页：二级分类级联 ===== */
.sub-grid-title {
  padding: 10px 16px 0;
  font-size: 13px;
  color: #999;
  background: #fff;
}
.category-grid.sub-grid {
  padding-top: 8px;
  padding-bottom: 4px;
}

/* ===== 分类管理：二级结构 ===== */
.cat-manage-title {
  padding: 14px 16px 8px;
  font-size: 13px;
  color: #999;
  background: #f7f8fa;
}
.cat-manage-item.active {
  background: #eaf1ff;
  box-shadow: 0 0 0 2px #1e80ff;
}
.cat-manage-item.active .cm-name { color: #1e80ff; font-weight: 600; }

/* ===== 健康管理：功能切换 ===== */
.health-switch {
  display: flex;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
}
.hs-item {
  flex: 1;
  text-align: center;
  padding: 13px 0;
  font-size: 15px;
  color: #999;
  position: relative;
  cursor: pointer;
}
.hs-item.active { color: #333; font-weight: 600; }
.hs-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  border-radius: 2px;
  background: #1e80ff;
}

/* ===== 健康管理：通用卡片 ===== */
.h-card {
  margin: 12px 16px 0;
  background: #fff;
  border-radius: 14px;
  padding: 16px;
}
.h-card-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.h-empty { text-align: center; color: #bbb; font-size: 13px; padding: 24px 0; }
.h-tip { text-align: center; color: #bbb; font-size: 11px; margin-top: 10px; }

/* 状态标签 */
.h-tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 8px;
  line-height: 1.5;
}
.h-tag.normal { background: #e8f7ee; color: #12b76a; }
.h-tag.high { background: #ffeded; color: #f53f3f; }
.h-tag.low { background: #fff7e6; color: #ff9f0a; }

/* ===== 血糖：今日概览 ===== */
.h-overview {
  margin: 12px 16px 0;
  border-radius: 14px;
  padding: 16px;
  background: linear-gradient(135deg, #1e80ff, #5aa7ff);
  color: #fff;
}
.h-ov-title { font-size: 13px; opacity: 0.9; }
.h-ov-row { display: flex; flex-wrap: wrap; justify-content: space-between; margin-top: 8px; }
.h-ov-item {
  width: 31.8%;
  text-align: center;
  padding: 8px 0 6px;
  margin-bottom: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
  user-select: none;
}
.h-ov-item:active { background: rgba(255, 255, 255, 0.24); }
.h-ov-item:nth-child(n + 7) { margin-bottom: 0; }
.h-ov-label { font-size: 11px; opacity: 0.8; }
.h-ov-value { font-size: 19px; font-weight: 700; margin: 2px 0 4px; }
.h-ov-status { min-height: 18px; }
.h-ov-status .h-tag { color: #fff; }
.h-ov-status .h-tag.normal { background: rgba(255, 255, 255, 0.22); }
.h-ov-status .h-tag.high { background: rgba(245, 63, 63, 0.85); }
.h-ov-status .h-tag.low { background: rgba(255, 159, 10, 0.85); }

/* 趋势入口 */
.h-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 12px 16px 0;
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  color: #333;
}
.h-entry:active { background: #fafafa; }
.h-entry-title { font-size: 15px; font-weight: 600; }
.h-entry-sub { font-size: 12px; color: #999; margin-top: 4px; }
.h-entry-arrow { font-size: 22px; color: #ccc; }

/* 记录列表 */
.h-record {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f5f6f8;
  cursor: pointer;
}
.h-record:last-child { border-bottom: none; }
.h-record:active { background: #fafafa; }
.h-r-period {
  width: 68px;
  flex-shrink: 0;
  font-size: 13px;
  color: #666;
}
.h-r-value { flex: 1; font-size: 15px; font-weight: 600; }
.h-r-value i { font-style: normal; font-size: 11px; color: #999; font-weight: 400; margin-left: 3px; }
.h-r-time { font-size: 12px; color: #bbb; margin-left: 8px; }

/* ===== 例假：今日状态横幅 ===== */
.h-banner {
  margin: 12px 16px 0;
  border-radius: 14px;
  padding: 16px;
  color: #fff;
}
.h-banner.period { background: linear-gradient(135deg, #f53f3f, #ff7d6b); }
.h-banner.fertile { background: linear-gradient(135deg, #ff9f0a, #ffc46b); }
.h-banner.safe { background: linear-gradient(135deg, #12b76a, #4ade80); }
.h-banner:not(.period):not(.fertile):not(.safe) { background: linear-gradient(135deg, #86909c, #a9b0ba); }
.h-b-label { font-size: 11px; opacity: 0.85; }
.h-b-status { font-size: 18px; font-weight: 700; margin: 6px 0 4px; }
.h-b-tip { font-size: 12px; opacity: 0.9; }

/* ===== 例假日历 ===== */
.h-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.h-cal-arrow {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #f5f6f8;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: #666;
  cursor: pointer;
  user-select: none;
}
.h-cal-arrow:active { background: #eef0f3; }
.h-cal-month { font-size: 15px; font-weight: 600; }
.h-cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 12px;
  color: #999;
  margin-bottom: 6px;
}
.h-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.h-cal-cell {
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #333;
  position: relative;
}
.h-cal-cell.today { font-weight: 700; box-shadow: inset 0 0 0 1px #1e80ff; color: #1e80ff; }
.h-cal-cell.period { background: #ff5b4d; color: #fff; }
.h-cal-cell.fertile { background: #ffb547; color: #fff; }
.h-cal-cell.safe { background: #e8f7ee; color: #12b76a; }
.h-cal-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 10px;
  font-size: 12px;
  color: #999;
}
.h-legend-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: -1px;
}
.h-legend-dot.period { background: #ff5b4d; }
.h-legend-dot.fertile { background: #ffb547; }
.h-legend-dot.safe { background: #12b76a; }

/* 预测卡片 */
.h-predict-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
  color: #666;
}
.h-predict-row b { color: #333; }

/* ===== 血糖记录表单 ===== */
.b-value-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff;
  padding: 26px 16px;
}
.b-value-input {
  width: 200px;
  font-size: 46px;
  font-weight: 700;
  color: #222;
  text-align: center;
  background: transparent;
  border-bottom: 2px solid #1e80ff;
}
.b-value-input::placeholder { color: #d8dce2; font-weight: 400; }
.b-value-unit { font-size: 14px; color: #999; }
.h-std-tip {
  margin: 16px 16px 0;
  font-size: 13px;
  color: #1e80ff;
  background: #f2f6ff;
  border-radius: 10px;
  padding: 10px 14px;
  line-height: 1.5;
}
.h-form-tip { font-size: 12px; color: #999; margin-top: 8px; line-height: 1.5; }

/* ===== 血糖趋势图 ===== */
.h-range {
  display: flex;
  gap: 10px;
  margin: 12px 16px 0;
}
.h-range-btn {
  flex: 1;
  text-align: center;
  background: #fff;
  border-radius: 10px;
  padding: 9px 0;
  font-size: 14px;
  color: #666;
  cursor: pointer;
}
.h-range-btn.active {
  background: linear-gradient(135deg, #1e80ff, #4d9dff);
  color: #fff;
  font-weight: 600;
}
.h-chart-wrap {
  background: #fff;
  border-radius: 12px;
  padding: 10px 6px 4px;
  overflow-x: auto;
}
.h-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 12px;
  font-size: 11px;
  color: #666;
}
.h-chart-legend .h-legend-item {
  display: flex;
  align-items: center;
  width: 33.333%;
  padding: 4px 0;
  cursor: pointer;
  user-select: none;
}
.h-chart-legend .h-legend-item.off { opacity: 0.35; }
.h-chart-legend .h-legend-item.off i { background: #ccc !important; }
.h-chart-legend i {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: -1px;
}
.h-chart-tip {
  text-align: center;
  font-size: 11px;
  color: #bbb;
  margin-top: 10px;
  line-height: 1.5;
}
/* 图表卡片（点位点击详情浮层定位参照） */
.h-chart-card { position: relative; }
.h-chart-tipbox {
  position: absolute;
  z-index: 30;
  background: rgba(29, 33, 41, 0.92);
  color: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  max-width: 180px;
  pointer-events: none;
}
.h-tb-title { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.h-tb-row { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.h-tb-row span { color: #c9cdd4; }
.h-tb-row b { font-weight: 700; }
.h-tb-row i { font-style: normal; color: #ffa940; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 90px; }

/* 血糖添加：9 时段网格 */
.blood-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
}
.blood-tabs .type-tab {
  flex: none;
  width: calc(33.333% - 4px);
  background: #f5f6f8;
  border-radius: 10px;
  padding: 10px 0;
  font-size: 13px;
  color: #4e5969;
}
.blood-tabs .type-tab.active {
  background: linear-gradient(135deg, #1e80ff, #4d9dff);
  color: #fff;
  font-weight: 600;
}
.blood-tabs .type-tab.active::after { display: none; }

/* 正常标准参考 */
.h-std-row {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f5f6f8;
}
.h-std-row:last-child { border-bottom: none; }
.h-std-name { width: 90px; flex-shrink: 0; font-size: 13px; color: #666; }
.h-std-val { flex: 1; font-size: 15px; font-weight: 700; color: #333; }
.h-std-desc { font-size: 11px; color: #999; }
.h-std-note { font-size: 11px; color: #bbb; margin-top: 12px; line-height: 1.5; }

/* ===== 三功能模块切换（记账 / 血糖 / 例假） ===== */
.module-bar {
  display: flex;
  gap: 6px;
  margin: 10px 16px 0;
  background: #fff;
  border-radius: 12px;
  padding: 6px;
}
.module-item {
  flex: 1;
  text-align: center;
  padding: 6px 0;
  font-size: 14px;
  color: #666;
  border-radius: 9px;
  cursor: pointer;
  user-select: none;
}
.module-item.active {
  background: linear-gradient(135deg, #1e80ff, #4d9dff);
  color: #fff;
  font-weight: 600;
}
.module-icon { margin-right: 2px; }

/* ===== 日历页 ===== */
.cal-card {
  margin: 12px 16px 0;
  background: #fff;
  border-radius: 14px;
  padding: 16px;
}
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cal-title { font-size: 17px; font-weight: 700; color: #1d2129; }
.cal-arrow {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #f5f6f7;
  color: #4e5969;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  user-select: none;
}
.cal-arrow:active { background: #e4edff; }
.cal-week {
  display: flex;
  margin-top: 12px;
}
.cal-week span {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: #86909c;
}
.cal-grid {
  display: flex;
  flex-wrap: wrap;
  margin-top: 4px;
}
.cal-cell {
  width: 14.285%;
  height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  user-select: none;
}
.cal-cell .cal-num {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: #1d2129;
  border-radius: 50%;
}
.cal-cell.other .cal-num { color: #c9cdd4; }
.cal-cell.today .cal-num { background: #eaf1ff; color: #1e80ff; font-weight: 700; }
.cal-cell.selected .cal-num { background: linear-gradient(135deg, #1e80ff, #4d9dff); color: #fff; font-weight: 700; }
.cal-dots {
  position: absolute;
  bottom: 5px;
  display: flex;
  gap: 3px;
}
.cal-dot { width: 5px; height: 5px; border-radius: 50%; }
.cal-dot.expense { background: #ff5b4d; }
.cal-dot.income { background: #12b76a; }
.cal-dot.blood { background: #1e80ff; }
.cal-legend {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 10px;
  font-size: 11px;
  color: #86909c;
}
.cal-legend i {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: -1px;
}
.cal-legend i.expense { background: #ff5b4d; }
.cal-legend i.income { background: #12b76a; }
.cal-legend i.blood { background: #1e80ff; }

.cal-day-title {
  font-size: 15px;
  font-weight: 600;
  color: #1d2129;
  margin: 16px 16px 8px;
}
.cal-tabs {
  display: flex;
  margin: 0 16px 8px;
  background: #fff;
  border-radius: 12px;
  padding: 4px;
}
.cal-tab {
  flex: 1;
  text-align: center;
  padding: 9px 0;
  font-size: 13px;
  color: #666;
  border-radius: 9px;
  cursor: pointer;
  user-select: none;
}
.cal-tab.active {
  background: linear-gradient(135deg, #1e80ff, #4d9dff);
  color: #fff;
  font-weight: 600;
}
.cal-day-list { margin: 0 16px 16px; background: #fff; border-radius: 14px; padding: 4px 16px; }
.cal-day-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f5f6f8;
}
.cal-day-item:last-child { border-bottom: none; }
.cdi-icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #f5f6f8;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.cdi-main {
  flex: 1;
  margin-left: 12px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.cdi-main b { font-size: 14px; color: #1d2129; }
.cdi-main i {
  font-style: normal;
  font-size: 11px;
  color: #86909c;
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cdi-val { font-size: 14px; font-weight: 700; flex-shrink: 0; }
.cdi-val.expense { color: #ff5b4d; }
.cdi-val.income { color: #12b76a; }
.cdi-val.blood { color: #1e80ff; }
.cal-day-empty {
  margin: 0 16px 16px;
  background: #fff;
  border-radius: 14px;
  padding: 40px 0;
  text-align: center;
  font-size: 13px;
  color: #c9cdd4;
}

/* ===== 首页账单左滑删除 ===== */
.swipe-wrap { position: relative; overflow: hidden; }
.swipe-wrap .bill-item {
  position: relative;
  z-index: 1;
  background: #fff;
  transition: transform 0.2s ease;
  cursor: pointer;
}
/* 左滑删除：取消红底，红线分隔 + 红色半透明垃圾桶图标 */
.swipe-wrap .swipe-del {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 72px;
  background: #fff;
  border-left: 1px solid rgba(255, 77, 79, 0.55);
  color: rgba(255, 77, 79, 0.72);
  font-size: 20px;
  border-top: none;
  border-right: none;
  border-bottom: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.swipe-wrap .swipe-del:active { background: #fff5f5; }

/* ===== 二级分类弹框 ===== */
.sub-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  max-width: 88%;
  max-height: 70vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  z-index: 210;
}
.sub-modal-title { font-size: 15px; font-weight: 600; text-align: center; margin-bottom: 14px; }
.sub-modal-grid {
  display: flex;
  flex-wrap: wrap;
}
.sub-modal-item {
  width: 33.333%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  border-radius: 10px;
  cursor: pointer;
}
.sub-modal-item.active { background: #e8f3ff; }
.sub-modal-item .sm-ico {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: #f2f3f5;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.sub-modal-item.active .sm-ico { background: #165dff; }
.sub-modal-item .sm-name {
  margin-top: 5px;
  font-size: 12px;
  color: #4e5969;
  text-align: center;
}
.sub-modal-item.active .sm-name { color: #165dff; font-weight: 600; }
.sm-empty { width: 100%; padding: 30px 0; text-align: center; color: #c9cdd4; font-size: 13px; }
.sm-use1 {
  width: 100%;
  margin-top: 14px;
  background: #eef2ff;
  color: #165dff;
  border-radius: 10px;
  padding: 12px 0;
  font-size: 14px;
  font-weight: 600;
}
.sm-close { margin-top: 12px; text-align: center; color: #86909c; font-size: 13px; cursor: pointer; }

/* ===== 页脚备案号 ===== */
.page-footer {
  text-align: center;   /* 文字居中 */
  padding: 14px 0 10px; /* 上下留一点间距，避免贴得太紧 */
  font-size: 11px;      /* 小字号，不抢页面主内容的风头 */
  color: #999;          /* 浅灰色，和页面次要文字保持一致 */
}
.page-footer a { color: #999; } /* 链接也用浅灰色；点击后跳工信部备案官网 */