/* ===== 设计系统：苹果极简风 ===== */
:root {
  --bg: #f2f2f7;
  --bg-elev: #ffffff;
  --card: #ffffff;
  --text: #1c1c1e;
  --text-2: #8a8a8e;
  --text-3: #b0b0b5;
  --sep: rgba(60,60,67,0.10);
  --accent: #0a84ff;
  --accent-soft: rgba(10,132,255,0.10);
  --green: #34c759;
  --red: #ff3b30;
  --orange: #ff9500;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.05);
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --maxw: 640px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-elev: #1c1c1e;
    --card: #1c1c1e;
    --text: #ffffff;
    --text-2: #98989f;
    --text-3: #636366;
    --sep: rgba(255,255,255,0.10);
    --accent: #0a84ff;
    --accent-soft: rgba(10,132,255,0.18);
    --shadow: 0 1px 2px rgba(0,0,0,0.4);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
#app { max-width: var(--maxw); margin: 0 auto; min-height: 100vh; }
.view { padding: 16px 16px calc(var(--tabbar-h) + var(--safe-b) + 24px); animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h1,h2,h3 { margin: 0; font-weight: 700; letter-spacing: -0.02em; }
.title-lg { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.center { text-align: center; }
a { color: var(--accent); text-decoration: none; }

/* ===== 顶部栏 ===== */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.topbar .hello { font-size: 13px; color: var(--text-2); }
.topbar .shop { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }
.balance-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); box-shadow: var(--shadow);
  padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 15px;
  cursor: pointer; white-space: nowrap;
}
.balance-pill .lbl { font-size: 11px; color: var(--text-2); font-weight: 600; }

/* ===== 卡片 ===== */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 16px; }
.banner {
  background: linear-gradient(135deg, var(--accent), #5e5ce6);
  color: #fff; border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px;
  font-size: 14px; line-height: 1.5; box-shadow: var(--shadow);
}
.section-title { font-size: 13px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; margin: 22px 4px 10px; }

/* ===== 搜索 / 输入 ===== */
.search { position: relative; margin-bottom: 14px; }
.search input { padding-left: 38px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
input, textarea, select {
  width: 100%; font: inherit; color: var(--text);
  background: var(--bg-elev); border: 1px solid var(--sep);
  border-radius: var(--radius-sm); padding: 12px 14px; outline: none;
  transition: border-color .15s;
}
@media (prefers-color-scheme: dark) { input, textarea, select { background: #2c2c2e; } }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 84px; }
label.field { display: block; margin: 12px 0; }
label.field .lbl { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }

/* ===== 分类 chips ===== */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; -ms-overflow-style: none; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: var(--card); color: var(--text); box-shadow: var(--shadow); cursor: pointer; border: none;
  transition: all .15s;
}
.chip.active { background: var(--accent); color: #fff; }

/* ===== 商品网格 ===== */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 12px; }
.product {
  background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  cursor: pointer; display: flex; flex-direction: column; transition: transform .12s;
}
.product:active { transform: scale(0.97); }
.product .thumb {
  aspect-ratio: 1.5/1; background: linear-gradient(135deg,#e9e9ee,#f7f7fa);
  display: flex; align-items: center; justify-content: center; font-size: 34px;
}
@media (prefers-color-scheme: dark) { .product .thumb { background: linear-gradient(135deg,#2c2c2e,#3a3a3c); } }
.product .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product .body { padding: 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.product .name { font-weight: 700; font-size: 15px; line-height: 1.3; }
.product .sub { font-size: 12px; color: var(--text-2); flex: 1; }
.product .row { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.price { color: var(--accent); font-weight: 800; font-size: 16px; }
.price .sym { font-size: 12px; }
.tag { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tag.gray { background: var(--sep); color: var(--text-2); }
.sold-out { filter: grayscale(0.6); opacity: 0.7; }

/* ===== 列表行 ===== */
.list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--sep); cursor: pointer; }
.row-item:last-child { border-bottom: none; }
.row-item .grow { flex: 1; min-width: 0; }
.row-item .t1 { font-weight: 600; font-size: 15px; }
.row-item .t2 { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.row-item .chev { color: var(--text-3); }
.amount-pos { color: var(--green); font-weight: 700; }
.amount-neg { color: var(--text); font-weight: 700; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 15px 18px; border: none; border-radius: 14px;
  background: var(--accent); color: #fff; font-size: 17px; font-weight: 700; cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; }
.btn.secondary { background: var(--card); color: var(--accent); box-shadow: var(--shadow); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.danger { background: var(--red); }
.btn.sm { width: auto; padding: 9px 16px; font-size: 14px; border-radius: 10px; }
.btn-row { display: flex; gap: 10px; }

/* ===== 充值方式选择 ===== */
.method-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.method {
  background: var(--card); box-shadow: var(--shadow); border-radius: var(--radius-sm);
  padding: 16px 12px; text-align: center; cursor: pointer; border: 2px solid transparent;
  display: flex; flex-direction: column; align-items: center; gap: 6px; transition: border-color .15s;
}
.method .ico { font-size: 26px; }
.method .nm { font-weight: 700; font-size: 14px; }
.method .ds { font-size: 11px; color: var(--text-2); }
.amount-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.amount-chips .chip { box-shadow: none; border: 1px solid var(--sep); background: var(--bg-elev); }
.amount-chips .chip.active { background: var(--accent); color:#fff; border-color: var(--accent); }

/* ===== 支付信息 ===== */
.pay-field { background: var(--bg-elev); border: 1px solid var(--sep); border-radius: var(--radius-sm); padding: 12px 14px; margin: 8px 0; }
.pay-field .k { font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.pay-field .v { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; word-break: break-all; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.copy-btn { color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer; flex: 0 0 auto; }

/* ===== 底部 Tab ===== */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; max-width: var(--maxw); margin: 0 auto;
  background: color-mix(in srgb, var(--bg-elev) 80%, transparent);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--sep);
}
.tabbar .tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-3); font-size: 10px; font-weight: 600; cursor: pointer; border: none; background: none;
}
.tabbar .tab.active { color: var(--accent); }
.tabbar .tab svg { width: 25px; height: 25px; }
.tabbar .badge { position: absolute; top: 8px; margin-left: 18px; background: var(--red); color:#fff; font-size: 9px; min-width: 16px; height: 16px; border-radius: 8px; display:flex; align-items:center; justify-content:center; padding: 0 4px; }

/* ===== 详情 / 弹层 ===== */
.detail-hero { aspect-ratio: 1.7/1; border-radius: var(--radius); background: linear-gradient(135deg,#e9e9ee,#f7f7fa); display:flex; align-items:center; justify-content:center; font-size: 64px; margin-bottom: 16px; overflow: hidden; }
@media (prefers-color-scheme: dark){ .detail-hero { background: linear-gradient(135deg,#2c2c2e,#3a3a3c);} }
.detail-hero img { width:100%; height:100%; object-fit: cover; }
.qty { display: flex; align-items: center; gap: 16px; }
.qty button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--sep); background: var(--bg-elev); font-size: 20px; color: var(--text); cursor: pointer; }
.qty .n { font-size: 18px; font-weight: 700; min-width: 28px; text-align: center; }

.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 100; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet { background: var(--bg); width: 100%; max-width: var(--maxw); border-radius: 22px 22px 0 0; padding: 22px 18px calc(22px + var(--safe-b)); animation: slideup .28s cubic-bezier(.2,.8,.2,1); max-height: 88vh; overflow-y: auto; }
@keyframes slideup { from { transform: translateY(100%);} to { transform: none; } }
.sheet .grab { width: 38px; height: 5px; border-radius: 3px; background: var(--text-3); opacity: .4; margin: -8px auto 14px; }
.delivery-box { background: var(--card); border-radius: var(--radius-sm); padding: 14px; font-family: ui-monospace, Menlo, monospace; font-size: 14px; white-space: pre-wrap; word-break: break-all; border: 1px solid var(--sep); }

.status-dot { display:inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.st-delivered { color: var(--green);} .st-delivered .status-dot{background:var(--green);}
.st-pending { color: var(--orange);} .st-pending .status-dot{background:var(--orange);}
.st-refunded,.st-cancelled,.st-rejected { color: var(--text-2);} .st-refunded .status-dot,.st-cancelled .status-dot,.st-rejected .status-dot{background:var(--text-3);}
.st-paid{color:var(--green);} .st-paid .status-dot{background:var(--green);}

.empty { text-align: center; padding: 60px 20px; color: var(--text-2); }
.empty .ico { font-size: 48px; margin-bottom: 12px; opacity: .5; }

.spinner { width: 22px; height: 22px; border: 2.5px solid var(--sep); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-full { display: flex; align-items: center; justify-content: center; min-height: 70vh; }

/* ===== Toast ===== */
#toast { position: fixed; bottom: calc(var(--tabbar-h) + 30px); left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.86); color:#fff; padding: 11px 18px; border-radius: 12px; font-size: 14px; z-index: 200; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; max-width: 80%; text-align:center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* ===== 头像 ===== */
.avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display:flex; align-items:center; justify-content:center; font-size: 24px; font-weight: 700; overflow: hidden; flex: 0 0 auto; }
.avatar img { width:100%; height:100%; object-fit: cover; }

/* ===== 后台 ===== */
.admin-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 14px; padding: 0 16px 4px; scrollbar-width: none; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tabs .chip { box-shadow: none; border: 1px solid var(--sep); background: var(--bg-elev); }
.stat-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; margin-bottom: 8px; }
.stat { background: var(--card); border-radius: var(--radius-sm); padding: 14px; box-shadow: var(--shadow); }
.stat .num { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.stat .lbl { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.back-btn { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 600; cursor: pointer; margin-bottom: 12px; font-size: 16px; }
.adm-row { background: var(--card); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 14px; margin-bottom: 10px; }
.adm-row .h { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.adm-row .h .t { font-weight: 700; }
.adm-row .meta { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.adm-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.fab { position: fixed; right: max(16px, calc((100vw - var(--maxw))/2 + 16px)); bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color:#fff; font-size: 28px; border: none; box-shadow: 0 4px 16px rgba(10,132,255,.4); cursor: pointer; z-index: 40; }

/* ===== 公告横幅（带图标）===== */
.banner { display: flex; align-items: flex-start; gap: 10px; }
.banner .banner-ico { flex: 0 0 auto; }

/* ===== 首页：货币兑换广告位 ===== */
.exch-ad {
  position: relative; overflow: hidden; cursor: pointer; margin-bottom: 14px;
  border-radius: var(--radius); padding: 18px; color: #fff;
  background: linear-gradient(135deg, #0a84ff 0%, #5e5ce6 55%, #bf5af2 100%);
  box-shadow: 0 8px 24px rgba(94,92,230,.35); transition: transform .12s;
}
.exch-ad:active { transform: scale(.99); }
.exch-shine { position: absolute; top: -60%; right: -15%; width: 55%; height: 220%; transform: rotate(20deg); pointer-events: none; background: radial-gradient(closest-side, rgba(255,255,255,.35), transparent); }
.exch-top { display: flex; justify-content: space-between; align-items: center; position: relative; }
.exch-badge { font-size: 12px; font-weight: 700; background: rgba(255,255,255,.22); padding: 4px 10px; border-radius: 999px; }
.exch-cta { font-size: 13px; font-weight: 700; opacity: .95; }
.exch-title { font-size: 20px; font-weight: 800; letter-spacing: -.02em; margin: 12px 0 4px; position: relative; }
.exch-desc { font-size: 13px; line-height: 1.5; opacity: .92; position: relative; }
.exch-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; position: relative; }
.exch-chips span { font-size: 11px; font-weight: 700; background: rgba(255,255,255,.18); padding: 4px 9px; border-radius: 8px; }
.exch-chips span:last-child { background: rgba(255,255,255,.95); color: var(--accent); }
.exch-points { display: flex; justify-content: space-around; gap: 8px; margin-top: 18px; }
.exch-points > div { display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); font-weight: 600; }
.exch-points .p-i { font-size: 24px; }

/* ===== 首页：服务亮点 ===== */
.feature-strip { display: flex; gap: 8px; margin: 14px 0 2px; }
.feat { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; background: var(--card); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 10px 4px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.feat .fi { font-size: 20px; }
