/* ============================================================
   健康管理 · 设计系统 v2
   主色：青绿（健康、清新）；点缀：琥珀（摄入）、靛蓝（体重）、玫红（差值）
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #0e9f8a;
  --primary-dark: #0b8272;
  --primary-soft: #e0f5f1;
  --amber: #f59e0b;
  --amber-soft: #fef3e0;
  --indigo: #6366f1;
  --indigo-soft: #e8e9fd;
  --rose: #f43f5e;
  --rose-soft: #fde8ec;
  --purple: #9b59d0;
  --bg: #f2f6f4;
  --card: #ffffff;
  --text: #1f2d2a;
  --text-light: #7d8f8a;
  --border: #e4ebe8;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(20, 60, 50, 0.05), 0 6px 20px rgba(20, 60, 50, 0.06);
  --shadow-hover: 0 4px 8px rgba(20, 60, 50, 0.07), 0 12px 32px rgba(20, 60, 50, 0.10);
}

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ============ 按钮通用 ============ */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #0fb59c);
  color: #fff; border: none; padding: 12px;
  border-radius: 12px; font-size: 15px; cursor: pointer; font-weight: 600;
  box-shadow: 0 4px 14px rgba(14, 159, 138, 0.28);
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(14, 159, 138, 0.36); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-text { background: none; border: none; color: var(--text-light); cursor: pointer; font-size: 13px; }
.btn-text:hover { color: var(--primary); }

