/* ==========================================================================
   知乐物 · components.css
   导航 / 公告条 / 按钮 / 商品卡 / 表单 / 表格 / 标签 / Toast / 步骤条 / 页脚
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 公告条
   -------------------------------------------------------------------------- */
.announce {
  background: var(--color-primary);
  color: var(--color-white);
}

.announce__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 32px;
  padding-block: var(--sp-1);
  font-size: var(--fs-micro);
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
}

@media (min-width: 768px) {
  .announce__inner { min-height: 36px; font-size: var(--fs-caption); }
}

.announce__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.announce__link {
  color: var(--color-white);
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}
.announce__link:hover { color: var(--color-white); }

.announce__close {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-left: var(--sp-1);
  color: rgba(255, 255, 255, 0.72);
}
.announce__close::before {
  content: "";
  position: absolute;
  inset: -8px -9px;
}
.announce__close:hover { color: var(--color-white); }

/* --------------------------------------------------------------------------
   2. 顶部导航
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-page);
  transition: box-shadow var(--dur-fast) ease, border-color var(--dur-fast) ease;
  border-bottom: 1px solid transparent;
}

.site-header.is-scrolled {
  background: var(--color-paper);
  box-shadow: var(--shadow-3);
  border-bottom-color: var(--border-subtle);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  height: var(--h-header);
}

.logo {
  display: inline-flex;
  align-items: baseline;
  gap: var(--sp-1);
  margin-right: auto;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
}
.logo:hover { color: var(--text-strong); }

@media (min-width: 1024px) { .logo { font-size: 22px; margin-right: 0; } }

.logo__mark {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--color-primary);
  border-radius: var(--radius-xs);
  transform: translateY(-2px);
}

.logo__sub {
  font-size: var(--fs-micro);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

/* 主导航（≥768 显示） */
.main-nav { display: none; }

@media (min-width: 768px) {
  .main-nav {
    display: flex;
    align-items: center;
    height: var(--h-header);
    margin-left: var(--sp-7);
    margin-right: auto;
  }
}

.main-nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: var(--h-header);
  padding-inline: var(--sp-4);
  font-size: var(--fs-body-sm);
  font-weight: 500;
  color: var(--text-body);
  white-space: nowrap;
}
.main-nav__link:hover { color: var(--color-primary); }
.main-nav__link[aria-current="page"] {
  color: var(--text-strong);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--color-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

@media (min-width: 1024px) { .header-actions { gap: var(--sp-2); } }

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  color: var(--text-body);
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.icon-btn:hover {
  background: var(--bg-subtle);
  color: var(--color-primary);
}
.icon-btn__badge {
  position: absolute;
  top: 6px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding-inline: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-micro);
  font-weight: 700;
  line-height: 1;
  color: var(--color-white);
  background: var(--color-price);
  border-radius: var(--radius-pill);
}
@media (min-width: 1024px) {
  .icon-btn__badge { min-width: 20px; height: 20px; top: 4px; right: 0; }
}

/* --------------------------------------------------------------------------
   3. 底部 Tab 栏（< 768 显示）
   -------------------------------------------------------------------------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  display: flex;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-up);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (min-width: 768px) { .tabbar { display: none; } }
body.is-flow .tabbar { display: none; }

.tabbar__item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: var(--h-tabbar);
  font-size: var(--fs-micro);
  font-weight: 500;
  color: var(--color-ink-500);
  text-decoration: none;
  position: relative;
}
.tabbar__item:hover { color: var(--color-ink-500); }
.tabbar__item[aria-current="page"] {
  color: var(--color-primary);
  font-weight: 600;
}
.tabbar__item[aria-current="page"] svg { stroke-width: 2; }

.tabbar__badge {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(2px);
  min-width: 16px;
  height: 16px;
  padding-inline: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-num);
  font-size: var(--fs-micro);
  font-weight: 700;
  line-height: 1;
  color: var(--color-white);
  background: var(--color-price);
  border-radius: var(--radius-pill);
}
/* --------------------------------------------------------------------------
   4. 按钮
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 40px;
  padding: 0 var(--sp-4);
  font-family: var(--font-sans);
  font-size: var(--fs-body-sm);
  line-height: 1;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--dur-fast) ease,
              border-color var(--dur-fast) ease,
              color var(--dur-fast) ease,
              transform 100ms ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:focus-visible {
  outline: 2px solid transparent;
  box-shadow: var(--focus-ring);
}

.btn--xs { height: 28px; padding-inline: 10px; font-size: var(--fs-micro); border-radius: var(--radius-sm); }
.btn--sm { height: 32px; padding-inline: var(--sp-3); font-size: var(--fs-caption); }
.btn--md { height: 40px; padding-inline: var(--sp-4); font-size: var(--fs-body-sm); }
.btn--lg { height: 48px; padding-inline: var(--sp-6); font-size: var(--fs-body); }
.btn--xl { height: 52px; padding-inline: var(--sp-6); font-size: var(--fs-h4); }
.btn--full { width: 100%; }

.btn--primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-white);
}
.btn--primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); color: var(--color-white); }
.btn--primary:active { background: var(--color-primary-darker); border-color: var(--color-primary-darker); transform: translateY(1px); }

.btn--secondary {
  background: transparent;
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.btn--secondary:hover { background: var(--color-primary-light); color: var(--color-primary-dark); }
.btn--secondary:active { background: #DDE8E2; transform: translateY(1px); }

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding-inline: var(--sp-2);
}
.btn--ghost:hover { background: var(--color-primary-light); color: var(--color-primary-dark); }
.btn--ghost.btn--danger {
  background: transparent;
  border-color: transparent;
  color: var(--color-danger);
}
.btn--ghost.btn--danger:hover { background: var(--color-danger-bg); color: var(--color-danger); }

.btn--danger {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: var(--color-white);
}
.btn--danger:hover { background: #94231A; border-color: #94231A; color: var(--color-white); }

.btn--plain {
  background: var(--bg-surface);
  border-color: var(--border-strong);
  color: var(--text-body);
}
.btn--plain:hover { background: var(--bg-subtle); color: var(--text-strong); }

.btn[disabled],
.btn[aria-disabled="true"] {
  background: var(--color-sand-100);
  color: var(--color-ink-400);
  border-color: transparent;
  cursor: not-allowed;
  transform: none;
}
.btn[disabled]:hover,
.btn[aria-disabled="true"]:hover {
  background: var(--color-sand-100);
  color: var(--color-ink-400);
}

.btn--loading { pointer-events: none; }
.btn--loading .btn__spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--color-white);
  border-radius: 50%;
  animation: zl-spin 800ms linear infinite;
}

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

/* 文字链 */
.text-link {
  color: var(--text-link);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
}
.text-link:hover { color: var(--color-primary-dark); }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--fs-body-sm);
  font-weight: 500;
  color: var(--color-primary);
  text-decoration: none;
}
.link-arrow:hover { color: var(--color-primary-dark); }
.link-arrow:hover .link-arrow__text { text-decoration: underline; text-underline-offset: 3px; }

