/* =========================================================
 * 发卡网 · 前台样式（手机电商风格）
 * 主色：indigo，配浅背景 + 白卡片 + 大圆角
 * 移动端 320-767 / 平板 768-991 / 桌面 992+
 * ========================================================= */

:root {
  --brand:        #4f46e5;
  --brand-dark:   #4338ca;
  --brand-light:  #eef2ff;
  --brand-glow:   rgba(79, 70, 229, .22);
  --price:        #dc2626;
  --price-soft:   #fef2f2;
  --text:         #111827;
  --text-muted:   #6b7280;
  --line:         #eef0f4;
  --line-soft:    #f3f4f6;
  --bg:           #f6f7fb;
  --card:         #ffffff;
  --radius-xl:    18px;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow-sm:    0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .05);
  --shadow-md:    0 4px 14px rgba(15, 23, 42, .08);
  --shadow-lg:    0 12px 32px rgba(15, 23, 42, .12);
  --tab-h:        56px;         /* 底部 tabbar 高度 */
}

* { -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100%;
}
body { display: flex; flex-direction: column; min-height: 100vh; }
.site-main { flex: 1 0 auto; padding: 12px 14px 16px; }
@media (min-width: 768px) {
  .site-main { padding: 14px 20px 20px; }
}
/* site-main 里嵌套的 Bootstrap 容器不需要再加左右 padding */
.site-main > .container-fluid,
.site-main > .container { padding-left: 0; padding-right: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
code { color: var(--brand-dark); background: var(--brand-light); padding: 2px 6px; border-radius: 4px; font-size: .92em; }
img { max-width: 100%; height: auto; display: block; }

/* ================== 公告 / FAQ Modal ================== */
.announce-list { list-style: none; padding: 0; margin: 0; }
.announce-list-item {
  padding: 12px 14px; margin-bottom: 8px;
  background: var(--brand-light); border-radius: var(--radius);
  border-left: 3px solid var(--brand);
}
.announce-list-title { font-weight: 700; margin-bottom: 4px; color: var(--text); }
.announce-list-body { color: var(--text); white-space: pre-wrap; line-height: 1.55; font-size: 14px; }
.announce-list-time { color: var(--text-muted); font-size: 11px; margin-top: 6px; }

/* Bootstrap accordion 换色 */
.accordion-button:not(.collapsed) {
  background: var(--brand-light); color: var(--brand);
  font-weight: 600; box-shadow: none;
}
.accordion-button:focus { box-shadow: none; }

.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark); --bs-btn-active-bg: var(--brand-dark); }

/* ================== 聊天浮窗 & 悬浮客服按钮 ================== */
.floating-cs {
  position: fixed; right: 20px; bottom: 24px; z-index: 40;
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand) 0%, #7c3aed 100%);
  color: #fff; border: none;
  display: none; align-items: center; justify-content: center; flex-direction: column;
  box-shadow: 0 8px 24px rgba(79, 70, 229, .35);
  font-size: 22px; cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.floating-cs span { display: none; font-size: 11px; }
.floating-cs:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(79, 70, 229, .48); }
@media (min-width: 768px) {
  .floating-cs { display: flex; }
}

.chat-widget {
  position: fixed; z-index: 60;
  background: var(--card);
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(15,23,42,.25);
  animation: chat-slide-up .22s ease;
}
@media (min-width: 768px) {
  .chat-widget {
    right: 20px; bottom: 20px;
    width: 360px; height: min(560px, calc(100vh - 40px));
    border-radius: 18px; overflow: hidden;
  }
}
@media (max-width: 767.98px) {
  .chat-widget {
    inset: 0; width: 100%; height: 100dvh;
    border-radius: 0;
  }
}
@keyframes chat-slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat-widget-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--brand) 0%, #7c3aed 100%);
  color: #fff;
}
.chat-widget-title {
  font-weight: 700; font-size: 15px;
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
}
.chat-widget-title .bi { font-size: 18px; }
.chat-widget-status {
  font-weight: 400; font-size: 11px; opacity: .75;
  padding-left: 6px; border-left: 1px solid rgba(255,255,255,.3);
  margin-left: 6px;
}
.chat-widget-close {
  background: rgba(255,255,255,.15); border: none; color: #fff;
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .12s ease;
}
.chat-widget-close:hover { background: rgba(255,255,255,.28); }

