:root {
  --primary: #22c55e;
  --primary-dark: #16a34a;
  --accent: #f97316;
  --bg: #f3f4f6;
  --text-main: #111827;
  --text-sub: #6b7280;
  --card-bg: #ffffff;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.08);

  /* ✅ iOS 视口高度变量（JS 会写入 --vvh） */
  --vvh: 100vh;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  background: var(--bg);
  color: var(--text-main);
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
}

#app {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  min-height: var(--vvh, 100vh); /* ✅ iOS 键盘：真实可视高度 */
}

/* =========================================================
   ✅ iOS 键盘通用防“撑破屏幕”锁屏（搜索/ZIP）
   说明：配合 JS 给 body 加 class：kb-open / use-vvh
   ========================================================= */
body.kb-open {
  position: fixed !important;
  left: 0;
  right: 0;
  width: 100% !important;
  overflow: hidden !important;
}

body.use-vvh {
  height: var(--vvh, 100vh) !important;
}

body.use-vvh #app {
  min-height: var(--vvh, 100vh) !important;
}

/* =========================
   顶部导航 + 分类条置顶
   ========================= */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 999;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.top-nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 16px 6px;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 260px;
  gap: 16px;
  align-items: center;
}

@media (max-width: 900px) {
  .top-nav-inner {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
    row-gap: 8px;
  }
}

@media (max-width: 480px) {
  .top-nav-inner {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    box-sizing: border-box;
  }
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-badge {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #22c55e, #16a34a);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 3px 8px rgba(16, 185, 129, 0.7);
}

.logo-text-main {
  font-size: 18px;
  font-weight: 700;
}

.logo-text-sub {
  font-size: 11px;
  color: var(--text-sub);
}

.search-area {
  display: flex;
  align-items: center;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f3f4f6;
  border-radius: 999px;
  padding: 7px 10px;
  width: 100%;
}

.search-icon {
  font-size: 14px;
  color: var(--text-sub);
}

.search-input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 13px;
  line-height: 1.2;
}
/* ✅ FIX: iOS 输入搜索时文字看不到（强制 text color） */
.search-input{
  color: #111827 !important;
  caret-color: #111827 !important;
  -webkit-text-fill-color: #111827 !important; /* iOS 关键 */
  opacity: 1 !important;
}

.search-input::placeholder{
  color: #9ca3af !important;
  -webkit-text-fill-color: #9ca3af !important;
}

@media (max-width: 768px) {
  .search-input {
    font-size: 16px;
  } /* ✅ iOS 不自动缩放 */
}

.search-input::placeholder {
  color: #9ca3af;
}

.user-area {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.link-btn {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}

.link-btn.primary {
  border-color: transparent;
  background: #22c55e;
  color: #fff;
}

.link-btn:hover {
  filter: brightness(0.97);
}

/* 购物车图标 */
.cart-icon {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #e5e7eb;
}

.cart-count-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  padding: 0 6px;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
}

/* 分类条 */
.category-bar-wrap {
  width: 100%;
  background: #fff;
  border-top: 1px solid #f3f4f6;
}

.category-bar {
  max-width: 1400px;
  margin: 0 auto;
  padding: 6px 16px 8px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-width: 0;

  /* ✅ 允许横向滑动 */
  touch-action: pan-x;
}

.category-bar::-webkit-scrollbar {
  display: none;
}

.catbar-more {
  display: none;
  padding: 8px 12px;
  border-radius: 999px;
  background: #eef2ff;
  color: #2563eb;
  font-size: 13px;
  white-space: nowrap;
}

@media (min-width: 769px) {
  .catbar-more {
    display: inline-flex;
  }
}

.cat-pill {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #fff;
  font-size: 14px;
  color: #111827;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
  transition: background 0.18s ease-out, transform 0.12s ease-out,
    box-shadow 0.18s ease-out, border-color 0.18s ease-out;
}

.cat-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.09);
}

.cat-pill.active {
  border-color: rgba(34, 197, 94, 0.9);
  background: linear-gradient(135deg, #ecfdf3, #dcfce7);
  color: #15803d;
  font-weight: 700;
}

.cat-icon {
  font-size: 18px;
}

/* =========================
   主体
   ========================= */
.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 16px 32px;
}

