/* =====================================================================
   3510 Mall 电商样式（mall.css）
   复用 portal.css 变量 + 电商专属组件
   设计：primary green #1e8449, dark navy #1a252f, price #0b2b5c, muted #5a6f8a
   ===================================================================== */

/* ── CSS 变量（电商专属，可覆盖） ── */
:root {
  --mall-primary: #1e8449;
  --mall-primary-light: #27ae60;
  --mall-dark: #1a252f;
  --mall-bg: #f6f9fc;
  --mall-card-bg: #fff;
  --mall-price: #0b2b5c;
  --mall-price-red: #e74c3c;
  --mall-muted: #5a6f8a;
  --mall-border: #e3eaf2;
  --mall-radius: 12px;
  --mall-radius-lg: 16px;
  --mall-shadow: 0 2px 12px rgba(0,20,40,.08);
  --mall-shadow-hover: 0 8px 24px -8px rgba(0,20,40,.14);
  --mall-grid-gap: 20px;
  --mall-touch: 44px;
}

/* ── MP mode ── */
html.mp-mode #site-nav,
html.mp-mode #site-foot,
html.mp-mode .breadcrumb,
html.mp-mode .web-only { display: none !important; }
html.mp-mode .mall-page { padding-top: 0; }
html.mp-mode .mall-header-bar { top: 0; }

/* ── Page wrapper ── */
.mall-page {
  min-height: 100vh;
  background: var(--mall-bg);
}

/* ── Header bar (search + nav) ── */
.mall-header-bar {
  position: sticky;
  top: 64px; /* below site-nav */
  z-index: 50;
  background: #fff;
  border-bottom: 1px solid var(--mall-border);
  padding: 12px 0;
}

.mall-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.mall-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.mall-search input {
  width: 100%;
  height: var(--mall-touch);
  padding: 0 44px 0 16px;
  border: 2px solid var(--mall-border);
  border-radius: 22px;
  font-size: .92rem;
  font-family: inherit;
  color: var(--mall-dark);
  background: var(--mall-bg);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.mall-search input:focus {
  border-color: var(--mall-primary);
  box-shadow: 0 0 0 3px rgba(30,132,73,.12);
}

.mall-search input::placeholder { color: #aab; }

.mall-search-btn {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 36px;
  height: 36px;
  border: none;
  background: var(--mall-primary);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}

.mall-search-btn:hover { background: var(--mall-primary-light); }

.mall-search-btn svg { width: 18px; height: 18px; }

.mall-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mall-header-actions .btn { white-space: nowrap; }

/* ── Category nav (horizontal scroll on mobile, sidebar on desktop) ── */
.mall-body {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px 60px;
  display: flex;
  gap: 24px;
}

.mall-sidebar {
  width: 200px;
  flex-shrink: 0;
}

.mall-sidebar-inner {
  position: sticky;
  top: 130px;
  background: #fff;
  border-radius: var(--mall-radius);
  border: 1px solid var(--mall-border);
  padding: 12px 0;
  box-shadow: var(--mall-shadow);
}

.mall-cat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: .9rem;
  color: var(--mall-muted);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all .15s;
  min-height: var(--mall-touch);
  user-select: none;
}

.mall-cat-item:hover {
  color: var(--mall-dark);
  background: var(--mall-bg);
}

.mall-cat-item.active {
  color: var(--mall-primary);
  font-weight: 600;
  border-left-color: var(--mall-primary);
  background: rgba(30,132,73,.06);
}

.mall-cat-icon { font-size: 1.1rem; flex-shrink: 0; }
.mall-cat-count { margin-left: auto; font-size: .75rem; color: #aab; }

/* ── Mobile category scroll ── */
.mall-cat-scroll {
  display: none;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 20px;
  gap: 8px;
  background: #fff;
  border-bottom: 1px solid var(--mall-border);
  scrollbar-width: none;
}

.mall-cat-scroll::-webkit-scrollbar { display: none; }

.mall-cat-chip {
  flex-shrink: 0;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: .84rem;
  color: var(--mall-muted);
  background: var(--mall-bg);
  border: 1px solid var(--mall-border);
  cursor: pointer;
  white-space: nowrap;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all .15s;
}

.mall-cat-chip:hover { border-color: var(--mall-primary); color: var(--mall-primary); }

.mall-cat-chip.active {
  background: var(--mall-primary);
  color: #fff;
  border-color: var(--mall-primary);
}

/* ── Main content area ── */
.mall-main { flex: 1; min-width: 0; }

/* ── Filter bar ── */
.mall-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: #fff;
  border-radius: var(--mall-radius);
  border: 1px solid var(--mall-border);
}

.mall-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mall-filter-label {
  font-size: .82rem;
  color: var(--mall-muted);
  white-space: nowrap;
}

.mall-filter-btn {
  padding: 5px 14px;
  border-radius: 18px;
  border: 1px solid var(--mall-border);
  background: #fff;
  color: var(--mall-muted);
  font-size: .82rem;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
  min-height: 32px;
}

.mall-filter-btn:hover { border-color: var(--mall-primary); color: var(--mall-primary); }

.mall-filter-btn.active {
  background: var(--mall-primary);
  color: #fff;
  border-color: var(--mall-primary);
}

.mall-filter-divider {
  width: 1px;
  height: 24px;
  background: var(--mall-border);
  margin: 0 6px;
}

.mall-filter-select {
  padding: 5px 28px 5px 12px;
  border-radius: 18px;
  border: 1px solid var(--mall-border);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%235a6f8a' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 10px center;
  color: var(--mall-muted);
  font-size: .82rem;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  min-height: 32px;
}

.mall-filter-select:focus { border-color: var(--mall-primary); outline: none; }

/* ── Price range inputs ── */
.mall-price-range {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mall-price-range input {
  width: 72px;
  padding: 5px 8px;
  border: 1px solid var(--mall-border);
  border-radius: 8px;
  font-size: .82rem;
  font-family: inherit;
  text-align: center;
  color: var(--mall-dark);
  min-height: 32px;
}

.mall-price-range input:focus { border-color: var(--mall-primary); outline: none; }

.mall-price-range span {
  font-size: .82rem;
  color: var(--mall-muted);
}

.mall-price-apply {
  padding: 5px 12px;
  border-radius: 8px;
  border: none;
  background: var(--mall-primary);
  color: #fff;
  font-size: .78rem;
  font-family: inherit;
  cursor: pointer;
  min-height: 32px;
}

/* ── Result count ── */
.mall-result-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: .84rem;
  color: var(--mall-muted);
}

.mall-result-bar strong { color: var(--mall-primary); }

/* ── Product grid ── */
.mall-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--mall-grid-gap);
}

