/* ==========================================================================
   Personal Life OS — style.css
   绿色 iOS / Liquid Glass 视觉系统
   目录：
   01 设计令牌   02 基础重置   03 环境背景   04 排版
   05 外壳布局   06 侧边栏     07 底部导航   08 页面/顶栏
   09 卡片       10 列表行     11 按钮       12 表单
   13 分段控件   14 面板/弹窗  15 图表       16 状态
   17 响应式     18 深色模式   19 玻璃降级   20 工具类
   ========================================================================== */

/* ---------- 01 设计令牌 ---------- */
:root {
  /* 品牌：薄荷绿系统（主色 E8FFE8，交互色用深绿保证可读） */
  --brand: #E8FFE8;
  --brand-2: #D2FAD9;
  --green: #1F8A4C;
  --green-dark: #166B3C;
  --green-deep: #0C3A24;
  --green-light: #E8FFE8;
  --mint: #F3FFF4;

  /* 表面与文字 */
  --bg: #F2FBF3;
  --surface: #FFFFFF;
  --surface-2: #F0FAF3;
  --surface-3: #E9F5EC;
  --text: #12261A;
  --text-2: #6B7F73;
  --text-3: #97A79B;
  --line: rgba(12, 58, 36, 0.08);
  --line-strong: rgba(12, 58, 36, 0.15);

  /* 语义色 */
  --danger: #DC2626;
  --warn: #D97706;
  --info: #2563EB;
  --violet: #7C3AED;

  /* 玻璃：薄荷染色 + 分层高光 */
  --glass-bg: rgba(255, 255, 255, 0.70);
  --glass-bg-strong: rgba(255, 255, 255, 0.88);
  --glass-tint: rgba(232, 255, 232, 0.62);
  --glass-border: rgba(255, 255, 255, 0.72);
  --glass-blur: 26px;
  --glass-shadow: 0 16px 44px -20px rgba(8, 46, 26, 0.26), 0 2px 10px -6px rgba(8, 46, 26, 0.12);
  --glass-sheen:
    inset 0 1px 0 rgba(255, 255, 255, 0.94),
    inset 0 -1px 0 rgba(12, 58, 36, 0.05),
    inset 0 0 0 1px rgba(12, 58, 36, 0.05);

  /* 阴影 */
  --shadow-sm: 0 1px 2px rgba(10, 40, 26, 0.05);
  --shadow: 0 1px 2px rgba(10, 40, 26, 0.05), 0 10px 28px -16px rgba(10, 40, 26, 0.22);
  --shadow-lg: 0 20px 60px -24px rgba(10, 40, 26, 0.34);

  /* 形状 */
  --r-xs: 10px;
  --r-sm: 14px;
  --r: 18px;
  --r-lg: 24px;
  --r-pill: 999px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro SC", "PingFang SC",
          "Segoe UI", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-num: "SF Pro Display", -apple-system, "Segoe UI", system-ui, sans-serif;

  --tabbar-h: 62px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  /* 内容列宽：随断点变化，FAB / 顶栏都锚在这条列上 */
  --content-max: 720px;
}

/* ---------- 02 基础重置 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; -webkit-appearance: none; }
a { color: var(--green-dark); text-decoration: none; }
img { max-width: 100%; display: block; }
svg { display: block; }
[hidden] { display: none !important; }

::selection { background: var(--green-light); color: var(--green-deep); }

/* ---------- 03 环境背景 ---------- */
body {
  background-image:
    radial-gradient(1200px 700px at 4% -10%, rgba(200, 255, 208, 0.55), transparent 60%),
    radial-gradient(900px 560px at 104% 0%, rgba(232, 255, 232, 0.66), transparent 62%),
    radial-gradient(1000px 780px at 58% 114%, rgba(31, 138, 76, 0.10), transparent 66%);
  background-attachment: fixed;
  background-repeat: no-repeat;
}

