/* =========================================================
   Hydi 小店 · 样式
   ---------------------------------------------------------
   设计令牌直接沿用 HydI 论坛那一套（同一组颜色、圆角、动效曲线），
   所以两个站看起来是"一家人"，但代码完全独立、互不引用。
   ========================================================= */

/* ---------- 1. 设计令牌 ---------- */
:root {
  --brand: #f6c445;
  --brand-strong: #ffd75e;
  --brand-dim: rgba(246, 196, 69, 0.14);
  --brand-line: rgba(246, 196, 69, 0.32);

  --accent-2: #4fd1c5;
  --danger: #ff5f6d;

  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-full: 999px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 0.16s var(--ease);
  --t-base: 0.26s var(--ease);

  --header-h: 64px;
  /* 刘海 / 底部小横条的安全区。桌面和安卓取到 0，只有 iPhone 有值。
     ★ 一定要带兜底值 0px：老浏览器不认 env() 时整行会被丢掉。 */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* 顶栏占的总高度（含刘海）—— 算页面高度时要用它，不能再用 --header-h */
  --header-total: calc(var(--header-h) + var(--safe-top));

  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei",
    "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  --shadow-card: 0 2px 10px rgba(0, 0, 0, 0.4);
  --shadow-pop: 0 18px 50px rgba(0, 0, 0, 0.6);

  --bg: #0b0b0d;
  --bg-soft: #101012;
  --surface: #1d1d1d;
  --surface-2: #262626;
  --surface-3: #303030;
  --overlay: rgba(10, 10, 11, 0.72);

  --text: #f2f2f3;
  --text-2: #a8a8ad;
  --text-3: #6f6f76;
  --on-brand: #17130a;

  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
}

/* ---------- 2. 基础 ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll { overflow: hidden; }

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

::selection {
  background: var(--brand);
  color: var(--on-brand);
}

/* 滚动条：细一点，别抢戏 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: var(--r-full);
}
::-webkit-scrollbar-thumb:hover { background: #3d3d3d; }

.hidden { display: none !important; }

/* ---------- 3. 顶栏 ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 40;
  /* ★ iPhone 刘海 / 状态栏：viewport-fit=cover 之后，页面顶部会延伸到
     刘海下面。不加这一行的结果就是"顶栏最上边看不到"（logo 和按钮被盖住）。
     env() 在非 iOS / 非刘海机型上取到 0，不影响其他平台。 */
  height: calc(var(--header-h) + var(--safe-top));
  padding: var(--safe-top) 22px 0;
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(11, 11, 13, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* 品牌标：一个琥珀色圆角块 + 字母，和论坛的 H 标同一个手感 */
.brand__mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--brand-strong), var(--brand));
  color: var(--on-brand);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.5px;
  box-shadow: 0 2px 10px rgba(246, 196, 69, 0.28);
}

.brand__text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand__name { font-size: 15px; font-weight: 700; letter-spacing: 0.2px; }
.brand__sub { font-size: 10.5px; color: var(--text-3); letter-spacing: 0.3px; }

.header__spacer { flex: 1; }

.header__nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-item {
  padding: 7px 13px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text-2);
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.is-active { background: var(--brand-dim); color: var(--brand); font-weight: 600; }

/* 购物车按钮 */
.cart-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px;
  border: 1px solid var(--brand-line);
  border-radius: var(--r-full);
  background: var(--brand-dim);
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast), transform var(--t-fast);
}
.cart-btn:hover { background: rgba(246, 196, 69, 0.2); }
.cart-btn:active { transform: scale(0.97); }

/* 次要按钮（我的订单）：不用琥珀色抢购物车的注意力 */
.cart-btn--ghost {
  border-color: var(--line-2);
  background: transparent;
  color: var(--text-2);
  font-weight: 600;
}
.cart-btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.cart-btn--ghost .cart-badge { background: var(--surface-3); color: var(--text); }

.cart-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--r-full);
  background: var(--brand);
  color: var(--on-brand);
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.cart-badge.is-zero { display: none; }

/* ---------- 4. 页面容器 ---------- */
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 22px 70px;
}

/* ---------- 5. Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 26px;
  padding: 34px 30px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background:
    radial-gradient(120% 180% at 0% 0%, var(--brand-dim), transparent 58%),
    var(--surface);
}
/* 右上角一团很淡的光，让大片深色不至于发闷 */
.hero::after {
  content: "";
  position: absolute;
  top: -110px;
  right: -80px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(246, 196, 69, 0.16), transparent 68%);
  pointer-events: none;
}
.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: var(--brand);
  text-transform: uppercase;
}
.hero__title {
  margin: 10px 0 0;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.25;
}
.hero__desc {
  margin: 10px 0 0;
  max-width: 560px;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.75;
}