/* ── Product card ── */
.mall-card {
  background: var(--mall-card-bg);
  border-radius: var(--mall-radius);
  border: 1px solid var(--mall-border);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow .2s, transform .2s, border-color .2s;
  display: flex;
  flex-direction: column;
}

.mall-card:hover {
  box-shadow: var(--mall-shadow-hover);
  transform: translateY(-3px);
  border-color: #c8e8d5;
}

.mall-card-img {
  position: relative;
  width: 100%;
  padding-top: 100%; /* 1:1 aspect ratio */
  background: var(--mall-bg);
  overflow: hidden;
}

.mall-card-img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s;
}

.mall-card:hover .mall-card-img img { transform: scale(1.04); }

.mall-card-img .mall-emoji-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, #eaf6ee, #eaf2fb);
}

.mall-card-type-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: .72rem;
  font-weight: 600;
  z-index: 1;
}

.badge-physical { background: #e6f6ec; color: #1e8449; }
.badge-virtual { background: #eef4fc; color: #1f618d; }
.badge-service { background: #fdf2e9; color: #b9651a; }
.badge-longterm { background: #fdf2e9; color: #b9651a; }

.mall-card-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.mall-card-title {
  font-size: .92rem;
  font-weight: 600;
  color: var(--mall-dark);
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mall-card-shop {
  font-size: .76rem;
  color: var(--mall-muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.mall-card-price {
  margin-top: auto;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.mall-card-price .price {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--mall-price);
}

.mall-card-price .price-unit {
  font-size: .78rem;
  font-weight: 400;
  color: var(--mall-muted);
}

.mall-card-price .price-original {
  font-size: .78rem;
  color: #aab;
  text-decoration: line-through;
}

/* ── Entitlement badges on card ── */
.mall-card-ents {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0 0;
}

.mall-ent-badge {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: .7rem;
  font-weight: 600;
  background: #e6f6ec;
  color: #1e8449;
  border: 1px solid #bfe6cc;
}

/* ── Loading / Empty / Error states ── */
.mall-loading,
.mall-empty,
.mall-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--mall-muted);
  text-align: center;
  grid-column: 1 / -1;
}

.mall-loading .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--mall-border);
  border-top-color: var(--mall-primary);
  border-radius: 50%;
  animation: mall-spin .8s linear infinite;
  margin-bottom: 16px;
}

@keyframes mall-spin { to { transform: rotate(360deg); } }

.mall-loading p,
.mall-empty p,
.mall-error p { font-size: .92rem; margin-top: 8px; }

.mall-empty .empty-icon { font-size: 3rem; margin-bottom: 12px; opacity: .5; }
.mall-error .error-icon { font-size: 3rem; margin-bottom: 12px; }

/* ── Pagination ── */
.mall-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 32px;
  padding: 16px 0;
}

.mall-page-btn {
  min-width: var(--mall-touch);
  min-height: var(--mall-touch);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--mall-border);
  border-radius: 10px;
  background: #fff;
  color: var(--mall-muted);
  font-size: .88rem;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
  padding: 0 12px;
}

.mall-page-btn:hover { border-color: var(--mall-primary); color: var(--mall-primary); }

.mall-page-btn.active {
  background: var(--mall-primary);
  color: #fff;
  border-color: var(--mall-primary);
}

.mall-page-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.mall-page-info {
  font-size: .82rem;
  color: var(--mall-muted);
  margin: 0 8px;
}

/* ── Infinite scroll sentinel ── */
.mall-scroll-sentinel {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mall-scroll-sentinel .spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--mall-border);
  border-top-color: var(--mall-primary);
  border-radius: 50%;
  animation: mall-spin .8s linear infinite;
}

