/* ===== 基础 ===== */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: #f5f5f5;
  color: #333;
  font-size: 14px;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  padding-top: 50px;
  padding-bottom: 60px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { border: none; background: none; cursor: pointer; font-family: inherit; font-size: inherit; color: inherit; }
input, textarea { font-family: inherit; font-size: inherit; outline: none; }
img { max-width: 100%; display: block; }

:root {
  --primary: #8B0000;
  --primary-light: #c0392b;
  --gold: #d4af37;
  --bg: #f5f5f5;
  --text: #333;
  --text-light: #999;
  --border: #eee;
}

/* ===== 顶部栏 ===== */
.app-header {
  position: fixed;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: 50px;
  background: linear-gradient(135deg, #8B0000, #c0392b);
  color: #fff;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 16px;
  position: relative;
}
.header-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: bold;
  letter-spacing: 1px;
}
.back-btn {
  position: absolute;
  left: 8px;
  color: #fff;
  font-size: 32px;
  line-height: 1;
  padding: 0 8px;
}

/* ===== 底部 Tab ===== */
.tabbar {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: 60px;
  background: #fff;
  border-top: 1px solid #eee;
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #999;
  position: relative;
  gap: 2px;
}
.tab-ico { font-size: 22px; }
.tab.active { color: var(--primary); }
.tab-badge {
  position: absolute;
  top: 6px;
  right: 28%;
  background: #ff3b30;
  color: #fff;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  font-weight: bold;
}

/* ===== 页面容器 ===== */
#page-root { min-height: calc(100vh - 110px); }
.page { padding: 12px; }

.card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.price { color: var(--primary); font-weight: bold; }
.price::before { content: '¥'; font-size: 0.8em; margin-right: 1px; }
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  background: #fef0f0;
  color: var(--primary);
  margin-right: 4px;
}
.empty {
  padding: 60px 0;
  text-align: center;
  color: #999;
}
.btn-primary {
  background: linear-gradient(135deg, #8B0000, #c0392b);
  color: #fff;
  border-radius: 24px;
  padding: 12px 0;
  font-size: 15px;
  width: 100%;
  font-weight: bold;
}
.btn-primary:disabled { opacity: 0.6; }

/* ===== 首页 ===== */
.search-bar {
  background: rgba(255,255,255,0.95);
  border-radius: 20px;
  padding: 8px 16px;
  margin: 8px 12px 4px;
  color: #999;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.banner {
  margin: 8px 12px;
  height: 140px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}
.banner-slide {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 24px;
  color: #fff;
}
.banner-slide h3 { margin: 0; font-size: 20px; }
.banner-slide p { margin: 8px 0 0; font-size: 12px; opacity: 0.9; }

.cat-grid {
  margin: 8px 12px;
  padding: 16px 0;
  display: flex;
  flex-wrap: wrap;
}
.cat-item {
  width: 25%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  font-size: 12px;
}
.cat-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: 6px;
}