/* side-rail */
.side-rail {
  position: fixed;
  top: 120px;
  left: 8px;
  width: 56px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  padding: 6px 4px;
}

.side-rail-item {
  background: #fff;
  border-radius: 10px;
  padding: 6px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 48px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  border: 1px solid #eee;
}

.side-rail-item span {
  font-size: 10px;
  color: #444;
  margin-top: 3px;
}

.side-icon {
  width: 24px;
  height: 24px;
  display: block;
}

@media (min-width: 769px) {
  .page {
    margin-left: 0 !important;
    padding-left: 120px;
  }
}

@media (max-width: 768px) {
  .side-rail {
    display: none;
  }
  .page {
    margin-left: 0 !important;
    padding-left: 16px;
  }
}

/* =========================
   Banner
   ========================= */
.banner-carousel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  background: #000;
  min-height: 260px;
}

.banner-track {
  display: flex;
  transition: transform 0.4s ease-out;
  height: 100%;
}

.banner-card {
  flex: 0 0 100%;
  padding: 22px 22px 16px;
  color: #f9fafb;
  position: relative;
  overflow: hidden;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transform: scale(0.94);
  opacity: 0.8;
  transition: transform 0.25s ease-out, opacity 0.25s ease-out,
    box-shadow 0.25s ease-out;
}

.banner-card.active {
  transform: scale(1.05);
  opacity: 1;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.4);
}

.banner-1 {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.banner-2 {
  background: linear-gradient(135deg, #f97316, #ea580c);
}

.banner-3 {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.banner-4 {
  background: linear-gradient(135deg, #14b8a6, #0f766e);
}

.banner-5 {
  background: linear-gradient(135deg, #a855f7, #7c3aed);
}

.banner-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.banner-sub {
  font-size: 14px;
  opacity: 0.98;
  margin-bottom: 12px;
  max-width: 520px;
}

.banner-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
}

.banner-tag {
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.25);
}

.banner-dots {
  position: absolute;
  bottom: 10px;
  right: 16px;
  display: flex;
  gap: 4px;
}

.banner-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.35);
  cursor: pointer;
}

.banner-dot.active {
  background: #f9fafb;
}

/* =========================
   Section
   ========================= */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin: 14px 2px 10px;
}

.section-header > div {
  flex: 1;
  min-width: 0;
}

.section-title .title-icon {
  font-size: 24px;
}

.section-sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-sub);
}

/* 查看更多 */
.section-link--desktop {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
  color: #16a34a;
  gap: 4px;
}

.section-link--mobile-bottom {
  display: none;
}

@media (max-width: 768px) {
  .section-link--desktop {
    display: none !important;
  }
  .section-link--mobile-bottom {
    display: flex !important;
    justify-content: center;
    align-items: center;
    margin: 12px 0 6px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #eef2ff;
    color: #2563eb;
    font-size: 14px;
    font-weight: 600;
  }
}

/* =========================
   商品网格/卡片
   ========================= */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  min-width: 0;
  flex: 1;
  align-content: flex-start;
}

@media (max-width: 1200px) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.product-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 8px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.product-image-wrap {
  position: relative;
  width: 100%;
  padding-top: 70%;
  border-radius: 12px;
  overflow: hidden;
  background: #f3f4f6;
}

.product-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.special-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
  z-index: 2;
}

.product-qty-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  background: #22c55e;
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  border-radius: 999px;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.28);
  border: 2px solid #fff;
  z-index: 3;
}

/* 悬停 overlay */
.product-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(15, 23, 42, 0.7),
    rgba(15, 23, 42, 0.1)
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 8px;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease-out;
}

/* ✅ 修复：用 product-image-wrap 触发 hover */
.product-image-wrap:hover .product-overlay {
  opacity: 1;
  pointer-events: auto;
}

.overlay-btn-row {
  display: flex;
  gap: 6px;
}