/* =====================================================================
   Detail page
   ===================================================================== */

.mall-detail {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.mall-detail-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}

/* Image gallery */
.mall-gallery {
  position: sticky;
  top: 130px;
}

.mall-gallery-main {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--mall-radius-lg);
  background: var(--mall-bg);
  overflow: hidden;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mall-gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mall-gallery-main .emoji-placeholder {
  font-size: 6rem;
}

.mall-gallery-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.mall-gallery-thumb {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  border: 2px solid var(--mall-border);
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color .15s;
}

.mall-gallery-thumb:hover,
.mall-gallery-thumb.active { border-color: var(--mall-primary); }

.mall-gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Info section */
.mall-info { display: flex; flex-direction: column; }

.mall-info-type {
  display: inline-flex;
  padding: 4px 14px;
  border-radius: 14px;
  font-size: .78rem;
  font-weight: 600;
  margin-bottom: 12px;
  width: fit-content;
}

.mall-info h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--mall-dark);
  line-height: 1.4;
  margin-bottom: 8px;
}

.mall-info-subtitle {
  font-size: .92rem;
  color: var(--mall-muted);
  margin-bottom: 16px;
}

.mall-info-shop {
  font-size: .84rem;
  color: var(--mall-muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mall-info-price-block {
  background: linear-gradient(135deg, #f3faf6, #eef4fc);
  border-radius: var(--mall-radius);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.mall-info-price {
  font-size: 2rem;
  font-weight: 800;
  color: var(--mall-price);
}

.mall-info-price small {
  font-size: .9rem;
  font-weight: 400;
  color: var(--mall-muted);
}

/* SKU picker */
.mall-sku-section { margin-bottom: 20px; }

.mall-sku-label {
  font-size: .88rem;
  font-weight: 600;
  color: var(--mall-dark);
  margin-bottom: 8px;
}

.mall-sku-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mall-sku-btn {
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid var(--mall-border);
  background: #fff;
  font-size: .86rem;
  font-family: inherit;
  color: var(--mall-dark);
  cursor: pointer;
  transition: all .15s;
  min-height: var(--mall-touch);
}

.mall-sku-btn:hover { border-color: var(--mall-primary); }

.mall-sku-btn.active {
  border-color: var(--mall-primary);
  background: rgba(30,132,73,.06);
  color: var(--mall-primary);
  font-weight: 600;
}

.mall-sku-btn.out-of-stock {
  opacity: .4;
  cursor: not-allowed;
  text-decoration: line-through;
}

/* Quantity */
.mall-qty-section {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.mall-qty-label {
  font-size: .88rem;
  font-weight: 600;
  color: var(--mall-dark);
}

.mall-qty-control {
  display: flex;
  align-items: center;
  border: 1px solid var(--mall-border);
  border-radius: 8px;
  overflow: hidden;
}

.mall-qty-btn {
  width: var(--mall-touch);
  height: 36px;
  border: none;
  background: var(--mall-bg);
  color: var(--mall-dark);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}

.mall-qty-btn:hover { background: #dde5ed; }
.mall-qty-btn:disabled { opacity: .3; cursor: not-allowed; }

.mall-qty-value {
  width: 48px;
  text-align: center;
  font-size: .92rem;
  font-weight: 600;
  color: var(--mall-dark);
  border-left: 1px solid var(--mall-border);
  border-right: 1px solid var(--mall-border);
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Action buttons */
.mall-actions {
  display: flex;
  gap: 12px;
  margin-top: auto;
  padding-top: 20px;
}

.mall-actions .btn { flex: 1; min-height: 48px; font-size: 1rem; }

/* Detail description */
.mall-detail-desc {
  background: #fff;
  border-radius: var(--mall-radius-lg);
  border: 1px solid var(--mall-border);
  padding: 24px;
  margin-bottom: 24px;
}

.mall-detail-desc h2 {
  font-size: 1.15rem;
  color: var(--mall-dark);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--mall-border);
}

.mall-detail-desc .desc-body {
  font-size: .92rem;
  color: #3a4d62;
  line-height: 1.8;
  white-space: pre-line;
}

/* Entitlements section */
.mall-detail-ents {
  background: #fff;
  border-radius: var(--mall-radius-lg);
  border: 1px solid var(--mall-border);
  padding: 24px;
}

.mall-detail-ents h2 {
  font-size: 1.15rem;
  color: var(--mall-dark);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--mall-border);
}

.mall-ent-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  font-size: .88rem;
  color: #3a4d62;
  border-bottom: 1px dashed var(--mall-border);
}

.mall-ent-row:last-child { border-bottom: none; }

.mall-ent-year {
  font-weight: 700;
  color: var(--mall-primary);
  min-width: 44px;
  flex-shrink: 0;
}

.mall-ent-icon {
  flex-shrink: 0;
}

/* =====================================================================
   Cart page
   ===================================================================== */

.mall-cart {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.mall-cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.mall-cart-header h1 {
  font-size: 1.4rem;
  color: var(--mall-dark);
}

.mall-cart-list {
  background: #fff;
  border-radius: var(--mall-radius-lg);
  border: 1px solid var(--mall-border);
  overflow: hidden;
}

.mall-cart-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--mall-border);
  transition: background .15s;
}

.mall-cart-item:last-child { border-bottom: none; }
.mall-cart-item:hover { background: var(--mall-bg); }

.mall-cart-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--mall-border);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}

.mall-cart-check.checked {
  background: var(--mall-primary);
  border-color: var(--mall-primary);
}

.mall-cart-check.checked::after {
  content: '';
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
}

.mall-cart-img {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--mall-bg);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mall-cart-img img { width: 100%; height: 100%; object-fit: cover; }

.mall-cart-info { flex: 1; min-width: 0; }

.mall-cart-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--mall-dark);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mall-cart-sku {
  font-size: .78rem;
  color: var(--mall-muted);
  margin-bottom: 6px;
}

