/* Bitelog · 移动优先的暖色记录工具风格 */

:root {
  --bg: #f5f3ed;
  --surface: #ffffff;
  --surface-soft: #faf7f0;
  --surface-2: #efeae0;
  --ink: #222222;
  --ink-soft: #4b4740;
  --muted: #7a756d;
  --line: #e6e2d8;
  --green: #2c5542;
  --green-deep: #234435;
  --green-soft: #e8f0ea;
  --amber: #b0692f;
  --amber-soft: #f7ecdf;
  --red: #b0463d;
  --red-soft: #f8e8e5;
  --blue: #5b7392;
  --gold: #c2924d;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(34, 34, 34, 0.04), 0 10px 28px rgba(34, 34, 34, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC", "Noto Sans SC",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: #eae6dc;
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--green); text-decoration: none; }

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 540px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  background-image: radial-gradient(120% 60% at 50% -10%, #fcfbf6 0%, var(--bg) 60%);
  overflow-x: hidden;
}

@media (min-width: 620px) {
  body { padding: 18px 0; }
  .app {
    min-height: calc(100dvh - 36px);
    border-radius: 30px;
    box-shadow: 0 24px 60px rgba(34, 34, 34, 0.14);
    overflow: hidden;
  }
}

.boot-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 100dvh;
  color: var(--muted);
  font-size: 14px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 55%),
    url("/icons/icon-192.png") center / cover no-repeat;
  background-color: var(--green);
  flex: 0 0 auto;
}

.brand-mark--large { width: 72px; height: 72px; border-radius: 20px; }

.noscript {
  padding: 24px;
  text-align: center;
  background: var(--amber-soft);
  color: var(--amber);
}

/* ---------- 页面骨架 ---------- */

.view {
  flex: 1;
  padding: 18px 18px calc(104px + env(safe-area-inset-bottom));
  animation: rise 0.28s ease-out;
}