/* Identify（欢迎+填联系方式） */
.chat-widget-identify { flex: 1; overflow-y: auto; padding: 22px 20px; }
.chat-widget-welcome { text-align: center; padding-bottom: 20px; }
.chat-widget-welcome-icon {
  width: 68px; height: 68px; border-radius: 50%;
  background: linear-gradient(135deg, #eef2ff, #f5f3ff);
  color: var(--brand); font-size: 32px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  box-shadow: 0 4px 16px rgba(79, 70, 229, .16);
}
.chat-widget-welcome-title { font-size: 18px; font-weight: 700; }
.chat-widget-welcome-sub { font-size: 13px; color: var(--text-muted); margin-top: 6px; line-height: 1.5; }
.chat-widget-form .form-select,
.chat-widget-form .form-control { font-size: 14px; }

/* 消息列表 */
.chat-widget-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  background: linear-gradient(180deg, #fafbff 0%, #f6f7fb 100%);
  display: flex; flex-direction: column; gap: 10px;
}
.chat-msg { display: flex; flex-direction: column; gap: 4px; max-width: 82%; }
.chat-msg-user  { align-self: flex-end; align-items: flex-end; }
.chat-msg-admin { align-self: flex-start; align-items: flex-start; }
.chat-msg-bubble {
  padding: 8px 12px; border-radius: 14px;
  font-size: 14px; line-height: 1.4; word-break: break-word;
  white-space: pre-wrap;
}
.chat-msg-user .chat-msg-bubble {
  background: linear-gradient(135deg, var(--brand), #7c3aed); color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg-admin .chat-msg-bubble {
  background: var(--card); color: var(--text);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(15,23,42,.06);
}
.chat-msg-time { font-size: 10px; color: var(--text-muted); opacity: .7; }
.chat-msg-order {
  font-size: 11px; margin-top: 4px; padding-top: 4px;
  border-top: 1px solid rgba(255,255,255,.25);
  opacity: .85;
}
.chat-msg-admin .chat-msg-order {
  border-top-color: var(--line);
  color: var(--text-muted);
}

/* 输入区 */
.chat-widget-input {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: var(--card);
}
.chat-widget-input input {
  flex: 1; min-width: 0; height: 40px;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0 14px; font-size: 14px; outline: none;
  background: var(--line-soft);
  transition: background .1s ease, border-color .1s ease;
}
.chat-widget-input input:focus { background: var(--card); border-color: var(--brand); }
.chat-widget-input button {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #7c3aed);
  color: #fff; border: none; font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .1s ease;
  flex-shrink: 0;
}
.chat-widget-input button:hover { transform: scale(1.06); }
.chat-widget-input button:active { transform: scale(.95); }

body.chat-open { overflow: hidden; }
@media (min-width: 768px) {
  body.chat-open { overflow: auto; }
}
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand); }

.inner { max-width: 960px; margin: 0 auto; padding: 0 12px; }