.mall-cart-price {
  font-size: .92rem;
  font-weight: 700;
  color: var(--mall-price);
}

.mall-cart-qty {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--mall-border);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.mall-cart-qty button {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--mall-bg);
  color: var(--mall-dark);
  cursor: pointer;
  font-size: .9rem;
}

.mall-cart-qty button:hover { background: #dde5ed; }

.mall-cart-qty span {
  width: 40px;
  text-align: center;
  font-size: .86rem;
  font-weight: 600;
  color: var(--mall-dark);
  border-left: 1px solid var(--mall-border);
  border-right: 1px solid var(--mall-border);
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mall-cart-del {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  color: #aab;
  cursor: pointer;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}

.mall-cart-del:hover { background: #fdecea; color: #e74c3c; }

/* Cart footer */
.mall-cart-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #fff;
  border-radius: var(--mall-radius-lg);
  border: 1px solid var(--mall-border);
  margin-top: 16px;
  position: sticky;
  bottom: 0;
  z-index: 10;
}

.mall-cart-footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mall-cart-total {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--mall-price);
}

.mall-cart-total small {
  font-weight: 400;
  color: var(--mall-muted);
  font-size: .84rem;
}

/* =====================================================================
   Checkout page
   ===================================================================== */

.mall-checkout {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.mall-checkout h1 {
  font-size: 1.4rem;
  color: var(--mall-dark);
  margin-bottom: 20px;
}

.mall-co-section {
  background: #fff;
  border-radius: var(--mall-radius-lg);
  border: 1px solid var(--mall-border);
  padding: 20px;
  margin-bottom: 16px;
}

.mall-co-section h2 {
  font-size: 1rem;
  color: var(--mall-dark);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mall-co-address {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: var(--mall-radius);
  background: var(--mall-bg);
}

.mall-co-address-icon { font-size: 1.4rem; flex-shrink: 0; margin-top: 2px; }

.mall-co-address-info { flex: 1; }

.mall-co-address-name {
  font-weight: 600;
  color: var(--mall-dark);
  margin-bottom: 2px;
}

.mall-co-address-detail {
  font-size: .86rem;
  color: var(--mall-muted);
}

.mall-co-no-address {
  color: var(--mall-primary);
  font-weight: 600;
  cursor: pointer;
}

.mall-co-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--mall-border);
}

.mall-co-item:last-child { border-bottom: none; }

.mall-co-item-img {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--mall-bg);
  flex-shrink: 0;
}