.notice {
  margin: 0 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #666;
}
.notice-tag {
  background: var(--primary);
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  flex-shrink: 0;
}
.notice-text {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.section-title {
  margin: 16px 12px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: bold;
}
.title-bar {
  width: 4px;
  height: 16px;
  background: linear-gradient(180deg, var(--primary), var(--gold));
  border-radius: 2px;
  display: inline-block;
}

.goods-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 12px;
}
.goods-card {
  overflow: hidden;
  cursor: pointer;
}
.goods-thumb {
  width: 100%;
  aspect-ratio: 1/1;
  background: linear-gradient(135deg, #fef0f0, #fff);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-weight: bold;
  font-size: 36px;
}
.goods-thumb img { width: 100%; height: 100%; object-fit: cover; }
.goods-body { padding: 8px 10px 10px; }
.goods-name {
  font-size: 13px;
  line-height: 1.3;
  height: 34px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.goods-spec { font-size: 11px; color: #999; margin-top: 4px; }
.goods-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}
.goods-foot .price { font-size: 15px; }
.add-btn {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8B0000, #c0392b);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
}

/* ===== 加购步进器 ===== */
.qty-stepper {
  display: inline-flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center;
  user-select: none;
  white-space: nowrap;
  gap: 4px;
}
.qty-stepper .qty-btn {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--primary);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  line-height: 1;
  flex-shrink: 0;
}
.qty-stepper .qty-btn:active { background: var(--primary); color: #fff; }
.qty-stepper .qty-num {
  min-width: 26px;
  text-align: center;
  font-size: 14px;
  font-weight: bold;
  color: var(--primary);
  padding: 0 2px;
  flex-shrink: 0;
}
/* round 风格（首页热销卡） */
.qty-stepper.round .qty-btn { width: 22px; height: 22px; font-size: 14px; }
.qty-stepper.round .qty-num { min-width: 24px; font-size: 13px; }

/* mini 风格（分类列表用，胶囊感更强） */
.qty-stepper.mini {
  background: #fff;
  border-radius: 14px;
  padding: 0 2px;
}
.qty-stepper.mini .qty-btn { width: 22px; height: 22px; font-size: 14px; }
.qty-stepper.mini .qty-num { min-width: 26px; font-size: 13px; }

/* ===== 分类页 ===== */
.search-wrap {
  padding: 8px 12px;
  background: #fff;
  border-bottom: 1px solid #eee;
}
.search-box {
  position: relative;
  background: #f5f5f5;
  border-radius: 18px;
  padding: 0 40px 0 34px;
  height: 36px;
  display: flex;
  align-items: center;
}
.search-box .search-ico {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: #999;
  pointer-events: none;
}
.search-box input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 14px;
  height: 36px;
  line-height: 36px;
  color: #333;
}
.search-box input:focus { outline: none; }
.search-box input::placeholder { color: #bbb; }
.search-box .search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ccc;
  color: #fff;
  font-size: 15px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  font-weight: bold;
  user-select: none;
}
.search-meta {
  padding: 6px 4px 0;
  font-size: 12px;
  color: #666;
}
.search-meta b { color: var(--primary); font-weight: bold; }
.search-meta-link {
  color: var(--primary);
  border-bottom: 1px dashed var(--primary);
  cursor: pointer;
  margin-left: 4px;
}
.cat-g-name .hl {
  color: var(--primary);
  background: #fef0f0;
  padding: 0 2px;
  border-radius: 2px;
  font-weight: bold;
}
.cat-side-item.dim { opacity: 0.3; }
.link {
  color: var(--primary);
  border-bottom: 1px dashed var(--primary);
  cursor: pointer;
}
.cat-layout {
  display: flex;
  height: calc(100vh - 110px - 46px);
}
.cat-side {
  width: 88px;
  background: #fff;
  overflow-y: auto;
}
.cat-side-item {
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #666;
  position: relative;
  cursor: pointer;
}
.cat-side-item.active {
  background: #f5f5f5;
  color: var(--primary);
  font-weight: bold;
}
.cat-side-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 10px;
  width: 3px; height: 30px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}