/* ---------- 6. 区块标题 ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 14px;
}
.section-title { font-size: 16px; font-weight: 700; }
.section-note { font-size: 12px; color: var(--text-3); }

/* ---------- 7. 商品网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
  transition: border-color var(--t-fast), transform var(--t-base), box-shadow var(--t-base);
}
.card:hover {
  border-color: var(--line-2);
  transform: translateY(-3px);
  box-shadow: var(--shadow-card);
}

/* 商品图：1:1 方图。没有图时不要放一个巨大的暗色字 ——
   那看着像"图片加载失败"。改成"淡色首字 + 暂无图片"的明确占位。 */
.card__media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--surface-2);
  overflow: hidden;
}
.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--t-base);
}
.card:hover .card__media img { transform: scale(1.035); }

/* ---------- 商品分类标签（虚拟服务 / 实体商品） ---------- */
.ktag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border: 1px solid transparent;
  border-radius: var(--r-full);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.6;
  vertical-align: middle;
  white-space: nowrap;
}
.ktag--virtual {
  color: #7fd8ff;
  border-color: rgba(127, 216, 255, 0.36);
  background: rgba(127, 216, 255, 0.1);
}
.ktag--physical {
  color: #ffc46b;
  border-color: rgba(255, 196, 107, 0.36);
  background: rgba(255, 196, 107, 0.1);
}
.ktag--sm { padding: 1px 6px; font-size: 10px; }
/* 卡片上压在图片左上角 */
.ktag--onmedia {
  position: absolute;
  top: 9px;
  left: 9px;
  z-index: 1;
  background: rgba(12, 12, 14, 0.72);
  backdrop-filter: blur(6px);
}

/* 分类筛选按钮 */
.kfilters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -6px 0 16px;
}
.kfilter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-full);
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.kfilter:hover { background: var(--surface-2); color: var(--text); }
.kfilter.is-active {
  color: var(--on-brand);
  background: var(--brand);
  border-color: var(--brand);
}
.kfilter__n {
  padding: 0 5px;
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.12);
  font-size: 10.5px;
  font-weight: 800;
}
.kfilter.is-active .kfilter__n { background: rgba(0, 0, 0, 0.18); }

/* 结算页顶上的分类提示 */
.ck-note {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: 11.5px;
  color: var(--text-2);
  line-height: 1.6;
}

/* 后台：分类选择（两张卡片二选一） */
.kchoose {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.kchoose__item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 11.5px;
  line-height: 1.55;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.kchoose__item b { font-size: 13px; color: var(--text); }
.kchoose__item:hover { background: var(--surface-2); }
.kchoose__item.is-active {
  border-color: var(--brand-line);
  background: var(--brand-dim);
}
.kchoose__item.is-active b { color: var(--brand); }

.card__ph {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: linear-gradient(135deg, #232323, #191919);
}
.card__ph b {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  color: rgba(246, 196, 69, 0.34);
}
.card__ph span {
  font-size: 10.5px;
  letter-spacing: 0.5px;
  color: var(--text-3);
}

.card__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 13px 14px 15px;
  flex: 1;
}
.card__name {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__desc {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 38px;
}
.card__foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 6px;
}
.card__price {
  font-size: 18px;
  font-weight: 800;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
}
.card__price small { font-size: 12px; font-weight: 600; opacity: 0.8; }

/* ---------- 8. 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast), opacity var(--t-fast);
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.btn--primary { background: var(--brand); color: var(--on-brand); }
.btn--primary:hover:not([disabled]) { background: var(--brand-strong); }

.btn--ghost {
  background: transparent;
  border-color: var(--line-2);
  color: var(--text-2);
}
.btn--ghost:hover:not([disabled]) { background: var(--surface-2); color: var(--text); }

.btn--danger { background: rgba(255, 95, 109, 0.12); border-color: rgba(255, 95, 109, 0.4); color: var(--danger); }
.btn--danger:hover:not([disabled]) { background: rgba(255, 95, 109, 0.2); }

.btn--sm { padding: 6px 12px; font-size: 12.5px; }
.btn--block { width: 100%; }

/* ---------- 9. 表单 ---------- */
.field { margin-bottom: 14px; }
.field__label {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}
.field__wrap {
  display: flex;
  align-items: center;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.field__wrap:focus-within { border-color: var(--brand-line); background: var(--surface-3); }
.field__wrap input,
.field__wrap textarea {
  width: 100%;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
}
.field__wrap input::placeholder,
.field__wrap textarea::placeholder { color: var(--text-3); }

/* 多行输入：高度自动，绝对不能固定高度（固定高度会把文字裁掉、压到标签上） */
.field__wrap--area {
  height: auto;
  padding: 10px 12px;
  align-items: stretch;
}
.field__wrap--area textarea {
  resize: vertical;
  min-height: 74px;
  line-height: 1.65;
}

.field__hint { margin-top: 6px; font-size: 11.5px; color: var(--text-3); }
.field__err { display: none; margin-top: 6px; font-size: 11.5px; color: var(--danger); }
.field__err.is-on { display: block; }

.field-row { display: flex; gap: 12px; }
.field-row > .field { flex: 1; }

/* ---------- 10. 遮罩 / 弹窗 / 抽屉 ---------- */
.mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  background: var(--overlay);
  backdrop-filter: blur(3px);
}
.mask.is-open { display: block; animation: fadeIn 0.18s var(--ease); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: none; }
}