.overlay-btn {
  flex: 1;
  border-radius: 999px;
  border: none;
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.overlay-btn.fav {
  background: rgba(15, 23, 42, 0.85);
  color: #fbbf24;
}

.overlay-btn.add {
  background: #22c55e;
  color: #fff;
}

.overlay-btn.add.is-loading {
  opacity: 0.7;
  pointer-events: none;
  position: relative;
}

.overlay-btn.add.is-loading::after {
  content: "…";
  margin-left: 4px;
  font-size: 12px;
}

.product-name {
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.product-desc {
  font-size: 12px;
  color: var(--text-sub);
}

.product-price-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.product-price {
  font-size: 16px;
  font-weight: 700;
  color: #22c55e;
}

.product-origin {
  font-size: 11px;
  text-decoration: line-through;
  color: #9ca3af;
}

.product-tagline {
  font-size: 11px;
  color: var(--accent);
}

.special-hint {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #f97316;
}

.variant-box {
  margin-top: 6px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px dashed rgba(15, 23, 42, 0.18);
  border-radius: 10px;
}

.variant-line {
  font-size: 12px;
  color: #334155;
  line-height: 1.4;
}

/* 盒马风格：图右下角 qty 控件 */
.product-qty-ctrl {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(229, 231, 235, 0.9);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
  z-index: 6;
}

.product-qty-ctrl .qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.product-qty-ctrl .qty-btn:active {
  transform: scale(0.98);
}

.product-qty-ctrl .qty-num {
  min-width: 22px;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  color: #16a34a;
}

@media (max-width: 480px) {
  .product-qty-ctrl {
    right: 10px;
    bottom: 10px;
    padding: 5px;
    gap: 5px;
  }
  .product-qty-ctrl .qty-btn {
    width: 26px;
    height: 26px;
    font-size: 17px;
  }
  .product-qty-ctrl .qty-num {
    font-size: 13px;
  }
}

/* 手机强制 2 列（你首页 5 个区块 id） */
@media (max-width: 768px) {
  #productGridHot,
  #productGridDaily,
  #productGridNew,
  #productGridBest,
  #productGridNormal {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  #productGridHot .product-card,
  #productGridDaily .product-card,
  #productGridNew .product-card,
  #productGridBest .product-card,
  #productGridNormal .product-card {
    width: 100% !important;
    min-width: 0 !important;
  }
}

/* 骨架屏 */
.product-card.skeleton {
  overflow: hidden;
}

.skeleton-img,
.skeleton-line,
.skeleton-tag {
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 37%, #e5e7eb 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
  border-radius: 8px;
}

.skeleton-img {
  aspect-ratio: 4 / 3;
  margin-bottom: 6px;
}

.skeleton-line {
  height: 10px;
  margin-bottom: 6px;
}

.skeleton-tag {
  width: 40%;
  height: 8px;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

/* =========================
   购物车抽屉（最终权威版）
   ========================= */
#cartBackdrop.cart-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  display: none;
  z-index: 25000;
}

#cartBackdrop.cart-drawer-backdrop.active {
  display: block;
}

#cartBackdrop.cart-drawer-backdrop:not(.active) {
  pointer-events: none;
}

#cartDrawer.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  max-width: 90vw;
  height: 100%;
  background: #fff;
  box-shadow: -2px 0 10px rgba(15, 23, 42, 0.2);
  transform: translateX(100%);
  transition: transform 0.22s ease-out;
  z-index: 26000;
  display: flex;
  flex-direction: column;
}

#cartDrawer.cart-drawer.active {
  transform: translateX(0);
}

.cart-header {
  padding: 12px 14px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-title {
  font-size: 15px;
  font-weight: 600;
}

.cart-close {
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
}

.cart-body {
  flex: 1;
  padding: 10px 14px;
  overflow-y: auto;
  font-size: 13px;
}

.cart-empty {
  font-size: 13px;
  color: var(--text-sub);
  margin-top: 20px;
  text-align: center;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #f3f4f6;
}

.cart-item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cart-item-name {
  font-size: 13px;
}

.cart-item-sub {
  font-size: 11px;
  color: var(--text-sub);
}

.cart-item-right {
  text-align: right;
  font-size: 12px;
}

.cart-remove {
  font-size: 11px;
  color: #ef4444;
  cursor: pointer;
}

.cart-footer {
  border-top: 1px solid #e5e7eb;
  padding: 10px 14px 12px;
  font-size: 13px;
}

.line {
  display: flex;
  justify-content: space-between;
  margin: 4px 0;
}

.line-total {
  font-weight: 700;
  font-size: 14px;
}

.shipping-modes {
  margin-top: 6px;
  font-size: 12px;
}

.mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.mode-pill-small {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  font-size: 11px;
}

.mode-pill-small input {
  margin: 0;
}

.mode-hint-small {
  font-size: 11px;
  color: var(--text-sub);
  margin-top: 4px;
}

.group-size-select {
  margin-top: 4px;
  font-size: 11px;
}

.group-size-select select {
  font-size: 11px;
  padding: 2px 6px;
}

.btn-checkout {
  margin-top: 8px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.btn-checkout:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.footer-note {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-sub);
}

/* 抽屉内数量按钮放大（不影响 goCartBtn） */
#cartDrawer button:not(#goCartBtn) {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  padding: 0 !important;
  font-size: 22px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  border-radius: 10px !important;
  border: 1px solid #d1d5db !important;
  background: #fff !important;
  color: #111827 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#cartDrawer button:not(#goCartBtn):hover {
  background: #f3f4f6 !important;
  border-color: #9ca3af !important;
}

