* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif;
  background: #f5f5f5;
  color: #333;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #fff;
  position: relative;
}

.view {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  padding-bottom: calc(56px + env(safe-area-inset-bottom));
}
.view.active { display: flex; }
.view#view-home { padding-bottom: calc(56px + env(safe-area-inset-bottom)); overflow: hidden; }
.overlay-view { position: absolute; inset: 0; z-index: 120; background: #f5f5f5; padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
.tab-bar.tab-bar-hidden { display: none !important; }

.home-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #f5f5f5;
}
/* 店铺头部 */
.shop-header {
  background: #fff;
  padding: 14px 14px 10px;
}
.shop-header-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.shop-avatar {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffe082, #ffb74d);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
  overflow: hidden;
}
.shop-avatar img { width: 100%; height: 100%; object-fit: cover; }
.shop-meta { flex: 1; min-width: 0; }
.shop-name { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.shop-stats { font-size: 12px; color: #999; }
.shop-badges { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.shop-badge {
  font-size: 11px;
  color: #ff6b00;
  border: 1px solid #ffcc80;
  background: #fff8f0;
  border-radius: 4px;
  padding: 2px 6px;
}

/* 火热条 */
.hot-strip {
  background: #fff;
  padding: 8px 14px;
  font-size: 13px;
  color: #ff6b00;
  border-top: 1px solid #f5f5f5;
}
.hot-strip.hidden { display: none; }

/* 团购标题卡 */
.group-title-card {
  background: #fff;
  margin: 8px 0;
  padding: 14px;
}
.group-title-main {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 8px;
}
.group-title-main .shop-prefix { color: #333; }
.group-announce {
  font-size: 14px;
  color: #e65100;
  line-height: 1.5;
  margin-bottom: 10px;
}
.pickup-box {
  background: #f1f8f4;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: #2e7d32;
  line-height: 1.5;
}
.pickup-box b { font-size: 15px; }
.group-tags { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.delivery-tag {
  font-size: 12px;
  color: #2e7d32;
  background: #e8f5e9;
  border-radius: 4px;
  padding: 3px 8px;
}

/* 跟团动态 */
.activity-card {
  background: #fff;
  margin: 0 0 8px;
  border-radius: 0;
  overflow: hidden;
}
.activity-card.hidden { display: none; }
.activity-head {
  background: linear-gradient(90deg, #ff9800, #ffb74d);
  color: #fff;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
}
.activity-head span { opacity: .9; font-weight: normal; }
.activity-list { padding: 0 14px; }
.activity-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid #f5f5f5;
}
.activity-item:last-child { border-bottom: none; }
.activity-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #666;
  flex-shrink: 0;
  overflow: hidden;
}
.activity-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.activity-body { flex: 1; min-width: 0; }
.activity-user { font-size: 13px; color: #333; }
.activity-user small { color: #999; margin-left: 6px; }
.activity-goods { font-size: 12px; color: #666; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-btn {
  flex-shrink: 0;
  background: linear-gradient(90deg, #66bb6a, #43a047);
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 6px 12px;
  font-size: 12px;
}

.shop-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #fff;
  position: relative;
}

/* 团购切换 */
.group-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
  z-index: 6;
}

.announce-line {
  padding: 10px 14px;
  background: #fffbeb;
  border-bottom: 1px solid #ffe082;
  flex-shrink: 0;
  font-size: 13px;
  color: #e65100;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.announce-line.hidden { display: none; }
.group-tab {
  flex: 1;
  height: 40px;
  border: 1px solid #e8e8e8;
  border-radius: 20px;
  background: #fafafa;
  color: #666;
  font-size: 13px;
  font-weight: 500;
  padding: 0 4px;
}
.group-tab.active {
  background: linear-gradient(90deg, #e8f5e9, #f1f8f4);
  border-color: #81c784;
  color: #2e7d32;
  font-weight: 700;
}

.side-nav.hidden {
  display: none;
}

.shop-layout.recommend-mode .main-panel {
  width: 100%;
}

.product-loading {
  text-align: center;
  padding: 32px 16px;
  color: #999;
  font-size: 14px;
}

.top-bar {
  flex-shrink: 0;
  height: 48px;
  line-height: 48px;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  background: #fff;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 0;
  z-index: 10;
}
.top-bar.with-back { display: flex; align-items: center; justify-content: center; }
.back-btn {
  position: absolute;
  left: 8px;
  border: none;
  background: none;
  font-size: 28px;
  line-height: 1;
  padding: 8px 12px;
  color: #333;
}

.side-nav {
  width: 92px;
  flex-shrink: 0;
  align-self: stretch;
  min-height: 0;
  height: auto;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  background: #f7f7f7;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.side-item {
  padding: 16px 6px;
  text-align: center;
  font-size: 13px;
  line-height: 1.35;
  color: #666;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background .15s;
}
.side-item.active {
  background: #fff;
  color: #333;
  font-weight: 600;
  border-left-color: #4caf50;
}
.side-emoji { display: block; font-size: 16px; margin-top: 4px; }

.main-panel {
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: auto;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  background: #fff;
}

.cat-section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px 14px 10px;
  font-size: 16px;
  font-weight: 700;
  background: #fff;
  border-bottom: 1px solid #f5f5f5;
}
.cat-section-header .list-count {
  color: #999;
  font-size: 12px;
  font-weight: normal;
}
.list-bottom-pad { height: 24px; }

.banner-carousel { background: #f0f0f0; flex-shrink: 0; }
.banner-carousel.hidden { display: none; }
.banner-viewport { overflow: hidden; width: 100%; }
.banner-track { display: flex; transition: transform .35s ease; will-change: transform; }
.banner-slide {
  min-width: 100%;
  flex-shrink: 0;
  display: block;
  position: relative;
  text-decoration: none;
  color: inherit;
}
.banner-slide img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
  background: #eee;
}
.banner-title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px 12px;
  font-size: 13px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.55));
}
.banner-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 8px 0 4px;
  background: #fff;
}
.banner-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ddd;
  border: none;
  padding: 0;
}
.banner-dot.active { background: #4caf50; width: 16px; border-radius: 3px; }

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 14px 10px;
  font-size: 16px;
  font-weight: 700;
  background: #fff;
  border-bottom: 1px solid #f5f5f5;
}
.muted { color: #999; font-size: 12px; font-weight: normal; }

.product-list { padding-bottom: 12px; }
.goods-row {
  display: flex;
  padding: 14px;
  border-bottom: 1px solid #f5f5f5;
  gap: 12px;
  align-items: stretch;
}
.goods-img {
  width: 88px;
  height: 88px;
  border-radius: 10px;
  object-fit: cover;
  background: #f5f5f5;
  flex-shrink: 0;
}
.goods-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; min-height: 88px; }
.goods-name {
  font-size: 15px;
  line-height: 1.45;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.goods-name-row { display: flex; gap: 6px; align-items: flex-start; }
.sku-tag {
  flex-shrink: 0;
  font-size: 10px;
  color: #ff6b00;
  border: 1px solid #ff6b00;
  border-radius: 4px;
  padding: 1px 4px;
}
.goods-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 8px; }
.price { color: #ff6b00; font-weight: 700; font-size: 20px; }
.price small { font-size: 12px; }
.price-from { font-size: 12px; margin-left: 2px; font-weight: normal; }
.cart-btn {
  background: linear-gradient(135deg, #66bb6a, #43a047);
  color: #fff;
  border: none;
  border-radius: 18px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  min-height: 36px;
  box-shadow: 0 2px 8px rgba(67,160,71,.25);
}
.cart-btn:active { transform: scale(.96); }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: #999;
}
.empty-state .icon { font-size: 40px; display: block; margin-bottom: 10px; }

.tab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  height: calc(56px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: #fff;
  border-top: 1px solid #eee;
  z-index: 100;
}
.tab {
  flex: 1;
  border: none;
  background: none;
  font-size: 11px;
  color: #999;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding-top: 4px;
}
.tab-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tab-icon svg {
  width: 22px;
  height: 22px;
}
.tab-label { line-height: 1; }
.tab.active { color: #4caf50; font-weight: 600; }
.badge {
  position: absolute;
  top: 2px;
  left: 50%;
  margin-left: 10px;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #f44336;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
}

.panel-body { flex: 1; overflow-y: auto; padding: 12px; -webkit-overflow-scrolling: touch; }
.card { background: #fff; border-radius: 12px; padding: 14px; margin-bottom: 12px; }

.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(56px + env(safe-area-inset-bottom));
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #fff;
  border-top: 1px solid #eee;
  z-index: 130;
}
.overlay-view.active ~ .tab-bar,
.tab-bar.tab-bar-hidden { display: none !important; }
.overlay-view.active .bottom-bar {
  bottom: env(safe-area-inset-bottom);
}
.bottom-bar.hidden { display: none; }

.btn-primary {
  background: #2e7d32;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 10px 24px;
  font-size: 15px;
}
.btn-block { width: 100%; margin-top: 8px; }
.btn-cart-secondary {
  flex: 1;
  background: #2e7d32;
  color: #fff;
  border: none;
  border-radius: 22px;
  padding: 12px;
  font-size: 15px;
}

.empty { text-align: center; padding: 48px 20px; color: #999; }
.empty .icon { font-size: 48px; display: block; margin-bottom: 12px; }

.cart-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f5f5f5; }
.qty-box { display: flex; align-items: center; gap: 8px; }
.qty-btn {
  width: 28px; height: 28px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  font-size: 16px;
}

.form-card label { display: block; margin-bottom: 12px; font-size: 14px; color: #666; }
.form-tip { font-size: 12px; color: #999; margin-top: 4px; }
.form-card input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  font-size: 15px;
}

.detail-banner { width: 100%; border-radius: 12px; margin-bottom: 12px; display: block; background: #eee; min-height: 200px; object-fit: cover; aspect-ratio: 1 / 1; }
.detail-banner-wrap {
  position: relative;
  margin-bottom: 12px;
  border-radius: 12px;
  overflow: hidden;
  background: #eee;
}
.detail-banner-wrap .detail-banner {
  margin-bottom: 0;
  border-radius: 0;
  width: 100%;
  min-width: 100%;
  flex-shrink: 0;
}
.detail-banner-track {
  display: flex;
  transition: transform .3s ease;
  will-change: transform;
}
.detail-banner-dots {
  position: absolute;
  left: 0; right: 0; bottom: 8px;
  display: flex;
  justify-content: center;
  gap: 5px;
  pointer-events: none;
}
.detail-banner-dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,.55);
}
.detail-banner-dots i.active { background: #fff; width: 14px; border-radius: 4px; }
.detail-section-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.detail-long-img { width: 100%; display: block; margin-bottom: 8px; border-radius: 8px; background: #f3f3f3; min-height: 40px; }
.detail-long-img.is-broken,
.detail-banner.is-broken { display: none !important; }
.detail-off-sale { margin-top: 10px; padding: 8px 12px; background: #fff3e0; color: #e65100; border-radius: 8px; font-size: 13px; }
.detail-price { color: #ff6b00; font-size: 24px; font-weight: 700; margin: 8px 0; }
.detail-title { font-size: 17px; font-weight: 600; line-height: 1.5; }
.detail-desc { color: #888; font-size: 13px; margin-top: 8px; }
.detail-imgs img { width: 100%; display: block; margin-bottom: 8px; border-radius: 8px; }
.detail-empty-img {
  padding: 28px 12px;
  text-align: center;
  color: #999;
  font-size: 13px;
  background: #f7f7f7;
  border-radius: 12px;
  margin-bottom: 12px;
}

.order-card {
  margin-bottom: 12px;
  padding: 14px;
}
.order-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.order-no {
  font-size: 12px;
  color: #888;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.status-badge {
  flex-shrink: 0;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #fff7e6;
  color: #fa8c16;
  font-weight: 600;
}
.status-badge.pending { background: #fff7e6; color: #fa8c16; }
.status-badge.unpaid { background: #fff1f0; color: #ff4d4f; }
.status-badge.confirmed,
.status-badge.shipped { background: #e6f7ff; color: #1890ff; }
.status-badge.cancelled,
.status-badge.failed { background: #f5f5f5; color: #999; }
.status-badge.refunded { background: #fce4ec; color: #c2185b; }
.status-badge.success,
.status-badge.paid { background: #f6ffed; color: #52c41a; }

.pickup-box {
  margin: 10px 0;
  padding: 12px;
  background: linear-gradient(135deg, #e8f5e9, #f1f8f4);
  border: 1px dashed #81c784;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.pickup-label { display: block; font-size: 12px; color: #2e7d32; }
.pickup-code {
  display: block;
  margin: 4px 0;
  font-size: 26px;
  font-weight: 800;
  color: #1b5e20;
  letter-spacing: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.2;
}
.pickup-hint { display: block; font-size: 11px; color: #66bb6a; }
.pickup-copy {
  flex-shrink: 0;
  border: 1px solid #81c784;
  background: #fff;
  color: #2e7d32;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
}

.order-line {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid #f5f5f5;
}
.order-line-img {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  background: #f0f0f0;
  flex-shrink: 0;
}
.order-line-img.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #bbb;
}
.order-line-body { flex: 1; min-width: 0; }
.order-line-name {
  font-size: 14px;
  font-weight: 500;
  color: #222;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-line-sku {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #999;
}
.order-line-meta {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #666;
}
.order-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border-top: 1px solid #f5f5f5;
  margin-top: 4px;
  padding-top: 10px;
}
.order-time { font-size: 12px; color: #999; }
.order-total { font-size: 15px; font-weight: 700; color: #ff4d4f; }
.order-total small { font-size: 12px; font-weight: 500; color: #666; margin-right: 4px; }

.my-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: #f5f5f5;
}
.my-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 28px 16px 36px;
  background: linear-gradient(135deg, #66bb6a, #43a047);
  color: #fff;
}
.my-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,.22);
  border: 2px solid rgba(255,255,255,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}
.my-user { min-width: 0; }
.my-name { font-size: 18px; font-weight: 700; line-height: 1.3; }
.my-desc { margin-top: 4px; font-size: 12px; opacity: .88; }
.my-body {
  flex: 1;
  min-height: 0;
  margin-top: -18px;
  padding-top: 0;
}
.my-stats {
  display: flex;
  margin-bottom: 12px;
  padding: 16px 0;
  box-shadow: 0 2px 10px rgba(0,0,0,.04);
}
.my-stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.my-stat-item b {
  font-size: 22px;
  font-weight: 700;
  color: #4caf50;
  line-height: 1.2;
}
.my-stat-item span {
  font-size: 12px;
  color: #999;
}
.order-list .empty-cta {
  display: inline-block;
  margin-top: 14px;
  color: #2e7d32;
  font-size: 14px;
  font-weight: 600;
  background: none;
  border: none;
  padding: 0;
}

/* legacy status class kept for safety */
.status { color: #f57f17; font-size: 12px; }
.status.confirmed, .status.shipped { color: #2e7d32; }

.mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
}
.sku-panel {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 201;
  max-height: 70vh;
  overflow-y: auto;
}
.sku-panel h3 { font-size: 16px; margin-bottom: 12px; }
.sku-opt {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid #eee;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
}
.sku-opt.active { border-color: #2e7d32; background: #e8f5e9; color: #2e7d32; }

.toast {
  position: fixed;
  left: 50%; top: 45%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,.75);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  z-index: 300;
  font-size: 14px;
}
.hidden { display: none !important; }
.load-more { text-align: center; padding: 16px; color: #999; font-size: 13px; }
.load-more.hidden { display: none; }

@media (min-width: 481px) {
  body { background: #e8e8e8; }
  #app { box-shadow: 0 0 24px rgba(0,0,0,.08); }
}