.modal {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 36px);
  max-width: 520px;
  max-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  background: var(--bg-soft);
  box-shadow: var(--shadow-pop);
  animation: popIn 0.22s var(--ease);
  overflow: hidden;
}

.modal__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.modal__title { font-size: 15px; font-weight: 700; }
.modal__body { padding: 18px; overflow-y: auto; }
.modal__foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.icon-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text-3);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* 购物车抽屉：从右边滑出来 */
.drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line-2);
  background: var(--bg-soft);
  box-shadow: var(--shadow-pop);
  /* ★ 抽屉是贴着屏幕顶部/底部的全高面板，所以它自己要让开刘海和小横条。
     不加 padding-top 的后果：手机上抽屉铺满整屏，右上角那个 ✕ 正好落在
     刘海（0~59px）里 —— 手指点不到，看起来就是"购物车关不掉、回不去"。
     （这个 bug 实测复现过：关闭按钮在 y=16~46，人点不到，只有代码点得到。） */
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  animation: slideIn 0.26s var(--ease);
}
.drawer__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.drawer__body { flex: 1; overflow-y: auto; padding: 16px 18px; }
.drawer__foot {
  padding: 16px 18px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}

/* ---------- 11. 购物车条目 ---------- */
.citem {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.citem:last-child { border-bottom: 0; }
.citem__media {
  width: 62px;
  height: 62px;
  flex-shrink: 0;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface-2);
}
.citem__media img { width: 100%; height: 100%; object-fit: cover; }
.citem__ph {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  font-size: 20px; font-weight: 800;
  /* 和商品卡占位同一套颜色，不然小图上几乎看不见（原来是 --surface-3，
     在深色底上等于没有） */
  color: rgba(246, 196, 69, 0.34);
  background: linear-gradient(135deg, #232323, #191919);
}
.citem__main { flex: 1; min-width: 0; }
.citem__name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.citem__price { margin-top: 2px; font-size: 12px; color: var(--brand); font-weight: 700; }
.citem__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
}

/* 数量加减 */
.qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.qty button {
  width: 26px;
  height: 26px;
  border: 0;
  background: none;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.qty button:hover { background: var(--surface-2); color: var(--text); }
.qty__n {
  min-width: 28px;
  text-align: center;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.empty {
  padding: 46px 16px;
  text-align: center;
  color: var(--text-3);
}
.empty__icon { font-size: 30px; opacity: 0.5; margin-bottom: 8px; }
.empty__title { font-size: 14px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }

/* 合计行 */
.total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.total-row__label { font-size: 12.5px; color: var(--text-3); }
.total-row__value {
  font-size: 22px;
  font-weight: 800;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

/* ---------- 12. 付款页 ---------- */
.pay-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.pay-head__label { font-size: 11.5px; color: var(--text-3); }
.pay-head__amount {
  font-size: 27px;
  font-weight: 800;
  color: var(--brand);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}
.pay-head__side { text-align: right; }
.pay-head__no {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  color: var(--text-2);
  padding: 3px 8px;
  border-radius: var(--r-xs);
  background: var(--surface-3);
  display: inline-block;
}

.pay-tip {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.75;
  color: var(--text-2);
}
.pay-tip b { color: var(--brand); }
.pay-tip--warn {
  border-color: var(--brand-line);
  background: var(--brand-dim);
}
.pay-tip--warn b { color: var(--brand); }

/* 两张二维码并排。二维码不能太小（扫不出来），
   而且要能点开放大 —— 屏幕上的码自己扫不了自己。 */
.qr-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.qr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 10px 4px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: #fff;
  cursor: zoom-in;
  transition: border-color var(--t-fast), transform var(--t-fast);
}
.qr-card:hover { border-color: var(--brand-line); transform: translateY(-2px); }
.qr-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #fff;
  border-radius: var(--r-xs);
}
.qr-card__label {
  font-size: 12px;
  font-weight: 700;
  color: #333;
  padding-bottom: 4px;
}

.pay-empty {
  margin-top: 14px;
  padding: 22px 16px;
  text-align: center;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-md);
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.8;
}