/* ---------- 04 排版 ---------- */
.t-title { font-size: 22px; font-weight: 700; letter-spacing: -0.022em; }
.t-h2 { font-size: 17px; font-weight: 650; letter-spacing: -0.012em; }
.t-h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.008em; }
.t-body { font-size: 15px; }
.t-sm { font-size: 13.5px; }
.t-xs { font-size: 12px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.strike { text-decoration: line-through; text-decoration-thickness: 1.5px; text-decoration-color: var(--text-3); }

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 26px 4px 10px;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}
.section-title .act { font-size: 12.5px; letter-spacing: 0; text-transform: none; color: var(--green-dark); font-weight: 600; }

/* ---------- 05 外壳布局 ---------- */
.app { min-height: 100%; }
.main {
  min-height: 100dvh;
  padding: 0;
  position: relative;
  z-index: 1;
}
.page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--tabbar-h) + 34px + env(safe-area-inset-bottom));
  animation: pageIn 0.28s var(--ease) both;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.content {
  flex: 1;
  padding: 4px 16px 0;
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
}

/* ---------- 06 侧边栏 ---------- */
.sidebar { display: none; }

/* ---------- 07 底部导航（悬浮薄荷玻璃胶囊） ---------- */
.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(10px + env(safe-area-inset-bottom));
  width: min(calc(100% - 20px), 440px);
  min-height: var(--tabbar-h);
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 7px;
  border-radius: var(--r-lg);
  z-index: 30;
  /* 薄荷玻璃：底色层 + 染色层 + 背景虚化 + 分层高光，少一层就会“透得发廉价” */
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.74)),
    radial-gradient(120% 180% at 50% 0%, var(--glass-tint), transparent 72%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(190%);
  backdrop-filter: blur(var(--glass-blur)) saturate(190%);
  box-shadow:
    0 22px 50px -20px rgba(8, 46, 26, 0.40),
    0 4px 14px -8px rgba(8, 46, 26, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.98),
    inset 0 -1px 0 rgba(12, 58, 36, 0.07),
    inset 0 0 0 1px rgba(12, 58, 36, 0.08);
  transition: transform 0.34s var(--ease), opacity 0.24s ease;
}
/* 上沿折射亮线：1px 渐变描边，模拟液面高光 */
.tabbar::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.14) 44%, rgba(31, 138, 76, 0.10));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}
.tabbar.hide { transform: translate(-50%, 140%); opacity: 0; pointer-events: none; }

/* 底部渐隐托底：内容滚到导航后面时自然过渡，不再“字贴玻璃” */
.tabbar-scrim {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--tabbar-h) + 46px + env(safe-area-inset-bottom));
  z-index: 29;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(242, 251, 243, 0) 0%, rgba(242, 251, 243, 0.78) 52%, var(--bg) 92%);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 46px;
  border-radius: 16px;
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 550;
  letter-spacing: 0.01em;
  transition: color 0.2s ease, background 0.24s var(--ease), transform 0.2s var(--ease), box-shadow 0.24s ease;
  position: relative;
}
.tab svg { width: 21px; height: 21px; opacity: 0.88; }
.tab:active { transform: scale(0.94); }
.tab.on {
  color: var(--green-deep);
  background: linear-gradient(180deg, #FFFFFF 0%, var(--brand) 62%, #D8FBDD 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.98),
    inset 0 0 0 1px rgba(31, 138, 76, 0.22),
    0 8px 18px -10px rgba(31, 138, 76, 0.45);
}
.tab.on svg { opacity: 1; color: var(--green-dark); }
.tab.on::after {
  content: "";
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(31, 138, 76, 0), rgba(31, 138, 76, 0.55), rgba(31, 138, 76, 0));
}

