:root {
  --bg: #f6f8f7;
  --card: #ffffff;
  --ink: #1f2933;
  --muted: #7b8794;
  --line: #e6eaec;
  --brand: #16a085;
  --brand-2: #27ae60;
  --warn: #f39c12;
  --danger: #e74c3c;
  --shadow: 0 1px 3px rgba(16, 42, 67, .08), 0 4px 14px rgba(16, 42, 67, .06);
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased; line-height: 1.5;
}
a { color: var(--brand); text-decoration: none; }
.wrap { max-width: 720px; margin: 0 auto; padding: 16px 16px 90px; }
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px;
  border: 1px solid var(--line);
}
.muted { color: var(--muted); font-size: 13px; }
.h1 { font-size: 20px; font-weight: 700; }
.h2 { font-size: 16px; font-weight: 600; margin: 0 0 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* 顶部 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 2px 14px;
}
.brand-dot { color: var(--brand); font-weight: 800; letter-spacing: .5px; }

/* 热量环形 */
.calorie-hero { text-align: center; padding: 20px 16px 16px; }
.big-num { font-size: 42px; font-weight: 800; color: var(--brand); }
.big-num.over { color: var(--warn); }
.ring-label { font-size: 13px; color: var(--muted); }

/* 宏量营养 */
.macro { display: flex; gap: 8px; }
.macro .m {
  flex: 1; text-align: center; padding: 10px 4px; border-radius: 10px;
  background: #f0fbf7; border: 1px solid #dff3ec;
}
.macro .m b { display: block; font-size: 16px; }
.macro .m span { font-size: 12px; color: var(--muted); }

/* 徽章 */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; background: #f0fbf7; color: var(--brand); border: 1px solid #dff3ec;
}

/* tabs */
.tabs { display: flex; background: var(--card); border-radius: 12px; border: 1px solid var(--line); overflow: hidden; margin-bottom: 14px; }
.tabs button {
  flex: 1; padding: 12px; border: 0; background: transparent; font-size: 15px;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent;
}
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 12px; padding: 11px 16px; font-size: 15px;
  cursor: pointer; font-weight: 600; transition: opacity .15s;
}
.btn:active { opacity: .8; }
.btn-primary { background: var(--brand); color: #fff; width: 100%; }
.btn-ghost { background: #eef1f3; color: var(--ink); }
.btn-danger { background: #fdeceb; color: var(--danger); }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }

/* 输入 */
input, select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 15px; background: #fff; color: var(--ink);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 5px; }
.field { margin-bottom: 8px; }

/* 餐次 */
.meal-group { margin-bottom: 14px; }
.meal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.meal-head .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.meal-items { display: flex; flex-direction: column; gap: 6px; }
.mi {
  display: flex; align-items: center; gap: 10px; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px;
}
.mi img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }
.mi .grow { flex: 1; min-width: 0; }
.mi .name { font-weight: 600; font-size: 14px; }
.mi .sub { font-size: 12px; color: var(--muted); }
.mi .kcal { font-weight: 700; color: var(--brand); white-space: nowrap; }

/* 空状态 */
.empty { text-align: center; color: var(--muted); padding: 22px 0; font-size: 14px; }

/* 弹层 */
.sheet {
  position: fixed; inset: 0; background: rgba(16, 26, 34, .45); z-index: 40;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet.hidden { display: none; }
.sheet-box {
  background: #fff; width: 100%; max-width: 720px; max-height: 88vh;
  overflow-y: auto; border-radius: 18px 18px 0 0; padding: 18px 16px 24px;
}
.sheet-handle { width: 40px; height: 4px; background: #d5dadd; border-radius: 2px; margin: 0 auto 14px; }

/* 识别结果项 */
.ana-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.ana-item .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ana-item input { width: 90px; }

/* 图表 */
canvas { width: 100%; height: 200px; }

/* 提醒横幅 */
.remind-banner {
  background: #fff8e6; border: 1px solid #f5e3b3; color: #8a6d1a;
  border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-size: 14px;
}

/* 悬浮按钮 */
.fab {
  position: fixed; right: 18px; bottom: 24px; width: 58px; height: 58px;
  border-radius: 50%; background: var(--brand); color: #fff; font-size: 30px;
  border: 0; box-shadow: 0 6px 18px rgba(22, 160, 133, .4); cursor: pointer; z-index: 30;
}

/* 登录页 */
.login-hero { text-align: center; padding: 60px 20px 30px; }
.login-hero .logo { font-size: 44px; }
.login-hero h1 { margin: 10px 0 4px; }
.login-box { max-width: 380px; margin: 0 auto; padding: 20px; }
.login-err { color: var(--danger); font-size: 13px; min-height: 20px; text-align: center; }

/* 设置 */
.sec-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin: 18px 0 8px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; font-size: 14px;
}
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }

@media (min-width: 720px) {
  .sheet-box { border-radius: 18px; margin-bottom: 4vh; }
}
