:root {
  --bg-page: #f5f7fb;
  --bg-card: #ffffff;
  --bg-soft: #f8fafc;
  --border: #e5eaf2;
  --border-strong: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  /* 克制航海色板：海军深蓝主色 + 微量暖金细节点缀 */
  --navy-deep: #102347;
  --navy: #1e3a8a;
  --navy-bright: #2546a8;
  --navy-hover: #172e6e;
  --navy-tint: #eef3ff;
  --navy-border: #c5d4f7;
  --gold: #d97706;
  --gold-line: #f59e0b;
  --gold-soft: #fef3c7;
  --gold-border: #fde68a;
  --teal: #0f766e;
  --teal-tint: #f0fdfa;
  --green: #059669;
  --red: #b91c1c;
  --red-tint: #fef2f2;
  --radius-lg: 14px;
  --radius-md: 10px;
  --shadow-card: 0 1px 2px rgba(15, 35, 71, 0.04), 0 4px 12px rgba(15, 35, 71, 0.025);
  --shadow-hover: 0 8px 20px rgba(30, 58, 138, 0.09);
  /* 兼容本地管理员 /cards 样式变量 */
  --border-light: #e5eaf2;
  --primary: #1e3a8a;
  --text-main: #0f172a;
  --shadow-sm: 0 1px 3px rgba(15, 35, 71, 0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-padding-top: 96px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1260px;
  margin: 0 auto;
  padding: 0 18px;
}

.hidden {
  display: none !important;
}

/* 1. 紧凑一体化顶栏（桌面单行融合搜索，窄屏自动两行，零右侧溢出） */
.topbar,
.site-header {
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(245, 158, 11, 0.08);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-main {
  min-height: 60px;
  padding-top: 8px;
  padding-bottom: 8px;
  display: grid;
  grid-template-columns: auto minmax(260px, 480px) auto;
  align-items: center;
  gap: 16px;
}

/* 桌面端让 brand 与 header-actions 分别居左右两侧，搜索居中 */
.brand-row {
  display: contents;
}

.brand,
.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--navy-deep);
  min-width: 0;
}

.brand-crest,
.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--navy-deep), var(--navy-bright));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(30, 58, 138, 0.18);
}

.brand-title,
.logo-text strong {
  font-size: 15.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.logo-text {
  display: flex;
  flex-direction: column;
}
.logo-text span {
  font-size: 11.5px;
  color: var(--text-muted);
}

.compact-search {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  background: var(--bg-soft);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 3px 4px 3px 11px;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

.compact-search:focus-within {
  background: #fff;
  border-color: var(--navy-bright);
  box-shadow: 0 0 0 3px rgba(37, 70, 168, 0.1);
}

.search-icon {
  color: var(--text-muted);
  display: inline-flex;
  flex-shrink: 0;
}

#searchInput {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 13.5px;
  color: var(--text-primary);
  font-family: inherit;
}

#searchInput:focus {
  outline: none;
}

#searchInput::placeholder {
  color: #94a3b8;
}

.clear-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: #e2e8f0;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.search-btn {
  height: 32px;
  padding: 0 14px;
  border-radius: 7px;
  border: none;
  background: var(--navy);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  transition: background-color 0.15s;
}

.search-btn:hover {
  background: var(--navy-hover);
}

.header-actions,
.header-links {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.hdr-btn {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}

.hdr-btn:hover,
.hdr-btn.active {
  border-color: var(--navy-border);
  background: var(--navy-tint);
  color: var(--navy);
}

.hdr-badge {
  font-size: 11px;
  background: rgba(30, 58, 138, 0.12);
  color: var(--navy);
  padding: 0 5px;
  border-radius: 999px;
}

.hdr-time-btn {
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-muted);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  white-space: nowrap;
}

.hdr-time-btn:hover {
  border-color: var(--navy-border);
  color: var(--navy);
}

.time-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

.info-i {
  font-size: 11px;
  opacity: 0.75;
}

