/* ============================================================
   食光 Pantry Life · 首页
   PC 与 Mobile 是两套重新设计的信息架构，不是等比例缩放：
   PC = 侧栏 + 双栏仪表盘 + 完整周表；Mobile = 单栏卡片流 + 横滑清单 + 大触屏按钮
   ============================================================ */

/* ---------------- 欢迎区 ---------------- */
.welcome {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
  min-height: 88px; /* 副标题移除后收拢欢迎区，临期卡随之上移 */
}
.welcome__text { position: relative; z-index: 2; }
.welcome h1 { font-size: 34px; margin: 6px 0 6px; }
.welcome h1 em { font-style: normal; color: var(--olive); }
.welcome__sub { font-size: 13px; color: var(--ink-2); }
.welcome__actions { display: flex; gap: 10px; position: relative; z-index: 2; }
.welcome__art {
  position: absolute;
  right: -18px; top: -46px;
  width: 190px; height: 190px;
  object-fit: contain;
  opacity: .92;
  border-radius: 0;
  background: transparent;
  transform: rotate(4deg);
  pointer-events: none;
}
.welcome__art--mb { display: none; }

/* ---------------- 临期提醒 · 首页视觉焦点 ---------------- */
.alert-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  gap: var(--sp-5);
  align-items: center;
  padding: 30px 34px;
  margin-bottom: var(--sp-5);
  background:
    radial-gradient(circle at 4% 12%, rgba(226, 164, 92, .30), transparent 38%),
    linear-gradient(112deg, #f2dfc8 0%, #f7ead9 52%, #fbf6e9 100%);
  border: 1px solid #e9d2b5;
  border-radius: var(--r-card);
  box-shadow: var(--shadow-lift);
  overflow: hidden;
}
.alert-hero::after {
  content: "";
  position: absolute;
  width: 260px; height: 260px;
  right: -110px; bottom: -170px;
  border-radius: var(--r-round);
  background: radial-gradient(circle, rgba(181, 84, 58, .10), transparent 70%);
}
.alert-hero__left { position: relative; z-index: 2; }
.alert-hero__flag {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--warm-deep); font-weight: 700;
}
.alert-hero__flag::before { content: ""; width: 16px; height: 1px; background: var(--warm); }
.alert-hero__num {
  font-family: var(--serif);
  font-size: 76px; line-height: 1;
  color: var(--cocoa);
  font-variant-numeric: tabular-nums;
  margin: 6px 0 0;
  letter-spacing: -2px;
}
.alert-hero__num small { font-size: 22px; margin-left: 10px; color: var(--warm-deep); letter-spacing: 0; }
.alert-hero__title { font-size: 19px; margin-top: 4px; color: var(--cocoa); }
.alert-hero__desc { font-size: 12px; color: var(--ink-2); margin: 8px 0 18px; max-width: 300px; line-height: 1.7; }
.alert-hero__desc--warn {
  margin: 0 0 18px; padding: 6px 10px;
  max-width: 300px;
  color: #8f3d24; background: rgba(181, 84, 58, .08);
  border-left: 2px solid rgba(181, 84, 58, .5);
  border-radius: 0 6px 6px 0;
}
.alert-hero__cta { display: flex; gap: 10px; align-items: center; }