/* --------------------------------------------------------------------------
   5. 卡片 / 面板
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
}

.card--pad { padding: var(--sp-4); }
@media (min-width: 1024px) { .card--pad { padding: var(--sp-6); } }

.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
}
@media (min-width: 1024px) { .panel { padding: var(--sp-6); } }

.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  padding-bottom: var(--sp-3);
  margin-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
}

.panel__title {
  font-size: var(--fs-h4);
  font-weight: 600;
  color: var(--text-strong);
}

/* --------------------------------------------------------------------------
   6. 商品卡
   -------------------------------------------------------------------------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--grid-gap);
}
@media (min-width: 768px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1024px) and (max-width: 1279px) {
  .has-sidebar .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.card--grid {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  transition: box-shadow var(--dur-base) var(--ease-out),
              transform var(--dur-base) var(--ease-out);
}

@media (hover: hover) {
  .card--grid:hover {
    box-shadow: var(--shadow-2);
    transform: translateY(-2px);
  }
  .card--grid:hover .media img { transform: scale(1.03); }
}

.card--grid__link {
  display: block;
  color: inherit;
  text-decoration: none;
}
.card--grid__link:hover { color: inherit; }

/* 图片容器 */
.media {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--color-sand-50);
  border-radius: inherit;
}

.media > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 320ms var(--ease-out);
}

@supports not (aspect-ratio: 1 / 1) {
  .media::before { content: ""; display: block; padding-top: 100%; }
  .media > img { position: absolute; inset: 0; }
}

.media img.is-error { visibility: hidden; }

.media.is-error::after {
  content: "";
  position: absolute;
  inset: 0;
  background-color: var(--bg-inset);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238C8375' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Cpath d='m3 16 5-5 4 4 3-3 6 6'/%3E%3Cpath d='m2 2 20 20'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center 40%;
  background-size: 32px 32px;
}

.media.is-error::before {
  content: "图片加载失败";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 32%;
  text-align: center;
  font-size: var(--fs-micro);
  line-height: 1;
  color: var(--text-muted);
  z-index: 1;
}

/* 卡内容 */
.card--grid__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--sp-3) var(--sp-3) var(--sp-4);
}
@media (min-width: 1024px) {
  .card--grid__body { padding: var(--sp-4) var(--sp-4) 18px; }
}

.card--grid__name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.9em;
  font-size: var(--fs-body);
  line-height: 1.45;
  font-weight: 500;
  color: var(--text-strong);
}

.card--grid__sub {
  display: none;
  margin-top: var(--sp-1);
  font-size: var(--fs-caption);
  line-height: 1.5;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (min-width: 768px) { .card--grid__sub { display: block; } }

.card--grid__spec {
  margin-top: var(--sp-1);
  font-size: var(--fs-caption);
  line-height: 1.5;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card--grid__foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.price-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--sp-2);
  min-width: 0;
}

.price {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-price);
  white-space: nowrap;
}

.price__sym {
  font-size: 60%;
  font-weight: 600;
  vertical-align: 0.08em;
  margin-right: 2px;
}

.price--card { font-size: var(--fs-price); line-height: 1.15; }
@media (min-width: 1024px) { .price--card { font-size: var(--fs-price-lg); } }
.price--detail { font-size: var(--fs-price-xl); line-height: 1.05; }
.price--pay { font-size: var(--fs-display); line-height: 1.1; }
.price--sm { font-size: var(--fs-price-sm); line-height: 1.2; font-weight: 600; }
.price--lg { font-size: var(--fs-price-lg); line-height: 1.1; }

.price-original {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-caption);
  font-weight: 400;
  color: var(--text-muted);
  text-decoration: line-through;
  white-space: nowrap;
}

.card--grid__sales {
  margin-top: var(--sp-1);
  font-size: var(--fs-micro);
  line-height: 1.4;
  color: var(--text-muted);
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

/* 加购按钮（绝对定位在卡片右下，位于 <a> 外） */
.add-btn {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background: var(--color-primary-light);
  color: var(--color-primary);
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.add-btn:hover { background: var(--color-primary); color: var(--color-white); }
.add-btn[disabled] {
  background: var(--bg-inset);
  color: var(--color-ink-400);
  cursor: not-allowed;
}

/* 角标 */
.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding-inline: 6px;
  font-size: var(--fs-micro);
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-xs);
  white-space: nowrap;
}
.badge--discount { background: var(--color-price); color: var(--color-white); }
.badge--hot { background: var(--color-accent-light); color: var(--color-accent-strong); }
.badge--free { background: var(--color-accent); color: var(--color-white); }
.badge--soldout { background: rgba(38, 34, 32, 0.72); color: var(--color-white); }
.badge--stock { background: var(--color-warning-bg); color: var(--color-warning); }

.card__badges {
  position: absolute;
  top: var(--sp-2);
  left: var(--sp-2);
  right: var(--sp-2);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-2);
  pointer-events: none;
  z-index: 2;
}
.card__badges > span { display: inline-flex; gap: var(--sp-1); }

/* 缺货态 */
.card--grid.is-soldout .media img { filter: grayscale(0.6) opacity(0.72); }

