/* =============================================================
   崽宝的空间 · 设计契约（唯一来源，请勿在文件外追加覆盖）
   画布：暖白纸感  /  文字：炭黑  /  强调：暗玫瑰  /  辅助：金棕
   间距 8pt，圆角统一 12/18px，网格画廊（非瀑布流）
   ============================================================= */
:root {
  --bg: #F4FBFA;
  --bg-elevated: #E8F9F6;
  --surface: #ffffff;
  --ink: #1F3532;
  --ink-soft: #4A6660;
  --muted: #7E9994;
  --line: #DCEDE8;
  --line-strong: #C8E8E2;
  --primary: #2E8B78;
  --primary-deep: #1F6B5C;
  --primary-soft: #DCF2F1;
  --gold: #6FA08C;
  --shadow: 0 8px 24px rgba(35, 84, 74, 0.08);
  --shadow-strong: 0 16px 40px rgba(35, 84, 74, 0.14);
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --nav-height: 76px;
  /* 标签选中下划线（红色） */
  --tab-underline: #E64340;
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(255, 255, 255, 0.75), transparent 60%),
    linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg) 100%);
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { border: 0; cursor: pointer; font: inherit; color: inherit; background: none; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
input, textarea, select { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--focus-ring, rgba(46, 139, 120, 0.28));
  outline-offset: 2px;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 12px; }

#app { min-height: 100vh; }
.page { min-height: 100vh; padding-bottom: calc(var(--nav-height) + 28px); }

/* ---------- 通用容器 ---------- */
.page-content,
.narrow-content {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 26px 20px 40px;
}
.narrow-content { max-width: 760px; }

.eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--accent-text, var(--gold));
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

/* ---------- 顶部栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-glass-92, rgba(244, 251, 250, 0.92));
  backdrop-filter: blur(14px);
}
.topbar-inner { max-width: 1120px; margin: 0 auto; }

.site-header-main {
  display: grid;
  grid-template-columns: minmax(180px, auto) minmax(300px, 520px) 1fr;
  align-items: center;
  gap: 24px;
}
.site-brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  display: inline-flex;
  width: 34px; height: 34px;
  align-items: flex-end; justify-content: center;
  gap: 3px; padding: 8px 7px;
  border-radius: 50%;
  background: var(--primary);
  transform: rotate(-8deg);
  flex: 0 0 auto;
}
.brand-mark i { width: 4px; border-radius: 4px; background: var(--bg-elevated); }
.brand-mark i:nth-child(1) { height: 9px; }
.brand-mark i:nth-child(2) { height: 15px; }
.brand-mark i:nth-child(3) { height: 11px; }
.brand-copy { display: grid; gap: 1px; min-width: 0; }
.brand-copy strong { font-size: 17px; letter-spacing: 0.05em; }
.brand-copy small { color: var(--muted); font-size: 11px; }
.header-aside { justify-self: end; text-align: right; color: var(--primary-deep); font-size: 12px; font-weight: 700; }
.header-aside small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 500; }

.search-row { display: flex; align-items: stretch; gap: 8px; width: 100%; }
.mode-button-wrap { position: relative; flex: 0 0 auto; }
.mode-button {
  display: flex; height: 100%; align-items: center; gap: 4px;
  padding: 0 12px; min-height: 42px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--primary-deep); font-size: 13px; font-weight: 700;
  background: var(--surface);
}
.mode-button svg { width: 13px; height: 13px; }
.mode-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
  min-width: 120px; padding: 5px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); box-shadow: var(--shadow-strong);
}
.mode-menu button {
  display: block; width: 100%; padding: 9px 10px;
  border-radius: 8px; text-align: left; font-size: 13px;
}
.mode-menu button:hover, .mode-menu button.active { color: var(--primary-deep); background: var(--primary-soft); }

.search-input-wrap {
  position: relative; display: flex; flex: 1; min-width: 0; align-items: center;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface);
}
.search-input {
  width: 100%; min-width: 0; padding: 12px 84px 12px 14px;
  border: 0; outline: 0; background: transparent; font-size: 13px;
}
.search-input::placeholder { color: var(--muted); }
.search-button {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  padding: 7px 14px; border-radius: 8px;
  color: #fff; font-size: 12px; font-weight: 700;
  background: var(--primary);
}
.search-button:hover { background: var(--primary-deep); }

.price-search { display: flex; flex: 1; align-items: center; gap: 8px; }
.price-input {
  position: relative; display: flex; flex: 1; min-width: 0; align-items: center;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
}
.price-input input { width: 100%; min-width: 0; padding: 12px 34px 12px 13px; border: 0; outline: 0; background: transparent; font-size: 13px; }
.price-input span { position: absolute; right: 10px; color: var(--muted); font-size: 12px; }
.price-search .search-button { position: static; transform: none; }

/* ---------- 分类筛选 ---------- */
.category-area { margin-top: 14px; }
.category-row, .subcategory-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.subcategory-row { margin-top: 8px; }
.filter-label {
  flex: 0 0 auto; color: var(--muted);
  font-size: 10px; font-weight: 800; letter-spacing: 0.14em;
}
.pill-row {
  display: flex; flex: 1; min-width: 0; gap: 7px;
  overflow-x: auto; scrollbar-width: none; padding-bottom: 2px;
}
.pill-row::-webkit-scrollbar { display: none; }
.pill {
  display: inline-flex; align-items: center;
  padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink-soft); font-size: 12px; font-weight: 600;
  white-space: nowrap; background: var(--surface);
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.pill:hover { color: var(--primary-deep); border-color: var(--line-strong); }
.pill.active { border-color: var(--primary); color: #fff; background: var(--primary); }
.subcategory-row .pill { padding: 5px 11px; font-size: 11px; }
.subcategory-row .pill.active { color: var(--primary-deep); background: var(--primary-soft); }

/* ---------- 目录标题 ---------- */
.catalog-heading {
  max-width: 640px; margin: 0 auto 26px; padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.catalog-heading h1 {
  margin: 0; font-size: clamp(24px, 3vw, 34px);
  font-weight: 800; letter-spacing: 0.01em;
}
.catalog-heading p { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }

/* ---------- 商品画廊（固定网格） ---------- */
.masonry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.product-wrap { min-width: 0; }
.product-card {
  display: flex; height: 100%; min-width: 0; flex-direction: column;
  overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.product-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-strong);
}
.product-image-wrap { position: relative; width: 100%; aspect-ratio: 1 / 0.75; overflow: hidden; background: var(--bg-elevated); }
.product-image-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.product-card:hover .product-image-wrap img { transform: scale(1.03); }
.card-open-icon {
  position: absolute; right: 10px; bottom: 10px;
  display: grid; width: 30px; height: 30px; place-items: center;
  border-radius: 50%; color: #fff; font-size: 14px;
  background: var(--ink-glass-65, rgba(31, 53, 50, 0.65));
  opacity: 0; transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.product-card:hover .card-open-icon { opacity: 1; transform: none; }
.product-info { display: flex; flex: 1; flex-direction: column; padding: 12px 14px 14px; }
.product-category {
  margin-bottom: 6px; color: var(--accent-text, var(--gold));
  font-size: 10px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
}
.product-name {
  display: -webkit-box; margin: 0 0 8px; min-height: 2.9em; overflow: hidden;
  font-size: 14px; font-weight: 700; line-height: 1.45;
  -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere;
}
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; max-height: 44px; overflow: hidden; }
.tag {
  max-width: 100%; padding: 3px 8px; border-radius: 999px;
  overflow: hidden; color: var(--primary-deep); font-size: 11px;
  text-overflow: ellipsis; white-space: nowrap; background: var(--primary-soft);
}
.product-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: auto; }
.price { color: var(--primary-deep); font-size: 17px; font-weight: 800; }
.price small { font-size: 12px; font-weight: 600; }
.product-open-label { color: var(--muted); font-size: 11px; white-space: nowrap; }
.product-open-label b { color: var(--primary); font-size: 13px; }

