/* ============================================================
   pages.css · 前台页面布局（首页 / 目录 / 详情 / 交易 / 账户）
   后台版式见 admin.css，两者共用组件但不共用布局
   ============================================================ */

/* ---------------------------------------------------- 首页 */
.shop-main { padding-top: var(--sp-6); flex: 1; width: 100%; }
.shop-page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.shop-page-heading h1 { font-size: var(--fs-hero); }
.shop-page-heading p { font-size: var(--fs-sm); color: var(--text-2); margin-top: 6px; }
.shop-announcement { display: flex; align-items: baseline; gap: var(--sp-4); padding: var(--sp-3) var(--sp-4); background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: 0 var(--r-md) var(--r-md) 0; margin-bottom: var(--sp-5); }
.announcement-label { font-size: var(--fs-xs); font-weight: 600; color: var(--brand); white-space: nowrap; }
.shop-announcement p { font-size: var(--fs-sm); color: var(--text-2); line-height: 1.7; }

/* 交付三步：数字商店的信任锚点 */
.delivery-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; margin-bottom: var(--sp-5); }
.delivery-step { background: var(--surface); padding: var(--sp-4); display: flex; gap: var(--sp-3); align-items: flex-start; }
.delivery-step .step-no { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--brand); border: 1px solid var(--brand-soft); background: var(--brand-tint); border-radius: 50%; width: 26px; height: 26px; display: grid; place-items: center; flex-shrink: 0; }
.delivery-step .step-title { font-size: var(--fs-sm); font-weight: 600; }
.delivery-step .step-desc { font-size: var(--fs-xs); color: var(--text-2); line-height: 1.6; margin-top: 2px; }

.shop-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: var(--sp-5); align-items: start; }
.store-catalog, .shop-purchase-panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-4); }
.catalog-section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.catalog-section-head h2 { font-size: var(--fs-md); }
.catalog-section-head h2 span { font-size: var(--fs-xs); font-weight: 400; color: var(--muted); margin-left: 8px; }
.home-catalog-tools { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; border-bottom: 1px solid var(--line); padding-bottom: var(--sp-3); margin-bottom: var(--sp-4); }
#home-categories, .delivery-filter { display: flex; gap: 6px; flex-wrap: wrap; }
#home-categories button, .delivery-filter button, .sort-tabs button { min-height: 32px; padding: 5px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); font-size: var(--fs-xs); color: var(--text-2); }
#home-categories button.on, .delivery-filter button.on, .sort-tabs button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.home-sort { display: flex; align-items: center; gap: var(--sp-3); margin-left: auto; }
.home-sort select { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 5px 8px; background: var(--surface); font-size: var(--fs-xs); }
.shop-sidebar { display: grid; gap: var(--sp-3); }
.shop-side-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-4); }
.shop-side-card h2 { font-size: var(--fs-md); margin-bottom: var(--sp-2); }
.shop-side-card p { font-size: var(--fs-xs); color: var(--text-2); line-height: 1.8; }
.shop-side-card .btn { width: 100%; margin: var(--sp-3) 0 var(--sp-2); }
.shop-side-card small { display: block; font-size: var(--fs-xs); color: var(--muted); }
.side-card-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--r-sm); background: var(--brand-tint); color: var(--brand); margin-bottom: var(--sp-3); }
.side-card-icon svg { width: 22px; height: 22px; }
.shop-guide { counter-reset: guide; display: grid; gap: var(--sp-3); }
.shop-guide li { counter-increment: guide; position: relative; padding-left: 24px; }
.shop-guide li::before { content: counter(guide); position: absolute; left: 0; top: 1px; width: 18px; height: 18px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 11px; display: grid; place-items: center; }
.shop-guide b { font-size: var(--fs-sm); font-weight: 600; }
.shop-guide p { margin-top: 2px; }

