* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --red: #c8102e;
  --bg: #f5f6f7;
  --card: #fff;
  --text: #1f2329;
  --muted: #8a919f;
  --line: #eef0f3;
  --green: #2fae60;
  --blue: #2f7bd9;
  --orange: #e08a00;
}
body {
  font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
button { cursor: pointer; border: none; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; outline: none; }
img { display: block; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: #1a1a1a; color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
}
.topbar .brand { font-weight: 700; font-size: 16px; }
.topbar .brand span { color: #ff5b6e; }
.topbar a { color: #bbb; font-size: 13px; margin-left: 12px; }
.notice { background: var(--red); color: #fff; text-align: center; padding: 8px 12px; font-size: 13px; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 16px; }

.sec { margin: 18px 0; }
.sec-title {
  display: flex; align-items: center;
  font-size: 16px; font-weight: 700; margin-bottom: 10px;
}
.sec-title::before { content: ''; width: 4px; height: 16px; background: var(--red); border-radius: 2px; margin-right: 8px; }
.sec-title .more { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 400; }

.cats { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.cat {
  flex-shrink: 0; padding: 6px 16px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); font-size: 13px; color: #555;
}
.cat.active { background: var(--red); border-color: var(--red); color: #fff; }

.search { margin: 12px 0; }
.search input {
  width: 100%; padding: 10px 14px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card);
}

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.card {
  background: var(--card); border-radius: 12px; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .04); cursor: pointer;
}
.thumb {
  position: relative; width: 100%; aspect-ratio: 1;
  background: linear-gradient(135deg, #f3e7e0, #e8d5c4);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .ph { font-size: 32px; color: #b98d68; font-weight: 700; }
.badge {
  position: absolute; left: 8px; top: 8px;
  background: var(--red); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 4px;
}
.badge.new { background: var(--green); }
.badge.soldout { background: #666; }
.info { padding: 8px 10px 10px; }
.name { font-size: 13px; font-weight: 600; line-height: 1.4; height: 2.8em; overflow: hidden; }
.stock { font-size: 11px; color: var(--muted); margin: 4px 0; }
.price-row { display: flex; align-items: baseline; gap: 6px; }
.price { color: var(--red); font-weight: 700; font-size: 16px; }
.origin { color: var(--muted); font-size: 12px; text-decoration: line-through; }

.hscroll { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.hscroll .card { min-width: 130px; flex-shrink: 0; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

.fab {
  position: fixed; right: 16px; bottom: 30px; z-index: 40;
  background: var(--red); color: #fff; border-radius: 999px;
  padding: 12px 20px; font-size: 14px; font-weight: 600;
  box-shadow: 0 4px 14px rgba(200, 16, 46, .35);
}
.fab .cnt { background: #fff; color: var(--red); border-radius: 999px; padding: 0 7px; margin-left: 6px; }

.drawer {
  position: fixed; right: 0; top: 0; bottom: 0; width: 340px; max-width: 92vw;
  background: #fff; z-index: 60; transform: translateX(100%);
  transition: transform .25s; display: flex; flex-direction: column;
  box-shadow: -4px 0 20px rgba(0, 0, 0, .12);
}
.drawer.open { transform: translateX(0); }
.drawer .head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); font-weight: 700; }
.drawer .body { flex: 1; overflow-y: auto; padding: 12px 16px; }
.drawer .foot { padding: 12px 16px; border-top: 1px solid var(--line); }
.ci { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: center; }
.ci img, .ci .ph { width: 54px; height: 54px; border-radius: 8px; object-fit: cover; background: #f3e7e0; display: flex; align-items: center; justify-content: center; color: #b98d68; font-weight: 700; }
.ci .t { flex: 1; }
.ci .n { font-size: 13px; font-weight: 600; }
.ci .m { font-size: 12px; color: var(--muted); }
.qty { display: flex; align-items: center; gap: 6px; }
.qty button { width: 24px; height: 24px; border-radius: 6px; background: #f2f3f5; font-size: 14px; }

.mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 70;
  display: none; align-items: center; justify-content: center;
}
.mask.open { display: flex; }
.modal {
  background: #fff; border-radius: 14px; width: 92%; max-width: 520px;
  max-height: 86vh; overflow-y: auto; padding: 18px;
}
.modal h3 { font-size: 16px; margin-bottom: 12px; }
.modal .close { float: right; color: var(--muted); font-size: 20px; background: none; }

.fld { margin-bottom: 12px; }
.fld label { display: block; font-size: 13px; color: #555; margin-bottom: 5px; }
.fld input, .fld select, .fld textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fafafa;
}
.fld textarea { min-height: 64px; resize: vertical; }
.frow { display: flex; gap: 12px; }
.frow .fld { flex: 1; }
.radio-row { display: flex; gap: 10px; margin-bottom: 12px; }
.radio-row label {
  flex: 1; text-align: center; padding: 9px 0; border: 1px solid var(--line);
  border-radius: 8px; cursor: pointer; font-size: 13px;
}
.radio-row input { display: none; }
.radio-row label.on { border-color: var(--red); color: var(--red); background: #fdecec; }

.btn {
  display: inline-block; border-radius: 999px; font-size: 14px; font-weight: 600;
  padding: 9px 22px; text-align: center;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-plain { background: #fff; color: var(--red); border: 1px solid var(--red); }
.btn-gray { background: #f2f3f5; color: #555; }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.spinner {
  display: none;
  width: 14px; height: 14px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: -2px;
  margin-right: 7px;
  animation: spin .7s linear infinite;
}
.btn.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.total-line { display: flex; justify-content: space-between; font-size: 13px; color: #555; margin: 6px 0; }
.total-line.big { font-size: 15px; font-weight: 700; color: var(--text); }
.total-line .price { font-size: 18px; }

.badge-pay { font-size: 11px; border-radius: 4px; padding: 2px 8px; }
.pay-unpaid { background: #fdecea; color: var(--red); }
.pay-paid { background: #e8f6ee; color: var(--green); }
.pay-credit { background: #fff4e0; color: var(--orange); }
.pay-settled { background: #e8f1fc; color: var(--blue); }
.pay-refunded { background: #f2f3f5; color: var(--muted); }
.st-pending { color: var(--red); }
.st-confirmed { color: var(--orange); }
.st-shipped { color: var(--blue); }
.st-completed { color: var(--green); }
.st-cancelled { color: var(--muted); }

.order { background: var(--card); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.order .row { display: flex; justify-content: space-between; align-items: center; }
.order .row + .row { margin-top: 8px; }
.order .no { font-weight: 700; font-size: 13px; }
.order .t { font-size: 12px; color: var(--muted); }
.order .items { font-size: 12px; color: #555; }

.updates { background: var(--card); border-radius: 12px; padding: 14px 16px; }
.updates .u { padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.updates .u:last-child { border-bottom: none; }
.updates .u .d { color: var(--red); font-weight: 700; margin-right: 8px; }

footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 0 60px; }

/* ---------- 管理后台 ---------- */
.admin-nav {
  display: flex; flex-wrap: wrap; gap: 8px;
  background: #fff; padding: 10px 16px; position: sticky; top: 49px; z-index: 45;
  border-bottom: 1px solid var(--line);
}
.admin-nav button {
  padding: 7px 16px; border-radius: 999px; background: #f2f3f5; font-size: 13px; color: #555;
}
.admin-nav button.active { background: var(--red); color: #fff; }
.panel { display: none; }
.panel.active { display: block; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border-radius: 12px; padding: 16px; }
.stat .v { font-size: 22px; font-weight: 700; }
.stat .k { font-size: 12px; color: var(--muted); margin-top: 4px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input, .toolbar select {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.toolbar .sp { flex: 1; }

table.tb { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; }
table.tb th, table.tb td {
  padding: 10px 12px; text-align: left; font-size: 13px;
  border-bottom: 1px solid var(--line); vertical-align: middle;
}
table.tb th { background: #fafafa; color: #555; font-weight: 600; white-space: nowrap; }
table.tb tr:last-child td { border-bottom: none; }
table.tb .thumb-cell { width: 54px; height: 54px; border-radius: 8px; object-fit: cover; background: #f3e7e0; }
.tag-promo { color: var(--red); font-size: 12px; }
.act { display: flex; gap: 6px; flex-wrap: wrap; }

.login-mask { position: fixed; inset: 0; background: #1a1a1a; z-index: 100; display: flex; align-items: center; justify-content: center; }
.login-box { background: #fff; border-radius: 14px; padding: 30px; width: 320px; }
.login-box h2 { margin-bottom: 6px; }
.login-box p { color: var(--muted); font-size: 12px; margin-bottom: 16px; }
.login-switch { margin-top: 14px; text-align: center; font-size: 13px; color: var(--muted); }
.login-switch a { color: var(--red); font-weight: 600; }

.toast {
  position: fixed; left: 50%; top: 30%; transform: translateX(-50%);
  background: rgba(0, 0, 0, .78); color: #fff; padding: 10px 22px;
  border-radius: 8px; font-size: 14px; z-index: 200; display: none; max-width: 80vw;
}
.toast.show { display: block; }

@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .wrap { padding: 10px; }
}

/* ---------- 买家端移动商城（四页签 + 底部导航） ---------- */
body { padding-bottom: 0; }
.app { max-width: 680px; margin: 0 auto; padding: 12px 12px 84px; }
.tab-page { display: none; }
.tab-page.active { display: block; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
  display: flex; justify-content: space-around; align-items: stretch;
  background: #fff; border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  max-width: 680px; margin: 0 auto;
}
.bottom-nav .nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11px; color: #8a919f; padding: 4px 0; position: relative;
}
.bottom-nav .nav-btn .ico { font-size: 21px; line-height: 1; }
.bottom-nav .nav-btn.active { color: var(--red); font-weight: 700; }
.bottom-nav .cnt {
  position: absolute; top: 0; right: calc(50% - 26px);
  background: var(--red); color: #fff; font-size: 10px; min-width: 16px; height: 16px;
  border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* 轮播图 */
.banner-box { position: relative; border-radius: 12px; overflow: hidden; margin-bottom: 12px; background: #f3e7e0; }
.banner-track { display: flex; transition: transform .45s ease; }
.banner-slide { min-width: 100%; position: relative; }
.banner-slide img { width: 100%; height: 150px; object-fit: cover; display: block; }
.banner-title {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 12px 8px;
  font-size: 13px; color: #fff; font-weight: 600;
  background: linear-gradient(transparent, rgba(0,0,0,.45));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.banner-dots { position: absolute; right: 10px; bottom: 8px; display: flex; gap: 5px; z-index: 2; }
.banner-dots .dot { width: 6px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.55); }
.banner-dots .dot.active { width: 14px; background: #fff; }

/* 购物车 */
.cart-list { display: flex; flex-direction: column; gap: 10px; }
.cart-list .ci {
  display: flex; align-items: center; gap: 10px; background: #fff;
  border-radius: 12px; padding: 10px; border: 1px solid transparent;
}
.cart-list .ci.sel { border-color: var(--red); }
.ci-check { width: 18px; height: 18px; accent-color: var(--red); flex: none; }
.cart-list .ci img, .cart-list .ci .ph { width: 54px; height: 54px; border-radius: 8px; object-fit: cover; flex: none; }
.cart-list .ci .ph { display: flex; align-items: center; justify-content: center; background: #f3e7e0; color: #b98d68; font-weight: 700; }
.cart-list .ci .t { flex: 1; min-width: 0; }
.cart-list .ci .n { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-list .ci .m { font-size: 12px; color: var(--muted); margin-top: 4px; }
.cart-bar {
  position: fixed; left: 0; right: 0; bottom: 58px; z-index: 70;
  display: flex; align-items: center; gap: 12px; background: #fff;
  border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  max-width: 680px; margin: 0 auto;
}
.cart-bar .selall { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.cart-bar .selall input { width: 16px; height: 16px; accent-color: var(--red); }
.cart-bar .cart-total { flex: 1; font-size: 13px; }
.cart-bar .price { color: var(--red); font-weight: 700; font-size: 16px; }

/* 我的 */
.panel-form { background: #fff; border-radius: 12px; padding: 16px; }
.me-switch { margin-top: 12px; text-align: center; font-size: 13px; color: var(--muted); }
.me-switch a { color: var(--red); font-weight: 600; }
.me-card {
  display: flex; align-items: center; gap: 12px; background: #fff;
  border-radius: 12px; padding: 16px; margin-bottom: 12px;
}
.me-avatar {
  width: 46px; height: 46px; border-radius: 50%; background: var(--red); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; flex: none;
}
.me-info { flex: 1; }
.me-name { font-size: 16px; font-weight: 700; }
.me-phone { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* 订单列表 */
.order-list { display: flex; flex-direction: column; gap: 10px; }
.order-list .order { background: #fff; border-radius: 12px; padding: 12px 14px; }
.order .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; }
.order .row:first-child { margin-top: 0; }
.order .no { font-weight: 700; font-size: 13px; }
.order .t { color: var(--muted); font-size: 12px; }
.order .items { font-size: 13px; color: #333; flex: 1; }
.pickup-line { margin-top: 8px; font-size: 13px; color: #333; }
.pickup-no-sm { color: var(--red); font-weight: 800; font-size: 16px; letter-spacing: 1px; }

/* 支付确认 */
.pay-tip { text-align: center; color: var(--muted); font-size: 13px; margin: 4px 0 10px; }

/* 取件编号结果 */
.pickup-box { background: #fff5f5; border: 1px dashed var(--red); border-radius: 12px; text-align: center; padding: 20px 12px; margin: 10px 0; }
.pickup-label { font-size: 13px; color: #555; }
.pickup-no { font-size: 34px; font-weight: 800; color: var(--red); letter-spacing: 3px; margin: 8px 0 4px; }
.pickup-hint { font-size: 12px; color: var(--muted); }
.order-no-line { text-align: center; font-size: 13px; color: #555; margin-bottom: 12px; }

/* 印花状态 */
.pt-st-pending { color: #e6a23c; font-weight: 600; }
.pt-st-accepted { color: #409eff; font-weight: 600; }
.pt-st-printing { color: #9254de; font-weight: 600; }
.pt-st-done { color: #2fae60; font-weight: 600; }

/* 拣货单（管理员打印） */
.pick-sheet { background: #fff; border: 1px solid #333; border-radius: 8px; padding: 16px; }
.pick-sheet h3 { text-align: center; margin-bottom: 4px; }
.pick-sheet .ps-meta { display: flex; justify-content: space-between; font-size: 12px; color: #333; margin: 6px 0 10px; }
.pick-sheet table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pick-sheet th, .pick-sheet td { border: 1px solid #666; padding: 6px 8px; text-align: center; }
.pick-sheet .ps-foot { margin-top: 12px; font-size: 12px; color: #555; }
@media print {
  body * { visibility: hidden; }
  .pick-sheet, .pick-sheet * { visibility: visible; }
  .pick-sheet { position: absolute; left: 0; top: 0; width: 100%; border: none; }
}

/* 支付通道选择与扫码 */
.pay-channel-row { display: flex; gap: 8px; margin: 10px 0 4px; }
.ch-btn { flex: 1; position: relative; padding: 9px 6px; border: 1px solid #ddd; border-radius: 8px; text-align: center; font-size: 14px; cursor: pointer; background: #fff; }
.ch-btn.on { border-color: #07c160; color: #07c160; background: #f0fbf4; font-weight: 600; }
.ch-btn.disabled { opacity: .55; cursor: not-allowed; }
.ch-btn input { display: none; }
.ch-tag { display: inline-block; margin-left: 4px; padding: 0 6px; font-size: 11px; line-height: 16px; color: #999; border: 1px solid #ddd; border-radius: 8px; }
.qr-box { width: 200px; height: 200px; margin: 8px auto; border: 1px solid #eee; border-radius: 8px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: #fff; }
.qr-box img { width: 100%; height: 100%; object-fit: contain; }
.pt-preview { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid #e6e8ee; display: block; }
.pt-fee { color: #c8102e; font-weight: 700; }
.pt-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; border: 1px solid #e6e8ee; display: block; }