/* FAB：薄荷实心 + 墨绿图标，与主色一致 */
.fab {
  position: fixed;
  right: max(16px, calc((100vw - var(--content-max)) / 2 + 18px));
  bottom: calc(var(--tabbar-h) + 22px + env(safe-area-inset-bottom));
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--green-deep);
  background: linear-gradient(160deg, #F5FFF6, var(--brand-2) 78%);
  box-shadow:
    0 16px 34px -12px rgba(8, 46, 26, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    inset 0 0 0 1px rgba(31, 138, 76, 0.18);
  z-index: 31;
  transition: transform 0.22s var(--ease), box-shadow 0.22s ease, opacity 0.2s ease;
}
.fab svg { width: 22px; height: 22px; }
.fab:active { transform: scale(0.9); }
.fab.hide { opacity: 0; pointer-events: none; transform: scale(0.6); }

/* ---------- 08 页面 / 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, rgba(242, 251, 243, 0.94), rgba(242, 251, 243, 0.76));
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.topbar.scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 8px 24px -20px rgba(8, 46, 26, 0.3);
}
.topbar-inner {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar .grow { flex: 1; min-width: 0; }
.topbar .sub { font-size: 12.5px; color: var(--text-2); margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
  transition: transform 0.18s var(--ease), background 0.18s ease, color 0.18s ease;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:active { transform: scale(0.92); }
.icon-btn:hover { color: var(--green-dark); background: #fff; }

/* 日期导航 */
.datenav { display: flex; align-items: center; gap: 6px; }
.datenav .date-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 2px 4px;
  border-radius: 10px;
}
.datenav .date-label:active { background: var(--surface-3); }
.datenav .d1 { font-size: 17px; font-weight: 680; letter-spacing: -0.02em; }
.datenav .d2 { font-size: 12px; color: var(--text-2); }