/* 横滑卡 */
.scroll-x {
  display: flex;
  gap: var(--sp-3);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-inline: var(--gutter);
  margin-inline: calc(var(--gutter) * -1);
  scrollbar-width: none;
}
.scroll-x::-webkit-scrollbar { display: none; }
.scroll-x > * { flex: 0 0 148px; scroll-snap-align: start; }

/* 迷你卡 */
.card--mini {
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  padding-block: var(--sp-3);
  color: inherit;
  text-decoration: none;
}
.card--mini:hover { color: inherit; }
.card--mini .media { width: 72px; height: 72px; flex-shrink: 0; border-radius: var(--radius-sm); }
.card--mini__info { min-width: 0; flex: 1; }
.card--mini__name {
  font-size: var(--fs-body-sm);
  font-weight: 500;
  color: var(--text-strong);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   7. 标签
   -------------------------------------------------------------------------- */
.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding-inline: var(--sp-2);
  font-size: var(--fs-micro);
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-xs);
  white-space: nowrap;
}
.tag--sm { height: 20px; padding-inline: 6px; }
.tag--lg { height: 26px; padding-inline: 10px; font-size: var(--fs-caption); font-weight: 600; border-radius: var(--radius-sm); }

.tag--neutral { color: var(--color-ink-600); background: var(--color-sand-50); }
.tag--outline { color: var(--text-muted); background: transparent; border: 1px solid var(--border-strong); }
.tag--primary { color: var(--color-primary); background: var(--color-primary-light); }
.tag--accent { color: var(--color-accent-strong); background: var(--color-accent-light); }
.tag--danger { color: var(--color-white); background: var(--color-danger); }
.tag--warning { color: var(--color-warning); background: var(--color-warning-bg); }
.tag--success { color: var(--color-success); background: var(--color-success-bg); }
.tag--info { color: var(--color-info); background: var(--color-info-bg); }

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

/* --------------------------------------------------------------------------
   8. 分类 Tab / 排序条 / 搜索
   -------------------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  padding: var(--sp-3) var(--gutter);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-page);
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  /* 移动端：分类多于屏宽，靠左排列 + 横向滚动 */
  justify-content: flex-start;
  /* scroll-snap-align:start 会把首项吸附到滚动容器边缘，导致左侧 padding 被吃掉、
     「全部」按钮紧贴屏幕边。给出 scroll-padding 让吸附点内缩一个 gutter。 */
  scroll-padding-inline: var(--gutter);
}
/* 桌面端：分类一屏放得下时整组水平居中，与 .container 的中轴线对齐
   （.tabs 满宽 + 居中 = 视口中线；容器本身也居中，两者重合）
   注意只在「放得下」的宽度启用居中，否则首尾项会被 overflow 裁掉且滚不回来；
   safe center 兜底：万一内容仍超出，退化为靠左而不是丢失左侧内容。
   长度预算：1440 可用 1360px，当前 8 项共约 925px；名字若再加长到 10 字以上，
   1024 断点（可用 960px）就会溢出并让居中失效。 */
@media (min-width: 1024px) {
  .tabs {
    justify-content: center;
    justify-content: safe center;
  }
}
.tabs::-webkit-scrollbar { display: none; }

.tabs__item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  height: 34px;
  padding-inline: 14px;
  font-size: var(--fs-body-sm);
  font-weight: 500;
  color: var(--text-body);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  text-decoration: none;
  scroll-snap-align: start;
}
/* 视觉 34px，热区扩展到 44px（上下各外扩 5px，落在容器 padding 内） */
.tabs__item::before {
  content: "";
  position: absolute;
  inset: -5px 0;
}
.tabs__item:hover { color: var(--text-strong); border-color: var(--border-strong); }
.tabs__item[aria-pressed="true"],
.tabs__item[aria-selected="true"],
.tabs__item.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-white);
  font-weight: 600;
}
.tabs__count { font-size: var(--fs-caption); color: var(--color-ink-mute); font-family: var(--font-num); }

/* 吸顶筛选区（移动端） */
.filter-sticky {
  position: sticky;
  z-index: 60;
  top: var(--h-header);
  background: var(--bg-page);
}

/* 排序条 */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  min-height: 44px;
  padding-block: var(--sp-1);
  border-bottom: 1px solid var(--border-subtle);
}

.toolbar__count {
  font-size: var(--fs-caption);
  color: var(--text-muted);
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

.toolbar__actions { display: flex; align-items: center; gap: var(--sp-2); }

/* 分段式排序按钮组 */
.segmented {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  flex-wrap: wrap;
}

.segmented__btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding-inline: var(--sp-3);
  font-size: var(--fs-caption);
  font-weight: 500;
  color: var(--text-body);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  white-space: nowrap;
  cursor: pointer;
}
/* 视觉 32px，热区扩展到 44px */
.segmented__btn::before {
  content: "";
  position: absolute;
  inset: -6px 0;
}
.segmented__btn:hover { border-color: var(--border-strong); color: var(--text-strong); }
.segmented__btn[aria-pressed="true"] {
  color: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: inset 0 0 0 1px var(--color-primary);
  font-weight: 600;
  background: var(--color-primary-light);
}

/* 搜索框 */
.search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.search__icon {
  position: absolute;
  left: var(--sp-3);
  color: var(--text-muted);
  pointer-events: none;
}
.search__input {
  width: 100%;
  height: 44px;
  padding: 0 var(--sp-4) 0 40px;
  font-size: max(16px, var(--fs-body));
  color: var(--text-strong);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  -webkit-appearance: none;
  appearance: none;
}
.search__input::placeholder { color: var(--text-placeholder); }
.search__input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(45, 90, 78, 0.14);
}

/* --------------------------------------------------------------------------
   9. 表单
   -------------------------------------------------------------------------- */
.field { margin-bottom: var(--sp-5); }
.field:last-child { margin-bottom: 0; }

.field__label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--fs-body-sm);
  font-weight: 600;
  color: var(--text-body);
}

.req { color: var(--color-danger); margin-left: 2px; }

.field__hint {
  margin-top: 6px;
  font-size: var(--fs-caption);
  color: var(--text-muted);
  line-height: 1.6;
}