.alert-hero__list { position: relative; z-index: 2; }
.alert-hero__list-head { display: flex; justify-content: space-between; align-items: center; font-size: 10px; color: var(--warm-deep); margin-bottom: 10px; letter-spacing: .6px; }
.expire-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 14px;
  background: rgba(251, 247, 236, .82);
  border: 1px solid rgba(233, 210, 181, .8);
  border-radius: var(--r-card-sm);
}
.expire-row + .expire-row { margin-top: 8px; }
.expire-row img { width: 44px; height: 44px; flex: none; }
.expire-row__name { font-size: 13px; font-weight: 600; }
.expire-row__meta { font-size: 10px; color: var(--ink-2); }
.expire-row__days { margin-left: auto; text-align: right; flex: none; }
.expire-row__days b { display: block; font-family: var(--serif); font-size: 19px; color: var(--clay); line-height: 1.1; }
.expire-row__days b.is-word { font-size: 13px; letter-spacing: .04em; padding-bottom: 2px; }
.expire-row__days span { font-size: 9px; color: var(--ink-3); }
.expire-row__days.is-over b { color: var(--clay-deep, #8f3d24); }
.expire-more {
  display: block; width: 100%; margin-top: 8px;
  padding: 7px 12px;
  font: inherit; font-size: 10px; color: var(--ink-3);
  background: rgba(251, 247, 236, .5);
  border: 1px dashed rgba(233, 210, 181, .95);
  border-radius: var(--r-card-sm);
  cursor: pointer; transition: background .16s, color .16s;
}
.expire-more:hover { background: rgba(255, 252, 245, .95); color: var(--ink-1); }

/* ---------------- 数据卡 ---------------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.metric { position: relative; padding: 18px 20px 17px; }
.metric__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.metric__label { font-size: 11px; color: var(--ink-2); }
.metric__icon {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: var(--r-round);
  background: var(--sage-wash);
  color: var(--olive);
}
.metric__icon svg { width: 15px; height: 15px; }
.metric__value { font-family: var(--serif); font-size: 32px; line-height: 1.2; margin-top: 8px; }
.metric__value small { font-family: var(--sans); font-size: 11px; color: var(--ink-3); margin-left: 5px; }
.metric__foot { font-size: 10px; color: var(--ink-3); margin-top: 2px; }
.metric .progress { margin-top: 10px; }

/* ---------------- 双栏：菜谱 + 周计划 ---------------- */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(300px, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}
.panel { padding: var(--sp-4); }
.recipe-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.recipe-card {
  position: relative;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-card-sm);
  background: var(--paper-warm);
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}
.recipe-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.recipe-card__img { width: 100%; height: 118px; object-fit: cover; border-radius: 0; }
.recipe-card__body { padding: 12px 14px 14px; }
.recipe-card__name { font-family: var(--serif); font-size: 16px; }
.recipe-card__meta { font-size: 10px; color: var(--ink-2); margin-top: 3px; }
.recipe-card__tags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

.week-list { display: flex; flex-direction: column; gap: 8px; }
.week-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--paper-warm);
  border-radius: var(--r-chip);
  font-size: 11px;
}
.week-row.is-today { background: var(--sage-pale); }
.week-row__day { font-family: var(--serif); font-size: 13px; color: var(--olive-deep); }
.week-row__meal { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.week-row__dot { width: 6px; height: 6px; border-radius: var(--r-round); background: var(--sage); }

/* ---------------- 消耗统计 ---------------- */
.stats-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .7fr); gap: var(--sp-5); align-items: center; }
.bar-row { display: grid; grid-template-columns: 74px minmax(0, 1fr) 52px; align-items: center; gap: 12px; margin-bottom: 11px; font-size: 11px; }
.bar-row__name { color: var(--ink-2); }
.bar-track { height: 9px; background: var(--cream-deep); border-radius: var(--r-pill); overflow: hidden; }
.bar-track > i { display: block; height: 100%; border-radius: var(--r-pill); background: var(--sage); }
.bar-row:nth-child(2) .bar-track > i { background: var(--honey); }
.bar-row:nth-child(3) .bar-track > i { background: var(--clay); }
.bar-row__val { text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.stats-aside { padding: 18px; background: var(--sage-wash); border-radius: var(--r-card-sm); }
.stats-aside__num { font-family: var(--serif); font-size: 30px; color: var(--olive-deep); }
.stats-aside__text { font-size: 11px; color: var(--ink-2); line-height: 1.7; margin-top: 4px; }

/* ---------------- Mobile 专属信息架构 ---------------- */
.mb-welcome { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 0; }
.mb-welcome h1 { font-size: 26px; margin: 3px 0; }
.mb-welcome__sub { font-size: 11px; color: var(--ink-2); }
.mb-welcome__art { width: 74px; height: 74px; object-fit: contain; background: transparent; border-radius: 0; transform: rotate(6deg); }

.mb-alert {
  position: relative;
  padding: 22px 20px 20px;
  margin-bottom: 18px;
  background: linear-gradient(135deg, #f0dcc4 0%, #f7e9da 62%, #fbf4e8 100%);
  border: 1px solid #e9d2b5;
  border-radius: var(--r-card);
  box-shadow: var(--shadow-lift);
  overflow: hidden;
}
.mb-alert__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.mb-alert__num { font-family: var(--serif); font-size: 58px; line-height: 1; color: var(--cocoa); }
.mb-alert__num small { font-size: 15px; margin-left: 6px; color: var(--warm-deep); }
.mb-alert__title { font-size: 15px; color: var(--cocoa); margin-top: 2px; }
.mb-alert__desc { font-size: 11px; color: var(--ink-2); margin-top: 5px; line-height: 1.6; }
.mb-alert__seal {
  width: 58px; height: 58px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-round);
  border: 1px dashed var(--warm);
  color: var(--warm-deep);
  font-family: var(--serif);
  font-size: 13px;
  transform: rotate(-12deg);
  background: rgba(251, 247, 236, .55);
}

/* 临期食材卡堆：一摞牌，顶张可拖走，下一张顶上来 */
.expire-stack {
  position: relative;
  height: 118px;          /* 卡高 96 + 3 层各下移 7px，留出「厚度」 */
  margin-top: 16px;
}
.expire-stack__card {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 96px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid rgba(233, 210, 181, .95);
  border-radius: var(--r-card-sm);
  box-shadow: 0 8px 18px rgba(107, 77, 54, .12);
  transform-origin: 50% 0;
  transform: translate3d(0, calc(var(--i, 0) * 7px), 0) scale(calc(1 - var(--i, 0) * .035));
  z-index: calc(20 - var(--i, 0));
  transition: transform .34s cubic-bezier(.22, .61, .36, 1), opacity .3s ease, box-shadow .3s ease;
  touch-action: pan-y;    /* 纵向滚动留给页面，横向手势交给 JS */
  will-change: transform;
}
.expire-stack__card.is-top { box-shadow: 0 12px 26px rgba(107, 77, 54, .2); cursor: grab; }
.expire-stack__card.is-dragging { cursor: grabbing; transition: none; }

.expire-stack__img {
  width: 54px; height: 54px; flex: none;
  border-radius: 14px;
  object-fit: cover;
  background: var(--sage-wash);
}
.expire-stack__info { flex: 1; min-width: 0; }
.expire-stack__name {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--cocoa);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.expire-stack__meta {
  margin-top: 2px;
  font-size: 10px;
  color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.expire-stack__days {
  flex: none; min-width: 58px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  padding: 8px 10px;
  border-radius: 15px;
  background: rgba(226, 164, 92, .2);
}
.expire-stack__days b {
  font-family: var(--serif);
  font-size: 23px; line-height: 1.05;
  font-weight: 400;
  color: var(--warm-deep);
  font-variant-numeric: tabular-nums;
}
.expire-stack__days b.is-word { font-size: 15px; letter-spacing: .02em; }
.expire-stack__days span { font-size: 9px; color: var(--ink-3); letter-spacing: .04em; }
.expire-stack__card.is-clay .expire-stack__days { background: rgba(181, 84, 58, .13); }
.expire-stack__card.is-clay .expire-stack__days b { color: var(--clay); }

/* 空态：一张虚线占位卡，不摆出「一摞」的错觉 */
.expire-stack.is-empty { height: 96px; }
.expire-stack__card.is-empty {
  position: relative;
  display: grid; place-items: center;
  background: rgba(251, 247, 236, .55);
  border: 1px dashed rgba(168, 135, 79, .42);
  box-shadow: none;
  transform: none;
  z-index: 1;
  cursor: default;
}
.expire-stack__empty { text-align: center; }
.expire-stack__empty b {
  display: block;
  font-family: var(--serif); font-size: 15px; font-weight: 400; color: var(--cocoa);
}
.expire-stack__empty span { display: block; margin-top: 4px; font-size: 10px; color: var(--ink-3); }

/* 全部看完后的收尾卡 */
.expire-stack__done {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: rgba(251, 247, 236, .93);
  border: 1px solid rgba(233, 210, 181, .95);
  border-radius: var(--r-card-sm);
  text-align: center;
  z-index: 30;
}
.expire-stack__done.is-on { display: flex; }
.expire-stack__done b { font-family: var(--serif); font-size: 15px; font-weight: 400; color: var(--cocoa); }
.expire-stack__done span { font-size: 10px; color: var(--ink-3); }
.expire-stack__again {
  margin-top: 3px;
  padding: 5px 14px;
  font: inherit; font-size: 10px;
  color: var(--warm-deep);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  cursor: pointer;
}

/* 卡堆下方的说明与页码 */
.expire-stack__bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px;
  font-size: 10px; color: var(--ink-3);
}
.expire-stack__count {
  font-family: var(--serif); font-size: 12px; color: var(--warm-deep);
  display: inline-flex; align-items: baseline;
}
.expire-stack__count b { font-weight: 400; font-size: 16px; }
.expire-stack__count i { font-style: normal; margin: 0 3px; opacity: .45; }

.mb-alert > .btn { margin-top: 10px; }
/* 空态没有页码条，按钮需要自己补回一点呼吸位 */
.expire-stack.is-empty + .btn { margin-top: 16px; }

.mb-quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 20px; }
.mb-quick .btn { width: 100%; min-height: 50px; }

