:root {
  --brand: #2b3a3f;
  --brand-2: #3f565c;
  --accent: #c9a063;
  --accent-2: #b98a4e;
  --price: #e0442e;
  --bg: #f5f3ef;
  --card: #ffffff;
  --line: #ece7df;
  --text: #2c2c2c;
  --muted: #9a938b;
  --ok: #3aa06f;
  --shadow: 0 2px 10px rgba(43, 58, 63, .06);
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  padding-bottom: 64px;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; }
input, select, textarea { font-family: inherit; font-size: 14px; }

#page { max-width: 640px; margin: 0 auto; background: var(--bg); min-height: 100vh; }

/* 顶部 */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff; padding: 12px 14px;
}
.topbar .logo { font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.topbar .logo b { color: var(--accent); }
.topbar .slogan { font-size: 11px; opacity: .7; margin-left: -6px; margin-top: 3px; }
.topbar .spacer { flex: 1; }
.topbar .icon-btn { background: rgba(255,255,255,.12); color: #fff; border-radius: 8px; padding: 6px 9px; font-size: 12px; position: relative; }
.topbar .icon-btn .dot { position: absolute; top: -4px; right: -4px; background: var(--price); color: #fff; font-size: 10px; border-radius: 8px; padding: 0 5px; }

/* 底部导航 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  max-width: 640px; margin: 0 auto;
  background: #fff; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 8px; color: var(--muted); font-size: 11px; }
.tabbar a.active { color: var(--brand); font-weight: 600; }
.tabbar a .ic { font-size: 20px; line-height: 1; }

/* 区块 */
.section { margin: 10px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.section-title { display: flex; align-items: center; gap: 8px; padding: 13px 14px 6px; font-size: 16px; font-weight: 700; }
.section-title .bar { width: 4px; height: 16px; background: var(--accent); border-radius: 2px; }
.section-title .more { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 400; }

/* 轮播 banner */
.banner { margin: 10px 10px 0; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.banner img { width: 100%; aspect-ratio: 16/7; object-fit: cover; }
.banner .swipe { position: relative; }
.banner .swipe .txt { position: absolute; left: 12px; bottom: 12px; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.4); }
.banner .swipe .txt h3 { font-size: 18px; }

/* 分类网格 */
.cat-grid { display: grid; grid-template-columns: repeat(5, 1fr); padding: 12px 8px; gap: 6px; }
.cat-grid a { display: flex; flex-direction: column; align-items: center; gap: 5px; color: var(--text); font-size: 12px; }
.cat-grid .icon { width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #f6ede1, #efe3d3); font-size: 22px; }

/* 商品网格 */
.goods-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 8px 12px 14px; }
.goods-card { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.goods-card .pic { position: relative; aspect-ratio: 1/1; background: #f1ede7; }
.goods-card .pic img { width: 100%; height: 100%; object-fit: cover; }
.goods-card .badge { position: absolute; top: 8px; left: 8px; background: var(--price); color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 10px; }
.goods-card .info { padding: 8px 10px 12px; }
.goods-card .name { font-size: 13px; line-height: 1.4; height: 36px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.goods-card .price-row { margin-top: 6px; display: flex; align-items: baseline; gap: 4px; }
.goods-card .price { color: var(--price); font-size: 16px; font-weight: 700; }
.goods-card .price small { font-size: 12px; }
.goods-card .origin { color: var(--muted); font-size: 11px; text-decoration: line-through; }
.goods-card .meta { color: var(--muted); font-size: 11px; margin-top: 3px; }

/* 品牌馆 */
.brand-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 8px 12px 14px; }
.brand-card { display: flex; align-items: center; gap: 10px; background: #faf7f2; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.brand-card .logo { width: 46px; height: 46px; border-radius: 12px; background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; }
.brand-card .bname { font-weight: 600; font-size: 14px; }
.brand-card .slogan { color: var(--muted); font-size: 11px; margin-top: 2px; }

/* 通用按钮 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 20px; padding: 10px 18px; font-size: 14px; font-weight: 600; transition: .15s; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.btn-dark { background: var(--brand); color: #fff; }
.btn-block { width: 100%; }
.btn-lg { padding: 13px 22px; font-size: 15px; }
.btn-light { background: #fff; border: 1px solid var(--line); color: var(--text); }
.btn:active { transform: scale(.98); opacity: .92; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* 表单 */
.form-field { padding: 0 14px; }
.form-field label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
.input, .textarea, select.input {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px; background: #fff; outline: none;
}
.input:focus, .textarea:focus { border-color: var(--accent); }
.textarea { min-height: 72px; resize: vertical; }

/* 后台支付配置表单 */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.settings-card { background: #fff; border-radius: 10px; padding: 18px; }
.settings-card h3 { margin: 0 0 14px; font-size: 15px; }
.settings-card label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 5px; }
.settings-card .input, .settings-card .textarea { margin-bottom: 2px; }

/* 价格/金额 */
.money { color: var(--price); font-weight: 700; }
.money small { font-size: 60%; }

/* 商品详情 */
.detail-pics { width: 100%; aspect-ratio: 1/1; background: #f1ede7; }
.detail-pics img { width: 100%; height: 100%; object-fit: cover; }
.detail-body { margin: 10px; background: #fff; border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.detail-name { font-size: 17px; font-weight: 700; line-height: 1.45; }
.detail-priceline { display: flex; align-items: baseline; gap: 8px; margin: 10px 0; }
.detail-price { color: var(--price); font-size: 26px; font-weight: 800; }
.detail-origin { color: var(--muted); text-decoration: line-through; }
.detail-sales { margin-left: auto; color: var(--muted); font-size: 12px; }
.param-row { display: flex; border-bottom: 1px dashed var(--line); padding: 8px 0; font-size: 13px; }
.param-row .k { color: var(--muted); width: 72px; flex: none; }
.detail-desc { margin: 10px; background: #fff; border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); color: #555; white-space: pre-wrap; }
.detail-bar { position: sticky; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.detail-bar .qty { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 20px; }
.detail-bar .qty button { width: 34px; height: 34px; background: transparent; font-size: 18px; color: var(--text); }
.detail-bar .qty span { min-width: 30px; text-align: center; }

/* 购物车 */
.cart-item { display: flex; gap: 10px; padding: 12px; border-bottom: 1px solid var(--line); align-items: center; }
.cart-item img { width: 76px; height: 76px; border-radius: 8px; object-fit: cover; }
.cart-item .ci-body { flex: 1; min-width: 0; }
.cart-item .ci-name { font-size: 13px; line-height: 1.4; height: 36px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cart-item .ci-price { margin-top: 4px; }
.cart-summary { position: sticky; bottom: 54px; display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #fff; border-top: 1px solid var(--line); }
.cart-summary .total { flex: 1; font-size: 14px; }

/* 订单卡片 */
.order-card { margin: 10px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.order-head { display: flex; justify-content: space-between; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.order-body { padding: 12px 14px; }
.order-item { display: flex; gap: 10px; margin: 6px 0; }
.order-item img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; }
.order-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); background: #fbf9f6; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; }
.tag-pending { background: #fdecea; color: var(--price); }
.tag-paid { background: #e8f5ee; color: var(--ok); }
.tag-shipped { background: #e8f1f8; color: #3378b5; }
.tag-completed { background: #f0f0f0; color: #777; }
.tag-cancelled { background: #f0f0f0; color: #aaa; }

/* 支付/收银台 */
.cashier-wrap { margin: 20px 12px; }
.cashier-card { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 26px 20px; text-align: center; }
.cashier-amt { font-size: 15px; color: var(--muted); margin-bottom: 14px; }
.cashier-amt .big { font-size: 40px; color: var(--text); font-weight: 800; }
.cashier-amt .big small { font-size: 20px; }

/* 遮罩/提示 */
.toast { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); background: rgba(0,0,0,.78); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 14px; z-index: 999; max-width: 80%; text-align: center; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

/* 管理后台 */
.admin-shell { display: flex; min-height: 100vh; background: #f1f3f5; }
.admin-side { width: 210px; background: #23292e; color: #cfd6db; padding: 20px 0; flex: none; }
.admin-side .brand { color: #fff; font-size: 17px; font-weight: 700; padding: 0 20px 18px; }
.admin-side a { display: block; padding: 12px 20px; color: #cfd6db; font-size: 14px; }
.admin-side a.active, .admin-side a:hover { background: #2f373d; color: #fff; }
.admin-main { flex: 1; padding: 20px; }
.admin-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.admin-card { background: #fff; border-radius: 10px; padding: 18px; }
.admin-card .n { font-size: 26px; font-weight: 700; }
.admin-card .l { color: #8a9196; font-size: 13px; margin-top: 4px; }
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; font-size: 13px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eee; }
.table th { background: #f7f8f9; font-weight: 600; }

@media (max-width: 720px) {
  .admin-shell { flex-direction: column; }
  .admin-side { width: 100%; display: flex; overflow-x: auto; padding: 0; }
  .admin-side .brand { display: none; }
  .admin-side a { padding: 12px 16px; white-space: nowrap; }
  .admin-cards { grid-template-columns: repeat(2, 1fr); }
}