.field__error {
  display: none;
  align-items: flex-start;
  gap: var(--sp-1);
  margin-top: 6px;
  font-size: var(--fs-caption);
  line-height: 1.6;
  color: var(--color-danger);
}
.field__error svg { margin-top: 2px; flex-shrink: 0; }
.field.is-invalid .field__error { display: flex; }

.input,
.select,
.textarea {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  font-size: max(16px, var(--fs-body));
  color: var(--text-strong);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
@media (min-width: 1024px) {
  .input, .select { height: 44px; font-size: var(--fs-body); padding-inline: var(--sp-3); }
}

.input::placeholder,
.textarea::placeholder { color: var(--text-placeholder); }

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(45, 90, 78, 0.14);
}

.textarea {
  height: auto;
  min-height: 88px;
  padding: var(--sp-3) 14px;
  line-height: 1.6;
  resize: vertical;
}

.select {
  padding-right: var(--sp-8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236E6558' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

.field.is-invalid .input,
.field.is-invalid .select,
.field.is-invalid .textarea {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(176, 42, 30, 0.12);
}
.field.is-invalid .input:focus,
.field.is-invalid .select:focus,
.field.is-invalid .textarea:focus {
  border-color: var(--color-danger);
  box-shadow: var(--focus-ring-danger);
}

.input[readonly],
.textarea[readonly] {
  background: var(--bg-subtle);
  border-color: transparent;
  color: var(--text-body);
}

.input[disabled],
.select[disabled],
.textarea[disabled] {
  background: var(--bg-inset);
  color: var(--color-ink-400);
  cursor: not-allowed;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.field-row > .field { margin-bottom: 0; }
@media (min-width: 480px) {
  .field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
}
.field-row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }

@media (min-width: 768px) {
  .field-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-5);
  }
  .field-grid-2 > .field { margin-bottom: 0; }
  .field-grid-2 { margin-bottom: var(--sp-5); }
}

/* 复选框 */
.check {
  position: relative;
  display: inline-flex;
  align-items: flex-start;
  gap: var(--sp-2);
  min-height: 44px;
  padding-block: var(--sp-2);
  cursor: pointer;
  font-size: var(--fs-body-sm);
  color: var(--text-body);
  line-height: 1.6;
}

.check__input {
  position: absolute;
  opacity: 0;
  width: 20px;
  height: 20px;
  margin: 0;
  cursor: pointer;
}

.check__box {
  position: relative;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}

.check__box svg {
  position: absolute;
  inset: 0;
  margin: auto;
  opacity: 0;
  color: var(--color-white);
}

.check__input:checked + .check__box {
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.check__input:checked + .check__box svg { opacity: 1; }

.check__input:indeterminate + .check__box {
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.check__input:indeterminate + .check__box::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  background: var(--color-white);
  border-radius: 1px;
}
.check__input:indeterminate + .check__box svg { opacity: 0; }

.check__input:focus-visible + .check__box { box-shadow: var(--focus-ring); }

.check__input:disabled + .check__box {
  background: var(--bg-inset);
  border-color: var(--border-default);
}
.check__input:disabled ~ .check__label { color: var(--color-ink-400); }

.check:hover .check__box { border-color: var(--color-primary); }

/* 单选框（整块卡片） */
.radio-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 64px;
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.radio-card:hover { border-color: var(--border-strong); }

.radio-card__input {
  position: absolute;
  opacity: 0;
  width: 20px;
  height: 20px;
  right: var(--sp-4);
  top: 50%;
  margin: -10px 0 0;
}

.radio-card__dot {
  position: relative;
  flex-shrink: 0;
  margin-left: auto;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  background: var(--color-white);
}
.radio-card__input:checked ~ .radio-card__dot {
  border: 6px solid var(--color-primary);
}
.radio-card__input:focus-visible ~ .radio-card__dot { box-shadow: var(--focus-ring); }

.radio-card:has(.radio-card__input:checked) {
  border-color: var(--color-primary);
  box-shadow: inset 0 0 0 1px var(--color-primary);
  background: var(--color-primary-light);
}

.radio-card__main { min-width: 0; flex: 1; }
.radio-card__title {
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--text-strong);
  line-height: 1.4;
}
.radio-card__desc {
  font-size: var(--fs-caption);
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 2px;
}

/* 数量步进器 */
.stepper {
  display: inline-flex;
  align-items: stretch;
  height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-surface);
}

.stepper__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 100%;
  background: var(--bg-subtle);
  color: var(--text-body);
  transition: background-color var(--dur-fast) ease;
}
/* 内部边框把可用高度压到 42px，用负外边距把热区补回 44px（视觉不变） */
@media (max-width: 767px) {
  .stepper__btn { margin-block: -1px; height: calc(100% + 2px); }
}
.stepper__btn:hover:not([disabled]) { background: var(--bg-inset); }
.stepper__btn:active:not([disabled]) { background: var(--border-default); }
.stepper__btn[disabled] {
  color: var(--color-ink-400);
  background: var(--bg-inset);
  cursor: not-allowed;
}

.stepper__value {
  width: 48px;
  height: 100%;
  text-align: center;
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--text-strong);
  background: var(--bg-surface);
  border: 0;
  border-inline: 1px solid var(--border-strong);
  -moz-appearance: textfield;
  -webkit-appearance: none;
  appearance: none;
  padding: 0;
}
.stepper__value::-webkit-outer-spin-button,
.stepper__value::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper__value:focus { outline: none; box-shadow: inset var(--focus-ring); }

@media (min-width: 1024px) {
  .stepper { height: 36px; }
  .stepper__btn { width: 36px; }
  .stepper__value { width: 44px; }
}

.stepper--sm { height: 36px; }
.stepper--sm .stepper__btn { width: 36px; }
.stepper--sm .stepper__value { width: 40px; font-size: var(--fs-body-sm); }

/* 触屏：紧凑步进器抬到 44px 热区 */
@media (max-width: 767px) {
  .stepper--sm { height: 44px; }
  .stepper--sm .stepper__btn { width: 44px; }
  .stepper--sm .stepper__value { width: 44px; }
}

/* --------------------------------------------------------------------------
   10. 表格
   -------------------------------------------------------------------------- */
.table-wrap {
  width: 100%;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-surface);
}

.table { width: 100%; table-layout: fixed; }