.cat-main {
  flex: 1;
  padding: 8px;
  overflow-y: auto;
}
.cat-g-item {
  display: flex;
  padding: 10px;
  gap: 10px;
  margin-bottom: 8px;
}
.cat-g-thumb {
  width: 80px; height: 80px;
  border-radius: 8px;
  background: linear-gradient(135deg, #fef0f0, #fff);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 24px;
  font-weight: bold;
  flex-shrink: 0;
  overflow: hidden;
}
.cat-g-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cat-g-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; }
.cat-g-name {
  font-size: 14px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cat-g-spec { font-size: 11px; color: #999; }
.cat-g-foot { display: flex; justify-content: space-between; align-items: center; }
.cat-g-foot .price { font-size: 15px; }
.mini-add {
  background: linear-gradient(135deg, #8B0000, #c0392b);
  color: #fff;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 14px;
}

/* 分类列表底部"到底了"提示 */
.list-end {
  text-align: center;
  padding: 24px 16px 32px;
  cursor: pointer;
  user-select: none;
}
.list-end-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.list-end-line span:first-child,
.list-end-line span:last-child {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, #d4af37, transparent);
}
.list-end-em {
  font-size: 22px;
  filter: drop-shadow(0 0 6px rgba(212,175,55,0.4));
}
.list-end-text {
  font-size: 14px;
  color: #666;
  margin-bottom: 6px;
}
.list-end-cta {
  color: var(--primary);
  font-weight: bold;
  border-bottom: 1px dashed var(--primary);
  margin-left: 4px;
}
.list-end-tip {
  font-size: 11px;
  color: #bbb;
}

/* ===== 详情页 ===== */
.detail-hero {
  width: 100%;
  height: 320px;
  background: linear-gradient(135deg, #fef0f0, #ffd9d9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
  position: relative;
}
.detail-hero img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.detail-hero::after {
  content: "🔍";
  position: absolute;
  right: 12px; bottom: 12px;
  width: 32px; height: 32px;
  background: rgba(0,0,0,.45);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  pointer-events: none;
}
.hero-emoji { font-size: 90px; }
.hero-name {
  font-size: 14px;
  color: var(--primary);
  font-weight: bold;
  margin-top: 8px;
}

/* 全屏看图 */
.image-viewer {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.92);
  z-index: 99999;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: ivFade .15s ease-out;
}
@keyframes ivFade { from { opacity: 0; } to { opacity: 1; } }
.image-viewer img {
  max-width: 100%;
  max-height: 100%;
  display: block;
  /* 让长按"识别二维码 / 保存图片"菜单可用 */
  -webkit-touch-callout: default;
  user-select: none;
  cursor: zoom-out;
  animation: ivZoom .2s cubic-bezier(.18,.89,.32,1.28);
}
@keyframes ivZoom { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.image-viewer-close {
  position: absolute; top: 20px; right: 20px;
  width: 40px; height: 40px;
  background: rgba(255,255,255,.15);
  color: #fff;
  border: none; border-radius: 50%;
  font-size: 24px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.image-viewer-close:hover { background: rgba(255,255,255,.3); }
.image-viewer-tip {
  position: absolute;
  bottom: 30px; left: 0; right: 0;
  text-align: center;
  color: rgba(255,255,255,.6);
  font-size: 12px;
}

.detail-price-card {
  margin: -16px 12px 0;
  padding: 16px;
  position: relative;
  z-index: 1;
}
.big-price {
  font-size: 28px;
  color: var(--primary);
  font-weight: bold;
}
.origin-price {
  color: #999;
  text-decoration: line-through;
  font-size: 13px;
  margin-left: 8px;
}
.detail-name {
  font-size: 16px;
  font-weight: bold;
  margin: 8px 0 6px;
  line-height: 1.4;
}

.detail-card {
  margin: 10px 12px;
  padding: 12px 16px;
}
.info-row {
  display: flex;
  padding: 7px 0;
  font-size: 13px;
  border-bottom: 1px solid #f0f0f0;
}
.info-row:last-child { border: none; }
.info-row .label { width: 70px; color: #999; }

.count-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.counter {
  display: flex;
  align-items: center;
  gap: 12px;
}
.step {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid #ddd;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  background: #fff;
}
.num { min-width: 30px; text-align: center; }

.desc-content {
  font-size: 13px;
  color: #666;
  line-height: 1.7;
  margin-top: 8px;
  white-space: pre-wrap;
}

.detail-footer {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: 56px;
  background: #fff;
  border-top: 1px solid #eee;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  z-index: 99;
}
.bb-icon {
  width: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 18px;
  position: relative;
}
.bb-icon small { font-size: 10px; color: #666; }
.bb-icon .tab-badge { right: 8px; top: 0; }
.bb-add, .bb-buy {
  flex: 1;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  border-radius: 20px;
}
.bb-add { background: linear-gradient(135deg, #d4af37, #b8941f); }
.bb-buy { background: linear-gradient(135deg, #8B0000, #c0392b); }

/* ===== 购物车 ===== */
.cart-empty {
  padding: 100px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cart-empty-ico { font-size: 80px; opacity: 0.4; margin-bottom: 16px; }
.cart-empty p { color: #999; margin: 0 0 20px; }
.cart-empty .go-btn {
  background: linear-gradient(135deg, #8B0000, #c0392b);
  color: #fff;
  padding: 8px 40px;
  border-radius: 24px;
}

.cart-list { padding: 8px 12px 60px; }
.cart-item {
  display: flex;
  align-items: center;
  padding: 10px;
  margin-bottom: 8px;
  gap: 10px;
  position: relative;
}
.check {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1.5px solid #ccc;
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
}
.check.checked {
  background: var(--primary);
  border-color: var(--primary);
}
.check.checked::after {
  content: '';
  position: absolute;
  left: 6px; top: 2px;
  width: 5px; height: 10px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg);
}
.cart-thumb {
  width: 70px; height: 70px;
  border-radius: 6px;
  background: linear-gradient(135deg, #fef0f0, #fff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
  overflow: hidden;
}
.cart-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cart-info .n {
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cart-info .s { font-size: 11px; color: #999; }
.cart-info .b { display: flex; justify-content: space-between; align-items: center; margin-top: 2px; }
.cart-info .b .price { font-size: 14px; }
.cart-remove {
  position: absolute;
  top: 4px; right: 8px;
  color: #ccc;
  font-size: 18px;
  padding: 2px 6px;
}

.cart-bar {
  position: fixed;
  bottom: 60px; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: 52px;
  background: #fff;
  border-top: 1px solid #eee;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 10px;
  z-index: 99;
}
.cart-bar .check-all { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.cart-bar .total { flex: 1; font-size: 13px; color: #666; }
.cart-bar .total-price { font-size: 18px; color: var(--primary); font-weight: bold; }
.checkout {
  background: linear-gradient(135deg, #8B0000, #c0392b);
  color: #fff;
  padding: 8px 24px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: bold;
}

/* ===== 用户中心 ===== */
.user-header {
  background: linear-gradient(135deg, #8B0000, #c0392b);
  padding: 24px 16px 48px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: -12px -12px 0;
}
.user-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: #fff;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: bold;
  border: 2px solid rgba(255,255,255,0.5);
}
.user-name { font-size: 18px; font-weight: bold; }
.user-role { font-size: 11px; opacity: 0.9; margin-top: 3px; }

.user-quick {
  margin: -24px 12px 0 ;
  background: #fff;
  border-radius: 10px;
  display: flex;
  padding: 14px 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}
.q-col {
  flex: 1;
  text-align: center;
  border-right: 1px solid #eee;
  font-size: 11px;
  color: #666;
}
.q-col:last-child { border: none; }
.q-col .q-n { font-size: 18px; color: var(--primary); font-weight: bold; }

.user-menu { margin: 12px; padding: 0 14px; }
.menu-row {
  display: flex;
  align-items: center;
  height: 48px;
  font-size: 14px;
  border-bottom: 1px solid #f0f0f0;
  gap: 10px;
  cursor: pointer;
}
.menu-row:last-child { border: none; }
.menu-row .mt { flex: 1; }
.menu-row .mr { color: #ccc; font-size: 18px; }
.menu-row .mtip {
  color: #999;
  font-size: 11px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== 登录弹窗 ===== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal {
  background: #fff;
  border-radius: 14px;
  padding: 24px 22px 20px;
  width: 100%;
  max-width: 340px;
}
.modal h3 {
  margin: 0 0 4px;
  text-align: center;
  color: var(--primary);
  font-size: 20px;
}
.modal .subtitle {
  text-align: center;
  color: #999;
  font-size: 12px;
  letter-spacing: 3px;
  margin-bottom: 22px;
}
.modal-input {
  width: 100%;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.modal-input:focus { border-color: var(--primary); }
.modal-actions { display: flex; gap: 10px; margin-top: 8px; }
.modal-actions button {
  flex: 1;
  padding: 10px 0;
  border-radius: 24px;
  font-size: 14px;
}
.modal-cancel { background: #f5f5f5; color: #666; }
.modal-ok { background: linear-gradient(135deg, #8B0000, #c0392b); color: #fff; font-weight: bold; }

/* ===== 管理员后台 ===== */
.admin-stats {
  display: flex;
  background: linear-gradient(135deg, #8B0000, #c0392b);
  color: #fff;
  padding: 20px 10px;
  margin: -12px -12px 0;
}
.stat-col { flex: 1; text-align: center; border-right: 1px solid rgba(255,255,255,0.2); }
.stat-col:last-child { border: none; }
.stat-col .n { font-size: 22px; font-weight: bold; }
.stat-col .l { font-size: 11px; opacity: 0.9; margin-top: 3px; }

.import-card {
  margin: 14px 0;
  padding: 14px 16px;
}
.import-card .title {
  font-size: 15px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.import-card .title .link { color: var(--primary); font-size: 12px; font-weight: normal; cursor: pointer; }
.import-card .hint { color: #999; font-size: 12px; line-height: 1.7; margin-bottom: 12px; }
.import-card .hint strong { color: #333; }
.file-input { display: none; }

.recent-card { margin: 14px 0; padding: 14px 16px 4px; }
.recent-card .title { font-size: 15px; font-weight: bold; margin-bottom: 6px; }
.r-item {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
  gap: 8px;
}
.r-item:last-child { border: none; }
.r-info { flex: 1; min-width: 0; }
.r-name {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.r-sub { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 11px; }
.r-stock { color: #999; }
.r-btns { display: flex; gap: 6px; }
.r-btn {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid #ddd;
  color: #666;
  background: #fff;
}
.r-btn.on { color: #07c160; border-color: #07c160; }
.r-btn.off { color: var(--primary); border-color: var(--primary); }
.r-btn.del { color: #999; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  max-width: 80%;
  text-align: center;
}
.toast.show { opacity: 1; }

/* ===== 悬浮联系按钮 ===== */
.fab {
  position: fixed;
  right: calc(50% - 240px + 16px);
  bottom: 160px;       /* 避开底部 tab(56px) + 购物车结算栏(60px) + 余量 */
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8B0000, #c0392b);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(139,0,0,0.4);
  z-index: 500;
  border: none;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  gap: 0;
}
.fab:active { transform: scale(0.92); }
.fab:hover { box-shadow: 0 8px 26px rgba(139,0,0,0.5); }
.fab-ico { font-size: 22px; line-height: 1; }
.fab-label { font-size: 10px; margin-top: 1px; }

/* 在购物车页 / 订单确认页等带底部固定操作条的页面，FAB 再往上挪一些 */
body[data-page="cart"] .fab,
body[data-page="address"] .fab {
  bottom: 200px;
}

/* 窄屏时 fab 贴边 */
@media (max-width: 480px) {
  .fab { right: 16px; }
}

/* ===== 全页 loading ===== */
.page-loading {
  padding: 80px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: #999;
  font-size: 13px;
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #eee;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 订单列表 ===== */
.order-list { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.order-item { padding: 12px 14px; }
.order-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #666;
  padding-bottom: 8px;
  border-bottom: 1px dashed #eee;
  margin-bottom: 8px;
}
.order-status { font-weight: bold; }
.order-goods { font-size: 13px; margin-bottom: 4px; }
.order-addr { font-size: 11px; color: #999; margin-bottom: 6px; }
.order-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px dashed #eee;
}
.order-total { font-size: 13px; color: #666; }
.order-total .price { font-size: 16px; }
.order-id { font-size: 11px; color: #ccc; }

/* ===== 收货地址 ===== */
.addr-tip {
  background: linear-gradient(135deg, #fff8e7, #fef0f0);
  color: #8B0000;
  font-size: 12px;
  text-align: center;
  padding: 10px 16px;
  margin: -12px -12px 12px;
  border-bottom: 1px solid #f0e0c0;
}
.addr-list { display: flex; flex-direction: column; gap: 10px; }
.addr-item { padding: 14px 16px; }
.addr-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.addr-name { font-size: 15px; font-weight: bold; }
.addr-phone { font-size: 13px; color: #666; }
.addr-default {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
}
.addr-detail {
  font-size: 13px;
  color: #333;
  line-height: 1.5;
  margin-bottom: 4px;
}
.addr-note {
  font-size: 11px;
  color: #999;
  margin-bottom: 8px;
}
.addr-actions {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  padding-top: 10px;
  border-top: 1px dashed #eee;
  margin-top: 8px;
}
.addr-btn {
  font-size: 12px;
  color: #666;
  cursor: pointer;
}
.addr-btn.danger { color: var(--primary); }

.addr-bottom {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  padding: 10px 16px;
  background: #fff;
  border-top: 1px solid #eee;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

/* 地址编辑弹窗 */
.addr-modal {
  max-width: 360px;
}
.addr-sub {
  font-size: 12px;
  color: #999;
  margin-bottom: 14px;
  text-align: center;
}
.form-row { margin-bottom: 12px; }
.form-label {
  font-size: 12px;
  color: #666;
  margin-bottom: 6px;
}
.form-label .req { color: var(--primary); margin-left: 2px; }
.addr-modal .modal-input {
  margin-bottom: 0;
}
.addr-textarea {
  min-height: 60px;
  resize: none;
  font-family: inherit;
  line-height: 1.5;
}
.addr-default-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #666;
  margin: 6px 0 4px;
  cursor: pointer;
}

/* ===== 店家联系卡（含微信名片二维码） ===== */
.shop-contact-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: scFade .2s ease-out;
}
@keyframes scFade { from { opacity: 0; } to { opacity: 1; } }
.shop-contact-card {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 60px rgba(0,0,0,.35);
  animation: scPop .25s cubic-bezier(.18,.89,.32,1.28);
}
@keyframes scPop { from { transform: translateY(20px) scale(.92); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
.sc-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 0;
}
.sc-title { font-size: 17px; font-weight: 600; color: #8B0000; }
.sc-close {
  background: transparent; border: none;
  font-size: 26px; line-height: 1;
  color: #999; cursor: pointer;
  padding: 0 4px;
}
.sc-close:hover { color: #d4380d; }
.sc-sub {
  text-align: center;
  font-size: 13px; color: #666;
  padding: 6px 18px 12px;
  line-height: 1.5;
}
.sc-img-box {
  display: flex; justify-content: center;
  padding: 0 18px;
  background: linear-gradient(180deg, #fff 0%, #fafafa 100%);
}
.sc-img-box img {
  max-width: 100%;
  max-height: 360px;
  border-radius: 8px;
  display: block;
  /* 让长按"识别二维码"菜单更顺手 */
  -webkit-touch-callout: default;
  user-select: none;
  pointer-events: auto;
}
.sc-tips {
  padding: 14px 22px 4px;
  font-size: 12px; color: #666;
  line-height: 2;
  border-top: 1px dashed #eee;
  margin-top: 14px;
}
.sc-tips div { display: flex; align-items: center; gap: 6px; }
.sc-ok {
  display: block; width: calc(100% - 36px);
  margin: 14px auto 18px;
  padding: 12px 0;
  background: linear-gradient(135deg, #8B0000, #c0392b);
  color: #fff; border: none; border-radius: 8px;
  font-size: 15px; font-weight: 600;
  cursor: pointer;
}
.sc-ok:active { transform: scale(.98); }

/* 详情页底部「问老板」按钮 */
.detail-footer .bb-icon[data-action="contact-shop"] {
  cursor: pointer;
}

/* 首页微信转发 */
.share-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #f0fff4 0%, #ffffff 70%);
  border: 1px solid rgba(7, 193, 96, .18);
}
.share-title {
  font-size: 15px;
  font-weight: 800;
  color: #123;
}
.share-sub {
  margin-top: 3px;
  font-size: 12px;
  color: #667085;
  line-height: 1.35;
}
.share-wechat-btn {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  background: #07c160;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 6px 14px rgba(7, 193, 96, .25);
}
.share-wechat-btn:active { transform: scale(.98); }