/* ---------- 09 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card + .card { margin-top: 12px; }
.card-pad { padding: 16px; }
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.card-head .t-h3 { flex: 1; min-width: 0; }

/* hero 玻璃卡 */
.hero {
  position: relative;
  border-radius: var(--r-lg);
  padding: 18px 18px 16px;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(148deg, #FFFFFF 0%, var(--brand) 46%, #CFF9D6 100%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(190%);
  backdrop-filter: blur(var(--glass-blur)) saturate(190%);
  border: 1px solid rgba(31, 138, 76, 0.14);
  box-shadow: var(--glass-shadow), var(--glass-sheen);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.55), transparent 42%, transparent 68%, rgba(31, 138, 76, 0.06));
  pointer-events: none;
  z-index: -1;
}
.hero .hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hero .hero-kicker { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--green-dark); }
.hero .hero-num { font-size: 34px; font-weight: 680; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hero .hero-num small { font-size: 14px; font-weight: 550; color: var(--text-2); letter-spacing: 0; margin-left: 4px; }

/* 统计网格 */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat {
  padding: 13px 14px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.stat .k { font-size: 11.5px; color: var(--text-2); letter-spacing: 0.02em; }
.stat .v { font-size: 22px; font-weight: 660; letter-spacing: -0.028em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 12px; color: var(--text-2); font-weight: 500; margin-left: 2px; letter-spacing: 0; }
.stat .sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.stat.accent { background: linear-gradient(160deg, var(--mint), #fff 70%); border-color: rgba(31, 138, 76, 0.18); }
.stat.accent .v { color: var(--green-deep); }

/* ---------- 10 列表行 ---------- */
.row-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background 0.16s ease;
  position: relative;
}
.row-item:last-child { border-bottom: 0; }
.row-item:active { background: var(--surface-2); }
.row-item .body { flex: 1; min-width: 0; }
.row-item .r1 { display: flex; align-items: center; gap: 8px; }
.row-item .r2 { display: flex; align-items: center; gap: 8px; margin-top: 3px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.row-item .title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-item.done .title { color: var(--text-2); text-decoration: line-through; text-decoration-thickness: 1.5px; text-decoration-color: var(--text-3); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex-shrink: 0; }

.check {
  width: 26px; height: 26px;
  border-radius: 9px;
  border: 1.5px solid var(--line-strong);
  display: grid; place-items: center;
  flex-shrink: 0;
  margin-top: 1px;
  transition: all 0.2s var(--ease);
  background: #fff;
}
.check svg { width: 15px; height: 15px; color: #fff; opacity: 0; transform: scale(0.6); transition: all 0.2s var(--ease); }
.check.on { background: var(--green); border-color: var(--green); box-shadow: 0 2px 8px -2px rgba(31, 138, 76, 0.5); }
.check.on svg { opacity: 1; transform: none; }
.check:active { transform: scale(0.9); }

/* 次要标签 */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 550;
  color: var(--text-2);
  background: var(--surface-3);
  white-space: nowrap;
}
.tag.green { color: var(--green-deep); background: var(--green-light); }
.tag.warn { color: #92400E; background: #FEF3C7; }
.tag.danger { color: #991B1B; background: #FEE2E2; }
.tag.info { color: #1E40AF; background: #DBEAFE; }
.tag.violet { color: #5B21B6; background: #EDE9FE; }
.tag.area { color: var(--tag-fg, var(--text-2)); background: var(--tag-bg, var(--surface-3)); }
.tag.plain { background: transparent; padding: 0; color: var(--text-3); }

/* 进度条 */
.progress {
  height: 6px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #34D399, var(--green));
  transition: width 0.5s var(--ease);
}
.progress.sm { height: 5px; }

/* 环形进度 */
.ring { position: relative; width: 68px; height: 68px; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; }
.ring .val {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 680;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* 键值表 */
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 8px 12px; font-size: 13.5px; }
.kv .k { color: var(--text-2); }
.kv .v { color: var(--text); word-break: break-word; }

/* ---------- 11 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  border: 1px solid transparent;
  transition: transform 0.18s var(--ease), background 0.18s ease, opacity 0.18s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.btn svg { width: 17px; height: 17px; }

.btn.primary {
  color: #fff;
  background: linear-gradient(160deg, #22C55E, #166B3C);
  box-shadow: 0 8px 20px -10px rgba(22, 107, 60, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.btn.primary:hover { filter: brightness(1.03); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.btn.ghost { color: var(--green-dark); background: rgba(31, 138, 76, 0.08); }
.btn.danger { color: var(--danger); background: rgba(220, 38, 38, 0.08); }
.btn.danger.solid { color: #fff; background: linear-gradient(160deg, #EF4444, #DC2626); box-shadow: 0 8px 20px -10px rgba(220, 38, 38, 0.6); }
.btn.block { width: 100%; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 11px; }
.btn.sm svg { width: 15px; height: 15px; }

.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex: 1; }

/* 快捷操作条 */
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 13px 4px 11px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  font-size: 12px;
  font-weight: 550;
  transition: transform 0.18s var(--ease), background 0.18s ease;
}
.quick:active { transform: scale(0.95); background: var(--mint); }
.quick .ic {
  width: 32px; height: 32px;
  border-radius: 11px;
  display: grid; place-items: center;
  background: var(--green-light);
  color: var(--green-deep);
}
.quick .ic svg { width: 17px; height: 17px; }

/* ---------- 12 表单 ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); letter-spacing: 0.01em; }
.field .hint { font-size: 11.5px; color: var(--text-3); }

.input, .select, .textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border-radius: 13px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  -webkit-appearance: none;
  appearance: none;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 138, 76, 0.14);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.textarea { min-height: 92px; resize: vertical; line-height: 1.55; }

/* 搜索栏：独立玻璃条，图标固定 18px（之前 SVG 无固有尺寸会撑满整行） */
.searchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 12px 0 14px;
  border-radius: 15px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(243, 255, 244, 0.9));
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 2px 10px -8px rgba(8, 46, 26, 0.28);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.searchbar:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 138, 76, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.searchbar-ico {
  width: 18px;
  height: 18px;
  flex: none;
  display: grid;
  place-items: center;
  color: var(--text-3);
}
.searchbar-ico svg { width: 18px; height: 18px; }
.searchbar input,
.searchbar .input {
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 14.5px;
}
.searchbar input:focus { box-shadow: none; }
.searchbar-clear {
  width: 26px;
  height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text-2);
  background: var(--surface-3);
}
.searchbar-clear svg { width: 13px; height: 13px; }
.searchbar-clear:active { transform: scale(0.9); }
.select {
  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.5L6 6.5L11 1.5' stroke='%23718078' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.input[type="date"], .input[type="time"] { min-height: 46px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-grid .field.full { grid-column: 1 / -1; }

.seg {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 13px;
  background: var(--surface-3);
}
.seg > button {
  flex: 1;
  min-height: 36px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  transition: all 0.2s var(--ease);
}
.seg > button.on {
  background: #fff;
  color: var(--green-deep);
  box-shadow: 0 1px 3px rgba(10, 40, 26, 0.12);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 13px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 13px;
  font-weight: 550;
  color: var(--text-2);
  transition: all 0.18s var(--ease);
}
.chip.on { border-color: var(--green); background: var(--green-light); color: var(--green-deep); }
.chip:active { transform: scale(0.96); }
.chip .x { color: var(--text-3); font-size: 15px; line-height: 1; }

.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--surface-3);
  display: grid; place-items: center;
  font-size: 19px;
  font-weight: 600;
  color: var(--text-2);
}
.stepper button:active { background: var(--green-light); color: var(--green-deep); }
.stepper .val { flex: 1; text-align: center; font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; }

/* 星级 */
.stars { display: flex; gap: 7px; }
.stars button {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  color: var(--text-3);
  transition: transform 0.16s var(--ease), color 0.16s ease;
}
.stars button svg { width: 21px; height: 21px; }
.stars button.on { color: var(--green); }
.stars button:active { transform: scale(0.88); }

/* ---------- 13 面板 / 弹窗 ---------- */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(16, 30, 22, 0.36);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  z-index: 40;
  opacity: 0;
  transition: opacity 0.28s ease;
}
.scrim.on { opacity: 1; }

.sheet-root { position: fixed; inset: 0; z-index: 50; pointer-events: none; }

.sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 100%);
  width: min(100%, 560px);
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid var(--glass-border);
  border-bottom: 0;
  box-shadow: 0 -20px 60px -20px rgba(10, 40, 26, 0.4), var(--glass-sheen);
  pointer-events: auto;
  transition: transform 0.4s var(--ease);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet.on { transform: translate(-50%, 0); }
.sheet.wide { width: min(100%, 720px); }

.sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.sheet-head .grow { flex: 1; min-width: 0; }
.sheet-title { font-size: 16px; font-weight: 680; letter-spacing: -0.015em; }
.sheet-sub { font-size: 12.5px; color: var(--text-2); margin-top: 1px; }
.sheet-body {
  padding: 16px 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.sheet-foot {
  padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
.sheet-foot > .btn { flex: 1; }
.sheet .grab {
  width: 38px; height: 5px;
  border-radius: 99px;
  background: var(--line-strong);
  margin: 8px auto 0;
  flex-shrink: 0;
}

/* dialog */
.dialog-wrap {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 30, 22, 0.34);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease both;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.dialog {
  width: min(100%, 360px);
  border-radius: 20px;
  padding: 22px 20px 16px;
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg), var(--glass-sheen);
  animation: popIn 0.3s var(--ease) both;
  text-align: center;
}
@keyframes popIn { from { opacity: 0; transform: scale(0.94) } to { opacity: 1; transform: none } }
.dialog .d-title { font-size: 16px; font-weight: 680; }
.dialog .d-msg { font-size: 13.5px; color: var(--text-2); margin-top: 6px; line-height: 1.55; }
.dialog .d-actions { display: flex; gap: 10px; margin-top: 18px; }
.dialog .d-actions > .btn { flex: 1; }

/* toast */
.toast-root {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 40px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: min(calc(100% - 32px), 420px);
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 100%;
  padding: 11px 16px;
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--text);
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  animation: toastIn 0.3s var(--ease) both;
}
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast.ok svg { color: var(--green); }
.toast.err svg { color: var(--danger); }
.toast.out { animation: toastOut 0.24s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(0.96) } to { opacity: 1; transform: none } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px) scale(0.96) } }

