/* ===== 每周食谱管家 · 薄荷绿 + 小红书卡片风 ===== */
:root {
  --mint: #54B991;
  --mint-dark: #3E9A78;
  --mint-light: #E3F3EC;
  --cream: #FAF7F2;
  --card: #FFFFFF;
  --ink: #2F3533;
  --gray: #8A938F;
  --line: #EFEAE3;
  --orange: #FF9F68;
  --orange-light: #FFF0E6;
  --red: #E56B6B;
  --radius: 18px;
  --shadow: 0 4px 18px rgba(60, 90, 80, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--cream);
  color: var(--ink);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* ===== 视图 ===== */
.view { min-height: 100vh; }
.main-view { padding-bottom: 64px; }

/* ===== 登录页 ===== */
.auth-view {
  display: flex; flex-direction: column; align-items: center;
  padding: 12vh 24px 0;
  background: linear-gradient(160deg, #E8F6EF 0%, var(--cream) 55%);
  min-height: 100vh;
}
.auth-logo { font-size: 56px; margin-bottom: 8px; }
.auth-title { font-size: 26px; font-weight: 800; color: var(--mint-dark); letter-spacing: 1px; }
.auth-sub { color: var(--gray); margin: 6px 0 28px; font-size: 13px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--card);
  border-radius: 24px; padding: 20px; box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.auth-tabs { display: flex; margin-bottom: 16px; background: var(--cream); border-radius: 12px; padding: 4px; }
.auth-tab { flex: 1; border: none; background: none; padding: 9px; border-radius: 9px; font-size: 15px; color: var(--gray); cursor: pointer; }
.auth-tab.active { background: var(--mint); color: #fff; font-weight: 600; }
.auth-form input {
  width: 100%; padding: 12px 14px; margin-bottom: 12px;
  border: 1.5px solid var(--line); border-radius: 12px; font-size: 15px;
  background: #FBFBF8; outline: none; transition: border .2s;
}
.auth-form input:focus { border-color: var(--mint); }
.auth-error { color: var(--red); font-size: 13px; min-height: 18px; margin-bottom: 6px; }
.btn-primary {
  width: 100%; padding: 13px; border: none; border-radius: 12px;
  background: var(--mint); color: #fff; font-size: 16px; font-weight: 700;
  cursor: pointer; transition: opacity .2s;
}
.btn-primary:active { opacity: .85; }
.auth-foot { margin-top: 24px; color: var(--gray); font-size: 12px; }

/* ===== 顶部栏 ===== */
#app-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: rgba(250,247,242,0.92);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.header-title { font-size: 18px; font-weight: 800; }
.header-right { display: flex; align-items: center; gap: 8px; }
.header-btn {
  border: none; background: var(--card); border-radius: 10px;
  padding: 7px 11px; font-size: 13px; color: var(--mint-dark);
  border: 1px solid var(--line); cursor: pointer; font-weight: 600;
}

/* ===== 页面容器 ===== */
#page-container { padding: 16px 16px 20px; max-width: 520px; margin: 0 auto; }

/* ===== 周切换 ===== */
.week-switch {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border-radius: var(--radius); padding: 10px 14px;
  margin-bottom: 14px; border: 1px solid var(--line); box-shadow: var(--shadow);
}
.week-nav { border: none; background: none; font-size: 20px; color: var(--mint-dark); cursor: pointer; padding: 0 8px; }
.week-label { font-weight: 700; font-size: 15px; }

/* ===== 日期条 ===== */
.day-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; -webkit-overflow-scrolling: touch; }
.day-chip {
  flex-shrink: 0; min-width: 52px; text-align: center; padding: 8px 6px;
  background: var(--card); border-radius: 14px; border: 1.5px solid var(--line); cursor: pointer;
}
.day-chip.active { background: var(--mint); border-color: var(--mint); color: #fff; }
.day-chip .dow { font-size: 12px; opacity: .8; }
.day-chip .dnum { font-size: 16px; font-weight: 800; }

/* ===== 餐卡 ===== */
.day-title { font-size: 17px; font-weight: 800; margin: 10px 0 12px; display: flex; align-items: center; justify-content: space-between; }
.day-title .kcal-total { font-size: 13px; font-weight: 800; color: var(--mint-dark); background: var(--mint-light); padding: 4px 10px; border-radius: 20px; }
.meal-card {
  background: var(--card); border-radius: var(--radius); border: 1px solid var(--line);
  padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--shadow);
  position: relative; cursor: pointer;
}
.meal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.meal-ico { font-size: 18px; }
.meal-type {
  font-size: 12px; font-weight: 700; color: var(--mint-dark);
  background: var(--mint-light); padding: 3px 10px; border-radius: 20px;
}
.meal-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.meal-kcal { font-size: 12px; font-weight: 800; color: var(--orange); background: var(--orange-light); padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.meal-content { font-size: 14px; line-height: 1.55; color: #444; padding-right: 8px; }
.meal-content.empty { color: #B9C2BD; font-style: normal; }
.meal-check {
  width: 24px; height: 24px; flex-shrink: 0;
  border-radius: 50%; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: #fff; cursor: pointer; transition: all .2s;
}
.meal-check.done { background: var(--orange); border-color: var(--orange); }
.meal-photo { display: block; width: 72px; height: 40px; margin: 8px 0 0 auto; border-radius: 10px; object-fit: cover; border: 1.5px solid var(--line); cursor: pointer; }
.meal-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tag-chip { font-size: 11px; color: var(--mint-dark); background: var(--mint-light); padding: 2px 8px; border-radius: 20px; }
.tag-chip.dish { cursor: pointer; }
.tag-chip.dish:hover { background: var(--mint); color: #fff; }

/* ===== 汇总卡 ===== */
.summary-card {
  background: linear-gradient(135deg, #E8F6EF, #F5FBF8);
  border-radius: var(--radius); padding: 14px; margin-bottom: 14px;
  border: 1px solid #D6EBE1; display: flex; align-items: center; justify-content: space-between;
}
.summary-item { text-align: center; flex: 1; }
.summary-item .num { font-size: 20px; font-weight: 800; color: var(--mint-dark); }
.summary-item .lbl { font-size: 11px; color: var(--gray); margin-top: 2px; }

/* ===== 环形进度 ===== */
.ring-wrap { display: flex; align-items: center; gap: 18px; background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.ring { position: relative; width: 88px; height: 88px; flex-shrink: 0; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800; color: var(--mint-dark); }
.ring-info h3 { font-size: 15px; margin-bottom: 4px; }
.ring-info p { font-size: 12px; color: var(--gray); line-height: 1.5; }

/* ===== 打卡列表 ===== */
.checkin-group { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.checkin-group .cg-title { font-weight: 800; margin-bottom: 10px; font-size: 15px; }
.checkin-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.checkin-item:last-child { border-bottom: none; }
.checkin-item .ci-ico { font-size: 20px; }
.checkin-item .ci-name { font-size: 13px; color: #555; flex: 1; }
.checkin-item .ci-name.checked { color: var(--gray); text-decoration: line-through; }
.ci-check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 14px; color: transparent; transition: all .2s; flex-shrink: 0; }
.ci-check.done { background: var(--orange); border-color: var(--orange); color: #fff; }
.ci-photo { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; cursor: pointer; border: 1px solid var(--line); }
.ci-cam {
  width: 36px; height: 36px; border-radius: 10px; border: 1.5px dashed var(--mint);
  display: flex; align-items: center; justify-content: center; font-size: 16px; color: var(--mint-dark); cursor: pointer;
}

/* ===== 购物清单 ===== */
.shop-progress { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.shop-bar { height: 8px; background: var(--cream); border-radius: 20px; overflow: hidden; margin-top: 8px; }
.shop-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--mint), #7FD0AF); border-radius: 20px; transition: width .4s; }
.shop-cat { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.shop-cat-title { font-weight: 800; font-size: 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.shop-item { display: flex; align-items: center; gap: 8px; padding: 7px 0; font-size: 13px; border-bottom: 1px dashed var(--line); }
.shop-item:last-child { border-bottom: none; }
.shop-item.bought .si-name { color: var(--gray); text-decoration: line-through; }
.si-check { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 12px; color: transparent; flex-shrink: 0; }
.shop-item.bought .si-check { background: var(--mint); border-color: var(--mint); color: #fff; }
.si-name { flex: 1; }

/* ===== 我的页 ===== */
.profile-head { display: flex; align-items: center; gap: 14px; background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.avatar { width: 54px; height: 54px; border-radius: 50%; background: var(--mint-light); display: flex; align-items: center; justify-content: center; font-size: 26px; }
.profile-head .uname { font-weight: 800; font-size: 17px; }
.profile-head .udesc { font-size: 12px; color: var(--gray); margin-top: 3px; }

/* 体重模块 */
.weight-card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.weight-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.weight-top h3 { font-size: 15px; font-weight: 800; }
.weight-now { display: flex; align-items: baseline; gap: 8px; margin: 8px 0 4px; }
.weight-now .wkg { font-size: 36px; font-weight: 800; color: var(--mint-dark); }
.weight-now .wunit { color: var(--gray); }
.weight-delta { font-size: 13px; font-weight: 700; }
.wd-down { color: var(--mint-dark); } .wd-up { color: var(--orange); }
.weight-meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.w-chip { font-size: 12px; background: var(--cream); border-radius: 20px; padding: 4px 10px; color: #555; }
.w-chip b { color: var(--mint-dark); }
.weight-chart { margin: 12px 0; }
.weight-chart svg { width: 100%; height: auto; display: block; }
.weight-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.wstat { text-align: center; background: var(--cream); border-radius: 12px; padding: 8px 2px; }
.wstat .num { font-size: 14px; font-weight: 800; color: var(--mint-dark); }
.wstat .lbl { font-size: 10px; color: var(--gray); }
.weight-history { margin-top: 12px; }
.wh-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.wh-item:last-child { border-bottom: none; }
.wh-date { color: var(--gray); width: 84px; }
.wh-weight { font-weight: 700; }
.wh-photo { width: 56px; height: 32px; border-radius: 8px; object-fit: cover; cursor: pointer; border: 1px solid var(--line); }
.wh-del { margin-left: auto; color: var(--red); font-size: 12px; cursor: pointer; border: none; background: none; padding: 2px 4px; }
.wh-delphoto { color: var(--red); font-size: 12px; cursor: pointer; border: none; background: none; padding: 2px 4px; }

/* 菜单 */
.menu-card { background: var(--card); border-radius: var(--radius); margin-bottom: 12px; border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.menu-item:last-child { border-bottom: none; }
.menu-item .m-ico { font-size: 20px; }
.menu-item .m-title { flex: 1; font-weight: 600; font-size: 15px; }
.menu-item .m-desc { font-size: 11px; color: var(--gray); }
.menu-item .m-arrow { color: #C5CCC8; font-size: 16px; }

/* ===== 底部导航 ===== */
#tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  display: flex; background: rgba(255,255,255,0.95); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.tab-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; cursor: pointer; }
.tab-ico { font-size: 21px; transition: transform .2s; }
.tab-label { font-size: 11px; color: var(--gray); }
.tab-item.active .tab-label { color: var(--mint-dark); font-weight: 700; }
.tab-item.active .tab-ico { transform: scale(1.12); }
.tab-item.active { background: var(--mint-light); border-radius: 14px; margin: 0 4px; }

/* ===== 抽屉/Sheet ===== */
.overlay { position: fixed; inset: 0; background: rgba(30,40,36,0.45); z-index: 90; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  background: var(--card); border-radius: 24px 24px 0 0;
  padding: 10px 18px calc(20px + env(safe-area-inset-bottom));
  max-height: 86vh; overflow-y: auto; box-shadow: 0 -6px 30px rgba(0,0,0,.12);
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle { width: 40px; height: 4px; background: #E0E6E2; border-radius: 4px; margin: 4px auto 14px; }
.sheet-title { font-size: 17px; font-weight: 800; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.sheet-close { border: none; background: var(--cream); width: 28px; height: 28px; border-radius: 50%; font-size: 14px; cursor: pointer; }

/* 二次确认弹窗 */
.confirm-modal { position: fixed; inset: 0; z-index: 150; display: flex; align-items: center; justify-content: center; background: rgba(30,40,36,0.45); animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.confirm-card { width: 300px; max-width: 86vw; background: var(--card); border-radius: 24px; padding: 24px 22px 18px; text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,.16); animation: popIn .22s ease; }
@keyframes popIn { from { transform: scale(.88); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.confirm-emoji { font-size: 34px; margin-bottom: 8px; }
.confirm-title { font-size: 17px; font-weight: 800; margin-bottom: 8px; }
.confirm-msg { font-size: 14px; color: #666; line-height: 1.6; margin-bottom: 18px; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-btn { flex: 1; padding: 12px; border: none; border-radius: 14px; font-size: 15px; font-weight: 700; cursor: pointer; }
.confirm-btn.cancel { background: var(--cream); color: #666; }
.confirm-btn.ok { background: var(--orange); color: #fff; }

/* 表单 */
.form-group { margin-bottom: 12px; }
.form-group label { font-size: 13px; color: var(--gray); display: block; margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 11px 13px; border: 1.5px solid var(--line);
  border-radius: 12px; font-size: 15px; background: #FBFBF8; outline: none;
}
.form-group textarea { min-height: 80px; resize: vertical; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn { flex: 1; padding: 12px; border: none; border-radius: 12px; font-size: 15px; font-weight: 700; cursor: pointer; }
.btn-mint { background: var(--mint); color: #fff; }
.btn-mint-outline { background: #fff; color: var(--mint-dark); border: 1.5px solid var(--mint); }
.btn-gray { background: var(--cream); color: #666; }
.btn-orange { background: var(--orange); color: #fff; }

/* 菜品详情 */
.dish-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.dish-head .d-ico { font-size: 28px; }
.dish-name { font-size: 19px; font-weight: 800; }
.dish-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.dish-kcal { font-size: 13px; font-weight: 700; color: var(--orange); background: var(--orange-light); padding: 3px 10px; border-radius: 20px; }
.section-title { font-size: 14px; font-weight: 800; margin: 12px 0 8px; }
.dish-foods { display: flex; flex-wrap: wrap; gap: 6px; }
.dish-step { display: flex; gap: 8px; font-size: 14px; line-height: 1.6; color: #555; padding: 4px 0; }
.dish-step .step-num { color: var(--mint-dark); font-weight: 800; flex-shrink: 0; }
.dish-tip { background: var(--mint-light); border-radius: 12px; padding: 10px 12px; font-size: 13px; color: #3c6b58; margin-top: 10px; line-height: 1.5; }

/* 喜好按钮 */
.pref-row { display: flex; gap: 8px; margin-top: 14px; }
.pref-btn { flex: 1; padding: 9px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; font-size: 14px; }
.pref-btn.active-like { border-color: var(--mint); background: var(--mint-light); color: var(--mint-dark); font-weight: 700; }
.pref-btn.active-dislike { border-color: var(--red); background: #FDEBEB; color: var(--red); font-weight: 700; }

/* ===== 相册 ===== */
.album-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.album-item { position: relative; border-radius: 12px; overflow: hidden; aspect-ratio: 1; }
.album-item img { width: 100%; height: 100%; object-fit: cover; }
.album-item .al-tag { position: absolute; bottom: 4px; left: 4px; background: rgba(0,0,0,.55); color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 8px; }

/* ===== Toast ===== */
.toast {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%) translateY(-20px);
  background: rgba(40,50,46,0.92); color: #fff; padding: 10px 20px;
  border-radius: 30px; font-size: 14px; z-index: 200; opacity: 0; pointer-events: none;
  transition: all .3s; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 图片预览 ===== */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.94); z-index: 300; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; }
.lightbox img { max-width: 94%; max-height: 94%; border-radius: 10px; transform-origin: center center; transition: transform .12s ease; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.lightbox-close { position: fixed; top: 18px; right: 18px; width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.2); color: #fff; font-size: 17px; display: flex; align-items: center; justify-content: center; z-index: 2; cursor: pointer; }
.lightbox-hint { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: rgba(255,255,255,.16); color: rgba(255,255,255,.85); font-size: 12px; padding: 6px 14px; border-radius: 20px; white-space: nowrap; z-index: 2; pointer-events: none; }

/* ===== 生成模式选择 ===== */
.gen-option { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1.5px solid var(--line); border-radius: 14px; margin-bottom: 10px; cursor: pointer; transition: all .2s; }
.gen-option:hover { border-color: var(--mint); background: #F7FCFA; }
.gen-option .g-ico { font-size: 24px; }
.gen-option .g-title { font-weight: 700; font-size: 15px; }
.gen-option .g-desc { font-size: 12px; color: var(--gray); margin-top: 2px; }

/* 食谱库 */
.lib-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.lib-card { background: var(--card); border-radius: 14px; border: 1px solid var(--line); padding: 12px; cursor: pointer; box-shadow: var(--shadow); }
.lib-card .lc-name { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.lib-card .lc-meta { font-size: 11px; color: var(--gray); }
.lib-filter { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; padding-bottom: 4px; }
.lib-filter .chip { padding: 6px 12px; border-radius: 20px; background: var(--card); border: 1.5px solid var(--line); font-size: 13px; cursor: pointer; white-space: nowrap; }
.lib-filter .chip.active { background: var(--mint); border-color: var(--mint); color: #fff; font-weight: 600; }

.muted { color: var(--gray); font-size: 12px; }
.mt-10 { margin-top: 10px; }
.empty-tip { text-align: center; color: var(--gray); padding: 30px 0; font-size: 13px; }