.table caption {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.table thead th {
  height: 48px;
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-body-sm);
  font-weight: 600;
  color: var(--text-strong);
  text-align: left;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-strong);
}

.table tbody td {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-body-sm);
  line-height: 1.7;
  color: var(--text-body);
  border-top: 1px solid var(--border-subtle);
  vertical-align: top;
}

.table tbody tr:first-child td { border-top: 0; }

.table--params tbody th {
  width: 140px;
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-body-sm);
  font-weight: 500;
  color: var(--text-muted);
  text-align: left;
  border-top: 1px solid var(--border-subtle);
  vertical-align: top;
  background: transparent;
}
.table--params tbody tr:nth-child(even) { background: var(--bg-subtle); }
.table--params tbody tr:nth-child(even) th { background: transparent; }

.table--rules tbody th {
  width: 200px;
  padding: var(--sp-4);
  font-size: var(--fs-body-sm);
  font-weight: 600;
  color: var(--text-strong);
  text-align: left;
  border-top: 1px solid var(--border-subtle);
  vertical-align: top;
}
.table--rules tbody td { padding: var(--sp-4); }

.table td.n,
.table th.n { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; }

/* 移动端卡片化 */
@media (max-width: 767px) {
  .table-wrap--responsive { border: 0; border-radius: 0; background: transparent; overflow: visible; }
  .table-wrap--responsive .table thead { display: none; }
  .table-wrap--responsive .table,
  .table-wrap--responsive .table tbody,
  .table-wrap--responsive .table tr,
  .table-wrap--responsive .table th,
  .table-wrap--responsive .table td { display: block; width: 100%; }

  .table-wrap--responsive .table tbody tr {
    padding: var(--sp-3) var(--sp-3);
    margin-bottom: var(--sp-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
  }
  .table-wrap--responsive .table tbody tr:nth-child(even) { background: var(--bg-surface); }
  .table-wrap--responsive .table tbody tr:last-child { margin-bottom: 0; }

  .table-wrap--responsive .table tbody th,
  .table-wrap--responsive .table tbody td {
    padding: 0;
    border: 0;
    text-align: left;
    font-size: var(--fs-body-sm);
    color: var(--text-strong);
  }
  .table-wrap--responsive .table tbody td + td,
  .table-wrap--responsive .table tbody th + td { margin-top: var(--sp-2); }

  .table-wrap--responsive .table tbody td[data-label]::before,
  .table-wrap--responsive .table tbody th[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    font-size: var(--fs-micro);
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.4;
  }
}

/* --------------------------------------------------------------------------
   11. 提示块
   -------------------------------------------------------------------------- */
.notice {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--border-strong);
  background: var(--bg-subtle);
  font-size: var(--fs-body-sm);
  line-height: 1.7;
  color: var(--text-body);
}
.notice > svg { margin-top: 3px; flex-shrink: 0; }
.notice__title {
  display: block;
  font-weight: 600;
  color: var(--text-strong);
  margin-bottom: var(--sp-1);
}
.notice p { margin-bottom: var(--sp-2); }
.notice p:last-child { margin-bottom: 0; }

.notice--info { background: var(--color-info-bg); border-left-color: var(--color-info); color: var(--color-ink-700); }
.notice--info > svg { color: var(--color-info); }
.notice--warning { background: var(--color-warning-bg); border-left-color: var(--color-warning); color: var(--color-ink-700); }
.notice--warning > svg { color: var(--color-warning); }
.notice--success { background: var(--color-success-bg); border-left-color: var(--color-success); color: var(--color-ink-700); }
.notice--success > svg { color: var(--color-success); }
.notice--danger { background: var(--color-danger-bg); border-left-color: var(--color-danger); color: var(--color-ink-700); }
.notice--danger > svg { color: var(--color-danger); }
.notice--accent { background: var(--color-accent-light); border-left-color: var(--color-accent); color: var(--color-ink-700); }
.notice--accent > svg { color: var(--color-accent-strong); }
.notice--primary { background: var(--color-primary-light); border-left-color: var(--color-primary); color: var(--color-ink-700); }
.notice--primary > svg { color: var(--color-primary); }

/* --------------------------------------------------------------------------
   12. Toast
   -------------------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--h-tabbar-total) + env(safe-area-inset-bottom, 0px) + var(--sp-4));
  transform: translate(-50%, 8px);
  z-index: 900;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  max-width: 320px;
  min-width: 160px;
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-body-sm);
  font-weight: 500;
  line-height: 1.5;
  color: var(--color-white);
  background: rgba(22, 19, 15, 0.92);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-3);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 160ms ease, transform 180ms var(--ease-out), visibility 160ms;
}

.toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  pointer-events: auto;
  transition: opacity 180ms ease, transform 180ms var(--ease-out), visibility 0ms;
}

.toast svg { flex-shrink: 0; }

@media (min-width: 768px) {
  .toast {
    bottom: auto;
    top: 88px;
    max-width: 420px;
    transform: translate(-50%, -8px);
  }
  .toast.is-visible { transform: translate(-50%, 0); }
}

body.is-flow .toast { bottom: calc(var(--sp-4) + env(safe-area-inset-bottom, 0px)); }

/* --------------------------------------------------------------------------
   13. 步骤条
   -------------------------------------------------------------------------- */
.steps {
  padding-block: var(--sp-3);
}
@media (min-width: 1024px) { .steps { padding-block: var(--sp-5); } }

.steps__list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 560px;
  margin-inline: auto;
}

.steps__item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
}

.steps__item::before {
  content: "";
  position: absolute;
  top: 12px;
  left: -50%;
  width: 100%;
  height: 1px;
  background: var(--border-default);
}
.steps__item:first-child::before { display: none; }
.steps__item[data-state="done"]::before,
.steps__item[data-state="current"]::before { background: var(--color-primary); }

.steps__dot {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-family: var(--font-num);
  font-size: var(--fs-micro);
  font-weight: 600;
  color: var(--color-ink-500);
  background: var(--bg-inset);
  border: 1px solid var(--border-default);
  border-radius: 50%;
}

