/* 佛悦 · 流通处 —— 与主站同一「写经格局」语汇：宣纸底、墨字、赭红点睛、泥金结构线 */

:root {
  --serif: "Noto Serif SC", "Songti SC", "STSongti-SC-Regular", "STSong", serif;
  --bg: #f3ecda; --bg-deep: #eae0c5;
  --ink: #33291b; --ink-2: #6f6047; --ink-3: #a08b6b;
  --card: rgba(255, 252, 243, 0.72);
  --line: rgba(86, 68, 42, 0.16);
  --accent: #b0624a;                          /* 赭红：唯一点睛色 */
  --accent-soft: rgba(176, 98, 74, 0.4);
  --accent-wash: rgba(176, 98, 74, 0.07);
  --gold-line: rgba(166, 130, 60, 0.4);       /* 泥金描线 */
  --gold-text: #8f6f2e;
}

* { box-sizing: border-box; margin: 0; padding: 0; touch-action: manipulation; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--serif); background: var(--bg); color: var(--ink);
  min-height: 100dvh; display: flex; flex-direction: column;
  line-height: 1.75; font-size: 16px;
}
button, input, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

/* ===== 顶栏 ===== */
.top {
  display: flex; align-items: center; gap: 14px;
  padding: 12px clamp(14px, 4vw, 28px);
  border-bottom: 1px solid var(--gold-line);
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 38px; height: 38px; object-fit: contain; flex: none; }
.brand-text b { font-size: 1.02rem; letter-spacing: 0.1em; display: block; line-height: 1.3; }
.brand-text small { font-size: 0.68rem; color: var(--ink-3); letter-spacing: 0.08em; }
.tabs { display: flex; gap: 4px; margin-left: auto; }
.tabs a {
  padding: 6px 12px; border-radius: 999px; font-size: 0.88rem;
  color: var(--ink-2); letter-spacing: 0.06em; white-space: nowrap;
}
.tabs a.on { color: var(--accent); background: var(--accent-wash); }
.cart-btn { position: relative; width: 38px; height: 38px; display: grid; place-items: center; color: var(--ink-2); }
.cart-btn svg { width: 22px; height: 22px; }
.cart-btn i, #csBtn i {
  position: absolute; top: 0; right: 0; min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--accent); color: #fff8ec; border-radius: 999px;
  font-size: 0.62rem; font-style: normal; display: grid; place-items: center; line-height: 1;
}

/* ===== 公告 ===== */
.notice {
  margin: 12px clamp(14px, 4vw, 28px) 0; padding: 8px 14px;
  border: 1px solid var(--gold-line); border-radius: 10px;
  color: var(--gold-text); font-size: 0.85rem; background: var(--card);
}

/* ===== 主体 ===== */
.wrap { width: 100%; max-width: 980px; margin: 0 auto; padding: 18px clamp(14px, 4vw, 28px) 60px; flex: 1; }
.sec-title { font-size: 0.85rem; color: var(--ink-2); letter-spacing: 0.14em; margin: 6px 0 14px; }
.sec-title::before { content: ""; display: inline-block; width: 8px; height: 8px; background: var(--accent); border-radius: 2px; margin-right: 8px; vertical-align: 1px; }

