:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --blue: #2f6fed;
  --blue-d: #1f4fb8;
  --orange: #f5921b;
  --text: #1f2733;
  --muted: #8a94a6;
  --line: #e6eaf2;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.topbar {
  background: linear-gradient(120deg, var(--blue), var(--blue-d));
  color: #fff;
  padding: 20px 24px;
}
.brand { font-size: 20px; font-weight: 700; }
.sub { opacity: 0.85; margin-top: 4px; font-size: 13px; }
.topbar a.helplink {
  float: right;
  color: #fff;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.6);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  margin-top: 2px;
}
.topbar a.helplink:hover { background: rgba(255,255,255,0.15); }
.container {
  max-width: 760px;
  margin: 24px auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.card {
  background: var(--card);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(20, 40, 80, 0.05);
}
.card h2 { margin: 0 0 14px; font-size: 16px; }
.card h3 { margin: 18px 0 8px; font-size: 14px; color: var(--blue-d); }
.channels { display: flex; gap: 10px; }
.chan {
  flex: 1;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  transition: all 0.15s;
}
.chan.active { border-color: var(--blue); background: #eef3ff; color: var(--blue-d); font-weight: 600; }
.hint { color: var(--muted); font-size: 13px; margin: 12px 0 0; line-height: 1.6; }
label { display: block; margin-bottom: 14px; font-size: 14px; }
label small { display: block; color: var(--muted); margin-top: 4px; font-size: 12px; line-height: 1.5; }
input {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 14px;
}
input:focus { outline: none; border-color: var(--blue); }
.chk { display: flex; align-items: center; gap: 8px; }
.chk input { width: auto; margin: 0; }
.primary {
  width: 100%;
  padding: 12px;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.primary:hover { filter: brightness(1.05); }
.result code { color: var(--blue-d); font-size: 13px; }
.row { display: flex; gap: 8px; margin-top: 8px; }
.row input { flex: 1; background: #f7f9fc; }
#copyBtn {
  width: 80px;
  border: none;
  background: var(--blue);
  color: #fff;
  border-radius: 9px;
  cursor: pointer;
}
.botlist { list-style: none; padding: 0; margin: 0; }
.botlist li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.botlist li:last-child { border-bottom: none; }
.empty { color: var(--muted); }
.muted { color: var(--muted); font-size: 12px; margin-left: 6px; }
.editai {
  margin-left: auto;
  padding: 6px 12px;
  border: 1px solid var(--blue);
  background: #fff;
  color: var(--blue-d);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.editai:hover { background: #eef3ff; }
.delbot {
  padding: 6px 12px;
  border: 1px solid #e53e3e;
  background: #fff;
  color: #e53e3e;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.delbot:hover { background: #fff5f5; }
.ok { color: #38a169; font-weight: 500; }
.warn { color: #d69e2e; font-weight: 500; }

/* 统一操作反馈（小窗口提示） */
.toast-wrap { position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; max-width: 84vw; padding: 11px 18px; border-radius: 10px; color: #fff; font-size: 14px; line-height: 1.45; box-shadow: 0 6px 20px rgba(0,0,0,.2); opacity: 0; transform: translateY(10px); transition: opacity .2s ease, transform .2s ease; cursor: pointer; text-align: center; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok { background: #38a169; }
.toast.err { background: #e53e3e; }

/* 套餐列表（前端展示） */
.planlist { display: block; margin-top: 10px; }
.plan-scope-tabs, .plan-period-tabs { display: flex; justify-content: center; gap: 8px; margin: 16px 0; flex-wrap: wrap; }
.plan-scope-tabs button, .plan-period-tabs button {
  padding: 8px 16px; border: 1px solid var(--line); background: #fff; border-radius: 999px;
  cursor: pointer; font-size: 14px; color: var(--text);
}
.plan-scope-tabs button.active, .plan-period-tabs button.active {
  background: var(--blue); color: #fff; border-color: var(--blue);
}
.discount-tag { color: #38a169; font-size: 12px; margin-left: 4px; }
.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-top: 10px; }
.plan-card {
  position: relative; border: 1px solid var(--line); border-radius: 16px; padding: 18px 14px 14px;
  background: #fff; text-align: center; display: flex; flex-direction: column; align-items: center;
}
.plan-card.popular {
  border: 2px solid #38a169; box-shadow: 0 8px 24px rgba(56, 161, 105, 0.12);
}
.plan-tag {
  position: absolute; top: 0; left: 0; right: 0;
  background: linear-gradient(90deg, #38a169, #2f855a); color: #fff;
  font-size: 12px; padding: 6px 0; border-radius: 14px 14px 0 0;
}
.plan-icon { width: 44px; height: 44px; border-radius: 50%; background: #eef3ff; margin: 18px 0 8px; }
.plan-name { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.plan-price { font-size: 28px; font-weight: 800; color: var(--blue-d); margin: 8px 0; display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.plan-price span { font-size: 13px; color: var(--muted); font-weight: 400; }
.plan-price .free { color: #38a169; font-size: 20px; }
.plan-price del.orig { font-size: 14px; color: var(--muted); font-weight: 400; }
.plan-card .buyBtn { width: 100%; margin: 10px 0; padding: 10px; border-radius: 10px; font-size: 14px; }
.plan-card.popular .buyBtn { background: #38a169; }
.plan-features { list-style: none; padding: 0; margin: 0; text-align: left; font-size: 13px; color: var(--text); width: 100%; }
.plan-features li { padding: 6px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 6px; align-items: flex-start; line-height: 1.4; }
.plan-features li:last-child { border-bottom: none; }
.plan-features .dot { color: var(--blue); flex-shrink: 0; }
.paybox { margin-top: 16px; padding: 14px; border: 1px dashed var(--line); border-radius: 12px; text-align: center; }
.qrbox { margin: 8px 0; }
.qrbox img { max-width: 220px; border-radius: 8px; border: 1px solid var(--line); }
/* 超管套餐设置行 */
.planrow { display: block; margin-bottom: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fafbff; }
.planrow-main, .planrow-extra { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 10px; }
.planrow-main b { width: 70px; }
.planrow label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 4px; margin: 0; }
.planrow input, .planrow select, .planrow textarea { width: 120px; padding: 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.planrow textarea { width: 280px; }
.plan-select { padding: 4px 6px; font-size: 12px; border-radius: 6px; border: 1px solid var(--line); }

/* 多种收款方式 */
.qrbox a { color: var(--blue); word-break: break-all; }
.paymethod { display: inline-block; vertical-align: top; width: 220px; margin: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.paymethod .pmname { font-weight: 700; margin-bottom: 6px; }
.paymethod .pmnote { font-size: 12px; color: var(--text); margin-top: 6px; white-space: pre-wrap; }
.payrow { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fafbff; }
.payrow label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 4px; }
.payrow input, .payrow textarea, .payrow select { width: 200px; padding: 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; color: var(--text); }
.payrow .pm-cur { color: var(--muted); font-size: 11px; }
#addPayMethodBtn { margin: 6px 0 14px; }

/* ===== 超管控制台 ===== */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab {
  padding: 8px 14px; border: 1px solid var(--line); background: #fff; border-radius: 999px;
  cursor: pointer; font-size: 13px; color: var(--text);
}
.tab.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.tabpane { margin-top: 4px; }
.stats4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { background: linear-gradient(135deg, #eef3ff, #f7faff); border: 1px solid var(--line); border-radius: 12px; padding: 16px; text-align: center; }
.stat .num { font-size: 28px; font-weight: 800; color: var(--blue-d); }
.stat .lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }
.footstatus { margin-top: 16px; font-size: 13px; color: var(--muted); background: #f7f9fc; border-radius: 10px; padding: 10px 12px; }

.tbl { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.tr { display: grid; grid-template-columns: 1.4fr 1fr 1fr 0.7fr 0.8fr 0.8fr 1.3fr 1.2fr; gap: 8px; padding: 10px 8px; border-bottom: 1px solid var(--line); align-items: center; }
.tr.th { font-weight: 700; color: var(--blue-d); background: #f7f9fc; border-radius: 8px 8px 0 0; }
.tr span { overflow: hidden; text-overflow: ellipsis; }
.tr .mono { font-family: ui-monospace, monospace; font-size: 11px; word-break: break-all; }
.badge-on { color: #38a169; font-weight: 600; }
.badge-off { color: #e53e3e; font-weight: 600; }
.badge-warn { color: #d69e2e; font-weight: 600; }
.activate-banner {
  border-left: 4px solid #d69e2e;
  background: #fffaf0;
}
.activate-banner ol { margin: 8px 0 8px 18px; padding: 0; }
.activate-banner li { margin: 4px 0; }
.mini-row { padding: 6px 8px; border-bottom: 1px dashed var(--line); font-size: 12px; color: var(--text); }
.detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.detail-head h3 { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 12px 0; }
.grid2 > div { background: #f7f9fc; border-radius: 10px; padding: 12px; font-size: 13px; line-height: 1.8; }
.ai-block { margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.ai-block label { margin-top: 8px; }

.modal { position: fixed; inset: 0; background: rgba(20, 30, 50, 0.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-box { background: #fff; border-radius: 14px; padding: 20px; width: min(520px, 92vw); max-height: 80vh; overflow: auto; }
.fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 40;
  border: none; background: var(--blue); color: #fff; padding: 12px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 600; cursor: pointer; box-shadow: 0 6px 18px rgba(47, 111, 237, 0.35);
}
.fab:hover { filter: brightness(1.05); }
.company-group { margin-bottom: 12px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.company-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: #f7f9fc; cursor: pointer; font-weight: 500; font-size: 14px; }
.company-header:hover { background: #eef3ff; }
.company-header .badge { font-size: 12px; background: var(--line); padding: 2px 8px; border-radius: 10px; color: var(--text); }
.company-rows.hidden { display: none; }
.company-rows .tr { border-top: 1px solid var(--line); }
@media (max-width: 640px) {
  .stats4 { grid-template-columns: repeat(2, 1fr); }
  .tr { grid-template-columns: 1fr 1fr; }
  .tr.th { display: none; }
  .grid2 { grid-template-columns: 1fr; }
}