.btn-mini {
  background: var(--primary-soft); color: var(--primary-dark); border: none;
  border-radius: 8px; padding: 4px 12px; font-size: 12px; cursor: pointer; font-weight: 600;
  transition: background .15s ease;
}
.btn-mini:hover { background: #c8ece5; }

/* ============ 登录页 ============ */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; position: relative; overflow: hidden;
  background: linear-gradient(160deg, #e6f6f1 0%, #f2f6f4 45%, #e9f0fd 100%);
}
.auth-wrap::before, .auth-wrap::after {
  content: ''; position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55;
}
.auth-wrap::before { width: 420px; height: 420px; background: #a7e8da; top: -120px; right: -100px; }
.auth-wrap::after { width: 360px; height: 360px; background: #c3d2fa; bottom: -120px; left: -100px; }

.auth-card {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  box-shadow: 0 16px 60px rgba(20, 60, 50, 0.14);
  padding: 40px 36px;
  width: 100%; max-width: 420px;
  position: relative; z-index: 1;
}
.auth-brand { text-align: center; margin-bottom: 26px; }
.auth-logo {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--primary), #34d399);
  color: #fff; font-size: 30px;
  border-radius: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(14, 159, 138, 0.35);
}
.auth-brand h1 { font-size: 24px; letter-spacing: 1px; }
.auth-brand p { color: var(--text-light); font-size: 13px; margin-top: 8px; }

.auth-tabs {
  display: flex; gap: 4px; background: var(--bg);
  border-radius: 12px; padding: 4px; margin-bottom: 22px;
}
.auth-tab {
  flex: 1; border: none; background: transparent; padding: 9px 0;
  border-radius: 9px; cursor: pointer; font-size: 14px; color: var(--text-light);
  transition: all .15s ease;
}
.auth-tab.active { background: #fff; color: var(--primary-dark); font-weight: 600; box-shadow: 0 2px 8px rgba(20, 60, 50, 0.08); }

.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form input {
  padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 12px;
  font-size: 14px; outline: none; width: 100%; background: #fbfdfc;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.auth-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14, 159, 138, 0.12); }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; }
.btn-code {
  border: 1.5px solid var(--primary); color: var(--primary-dark); background: #fff;
  border-radius: 12px; padding: 0 14px; font-size: 13px; cursor: pointer; white-space: nowrap;
  font-weight: 600;
}
.btn-code:disabled { opacity: 0.5; cursor: not-allowed; }
.auth-link { font-size: 13px; color: var(--text-light); text-align: center; text-decoration: none; }
.auth-link:hover { color: var(--primary); }
.auth-hint { font-size: 13px; color: var(--text-light); }
.auth-msg {
  margin-top: 14px; padding: 10px 14px; border-radius: 10px; font-size: 13px;
  background: var(--rose-soft); color: #c22844;
}
.auth-msg.ok { background: var(--primary-soft); color: var(--primary-dark); }
.auth-footer { margin-top: 20px; text-align: center; font-size: 12px; color: var(--text-light); }
.auth-footer a { color: var(--primary-dark); text-decoration: none; font-weight: 600; }

/* ============ 主框架 ============ */
.app-header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  padding: 12px 20px;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.app-title { font-weight: 700; font-size: 17px; color: var(--primary-dark); display: flex; align-items: center; gap: 8px; }
.logo-mark {
  width: 28px; height: 28px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), #34d399);
  color: #fff; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
}
.app-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-light); }

.app-nav {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 53px; z-index: 19;
  padding: 8px 16px;
}
.nav-inner {
  max-width: 720px; margin: 0 auto;
  display: flex; gap: 4px; background: var(--bg);
  border-radius: 14px; padding: 4px;
}
.nav-btn {
  flex: 1; border: none; background: none; padding: 8px 0; font-size: 14px;
  color: var(--text-light); cursor: pointer; border-radius: 10px;
  transition: all .15s ease;
}
.nav-btn.active {
  background: #fff; color: var(--primary-dark); font-weight: 600;
  box-shadow: 0 2px 8px rgba(20, 60, 50, 0.08);
}

.app-main { max-width: 960px; margin: 0 auto; padding: 20px 16px 40px; }
.page { display: flex; flex-direction: column; gap: 16px; }

/* ============ 卡片 ============ */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px;
  transition: box-shadow .2s ease;
}
.card:hover { box-shadow: var(--shadow-hover); }
.card-title {
  font-size: 15px; font-weight: 700; margin-bottom: 14px;
  display: flex; justify-content: space-between; align-items: center;
  letter-spacing: .2px;
}
.card-title::before {
  content: ''; width: 4px; height: 16px; border-radius: 2px;
  background: linear-gradient(180deg, var(--primary), #34d399);
  margin-right: 8px; display: inline-block; vertical-align: -2px;
}

/* ============ 首页 Hero ============ */
.hero {
  background: linear-gradient(120deg, #0e9f8a 0%, #14b8a6 55%, #34d399 100%);
  border-radius: 20px;
  padding: 26px 24px;
  color: #fff;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  box-shadow: 0 10px 32px rgba(14, 159, 138, 0.30);
  flex-wrap: wrap;
}
.hero-greeting { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.hero-date { font-size: 13px; opacity: .85; }
.hero-sub { font-size: 13px; opacity: .9; margin-top: 10px; line-height: 1.6; }
.hero-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-chip {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px; padding: 8px 14px; font-size: 13px;
  backdrop-filter: blur(4px); white-space: nowrap;
}
.hero-chip b { font-size: 16px; }

/* 日期切换 */
.date-bar { display: flex; align-items: center; gap: 10px; justify-content: center; }
.date-bar input {
  border: 1.5px solid var(--border); border-radius: 12px; padding: 8px 14px;
  font-size: 14px; background: #fff; outline: none; color: var(--text);
}
.date-bar input:focus { border-color: var(--primary); }
.btn-date {
  width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--border);
  background: #fff; font-size: 18px; cursor: pointer; color: var(--text-light);
  transition: all .15s ease; display: inline-flex; align-items: center; justify-content: center;
}
.btn-date:hover { border-color: var(--primary); color: var(--primary); }

/* 统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 14px; display: flex; flex-direction: column; gap: 4px;
  position: relative; overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.stat-icon {
  width: 34px; height: 34px; border-radius: 10px; font-size: 17px;
  display: inline-flex; align-items: center; justify-content: center; margin-bottom: 6px;
}
.stat-card.intake .stat-icon { background: var(--amber-soft); }
.stat-card.burn .stat-icon { background: var(--primary-soft); }
.stat-card.deficit .stat-icon { background: var(--rose-soft); }
.stat-card.weight .stat-icon { background: var(--indigo-soft); }
.stat-label { font-size: 12px; color: var(--text-light); }
.stat-value { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.stat-unit { font-size: 11px; color: var(--text-light); }
.stat-card.intake .stat-value { color: var(--amber); }
.stat-card.burn .stat-value { color: var(--primary); }
.stat-card.deficit .stat-value { color: var(--rose); }
.stat-card.weight .stat-value { color: var(--indigo); }

.tdee-info { font-size: 13px; color: var(--text-light); line-height: 1.9; }
.tdee-info b { color: var(--text); }

/* 周总结 */
.week-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.week-item {
  background: #f7faf9; border-radius: 12px; padding: 14px 10px; text-align: center;
}
.week-value { font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.week-value.rose { color: var(--rose); }
.week-value.teal { color: var(--primary); }
.week-value.indigo { color: var(--indigo); }
.week-label { font-size: 12px; color: var(--text-light); margin-top: 4px; }

.section-divider {
  display: flex; align-items: center; gap: 12px;
  font-size: 13px; color: var(--text-light); font-weight: 600;
  margin-top: 4px;
}
.section-divider::before, .section-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.chart-home { height: 220px; }

/* 首页动态图表容器：卡片之间留出与其他区块一致的间距 */
#homeCharts { display: flex; flex-direction: column; gap: 16px; }

/* 营养摄入进度条 */
.nutri-row { margin-bottom: 12px; }
.nutri-row:last-child { margin-bottom: 0; }
.nutri-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.nutri-head .n-name { font-weight: 600; }
.nutri-head .n-val { color: var(--text-light); }
.nutri-head .n-val b { color: var(--text); }
.nutri-bar { height: 8px; background: #eef2f0; border-radius: 4px; overflow: hidden; }
.nutri-fill { height: 100%; border-radius: 4px; transition: width .4s ease; }
.nutri-hint { font-size: 12px; margin-top: 3px; }
.nutri-hint.lack { color: var(--amber); }
.nutri-hint.over { color: var(--rose); }
.nutri-hint.ok { color: var(--primary); }

/* 用药计划 */
.slot-checks { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.slot-check {
  display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text);
  background: #f7faf9; border: 1.5px solid var(--border); border-radius: 18px;
  padding: 5px 12px; cursor: pointer; min-width: 56px; justify-content: center;
}
.slot-check:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.slot-check input { display: none; }
.med-due-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; border-radius: 10px; font-size: 13px; background: #f7faf9;
}
.med-due-item.done { opacity: 0.55; }
.med-due-item .slot-tag {
  font-size: 11px; border-radius: 6px; padding: 2px 8px; background: var(--indigo-soft); color: var(--indigo);
}
.med-due-item .take-btn {
  border: none; background: var(--primary-soft); color: var(--primary-dark);
  border-radius: 8px; padding: 4px 12px; font-size: 12px; cursor: pointer; font-weight: 600;
}
.med-due-item.done .take-btn { background: #eee; color: #999; }
.med-due-item .done-mark { color: var(--primary); font-weight: 700; }
.ci-quick {
  border: none; background: var(--primary-soft); color: var(--primary-dark);
  border-radius: 8px; padding: 4px 12px; font-size: 12px; cursor: pointer; font-weight: 600;
}
.ci-quick:hover { background: #c8ece5; }
.fb-status { font-size: 12px; color: var(--text-light); white-space: nowrap; }

/* 我的页底部版本信息 */
.app-footer-info {
  display: flex; justify-content: center; align-items: center; gap: 14px;
  font-size: 12px; color: var(--text-light); padding: 10px 0 20px;
}
.app-footer-info b { color: var(--primary-dark); }
.app-footer-info a { color: var(--primary-dark); text-decoration: none; font-weight: 600; }
.app-footer-info a:hover { text-decoration: underline; }

/* 首页图表配置 */
.chart-cfg-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.chart-cfg-item {
  display: flex; align-items: center; gap: 10px;
  background: #f7faf9; border-radius: 10px; padding: 9px 12px; font-size: 13px;
}
.chart-cfg-item .ci-drag { cursor: grab; color: var(--text-light); font-size: 16px; user-select: none; }
.chart-cfg-item .ci-name { flex: 1; font-weight: 500; }
.chart-cfg-item .ci-up, .chart-cfg-item .ci-down {
  border: 1px solid var(--border); background: #fff; border-radius: 6px;
  width: 26px; height: 26px; cursor: pointer; font-size: 12px; color: var(--text-light);
}
.chart-cfg-item .ci-up:hover, .chart-cfg-item .ci-down:hover { border-color: var(--primary); color: var(--primary); }
.chart-cfg-item .ci-del {
  border: none; background: none; color: var(--text-light); cursor: pointer; font-size: 16px;
}
.chart-cfg-item .ci-del:hover { color: var(--rose); }

/* 迷你列表 */
.mini-list { display: flex; flex-direction: column; gap: 6px; }
.mini-item {
  display: flex; justify-content: space-between; align-items: center; font-size: 13px;
  padding: 8px 12px; background: #f7faf9; border-radius: 10px;
  border: 1px solid transparent;
  transition: border-color .15s ease;
}
.mini-item:hover { border-color: var(--border); }
.mini-item .kcal { color: var(--amber); font-weight: 700; }
.mini-item .kcal.green { color: var(--primary); }
.empty-tip { font-size: 13px; color: var(--text-light); text-align: center; padding: 12px 0; }

/* ============ 记录页 ============ */
.sub-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.sub-tab {
  flex: 1; min-width: 64px; border: 1.5px solid var(--border); background: #fff;
  padding: 10px 4px; border-radius: 12px; cursor: pointer; font-size: 13px; color: var(--text-light);
  transition: all .15s ease;
}
.sub-tab:hover { border-color: var(--primary); color: var(--primary); }
.sub-tab.active {
  border-color: transparent; color: #fff; font-weight: 600;
  background: linear-gradient(135deg, var(--primary), #14b8a6);
  box-shadow: 0 4px 14px rgba(14, 159, 138, 0.28);
}

.form-card { display: flex; flex-direction: column; gap: 12px; }
.form-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.form-row label { font-size: 13px; color: var(--text-light); min-width: 64px; font-weight: 500; }
.form-row input, .form-row select {
  flex: 1; min-width: 100px; padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: 10px; font-size: 14px; outline: none; background: #fbfdfc;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-row input:focus, .form-row select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14, 159, 138, 0.12);
}
.form-hint { font-size: 12px; color: var(--text-light); }
.calc-kcal { font-size: 14px; }
.calc-kcal span { font-size: 22px; font-weight: 800; color: var(--amber); }

.record-list { display: flex; flex-direction: column; gap: 8px; }
.record-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 14px; background: #f7faf9; border-radius: 12px; font-size: 13px;
  border: 1px solid transparent;
  transition: all .15s ease;
}
.record-item:hover { border-color: var(--border); background: #f2f7f5; }
.record-item .ri-main { flex: 1; min-width: 0; }
.record-item .ri-title { font-weight: 600; }
.record-item .ri-sub { color: var(--text-light); font-size: 12px; margin-top: 2px; }
.record-item .ri-kcal { font-weight: 700; margin: 0 10px; white-space: nowrap; }
.record-item .ri-del {
  border: none; background: none; color: var(--text-light); cursor: pointer;
  font-size: 18px; width: 28px; height: 28px; border-radius: 8px; line-height: 1;
}
.record-item .ri-del:hover { color: var(--rose); background: var(--rose-soft); }

/* ============ 趋势页 ============ */
.range-bar { display: flex; gap: 8px; }
.btn-range {
  border: 1.5px solid var(--border); background: #fff; border-radius: 20px;
  padding: 7px 18px; font-size: 13px; cursor: pointer; color: var(--text-light);
  transition: all .15s ease; font-weight: 500;
}
.btn-range.active {
  border-color: transparent; color: #fff;
  background: linear-gradient(135deg, var(--primary), #14b8a6);
  box-shadow: 0 4px 12px rgba(14, 159, 138, 0.28);
}
.chart-box { position: relative; height: 260px; }
.loss-card {
  background: linear-gradient(135deg, #ffffff 0%, var(--primary-soft) 100%);
  border: 1px solid #d3ece5;
}
.loss-summary { font-size: 14px; line-height: 2.1; }
.loss-summary b { color: var(--primary-dark); font-size: 18px; }
.trend-metric-select {
  border: 1.5px solid var(--border); border-radius: 10px; padding: 6px 12px;
  font-size: 13px; outline: none; max-width: 200px; background: #fbfdfc;
}
.trend-metric-select:focus { border-color: var(--primary); }

/* ============ 科普页 ============ */
.article-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.article-item {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; cursor: pointer; border: 1px solid transparent;
  transition: all .18s ease;
}
.article-item:hover {
  box-shadow: var(--shadow-hover); transform: translateY(-2px);
  border-color: #d3ece5;
}
.article-item h3 { font-size: 15px; margin-bottom: 6px; line-height: 1.5; }
.article-item .art-cat {
  display: inline-block; font-size: 11px; color: var(--primary-dark); background: var(--primary-soft);
  border-radius: 6px; padding: 2px 8px; margin-bottom: 8px; font-weight: 600;
}
.article-item p { font-size: 13px; color: var(--text-light); line-height: 1.7; }
.article-detail h2 { font-size: 20px; margin: 12px 0 8px; }
.art-category {
  display: inline-block; font-size: 12px; color: var(--primary-dark); background: var(--primary-soft);
  border-radius: 6px; padding: 3px 10px; margin-bottom: 16px; font-weight: 600;
}
.art-content { font-size: 14px; line-height: 2; white-space: pre-wrap; color: #37474f; }

/* ============ 我的 / Agent 接入 ============ */
.agent-desc { font-size: 13px; color: var(--text-light); line-height: 1.8; margin-bottom: 14px; }
.btn-agent { flex: 0 0 auto; padding: 10px 18px; font-size: 13px; }
.token-box {
  margin: 12px 0; padding: 16px; border: 1.5px dashed var(--primary);
  border-radius: 14px; background: var(--primary-soft);
}
.token-warn { font-size: 13px; color: var(--primary-dark); margin-bottom: 8px; font-weight: 700; }
.token-value {
  font-family: Consolas, monospace; font-size: 14px; word-break: break-all;
  background: #fff; border-radius: 10px; padding: 10px 12px; margin-bottom: 10px;
  border: 1px solid var(--border);
}
.token-config-title { font-size: 12px; color: var(--text-light); margin: 12px 0 6px; font-weight: 600; }
.token-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-copy-guide { background: var(--primary); color: #fff; }
.btn-copy-guide:hover { background: var(--primary-dark); }
.guide-pre { max-height: 320px; overflow-y: auto; white-space: pre-wrap; word-break: break-word; }
.token-config {
  font-family: Consolas, monospace; font-size: 12px; background: #1f2d2a; color: #c8e6de;
  border-radius: 10px; padding: 14px; overflow-x: auto; white-space: pre; margin-bottom: 10px;
}
.token-item .ri-sub { font-family: Consolas, monospace; }

/* ============ 自定义指标 ============ */
.preset-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  border: 1.5px solid var(--border); background: #fff; border-radius: 18px;
  padding: 5px 14px; font-size: 12px; cursor: pointer; color: var(--text);
  transition: all .15s ease;
}
.chip:hover {
  border-color: var(--primary); color: var(--primary-dark);
  background: var(--primary-soft); transform: translateY(-1px);
}
.def-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.def-form input {
  flex: 1; min-width: 100px; padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: 10px; font-size: 13px; outline: none; background: #fbfdfc;
}
.def-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14, 159, 138, 0.12); }

/* ============ 插件下载 ============ */
.download-box { margin-bottom: 16px; }
.download-btn {
  display: block; text-align: center; text-decoration: none; font-size: 14px;
}
.download-steps { margin-top: 10px; font-size: 12px; color: var(--text-light); line-height: 2; }
.download-steps a { color: var(--primary-dark); }

/* ============ Toast ============ */
.toast {
  position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%);
  background: rgba(31, 45, 42, 0.92); color: #fff; padding: 11px 24px;
  border-radius: 24px; font-size: 14px; z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  animation: toastIn .25s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ============ 手动复制弹窗 ============ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(20, 40, 35, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-box {
  background: #fff; border-radius: 18px; padding: 22px;
  width: 100%; max-width: 640px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
.modal-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.modal-textarea {
  width: 100%; height: 320px; resize: vertical;
  font-family: Consolas, monospace; font-size: 12px; line-height: 1.6;
  border: 1.5px solid var(--border); border-radius: 12px; padding: 12px;
  background: #fbfdfc; outline: none; color: var(--text);
}
.modal-textarea:focus { border-color: var(--primary); }
.modal-actions { margin-top: 14px; display: flex; justify-content: flex-end; gap: 8px; }
.modal-actions .btn-primary { padding: 10px 22px; font-size: 14px; }

/* 编辑字段 */
.edit-fields { display: flex; flex-direction: column; gap: 10px; max-height: 55vh; overflow-y: auto; }
.edit-fields .form-row label { min-width: 88px; }

/* 图表全屏 */
.fs-overlay {
  position: fixed; inset: 0; z-index: 130; background: #fff;
  display: flex; flex-direction: column; padding: 14px 16px;
}
.fs-inner { display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 0; }
.fs-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; }
.fs-head span:first-child { font-size: 16px; font-weight: 700; }
.fs-actions { display: flex; gap: 8px; }
.fs-body { flex: 1; position: relative; min-height: 0; }
.fs-body canvas { position: absolute; inset: 0; }
.fs-hint { text-align: center; font-size: 12px; color: var(--text-light); margin-top: 8px; }

/* CSS 横屏旋转（不支持系统横屏锁定的设备用） */
#chartFullscreen.rotated .fs-inner {
  position: absolute; top: 0; left: 0;
  width: 100vh; height: 100vw;
  transform: rotate(90deg) translateY(-100%);
  transform-origin: top left;
}
#chartFullscreen.rotated .fs-hint { display: none; }

/* 记录项操作按钮 */
.record-item .ri-edit {
  border: none; background: none; color: var(--text-light); cursor: pointer;
  font-size: 14px; width: 28px; height: 28px; border-radius: 8px; line-height: 1;
}
.record-item .ri-edit:hover { color: var(--primary); background: var(--primary-soft); }

/* 图表卡全屏按钮 */
.card-title .btn-fs {
  border: none; background: none; cursor: pointer; font-size: 15px;
  color: var(--text-light); padding: 2px 6px; border-radius: 6px;
}
.card-title .btn-fs:hover { color: var(--primary); background: var(--primary-soft); }

/* ============ 响应式 ============ */
@media (max-width: 720px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .week-grid { grid-template-columns: repeat(2, 1fr); }
  .article-list { grid-template-columns: 1fr; }
  .hero { padding: 20px; }
  .hero-greeting { font-size: 19px; }
  .form-row label { min-width: 56px; }
}
