/* ================= 管理后台样式 ================= */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #eef1f6; color: #1b2632; font-size: 14.5px;
}

.hidden { display: none !important; }

/* ---- 登录 / 拒绝 ---- */
#gate, #deny {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.gate-card {
  width: 100%; max-width: 380px; background: #fff; border-radius: 20px;
  padding: 34px 26px 30px; text-align: center;
  box-shadow: 0 20px 60px -30px rgba(16, 24, 40, 0.35);
}
.gate-logo {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px;
  background: linear-gradient(135deg, #ff8a4d, #e03b0a);
  color: #fff; font-size: 30px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
}
.gate-logo.deny { background: #fceceb; font-size: 34px; }
.gate-card h1 { font-size: 19px; font-weight: 900; letter-spacing: 1px; }
.gate-sub { margin-top: 8px; font-size: 12.5px; color: #8a919d; line-height: 1.8; }
.auth-msg { min-height: 20px; margin-top: 10px; font-size: 12.5px; color: #e0552a; font-weight: 700; }
.auth-msg.ok { color: #16a34a; }
.frow { display: flex; gap: 8px; margin-top: 8px; }
.frow input { flex: 1; min-width: 0; }
#gateForm input {
  width: 100%; height: 46px; margin-top: 10px; padding: 0 14px;
  border: 1.5px solid #dfe5ee; border-radius: 12px; font-size: 15px; outline: none;
  background: #f8fafc;
}
#gateForm input:focus { border-color: #ff6a2b; background: #fff; }
#gateForm button {
  height: 46px; border: 0; border-radius: 12px; cursor: pointer;
  font-size: 15px; font-weight: 800;
}
#gSend {
  margin-top: 10px; flex: none; width: 128px;
  background: #fff3ed; color: #e03b0a;
}
#gSend:disabled { opacity: 0.55; }
#gLogin { width: 100%; margin-top: 16px; background: linear-gradient(135deg, #ff8a4d, #ff5112); color: #fff; box-shadow: 0 8px 18px -8px rgba(255, 81, 18, 0.55); }
#denyOut, #adLogout {
  height: 40px; padding: 0 16px; border: 0; border-radius: 10px; cursor: pointer;
  background: #f1f4f8; color: #5b6a7b; font-size: 13.5px; font-weight: 700;
}
#denyOut { margin-top: 18px; width: 100%; }

/* ---- 顶栏 ---- */
#adLogout { background: rgba(255, 255, 255, 0.16); color: #fff; }
.ad-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
  background: linear-gradient(135deg, #2a3547, #1b2632); color: #fff;
}
.ad-title { display: flex; align-items: center; gap: 10px; }
.ad-mark {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, #ff8a4d, #e03b0a);
  font-size: 20px; font-weight: 900; display: flex; align-items: center; justify-content: center;
}
.ad-title b { display: block; font-size: 16.5px; font-weight: 900; letter-spacing: 1px; }
.ad-title i { display: block; font-style: normal; font-size: 11px; color: rgba(255, 255, 255, 0.65); margin-top: 2px; }

/* ---- Tabs ---- */
.ad-tabs {
  position: sticky; top: calc(64px + env(safe-area-inset-top, 0px)); z-index: 19;
  display: flex; gap: 6px; padding: 10px 12px;
  background: #eef1f6; overflow-x: auto; white-space: nowrap;
}
.ad-tabs button {
  position: relative; flex: none; height: 36px; padding: 0 15px;
  border: 0; border-radius: 999px; cursor: pointer;
  background: #fff; color: #5b6a7b; font-size: 13.5px; font-weight: 700;
}
.ad-tabs button.on { background: linear-gradient(135deg, #ff8a4d, #ff5112); color: #fff; }
.ad-tabs em {
  position: absolute; top: -5px; right: -3px; min-width: 18px; height: 18px;
  border-radius: 9px; background: #f43f5e; color: #fff;
  font-size: 10px; font-style: normal; font-weight: 900; line-height: 18px; padding: 0 4px;
}

.ad-main { max-width: 640px; margin: 0 auto; padding: 4px 12px calc(40px + env(safe-area-inset-bottom, 0px)); }
.tab { display: none; }
.tab.on { display: block; }

.sec-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 14px 4px 8px;
}
.sec-head b { font-size: 15px; font-weight: 900; }
.sec-head span { font-size: 11.5px; color: #98a1ae; }

.card, .card-list > * { background: #fff; }
.card { border-radius: 14px; padding: 14px; box-shadow: 0 6px 18px -14px rgba(16, 24, 40, 0.3); }
.card-list { display: flex; flex-direction: column; gap: 10px; }
.empty { padding: 36px 20px; text-align: center; color: #8a919d; font-size: 13.5px; border-radius: 14px; background: #fff; }

/* ---- 付款确认 ---- */
.ao-row {
  display: flex; align-items: center; gap: 10px;
  border-radius: 14px; padding: 12px 14px;
}
.ao-info { flex: 1; min-width: 0; }
.ao-info b { font-size: 14.5px; font-weight: 800; display: block; }
.ao-info span { font-size: 11.5px; color: #98a1ae; display: block; margin-top: 3px; }
.ao-feat {
  flex: none; font-size: 11px; font-weight: 800; color: #cf3c0a;
  background: #fff3ed; border: 1px solid #ffd9c9; border-radius: 6px; padding: 2px 7px;
}
.ao-acts { display: flex; gap: 8px; flex: none; }
.ao-acts button {
  height: 34px; padding: 0 14px; border: 0; border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 800;
}
.ao-ok { background: linear-gradient(135deg, #34d399, #10b981); color: #fff; }
.ao-no { background: #f1f4f8; color: #5b6a7b; }

/* ---- 卡密 ---- */
.gen-row { display: flex; align-items: center; gap: 10px; }
.gen-row input {
  width: 96px; height: 44px; text-align: center; font-size: 18px; font-weight: 900;
  border: 1.5px solid #dfe5ee; border-radius: 12px; outline: none; background: #f8fafc;
}
.gen-unit { font-size: 14px; font-weight: 800; color: #5b6a7b; }
.gen-row button {
  flex: 1; height: 44px; border: 0; border-radius: 12px; cursor: pointer;
  background: linear-gradient(135deg, #ff8a4d, #ff5112); color: #fff; font-size: 15px; font-weight: 900;
}
.code-new {
  margin-top: 12px; padding: 12px; border-radius: 12px;
  background: #f0fdf4; border: 1px dashed #86efac; text-align: center;
}
.code-new b { font-size: 22px; font-weight: 900; letter-spacing: 3px; color: #16a34a; cursor: pointer; }
.code-new span { display: block; margin-top: 6px; font-size: 11.5px; color: #7c8794; }
.adc-row {
  display: flex; align-items: center; gap: 8px;
  border-radius: 12px; padding: 11px 14px;
}
.adc-row b { font-size: 15px; font-weight: 900; letter-spacing: 1.5px; cursor: pointer; }
.adc-days { flex: 1; font-size: 11.5px; color: #98a1ae; }
.adc-used { font-size: 11.5px; color: #f43f5e; font-weight: 700; }
.adc-ok { font-size: 11.5px; color: #16a34a; font-weight: 700; }

/* ---- 海报 ---- */
.upload-btn {
  display: block; height: 46px; border-radius: 12px; cursor: pointer;
  background: linear-gradient(135deg, #ff8a4d, #ff5112); color: #fff;
  font-size: 15px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 18px -8px rgba(255, 81, 18, 0.55);
}
.poster-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.pg-card { position: relative; border-radius: 12px; background: #fff; padding: 8px; }
.pg-card img { width: 100%; border-radius: 8px; display: block; }
.pg-title {
  margin-top: 6px; font-size: 11.5px; font-weight: 700; color: #43506a;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pg-del {
  position: absolute; top: 12px; right: 12px; width: 26px; height: 26px;
  border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 13px;
}

/* ---- 客户管理 ---- */
.user-sum { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 12px 0; }
.user-sum > div { background: #fff; border-radius: 12px; padding: 12px 2px; text-align: center; }
.user-sum b { display: block; font-size: 16px; font-weight: 900; }
.user-sum span { display: block; margin-top: 3px; font-size: 10px; color: #98a1ae; }
.user-sum b.on-sum { color: #16a34a; }
/* 客户在线状态 */
.online-box { margin: 0 0 12px; padding: 12px 14px; }
.ob-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ob-head b { font-size: 14px; font-weight: 900; color: #1d2733; }
.ob-head span { font-size: 11px; color: #98a1ae; white-space: nowrap; }
.ob-empty { margin-top: 8px; font-size: 12.5px; color: #98a1ae; line-height: 1.6; }
.ob-tip { margin-top: 9px; font-size: 10.5px; color: #a6b2be; line-height: 1.6; }
.ob-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.ob-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px; border-radius: 10px;
  background: #eefaf2; border: 1px solid #c6ecd5; font-size: 11.5px; color: #16794a;
}
.ob-chip i { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; flex: none; }
.ob-chip b { font-weight: 800; }
.ob-chip em { font-style: normal; color: #6b9c81; font-size: 10px; }
.ob-chip > span { color: #4f8a69; font-size: 10.5px; }
.ob-more { align-self: center; font-size: 11.5px; color: #98a1ae; font-weight: 700; }
.ua-live { font-size: 10.5px; font-weight: 800; white-space: nowrap; }
.ua-live.on { color: #16a34a; }
.ua-live.off { color: #9aa7b4; font-weight: 600; }
.ua-top .ua-live { margin-left: 4px; }
.pos { color: #dc2626; }
.neg { color: #16a34a; }
.search-row { margin-bottom: 10px; }
.search-row input {
  width: 100%; height: 42px; padding: 0 14px; border: 1.5px solid #dfe5ee;
  border-radius: 12px; font-size: 14px; outline: none; background: #fff;
}
.ubx-head { display: flex; align-items: baseline; gap: 8px; }
.ubx-head b { font-size: 14px; font-weight: 900; }
.ubx-head span { font-size: 11.5px; color: #98a1ae; }
.ubx-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ubx-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 10px;
  border-radius: 999px; background: #fff3ed; color: #cf3c0a; font-size: 12.5px; font-weight: 700;
  border: 1px solid #ffd9c9;
}
.ubx-chip button { border: 0; background: none; color: #cf3c0a; font-weight: 900; cursor: pointer; font-size: 12px; }
.ubx-empty { margin-top: 8px; font-size: 12.5px; color: #98a1ae; }
.ubx-add { display: flex; gap: 8px; margin-top: 10px; }
.ubx-add input {
  flex: 1; min-width: 0; height: 38px; padding: 0 12px;
  border: 1.5px solid #dfe5ee; border-radius: 10px; font-size: 14px; outline: none;
}
.ubx-add button {
  flex: none; width: 74px; height: 38px; border: 0; border-radius: 10px; cursor: pointer;
  background: #fee2e2; color: #dc2626; font-weight: 900; font-size: 13.5px;
}
.ua-row { display: flex; align-items: center; gap: 10px; border-radius: 12px; padding: 11px 14px; }
.ua-av {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, #ff8a4d, #ff5112); color: #fff;
  font-size: 16px; font-weight: 900; display: flex; align-items: center; justify-content: center;
}
.ua-main { flex: 1; min-width: 0; }
.ua-top b { font-size: 14px; font-weight: 800; }
.ua-top .blk { color: #f43f5e; font-size: 10.5px; background: #ffe4e6; border-radius: 5px; padding: 1px 5px; margin-left: 6px; }
.ua-sub { margin-top: 3px; font-size: 11px; color: #98a1ae; }
.acts-row { display: flex; gap: 6px; flex: none; }
.acts-row button {
  height: 30px; padding: 0 10px; border: 0; border-radius: 8px; cursor: pointer;
  background: #f1f4f8; color: #43506a; font-size: 11.5px; font-weight: 700;
}
.acts-row button.danger { background: #fee2e2; color: #dc2626; }

/* ---- 店铺设置 ---- */
.shop-form label { display: block; margin-top: 12px; font-size: 12.5px; font-weight: 700; color: #5b6a7b; }
.shop-form input, .shop-form textarea, .card select {
  width: 100%; margin-top: 6px; padding: 10px 12px;
  border: 1.5px solid #dfe5ee; border-radius: 10px; font-size: 14px; outline: none;
  background: #f8fafc; font-family: inherit;
}
.shop-form input:focus, .shop-form textarea:focus { border-color: #ff6a2b; background: #fff; }
.card select { height: 44px; }
.qr-row { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.qr-row img { width: 96px; height: 96px; object-fit: cover; border-radius: 12px; border: 1.5px solid #dfe5ee; }
.qr-acts { display: flex; flex-direction: column; gap: 8px; }
.mini-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 36px; padding: 0 14px; border-radius: 10px; cursor: pointer;
  background: #fff3ed; color: #e03b0a; font-size: 13px; font-weight: 800; border: 0;
}
.mini-btn.ghost { background: #f1f4f8; color: #5b6a7b; }
#shopSave {
  width: 100%; height: 46px; margin-top: 16px; border: 0; border-radius: 12px; cursor: pointer;
  background: linear-gradient(135deg, #ff8a4d, #ff5112); color: #fff; font-size: 15px; font-weight: 900;
}

/* ---- Toast ---- */
#toastWrap { position: fixed; left: 0; right: 0; bottom: calc(60px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 999; pointer-events: none; }
.toast {
  max-width: 82%; padding: 10px 18px; border-radius: 999px;
  background: rgba(20, 28, 40, 0.92); color: #fff; font-size: 13px; font-weight: 600;
  box-shadow: 0 8px 24px -10px rgba(0, 0, 0, 0.4);
}
.toast.ok { background: rgba(16, 122, 60, 0.94); }
.toast.err { background: rgba(200, 40, 30, 0.94); }

/* ---------- 参考站同步 ---------- */
.ref-tip { font-size: 12.5px; color: #9fb0c3; line-height: 1.7; margin: 0 0 10px; }
.ref-tip.small { margin: 10px 0 0; font-size: 11.5px; color: #7488a0; }
.ref-status { font-size: 13px; background: rgba(255,255,255,.04); border: 1px dashed rgba(255,255,255,.14); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.ref-status b.ok { color: #4cd48b; }
.ref-status b.err { color: #ff7a6e; }
#tab-ref label { display: block; font-size: 12.5px; color: #9fb0c3; margin-bottom: 10px; }
#tab-ref input {
  display: block; width: 100%; box-sizing: border-box; margin-top: 6px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.16);
  border-radius: 10px; color: #eef4fb; font-size: 15px; padding: 10px 12px;
}
.ref-code-row { display: flex; gap: 8px; align-items: stretch; }
.ref-code-row input { margin-top: 0; flex: 1; }
.ref-code-row .mini-btn { flex-shrink: 0; }
#refBind {
  width: 100%; border: none; border-radius: 12px; padding: 12px;
  background: linear-gradient(135deg, #2f6bff, #1d49d8); color: #fff;
  font-size: 15px; font-weight: 700; margin-top: 4px;
}

/* ---------- 顾客聊天开关 ---------- */
.chat-switch {
  display: flex; align-items: center; gap: 14px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px; padding: 12px 14px; margin: 4px 0 14px;
}
.chat-switch .cs-main { flex: 1; min-width: 0; }
.chat-switch .cs-main b { display: block; font-size: 14px; color: #eef4fb; }
.chat-switch .cs-main p { margin: 4px 0 0; font-size: 11.5px; line-height: 1.6; color: #8fa2b8; }
.cs-sw { position: relative; flex: none; width: 50px; height: 28px; }
.cs-sw input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.cs-sw i {
  position: absolute; inset: 0; border-radius: 20px; background: rgba(255,255,255,.16);
  transition: background .2s;
}
.cs-sw i::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; transition: transform .2s;
}
.cs-sw input:checked + i { background: linear-gradient(135deg, #2fbb6b, #149a52); }
.cs-sw input:checked + i::after { transform: translateX(22px); }

/* ================= 移动端视口锁定：禁止放大缩小，保留上下滑动 ================= */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: pan-x pan-y;
}
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}
body { touch-action: pan-x pan-y; -webkit-tap-highlight-color: transparent; position: relative; }
img, video, canvas, svg { max-width: 100%; }
@media (max-width: 820px) {
  input:not([type="range"]):not([type="checkbox"]):not([type="radio"]),
  textarea, select { font-size: 16px !important; }
}