/* 二维码放大 */
.lightbox {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(360px, calc(100vw - 40px));
  padding: 14px;
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--shadow-pop);
  text-align: center;
  cursor: zoom-out;
  animation: popIn 0.18s var(--ease);
}
.lightbox img { width: 100%; aspect-ratio: 1/1; object-fit: contain; border-radius: var(--r-sm); }
.lightbox__cap { margin-top: 8px; font-size: 13px; font-weight: 700; color: #222; }
.lightbox__hint { margin-top: 2px; font-size: 11px; color: #999; }

/* 订单状态块（已付款 / 已发货 / 已取消） */
.pay-state { text-align: center; padding: 18px 0 4px; }
.pay-state__icon { font-size: 34px; line-height: 1; margin-bottom: 10px; }
.pay-state__title { font-size: 16px; font-weight: 800; margin-bottom: 5px; }
.pay-state__desc { font-size: 12.5px; color: var(--text-3); line-height: 1.75; }

/* 我的订单列表 */
.myord {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.myord + .myord { margin-top: 8px; }
.myord:hover { border-color: var(--brand-line); background: var(--surface-2); }
.myord__main { flex: 1; min-width: 0; }
.myord__no {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  font-weight: 700;
}
.myord__meta { margin-top: 2px; font-size: 11.5px; color: var(--text-3); }
.myord__right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.myord__total { font-size: 14px; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }

/* ---------- 13. 提示条 ---------- */
.toast-host {
  position: fixed;
  left: 50%;
  /* 底部让开 iPhone 的小横条，不然提示会被压在 home indicator 下面 */
  bottom: calc(26px + var(--safe-bottom));
  z-index: 90;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 10px 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  box-shadow: var(--shadow-pop);
  animation: popIn 0.2s var(--ease);
}
.toast.is-err { border-color: rgba(255, 95, 109, 0.5); color: #ffb3b9; }

/* ---------- 14. 后台 ---------- */
/* 登录卡片居中。
   ★ 两个坑：
     1. iOS 的 100vh 是"地址栏收起后"的高度，比当前可见区域大 ——
        用 100vh 居中会算错，改用 dvh（不支持的浏览器自动退回上一个值）。
     2. place-items:center 在"卡片比容器高"时会把顶部溢出到滚动区之外，
        导致最上面永远滚不到。改成 flex + margin:auto，
        内容装得下就居中、装不下就从顶部开始、可以正常滚动。 */
.login-wrap {
  min-height: calc(100vh - var(--header-total));
  min-height: calc(100dvh - var(--header-total));
  display: flex;
  flex-direction: column;
  padding: 40px 20px calc(40px + var(--safe-bottom));
}
.login-card {
  width: 100%;
  max-width: 380px;
  margin: auto;
  padding: 28px 26px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.login-card__title { margin: 0 0 4px; font-size: 19px; font-weight: 800; }
.login-card__sub { margin: 0 0 20px; font-size: 12.5px; color: var(--text-3); }
/* 后台进门时的"正在进入"提示（只在查口令会话的那几百毫秒出现） */
.boot-hint {
  margin: auto;
  font-size: 13px;
  color: var(--text-3);
}

/* 后台标签页 */
.tabs {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: var(--surface);
}
.tab {
  padding: 7px 17px;
  border: 0;
  border-radius: var(--r-full);
  background: none;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--brand); color: var(--on-brand); }

/* 概览数字 */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.stat {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}
.stat__n { font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.5px; }
.stat__l { margin-top: 2px; font-size: 11.5px; color: var(--text-3); }

/* 后台商品行 */
.prow {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}
.prow + .prow { margin-top: 9px; }
.prow.is-off { opacity: 0.62; }
.prow__media {
  width: 62px;
  height: 62px;
  flex-shrink: 0;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface-2);
}
.prow__media img { width: 100%; height: 100%; object-fit: cover; }
.prow__ph {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  font-size: 20px; font-weight: 800;
  color: rgba(246, 196, 69, 0.34);
  background: linear-gradient(135deg, #232323, #191919);
}
.prow__main { flex: 1; min-width: 0; }
.prow__name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  flex-wrap: wrap;
}
.prow__desc {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prow__price {
  font-size: 14px;
  font-weight: 800;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.prow__acts { display: flex; gap: 6px; flex-shrink: 0; }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--r-full);
  border: 1px solid var(--line-2);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.pill[data-s="off"] { color: var(--text-3); }
/* 订单状态配色：待付款(橙) / 已付款待确认(蓝) / 已发货(绿) / 已取消(灰) */
.pill[data-s="pending"] { color: #ffb648; border-color: rgba(255, 182, 72, 0.4); background: rgba(255, 182, 72, 0.1); }
.pill[data-s="claimed"] { color: #6cb8ff; border-color: rgba(108, 184, 255, 0.45); background: rgba(108, 184, 255, 0.12); }
.pill[data-s="shipped"],
.pill[data-s="done"] { color: #4fd18b; border-color: rgba(79, 209, 139, 0.4); background: rgba(79, 209, 139, 0.1); }
.pill[data-s="cancelled"],
.pill[data-s="new"] { color: var(--text-3); }

/* 后台：两张收款码 */
.qr-slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 220px));
  gap: 12px;
}
.qr-slot {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  text-align: center;
}
.qr-slot__view {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: #fff;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.7;
  color: #999;
}
.qr-slot__view img { width: 100%; height: 100%; object-fit: contain; }
.qr-slot__name { margin-top: 8px; font-size: 13px; font-weight: 700; }
.qr-slot__ops { display: flex; gap: 6px; justify-content: center; margin-top: 8px; flex-wrap: wrap; }

/* 后台：订单里的提醒与已发货标记 */
.orow__warn {
  margin-top: 9px;
  padding: 7px 10px;
  border-radius: var(--r-xs);
  border: 1px solid rgba(255, 182, 72, 0.35);
  background: rgba(255, 182, 72, 0.1);
  color: #ffc266;
  font-size: 11.5px;
  line-height: 1.6;
}
.orow__done { font-size: 11.5px; color: var(--text-3); }

/* 图片上传框 */
.imgbox {
  display: flex;
  align-items: center;
  gap: 14px;
}
.imgbox__view {
  width: 88px;
  height: 88px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface-2);
  overflow: hidden;
  font-size: 11.5px;
  color: var(--text-3);
}
.imgbox__view img { width: 100%; height: 100%; object-fit: cover; }
.imgbox__ops { display: flex; flex-direction: column; gap: 7px; align-items: flex-start; }

/* 订单行 */
.orow {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}
.orow + .orow { margin-top: 9px; }
.orow__head {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 700;
}
.orow__no {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  padding: 2px 7px;
  border-radius: var(--r-xs);
  background: var(--surface-3);
  color: var(--text-2);
}
.orow__meta { margin-top: 5px; font-size: 11.5px; color: var(--text-3); }
.orow__items { margin-top: 8px; display: flex; flex-direction: column; gap: 3px; }
.orow__item {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-2);
}
.orow__foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.orow__total { font-size: 15px; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }

/* ---------- 15. 页脚 ---------- */
.footer {
  padding: 26px 22px 40px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}
.footer a { color: var(--text-2); }
.footer a:hover { color: var(--brand); }

/* ---------- 16. 手机端 ---------- */
@media (max-width: 720px) {
  /* ★ 这里的 padding 必须保留 --safe-top：写成 `padding: 0 14px` 会把上面
     顶栏的刘海内边距清掉，结果就是 iPhone 上 logo 又被状态栏盖住
     （这个坑实测踩了一次）。 */
  .header { padding: var(--safe-top) 14px 0; gap: 10px; }
  .brand__sub { display: none; }
  .header__nav { display: none; }
  .wrap { padding: 18px 14px 60px; }
  .hero { padding: 24px 20px; border-radius: var(--r-lg); }
  .hero__title { font-size: 23px; }
  .hero__desc { font-size: 12.5px; }

  /* 手机上两列就够，一列太浪费横向空间 */
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
  .card__body { padding: 10px 11px 12px; }
  .card__name { font-size: 13px; }
  .card__desc { font-size: 11px; min-height: 34px; -webkit-line-clamp: 2; }
  .card__price { font-size: 16px; }
  /* 卡片底部按钮在窄屏上换行铺满，别挤在一起 */
  .card__foot { flex-direction: column; align-items: stretch; gap: 8px; }
  .card__foot .btn { width: 100%; }

  .field-row { flex-direction: column; gap: 0; }
  .prow { flex-wrap: wrap; }
  .prow__acts { width: 100%; }
  .prow__acts .btn { flex: 1; }
  .drawer { width: 100%; border-left: 0; }
  .modal { max-height: calc(100vh - 28px); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* =========================================================
   以下原本在 app.css（已合并进来：少一个请求就少一个往返）
   ========================================================= */
/* ---------- 通用面板 ---------- */
.panel {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}
.panel + .panel { margin-top: 16px; }
.panel__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}
.panel__title { font-size: 14.5px; font-weight: 700; }
.panel__body { padding: 16px; }
.counter { font-size: 11.5px; color: var(--text-3); }

/* ---------- 顶栏用户块 ---------- */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 5px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-full);
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.user-chip:hover { background: var(--surface-2); color: var(--text); border-color: var(--brand-line); }
.user-chip__avatar {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: var(--surface-3);
}
.user-chip__avatar--ph {
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--on-brand);
  background: linear-gradient(140deg, var(--brand-strong), var(--brand));
}
.user-chip__name {
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 管理员的头像单独是个按钮（点了就换头像），名字才是进后台的链接 */
.user-chip__avbtn {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  line-height: 0;
  cursor: pointer;
}
.user-chip__avbtn:hover .user-chip__avatar { box-shadow: 0 0 0 2px var(--brand-line); }
.user-chip__avbtn:active { transform: scale(0.94); }
.user-chip--admin .user-chip__name {
  color: var(--text-2);
  text-decoration: none;
  transition: color var(--t-fast);
}
.user-chip--admin .user-chip__name:hover { color: var(--text); }

/* ---------- 登录页 ---------- */
.auth-switch {
  margin-top: 16px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-3);
}
.link-brand { color: var(--brand); font-weight: 600; }
.link-brand:hover { text-decoration: underline; }

/* ---------- 我的：资料卡 ---------- */
.profile-card__top {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 18px 16px;
}
.profile-card__main { flex: 1; min-width: 0; }
.profile-card__name {
  font-size: 19px;
  font-weight: 800;
  cursor: pointer;
  display: inline-block;
  border-bottom: 1px dashed transparent;
}
.profile-card__name:hover { border-bottom-color: var(--brand-line); }
.profile-card__sub { margin-top: 3px; font-size: 11.5px; color: var(--text-3); }

/* 可点换头像 */
.avatar-edit {
  position: relative;
  width: 70px;
  height: 70px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
}
.avatar-edit__img { width: 100%; height: 100%; }
.avatar-edit__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-edit__ph {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 800;
  color: var(--on-brand);
  background: linear-gradient(140deg, var(--brand-strong), var(--brand));
}
.avatar-edit__mask {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity var(--t-fast);
}
.avatar-edit:hover .avatar-edit__mask { opacity: 1; }

/* ---------- 联系管理员：悬浮按钮 + 面板 ---------- */
.chat-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 17px;
  border: 1px solid var(--brand-line);
  border-radius: var(--r-full);
  background: var(--brand);
  color: var(--on-brand);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 26px rgba(246, 196, 69, 0.28);
  transition: transform var(--t-fast), filter var(--t-fast);
}
.chat-fab:hover { filter: brightness(1.06); }
.chat-fab:active { transform: scale(0.97); }
.chat-fab__dot {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: none;
  place-items: center;
  border-radius: var(--r-full);
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.chat-fab__dot.is-on { display: inline-grid; }

/* ---------------- 微信式聊天面板 ----------------
   配色尽量贴微信：对方灰气泡、自己绿色气泡、头像圆角方形。
   深色站里用深色版的微信配色（微信自己也有深色模式）。 */
.wx {
  --wx-bg: #131315;
  --wx-bar: #1c1c1f;
  --wx-line: rgba(255, 255, 255, 0.07);
  --wx-in: #2b2b30;
  --wx-in-text: #ececed;
  --wx-out: #95ec69;
  --wx-out-text: #12230b;
  --wx-meta: rgba(255, 255, 255, 0.36);
}

.chat-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 55;
  width: min(392px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 120px));
  height: min(620px, calc(100dvh - 120px));
  display: none;
  flex-direction: column;
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  background: var(--wx-bg);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.chat-panel.is-open { display: flex; animation: popIn 0.2s var(--ease); }

