:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --border: #e6e8ef;
  --text: #111827;
  --muted: #6b7280;
  --brand: #4f46e5;
  --brand-soft: #eef2ff;
  --dy: #0f1419;
  --xhs: #ff2e4d;
  --ok: #16a34a;
  --warn: #d97706;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button { font-family: inherit; cursor: pointer; }
a { color: var(--brand); }

.site-footer {
  margin-top: auto;
  padding: 18px 16px;
  text-align: center;
  font-size: 12px;
  line-height: 24px;
  color: var(--muted);
}
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer a:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; }

.shop-session-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.shop-session-card .card-title { margin-bottom: 8px; }
.shop-session-summary { margin: 0 0 6px; font-weight: 600; overflow-wrap: anywhere; }
.shop-session-help { margin: 0; color: var(--muted); font-size: 13px; }
.shop-session-actions { display: flex; flex-shrink: 0; gap: 10px; }
.shop-login-notice { margin: 14px 0 0; padding: 10px 12px; color: #3730a3; background: var(--brand-soft); border-radius: 8px; font-size: 13px; }
@media (max-width: 640px) {
  .shop-session-card { align-items: stretch; flex-direction: column; gap: 16px; }
  .shop-session-actions .btn { flex: 1; }
}

/* ---------- header ---------- */
.header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff; display: grid; place-items: center; font-size: 16px;
}
.logo small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); }
.env { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.chip {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: #f3f4f6; color: var(--muted); border: 1px solid var(--border);
  white-space: nowrap;
}
.chip.ok { background: #ecfdf5; color: var(--ok); border-color: #a7f3d0; }
.chip.warn { background: #fffbeb; color: var(--warn); border-color: #fde68a; }
.chip.info { background: var(--brand-soft); color: var(--brand); border-color: #c7d2fe; }

/* ---------- layout ---------- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 20px 24px 60px; }
.grid { display: grid; grid-template-columns: minmax(340px, 460px) 1fr; gap: 20px; align-items: start; }
@media (max-width: 940px) { .grid { grid-template-columns: 1fr; } }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
.card-title { font-weight: 600; font-size: 15px; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.step {
  width: 20px; height: 20px; border-radius: 6px; background: var(--brand-soft);
  color: var(--brand); font-size: 12px; display: grid; place-items: center; font-weight: 700;
}

/* ---------- 登录 / 注册 ---------- */
.auth-screen {
  min-height: calc(100vh - 60px); display: grid; place-items: center; padding: 24px;
  background: linear-gradient(135deg, #eef2ff 0%, #faf5ff 45%, #f6f7fb 100%);
}
.auth-box {
  width: 100%; max-width: 460px; background: #fff; border: 1px solid var(--border);
  border-radius: 18px; box-shadow: 0 12px 40px rgba(16, 24, 40, .1); padding: 26px;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.auth-brand .logo-mark { width: 42px; height: 42px; border-radius: 12px; font-size: 20px; }
.auth-brand h2 { margin: 0; font-size: 19px; }
.auth-brand p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.auth-tabs { display: flex; gap: 6px; background: #f3f4f6; padding: 4px; border-radius: 10px; margin-bottom: 16px; }
.auth-tabs button {
  flex: 1; border: none; background: transparent; padding: 8px; border-radius: 7px;
  font-size: 14px; color: var(--muted);
}
.auth-tabs button.on { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.auth-foot { margin-top: 14px; display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }

.test-banner {
  max-width: 1240px; margin: 12px auto 0; padding: 10px 16px; border-radius: 12px;
  background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: 13px;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.test-banner .btn { width: auto; }

.ac-cap { font-size: 11px; color: var(--muted); margin-bottom: 6px; line-height: 1.5; }

/* ---------- nav ---------- */
.nav { display: flex; gap: 6px; padding: 12px 24px 0; max-width: 1240px; margin: 0 auto; }
.nav-btn {
  border: 1px solid var(--border); background: #fff; border-radius: 10px 10px 0 0;
  padding: 9px 18px; font-size: 14px; color: var(--muted); border-bottom: none;
}
.nav-btn.on { color: var(--brand); font-weight: 600; background: #fff; box-shadow: inset 0 -2px 0 var(--brand); }
.tabpane { display: none; }
.tabpane.on { display: block; }

/* ---------- 商家工作台总览 ---------- */
.overview-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  overflow: hidden;
  position: relative;
  margin-bottom: 16px;
  padding: 26px 28px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 86% 12%, rgba(255, 255, 255, .20), transparent 24%),
    linear-gradient(135deg, #34235e, #4f46e5 62%, #6d5cf0);
  color: #fff;
  box-shadow: 0 12px 36px rgba(79, 70, 229, .20);
}
.overview-hero::after {
  content: "AI";
  position: absolute;
  right: 160px;
  bottom: -52px;
  color: rgba(255, 255, 255, .06);
  font-size: 150px;
  font-weight: 900;
  line-height: 1;
}
.overview-hero > * { position: relative; z-index: 1; }
.overview-hero h2 { margin: 4px 0 7px; font-size: 25px; }
.overview-hero p { margin: 0; color: rgba(255, 255, 255, .75); font-size: 13px; }
.overview-kicker { color: var(--brand); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.overview-hero .overview-kicker { color: #dcd8ff; }
.overview-primary { width: auto; flex: 0 0 auto; background: #fff; color: #34235e; padding: 11px 18px; }
.overview-primary:hover { filter: none; transform: translateY(-1px); }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, .8fr); gap: 16px; }
.overview-grid.lower { grid-template-columns: minmax(0, 1fr) minmax(320px, 1fr); }
.overview-title-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 15px; }
.overview-title-row h3 { margin: 2px 0 0; font-size: 16px; }
.overview-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.overview-metric { padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: #fafbff; }
.overview-metric b { display: block; color: var(--text); font-size: 25px; line-height: 1.2; }
.overview-metric span { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.overview-metric.accent { border-color: #c7d2fe; background: var(--brand-soft); }
.overview-metric.accent b { color: var(--brand); }
.overview-loading { grid-column: 1 / -1; padding: 24px; color: var(--muted); font-size: 12px; text-align: center; }
.funnel-line { display: flex; align-items: center; gap: 5px; margin-top: 14px; }
.funnel-step { flex: 1; min-width: 0; }
.funnel-step .funnel-bar { height: 7px; overflow: hidden; border-radius: 999px; background: #eef0f5; }
.funnel-step .funnel-bar i { display: block; height: 100%; min-width: 4px; border-radius: inherit; background: linear-gradient(90deg, #818cf8, #4f46e5); }
.funnel-step small { display: block; overflow: hidden; margin-top: 5px; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.funnel-arrow { color: #c3c8d2; font-size: 12px; }
.overview-footnote { margin: 11px 0 0; color: var(--muted); font-size: 10px; }
.readiness-score { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 13px; font-weight: 800; }
.readiness-list { display: grid; gap: 8px; }
.readiness-item { display: flex; align-items: center; gap: 10px; padding: 10px 11px; border-radius: 10px; background: #f8f9fb; }
.readiness-item > span { width: 22px; height: 22px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: #eceff4; color: #9ca3af; font-size: 11px; font-weight: 800; }
.readiness-item.done > span { background: #dcfce7; color: var(--ok); }
.readiness-item div { min-width: 0; flex: 1; }
.readiness-item b { display: block; font-size: 12px; }
.readiness-item small { display: block; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.readiness-item button { border: none; background: transparent; color: var(--brand); font-size: 11px; cursor: pointer; }
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quick-card { display: grid; grid-template-columns: 30px 1fr; column-gap: 9px; padding: 13px; border: 1px solid var(--border); border-radius: 12px; background: #fff; color: var(--text); text-align: left; transition: .15s; }
.quick-card:hover { border-color: #c7d2fe; background: #fafaff; transform: translateY(-1px); }
.quick-card > span { grid-row: 1 / 3; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--brand-soft); color: var(--brand); font-size: 10px; font-weight: 800; }
.quick-card b { font-size: 12px; }
.quick-card small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.overview-campaign { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.overview-campaign:last-child { border-bottom: 0; }
.overview-campaign .campaign-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px #dcfce7; }
.overview-campaign.paused .campaign-dot { background: #f59e0b; box-shadow: 0 0 0 4px #fef3c7; }
.overview-campaign > div { min-width: 0; flex: 1; }
.overview-campaign b { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.overview-campaign small { color: var(--muted); font-size: 10px; }
.overview-campaign button { border: 1px solid var(--border); border-radius: 7px; background: #fff; color: var(--text); padding: 5px 8px; font-size: 10px; }

@media (max-width: 900px) {
  .nav { overflow-x: auto; }
  .nav-btn { flex: 0 0 auto; }
  .overview-grid, .overview-grid.lower { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .overview-hero { align-items: flex-start; flex-direction: column; padding: 21px; }
  .overview-hero h2 { font-size: 21px; }
  .overview-primary { width: 100%; }
  .overview-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-grid { grid-template-columns: 1fr; }
}

.row3 { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; }
@media (max-width: 720px) { .row3 { grid-template-columns: 1fr; } }
.cat-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.cat-pick .chip { cursor: pointer; }

/* ---------- 素材库 ---------- */
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.asset-card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; }
.asset-card.off { opacity: .45; }
.asset-card img { width: 100%; height: 110px; object-fit: cover; display: block; background: #f3f4f6; }
.ac-body { padding: 8px; }
.ac-cat { width: 100%; border: 1px solid var(--border); border-radius: 7px; padding: 4px 6px; font: inherit; font-size: 12px; background: #fff; }
.ac-meta { display: flex; align-items: center; gap: 6px; margin: 6px 0; }
.ac-name { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-ops { display: flex; gap: 6px; }
.ac-ops button {
  flex: 1; border: 1px solid var(--border); background: #fff; border-radius: 6px;
  padding: 4px; font-size: 12px; color: var(--muted);
}
.ac-ops button.danger { color: #dc2626; }

/* ---------- 推广任务卡片 ---------- */
.camp-card { display: flex; gap: 16px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px; }
.cc-qr { width: 120px; height: 120px; flex: 0 0 auto; border: 1px solid var(--border); border-radius: 10px; padding: 6px; background: #fff; }
.cc-qr img { width: 100%; height: 100%; display: block; }
.cc-main { flex: 1; min-width: 0; }
.cc-title { font-weight: 600; font-size: 15px; margin-bottom: 3px; }
.cc-sub { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.cc-stats { display: flex; gap: 14px; margin: 8px 0; font-size: 12px; color: var(--muted); }
.cc-stats b { font-size: 15px; color: var(--text); margin-left: 2px; }
.cc-ops { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.cc-url { font-size: 11px; color: var(--muted); background: #f3f4f6; padding: 4px 8px; border-radius: 6px; word-break: break-all; }

/* ---------- 统计 ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; box-shadow: var(--shadow); }
.sc-num { font-size: 26px; font-weight: 700; color: var(--brand); }
.sc-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bar-name { width: 90px; font-size: 13px; }
.bar-track { flex: 1; height: 10px; background: #f3f4f6; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, #6366f1, #a855f7); border-radius: 999px; }
.bar-val { width: 32px; text-align: right; font-size: 13px; color: var(--muted); }

.top-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.top-item { position: relative; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.top-item img { width: 100%; height: 72px; object-fit: cover; display: block; }
.ti-badge {
  position: absolute; top: 4px; right: 4px; background: rgba(79, 70, 229, .92); color: #fff;
  font-size: 11px; border-radius: 5px; padding: 1px 6px;
}
.ti-name { font-size: 11px; padding: 4px 6px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; background: #fafbfc; }

.trend-bars { display: flex; gap: 6px; align-items: flex-end; height: 130px; }
.tb { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.tb-bar { width: 100%; max-width: 34px; background: linear-gradient(180deg, #818cf8, #4f46e5); border-radius: 5px 5px 0 0; min-height: 3px; }
.tb-label { font-size: 10px; color: var(--muted); margin-top: 4px; }
.tb-val { font-size: 11px; }

.rec-row { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.rec-row img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(17, 24, 39, .5); display: none; place-items: center; z-index: 90; padding: 20px; }
.modal.on { display: grid; }
.modal-box { background: #fff; border-radius: 14px; padding: 18px; width: 100%; max-width: 560px; max-height: 80vh; overflow: auto; position: relative; }
.modal-close { position: absolute; top: 10px; right: 12px; border: none; background: none; font-size: 22px; color: var(--muted); }
.modal-box h3 { margin: 0 0 12px; font-size: 15px; }

.privacy-note { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.ai-consent-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 16px; background: #fafbff; }
.ai-consent-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ai-consent-head h4 { margin: 8px 0 0; font-size: 15px; }
.ai-consent-card p { margin: 10px 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.ai-consent-meta { color: var(--muted); font-size: 12px; }
.ai-consent-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.ai-consent-actions .btn { width: auto; }
.consent-doc { color: var(--text); line-height: 1.75; }
.consent-doc .consent-summary { padding: 10px 12px; border-radius: 10px; background: #fff7ed; color: #9a3412; font-size: 13px; }
.consent-doc ul { padding-left: 20px; color: var(--muted); font-size: 13px; }
.consent-check { display: flex; gap: 9px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--border); font-size: 13px; }
.consent-check input { margin-top: 4px; flex: 0 0 auto; }
.consent-version { color: var(--muted); font-size: 11px; margin-top: 10px; }

/* ---------- dropzone ---------- */
.drop {
  border: 1.5px dashed #cbd5e1; border-radius: 12px; padding: 26px 16px;
  text-align: center; color: var(--muted); cursor: pointer; transition: .15s; background: #fafbfc;
}
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.drop b { display: block; color: var(--text); font-size: 14px; margin-bottom: 4px; }
.drop span { font-size: 12px; }

.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.thumb { position: relative; width: 76px; height: 76px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button {
  position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%;
  border: none; background: rgba(0, 0, 0, .6); color: #fff; font-size: 12px; line-height: 1; padding: 0;
}

/* ---------- form ---------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px;
  font: inherit; background: #fff; color: var(--text); outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field textarea { resize: vertical; min-height: 62px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.platform-pick { display: flex; gap: 8px; }
.plat-btn {
  flex: 1; border: 1px solid var(--border); background: #fff; border-radius: 10px; padding: 9px;
  text-align: center; font-size: 13px; color: var(--muted); transition: .15s;
}
.plat-btn.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }

.btn {
  border: none; border-radius: 10px; padding: 10px 16px; font-size: 14px; font-weight: 600;
  background: var(--brand); color: #fff; width: 100%; transition: .15s;
}
.btn:hover { filter: brightness(1.05); }
.btn:disabled { background: #c7cbd4; cursor: not-allowed; filter: none; }
.btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--border); font-weight: 500; }
.btn.sm { padding: 6px 12px; font-size: 13px; width: auto; }

/* ---------- result ---------- */
.tabs { display: flex; gap: 6px; background: #f3f4f6; padding: 4px; border-radius: 10px; margin-bottom: 14px; }
.tab {
  flex: 1; border: none; background: transparent; padding: 7px; border-radius: 7px;
  font-size: 13px; color: var(--muted);
}
.tab.on { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

.res-block { margin-bottom: 12px; }
.res-block label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.res-block textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 9px; padding: 9px 10px;
  font: inherit; color: var(--text); resize: vertical; outline: none; background: #fff;
}
.res-block textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { background: var(--brand-soft); color: var(--brand); border-radius: 6px; padding: 3px 8px; font-size: 12px; }

.script-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.script-item:last-child { border-bottom: none; }
.script-time { color: var(--brand); font-weight: 600; min-width: 56px; }

/* ---------- qr ---------- */
.qr-card { text-align: center; }
.qr-box { width: 200px; height: 200px; margin: 4px auto 12px; padding: 10px; background: #fff; border: 1px solid var(--border); border-radius: 12px; }
.qr-box img { width: 100%; height: 100%; display: block; }
.share-url {
  font-size: 12px; color: var(--muted); background: #f3f4f6; padding: 7px 10px;
  border-radius: 8px; word-break: break-all; margin-bottom: 10px;
}
.qr-actions { display: flex; gap: 8px; }
.qr-actions .btn { font-size: 13px; padding: 8px; }

/* ---------- misc ---------- */
.empty { color: var(--muted); text-align: center; padding: 40px 10px; font-size: 13px; }
.hist-item {
  display: flex; gap: 10px; align-items: center; padding: 9px; border-radius: 10px; cursor: pointer;
}
.hist-item:hover { background: #f3f4f6; }
.hist-item img { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; }
.hist-item .h-name { font-size: 13px; font-weight: 500; }
.hist-item .h-time { font-size: 11px; color: var(--muted); }

.note { font-size: 12px; color: var(--warn); background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 9px 11px; margin-bottom: 12px; }
.section-desc { color: var(--muted); font-size: 13px; margin: -4px 0 16px; line-height: 1.7; }
.magic-hero {
  display: flex; justify-content: space-between; gap: 24px; align-items: center;
  border-radius: 20px; padding: 28px 30px; margin-bottom: 16px; color: #fff;
  background: linear-gradient(135deg, #312e81, #5b4cf0 62%, #8b5cf6);
  box-shadow: 0 16px 36px rgba(79, 70, 229, .2);
}
.magic-kicker { font-size: 12px; opacity: .8; font-weight: 700; letter-spacing: .08em; }
.magic-balance { display: flex; align-items: baseline; gap: 9px; margin: 8px 0 4px; }
.magic-balance strong { font-size: 46px; line-height: 1; }
.magic-balance span { font-size: 15px; opacity: .88; }
.magic-hero p { margin: 8px 0 0; font-size: 13px; opacity: .84; }
.recharge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.recharge-pack {
  position: relative; text-align: left; border: 1px solid var(--border); border-radius: 14px;
  padding: 16px; background: #fff; color: var(--text); cursor: pointer; transition: .16s;
}
.recharge-pack:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(79,70,229,.1); }
.recharge-pack strong { display: block; font-size: 24px; color: var(--brand); }
.recharge-pack span { display: block; margin-top: 5px; font-size: 12px; color: var(--muted); }
.recharge-pack em {
  position: absolute; top: 10px; right: 10px; padding: 3px 7px; border-radius: 999px;
  background: #fff1f2; color: #e11d48; font-style: normal; font-size: 10px; font-weight: 700;
}
.custom-recharge { display: grid; grid-template-columns: 1fr 190px; align-items: end; gap: 12px; margin-top: 14px; }
.billing-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.billing-table th, .billing-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.billing-table th { color: var(--muted); font-weight: 600; }
.billing-credit { color: #059669; font-weight: 700; }
.billing-debit { color: #dc2626; font-weight: 700; }
.order-status { display: inline-block; padding: 3px 7px; border-radius: 999px; background: #f3f4f6; color: var(--muted); }
.order-status.paid { background: #ecfdf5; color: #047857; }
.order-status.closed { background: #fff1f2; color: #be123c; }
.manual-pay { padding: 4px 4px 2px; }
.manual-pay > h3 { padding-right: 30px; font-size: 18px; }
.manual-pay-amount { display: flex; align-items: baseline; justify-content: space-between; padding: 13px 15px; margin-bottom: 12px; border-radius: 12px; background: #f8fafc; }
.manual-pay-amount span { color: var(--muted); font-size: 13px; }
.manual-pay-amount strong { color: #ea580c; font-size: 28px; }
.payment-channel-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 12px; }
.payment-channel-choice { border: 1px solid var(--border); background: #fff; color: var(--muted); border-radius: 10px; padding: 10px; font-weight: 650; }
.payment-channel-choice.on { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.manual-pay-code-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 15px; border: 1px solid var(--border); border-radius: 14px; background: #fafafa; }
.manual-pay-code-wrap img { display: block; width: min(300px, 72vw); height: min(380px, 82vw); object-fit: contain; border-radius: 10px; background: #fff; }
.manual-pay-code-wrap span { color: var(--muted); font-size: 12px; }
.manual-pay-tip { margin: 12px 0; padding: 10px 12px; color: #9a5b0b; background: #fff8e8; border-radius: 10px; font-size: 12px; line-height: 1.7; }

/* ---------- 商家唯一主二维码 ---------- */
.merchant-qr-card {
  display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 34px;
  align-items: center; padding: 30px;
}
.merchant-qr-copy h3 { margin: 7px 0 10px; font-size: 26px; }
.merchant-qr-copy > p { color: var(--muted); line-height: 1.8; margin: 0 0 18px; }
.merchant-qr-state { display: inline-flex; padding: 6px 10px; border-radius: 999px; background: #ecfdf5; color: #047857; font-size: 12px; font-weight: 700; }
.merchant-qr-state.paused { background: #fff7ed; color: #c2410c; }
.merchant-qr-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.danger-outline { color: #dc2626 !important; border-color: #fecaca !important; }
.merchant-qr-image-wrap {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 22px; border-radius: 20px; background: linear-gradient(160deg, #f5f3ff, #fff);
  border: 1px solid #e9e5ff;
}
.merchant-qr-image-wrap img { width: 230px; height: 230px; padding: 10px; border-radius: 16px; background: #fff; border: 1px solid var(--border); }
.merchant-qr-image-wrap b { margin-top: 13px; font-size: 16px; }
.merchant-qr-image-wrap span { margin-top: 4px; color: var(--muted); font-size: 12px; }

@media (max-width: 720px) {
  .magic-hero { align-items: flex-start; flex-direction: column; padding: 22px; }
  .recharge-grid { grid-template-columns: repeat(2, 1fr); }
  .custom-recharge { grid-template-columns: 1fr; }
  .billing-scroll { overflow-x: auto; }
  .billing-table { min-width: 620px; }
  .merchant-qr-card { grid-template-columns: 1fr; padding: 20px; }
  .merchant-qr-image-wrap { order: -1; }
  .merchant-qr-image-wrap img { width: min(230px, 72vw); height: min(230px, 72vw); }
}
.publish-row { display: flex; gap: 8px; margin-top: 10px; }
.state-pill { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: #f3f4f6; color: var(--muted); }

/* ---- V2.2 门店执行：分发结果 ---- */
.dist-result { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.dist-result img { width: 132px; height: 132px; border-radius: 12px; border: 1px solid var(--border); background: #fff; padding: 6px; }
.dist-result > div { flex: 1; min-width: 240px; }
.dist-url {
  width: 100%; font-size: 12px; color: var(--muted); background: #f9fafb;
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
  margin: 0 0 10px; font-family: ui-monospace, Menlo, Consolas, monospace;
}

#loading {
  position: fixed; inset: 0; background: rgba(255, 255, 255, .82); display: none;
  place-items: center; z-index: 100; backdrop-filter: blur(2px);
}
#loading.on { display: grid; }
.spinner { width: 34px; height: 34px; border: 3px solid #e5e7eb; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
#loading .txt { text-align: center; font-size: 13px; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(20px);
  background: #111827; color: #fff; padding: 9px 18px; border-radius: 999px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: .22s; z-index: 200;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