/* ---------- 14 图表 ---------- */
.chart { width: 100%; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .bar { fill: var(--green); opacity: 0.85; transition: opacity 0.2s ease; }
.chart .bar.zero { fill: var(--surface-3); opacity: 1; }
.chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .lbl { font-size: 10px; fill: var(--text-3); text-anchor: middle; }
.chart .lbl-y { font-size: 10px; fill: var(--text-3); text-anchor: end; }

.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 12px; }
.legend .item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.legend .sw { width: 9px; height: 9px; border-radius: 50%; }

/* 迷你趋势条 */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 34px; }
.spark i {
  flex: 1;
  border-radius: 3px 3px 2px 2px;
  background: var(--green-light);
  min-height: 3px;
  transition: height 0.4s var(--ease);
}
.spark i.hot { background: var(--green); }

/* ---------- 15 状态 ---------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 34px 24px;
  color: var(--text-2);
}
.empty .ic {
  width: 54px; height: 54px;
  border-radius: 18px;
  display: grid; place-items: center;
  background: var(--green-light);
  color: var(--green-dark);
}
.empty .ic svg { width: 26px; height: 26px; }
.empty .et { font-size: 15px; font-weight: 620; color: var(--text); }
.empty .ed { font-size: 13px; max-width: 300px; line-height: 1.6; }

.loading { display: grid; place-items: center; gap: 12px; padding: 48px 0; color: var(--text-2); font-size: 13px; }
.spinner {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2.5px solid var(--green-light);
  border-top-color: var(--green);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

.skeleton {
  border-radius: 12px;
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  height: 14px;
}
@keyframes shimmer { to { background-position: -200% 0 } }

/* ---------- 16 响应式 ---------- */
@media (max-width: 380px) {
  .content { padding-left: 12px; padding-right: 12px; }
  .quick-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .stat .v { font-size: 20px; }
  .hero .hero-num { font-size: 30px; }
}