.freshness-detail {
  background: #f8fafc;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}

.freshness-detail-inner {
  padding-top: 7px;
  padding-bottom: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.text-close-btn {
  border: none;
  background: none;
  color: var(--navy);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

/* 兼容本地管理员 /cards 头部样式 */
.header-inner {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.store-chip,
.nav-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
}
.chip-liandong,
.nav-pill-accent {
  background: var(--navy-tint);
  border-color: var(--navy-border);
  color: var(--navy);
}
.chip-16688 {
  background: var(--teal-tint);
  color: var(--teal);
}

/* 2. 主体区与单行清晰分类条 */
.hall-main {
  padding-top: 12px;
  padding-bottom: 44px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.category-row-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 6px 8px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.category-row {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

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

.cat-tab {
  flex: 0 0 auto;
  border: 1px solid #e4ebf5;
  background: #f8fafd;
  color: #334155;
  padding: 7px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  position: relative;
  transition:
    color 0.16s ease,
    background-color 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.cat-tab-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  color: #3b5998;
  opacity: 0.88;
  transition: color 0.16s ease, transform 0.16s ease;
}

.cat-tab:hover {
  background: #ffffff;
  border-color: #9cb4e6;
  color: var(--navy);
  box-shadow: 0 3px 10px rgba(30, 58, 138, 0.08);
  transform: translateY(-1px);
}

.cat-tab:hover .cat-tab-icon {
  color: var(--navy);
  transform: scale(1.06);
}

.cat-tab.active {
  background: linear-gradient(135deg, #102a46 0%, #1d426c 100%);
  border-color: #102a46;
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(16, 42, 70, 0.22);
}

.cat-tab.active .cat-tab-icon {
  color: #f6d384;
  opacity: 1;
}

/* 激活分类底部暖金高光细线 */
.cat-tab.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #f59e0b, #fde68a);
}

.cat-tab-count {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  color: #475569;
}

.cat-tab.active .cat-tab-count {
  background: rgba(255, 255, 255, 0.18);
  color: #fde68a;
}

/* 3. 二级细分条与紧凑控制栏 */
.subfamily-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 1px;
}

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

.subfamily-pill {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.subfamily-pill:hover {
  border-color: var(--navy-border);
  color: var(--navy);
}

.subfamily-pill.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.subfamily-pill .sf-num {
  font-size: 11px;
  opacity: 0.8;
  margin-left: 3px;
}

/* 渐进分层筛选栏：独立交付方式 + 套餐 + 有意义的更细档位 */
.layered-filter-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px 11px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  box-shadow: 0 1px 2px rgba(15, 35, 71, 0.03);
}

.facet-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 2px 0;
}

.facet-row + .facet-row:not(.hidden) {
  border-top: 1px dashed #edf1f7;
  padding-top: 6px;
}

.facet-row-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.facet-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  min-width: 0;
  padding: 2px 1px;
  scrollbar-width: none;
}

.facet-pills::-webkit-scrollbar {
  display: none;
}

.facet-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 29px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.facet-pill:hover {
  border-color: var(--navy-border);
  background: #fff;
  color: var(--navy);
}

.facet-pill[aria-pressed="true"],
.facet-pill.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.facet-pill.is-zero:not(.active) {
  opacity: 0.52;
}

.facet-pill-count {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.82;
}

.cat-tab:focus-visible,
.facet-pill:focus-visible,
.sort-pill:focus-visible,
.seg-btn:focus-visible,
.cond-chip:focus-visible,
.filter-trigger-btn:focus-visible,
.g-fav-btn:focus-visible,
.g-detail-btn:focus-visible,
.g-buy-btn:focus-visible {
  outline: 2.5px solid var(--navy-bright);
  outline-offset: 2px;
}

/* 顶栏真实草帽头像与登录态视觉优化 */
.voyage-crest-wrap {
  display: inline-flex;
  flex-shrink: 0;
  line-height: 0;
}

.voyage-crest {
  display: block;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  object-fit: cover;
  background: #132c42;
  box-shadow: 0 2px 8px rgba(8, 22, 38, 0.35);
}

.voyage-brand strong,
.voyage-brand small {
  white-space: nowrap;
}

.buyer-entry.is-logged-in {
  background: #f6e0b3;
  border-color: #fff1cf;
  color: #102638;
}

.control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 2px 2px;
}

.sort-group {
  display: flex;
  align-items: center;
  gap: 3px;
}

.sort-pill {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}

.sort-pill:hover {
  color: var(--navy);
}

.sort-pill.active {
  background: #fff;
  border-color: var(--border);
  color: var(--navy);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.control-right {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.shop-seg {
  display: inline-flex;
  background: #e9eef6;
  border-radius: 8px;
  padding: 2px;
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.seg-btn.active {
  background: #fff;
  color: var(--navy);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.stock-switch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.stock-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: #cbd5e1;
  position: relative;
  transition: background-color 0.16s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.16s ease;
}

.stock-switch input:checked + .switch-track {
  background: var(--navy-bright);
}

.stock-switch input:checked + .switch-track::after {
  transform: translateX(14px);
}

.filter-trigger-btn {
  height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.filter-trigger-btn:hover,
.filter-trigger-btn.active {
  border-color: var(--navy-border);
  color: var(--navy);
  background: var(--navy-tint);
}

.filter-count-dot {
  background: var(--gold);
  color: #fff;
  font-size: 10.5px;
  padding: 0 5px;
  border-radius: 999px;
}

.result-count {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

/* 4. 按需展开规格筛选面板 */
.adv-filter-panel {
  background: var(--bg-card);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  padding: 15px 16px;
  box-shadow: var(--shadow-hover);
}

.adv-grid {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.adv-block {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: start;
  gap: 10px;
}

.adv-block-split {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.adv-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  padding-top: 4px;
  display: block;
}

.adv-block-split .adv-label {
  padding-top: 0;
  margin-bottom: 5px;
}

.adv-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.adv-pill {
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 7px;
  cursor: pointer;
}

.adv-pill.active {
  background: var(--navy-tint);
  border-color: var(--navy-border);
  color: var(--navy);
  font-weight: 600;
}

.price-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.price-inputs input {
  width: 78px;
  height: 30px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--border);
  font-size: 12px;
  background: var(--bg-soft);
}

.price-quick {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.price-quick.active {
  background: var(--navy-tint);
  border-color: var(--navy-border);
  color: var(--navy);
  font-weight: 600;
}

.adv-select {
  height: 30px;
  min-width: 200px;
  max-width: 100%;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--border);
  font-size: 12px;
  background: var(--bg-soft);
  color: var(--text-primary);
}

.adv-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.active-conditions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.active-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cond-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--navy-border);
  color: var(--navy);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.active-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.link-action {
  border: none;
  background: none;
  color: var(--navy);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.link-danger {
  color: var(--text-muted);
}

/* 5. 商品卡网格 */
@keyframes cardFadeUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.product-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.g-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-shadow: var(--shadow-card);
  animation: cardFadeUp 0.2s ease-out both;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.g-card:hover {
  transform: translateY(-2px);
  border-color: var(--navy-border);
  box-shadow: var(--shadow-hover);
}

.g-card.is-out {
  opacity: 0.68;
}

.g-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.g-store-badge {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.g-fav-btn {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.g-fav-btn.is-fav {
  background: #fffbeb;
  color: var(--gold);
}

.g-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 11px 13px 12px;
  min-width: 0;
}

.g-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
  min-height: calc(1.4em * 2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  cursor: pointer;
}

.g-title:hover {
  color: var(--navy);
}

/* 克制单行规格与库存摘要（最多凸显 2-3 个关键事实，不堆满排药丸） */
.g-meta-row {
  margin-top: 6px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
}

.g-stock-text {
  font-weight: 600;
  flex-shrink: 0;
}

.g-stock-in_stock {
  color: var(--green);
}

.g-stock-unknown {
  color: var(--gold);
}

.g-stock-out_of_stock {
  color: var(--text-muted);
}

.g-dot-sep {
  color: #cbd5e1;
  flex-shrink: 0;
}

.g-key-spec {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.g-warn-mark {
  color: var(--gold);
  font-weight: 600;
  flex-shrink: 0;
}

.g-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #f1f4f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.g-price-wrap {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
}

.g-price {
  color: var(--navy);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  white-space: nowrap;
}

.g-price .yen {
  font-size: 13px;
  font-weight: 700;
  margin-right: 1px;
}

.g-min-tag {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--gold);
  background: var(--gold-soft);
  padding: 0 4px;
  border-radius: 3px;
  white-space: nowrap;
}

.g-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.g-detail-btn {
  height: 31px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.g-detail-btn:hover {
  border-color: var(--navy-border);
  color: var(--navy);
}

.g-buy-btn {
  height: 31px;
  padding: 0 12px;
  border-radius: 7px;
  background: var(--navy);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: background-color 0.15s;
}

.g-buy-btn:hover {
  background: var(--navy-hover);
}

.g-buy-btn.is-muted {
  background: #64748b;
}

/* 6. 按需展开的商品详情弹窗 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.detail-modal {
  width: 100%;
  max-width: 620px;
  max-height: 86vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-store-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--navy-tint);
  color: var(--navy);
}

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.modal-title {
  font-size: 16.5px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.45;
}

.modal-price-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 11px 14px;
  flex-wrap: wrap;
}

.modal-facts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.fact-cell {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fact-cell span {
  font-size: 11px;
  color: var(--text-muted);
}

.fact-cell strong,
.fact-cell code {
  font-size: 12.5px;
  color: var(--text-primary);
  word-break: break-all;
}

.drawer-conflict {
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  color: var(--gold);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
}

.drawer-desc {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px 13px;
}

.drawer-desc-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.drawer-desc ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}

.modal-footer-btns {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* 通用按钮、状态提示、分页与页脚 */
.btn-navy,
.btn-primary {
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 15px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-navy:hover {
  background: var(--navy-hover);
}

.btn-ghost {
  background: #fff;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.state-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 34px 18px;
  text-align: center;
}

.state-error {
  background: var(--red-tint);
  border-color: #fecaca;
  color: var(--red);
  padding: 20px 18px;
}

.empty-title {
  font-size: 15.5px;
  font-weight: 700;
  margin-bottom: 5px;
}

.empty-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.empty-btns {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.folded-bar {
  background: #fff;
  border: 1px dashed var(--border-strong);
  border-radius: 9px;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.pagination {
  margin-top: 6px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

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

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

.footer {
  border-top: 1px solid var(--border);
  background: #fff;
  padding: 18px 0;
  font-size: 12px;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.footer-left strong {
  color: var(--navy-deep);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.footer-links a,
.footer-cs-btn {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}

.footer-links a:hover,
.footer-cs-btn:hover {
  color: var(--navy);
}

.btn-as-link {
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
}

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy-deep);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(15, 35, 71, 0.25);
  z-index: 140;
}

.mobile-only-flex,
.mobile-only-inline,
.filter-backdrop {
  display: none;
}

/* 响应式：中等屏 3 列，平板 2 列，窄屏手机 (390px / 360px) 紧凑不裁切 */
@media (max-width: 1120px) {
  .product-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .topbar-main {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-width: 0;
  }

  .product-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  html,
  body {
    overflow-x: hidden;
    max-width: 100%;
  }

  .container {
    padding: 0 10px;
    max-width: 100%;
  }

  .topbar-main {
    padding-top: 7px;
    padding-bottom: 7px;
    gap: 7px;
  }

  .brand {
    gap: 6px;
  }

  .brand-crest {
    width: 28px;
    height: 28px;
    border-radius: 7px;
  }

  .brand-title {
    font-size: 13.5px;
  }

  .brand-context {
    display: none;
  }

  .header-actions {
    gap: 4px;
    flex-shrink: 0;
  }

  .hdr-btn {
    height: 27px;
    padding: 0 6px;
    font-size: 11px;
    border-radius: 6px;
    gap: 3px;
  }

  .topbar .hdr-time-btn {
    min-width: 36px;
    min-height: 38px;
    padding: 0 8px;
    justify-content: center;
  }

  .topbar .hdr-btn {
    min-height: 38px;
    padding: 0 7px;
    font-size: 12px;
  }

  .time-dot {
    display: none;
  }

  .compact-search {
    padding: 3px 4px 3px 10px;
    border-radius: 9px;
  }

  #searchInput {
    min-height: 36px;
    height: 36px;
    font-size: 13.5px;
  }

  .clear-btn {
    width: 30px;
    height: 30px;
    min-width: 30px;
  }

  .search-btn {
    min-height: 34px;
    height: 34px;
    min-width: 52px;
    padding: 0 12px;
    font-size: 12.5px;
  }

  .layered-filter-panel {
    padding: 5px 8px;
    border-radius: 10px;
    gap: 4px;
  }

  .facet-row {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 6px;
  }

  .facet-row-label {
    font-size: 11.5px;
  }

  .facet-pill {
    min-height: 30px;
    padding: 4px 10px;
    font-size: 12px;
  }

  .hall-main {
    padding-top: 8px;
    gap: 8px;
  }

  .category-row-wrap {
    padding: 4px 6px;
    border-radius: 10px;
  }

  .cat-tab {
    padding: 5px 9px;
    font-size: 12.5px;
    gap: 4px;
  }

  .control-bar {
    gap: 6px;
  }

  .sort-group {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .sort-group::-webkit-scrollbar {
    display: none;
  }

  .sort-pill {
    padding: 4px 8px;
    font-size: 12px;
  }

  .control-right {
    width: 100%;
    justify-content: space-between;
    gap: 4px;
  }

  .seg-btn {
    padding: 3px 6px;
    font-size: 11px;
  }

  .stock-switch {
    font-size: 11.5px;
  }

  .filter-trigger-btn {
    height: 27px;
    padding: 0 8px;
    font-size: 11.5px;
  }

  .result-count {
    font-size: 11.5px;
  }

  /* 手机端二级筛选弹出底部面板 */
  .filter-backdrop:not(.hidden) {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 80;
  }

  .adv-filter-panel:not(.hidden) {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 82vh;
    overflow-y: auto;
    border-radius: 16px 16px 0 0;
    border: none;
    z-index: 90;
    padding: 15px 14px 22px;
    box-shadow: 0 -8px 28px rgba(15, 23, 42, 0.2);
  }

  .mobile-only-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
  }

  .mobile-only-inline {
    display: inline-flex;
  }

  .adv-block {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  /* 窄屏单列，标题与购买入口占用整行可用宽度。 */
  .product-card-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
  }

  .g-body {
    padding: 10px 12px;
    justify-content: space-between;
  }

  .g-title {
    font-size: 13.5px;
    min-height: 0;
  }

  .g-meta-row {
    margin-top: 4px;
    font-size: 11.5px;
  }

  .g-footer {
    margin-top: 6px;
    padding-top: 6px;
    gap: 4px;
  }

  .g-price {
    font-size: 17.5px;
  }

  .g-detail-btn {
    height: 28px;
    padding: 0 7px;
    font-size: 11px;
  }

  .g-buy-btn {
    height: 28px;
    padding: 0 10px;
    font-size: 11.5px;
  }

  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .detail-modal {
    border-radius: 16px 16px 0 0;
  }

  .modal-facts-grid {
    grid-template-columns: 1fr;
  }
}

/* 超窄屏 (360px / 320px) 防品牌折行与触控区保护 */
@media (max-width: 385px) {
  .hide-narrow-xs {
    display: none;
  }

  .voyage-crest {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
  }

  .voyage-brand strong {
    font-size: 15px;
  }

  .voyage-brand small {
    display: none;
  }

  .topbar .header-actions {
    gap: 2px;
  }

  .topbar .hdr-btn {
    padding: 0 5px;
    font-size: 11.5px;
  }

  .topbar .hdr-time-btn {
    min-width: 34px;
    padding: 0 6px;
  }

  .buyer-entry {
    max-width: 78px;
    padding: 0 7px 0 5px;
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