.steps__item[data-state="current"] .steps__dot,
.steps__item[data-state="done"] .steps__dot {
  color: var(--color-white);
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.steps__label {
  font-size: var(--fs-micro);
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.3;
  text-align: center;
}
.steps__item[data-state="current"] .steps__label,
.steps__item[data-state="done"] .steps__label {
  color: var(--text-strong);
  font-weight: 600;
}

@media (min-width: 1024px) {
  .steps__dot { width: 28px; height: 28px; font-size: var(--fs-caption); }
  .steps__item::before { top: 14px; height: 2px; }
  .steps__label { font-size: var(--fs-body-sm); }
}

/* 售后流程 5 步 */
.flow5 {
  display: grid;
  gap: var(--sp-3);
  counter-reset: flow;
}
@media (min-width: 768px) { .flow5 { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--sp-3); } }

.flow5__item {
  position: relative;
  padding: var(--sp-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}
.flow5__step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-bottom: var(--sp-2);
  font-family: var(--font-num);
  font-size: var(--fs-micro);
  font-weight: 700;
  color: var(--color-white);
  background: var(--color-primary);
  border-radius: 50%;
}
.flow5__title {
  font-size: var(--fs-body-sm);
  font-weight: 600;
  color: var(--text-strong);
  line-height: 1.5;
  margin-bottom: var(--sp-1);
}
.flow5__desc { font-size: var(--fs-caption); color: var(--text-muted); line-height: 1.6; }

/* --------------------------------------------------------------------------
   14. 面包屑
   -------------------------------------------------------------------------- */
.breadcrumb { padding-block: var(--sp-3); }
@media (min-width: 1024px) { .breadcrumb { padding-block: var(--sp-4); } }

.breadcrumb__list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: var(--fs-caption);
  line-height: 1.5;
  color: var(--text-muted);
}

.breadcrumb__list li { display: inline-flex; align-items: center; gap: 6px; }
.breadcrumb__list li + li::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238C8375' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px;
}

.breadcrumb__list a { color: var(--text-link); font-weight: 400; }
.breadcrumb__list a:hover { text-decoration: underline; text-underline-offset: 3px; }
.breadcrumb__list [aria-current="page"] { color: var(--text-body); font-weight: 500; }

@media (max-width: 767px) {
  .breadcrumb__list .is-mid { display: none; }
  .breadcrumb__list .is-mid + .is-mid::before { display: none; }
}

/* --------------------------------------------------------------------------
   15. 空状态
   -------------------------------------------------------------------------- */
.empty {
  padding: var(--sp-10) var(--sp-6);
  text-align: center;
}
.empty__art {
  width: 120px;
  height: 120px;
  margin: 0 auto;
  color: var(--color-ink-400);
}
@media (min-width: 1024px) { .empty__art { width: 160px; height: 160px; } }

.empty__title {
  margin-top: var(--sp-6);
  font-size: var(--fs-h3);
  font-weight: 600;
  color: var(--text-strong);
}
.empty__desc {
  max-width: 320px;
  margin: var(--sp-2) auto 0;
  font-size: var(--fs-body-sm);
  line-height: 1.7;
  color: var(--text-muted);
}
.empty__actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  align-items: center;
  margin-top: var(--sp-6);
}
.empty__actions .btn { width: 100%; max-width: 280px; }

/* --------------------------------------------------------------------------
   16. 页脚
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--bg-inverse);
  color: var(--color-sand-200);
  padding-block: var(--sp-7) var(--sp-6);
  margin-top: var(--sp-8);
}
@media (min-width: 1024px) { .site-footer { padding-block: var(--sp-10) var(--sp-7); margin-top: var(--sp-11); } }

body.is-flow .site-footer { margin-top: var(--sp-7); }

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-6);
}
@media (min-width: 768px) {
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-7); }
}
@media (min-width: 1024px) {
  .footer-grid {
    /* 品牌列需要容纳「知乐物 · 上海知乐读科技有限公司」单行，1.4fr 会挤成两行 */
    grid-template-columns: 1.8fr repeat(3, minmax(0, 1fr));
    gap: var(--sp-7);
  }
}

.footer-brand__name {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-white);
  line-height: 1.4;
  /* 中文长公司名允许在「·」后断，但避免「公/司」被拆开 */
  word-break: keep-all;
  overflow-wrap: break-word;
}
@media (min-width: 1024px) { .footer-brand__name { font-size: 22px; } }

.footer-brand__slogan {
  margin-top: var(--sp-1);
  font-size: var(--fs-caption);
  color: var(--color-ink-mute);
  line-height: 1.7;
}

.footer-brand__desc {
  margin-top: var(--sp-3);
  font-size: var(--fs-caption);
  line-height: 1.8;
  color: var(--color-sand-200);
  max-width: 30em;
}

.footer-col__title {
  font-size: var(--fs-body-sm);
  font-weight: 600;
  color: var(--color-white);
  margin-bottom: var(--sp-3);
}

.footer-col ul { display: block; }
.footer-col li { line-height: 2.1; }

.footer-col a,
.footer-link {
  font-size: var(--fs-caption);
  color: var(--color-sand-200);
  text-decoration: none;
}
.footer-col a:hover,
.footer-link:hover { color: var(--color-white); text-decoration: underline; text-underline-offset: 3px; }

@media (min-width: 1024px) {
  .footer-col a, .footer-link { font-size: var(--fs-body-sm); }
  .footer-col li { line-height: 2; }
}

.footer-contact {
  margin-top: var(--sp-6);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--border-inverse);
}
@media (min-width: 1024px) { .footer-contact { margin-top: var(--sp-7); padding-top: var(--sp-6); } }

/* 页脚联系方式：客服电话与邮箱都已从页脚撤下，只剩 2 项（注册地址 / 工作时间）。
   两项按等宽两列排布 —— 若维持 3 列会在右侧留出一整格空白，栅格与上方
   页脚栏目也对不齐。手机上单列堆叠，无需额外声明。 */
.footer-contact__list {
  display: grid;
  gap: var(--sp-3);
}
@media (min-width: 768px) {
  .footer-contact__list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
}
@media (min-width: 1024px) {
  .footer-contact__list { gap: var(--sp-5); }
}