/* 商品网格 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 14px; }
.pcard {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; display: flex; flex-direction: column; transition: border-color 0.2s;
}
.pcard:hover { border-color: var(--accent-soft); }
.pimg { aspect-ratio: 1; background: var(--bg-deep); display: grid; place-items: center; overflow: hidden; }
.pimg img { width: 100%; height: 100%; object-fit: cover; }
.pimg svg { width: 44%; height: 44%; color: var(--ink-3); opacity: 0.55; }
.pbody { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.pname { font-size: 0.92rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pbrief { font-size: 0.76rem; color: var(--ink-3); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.prow { margin-top: auto; display: flex; align-items: baseline; justify-content: space-between; padding-top: 6px; }
.price { color: var(--accent); font-size: 1rem; font-variant-numeric: tabular-nums; }
.price small { font-size: 0.7rem; }
.price.free { font-size: 0.85rem; letter-spacing: 0.06em; }
.pcat { font-size: 0.7rem; color: var(--ink-3); }

/* 通用卡片 / 按钮 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 14px; }
.btn {
  cursor: pointer; letter-spacing: 0.08em; font-size: 0.9rem;
  color: var(--accent); background: var(--accent-wash);
  border: 1px solid var(--accent-soft); border-radius: 999px; padding: 9px 24px;
}
.btn:hover { background: rgba(176, 98, 74, 0.14); }
.btn.solid { background: var(--accent); color: #fff8ec; border-color: var(--accent); }
.btn.plain, button.plain { cursor: pointer; color: var(--ink-2); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 9px 20px; font-size: 0.88rem; }
.btn.sm { padding: 5px 14px; font-size: 0.8rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

input.field, textarea.field {
  width: 100%; background: #fffcf3; border: 1px solid rgba(86, 68, 42, 0.2);
  border-radius: 10px; padding: 10px 14px; font-size: 0.94rem;
}
input.field:focus, textarea.field:focus { outline: none; border-color: var(--accent-soft); }
textarea.field { min-height: 76px; resize: vertical; line-height: 1.7; }
label.f { display: block; font-size: 0.8rem; color: var(--ink-2); letter-spacing: 0.08em; margin: 12px 0 6px; }

/* 详情页 */
.detail { display: grid; grid-template-columns: minmax(220px, 380px) 1fr; gap: 22px; }
.detail .pimg { border-radius: 14px; border: 1px solid var(--line); }
.detail h1 { font-size: 1.2rem; line-height: 1.6; letter-spacing: 0.04em; }
.detail .price { font-size: 1.3rem; margin: 8px 0 2px; display: block; }
.stock-line { font-size: 0.78rem; color: var(--ink-3); margin-bottom: 12px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.qty button { width: 36px; height: 34px; background: transparent; border: 0; cursor: pointer; color: var(--ink-2); font-size: 1rem; }
.qty b { min-width: 40px; text-align: center; font-size: 0.95rem; font-weight: 400; font-variant-numeric: tabular-nums; }
.detail-text { margin-top: 20px; border-top: 1px solid var(--gold-line); padding-top: 14px; }
.detail-text p { margin-bottom: 0.7em; color: var(--ink); font-size: 0.94rem; }
.actrow { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; align-items: center; }

/* 请购单 / 表格行 */
.cart-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-item:last-child { border-bottom: 0; }
.cart-item .pimg { width: 58px; height: 58px; border-radius: 10px; flex: none; }
.cart-item .nm { flex: 1; min-width: 0; font-size: 0.9rem; line-height: 1.5; }
.cart-item .nm small { display: block; color: var(--accent); }
.cart-item .del { cursor: pointer; border: 0; background: none; color: var(--ink-3); font-size: 0.85rem; padding: 6px; }
.total-row { display: flex; justify-content: space-between; align-items: baseline; padding-top: 14px; }
.total-row b { color: var(--accent); font-size: 1.2rem; font-weight: 400; }

/* 付款页 */
.payqr { width: min(240px, 70vw); margin: 12px auto; border: 1px solid var(--gold-line); border-radius: 12px; background: #fff; padding: 10px; }
.ono-line { text-align: center; font-size: 1.05rem; letter-spacing: 0.08em; }
.ono-line b { color: var(--accent); font-weight: 400; user-select: all; }
.center { text-align: center; }
.hint { font-size: 0.82rem; color: var(--ink-2); line-height: 1.9; }
.gold { color: var(--gold-text); letter-spacing: 0.2em; }

/* 订单进度 */
.steps { display: flex; flex-direction: column; gap: 0; margin-top: 10px; }
.step { display: flex; gap: 12px; }
.step .dot { width: 10px; height: 10px; border-radius: 999px; background: var(--line); margin-top: 7px; flex: none; }
.step.onn .dot { background: var(--accent); }
.step .bar { width: 2px; flex: 1; background: var(--line); margin: 2px auto 0; min-height: 14px; }
.step-col { display: flex; flex-direction: column; align-items: center; }
.step-txt { padding-bottom: 14px; font-size: 0.9rem; color: var(--ink-3); }
.step.onn .step-txt { color: var(--ink); }

/* 公众号页 */
.gzh-qr { width: min(230px, 66vw); margin: 14px auto; border: 1px solid var(--gold-line); border-radius: 12px; background: #fff; padding: 10px; }

/* ===== 页脚 ===== */
.foot {
  border-top: 1px solid var(--gold-line); padding: 22px 16px 30px;
  text-align: center; display: flex; flex-direction: column; gap: 6px;
}
.foot small { color: var(--ink-3); font-size: 0.72rem; letter-spacing: 0.06em; }

/* ===== 客服 ===== */
#csBtn {
  position: fixed; right: 16px; bottom: 22px; z-index: 30;
  width: 48px; height: 48px; border-radius: 999px; cursor: pointer;
  background: var(--card); border: 1px solid var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; box-shadow: 0 4px 14px rgba(60, 44, 20, 0.12);
}
#csBtn svg { width: 24px; height: 24px; }
#csMask { position: fixed; inset: 0; background: rgba(30, 22, 10, 0.32); z-index: 40; }
#csPanel {
  position: fixed; z-index: 41; display: flex; flex-direction: column;
  right: 16px; bottom: 16px; width: min(380px, calc(100vw - 32px)); height: min(520px, 76dvh);
  background: var(--bg); border: 1px solid var(--gold-line); border-radius: 16px; overflow: hidden;
}
@media (max-width: 560px) {
  #csPanel { right: 0; bottom: 0; width: 100vw; height: 72dvh; border-radius: 16px 16px 0 0; border-bottom: 0; }
}
#csPanel header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
#csPanel header b { letter-spacing: 0.12em; font-size: 0.95rem; font-weight: 400; }
#csPanel header .plain { border: 0; padding: 4px 8px; cursor: pointer; background: none; color: var(--ink-3); }
.cs-hint { padding: 10px 16px 0; font-size: 0.76rem; color: var(--ink-3); line-height: 1.7; }
#csList { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 82%; padding: 8px 13px; border-radius: 13px; font-size: 0.9rem; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.msg.me { align-self: flex-end; background: var(--accent-wash); border: 1px solid var(--accent-soft); border-bottom-right-radius: 4px; }
.msg.ta { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg time { display: block; font-size: 0.64rem; color: var(--ink-3); margin-top: 3px; }
.cs-inputrow { display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.cs-inputrow input { flex: 1; background: #fffcf3; border: 1px solid rgba(86, 68, 42, 0.2); border-radius: 999px; padding: 9px 16px; font-size: 16px; }
.cs-inputrow input:focus { outline: none; border-color: var(--accent-soft); }
.cs-inputrow button {
  cursor: pointer; color: #fff8ec; background: var(--accent); border: 0;
  border-radius: 999px; padding: 0 20px; font-size: 0.88rem; letter-spacing: 0.1em;
}

/* 首页工具行：搜索 + 分类胶囊 */
.toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.search-box { position: relative; max-width: 420px; }
.search-box input {
  width: 100%; background: #fffcf3; border: 1px solid rgba(86, 68, 42, 0.2);
  border-radius: 999px; padding: 9px 16px 9px 38px; font-size: 0.92rem;
}
.search-box input:focus { outline: none; border-color: var(--accent-soft); }
.search-box svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-3); }
.catbar { display: flex; gap: 6px; flex-wrap: wrap; }
.catbar button {
  cursor: pointer; font-size: 0.8rem; letter-spacing: 0.04em; color: var(--ink-2);
  background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 4px 14px;
}
.catbar button.on { color: var(--accent); border-color: var(--accent-soft); background: var(--accent-wash); }

/* 详情图集 */
.thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.thumbs button {
  width: 56px; height: 56px; padding: 0; cursor: pointer; overflow: hidden;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg-deep);
}
.thumbs button.on { border-color: var(--accent); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }

/* 付款方式切换 */
.paytabs { display: flex; gap: 8px; justify-content: center; margin: 14px 0 4px; flex-wrap: wrap; }
.paytabs button {
  cursor: pointer; font-size: 0.84rem; letter-spacing: 0.06em; color: var(--ink-2);
  background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 6px 18px;
}
.paytabs button.on { color: var(--accent); border-color: var(--accent-soft); background: var(--accent-wash); }
.paypanel { margin-top: 4px; }

/* 本机订单历史 */
.ohist { margin-top: 18px; border-top: 1px solid var(--gold-line); padding-top: 10px; }
.ohist h3 { font-size: 0.8rem; color: var(--ink-2); font-weight: 400; letter-spacing: 0.1em; margin-bottom: 6px; }
.ohist a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 0.85rem; cursor: pointer; }
.ohist a:last-child { border-bottom: 0; }
.ohist a small { color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* 空态 */
.empty { text-align: center; color: var(--ink-3); padding: 44px 0; font-size: 0.9rem; letter-spacing: 0.08em; }

@media (max-width: 640px) {
  .detail { grid-template-columns: 1fr; }
  .tabs a { padding: 6px 9px; font-size: 0.84rem; }
  .brand-text small { display: none; }
}
