/* =====================================================================
   草本亦方 PWA —— 样式
   配色沿用小程序：#2E5B4E 草本深绿 + #F7F5F0 米白底
   ===================================================================== */

:root {
  --green: #2E5B4E;
  --green-2: #3E7462;
  --green-soft: #EAF1EE;
  --bg: #F7F5F0;
  --card: #FFFFFF;
  --line: #E7E2D8;
  --text-1: #24322C;
  --text-2: #5C6B64;
  --text-3: #93A29B;
  --danger: #B4453C;
  --danger-bg: #FDF0EF;
  --warn: #9A7418;
  --warn-bg: #FDF6E8;
  --ok: #2E7D57;
  --ok-bg: #EAF5EF;
  --price: #C0542F;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 2px 12px rgba(46, 91, 78, 0.06);
  --shadow-lg: 0 8px 32px rgba(46, 91, 78, 0.14);
  /* 底部 tab 栏高度：内容区要用它留出空间，否则最后一项会被挡住 */
  --tabbar-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-1);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Helvetica Neue", sans-serif;
  overscroll-behavior-y: none;
}

body { min-height: 100vh; }
img { display: block; max-width: 100%; }
/* 图标兜底尺寸：/icons/*.png 原始是 108px，任何没有容器约束的地方都会撑爆布局
 * （「我的」页曾经整行变成一张大图就是这个原因）。放在最前面，后面的规则可覆盖。 */
img[src^="/icons/"] { width: 20px; height: 20px; object-fit: contain; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--green); text-decoration: none; }

/* ---------------- 首屏骨架 ---------------- */
.boot {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg);
  z-index: 999;
}
.boot-logo {
  width: 62px; height: 62px;
  border-radius: 18px;
  background: var(--green);
  color: var(--bg);
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
}
.boot-text { font-size: 13px; color: var(--text-3); }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--green);
  color: var(--bg);
}
.topbar .t-title { font-size: 17px; font-weight: 600; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .t-sub { font-size: 12px; opacity: 0.8; font-weight: 400; margin-left: 8px; }
/* 返回键借用右箭头图标，转 180° 才是「返回」的语义 */
.topbar [data-back] img { transform: rotate(180deg); }
.icon-btn {
  width: 34px; height: 34px;
  border: 0; border-radius: 10px;
  background: rgba(255,255,255,0.14);
  display: grid; place-items: center;
  flex: none;
}
.icon-btn:active { background: rgba(255,255,255,0.28); }
.icon-btn img { width: 20px; height: 20px; }

/* ---------------- 主体 ---------------- */
.main { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px); }
.view { padding: 14px 16px; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 0;
}
.card-head h3 { margin: 0; font-size: 15px; font-weight: 600; flex: none; }
.card-head .spacer { flex: 1; }
.card-body { padding: 14px 16px; }
.card-body.tight { padding: 0; }

/* ---------------- 首页 hero ---------------- */
.hero {
  background: linear-gradient(150deg, var(--green) 0%, var(--green-2) 100%);
  color: var(--bg);
  padding: 22px 18px 26px;
}
.hero .badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  font-size: 12px;
  margin-bottom: 12px;
}
.hero h1 { margin: 0 0 8px; font-size: 22px; font-weight: 700; letter-spacing: 0.5px; }
.hero .sub { margin: 0; font-size: 13.5px; opacity: 0.88; line-height: 1.7; }
.hero .meta { margin-top: 14px; font-size: 12.5px; opacity: 0.82; display: flex;
  flex-direction: column; gap: 4px; }
.hero .closed { display: inline-block; margin-top: 12px; padding: 6px 14px;
  background: rgba(0,0,0,0.22); border-radius: 8px; font-size: 13px; }

/* ---------------- 图标尺寸 ----------------
 * ⚠️ 每个 <img> 图标都必须带一个尺寸类。不带的话 <img> 会按原始
 *    像素尺寸渲染，几十个图标能把整个布局撑爆 —— 这个坑踩过。
 */
.i16 { width: 16px; height: 16px; }
.i20 { width: 20px; height: 20px; }
.i24 { width: 24px; height: 24px; }
.i32 { width: 32px; height: 32px; }
.i40 { width: 40px; height: 40px; }

