* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --primary: #FF7A59;
  --primary-light: #FFF1EC;
  --green: #3BA272;
  --green-light: #E8F6EF;
  --orange: #F0A020;
  --orange-light: #FDF3E0;
  --red: #E24B4A;
  --red-light: #FCEBEB;
  --text: #1D1D1F;
  --text-2: #6E6E73;
  --text-3: #A1A1A6;
  --bg: #F7F6F4;
  --card: #FFFFFF;
  --border: #EFEDEA;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5;
  max-width: 750px; margin: 0 auto;
}
#app { min-height: 100%; padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
.page { padding: 12px 14px; }
.hidden { display: none !important; }

/* 顶部宝宝栏 */
.baby-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: 14px; padding: 14px;
  margin-bottom: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.baby-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 600;
}
.baby-info { flex: 1; min-width: 0; }
.baby-name { font-size: 16px; font-weight: 600; }
.baby-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.baby-switch { font-size: 13px; color: var(--primary); padding: 6px 4px; }

/* 卡片 */
.card {
  background: var(--card); border-radius: 14px; padding: 14px;
  margin-bottom: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.card-title .more { font-size: 12px; color: var(--text-3); font-weight: 400; }

/* 排敏计划卡 */
.plan-card { display: flex; align-items: center; gap: 12px; }
.plan-ring {
  width: 56px; height: 56px; border-radius: 50%; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--primary-light); color: var(--primary);
}
.plan-ring .d { font-size: 17px; font-weight: 700; line-height: 1.1; }
.plan-ring .t { font-size: 10px; }
.plan-main { flex: 1; min-width: 0; }
.plan-food { font-size: 16px; font-weight: 600; }
.plan-meta { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.plan-dots { display: flex; gap: 6px; margin-top: 8px; }
.dot {
  width: 22px; height: 22px; border-radius: 50%; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); color: var(--text-3); border: 1px solid var(--border);
}
.dot.done { background: var(--green-light); color: var(--green); border-color: var(--green); }
.dot.today { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 20px; font-size: 14px; padding: 8px 18px;
  background: var(--primary); color: #fff; cursor: pointer; white-space: nowrap;
}
.btn:active { opacity: .85; }
.btn.ghost { background: var(--card); color: var(--primary); border: 1px solid var(--primary); }
.btn.gray { background: var(--bg); color: var(--text-2); }
.btn.block { display: flex; width: 100%; padding: 13px; border-radius: 12px; font-size: 16px; font-weight: 600; }
.btn.sm { padding: 5px 12px; font-size: 12px; border-radius: 14px; }

/* 空状态 */
.empty { text-align: center; padding: 46px 20px; color: var(--text-3); }
.empty .ico { font-size: 44px; margin-bottom: 10px; }
.empty .txt { font-size: 14px; line-height: 1.7; }

/* 悬浮按钮 */
.fab {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom));
  width: calc(100% - 28px); max-width: 722px;
  display: flex; gap: 10px; z-index: 20;
}

/* 分类标签 */
.cat-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; -webkit-overflow-scrolling: touch; }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  flex-shrink: 0; padding: 6px 14px; border-radius: 16px; font-size: 13px;
  background: var(--card); color: var(--text-2); border: 1px solid var(--border);
}
.cat-tab.on { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 搜索 */
.search-box { margin-bottom: 10px; }
.search-box input {
  width: 100%; border: none; background: var(--card); border-radius: 10px;
  padding: 10px 14px; font-size: 14px; outline: none;
}

/* 食物条目 */
.food-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px;
}
.food-name { flex: 1; font-size: 15px; }
.food-name .m { font-size: 11px; color: var(--text-3); margin-left: 6px; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 9px; flex-shrink: 0; }
.badge.lv1 { background: var(--green-light); color: var(--green); }
.badge.lv2 { background: var(--orange-light); color: var(--orange); }
.badge.lv3 { background: var(--red-light); color: var(--red); }
.badge.st-safe { background: var(--green-light); color: var(--green); }
.badge.st-suspected { background: var(--orange-light); color: var(--orange); }
.badge.st-allergic { background: var(--red-light); color: var(--red); }
.badge.st-active { background: var(--primary-light); color: var(--primary); }
.badge.st-abandoned { background: var(--bg); color: var(--text-3); }

