/* ==========================================================================
   52趣玩屿礼品商城 · 网页版（H5）
   设计变量与小程序端 1:1 对齐：小程序 1rpx = 375 视口下 0.5px，故此处 px = rpx / 2
   主色 #ffd43b / 价格红 #e64b33 / 资料卡蓝渐变 #1f63ff → #4b96ff / 卡片圆角 12px
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

/* 统一兜底：任何带 hidden 属性的元素都不显示。
   注意 .topnav / .tabbar 等用 display 控制显隐时，必须靠这条 !important 才压得住媒体查询里的 display。 */
[hidden] { display: none !important; }

:root {
  --bg: #f6f7f9;
  --text: #17191f;
  --muted: #8a8f99;
  --muted-2: #a0a4ad;
  --line: #eef0f3;
  --accent: #ffd43b;
  --accent-ink: #15171c;
  --price: #e64b33;
  --blue: #1f63ff;
  --blue-2: #4b96ff;
  --app-w: 430px;
  --tabbar-h: 74px;
  --shadow-card: 0 4px 14px rgba(20, 23, 31, 0.05);
  --shadow-float: 0 -4px 18px rgba(17, 24, 39, 0.07);
  --radius-card: 12px;
}

html, body { margin: 0; padding: 0; }

body {
  background: #e8ecf2;
  background-image: radial-gradient(1200px 600px at 50% -10%, #f3f6fb 0%, #e6eaf1 55%, #dfe4ec 100%);
  color: var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

img { display: block; max-width: 100%; }
button { font: inherit; }
a { color: inherit; text-decoration: none; }
input, button, textarea { font-family: inherit; }

/* 应用列：手机宽度居中，桌面端像一部手机 */
#app {
  position: relative;
  width: 100%;
  max-width: var(--app-w);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  box-shadow: 0 0 56px rgba(20, 23, 31, 0.1);
  /* 这里不能设 overflow:hidden —— 会把 #app 变成滚动容器，导致内部 position:sticky 失效 */
}

/* ---------- 顶部导航（仅二级页显示） ---------- */
.appbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 8px;
  height: 48px; padding: 0 10px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.appbar[hidden] { display: none; }
.appbar-back {
  width: 34px; height: 34px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: transparent; cursor: pointer;
  color: #33383f;
}
.appbar-back:hover { background: #f1f3f6; }
.appbar-title {
  flex: 1; text-align: center; font-size: 16px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding-right: 34px;
}

/* ---------- 页面容器 ---------- */
body.locked { overflow: hidden; height: 100vh; }
.view { min-height: 100vh; }
.page {
  padding: 12px 12px calc(var(--tabbar-h) + 24px);
}
.page--plain { padding-bottom: 28px; }                       /* 二级页：无 tabBar 无底栏 */
.page--bar { padding-bottom: 86px; }                          /* 有底部操作条 */
.page--bar-tab { padding-bottom: calc(var(--tabbar-h) + 86px); } /* 底栏 + tabBar 都有 */

/* ---------- 通用原子 ---------- */
.card { background: #fff; border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.muted { color: var(--muted); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 17px 0 10px; }
.section-title { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: 0.2px; }
.section-more, .section-subtitle { color: #888e98; font-size: 12px; }
.section-more { cursor: pointer; }
.section-more:hover { color: var(--blue); }
.loading { padding: 40px 0; text-align: center; color: var(--muted); font-size: 13px; }
.empty-state { padding: 60px 16px; text-align: center; color: var(--muted); }
.empty-title { margin: 11px 0 4px; color: #1c1f25; font-size: 17px; font-weight: 700; }
.empty-icon { font-size: 46px; line-height: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 700; transition: transform 0.12s ease, filter 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn:hover { filter: brightness(1.03); }
.btn--ghost { background: #f3f4f6; color: #4b515b; }
.btn--blue { background: linear-gradient(135deg, #2f7bff, var(--blue)); color: #fff; }
.btn[disabled] { background: #e9eaed; color: #989ca5; cursor: not-allowed; transform: none; }

.tag {
  display: inline-block; padding: 4px 8px; border-radius: 999px;
  background: #fff3ba; color: #6b5710; font-size: 11px;
}
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: 999px;
  background: #fff1ae; color: #6d5710; font-size: 11px;
}

/* 数量步进器 */
.stepper {
  display: flex; align-items: center; overflow: hidden;
  border: 1px solid #e1e3e7; border-radius: 10px; background: #fff;
}
.stepper .step {
  width: 40px; height: 34px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: #f4f5f6; color: #33383f; font-size: 17px;
  cursor: pointer; user-select: none;
}
.stepper .step:hover { background: #eaecf0; }
.stepper input {
  width: 54px; height: 34px; flex: none; text-align: center;
  border: 0; outline: none; font-size: 13px; color: var(--text); background: #fff;
}

/* ---------- 商品卡片（复刻 components/product-card） ---------- */
.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.product-card {
  overflow: hidden; background: #fff; border-radius: 11px;
  box-shadow: var(--shadow-card); cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.18s ease;
}
.product-card:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(20, 23, 31, 0.09); }
.product-card:active { transform: scale(0.985); }
.product-card .image-wrap {
  position: relative; height: 150px;
  display: flex; align-items: center; justify-content: center;
  background: #f4f6f9;
}
.product-card .product-image { width: 100%; height: 100%; object-fit: cover; }
.product-card .stock-badge {
  position: absolute; top: 7px; right: 7px;
  padding: 3px 7px; border-radius: 999px;
  background: rgba(22, 24, 29, 0.74); color: #fff; font-size: 10px;
}
.product-card .product-body { padding: 9px; }
.product-card .product-name {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 38px;
  font-size: 13.5px; font-weight: 600; line-height: 19px;
}
.product-card .product-spec {
  display: block; margin-top: 4px; overflow: hidden;
  color: var(--muted); font-size: 11px;
  white-space: nowrap; text-overflow: ellipsis;
}
.product-card .price-row { display: flex; align-items: flex-end; justify-content: space-between; margin-top: 8px; }
.price { color: var(--price); font-weight: 800; }
.price .currency { font-size: 11px; font-weight: 700; margin-right: 1px; }
.price .amount { font-size: 17px; }
.product-card .minimum { display: block; margin-top: 3px; color: #5f6570; font-size: 10.5px; }

/* ==========================================================================
   首页
   ========================================================================== */
.top-row { display: flex; align-items: center; justify-content: space-between; min-height: 35px; }
.brand-logo { width: 105px; height: auto; }
.search-bar {
  display: flex; align-items: center; height: 42px; margin-top: 9px;
  padding: 0 6px 0 13px; background: #fff;
  border: 1.5px solid var(--text); border-radius: 999px; cursor: pointer;
}
.search-bar .search-icon { margin-right: 6px; font-size: 19px; line-height: 1; transform: rotate(-20deg); }
.search-bar .search-placeholder { flex: 1; color: #969ba5; font-size: 12.5px; }
.search-bar .search-action { padding: 9px 15px; background: var(--accent); border-radius: 999px; font-weight: 700; }

.banner { position: relative; height: 143px; margin-top: 12px; overflow: hidden; border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.banner-track { display: flex; height: 100%; transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1); }
.banner-slide { width: 100%; height: 100%; flex: none; }
.banner-slide img { width: 100%; height: 100%; object-fit: cover; }
.banner-dots { position: absolute; left: 0; right: 0; bottom: 8px; display: flex; justify-content: center; gap: 5px; }
.banner-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.45); cursor: pointer; transition: width 0.2s; }
.banner-dots i.on { width: 16px; border-radius: 3px; background: #fff; }

.category-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.category-item {
  position: relative; padding: 5px 7px 8px; background: #fff;
  border-radius: 12px; box-shadow: var(--shadow-card); cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.18s ease;
}
.category-item:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(20, 23, 31, 0.09); }
.category-item:active { transform: scale(0.97); }
.category-icon { width: 64px; height: 64px; margin: 0 auto 2px; border-radius: 50%; object-fit: contain; }
.category-name {
  display: block; overflow: hidden; padding-left: 1px;
  font-size: 11.5px; font-weight: 600; color: var(--text);
  white-space: nowrap; text-overflow: ellipsis;
}
.category-count { display: block; margin-top: 1px; padding-left: 1px; color: var(--muted-2); font-size: 9.5px; }
.category-arrow {
  position: absolute; right: 6px; bottom: 7px; width: 17px; height: 17px;
  display: flex; align-items: center; justify-content: center;
  color: #4a9eff; font-size: 13px; font-weight: 600; line-height: 1;
  background: #e8f1ff; border-radius: 50%;
}

/* ==========================================================================
   分类页（左栏分类 + 右栏商品，各自独立滚动）
   ========================================================================== */
.category-page { padding: 0 0 var(--tabbar-h); height: 100vh; display: flex; flex-direction: column; }
.catalog-search {
  flex: none; margin: 9px 12px; padding: 10px 14px;
  color: #989da6; background: #f3f4f6; border-radius: 999px;
  font-size: 13px; cursor: pointer;
}
.catalog-search:hover { background: #eceef2; }
.catalog-body { display: flex; flex: 1; min-height: 0; border-top: 1px solid var(--line); }
.category-list { width: 105px; flex: none; overflow-y: auto; background: #f5f6f8; -webkit-overflow-scrolling: touch; }
.category-row {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  min-height: 48px; padding: 9px 9px 9px 12px;
  color: #676d77; font-size: 12px; cursor: pointer;
}
.category-row.active { color: var(--text); background: #fff; font-weight: 700; }
.category-row.active::before {
  position: absolute; left: 0; width: 4px; height: 19px;
  background: var(--accent); border-radius: 0 3px 3px 0; content: "";
}
.category-total { color: #a6aab2; font-size: 9.5px; }
.product-list { flex: 1; min-width: 0; overflow-y: auto; padding: 0 9px 16px; -webkit-overflow-scrolling: touch; }
.current-title { padding: 12px 0 9px; font-size: 15.5px; font-weight: 700; }

/* ==========================================================================
   商品详情
   ========================================================================== */
.detail-hero { display: flex; align-items: center; justify-content: center; height: 340px; background: #f4f6f9; }
.detail-hero img { width: 100%; height: 100%; object-fit: contain; }
.detail-card { margin: 10px 12px 0; padding: 14px; background: #fff; border-radius: var(--radius-card); }
.detail-card + .detail-card { margin-top: 10px; }
.price-line { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.price-line .price .currency { font-size: 14px; }
.price-line .price .amount { font-size: 25px; }
.price-line .unit, .price-line .retail { color: #959aa4; font-size: 11px; }
.detail-name { display: block; margin-top: 9px; font-size: 17px; font-weight: 700; line-height: 24px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.stock-line { display: flex; justify-content: space-between; margin-top: 12px; padding-top: 11px; color: #6b717b; border-top: 1px solid #f0f1f3; font-size: 11.5px; }
.block-title { display: block; margin-bottom: 9px; font-size: 15px; font-weight: 700; }
.spec-row { display: flex; padding: 8px 0; color: #555b65; border-bottom: 1px solid #f2f3f5; font-size: 12px; }
.spec-row:last-child { border-bottom: 0; }
.spec-label { width: 65px; flex: none; color: #999ea7; }

/* ==========================================================================
   进货单 / 结算 / 订单
   ========================================================================== */
.cart-summary { margin-bottom: 9px; color: #666c76; font-size: 13px; }
.cart-item { display: flex; margin-bottom: 9px; padding: 10px; }
.cart-image { width: 85px; height: 85px; flex: none; margin-right: 10px; border-radius: 9px; background: #f2f3f5; object-fit: cover; }
.cart-info { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.cart-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 600; line-height: 19px; font-size: 13.5px; }
.cart-min { margin-top: 5px; color: #9398a2; font-size: 11px; }
.cart-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 8px; gap: 8px; }
.cart-price { color: var(--price); font-weight: 800; font-size: 15px; }
.cart-remove { border: 0; background: transparent; color: #a1a5ad; font-size: 11px; cursor: pointer; padding: 4px; }
.cart-remove:hover { color: var(--price); }

.bottom-bar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--app-w); z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px calc(9px + env(safe-area-inset-bottom));
  background: #fff; box-shadow: var(--shadow-float);
}
/* 进货单页同时有 tabBar：结算条要抬到导航之上（小程序里是 bottom:140rpx） */
.bottom-bar--above-tab { bottom: var(--tabbar-h); }
.bottom-bar .bar-total { flex: 1; min-width: 0; }
.bottom-bar .bar-total .total { color: var(--price); font-size: 18px; font-weight: 800; }
.bottom-bar .btn { flex: none; padding: 11px 26px; font-size: 14px; }
.bottom-bar .btn--wide { flex: 1; padding: 12px 20px; }

.field { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; border-bottom: 1px solid #f2f3f5; }
.field:last-child { border-bottom: 0; }
.field-label { width: 62px; flex: none; color: #6b717b; font-size: 13px; padding-top: 2px; }
.field-value { flex: 1; min-width: 0; font-size: 13px; }
.field input, .field textarea {
  width: 100%; border: 0; outline: none; background: #f5f6f8;
  border-radius: 8px; padding: 9px 11px; font-size: 13px; color: var(--text);
}
.field textarea { resize: vertical; min-height: 54px; }
.field input:focus, .field textarea:focus { background: #eef1f6; box-shadow: 0 0 0 2px rgba(31, 99, 255, 0.15); }

.checkout-items { margin-top: 10px; padding: 4px 12px; }
.checkout-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f2f3f5; }
.checkout-item:last-child { border-bottom: 0; }
.checkout-item img { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; background: #f2f3f5; }
.checkout-item .ci-name { flex: 1; min-width: 0; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checkout-item .ci-qty { color: var(--muted); font-size: 12px; }
.checkout-item .ci-price { color: var(--price); font-weight: 700; font-size: 12.5px; }

.order-card { margin-bottom: 10px; padding: 12px; }
.order-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); }
.order-status { font-weight: 700; color: var(--blue); }
.order-status.is-done { color: #34c759; }
.order-status.is-off { color: #a1a5ad; }
.order-goods { display: flex; gap: 8px; margin: 10px 0; overflow: hidden; }
.order-goods img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: #f2f3f5; flex: none; }
.order-foot { display: flex; align-items: center; justify-content: space-between; padding-top: 9px; border-top: 1px solid #f2f3f5; font-size: 12px; }
.order-foot .total { color: var(--price); font-weight: 800; font-size: 15px; }
.order-actions { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; }
.order-actions .btn { padding: 8px 16px; font-size: 12.5px; }
.filter-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: none; }
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-tab {
  flex: none; padding: 6px 13px; border-radius: 999px; font-size: 12.5px;
  background: #fff; color: #6b717b; cursor: pointer; border: 1px solid var(--line);
}
.filter-tab.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }

/* ==========================================================================
   搜索
   ========================================================================== */
.search-head { position: sticky; top: 48px; z-index: 20; padding: 10px 12px 6px; background: var(--bg); }
.search-box {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 12px; background: #fff; border-radius: 999px;
  box-shadow: var(--shadow-card);
}
.search-box input { flex: 1; min-width: 0; border: 0; outline: none; font-size: 13.5px; background: transparent; }
.search-box .search-submit { flex: none; padding: 7px 14px; border-radius: 999px; background: var(--accent); font-weight: 700; font-size: 13px; cursor: pointer; }
.filters { display: flex; gap: 6px; margin-top: 9px; }
.filter { padding: 5px 13px; border-radius: 999px; background: #fff; color: #6b717b; font-size: 12px; cursor: pointer; border: 1px solid var(--line); }
.filter.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.result-count { margin: 6px 0 10px; color: var(--muted); font-size: 12px; }

/* ==========================================================================
   我的
   ========================================================================== */
.profile-card {
  display: flex; align-items: center; gap: 13px;
  padding: 20px 15px; border-radius: 12px;
  background: linear-gradient(115deg, var(--blue), var(--blue-2));
  box-shadow: 0 6px 18px rgba(31, 99, 255, 0.28);
  position: relative; overflow: hidden;
}
.profile-card::after {
  content: ""; position: absolute; right: -30px; top: -46px;
  width: 150px; height: 150px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}
.avatar-frame { position: relative; flex: none; width: 59px; height: 59px; }
.profile-avatar {
  width: 59px; height: 59px; border-radius: 50%; object-fit: cover;
  border: 2.5px solid rgba(255, 255, 255, 0.9);
  background: linear-gradient(135deg, #eaf1ff, #d7e5ff);
  box-shadow: 0 3px 8px rgba(9, 30, 66, 0.25);
}
.avatar-badge {
  position: absolute; right: 6px; bottom: 6px; z-index: 2;
  width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;
  background: #17191f; border: 1.5px solid #fff; border-radius: 50%;
  box-shadow: 0 1.5px 4px rgba(9, 30, 66, 0.35);
}
.avatar-badge .cam { position: relative; width: 11px; height: 10px; }
.avatar-badge .cam-bump { position: absolute; top: 0; left: 50%; width: 5px; height: 3px; margin-left: -2.5px; background: #fff; border-radius: 1.5px 1.5px 0 0; }
.avatar-badge .cam-body { position: absolute; left: 0; bottom: 0; width: 11px; height: 7.5px; background: #fff; border-radius: 1.5px; }
.avatar-badge .cam-lens { position: absolute; left: 50%; top: 50%; width: 4.5px; height: 4.5px; margin: -2.25px 0 0 -2.25px; background: #17191f; border-radius: 50%; }
.profile-copy { display: flex; flex: 1; flex-direction: column; justify-content: center; min-width: 0; position: relative; z-index: 1; }
.profile-name { max-width: 100%; font-size: 17px; font-weight: 800; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-sub { max-width: 100%; margin-top: 5px; color: rgba(255, 255, 255, 0.88); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-actions { flex: none; display: flex; flex-direction: column; gap: 8px; position: relative; z-index: 1; }
.action-pill {
  width: 60px; height: 29px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 600; cursor: pointer;
  background: rgba(255, 255, 255, 0.18); border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 999px; transition: background 0.15s ease;
}
.action-pill:hover { background: rgba(255, 255, 255, 0.32); }

.order-card-wrap, .service-card { margin-top: 11px; padding: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; font-weight: 700; }
.card-head .muted { font-size: 11px; font-weight: 400; cursor: pointer; }
.order-statuses { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 17px; }
.status { display: flex; align-items: center; flex-direction: column; gap: 7px; color: #4b515b; font-size: 11.5px; font-weight: 500; cursor: pointer; }
.status-icon { width: 48px; height: 48px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(17, 24, 39, 0.08); object-fit: contain; transition: transform 0.14s ease; }
.status:hover .status-icon { transform: scale(0.94); }
.service-card { padding: 2px 14px; }
.service-row { display: flex; align-items: center; min-height: 52px; border-bottom: 1px solid #f0f1f3; cursor: pointer; }
.service-row:last-child { border-bottom: 0; }
.service-icon { width: 29px; flex: none; font-size: 15px; }
.service-label { flex: 1; font-size: 14px; }
.service-arrow { color: #a1a5ad; font-size: 19px; }

/* ---------- 底部弹层（编辑昵称等） ---------- */
.sheet-mask {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-end;
  background: rgba(17, 20, 28, 0.55); animation: fade 0.2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  width: 100%; max-width: var(--app-w); margin: 0 auto;
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  background: #fff; border-radius: 16px 16px 0 0;
  animation: rise 0.24s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes rise { from { transform: translateY(30px); opacity: 0.6; } to { transform: translateY(0); opacity: 1; } }
.sheet-grip { width: 36px; height: 4px; margin: 0 auto 12px; background: #e3e5ea; border-radius: 999px; }
.sheet-title { display: block; font-size: 16px; font-weight: 800; text-align: center; }
.sheet-input {
  width: 100%; margin-top: 14px; padding: 0 14px; height: 48px;
  background: #f3f4f6; border: 0; border-radius: 10px; font-size: 15px; color: var(--text); outline: none;
}
.sheet-tip { margin-top: 8px; color: #a1a5ad; font-size: 11px; text-align: center; }
.sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet-actions .btn { flex: 1; min-width: 0; height: 44px; font-size: 14.5px; }

/* ---------- 吐司 ---------- */
.toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  z-index: 400; max-width: 240px; padding: 12px 18px;
  background: rgba(17, 20, 28, 0.88); color: #fff;
  border-radius: 10px; font-size: 13.5px; text-align: center; line-height: 1.5;
  animation: fade 0.18s ease;
}
.toast[hidden] { display: none; }

/* ---------- 骨架屏 ---------- */
.skeleton { background: linear-gradient(90deg, #eef0f4 25%, #e4e7ee 37%, #eef0f4 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.skeleton-card { height: 214px; border-radius: 11px; }

/* ---------- 底部导航（复刻小程序自定义 tabBar：彩色图标 + 选中胶囊底 + 角标 + 圆点） ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--app-w); z-index: 50;
  display: flex; align-items: flex-start;
  padding: 4px 4px calc(5px + env(safe-area-inset-bottom));
  background: #fff; box-shadow: 0 -3px 12px rgba(17, 24, 39, 0.07);
}
.tabbar[hidden] { display: none; }
.tab-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  cursor: pointer; user-select: none; padding-top: 2px;
}
.icon-wrap {
  position: relative; width: 39px; height: 39px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background-color 0.2s ease;
}
.icon { width: 23px; height: 23px; object-fit: contain; }
.badge {
  position: absolute; top: -2px; right: -2px; min-width: 17px; height: 17px;
  padding: 0 4px; border-radius: 10px; background: #fa5151; color: #fff;
  font-size: 10.5px; line-height: 17px; text-align: center; font-weight: 600;
  border: 1.5px solid #fff;
}
.tab-label { margin-top: 1px; font-size: 11.5px; color: #6b7280; font-weight: 500; }
.tab-item.on .tab-label { font-weight: 600; }
.dot { width: 3px; height: 3px; border-radius: 1.5px; margin-top: 2px; }

/* ---------- 协议 ---------- */
.doc { padding: 4px 4px 20px; color: #3d434c; font-size: 13px; line-height: 1.85; }
.doc h2 { font-size: 16px; margin: 18px 0 8px; color: var(--text); }
.doc h1 { font-size: 19px; margin: 6px 0 4px; }
.doc p { margin: 8px 0; }
.doc .doc-date { color: var(--muted); font-size: 12px; }

/* ==========================================================================
   详情页双栏包裹层：手机端用 display:contents 让内部元素「透明」，
   视觉与改造前完全一致；桌面端再改成真正的左右两栏（见文件末尾媒体查询）。
   ========================================================================== */
.page--detail .detail-media,
.page--detail .detail-side { display: contents; }

/* 顶部导航：手机端不出现（用底部 tabBar），桌面端在媒体查询里启用 */
.topnav { display: none; }

/* ---------- 站点页脚（ICP 备案号等合规信息） ----------
   背景沿用 #app 的 --bg，不加边框、不用白底，让上方 .page 预留的底部留白
   与页脚自身的 padding 连成一个安静的收尾区，不会显得突兀。
   底部 padding 里加上 --tabbar-h：手机端用于避开固定 tabBar，桌面端该变量为 0 自动归零。 */
.site-footer {
  padding: 18px 18px calc(var(--tabbar-h) + 16px);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.9;
  text-align: center;
}
.footer-name { color: #62676f; font-weight: 600; font-size: 12.5px; }
.footer-org { color: var(--muted-2); }
.footer-beian { margin-top: 8px; }
.beian-link { color: var(--muted); }
.beian-link:hover { color: #6b7280; text-decoration: underline; }
.beian-link + .beian-link { margin-left: 14px; }

@media (max-width: 430px) {
  #app { box-shadow: none; }
  body { background: var(--bg); }
}

/* ==========================================================================
   桌面端自适应（≥ 900px）
   一套代码两种版式：窄屏 = 手机壳（底部 tabBar），宽屏 = 顶部导航 + 宽栅格。
   不改变任何业务逻辑，只覆盖样式与容器宽度。
   ========================================================================== */
@media (min-width: 900px) {
  :root {
    --app-w: 1180px;      /* 外框宽度：手机壳 → 桌面容器 */
    --tabbar-h: 0px;      /* 底部 tabBar 退场，所有依赖它的内边距自动归零 */
    --topnav-h: 64px;
  }

  #app {
    box-shadow: 0 0 0 1px rgba(20, 23, 31, 0.06), 0 26px 70px rgba(20, 23, 31, 0.12);
  }
  .view { min-height: calc(100vh - var(--topnav-h)); }

  /* ---------- 顶部导航 ---------- */
  .topnav {
    display: block;
    position: sticky; top: 0; z-index: 60;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--line);
  }
  .topnav-inner {
    display: flex; align-items: center; gap: 22px;
    /* 顶栏总高严格等于 --topnav-h（含 .topnav 的 1px 底边框），
       否则 100vh 的页面会多出 1px 纵向滚动 */
    height: calc(var(--topnav-h) - 1px); padding: 0 24px;
  }
  .topnav-brand { display: flex; align-items: center; flex: none; cursor: pointer; }
  .topnav-brand img { width: 116px; height: auto; }
  .topnav-search {
    display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; max-width: 420px;
    height: 40px; padding: 0 16px; border-radius: 999px;
    background: #f3f4f6; color: #969ba5; font-size: 13px; cursor: pointer;
    transition: background 0.15s ease;
  }
  .topnav-search:hover { background: #eaeced; }
  .topnav-search .tn-ic { font-size: 17px; line-height: 1; transform: rotate(-20deg); }
  .topnav-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
  .topnav-item {
    display: flex; align-items: center; gap: 6px;
    padding: 9px 16px; border-radius: 999px; cursor: pointer;
    color: #4b515b; font-size: 14px; font-weight: 600;
    transition: background 0.15s ease, color 0.15s ease;
  }
  .topnav-item:hover { background: #f2f4f7; color: var(--text); }
  .topnav-item.on { background: var(--accent); color: var(--accent-ink); }
  .tn-badge {
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    background: #fa5151; color: #fff;
    font-size: 11px; line-height: 18px; text-align: center; font-weight: 700;
  }
  .topnav-item.on .tn-badge { background: var(--accent-ink); color: #fff; }

  /* 底部 tabBar 退场；首页自带的品牌行与搜索条与顶栏重复，一并隐藏 */
  .tabbar { display: none !important; }
  .top-row, .search-bar { display: none; }

  /* 二级页返回栏贴在顶栏之下，标题改为左对齐 */
  .appbar { top: var(--topnav-h); height: 54px; padding: 0 24px; }
  .appbar-back { margin-left: -6px; }
  .appbar-title { padding-right: 40px; padding-left: 4px; text-align: left; font-size: 17px; }

  /* ---------- 页面容器 ---------- */
  .page { padding: 22px 24px 40px; }
  .page--plain { padding-bottom: 44px; }
  .page--bar, .page--bar-tab { padding-bottom: 106px; }  /* 给悬浮结算条留位 */
  .page--narrow { max-width: 800px; margin: 0 auto; }    /* 购物链路收窄成一列，更易读 */

  /* ---------- 首页 ---------- */
  /* 轮播原图 1125×540（2.08:1）。桌面端若沿用固定高度会把底部按钮裁掉，
     改为按容器宽度等比缩放，并封顶 460px 防止首屏被大图占满。 */
  .banner { height: auto; aspect-ratio: 1125 / 540; max-height: 460px; margin-top: 6px; }
  .banner-dots { bottom: 12px; }
  .category-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 14px; }
  .category-item { padding: 12px 8px 14px; }
  .category-icon { width: 74px; height: 74px; }
  .category-name { padding-left: 0; text-align: center; font-size: 13px; }
  .category-count { padding-left: 0; text-align: center; font-size: 11px; }
  .category-arrow { right: 8px; bottom: 9px; width: 19px; height: 19px; }

  /* ---------- 商品栅格：2 列 → 4 列 ---------- */
  .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .product-card .image-wrap { height: 196px; }
  .product-card .product-body { padding: 12px; }
  .product-card .product-name { font-size: 14px; }
  .product-card .price .amount { font-size: 19px; }
  .product-card .minimum { font-size: 11.5px; }
  .skeleton-card { height: 274px; }

  /* ---------- 分类页 ---------- */
  .category-page { height: calc(100vh - var(--topnav-h)); }
  .catalog-search { margin: 16px 24px 12px; }
  .category-list { width: 186px; }
  .category-row { min-height: 54px; padding: 11px 14px 11px 18px; font-size: 13.5px; }
  .product-list { padding: 0 20px 26px; }
  .current-title { padding: 16px 0 14px; font-size: 18px; }

  /* ---------- 商品详情：左图右文 ---------- */
  .page--detail {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(360px, 1fr);
    gap: 22px; align-items: start;
    padding-bottom: 40px;
  }
  /* 吸顶位置要给「顶部导航 + 二级页返回栏」两层留出空间，否则大图会钻到返回栏底下 */
  .page--detail .detail-media { display: block; position: sticky; top: calc(var(--topnav-h) + 70px); }
  .page--detail .detail-hero { height: 480px; margin: 0; border-radius: 14px; overflow: hidden; }
  .page--detail .detail-side { display: flex; flex-direction: column; gap: 12px; }
  .page--detail .detail-card { margin: 0; padding: 18px; }
  .page--detail .bottom-bar {
    position: sticky; bottom: 16px;
    left: auto; transform: none; max-width: none;
    padding: 12px 14px; border-radius: 14px;
    box-shadow: 0 10px 30px rgba(17, 24, 39, 0.12);
  }
  .price-line .price .amount { font-size: 30px; }
  .detail-name { font-size: 20px; line-height: 28px; }

  /* ---------- 进货单 / 结算 / 订单 ---------- */
  .bottom-bar { max-width: 800px; border-radius: 14px 14px 0 0; }
  .cart-item { padding: 14px; }
  .cart-image { width: 96px; height: 96px; }
  .cart-summary { margin-bottom: 12px; }
  .order-card { padding: 16px; }
  .order-goods img { width: 64px; height: 64px; }

  /* ---------- 搜索 ---------- */
  .search-head { top: var(--topnav-h); padding: 16px 24px 8px; }

  /* ---------- 我的：左侧资料 + 右侧订单 ---------- */
  .page--mine {
    display: grid; grid-template-columns: 380px minmax(0, 1fr);
    gap: 18px; align-items: start;
    max-width: 1040px; margin: 0 auto;   /* 收窄避免整行拉太散 */
  }
  .page--mine .profile-card { grid-column: 1; grid-row: 1; padding: 26px 22px; }
  .page--mine .order-card-wrap { grid-column: 2; grid-row: 1 / span 2; margin-top: 0; }
  .page--mine .service-card { grid-column: 1; grid-row: 2; margin-top: 0; }
  .order-statuses { margin-top: 22px; }

  /* ---------- 弹层：桌面端由「底部抽屉」变成「居中卡片」 ---------- */
  .sheet-mask { align-items: center; justify-content: center; }
  .sheet {
    max-width: 440px; margin: 0;
    border-radius: 16px;
    padding: 16px 20px 20px;
    animation: sheet-pop 0.2s cubic-bezier(0.2, 0.9, 0.3, 1);
  }
  @keyframes sheet-pop {
    from { transform: scale(0.96); opacity: 0.6; }
    to { transform: scale(1); opacity: 1; }
  }

  /* ---------- 站点页脚：桌面端由居中堆叠改为「左品牌 / 右备案号」两栏 ---------- */
  .site-footer {
    padding: 24px 24px 30px;
    text-align: left;
    border-top: 1px solid rgba(20, 23, 31, 0.07);
  }
  .site-footer .footer-inner {
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
    max-width: 1132px; margin: 0 auto;
  }
  .footer-beian { margin-top: 0; text-align: right; }
}

