:root {
  --brand: #ff6a2b;
  --brand-deep: #f23c18;
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #23262b;
  --sub: #7a7f87;
  --line: #eceef1;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 14px;
}

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

html { font-size: 15px; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--brand-deep); text-decoration: none; }

.app { max-width: 640px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.main { flex: 1; padding: 16px 16px 24px; }
.has-bar { padding-bottom: 96px; }

/* 顶部品牌栏 */
.topbar {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: #fff; padding: 18px 16px 46px;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; }
.topbar .logo {
  width: 40px; height: 40px; border-radius: 10px; background: rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; border: 1px solid rgba(255,255,255,.35);
}
.topbar .name { font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.topbar .slogan { font-size: 12px; opacity: .9; }
.topbar .page-title { font-size: 18px; font-weight: 700; }
.topbar .backbar { display: flex; align-items: center; gap: 10px; }
.backbtn {
  color: #fff; font-size: 13px; padding: 4px 12px 4px 8px; border-radius: 99px;
  background: rgba(0,0,0,.18); border: 1px solid rgba(255,255,255,.45); flex-shrink: 0;
}

/* 卡片 */
.card {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  box-shadow: 0 2px 10px rgba(31, 35, 41, .05); margin-bottom: 14px;
}
.card.-overlap { margin-top: -34px; position: relative; z-index: 2; }
/* 注意：-overlap 会把卡片上提压住前一个兄弟元素，页面级提示条（.notice）必须放进卡片内部，
   不能排在它前面（首页支付维护提示、登录页体验提示都踩过这个坑）。 */
.card-title { font-size: 15px; font-weight: 700; margin: 0 0 10px; display: flex; justify-content: space-between; align-items: center; }
.card-title .more { font-size: 12px; color: var(--sub); font-weight: 400; }

/* 余额 */
.balance-label { font-size: 12px; color: var(--sub); }
.balance-num { font-size: 30px; font-weight: 800; }
.balance-num small { font-size: 14px; font-weight: 600; margin-left: 2px; }
.cardno { font-size: 12px; color: var(--sub); }
.cardno b { color: var(--text); font-weight: 600; letter-spacing: .5px; }

/* 档位 */
.tiers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tier {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 14px 12px;
  text-align: center; cursor: pointer; background: #fff; transition: all .15s;
}
.tier .amt { font-size: 20px; font-weight: 800; }
.tier .amt small { font-size: 12px; font-weight: 600; }
.tier .tip { font-size: 11px; color: var(--sub); }
.tier.sel { border-color: var(--brand); background: linear-gradient(180deg, #fff7f2, #fff); box-shadow: 0 2px 8px rgba(242, 60, 24, .12); }
.tier.sel .amt { color: var(--brand-deep); }

/* 按钮 */
.btn {
  display: block; width: 100%; border: 0; border-radius: 12px; padding: 13px 16px;
  font-size: 16px; font-weight: 700; color: #fff; text-align: center; cursor: pointer;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.-ghost { background: #fff; color: var(--brand-deep); border: 1.5px solid var(--brand-deep); }
.btn.-gray { background: #eef0f3; color: var(--sub); }
.btn-row { display: flex; gap: 10px; }

/* 底部操作条 */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: #fff; border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}
.actionbar .inner { max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.actionbar .total { flex-shrink: 0; font-size: 13px; color: var(--sub); }
.actionbar .total b { font-size: 20px; color: var(--brand-deep); }
.actionbar .btn { width: auto; flex: 1; }

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 6px; }
.field input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 12px;
  font-size: 15px; background: #fafbfc; outline: none;
}
.field input:focus { border-color: var(--brand); background: #fff; }
.form-note { font-size: 12px; color: var(--sub); text-align: center; margin-top: 12px; }
.agree { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--sub); margin: 10px 0 14px; }
.agree input { margin-top: 3px; accent-color: var(--brand-deep); flex-shrink: 0; }

/* 订单行 */
.order { border-bottom: 1px solid var(--line); padding: 12px 0; display: flex; justify-content: space-between; gap: 10px; }
.order:last-child { border-bottom: 0; }
.order .t { font-size: 14px; font-weight: 600; }
.order .s { font-size: 11px; color: var(--sub); word-break: break-all; }
.order .amt { font-weight: 800; text-align: right; font-size: 15px; }
.chip { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 99px; margin-top: 4px; }
.chip.-pending { color: var(--warn); background: #fef3e2; }
.chip.-paid { color: var(--ok); background: #e7f6ec; }
.chip.-closed { color: var(--sub); background: #eef0f3; }
.chip.-pay { color: var(--brand-deep); background: #fdeee6; cursor: pointer; }

/* 支付方式 */
.payway { display: flex; align-items: center; gap: 10px; padding: 12px 2px; }
.payway .wx {
  width: 34px; height: 34px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.payway .nm { flex: 1; font-size: 15px; font-weight: 600; }
.payway .nm .sub { font-size: 11px; color: var(--sub); font-weight: 400; }
.radio { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid #c8ccd2; display: inline-block; position: relative; }
.radio.on { border-color: var(--brand-deep); }
.radio.on::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--brand-deep); }

.kv { display: flex; justify-content: space-between; font-size: 13px; padding: 6px 0; }
.kv .k { color: var(--sub); }

/* 结果页 */
.result { text-align: center; padding: 40px 16px 8px; }
.result .icon { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; font-size: 36px; font-weight: 800; }
.result .icon.-ok { background: #e7f6ec; color: var(--ok); }
.result .icon.-wait { background: #fdeee6; color: var(--brand-deep); }
.result h2 { margin: 0 0 6px; font-size: 19px; }
.result p { margin: 0; color: var(--sub); font-size: 13px; }
.spinner {
  width: 22px; height: 22px; border: 3px solid #f4c9b5; border-top-color: var(--brand-deep);
  border-radius: 50%; animation: spin .8s linear infinite; margin: 14px auto 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 提示条 / 弹层 / toast */
.notice { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; font-size: 12px; border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; }
.mask { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 90; display: none; align-items: center; justify-content: center; padding: 24px; }
.mask.show { display: flex; }
.dialog { background: #fff; border-radius: 16px; padding: 22px 18px; max-width: 320px; text-align: center; }
.dialog h3 { margin: 0 0 8px; font-size: 16px; }
.dialog p { margin: 0 0 16px; font-size: 13px; color: var(--sub); }
.dialog .btn { padding: 10px; font-size: 15px; }
#toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 99;
  background: rgba(20,22,25,.88); color: #fff; font-size: 13px; border-radius: 10px;
  padding: 10px 16px; max-width: 80vw; opacity: 0; pointer-events: none; transition: opacity .2s;
}
#toast.show { opacity: 1; }

/* 底部备案 */
.footer { text-align: center; font-size: 11px; color: #9aa0a8; padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); line-height: 1.9; }
.footer a { color: #9aa0a8; }
.footer .links a { margin: 0 6px; }

/* 富文本协议页 */
.doc h2 { font-size: 16px; margin: 22px 0 8px; }
.doc h3 { font-size: 14px; margin: 16px 0 6px; }
.doc p, .doc li { font-size: 13px; color: #3c4046; margin: 6px 0; }
.doc .meta { font-size: 12px; color: var(--sub); }

.empty { text-align: center; color: var(--sub); font-size: 13px; padding: 30px 0; }
.link-row { display: flex; justify-content: space-between; font-size: 13px; margin-top: 12px; }

/* 账单页 Tab（充值记录 / 消费记录） */
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tabs .tab {
  flex: 1; text-align: center; font-size: 14px; font-weight: 600; padding: 9px 0;
  border-radius: 10px; background: #f2f4f6; color: var(--sub); cursor: pointer;
  border: 1.5px solid transparent;
}
.tabs .tab.on { color: var(--brand-deep); border-color: var(--brand); background: linear-gradient(180deg, #fff7f2, #fff); }

/* 账单汇总：累计充值 / 累计消费 / 当前余额 */
.ledger { display: flex; align-items: center; text-align: center; }
.ledger .item { flex: 1; }
.ledger .num { font-size: 17px; font-weight: 800; }
.ledger .num.-minus { color: var(--brand-deep); }
.ledger .lb { font-size: 11px; color: var(--sub); }
.ledger .divider { width: 1px; align-self: stretch; background: var(--line); }
.formula { font-size: 12px; color: var(--sub); text-align: center; margin-top: 10px; }

/* 消费流水 */
.consume .minus { color: var(--brand-deep); }
.consume .after { font-size: 11px; color: var(--sub); font-weight: 400; }
.note-box { font-size: 12px; color: #3c4046; background: #f8f9fb; border-radius: 10px; padding: 10px 12px; margin-top: 12px; line-height: 1.7; }

/* ===== 在线点餐 ===== */
/* 分类吸顶条 */
.cats {
  position: sticky; top: 0; z-index: 20; display: flex; gap: 8px;
  padding: 10px 0 8px; margin: 0 -16px 6px; padding-left: 16px; padding-right: 16px;
  overflow-x: auto; background: var(--bg); -webkit-overflow-scrolling: touch;
}
.cats::-webkit-scrollbar { display: none; }
.cats .cat {
  flex: 0 0 auto; font-size: 13px; font-weight: 600; color: var(--sub);
  background: #fff; border: 1.5px solid var(--line); border-radius: 99px; padding: 6px 14px; cursor: pointer;
}
.cats .cat.on { color: var(--brand-deep); border-color: var(--brand); background: linear-gradient(180deg, #fff7f2, #fff); }
.cat-desc { font-size: 12px; color: var(--sub); margin: 2px 0 8px; }

/* 菜品卡片：图片 + 名称 + 公示价 + 份数 */
.dish { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.dish:last-child { border-bottom: 0; }
/* 图片容器：加载期显示品牌色微光骨架，避免出现"灰框等图"的空档 */
.thumbwrap {
  width: 96px; height: 74px; flex-shrink: 0; border-radius: 10px; overflow: hidden; position: relative;
  background: linear-gradient(100deg, #ffeee4 30%, #fff8f3 50%, #ffeee4 70%);
  background-size: 220% 100%; animation: shimmer 1.15s ease-in-out infinite;
}
.thumbwrap img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .25s ease; }
.thumbwrap img.ready { opacity: 1; }
/* 加载完成后停掉微光；加载失败时保留品牌色底，不出现破图或永久灰框 */
.thumbwrap.ready { animation: none; }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@media (prefers-reduced-motion: reduce) { .thumbwrap, .thumb-s { animation: none; } }
.thumb-s {
  width: 56px; height: 44px; border-radius: 8px; overflow: hidden; flex-shrink: 0; position: relative;
  background: linear-gradient(100deg, #ffeee4 30%, #fff8f3 50%, #ffeee4 70%);
  background-size: 220% 100%; animation: shimmer 1.15s ease-in-out infinite;
}
.thumb-s img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .25s ease; }
.thumb-s img.ready { opacity: 1; }
.thumb-s.ready { animation: none; }
.dish .info { flex: 1; min-width: 0; }
.dish .nm { font-size: 15px; font-weight: 700; }
.dish .sub { font-size: 11px; color: var(--sub); margin-top: 1px; }
.dish .tags { margin-top: 4px; }
.dish .tag {
  display: inline-block; font-size: 10px; color: var(--brand-deep);
  background: #fdeee6; border-radius: 4px; padding: 1px 5px; margin-right: 4px;
}
/* 供应状态：营业中 / 预约单，和取餐时段口径一致 */
.tag.-open { color: var(--ok); background: #e7f6ec; }
.tag.-book { color: var(--warn); background: #fef3e2; }
.dish .hint { font-size: 11px; color: var(--warn); margin-top: 3px; }
.dish .hint.-ok { color: var(--ok); }
.dish .bottom { display: flex; align-items: flex-end; justify-content: space-between; margin-top: 6px; }
.dish .price { color: var(--brand-deep); font-weight: 800; font-size: 17px; }
.dish .price small { font-size: 11px; font-weight: 600; }
.dish .sales { font-size: 11px; color: var(--sub); font-weight: 400; margin-left: 6px; }
.dish.soldout { opacity: .55; }
.dish.soldout .price { color: var(--sub); }

/* 份数加减 */
.stepper { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.stepper button {
  width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--brand);
  background: #fff; color: var(--brand-deep); font-size: 17px; line-height: 1; cursor: pointer; padding: 0;
}
.stepper button:disabled { border-color: var(--line); color: #c8ccd2; background: #f7f8fa; cursor: not-allowed; }
.stepper .qty { min-width: 18px; text-align: center; font-size: 15px; font-weight: 700; }
.stepper .add-only { width: 26px; height: 26px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--brand), var(--brand-deep)); color: #fff; font-size: 17px; line-height: 1; cursor: pointer; padding: 0; }

/* 购物车明细 / 确认清单 */
.cartline { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.cartline:last-child { border-bottom: 0; }
.cartline .nm { flex: 1; min-width: 0; }
.cartline .nm .s { font-size: 11px; color: var(--sub); }
.cartline .nm .s.ok { color: var(--ok); }
.cartline .amt { font-weight: 700; flex-shrink: 0; }
.total-row { display: flex; justify-content: space-between; align-items: baseline; padding-top: 10px; margin-top: 4px; border-top: 1px solid var(--line); font-size: 14px; }
.total-row b { font-size: 20px; color: var(--brand-deep); }

/* 取餐码 */
.pickup { text-align: center; padding: 6px 0 2px; }
.pickup .box {
  display: inline-block; border: 2px dashed var(--brand); border-radius: 16px;
  padding: 14px 30px 12px; background: #fff7f2;
}
.pickup .lb { font-size: 12px; color: var(--sub); }
.pickup .code { font-size: 40px; font-weight: 800; letter-spacing: 6px; color: var(--brand-deep); line-height: 1.2; text-indent: 6px; }
.chip.-waiting { color: var(--brand-deep); background: #fdeee6; }
.chip.-done { color: var(--ok); background: #e7f6ec; }