/* ---------- 加载 / 空态 ---------- */
.loading-state, .empty-state { padding: 70px 20px; color: var(--muted); text-align: center; }
.loading-state::before {
  display: block; width: 26px; height: 26px; margin: 0 auto 12px;
  border: 3px solid var(--line); border-top-color: var(--primary);
  border-radius: 50%; content: ""; animation: spin 0.8s linear infinite;
}
.empty-icon { margin-bottom: 12px; font-size: 44px; }
.load-more {
  display: block; margin: 22px auto 0; padding: 10px 24px;
  border: 1px solid var(--line); border-radius: 999px;
  color: var(--primary-deep); font-size: 13px; font-weight: 700; background: var(--surface);
}
.load-more:hover { border-color: var(--primary); }

/* ---------- 底部导航 ---------- */
.bottom-nav {
  position: fixed; right: 0; bottom: 0; left: 0; z-index: 40;
  height: var(--nav-height);
  padding: 8px 18px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}
.bottom-nav-inner {
  display: flex; max-width: 520px; height: 100%; margin: 0 auto;
  align-items: center; justify-content: space-around;
}
.nav-item {
  display: flex; width: 84px; height: 58px; min-width: 84px;
  align-items: center; justify-content: center; flex-direction: column; gap: 3px;
  border-radius: var(--r-md); color: var(--muted); font-size: 11px; font-weight: 700;
}
.nav-item.active { color: var(--primary-deep); background: var(--primary-soft); }
.nav-item svg { width: 21px; height: 21px; }

.share-fab {
  position: fixed; right: 18px; bottom: calc(var(--nav-height) + 18px); z-index: 35;
  display: grid; width: 48px; height: 48px; place-items: center;
  border-radius: 50%; color: #fff; background: var(--primary); box-shadow: var(--shadow-strong);
}
.share-fab svg { width: 20px; height: 20px; }
.share-fab:hover { background: var(--primary-deep); }

/* ---------- 详情页 ---------- */
.detail-page { padding-bottom: 0; }
.detail-header {
  position: sticky; top: 0; z-index: 30;
  border-bottom: 1px solid var(--line);
  background: var(--bg-glass-94, rgba(244, 251, 250, 0.94));
  backdrop-filter: blur(14px);
}
.detail-header-inner {
  display: flex; width: min(100% - 40px, 1100px); height: 60px;
  margin: 0 auto; align-items: center; justify-content: space-between;
}
.detail-back {
  display: inline-flex; min-width: 84px; align-items: center; gap: 6px;
  color: var(--primary-deep); font-size: 13px; font-weight: 700;
}
.detail-back svg { width: 18px; height: 18px; }
.detail-header-title { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.16em; }
.detail-header-spacer { min-width: 84px; }

