:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel2: #1d212a;
  --line: #2a2f3a;
  --txt: #e6e9ef;
  --dim: #9aa4b2;
  --accent: #4c8dff;
  --ok: #27c07a;
  --warn: #f0a020;
  --bad: #e5534b;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font: 14px/1.5 -apple-system, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}

button { font: inherit; cursor: pointer; }
input { font: inherit; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px 24px;
}
.login-card h1 { font-size: 18px; margin: 0 0 4px; }
.login-sub { color: var(--dim); font-size: 13px; margin: 0 0 20px; }
.login-card label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--dim); }
.login-card input {
  width: 100%;
  margin-top: 6px;
  padding: 9px 11px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--txt);
}
.login-card button {
  width: 100%;
  padding: 10px;
  margin-top: 6px;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
}
.login-card button:disabled { opacity: .6; cursor: default; }
.login-msg { color: var(--bad); font-size: 13px; min-height: 18px; margin: 12px 0 0; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; letter-spacing: .3px; }
.brand span { color: var(--dim); font-weight: 400; font-size: 13px; margin-left: 6px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.muted { color: var(--dim); font-size: 12px; font-family: var(--mono); }

main { padding: 18px 20px 60px; max-width: 1500px; margin: 0 auto; }

/* ---------- 统计卡 ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.card .k { color: var(--dim); font-size: 12px; }
.card .v { font-size: 22px; font-weight: 700; margin-top: 4px; font-family: var(--mono); }
.card.warn .v { color: var(--warn); }
.card.ok .v { color: var(--ok); }
.card.bad .v { color: var(--bad); }

/* ---------- 页签 ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--dim);
  padding: 7px 14px;
  border-radius: 8px;
}
.tab.active { background: var(--panel2); color: var(--txt); border-color: var(--accent); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.hint { color: var(--dim); font-size: 12.5px; margin: 0 0 12px; }

.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--dim);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12.5px;
}
.chip.active { color: #fff; border-color: var(--accent); background: #24344f; }
.search {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--txt);
  padding: 7px 11px;
  min-width: 220px;
}
.inline { color: var(--dim); font-size: 13px; display: flex; align-items: center; gap: 6px; }

/* ---------- 表 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--dim); font-weight: 600; font-size: 12px; white-space: nowrap; position: sticky; top: 0; background: var(--panel); }
td.mono, .mono { font-family: var(--mono); font-size: 12px; }
.empty { padding: 30px; text-align: center; color: var(--dim); }

/* 状态徽标 */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.PENDING_PAY { background: #3a2d12; color: #f0a020; border-color: #5c4519; }
.badge.PENDING_CODE { background: #2c2440; color: #b39ddb; border-color: #453963; }
.badge.PENDING_SMS { background: #2c2440; color: #b39ddb; border-color: #453963; }
.badge.PENDING_REVIEW { background: #12384a; color: #4fc3f7; border-color: #1c5570; }
.badge.APPROVED { background: #123a26; color: #27c07a; border-color: #1b5c3c; }
.badge.REJECTED { background: #3d1a19; color: #e5534b; border-color: #5e2725; }
.badge.EXPIRED { background: #2a2d33; color: #8b93a0; border-color: #3a3f49; }
.badge.VALID { background: #123a26; color: #27c07a; border-color: #1b5c3c; }
.badge.GRACE { background: #3a2d12; color: #f0a020; border-color: #5c4519; }
.badge.REVOKED { background: #3d1a19; color: #e5534b; border-color: #5e2725; }
.badge.SUSPENDED { background: #2c2440; color: #b39ddb; border-color: #453963; }
.badge.ACTIVE { background: #123a26; color: #27c07a; border-color: #1b5c3c; }
.badge.NONE { background: #2a2d33; color: #8b93a0; }

/* 操作按钮 */
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn {
  padding: 5px 11px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--txt);
  font-size: 12.5px;
  white-space: nowrap;
}
.btn:hover { border-color: #3d4657; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.ok { background: #1a6b45; border-color: #1a6b45; color: #fff; }
.btn.bad { background: #8d2f29; border-color: #8d2f29; color: #fff; }
.btn.warn { background: #8a5a00; border-color: #8a5a00; color: #fff; }
.btn.ghost { background: transparent; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* [hidden] 必须真的隐藏。浏览器默认样式表里 [hidden]{display:none} 只是普通声明，
   任何带 display 的类（比如下面 .modal 的 display:flex）都会把它覆盖掉 —— 那样
   .modal 一进页面就常驻、全屏遮罩挡住整页，所有按钮都点不动。用 !important 固定住。 */
[hidden] { display: none !important; }

/* ---------- 模态框 ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow: auto;
}
.modal-card h2 { font-size: 16px; margin: 0 0 14px; }
.modal-card .field { margin-bottom: 12px; }
.modal-card .field label { display: block; font-size: 12.5px; color: var(--dim); margin-bottom: 5px; }
.modal-card .field input[type=text],
.modal-card .field input[type=date],
.modal-card .field input[type=number],
.modal-card .field select,
.modal-card .field textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--txt);
}
.modal-card .radios { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.modal-card .radios label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--txt); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.kv { font-size: 12.5px; color: var(--dim); line-height: 1.9; margin-bottom: 12px; }
.kv b { color: var(--txt); font-weight: 600; }
.code-big {
  font-family: var(--mono);
  font-size: 30px;
  letter-spacing: 6px;
  text-align: center;
  padding: 14px;
  background: var(--panel2);
  border-radius: 10px;
  border: 1px dashed var(--line);
  margin: 10px 0;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: #23303f;
  border: 1px solid #33507a;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 80;
  max-width: 80vw;
}
.toast.bad { background: #3d1a19; border-color: #5e2725; }
.toast.ok { background: #123a26; border-color: #1b5c3c; }

@media (max-width: 720px) {
  main { padding: 12px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  th, td { padding: 8px 6px; }
}

/* ---------- 收款设置页 ---------- */

/* 两栏：左边看码、右边改价。窄屏（<=720px）自动堆成一栏，
   管理员在手机上看后台时不至于横向滚动。 */
.pay-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 24px;
  align-items: start;
}

.pay-col { min-width: 0; }

.pay-h {
  font-size: 14px;
  font-weight: 600;
  margin: 4px 0 10px;
  padding-left: 8px;
  border-left: 3px solid var(--accent);
}

/* 收款码预览：白底方框。图本身是白底的，配深色底会看不清静区还剩多少，
   所以这里刻意用白底 + 细边，让"图有没有铺满"一眼能看出来。 */
.qr-box {
  width: 240px;
  height: 240px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.qr-box img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }

.pay-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 10px 0 8px;
}

/* 三档价格行：标签 / 输入框 / 单位对齐成一行 */
.pay-price { margin-bottom: 4px; }
.pay-price-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.pay-price-row label {
  min-width: 190px;
  font-size: 13px;
  color: var(--txt);
}
.pay-price-row input[type=number] {
  width: 120px;
  padding: 7px 9px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--txt);
  font-family: var(--mono);
}

/* 学员端会拿到的原始文本：等宽、可换行，直接看服务端吐什么 */
.pay-plans {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin: 0;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--txt);
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 60px;
}

@media (max-width: 720px) {
  .pay-grid { grid-template-columns: 1fr; }
  .pay-price-row { flex-wrap: wrap; }
  .pay-price-row label { min-width: 100%; }
}
