/* ===== 轻卡打卡 样式 ===== */
:root {
  --green: #059669;
  --green-dark: #047857;
  --green-light: #ecfdf5;
  --bg: #f6f8f7;
  --card: #ffffff;
  --text: #1a2b24;
  --text-2: #6b7f76;
  --border: #e5ece8;
  --red: #ef4444;
  --shadow: 0 2px 12px rgba(5, 105, 81, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

.view { display: none; min-height: 100vh; }
.view.active { display: block; }
.hidden { display: none !important; }

/* ===== 登录页 ===== */
#auth-view {
  background: linear-gradient(160deg, #059669 0%, #34d399 100%);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#auth-view.active { display: flex; }
.auth-box {
  background: #fff;
  border-radius: 24px;
  padding: 36px 28px 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  text-align: center;
}
.auth-logo { font-size: 52px; line-height: 1; }
.auth-title { font-size: 26px; margin: 12px 0 4px; color: var(--green-dark); }
.auth-sub { color: var(--text-2); font-size: 14px; margin-bottom: 22px; }
.auth-tabs { display: flex; background: var(--bg); border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.auth-tab {
  flex: 1; border: none; background: transparent; padding: 10px 0;
  border-radius: 9px; font-size: 15px; color: var(--text-2); cursor: pointer;
}
.auth-tab.active { background: #fff; color: var(--green); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.auth-input {
  width: 100%; padding: 14px 16px; border: 1.5px solid var(--border); border-radius: 12px;
  font-size: 16px; margin-bottom: 12px; outline: none; background: #fbfcfb;
}
.auth-input:focus { border-color: var(--green); background: #fff; }
.auth-btn {
  width: 100%; padding: 15px 0; border: none; border-radius: 12px; background: var(--green);
  color: #fff; font-size: 17px; font-weight: 600; cursor: pointer; margin-top: 6px;
}
.auth-btn:active { background: var(--green-dark); }
.auth-error { color: var(--red); font-size: 13px; min-height: 20px; margin-top: 8px; }
.auth-tip { color: var(--text-2); font-size: 12px; margin-top: 14px; line-height: 1.6; }

/* ===== 主框架 ===== */
.pages { padding: 0 16px calc(76px + env(safe-area-inset-bottom)); padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.page { display: none; }
.page.active { display: block; }

/* 顶部 */
.hero { padding: 22px 4px 16px; }
.hero-top { display: flex; align-items: center; justify-content: space-between; }
.greeting { font-size: 26px; font-weight: 700; }
.date-line { color: var(--text-2); font-size: 14px; margin-top: 4px; }
.streak-badge {
  background: #fff7e6; color: #b45309; font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: 999px; box-shadow: var(--shadow);
}

/* 卡片 */
.card {
  background: var(--card); border-radius: 18px; padding: 18px;
  box-shadow: var(--shadow); margin-bottom: 14px;
}
.card-title { font-size: 15px; font-weight: 600; color: var(--text-2); margin-bottom: 14px; }
.card-title .unit { font-size: 12px; color: #9fb0a8; font-weight: 400; margin-left: 2px; }

/* 体重 */
.weight-input-row { display: flex; align-items: center; gap: 12px; }
.weight-input {
  flex: 1; font-size: 34px; font-weight: 700; border: none; outline: none;
  border-bottom: 2px solid var(--border); padding: 6px 2px; color: var(--text);
  min-width: 0; background: transparent;
}
.weight-input:focus { border-color: var(--green); }
.pill-btn {
  border: none; background: var(--green); color: #fff; font-size: 15px; font-weight: 600;
  padding: 11px 22px; border-radius: 999px; cursor: pointer; flex-shrink: 0;
}
.pill-btn:active { background: var(--green-dark); }
.weight-hint { margin-top: 10px; font-size: 13px; color: var(--green); min-height: 18px; }
.weight-hint.warn { color: var(--red); }

/* 饮食 */
.meal-row {
  display: flex; align-items: center; gap: 10px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.meal-row:last-child { border-bottom: none; padding-bottom: 2px; }
.meal-icon { font-size: 20px; }
.meal-name { font-size: 15px; font-weight: 600; width: 40px; flex-shrink: 0; }
.meal-input {
  flex: 1; border: none; outline: none; font-size: 15px; background: transparent;
  padding: 4px 0; min-width: 0; color: var(--text);
}
.meal-input::placeholder { color: #b6c4bd; }
.meal-done { width: 18px; text-align: center; color: var(--green); font-weight: 700; font-size: 15px; }

/* 保存按钮 */
.save-btn {
  width: 100%; padding: 16px 0; border: none; border-radius: 16px;
  background: linear-gradient(135deg, #059669, #10b981); color: #fff;
  font-size: 17px; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.3); margin-top: 4px;
}
.save-btn:active { transform: scale(0.98); }
.save-btn.saved { background: linear-gradient(135deg, #10b981, #34d399); }
.save-msg { text-align: center; font-size: 13px; color: var(--green); margin-top: 10px; min-height: 18px; }

/* 页面标题 */
.page-header { font-size: 22px; font-weight: 700; padding: 22px 4px 16px; }

/* 记录列表 */
.records-list { display: flex; flex-direction: column; gap: 12px; }
.record-card {
  background: var(--card); border-radius: 16px; padding: 16px; box-shadow: var(--shadow);
}
.record-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.record-date { font-size: 15px; font-weight: 700; }
.record-weight { font-size: 15px; font-weight: 700; color: var(--green); }
.record-meal { display: flex; gap: 8px; font-size: 13px; color: var(--text-2); padding: 3px 0; }
.record-meal .rm-name { color: #9fb0a8; flex-shrink: 0; width: 34px; }
.record-empty { text-align: center; color: var(--text-2); padding: 60px 0; font-size: 14px; line-height: 2; }

/* 统计 */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.stat-card {
  background: var(--card); border-radius: 16px; padding: 16px 8px; text-align: center;
  box-shadow: var(--shadow);
}
.stat-card b { display: block; font-size: 24px; color: var(--green); }
.stat-card span { font-size: 12px; color: var(--text-2); }

/* 图表 */
.chart-card { position: relative; }
#weight-chart { width: 100%; height: 220px; display: block; }
.chart-empty { height: 200px; display: flex; align-items: center; justify-content: center; color: var(--text-2); font-size: 14px; text-align: center; padding: 0 20px; }

/* 退出 */
.logout-row { text-align: center; padding: 20px 0 10px; }
.link-btn { border: none; background: none; color: #9fb0a8; font-size: 13px; cursor: pointer; text-decoration: underline; }

/* 底部 tab */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  display: flex; background: rgba(255,255,255,0.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; border: none; background: none; padding: 9px 0 8px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: #9fb0a8; font-size: 11px; cursor: pointer;
}
.tab .tab-icon { font-size: 20px; line-height: 1.2; }
.tab.active { color: var(--green); font-weight: 600; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%) translateY(20px);
  background: rgba(26,43,36,0.92); color: #fff; font-size: 14px;
  padding: 11px 20px; border-radius: 999px; z-index: 999;
  opacity: 0; transition: all 0.25s; pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
