/* ==========================================================================
   Storefront UI system — P0 (2026-11-11)
   前台/账户共用；令牌沿用 site.css 的 --accent/--navy/--price，只补间距/字号档位。
   组件前缀 .ui-*，避免与历史页面样式冲突。
   ========================================================================== */

/* 2026-11-14 B5：不再维护第二套尺度 —— 统一别名到 tokens.css 的单一真相源。
   后台的 --ad-* 不受影响。 */
.app-shell,
body{
  --ui-space-1:var(--sp-1); --ui-space-2:var(--sp-2); --ui-space-3:var(--sp-3);
  --ui-space-4:var(--sp-4); --ui-space-5:var(--sp-5); --ui-space-6:var(--sp-6);
  --ui-radius-sm:var(--r-sm); --ui-radius-md:var(--r-md); --ui-radius-lg:var(--r-lg);
  --ui-text-xs:var(--text-caption); --ui-text-sm:var(--text-small);
  --ui-text-md:var(--text-body); --ui-text-lg:var(--text-lead);
  --ui-text-xl:var(--text-h2);
}

/* 区块头：标题 + 副标题 + View all */
.ui-section-head{
  display:flex; justify-content:space-between; align-items:flex-end; flex-wrap:wrap;
  gap:var(--ui-space-3); margin-bottom:var(--ui-space-4);
}
.ui-section-title{
  margin:0; font-size:var(--ui-text-xl); font-weight:700; line-height:1.25;
  color:var(--navy, #0d1b2a);
}
.ui-section-sub{
  margin:4px 0 0; font-size:var(--ui-text-md); color:var(--muted, #6b7280);
}

/* 价格块 */
.ui-price{ display:flex; align-items:baseline; gap:6px; flex-wrap:wrap; }
.ui-price-main{ font-size:20px; font-weight:700; color:var(--price, #c0392b); }
.ui-price-meta{ font-size:var(--ui-text-sm); color:var(--muted, #6b7280); }

/* CTA 组：主按钮唯一，次按钮统一 outline */
.ui-cta-group{ display:flex; gap:var(--ui-space-2); flex-wrap:wrap; align-items:center; }
.ui-cta-group .btn{ white-space:nowrap; }

/* 筛选条：桌面横排，手机可横向滚动 / 折叠 */
.ui-filter-bar{
  display:flex; gap:var(--ui-space-2); align-items:center; flex-wrap:wrap;
  margin-bottom:var(--ui-space-4);
}
@media (max-width: 575.98px){
  .ui-filter-bar{ flex-wrap:nowrap; overflow-x:auto; -webkit-overflow-scrolling:touch; padding-bottom:4px; }
  .ui-filter-bar > *{ flex:0 0 auto; }
}

/* 空状态 */
.ui-empty{
  text-align:center; padding:var(--ui-space-6) var(--ui-space-4); color:var(--muted, #6b7280);
}
.ui-empty .bi{ font-size:30px; display:block; margin-bottom:var(--ui-space-2); opacity:.5; }
.ui-empty-title{ font-size:var(--ui-text-lg); font-weight:600; color:var(--navy, #0d1b2a); }

/* 分页 */
.ui-pager{ margin-top:var(--ui-space-5); }

/* 前台表单一致性（与后台同一口径，但不动后台 .ad-*） */
.ui-form .form-label{ font-size:var(--ui-text-sm); font-weight:600; margin-bottom:6px; }
.ui-form .form-text{ font-size:var(--ui-text-xs); color:var(--muted, #6b7280); }
.ui-form .form-control,
.ui-form .form-select{ font-size:var(--ui-text-md); border-radius:var(--ui-radius-sm); }

/* 结账步骤条 */
.ui-steps{ display:flex; gap:var(--ui-space-2); flex-wrap:wrap; margin-bottom:var(--ui-space-4); }
.ui-step{
  display:flex; align-items:center; gap:6px; padding:6px 10px; border-radius:999px;
  background:var(--light, #f3f4f6); color:var(--muted, #6b7280); font-size:var(--ui-text-sm);
}
.ui-step.is-active{ background:var(--accent, #0453f3); color:#fff; }
.ui-step.is-done{ background:#e8f0fe; color:var(--accent, #0453f3); }

/*
 * 结账三步在手机上**必须一行**（2026-11-14 用户：1.Cart / 2.Address&shipping /
 * 3.Payment 换行了）。原样式 `flex-wrap:wrap` + 各 chip 按内容定宽，390px 下超宽折行。
 * 现在：不换行、三等分、字号收紧；长的那一格省略号兜底。
 */
@media (max-width: 575.98px){
  .ui-steps{ flex-wrap:nowrap; gap:4px; }
  .ui-step{
    flex:1 1 0; min-width:0; justify-content:center;
    padding:6px 4px; font-size:.75rem; white-space:nowrap;
    overflow:hidden; text-overflow:ellipsis;
  }
  .ui-step i{ display:none; }   /* 图标让位给文字，三步才装得下 */
}

/* 结账页底部操作区：手机上吸底，总价/下单按钮始终可点（2026-11-11 P2）。 */
@media (max-width: 575.98px){
  .ui-checkout-actions{
    position:sticky; bottom:0; z-index:5;
    background:#fff; padding:10px 0 12px;
    border-top:1px solid var(--border, #e5e6eb);
    margin:0 -12px; padding-left:12px; padding-right:12px;
  }
}

/* ---- 阶梯价「下一档」进度条（2026-11-13，默认关，见 Site::$gami）----
 * 纯新增类名，不影响任何现有元素。骨架由 partials/buy/tier_progress.php 出，
 * 数字/进度由 assets/js/tier-progress.js 填。 */
.tier-progress{ margin-top:var(--sp-2, .5rem); }
.tier-progress__text{
  display:flex; flex-wrap:wrap; gap:.25rem;
  font-size:var(--fs-sm, .8rem); color:var(--navy-2, #4b5563); line-height:1.35;
}
.tier-progress__text .tp-main{ font-weight:600; }
.tier-progress__text .tp-hint{ color:var(--accent, #0453f3); }
.tier-progress__bar{
  height:6px; margin-top:var(--sp-1, .25rem);
  border-radius:var(--r-pill, 999px);
  background:var(--light, #f3f4f6); overflow:hidden;
}
.tier-progress__fill{
  display:block; width:0; height:100%;
  border-radius:inherit; background:var(--accent, #0453f3);
  transition:width .25s ease;
}
@media (prefers-reduced-motion: reduce){
  .tier-progress__fill{ transition:none; }
}

/* ---- 订单状态进度轨（2026-11-13）----
 * 四步：Ordered → Processing → In transit → Delivered。
 * 纯展示，见 partials/order_status_rail.php。 */
.order-rail{
  display:flex; align-items:flex-start;
  margin:0 0 var(--sp-4, 1rem);
  padding:var(--sp-3, .75rem) var(--sp-2, .5rem);
  border:1px solid var(--border, #e5e6eb);
  border-radius:var(--r-lg, 1rem);
  background:#fff;
}
.order-rail__step{
  flex:1 1 0; position:relative; text-align:center; min-width:0;
}
.order-rail__step::before{
  content:''; position:absolute; top:5px; right:50%; width:100%; height:2px;
  background:var(--border, #e5e6eb);
}
.order-rail__step:first-child::before{ display:none; }
.order-rail__step.is-done::before,
.order-rail__step.is-current::before{ background:var(--accent, #0453f3); }

.order-rail__dot{
  position:relative; z-index:1; display:inline-block;
  width:12px; height:12px; border-radius:50%;
  background:#fff; border:2px solid var(--border, #e5e6eb);
}
.order-rail__step.is-done .order-rail__dot,
.order-rail__step.is-current .order-rail__dot{
  background:var(--accent, #0453f3); border-color:var(--accent, #0453f3);
}
.order-rail__step.is-current .order-rail__dot{
  box-shadow:0 0 0 4px rgba(var(--accent-rgb, 4, 83, 243), .18);
}

.order-rail__label{
  display:block; margin-top:var(--sp-1, .25rem);
  font-size:var(--fs-xs, .72rem); line-height:1.25;
  color:var(--muted, #6b7280); word-break:break-word;
}
.order-rail__step.is-done .order-rail__label,
.order-rail__step.is-current .order-rail__label{
  color:var(--navy, #111827); font-weight:600;
}

/* 紧凑版（列表行内用；当前没接，留着给后续） */
.order-rail--sm{ padding:var(--sp-2, .5rem); margin-bottom:var(--sp-2, .5rem); }
.order-rail--sm .order-rail__label{ font-size:10px; }

/* 列表行内的极简进度条（状态徽章下面那一条，2026-11-13）。
 * 四个等宽小段，已完成的是品牌色 —— 只做辅助，信息仍以徽章为准。 */
.order-mini{ display:flex; gap:2px; margin-top:4px; max-width:72px; }
.order-mini span{
  flex:1 1 0; height:3px; border-radius:2px;
  background:var(--border, #e5e6eb);
}
.order-mini span.on{ background:var(--accent, #0453f3); }

/* ---- 买家等级徽章（2026-11-13）----
 * 15 级：1–5 钻 ◆ / 1–5 冠 ♛ / 1–5 王者 ♚。
 * 配色按档位分，星数用填充/空心表示。 */
.buyer-level{
  margin-top:var(--sp-3, .75rem); text-align:left;
  padding:var(--sp-2, .5rem) var(--sp-3, .75rem);
  border:1px solid var(--border, #e5e6eb); border-radius:var(--r-md, .625rem);
  background:#fbfcfe;
}
.buyer-level__head{ display:flex; align-items:baseline; justify-content:space-between; gap:.5rem; }
.buyer-level__stars{ font-size:.95rem; line-height:1; white-space:nowrap; }
/* 未达标的图标仍保持**彩色**（用户 2026-11-13：「彩色的」）——只降透明度，不做灰度。 */
.buyer-level__stars .bl-ico{ display:inline-block; opacity:.22; filter:saturate(1); }
.buyer-level__stars .bl-ico.is-on{ opacity:1; }
.buyer-level__name{ font-size:var(--fs-xs, .72rem); font-weight:700; text-transform:uppercase; letter-spacing:.04em; }

.buyer-level__bar{
  height:5px; margin-top:6px; border-radius:999px;
  background:var(--light, #f3f4f6); overflow:hidden;
}
.buyer-level__bar > span{ display:block; height:100%; width:0; border-radius:inherit; }
.buyer-level__note{ margin-top:5px; font-size:var(--fs-xs, .72rem); color:var(--muted, #6b7280); }

/* 三档配色 */
.buyer-level.is-diamond .buyer-level__stars,
.buyer-level.is-diamond .buyer-level__name{ color:#0453f3; }
.buyer-level.is-diamond .buyer-level__bar > span{ background:#0453f3; }

.buyer-level.is-crown .buyer-level__stars,
.buyer-level.is-crown .buyer-level__name{ color:#b8860b; }
.buyer-level.is-crown .buyer-level__bar > span{ background:#b8860b; }

.buyer-level.is-king .buyer-level__stars,
.buyer-level.is-king .buyer-level__name{ color:#7c3aed; }
.buyer-level.is-king .buyer-level__bar > span{ background:#7c3aed; }

/* 身份横条里的轻量等级进度（2026-11-13 三端对齐）。 */
.ai-level__bar{
  height:5px; margin-top:3px; border-radius:999px;
  background:var(--light, #f3f4f6); overflow:hidden;
}
.ai-level__bar > span{ display:block; height:100%; border-radius:inherit; background:var(--accent, #0453f3); }
.ai-level.is-crown .ai-level__bar > span{ background:#b8860b; }
.ai-level.is-king .ai-level__bar > span{ background:#7c3aed; }

/* ---- 定制步骤进度条（2026-11-13，仅 customize 页）----
 * 四步：Pick template → Upload artwork → Preview → Save。
 * 状态由页面末尾那段脚本实时判定。 */
.cz-steps{
  display:flex; align-items:center; gap:.25rem;
  margin:0 0 var(--sp-4, 1rem);
  padding:.6rem .9rem;
  border:1px solid var(--border, #e5e6eb); border-radius:12px; background:#fff;
}
.cz-step{
  flex:1 1 0; position:relative; min-width:0;
  display:flex; align-items:center; gap:.4rem;
  font-size:var(--fs-sm, .8rem); color:var(--muted, #6b7280);
}
.cz-step::before{
  content:''; position:absolute; left:0; top:50%; width:100%; height:2px;
  background:var(--border, #e5e6eb); transform:translateY(-50%); z-index:0;
}
.cz-step:first-child::before{ display:none; }
.cz-step.is-done::before,
.cz-step.is-active::before{ background:var(--accent, #0453f3); }

.cz-dot{
  position:relative; z-index:1; flex:0 0 22px; width:22px; height:22px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  background:#fff; border:2px solid var(--border, #e5e6eb);
  font-size:.72rem; font-weight:700;
}
.cz-step.is-done .cz-dot{ background:var(--accent, #0453f3); border-color:var(--accent, #0453f3); color:#fff; }
.cz-step.is-active .cz-dot{
  border-color:var(--accent, #0453f3); color:var(--accent, #0453f3);
  box-shadow:0 0 0 3px rgba(var(--accent-rgb, 4, 83, 243), .16);
}
.cz-step.is-done,
.cz-step.is-active{ color:var(--navy, #111827); font-weight:600; }

/* 连接线从圆点**右侧**起画，标签用白底盖住线 —— 否则线会横穿文字。 */
.cz-step::before{ left:22px; right:0; width:auto; }
.cz-label{ position:relative; z-index:1; background:#fff; padding:0 .35rem; }

@media (max-width: 575.98px){
  .cz-steps{ gap:0; padding:.5rem .6rem; }
  .cz-step{ justify-content:center; }
  .cz-step .cz-label{ display:none; }
}

/* ---- 买家成就墙（2026-11-14）----
 * 未解锁的保持可见但压暗 + 进度条 —— 空位才是目标提示。 */
.achievement-grid{
  display:grid; grid-template-columns:repeat(auto-fill, minmax(118px, 1fr)); gap:.6rem;
}
.achievement{
  position:relative; text-align:center; padding:.7rem .5rem;
  border:1px solid var(--border, #e5e6eb); border-radius:var(--r-md, .625rem);
  background:#fbfcfe; opacity:.62;
}
.achievement.is-earned{
  opacity:1; background:var(--accent-soft, #eef4ff); border-color:#d7e3ff;
}
.achievement__icon{ position:relative; display:inline-block; font-size:1.5rem; color:var(--muted, #6b7280); }
.achievement.is-earned .achievement__icon{ color:var(--accent, #0453f3); }
.achievement__tick{
  position:absolute; right:-7px; bottom:-3px; font-size:.78rem;
  color:#198754; background:#fff; border-radius:50%;
}
.achievement__label{ font-size:.72rem; font-weight:600; margin-top:.35rem; color:var(--navy, #111827); }
.achievement__bar{
  height:4px; margin-top:.4rem; border-radius:999px;
  background:var(--light, #f3f4f6); overflow:hidden;
}
.achievement__bar > span{ display:block; height:100%; background:var(--accent, #0453f3); }
.achievement__meta{ font-size:.65rem; color:var(--muted, #6b7280); margin-top:.2rem; }

/* ---- 卖家资料完成度清单（2026-11-14）----
 * 从"缺 X/Y/Z"改成可点清单：未完成项链到资料页，已完成项压暗打勾。 */
.profile-checklist{ display:flex; flex-direction:column; gap:2px; }
.profile-checklist__item{
  display:flex; align-items:center; gap:.5rem;
  padding:.38rem .5rem; border-radius:var(--r-sm, .375rem);
  font-size:.82rem; color:var(--navy, #111827); text-decoration:none;
}
a.profile-checklist__item:hover{ background:var(--light, #f3f4f6); }
.profile-checklist__item .bi-circle{ color:var(--muted, #6b7280); font-size:.8rem; }
.profile-checklist__item.is-done{ color:var(--muted, #6b7280); }
.profile-checklist__item.is-done .bi-check-circle-fill{ color:#198754; }
.profile-checklist__label{ flex:1 1 auto; min-width:0; }

/* ---- 活跃热力图（2026-11-14）----
 * GitHub 贡献图的形态，纯 CSS grid：每列一周、每行一个星期几。
 * 颜色沿用品牌蓝的深浅，不引第三方库。 */
.activity-heatmap__scroll{ overflow-x:auto; padding-bottom:2px; }
.ah-months{ display:grid; grid-auto-flow:column; grid-auto-columns:11px; gap:3px; height:15px; }
.ah-months > span{
  font-size:.62rem; line-height:1; color:var(--muted, #6b7280);
  white-space:nowrap; overflow:visible; /* 月份字比格子宽，允许压到右边一列 */
}
.ah-grid{ display:grid; grid-auto-flow:column; grid-template-rows:repeat(7, 11px); grid-auto-columns:11px; gap:3px; }
.ah-cell{ display:inline-block; width:11px; height:11px; border-radius:2px; background:#ebedf0; }
.ah-cell.is-empty{ background:transparent; }
.ah-cell.l0{ background:#ebedf0; }
.ah-cell.l1{ background:#cddcff; }
.ah-cell.l2{ background:#9dbaff; }
.ah-cell.l3{ background:#5b86f7; }
.ah-cell.l4{ background:var(--accent, #0453f3); }
.ah-legend .ah-cell{ width:9px; height:9px; vertical-align:middle; margin:0 1px; }