/* 顶栏：返回箭头 + 居中标题（微信就是一个名字，下面一行小字）
   --wx-top / --wx-h 由 JS 按 visualViewport 写入，只有手机端用得上 */
.wx__head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 9px 10px;
  background: var(--wx-bar);
  border-bottom: 1px solid var(--wx-line);
}
.wx__back {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background var(--t-fast);
}
.wx__back:hover { background: rgba(255, 255, 255, 0.07); }
.wx__mid { flex: 1; min-width: 0; text-align: center; }
.wx__title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wx__sub {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wx__spacer { width: 38px; flex-shrink: 0; }

.wx__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 14px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--wx-bg);
}
/* 消息少的时候贴着输入框（底对齐），多出来的空白留在上面。
   微信里打开一个只聊了几句的会话就是这样。
   内容超过一屏时 margin-top:auto 会算成 0，不影响正常滚动。 */
.wx__body > :first-child { margin-top: auto; }

.wx-time {
  align-self: center;
  font-size: 11px;
  color: var(--wx-meta);
  padding: 1px 0;
}

/* 一条消息：头像 + 气泡 */
.wx-msg {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}
.wx-msg--me { flex-direction: row-reverse; }
.wx-av {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 6px;
  overflow: hidden;
  background: var(--wx-in);
  color: var(--text-2);
  font-size: 15px;
  font-weight: 700;
  user-select: none;
}
.wx-msg--me .wx-av { background: rgba(149, 236, 105, 0.16); color: var(--wx-out); }
.wx-av__img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wx-msg__main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: calc(100% - 78px);
  min-width: 0;
}
.wx-msg--me .wx-msg__main { align-items: flex-end; }