#cartDrawer input[type="number"],
#cartDrawer input[type="text"] {
  height: 36px !important;
  width: 40px !important;
  text-align: center !important;
  font-size: 18px !important;
  font-weight: 900 !important;
  border-radius: 10px !important;
  border: 1px solid #e5e7eb !important;
  background: #f9fafb !important;
  margin: 0 8px !important;
}

/* 购物车图标抖动 */
@keyframes cart-shake {
  0% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-4px);
  }
  40% {
    transform: translateX(4px);
  }
  60% {
    transform: translateX(-3px);
  }
  80% {
    transform: translateX(3px);
  }
  100% {
    transform: translateX(0);
  }
}

.cart-icon.shake {
  animation: cart-shake 0.35s ease;
}

/* toast */
.add-cart-toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(-16px);
  background: #111827;
  color: #f9fafb;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 9999;
  white-space: nowrap;
}

.add-cart-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =========================
   登录/注册弹窗（最终权威版）
   结构：#authBackdrop.auth-backdrop > .auth-card
   ========================= */
#authBackdrop.auth-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2, 6, 23, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#authBackdrop.auth-backdrop.active {
  display: flex;
}

#authBackdrop .auth-card {
  width: min(92vw, 460px);
  border-radius: 22px;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 18px 60px rgba(15, 23, 42, 0.35);
  overflow: hidden;

  /* ✅ iOS 键盘：外层不滚动，内部滚动 */
  max-height: calc(var(--vvh, 100vh) - 24px);
  display: flex;
  flex-direction: column;
}

/* Header */
#authBackdrop .auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  background: linear-gradient(
    135deg,
    rgba(34, 197, 94, 0.18),
    rgba(34, 197, 94, 0.06)
  );
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

#authBackdrop .auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

#authBackdrop .auth-logo {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  background: radial-gradient(circle at 30% 30%, #22c55e, #16a34a);
  box-shadow: 0 10px 24px rgba(34, 197, 94, 0.25);
}

#authBackdrop .auth-brand-title {
  font-size: 18px;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: 0.2px;
}

#authBackdrop .auth-brand-sub {
  margin-top: 2px;
  font-size: 12px;
  color: #64748b;
}

#authBackdrop .auth-close {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: rgba(255, 255, 255, 0.9);
  color: #64748b;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#authBackdrop .auth-close:active {
  transform: translateY(1px);
}

/* Tabs */
#authBackdrop .auth-tabs {
  margin: 12px 16px 8px;
  padding: 4px;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid rgba(226, 232, 240, 0.9);
  display: flex;
  gap: 6px;
}

#authBackdrop .auth-tab {
  flex: 1;
  height: 36px;
  border-radius: 999px;
  border: none;
  background: transparent;
  font-weight: 900;
  font-size: 13px;
  color: #64748b;
}

#authBackdrop .auth-tab.active {
  background: #fff;
  color: #16a34a;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(226, 232, 240, 0.9);
}

/* Body（内部滚动） */
#authBackdrop .auth-body {
  padding: 6px 16px 16px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* 字段 */
#authBackdrop .auth-field {
  display: block;
  margin-top: 10px;
}

#authBackdrop .auth-label {
  font-size: 12px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
}

/* 输入框 + icon + eye */
#authBackdrop .auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

#authBackdrop .auth-input-ico {
  position: absolute;
  left: 12px;
  font-size: 14px;
  opacity: 0.75;
  pointer-events: none;
  transform: translateY(-1px);
}