/* 平板：≥ 700px */
@media (min-width: 700px) {
  :root { --content-max: 860px; }
  .content { padding-left: 24px; padding-right: 24px; }
  .topbar { padding-left: 24px; padding-right: 24px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
  .two-col > .card + .card, .two-col > .card { margin-top: 0; }
  .tabbar { width: min(calc(100% - 48px), 520px); }
}

/* 桌面：≥ 1000px，侧边栏布局 */
@media (min-width: 1000px) {
  :root { --content-max: 1020px; }
  body { background-attachment: fixed; }
  .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 16px;
    top: 16px;
    bottom: 16px;
    width: 236px;
    border-radius: var(--r-lg);
    padding: 18px 12px;
    gap: 6px;
    z-index: 30;
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow), var(--glass-sheen);
    overflow-y: auto;
  }
  .sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 16px; }
  .sidebar .brand .mark {
    width: 34px; height: 34px; border-radius: 11px;
    display: grid; place-items: center;
    background: linear-gradient(160deg, #22C55E, #166B3C);
    color: #fff; font-size: 15px; font-weight: 700;
    box-shadow: 0 6px 16px -8px rgba(22, 107, 60, 0.8);
  }
  .sidebar .brand .nm { font-size: 14.5px; font-weight: 680; letter-spacing: -0.01em; line-height: 1.25; }
  .sidebar .brand .sb { font-size: 11px; color: var(--text-3); }
  .sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    color: var(--text-2);
    font-size: 14px;
    font-weight: 550;
    transition: all 0.18s ease;
  }
  .sidebar .nav-item svg { width: 18px; height: 18px; }
  .sidebar .nav-item:hover { background: rgba(255, 255, 255, 0.6); color: var(--text); }
  .sidebar .nav-item.on { background: rgba(31, 138, 76, 0.1); color: var(--green-deep); font-weight: 620; }
  .sidebar .spacer { flex: 1; }
  .sidebar .nav-item.sub-item { font-size: 13px; opacity: 0.9; }

  .main { margin-left: 268px; }
  .tabbar { display: none; }
  .tabbar-scrim { display: none; }
  .fab { right: 40px; bottom: 40px; width: 58px; height: 58px; }
  .page { padding-bottom: 40px; }
  .toast-root { bottom: 40px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }

  .sheet {
    left: auto;
    right: 24px;
    bottom: 24px;
    transform: translate(0, calc(100% + 30px)) scale(0.98);
    border-radius: var(--r-lg);
    border-bottom: 1px solid var(--glass-border);
    max-height: calc(100dvh - 48px);
    width: min(520px, calc(100vw - 48px));
  }
  .sheet.on { transform: none; }
  .sheet.wide { width: min(760px, calc(100vw - 48px)); }
}

