/* ==========================================================================
   商城前端样式 — 浅灰蓝底 / 白色卡片 / 蓝色主色
   ========================================================================== */

:root {
  --brand: #2878ff;
  --brand-rgb: 40, 120, 255;
  --on-brand: #ffffff;
  --brand-600: #1a63e0;
  --brand-050: #eef4ff;
  --brand-100: #dbe8ff;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --soft: #98a2b3;
  --line: #e4e8ef;
  --line-soft: #edf0f5;
  --bg: #fbfcfe;
  --white: #ffffff;
  --ok: #12a150;
  --ok-bg: #e8f8ef;
  --green: #0f9d6b;
  --green-line: #cbeedd;
  --warn: #b54708;
  --warn-bg: #fff4e5;
  --danger: #d92d20;
  --danger-bg: #fef1f0;
  --radius: 10px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow: 0 2px 6px rgba(16, 24, 40, .05), 0 1px 2px rgba(16, 24, 40, .03);
  --shadow-lg: 0 20px 48px rgba(16, 24, 40, .16), 0 6px 16px rgba(16, 24, 40, .07);
  --wrap: 1200px;
  --ring: 0 0 0 3px rgba(var(--brand-rgb), .14);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scrollbar-gutter: stable; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-2);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

body.no-scroll { overflow: hidden; }

h1, h2, h3, h4 { color: var(--ink); margin: 0; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
img { display: block; max-width: 100%; }
svg { display: block; width: 100%; height: 100%; }
[hidden] { display: none !important; }

::selection { background: var(--brand-100); color: var(--brand-600); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 6px;
}

.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(760px 420px at 12% -8%, rgba(var(--brand-rgb), .07), transparent 68%),
    radial-gradient(720px 420px at 88% 4%, rgba(132, 112, 255, .06), transparent 70%),
    radial-gradient(900px 520px at 55% 110%, rgba(var(--brand-rgb), .04), transparent 72%);
  background-position: center top;
  background-repeat: no-repeat;
  background-size: cover;
  pointer-events: none;
}
.bg-layer.is-photo { background-size: cover; background-attachment: fixed; }

.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 20px;
}
body > .wrap { flex: 1 0 auto; }

/* ============================ 导航 ============================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.nav-inner {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  height: 56px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 26px;
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-mark {
  flex: none;
  width: 24px;
  height: 24px;
  color: var(--brand);
}
.brand-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 30vw;
}
.nav-links { display: flex; align-items: center; gap: 20px; margin-left: 6px; }
.nav-link {
  padding: 4px 0;
  font-size: 14px;
  color: #475467;
  white-space: nowrap;
  transition: color .15s;
}
.nav-link:hover { color: var(--brand); }
.nav-cta {
  margin-left: auto;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(var(--brand-rgb), .22);
  transition: background .16s, box-shadow .16s;
}
.nav-cta svg { width: 14px; height: 14px; }
.nav-cta:hover { background: var(--brand-600); box-shadow: 0 4px 14px rgba(var(--brand-rgb), .3); }

/* ============================ 店铺身份 ============================ */
#shopMain { padding-top: 34px; }