.detail-layout {
  display: grid; width: min(100% - 40px, 1100px); margin: 0 auto;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 40px; padding: 36px 0 80px; align-items: start;
}
.detail-media-card {
  overflow: hidden; border: 1px solid var(--line);
  border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow);
}
.detail-hero { position: relative; width: 100%; margin: 0; }
.detail-media-caption {
  display: flex; justify-content: space-between; padding: 12px 16px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 11px;
}
.detail-panel { padding-top: 4px; }
.detail-kicker {
  margin-bottom: 12px; color: var(--accent-text, var(--gold));
  font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
}
.detail-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.detail-title { margin: 0 0 18px; font-size: clamp(24px, 3vw, 36px); line-height: 1.25; overflow-wrap: anywhere; }
.detail-favorite {
  display: inline-flex; flex: 0 0 auto; min-height: 40px; align-items: center; gap: 6px;
  padding: 0 16px; border: 1px solid var(--primary); border-radius: 999px;
  color: #fff; font-size: 13px; font-weight: 800; background: var(--primary);
  transition: background 0.15s ease;
}
.detail-favorite.saved { border-color: var(--gold); background: var(--gold); }
.detail-favorite svg { width: 16px; height: 16px; }
.meta-line {
  display: flex; align-items: center; gap: 8px; padding: 12px 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  color: var(--ink-soft); font-size: 12px;
}
.code-value { padding: 3px 8px; border-radius: 7px; background: var(--primary-soft); font-family: ui-monospace, Menlo, monospace; }
.copy-small { display: inline-grid; width: 26px; height: 26px; place-items: center; border-radius: 7px; color: var(--primary-deep); background: var(--primary-soft); }
.copy-small svg { width: 13px; height: 13px; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.detail-tag { padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-soft); font-size: 12px; background: var(--surface); }
.price-section { margin-top: 26px; }
.section-label { margin-bottom: 12px; color: var(--ink-soft); font-size: 12px; font-weight: 800; }
.price-label, .single-price-label { display: block; margin-bottom: 10px; color: var(--ink-soft); font-size: 12px; font-weight: 800; }
.price-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.price-option {
  padding: 12px 13px; border: 1px solid var(--line); border-radius: var(--r-md);
  color: var(--ink-soft); text-align: left; background: var(--surface);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.price-option:hover { border-color: var(--primary); }
.price-option.selected { border-color: var(--primary); background: var(--primary-soft); }
.price-option-count { display: block; margin-bottom: 3px; font-size: 12px; }
.price-option-value { color: var(--primary-deep); font-size: 19px; font-weight: 800; }
.single-price { margin-top: 4px; color: var(--primary-deep); font-size: 30px; font-weight: 800; }

.watermark-text, .watermark-image {
  position: absolute; left: 50%; top: 50%;
  pointer-events: none; transform: translate(-50%, -50%);
}
.watermark-text { padding: 3px 8px; color: rgba(30, 26, 24, 0.82); font-size: 13px; white-space: nowrap; }
.watermark-image { max-width: 90px; max-height: 90px; opacity: 0.75; }

.floating-back {
  position: fixed; top: 16px; left: 16px; z-index: 50;
  display: grid; width: 42px; height: 42px; place-items: center;
  border-radius: 50%; color: var(--primary-deep);
  background: rgba(255, 255, 255, 0.95); box-shadow: var(--shadow);
}
.floating-back svg { width: 18px; height: 18px; }

/* ---------- 收藏页 ---------- */
.page-intro { margin: 6px 0 24px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.page-intro h1 { margin: 0; font-size: clamp(22px, 3vw, 30px); }
.page-intro p { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.shared-intro { padding-top: 44px; }
.backpack-list { display: grid; gap: 12px; }
.backpack-card {
  display: flex; gap: 13px; padding: 12px;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.backpack-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.backpack-card img { flex: 0 0 88px; width: 88px; height: 88px; border-radius: var(--r-md); object-fit: cover; }
.backpack-card-main { display: flex; min-width: 0; flex: 1; flex-direction: column; justify-content: space-between; }
.backpack-card h3 { display: -webkit-box; margin: 0; overflow: hidden; font-size: 14px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.backpack-card p { margin: 4px 0 0; color: var(--primary-deep); font-weight: 800; }
.backpack-card small { color: var(--muted); font-size: 11px; }
.remove-button { align-self: flex-end; padding: 4px 0; color: #C2556B; font-size: 12px; font-weight: 700; }
.shared-banner { margin-bottom: 16px; padding: 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.shared-banner h2 { margin: 0; font-size: 17px; }
.shared-banner p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.backpack-toolbar { position: fixed; right: 0; bottom: calc(var(--nav-height) + 6px); left: 0; z-index: 32; padding: 0 16px; pointer-events: none; }
.backpack-toolbar-inner { display: flex; max-width: 720px; margin: 0 auto; align-items: center; gap: 10px; pointer-events: auto; }
.total-box {
  display: flex; flex: 1; min-width: 0; align-items: center; justify-content: space-between;
  padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); box-shadow: var(--shadow-strong);
}
.total-value { color: #C2556B; font-size: 19px; font-weight: 800; }
.forward-button {
  display: flex; align-items: center; gap: 6px; padding: 13px 18px;
  border-radius: var(--r-md); color: #fff; font-weight: 800; white-space: nowrap;
  background: var(--primary); box-shadow: var(--shadow-strong);
}
.forward-button svg { width: 17px; height: 17px; }
.forward-button:hover { background: var(--primary-deep); }

/* ---------- 公告 ---------- */
.announcement-list { display: grid; gap: 12px; }
.announcement-card {
  padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.announcement-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.announcement-title { margin: 0; font-size: 15px; }
.announcement-date { margin-top: 7px; color: var(--muted); font-size: 11px; }
.announcement-detail {
  margin-top: 16px; padding: 26px 24px;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface);
}
.announcement-detail h1 { margin: 0 0 8px; font-size: 26px; }
.announcement-detail .announcement-date { margin: 0 0 18px; }
.rich-content { color: var(--ink-soft); font-size: 14px; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; }
.qr-block { margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--line); text-align: center; }
.qr-block img { width: min(70%, 280px); margin: 0 auto; border-radius: var(--r-md); }

/* ---------- 页面通用文案标题（收藏 / 公告） ---------- */

/* ---------- 按钮 ---------- */
.primary-button, .secondary-button, .danger-button {
  padding: 11px 18px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 800; transition: background 0.15s ease, border-color 0.15s ease;
}
.primary-button { color: #fff; background: var(--primary); }
.primary-button:hover { background: var(--primary-deep); }
.secondary-button { border: 1px solid var(--line); color: var(--ink-soft); background: var(--surface); }
.secondary-button:hover { border-color: var(--line-strong); }
.danger-button { border: 1px solid #F6DDE0; color: #C2556B; background: #FDF1F2; }
.danger-button:hover { background: #FAE4E7; }
.small-button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); color: var(--ink-soft); font-size: 12px; font-weight: 700; background: var(--surface); }
.small-button svg { width: 14px; height: 14px; flex: 0 0 auto; }
.small-button:hover { border-color: var(--line-strong); }
.small-button.danger { border-color: #F6DDE0; color: #C2556B; background: #FDF1F2; }
.logout-button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--r-sm);
  color: #EAF7F3; font-size: 12px; font-weight: 700; background: rgba(255, 255, 255, 0.12);
}
.logout-button svg { width: 15px; height: 15px; }
.logout-button:hover { background: rgba(255, 255, 255, 0.2); }

/* ---------- 登录页 ---------- */
.login-page {
  display: grid; min-height: 100vh; padding: 40px 24px;
  place-items: center;
  background: var(--bg-elevated);
}
.login-decoration { display: none; }
.login-card {
  width: 100%; max-width: 400px; padding: 40px 34px 34px;
  border: 1px solid var(--line); border-radius: 20px;
  background: var(--surface); box-shadow: var(--shadow-strong);
}
.login-card-mark { display: flex; justify-content: center; margin-bottom: 16px; }
.login-title { margin: 0; font-size: 28px; text-align: center; }
.login-subtitle { margin: 8px 0 26px; color: var(--muted); font-size: 13px; text-align: center; }
.login-card .primary-button { display: flex; width: 100%; justify-content: center; margin-top: 6px; padding: 13px; }

/* ---------- 表单 ---------- */
.form-stack { display: grid; gap: 14px; }
.form-field { display: grid; gap: 6px; min-width: 0; }
.form-field label { color: var(--ink-soft); font-size: 12px; font-weight: 800; }
.form-field input, .form-field textarea, .form-field select, .admin-search {
  width: 100%; min-width: 0; min-height: 42px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  outline: none; color: var(--ink); background: var(--surface);
}
.form-field input:focus, .form-field textarea:focus, .form-field select:focus, .admin-search:focus { border-color: var(--primary); }
.form-field textarea { min-height: 120px; resize: vertical; }
.inline-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.checkbox-field { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 13px; }
.checkbox-field input { width: 17px; height: 17px; accent-color: var(--primary); }
.file-drop {
  padding: 16px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-sm);
  color: var(--muted); font-size: 12px; text-align: center; background: var(--bg-elevated);
}
.file-drop input { width: 100%; margin-top: 8px; }
.button-row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.button-row > * { min-width: 0; }

/* ---------- 弹窗 ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80;
  display: grid; padding: 18px; place-items: center;
  background: var(--ink-glass-50, rgba(24, 46, 42, 0.5));
}
.modal {
  width: 100%; max-width: 540px; max-height: calc(100vh - 36px);
  padding: 24px; overflow-y: auto;
  border-radius: var(--r-lg); background: var(--surface); box-shadow: 0 24px 70px var(--ink-glass-30, rgba(24, 46, 42, 0.3));
}
.modal-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-heading h2 { margin: 0; font-size: 18px; }
.close-button { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; color: var(--ink-soft); background: var(--bg-elevated); }
.close-button svg { width: 15px; height: 15px; }

/* ---------- 提示 ---------- */
.toast-root {
  position: fixed; top: 16px; left: 50%; z-index: 120;
  display: grid; gap: 8px; width: min(calc(100% - 32px), 360px);
  pointer-events: none; transform: translateX(-50%);
}
.toast {
  padding: 12px 15px; border-radius: var(--r-sm);
  color: #fff; font-size: 13px; text-align: center;
  box-shadow: var(--shadow-strong); animation: toast-in 0.2s ease-out;
}
.toast.success { background: #3F8F7A; }
.toast.error { background: #C2556B; }
.toast.info { background: #4A7A80; }

/* ---------- 后台工作台 ---------- */
.admin-page { min-height: 100vh; background: var(--bg-elevated); }
.admin-header {
  position: sticky; top: 0; z-index: 30;
  padding: 0 24px; background: var(--header-dark, #223D38);
}
.admin-header-inner {
  display: flex; max-width: 1240px; height: 62px; margin: 0 auto;
  align-items: center; justify-content: space-between;
}
.admin-brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.admin-brand .brand-mark { width: 30px; height: 30px; padding: 7px 6px; background: var(--primary); }
.admin-brand strong { display: block; color: #F7FFFC; font-size: 15px; }
.admin-brand small { display: block; color: rgba(255, 255, 255, 0.6); font-size: 9px; letter-spacing: 0.18em; }
.admin-head-actions { display: flex; align-items: center; gap: 16px; }
.admin-status { display: inline-flex; align-items: center; gap: 6px; color: rgba(255, 255, 255, 0.65); font-size: 10px; font-weight: 700; letter-spacing: 0.14em; }
.admin-status i { width: 6px; height: 6px; border-radius: 50%; background: #8FD0B9; }

.admin-shell {
  display: grid; max-width: 1240px; margin: 0 auto;
  grid-template-columns: 216px minmax(0, 1fr);
  align-items: start;
}
.admin-sidebar {
  position: sticky; top: 62px;
  display: flex; height: calc(100vh - 62px);
  flex-direction: column;
  padding: 22px 18px;
  border-right: 1px solid var(--line);
}
.sidebar-label { margin-bottom: 10px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.16em; }
.admin-sidebar .admin-tabs { display: grid; gap: 4px; overflow: visible; }
.admin-tab {
  display: block; width: 100%; padding: 10px 13px;
  border-radius: var(--r-sm); color: var(--ink-soft);
  font-size: 13px; font-weight: 700; text-align: left;
}
.admin-tab:hover { color: var(--primary-deep); background: rgba(255, 255, 255, 0.7); }
.admin-tab.active { color: #fff; background: var(--primary); }
.sidebar-foot { margin-top: auto; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.14em; line-height: 1.8; }
.sidebar-foot span { font-weight: 500; letter-spacing: 0.02em; }

.admin-content { padding: 30px 26px 60px; min-width: 0; }
.admin-intro { margin-bottom: 24px; }
.admin-intro h1 { margin: 0; font-size: 26px; }
.admin-intro p { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }

.admin-grid { display: grid; min-width: 0; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.white-card {
  min-width: 0; padding: 22px;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--shadow);
}
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-heading h2, .card-heading h3 { margin: 0; font-size: 17px; }

.status-tabs { display: flex; gap: 7px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.status-tabs::-webkit-scrollbar { display: none; }
.status-tab { padding: 8px 13px; border-radius: 999px; color: var(--ink-soft); font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--bg-elevated); }
.status-tab.active { color: #fff; background: var(--primary); }
.admin-search { margin-bottom: 14px; }

.admin-selection-bar {
  position: fixed; top: 74px; right: 18px; z-index: 45;
  display: flex; gap: 8px; padding: 10px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); box-shadow: var(--shadow-strong);
}

.admin-product-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.admin-product {
  position: relative; min-width: 0; overflow: hidden; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
}
.admin-product.selected { outline: 3px solid var(--primary); }
.admin-product img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.admin-product-info { padding: 10px 12px 12px; }
.admin-product-info strong { display: -webkit-box; min-height: 2.6em; overflow: hidden; font-size: 13px; line-height: 1.3; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.admin-product-info small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.admin-product-check {
  position: absolute; top: 8px; right: 8px;
  display: grid; width: 24px; height: 24px; place-items: center;
  border-radius: 50%; color: #fff; font-size: 12px; background: var(--primary);
}
.admin-product-delete {
  position: absolute; right: 8px; bottom: 56px;
  display: grid; width: 28px; height: 28px; place-items: center;
  border-radius: 50%; color: #fff; background: #C2556B;
  opacity: 0; transition: opacity 0.2s ease;
}
.admin-product-delete svg { width: 14px; height: 14px; }
.admin-product:hover .admin-product-delete { opacity: 1; }
.admin-pager { display: flex; margin-top: 18px; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-size: 12px; }

.admin-list { display: grid; gap: 8px; }
.admin-list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface);
}
.admin-list-item.selected { border-color: var(--primary); background: var(--primary-soft); }
.admin-list-item-main { min-width: 0; flex: 1; cursor: default; }
.admin-list-item strong, .admin-list-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-list-item small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.item-actions { display: flex; flex: 0 0 auto; gap: 7px; }
.inline-edit { display: grid; flex: 1; min-width: 0; gap: 6px; }
.inline-edit input { min-height: 34px; padding: 6px 10px; border: 1px solid var(--primary); border-radius: 8px; outline: none; }

/* ---------- 批量上传 ---------- */
.upload-dropzone {
  position: relative;
  display: grid; padding: 36px 16px; place-items: center; gap: 8px;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-md);
  color: var(--muted); font-size: 13px; cursor: pointer;
  transition: border-color 0.15s ease;
}
.upload-dropzone-inner { display: grid; place-items: center; gap: 8px; pointer-events: none; }
/* MDN 推荐的可访问隐藏：保留原生 input 可被 label 激活，兼容手机与微信 */
.visually-hidden {
  clip: rect(0 0 0 0); clip-path: inset(50%);
  height: 1px; width: 1px; overflow: hidden;
  position: absolute; white-space: nowrap;
}
input.visually-hidden:focus-visible + .upload-dropzone-inner { outline: 2px solid var(--primary); outline-offset: 4px; }
.upload-dropzone:hover { border-color: var(--primary); }
.upload-dropzone svg { width: 26px; height: 26px; color: var(--primary); }
.upload-task-head-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.upload-task-list { display: grid; gap: 9px; }
.upload-task { display: flex; gap: 11px; padding: 10px; border-radius: var(--r-md); background: var(--bg-elevated); }
.upload-task img { flex: 0 0 58px; width: 58px; height: 58px; border-radius: 9px; border: 1px solid var(--line); object-fit: cover; }
.upload-task-main { min-width: 0; flex: 1; }
.upload-task-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 12px; }
.upload-task-head span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-task-error { margin-top: 6px; color: #C2556B; font-size: 12px; }
.text-green { color: #3F8F7A; font-weight: 700; }
.text-red { color: #C2556B; font-weight: 700; }
.text-primary { color: var(--primary-deep); font-weight: 700; }
.progress-bar { height: 7px; overflow: hidden; border-radius: 999px; background: var(--line); }
.progress-bar.big { height: 14px; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--primary); transition: width 0.3s ease; }
.progress-fill.success { background: #3F8F7A; }
.progress-fill.failed { background: #C2556B; }
.bg-primary { background: var(--primary); }
.bg-yellow { background: #D9B23C; }
.bg-red { background: #C2556B; }
.storage-row { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 12px; color: var(--ink-soft); }

/* ---------- 全屏编辑器 ---------- */
.fullscreen-editor {
  position: fixed; inset: 0; z-index: 90;
  display: flex; overflow: hidden; flex-direction: column; background: var(--bg);
}
.fullscreen-hero { position: relative; flex: 0 0 auto; background: var(--surface); box-shadow: var(--shadow); }
.fullscreen-hero > img { width: 100%; max-height: 42vh; object-fit: cover; }
.fs-close {
  position: absolute; top: 14px; right: 14px;
  display: grid; width: 38px; height: 38px; place-items: center;
  border-radius: 50%; color: var(--ink-soft); font-size: 20px;
  background: rgba(255, 255, 255, 0.94); box-shadow: var(--shadow);
}
.fs-hero-meta { position: absolute; right: 0; bottom: 0; left: 0; padding: 30px 16px 13px; background: linear-gradient(to top, rgba(16, 42, 38, 0.6), transparent); }
.fs-hero-meta h3 { margin: 0; color: #fff; font-size: 16px; }
.fs-hero-meta p { margin: 3px 0 0; color: rgba(255, 255, 255, 0.85); font-size: 12px; }
.fs-body { flex: 1; width: min(100%, 720px); margin: 0 auto; padding: 20px 16px 44px; overflow-y: auto; }
.fs-watermark-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.fs-slider-label { display: block; margin: 10px 0 4px; color: var(--muted); font-size: 11px; font-weight: 700; }
.replaced-badge { margin-top: 8px; padding: 4px 10px; border-radius: 999px; color: #fff; font-size: 11px; text-align: center; background: #3F8F7A; }
.price-rows { display: grid; gap: 8px; margin-top: 10px; }
.price-row { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); }
.tier-heading { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(90px, .7fr); align-items: center; gap: 8px; }
.tier-heading > span { font-size: 12px; color: var(--ink-soft); }
.tier-batch-price { display: flex; gap: 8px; align-items: center; }
.tier-batch-price input { min-width: 0; width: 100%; }
.price-row textarea { width: 100%; min-height: 64px; resize: vertical; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-sm); font: inherit; }
.price-option-count, .price-option-remark { white-space: pre-wrap; overflow-wrap: anywhere; }
.price-option-remark { display: block; grid-column: 1 / -1; font-size: 13px; color: var(--ink-soft); text-align: left; }
.price-option { min-width: 0; max-width: 100%; flex-wrap: wrap; }
.price-option-remark { flex-basis: 100%; }
.price-row-label { flex: 0 0 42px; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.price-row input { flex: 1; min-width: 0; min-height: 38px; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--r-sm); outline: none; }
.price-row input:focus { border-color: var(--primary); }

/* ---------- 动画 ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- 响应式 ---------- */
@media (min-width: 700px) {
  .masonry-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1020px) {
  .masonry-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .admin-product-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .admin-grid.two-columns { grid-template-columns: minmax(300px, 0.8fr) minmax(0, 1.2fr); }
  .login-page { grid-template-columns: 1fr minmax(360px, 400px) 1fr; column-gap: 48px; }
  .login-card { grid-column: 2; }
  .login-decoration {
    display: grid; grid-column: 1; grid-row: 1; justify-self: end; align-self: center;
    gap: 12px;
  }
  .login-decoration strong { color: var(--primary-deep); font-size: clamp(24px, 2.6vw, 38px); line-height: 1.3; }
  .login-decoration p { margin: 0; color: var(--muted); font-size: 12px; letter-spacing: 0.06em; }
}
@media (max-width: 760px) {
  .site-header-main { display: block; }
  .site-header-main .search-row { margin-top: 12px; }
  .header-aside { display: none; }
  .detail-layout { display: block; width: min(100% - 24px, 680px); padding-top: 18px; }
  .detail-panel { padding-top: 22px; }
  .admin-shell { display: block; }
  .admin-sidebar {
    position: static; height: auto;
    padding: 14px 16px 0; border-right: 0;
  }
  .admin-sidebar .admin-tabs { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; padding-bottom: 12px; }
  .admin-sidebar .admin-tab { width: auto; white-space: nowrap; }
  .admin-sidebar .sidebar-foot { display: none; }
  .admin-content { padding: 20px 14px 50px; }
  .admin-header { padding: 0 14px; }
}
@media (max-width: 560px) {
  .topbar { padding: 12px 12px 10px; }
  .page-content { padding: 20px 12px 34px; }
  .masonry-grid { gap: 10px; }
  .product-info { padding: 10px 11px 12px; }
  .product-open-label { display: none; }
  .filter-label { display: none; }
  .detail-header-inner { width: calc(100% - 24px); }
  .detail-back, .detail-header-spacer { min-width: 60px; }
  .detail-header-title { display: none; }
  .detail-back span { display: none; }
  .detail-title-row { display: block; }
  .detail-favorite { margin-bottom: 14px; }
  .admin-selection-bar { top: auto; right: 10px; left: 10px; bottom: 14px; justify-content: center; }
  .admin-selection-bar .primary-button, .admin-selection-bar .small-button { flex: 1; padding: 10px 6px; font-size: 11px; }
  .backpack-card img { flex-basis: 74px; width: 74px; height: 74px; }
  .login-card { padding: 32px 22px 26px; }
}

/* ---------- 新功能样式 ---------- */
/* 库存徽章 */
.stock-badge { display: inline-flex; padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--primary-soft); color: var(--primary-deep); }
.stock-badge.out { background: var(--bg-elevated); color: var(--muted); }

/* 收藏数量选择 */
.qty-section { margin-top: 20px; }
.qty-row { display: flex; align-items: center; gap: 8px; }
.qty-btn {
  display: grid; width: 42px; height: 42px; place-items: center;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--ink-soft); font-size: 18px; font-weight: 700; background: var(--surface);
}
.qty-btn:hover { border-color: var(--primary); color: var(--primary-deep); }
.qty-input {
  width: 72px; min-height: 42px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  text-align: center; font-size: 15px; font-weight: 700; color: var(--ink);
  outline: none; background: var(--surface);
  -moz-appearance: textfield; appearance: textfield;
}
.qty-input::-webkit-inner-spin-button, .qty-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.qty-input:focus { border-color: var(--primary); }

/* 收藏卡片数量角标 */
.qty-chip {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  border-radius: 999px; color: #fff; font-size: 11px; font-weight: 800;
  background: var(--primary); vertical-align: middle;
}
.unit-price { color: var(--muted); font-weight: 500; font-size: 11px; }

/* 商品序号（后台） */
.product-code-line { color: var(--accent-text, var(--gold)); font-weight: 800; letter-spacing: 0.04em; margin-bottom: 2px !important; }

/* 拖拽排序 */
.admin-product-list.reorder-mode .admin-product { cursor: grab; }
.admin-product-list.reorder-mode .admin-product.dragging { opacity: 0.5; outline: 2px dashed var(--primary); }
.admin-product-list.reorder-mode .admin-product::before {
  content: "⋮⋮"; position: absolute; top: 6px; left: 6px;
  color: #fff; font-size: 14px; text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  pointer-events: none; z-index: 2;
}

/* 口令兑换 */
.redeem-box {
  margin: 0 0 20px; padding: 16px 18px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface);
}
.redeem-row { display: flex; gap: 8px; margin-top: 8px; }
.redeem-input {
  flex: 1; min-width: 0; min-height: 42px; padding: 0 13px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  outline: none; font-size: 14px; color: var(--ink); background: var(--surface);
}
.redeem-input:focus { border-color: var(--primary); }
.redeem-row .primary-button { min-height: 42px; padding: 0 22px; white-space: nowrap; }

/* 标签搜索输入（价格模式） */
.tags-wrap { margin-bottom: 8px; }

/* ---------- 固定收藏按钮（详情页底部悬浮，滚动不动） ---------- */
.detail-fav-bar {
  position: fixed; right: 0; bottom: 0; left: 0; z-index: 40;
  display: flex; justify-content: center;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(255,255,255,0.96), rgba(255,255,255,0));
  pointer-events: none;
}
.detail-fav-bar .detail-favorite {
  pointer-events: auto; min-width: 200px; min-height: 48px; justify-content: center;
  box-shadow: 0 6px 20px var(--primary-glow, rgba(46, 139, 120, 0.35));
}
/* 桌面端双栏布局时不悬浮，按钮留在面板内 */
@media (min-width: 960px) {
  .detail-fav-bar { position: static; padding: 0; margin-top: 22px; background: none; }
  .detail-fav-bar .detail-favorite { min-width: 160px; box-shadow: none; }
}

/* ---------- 分类列表拖拽 ---------- */
.admin-list.reorder-mode .admin-list-item { cursor: grab; }
.admin-list.reorder-mode .admin-list-item.dragging { opacity: 0.5; outline: 2px dashed var(--primary); }

/* ---------- 收藏卡编号与单卡分享 ---------- */
.card-code { display: inline-block; margin: 2px 0 4px; color: var(--muted); font-size: 11px; }
.card-code b { color: var(--accent-text, var(--gold)); font-weight: 800; letter-spacing: 0.04em; }
.backpack-card-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.backpack-card-actions .remove-button { min-height: 30px; padding: 4px 12px; font-size: 11px; }

/* ---------- 移动端适配优化 ---------- */
.price-search .price-search-submit {
  position: static; transform: none;
  flex: 0 0 auto; padding: 0 18px; min-height: 42px;
}

/* 小屏：搜索主行 + 价格筛选行 上下堆叠 */
@media (max-width: 720px) {
  /* 搜索行允许换行，两行布局 */
  .search-row { flex-wrap: wrap; gap: 8px; }
  .mode-button-wrap { flex: 0 0 auto; height: 42px; }
  .mode-button { min-height: 42px; height: 42px; padding: 0 10px; font-size: 12px; }

  /* 第一行：搜索输入占满剩余宽度 */
  .search-row .search-input-wrap { flex: 1 1 100%; }
  /* 有模式按钮时输入框与按钮同行：用负 margin 让它绕开？改为：模式按钮绝对定位于行内 */
  .search-row { position: relative; }

  /* 第二行：价格区间 + 筛选按钮 */
  .price-search { flex: 1 1 100%; }
  .price-search .price-input { flex: 1; }
  .price-search > .muted { flex: 0 0 auto; }
  .price-search .price-search-submit { flex: 0 0 auto; min-height: 42px; padding: 0 16px; }

  /* 分类 pill 行：标签缩小更省空间 */
  .category-row { gap: 8px; }
  .pill { padding: 6px 12px; font-size: 12px; }

  /* 目录标题收紧 */
  .catalog-heading h1 { font-size: 24px; }
  .catalog-heading p { font-size: 13px; }

  /* 商品网格 2 列，间距收紧 */
  .masonry-grid { gap: 10px; }

  /* 页面留白统一收紧 */
  .topbar-inner { width: calc(100% - 20px); }
  .page-content { padding: 16px 10px 30px; }
}

/* 移动端商品卡：图片压扁 + 信息紧凑，一屏可见更多商品 */
@media (max-width: 720px) {
  .product-image-wrap { aspect-ratio: 1 / 0.62; }
  .product-info { padding: 8px 10px 10px; }
  .product-name { font-size: 13px !important; }
  .product-category { font-size: 9px !important; margin-bottom: 3px !important; }
  .tag-list { gap: 4px !important; margin-top: 5px !important; }
  .tag-list .tag { padding: 2px 7px !important; font-size: 9px !important; }
  .product-bottom { margin-top: 6px !important; }
  .price { font-size: 14px !important; }
  .price small { font-size: 10px !important; }
}

/* 超小屏（<360px）：搜索按钮不换行、价格输入保持可用 */
@media (max-width: 360px) {
  .search-button { padding: 7px 10px; font-size: 11px; }
  .price-search .price-search-submit { padding: 0 12px; }
  .mode-button { padding: 0 8px; }
}

/* ---------- 收藏卡移动端紧凑布局 ---------- */
@media (max-width: 720px) {
  /* 卡片内：编号/价格信息优先，操作按钮横向排一行贴底 */
  .backpack-card-main {
    flex-direction: row; align-items: center; gap: 12px;
  }
  .backpack-card-main > div:first-child { flex: 1; min-width: 0; }
  .backpack-card-actions {
    flex-direction: column; align-items: stretch; gap: 8px;
    flex: 0 0 auto; min-width: 64px;
  }
  .backpack-card-actions .remove-button { align-self: center; white-space: nowrap; }
  .backpack-card-actions .remove-button { align-self: center; padding: 4px 0; }
  .backpack-card-actions .small-button { min-height: 32px; padding: 5px 10px; font-size: 11px; white-space: nowrap; }
  .backpack-card { align-items: center; }
  /* 底部总额栏给页面留出空间，避免遮挡最后一张卡 */
  .narrow-content { padding-bottom: 76px; }
  .backpack-toolbar { padding: 0 10px; }
  .total-box { padding: 10px 12px; }
  .total-value { font-size: 16px; }
  .forward-button { padding: 10px 14px; font-size: 13px; }
}

/* ---------- 用户端入口页（banner + 四宫格） ---------- */
.entry-page { padding-bottom: calc(var(--nav-height) + 20px); }
.entry-header { padding: 26px 20px 14px; text-align: center; }
.entry-site-title { margin: 0; font-size: 20px; letter-spacing: 0.06em; }
.entry-banner {
  position: relative; width: min(100% - 40px, 520px); margin: 0 auto 26px;
  aspect-ratio: 1 / 0.85; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: linear-gradient(160deg, var(--primary-soft), var(--bg-elevated));
  display: grid; place-items: center;
}
.entry-banner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.entry-banner.empty span { color: rgba(120, 70, 40, 0.55); font-size: 34px; font-weight: 800; letter-spacing: 0.2em; }
.entry-grid {
  display: grid; width: min(100% - 40px, 520px); margin: 0 auto;
  grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px;
}
.entry-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 20px 12px; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.entry-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.entry-avatar {
  display: grid; width: 84px; height: 84px; place-items: center; overflow: hidden;
  border-radius: 50%; background: var(--primary-soft); color: var(--primary-deep);
  font-size: 26px; font-weight: 800;
}
.entry-avatar img { width: 100%; height: 100%; object-fit: cover; }
.entry-name { font-size: 14px; font-weight: 700; letter-spacing: 0.04em; }

/* 入口内页头部 */
.space-header { display: flex; align-items: center; gap: 10px; }
.space-back {
  display: grid; width: 38px; height: 38px; place-items: center; flex: 0 0 auto;
  border: 1px solid var(--line); border-radius: 50%;
  color: var(--primary-deep); background: var(--surface);
}
.space-back svg { width: 18px; height: 18px; }
.space-search { margin-top: 12px; }

/* ---------- 后台入口切换条 ---------- */
.admin-space-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px; padding: 12px 16px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface);
}
.admin-space-label { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 0.12em; }
.admin-space-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-space-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink-soft); font-size: 12px; font-weight: 700; background: var(--surface);
}
.admin-space-tab img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.admin-space-tab.active { border-color: var(--primary); color: #fff; background: var(--primary); }

/* ---------- 后台入口配置面板 ---------- */
.banner-preview {
  display: grid; width: min(100%, 320px); aspect-ratio: 1 / 0.85; place-items: center;
  overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-elevated);
}
.banner-preview img { width: 100%; height: 100%; object-fit: cover; }
.space-config-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.space-config-item {
  display: grid; gap: 10px; padding: 16px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-elevated);
}
.space-config-head { display: flex; align-items: center; gap: 8px; }
.space-config-title { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 0.1em; }
.space-config-avatar {
  display: grid; width: 64px; height: 64px; place-items: center; overflow: hidden;
  border-radius: 50%; background: var(--primary-soft); color: var(--primary-deep); font-weight: 800;
}
.space-config-avatar img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 720px) {
  .entry-banner { width: calc(100% - 28px); }
  .entry-grid { width: calc(100% - 28px); gap: 12px; }
  .entry-avatar { width: 70px; height: 70px; font-size: 22px; }
  .admin-space-bar { padding: 10px 12px; }
}


/* ---------- 站点设置：配色方案 ---------- */
.theme-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 12px; }
.theme-preset {
  display: grid; gap: 8px; padding: 12px; justify-items: center;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.theme-preset:hover { border-color: var(--line-strong); }
.theme-preset.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.theme-swatches { display: flex; gap: 4px; }
.theme-swatches i { width: 20px; height: 20px; border: 1px solid rgba(0, 0, 0, 0.08); border-radius: 50%; }
.theme-preset-name { font-size: 12px; font-weight: 700; }
.theme-color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.theme-color-field { display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.theme-color-field input[type="color"] {
  width: 100%; height: 44px; padding: 3px; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--surface); cursor: pointer;
}
.theme-color-field code { color: var(--muted); font-size: 11px; letter-spacing: 0.04em; }

/* ---------- 入口页：搜索/筛选折叠按钮 ---------- */
/* 入口页顶栏固定纵向堆叠（标题 → 搜索按钮 → 分类），避免宽屏时按钮浮到标题右侧 */
.space-topbar .site-header-main { display: block; }
.space-topbar .search-toggle-row { margin-top: 12px; }
.search-toggle-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.search-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink-soft); font-size: 12px; font-weight: 700; background: var(--surface);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.search-toggle svg { width: 15px; height: 15px; }
.search-toggle:hover { border-color: var(--primary); color: var(--primary-deep); }
.search-toggle.has-filter { border-color: var(--primary); color: var(--primary-deep); background: var(--primary-soft); }
.filter-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.search-clear {
  padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); font-size: 12px; font-weight: 600; background: var(--surface);
}
.search-clear:hover { color: #C2556B; border-color: #F6DDE0; }
.space-search { margin-top: 10px; }
.space-search.hidden { display: none; }

/* ---------- 分类排序箭头 ---------- */
.sort-arrows { display: flex; flex-direction: column; gap: 2px; flex: 0 0 auto; }
.arrow-button {
  display: grid; width: 26px; height: 20px; place-items: center;
  border: 1px solid var(--line); border-radius: 6px;
  color: var(--ink-soft); font-size: 11px; font-weight: 800; line-height: 1;
  background: var(--surface);
}
.arrow-button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary-deep); background: var(--primary-soft); }
.arrow-button:disabled { opacity: 0.3; cursor: not-allowed; }

/* ---------- 特价展示 ---------- */
.special-badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  padding: 3px 9px; border-radius: 999px;
  color: #fff; font-size: 11px; font-weight: 800; letter-spacing: 0.04em;
  background: #E8543F; box-shadow: 0 2px 8px rgba(232, 84, 63, 0.35);
}
.price-special { color: #E8543F !important; }
.price-original { margin-left: 6px; color: var(--muted); font-size: 12px; font-weight: 500; text-decoration: line-through; }
.detail-special {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin: 0 0 12px; padding: 10px 14px;
  border: 1px solid rgba(232, 84, 63, 0.25); border-radius: var(--r-md);
  background: rgba(232, 84, 63, 0.06);
}
.detail-special .special-badge { position: static; box-shadow: none; }
.detail-special-price { color: #E8543F; font-size: 22px; font-weight: 800; }
.detail-special-time { color: var(--muted); font-size: 11px; }
.admin-special-tag { color: #E8543F; font-weight: 800; }

/* ---------- 批量上传：待上传区与底部操作条 ---------- */
.upload-staged { margin-top: 14px; }
.upload-staged-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.upload-staged-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 10px; }
.staged-item { position: relative; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.staged-item img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.staged-name { display: block; padding: 4px 6px; color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.staged-remove {
  position: absolute; top: 4px; right: 4px;
  display: grid; width: 22px; height: 22px; place-items: center;
  border-radius: 50%; color: #fff; font-size: 14px; line-height: 1;
  background: rgba(0, 0, 0, 0.55);
}
.staged-remove:hover { background: #C2556B; }
.upload-action-bar {
  display: flex; gap: 10px; margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--line);
}
.upload-action-bar .primary-button, .upload-action-bar .secondary-button { flex: 1; min-height: 46px; }
#upload-tasks:not(:empty) { margin-top: 16px; }

/* ---------- 空间页：资料头部（头像 / 昵称 / 签名） ---------- */
.space-profile { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.space-avatar {
  display: grid; width: 54px; height: 54px; flex: 0 0 auto; place-items: center; overflow: hidden;
  border-radius: 50%; background: var(--primary-soft); color: var(--primary-deep);
  font-size: 18px; font-weight: 800;
}
.space-avatar img { width: 100%; height: 100%; object-fit: cover; }
.space-identity { display: grid; gap: 3px; min-width: 0; }
.space-identity strong { font-size: 17px; letter-spacing: 0.04em; }
.space-identity small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 空间页：搜索与筛选（横排） ---------- */
.search-toggle-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.image-search-toggle { padding-right: 14px; }
.image-search-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 12px; padding: 10px 14px;
  border: 1px solid var(--primary); border-radius: var(--r-md);
  background: var(--primary-soft); color: var(--primary-deep);
  font-size: 12px; font-weight: 700;
}
.activity-row { display: flex; gap: 7px; margin-top: 8px; }
.activity-pill.active { border-color: var(--primary); color: #fff; background: var(--primary); }

/* ---------- 空间页：双列错落瀑布流 ---------- */
.waterfall { column-count: 2; column-gap: 10px; }
@media (min-width: 700px) { .waterfall { column-count: 3; column-gap: 14px; } }
@media (min-width: 1020px) { .waterfall { column-count: 4; column-gap: 16px; } }
.waterfall .product-wrap { break-inside: avoid; margin: 0 0 10px; display: block; }
.waterfall .product-image-wrap { aspect-ratio: auto; }
.waterfall .product-image-wrap img { width: 100%; height: auto; display: block; }
.waterfall .product-card { transform: none !important; }
.card-badges { position: absolute; top: 8px; left: 8px; z-index: 2; display: flex; gap: 6px; }
.gift-badge {
  padding: 3px 9px; border-radius: 999px; color: #fff;
  font-size: 11px; font-weight: 800; letter-spacing: 0.04em;
  background: var(--primary); box-shadow: 0 2px 8px var(--primary-glow);
}
.card-badges .special-badge { position: static; }

/* ---------- 加载动画与上拉提示 ---------- */
.loading-state { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 26px 0; color: var(--muted); font-size: 13px; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line-strong); border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
.load-more-hint { padding: 16px 0 8px; text-align: center; color: var(--muted); font-size: 12px; }

/* ---------- 下拉刷新指示 ---------- */
.pull-refresh {
  position: fixed; top: 8px; left: 50%; z-index: 60;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow);
  color: var(--primary-deep); font-size: 12px; font-weight: 700;
  opacity: 0; transform: translate(-50%, 0); transition: opacity 0.15s ease;
  pointer-events: none;
}
.pull-refresh svg { width: 14px; height: 14px; }

/* ---------- 底部导航：选中粉色高亮 ---------- */
.bottom-nav .nav-item.active { color: var(--primary-deep); }
.bottom-nav .nav-item.active svg { color: var(--primary); }
.bottom-nav .nav-item.active span { color: var(--primary-deep); font-weight: 800; }

@media (max-width: 560px) {
  .space-profile { gap: 10px; }
  .space-avatar { width: 46px; height: 46px; font-size: 16px; }
  .space-identity strong { font-size: 15px; }
  .search-toggle-row { gap: 6px; }
  .search-toggle { padding: 8px 13px; }
}

/* ---------- 全屏编辑器：右上角删除按钮 ---------- */
.fs-delete {
  position: absolute; top: 12px; right: 56px; z-index: 5;
  display: grid; width: 34px; height: 34px; place-items: center;
  border-radius: 50%; color: #fff; font-size: 20px; font-weight: 700; line-height: 1;
  background: rgba(194, 85, 107, 0.9); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
.fs-delete:hover { background: #C2556B; }

/* ---------- 公告：归属窗口展示 ---------- */
.announcement-meta { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.announcement-window {
  padding: 2px 9px; border-radius: 999px;
  color: var(--primary-deep); background: var(--primary-soft);
  font-size: 11px; font-weight: 700;
}
.announcement-window-line { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.announcement-window-line a { color: var(--primary-deep); font-weight: 700; }


/* ---------- 空间页：两级标签（红色下划线） ---------- */
.space-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.space-tool {
  display: grid; width: 38px; height: 38px; place-items: center; flex: 0 0 auto;
  border: 1px solid var(--line); border-radius: 50%;
  color: var(--ink-soft); background: var(--surface);
}
.space-tool svg { width: 17px; height: 17px; }
.space-tool:hover { border-color: var(--primary); color: var(--primary-deep); }
.space-tool.has-filter { border-color: var(--tab-underline, #E64340); color: var(--tab-underline, #E64340); }

.category-tabs-wrap { margin-top: 4px; }
.tab-bar {
  display: flex; align-items: center; gap: 20px;
  overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; scroll-behavior: smooth;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-item {
  position: relative; flex: 0 0 auto;
  padding: 10px 2px 11px;
  color: var(--ink-soft); font-size: 14px; font-weight: 700;
  white-space: nowrap;
}
.tab-item.active { color: var(--tab-underline, #E64340); }
.tab-item.active::after {
  content: ""; position: absolute; left: 50%; bottom: 4px;
  width: 22px; height: 3px; border-radius: 2px;
  background: var(--tab-underline, #E64340);
  transform: translateX(-50%);
}
.level-one-bar { border-bottom: 1px solid var(--line); }
.level-one-bar .tab-item { font-size: 15px; padding: 12px 2px 13px; }
.level-one-bar .tab-item.active { font-weight: 800; }
.category-bar { margin-top: 6px; }
.tab-item-small { font-size: 12px; font-weight: 600; padding: 7px 2px 9px; gap: 14px; }
.tab-item-small.active::after { width: 16px; height: 2px; bottom: 3px; }
.subcategory-bar { gap: 16px; }
.space-search { margin-top: 12px; }
.search-clear {
  flex: 0 0 auto; padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); font-size: 12px; font-weight: 600; background: var(--surface);
}
.search-clear:hover { color: #C2556B; border-color: #F6DDE0; }

/* ---------- 未归属分类提示 ---------- */
.orphan-card { margin-bottom: 16px; border-color: #F6DDE0; background: #FFF8F8; }
.orphan-card .card-heading h2 { color: #C2556B; }

/* 切换筛选时保留旧列表并轻微淡出，避免整块闪成加载骨架 */
.waterfall.is-refreshing { opacity: 0.45; transition: opacity 0.15s ease; pointer-events: none; }
#subcategory-area:empty { display: none; }