.mb-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
.mb-metrics .metric { padding: 14px 15px; border-radius: var(--r-card-sm); }
.mb-metrics .metric__value { font-size: 26px; }

.mb-scroll-cards {
  display: flex; gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  /* 左右各留一格内边距，让首张卡片与「今日推荐菜谱」标题同一条左基线；
     scroll-padding 同步这格内边距，否则 x mandatory 吸附会把首张卡片
     顶到屏幕最左侧（scrollLeft 被抬到 14px），卡片与标题错位且紧贴屏幕边。 */
  padding: 2px 14px 10px;
  margin: 0 -14px;
  scroll-padding: 0 14px;
  scrollbar-width: none;
}
.mb-scroll-cards::-webkit-scrollbar { display: none; }
.mb-recipe {
  flex: 0 0 236px;
  scroll-snap-align: start;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-card-sm);
  background: var(--paper);
  overflow: hidden;
}
.mb-recipe img { width: 100%; height: 104px; object-fit: cover; border-radius: 0; }
.mb-recipe__body { padding: 10px 12px 12px; }
.mb-recipe__name { font-family: var(--serif); font-size: 15px; }
.mb-recipe__meta { font-size: 10px; color: var(--ink-2); margin-top: 2px; }

.mb-week {
  display: flex; gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 12px;
  scrollbar-width: none;
}
.mb-week::-webkit-scrollbar { display: none; }
.mb-day {
  flex: 0 0 52px;
  scroll-snap-align: start;
  min-height: 62px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  border-radius: var(--r-chip);
  background: var(--paper);
  border: 1px solid var(--line-soft);
}
.mb-day.is-today { background: var(--olive); border-color: var(--olive); color: var(--on-olive); }
.mb-day__name { font-size: 11px; font-family: var(--serif); }
.mb-day__dot { width: 5px; height: 5px; border-radius: var(--r-round); background: var(--sage); }
.mb-day.is-today .mb-day__dot { background: var(--paper); }
.mb-today-meal {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--sage-wash);
  border-radius: var(--r-card-sm);
}
.mb-today-meal img { width: 52px; height: 52px; flex: none; }
.mb-today-meal__label { font-size: 10px; color: var(--olive); }
.mb-today-meal__name { font-family: var(--serif); font-size: 15px; }
.mb-today-meal__meta { font-size: 10px; color: var(--ink-2); }

