/* ============ 授权端管理后台 · 粉紫校园风 ============ */
:root {
  --p1: #a78bfa;
  --p2: #f0abfc;
  --p3: #818cf8;
  --grad: linear-gradient(135deg, #8b5cf6 0%, #c084fc 50%, #f0abfc 100%);
  --grad-soft: linear-gradient(135deg, #f5f3ff 0%, #fdf4ff 100%);
  --ink: #3b2a5c;
  --ink-2: #6d5a94;
  --line: #e9e3f7;
  --card: #ffffff;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --shadow: 0 8px 30px rgba(139, 92, 246, .12);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--grad-soft);
  color: var(--ink);
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; flex-shrink: 0;
  background: linear-gradient(180deg, #6d28d9 0%, #a21caf 100%);
  color: #fff; padding: 22px 14px;
  display: flex; flex-direction: column;
}
.brand { font-size: 19px; font-weight: 700; letter-spacing: 1px; padding: 0 10px 20px; }
.brand small { display: block; font-size: 11px; font-weight: 400; opacity: .75; margin-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; margin: 4px 0; border-radius: 12px;
  font-size: 14px; color: rgba(255,255,255,.85);
  transition: all .25s ease;
}
.nav-item:hover { background: rgba(255,255,255,.14); transform: translateX(3px); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.22); color: #fff; font-weight: 600; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
.nav-ico { width: 20px; text-align: center; }
.nav-logout { margin-top: auto; color: rgba(255,255,255,.7); }
.main { flex: 1; padding: 26px 30px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.page-title { font-size: 22px; font-weight: 700; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.who-wrap { position: relative; }
.who {
  font-size: 13px; color: var(--ink-2); cursor: pointer; user-select: none;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 12px; background: var(--card);
  box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s;
}
.who:hover { transform: translateY(-1px); box-shadow: 0 10px 32px rgba(139, 92, 246, .2); }
.who-caret { font-size: 10px; color: var(--p1); transition: transform .25s; }
.who-wrap.open .who-caret { transform: rotate(180deg); }
.who-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 148px; z-index: 60;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 16px 44px rgba(109, 40, 217, .18); padding: 6px;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .22s ease, transform .22s ease, visibility .22s;
}
.who-wrap.open .who-menu { opacity: 1; visibility: visible; transform: none; }
.who-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 12px; border: 0; border-radius: 10px; background: transparent;
  font-size: 13px; color: var(--ink); font-family: inherit; cursor: pointer;
  transition: background .18s, color .18s;
}
.who-item:hover { background: var(--grad-soft); color: #7c3aed; }
.wi-ico { color: var(--p1); font-size: 14px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border-radius: 18px; box-shadow: var(--shadow);
  padding: 20px 22px; margin-bottom: 20px;
  animation: rise .5s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.card:hover { box-shadow: 0 12px 36px rgba(139, 92, 246, .18); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: var(--card); border-radius: 16px; padding: 18px 20px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
  animation: rise .5s ease both;
}
.stat-card::after {
  content: ""; position: absolute; right: -22px; top: -22px; width: 78px; height: 78px;
  border-radius: 50%; background: var(--grad); opacity: .12;
}
.stat-num { font-size: 30px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat-label { font-size: 13px; color: var(--ink-2); margin-top: 4px; }

/* ---------- 表格 ---------- */
table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.grid th { text-align: left; padding: 10px 12px; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid var(--line); white-space: nowrap; }
.grid td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; word-break: break-all; }
.grid tbody tr { transition: background .2s; }
.grid tbody tr:hover { background: #faf7ff; }
.muted { color: #9d8fbf; font-size: 12px; }

/* ---------- 徽标 ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.ok { background: #dcfce7; color: #15803d; }
.badge.off { background: #fee2e2; color: #b91c1c; }
.badge.tag { background: #ede9fe; color: #6d28d9; }
.badge.warn { background: #fef3c7; color: #b45309; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border: none; border-radius: 12px; cursor: pointer;
  font-size: 13px; font-weight: 600; transition: all .22s ease;
  background: #f1ecfd; color: var(--ink);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(139,92,246,.25); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--grad); color: #fff; }
.btn.danger { background: #fde8e8; color: #b91c1c; }
.btn.ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--line); }
.btn.sm { padding: 5px 11px; font-size: 12px; border-radius: 9px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 11px;
  font-size: 13.5px; color: var(--ink); background: #fff; outline: none;
  transition: border .2s, box-shadow .2s; font-family: inherit;
}
.input:focus { border-color: var(--p1); box-shadow: 0 0 0 3px rgba(167,139,250,.18); }
textarea.input { min-height: 110px; resize: vertical; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 400; color: var(--ink); cursor: pointer; }

/* ---------- 弹窗 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(59,42,92,.42); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; z-index: 90;
}
.mask.show { display: flex; }
.modal {
  width: 560px; max-width: calc(100vw - 40px); max-height: 86vh; overflow: auto;
  background: #fff; border-radius: 20px; padding: 24px 26px;
  box-shadow: 0 24px 70px rgba(109,40,217,.3);
  animation: pop .3s ease both;
}
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(10px); } to { opacity: 1; transform: none; } }
.modal h3 { font-size: 17px; margin-bottom: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------- 提示 ---------- */
#toast-box { position: fixed; top: 22px; right: 22px; z-index: 99; display: flex; flex-direction: column; gap: 10px; }
.toast {
  padding: 12px 18px; border-radius: 13px; font-size: 13.5px; color: #fff;
  box-shadow: 0 10px 30px rgba(0,0,0,.18); animation: slidein .35s ease both;
  max-width: 360px;
}
.toast.ok { background: linear-gradient(135deg, #10b981, #34d399); }
.toast.err { background: linear-gradient(135deg, #ef4444, #f87171); }
.toast.info { background: var(--grad); }
@keyframes slidein { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 45%, #ec4899 100%);
  position: relative; overflow: hidden;
}
.login-wrap::before, .login-wrap::after {
  content: ""; position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.12); animation: floaty 7s ease-in-out infinite;
}
.login-wrap::before { width: 340px; height: 340px; left: -80px; top: -80px; }
.login-wrap::after { width: 260px; height: 260px; right: -60px; bottom: -60px; animation-delay: 2s; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(24px); } }
.login-card {
  position: relative; z-index: 2; width: 380px; max-width: calc(100vw - 40px);
  background: rgba(255,255,255,.96); border-radius: 24px; padding: 38px 36px;
  box-shadow: 0 30px 80px rgba(50,10,90,.35); animation: rise .6s ease both;
}
.login-card h1 { font-size: 22px; text-align: center; margin-bottom: 6px; }
.login-card .sub { text-align: center; color: var(--ink-2); font-size: 13px; margin-bottom: 26px; }
.login-card .btn.primary { width: 100%; padding: 12px; font-size: 15px; border-radius: 13px; }

/* ---------- 其它 ---------- */
.empty { text-align: center; color: #9d8fbf; padding: 34px 0; font-size: 13.5px; }
.kv { font-size: 12.5px; line-height: 1.9; }
.kv b { color: var(--ink-2); font-weight: 600; }
code.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: #f5f2fd; padding: 2px 7px; border-radius: 7px; color: #6d28d9; }
.section-h { font-size: 15px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.section-h::before { content: ""; width: 4px; height: 16px; border-radius: 3px; background: var(--grad); }

/* ---------- 智能更新 ---------- */
.upd-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.upd-item {
  background: var(--grad-soft); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 16px; display: flex; flex-direction: column; gap: 6px;
  transition: transform .2s, box-shadow .2s;
}
.upd-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.upd-k { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.upd-v { font-size: 13.5px; color: var(--ink); word-break: break-all; }
.log-list { list-style: none; max-height: 52vh; overflow: auto; padding-right: 4px; }
.log-list li {
  font-size: 13px; line-height: 1.7; color: var(--ink);
  padding: 8px 12px; border-radius: 10px; margin-bottom: 4px;
}
.log-list li:nth-child(odd) { background: var(--grad-soft); }
.log-list li b { color: #7c3aed; }