/* ---------------- 招牌区 ---------------- */
.sec-title { display: flex; align-items: baseline; gap: 10px; margin: 20px 0 12px; }
.sec-title h2 { margin: 0; font-size: 17px; font-weight: 600; }
.sec-title .more { margin-left: auto; font-size: 13px; color: var(--green); }

/* ---------------- 草本之道（首页板块） ---------------- */
.philo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 380px) { .philo-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 260px) { .philo-grid { grid-template-columns: 1fr; } }

.philo .card-body { padding: 14px 12px 10px; }
.philo-head { display: flex; align-items: flex-start; gap: 10px; }
.philo-ico {
  width: 36px; height: 36px; flex: none;
  border-radius: 10px;
  background: var(--green-soft);
  display: grid; place-items: center;
}
.philo-head .t { font-size: 14px; font-weight: 600; line-height: 1.4; }
.philo-head .d { font-size: 12px; color: var(--text-2); margin-top: 3px; line-height: 1.5; }

.philo-toggle {
  display: flex; align-items: center; gap: 4px;
  margin-top: 10px; padding: 0;
  border: 0; background: none;
  color: var(--green); font-size: 13px;
  text-decoration: none; width: 100%;
}
.philo-toggle .philo-arrow { transition: transform .16s ease; }
.philo-toggle[aria-expanded="true"] .philo-arrow { transform: rotate(90deg); }

.philo-detail {
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px; line-height: 1.8; color: var(--text-2);
  white-space: pre-wrap; word-break: break-word;
}
/* 展开状态由 JS 切 hidden 属性；这条兜底防止 hidden 失效时内容直接铺开 */
.philo-detail[hidden] { display: none !important; }

/* ---------------- 菜品卡 ---------------- */
.dish-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 340px) { .dish-grid { grid-template-columns: 1fr; } }

