:root {
  --primary: #ff6b35;
  --primary-dark: #e8551f;
  --green: #2fb344;
  --ink: #1f2329;
  --sub: #6b7280;
  --line: #eef0f3;
  --bg: #f6f7f9;
  --card: #ffffff;
}

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #e9ebef;
  color: var(--ink);
}

.shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

/* 登录 */
.login-screen { min-height: 100vh; padding: 64px 28px 28px; background: linear-gradient(160deg, #fff3ec 0%, #f6f7f9 55%); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(135deg, #ff8a52, #ff5a1f); color: #fff; font-size: 22px; font-weight: 700;
  box-shadow: 0 8px 18px rgba(255, 107, 53, .28);
}
.brand-name { font-size: 22px; font-weight: 800; letter-spacing: .5px; }
.brand-slogan { color: var(--sub); font-size: 13px; margin-top: 6px; }
.login-card { margin-top: 32px; background: #fff; border-radius: 18px; padding: 22px 20px; box-shadow: 0 12px 30px rgba(20, 30, 60, .06); }
.login-card h2 { margin: 0 0 4px; font-size: 18px; }
.login-card p.tip { margin: 0 0 18px; font-size: 12px; color: var(--sub); }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--sub); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); background: #fafbfc; border-radius: 10px;
  padding: 12px; font-size: 14px; color: var(--ink); outline: none;
}
.field input:focus, .field textarea:focus { border-color: var(--primary); background: #fff; }
.btn { border: 0; border-radius: 999px; padding: 12px 18px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn-primary { background: linear-gradient(135deg, #ff7d4d, #ff5a1f); color: #fff; width: 100%; box-shadow: 0 10px 20px rgba(255, 90, 31, .22); }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-small { padding: 7px 12px; font-size: 12px; border-radius: 999px; }
.demo-box { margin-top: 14px; font-size: 12px; color: var(--sub); line-height: 1.7; background: #fff8f4; border: 1px dashed #ffd2be; border-radius: 10px; padding: 10px 12px; }

/* 顶部 */
.topbar {
  position: sticky; top: 0; z-index: 10; background: linear-gradient(135deg, #ff8a52, #ff5a1f);
  color: #fff; padding: 12px 16px 14px;
}
.store-line { display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
.store-line .name { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.store-line .switch { background: rgba(255,255,255,.18); border: 0; color: #fff; border-radius: 999px; padding: 6px 10px; font-size: 12px; }
.search-box { margin-top: 10px; background: rgba(255,255,255,.96); border-radius: 999px; padding: 9px 14px; display: flex; align-items: center; gap: 8px; }
.search-box input { border: 0; background: transparent; outline: none; font-size: 13px; width: 100%; }

.view { padding: 12px 14px 84px; flex: 1; }

/* 通用卡片 */
.card { background: var(--card); border-radius: 16px; padding: 14px; box-shadow: 0 6px 18px rgba(20, 30, 60, .04); }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 16px 2px 10px; }
.section-title h3 { margin: 0; font-size: 16px; }
.section-title .more { font-size: 12px; color: var(--sub); }
.price { color: var(--primary); font-weight: 800; }
.price small { font-size: 11px; font-weight: 500; }
.old-price { color: #a0a6b1; font-size: 11px; text-decoration: line-through; margin-left: 6px; }

/* banner */
.banner { width: 100%; border-radius: 14px; display: block; aspect-ratio: 3 / 1.25; object-fit: cover; background: linear-gradient(135deg, #ffb083, #ff6b35); }
.banner-fallback { border-radius: 14px; padding: 22px 18px; color: #fff; background: linear-gradient(135deg, #ff9a6b, #ff5a1f); }
.banner-fallback h4 { margin: 0 0 6px; font-size: 18px; }
.banner-fallback p { margin: 0; font-size: 12px; opacity: .9; }

/* 分类金刚区 */
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quick-item { text-align: center; font-size: 12px; color: var(--ink); }
.quick-icon { width: 52px; height: 52px; border-radius: 16px; margin: 0 auto 6px; display: grid; place-items: center; font-size: 24px; background: #fff2ec; }

/* 商品列表 */
.product-row { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); transition: background .15s ease; }
.product-row:active { background: #fff8f3; }
.product-row:last-child { border-bottom: 0; }
.thumb { width: 76px; height: 76px; border-radius: 12px; background: #fff2ec; display: grid; place-items: center; font-size: 30px; overflow: hidden; flex: 0 0 auto; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.product-name { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 10px; color: #b45309; background: #fff7ed; border-radius: 6px; padding: 2px 6px; }
.tag.green { color: #15803d; background: #f0fdf4; }
.product-bottom { margin-top: auto; display: flex; align-items: center; justify-content: space-between; }
.add-btn { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--primary); background: #fff; color: var(--primary); font-size: 18px; line-height: 1; display: grid; place-items: center; }
.stepper { display: inline-flex; align-items: center; gap: 8px; }
.stepper button { width: 26px; height: 26px; border-radius: 50%; border: 0; background: #fff2ec; color: var(--primary); font-size: 16px; }

/* 点单分类栏 */
.menu-layout { display: flex; gap: 10px; }
.cat-rail { width: 88px; flex: 0 0 88px; background: #fff; border-radius: 14px; padding: 8px 0; height: fit-content; position: sticky; top: 84px; }
.cat-rail button { display: block; width: 100%; border: 0; background: transparent; padding: 11px 8px; font-size: 12px; color: var(--sub); text-align: center; border-left: 3px solid transparent; }
.cat-rail button.on { color: var(--primary); font-weight: 700; border-left-color: var(--primary); background: #fff7f2; }
.cat-rail button.subcat { padding: 7px 6px 7px 14px; font-size: 11px; color: #8a919c; }
.cat-rail button.subcat.on { color: var(--primary); background: #fffaf7; }
.combo-list { background: #fbfcfe; border-radius: 10px; padding: 6px 10px; }
.combo-item { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; font-size: 12px; color: #4b5563; border-bottom: 1px dashed #eef0f3; }
.combo-item:last-child { border-bottom: 0; }
.combo-item b { color: var(--primary); }
.seckill-zone { margin-top: 14px; background: linear-gradient(135deg,#fff2ec,#ffe3d6); border-radius: 14px; padding: 12px 10px 10px; }
.seckill-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; color:#c2410c; font-weight:800; font-size:14px; }
.seckill-head em { font-style:normal; font-size:11px; font-weight:500; color:#9a5b45; }
.seckill-scroll { display:flex; gap:8px; overflow-x:auto; padding-bottom:2px; }
.seckill-card { flex:0 0 118px; background:#fff; border-radius:10px; padding:8px; cursor:pointer; }
.seckill-thumb { height:64px; border-radius:8px; overflow:hidden; background:#fff7f2; display:flex; align-items:center; justify-content:center; font-size:26px; }
.seckill-thumb img { width:100%; height:100%; object-fit:cover; }
.seckill-name { font-size:12px; font-weight:600; margin:5px 0 3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.seckill-price { color:#e11d48; font-size:15px; font-weight:800; }
.seckill-card del { color:#a1a7b0; font-size:10px; }
.seckill-stock { font-size:10px; color:#9aa1ac; margin-top:2px; }
.menu-list { flex: 1; background: #fff; border-radius: 14px; padding: 4px 12px; min-width: 0; }

/* 底部 tab */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; max-width: 480px; margin: 0 auto; background: #fff; display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); z-index: 20; padding-bottom: env(safe-area-inset-bottom); }
.tabbar button { border: 0; background: transparent; padding: 8px 0 10px; font-size: 11px; color: var(--sub); display: flex; flex-direction: column; align-items: center; gap: 3px; position: relative; }
.tabbar button.on { color: var(--primary); font-weight: 700; }
.tabbar .ico { font-size: 19px; line-height: 1; }
.badge { position: absolute; top: 2px; right: 22%; min-width: 16px; height: 16px; border-radius: 8px; background: var(--primary); color: #fff; font-size: 10px; line-height: 16px; padding: 0 4px; }

/* 购物车 */
.cart-line { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-line .thumb { width: 58px; height: 58px; font-size: 22px; }
.cart-info { flex: 1; min-width: 0; }
.cart-info .n { font-size: 14px; font-weight: 600; }
.cart-info .s { font-size: 11px; color: var(--sub); margin-top: 2px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { flex: 1; border: 0; background: #fff; padding: 9px 0; font-size: 13px; color: var(--sub); }
.seg button.on { background: var(--primary); color: #fff; font-weight: 700; }
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.setting-row .val { color: var(--sub); max-width: 62%; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amount-box { background: #fff; border-radius: 16px; padding: 14px; margin-top: 10px; font-size: 13px; }
.amount-row { display: flex; justify-content: space-between; padding: 5px 0; color: var(--sub); }
.amount-row.total { color: var(--ink); font-weight: 700; padding-top: 10px; border-top: 1px dashed var(--line); margin-top: 6px; }

.footer-bar { position: fixed; bottom: 56px; left: 0; right: 0; max-width: 480px; margin: 0 auto; background: #fff; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; z-index: 21; gap: 10px; }
.footer-bar .sum { font-size: 12px; color: var(--sub); }
.footer-bar .sum b { color: var(--primary); font-size: 20px; }
.footer-bar .btn-primary { width: auto; padding: 11px 26px; }

/* 订单 */
.order-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; }
.order-tabs button { white-space: nowrap; border: 0; background: #fff; border-radius: 999px; padding: 8px 14px; font-size: 12px; color: var(--sub); }
.order-tabs button.on { background: var(--primary); color: #fff; font-weight: 700; }
.order-card { background: #fff; border-radius: 16px; padding: 14px; margin-bottom: 10px; }
.order-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--sub); }
.order-status { font-weight: 700; color: var(--primary); font-size: 13px; }
.order-status.gray { color: var(--sub); }
.order-body { margin: 10px 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.order-body .left { font-size: 13px; }
.order-body .left b { display: block; font-size: 15px; margin-bottom: 3px; }
.order-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* 我的 */
.me-card { background: linear-gradient(135deg, #2c2f36, #40454f); color: #fff; border-radius: 18px; padding: 18px; }
.me-card .lvl { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.14); border-radius: 999px; padding: 5px 10px; font-size: 12px; }
.me-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 16px; text-align: center; }
.me-stats div b { display: block; font-size: 20px; }
.me-stats div span { font-size: 11px; opacity: .75; }
.me-list { margin-top: 12px; background: #fff; border-radius: 16px; overflow: hidden; }
.me-item { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.me-item:last-child { border-bottom: 0; }
.me-item .l { display: flex; align-items: center; gap: 10px; }
.me-item .icon { font-size: 18px; }

/* 优惠券 */
.coupon { display: flex; border-radius: 12px; overflow: hidden; background: #fff8f4; margin-bottom: 10px; }
.coupon .left { width: 92px; padding: 14px 8px; text-align: center; color: #fff; background: linear-gradient(135deg, #ff8a52, #ff5a1f); }
.coupon .left b { font-size: 22px; }
.coupon .left span { display: block; font-size: 11px; margin-top: 2px; }
.coupon .right { flex: 1; padding: 12px; font-size: 12px; color: var(--sub); }
.coupon .right b { display: block; color: var(--ink); font-size: 14px; margin-bottom: 4px; }
.coupon .act { align-self: center; padding-right: 12px; }
.coupon.used { opacity: .55; }

/* 弹层 */
.backdrop { position: fixed; inset: 0; background: rgba(15, 20, 30, .45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 480px; background: #fff; border-radius: 20px 20px 0 0; max-height: 88vh; overflow: auto; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: up .22s ease; }
@keyframes up { from { transform: translateY(24px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-head h3 { margin: 0; font-size: 17px; }
.sheet-close { border: 0; background: #f2f4f7; width: 30px; height: 30px; border-radius: 50%; font-size: 15px; }
.center-modal { align-items: center; padding: 20px; }
.center-modal .sheet { border-radius: 18px; max-width: 420px; animation: pop .2s ease; }
@keyframes pop { from { transform: scale(.94); opacity: .6; } to { transform: scale(1); opacity: 1; } }

/* 商品详情 */
.pd-hero { border-radius: 14px; background: linear-gradient(135deg, #fff1e9, #ffe1d1); display: grid; place-items: center; height: 170px; font-size: 64px; margin-bottom: 12px; }
.pd-name { font-size: 19px; font-weight: 800; margin: 0 0 6px; }
.pd-desc { font-size: 12px; color: var(--sub); line-height: 1.7; }
.pd-price { margin: 10px 0; }
.opt-title { font-size: 13px; font-weight: 700; margin: 14px 0 8px; }
.opt-list { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { border: 1px solid var(--line); background: #fafbfc; border-radius: 10px; padding: 8px 12px; font-size: 12px; }
.opt.on { border-color: var(--primary); color: var(--primary); background: #fff7f2; font-weight: 700; }

/* 订单详情 */
.code-box { text-align: center; background: #fff7f2; border: 1px dashed #ffc6ad; border-radius: 14px; padding: 16px; margin: 10px 0; }
.code-box .code { font-size: 34px; letter-spacing: 8px; font-weight: 800; color: var(--primary); }
.code-box .timer { font-size: 12px; color: var(--sub); margin-top: 6px; }
.log-item { font-size: 12px; color: var(--sub); padding: 6px 0; border-bottom: 1px dashed var(--line); }
.log-item b { color: var(--ink); margin-right: 8px; }

/* toast */
#toast { position: fixed; left: 50%; bottom: 130px; transform: translateX(-50%); background: rgba(20, 24, 32, .88); color: #fff; font-size: 13px; padding: 10px 16px; border-radius: 999px; z-index: 60; opacity: 0; pointer-events: none; transition: .2s; max-width: 84%; text-align: center; }
#toast.on { opacity: 1; }

/* 状态提示 */
.empty { text-align: center; color: #9aa1ac; font-size: 13px; padding: 40px 0; }
.empty .e { font-size: 42px; display: block; margin-bottom: 8px; }
.loading { color: #9aa1ac; font-size: 12px; text-align: center; padding: 20px; }

@media (min-width: 760px) {
  .shell { box-shadow: 0 20px 60px rgba(20, 30, 60, .12); }
}