.mall-co-item-img img { width: 100%; height: 100%; object-fit: cover; }

.mall-co-item-info { flex: 1; min-width: 0; }

.mall-co-item-title {
  font-size: .88rem;
  font-weight: 600;
  color: var(--mall-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mall-co-item-meta {
  font-size: .78rem;
  color: var(--mall-muted);
}

.mall-co-item-price {
  font-size: .9rem;
  font-weight: 700;
  color: var(--mall-price);
  flex-shrink: 0;
}

.mall-co-remark {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--mall-border);
  border-radius: 8px;
  font-size: .88rem;
  font-family: inherit;
  color: var(--mall-dark);
  resize: vertical;
  min-height: 60px;
}

.mall-co-remark:focus { border-color: var(--mall-primary); outline: none; }

.mall-co-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mall-co-row {
  display: flex;
  justify-content: space-between;
  font-size: .88rem;
  color: var(--mall-muted);
}

.mall-co-row.total {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--mall-price);
  padding-top: 8px;
  border-top: 1px solid var(--mall-border);
}

.mall-co-submit {
  margin-top: 20px;
}

.mall-co-submit .btn {
  width: 100%;
  min-height: 52px;
  font-size: 1.05rem;
}

/* =====================================================================
   Orders page
   ===================================================================== */

.mall-orders {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.mall-orders h1 {
  font-size: 1.4rem;
  color: var(--mall-dark);
  margin-bottom: 16px;
}

/* Order tabs */
.mall-order-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  background: #fff;
  border-radius: var(--mall-radius);
  border: 1px solid var(--mall-border);
  overflow: hidden;
}

.mall-order-tab {
  flex: 1;
  padding: 12px 0;
  text-align: center;
  font-size: .86rem;
  font-weight: 500;
  color: var(--mall-muted);
  cursor: pointer;
  border: none;
  background: none;
  border-right: 1px solid var(--mall-border);
  font-family: inherit;
  transition: all .15s;
  min-height: var(--mall-touch);
}

.mall-order-tab:last-child { border-right: none; }
.mall-order-tab:hover { color: var(--mall-dark); background: var(--mall-bg); }

.mall-order-tab.active {
  color: var(--mall-primary);
  font-weight: 700;
  background: rgba(30,132,73,.06);
}

/* Order card */
.mall-order-card {
  background: #fff;
  border-radius: var(--mall-radius-lg);
  border: 1px solid var(--mall-border);
  margin-bottom: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow .2s;
}

.mall-order-card:hover { box-shadow: var(--mall-shadow-hover); }

.mall-order-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--mall-border);
  background: var(--mall-bg);
}

.mall-order-id {
  font-size: .82rem;
  color: var(--mall-muted);
}

.mall-order-status {
  font-size: .78rem;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 12px;
}

