/* ============================================================
   双人合拍趣味测评系统 · 管理后台样式
   深色侧边栏(#1e1533) + 浅灰内容区(#f5f6fa)
   主色：紫 #7c3aed，点缀：粉 #ec4899 / 金 #f0c97a
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --sidebar-bg: #1e1533;
  --sidebar-active: #2c2148;
  --content-bg: #f5f6fa;
  --primary: #7c3aed;
  --primary-dark: #6d28d9;
  --primary-light: #ede9fe;
  --pink: #ec4899;
  --gold: #f0c97a;
  --text-main: #1f2937;
  --text-sub: #6b7280;
  --border: #e5e7eb;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --yellow: #b45309;
  --yellow-bg: #fef3c7;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --blue: #2563eb;
  --blue-bg: #dbeafe;
  --shadow: 0 2px 12px rgba(30, 21, 51, .07);
  --radius: 12px;
}

html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--content-bg);
  color: var(--text-main);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e1533 0%, #3b2566 55%, #5b21b6 100%);
  padding: 24px;
}
.login-card {
  width: 400px; max-width: 100%;
  background: #fff; border-radius: 16px;
  padding: 40px 36px 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.login-logo {
  text-align: center; margin-bottom: 8px;
  font-size: 22px; font-weight: 700;
  background: linear-gradient(90deg, var(--primary), var(--pink), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.login-sub { text-align: center; color: var(--text-sub); font-size: 13px; margin-bottom: 28px; }
.login-tip {
  margin-top: 18px; padding: 10px 12px; border-radius: 8px;
  background: var(--primary-light); color: var(--primary-dark);
  font-size: 12px; line-height: 1.7; text-align: center;
}
.login-err {
  display: none; margin-top: 12px; padding: 8px 12px; border-radius: 8px;
  background: var(--red-bg); color: var(--red); font-size: 13px; text-align: center;
}
.login-err.show { display: block; }

/* ---------- 整体布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 224px; flex-shrink: 0;
  background: var(--sidebar-bg);
  color: #c4b5fd;
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 20;
}
.sidebar-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar-brand .name {
  font-size: 16px; font-weight: 700; color: #fff; letter-spacing: .5px;
}
.sidebar-brand .name em {
  font-style: normal;
  background: linear-gradient(90deg, var(--pink), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sidebar-brand .tag { font-size: 11px; color: #8b7fb8; margin-top: 4px; }
.sidebar-nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; margin-bottom: 4px;
  border-radius: 9px; color: #b9aee0; font-size: 14px;
  transition: background .15s, color .15s;
}
.nav-item .ico { width: 20px; text-align: center; font-size: 15px; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, var(--primary), #9333ea);
  color: #fff; font-weight: 600;
  box-shadow: 0 4px 14px rgba(124, 58, 237, .4);
}
.sidebar-foot { padding: 14px 12px; border-top: 1px solid rgba(255, 255, 255, .08); }
.sidebar-foot .admin-info {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px 12px;
}
.admin-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), var(--gold));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px;
}
.admin-info .n { color: #fff; font-size: 13px; }
.admin-info .r { color: #8b7fb8; font-size: 11px; }
.side-link {
  display: block; width: 100%; text-align: left;
  background: none; border: none; color: #b9aee0;
  padding: 8px 14px; border-radius: 8px; font-size: 13px;
}
.side-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-mode {
  margin: 0 8px 10px; padding: 5px 10px; border-radius: 6px;
  background: rgba(255, 255, 255, .06); color: #b9aee0;
  font-size: 11px; letter-spacing: .3px;
}

.main { flex: 1; margin-left: 224px; padding: 24px 28px 48px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-title { font-size: 20px; font-weight: 700; }
.page-desc { color: var(--text-sub); font-size: 13px; margin-top: 4px; }

/* ---------- 统计卡片 ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 22px;
}
.stat-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; display: flex; align-items: center; gap: 16px;
}
.stat-ico {
  width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.stat-ico.c1 { background: var(--primary-light); }
.stat-ico.c2 { background: #fce7f3; }
.stat-ico.c3 { background: #fef3c7; }
.stat-ico.c4 { background: var(--blue-bg); }
.stat-num { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat-num small { font-size: 13px; font-weight: 400; color: var(--text-sub); }
.stat-label { color: var(--text-sub); font-size: 13px; margin-top: 2px; }

/* ---------- 卡片 / 面板 ---------- */
.card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 22px;
}
.card-title {
  font-size: 15px; font-weight: 700; margin-bottom: 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.card-title .more { font-size: 12px; color: var(--text-sub); font-weight: 400; }
.dash-cols { display: grid; grid-template-columns: 1.1fr 1fr; gap: 22px; }
.dash-cols .card { margin-bottom: 0; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; padding: 10px 12px; color: var(--text-sub); font-weight: 600;
  border-bottom: 1px solid var(--border); white-space: nowrap;
  background: #fafafc;
}
.tbl td { padding: 12px; border-bottom: 1px solid #f1f2f6; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: #faf9ff; }
.tbl .muted { color: var(--text-sub); }
.tbl .strong { font-weight: 600; }
.cell-user { display: flex; align-items: center; gap: 8px; }
.mini-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 600;
}
.empty-row { text-align: center; color: var(--text-sub); padding: 36px 0 !important; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge.yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge.green  { background: var(--green-bg);  color: var(--green); }
.badge.red    { background: var(--red-bg);    color: var(--red); }
.badge.blue   { background: var(--blue-bg);   color: var(--blue); }
.badge.gray   { background: #f3f4f6;          color: var(--text-sub); }
.badge.purple { background: var(--primary-light); color: var(--primary-dark); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 8px; padding: 9px 18px;
  font-size: 13px; font-weight: 600; transition: filter .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(90deg, var(--primary), #9333ea); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: #fff; border: 1px solid var(--border); color: var(--text-main); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-danger:hover { filter: brightness(.97); }
.btn-block { width: 100%; padding: 12px; font-size: 15px; }
.btn-sm {
  padding: 5px 10px; font-size: 12px; border-radius: 6px; font-weight: 500;
  border: 1px solid transparent; background: none;
}
.btn-sm.ok     { color: var(--green); border-color: var(--green-bg); background: var(--green-bg); }
.btn-sm.no     { color: var(--red); border-color: var(--red-bg); background: var(--red-bg); }
.btn-sm.edit   { color: var(--primary); border-color: var(--primary-light); background: var(--primary-light); }
.btn-sm.pay    { color: var(--blue); border-color: var(--blue-bg); background: var(--blue-bg); }
.btn-sm.ghost  { color: var(--text-sub); border-color: var(--border); background: #fff; }
.btn-sm:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm:not(:disabled):hover { filter: brightness(.95); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 筛选工具条 ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.filter-tabs { display: flex; gap: 6px; }
.ftab {
  padding: 7px 14px; border-radius: 999px; font-size: 13px;
  background: #fff; border: 1px solid var(--border); color: var(--text-sub);
}
.ftab.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.ftab .cnt { font-size: 11px; opacity: .8; }

/* ---------- 表单 ---------- */
.form-item { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-label .req { color: var(--red); }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; color: var(--text-main);
  background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124, 58, 237, .12);
}
.textarea { resize: vertical; min-height: 72px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.radio-group { display: flex; gap: 10px; }
.radio-pill {
  flex: 1; text-align: center; padding: 9px; border-radius: 8px;
  border: 1px solid var(--border); cursor: pointer; font-size: 13px; color: var(--text-sub);
}
.radio-pill.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }

/* 选项动态编辑 */
.opt-list { display: flex; flex-direction: column; gap: 8px; }
.opt-row { display: flex; gap: 8px; align-items: center; }
.opt-row .opt-key {
  width: 30px; height: 38px; flex-shrink: 0; border-radius: 8px;
  background: var(--primary-light); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
.opt-row .input { flex: 1; }
.opt-del {
  width: 34px; height: 38px; flex-shrink: 0; border-radius: 8px; border: none;
  background: var(--red-bg); color: var(--red); font-size: 15px;
}
.opt-add {
  border: 1px dashed var(--border); background: #fafafc; color: var(--text-sub);
  border-radius: 8px; padding: 9px; width: 100%; font-size: 13px;
}
.opt-add:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- 开关 ---------- */
.switch {
  position: relative; width: 42px; height: 24px; display: inline-block; cursor: pointer;
}
.switch input { display: none; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px; background: #d1d5db; transition: background .2s;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { left: 21px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 12, 40, .5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 24px; backdrop-filter: blur(2px);
}
.modal {
  background: #fff; border-radius: 14px; width: 560px; max-width: 100%;
  max-height: 88vh; display: flex; flex-direction: column;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .3);
  animation: pop .18s ease-out;
}
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head {
  padding: 18px 22px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head .t { font-size: 16px; font-weight: 700; }
.modal-close {
  border: none; background: none; font-size: 20px; color: var(--text-sub); line-height: 1;
}
.modal-close:hover { color: var(--text-main); }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}
.modal.modal-sm { width: 420px; }

/* 订单详情 */
.detail-section { margin-bottom: 18px; }
.detail-section .ds-title {
  font-size: 13px; font-weight: 700; color: var(--primary-dark); margin-bottom: 10px;
  padding-left: 8px; border-left: 3px solid var(--primary);
}
.duo-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.duo-card {
  border: 1px solid var(--border); border-radius: 10px; padding: 14px;
  display: flex; gap: 10px; align-items: center; background: #faf9ff;
}
.duo-card .mini-avatar { width: 40px; height: 40px; font-size: 16px; }
.duo-card .nm { font-weight: 600; }
.duo-card .rl { font-size: 11px; color: var(--text-sub); margin-top: 2px; }
.score-ring {
  text-align: center; padding: 14px; border-radius: 10px;
  background: linear-gradient(135deg, #f5f3ff, #fdf2f8);
}
.score-ring .num {
  font-size: 38px; font-weight: 800;
  background: linear-gradient(90deg, var(--primary), var(--pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.score-ring .cap { font-size: 12px; color: var(--text-sub); }
.kv { display: grid; grid-template-columns: 92px 1fr; row-gap: 8px; font-size: 13px; }
.kv dt { color: var(--text-sub); }
.kv dd { font-weight: 500; }
.answer-bars { display: flex; flex-direction: column; gap: 8px; }
.answer-bar { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.answer-bar .ab-label { width: 70px; color: var(--text-sub); flex-shrink: 0; }
.answer-bar .ab-track { flex: 1; height: 8px; border-radius: 999px; background: #f1f2f6; overflow: hidden; }
.answer-bar .ab-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--pink)); }
.answer-bar .ab-val { width: 48px; text-align: right; font-weight: 600; }

/* ---------- Toast ---------- */
.toast-box { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); z-index: 200; }
.toast {
  padding: 10px 22px; border-radius: 999px; color: #fff; font-size: 13px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2); margin-bottom: 8px;
  animation: drop .25s ease-out;
}
@keyframes drop { from { transform: translateY(-12px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.success { background: linear-gradient(90deg, #16a34a, #22c55e); }
.toast.error { background: linear-gradient(90deg, #dc2626, #ef4444); }
.toast.info { background: linear-gradient(90deg, var(--primary), #9333ea); }

/* ---------- 图表 ---------- */
.chart-box { position: relative; }
.chart-box canvas { width: 100%; display: block; }
.chart-legend { display: flex; gap: 18px; font-size: 12px; color: var(--text-sub); }
.chart-legend .lg { display: flex; align-items: center; gap: 6px; }
.chart-legend .dot { width: 10px; height: 10px; border-radius: 3px; }

/* ---------- 系统设置 / 签文管理 ---------- */
.hint-banner {
  margin: -6px 0 16px; padding: 11px 16px; border-radius: 10px;
  background: var(--primary-light); border: 1px solid #ddd0fb;
  color: var(--primary-dark); font-size: 13px; line-height: 1.6;
}
.settings-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 22px;
}
.settings-item { margin-bottom: 16px; }
.settings-tip { margin-top: 5px; font-size: 11px; color: var(--text-sub); line-height: 1.5; }
.settings-actions {
  display: flex; gap: 12px; margin-top: 8px; padding-top: 18px;
  border-top: 1px solid #eef0f5;
}
@media (max-width: 1100px) {
  .settings-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .settings-grid { grid-template-columns: 1fr; }
}

/* ---------- 其它 ---------- */
.compliance-note {
  margin-top: 8px; font-size: 12px; color: var(--text-sub); line-height: 1.7;
  padding: 10px 14px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px;
}
.loading-line { text-align: center; color: var(--text-sub); padding: 40px 0; }
.mono { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-cols { grid-template-columns: 1fr; }
}
