/* ============================================================
   卡密管理平台 后台样式 v2
   配色：靛蓝主色 + 石板灰中性色；所有业务类名保持不变
   ============================================================ */
:root {
  --primary: #2563eb;
  --primary-2: #4f46e5;
  --ring: rgba(99, 102, 241, .16);
  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #64748b;
  --ink-4: #94a3b8;
  --line: #e2e8f0;
  --bg: #f1f5f9;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 14px rgba(15, 23, 42, .06);
  --shadow-lg: 0 4px 10px rgba(15, 23, 42, .06), 0 14px 34px rgba(15, 23, 42, .10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font: 14px/1.65 "Microsoft YaHei", "PingFang SC", -apple-system, "Segoe UI", sans-serif;
  color: var(--ink-2);
  background:
    radial-gradient(900px 320px at 50% -140px, rgba(79, 70, 229, .10), transparent 70%),
    var(--bg);
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; transition: color .15s; }
a:hover { text-decoration: none; color: var(--primary-2); }
::selection { background: #c7d2fe; color: var(--ink); }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(90deg, #0f172a, #1e293b 55%, #1e1b4b);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 2px 12px rgba(15, 23, 42, .28);
}
.topbar .wrap { display: flex; align-items: center; gap: 22px; height: 54px; }
.topbar .logo {
  font-size: 16px; font-weight: 700; letter-spacing: 1px; white-space: nowrap;
  display: flex; align-items: center; gap: 9px;
}
.topbar .logo::before {
  content: ""; width: 10px; height: 10px; border-radius: 3px; flex: none;
  background: linear-gradient(135deg, #60a5fa, #818cf8);
  box-shadow: 0 0 10px rgba(99, 102, 241, .9);
}
.topbar nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.topbar nav::-webkit-scrollbar { display: none; }
.topbar nav a {
  color: #94a3b8; padding: 6px 14px; border-radius: 999px; font-size: 13px;
  white-space: nowrap; transition: all .18s;
}
.topbar nav a:hover { color: #e2e8f0; background: rgba(255, 255, 255, .08); }
.topbar nav a.on {
  color: #fff; font-weight: 600;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 2px 8px rgba(59, 91, 219, .45);
}
.topbar .who { font-size: 13px; color: #64748b; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.topbar .who::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: #34d399; box-shadow: 0 0 6px #34d399; margin-right: 2px;
}
.topbar .who .out { color: #f87171; margin-left: 8px; padding: 3px 8px; border-radius: 6px; transition: all .15s; }
.topbar .who .out:hover { color: #fecaca; background: rgba(248, 113, 113, .14); text-decoration: none; }

/* ---------------- 布局 ---------------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 18px; }
.wrap.main { padding-top: 26px; padding-bottom: 56px; min-height: calc(100vh - 118px); }
.footer { text-align: center; color: var(--ink-4); font-size: 12px; padding: 18px 0 22px; }

h2 { font-size: 21px; font-weight: 700; margin-bottom: 4px; color: var(--ink); letter-spacing: .3px; }
h3 { font-size: 15px; font-weight: 600; margin-bottom: 14px; color: var(--ink-2); }
.wrap.main > h2 { padding-left: 12px; border-left: 4px solid var(--primary-2); border-radius: 2px; margin-bottom: 18px; line-height: 1.4; }

/* ---------------- 提示条 ---------------- */
.flash {
  padding: 11px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 13px;
  border: 1px solid transparent; display: flex; align-items: center; gap: 8px;
  animation: fadeDown .25s ease;
}
.flash::before { font-weight: 700; flex: none; }
.flash.ok { background: #ecfdf5; color: #047857; border-color: #a7f3d0; border-left-width: 4px; }
.flash.ok::before { content: "✓"; }
.flash.err { background: #fef2f2; color: #b91c1c; border-color: #fecaca; border-left-width: 4px; }
.flash.err::before { content: "✕"; }

/* ---------------- 面板 ---------------- */
.panel {
  background: var(--card); border: 1px solid rgba(226, 232, 240, .8);
  border-radius: var(--radius); padding: 22px; margin-bottom: 20px;
  box-shadow: var(--shadow); transition: box-shadow .2s;
}
.panel:hover { box-shadow: var(--shadow-lg); }
.panel.inner { background: #f8fafc; border: 1px dashed #cbd5e1; box-shadow: none; }
.panel.inner:hover { box-shadow: none; }

/* ---------------- 统计卡片 ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat {
  position: relative; background: var(--card); border: 1px solid rgba(226, 232, 240, .8);
  border-radius: var(--radius); padding: 18px 12px 14px; text-align: center;
  box-shadow: var(--shadow); overflow: hidden; transition: transform .18s, box-shadow .18s;
}
.stat::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #60a5fa, #6366f1);
}
.stat:nth-child(2)::before  { background: linear-gradient(90deg, #34d399, #10b981); }
.stat:nth-child(3)::before  { background: linear-gradient(90deg, #818cf8, #6366f1); }
.stat:nth-child(4)::before  { background: linear-gradient(90deg, #f87171, #ef4444); }
.stat:nth-child(5)::before  { background: linear-gradient(90deg, #38bdf8, #0ea5e9); }
.stat:nth-child(6)::before  { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.stat:nth-child(7)::before  { background: linear-gradient(90deg, #a78bfa, #8b5cf6); }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat b {
  display: block; font-size: 27px; line-height: 1.25; font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.stat span { font-size: 12px; color: var(--ink-3); }

/* ---------------- 表格 ---------------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; white-space: nowrap; }
th {
  color: var(--ink-3); font-weight: 600; font-size: 12px; letter-spacing: .4px;
  background: #f8fafc; border-bottom: 1px solid var(--line);
}
td { color: #3f4c63; border-bottom: 1px solid #eef2f7; }
tbody tr, table tr { transition: background .12s; }
tr:hover td { background: #f6f9ff; }
td.empty { text-align: center; color: var(--ink-4); padding: 30px 0; }
.mono { font-family: Consolas, "JetBrains Mono", "Courier New", monospace; font-size: 12.5px; }

/* ---------------- 标签 ---------------- */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.tag-ok { background: #ecfdf5; color: #059669; }
.tag-err { background: #fef2f2; color: #dc2626; }
.tag-i { background: #f1f5f9; color: var(--ink-3); }

/* ---------------- 表单 ---------------- */
.form-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin-bottom: 10px; }
.form-row label, .form-col label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 12px; font-weight: 500; color: var(--ink-3);
}
.form-col { display: flex; flex-direction: column; gap: 14px; max-width: 480px; }
input, select, textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 13px;
  font-family: inherit; background: #fff; outline: none; color: var(--ink);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: #b6c2d4; }
input:hover, select:hover, textarea:hover { border-color: #c4cfe0; }
input:focus, select:focus, textarea:focus {
  border-color: #6366f1; background: #fff;
  box-shadow: 0 0 0 3px var(--ring);
}
input.mini { width: 130px; padding: 4px 9px; font-size: 12px; }
textarea { resize: vertical; line-height: 1.7; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; border: 0; border-radius: 8px; padding: 9px 20px;
  font-size: 13px; font-weight: 600; letter-spacing: .5px; cursor: pointer;
  box-shadow: 0 2px 8px rgba(59, 91, 219, .32);
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.btn:hover {
  transform: translateY(-1px); filter: brightness(1.06); text-decoration: none;
  box-shadow: 0 5px 14px rgba(59, 91, 219, .42); color: #fff;
}
.btn:active { transform: translateY(0); box-shadow: 0 2px 6px rgba(59, 91, 219, .35); }
.lk {
  background: none; border: 0; color: var(--primary); cursor: pointer;
  font-size: 12px; padding: 3px 8px; border-radius: 6px; transition: all .13s;
}
.lk:hover { background: #eef2ff; color: var(--primary-2); text-decoration: none; }
.lk.err { color: #dc2626; }
.lk.err:hover { background: #fef2f2; color: #b91c1c; }
.inline { display: inline; }
.ops form { display: inline-flex; gap: 2px; align-items: center; }

/* ---------------- 其他 ---------------- */
.hint {
  font-size: 12px; color: var(--ink-4); margin-top: 12px; line-height: 1.9;
  padding: 10px 14px; background: #f8fafc; border-radius: 8px; border: 1px solid #eef2f7;
}
code.mono {
  background: #eef2ff; color: #4338ca; padding: 2px 7px; border-radius: 5px;
  font-size: 12px; word-break: break-all;
}

/* ---------------- 登录页 ---------------- */
.login-body {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 24px 16px;
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 48%, #312e81 100%);
}
.login-deco {
  position: absolute; border-radius: 50%; pointer-events: none; filter: blur(70px);
  animation: float 14s ease-in-out infinite alternate;
}
.login-deco.d1 { width: 420px; height: 420px; left: -120px; top: -140px; background: rgba(99, 102, 241, .38); }
.login-deco.d2 { width: 520px; height: 520px; right: -180px; bottom: -220px; background: rgba(37, 99, 235, .30); animation-delay: -6s; }
.login-deco.d3 { width: 200px; height: 200px; right: 14%; top: 12%; background: rgba(56, 189, 248, .20); animation-delay: -10s; }

.login-card {
  position: relative; z-index: 1; width: 372px; max-width: 100%;
  background: rgba(255, 255, 255, .97);
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 20px; padding: 40px 36px 34px;
  box-shadow: 0 30px 70px rgba(2, 6, 23, .5), 0 2px 0 rgba(255, 255, 255, .35) inset;
  text-align: center;
  animation: rise .45s cubic-bezier(.22, .9, .36, 1);
}
.login-logo {
  width: 62px; height: 62px; margin: 0 auto 16px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: #fff; font-size: 26px; font-weight: 700;
  box-shadow: 0 10px 24px rgba(59, 91, 219, .45);
}
.login-card h1 { font-size: 20px; color: var(--ink); margin-bottom: 5px; letter-spacing: .5px; }
.login-sub { font-size: 12px; color: var(--ink-4); margin-bottom: 26px; letter-spacing: 2px; }
.login-card form { text-align: left; }
.login-card input {
  width: 100%; padding: 11px 14px; margin-bottom: 14px; border-radius: 10px;
  background: #f8fafc; font-size: 14px;
}
.login-card input:focus { background: #fff; }
.login-btn { width: 100%; padding: 12px; font-size: 14px; margin-top: 6px; }
.login-card .flash { text-align: left; }
.login-foot {
  position: relative; z-index: 1; margin-top: 26px;
  color: rgba(226, 232, 240, .38); font-size: 12px; letter-spacing: 1px;
}

/* ---------------- 动画 ---------------- */
@keyframes rise { from { opacity: 0; transform: translateY(22px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes float { from { transform: translate(0, 0) scale(1); } to { transform: translate(40px, 30px) scale(1.12); } }

/* ---------------- 响应式 ---------------- */
@media (max-width: 860px) {
  .topbar .wrap { gap: 12px; padding: 0 14px; }
  .topbar .logo { font-size: 15px; }
  .wrap.main { padding-top: 20px; }
  .panel { padding: 16px; }
  .stat b { font-size: 22px; }
  th, td { padding: 9px 8px; }
  .panel { overflow-x: auto; }
}
