:root {
  --primary: #ff6b35;
  --primary-dark: #e85a28;
  --green: #27ae60;
  --text: #222;
  --muted: #999;
  --bg: #f5f6f8;
  --card: #fff;
  --line: #eee;
  --radius: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
input, textarea, button { font-family: inherit; font-size: 15px; }

/* 头部 */
.app-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--primary);
  color: #fff;
  padding-top: env(safe-area-inset-top);
}
.app-header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 48px; padding: 0 8px;
}
.app-title { font-size: 17px; font-weight: 600; margin: 0; flex: 1; text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.app-back { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; font-size: 28px; line-height: 1; }
.app-header-side { width: 40px; }
.app-header-side.right { width: auto; display: flex; align-items: center; }
.app-share { color: #fff; font-size: 14px; padding: 0 10px; }

.app-main { padding-bottom: 70px; min-height: 70vh; }

/* 底部导航 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 7px 0 6px; color: var(--muted); position: relative; }
.tab.active { color: var(--primary); }
.tab-icon { font-size: 20px; line-height: 1; }
.tab-text { font-size: 11px; margin-top: 3px; }

/* 购物车角标 */
.cart-badge {
  position: absolute; top: 2px; right: 50%; transform: translateX(22px);
  background: #f0432e; color: #fff; font-size: 10px; font-style: normal;
  min-width: 16px; height: 16px; line-height: 16px; border-radius: 8px;
  text-align: center; padding: 0 4px;
}
.detail-bar-cart .cart-badge { position: absolute; top: 0; right: 8px; transform: none; }

/* 首页 */
.home-hero {
  position: relative;
  background: linear-gradient(135deg, #ff6b35, #ff8f5a);
  color: #fff; padding: 22px 16px 28px;
}
.home-add-btn {
  position: absolute; top: 14px; right: 14px;
  background: rgba(255,255,255,.25); color: #fff; border: none;
  border-radius: 16px; padding: 6px 12px; font-size: 12px;
}
.home-hero-hi { font-size: 20px; font-weight: 700; }
.home-hero-sub { font-size: 13px; opacity: .9; margin-top: 4px; }

.search-bar {
  display: flex; margin: -16px 16px 12px; background: #fff; border-radius: 20px;
  padding: 6px 8px 6px 16px; box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.search-bar input { flex: 1; border: none; outline: none; background: transparent; }
.search-bar button { border: none; background: var(--primary); color: #fff; border-radius: 16px; padding: 6px 16px; }

.cat-scroll { display: flex; gap: 8px; padding: 4px 16px 12px; overflow-x: auto; white-space: nowrap; }
.cat { padding: 6px 14px; background: #fff; border-radius: 16px; color: #666; font-size: 13px; }
.cat.active { background: var(--primary); color: #fff; }

.product-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 12px 20px; }
.product-card { background: var(--card); border-radius: var(--radius); overflow: hidden; display: block; }
.product-cover {
  width: 100%; height: 150px; background: #eef1f4 center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
}
.cover-letter { font-size: 44px; font-weight: 700; color: #b9c2cc; }
.cover-letter.big { font-size: 80px; }
.product-name { padding: 10px 10px 2px; font-size: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.product-meta { display: flex; align-items: center; justify-content: space-between; padding: 4px 10px 12px; }
.product-price { color: #f0432e; font-weight: 700; }
.product-price em { font-style: normal; font-size: 16px; }
.product-buy { background: var(--primary); color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 12px; }

/* 商品详情 */
.pdetail-cover { width: 100%; height: 280px; background: #eef1f4 center/cover no-repeat; display: flex; align-items: center; justify-content: center; }
.pdetail-body { background: #fff; margin-top: -14px; border-radius: 16px 16px 0 0; padding: 16px; position: relative; }
.pdetail-price-row { display: flex; align-items: baseline; justify-content: space-between; }
.pdetail-price { color: #f0432e; font-weight: 700; }
.pdetail-price em { font-style: normal; font-size: 26px; }
.pdetail-cat { font-size: 12px; color: var(--muted); background: #f2f3f5; padding: 2px 8px; border-radius: 10px; }
.pdetail-name { font-size: 18px; margin: 8px 0 4px; }
.pdetail-desc { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.pdetail-section { margin-top: 16px; }
.pdetail-section-title { font-weight: 600; margin-bottom: 10px; }
.pdetail-rich { color: #555; font-size: 14px; white-space: pre-wrap; }

/* 规格 */
.spec-list { display: flex; flex-wrap: wrap; gap: 10px; }
.spec-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 8px 14px; cursor: pointer; color: #333;
}
.spec-item .spec-name { font-size: 13px; }
.spec-item .spec-price { color: #f0432e; font-weight: 600; font-size: 13px; }
.spec-item .spec-price-old { color: #bbb; font-size: 12px; text-decoration: line-through; }
.spec-item .spec-stock { color: #f57c00; font-size: 11px; }
.spec-item .spec-stock.sold { color: #c0392b; }
.spec-item.soldout { opacity: .55; }
.spec-item.active { border-color: var(--primary); background: #fff3ee; color: var(--primary); }

/* 数量 */
.qty-stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.qty-btn { width: 34px; height: 34px; border: none; background: #f7f8fa; font-size: 18px; cursor: pointer; color: #333; }
.qty-input { width: 44px; height: 34px; border: none; text-align: center; outline: none; }
.qty-stepper.sm { border-radius: 6px; }
.qty-btn.sm { width: 26px; height: 26px; font-size: 15px; }
.qty-input.sm { width: 34px; height: 26px; font-size: 13px; }

/* 底部操作栏 */
.detail-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px; background: #fff;
  border-top: 1px solid var(--line); padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
}
.detail-bar-cart { position: relative; display: flex; flex-direction: column; align-items: center; color: #666; font-size: 11px; min-width: 52px; }
.detail-bar-cart em { font-style: normal; }
.detail-bar .btn { flex: 1; }

/* 按钮 */
.btn { display: inline-block; border: none; border-radius: 22px; padding: 10px 20px; font-size: 15px; cursor: pointer; text-align: center; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-outline { background: #fff3ee; color: var(--primary); border: 1px solid var(--primary); }
.btn-block { display: block; width: 100%; }
.btn:disabled { opacity: .6; }

/* 购物车 */
.cart-list { padding: 12px; }
.cart-item { display: flex; justify-content: space-between; background: #fff; border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 14px; font-weight: 600; }
.cart-item-spec { color: var(--muted); font-size: 12px; margin: 2px 0; }
.cart-item-price { color: #f0432e; font-weight: 600; }
.cart-item-stock { color: #f57c00; font-size: 11px; margin-top: 2px; }
.cart-item-stock.danger { color: #c0392b; font-weight: 600; }
.cart-item-right { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; }
.cart-remove { border: none; background: none; color: var(--muted); font-size: 12px; cursor: pointer; }
.cart-summary { background: #fff; margin: 0 12px; border-radius: var(--radius); padding: 14px; display: flex; justify-content: space-between; }
.cart-total { color: #f0432e; font-style: normal; font-weight: 700; }
.cart-actions { padding: 16px 12px 24px; }

/* 结算 */
.co-section { background: #fff; margin: 12px; border-radius: var(--radius); padding: 14px; }
.co-title { font-weight: 600; margin-bottom: 10px; }
.co-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 14px; }
.co-item-name { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.co-item-qty { color: var(--muted); }
.co-item-price { color: #333; }
.co-total { text-align: right; font-size: 14px; padding-top: 8px; border-top: 1px dashed var(--line); margin-top: 8px; }
.co-total em { color: #f0432e; font-style: normal; font-size: 18px; font-weight: 700; }
.co-radio { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 8px; cursor: pointer; }
.co-radio.active { border-color: var(--primary); background: #fff3ee; }
.co-radio input { margin: 0; }
.co-tip { color: var(--muted); font-size: 13px; margin: 0; }

/* 表单 */
.field-label { display: block; font-size: 13px; color: #666; margin: 10px 0 4px; }
.field { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; outline: none; background: #fff; }
.field:focus { border-color: var(--primary); }

/* 订单列表 */
.order-tabs { display: flex; background: #fff; margin-bottom: 10px; }
.otab { flex: 1; text-align: center; padding: 12px; color: #666; border-bottom: 2px solid transparent; }
.otab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.order-list { padding: 0 12px 20px; }
.order-card { background: #fff; border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.order-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.order-no { color: #666; font-size: 13px; }
.order-status { font-size: 12px; padding: 2px 10px; border-radius: 10px; }
.order-status.pending { background: #fff3e0; color: #f57c00; }
.order-status.done { background: #e8f5e9; color: var(--green); }
.order-items { padding: 8px 0; }
.order-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 14px; }
.oi-name { flex: 1; }
.oi-qty { color: var(--muted); }
.oi-price { color: #333; }
.order-foot { display: flex; align-items: center; gap: 10px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 13px; color: #666; }
.order-delivery { background: #f2f3f5; padding: 2px 8px; border-radius: 8px; }
.order-time { flex: 1; }
.order-total { color: #333; }
.order-total em { color: #f0432e; font-style: normal; font-weight: 700; }

/* 成功/提示页 */
.success-wrap { text-align: center; padding: 60px 24px; }
.success-icon { font-size: 56px; }
.success-title { margin: 12px 0 8px; }
.success-sub { color: var(--muted); margin: 0 0 20px; }
.success-order { background: #fff; border-radius: 8px; padding: 12px; margin-bottom: 20px; color: #666; }
.success-actions { display: flex; gap: 12px; justify-content: center; }
.success-actions .btn { flex: 0 1 auto; }

/* 登录 */
.login-wrap { padding: 50px 24px 40px; text-align: center; }
.login-logo { font-size: 60px; }
.login-logo img { width: 96px; height: 96px; border-radius: 24px; object-fit: contain; }
.login-title { margin: 12px 0 4px; }
.login-sub { color: var(--muted); margin: 0 0 24px; }
.login-card { background: #fff; border-radius: var(--radius); padding: 20px; text-align: left; box-shadow: 0 2px 12px rgba(0,0,0,.05); }
.login-card .btn { margin-top: 28px; }
.login-error { color: #c0392b; font-size: 13px; margin: 4px 0 12px; }
.login-members { margin-top: 24px; }
.login-members-tip { color: var(--muted); font-size: 13px; }
.member-chip { display: inline-block; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 8px 18px; margin: 4px; color: #333; }
.member-chip:active { background: #fff3ee; border-color: var(--primary); color: var(--primary); }
.login-note { color: #bbb; font-size: 12px; margin-top: 28px; }

/* 空状态 */
.empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty .btn { margin-top: 16px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(10px);
  background: rgba(0,0,0,.75); color: #fff; padding: 10px 18px; border-radius: 20px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 99;
  max-width: 80%; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 支付弹窗 */
.pay-mask { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; }
.pay-box { background: #fff; border-radius: 16px; padding: 24px; width: 100%; max-width: 320px; text-align: center; }
.pay-title { font-size: 18px; font-weight: 700; }
.pay-sub { color: #999; font-size: 13px; margin-top: 8px; }
.pay-actions { display: flex; gap: 10px; margin-top: 20px; }
.pay-actions .btn { flex: 1; }

/* 订单去支付 */
.order-pay { padding-top: 10px; text-align: right; }
.order-pay-hint { color: #f57c00; font-size: 13px; }

/* 分享面板 / 添加到桌面 */
.share-sheet { background: #fff; border-radius: 16px; padding: 24px; width: 100%; max-width: 320px; text-align: center; max-height: 85vh; overflow: auto; }
.share-sheet-title { font-size: 18px; font-weight: 700; }
.share-sheet-sub { color: #666; font-size: 13px; margin-top: 6px; }
.share-qr { width: 220px; height: 220px; margin: 16px auto 8px; display: block; border: 1px solid #eee; border-radius: 8px; }
.share-sheet-tip { color: #999; font-size: 12px; margin-bottom: 16px; }
.share-actions { display: flex; gap: 10px; }
.share-actions .btn { flex: 1; }
.share-sheet-note { color: #bbb; font-size: 12px; margin-top: 14px; text-align: left; line-height: 1.6; }
.share-close { margin-top: 16px; border: none; background: #f2f3f5; color: #666; border-radius: 20px; padding: 8px 20px; font-size: 13px; }
.ah-step { text-align: left; color: #333; font-size: 14px; margin: 12px 0; line-height: 1.6; }
