/* ==========================================================================
   管理后台样式：深色侧边栏 + 浅色内容区（Bootstrap 5 之上，只做增量）
   ========================================================================== */

:root {
  --sidebar-w: 240px;
  --sidebar-bg: #0f172a;
  --sidebar-bg-2: #111c33;
  --sidebar-fg: #9aa7bd;
  --sidebar-fg-active: #ffffff;
  --accent: #3b82f6;
  --page-bg: #f4f6f9;
  --card-border: #e6e9ef;
}

* { -webkit-font-smoothing: antialiased; }

body {
  font-family: "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background: var(--page-bg);
  color: #1f2937;
  font-size: 0.9rem;
}

/* ---------------------------------------------------------------- 布局骨架 */

.admin-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: radial-gradient(1200px 400px at -10% 0%, #1b2a4a 0%, transparent 60%), var(--sidebar-bg);
  color: var(--sidebar-fg);
  display: flex;
  flex-direction: column;
  padding: 0.9rem 0.75rem 0.75rem;
  overflow-y: auto;
  z-index: 1040;
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.5rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  margin-bottom: 0.75rem;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  font-size: 1.05rem;
  box-shadow: 0 6px 14px rgba(59, 130, 246, 0.32);
  flex: 0 0 auto;
}

.brand-mark-lg { width: 46px; height: 46px; border-radius: 12px; font-size: 1.4rem; }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { color: #fff; font-size: 0.95rem; letter-spacing: 0.02em; }
.brand-text small { color: #7f8da6; font-size: 0.72rem; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; }

.nav-label {
  color: #5d6b83;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.85rem 0.6rem 0.3rem;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--sidebar-fg);
  padding: 0.52rem 0.65rem;
  border-radius: 8px;
  font-size: 0.86rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-nav .nav-link i { font-size: 1rem; width: 1.1rem; text-align: center; opacity: 0.9; }
.sidebar-nav .nav-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }

.sidebar-nav .nav-link.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.22), rgba(59, 130, 246, 0.06));
  color: var(--sidebar-fg-active);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-foot {
  margin-top: 1rem;
  padding: 0.75rem 0.5rem 0.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  flex: 0 0 auto;
}

.content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.25rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--card-border);
}

.content-body { padding: 1.15rem 1.25rem 2rem; flex: 1 1 auto; }

.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 8px 0 30px rgba(15, 23, 42, 0.35);
  }
  .sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1030;
  }
  .content { margin-left: 0; }
  .content-body { padding: 0.9rem 0.85rem 1.6rem; }
}

/* ---------------------------------------------------------------- 卡片 / 统计 */

.card {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.card-header {
  background: #fff;
  border-bottom: 1px solid var(--card-border);
  font-size: 0.86rem;
  font-weight: 600;
  color: #334155;
  padding: 0.7rem 0.9rem;
}

.card-body { padding: 0.95rem; }

.stat-card {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  height: 100%;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0.85rem 0.9rem;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  color: inherit;
  text-decoration: none;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.stat-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.08);
  border-color: #cbd5e1;
  color: inherit;
}

.stat-alert { border-color: #fecaca; background: linear-gradient(180deg, #fff, #fff7f7); }

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  flex: 0 0 auto;
}

.stat-body { min-width: 0; }
.stat-value { font-size: 1.42rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.01em; }
.stat-label { font-size: 0.78rem; color: #64748b; }
.stat-hint { font-size: 0.7rem; color: #94a3b8; margin-top: 1px; }

.mini-stat {
  display: block;
  background: #f8fafc;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.mini-stat:hover { border-color: #cbd5e1; background: #f1f5f9; color: inherit; }
.mini-value { font-size: 1.2rem; font-weight: 700; color: #0f172a; line-height: 1.2; }
.mini-stat-row { padding: 0.55rem 0.8rem; }

/* ---------------------------------------------------------------- 柱状图 */

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.55rem;
  height: 180px;
  padding-top: 1.2rem;
}

.bar-col {
  flex: 1 1 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.bar {
  width: 100%;
  max-width: 44px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  transition: filter 0.15s ease;
  min-height: 0;
}

.bar-col:hover .bar { filter: brightness(1.08); }
.bar-value { font-size: 0.7rem; color: #475569; }
.bar-label { font-size: 0.7rem; color: #94a3b8; }

/* ---------------------------------------------------------------- 表格 */

.table { font-size: 0.83rem; }
.table > thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #7c8798;
  font-weight: 600;
  background: #fbfcfd;
  white-space: nowrap;
  border-bottom: 1px solid var(--card-border);
}
.table > tbody > tr > td { vertical-align: middle; }
.table > :not(caption) > * > *:first-child { padding-left: 0.95rem; }
.table > :not(caption) > * > *:last-child { padding-right: 0.95rem; }
.table-hover > tbody > tr:hover > * { background: #f7f9fc; }
.table-fixed-ish th { white-space: nowrap; }

.row-danger > td { background: rgba(220, 38, 38, 0.045) !important; }
.row-danger > td:first-child { box-shadow: inset 3px 0 0 #dc2626; }

.card-key {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: #0f172a;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 0.05rem 0.35rem;
  border-radius: 5px;
}

.pw-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: #334155;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 0.05rem 0.35rem;
  border-radius: 5px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
}

.row-actions .btn { white-space: nowrap; }

.payload-pre {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font-size: 0.72rem;
  line-height: 1.45;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ---------------------------------------------------------------- 分页 / 提示 */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.9rem;
  border-top: 1px solid var(--card-border);
  flex-wrap: wrap;
}

.pager .pagination { margin-bottom: 0; }
.pager .page-link { color: #43506b; border-color: #e2e8f0; }
.pager .page-item.active .page-link { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }

.alert { border-radius: 10px; border-width: 1px; font-size: 0.84rem; }
.badge { font-weight: 600; letter-spacing: 0.01em; }

.copied { color: #16a34a !important; }

/* ---------------------------------------------------------------- 登录页 */

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(900px 480px at 12% 8%, rgba(59, 130, 246, 0.22), transparent 60%),
    radial-gradient(700px 420px at 88% 92%, rgba(99, 102, 241, 0.18), transparent 62%),
    #0b1120;
  padding: 1.5rem;
}

.login-wrap { width: 100%; max-width: 392px; }

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 1.9rem 1.75rem 1.35rem;
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.45);
}

.login-head { text-align: center; margin-bottom: 1.35rem; }
.login-head .brand-mark { margin: 0 auto 0.75rem; }
.login-head h1 { font-size: 1.12rem; font-weight: 700; margin: 0; color: #0f172a; }
.login-head p { margin: 0.3rem 0 0; font-size: 0.78rem; color: #94a3b8; letter-spacing: 0.04em; }

.login-card .form-label { font-size: 0.78rem; color: #475569; font-weight: 600; }
.login-card .form-control { border-color: #dbe1ea; }
.login-card .form-control:focus { border-color: #93b4f8; box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.12); }
.login-card .input-group-text { background: #f8fafc; border-color: #dbe1ea; color: #94a3b8; }

.login-foot {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 1.1rem;
  padding-top: 0.85rem;
  border-top: 1px solid #eef2f7;
}

.login-copy {
  text-align: center;
  color: #64748b;
  font-size: 0.72rem;
  margin: 1rem 0 0;
}

/* 滚动条（深色侧边栏） */
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 3px; }