/* ---------- 17 深色模式 ---------- */
[data-theme="dark"] {
  --green: #34D399;
  --green-dark: #6EE7B7;
  --green-deep: #A7F3D0;
  --green-light: rgba(52, 211, 153, 0.16);
  --mint: rgba(52, 211, 153, 0.07);

  --bg: #0C1310;
  --surface: #151E19;
  --surface-2: #1A241E;
  --surface-3: #202C25;
  --text: #E8F1EA;
  --text-2: #93A69A;
  --text-3: #6E8278;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);

  --danger: #F87171;
  --warn: #FBBF24;

  --glass-bg: rgba(20, 29, 24, 0.72);
  --glass-bg-strong: rgba(23, 33, 28, 0.9);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-sheen: inset 0 1px 0 rgba(255, 255, 255, 0.10), inset 0 -1px 0 rgba(255, 255, 255, 0.04);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -18px rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 24px 70px -28px rgba(0, 0, 0, 0.75);
}
[data-theme="dark"] body {
  background-image:
    radial-gradient(1100px 620px at 6% -8%, rgba(31, 138, 76, 0.20), transparent 62%),
    radial-gradient(880px 520px at 102% 2%, rgba(52, 211, 153, 0.12), transparent 64%),
    radial-gradient(1000px 760px at 62% 112%, rgba(12, 58, 36, 0.22), transparent 66%);
}
[data-theme="dark"] .topbar {
  background: linear-gradient(180deg, rgba(12, 19, 16, 0.94), rgba(12, 19, 16, 0.76));
}
[data-theme="dark"] .tab.on {
  color: #E8FFE8;
  background: linear-gradient(180deg, rgba(232, 255, 232, 0.20), rgba(232, 255, 232, 0.10));
  box-shadow:
    inset 0 1px 0 rgba(232, 255, 232, 0.28),
    inset 0 0 0 1px rgba(232, 255, 232, 0.26),
    0 8px 18px -10px rgba(0, 0, 0, 0.5);
}
[data-theme="dark"] .tab.on svg { color: #E8FFE8; }
[data-theme="dark"] .check { background: rgba(255, 255, 255, 0.06); }
[data-theme="dark"] .check.on { background: var(--green); }
[data-theme="dark"] .seg > button.on { background: rgba(255, 255, 255, 0.10); color: var(--green-deep); }
[data-theme="dark"] .stat.accent { background: linear-gradient(160deg, rgba(52, 211, 153, 0.10), var(--surface) 70%); }
[data-theme="dark"] .icon-btn { background: rgba(255, 255, 255, 0.05); }
[data-theme="dark"] .tag.green { color: var(--green-deep); }
[data-theme="dark"] .tag.warn { color: #FCD34D; background: rgba(251, 191, 36, 0.14); }
[data-theme="dark"] .tag.danger { color: #FCA5A5; background: rgba(248, 113, 113, 0.14); }
[data-theme="dark"] .tag.info { color: #93C5FD; background: rgba(96, 165, 250, 0.14); }
[data-theme="dark"] .tag.violet { color: #C4B5FD; background: rgba(167, 139, 250, 0.14); }
[data-theme="dark"] .progress > i { background: linear-gradient(90deg, #34D399, #1F8A4C); }
[data-theme="dark"] .spark i { background: rgba(52, 211, 153, 0.18); }
[data-theme="dark"] .spark i.hot { background: rgba(52, 211, 153, 0.65); }

/* 深色下的薄荷玻璃：薄荷色只作为微光，不再是白雾 */
[data-theme="dark"] {
  --brand: rgba(232, 255, 232, 0.14);
  --brand-2: rgba(110, 231, 183, 0.20);
  --glass-tint: rgba(110, 231, 183, 0.16);
  --glass-shadow: 0 18px 46px -20px rgba(0, 0, 0, 0.7), 0 2px 10px -6px rgba(0, 0, 0, 0.5);
}
[data-theme="dark"] .tabbar {
  background:
    linear-gradient(180deg, rgba(26, 38, 31, 0.92), rgba(18, 27, 22, 0.74)),
    radial-gradient(120% 180% at 50% 0%, rgba(110, 231, 183, 0.16), transparent 72%);
  box-shadow:
    0 18px 46px -18px rgba(0, 0, 0, 0.66),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.34),    inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}
[data-theme="dark"] .tabbar::before {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.04) 44%, rgba(110, 231, 183, 0.12));
}
[data-theme="dark"] .tabbar-scrim {
  background: linear-gradient(180deg, rgba(12, 19, 16, 0) 0%, rgba(12, 19, 16, 0.82) 52%, var(--bg) 92%);
}
[data-theme="dark"] .hero {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.07) 0%, rgba(110, 231, 183, 0.10) 52%, rgba(31, 138, 76, 0.16) 100%);
}
[data-theme="dark"] .fab {
  background: linear-gradient(160deg, #CDF9DE, #6EE7B7 78%);
  color: #0C3A24;
  box-shadow:
    0 16px 34px -12px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 0 0 1px rgba(110, 231, 183, 0.34);
}
[data-theme="dark"] .searchbar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ---------- 18 玻璃降级 ---------- */
@supports not ((backdrop-filter: blur(4px)) or (-webkit-backdrop-filter: blur(4px))) {
  .hero, .tabbar, .sidebar, .sheet, .dialog, .toast {
    background: var(--surface);
    border-color: var(--line-strong);
  }
  .tabbar { box-shadow: 0 6px 24px -10px rgba(10, 40, 26, 0.3); }
  .sheet { box-shadow: 0 -18px 40px -20px rgba(10, 40, 26, 0.35); }
}

@media (prefers-reduced-transparency: reduce) {
  .hero, .tabbar, .sidebar, .sheet, .dialog, .toast, .topbar {
    background: var(--surface) !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    border-color: var(--line-strong) !important;
  }
  .scrim { background: rgba(16, 30, 22, 0.55) !important; -webkit-backdrop-filter: none; backdrop-filter: none; }
  body { background-image: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- 19 工具类 ---------- */
.row { display: flex; align-items: center; }
.row.gap { gap: 8px; }
.row.gap-lg { gap: 14px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; }
.stack.gap { gap: 10px; }
.gap-sm { gap: 6px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.center { display: flex; align-items: center; justify-content: center; }
.right { margin-left: auto; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pre { white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.7; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.scroll-x::-webkit-scrollbar { display: none; }
.inset-list { margin: 0 -16px; }
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.tap { transition: transform 0.16s var(--ease); }
.tap:active { transform: scale(0.97); }

/* ---------- 20 导航壳补充 ---------- */
.tab { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.tab .tab-ic { display: grid; place-items: center; height: 21px; }
.tab .tab-label { font-size: 11.5px; line-height: 1.1; font-weight: 550; }
.tab-gear {
  flex: 0 0 44px;
  opacity: 0.62;
}
.tab-gear.on { opacity: 1; }
.sidebar .foot {
  padding: 12px 12px 4px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-3);
}
.sidebar .nav { display: flex; flex-direction: column; gap: 4px; }

/* 触控目标：碎片化的 chip / 分段按钮至少 38px 高，避免误触 */
.chip { min-height: 38px; }
.seg > button { min-height: 40px; }

/* 可滚动容器的键盘避让：iOS 软键盘弹出时保证输入框可见 */
.field, .textarea, .input, .select { scroll-margin-bottom: 120px; }
.sheet-body { scroll-padding-bottom: 90px; }

/* 记录时间线的日期组 */
.section-title + .card { margin-top: 0; }

/* 报告与 AI 材料预览 */
.preview .pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* 表格型数值列（健身每组明细） */
.num-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