.store-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-height: 60px;
}
.store-avatar {
  flex: none;
  width: 60px;
  height: 60px;
  border-radius: 14px;
  background: linear-gradient(140deg, var(--brand), var(--brand-600));
  background-size: cover;
  background-position: center;
  color: var(--on-brand);
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.store-meta { min-width: 0; flex: 1; }
.store-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 26px;
}
.store-meta h1 {
  font-size: 22px;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: -.015em;
  overflow-wrap: anywhere;
}
.store-sub {
  margin-top: 5px;
  font-size: 13.5px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.store-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.btn-soft {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fafbfc;
  color: #475467;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: border-color .15s, color .15s, background .15s;
}
.btn-soft svg { width: 13px; height: 13px; flex: none; }
.btn-soft:hover { border-color: var(--brand-100); color: var(--brand); background: var(--brand-050); }
.btn-soft.is-green { color: var(--green); border-color: var(--green-line); background: #f2fbf6; }
.btn-soft.is-green:hover { border-color: var(--green); background: #e7f7ee; }

/* ============================ 店铺联系方式 / 自定义按钮 ============================ */
.store-extra {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.contact-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.contact-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 3px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: #fff;
  font-size: 12px;
  color: var(--ink-2);
}
.contact-chip.is-link {
  border-color: var(--brand-100);
  background: var(--brand-050);
  color: var(--brand-600);
  transition: border-color .18s ease, background .18s ease;
}
.contact-chip.is-link:hover { border-color: var(--brand); background: var(--brand-100); }
.chip-label { flex: none; color: var(--soft); font-weight: 400; }
.contact-chip.is-link .chip-label { color: var(--brand-600); }
.chip-value {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.chip-copy {
  flex: none;
  padding: 1px 6px;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: #fff;
  color: var(--soft);
  font-size: 10.5px;
  font-weight: 500;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.chip-copy:hover { border-color: var(--brand); background: var(--brand); color: var(--on-brand); }
.chip-copy:focus-visible { outline: none; box-shadow: var(--ring); }
.link-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.store-link-btn {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 3px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  overflow-wrap: anywhere;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}
.store-link-btn:hover { border-color: var(--brand); background: var(--brand); color: var(--on-brand); }
.store-link-btn:focus-visible { outline: none; box-shadow: var(--ring); }

/* ============================ 公告 ============================ */
.notice {
  margin-top: 18px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13.5px;
  line-height: 1.7;
}
.notice-ico { flex: none; width: 15px; height: 15px; color: var(--ink-2); align-self: center; }
.notice-title { flex: none; color: var(--ink-2); font-weight: 600; }
.notice-text { flex: 1 1 0; min-width: 0; color: #667085; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ============================ 商城面板 ============================ */
.store-panel {
  margin-top: 18px;
  padding: 18px 22px 24px;
  background: var(--white);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 34px;
}
.panel-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.panel-title .bolt { width: 17px; height: 17px; flex: none; color: var(--brand); }
.panel-title h2 { font-size: 17px; font-weight: 700; }
.panel-count { font-size: 15px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

.search {
  position: relative;
  flex: none;
  width: 220px;
  display: flex;
  align-items: center;
}
.search-ico {
  position: absolute;
  right: 10px;
  width: 14px;
  height: 14px;
  color: #b3bac6;
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 36px;
  padding: 0 32px 0 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: #f4f5f7;
  font-size: 13.5px;
  transition: border-color .16s, box-shadow .16s, background .16s;
  appearance: none;
}
.search input::-webkit-search-cancel-button { display: none; }
.search input::placeholder { color: #aab1bd; }
.search input:focus {
  outline: none;
  border-color: var(--brand-100);
  background: #fff;
  box-shadow: var(--ring);
}
.search-clear {
  position: absolute;
  right: 26px;
  width: 18px;
  height: 18px;
  padding: 3px;
  border-radius: 50%;
  color: var(--muted);
  background: #e4e7ec;
  transition: background .15s;
}
.search-clear:hover { background: #d5dae3; color: var(--ink); }
.search:has(.search-clear:not([hidden])) .search-ico { display: none; }

/* 分类卡 */
.cats {
  display: grid;
  grid-template-columns: repeat(auto-fill, 164px);
  gap: 10px;
  margin-top: 16px;
}
.cats.is-empty { display: none; }

.cat {
  position: relative;
  min-width: 0;
  width: 100%;
  height: 68px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f8fa;
  color: #475467;
  text-align: left;
  transition: border-color .16s, background .16s, color .16s;
}
.cat:hover { border-color: #d8dfe9; background: #f2f4f7; }
.cat-name {
  position: relative;
  z-index: 1;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.cat-count {
  position: relative;
  z-index: 1;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  color: #98a2b3;
  font-variant-numeric: tabular-nums;
}
.cat-check {
  position: absolute;
  right: 4px;
  bottom: 2px;
  width: 26px;
  height: 26px;
  color: #cfd6e0;
  opacity: .9;
}
.cat.active {
  border-color: transparent;
  background: linear-gradient(135deg, #3f8bff, #2878ff);
  color: #fff;
}
.cat.active .cat-count { color: rgba(255, 255, 255, .82); }
.cat.active .cat-check { color: rgba(255, 255, 255, .35); }

.goods-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}
.goods-head h3 { font-size: 12.5px; font-weight: 400; color: var(--muted); }
.goods-head-actions { display: flex; align-items: center; gap: 12px; }
.result-count { font-size: 12px; color: var(--soft); }
.link-btn {
  color: var(--brand);
  font-size: 12px;
  padding: 2px 0;
  border-radius: 4px;
}
.link-btn:hover { text-decoration: underline; }

/* ============================ 商品网格 ============================ */
.goods-area { padding-top: 12px; scroll-margin-top: 74px; }

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

/* 列表布局：每行一张横向卡片，缩略图固定尺寸，名称/描述在左，价格库存在右 */
.grid.layout-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.grid.layout-list .card.product { flex-direction: row; align-items: stretch; gap: 10px; padding: 10px; }
.grid.layout-list .thumb {
  flex: none;
  align-self: center;
  width: 88px;
  height: 88px;
  border-radius: 4px;
}
.grid.layout-list .card-body {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "name foot"
    "desc foot";
  align-content: center;
  align-items: center;
  gap: 2px 12px;
  padding: 0;
}
.grid.layout-list .p-title { grid-area: name; }
.grid.layout-list .p-name { min-height: 0; -webkit-line-clamp: 1; }
.grid.layout-list .p-desc { grid-area: desc; display: -webkit-box; -webkit-line-clamp: 1; }
.grid.layout-list .p-foot {
  grid-area: foot;
  margin-top: 0;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
}
.grid.layout-list .p-meta { justify-content: flex-end; }
.grid.layout-list .skeleton-card { display: flex; align-items: center; gap: 10px; padding: 10px; }
.grid.layout-list .sk-thumb { flex: none; width: 88px; height: 88px; aspect-ratio: auto; border-radius: 4px; }
.grid.layout-list .sk-line { flex: 1; margin: 6px 0; }
.card.product {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 10px;
  background: var(--white);
  border: 1px solid #edf0f4;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  transition: box-shadow .18s ease, border-color .18s ease, transform .18s ease;
  cursor: pointer;
}
.card.product:hover {
  border-color: #dfe6f1;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .09);
  transform: translateY(-1px);
}
.card.product:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.card.product.is-out { cursor: not-allowed; }
.card.product.is-out:hover { border-color: #edf0f4; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }

.thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  background: linear-gradient(150deg, var(--brand-050), #f8faff);
  overflow: hidden;
}
.thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .3s;
}
.thumb img.is-ready { opacity: 1; }
.thumb-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a9c6f5;
}
.thumb-fallback svg {
  position: relative;
  z-index: 1;
  width: 30%;
  height: 30%;
  max-width: 56px;
  max-height: 56px;
  color: var(--brand);
  opacity: .32;
}

.soldout-mask {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 24, 40, .42);
}
.soldout-mask span {
  padding: 4px 12px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .94);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
}

.card-body {
  padding: 8px 0 1px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.p-name {
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.55;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  min-height: 1.5em;
}
.p-desc {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--soft);
  display: none;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.p-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.p-title .p-name { flex: 1; min-width: 0; }
.p-sales {
  flex: none;
  font-size: 10.5px;
  color: var(--soft);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.p-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.p-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
.price {
  color: var(--brand);
  font-weight: 700;
  display: inline-flex;
  align-items: baseline;
  letter-spacing: -.02em;
  white-space: nowrap;
}
.price .cur { font-size: 13.5px; margin-right: 1px; font-weight: 600; }
.price .amount { font-size: 21px; font-variant-numeric: tabular-nums; }

.stock {
  flex: none;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--brand-050);
  color: #2f6fd0;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stock.is-low { background: var(--warn-bg); color: var(--warn); }
.stock.is-out { background: #f2f4f7; color: var(--soft); }

.store-panel.is-blank { padding-top: 22px; }
.store-panel.is-blank .panel-bar { display: none; }
.store-panel.is-blank .goods-area { padding-top: 0; }
.store-panel.is-blank .state {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: min(62vh, 520px);
  padding: 46px 24px;
  background: #fcfdff;
  border-color: #e9edf3;
  border-style: solid;
}

/* 骨架屏 */
.skeleton-card {
  background: var(--white);
  border: 1px solid #edf0f4;
  border-radius: 6px;
  padding: 9px;
  overflow: hidden;
}
.sk-thumb { aspect-ratio: 1 / 1; border-radius: 4px; }
.sk-line { height: 12px; margin: 10px 0 0; border-radius: 4px; }
.sk-line.short { width: 52%; margin-bottom: 2px; }
.sk-thumb, .sk-line {
  background: linear-gradient(90deg, #eef1f6 25%, #f6f8fb 37%, #eef1f6 63%);
  background-size: 400% 100%;
  animation: sk 1.3s ease infinite;
}
@keyframes sk {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* 空态 / 错误态 */
.state {
  padding: 68px 24px 60px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fcfdff;
}
.state-ico {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  padding: 14px;
  border-radius: 14px;
  color: #9dbdf0;
  background: var(--brand-050);
}
.state-ico.error { color: #e7a08f; background: var(--danger-bg); }
.state h2 { font-size: 17px; font-weight: 600; }
.state p { margin-top: 8px; font-size: 13.5px; color: var(--muted); max-width: 460px; margin-inline: auto; }
.state .btn { margin-top: 16px; }

.state-actions {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}
.state-actions .btn { margin-top: 0; }
.state-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: min(100%, 620px);
  margin: 26px auto 0;
  padding: 0;
  list-style: none;
}
.state-steps li {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 14px 15px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
  text-align: left;
}
.state-steps .step-num {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--brand-050);
  color: var(--brand-600);
  font-size: 12px;
  font-weight: 700;
}
.state-steps strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}
.state-steps em {
  color: var(--soft);
  font-size: 12.5px;
  font-style: normal;
  line-height: 1.55;
}

.label-optional {
  margin-left: 6px;
  color: var(--soft);
  font-size: 11.5px;
  font-weight: 400;
}

/* ============================ 按钮 ============================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background .16s, border-color .16s, color .16s, box-shadow .16s, opacity .16s;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary {
  background: var(--brand);
  color: var(--on-brand);
  box-shadow: 0 6px 14px rgba(var(--brand-rgb), .26);
}
.btn.primary:hover { background: var(--brand-600); }
.btn.primary:active { transform: translateY(1px); }
.btn.primary[disabled] { opacity: .6; cursor: not-allowed; box-shadow: none; }
.btn.ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--ink-2);
}
.btn.ghost:hover { border-color: var(--brand-100); color: var(--brand); background: var(--brand-050); }
.btn.soft {
  background: var(--brand-050);
  border-color: var(--brand-100);
  color: var(--brand-600);
}
.btn.soft:hover { background: var(--brand-100); border-color: var(--brand); color: var(--brand-600); }
.btn.block { width: 100%; }

.icon-btn {
  width: 32px;
  height: 32px;
  padding: 7px;
  border-radius: 8px;
  color: var(--muted);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: #f1f4f9; color: var(--ink); }

/* ============================ 页脚 ============================ */
.footer {
  position: relative;
  z-index: 1;
  margin-top: 32px;
  padding: 22px 0 26px;
  padding-bottom: calc(26px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, .66);
  font-size: 12.5px;
  color: var(--muted);
}
.footer-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-shop { color: var(--ink-2); font-weight: 600; }
.footer-text { margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.footer-links { display: flex; align-items: center; gap: 8px; color: var(--soft); }
.footer-links a:hover, .footer-links .link-btn:hover { color: var(--brand); }

.noscript {
  position: fixed;
  inset: auto 16px 16px;
  z-index: 90;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--danger);
  color: #fff;
  text-align: center;
}

/* ============================ 弹窗 ============================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(16, 24, 40, .44);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade .16s ease;
  overflow-y: auto;
  overscroll-behavior: contain;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}

.dialog {
  position: relative;
  width: 100%;
  max-width: 468px;
  margin: auto;
  background: var(--white);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  animation: pop .2s cubic-bezier(.22, .8, .3, 1);
}
.dialog-sm { max-width: 400px; }

.dialog-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.dialog-head h2 { font-size: 16px; }

.dialog-body {
  padding: 16px 20px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1 1 auto;
}

.dialog-desc {
  margin-bottom: 14px;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--muted);
}

.dialog-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--line-soft);
  background: #fbfcfe;
  border-radius: 0 0 18px 18px;
}
.foot-sum { display: flex; flex-direction: column; font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.foot-sum strong { font-size: 19px; color: var(--brand); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.dialog-foot .btn { min-width: 120px; }

/* 购买 */
.buy-product {
  display: flex;
  gap: 12px;
  padding: 10px;
  margin-bottom: 16px;
  background: #f8fafd;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
}
.buy-thumb {
  flex: none;
  width: 62px;
  height: 62px;
  border-radius: 10px;
  background: linear-gradient(150deg, var(--brand-050), #f6f9ff);
  background-size: cover;
  background-position: center;
  overflow: hidden;
}
.buy-info { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.buy-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.buy-sub { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); }
.buy-price { color: var(--brand); font-weight: 700; font-size: 14px; }
.mid-dot { color: #d0d5dd; }
.buy-desc {
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.field { margin-bottom: 14px; }
.field > label,
.field > .label-text {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.field .hint {
  margin-left: 6px;
  font-style: normal;
  font-weight: 400;
  font-size: 11.5px;
  color: var(--soft);
}

.input {
  display: block;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font-size: 13.5px;
  transition: border-color .16s, box-shadow .16s;
}
.input::placeholder { color: var(--soft); }
.input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(217, 45, 32, .1); }

.row-split { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.qty {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  height: 40px;
  background: #fff;
}
.qty button {
  width: 38px;
  height: 100%;
  font-size: 16px;
  color: var(--ink-2);
  background: #f8fafd;
  transition: background .15s, color .15s;
  user-select: none;
}
.qty button:hover:not([disabled]) { background: var(--brand-050); color: var(--brand); }
.qty button[disabled] { color: #cdd4df; cursor: not-allowed; }
.qty input {
  width: 54px;
  height: 100%;
  border: none;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: #fff;
  appearance: textfield;
  -moz-appearance: textfield;
}
.qty input::-webkit-outer-spin-button,
.qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--brand-100); }
.subtotal { text-align: right; font-size: 12px; color: var(--muted); line-height: 1.3; }
.subtotal strong { display: block; font-size: 15px; color: var(--brand); font-variant-numeric: tabular-nums; }

.pay-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pay-opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .16s, background .16s, box-shadow .16s;
  user-select: none;
}
.pay-opt:hover { border-color: var(--brand-100); background: #fafcff; }
.pay-opt input { position: absolute; opacity: 0; pointer-events: none; }
.pay-opt:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-050);
  box-shadow: 0 0 0 2px rgba(var(--brand-rgb), .1);
}
.pay-opt:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.pay-ico {
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 6px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pay-ico.alipay { background: #1677ff; }
.pay-ico.wxpay { background: #07c160; }

.order-notice {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 9px;
  background: #f6f8fc;
  border: 1px solid var(--line-soft);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.form-error {
  margin-bottom: 12px;
  padding: 9px 12px;
  border-radius: 9px;
  background: var(--danger-bg);
  border: 1px solid #fbd9d5;
  color: #b42318;
  font-size: 12.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.inline-hint {
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 9px;
  background: var(--brand-050);
  border: 1px solid var(--brand-100);
  color: #2a62c9;
  font-size: 12px;
  line-height: 1.6;
}
.buy-tip { margin-top: 2px; font-size: 11.5px; color: var(--soft); line-height: 1.6; }

/* 下单完成 */
.done-box { text-align: center; }
.done-ico {
  width: 52px;
  height: 52px;
  margin: 2px auto 12px;
  padding: 13px;
  border-radius: 50%;
  color: #fff;
  background: var(--ok);
  box-shadow: 0 8px 20px rgba(18, 161, 80, .26);
}
.done-box h3 { font-size: 16px; }
.done-sub { margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.done-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  margin-top: 10px;
  border-radius: 10px;
  background: #f8fafd;
  border: 1px solid var(--line-soft);
  font-size: 12.5px;
  color: var(--muted);
  text-align: left;
}
.done-row strong {
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
  overflow-wrap: anywhere;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.done-row .done-amount { color: var(--brand); font-size: 15px; }
.copy-mini {
  flex: none;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand);
  font-size: 11.5px;
  font-weight: 600;
  transition: background .15s, border-color .15s;
}
.copy-mini:hover { background: var(--brand-050); border-color: var(--brand-100); }
.done-lock { margin-top: 12px; font-size: 12px; color: var(--warn); line-height: 1.6; }
.done-box .btn { margin-top: 12px; }
.done-tip { margin-top: 8px; font-size: 11.5px; color: var(--soft); }

/* 订单结果 */
.lookup-result { margin-top: 16px; }
.order-card {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.order-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: #f8fafd;
  border-bottom: 1px solid var(--line-soft);
}
.order-head .o-name { font-size: 13.5px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.badge {
  flex: none;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.mute { background: #f2f4f7; color: var(--muted); }

.order-rows { padding: 4px 14px 10px; }
.order-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line-soft);
  font-size: 12.5px;
}
.order-row:last-child { border-bottom: none; }
.order-row span { flex: none; color: var(--soft); }
.order-row strong {
  font-weight: 600;
  color: var(--ink-2);
  text-align: right;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.order-row strong.money { color: var(--brand); }

.cards-box { padding: 0 14px 14px; }
.cards-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.cards-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  overflow: hidden;
  background: #fbfcfe;
}
.card-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.card-item:last-child { border-bottom: none; }
.card-item code {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink);
  overflow-wrap: anywhere;
  word-break: break-all;
  user-select: all;
}
.card-item .copy-mini { flex: none; }

.order-actions { display: flex; gap: 8px; padding: 0 14px 14px; }
.order-actions .btn { flex: 1; }
.empty-cards {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #fbfcfe;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.7;
}

/* 联系 */
.contact-card {
  padding: 16px;
  border-radius: 12px;
  background: linear-gradient(160deg, var(--brand-050), #f8fbff);
  border: 1px solid var(--brand-100);
  text-align: center;
}
.contact-label { display: block; font-size: 11.5px; color: var(--muted); letter-spacing: .04em; }
.contact-value {
  margin-top: 6px;
  font-size: 17px;
  font-weight: 700;
  color: var(--brand-600);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  user-select: all;
}
.contact-actions { display: flex; gap: 10px; margin-top: 14px; }
.contact-actions .btn { flex: 1; }
#contactChips { margin-top: 14px; }
.contact-tip { margin-top: 12px; font-size: 11.5px; color: var(--soft); line-height: 1.65; }

/* 维护 */
.maintenance { padding: 60px 20px 40px; display: flex; justify-content: center; }
.maintenance-card {
  width: 100%;
  max-width: 460px;
  padding: 36px 28px 30px;
  text-align: center;
  background: var(--white);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.maint-avatar {
  width: 60px;
  height: 60px;
  margin: 0 auto 16px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(140deg, #9fb8dc, #c8d6ea);
  background-size: cover;
  background-position: center;
  box-shadow: 0 8px 18px rgba(16, 24, 40, .12);
  overflow: hidden;
}
.maintenance-card h1 { font-size: 19px; overflow-wrap: anywhere; }
.maint-badge {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 12px;
  font-weight: 700;
}
.maint-text { margin-top: 14px; font-size: 13px; color: var(--muted); line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.maint-actions { display: flex; justify-content: center; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.maint-tip { margin-top: 16px; font-size: 11.5px; color: var(--soft); line-height: 1.65; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 200;
  transform: translate(-50%, 16px);
  max-width: calc(100vw - 40px);
  padding: 10px 18px;
  border-radius: 10px;
  background: rgba(16, 24, 40, .92);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  box-shadow: 0 12px 28px rgba(16, 24, 40, .24);
  overflow-wrap: anywhere;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: rgba(18, 122, 66, .95); }
.toast.err { background: rgba(180, 35, 24, .95); }

/* ============================ 响应式 ============================ */
@media (max-width: 860px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .search { width: 180px; }
}

@media (max-width: 720px) {
  .nav-inner { height: 52px; padding: 0 14px; gap: 10px; }
  .nav-links { gap: 8px; margin-left: 0; }
  .nav-links .nav-link { font-size: 13px; }
  #navLookup, #navContact { display: none; }
  .nav-cta { height: 32px; padding: 0 13px; font-size: 12.5px; }
  .nav-cta svg { width: 13px; height: 13px; }
  .brand-name { max-width: 33vw; font-size: 15px; }
  .wrap { padding: 0 14px; }
  #shopMain { padding-top: 20px; }
  .store-head { gap: 12px; }
  .store-avatar { width: 52px; height: 52px; border-radius: 12px; font-size: 21px; }
  .store-meta h1 { font-size: 18px; }
  .store-title-row { gap: 6px; }
  .store-sub { font-size: 13px; margin-top: 3px; }
  .notice { margin-top: 14px; gap: 6px; font-size: 13px; }
  .store-panel { margin-top: 14px; padding: 14px 14px 18px; border-radius: 10px; }
  .store-panel .panel-bar { gap: 10px; }
  .panel-title h2 { font-size: 16px; }
  .panel-count { font-size: 14px; }
  .search { width: 140px; flex: none; }
  .search input { height: 34px; font-size: 13px; }
  .cats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
  .cat { width: auto; height: 62px; padding: 10px 12px; }
  .cat-name { font-size: 13.5px; }
  .cat-check { width: 22px; height: 22px; }
  .goods-head { margin-top: 16px; padding-top: 14px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card.product { padding: 8px; }
  .card-body { padding: 8px 0 0; gap: 5px; }
  .p-name { font-size: 13.5px; }
  .price .amount { font-size: 19px; }
  .state { padding: 48px 16px 44px; }
  .state h2 { font-size: 16px; }
  .state-steps { grid-template-columns: 1fr; width: 100%; gap: 8px; margin-top: 20px; }
  .state-steps li { flex-direction: row; align-items: center; gap: 10px; padding: 12px 14px; }
  .state-steps .step-num { margin-bottom: 0; flex: none; }
  .state-steps strong { flex: none; font-size: 13.5px; }
  .state-steps em { font-size: 12px; }
  .footer { margin-top: 24px; padding: 18px 0 20px; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 10px; }

  .modal { padding: 0; align-items: flex-end; }
  .dialog {
    max-width: none;
    max-height: 92vh;
    max-height: 92dvh;
    margin: 0;
    border-radius: 18px 18px 0 0;
    animation: sheet .24s cubic-bezier(.22, .8, .3, 1);
  }
  .dialog-sm { max-width: none; }
  .dialog-foot { border-radius: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .dialog-head { padding: 14px 12px 12px 18px; }
  .dialog-body { padding: 14px 18px 16px; }
  .row-split { gap: 10px; }
  .qty input { width: 46px; }
  .buy-thumb { width: 56px; height: 56px; }
  .toast { bottom: 24px; }
  .maintenance { padding: 36px 0 24px; }
  .maintenance-card { padding: 28px 20px 24px; }
  .contact-chip { padding: 2px 7px; font-size: 11px; gap: 5px; }
  .grid.layout-list .thumb,
  .grid.layout-list .sk-thumb { width: 72px; height: 72px; }
  .grid.layout-list .card-body { padding: 0; }
}

@keyframes sheet {
  from { opacity: .6; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 400px) {
  .grid { gap: 8px; }
  .card.product { padding: 7px; }
  .card-body { padding: 6px 0 0; }
  .p-name { font-size: 12.5px; min-height: 1.5em; -webkit-line-clamp: 2; }
  .price .amount { font-size: 15px; }
  .stock { padding: 1px 5px; font-size: 10.5px; }
  .dialog-foot { flex-wrap: wrap; }
  .dialog-foot .btn { min-width: 0; flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