.dish {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform .12s ease;
}
.dish:active { transform: scale(0.985); }
.dish .pic {
  aspect-ratio: 4 / 3;
  background: var(--green-soft);
  display: grid;
  place-items: center;
  position: relative;
}
.dish .pic img { width: 100%; height: 100%; object-fit: cover; }
.dish .pic .fallback { width: 40px; height: 40px; opacity: .55; }
.dish .rec {
  position: absolute; left: 8px; top: 8px;
  background: var(--price); color: #fff;
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
}
.dish .sold-out {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.72);
  display: grid; place-items: center;
  font-size: 14px; font-weight: 600; color: var(--text-2);
}
.dish .info { padding: 10px 12px 12px; flex: 1; display: flex; flex-direction: column; }
.dish .name { font-size: 14.5px; font-weight: 600; margin-bottom: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dish .sub { font-size: 12px; color: var(--text-3); margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 32px; }
.dish .foot { display: flex; align-items: center; gap: 6px; margin-top: auto; }
/* nowrap + flex:none：价格后面加了「起」之后总宽会挤，不能再让它换行 */
.dish .price { color: var(--price); font-weight: 700; font-size: 17px;
  white-space: nowrap; flex: none; }
.dish .price .cur { font-size: 12px; font-weight: 600; }
.dish .sold {
  margin-left: auto; font-size: 11.5px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.dish .add {
  margin-left: 0;
  width: 30px; height: 30px; border-radius: 50%;
  flex: none;
  border: 0; background: var(--green); color: var(--bg);
  display: grid; place-items: center; flex: none;
}
.dish .add img { width: 16px; height: 16px; }
.dish .add:disabled { background: var(--line); }

/* 手机上两列卡片太窄：价格 +「起」+ 已售 + 加号放不下会换行，
 * 已售数字本来详情页也有，窄屏直接让位给加号 */
@media (max-width: 430px) {
  .dish .sold { display: none; }
  .dish .add { margin-left: auto; }
}

/* 有悬浮购物车/结算条时，内容区要多让出它的高度，
 * 否则滚到底部时最后一屏会被那条浮层压住（结算页的积分说明曾整段被挡） */
body:has(.cart-bar) .main {
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 84px);
}

/* ---------------- 菜品详情底部购买栏 ---------------- */
.buy-bar {
  position: fixed; left: 0; right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-b));
  z-index: 46;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 10px 16px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 -2px 14px rgba(46, 91, 78, .07);
}
.buy-bar .bb-price { flex: 1; min-width: 0; }
.buy-bar .bb-n { color: var(--price); font-weight: 700; font-size: 21px; line-height: 1.15; }
.buy-bar .bb-n .from { font-size: 11.5px; font-weight: 500; color: var(--text-3); margin-left: 2px; }
.buy-bar .bb-s { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.buy-bar .btn { flex: none; min-width: 128px; }
/* 菜品卡价格后的「起」：有规格时提示下单价可能更高 */
.price .from { font-size: 11px; color: var(--text-3); font-weight: 400; margin-left: 1px; }

/* ---------------- 菜单搜索 ---------------- */
.search-box {
  display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px;
}
.search-box img { width: 17px; height: 17px; opacity: .5; flex: none; }
.search-box input {
  flex: 1; min-width: 0; border: 0; background: transparent;
  font-size: 14px; padding: 0; height: 100%; color: var(--text-1);
}
.search-box input:focus { outline: none; }
/* 自带的小叉和自定义的清空按钮会重复，隐藏原生的 */
.search-box input::-webkit-search-cancel-button,
.search-box input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.search-box .sb-clear {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  border: 0; background: var(--bg); display: grid; place-items: center;
  padding: 0;
}
.search-box .sb-clear img { width: 12px; height: 12px; opacity: .55; }

/* ---------------- 分类横滑 ---------------- */
.cat-scroll {
  display: flex; gap: 10px;
  overflow-x: auto;
  padding: 2px 16px 12px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.cat-scroll::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: none;
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 13.5px;
  white-space: nowrap;
}
.cat-chip.on { background: var(--green); color: var(--bg); border-color: var(--green); }
.cat-chip img { width: 16px; height: 16px; }
.cat-chip.on img { filter: brightness(0) invert(1); }

/* ---------------- 列表行 ---------------- */
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-size: 14.5px; font-weight: 500; }
.row .s { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.row .v { font-size: 15px; color: var(--text-2); flex: none; }

/* ---------------- 按钮 ---------------- */
.btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-1);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14.5px;
  transition: opacity .12s;
}
.btn:active { opacity: .7; }
.btn:disabled { opacity: .45; }
.btn-primary { background: var(--green); color: var(--bg); border-color: var(--green); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-ghost { background: transparent; }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
/* <label class="btn"> 用作「上传图片」按钮：样式跟按钮一致 */
label.btn { display: inline-block; text-align: center; cursor: pointer; }

/* 上传按钮：把真 input 透明铺在按钮上。
 * ⚠️ 不要用 display:none / pointer-events:none 隐藏它 ——
 * iOS Safari 与微信内置浏览器会因此拒绝唤起选择器（点了没反应）。
 * 也不要用 label for 转发点击，实测 iOS 微信里同样不弹。 */
.file-btn-wrap { position: relative; display: inline-block; flex: none; }
.file-btn-wrap .btn { display: inline-block; }
.file-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
  /* 部分 WebView 以字号决定可点区域，给大一点 */
  font-size: 100px;
  z-index: 2;
}
/* 上传的三条备用通道提示（点击弹不出选择框时给用户一条活路） */
.upload-alt {
  margin-top: 6px; padding: 7px 10px;
  font-size: 11.5px; line-height: 1.55;
  color: var(--warn); background: var(--warn-bg);
  border-radius: 8px;
}
.upload-alt b { font-weight: 600; }
.upload-alt kbd {
  display: inline-block; padding: 0 4px; margin: 0 1px;
  font: inherit; font-size: 11px;
  color: var(--text-2); background: var(--card);
  border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 4px;
}
/* 拖拽悬停时给弹层描一圈绿边，告诉用户「松手就会上传」。
 * 注意 dropping 是加在 .mask 上的（onMount 拿到的 root 就是 mask）。 */
.mask.dropping .sheet,
.sheet.dropping { outline: 2px dashed var(--green-2); outline-offset: -7px; }