/* 气泡：圆角 8，留个尖角指向头像。
   ★ 三角形要用 width/height:0 + 单边 border 画：
     写成 border:6px solid transparent 再改一边颜色，盒宽是 12px，
     彩色那一半会落到气泡底下，最后只在边角露出 1px，看着像没有尖角。 */
.wx-bubble {
  position: relative;
  max-width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--wx-in);
  color: var(--wx-in-text);
  font-size: 14.5px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}
.wx-bubble::before {
  content: "";
  position: absolute;
  top: 12px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}
.wx-msg:not(.wx-msg--me) .wx-bubble::before {
  left: -6px;
  border-right: 6px solid var(--wx-in);
}
.wx-msg--me .wx-bubble {
  background: var(--wx-out);
  color: var(--wx-out-text);
  font-weight: 500;
}
.wx-msg--me .wx-bubble::before {
  right: -6px;
  border-left: 6px solid var(--wx-out);
}

/* 图片消息：不要气泡背景，图自己就是气泡。
   要写成 .wx-bubble.wx-bubble--img，否则被上面
   .wx-msg--me .wx-bubble 的绿色背景盖掉（那边权重更高）。 */
.wx-bubble.wx-bubble--img {
  padding: 0;
  background: transparent;
  /* 图片气泡里不要 pre-wrap：否则 HTML 里的缩进会变成空行 */
  white-space: normal;
}
.wx-bubble.wx-bubble--img::before { display: none; }
.wx-bubble__img {
  display: block;
  max-width: 180px;
  max-height: 240px;
  width: auto;
  border-radius: 8px;
  background: var(--wx-in);
  cursor: zoom-in;
}
.wx-bubble--img .wx-bubble__text {
  display: block;
  margin-top: 6px;
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--wx-in);
  color: var(--wx-in-text);
}
.wx-msg--me .wx-bubble--img .wx-bubble__text { background: var(--wx-out); color: var(--wx-out-text); }

