/* ===========================================================
   商家 SaaS 后台样式（浅色主题 / 桌面端）
   =========================================================== */
:root {
  --primary: #e4393c;
  --primary-d: #c81623;
  --bg: #f2f3f5;
  --panel: #ffffff;
  --text: #22252a;
  --sub: #8a8f99;
  --line: #e8eaed;
  --ok: #18a058;
  --warn: #f0a020;
  --blue: #2b7cf6;
  --radius: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13.5px;
}
a { color: inherit; text-decoration: none; }

/* ---------- 登录 ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box {
  display: flex; width: 860px; max-width: 94vw; background: #fff;
  border-radius: 16px; overflow: hidden; box-shadow: 0 12px 48px rgba(0,0,0,.12);
}
.login-left {
  flex: 1; padding: 48px 40px; color: #fff;
  background: linear-gradient(150deg, #ff5b4a, #c81623);
}
.login-left h1 { font-size: 26px; margin: 0 0 12px; }
.login-left p { font-size: 13px; opacity: .9; margin: 0 0 24px; }
.login-left ul { list-style: none; padding: 0; margin: 0; font-size: 13px; line-height: 2.1; opacity: .95; }
.login-right { width: 340px; padding: 48px 36px; }
.login-right h2 { font-size: 19px; margin: 0 0 22px; }
.fi { margin-bottom: 14px; }
.fi label { display: block; font-size: 12px; color: var(--sub); margin-bottom: 6px; }
.fi input, .fi select, .fi textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font-size: 14px; outline: none; font-family: inherit; background: #fafbfc;
}
.fi input:focus, .fi select:focus, .fi textarea:focus { border-color: var(--primary); background: #fff; }
.btn-primary {
  width: 100%; background: var(--primary); color: #fff; border: none;
  border-radius: 8px; padding: 12px; font-size: 15px; font-weight: 700; cursor: pointer;
}
.btn-primary:hover { background: var(--primary-d); }
.login-right .tip { font-size: 12px; color: var(--sub); text-align: center; margin-top: 14px; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.side {
  width: 200px; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0;
}
.side .logo {
  padding: 18px 20px; font-size: 15px; font-weight: 800; color: var(--primary);
  border-bottom: 1px solid var(--line);
}
.side .logo small { display: block; font-size: 11px; color: var(--sub); font-weight: 400; margin-top: 3px; }
.side nav { flex: 1; overflow: auto; padding: 10px 0; }
.side nav a {
  display: block; padding: 10px 20px; font-size: 13.5px; color: #5b6169;
  border-left: 3px solid transparent;
}
.side nav a:hover { background: #fafbfc; }
.side nav a.on { background: #fff5f5; color: var(--primary); font-weight: 700; border-left-color: var(--primary); }
.side nav .grp { font-size: 11px; color: #b3b8c0; padding: 14px 20px 6px; }

.main { flex: 1; margin-left: 200px; padding: 0 24px 40px; }
.topbar {
  height: 58px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line); margin-bottom: 18px; background: #fff;
  margin: 0 -24px 18px; padding: 0 24px;
}
.topbar h1 { font-size: 17px; margin: 0; }
.topbar .right { display: flex; align-items: center; gap: 14px; font-size: 12.5px; color: var(--sub); }
.topbar .right a { color: var(--blue); }

/* ---------- 面板 ---------- */
.panel { background: var(--panel); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.panel > h3 { font-size: 14.5px; margin: 0 0 14px; display: flex; align-items: center; justify-content: space-between; }
.panel > h3 .sub { font-size: 12px; color: var(--sub); font-weight: 400; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat {
  background: #fff; border-radius: var(--radius); padding: 16px 18px;
  border-left: 3px solid var(--primary);
}
.stat .t { font-size: 12px; color: var(--sub); }
.stat .n { font-size: 25px; font-weight: 800; margin-top: 6px; letter-spacing: .5px; }
.stat .n small { font-size: 13px; font-weight: 600; color: var(--sub); }
.stat .d { font-size: 11.5px; color: var(--sub); margin-top: 4px; }
.stat.green { border-left-color: var(--ok); }
.stat.blue { border-left-color: var(--blue); }
.stat.warn { border-left-color: var(--warn); }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 10px 12px; background: #fafbfc;
  color: var(--sub); font-weight: 600; font-size: 12.5px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 11px 12px; border-bottom: 1px solid #f2f3f5; vertical-align: middle; }
tr:hover td { background: #fcfcfd; }
.tb-wrap { overflow-x: auto; }

.tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #f1f2f4; color: #6b7078; }
.tag.red { background: #fdecec; color: var(--primary); }
.tag.green { background: #e8f7ee; color: var(--ok); }
.tag.blue { background: #e8f1fe; color: var(--blue); }
.tag.warn { background: #fdf3e3; color: #c98a10; }

.btn {
  border: 1px solid var(--line); background: #fff; border-radius: 7px;
  padding: 6px 13px; font-size: 12.5px; cursor: pointer; font-family: inherit;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.sm { padding: 3px 9px; font-size: 12px; }
.btn.red { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.red:hover { background: var(--primary-d); color: #fff; }
.btn.ghost { color: var(--sub); }
.btn + .btn { margin-left: 6px; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input, .toolbar select {
  border: 1px solid var(--line); border-radius: 7px; padding: 7px 11px;
  font-size: 13px; outline: none; font-family: inherit;
}
.toolbar input:focus, .toolbar select:focus { border-color: var(--primary); }

/* ---------- 图表 ---------- */
.chart { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 10px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.chart .bar {
  width: 100%; max-width: 44px; border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, #ff6a6a, #e4393c); min-height: 3px;
}
.chart .lb { font-size: 11px; color: var(--sub); }
.chart .vl { font-size: 11px; font-weight: 700; }

.rank-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f4f5f7; }
.rank-row:last-child { border-bottom: none; }
.rank-row .idx {
  width: 20px; height: 20px; border-radius: 4px; background: #f1f2f4;
  color: var(--sub); font-size: 11px; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.rank-row .idx.top { background: var(--primary); color: #fff; }
.rank-row .nm { flex: 1; font-size: 13px; }
.rank-row .vv { font-size: 13px; font-weight: 700; }

/* ---------- 弹窗 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 200; padding: 20px;
}
.mask.hide { display: none; }
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 520px;
  max-height: 88vh; overflow: auto; padding: 22px;
}
.modal h3 { margin: 0 0 16px; font-size: 16px; display: flex; justify-content: space-between; align-items: center; }
.modal h3 .x { cursor: pointer; color: #bbb; font-size: 22px; line-height: 1; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

.empty { text-align: center; color: #b6bac2; padding: 30px 0; font-size: 13px; }
.loading { text-align: center; color: var(--sub); padding: 30px 0; }

.toast {
  position: fixed; left: 50%; top: 30px; transform: translateX(-50%);
  background: rgba(0,0,0,.85); color: #fff; padding: 10px 18px;
  border-radius: 8px; font-size: 13px; z-index: 999;
}
.toast.hide { display: none; }

/* ==================================================================
   活动图标卡片网格
   商家进后台第一眼要看到"有哪些活动"，所以活动管理用卡片而不是表格：
   每张卡片一个独立图标 + 关键数据 + 操作，扫一眼就能定位要进的活动。
   ================================================================== */
.act-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.act-head-t { font-size: 14.5px; font-weight: 700; }
.act-head-t span { font-size: 12px; color: var(--sub); font-weight: 400; margin-left: 6px; }

.act-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
}
.act-card {
  background: #fff; border-radius: 12px; padding: 16px;
  border: 1px solid #eef0f3;
  transition: box-shadow .18s, transform .18s;
  display: flex; flex-direction: column; gap: 10px;
}
.act-card:hover { box-shadow: 0 8px 24px rgba(20,30,50,.10); transform: translateY(-2px); }
.act-card.off { opacity: .72; }

.act-top { display: flex; align-items: center; gap: 12px; }
.act-ico {
  position: relative; width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff; flex: 0 0 auto;
  box-shadow: 0 6px 14px rgba(0,0,0,.12);
}
.act-dot {
  position: absolute; right: -2px; top: -2px; width: 10px; height: 10px;
  border-radius: 50%; background: #c9ccd2; border: 2px solid #fff;
}
.act-dot.on { background: #18a058; }
.act-title { flex: 1; min-width: 0; }
.act-name {
  font-size: 14.5px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.act-type { font-size: 11.5px; color: var(--sub); margin-top: 3px; }
.act-run { flex: 0 0 auto; }

.act-time { font-size: 11.5px; color: var(--sub); }
.act-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  background: #f8f9fb; border-radius: 9px; padding: 10px 8px; text-align: center;
}
.act-stats b { display: block; font-size: 15px; color: var(--text); letter-spacing: .3px; }
.act-stats span { font-size: 11px; color: var(--sub); }
.act-badge-team {
  display: inline-block; font-size: 11px; color: #fa8c16; background: #fff7e6;
  padding: 3px 9px; border-radius: 20px;
}
.act-ops { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }

/* 新建活动：玩法选择 */
.type-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.type-item {
  border: 2px solid #eef0f3; border-radius: 12px; padding: 18px 10px;
  text-align: center; cursor: pointer; transition: all .18s;
}
.type-item:hover { border-color: var(--primary); background: #fffafa; transform: translateY(-2px); }
.type-ico {
  width: 50px; height: 50px; border-radius: 14px; margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center; font-size: 24px; color: #fff;
  box-shadow: 0 6px 14px rgba(0,0,0,.14);
}
.type-name { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.type-desc { font-size: 11.5px; color: var(--sub); line-height: 1.6; }

/* 表单分区标题与提示 */
.sec-h {
  font-size: 12.5px; font-weight: 700; color: var(--primary);
  border-left: 3px solid var(--primary); padding-left: 8px;
  margin: 16px 0 10px;
}
.hint {
  font-size: 11.5px; color: #8a8f99; background: #f8f9fb;
  border-radius: 8px; padding: 9px 11px; line-height: 1.7; margin-top: 10px;
}

/* 进度条（拼团人数） */
.pbar { width: 90px; height: 5px; background: #eef0f3; border-radius: 4px; overflow: hidden; margin-bottom: 5px; }
.pbar i { display: block; height: 100%; background: linear-gradient(90deg,#3ecf8e,#0f9d58); border-radius: 4px; }

/* 核销台：店员在柜台前单手操作，输入框与按钮必须够大 */
.vf-box {
  display: flex; gap: 10px; margin: 4px 0 14px;
}
.vf-box input {
  flex: 1; height: 52px; border: 2px solid #eef0f3; border-radius: 10px;
  padding: 0 16px; font-size: 20px; letter-spacing: 4px; font-weight: 700;
  color: #1b1f27; outline: none; transition: border-color .18s;
}
.vf-box input:focus { border-color: var(--primary); }
.vf-box input::placeholder { font-size: 14px; letter-spacing: 0; font-weight: 400; color: #b6bac2; }
.vf-box .btn { height: 52px; padding: 0 26px; font-size: 15px; border-radius: 10px; }

/* ==================================================================
   活动创建 / 编辑表单
   参考产品的表单分区很明确：主图 → 基本信息 → 价格 → 表单 → 详情
   → 凭证 → 海报 → 客服 → 分销。这里按同样顺序排版。
   ================================================================== */
.modal.wide { max-width: 880px; }

/* ================= 活动二维码弹窗 ================= */
.qr-body { text-align: center; padding: 6px 0 2px; }
.qr-frame {
  display: inline-block; padding: 14px; background: #fff;
  border: 1px solid #eef0f4; border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,.06);
}
.qr-frame img { display: block; width: 240px; height: 240px; }
.qr-title { margin-top: 14px; font-size: 16px; font-weight: 600; color: #1f2329; }
.qr-tip { margin-top: 6px; font-size: 13px; color: #b6bac2; }
.qr-link {
  margin: 12px auto 0; max-width: 460px; font-size: 12px; color: #8a8f99;
  background: #f6f7f9; padding: 8px 12px; border-radius: 6px;
  word-break: break-all; line-height: 1.5;
}
.qr-foot { justify-content: center; }
.qr-loading { text-align: center; color: #8a8f99; padding: 40px 0; font-size: 14px; }


.fm-sec {
  border-top: 1px solid #f0f2f5;
  padding: 16px 0 6px;
}
.fm-sec:first-of-type { border-top: 0; padding-top: 0; }
.fm-h {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 12px;
}
.fm-h i { width: 3px; height: 14px; background: var(--primary); border-radius: 2px; display: inline-block; }
.fm-h span { font-size: 11.5px; color: var(--sub); font-weight: 400; margin-left: 2px; }

.fm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.fm-col2 { grid-column: span 2; }
.fm-fi { display: block; margin-bottom: 12px; }
.fm-fi > span {
  display: block; font-size: 12.5px; color: #4a505c; margin-bottom: 6px;
}
.fm-fi > span i { color: #e4393c; font-style: normal; margin-left: 2px; }
.fm-fi input, .fm-fi select, .fm-fi textarea {
  width: 100%; box-sizing: border-box;
  border: 1px solid #e2e6ec; border-radius: 8px;
  padding: 9px 11px; font-size: 13.5px; color: var(--text);
  outline: none; background: #fff; font-family: inherit;
}
.fm-fi input:focus, .fm-fi select:focus, .fm-fi textarea:focus { border-color: var(--primary); }
.fm-fi input:disabled { background: #f7f8fa; color: #9aa0aa; }
.fm-fi em { display: block; font-size: 11.5px; color: #9aa0aa; font-style: normal; margin-top: 5px; }

.fm-sub { font-size: 12.5px; color: #4a505c; margin: 14px 0 8px; font-weight: 600; }
.fm-note {
  font-size: 11.5px; color: #8a8f99; background: #f8f9fb;
  border-radius: 7px; padding: 8px 10px; line-height: 1.7; margin-top: 4px;
}
.fm-row { display: flex; gap: 18px; align-items: flex-start; }

/* 上传控件：虚线框 + 加号，和参考产品一致 */
.up-wrap { display: flex; gap: 14px; align-items: flex-start; }
.up-box {
  width: 190px; height: 101px; flex: 0 0 auto;
  border: 1px dashed #d5dae2; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; background: #fafbfc; overflow: hidden; position: relative;
  transition: border-color .18s, background .18s;
}
.up-box:hover { border-color: var(--primary); background: #fffafa; }
.up-box.has { border-style: solid; border-color: #e8eaed; background: #fff; }
.up-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.up-box .up-plus { font-size: 30px; color: #c0c4cc; font-weight: 300; line-height: 1; }
.up-box.busy::after {
  content: '上传中…'; position: absolute; inset: 0; background: rgba(255,255,255,.82);
  display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--sub);
}
.up-tip { font-size: 11.5px; color: #8a8f99; line-height: 1.8; padding-top: 4px; }
.up-tip b { color: #4a505c; }
.up-del { color: #e4393c; text-decoration: none; }

/* 富文本编辑器 */
.rt { border: 1px solid #e2e6ec; border-radius: 8px; overflow: hidden; }
.rt-bar {
  display: flex; flex-wrap: wrap; gap: 2px; padding: 6px 8px;
  background: #f7f8fa; border-bottom: 1px solid #eceff3;
}
.rt-bar button {
  min-width: 30px; height: 28px; border: 0; background: transparent;
  border-radius: 5px; cursor: pointer; font-size: 13px; color: #4a505c;
}
.rt-bar button:hover { background: #e9edf3; }
.rt-area {
  min-height: 160px; max-height: 320px; overflow: auto;
  padding: 12px 14px; font-size: 13.5px; line-height: 1.75; outline: none;
}
.rt-area img { max-width: 100%; }
.rt-area h3 { font-size: 16px; margin: 10px 0 6px; }
.rt-area p { margin: 6px 0; }

/* 开关 */
.fm-switch {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px dashed #f0f2f5;
}
.fm-switch:last-of-type { border-bottom: 0; }
.fm-switch b { display: block; font-size: 13px; font-weight: 600; color: var(--text); }
.fm-switch em { display: block; font-size: 11.5px; color: #9aa0aa; font-style: normal; margin-top: 3px; }
.sw { position: relative; width: 44px; height: 24px; flex: 0 0 auto; cursor: pointer; }
.sw input { position: absolute; opacity: 0; width: 0; height: 0; }
.sw i {
  position: absolute; inset: 0; background: #d9dde4; border-radius: 14px;
  transition: background .18s;
}
.sw i::after {
  content: ''; position: absolute; left: 2px; top: 2px;
  width: 20px; height: 20px; background: #fff; border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.18); transition: transform .18s;
}
.sw input:checked + i { background: #18a058; }
.sw input:checked + i::after { transform: translateX(20px); }

.fm-checks, .fm-radios { display: flex; gap: 18px; flex-wrap: wrap; }
.ck { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #4a505c; cursor: pointer; }
.ck input { accent-color: var(--primary); }

/* 凭证选择 */
.fm-vouchers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vc-item {
  display: flex; gap: 9px; align-items: flex-start;
  border: 1px solid #e6e9ee; border-radius: 9px; padding: 11px 12px;
  cursor: pointer; transition: all .16s;
}
.vc-item:hover { border-color: #ffc9c9; background: #fffafa; }
.vc-item:has(input:checked) { border-color: var(--primary); background: #fff7f7; }
.vc-item input { margin-top: 3px; accent-color: var(--primary); }
.vc-item b { display: block; font-size: 13px; margin-bottom: 3px; }
.vc-item em { font-size: 11.5px; color: #8a8f99; font-style: normal; line-height: 1.6; display: block; }