#authBackdrop .auth-input {
  width: 100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: #f8fafc;
  font-size: 16px; /* ✅ iOS 不缩放 */
  outline: none;
  padding-left: 38px;
  padding-right: 44px;
}

#authBackdrop .auth-input:focus {
  background: #fff;
  border-color: rgba(34, 197, 94, 0.75);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
}

#authBackdrop .auth-eye {
  position: absolute;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: rgba(255, 255, 255, 0.9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  color: #64748b;
}

#authBackdrop .auth-eye:active {
  transform: translateY(1px);
}

#authBackdrop .auth-eye.is-on {
  color: #16a34a;
  border-color: rgba(34, 197, 94, 0.55);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
}

#authBackdrop .auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

#authBackdrop .auth-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #64748b;
}

#authBackdrop .auth-link {
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  color: #16a34a;
  padding: 6px 8px;
}

#authBackdrop .auth-primary {
  width: 100%;
  height: 46px;
  margin-top: 12px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  font-weight: 900;
  letter-spacing: 0.2px;
  box-shadow: 0 14px 30px rgba(34, 197, 94, 0.24);
}

#authBackdrop .auth-primary:active {
  transform: translateY(1px);
  box-shadow: 0 10px 24px rgba(34, 197, 94, 0.2);
}

#authBackdrop .auth-footnote {
  margin-top: 10px;
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
}

#authBackdrop .auth-footnote-link {
  color: #2563eb;
  font-weight: 800;
}

/* 锁滚动（打开弹窗时 JS 加 modal-open） */
html.modal-open,
body.modal-open {
  overflow: hidden !important;
  height: 100% !important;
}

body.modal-open {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
}

/* ✅ 防止 modal-open 和 kb-open 打架：modal-open 优先 */
body.modal-open.kb-open {
  position: fixed !important;
  overflow: hidden !important;
}

/* 小屏更贴合 */
@media (max-width: 420px) {
  #authBackdrop .auth-card {
    width: 94vw;
  }
  #authBackdrop .auth-header {
    padding: 12px 14px 10px;
  }
  #authBackdrop .auth-tabs {
    margin: 10px 14px 6px;
  }
  #authBackdrop .auth-body {
    padding: 6px 14px 14px;
  }
}

/* =========================
   FIX: sort-row / footer 超宽（保留你原逻辑）
   ========================= */
.sort-row {
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box;
  flex-wrap: wrap !important;
  min-width: 0 !important;
}

.sort-row > * {
  min-width: 0 !important;
  max-width: 100% !important;
}

@media (max-width: 768px) {
  .sort-row button,
  .sort-row .pill,
  .sort-row .sort-pill,
  .sort-row select {
    max-width: 100% !important;
  }

  footer,
  .footer,
  .footer-inner,
  .footer-wrap,
  .footer-delivery {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
    box-sizing: border-box;
  }

  .footer,
  .footer-inner,
  .footer-wrap {
    display: block !important;
  }

  .footer-delivery,
  .footer-section-title,
  .footer-text {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  .footer-text,
  .footer-text.footer-en {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }
}

/* =========================================================
   ✅ Freshbuy Global Patch Layer（全站通用兜底层）
   文件：frontend/user/assets/css/main.css
   位置：粘贴到最底部（最后一行）
   作用：不同页面 DOM 命名不一致也能生效
   ========================================================= */

/* ---------------------------
   1) 商品卡 hover overlay 兼容
   兼容：.product-image-wrap / .product-img-wrapper / .img-wrap
---------------------------- */
.product-image-wrap:hover .product-overlay,
.product-img-wrapper:hover .product-overlay,
.img-wrap:hover .product-overlay {
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* overlay 默认状态兜底（防止某页没写） */
.product-overlay {
  opacity: 0;
  pointer-events: none;
}

/* ---------------------------
   2) 商品网格 2列兜底（手机）
   兼容各种 grid 容器命名：.product-grid / .grid / #dailyGrid / #categoryGrid
---------------------------- */
@media (max-width: 768px) {
  .product-grid,
  .products-grid,
  .grid-products,
  #dailyGrid,
  #categoryGrid,
  #productGrid,
  #productListGrid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .product-grid .product-card,
  .products-grid .product-card,
  .grid-products .product-card,
  #dailyGrid .product-card,
  #categoryGrid .product-card,
  #productGrid .product-card,
  #productListGrid .product-card {
    width: 100% !important;
    min-width: 0 !important;
  }
}

/* ---------------------------
   3) 购物车抽屉层级/点击兜底
   兼容：#cartBackdrop/#cartDrawer 或 .cart-drawer-backdrop/.cart-drawer
---------------------------- */
#cartBackdrop,
.cart-drawer-backdrop {
  z-index: 25000 !important;
}

#cartDrawer,
.cart-drawer {
  z-index: 26000 !important;
}

#cartDrawer *,
.cart-drawer * {
  pointer-events: auto !important;
}

/* ---------------------------
   4) 登录/注册弹窗（全站兜底）
   兼容：#authBackdrop、#loginModal、#authModal、.modal-mask、.auth-modal
---------------------------- */
#authBackdrop,
#loginModal,
#authModal,
.login-modal,
.auth-modal,
.modal-mask,
.modal-backdrop,
.auth-overlay,
.modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 10000 !important;
}

