/* ============================================================
   管理端样式（PC 浏览器，紫色系）
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #7C3AED;
  --primary-deep: #6D28D9;
  --primary-2: #8B5CF6;
  --primary-3: #C4B5FD;
  --bg: #F6F5FE;
  --text: #1F2937;
  --text-2: #6B7280;
  --danger: #EF4444;
  --border: #EDE9FE;
  --shadow-md: 0 8px 24px rgba(109, 40, 217, .08), 0 2px 6px rgba(109, 40, 217, .05);
  --card-border: 1px solid rgba(124, 58, 237, .07);
  --font: "PingFang SC", "HarmonyOS Sans SC", "Source Han Sans SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}

/* ---------- 登录页 ---------- */
.admin-login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #5B21B6, var(--primary) 55%, var(--primary-2));
}
.admin-login .box {
  width: 390px; background: #fff; border-radius: 20px; padding: 40px 34px;
  box-shadow: 0 24px 70px rgba(0,0,0,.30); border: 1px solid rgba(255,255,255,.6);
}
.admin-login h1 { font-size: 21px; color: var(--primary); text-align: center; margin-bottom: 6px; letter-spacing: .01em; }
.admin-login .sub { text-align: center; color: var(--text-2); font-size: 13px; margin-bottom: 28px; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; background: linear-gradient(180deg, #5B21B6, var(--primary-deep) 60%, var(--primary)); color: #fff;
  padding: 22px 0; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 0 20px 22px; border-bottom: 1px solid rgba(255,255,255,.15); margin-bottom: 14px; }
.sidebar .brand img, .sidebar .brand .logo-fallback { width: 38px; height: 38px; border-radius: 50%; background: #fff; object-fit: cover; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.sidebar .brand .logo-fallback { display: flex; align-items: center; justify-content: center; color: var(--primary); font-weight: 700; }
.sidebar .brand .nm { font-size: 14px; font-weight: 700; line-height: 1.45; letter-spacing: .01em; }
.sidebar .nav-item {
  padding: 12px 20px; cursor: pointer; font-size: 14px; display: flex; gap: 10px; align-items: center;
  color: rgba(255,255,255,.85); transition: background .15s, color .15s; letter-spacing: .02em;
}
.sidebar .nav-item:hover { background: rgba(255,255,255,.10); }
.sidebar .nav-item.active { background: rgba(255,255,255,.18); color: #fff; font-weight: 700; border-right: 3px solid #fff; }

.main { flex: 1; padding: 26px 30px; min-width: 0; }
.main-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.main-header h2 { font-size: 21px; letter-spacing: .01em; }
.main-header .who { color: var(--text-2); font-size: 13px; }
.main-header .who a { color: var(--primary); cursor: pointer; margin-left: 12px; }
.main-header .who a:hover { text-decoration: underline; }

/* ---------- 统计卡片 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: #fff; border-radius: 18px; padding: 20px; box-shadow: var(--shadow-md);
  border: var(--card-border); transition: transform .15s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(109, 40, 217, .13), 0 3px 8px rgba(109, 40, 217, .06); }
.stat-card .label { color: var(--text-2); font-size: 13px; }
.stat-card .value { font-size: 30px; font-weight: 700; color: var(--primary); margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-card .value small { font-size: 14px; color: var(--text-2); font-weight: 400; }

/* ---------- 面板 / 表格 ---------- */
.panel { background: #fff; border-radius: 18px; padding: 22px; box-shadow: var(--shadow-md); margin-bottom: 20px; border: var(--card-border); }
.panel-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; letter-spacing: .01em; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; padding: 10px 12px; background: var(--bg); color: var(--text-2); font-weight: 600; font-size: 13px; white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid #F5F3FF; vertical-align: middle; }
.tbl tr:hover td { background: #FAF8FF; }
.tbl .empty { text-align: center; color: var(--text-2); padding: 32px; }

/* ---------- 表单控件 ---------- */
.input, .select {
  height: 38px; border: 1.5px solid #E5E7EB; border-radius: 12px; padding: 0 12px;
  font-size: 14px; font-family: inherit; background: #FAFAFA; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.input:focus, .select:focus { border-color: var(--primary-2); background: #fff; box-shadow: 0 0 0 3px rgba(139, 92, 246, .14); }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }

.btn {
  height: 38px; border: none; border-radius: 12px; padding: 0 18px;
  background: linear-gradient(135deg, var(--primary-deep), var(--primary) 55%, var(--primary-2)); color: #fff;
  font-size: 14px; font-weight: 600; letter-spacing: .02em; font-family: inherit; cursor: pointer;
  box-shadow: 0 4px 12px rgba(109, 40, 217, .28);
  transition: transform .12s, box-shadow .2s, opacity .2s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(109, 40, 217, .34); }
.btn:disabled { background: #E5E7EB; color: #9CA3AF; box-shadow: none; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--primary); border: 1.5px solid var(--primary-3); box-shadow: none; }
.btn.danger { background: linear-gradient(135deg, #DC2626, #F87171); box-shadow: 0 4px 12px rgba(220, 38, 38, .22); }
.btn.mini { height: 30px; padding: 0 12px; font-size: 13px; border-radius: 9px; }

/* 数据清除卡片 */
.danger-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border: 1.5px solid #FECACA; background: #FFFBFB; border-radius: 14px; padding: 16px 18px;
}
.danger-card-title { font-size: 15px; font-weight: 600; color: #B91C1C; margin-bottom: 4px; }
.danger-card-desc { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.danger-card .btn { flex-shrink: 0; }

.tag { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 999px; font-weight: 600; }
.tag.on { background: #ECFDF5; color: #059669; }
.tag.off { background: #F3F4F6; color: #9CA3AF; }
.tag.feature { background: #EDE9FE; color: var(--primary); }
.tag.extended { background: #EFF6FF; color: #2563EB; }
.tag.full { background: #FEF2F2; color: var(--danger); }

/* ---------- 弹窗 ---------- */
.mask { position: fixed; inset: 0; background: rgba(31,41,55,.45); z-index: 50; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.dialog { width: 520px; max-width: 94vw; max-height: 88vh; overflow: auto; background: #fff; border-radius: 18px; padding: 26px; box-shadow: 0 24px 70px rgba(0,0,0,.22); }
.dialog h3 { font-size: 17px; margin-bottom: 18px; letter-spacing: .01em; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.form-row .input, .form-row .select { width: 100%; }
.check-group { display: flex; flex-wrap: wrap; gap: 8px; }
.check-item { border: 1.5px solid #E5E7EB; border-radius: 12px; padding: 7px 14px; cursor: pointer; font-size: 13px; user-select: none; transition: border-color .15s, background .15s; }
.check-item.checked { border-color: var(--primary); background: var(--bg); color: var(--primary); font-weight: 600; }
.dialog-btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%); z-index: 99;
  padding: 11px 22px; border-radius: 999px; color: #fff; font-size: 14px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.20); max-width: 80%;
}
.toast.success { background: linear-gradient(135deg, var(--primary-deep), var(--primary-2)); }
.toast.error { background: linear-gradient(135deg, #DC2626, #F87171); }
.toast.warning { background: linear-gradient(135deg, #D97706, #F59E0B); }

/* 手动锁定候选列表 */
.cand-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.cand-row:hover { background: var(--bg); }
.cand-row.disabled { opacity: .55; cursor: not-allowed; }
.cand-row .nm { font-weight: 600; min-width: 64px; }
.cand-row .cls { color: var(--text-2); font-size: 13px; min-width: 96px; }
.cand-row .ph { color: var(--text-2); font-size: 12px; margin-left: auto; }

/* 导入结果明细 */
.import-result { max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: 12px; }
.import-result .line { padding: 8px 12px; font-size: 13px; border-bottom: 1px solid #F5F3FF; }
.import-result .line.ok { color: #059669; }
.import-result .line.fail { color: var(--danger); }

.logo-preview { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }

/* 背景设置 */
.bg-preview {
  width: 72px; height: 46px; border-radius: 10px; border: 1.5px solid var(--border);
  background: var(--bg); object-fit: cover; flex-shrink: 0;
}