/* 表单 */
.form-label { font-size: 13px; color: var(--text-2); margin: 14px 0 8px; font-weight: 600; }
.form-input, .form-textarea, .form-select {
  width: 100%; border: 1px solid var(--border); background: var(--card);
  border-radius: 10px; padding: 11px 12px; font-size: 15px; outline: none; font-family: inherit;
}
.form-textarea { min-height: 74px; resize: none; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg-item {
  padding: 8px 16px; border-radius: 18px; font-size: 14px;
  background: var(--card); border: 1px solid var(--border); color: var(--text-2);
}
.seg-item.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.seg-item.on-green { background: var(--green); color: #fff; border-color: var(--green); }
.seg-item.on-orange { background: var(--orange); color: #fff; border-color: var(--orange); }
.seg-item.on-red { background: var(--red); color: #fff; border-color: var(--red); }
.react-group { margin-bottom: 6px; }
.react-group .g-name { font-size: 12px; color: var(--text-3); margin: 8px 0 6px; }

/* 天数卡片 */
.day-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: 12px; padding: 13px 14px; margin-bottom: 8px;
}
.day-num {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); color: var(--text-3); font-weight: 700; font-size: 15px;
}
.day-card.done .day-num { background: var(--green-light); color: var(--green); }
.day-card.pending .day-num { background: var(--primary-light); color: var(--primary); }
.day-info { flex: 1; min-width: 0; }
.day-title { font-size: 15px; font-weight: 600; }
.day-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; word-break: break-all; }

/* 照片 */
.photo-row { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-cell { width: 72px; height: 72px; border-radius: 10px; overflow: hidden; position: relative; background: var(--bg); }
.photo-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-add {
  width: 72px; height: 72px; border-radius: 10px; border: 1px dashed var(--text-3);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 11px; gap: 2px; background: var(--card);
}
.photo-add .plus { font-size: 20px; line-height: 1; }
.photo-del {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; font-size: 11px; line-height: 18px; text-align: center;
}

/* 统计 */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.stat-cell { background: var(--card); border-radius: 12px; padding: 16px 8px; text-align: center; }
.stat-cell .n { font-size: 26px; font-weight: 700; }
.stat-cell .l { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.stat-cell.c-green .n { color: var(--green); }
.stat-cell.c-orange .n { color: var(--orange); }
.stat-cell.c-red .n { color: var(--red); }
.stat-cell.c-primary .n { color: var(--primary); }

/* 清单 tab */
.list-tabs { display: flex; background: var(--card); border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.list-tab { flex: 1; text-align: center; padding: 8px; font-size: 14px; border-radius: 9px; color: var(--text-2); }
.list-tab.on { background: var(--primary); color: #fff; font-weight: 600; }

/* 登录提示页 */
.gate { padding: 70px 30px; text-align: center; }
.gate .logo { font-size: 50px; margin-bottom: 16px; }
.gate h2 { font-size: 18px; margin-bottom: 10px; }
.gate p { font-size: 13px; color: var(--text-2); line-height: 1.8; }
.gate .debug { margin-top: 20px; font-size: 11px; color: var(--text-3); word-break: break-all; text-align: left; background: var(--card); border-radius: 10px; padding: 10px; }
.gate-err { background: #FFF0ED; color: var(--red); font-size: 13px; padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; }
.login-form { width: 100%; max-width: 300px; margin-top: 8px; }
.code-row { display: flex; gap: 10px; margin-bottom: 12px; }
.code-row .form-input { flex: 1; margin-bottom: 0; }
.code-row .btn { white-space: nowrap; }

/* toast */
.toast {
  position: fixed; top: 40%; left: 50%; transform: translate(-50%,-50%);
  background: rgba(0,0,0,.75); color: #fff; font-size: 14px;
  padding: 10px 20px; border-radius: 10px; z-index: 99; max-width: 80%;
}
/* 弹层 */
.mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: flex-end; }
.sheet { background: var(--card); width: 100%; max-width: 750px; margin: 0 auto; border-radius: 16px 16px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
.sheet h3 { font-size: 16px; margin-bottom: 14px; text-align: center; }
.sheet-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 4px; border-top: 1px solid var(--border); font-size: 15px; }
.sheet-row:first-of-type { border-top: none; }