.footer-contact__item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  font-size: var(--fs-caption);
  line-height: 1.7;
  color: var(--color-sand-200);
}
.footer-contact__item svg { margin-top: 3px; color: var(--color-ink-mute); flex-shrink: 0; }

.footer-contact__strong {
  display: block;
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--color-white);
  line-height: 1.5;
}
a.footer-contact__strong { color: var(--color-white); text-decoration: none; }
a.footer-contact__strong:hover { color: var(--color-white); text-decoration: underline; text-underline-offset: 3px; }

.footer-legal {
  margin-top: var(--sp-6);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border-inverse);
  font-size: var(--fs-micro);
  line-height: 1.9;
  color: var(--color-ink-mute);
}

.footer-legal__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1) var(--sp-2);
}

.footer-legal__sep { color: var(--color-ink-400); }

.footer-legal a {
  color: var(--color-sand-200);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.footer-legal a:hover { color: var(--color-white); }

@media (min-width: 1024px) {
  .footer-legal__row { justify-content: center; }
}

/* --------------------------------------------------------------------------
   17. 底部固定操作栏
   -------------------------------------------------------------------------- */
.action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: calc(var(--h-bar) + env(safe-area-inset-bottom, 0px));
  padding: 0 var(--gutter) env(safe-area-inset-bottom, 0px);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-up);
}

@media (min-width: 1024px) { .action-bar { display: none; } }

/* 与底部 Tab 栏同时存在时，操作栏必须叠在 Tab 栏之上，不能互相遮挡 */
@media (max-width: 767px) {
  body:not(.is-flow) .action-bar {
    bottom: calc(var(--h-tabbar-total) + env(safe-area-inset-bottom, 0px));
  }
}

.action-bar__sum { min-width: 0; }
.action-bar__label {
  font-size: var(--fs-micro);
  color: var(--text-muted);
  line-height: 1.4;
}
.action-bar__sub {
  font-size: var(--fs-micro);
  color: var(--text-muted);
  line-height: 1.4;
}
.action-bar__price {
  font-size: var(--fs-h2);
  line-height: 1.2;
}
.action-bar__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
}
.action-bar__actions .btn { flex: 1; min-width: 0; }

/* 页面底部占位
   ------------------------------------------------------------------------
   固定栏在各宽度下的实际存在情况（必须与 .tabbar / .action-bar 的 display 断点对齐）：
     ≥ 1024px  : 操作栏、Tab 栏都不固定 → 不留白
     768–1023  : 只剩操作栏（Tab 栏在 768 起隐藏）→ 只留操作栏高度
     < 768px   : 操作栏 + Tab 栏两层叠放（.action-bar 用 bottom 抬到 Tab 栏之上）

   两个条件同时成立才留白：
     1) 宽度在固定栏存在的区间内（媒体查询）；
     2) 该面板此刻真的在显示 —— 购物车为空时脚本会给 #cart-action-bar 加 hidden，
        若只凭 .has-action-bar 这个静态 class 留白，页脚下方会凭空多出 80px 死白。
        :has(.action-bar:not([hidden])) 让占位跟随真实可见性。 */
.has-action-bar { padding-bottom: 0; }

@media (max-width: 1023px) {
  .has-action-bar:has(.action-bar:not([hidden])),
  body.is-flow.has-action-bar:has(.action-bar:not([hidden])) {
    padding-bottom: calc(var(--h-bar) + env(safe-area-inset-bottom, 0px) + var(--sp-4));
  }
}

/* 非流程页在手机上还压着一层 Tab 栏，占位必须叠加 */
@media (max-width: 767px) {
  body:not(.is-flow).has-action-bar:has(.action-bar:not([hidden])) {
    padding-bottom: calc(var(--h-bar) + var(--h-tabbar-total) + env(safe-area-inset-bottom, 0px) + var(--sp-4));
  }
}

/* 不支持 :has() 的旧内核（Chrome < 105 / Safari < 15.4）兜底：
   只要挂了 .has-action-bar 就按有操作栏留白，宁可多留一点也不能让按钮盖住内容。 */
@supports not selector(:has(*)) {
  @media (max-width: 1023px) {
    .has-action-bar,
    body.is-flow.has-action-bar {
      padding-bottom: calc(var(--h-bar) + env(safe-area-inset-bottom, 0px) + var(--sp-4));
    }
  }
  @media (max-width: 767px) {
    body:not(.is-flow).has-action-bar {
      padding-bottom: calc(var(--h-bar) + var(--h-tabbar-total) + env(safe-area-inset-bottom, 0px) + var(--sp-4));
    }
  }
}

/* --------------------------------------------------------------------------
   18. 布局辅助：两栏
   -------------------------------------------------------------------------- */
.split {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-6);
}
@media (min-width: 1024px) {
  .split--sidebar { grid-template-columns: 800px minmax(0, 1fr); gap: var(--sp-7); }
  .split--checkout { grid-template-columns: minmax(0, 760px) 408px; gap: var(--sp-7); }
}

.sticky-col { position: static; }
@media (min-width: 1024px) {
  .sticky-col { position: sticky; top: calc(var(--h-header) + var(--sp-4)); }
}

/* --------------------------------------------------------------------------
   19. 金额明细
   -------------------------------------------------------------------------- */
.summary { display: grid; gap: var(--sp-2); }

.summary__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  font-size: var(--fs-body-sm);
  line-height: 1.8;
  color: var(--text-body);
}
.summary__row dt { color: var(--text-muted); }
.summary__row dd { margin: 0; font-family: var(--font-num); font-variant-numeric: tabular-nums; }

.summary__row--total {
  margin-top: var(--sp-1);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border-subtle);
  align-items: center;
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--text-strong);
}
.summary__row--total dt { color: var(--text-strong); font-weight: 600; }
.summary__row--total .price { font-size: var(--fs-price-lg); }

.summary__free { color: var(--color-success); font-weight: 600; font-size: var(--fs-body-sm); }

/* --------------------------------------------------------------------------
   20. 折叠面板
   -------------------------------------------------------------------------- */
.accordion { border-top: 1px solid var(--border-subtle); }
.accordion__item { border-bottom: 1px solid var(--border-subtle); }