.status-pending_payment,
.status-pending_pay { background: #fff3e6; color: #b9651a; }

.status-pending_shipment,
.status-pending_ship { background: #eef4fc; color: #1f4e8c; }

.status-shipped { background: #eef4fc; color: #1f4e8c; }

.status-completed,
.status-settled { background: #e6f6ec; color: #1e8449; }

.status-cancelled { background: #fdecea; color: #c0392b; }

.status-refunding,
.status-refunded { background: #fdf2e9; color: #b9651a; }

.mall-order-card-body {
  padding: 16px;
}

.mall-order-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mall-order-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mall-order-item-img {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--mall-bg);
  flex-shrink: 0;
}

.mall-order-item-img img { width: 100%; height: 100%; object-fit: cover; }

.mall-order-item-title {
  flex: 1;
  font-size: .86rem;
  font-weight: 500;
  color: var(--mall-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mall-order-item-qty {
  font-size: .82rem;
  color: var(--mall-muted);
  flex-shrink: 0;
}

.mall-order-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--mall-border);
  background: var(--mall-bg);
}

.mall-order-amount {
  font-size: .92rem;
  font-weight: 700;
  color: var(--mall-price);
}

.mall-order-time {
  font-size: .78rem;
  color: #aab;
}

.mall-order-actions {
  display: flex;
  gap: 8px;
}

.mall-order-actions .btn { padding: 6px 16px; font-size: .82rem; }

/* =====================================================================
   Order detail page
   ===================================================================== */

.mall-order-detail {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.mall-od-header {
  background: #fff;
  border-radius: var(--mall-radius-lg);
  border: 1px solid var(--mall-border);
  padding: 24px;
  margin-bottom: 16px;
  text-align: center;
}

.mall-od-status-icon { font-size: 2.5rem; margin-bottom: 8px; }

.mall-od-status-text {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 4px;
}

/* Steps */
.mall-od-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 16px 0;
}

.mall-od-step {
  display: flex;
  align-items: center;
  gap: 0;
}

.mall-od-step-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--mall-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}

.mall-od-step-dot.done { background: var(--mall-primary); }
.mall-od-step-dot.current { background: var(--mall-primary); box-shadow: 0 0 0 4px rgba(30,132,73,.2); }

.mall-od-step-line {
  width: 48px;
  height: 2px;
  background: var(--mall-border);
}

.mall-od-step-line.done { background: var(--mall-primary); }

/* =====================================================================
   Toast
   ===================================================================== */

.mall-toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  background: var(--mall-dark);
  color: #d6e4f5;
  padding: 10px 24px;
  border-radius: 30px;
  font-size: .88rem;
  box-shadow: 0 8px 24px -8px rgba(0,0,0,.4);
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
  z-index: 200;
  white-space: nowrap;
}

.mall-toast.show { opacity: 1; }

/* =====================================================================
   Responsive
   ===================================================================== */

@media (max-width: 1024px) {
  .mall-grid { grid-template-columns: repeat(3, 1fr); }
  .mall-sidebar { display: none; }
  .mall-cat-scroll { display: flex; }
  .mall-detail-top { grid-template-columns: 1fr; }
  .mall-gallery { position: static; }
}

@media (max-width: 768px) {
  .mall-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .mall-header-inner { padding: 0 12px; }
  .mall-body { padding: 12px 12px 60px; flex-direction: column; gap: 12px; }
  .mall-cat-scroll { padding: 8px 12px; }
  .mall-filters { padding: 8px 12px; gap: 6px; }
  .mall-filter-divider { display: none; }
  .mall-price-range { display: none; } /* hide on mobile, use sort instead */
  .mall-card-body { padding: 10px 10px 12px; }
  .mall-card-title { font-size: .84rem; }
  .mall-card-price .price { font-size: .96rem; }

  /* Detail */
  .mall-detail { padding: 12px 12px 60px; }
  .mall-info h1 { font-size: 1.2rem; }
  .mall-info-price { font-size: 1.6rem; }

  /* Cart */
  .mall-cart { padding: 12px 12px 60px; }
  .mall-cart-item { gap: 10px; padding: 12px; }
  .mall-cart-img { width: 60px; height: 60px; }

  /* Checkout */
  .mall-checkout { padding: 12px 12px 60px; }

  /* Orders */
  .mall-orders { padding: 12px 12px 60px; }
  .mall-order-tab { font-size: .78rem; padding: 10px 0; }

  /* Sticky header adjustments */
  .mall-header-bar { top: 0; }
}

@media (max-width: 480px) {
  .mall-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .mall-card-type-badge { top: 6px; left: 6px; font-size: .66rem; padding: 2px 8px; }
  .mall-order-tabs { flex-wrap: wrap; }
  .mall-order-tab { flex: 0 0 33.33%; border-bottom: 1px solid var(--mall-border); }
}

/* ===== 交付方式三选 + 地址 Modal + 扫码付（checkout / order-detail 共用）===== */
.mall-co-dopts { display: flex; gap: 10px; flex-wrap: wrap; }
.mall-co-dopt { display: flex; align-items: center; gap: 6px; padding: 10px 16px; border: 1.5px solid var(--mall-border); border-radius: 10px; cursor: pointer; font-size: .9rem; transition: all .15s; }
.mall-co-dopt input { margin: 0; accent-color: var(--mall-primary); }
.mall-co-dopt.active { border-color: var(--mall-primary); background: rgba(46,89,170,.06); color: var(--mall-primary); font-weight: 600; }
.mall-co-sub { margin-top: 14px; }
.mall-co-field { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.mall-co-field > label { width: 70px; color: var(--mall-muted); font-size: .86rem; flex-shrink: 0; }
.mall-co-field input { flex: 1; padding: 8px 12px; border: 1px solid var(--mall-border); border-radius: 8px; font-size: .9rem; }
.mall-co-static { font-weight: 600; }
.mall-co-hint { color: var(--mall-muted); font-size: .82rem; line-height: 1.6; padding: 8px 12px; background: #f7f9fc; border-radius: 8px; }
.mall-co-pickup, .mall-co-online { padding: 4px 0; }
.mall-co-link { background: none; border: none; color: var(--mall-primary); cursor: pointer; font-size: .84rem; padding: 4px 8px; }
.mall-co-link:hover { text-decoration: underline; }

/* Modal */
.mall-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.mall-modal { background: #fff; border-radius: 14px; max-width: 460px; width: 100%; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.mall-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--mall-border); }
.mall-modal-head h3 { margin: 0; font-size: 1rem; }
.mall-modal-close { background: none; border: none; font-size: 1.6rem; line-height: 1; color: var(--mall-muted); cursor: pointer; padding: 0 4px; }
.mall-modal-body { padding: 16px 20px; overflow-y: auto; }

/* 地址卡 */
.mall-addr-list { margin-bottom: 16px; }
.mall-addr-card { display: flex; align-items: center; justify-content: space-between; padding: 12px; border: 1px solid var(--mall-border); border-radius: 10px; margin-bottom: 8px; gap: 8px; }
.mall-addr-card.active { border-color: var(--mall-primary); background: rgba(46,89,170,.04); }
.mall-addr-card-name { font-weight: 600; font-size: .9rem; }
.mall-addr-card-detail { color: var(--mall-muted); font-size: .82rem; margin-top: 4px; }
.mall-addr-default { background: var(--mall-primary); color: #fff; font-size: .66rem; padding: 1px 6px; border-radius: 4px; }
.mall-addr-card-ops { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.mall-addr-empty { color: var(--mall-muted); font-size: .84rem; padding: 12px 0; }
.mall-addr-form { border-top: 1px dashed var(--mall-border); padding-top: 14px; }
.mall-addr-form h4 { margin: 0 0 10px; font-size: .9rem; }
.mall-addr-row { margin-bottom: 8px; }
.mall-addr-row input[type="text"], .mall-addr-row input[type="tel"], .mall-addr-row input:not([type]) { width: 100%; padding: 8px 12px; border: 1px solid var(--mall-border); border-radius: 8px; font-size: .88rem; box-sizing: border-box; }
.mall-addr-row3 { display: flex; gap: 8px; flex-wrap: wrap; }
.mall-addr-row3 input { flex: 1; min-width: 90px; }
.mall-addr-row3 select { flex: 1; min-width: 90px; padding: 8px 12px; border: 1px solid var(--mall-border); border-radius: 8px; font-size: .88rem; box-sizing: border-box; background: #fff; }

/* 扫码付 */
.mall-pay-modal { max-width: 360px; }
.mall-pay-body { text-align: center; padding: 24px 20px; }
#pay-qrcode, #pay-qrcode img { margin: 0 auto; }
.mall-pay-tip { margin: 16px 0 6px; font-size: .92rem; font-weight: 600; }
.mall-pay-status { color: var(--mall-muted); font-size: .82rem; }

/* 订单页：交付方式展示 */
.mall-co-delivery-box { padding: 12px 14px; border: 1px solid var(--mall-border); border-radius: 10px; }
.mall-co-delivery-tag { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: .8rem; font-weight: 600; }
.mall-co-delivery-tag.delivery { background: #e8f0fe; color: #1a56c4; }
.mall-co-delivery-tag.pickup { background: #fdf2e9; color: #b9651a; }
.mall-co-delivery-tag.online { background: #e6f7ed; color: #1e8449; }

@media (max-width: 480px) {
  .mall-co-dopts { flex-direction: column; }
  .mall-co-dopt { width: 100%; }
  .mall-addr-row3 { flex-direction: column; }
}

/* ============================ 卡包兑换支付面板（2026-08-21） ============================ */
.pp-mask{position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:1200;display:flex;align-items:flex-end;justify-content:center}
.pp-sheet{width:100%;max-width:560px;max-height:82vh;background:#fff;border-radius:14px 14px 0 0;display:flex;flex-direction:column;overflow:auto}
.pp-head{display:flex;justify-content:space-between;align-items:center;padding:16px 20px 6px}
.pp-title{font-size:17px;font-weight:600}
.pp-close{font-size:18px;color:#999;cursor:pointer;padding:2px 8px}
.pp-applied{margin:8px 20px;padding:8px 12px;background:#e8f5ef;border-radius:8px;color:#1a7f5a;font-size:13px}
.pp-banner{margin:8px 20px;padding:12px 14px;background:linear-gradient(135deg,#fff7e8,#fff1d6);border-radius:10px;border:1px solid #f0d9a8;cursor:pointer}
.pp-banner-main{font-size:14px;font-weight:600;color:#8a5a00}
.pp-banner-sub{font-size:12px;color:#a08040;margin-top:2px}
.pp-tabs{display:flex;margin:10px 20px 0;border-bottom:1px solid #eee}
.pp-tab{flex:1;text-align:center;padding:10px 0;font-size:15px;color:#888;cursor:pointer;position:relative}
.pp-tab.on{color:#1a7f5a;font-weight:600}
.pp-tab.on::after{content:'';position:absolute;left:35%;right:35%;bottom:-1px;height:3px;background:#1a7f5a;border-radius:2px}
.pp-body{padding:14px 20px}
.pp-empty{text-align:center;color:#999;padding:28px 0}
.pp-voucher{display:flex;align-items:center;gap:12px;padding:14px 12px;border:1px solid #e5e5e5;border-radius:10px;margin-bottom:10px;background:#fafafa;cursor:pointer}
.pp-voucher.sel{border-color:#1a7f5a;background:#f0faf5}
.pp-v-left{display:flex;flex-direction:column;align-items:center;min-width:72px;padding-right:12px;border-right:1px dashed #ddd}
.pp-v-amount{font-size:22px;font-weight:700;color:#c05621}
.pp-voucher.sel .pp-v-amount{color:#1a7f5a}
.pp-v-face{font-size:11px;color:#999}
.pp-v-mid{flex:1;display:flex;flex-direction:column;gap:3px;overflow:hidden}
.pp-v-title{font-size:14px;font-weight:500}
.pp-v-sub{font-size:11px;color:#999}
.pp-v-check{width:24px;height:24px;border-radius:50%;border:1px solid #ccc;color:#fff;display:flex;align-items:center;justify-content:center;font-size:13px;flex-shrink:0}
.pp-v-check.on{background:#1a7f5a;border-color:#1a7f5a}
.pp-alt{margin:6px 0 4px;color:#1a7f5a;font-size:14px;text-align:center;cursor:pointer;padding:8px 0 2px}
.pp-share-row{display:flex;gap:8px;align-items:center;margin-top:6px}
.pp-share-row input{flex:1;border:1px solid #ddd;border-radius:8px;padding:9px 12px;font-size:15px;letter-spacing:2px;font-family:monospace}
.pp-pay-row{display:flex;justify-content:space-between;align-items:center;padding:14px 4px;border-bottom:1px solid #f2f2f2}
.pp-pay-name{font-size:15px}
.pp-pay-sub{font-size:12px;color:#999;margin-top:2px}
.pp-foot{display:flex;align-items:center;gap:14px;padding:14px 20px 18px;border-top:1px solid #eee}
.pp-total{flex:1}
.pp-total-main{font-size:15px;font-weight:600}
.pp-total-sub{font-size:12px;color:#999;margin-top:2px}
.pp-qr-note{padding:0 20px 14px;font-size:12px;color:#999}