/* 底栏：发图 / 输入 / 发送 */
.wx__foot {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 10px;
  background: var(--wx-bar);
  border-top: 1px solid var(--wx-line);
}
.wx__tool {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.wx__tool:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.wx__field {
  flex: 1;
  min-width: 0;
  display: flex;
  padding: 0 10px;
  border-radius: 8px;
  background: #2a2a2e;
}
.wx__input {
  width: 100%;
  min-height: 34px;
  max-height: 104px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.5;
  resize: none;
  outline: 0;
}
.wx__input::placeholder { color: var(--text-3); }
.wx__send {
  flex-shrink: 0;
  min-width: 58px;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: var(--wx-out);
  color: var(--wx-out-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.wx__send:disabled {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-3);
  cursor: default;
}

/* 往上翻远了才浮出来的「最新」小按钮 */
.wx__jump {
  position: absolute;
  right: 14px;
  bottom: 66px;
  z-index: 2;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-full);
  background: rgba(30, 30, 34, 0.92);
  color: var(--text-2);
  font-size: 11.5px;
  font-family: inherit;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.wx__jump.is-on { display: inline-flex; }

/* 聊天面板铺满手机屏幕时，底下的页面别跟着滚 */
body.wx-lock { overflow: hidden; }

/* 空会话 / 没有消息 */
.chat-empty {
  margin: auto;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.9;
}

/* ---------- 后台聊天 ---------- */
.chat-admin {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 14px;
  min-height: 460px;
}
.chat-list {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow-y: auto;
  max-height: 560px;
}
.chat-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background var(--t-fast);
}
.chat-item:last-child { border-bottom: 0; }
.chat-item:hover { background: var(--surface-2); }
.chat-item.is-active { background: var(--brand-dim); }
.chat-item__avatar {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  /* 跟聊天里的头像一致：微信是圆角方形，不是圆形 */
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface-3);
}
.chat-item__avatar--ph {
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--on-brand);
  background: linear-gradient(140deg, var(--brand-strong), var(--brand));
}
.chat-item__main { flex: 1; min-width: 0; }
.chat-item__name { font-size: 13px; font-weight: 700; }
.chat-item__preview {
  font-size: 11.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-item__unread {
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border-radius: var(--r-full);
  background: var(--danger);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
}
.chat-thread {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--wx-bg);
  overflow: hidden;
  max-height: 640px;
  min-height: 460px;
}
.chat-thread__head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  background: var(--wx-bar);
  border-bottom: 1px solid var(--wx-line);
}
.chat-thread__name {
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-thread__count { margin-left: auto; flex-shrink: 0; font-size: 11px; color: var(--text-3); }
/* 返回键只在手机上的整屏会话里出现 */
.chat-thread__back {
  width: 38px;
  height: 38px;
  margin-left: -6px;
  flex-shrink: 0;
  display: none;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.chat-thread__back:hover { background: rgba(255, 255, 255, 0.07); }
/* 气泡区、底栏的样式全部来自 .wx__body / .wx__foot，这里只管容器本身 */
.chat-thread__body { flex: 1 1 auto; min-height: 0; }
.chat-thread__foot { border-radius: 0; }

/* ---------- 管理后台口令入口 ---------- */
.pass-entry {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.pass-entry__hint { font-size: 11.5px; color: var(--text-3); line-height: 1.7; }

/* 标签上的小角标（未读消息数） */
.tab__badge {
  display: none;
  min-width: 16px;
  height: 16px;
  margin-left: 5px;
  padding: 0 4px;
  place-items: center;
  border-radius: var(--r-full);
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  vertical-align: middle;
}
.tab__badge.is-on { display: inline-grid; }

/* ---------- 手机端补充 ---------- */
@media (max-width: 720px) {
  .header__nav { display: none; }
  .user-chip__name { display: none; }
  /* 管理员这块手机上要保留「管理员」三个字：
     手机顶栏的导航是隐藏的，头像是换头像用的，
     没有这三个字就找不到进后台的入口了。 */
  .user-chip--admin .user-chip__name { display: inline; max-width: 56px; }
  .user-chip { padding: 5px; }
  .user-chip--admin { padding: 5px 10px 5px 5px; }
  .user-chip__avatar { width: 28px; height: 28px; }

  /* 分类筛选、分类选择：手机上让它们换行排，别挤成一条 */
  .kfilters { gap: 7px; margin-bottom: 14px; }
  .kfilter { padding: 6px 11px; font-size: 12px; }
  .kchoose { grid-template-columns: 1fr; }
  .ktag--onmedia { top: 7px; left: 7px; }

  .chat-fab { right: 14px; bottom: calc(14px + var(--safe-bottom)); padding: 10px 15px; }

  /* ★ 手机上聊天面板铺满整个屏幕，跟微信打开一个聊天页一样。
     top/height 由 JS 按 visualViewport 写进 --wx-top / --wx-h：
     iOS 弹键盘时 visualViewport 会变矮，面板跟着缩，输入框才不会被键盘盖住。 */
  .chat-panel {
    left: 0;
    right: 0;
    top: var(--wx-top, 0px);
    bottom: auto;
    width: 100%;
    height: var(--wx-h, 100vh);
    height: var(--wx-h, 100dvh);
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding-bottom: 0;
  }
  .wx__head { padding-top: calc(6px + var(--safe-top)); }
  .wx__body { padding: 12px 10px 16px; gap: 14px; }
  .wx__foot { padding-bottom: calc(8px + var(--safe-bottom)); }
  .wx__send { height: 36px; font-size: 14px; min-width: 62px; }
  .wx__tool { width: 38px; height: 36px; }
  .wx__field { border-radius: 8px; }
  .wx__input { font-size: 16px; line-height: 1.45; padding: 8px 0; }
  .wx-av { width: 36px; height: 36px; }
  .wx-msg__main { max-width: calc(100% - 74px); }
  .wx-msg { gap: 8px; }
  .wx-bubble { font-size: 15px; }
  .wx-bubble__img { max-width: 180px; max-height: 220px; }
  .wx__jump { bottom: calc(66px + var(--safe-bottom)); }

  .chat-admin { grid-template-columns: minmax(0, 1fr); }
  .chat-list { max-height: 200px; }
  .chat-thread { max-height: 66vh; min-height: 380px; }

  /* ★ 手机上点开一个会话 → 整屏铺开（跟微信一样）。
     不这么做的话，会话框挤在页面顶部，键盘一弹整页被顶走，页脚都露出来。 */
  .chat-thread__back { display: grid; }
  .chat-admin.is-thread .chat-list { display: none; }
  .chat-admin.is-thread .chat-thread {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--wx-top, 0px);
    width: 100%;
    height: var(--wx-h, 100vh);
    height: var(--wx-h, 100dvh);
    max-height: none;
    min-height: 0;
    z-index: 60;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  /* 刘海 / 底部小横条 */
  .chat-admin.is-thread .chat-thread__head { padding-top: calc(6px + var(--safe-top)); }
  .chat-admin.is-thread .chat-thread__foot { padding-bottom: calc(8px + var(--safe-bottom)); }
  .profile-card__top { flex-wrap: wrap; }
  .profile-card__main { flex: 1 1 100%; order: 3; }
  .profile-card__top > .btn { margin-left: auto; }
  .avatar-edit { width: 58px; height: 58px; }

  /* ---------- iPhone 专项 ----------
     ★ 输入框字号必须 ≥16px：iOS Safari 在聚焦字号小于 16px 的输入框时
       会自作主张把整个页面放大，用户得手动缩回去。这是 iPhone 上最常见的
       "点一下就变大了"的原因。 */
  .field__wrap input,
  .field__wrap textarea,
  .wx__input,
  input.input,
  select,
  textarea {
    font-size: 16px;
  }

  /* 购物车抽屉、弹窗的底部按钮不要被小横条压住。
     （抽屉自己的上下安全区在 style.css 的 .drawer 里统一处理了，
       这里不再重复写 padding-bottom，免得两处打架。） */
  .drawer__foot,
  .modal__foot {
    padding-bottom: calc(14px + var(--safe-bottom));
  }

  /* ★ 手机上关闭按钮要够大：苹果的建议是触控区至少 44×44，
     30×30 经常点不中，尤其在移动中单手操作。 */
  .drawer .icon-btn,
  .modal .icon-btn {
    width: 40px;
    height: 40px;
    font-size: 19px;
  }

  /* 页脚同样留出小横条的高度 */
  .footer { padding-bottom: calc(40px + var(--safe-bottom)); }

  /* ★ 弹窗是垂直居中的：内容一高，顶部就会伸到刘海区域去
     （标题栏和 ✕ 被状态栏盖住，等于关不掉）。
     所以最大高度要把上下安全区扣掉，让它始终落在可见区域内。 */
  .modal {
    max-height: calc(100vh - 28px - var(--safe-top) - var(--safe-bottom));
    max-height: calc(100dvh - 28px - var(--safe-top) - var(--safe-bottom));
  }
}


/* ---------- 后台：管理员头像 ---------- */
.adm-avatar-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