.stage { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.app.no-tabbar .view { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
.app.no-tabbar .tabbar-wrap { display: none; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.tabbar-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  padding: 0 12px calc(10px + env(safe-area-inset-bottom));
  pointer-events: none;
}

@media (min-width: 620px) {
  .tabbar-wrap { padding-bottom: 30px; }
}

.tabbar {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  width: 100%;
  max-width: 516px;
  height: 66px;
  padding: 0 8px;
  background: rgba(252, 250, 245, 0.92);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 12px 34px rgba(34, 34, 34, 0.14);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  pointer-events: auto;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  border-radius: 14px;
}

.tab svg { width: 21px; height: 21px; }
.tab.active { color: var(--green); font-weight: 600; }
.tab.active svg { stroke: var(--green); }

.tab-fab { display: flex; justify-content: center; }
.fab {
  width: 52px;
  height: 52px;
  margin-top: -22px;
  border: 0;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 22px rgba(44, 85, 66, 0.32);
  transition: transform 0.16s ease;
}
.fab:active { transform: scale(0.94); }
.fab svg { width: 24px; height: 24px; }

/* ---------- 头部 ---------- */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.kicker {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.page-title {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.page-sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.top-actions { display: flex; gap: 8px; align-items: center; }

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-soft);
  box-shadow: 0 1px 2px rgba(34, 34, 34, 0.04);
}
.icon-btn svg { width: 18px; height: 18px; }

.avatar-btn {
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px 7px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 13px;
}
.back-btn svg { width: 16px; height: 16px; }

/* ---------- 通用卡片 ---------- */

.card {
  background: var(--surface);
  border: 1px solid rgba(230, 226, 216, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.card + .card, .section + .section, .section + .card, .card + .section { margin-top: 16px; }

.section { margin-top: 22px; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 0 2px 10px;
}

.section-title {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title svg { width: 18px; height: 18px; color: var(--green); }
.section-note { margin: 0; color: var(--muted); font-size: 12px; text-align: right; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--surface-2);
  color: var(--ink-soft);
  white-space: nowrap;
}
.chip--green { background: var(--green-soft); color: var(--green-deep); }
.chip--amber { background: var(--amber-soft); color: var(--amber); }
.chip--red { background: var(--red-soft); color: var(--red); }
.chip--muted { background: var(--surface-soft); color: var(--muted); border: 1px solid var(--line); }

/* ---------- 按钮 / 表单 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 13px;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.14s ease, background 0.16s ease;
}
.btn:active { transform: scale(0.985); }
.btn svg { width: 17px; height: 17px; }
.btn--primary { background: var(--green); color: #fff; box-shadow: 0 8px 20px rgba(44, 85, 66, 0.22); }
.btn--primary:active { background: var(--green-deep); }
.btn--secondary {
  width: calc((100% - 20px) / 2);
  margin: 0 0 0 10px;
  padding: 10px 8px;
  min-height: 44px;
  font-size: 12px;
  white-space: nowrap;
  background: #e6e2d8;
  color: var(--green);
  box-shadow: none;
}
.btn--secondary:active { background: #dcd7cb; }
.sticky-actions .btn { min-height: 44px; }
.btn--soft { background: var(--green-soft); color: var(--green-deep); }
.btn--ghost { background: var(--surface); border-color: var(--line); color: var(--ink-soft); }
.btn--danger { background: var(--red-soft); color: var(--red); }
.btn--block { width: 100%; }
.btn--sm { min-height: 34px; padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn[disabled] { opacity: 0.55; pointer-events: none; }

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

.sticky-actions {
  position: sticky;
  bottom: 12px;
  z-index: 10;
  margin-top: 20px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(245, 243, 237, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.field { margin-bottom: 14px; }
.field > label, .field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.field-hint { margin-top: 5px; color: var(--muted); font-size: 11.5px; line-height: 1.45; }

.input, .select, .textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 15px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
  appearance: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(44, 85, 66, 0.12);
  background: #fff;
}
.input::placeholder { color: #a8a29a; }
.textarea { min-height: 74px; resize: vertical; }

.select-wrap { position: relative; }
.select--trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  cursor: pointer;
}
.select--trigger:focus { background: var(--surface-soft); }
.select--trigger svg {
  flex: none;
  color: var(--muted);
  transition: transform 0.16s ease;
}
.select--trigger[aria-expanded="true"] svg { transform: rotate(180deg); }
.select-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  padding: 6px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: 260px;
  overflow: auto;
}
.select-option {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.select-option:hover,
.select-option:focus-visible,
.select-option.active { background: #f5f3ed; }
.select-option.active { color: var(--green); font-weight: 600; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid--3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 360px) { .form-grid, .form-grid--3 { grid-template-columns: 1fr; } }

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 13px;
  background: var(--surface-2);
}
.segmented button {
  flex: 1;
  min-height: 36px;
  padding: 6px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.16s ease, color 0.16s ease;
}
.segmented button.active { background: var(--surface); color: var(--green-deep); box-shadow: 0 1px 3px rgba(34, 34, 34, 0.1); }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.switch-row:first-of-type { border-top: 0; }
.switch-row .switch-copy { min-width: 0; }
.switch-title { font-size: 14px; font-weight: 600; }
.switch-sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; }

.switch {
  position: relative;
  width: 46px;
  height: 26px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  background: #d6d1c6;
  transition: background 0.18s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: left 0.18s ease;
}
.switch.on { background: var(--green); }
.switch.on::after { left: 24px; }

/* ---------- 首页 ---------- */

.low-weight-banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--amber-soft);
  border: 1px solid #eedcc6;
  color: #7a4a1d;
  font-size: 12.5px;
  line-height: 1.5;
}
.low-weight-banner svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px; }

.calorie-hero {
  display: grid;
  grid-template-columns: 138px 1fr;
  gap: 16px;
  align-items: center;
}
@media (max-width: 350px) { .calorie-hero { grid-template-columns: 1fr; justify-items: center; } }

.ring {
  --pct: 0;
  --ring-color: var(--green);
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color) calc(var(--pct) * 1%), #eae5da 0);
  display: grid;
  place-items: center;
  position: relative;
}
.ring::before {
  content: "";
  position: absolute;
  inset: 11px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px rgba(230, 226, 216, 0.6);
}
.ring-inner { position: relative; text-align: center; }
.ring-value { display: block; font-size: 27px; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.ring-unit { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }

.hero-stats { display: grid; gap: 8px; }
.hero-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--line);
}
.hero-line:last-child { border-bottom: 0; padding-bottom: 0; }
.hero-line .stat-label { color: var(--muted); font-size: 12px; }
.hero-line .stat-value { font-size: 16px; font-weight: 650; }
.hero-line .stat-value small { font-size: 11px; color: var(--muted); font-weight: 500; margin-left: 3px; }

.hero-goal { display: flex; align-items: center; gap: 8px; margin-top: 2px; flex-wrap: wrap; }