/* 这些弹窗容器如果加 active 才显示（兼容你不同页面写法） */
#authBackdrop.active,
#loginModal.active,
#authModal.active,
.login-modal.active,
.auth-modal.active,
.modal-mask.active,
.modal-backdrop.active {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* 弹窗卡片兜底（不同页面常见命名） */
#authBackdrop .auth-card,
#authBackdrop .login-modal,
#loginModal .card,
#authModal .card,
.login-box,
.login-card,
.modal-card,
.auth-card {
  width: min(92vw, 460px) !important;
  max-height: calc(var(--vvh, 100vh) - 24px) !important;
  overflow: auto !important;
  -webkit-overflow-scrolling: touch !important;
  border-radius: 18px !important;
  background: #fff !important;
  box-shadow: 0 18px 60px rgba(15, 23, 42, 0.35) !important;
}

/* iOS 输入框字体>=16，避免自动放大导致布局抖/溢出 */
#authBackdrop input,
#loginModal input,
#authModal input,
.login-modal input,
.auth-modal input {
  font-size: 16px !important;
}

/* 打开弹窗锁滚动（你 JS 只要加 body.classList.add('modal-open')） */
html.modal-open,
body.modal-open {
  overflow: hidden !important;
  height: 100% !important;
}

body.modal-open {
  position: fixed !important;
  left: 0;
  right: 0;
  width: 100%;
}

/* ---------------------------
   5) 横向溢出终极兜底（多页面共用）
---------------------------- */
html,
body,
#app {
  overflow-x: hidden !important;
  max-width: 100% !important;
}

img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
}
/* ---------------------------
   6) footer 超宽兜底（多页面）
---------------------------- */
@media (max-width: 768px) {
  footer,
  .footer,
  .footer-inner,
  .footer-wrap {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }

  .footer-text,
  .footer-text.footer-en {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }
}
/* ✅ iOS 输入框：小于16px会自动放大(zoom)，很容易造成页面溢出 */
#globalSearchInput,
#zipInput,
#zipInputRight {
  font-size: 16px !important;
}
/* ✅ 终极兜底：如果 input 用的是 id=globalSearchInput */
#globalSearchInput{
  color:#111827 !important;
  caret-color:#111827 !important;
  -webkit-text-fill-color:#111827 !important;
  opacity:1 !important;
}
/* ✅ 防止键盘/滚动引起横向溢出 */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}
.banner-chip{
  display:inline-flex;
  align-items:center;
  padding:8px 12px;
  border-radius:999px;
  background: rgba(0,0,0,.18);
  border: 1px solid rgba(255,255,255,.22);
  color:#fff;
  text-decoration:none;
  font-weight:700;
  font-size:13px;
  margin-right:10px;
}
.banner-chip:hover{ opacity:.92; }
/* =========================
   Banner 可点击标签/按钮（带链接）
   放 main.css 最底部
   ========================= */
.banner-chip{
  display:inline-flex;
  align-items:center;
  padding:8px 12px;
  border-radius:999px;
  background: rgba(0,0,0,.18);
  border: 1px solid rgba(255,255,255,.22);
  color:#fff;
  text-decoration:none;
  font-weight:700;
  font-size:13px;
  margin-right:10px;
}
.banner-chip:hover{ opacity:.92; }