/* ---------------------------------------------------- 目录页 */
.catalog-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin: var(--sp-4) 0; }
.catalog-heading h1 { font-size: var(--fs-hero); }
.catalog-heading p { font-size: var(--fs-sm); color: var(--text-2); margin-top: 4px; }
.catalog-result-count { font-size: var(--fs-xs); color: var(--muted); }
.list-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
.list-side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-4); }
.side-title { font-size: var(--fs-sm); margin-bottom: var(--sp-3); }
#side-cats { display: grid; gap: 2px; }
.side-cat { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: var(--r-sm); font-size: var(--fs-sm); color: var(--text-2); }
.side-cat:hover { background: var(--brand-tint); }
.side-cat.on { background: var(--brand-soft); color: var(--brand-deep); font-weight: 600; }
.side-count { font-size: var(--fs-xs); color: var(--muted); }
.list-main { min-width: 0; }
.toolbar { display: flex; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; align-items: center; padding: var(--sp-3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.sort-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.price-filter { display: flex; align-items: center; gap: 6px; }
.price-input { width: 92px; padding: 6px 8px; }
.dash { color: var(--muted); }
.catalog-options { display: flex; gap: var(--sp-4); flex-wrap: wrap; align-items: center; padding: var(--sp-3) 2px; }
.more-filter { width: 100%; border-top: 1px solid var(--line); padding-top: var(--sp-3); }
.more-filter > summary { font-size: var(--fs-xs); color: var(--brand); cursor: pointer; list-style: none; }
.more-filter > summary::-webkit-details-marker { display: none; }
.more-filter > summary::before { content: "+ "; }
.more-filter[open] > summary::before { content: "− "; }
.more-filter-body { display: flex; gap: var(--sp-4); flex-wrap: wrap; align-items: center; padding-top: var(--sp-3); }
.catalog-filters-summary { min-height: 0; }
#list-grid.prod-grid { margin-top: var(--sp-3); }

/* ---------------------------------------------------- 详情页 */
.pd-layout { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: var(--sp-6); align-items: start; padding: var(--sp-5) 0; }
.pd-gallery { position: sticky; top: calc(var(--header-h) + 16px); }
.pd-main-art { height: 280px; display: grid; place-items: center; background: var(--brand-tint); border: 1px solid var(--line); border-radius: var(--r-md); color: var(--brand); }
.pd-main-art .prod-art, .pd-main-art .digital-art { width: 96px; height: 96px; background: var(--surface); }
.pd-main-art .art-caption, .pd-main-art .prod-art .art-caption, .pd-main-art .digital-art .art-caption { display: block; font-size: 12px; }
.product-art-note { font-size: var(--fs-xs); color: var(--text-2); text-align: center; margin-top: var(--sp-3); line-height: 1.7; }
.pd-info { min-width: 0; }
.pd-title { font-size: var(--fs-xl); margin-top: 8px; }
.pd-subtitle { font-size: var(--fs-sm); color: var(--text-2); margin-top: 6px; }
.pd-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; margin-top: var(--sp-3); }
.pd-facts > div { background: var(--surface); padding: 8px 10px; }
.pd-facts dt { font-size: 11px; color: var(--muted); }
.pd-facts dd { font-size: var(--fs-sm); margin: 2px 0 0; color: var(--text); }
.pd-price-panel { display: flex; align-items: baseline; gap: var(--sp-3); flex-wrap: wrap; margin: var(--sp-4) 0; padding: var(--sp-4); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); }
.pd-price-panel .price { font-size: 30px; }
.pd-specs { margin: var(--sp-3) 0 0; }
.pd-meta { display: flex; gap: var(--sp-4); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--muted); padding-bottom: var(--sp-3); border-bottom: 1px solid var(--line); }
.pd-meta b { color: var(--text); }
.pd-decision { display: flex; gap: var(--sp-3); flex-wrap: wrap; padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); font-size: var(--fs-xs); color: var(--text-2); }
.pd-decision span { display: inline-flex; align-items: center; gap: 5px; }
.pd-decision b { color: var(--text); font-weight: 600; }
.pd-qty-row { display: flex; align-items: center; gap: var(--sp-3); margin: var(--sp-4) 0; }
.pd-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.pd-actions .btn-primary { flex: 0 1 220px; min-width: 160px; }
.pd-services { font-size: var(--fs-xs); color: var(--ok); margin-top: var(--sp-3); }
.pd-section { margin: var(--sp-6) 0; }
.pd-section > h2 { font-size: var(--fs-lg); margin-bottom: var(--sp-3); padding-bottom: var(--sp-2); border-bottom: 1px solid var(--line); }
.pd-detail-text { font-size: var(--fs-sm); line-height: 1.9; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.pd-section.collapsible > h2 { cursor: pointer; }
.pd-related-wrap { margin-top: var(--sp-3); }

/* ---------------------------------------------------- 交易流程（购物车 / 结算 / 支付） */
.transaction-heading { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.transaction-heading h1 { font-size: var(--fs-hero); }
.transaction-heading a { font-size: var(--fs-sm); color: var(--brand); }
.flow-steps { display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-4) 0 var(--sp-5); padding: var(--sp-3) var(--sp-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow-x: auto; }
.flow-step { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.flow-step .flow-no { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-strong); font-family: var(--font-mono); font-size: 11px; flex-shrink: 0; }
.flow-step.on { color: var(--brand-deep); font-weight: 600; }
.flow-step.on .flow-no { background: var(--brand); border-color: var(--brand); color: #fff; }
.flow-step.done .flow-no { background: var(--brand-soft); border-color: var(--brand-soft); color: var(--brand); }
.flow-sep { flex: 1; min-width: 16px; height: 1px; background: var(--line); }

.cart-card { overflow: hidden; }
.cart-head, .cart-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 100px 110px 100px 60px; gap: var(--sp-3); align-items: center; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line); }
.cart-head { background: var(--surface-2); font-size: var(--fs-xs); color: var(--muted); }
.cart-row.invalid { opacity: .6; }
.cbx { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); cursor: pointer; }
.cbx input { accent-color: var(--brand); width: 16px; height: 16px; }
.cart-prod { display: flex; gap: var(--sp-3); align-items: center; min-width: 0; }
.cart-art { width: 52px; height: 52px; display: grid; place-items: center; background: var(--brand-tint); border-radius: var(--r-sm); color: var(--brand); flex-shrink: 0; }
.cart-art .prod-art, .cart-art .digital-art { width: 40px; height: 40px; background: transparent; }
.cart-art .art-caption { display: none; }
.cart-title { font-size: var(--fs-sm); font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-spec { font-size: var(--fs-xs); color: var(--muted); }
.cart-price { font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.cart-subtotal { color: var(--price); font-weight: 600; }
.cart-del { border: 0; background: transparent; color: var(--muted); font-size: var(--fs-xs); }
.cart-del:hover { color: var(--danger); }
.cart-bar { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; padding: var(--sp-3) var(--sp-4); margin-top: var(--sp-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
.cart-selected { font-size: var(--fs-sm); color: var(--text-2); }
.cart-total { margin-left: auto; font-size: var(--fs-sm); }
.cart-total .price { font-size: var(--fs-lg); }

.checkout-caption { font-size: var(--fs-xs); color: var(--text-2); line-height: 1.8; margin: var(--sp-3) 0; }
.checkout-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--sp-4); align-items: start; }
.checkout-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-4); margin-bottom: var(--sp-4); }
.checkout-card h2 { font-size: var(--fs-md); margin-bottom: var(--sp-3); }
.checkout-line { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); }
.checkout-line:last-child { border-bottom: 0; }
.checkout-line .prod-art, .checkout-line .digital-art { width: 48px; height: 48px; }
.checkout-line .art-caption { display: none; }
.checkout-line-title { flex: 1; min-width: 0; }
.checkout-line-title h3 { font-size: var(--fs-sm); }
.checkout-line-title p { font-size: var(--fs-xs); color: var(--muted); }
.checkout-line-amount { text-align: right; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.checkout-line-amount small { display: block; font-size: var(--fs-xs); color: var(--muted); }
.checkout-hint { font-size: var(--fs-xs); color: var(--text-2); background: var(--brand-tint); padding: var(--sp-3); border-radius: var(--r-sm); margin-bottom: var(--sp-4); line-height: 1.7; }
.checkout-form label { margin-bottom: var(--sp-4); }
.checkout-summary { position: sticky; top: calc(var(--header-h) + 16px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-4); }
.checkout-summary h2 { font-size: var(--fs-md); margin-bottom: var(--sp-3); }
.summary-row { display: flex; justify-content: space-between; gap: var(--sp-3); font-size: var(--fs-sm); padding: 7px 0; }
.summary-total { border-top: 1px solid var(--line); margin-top: var(--sp-2); padding-top: var(--sp-3); font-weight: 600; }
.summary-total strong { font-size: var(--fs-lg); color: var(--price); }
.checkout-summary .btn { width: 100%; margin: var(--sp-4) 0 var(--sp-2); }
.checkout-terms { font-size: var(--fs-xs); color: var(--text-2); line-height: 1.7; margin-bottom: var(--sp-3); }

/* ---------------------------------------------------- 个人中心 */
.acc-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: var(--sp-5); align-items: start; padding: var(--sp-5) 0; }
.acc-side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-4); position: sticky; top: calc(var(--header-h) + 16px); }
.acc-user { display: flex; align-items: center; gap: var(--sp-3); padding-bottom: var(--sp-4); border-bottom: 1px solid var(--line); margin-bottom: var(--sp-3); }
.acc-menu { display: grid; gap: 2px; }
.acc-menu a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 11px; border-radius: var(--r-sm); font-size: var(--fs-sm); color: var(--text-2); }
.acc-menu a:hover { background: var(--brand-tint); color: var(--brand); }
.acc-menu a.on { background: var(--brand-soft); color: var(--brand-deep); font-weight: 600; }
.menu-badge { font-size: 11px; background: var(--accent-soft); color: var(--accent); border-radius: var(--r-pill); padding: 0 6px; }
.acc-menu-group { display: grid; gap: 2px; margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px dashed var(--line); }
.acc-menu-label { font-size: 11px; color: var(--muted); padding: 0 11px 6px; letter-spacing: .5px; }
.acc-menu-group a { padding: 6px 11px; color: var(--muted); }
.acc-main { min-width: 0; }
.acc-panel { display: none; }
.acc-panel.on { display: block; }
.acc-tabs { display: flex; gap: var(--sp-3); border-bottom: 1px solid var(--line); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.acc-tabs button { border: 0; background: transparent; padding: 8px 2px; font-size: var(--fs-sm); color: var(--muted); border-bottom: 2px solid transparent; }
.acc-tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.account-extra-stats { display: flex; gap: var(--sp-4); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--muted); }
.account-recent { margin-top: var(--sp-5); }
.profile-avatar-section, .profile-grid { margin-top: var(--sp-4); }
.profile-avatar-row, .profile-avatar-actions, .profile-avatar-buttons { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.done-mark, .done { color: var(--ok); }

/* ---------------------------------------------------- 响应式 */
@media (max-width: 1200px) {
  .shop-workspace { grid-template-columns: minmax(0, 1fr) 250px; }
  .pd-layout { grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: var(--sp-5); }
  .checkout-layout { grid-template-columns: minmax(0, 1fr) 260px; }
}
@media (max-width: 900px) {
  .shop-workspace, .list-layout, .pd-layout, .checkout-layout, .acc-layout { grid-template-columns: 1fr; }
  .shop-sidebar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pd-gallery, .checkout-summary, .acc-side { position: static; }
  .pd-main-art { height: 200px; }
  .list-side { display: none; }
  .cart-head { display: none; }
  .cart-row { grid-template-columns: 36px minmax(0, 1fr) auto; gap: var(--sp-2); }
  .cart-price, .cart-row .stepper, .cart-subtotal { grid-column: 2 / 3; }
  .cart-del { grid-column: 3; grid-row: 1; }
  .delivery-steps { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .shop-page-heading h1, .catalog-heading h1, .transaction-heading h1 { font-size: var(--fs-xl); }
  .shop-sidebar { grid-template-columns: 1fr; }
  .home-sort { margin-left: 0; }
  .store-catalog, .shop-purchase-panel { padding: var(--sp-3); }
  .filter-check { font-size: var(--fs-xs); }
  .cart-bar { gap: var(--sp-2); }
  .cart-total { width: 100%; margin-left: 0; display: flex; justify-content: space-between; }
  .cart-bar .btn { width: 100%; }
  .profile-grid, .form-grid { grid-template-columns: 1fr; }
  .pd-facts { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow-steps { gap: 6px; padding: var(--sp-2) var(--sp-3); }
  .flow-step { font-size: 11px; }
  .flow-sep { min-width: 8px; }
  .checkout-line { flex-wrap: wrap; }
  .account-table-scroll th:nth-child(n+4), .account-table-scroll td:nth-child(n+4) { display: none; }
}

/* ---------------------------------------------------- 重构新增组件 */
.sort-tabs .sort-secondary { background: var(--surface-2); color: var(--muted); }
.toolbar-options { padding: 0; gap: var(--sp-3); }
.pd-secondary { padding: var(--sp-4); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); }
.pd-secondary > h2 { font-size: var(--fs-md); }
.checkout-delivery-hint { font-size: var(--fs-xs); color: var(--text-2); background: var(--brand-tint); padding: 8px 10px; border-radius: var(--r-sm); margin-bottom: var(--sp-3); line-height: 1.7; }
.payment-flow { width: min(480px, 100%); }
.payment-page .flow-steps { margin: 0 0 var(--sp-4); }
.more-filter .filter-error { width: 100%; }
.more-filter-body .price-filter { flex-wrap: wrap; }
.flow-step.done { color: var(--ok); }

/* 首页侧栏「订单与交付」卡：1.5.28 已有该卡，窄屏收成一行两列 */
@media (max-width: 640px) {
  .order-query-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--sp-3); align-items: center; }
  .order-query-card .side-card-icon { display: none; }
  .order-query-card h2 { grid-column: 1; margin-bottom: 4px; }
  .order-query-card > p { grid-column: 1; margin-bottom: 0; }
  .order-query-card .btn { grid-column: 2; grid-row: 1 / 3; width: auto; margin: 0; }
  .order-query-card > small { grid-column: 1 / -1; margin-top: var(--sp-2); }
}

