/* 微锦超市 共享样式 —— 原创设计，移动端优先，桌面居中成手机宽度 */
:root {
  --brand: #ff5a1f;
  --brand-deep: #ef3d12;
  --brand-soft: #fff1e9;
  --price: #ff3b00;
  --ink: #1c1c1e;
  --ink-2: #55555a;
  --muted: #9a9aa2;
  --line: #ededf0;
  --bg: #f4f4f6;
  --card: #ffffff;
  --green: #12a05c;
  --blue: #2b6cff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(28, 28, 30, .05), 0 6px 18px rgba(28, 28, 30, .05);
  --tab-h: 54px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 8px);
}
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.wrap { max-width: 520px; margin: 0 auto; }
.hide { display: none !important; }

/* ---------- 顶部搜索栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: linear-gradient(180deg, #fff 60%, rgba(255, 255, 255, .86));
  padding: 10px 12px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, .04);
}
.searchbar {
  display: flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 4px 0 14px;
  background: #fff; border: 2px solid var(--blue);
  border-radius: 999px; box-shadow: 0 2px 10px rgba(43, 108, 255, .14);
}
.icon-btn {
  width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center;
  background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink-2);
}
.icon-btn:active { transform: scale(.92); }
.sb-div { width: 1px; height: 20px; background: var(--line); flex: 0 0 1px; }
#kw {
  flex: 1 1 auto; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent;
  font-size: 15px; letter-spacing: .2px;
}
#kw::placeholder { color: var(--muted); }
.sb-clear { color: var(--muted); }
.btn-search {
  flex: 0 0 auto; height: 34px; padding: 0 18px; border: 0; border-radius: 999px;
  background: linear-gradient(135deg, var(--blue), #1a53d8);
  color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; letter-spacing: 1px;
}
.btn-search:active { transform: translateY(1px); }

/* ---------- 轮播横幅 ---------- */
.kb { position: relative; margin: 12px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.kb-track { display: flex; transition: transform .42s cubic-bezier(.4, 0, .2, 1); }
.kb-item {
  position: relative; flex: 0 0 100%; height: 132px; padding: 22px 20px;
  display: flex; flex-direction: column; justify-content: center; gap: 6px; overflow: hidden;
}
.kb-item .k-note {
  align-self: flex-start; font-size: 11px; padding: 3px 8px; border-radius: 999px;
  background: rgba(255, 255, 255, .22); color: #fff; backdrop-filter: blur(2px);
}
.kb-item .k-title { font-size: 25px; font-weight: 800; color: #fff; letter-spacing: 1px; line-height: 1.15; }
.kb-item .k-sub { font-size: 12.5px; color: rgba(255, 255, 255, .88); }
.kb-item::after {
  content: ""; position: absolute; right: -34px; top: -46px; width: 168px; height: 168px;
  border-radius: 50%; background: rgba(255, 255, 255, .13);
}
.kb-item::before {
  content: ""; position: absolute; right: 34px; bottom: -58px; width: 116px; height: 116px;
  border-radius: 50%; background: rgba(255, 255, 255, .1);
}
.tone-warm { background: linear-gradient(120deg, #ff7a3c, #ef2f2f); }
.tone-mint { background: linear-gradient(120deg, #17b978, #0d8f7a); }
.tone-sky { background: linear-gradient(120deg, #4b7cff, #7b4dff); }
.tone-gold { background: linear-gradient(120deg, #f5a623, #e2601f); }
.tone-ink { background: linear-gradient(120deg, #3a3a44, #17171c); }
.kb-dots { position: absolute; bottom: 9px; left: 0; right: 0; display: flex; gap: 5px; justify-content: center; }
.kb-dots i { width: 5px; height: 5px; border-radius: 999px; background: rgba(255, 255, 255, .5); transition: width .25s; }
.kb-dots i.on { width: 15px; background: #fff; }

/* ---------- 分类筛选条 ---------- */
.chips { display: flex; gap: 8px; padding: 2px 12px 12px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 999px; background: #fff; color: var(--ink-2);
  font-size: 13px; border: 1px solid var(--line); white-space: nowrap; cursor: pointer;
}
.chip.on { background: var(--brand-soft); color: var(--brand-deep); border-color: #ffd3bd; font-weight: 600; }

/* ---------- 双列瀑布流 ---------- */
.feed { display: flex; gap: 10px; padding: 0 12px 20px; align-items: flex-start; }
.feed-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.gcard {
  position: relative;
  background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  display: block;
}
.gpic { position: relative; width: 100%; }
.gpic img { width: 100%; height: 100%; object-fit: cover; }
.gbadge {
  position: absolute; left: 8px; top: 8px; font-size: 10.5px; font-weight: 700; color: #fff;
  padding: 3px 7px; border-radius: 6px; background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  box-shadow: 0 2px 6px rgba(239, 61, 18, .3);
}
.gbody { padding: 9px 10px 11px; }
.gtitle {
  font-size: 14px; line-height: 1.42; color: var(--ink); display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 40px;
}
.gtags { display: flex; flex-wrap: wrap; gap: 4px; margin: 7px 0 0; min-height: 17px; }
.gtag { font-size: 10.5px; padding: 1.5px 5px; border-radius: 4px; }
.gtag.t-green { color: var(--green); background: #e9f7ef; }
.gtag.t-brand { color: var(--brand-deep); background: var(--brand-soft); }
.gtag.t-blue { color: var(--blue); background: #eaf0ff; }
.grow { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; margin-top: 9px; }
.gprice { color: var(--price); font-weight: 700; font-family: "DIN Alternate", "Bahnschrift", var(--font, inherit); }
.gprice i { font-style: normal; font-size: 12px; margin-right: 1px; }
.gprice b { font-size: 21px; font-weight: 800; letter-spacing: -.3px; }
.gprice em { font-style: normal; font-size: 13px; }
.gprice s { display: block; font-size: 11px; color: var(--muted); font-weight: 400; margin-top: 1px; }
.gsales { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.gself { display: inline-flex; align-items: center; font-size: 11px; color: var(--brand-deep); font-weight: 700; margin-right: 4px; }

/* 占位图（未上传素材时按 id 生成稳定配色） */
.ph { width: 100%; display: grid; place-items: center; color: #fff; font-size: 30px; font-weight: 800; letter-spacing: 2px; opacity: .96; }

/* ---------- 通用状态 ---------- */
.state { padding: 46px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.state b { display: block; font-size: 15px; color: var(--ink-2); margin-bottom: 6px; font-weight: 600; }
.spin { width: 22px; height: 22px; margin: 0 auto 10px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: r 1s linear infinite; }
@keyframes r { to { transform: rotate(360deg); } }
.loadmore { text-align: center; padding: 6px 0 16px; color: var(--muted); font-size: 12.5px; }

/* ---------- 底部标签栏 ---------- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 520px;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); border-top: 1px solid var(--line);
  display: flex; z-index: 70;
}
.tab { flex: 1 1 0; display: grid; place-items: center; gap: 2px; color: var(--muted); font-size: 10.5px; position: relative; }
.tab svg { width: 21px; height: 21px; }
.tab.on { color: var(--brand-deep); font-weight: 600; }
.tab .dot {
  position: absolute; top: 6px; left: 50%; margin-left: 6px; min-width: 15px; height: 15px; padding: 0 4px;
  border-radius: 999px; background: var(--brand); color: #fff; font-size: 10px; line-height: 15px; text-align: center;
}

/* ---------- 页头（内页） ---------- */
.nav {
  position: sticky; top: 0; z-index: 60; height: 48px; display: flex; align-items: center;
  gap: 8px; padding: 0 10px; background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--line);
}
.nav .back { width: 32px; height: 32px; display: grid; place-items: center; border: 0; background: none; cursor: pointer; }
.nav h1 { margin: 0; font-size: 16px; font-weight: 600; flex: 1 1 auto; }
.nav .act { font-size: 13.5px; color: var(--ink-2); background: none; border: 0; cursor: pointer; padding: 6px 8px; }

/* ---------- 卡片块 ---------- */
.block { background: #fff; border-radius: var(--radius); margin: 12px; padding: 14px; box-shadow: var(--shadow); }
.block-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.block-h h2 { margin: 0; font-size: 15px; font-weight: 700; }
.sec-t { font-size: 13px; color: var(--muted); padding: 4px 14px 0; }

/* ---------- 表单 ---------- */
.field { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: 0; }
.field label { flex: 0 0 62px; color: var(--ink-2); font-size: 13.5px; }
.field input, .field textarea {
  flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 15px; resize: none;
}
.field textarea { height: 54px; line-height: 1.5; }
.err { color: #d92b2b; font-size: 12.5px; min-height: 18px; padding: 2px 2px 0; }

/* ---------- 底部操作条 ---------- */
.actionbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 520px;
  background: #fff; border-top: 1px solid var(--line); padding: 9px 12px calc(9px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 10px; z-index: 71;
}
.actionbar.with-tab { bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); }
.btn {
  border: 0; border-radius: 999px; padding: 0 20px; height: 42px; font-size: 15px; font-weight: 600;
  cursor: pointer; background: #f1f1f4; color: var(--ink);
}
.btn.ghost { background: #fff; border: 1px solid var(--brand); color: var(--brand-deep); }
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand-deep)); color: #fff; flex: 1 1 auto; }
.btn[disabled] { opacity: .55; cursor: default; }
.total { margin-left: auto; text-align: right; }
.total span { font-size: 12px; color: var(--ink-2); }
.total b { color: var(--price); font-size: 21px; font-weight: 800; }

/* ---------- 步进器 ---------- */
.step { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.step button { width: 28px; height: 26px; border: 0; background: #fafafb; color: var(--ink-2); font-size: 16px; cursor: pointer; }
.step span { min-width: 34px; text-align: center; font-size: 13.5px; }

/* ---------- 购物车行 ---------- */
.crow { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.crow:last-child { border-bottom: 0; }
.crow .cpic { flex: 0 0 82px; width: 82px; height: 82px; border-radius: 10px; overflow: hidden; background: #f6f6f8; }
.crow .cinfo { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.crow .ct { font-size: 13.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.crow .cb { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.invalid { opacity: .5; }

/* ---------- 订单 ---------- */
.ohead { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--ink-2); padding-bottom: 9px; border-bottom: 1px solid var(--line); margin-bottom: 9px; }
.ohead b { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 600; color: var(--ink); }
.oitem { display: flex; gap: 10px; padding: 8px 0; }
.oitem .cpic { flex: 0 0 60px; width: 60px; height: 60px; border-radius: 8px; overflow: hidden; }
.ostat { font-size: 12.5px; font-weight: 600; color: var(--brand-deep); }
.osum { display: flex; justify-content: flex-end; gap: 4px; padding-top: 9px; margin-top: 4px; border-top: 1px solid var(--line); font-size: 13px; }
.osum b { color: var(--price); font-size: 16px; }

/* ---------- 轻提示 ---------- */
#toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 99;
  background: rgba(20, 20, 24, .86); color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 13.5px; max-width: 76vw; text-align: center; opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
#toast.on { opacity: 1; }

/* ---------- 弹层（底部拉起） ---------- */
.mask { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 90; opacity: 0; pointer-events: none; transition: opacity .22s; }
.mask.on { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translate(-50%, 100%); width: 100%; max-width: 520px;
  background: #fff; border-radius: 18px 18px 0 0; z-index: 91; padding: 16px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  transition: transform .28s cubic-bezier(.3, .8, .3, 1); max-height: 78vh; overflow: auto;
}
.sheet.on { transform: translate(-50%, 0); }
.sheet-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-h h3 { margin: 0; font-size: 16px; }
