/* ===== 基础 ===== */
:root {
  --bg: #F8F6F3;
  --card: #fff;
  --primary: #FF7E67;
  --primary-dark: #E17055;
  --text: #3D3D3D;
  --muted: #B2BEC3;
  --border: #EDEAE6;
  --warn: #FDCB6E;
  --danger: #E17055;
  --success: #00B894;
  --radius: 16rpx;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 80px;
  padding-top: 50px;
}

/* ===== 导航栏 ===== */
.nav-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 50px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(225,112,85,0.2);
}
.nav-title { font-size: 18px; font-weight: 600; }
.nav-action { font-size: 20px; cursor: pointer; }

/* ===== 底部导航 ===== */
.tab-bar {
  position: fixed; bottom: 0; left: 0; right: 0; height: 60px;
  background: #fff;
  display: flex;
  border-top: 1px solid var(--border);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-item {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: pointer; color: var(--muted);
  transition: color 0.2s;
}
.tab-item.active { color: var(--primary); }
.tab-icon { font-size: 22px; }
.tab-text { font-size: 10px; margin-top: 2px; }
.tab-add .tab-icon {
  background: var(--primary); color: #fff;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin-top: -10px;
}

/* ===== 页面容器 ===== */
.page-container { padding: 12px 14px; }
.page { display: none; }
.page.active { display: block; }

/* ===== 通用卡片 ===== */
.card {
  background: var(--card);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

/* ===== 快照卡片 ===== */
.snapshot-card {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 20px;
  padding: 28px;
  color: #fff;
  margin-bottom: 12px;
}
.snap-title { font-size: 13px; opacity: 0.85; margin-bottom: 14px; }
.snap-grid { display: flex; gap: 30px; margin-bottom: 18px; }
.snap-item { text-align: center; }
.snap-num { font-size: 36px; font-weight: 700; display: block; }
.snap-label { font-size: 12px; opacity: 0.9; }
.snap-warn .snap-num { color: var(--warn); }
.snap-danger .snap-num { color: #FFEAA7; }
.cat-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-tag {
  background: rgba(255,255,255,0.2);
  padding: 4px 14px; border-radius: 14px;
  font-size: 11px;
}

/* ===== 贴士条 ===== */
.tips-bar {
  background: #FFF8F0;
  border-radius: 12px; padding: 14px 16px;
  display: flex; align-items: center;
  margin-bottom: 12px;
  border-left: 4px solid var(--primary);
}
.tips-text { font-size: 13px; color: var(--primary-dark); flex: 1; margin-left: 8px; }

/* ===== 区域标题 ===== */
.section { margin: 12px 0; }
.section-title { font-size: 16px; font-weight: 700; margin-bottom: 10px; }

/* ===== 食材迷你卡片 ===== */
.food-mini {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--card);
  padding: 12px 16px; border-radius: 10px;
  margin-bottom: 6px; font-size: 14px;
}
.food-mini.expired { opacity: .45; }
.mini-icon { font-size: 24px; margin-right: 8px; }
.mini-info { flex: 1; }

/* ===== 快捷按钮 ===== */
.quick-actions { display: flex; gap: 10px; margin: 20px 0; }
.action-btn {
  flex: 1; font-size: 13px; padding: 16px 0;
  background: var(--card); border: none; border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  cursor: pointer; text-align: center; color: var(--text);
}

/* ===== 按钮 ===== */
.btn-primary {
  background: var(--primary); color: #fff;
  border: none; border-radius: 12px;
  font-size: 15px; padding: 12px 30px; cursor: pointer;
}
.btn-primary.full { width: 100%; padding: 14px; }
.btn-primary.sm { padding: 8px 20px; font-size: 13px; }
.btn-danger { background: var(--danger); color: #fff; border: none; border-radius: 12px; font-size: 13px; padding: 8px 20px; cursor: pointer; }
.btn-warning { background: var(--warn); color: var(--text); border: none; border-radius: 12px; font-size: 13px; padding: 8px 20px; cursor: pointer; }
.btn-warning.sm { padding: 6px 16px; font-size: 12px; }

/* ===== Tag & Badge ===== */
.badge {
  display: inline-block; padding: 3px 12px; border-radius: 12px;
  font-size: 11px; color: #fff;
}
.badge-fresh { background: var(--success); }
.badge-expiring { background: var(--warn); color: var(--text); }
.badge-expired { background: var(--danger); }

.tag {
  display: inline-block; padding: 3px 10px; border-radius: 14px;
  font-size: 11px; margin: 2px;
  background: #FFEDE8; color: var(--primary);
}

/* ===== 筛选栏 ===== */
.filter-bar { display: flex; gap: 8px; margin: 12px 0; overflow-x: auto; }
.filter-tag {
  padding: 7px 16px; border-radius: 16px;
  background: #F0EDE8; font-size: 12px; color: #8D8D8D;
  cursor: pointer; white-space: nowrap; border: none;
}
.filter-tag.active { background: var(--primary); color: #fff; }

/* ===== 食材列表 ===== */
.food-card {
  background: var(--card); border-radius: 14px;
  padding: 14px; margin-bottom: 8px;
  display: flex; align-items: center;
}
.food-icon { font-size: 36px; width: 50px; text-align: center; flex-shrink: 0; }
.food-info { flex: 1; margin-left: 10px; }
.food-name { font-size: 16px; font-weight: 500; }
.food-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.food-date { font-size: 11px; color: var(--muted); margin-top: 2px; }
.food-actions { text-align: right; }
.food-btns { margin-top: 6px; }
.food-btn { font-size: 18px; margin-left: 10px; cursor: pointer; }

/* ===== 表单 ===== */
.form-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.form-group { margin-bottom: 14px; }
.form-label { font-size: 13px; color: #6D6D6D; margin-bottom: 6px; display: block; }
.form-input {
  width: 100%; background: #F8F6F3;
  border: 1px solid var(--border); border-radius: 12px;
  padding: 12px; font-size: 14px; color: var(--text);
}
.form-input:focus { outline: none; border-color: var(--primary); }
.form-row { display: flex; gap: 10px; }
.half { flex: 1; }
.cat-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-option {
  padding: 7px 16px; border-radius: 16px;
  background: #F0EDE8; font-size: 12px; color: #8D8D8D;
  cursor: pointer; border: none;
}
.cat-option.active { background: var(--primary); color: #fff; }
.scan-btn {
  width: 100%; padding: 14px; border: 2px dashed var(--primary);
  color: var(--primary); background: var(--card);
  border-radius: 14px; font-size: 14px; cursor: pointer;
}
.or-divider { text-align: center; color: var(--muted); font-size: 12px; margin: 16px 0; }

/* ===== 菜谱列表 ===== */
.ingredient-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.ing-tag {
  background: #FFEDE8; color: var(--primary);
  padding: 4px 12px; border-radius: 14px; font-size: 12px;
}
.conflict-bar {
  background: #FFF5F3; border-radius: 12px;
  padding: 12px 14px; margin-bottom: 12px;
  border-left: 4px solid var(--danger);
  font-size: 12px;
}
.recipe-card {
  background: var(--card); border-radius: 14px;
  padding: 16px; margin-bottom: 10px;
  cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.recipe-header { display: flex; justify-content: space-between; align-items: flex-start; }
.recipe-name { font-size: 16px; font-weight: 500; }
.recipe-desc { font-size: 12px; color: var(--muted); margin-top: 3px; }
.recipe-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.recipe-match { text-align: center; min-width: 50px; }
.match-num { font-size: 22px; font-weight: 700; display: block; }
.match-label { font-size: 10px; color: var(--muted); }
.missing-bar { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 11px; }
.missing-tag { background: #FFF5F3; color: var(--danger); padding: 2px 10px; border-radius: 8px; font-size: 11px; }
/* ===== 冰箱图景 ===== */
.fridge-shelf {
  background: linear-gradient(180deg, #E3F2FD 0%, #BBDEFB 50%, #E8EAF6 100%);
  border-radius: 16px; padding: 16px;
  margin-bottom: 12px;
  border: 2px solid #BBDEFB;
}
.shelf-label { font-size: 13px; font-weight: 600; margin-bottom: 10px; color: #1565C0; }
.shelf-items { display: flex; flex-wrap: wrap; gap: 8px; }
.fridge-item {
  background: #fff; padding: 6px 12px; border-radius: 12px;
  font-size: 13px; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  display: inline-flex; align-items: center; gap: 2px;
}
.fridge-item-warn { background: #FFF8E1; border: 1px solid #FDCB6E; }
.fridge-item-expired { background: #FFEBEE; border: 1px solid #EF9A9A; opacity: 0.7; }
.conflict-mini { margin-top: 6px; font-size: 11px; color: var(--danger); }
.recipe-emoji { font-size: 28px; margin-right: 4px; vertical-align: middle; }
.shop-suggestions { margin-bottom: 10px; }
.avatar-option { transition: transform 0.2s; }
.avatar-option:hover { transform: scale(1.2); }
.recipe-emoji { font-size: 28px; margin-right: 4px; vertical-align: middle; }
.shop-suggestions { margin-bottom: 10px; }

/* ===== 弹窗 ===== */
.modal {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 200;
  overflow-y: auto; padding: 20px 0 80px;
}
.modal.show { display: block; }
.modal-content {
  background: var(--card); margin: 40px 14px; border-radius: 20px;
  padding: 24px; position: relative;
}
.modal-close {
  position: absolute; top: 14px; right: 16px;
  font-size: 22px; cursor: pointer; color: var(--muted);
}
.recipe-detail-name { font-size: 24px; font-weight: 700; margin: 0 30px 8px 0; }
.recipe-detail-desc { font-size: 14px; color: #888; margin-bottom: 16px; }
.detail-section { margin-bottom: 20px; }
.detail-section-title { font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.ing-list { display: flex; flex-wrap: wrap; gap: 8px; }
.ing-item {
  background: var(--bg); padding: 8px 16px; border-radius: 10px;
  font-size: 13px; width: 48%;
}
.ing-item.has { color: var(--success); }
.ing-item.miss { color: var(--danger); }
.step-item { display: flex; margin-bottom: 12px; }
.step-num {
  width: 32px; height: 32px; background: var(--primary); color: #fff;
  border-radius: 50%; text-align: center; line-height: 32px;
  font-size: 14px; margin-right: 10px; flex-shrink: 0;
}
.step-text { font-size: 14px; line-height: 1.6; flex: 1; }

/* ===== 采购清单 ===== */
.shop-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.shop-item {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--card); padding: 12px 14px; border-radius: 10px;
  margin-bottom: 6px;
}
.shop-item.done { opacity: .35; }
.shop-left { display: flex; align-items: center; gap: 8px; }
.shop-checkbox { width: 20px; height: 20px; cursor: pointer; }
.shop-name { font-size: 15px; }
.shop-del { font-size: 16px; cursor: pointer; }
.add-bar { display: flex; gap: 8px; margin-top: 16px; }
.add-input {
  flex: 1; background: var(--bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px; font-size: 14px;
}

/* ===== 小贴士 ===== */
.tip-card {
  background: var(--card); border-radius: 14px;
  padding: 14px 16px; margin-bottom: 8px;
}
.tip-content { font-size: 14px; line-height: 1.6; }
.tip-cat { font-size: 11px; color: var(--muted); margin-top: 6px; display: block; }

/* ===== 家庭组 ===== */
.family-card { @extend .card; }
.family-invite {
  font-size: 14px; margin: 12px 0;
}
.invite-code {
  color: var(--primary); font-weight: 700; font-size: 22px;
  letter-spacing: 2px;
}
.member-tag {
  display: inline-block; background: #FFEDE8; color: var(--primary);
  padding: 4px 14px; border-radius: 14px; font-size: 12px; margin: 3px;
}

/* ===== 空状态 ===== */
.empty-state { text-align: center; padding: 60px 0; color: #D5CDC4; }
.empty-icon { font-size: 64px; margin-bottom: 14px; }
.empty-link { color: var(--primary); font-size: 14px; text-decoration: none; }

/* ===== Toast ===== */
.toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: rgba(0,0,0,0.8); color: #fff;
  padding: 16px 30px; border-radius: 14px; font-size: 16px;
  z-index: 300; display: none; pointer-events: none;
  white-space: nowrap;
}
.toast.show { display: block; animation: toastIn .3s ease-out; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%,-50%) scale(0.8); } to { opacity: 1; transform: translate(-50%,-50%) scale(1); } }

/* ===== 扫码器 ===== */
.scanner-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.9); z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.scanner-box {
  background: #fff; border-radius: 20px; padding: 20px;
  width: 100%; max-width: 360px;
}
.scanner-header {
  display: flex; justify-content: space-between;
  font-size: 16px; font-weight: 600; margin-bottom: 12px;
}