/* ================== 通知条 ================== */
.site-notice {
  background: linear-gradient(135deg, var(--brand) 0%, #6366f1 100%);
  color: #fff; font-size: 12px; padding: 6px 0; text-align: center;
}
.site-notice .bi { margin-right: 4px; }

/* ================== 顶栏 ================== */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  position: sticky; top: 0; z-index: 20;
  box-shadow: 0 1px 12px rgba(15,23,42,.04);
}
.site-header::before {
  content: '';
  position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
}
.site-header .inner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.site-brand { display: flex; align-items: center; gap: 10px; color: var(--text); min-width: 0; flex: 1; }
.site-brand:hover { color: var(--text); }
.site-logo {
  width: 40px; height: 40px; border-radius: 10px; object-fit: cover; flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.site-logo-placeholder {
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand) 0%, #7c3aed 100%);
  color: #fff; font-weight: 700; font-size: 18px;
}
.site-brand-text { min-width: 0; }
.site-name { font-size: 16px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-desc { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }

.site-nav { display: flex; gap: 6px; flex-shrink: 0; }
.nav-icon {
  display: inline-flex; flex-direction: column; align-items: center; gap: 2px;
  width: 44px; padding: 4px 0; border-radius: 8px;
  color: var(--text-muted); font-size: 10px;
}
.nav-icon .bi { font-size: 18px; }
.nav-icon:hover { color: var(--brand); background: var(--brand-light); }
.nav-icon-label { line-height: 1; }

/* ================== 公告条 ================== */
.announce-strip {
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 6px 0; overflow: hidden;
}
.announce-strip .inner { display: flex; align-items: center; gap: 8px; }
.announce-strip .bi { color: var(--brand); flex-shrink: 0; }
.announce-track { flex: 1; overflow: hidden; }
.announce-track-inner {
  display: inline-flex; white-space: nowrap; gap: 32px;
  animation: announce-scroll 40s linear infinite;
}
.announce-item { font-size: 12px; color: var(--text-muted); }
.announce-item b { color: var(--text); }
@keyframes announce-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ================== 轮播图 ================== */
.banner-slider {
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(79, 70, 229, .12);
  background: linear-gradient(135deg, #eef2ff, #f5f3ff);
  position: relative;
}
.banner-slider::after {
  content: '';
  position: absolute; inset: 0; pointer-events: none;
  border-radius: var(--radius-xl);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.6);
}
.banner-slider .carousel-item {
  aspect-ratio: 5 / 2;
}
.banner-slider .carousel-item img {
  width: 100%; height: 100%; object-fit: cover;
}
.banner-slider .carousel-indicators {
  margin-bottom: 8px;
}
.banner-slider .carousel-indicators [data-bs-target] {
  width: 22px; height: 3px; border-radius: 3px;
  background-color: rgba(255,255,255,.5); border: none;
  transition: width .2s ease;
}
.banner-slider .carousel-indicators .active {
  width: 32px; background-color: #fff;
}

/* ================== 快捷入口 4 宫格 ================== */
.quick-actions {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  padding: 4px 0;
}
.quick-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 6px; background: var(--card);
  border-radius: var(--radius);
  color: var(--text); position: relative;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .12s ease;
}
.quick-item:hover  { transform: translateY(-2px); box-shadow: var(--shadow-md); color: var(--text); }
.quick-item:active { transform: scale(.96); }
.quick-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff; position: relative;
}
.quick-a .quick-icon { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.quick-b .quick-icon { background: linear-gradient(135deg, #f97316, #ef4444); }
.quick-c .quick-icon { background: linear-gradient(135deg, #10b981, #14b8a6); }
.quick-d .quick-icon { background: linear-gradient(135deg, #06b6d4, #3b82f6); }
.quick-label { font-size: 12px; color: var(--text-muted); line-height: 1; }
.quick-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: #ef4444; color: #fff; border-radius: 999px;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--card);
  line-height: 1;
}

/* ================== 优惠横条 ================== */
.promo-band {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(90deg, #fff7ed 0%, #ffe4e6 50%, #fef3c7 100%);
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  margin-bottom: 12px;
  position: relative; overflow: hidden;
}
.promo-band::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 10% 50%, rgba(251, 146, 60, .18) 0%, transparent 40%),
    radial-gradient(circle at 90% 50%, rgba(239, 68, 68, .12) 0%, transparent 40%);
  pointer-events: none;
}
.promo-band-icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(239, 68, 68, .28);
  z-index: 1;
}
.promo-band-icon .bi { animation: promo-shake 2.2s ease-in-out infinite; }
@keyframes promo-shake {
  0%, 100% { transform: rotate(-8deg); }
  50%      { transform: rotate(8deg); }
}
.promo-band-text { flex: 1; min-width: 0; z-index: 1; }
.promo-band-title {
  font-size: 14px; font-weight: 700; color: #c2410c;
  line-height: 1.2;
}
.promo-band-sub {
  font-size: 12px; color: #9a3412; margin-top: 2px;
  line-height: 1.2;
}
.promo-band-sub b { color: #dc2626; }
.promo-band-cta {
  padding: 4px 12px;
  background: linear-gradient(135deg, #f97316, #dc2626);
  color: #fff; border-radius: 999px;
  font-size: 12px; font-weight: 700;
  box-shadow: 0 3px 10px rgba(239,68,68,.25);
  z-index: 1;
}

/* ================== 主分类 tabs（改为胶囊风） ================== */
.main-tabs {
  display: flex; gap: 6px; padding: 6px 0 12px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.main-tabs::-webkit-scrollbar { display: none; }
.main-tab {
  padding: 7px 18px; font-size: 14px; font-weight: 600;
  color: var(--text-muted); white-space: nowrap;
  background: var(--card); border-radius: 999px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  transition: all .15s ease;
}
.main-tab.active {
  color: #fff; border-color: transparent;
  background: linear-gradient(135deg, var(--brand) 0%, #7c3aed 100%);
  box-shadow: 0 4px 12px var(--brand-glow);
}
.main-tab:hover { color: var(--brand); border-color: var(--brand); }
.main-tab.active:hover { color: #fff; }

/* ================== 顶部加载进度条 ================== */
.top-loading-bar {
  position: fixed; left: 0; top: 0; height: 2px;
  width: 100%; background: transparent;
  z-index: 9999; pointer-events: none;
  overflow: hidden;
}
.top-loading-bar::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 40%;
  background: linear-gradient(90deg, transparent 0%, var(--brand) 30%, #a855f7 70%, transparent 100%);
  transform: translateX(-100%);
  transition: none;
}
.top-loading-bar.active::before {
  animation: top-loading 1s cubic-bezier(.5,.1,.5,1) infinite;
}
@keyframes top-loading {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

/* ================== AJAX 商品面板淡入淡出 ================== */
#shop-panel { transition: opacity .2s ease; }
#shop-panel.is-loading { opacity: .55; pointer-events: none; }

/* AJAX 内容加载后的进入动画（对 .products-grid 内部子项） */
@keyframes card-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.products-grid .product-card { animation: card-fade-in .28s ease both; }

/* ================== 次分类横滚 ================== */
.sub-cat-scroll {
  display: flex; gap: 4px;
  padding: 8px 0 12px; margin: 0 -12px; padding-left: 12px; padding-right: 12px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.sub-cat-scroll::-webkit-scrollbar { display: none; }
.sub-cat-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  min-width: 68px; padding: 6px 4px 4px;
  color: var(--text); flex-shrink: 0;
  scroll-snap-align: start;
}
.sub-cat-icon {
  width: 48px; height: 48px; border-radius: 14px;
  background: var(--card);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
  color: var(--brand); font-size: 22px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.sub-cat-icon img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 14px;
}
.sub-cat-name {
  font-size: 12px; color: var(--text-muted); line-height: 1;
  max-width: 60px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sub-cat-item.active .sub-cat-icon {
  background: linear-gradient(135deg, var(--brand) 0%, #7c3aed 100%);
  color: #fff;
  box-shadow: 0 4px 12px var(--brand-glow);
}
.sub-cat-item.active .sub-cat-name { color: var(--brand); font-weight: 600; }
.sub-cat-item:active .sub-cat-icon { transform: scale(.95); }
.sub-cat-item:hover .sub-cat-icon { box-shadow: var(--shadow-md); }

/* ================== 搜索栏 ================== */
.topbar-search-inner {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; background: var(--card);
  border-radius: 999px; box-shadow: var(--shadow-sm);
}
.topbar-search-inner .bi { color: var(--text-muted); font-size: 15px; flex-shrink: 0; }
.topbar-search-inner input {
  border: none; outline: none; flex: 1; background: transparent;
  font-size: 14px; color: var(--text);
}
.topbar-search-inner input::placeholder { color: var(--text-muted); }
.topbar-search-clear { color: var(--text-muted); }
.topbar-search-clear:hover { color: var(--brand); }

/* ================== 商品区域标题 ================== */
.products-header {
  display: flex; align-items: center; justify-content: space-between;
  margin: 4px 0 12px;
}
.products-title {
  font-size: 17px; font-weight: 700; margin: 0;
  display: flex; align-items: center; gap: 6px;
}
.products-title .bi {
  color: transparent; font-size: 17px;
  background: linear-gradient(135deg, #f97316, #ef4444);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.products-count {
  font-size: 12px; font-weight: 400; color: var(--text-muted);
  padding: 2px 8px; background: var(--line-soft); border-radius: 999px;
}
.view-toggle {
  display: inline-flex; background: var(--card); border-radius: 8px;
  padding: 2px; box-shadow: var(--shadow-sm);
}
.view-btn {
  padding: 4px 10px; background: transparent; border: none;
  border-radius: 6px; color: var(--text-muted); font-size: 15px;
  transition: all .12s ease;
}
.view-btn.active { background: var(--brand); color: #fff; }

/* ================== 商品网格 ================== */
.products-grid {
  display: grid; gap: 10px;
}
.products-grid[data-view="grid"] { grid-template-columns: repeat(2, 1fr); }
.products-grid[data-view="list"] { grid-template-columns: 1fr; }
@media (min-width: 768px) {
  .products-grid[data-view="grid"] { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1200px) {
  .products-grid[data-view="grid"] { grid-template-columns: repeat(4, 1fr); }
}

/* --- 卡片：网格模式 --- */
.product-card {
  display: block;
  background: var(--card); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm);
  color: var(--text);
  transition: transform .15s ease, box-shadow .15s ease;
  border: 1px solid rgba(15,23,42,.03);
}
.product-card:hover { color: var(--text); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.product-card:active { transform: scale(.98); }

.product-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  overflow: hidden;
}
.product-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.product-card:hover .product-thumb img { transform: scale(1.04); }
.product-thumb-placeholder {
  position: relative;
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: #cbd5e1; font-size: 40px;
  background:
    radial-gradient(circle at 30% 30%, rgba(99,102,241,.08) 0%, transparent 50%),
    radial-gradient(circle at 70% 70%, rgba(168,85,247,.06) 0%, transparent 50%),
    linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
}

/* 分类彩色卡片（无图商品时显示） */
.product-thumb-cat {
  position: relative;
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--pt-from, #6366f1) 0%, var(--pt-to, #7c3aed) 100%);
  color: #fff;
  overflow: hidden;
}
.product-thumb-cat::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.22) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(0,0,0,.12) 0%, transparent 45%);
  pointer-events: none;
}
.product-thumb-cat::after {
  content: '';
  position: absolute; right: -12px; bottom: -12px;
  width: 90px; height: 90px; border-radius: 50%;
  background: rgba(255,255,255,.09);
  pointer-events: none;
}
.product-thumb-cat .bi {
  font-size: 46px;
  z-index: 1;
  text-shadow: 0 4px 12px rgba(0,0,0,.15);
  animation: cat-icon-in .5s ease both;
}
@keyframes cat-icon-in {
  from { transform: scale(.7) rotate(-6deg); opacity: 0; }
  to   { transform: scale(1) rotate(0);      opacity: 1; }
}
.product-thumb-cat-name {
  font-size: 12px; font-weight: 700; letter-spacing: .05em;
  padding: 3px 12px; border-radius: 999px;
  background: rgba(255,255,255,.18);
  color: #fff; z-index: 1;
  backdrop-filter: blur(2px);
}
/* 列表模式下彩色卡片 icon 稍小 */
.products-grid[data-view="list"] .product-thumb-cat .bi { font-size: 36px; }

/* 商品角标（HOT / 新品 / 库存紧张） */
.product-tags {
  position: absolute; top: 8px; left: 8px;
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
  z-index: 2;
}
.product-tag {
  padding: 2px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 700; color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
  line-height: 1.4;
}
.tag-hot  { background: linear-gradient(135deg, #f97316, #ef4444); }
.tag-new  { background: linear-gradient(135deg, #10b981, #06b6d4); }
.tag-warn { background: linear-gradient(135deg, #f59e0b, #f97316); }

.product-sold-out {
  position: absolute; inset: 0;
  background: rgba(15,23,42,.55); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700;
  backdrop-filter: blur(2px);
}
.product-body { padding: 10px 12px 12px; }
.product-cat {
  font-size: 11px; color: var(--brand); font-weight: 600;
  letter-spacing: .02em;
}
.product-name {
  font-size: 14px; font-weight: 500; margin: 4px 0 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 2.6em; line-height: 1.3;
}
.product-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.product-price {
  font-size: 18px; font-weight: 800; color: var(--price); letter-spacing: -.01em; line-height: 1;
}
.product-price-currency { font-size: 12px; font-weight: 600; margin-right: 1px; }
.product-sales {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 11px; color: var(--text-muted); white-space: nowrap;
}
.product-sales .bi { color: #f97316; font-size: 10px; }

/* --- 卡片：列表模式（横向）--- */
.products-grid[data-view="list"] .product-card {
  display: flex; align-items: stretch;
}
.products-grid[data-view="list"] .product-thumb {
  width: 130px; height: 130px; aspect-ratio: auto; flex-shrink: 0;
}
.products-grid[data-view="list"] .product-body {
  flex: 1; padding: 12px 14px; display: flex; flex-direction: column;
}
.products-grid[data-view="list"] .product-name {
  font-size: 15px; margin-top: 2px; margin-bottom: auto;
}

/* ================== 空态 ================== */
.empty-box {
  text-align: center; padding: 60px 0; color: var(--text-muted);
}
.empty-box .bi { font-size: 48px; opacity: .5; display: block; margin-bottom: 10px; }

/* ================== 商品详情 ================== */
.back-link { color: var(--text-muted); font-size: 13px; display: inline-flex; align-items: center; gap: 4px; padding: 8px 0 4px; }
.back-link:hover { color: var(--brand); }
.product-detail-wrap { padding-bottom: 100px; }

.product-detail-img,
.product-detail-img-placeholder {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
}
.product-detail-img-placeholder {
  display: flex; align-items: center; justify-content: center;
  color: #9ca3af; font-size: 80px;
}

.product-detail-header {
  background: var(--card); border-radius: var(--radius);
  padding: 14px 14px 12px;
  box-shadow: var(--shadow-sm);
  margin-top: 4px;
}
.product-detail-header .product-cat { margin-bottom: 4px; }
.product-detail-name {
  font-size: 20px; font-weight: 700; margin: 2px 0 10px;
  letter-spacing: -.01em; line-height: 1.35;
}
.product-detail-meta {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
}
.product-detail-price { font-size: 28px; font-weight: 800; color: var(--price); letter-spacing: -.01em; line-height: 1; }
.product-detail-badges { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.detail-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  background: var(--line-soft); color: var(--text-muted); font-size: 12px;
}
.detail-badge .bi { font-size: 12px; }
.detail-badge-ok     { background: #dcfce7; color: #16a34a; }
.detail-badge-danger { background: #fee2e2; color: #dc2626; }

.product-detail-desc {
  color: var(--text); line-height: 1.7; font-size: 14px;
  background: var(--card); padding: 14px 14px;
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  white-space: pre-wrap; margin-top: 12px;
}

/* ================== 下单表单：块级布局 ================== */
.order-form { margin-top: 12px; }
.form-block {
  background: var(--card); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}
.form-block-label {
  font-weight: 600; margin-bottom: 10px; color: var(--text); font-size: 14px;
}
.form-hint { color: var(--text-muted); font-size: 12px; margin-top: 6px; }

.qty-input { display: flex; align-items: center; gap: 6px; max-width: 180px; }
.qty-input .btn { min-width: 44px; height: 40px; font-weight: 700; font-size: 18px; padding: 0; }
.qty-input .form-control { text-align: center; height: 40px; }

.contact-input {
  display: flex; gap: 8px;
}
.contact-input .contact-type {
  flex: 0 0 100px;
}
.contact-input input {
  flex: 1;
  min-width: 0;
}
.contact-input .form-control,
.contact-input .form-select { height: 42px; }

.pay-methods {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}
.pay-method { position: relative; cursor: pointer; }
.pay-method input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.pay-method-body {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 12px; border: 2px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); font-weight: 500; font-size: 14px;
  transition: all .15s ease;
}
.pay-method-body .bi { font-size: 20px; color: var(--text-muted); }
.pay-method input:checked ~ .pay-method-body {
  border-color: var(--brand); background: var(--brand-light);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.pay-method input:checked ~ .pay-method-body .bi { color: var(--brand); }

.product-note {
  padding: 12px 14px; background: #fefce8;
  border: 1px solid #fde68a; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 12px;
}
.product-note-title { font-weight: 600; margin-bottom: 4px; }
.product-note-title .bi { color: #d97706; margin-right: 2px; }
.product-note-body { color: #92400e; white-space: pre-wrap; line-height: 1.6; }

/* ================== 底部购买栏（sticky bottom bar） ================== */
.buy-bar-spacer { height: 88px; }
.buy-bar {
  position: fixed; left: 0; right: 0;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255,255,255,.96);
  backdrop-filter: saturate(160%) blur(16px);
  border-top: 1px solid var(--line);
  z-index: 25;
}
@media (min-width: 768px) {
  .buy-bar { bottom: 0; }
  .buy-bar-spacer { height: 84px; }
}
.buy-bar-inner {
  max-width: 800px; margin: 0 auto;
  padding: 10px 12px;
  display: flex; align-items: center; gap: 10px;
}
.buy-bar-price {
  display: flex; flex-direction: column; gap: 0;
  flex: 1 1 auto; min-width: 0; overflow: hidden;
}
.buy-bar-label { font-size: 11px; color: var(--text-muted); line-height: 1; }
.buy-bar-amount {
  font-size: 22px; font-weight: 800; color: var(--price);
  letter-spacing: -.01em; line-height: 1.1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.btn-buy {
  flex: 0 0 auto;
  height: 46px; padding: 0 22px; font-size: 15px; font-weight: 700;
  border-radius: 999px; white-space: nowrap;
  box-shadow: 0 4px 12px var(--brand-glow);
}
.btn-buy .bi { margin-right: 4px; }

@media (max-width: 420px) {
  .buy-bar-inner { padding: 8px 12px; gap: 8px; }
  .buy-bar-label { display: none; }
  .buy-bar-amount { font-size: 20px; }
  .btn-buy { padding: 0 16px; font-size: 14px; height: 42px; }
}

/* ================== 支付/结果 ================== */
.pay-loading { text-align: center; padding: 60px 0; }
.pay-card, .result-card, .query-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 18px;
  box-shadow: var(--shadow-md);
  max-width: 640px;
  margin: 0 auto;
}
.pay-title { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.pay-table { width: 100%; margin-top: 8px; }
.pay-table th {
  width: 90px; text-align: left; padding: 7px 0;
  color: var(--text-muted); font-weight: 500; vertical-align: top;
  font-size: 13px;
}
.pay-table td {
  padding: 7px 0; vertical-align: top; font-size: 14px;
  border-bottom: 1px dashed var(--line);
}
.pay-table tr:last-child td { border-bottom: none; }
.pay-amount { font-size: 18px; font-weight: 800; color: var(--price); }

.result-icon {
  width: 68px; height: 68px; border-radius: 50%; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px;
}
.result-icon-success { background: #dcfce7; color: #16a34a; }
.result-icon-warn    { background: #fef3c7; color: #d97706; }
.result-title { text-align: center; font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.result-desc { text-align: center; color: var(--text-muted); margin-bottom: 18px; font-size: 13px; }

/* ================== 卡密展示 ================== */
.cards-box {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; background: #fafafa;
}
.card-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap;
}
.card-row:last-child { border-bottom: none; }
.card-idx {
  min-width: 22px; height: 22px;
  border-radius: 50%; background: var(--brand); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.card-content {
  flex: 1; min-width: 0; font-size: 13px; word-break: break-all;
  background: #fff; padding: 6px 10px; border-radius: 4px;
  border: 1px solid var(--line);
}

/* ================== 页脚 ================== */
.site-footer {
  margin-top: 20px; background: var(--card);
  border-top: 1px solid var(--line);
  padding: 20px 0 16px; font-size: 13px;
  flex-shrink: 0;
}
.footer-inner {
  max-width: 960px; margin: 0 auto; padding: 0 16px;
  display: grid; grid-template-columns: 1fr; gap: 16px;
}
@media (min-width: 768px) {
  .footer-inner {
    grid-template-columns: 2fr 1fr 1fr;
  }
  .footer-copyright { grid-column: 1 / -1; text-align: center; padding-top: 12px; border-top: 1px solid var(--line); }
}
.footer-brand { display: flex; gap: 10px; align-items: flex-start; }
.footer-nav, .footer-contact { display: flex; flex-direction: column; gap: 4px; }
.footer-contact-title { font-weight: 600; margin-bottom: 4px; }
.footer-link {
  color: var(--text-muted); font-size: 13px; display: inline-block; padding: 2px 0;
}
.footer-link:hover { color: var(--brand); }
.footer-copyright { color: var(--text-muted); font-size: 12px; padding-top: 12px; }

/* ================== 移动端底部 tabbar ================== */
.mobile-tabbar-spacer {
  display: none;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
}
.mobile-tabbar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255,255,255,.95);
  backdrop-filter: saturate(160%) blur(16px);
  border-top: 1px solid var(--line);
  justify-content: space-around; align-items: stretch;
}
@media (max-width: 767.98px) {
  .mobile-tabbar-spacer { display: block; }
  .mobile-tabbar { display: flex; }
}
.tabbar-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 11px; gap: 2px; padding: 6px 0;
}
.tabbar-item .bi { font-size: 20px; }
.tabbar-item:active { background: var(--line-soft); }
.tabbar-item:hover { color: var(--brand); }

/* ================== 响应式细节 ================== */
@media (max-width: 380px) {
  .site-name { font-size: 15px; }
  .site-logo { width: 36px; height: 36px; }
  .main-tab { font-size: 15px; padding: 6px 10px 8px; }
  .product-price { font-size: 16px; }
  .product-name { font-size: 13px; }
  .sub-cat-item { min-width: 62px; }
  .sub-cat-icon { width: 44px; height: 44px; }
}