/* ---------------- 底部 tab ---------------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  height: var(--tabbar-h);
  font-size: 10.5px;
  color: var(--text-3);
}
.tabbar a.on { color: var(--green); }
.tabbar img { width: 22px; height: 22px; }
.tabbar .dot {
  position: absolute; transform: translate(14px, -10px);
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--price); color: #fff;
  font-size: 10px; line-height: 16px; text-align: center;
}
.tabbar a { position: relative; }

/* ---------------- 购物车浮条 ---------------- */
.cart-bar {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 10px);
  z-index: 45;
  background: var(--green);
  color: var(--bg);
  border-radius: 999px;
  padding: 12px 18px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-lg);
}
.cart-bar .cnt {
  background: var(--price); color: #fff;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; font-size: 12px;
  display: grid; place-items: center;
}
.cart-bar .sum { margin-left: auto; font-size: 17px; font-weight: 700; }

/* 浮条右端的「清空购物车」×：故意做成小圆点，别抢「去结算」的视觉重心，
 * 但要能一眼看到 —— 之前完全没有入口，用户以为这条浮条消不掉 */
.cart-bar .cb-x {
  width: 26px; height: 26px; flex: none;
  padding: 0; border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  display: grid; place-items: center;
}
.cart-bar .cb-x img { width: 13px; height: 13px; }
.cart-bar .cb-x:active { background: rgba(255, 255, 255, 0.36); }

/* 购物车行的垃圾桶：淡红底，避免白底上只剩一个灰图标（几乎看不见） */
.row .del-btn {
  background: var(--danger-bg);
  margin-left: 4px;
}
.row .del-btn img { opacity: .85; }
.row .del-btn:active { background: #F8DEDC; }

/* ---------------- 空态 / 加载 ---------------- */
.empty { text-align: center; padding: 46px 20px; color: var(--text-3); font-size: 14px; }
.empty .big { font-size: 34px; margin-bottom: 10px; opacity: .35; }
.loading { text-align: center; padding: 40px 20px; color: var(--text-3); font-size: 14px; }
.loading::after {
  content: ''; display: block; margin: 14px auto 0;
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--green);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 错误提示条：读取失败必须看得见，不能装作"暂无数据" */
.note {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 12px;
}
.note.danger { background: var(--danger-bg); color: var(--danger); border: 1px solid #E8BDB8; }
.note.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #EAD9B0; }
.note.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #BFE0CD; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  font: inherit;
  color: var(--text-1);
  /* iOS 聚焦时不要自动放大：字号必须 ≥16px */
  font-size: 16px;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--green);
}
.field .tip { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }
.field.inline { display: flex; align-items: center; gap: 12px; }
.field.inline input[type="checkbox"] { width: 20px; height: 20px; flex: none; }

/* 规格编辑行：名称 + 加价 + 删除，一行放得下 */
.spec-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.spec-row input { flex: 1; min-width: 0; }
.spec-row input[data-spec-delta] { flex: 0 0 88px; width: 88px; }
.spec-row .btn { flex: none; }
.spec-group { border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 8px; }
/* 分组头：组名 + 必选/多选开关 + 删组 */
.spec-group-head { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.spec-group-head input[data-spec-gname] { flex: 1; min-width: 0; font-weight: 600; }
.spec-chk {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 12px; color: var(--text-2); flex: none; white-space: nowrap;
}
.spec-chk input { width: 15px; height: 15px; margin: 0; padding: 0; flex: none; }

/* ---------------- 浮层 ---------------- */
.mask {
  position: fixed; inset: 0;
  background: rgba(20, 30, 26, 0.45);
  z-index: 60;
  display: flex; align-items: flex-end;
}
.mask.center { align-items: center; justify-content: center; padding: 20px; }
.sheet {
  width: 100%;
  max-height: 86vh;
  background: var(--card);
  border-radius: 18px 18px 0 0;
  display: flex; flex-direction: column;
  animation: rise .22s ease;
}
@keyframes rise { from { transform: translateY(24px); opacity: .6; } }
.sheet-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 16px 10px;
  border-bottom: 1px solid var(--line);
}
.sheet-head h3 { margin: 0; font-size: 16px; font-weight: 600; flex: 1; }
.sheet-body { padding: 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; }
.sheet-foot { padding: 12px 16px calc(16px + var(--safe-b)); border-top: 1px solid var(--line); }
.dialog {
  width: 100%; max-width: 360px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 20px 18px;
  animation: rise .2s ease;
}
.dialog h3 { margin: 0 0 8px; font-size: 17px; }
.dialog p { margin: 0 0 18px; color: var(--text-2); font-size: 14px; line-height: 1.7; }
.dialog .acts { display: flex; gap: 10px; }
.dialog .acts .btn { flex: 1; }