.metric-list { display: grid; gap: 13px; }
.metric-row { display: grid; grid-template-columns: 46px 1fr; gap: 6px 12px; align-items: center; }
.metric-name { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.metric-value { grid-column: 2; display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11.5px; margin-top: -2px; }
.metric-value b { color: var(--ink-soft); font-weight: 600; }
.metric-status.ok { color: var(--green); }
.metric-status.low { color: var(--muted); }
.metric-status.over { color: var(--red); }

.bar {
  position: relative;
  height: 9px;
  border-radius: 999px;
  background: #efeae0;
  overflow: hidden;
}
.bar-band {
  position: absolute;
  top: 0;
  bottom: 0;
  background: #dce8e1;
  border-radius: 999px;
}
.bar-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  border-radius: 999px;
  background: var(--green);
  transition: width 0.45s ease;
  z-index: 1;
}
.bar-fill.low { background: #5e8a72; }
.bar-fill.over { background: var(--red); }
.bar-fill--gold { background: var(--gold); }

.food-row { display: grid; grid-template-columns: 76px 1fr; gap: 4px 10px; align-items: center; padding: 7px 0; }
.food-label { font-size: 13px; font-weight: 600; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.dot-grains { background: #c39a57; }
.dot-vegFruit { background: #4f8b63; }
.dot-protein { background: #b06a55; }
.dot-dairy { background: #6d86a8; }
.dot-oilSalt { background: #b98a3e; }
.food-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 11.5px; gap: 8px; }
.food-meta b { color: var(--ink-soft); font-weight: 600; }

.oilsalt-block { margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--line); display: grid; gap: 8px; }
.oilsalt-line { display: grid; grid-template-columns: 76px 1fr; gap: 8px 10px; align-items: center; }

.advice-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.advice-list li {
  position: relative;
  padding-left: 15px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.55;
}
.advice-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  opacity: 0.55;
}

/* ---------- 记录餐次 ---------- */

.meal-group { padding: 0; overflow: hidden; }
.meal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 13px 15px;
  border: 0;
  background: none;
  text-align: left;
}
.meal-head:active { background: var(--surface-soft); }
.meal-badge {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--green-soft);
  color: var(--green-deep);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  flex: 0 0 auto;
}
.meal-title { display: flex; flex-direction: column; gap: 1px; }
.meal-title b { font-size: 14px; font-weight: 650; }
.meal-title span { color: var(--muted); font-size: 11.5px; }
.meal-kcal { margin-left: auto; text-align: right; }
.meal-kcal b { font-size: 14px; }
.meal-kcal span { display: block; color: var(--muted); font-size: 10.5px; }
.meal-add {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--green);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.meal-add svg { width: 15px; height: 15px; }

.meal-items { border-top: 1px solid var(--line); padding: 4px 15px 10px; }
.meal-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 0;
  color: var(--ink-soft);
  font-size: 12.5px;
}
.meal-item .name { font-weight: 500; }
.meal-item .amt { color: var(--muted); font-size: 11.5px; }
.meal-item .kcal { margin-left: auto; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.meal-advice {
  margin: 4px 15px 12px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
}
.meal-empty {
  padding: 0 15px 14px;
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------- 登录 / 引导 ---------- */

.auth-screen {
  min-height: calc(100dvh - 20px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 0;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand h1 { margin: 0; font-size: 26px; letter-spacing: -0.01em; }
.auth-brand p { margin: 1px 0 0; color: var(--muted); font-size: 12.5px; }
.auth-title { margin: 0 0 6px; font-size: 22px; }
.auth-sub { margin: 0 0 18px; color: var(--muted); font-size: 13px; }

.tabs { display: flex; gap: 6px; margin-bottom: 18px; padding: 4px; border-radius: 14px; background: var(--surface-2); }
.tabs button {
  flex: 1;
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}
.tabs button.active { background: var(--surface); color: var(--green-deep); box-shadow: 0 1px 3px rgba(34, 34, 34, 0.1); }

.auth-note {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}
.form-error {
  display: none;
  margin: 10px 0 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 12.5px;
}
.form-error.show { display: block; }

.onboard-intro { margin-bottom: 18px; }
.onboard-intro h1 { margin: 0 0 8px; font-size: 27px; line-height: 1.25; letter-spacing: -0.01em; }
.onboard-intro p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.6; }

.target-preview {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: var(--green-soft);
  color: var(--green-deep);
}
.target-preview .preview-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.preview-stat b { display: block; font-size: 19px; line-height: 1.2; }
.preview-stat span { display: block; color: #5b7c68; font-size: 10.5px; margin-top: 2px; }
.target-preview .warning-list { margin: 10px 0 0; padding: 10px 0 0; border-top: 1px solid rgba(44, 85, 66, 0.18); list-style: none; display: grid; gap: 4px; font-size: 11.5px; color: #6a4a22; }
.target-preview.is-empty { display: none; }
.preview-status { margin-top: 8px; font-size: 11.5px; color: #5b7c68; text-align: center; }

/* ---------- 记一餐 ---------- */

.record-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.record-head h1 { margin: 0; font-size: 20px; }
.record-head .record-sub { margin: 1px 0 0; color: var(--muted); font-size: 11.5px; }

.source-toggle { margin-bottom: 14px; }

.photo-panel { padding: 14px; }
.photo-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 26px 16px;
  border: 1px dashed #dcd7ca;
  border-radius: 14px;
  background: var(--surface-soft);
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.photo-drop svg { width: 30px; height: 30px; color: var(--green); opacity: 0.8; }
.photo-actions { display: flex; gap: 10px; width: 100%; justify-content: center; flex-wrap: wrap; }
.photo-preview { position: relative; border-radius: 14px; overflow: hidden; background: #ddd; }
.photo-preview img { display: block; width: 100%; max-height: 300px; object-fit: cover; }
.photo-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 11.5px; color: var(--muted); }

.provider-chip { display: inline-flex; align-items: center; gap: 6px; }
.provider-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }
.provider-dot.real { background: var(--green); }

.notice {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--amber-soft);
  color: #7a4a1d;
  font-size: 12px;
  line-height: 1.5;
}
.notice--quiet { background: var(--surface-soft); color: var(--muted); border: 1px solid var(--line); }
.notice svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 2px; }

.spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(44, 85, 66, 0.2);
  border-top-color: var(--green);
  animation: spin 0.7s linear infinite;
  display: inline-block;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.item-card { padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.item-card + .item-card { margin-top: 10px; }
.item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.item-head .input { min-height: 40px; padding: 8px 10px; font-weight: 600; background: var(--surface-soft); }
.item-remove { border: 0; background: none; color: var(--muted); padding: 6px; border-radius: 8px; }
.item-remove svg { width: 17px; height: 17px; }
.item-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.item-grid .field { margin-bottom: 8px; }
.item-grid .field-label { font-size: 10.5px; color: var(--muted); margin-bottom: 3px; font-weight: 500; letter-spacing: 0; }
.item-grid .input { min-height: 38px; padding: 7px 9px; font-size: 13px; }
.item-grid .select { min-height: 38px; padding: 7px 9px; font-size: 13px; }
.item-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.item-range { color: var(--muted); font-size: 11px; }
.item-cat { min-height: 34px; padding: 5px 8px; font-size: 12px; width: auto; min-width: 104px; }
.item-subtype { min-height: 34px; padding: 5px 8px; font-size: 12px; width: auto; }
.item-extra { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }

.add-item-btn {
  width: 100%;
  margin-top: 10px;
  padding: 11px;
  border: 1px dashed #dcd7ca;
  border-radius: 12px;
  background: transparent;
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
}
.add-item-btn svg { width: 15px; height: 15px; vertical-align: -2px; margin-right: 5px; }

.record-foot { margin-top: 18px; }
.record-foot .btn--primary { min-height: 50px; font-size: 15px; }

.record-summary {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: center;
}
.record-summary.is-empty { display: none; }
.summary-main { font-size: 13px; color: var(--muted); }
.summary-main b { font-size: 27px; line-height: 1.1; color: var(--ink); margin-right: 4px; letter-spacing: -0.02em; }
.summary-meta { margin-top: 4px; color: var(--muted); font-size: 12px; }
.summary-range {
  display: inline-block;
  margin-top: 7px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-deep);
  font-size: 11.5px;
}

/* ---------- 报告 ---------- */

.report-tabs { margin-bottom: 16px; }
.stat-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile {
  padding: 12px 10px;
  border-radius: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  text-align: center;
}
.tile b { display: block; font-size: 20px; line-height: 1.2; letter-spacing: -0.01em; }
.tile span { display: block; margin-top: 3px; color: var(--muted); font-size: 10.5px; }
.tile--accent { background: var(--green-soft); border-color: #d9e4dc; color: var(--green-deep); }
.tile--accent span { color: #5b7c68; }

.day-chart { position: relative; display: flex; align-items: flex-end; gap: 4px; height: 112px; margin-top: 8px; }
.day-bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; position: relative; border-radius: 5px; background: #f1ece2; overflow: hidden; }
.day-bar-fill { width: 100%; background: var(--green-soft); border-radius: 5px 5px 0 0; min-height: 2px; position: relative; z-index: 1; }
.day-bar.over .day-bar-fill { background: #efc7c2; }
.day-target { position: absolute; left: 0; right: 0; border-top: 1px dashed rgba(44, 85, 66, 0.45); z-index: 0; }
.day-labels { display: flex; gap: 4px; margin-top: 6px; color: var(--muted); font-size: 9px; }
.day-labels span { flex: 1; text-align: center; overflow: hidden; white-space: nowrap; }
.chart-note { margin: 8px 0 0; color: var(--muted); font-size: 11px; }

/* ---------- 提醒 ---------- */

.reminder-card { padding: 0; overflow: hidden; }
.reminder-top { display: flex; align-items: center; gap: 12px; padding: 14px 15px; }
.reminder-top .meal-badge { background: var(--surface-2); color: var(--ink-soft); }
.reminder-top .switch-copy { flex: 1; min-width: 0; }
.reminder-detail { padding: 0 15px 15px; }
.reminder-detail .field { margin-bottom: 10px; }
.reminder-detail .field:last-child { margin-bottom: 0; }

.notice-card {
  padding: 12px 14px;
  border-radius: 13px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.permission-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- 设置 ---------- */

.settings-list { padding: 0; overflow: hidden; }
.settings-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  text-align: left;
  color: var(--ink);
}
.settings-item:first-child { border-top: 0; }
.settings-item:active { background: var(--surface-soft); }
.settings-item .si-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--surface-soft);
  display: grid;
  place-items: center;
  color: var(--green);
  flex: 0 0 auto;
}
.settings-item svg { width: 17px; height: 17px; }
.si-copy { flex: 1; min-width: 0; }
.si-title { display: block; font-size: 14px; font-weight: 600; }
.si-sub { display: block; margin-top: 1px; color: var(--muted); font-size: 11.5px; line-height: 1.4; }
a.settings-item { color: inherit; }
.settings-item .chevron { color: var(--muted); font-size: 16px; }

.kv-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.kv-grid .kv { padding: 8px 4px; border-radius: 10px; background: var(--surface-soft); }
.kv b { display: block; font-size: 16px; }
.kv span { color: var(--muted); font-size: 10.5px; }

.privacy-list { margin: 0; padding-left: 16px; color: var(--ink-soft); font-size: 12.5px; line-height: 1.65; display: grid; gap: 5px; }
.privacy-list li::marker { color: var(--green); }
.danger-zone { margin-top: 22px; }
.danger-text { color: var(--muted); font-size: 11.5px; text-align: center; margin-top: 10px; }

/* ---------- Toast / Sheet / 提醒条 ---------- */

.toast-wrap {
  position: fixed;
  left: 0;
  right: 0;
  top: calc(14px + env(safe-area-inset-top));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 90;
  pointer-events: none;
  padding: 0 16px;
}
.toast {
  max-width: 460px;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(34, 34, 34, 0.92);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  animation: toast-in 0.24s ease-out;
  text-align: center;
}
.toast.success { background: rgba(35, 68, 53, 0.95); }
.toast.error { background: rgba(150, 52, 45, 0.95); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(25, 23, 19, 0.42);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in 0.2s ease;
}
.sheet {
  width: 100%;
  max-width: 540px;
  max-height: 88dvh;
  overflow-y: auto;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0;
  background: var(--surface);
  animation: sheet-in 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@media (min-width: 620px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 24px; width: 460px; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-in { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { margin-bottom: 12px; }
.sheet-head h2 { margin: 0; font-size: 18px; }
.sheet-head p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet-actions .btn { flex: 1; }

.reminder-banner {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  top: calc(12px + env(safe-area-inset-top));
  z-index: 80;
  width: calc(100% - 32px);
  max-width: 480px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 14px 34px rgba(34, 34, 34, 0.16);
  animation: toast-in 0.24s ease-out;
}
.reminder-banner b { display: block; font-size: 13.5px; color: var(--green-deep); }
.reminder-banner p { margin: 2px 0 0; color: var(--ink-soft); font-size: 12px; }
.reminder-banner .close-x {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 26px;
  height: 26px;
  border: 0;
  background: none;
  color: var(--muted);
}

/* ---------- 工具类 ---------- */

.hidden { display: none !important; }
.muted { color: var(--muted); }
.tiny { font-size: 11px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.empty {
  padding: 26px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.nowrap { white-space: nowrap; }
