/* ============================================================
   后台样式
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: #f3f5f9; color: #2c2c2c; font-size: 14px;
}
a { color: #1a4ca0; text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  background: #1a4ca0;
  color: #fff;
  flex-shrink: 0;
}
.sidebar .brand { padding: 20px 18px; font-size: 16px; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,0.12); }
.sidebar .brand small { display: block; font-size: 11px; font-weight: 400; opacity: 0.7; margin-top: 2px; }
.sidebar .menu { padding: 14px 0; }
.sidebar .menu a {
  display: block;
  color: #fff;
  padding: 11px 20px;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: background 0.12s;
}
.sidebar .menu a.active { background: rgba(255,255,255,0.12); border-left-color: #fff; }
.sidebar .menu a:hover { background: rgba(255,255,255,0.08); text-decoration: none; }
.sidebar .logout { margin-top: 30px; padding: 0 18px; }
.sidebar .logout a {
  display: block; padding: 9px 12px;
  background: rgba(255,255,255,0.12);
  border-radius: 6px;
  color: #fff;
  text-align: center;
  font-size: 13px;
}

.main { flex: 1; padding: 24px 28px; min-width: 0; }
.main .page-title { font-size: 22px; font-weight: 700; margin-bottom: 18px; color: #1a4ca0; }
.main .page-desc { color: #666; margin-bottom: 18px; font-size: 13px; }

/* Stat cards */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { background: #fff; border-radius: 10px; padding: 16px 18px; box-shadow: 0 2px 6px rgba(0,0,0,0.05); }
.stat-card .label { color: #888; font-size: 12px; }
.stat-card .value { font-size: 28px; font-weight: 700; margin-top: 6px; color: #1a4ca0; }
.stat-card .bar  { display: flex; height: 6px; border-radius: 3px; overflow: hidden; margin-top: 8px; background: #f0f0f0; }
.stat-card .bar > span { display: block; }

/* Cat stat */
.cat-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 22px; }
.cat-stat {
  background: #fff;
  border-radius: 10px;
  padding: 14px 14px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.cat-stat .ic {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.cat-stat .info { flex: 1; min-width: 0; }
.cat-stat .name { font-size: 13px; color: #666; }
.cat-stat .num  { font-size: 20px; font-weight: 700; color: #2c2c2c; }

/* Filter / Toolbar */
.toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: #fff;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.toolbar select, .toolbar input[type=text] {
  padding: 8px 12px;
  border: 1px solid #d8dde6;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
}
.toolbar button, .toolbar a.btn {
  padding: 8px 16px;
  background: #1a4ca0;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.toolbar button:hover, .toolbar a.btn:hover { background: #153d80; text-decoration: none; }
.toolbar button.gray { background: #6c757d; }
.toolbar button.danger { background: #dc3545; }

/* Table */
.table-wrap { background: #fff; border-radius: 10px; overflow: auto; box-shadow: 0 2px 6px rgba(0,0,0,0.05); }
table { width: 100%; border-collapse: collapse; min-width: 700px; }
table th, table td { padding: 11px 12px; text-align: left; font-size: 13px; }
table thead { background: #f7f9fc; }
table th { font-weight: 700; color: #555; border-bottom: 1px solid #e5e8ef; }
table tbody tr { border-bottom: 1px solid #f0f2f6; }
table tbody tr:hover { background: #f9fafc; }
table td.rank { font-weight: 700; color: #1a4ca0; width: 60px; }
table td .pic-thumb { width: 70px; height: 50px; object-fit: cover; border-radius: 4px; background: #eee; }
table td .pill { display: inline-block; padding: 2px 8px; border-radius: 100px; background: #f0f4ff; color: #1a4ca0; font-size: 11px; margin-right: 4px; }

/* Login */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1a4ca0 0%, #2670d8 100%);
}
.login-card {
  width: 360px;
  background: #fff;
  border-radius: 12px;
  padding: 32px 28px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}
.login-card h1 { font-size: 20px; margin-bottom: 4px; color: #1a4ca0; }
.login-card p.sub { font-size: 12px; color: #888; margin-bottom: 22px; }
.login-card label { display: block; font-size: 12px; color: #555; margin: 12px 0 6px; }
.login-card input { width: 100%; padding: 11px 12px; border: 1px solid #d8dde6; border-radius: 6px; font-size: 14px; }
.login-card input:focus { outline: none; border-color: #1a4ca0; }
.login-card button { width: 100%; margin-top: 20px; padding: 12px; background: #1a4ca0; color: #fff; border: none; border-radius: 6px; font-size: 15px; font-weight: 700; cursor: pointer; }
.login-card .err { background: #ffe7eb; color: #c92e44; padding: 8px 12px; border-radius: 6px; font-size: 12px; margin-bottom: 10px; }

/* Mobile */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; }
  .sidebar .menu { display: flex; flex-wrap: wrap; padding: 0; }
  .sidebar .menu a { flex: 1; min-width: 33%; text-align: center; border-left: none; border-bottom: 3px solid transparent; padding: 12px 8px; font-size: 13px; }
  .sidebar .menu a.active { border-bottom-color: #fff; border-left-color: transparent; }
  .sidebar .logout { margin: 8px; }
  .main { padding: 16px; }
  table { min-width: 600px; }
}