/* ---------------- toast ---------------- */
.toast-host {
  position: fixed;
  left: 0; right: 0;
  top: 70px;
  z-index: 90;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  background: rgba(36, 50, 44, 0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  max-width: 84vw;
  text-align: center;
  animation: fade .2s ease;
}
.toast.danger { background: var(--danger); }
@keyframes fade { from { opacity: 0; transform: translateY(-8px); } }

/* ---------------- 标签 ---------------- */
.tag {
  display: inline-block;
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
}
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.danger { background: var(--danger-bg); color: var(--danger); }
.tag.plain { background: #F0EFEA; color: var(--text-3); }

/* ---------------- 券 ---------------- */
.coupon {
  border: 1px dashed var(--green);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(100deg, #F3F8F6 0%, #FFFFFF 60%);
}
.coupon .amt { font-size: 26px; font-weight: 700; color: var(--price); flex: none;
  min-width: 68px; text-align: center; }
.coupon .amt .cur { font-size: 14px; }
.coupon .amt .cond { display: block; font-size: 11px; color: var(--text-3); font-weight: 400; }
.coupon .info { flex: 1; min-width: 0; }
.coupon .info .t { font-size: 14.5px; font-weight: 600; }
.coupon .info .s { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.coupon.off { opacity: .55; border-color: var(--line); background: #F5F4F0; }

/* ---------------- 订单 ---------------- */
.order { border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); margin-bottom: 12px; overflow: hidden; }
.order-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; background: #FAF9F6;
  border-bottom: 1px solid var(--line);
}
.order-head .no { font-size: 12.5px; color: var(--text-2); flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-body { padding: 12px 14px; }
.order-line { display: flex; gap: 10px; font-size: 13.5px; margin-bottom: 7px; }
.order-line .n { flex: 1; min-width: 0; }
.order-line .q { color: var(--text-3); font-size: 12.5px; }
.order-line .p { color: var(--text-2); min-width: 58px; text-align: right; }
.order-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-top: 1px solid var(--line);
}
.order-foot .total { margin-left: auto; font-size: 15px; font-weight: 700; }
.order-foot .total .cur { font-size: 12px; }

/* ---------------- 规格选择 ---------------- */
.opt-group { margin-bottom: 16px; }
.opt-group h4 {
  margin: 0 0 9px; font-size: 13.5px; color: var(--text-2); font-weight: 500;
  display: flex; align-items: center; gap: 6px;
}
/* 「必选」/「可多选」提示：小字，不抢选项按钮的注意力 */
.opt-group h4 .req,
.opt-group h4 .opt-tip {
  font-size: 10.5px; line-height: 16px; padding: 0 6px; border-radius: 4px;
  font-weight: 400; flex: none;
}
.opt-group h4 .req { color: var(--price); background: #FBEDE7; }
.opt-group h4 .opt-tip { color: var(--text-3); background: var(--bg); }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 13.5px;
  transition: border-color .12s ease, background .12s ease;
}
.opt.on { border-color: var(--green); background: var(--green-soft); color: var(--green);
  font-weight: 500; }
.opt .delta { font-size: 11px; color: var(--price); margin-left: 3px; }

/* ---------------- 数量步进 ---------------- */
.stepper { display: inline-flex; align-items: center; gap: 2px; }
.stepper button {
  width: 28px; height: 28px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card);
  display: grid; place-items: center;
}
.stepper button:disabled { opacity: .35; }
.stepper .n { min-width: 34px; text-align: center; font-size: 15px; }

/* ---------------- 「我的」页的店长后台入口 ----------------
 * 手机端进后台的主路径：登录 → 我的 → 顶部这张绿卡片。
 * 不用记网址，也不用去猜 #/admin。非店长版本是白底灰边，低调放在页尾。 */
.admin-entry {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left; cursor: pointer;
  border: 0; border-radius: var(--radius);
  background: linear-gradient(140deg, var(--green) 0%, var(--green-2) 100%);
  color: var(--bg);
  padding: 15px 16px; margin-bottom: 14px;
  box-shadow: 0 4px 16px rgba(46, 91, 78, 0.18);
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s ease, box-shadow .12s ease;
}
.admin-entry:active { transform: scale(.985); box-shadow: 0 2px 8px rgba(46, 91, 78, .14); }
.admin-entry .ae-icon {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  background: rgba(255,255,255,.18);
  display: grid; place-items: center;
}
.admin-entry .ae-icon img { width: 22px; height: 22px; }
.admin-entry .ae-text { flex: 1; min-width: 0; }
.admin-entry .ae-t { font-size: 15.5px; font-weight: 600; }
.admin-entry .ae-s {
  font-size: 12.5px; opacity: .85; margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.admin-entry .ae-go { flex: none; opacity: .75; display: grid; place-items: center; }
.admin-entry .ae-go img { width: 18px; height: 18px; }

/* 非店长的「激活」版本：白底灰边，不抢眼 */
.admin-entry.plain {
  background: var(--card); color: var(--text-1);
  border: 1px dashed var(--line); box-shadow: none;
}
.admin-entry.plain .ae-icon { background: var(--green-soft); }
.admin-entry.plain .ae-s { color: var(--text-3); opacity: 1; }
.admin-entry.plain:active { transform: none; background: var(--green-soft); }

/* ---------------- 我的（顾客端个人中心） ----------------
 * 之前这里全是行内 style + 没有尺寸约束的 icon()，在手机上渲染成
 * 一张张 108px 的大图，整页像是没写样式。现在统一用类。
 */
.me-hero {
  background: linear-gradient(150deg, var(--green) 0%, var(--green-2) 100%);
  color: #fff;
  padding: 24px 18px 18px;
}
.me-user { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.me-ava {
  width: 54px; height: 54px; flex: none; overflow: hidden;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .3);
  display: grid; place-items: center;
}
.me-ava img { width: 26px; height: 26px; }
.me-ava img.photo { width: 100%; height: 100%; object-fit: cover; }
.me-info { flex: 1; min-width: 0; }
.me-name {
  font-size: 19px; font-weight: 600; letter-spacing: .3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.me-tag {
  display: inline-block; margin-top: 6px;
  font-size: 11.5px; line-height: 1.5;
  padding: 1px 9px; border-radius: 999px;
  background: rgba(255, 255, 255, .2); color: #fff;
}
.me-edit {
  width: 34px; height: 34px; flex: none; margin-left: auto;
  border-radius: 50%; background: rgba(255, 255, 255, .16);
  display: grid; place-items: center;
}
.me-edit img { width: 17px; height: 17px; }

/* 三个小统计，把「券 / 积分 / 订单」提到首屏，不用点进去才知道有多少 */
.me-stats {
  display: flex; margin-top: 18px;
  background: rgba(255, 255, 255, .12);
  border-radius: 12px; overflow: hidden;
}
.me-stat { flex: 1; padding: 10px 6px; text-align: center; cursor: pointer; }
.me-stat b { display: block; font-size: 16px; font-weight: 600; line-height: 1.3; }
.me-stat span { font-size: 11.5px; opacity: .8; }

/* 我的 → 列表项 */
.mi {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.mi:last-child { border-bottom: 0; }
.mi .grow { flex: 1; min-width: 0; }
.mi-ico {
  width: 36px; height: 36px; flex: none;
  border-radius: 11px; background: var(--green-soft);
  display: grid; place-items: center;
}
.mi-ico img { width: 19px; height: 19px; }
.mi-t { font-size: 14.5px; font-weight: 500; }
.mi-s {
  font-size: 12px; color: var(--text-3); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mi-arrow { flex: none; opacity: .5; }
.mi-arrow img { width: 16px; height: 16px; }
.mi:active { background: var(--green-soft); }

.me-logout { color: var(--danger); border-color: var(--line); margin-top: 4px; }
.me-foot {
  text-align: center; font-size: 11.5px;
  color: var(--text-3); margin: 16px 0 8px;
}

/* ---------------- 店长后台（移动优先：底部 tab 导航） ----------------
 * 手机端 #/admin 是一个独立的后台应用：
 *   顶部状态条（一键打烊）+ 内容区 + 底部 4 宫格 tab（概览/订单/菜品/更多）。
 * ≥960px 时被下方媒体查询改回「左侧竖排导航」的桌面后台。
 * 图标规则：未选中用 _m（灰），选中用 _p（主题绿）—— 与顾客端 tabbar 同一套。
 */
:root { --admin-tab-h: 56px; }

.admin-status {
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  margin-bottom: 12px;
}
.admin-status .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--ok); flex: none;
  box-shadow: 0 0 0 3px var(--ok-bg);
}
.admin-status.closed .dot { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.admin-status .st-name {
  font-weight: 600; font-size: 14.5px;
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.admin-status .st-text { font-size: 13px; color: var(--text-2); flex: none; }
.admin-status.closed .st-text { color: var(--danger); }
.admin-status .btn { flex: none; }

/* 待处理订单提醒条（概览页顶部，点了直达待处理订单） */
.admin-alert {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  border: 0; border-radius: var(--radius-sm);
  background: var(--warn-bg); color: var(--warn);
  padding: 12px 14px; margin-bottom: 12px;
  font-size: 14px; font-weight: 500;
}
.admin-alert img { width: 18px; height: 18px; flex: none; }
.admin-alert .arrow { margin-left: auto; flex: none; }

/* 「更多」宫格 */
.admin-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (max-width: 340px) { .admin-grid { grid-template-columns: repeat(2, 1fr); } }
.admin-grid-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  background: var(--card);
  border: 0; border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 8px 14px;
  font-size: 13px; color: var(--text-1);
}
.admin-grid-item:active { opacity: .7; }
.admin-grid-item .gi-ico {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--green-soft);
  display: grid; place-items: center;
}
.admin-grid-item .gi-ico img { width: 22px; height: 22px; }

.admin-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
  box-shadow: 0 -2px 16px rgba(46, 91, 78, 0.06);
}
.admin-nav button {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  height: var(--admin-tab-h);
  border: 0; background: none; border-radius: 0;
  padding: 0;
  font-size: 11px; color: var(--text-3);
  position: relative;
}
.admin-nav button img { width: 22px; height: 22px; }
.admin-nav button.on { color: var(--green); font-weight: 500; }
.admin-nav button .badge {
  position: absolute; top: 5px; left: calc(50% + 6px);
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--price); color: #fff;
  font-size: 10px; line-height: 16px; text-align: center;
}

/* 手机：副模块入口收进「更多」宫格，底部只留 4 个高频 tab */
.admin-nav button.m-sub { display: none; }

/* 后台页面的内容区要给底部 tab 留空间（顾客端 tabbar 在 /admin 不渲染） */
.main:has(.admin-shell) {
  padding-bottom: calc(var(--admin-tab-h) + var(--safe-b) + 14px);
}

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.stat {
  background: var(--card); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.stat .k { font-size: 12px; color: var(--text-3); }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 4px; }
.stat .v .cur { font-size: 13px; font-weight: 600; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--line); }
.table th { font-size: 12px; color: var(--text-3); font-weight: 500; }
.table td.num, .table th.num { text-align: right; }
.table-wrap { overflow-x: auto; }

/* ---------------- 其它 ---------------- */
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.flex { display: flex; align-items: center; gap: 10px; }
.mt { margin-top: 12px; }
.mb0 { margin-bottom: 0; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

.bar { height: 6px; border-radius: 3px; background: var(--green-soft); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--green); border-radius: 3px; }

/* ---------------- 后台概览：近 7 日营业额 ----------------
 * 三列定宽：日期 / 条 / 金额。
 * 日期列必须定宽，否则「10-18 周日」和「10-18 周三」宽度不同，
 * 每行的条形起点就会参差不齐（改版前用行内 flex + 自动宽度正是这个问题）。 */
.week-chart { display: flex; flex-direction: column; gap: 2px; padding: 8px 6px; }
.wk-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 84px;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 10px;
}
.wk-row.today { background: var(--green-soft); }
.wk-day {
  display: flex; align-items: baseline; gap: 5px;
  font-size: 13px; color: var(--text-1);
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.wk-w { font-size: 11.5px; color: var(--text-3); }
.week-chart .bar { height: 8px; border-radius: 4px; }
.wk-amt {
  text-align: right; font-size: 13px;
  color: var(--text-2); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.wk-row.today .wk-amt { color: var(--green); font-weight: 600; }
.wk-row.today .bar > i { background: var(--green-2); }

/* 大屏时居中限宽，像个正经应用而不是拉满的网页
 * ⚠️ fixed 元素（tabbar / cart-bar）居中只能用 left:0 + right:0 + max-width + margin:auto。
 *    不能再叠 transform:translateX(-50%) —— 那会和 margin:auto 双重居中互相拉扯，
 *    表现就是底部导航条明显偏右、和内容区对不上（这个 bug 上线首日就被发现了）。 */
@media (min-width: 720px) {
  .main, .topbar, .tabbar, .cart-bar, .buy-bar { max-width: 560px; margin-left: auto; margin-right: auto; }
  .tabbar { border-radius: 16px 16px 0 0; }
  .cart-bar { max-width: 536px; }
  .buy-bar { max-width: 560px; }
  body { background: #EFEDE7; }
  /* 底部动作面板（sheet）在 PC 上别拉满全宽，浮成一张居中卡片 */
  .mask:not(.center) .sheet {
    max-width: 560px;
    margin-inline: auto;
    border-radius: 18px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-lg);
  }
}

/* ---------------- PC 管理后台（#/admin 桌面化） ----------------
 * ≥960px 时：底部 tab 导航收进左侧变成竖排菜单，统计卡四列。
 * 小于 960px 完全不受影响，仍是手机版后台（底部 tab + 状态条）。
 * 用 :has 检测后台页面；不支持 :has 的老浏览器自动退回手机版布局，不会坏。 */
@media (min-width: 960px) {
  body:has(.admin-shell) .topbar,
  .main:has(.admin-shell) { max-width: 1200px; }
  /* 后台不需要顾客端底部导航，顶栏右侧有「返回首页」；
     后台自己的底部 tab 也收掉（PC 用左侧菜单） */
  body:has(.admin-shell) .tabbar { display: none; }
  .main:has(.admin-shell) { padding-bottom: 28px; }

  /* ⚠️ DOM 顺序是 body → nav（手机端 nav 是 fixed 无所谓顺序），
   *    PC 必须用 areas 显式指定「nav 在左、body 在右」，
   *    否则 grid 按顺序放置会把内容区塞进 200px 窄列。 */
  .admin-shell {
    display: grid;
    grid-template-columns: 200px 1fr;
    grid-template-areas: "nav body";
  }
  .admin-shell .admin-nav { grid-area: nav; }
  .admin-shell #admin-body { grid-area: body; }

  /* PC 侧边栏列出全部模块；「更多」宫格入口只在手机有意义 */
  .admin-shell .admin-nav button.m-sub { display: flex; }
  .admin-shell .admin-nav button.m-more { display: none; }
  .admin-shell .admin-nav {
    position: sticky;
    top: 57px;                          /* 顶栏高度（12+34+12），别被它盖住 */
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    height: calc(100vh - 57px);
    border-top: 0;
    border-bottom: 0;
    border-right: 1px solid var(--line);
    box-shadow: none;
    padding: 16px 12px;
    padding-bottom: 16px;
  }
  .admin-shell .admin-nav button {
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    height: auto;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 14px;
    text-align: left;
  }
  .admin-shell .admin-nav button.on { background: var(--green-soft); }
  .admin-shell .admin-nav button .badge {
    top: 50%; left: auto; right: 10px;
    transform: translateY(-50%);
  }
  .admin-shell #admin-body { padding: 20px 24px; }
  .admin-shell .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .admin-shell .admin-status { margin-bottom: 16px; }
}
