/* ============================================================
   WR 体重记录 · 设计系统（布局2 · 仪表盘式 · 奶油暖橙）
   主题色随体重趋势联动：health 绿 / ok 橙 / warn 深橙 / danger 红
   ============================================================ */
:root,
body.theme-ok {
  /* 默认档：奶油暖橙（1 个跨度上涨） */
  --primary: #E86A33;
  --primary-deep: #C2551F;
  --primary-soft: #FDE8D8;
  --primary-grad: linear-gradient(135deg, #F08545, #E86A33);
  --ring: rgba(232, 106, 51, .15);        /* 输入框 focus 光环 */
  --ring-strong: rgba(232, 106, 51, .5);  /* 键盘 focus-visible 描边 */
  --shadow: 0 6px 20px rgba(232, 106, 51, .10);
  --shadow-lg: 0 12px 32px rgba(232, 106, 51, .18);
  --shadow-btn: 0 6px 16px rgba(232, 106, 51, .28);
  --shadow-nav: 0 4px 12px rgba(232, 106, 51, .3);
  --shadow-modal: 0 20px 50px rgba(232, 106, 51, .3);
  --slider-off: #E8D5C3;                  /* 开关关闭态 */
  --dash-border: #EBC9A8;                 /* 上传虚线框 */
  --dash-bg: #FEFAF5;
  --dash-bg-hover: #FFF6EE;
  --chip-diff: rgba(255, 255, 255, .2);   /* 通用徽章底色（未用 diffClass 时） */
  --spark-bar: rgba(255, 255, 255, .4);   /* 趋势图普通柱 */
  --spark-latest: #fff;                   /* 趋势图最新柱 */
  --brand-fill: #E86A33;                  /* 品牌叶子图标 */

  --accent: #D97706;
  --success: #10B981;
  --success-bg: #D1FAE5;
  --danger: #EF4444;
  --danger-bg: #FEE2E2;
  --warn: #D97706;
  --warn-bg: #FEF3C7;
  --bg: #FBF7F2;
  --card: #FFFFFF;
  --text: #4A2C17;
  --muted: #A0775A;
  --border: #F3E3D3;
  --radius: 18px;
  --radius-sm: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

/* 健康向好：全部跨度下降/持平 → 绿色系 */
body.theme-health {
  --primary: #10B981;
  --primary-deep: #047857;
  --primary-soft: #D1FAE5;
  --primary-grad: linear-gradient(135deg, #34D399, #10B981);
  --ring: rgba(16, 185, 129, .15);
  --ring-strong: rgba(16, 185, 129, .5);
  --shadow: 0 6px 20px rgba(16, 185, 129, .12);
  --shadow-lg: 0 12px 32px rgba(16, 185, 129, .18);
  --shadow-btn: 0 6px 16px rgba(16, 185, 129, .28);
  --shadow-nav: 0 4px 12px rgba(16, 185, 129, .3);
  --shadow-modal: 0 20px 50px rgba(16, 185, 129, .3);
  --slider-off: #C7E5D8;
  --dash-border: #A7E3C8;
  --dash-bg: #F2FDF8;
  --dash-bg-hover: #E4FBF0;
  --spark-bar: rgba(255, 255, 255, .4);
  --spark-latest: #fff;
  --brand-fill: #10B981;
}

/* 需要关注：2 个跨度上涨 → 深橙 */
body.theme-warn {
  --primary: #EA580C;
  --primary-deep: #C2410C;
  --primary-soft: #FDE3D1;
  --primary-grad: linear-gradient(135deg, #F97316, #EA580C);
  --ring: rgba(234, 88, 12, .15);
  --ring-strong: rgba(234, 88, 12, .5);
  --shadow: 0 6px 20px rgba(234, 88, 12, .12);
  --shadow-lg: 0 12px 32px rgba(234, 88, 12, .2);
  --shadow-btn: 0 6px 16px rgba(234, 88, 12, .3);
  --shadow-nav: 0 4px 12px rgba(234, 88, 12, .32);
  --shadow-modal: 0 20px 50px rgba(234, 88, 12, .32);
  --slider-off: #E5C6B0;
  --dash-border: #F2C6A0;
  --dash-bg: #FEF8F3;
  --dash-bg-hover: #FDEFE5;
  --spark-bar: rgba(255, 255, 255, .4);
  --spark-latest: #fff;
  --brand-fill: #EA580C;
}

/* 明显增长：≥3 个跨度上涨 → 红色系 */
body.theme-danger {
  --primary: #EF4444;
  --primary-deep: #B91C1C;
  --primary-soft: #FDE3E3;
  --primary-grad: linear-gradient(135deg, #F87171, #EF4444);
  --ring: rgba(239, 68, 68, .15);
  --ring-strong: rgba(239, 68, 68, .5);
  --shadow: 0 6px 20px rgba(239, 68, 68, .12);
  --shadow-lg: 0 12px 32px rgba(239, 68, 68, .2);
  --shadow-btn: 0 6px 16px rgba(239, 68, 68, .3);
  --shadow-nav: 0 4px 12px rgba(239, 68, 68, .32);
  --shadow-modal: 0 20px 50px rgba(239, 68, 68, .32);
  --slider-off: #E8C2C2;
  --dash-border: #F2B8B8;
  --dash-bg: #FEF6F6;
  --dash-bg-hover: #FDECEC;
  --spark-bar: rgba(255, 255, 255, .4);
  --spark-latest: #fff;
  --brand-fill: #EF4444;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  padding-bottom: calc(72px + env(safe-area-inset-bottom)); /* 给移动端底部Tab留空间 */
}
@media (min-width: 768px) { body { padding-bottom: 0; } }
/* 管理页无底部Tab，无需底部留白 */
body.admin-page { padding-bottom: 0; }

a { color: var(--primary-deep); }

/* ============ 顶部导航（桌面，仅 今日/历史 两项） ============ */
.topbar { display: none; }
@media (min-width: 768px) {
  .topbar {
    display: block;
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
  }
  .topbar-inner {
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--primary-deep); }
  .brand svg { flex-shrink: 0; }
  .brand .brand-ico path { fill: var(--brand-fill); }
  .topnav { display: flex; gap: 6px; }
  .topnav a {
    display: flex; align-items: center; gap: 7px;
    text-decoration: none; color: var(--muted); font-weight: 600; font-size: .95rem;
    padding: 9px 16px; border-radius: 999px; transition: all .2s;
  }
  .topnav a:hover { background: var(--primary-soft); color: var(--primary-deep); }
  .topnav a.active { background: var(--primary-grad); color: #fff; box-shadow: var(--shadow-nav); }
}

/* ============ 管理页顶栏（独立，无用户入口） ============ */
.admin-topbar { position: sticky; top: 0; z-index: 100; background: var(--primary-grad); color: #fff; box-shadow: var(--shadow-lg); }
.admin-topbar-inner {
  max-width: 1040px; margin: 0 auto; padding: 0 16px; min-height: 56px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
@media (min-width: 768px) { .admin-topbar-inner { padding: 0 24px; min-height: 64px; } }
.admin-topbar .brand { color: #fff; font-size: 1rem; }
.admin-topbar .brand svg { flex-shrink: 0; }
.admin-tag { font-size: .72rem; font-weight: 600; background: rgba(255, 255, 255, .2); padding: 3px 10px; border-radius: 999px; color: #fff; }
.admin-topbar .btn { width: auto; min-height: 36px; padding: 0 16px; font-size: .85rem; background: rgba(255, 255, 255, .2); color: #fff; box-shadow: none; }
.admin-topbar .btn:hover { background: rgba(255, 255, 255, .32); }

/* ============ 容器 & 页面标题 ============ */
.wrap { max-width: 1040px; margin: 0 auto; padding: 16px 16px 8px; }
@media (min-width: 768px) { .wrap { padding: 28px 24px 40px; } }

.page-title { display: none; }
@media (min-width: 768px) {
  .page-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
  .page-title h1 { font-size: 1.5rem; color: var(--text); }
  .page-title .date-chip { font-size: .85rem; color: var(--muted); background: #fff; border: 1px solid var(--border); padding: 6px 14px; border-radius: 999px; }
}

/* ============ 大数字 Hero 区 ============ */
.hero-dash {
  background: var(--primary-grad); border-radius: var(--radius);
  padding: 26px 22px; color: #fff; box-shadow: var(--shadow-lg);
  margin-bottom: 16px; position: relative; overflow: hidden;
}
.hero-dash::after { content: ""; position: absolute; right: -40px; top: -40px; width: 200px; height: 200px; border-radius: 50%; background: rgba(255, 255, 255, .1); }
.hero-dash::before { content: ""; position: absolute; right: 60px; bottom: -60px; width: 140px; height: 140px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.hero-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; position: relative; z-index: 1; }
.hero-top .greet { font-size: .9rem; color: rgba(255, 255, 255, .92); font-weight: 600; }
.hero-top .date-chip { background: rgba(255, 255, 255, .2); padding: 5px 12px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.hero-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; position: relative; z-index: 1; }
.hero-num { font-size: 2.4rem; font-weight: 800; line-height: 1.15; letter-spacing: -.02em; white-space: nowrap; }
@media (min-width: 768px) { .hero-num { font-size: 4rem; line-height: 1; } }
.hero-num small { font-size: 1rem; font-weight: 600; }
@media (min-width: 768px) { .hero-num small { font-size: 1.2rem; } }
.hero-trend { text-align: right; flex-shrink: 0; }
.t-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, .2); border-radius: 999px; padding: 7px 14px;
  font-weight: 800; font-size: 1.05rem; color: #fff;
}
.t-chip svg { flex-shrink: 0; }
.t-chip .t-label { font-size: .7rem; font-weight: 600; opacity: .92; }
.t-chip.up { background: rgba(255, 255, 255, .92); color: #C2410C; }
.t-chip.down { background: rgba(255, 255, 255, .92); color: #047857; }
.t-chip.flat { background: rgba(255, 255, 255, .25); color: #fff; }

/* 迷你趋势柱状图（div/i 模拟，非图表库） */
.spark { display: flex; align-items: flex-end; gap: 4px; height: 46px; margin-top: 18px; position: relative; z-index: 1; }
.spark i { flex: 1; min-width: 0; background: var(--spark-bar); border-radius: 4px 4px 0 0; height: 20%; transition: height .3s; }
.spark i.latest { background: var(--spark-latest); }

/* ============ 统计条 ============ */
.stat-strip { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 640px) { .stat-strip { grid-template-columns: repeat(4, 1fr); } }
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.stat-card .sl { font-size: .76rem; color: var(--muted); font-weight: 600; }
.stat-card .sv { font-size: 1.35rem; font-weight: 800; margin-top: 4px; line-height: 1.2; letter-spacing: -.01em; }
.stat-card .sv small { font-size: .7rem; color: var(--muted); font-weight: 500; }
.stat-card .ss { font-size: .72rem; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card.down .sv { color: var(--success); }
.stat-card.down { background: linear-gradient(180deg, #fff, #F0FDF4); border-color: #A7F3D0; }
.stat-card.up { background: linear-gradient(180deg, #fff, #FFF7ED); border-color: #FED7AA; }
.stat-card.up .sv { color: var(--danger); }
.stat-card.up .sl { color: var(--warn); }
.stat-card.flat .sv { color: var(--muted); }

/* ============ 卡片区块 ============ */
.section {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 18px; margin-bottom: 16px;
}
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-head h2 { font-size: 1.1rem; display: flex; align-items: center; gap: 9px; }
.section-head h2 .ico {
  width: 32px; height: 32px; border-radius: 10px; background: var(--primary-soft);
  display: flex; align-items: center; justify-content: center; color: var(--primary-deep); flex-shrink: 0;
}
.section-head .more { font-size: .8rem; color: var(--muted); text-decoration: none; }

/* 双栏：左表单 右最近记录 */
.dash-cols { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 900px) { .dash-cols { grid-template-columns: 1fr 1fr; align-items: start; } }

/* ============ 表单 ============ */
.form-group { margin-bottom: 16px; }
label { display: block; margin-bottom: 7px; font-weight: 600; font-size: .92rem; }
.required { color: var(--danger); }
.hint { font-size: .78rem; color: var(--muted); margin-top: 6px; }
input[type=text], input[type=number], input[type=password], input[type=date], textarea, select {
  width: 100%; padding: 13px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 16px; font-family: var(--font);
  color: var(--text); background: #FEFDFC; transition: all .2s; outline: none;
}
textarea { resize: vertical; min-height: 76px; }
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); background: #fff; }

.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px dashed var(--border); }
.switch-row:last-child { border-bottom: none; }
.switch-row .txt { font-weight: 600; font-size: .92rem; }
.switch-row .txt small { display: block; font-weight: 400; color: var(--muted); font-size: .75rem; }
.switch { position: relative; width: 50px; height: 30px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: var(--slider-off); border-radius: 30px; transition: .25s; cursor: pointer; }
.slider:before { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .25s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider:before { transform: translateX(20px); }

/* 上传区 */
.upload-zone {
  border: 2px dashed var(--dash-border); border-radius: var(--radius-sm); background: var(--dash-bg);
  padding: 18px; text-align: center; cursor: pointer; transition: all .2s; color: var(--muted);
}
.upload-zone:hover { border-color: var(--primary); background: var(--dash-bg-hover); }
.upload-zone .u-ico { width: 44px; height: 44px; margin: 0 auto 8px; border-radius: 14px; background: var(--primary-soft); display: flex; align-items: center; justify-content: center; color: var(--primary-deep); }
.upload-zone b { color: var(--primary-deep); }

/* ============ 按钮 ============ */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 52px; border: none; border-radius: var(--radius-sm);
  font-size: 1.02rem; font-weight: 700; font-family: var(--font);
  background: var(--primary-grad); color: #fff; cursor: pointer; transition: all .2s;
  box-shadow: var(--shadow-btn); text-decoration: none;
}
.btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn:active { transform: scale(.98); }
.btn-ghost { background: #fff; color: var(--primary-deep); border: 1.5px solid var(--border); box-shadow: none; min-height: 44px; }
.btn-sm { width: auto; min-height: 40px; padding: 0 16px; font-size: .88rem; box-shadow: none; }
.btn-danger { background: var(--danger); box-shadow: 0 6px 16px rgba(239, 68, 68, .25); }
.btn-test { background: var(--accent); box-shadow: 0 6px 16px rgba(217, 119, 6, .28); }
.btn-test:hover { filter: brightness(1.05); }

.form-actions { display: flex; gap: 12px; margin-top: 4px; }
.form-actions .btn { flex: 1; }

/* ============ 最近记录 / 月度列表（迷你卡） ============ */
.mini-list { display: flex; flex-direction: column; gap: 8px; }
.mini-card { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--border); }
.mini-card:last-child { border-bottom: none; }
.mini-date { width: 46px; flex-shrink: 0; text-align: center; background: var(--primary-soft); border-radius: 12px; padding: 5px 0; color: var(--primary-deep); }
.mini-date .d { font-size: .95rem; font-weight: 800; line-height: 1.2; }
.mini-date .m { font-size: .62rem; font-weight: 600; }
.mini-info { flex: 1; min-width: 0; }
.mini-info .w { font-weight: 800; font-size: 1rem; }
.mini-info .p { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-info .p-multi { font-size: .8rem; color: var(--muted); margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.mini-info .n { font-size: .78rem; color: var(--muted); margin-top: 2px; word-break: break-word; }
.p-multi-inline { white-space: pre-wrap; word-break: break-word; }
.mini-status { display: flex; gap: 4px; flex-shrink: 0; margin-top: 2px; }
.dot { width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .62rem; font-weight: 800; }
.dot.ok { background: var(--success-bg); color: var(--success); }
.dot.no { background: var(--danger-bg); color: var(--danger); }
.dot.warn { background: var(--warn-bg); color: var(--warn); }
.see-all { margin-top: 12px; }

/* 历史页月度分组 */
.month-group { margin-bottom: 18px; }
.month-header { display: flex; align-items: center; gap: 10px; font-size: 1rem; color: var(--primary-deep); font-weight: 700; margin-bottom: 6px; }
.month-header::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* 历史页记录（保留完整徽章文字：任务✓/✗、运动✓/✗、进食超额/正常） */
.hist-mini { align-items: flex-start; }
.hist-mini .mini-info .w { color: var(--primary-deep); }
.hist-mini .mini-badges { margin-top: 6px; }
.hist-mini .mini-badges .badge { font-size: .72rem; padding: 3px 9px; }

.tag { display: inline-block; background: var(--primary-grad); color: #fff; font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-right: 6px; vertical-align: middle; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 600; padding: 4px 11px; border-radius: 999px; }
.badge.ok { background: var(--success-bg); color: var(--success); }
.badge.no { background: var(--danger-bg); color: var(--danger); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.load-more { display: flex; justify-content: center; margin-top: 14px; }
.no-records { text-align: center; color: var(--muted); padding: 32px 0; }

/* 照片 */
.record-photo { margin-top: 8px; }
.photo-thumbnail { width: 100%; max-width: 240px; height: auto; max-height: 300px; object-fit: cover; border-radius: var(--radius-sm); cursor: pointer; box-shadow: var(--shadow); display: block; }
.load-image-btn {
  width: 100%; background: var(--dash-bg-hover); border: 1.5px dashed var(--dash-border); border-radius: var(--radius-sm);
  color: var(--primary-deep); font-size: .85rem; font-weight: 600; padding: 9px; cursor: pointer; min-height: 42px;
  transition: all .2s;
}
.load-image-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.current-photo { margin-bottom: 10px; }
.photo-preview { border-radius: var(--radius-sm); object-fit: cover; box-shadow: var(--shadow); }

/* ============ 历史页 Hero 数据小卡 ============ */
.hist-hero { padding: 22px 20px; }
.hist-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; position: relative; z-index: 1; margin-top: 14px; }
@media (min-width: 640px) { .hist-stats { grid-template-columns: repeat(4, 1fr); } }
.glass-card { background: rgba(255, 255, 255, .18); border-radius: 14px; padding: 12px 14px; text-align: center; backdrop-filter: blur(4px); }
.glass-card .gl { font-size: .72rem; color: rgba(255, 255, 255, .9); font-weight: 600; }
.glass-card .gv { font-size: 1.35rem; font-weight: 800; color: #fff; line-height: 1.25; margin-top: 2px; }
.glass-card .gv small { font-size: .72rem; font-weight: 500; opacity: .85; }
.glass-card.up .gv { color: #FFE0D1; }
.glass-card.down .gv { color: #D9FBE9; }
.glass-card.flat .gv { color: #fff; }

/* ============ 管理 ============ */
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.admin-toolbar h2 { font-size: 1.05rem; }
.admin-tabs { display: flex; gap: 8px; margin-bottom: 16px; background: var(--primary-soft); padding: 6px; border-radius: 14px; }
.admin-tab { flex: 1; text-align: center; text-decoration: none; color: var(--muted); padding: 9px 12px; border-radius: 10px; font-size: .92rem; font-weight: 600; transition: all .2s; }
.admin-tab.active, .admin-tab:hover { background: var(--primary-grad); color: #fff; box-shadow: var(--shadow-nav); }

.admin-list { display: flex; flex-direction: column; gap: 10px; }
.admin-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
}
.admin-card-title { font-weight: 700; font-size: .95rem; color: var(--primary-deep); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-weight { color: var(--text); font-weight: 700; }
.admin-card-plan, .admin-card-note { font-size: .85rem; color: var(--text); word-break: break-word; }
.admin-card-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.admin-card-actions form { flex: 1; min-width: 0; }
.admin-card-actions .btn { flex: 1; }

.login-section { max-width: 400px; margin: 1.5rem auto; }
.login-form { width: 100%; }

/* 通知渠道 */
.notify-card { gap: 8px; }
.type-badge, .status-badge { display: inline-flex; align-items: center; font-size: .72rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; }
.type-qmsg { background: var(--success-bg); color: var(--success); }
.type-pushplus { background: var(--warn-bg); color: var(--warn); }
.type-wxpusher { background: var(--primary-soft); color: var(--primary-deep); }
.status-badge.on { background: var(--success-bg); color: var(--success); }
.status-badge.off { background: #F1E6DB; color: var(--muted); }
.param-summary { font-family: Consolas, Monaco, monospace; font-size: .8rem; letter-spacing: .02em; color: var(--muted); word-break: break-word; }

.field-group { display: none; }
.field-group.active { display: block; }

/* ============ 提示横幅 ============ */
.error-message { background: var(--danger-bg); color: var(--danger); border: 1px solid #FECACA; border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 16px; font-size: .9rem; display: flex; align-items: center; gap: 8px; }
.flash-success { background: var(--success-bg); color: var(--success); border: 1px solid #A7F3D0; border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 16px; font-size: .9rem; display: flex; align-items: center; gap: 8px; }

/* ============ 模态框 ============ */
.modal {
  display: none; position: fixed; inset: 0; background: rgba(74, 44, 23, .5);
  z-index: 1000; align-items: center; justify-content: center; padding: 20px;
}
.modal[style*="display: block"], .modal[style*="display:flex"], .modal[style*="display: flex"] { display: flex !important; }
.modal.visible { display: flex !important; }
.modal-content { background: #fff; padding: 22px; border-radius: var(--radius); width: 100%; max-width: 380px; position: relative; box-shadow: var(--shadow-modal); }
.modal-content h3 { text-align: center; margin-bottom: 18px; color: var(--text); }
.close-btn { position: absolute; top: 12px; right: 12px; font-size: 24px; font-weight: 700; color: var(--muted); cursor: pointer; background: var(--bg); width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.close-btn:hover { background: var(--primary-soft); color: var(--primary-deep); }
.modal-btn { width: 100%; margin-bottom: 10px; background: var(--primary-grad); color: #fff; border: none; cursor: pointer; min-height: 50px; font-size: 1rem; font-weight: 700; border-radius: var(--radius-sm); font-family: var(--font); }
.modal-btn:last-child { margin-bottom: 0; }
.modal-btn.cancel { background: var(--bg); color: var(--text); }
#modalImg { max-width: 100%; max-height: 80vh; object-fit: contain; display: block; margin: 0 auto; border-radius: var(--radius-sm); }

/* ============ 移动端底部 Tab（仅 今日/历史 两项） ============ */
.bottomnav { display: none; }
@media (max-width: 767px) {
  .bottomnav {
    display: block;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px);
    border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
  }
  .bottomnav-inner { display: flex; max-width: 480px; margin: 0 auto; }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 7px; text-decoration: none; color: var(--muted); font-size: .68rem; font-weight: 600; transition: color .2s; }
  .bottomnav a svg { width: 24px; height: 24px; }
  .bottomnav a.active { color: var(--primary-deep); }
  .bottomnav a.active svg circle, .bottomnav a.active svg path { stroke: var(--primary-deep); fill: var(--primary-deep); }
}

/* ============ 可访问性 ============ */
:focus-visible { outline: 3px solid var(--ring-strong); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
