/* ============ 设计令牌 ============ */
:root {
  --bg: #0b0e14;
  --bg-2: #0f1320;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.06);
  --surface-hover: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e6e9ef;
  --text-dim: #8b93a7;
  --text-faint: #5b6479;
  --accent: #6366f1;
  --accent-2: #22d3ee;
  --accent-grad: linear-gradient(135deg, #6366f1 0%, #22d3ee 100%);
  --success: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 80% -10%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(34, 211, 238, 0.12), transparent 55%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

/* ============ 登录页 ============ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}
.login-brand {
  flex: 1.1;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(34, 211, 238, 0.12)),
    #0c1020;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  border-right: 1px solid var(--border);
  padding: 48px 64px;
}
.login-brand::before {
  content: "";
  position: absolute;
  width: 520px; height: 520px;
  right: -160px; top: -160px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.35), transparent 60%);
  filter: blur(20px);
}
.login-brand::after {
  content: "";
  position: absolute;
  width: 420px; height: 420px;
  left: -120px; bottom: -140px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.28), transparent 60%);
  filter: blur(20px);
}
.brand-logo { align-self: flex-start; position: relative; z-index: 1; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--accent-grad);
  display: grid; place-items: center;
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.45);
}
.brand-mark svg { width: 24px; height: 24px; }
.brand-logo .logo-box {
  display: inline-flex; align-items: center; justify-content: center;
}
.brand-logo-img { max-width: 420px; max-height: 120px; object-fit: contain; display: block; }
.brand-center { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; z-index: 1; }
.brand-title { font-size: 36px; font-weight: 800; line-height: 1.4; text-align: center; letter-spacing: 1px; }
.brand-name { font-size: 20px; font-weight: 700; letter-spacing: .5px; }
.brand-tag { color: var(--text-dim); font-size: 13px; margin-top: 2px; }

.brand-hero { position: relative; z-index: 1; max-width: 460px; margin-top: 48px; }
.brand-hero h1 {
  font-size: 38px; font-weight: 800; line-height: 1.2; margin-bottom: 16px;
}
.brand-hero p { color: var(--text-dim); font-size: 15px; }
.brand-points { margin-top: 28px; display: flex; flex-direction: column; gap: 14px; }
.brand-point { display: flex; align-items: center; gap: 12px; color: var(--text); font-size: 14px; }
.brand-point .dot {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  background: var(--surface-2); border: 1px solid var(--border);
  display: grid; place-items: center; color: var(--accent-2);
}
.brand-foot { position: absolute; left: 0; right: 0; bottom: 28px; text-align: center; z-index: 1; color: var(--text-faint); font-size: 12px; }

.login-panel {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.login-card {
  width: 100%; max-width: 380px;
}
.login-card h2 { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.login-card .sub { color: var(--text-dim); font-size: 14px; margin-bottom: 32px; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 8px; }
.input {
  width: 100%; height: 48px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 15px;
  transition: border-color .2s, background .2s, box-shadow .2s;
  outline: none;
}
.input::placeholder { color: var(--text-faint); }
.input:focus {
  border-color: var(--accent);
  background: var(--surface-2);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}
.field-error {
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #fca5a5; font-size: 13px; padding: 10px 12px;
  border-radius: var(--radius-sm); margin-bottom: 18px;
}
.row-between { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.remember { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); cursor: pointer; }
.remember input { accent-color: var(--accent); width: 15px; height: 15px; }
.link { color: var(--accent-2); font-size: 13px; }

.btn {
  width: 100%; height: 48px; border: none; border-radius: var(--radius-sm);
  background: var(--accent-grad); color: #fff; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: transform .12s, box-shadow .2s, opacity .2s;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.35);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 14px 36px rgba(99, 102, 241, 0.45); }
.btn:active { transform: translateY(0); }
.btn-ghost {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  box-shadow: none;
}
.btn-ghost:hover { background: var(--surface-hover); }
.btn-sm { width: auto; height: 36px; padding: 0 16px; font-size: 13px; border-radius: 8px; }
.btn-danger { background: rgba(248,113,113,.15); color: #fca5a5; border: 1px solid rgba(248,113,113,.35); box-shadow: none; }
.btn-danger:hover { background: rgba(248,113,113,.25); }

/* ============ 通用布局 ============ */
.topbar {
  height: 64px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; border-bottom: 1px solid var(--border);
  background: rgba(11, 14, 20, 0.6); backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 20;
}
.topbar .brand-mini { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.topbar .brand-mark {
  width: 40px; height: 40px; border-radius: 10px;
  background: transparent; box-shadow: none;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.topbar .brand-mark svg { width: 18px; height: 18px; }
.topbar-logo-img { width: 100%; height: 100%; object-fit: contain; }
.user-chip { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--accent-grad);
  display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 15px;
}
.user-meta { text-align: right; line-height: 1.2; }
.user-meta .nm { font-size: 14px; font-weight: 600; }
.user-meta .rl { font-size: 12px; color: var(--text-dim); }

.container { max-width: 1180px; margin: 0 auto; padding: 36px 28px 60px; }
.page-title { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.page-sub { color: var(--text-dim); font-size: 14px; margin-bottom: 28px; }

/* ============ 门户卡片网格 ============ */
.stat-row { display: flex; gap: 16px; margin-bottom: 32px; flex-wrap: wrap; }
.stat {
  flex: 1; min-width: 180px; padding: 18px 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.stat .k { color: var(--text-dim); font-size: 13px; }
.stat .v { font-size: 28px; font-weight: 800; margin-top: 6px; }

.section-label { font-size: 15px; font-weight: 600; margin: 8px 0 18px; color: var(--text); }
.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.sys-card {
  position: relative; padding: 24px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; transition: transform .15s, border-color .2s, background .2s;
  overflow: hidden;
}
.sys-card:hover {
  transform: translateY(-4px); border-color: var(--border-strong);
  background: var(--surface-2);
}
.sys-card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(99,102,241,.10), transparent 50%);
  opacity: 0; transition: opacity .2s;
}
.sys-card:hover::after { opacity: 1; }
.sys-icon {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  background: var(--accent-grad); color: #fff; margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(99,102,241,.35); position: relative; z-index: 1;
}
.sys-icon svg { width: 26px; height: 26px; }
.sys-name { font-size: 16px; font-weight: 700; position: relative; z-index: 1; }
.sys-desc { font-size: 13px; color: var(--text-dim); margin-top: 4px; position: relative; z-index: 1; }
.empty {
  padding: 60px 20px; text-align: center; color: var(--text-dim);
  border: 1px dashed var(--border); border-radius: var(--radius);
}

/* ============ 管理后台 ============ */
.admin-shell { display: flex; min-height: calc(100vh - 64px); }
.sidebar {
  width: 232px; flex: none; border-right: 1px solid var(--border);
  padding: 22px 16px; background: rgba(255,255,255,.02);
}
.sidebar .nav-title { font-size: 12px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 1px; margin: 6px 8px 12px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px;
  color: var(--text-dim); font-size: 14px; font-weight: 500; margin-bottom: 4px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--accent-grad); color: #fff; box-shadow: 0 6px 18px rgba(99,102,241,.35); }
.nav-item svg { width: 18px; height: 18px; }
.admin-main { flex: 1; padding: 30px 34px; overflow: auto; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; margin-bottom: 22px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.card-head h3 { font-size: 17px; font-weight: 700; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 12px 14px; font-size: 14px; border-bottom: 1px solid var(--border); }
.table th { color: var(--text-dim); font-weight: 600; font-size: 13px; }
.table tr:hover td { background: var(--surface); }
.tag {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
}
.tag.on { background: rgba(52,211,153,.14); border-color: rgba(52,211,153,.4); color: var(--success); }
.tag.off { background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.35); color: var(--danger); }
.tag.admin { background: rgba(99,102,241,.16); border-color: rgba(99,102,241,.45); color: #a5b4fc; }

.form-inline { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.form-inline .field { margin-bottom: 0; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* 复选网格 */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 10px; }
.check-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.check-item:hover { border-color: var(--border-strong); }
.check-item input { accent-color: var(--accent); width: 16px; height: 16px; }
.check-item .meta { line-height: 1.3; }
.check-item .meta .n { font-size: 14px; font-weight: 600; }
.check-item .meta .d { font-size: 12px; color: var(--text-dim); }

/* 提示 */
.flash-wrap { margin-bottom: 18px; }
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 8px;
  border: 1px solid transparent;
}
.alert.success { background: rgba(52,211,153,.12); border-color: rgba(52,211,153,.4); color: #6ee7b7; }
.alert.danger { background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.4); color: #fca5a5; }

.muted { color: var(--text-dim); font-size: 13px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
@media (max-width: 860px) {
  .login-brand { display: none; }
  .sidebar { display: none; }
}