.mb-stat-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; }
.mb-stat-line__num { font-family: var(--serif); font-size: 24px; color: var(--olive-deep); }
.mb-stat-line__label { font-size: 10px; color: var(--ink-2); }
.mb-foot { text-align: center; font-size: 10px; color: var(--ink-3); margin-top: 24px; line-height: 1.8; }

/* ---------------- 占位视图（其余路由共用，不新建空壳页） ---------------- */
.stage-view { max-width: 680px; margin: 4vh auto; text-align: center; }
.stage-view__art { width: 132px; height: 132px; margin: 0 auto 18px; object-fit: contain; background: transparent; border-radius: 0; }
.stage-view h1 { font-size: 28px; margin-bottom: 8px; }
.stage-view__lead { font-size: 13px; color: var(--ink-2); line-height: 1.8; }
.stage-view__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 24px 0; text-align: left; }
.stage-view__item { padding: 12px 14px; background: var(--paper); border: 1px solid var(--line-soft); border-radius: var(--r-card-sm); font-size: 12px; }
.stage-view__item b { display: block; font-family: var(--serif); font-size: 14px; margin-bottom: 2px; }
.stage-view__item span { font-size: 10px; color: var(--ink-3); }

/* ============================================================
   响应式：PC 紧凑 / Mobile
   ============================================================ */
@media (max-width: 1200px) {
  .welcome h1 { font-size: 30px; }
  .welcome__art { width: 154px; height: 154px; top: -30px; }
  .alert-hero { padding: 24px 26px; }
  .alert-hero__num { font-size: 62px; }
  .dash-grid { grid-template-columns: minmax(0, 1.15fr) minmax(260px, 1fr); }
  .metric__value { font-size: 28px; }
}

/* 900–1024：PC 仍保留侧栏，仪表盘降为单列 */
@media (max-width: 1024px) and (min-width: 901px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid, .stats-panel { grid-template-columns: minmax(0, 1fr); }
  .alert-hero { grid-template-columns: minmax(0, 1fr); gap: 18px; }
}

@media (max-width: 900px) {
  .welcome h1 { font-size: 28px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage-view { margin: 24px auto; }
  .stage-view h1 { font-size: 23px; }
  .stage-view__list { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 480px) {
  .mb-welcome h1 { font-size: 23px; }
  .mb-alert__num { font-size: 50px; }
  .mb-alert__seal { width: 50px; height: 50px; font-size: 12px; }
}

/* ------------------------------------------------------------
   Mobile 首屏节奏微调：压缩上半屏间距，让 2×2 数据卡完整落在
   悬浮 tabbar 上方；装饰叶片始终置于内容之下，不压住表头文字。
   ------------------------------------------------------------ */
.alert-hero .leaf { z-index: 0; }

@media (max-width: 900px) {
  .mb-welcome { margin-bottom: 0; } /* 副标题移除后收拢，急救卡上移 */
  .mb-alert { padding: 18px 18px 16px; margin-bottom: 14px; }
  .expire-scroll { padding: 10px 2px 4px; }
  .mb-quick { margin-bottom: 14px; }
  .mb-metrics { margin-bottom: 18px; }
  .mb-metrics .metric { padding: 12px 14px; }
}