.accordion__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  width: 100%;
  min-height: 48px;
  padding: var(--sp-3) 0;
  font-size: var(--fs-body-sm);
  font-weight: 600;
  line-height: 1.6;
  color: var(--text-strong);
  text-align: left;
}
.accordion__trigger:hover { color: var(--color-primary); }
.accordion__trigger svg { flex-shrink: 0; color: var(--text-muted); transition: transform var(--dur-base) var(--ease-in-out); }
.accordion__trigger[aria-expanded="true"] svg { transform: rotate(180deg); }

.accordion__panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 240ms var(--ease-in-out);
}
.accordion__panel > div { overflow: hidden; }

/* 展开态：按钮外面可能套了 <h3>/<h4>，用 :has() 从 item 层判断，
   不能写 `.trigger[aria-expanded] + .panel`——那要求两者直接相邻 */
.accordion__item:has(.accordion__trigger[aria-expanded="true"]) .accordion__panel {
  grid-template-rows: 1fr;
}
/* 不支持 :has() 的老内核兜底：仍按直接相邻写一遍，不影响新内核 */
.accordion__trigger[aria-expanded="true"] + .accordion__panel { grid-template-rows: 1fr; }

.accordion__body {
  padding-bottom: var(--sp-4);
  font-size: var(--fs-body-sm);
  line-height: 1.72;
  color: var(--text-body);
}
.accordion__body p { margin-bottom: var(--sp-2); }
.accordion__body p:last-child { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   21. 对话框
   -------------------------------------------------------------------------- */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  background: var(--bg-overlay);
}
.dialog {
  width: 100%;
  max-width: 340px;
  padding: var(--sp-6);
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-4);
  animation: zl-dialog-in 180ms var(--ease-out);
}
@media (min-width: 1024px) { .dialog { max-width: 400px; } }

@keyframes zl-dialog-in {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.dialog__title { font-size: var(--fs-h4); font-weight: 600; color: var(--text-strong); }
.dialog__desc { margin-top: var(--sp-2); font-size: var(--fs-body-sm); line-height: 1.7; color: var(--text-body); }
.dialog__actions { display: flex; gap: var(--sp-3); justify-content: flex-end; margin-top: var(--sp-6); }

/* --------------------------------------------------------------------------
   22. 分隔标题
   -------------------------------------------------------------------------- */
.divider-title {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.divider-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* 小标题（详情页区块） */
.subhead {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  font-size: var(--fs-h3);
  font-weight: 600;
  color: var(--text-strong);
  line-height: 1.4;
}
.subhead::before {
  content: "";
  width: 3px;
  height: 18px;
  background: var(--color-primary);
  border-radius: 1px;
  flex-shrink: 0;
}

/* 编号列表 */
.numlist { counter-reset: nl; display: grid; gap: var(--sp-3); }
.numlist > li {
  position: relative;
  padding-left: var(--sp-7);
  font-size: var(--fs-body);
  line-height: 1.72;
  color: var(--text-body);
}
.numlist > li::before {
  counter-increment: nl;
  content: counter(nl, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 2px;
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-body-sm);
  font-weight: 700;
  color: var(--color-accent-strong);
  letter-spacing: 0.02em;
}

/* 方点列表 */
.dotlist { display: grid; gap: var(--sp-2); }
.dotlist > li {
  position: relative;
  padding-left: var(--sp-5);
  font-size: var(--fs-body-sm);
  line-height: 1.72;
  color: var(--text-body);
}
.dotlist > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--color-primary-mid);
}

/* --------------------------------------------------------------------------
   23. 服务徽章
   -------------------------------------------------------------------------- */
.service-badges {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2) var(--sp-3);
}
.service-badge {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--fs-caption);
  color: var(--text-body);
  line-height: 1.5;
}
.service-badge svg { color: var(--color-primary); flex-shrink: 0; }

/* --------------------------------------------------------------------------
   24. 图片画廊
   -------------------------------------------------------------------------- */
.gallery { display: flex; flex-direction: column; gap: var(--sp-3); }

.gallery__main {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-sand-50);
  border: 1px solid var(--border-default);
  cursor: zoom-in;
  width: 100%;
  display: block;
  padding: 0;
}
.gallery__main .media { border-radius: 0; }
.gallery__main img { transition: opacity 180ms ease; }

.gallery__thumbs {
  display: flex;
  gap: var(--sp-2);
  justify-content: center;
}
@media (min-width: 1024px) {
  .gallery__thumbs { justify-content: flex-start; gap: var(--sp-3); }
}

.gallery__thumb {
  width: 68px;
  height: 68px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid transparent;
  background: var(--color-sand-50);
  padding: 0;
  cursor: pointer;
  transition: border-color var(--dur-fast) ease;
}
@media (min-width: 1024px) { .gallery__thumb { width: 88px; height: 88px; } }
.gallery__thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery__thumb[aria-pressed="true"] { border-color: var(--color-primary); }
.gallery__thumb:hover { border-color: var(--border-strong); }
.gallery__thumb[aria-pressed="true"]:hover { border-color: var(--color-primary); }

/* 圆点：视觉 6px，点击热区 28×44（::after 画视觉圆点） */
.gallery__dots { display: flex; gap: 0; justify-content: center; }
.gallery__dot {
  position: relative;
  width: 28px;
  height: 44px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}
.gallery__dot::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-strong);
  transition: width var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.gallery__dot[aria-pressed="true"]::after {
  width: 18px;
  border-radius: 3px;
  background: var(--color-primary);
}

@media (min-width: 768px) { .gallery__dots { display: none; } }
@media (max-width: 767px) { .gallery__thumbs { display: none; } }

/* 全屏图片查看 */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 960;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  background: #16130F;
}
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox__close {
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-white);
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
}
.lightbox__close:hover { background: rgba(255, 255, 255, 0.22); }

/* --------------------------------------------------------------------------
   25. 骨架屏
   -------------------------------------------------------------------------- */
.skeleton {
  background: var(--bg-inset);
  border-radius: 3px;
  background-image: linear-gradient(90deg, #EDE7DC 25%, #F5F1EA 37%, #EDE7DC 63%);
  background-size: 400% 100%;
  animation: zl-shimmer 1400ms ease-in-out infinite;
}
@keyframes zl-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
