/* ============================================================
   后台管理专用样式
   ============================================================ */
.admin-body {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* ---- 侧边栏 ---- */
.admin-sidebar {
  width: 230px;
  background: #111827;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  position: sticky;
  top: 0;
  height: 100vh;
}
.admin-brand {
  padding: 0 22px 20px;
  font-size: 18px;
  font-weight: 700;
  border-bottom: 1px solid #1f2937;
}
.admin-brand a { color: #fff; display: flex; align-items: center; gap: 8px; }
.admin-nav { display: flex; flex-direction: column; padding: 12px 0; flex: 1; }
.admin-nav a {
  padding: 11px 22px;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .15s;
}
.admin-nav a:hover { background: #1f2937; color: #fff; }
.admin-nav a.active {
  background: #1f2937;
  color: #fff;
  border-left-color: var(--primary);
}
.admin-nav-bottom {
  padding: 16px 22px;
  border-top: 1px solid #1f2937;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-link {
  color: #9ca3af;
  font-size: 13px;
  padding: 4px 0;
}
.admin-link:hover { color: #fff; }

/* ---- 主区 ---- */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.admin-topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-page-title { font-size: 18px; font-weight: 700; margin: 0; }
.admin-user { font-size: 13px; color: var(--text-soft); }
.admin-content { padding: 24px 28px; overflow: auto; }

/* ---- 统计卡片 ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 13px; color: var(--text-soft); }
.stat-value { font-size: 28px; font-weight: 800; margin-top: 4px; color: var(--text); }
.stat-success .stat-value { color: var(--success); }
.stat-fail .stat-value { color: var(--danger); }

/* ---- 条形图 ---- */
.bar-chart { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 12px; }
.bar-label { width: 130px; font-size: 13px; color: var(--text-soft); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 18px; background: var(--bg-soft); border-radius: 9px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #7c3aed); border-radius: 9px; min-width: 2px; transition: width .4s; }
.bar-value { width: 36px; font-size: 13px; font-weight: 600; color: var(--text); }

/* ---- 数据表 ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg-soft);
  color: var(--text-soft);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.data-table tr:hover td { background: #fafbfd; }
.cell-ellipsis { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-tag {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.cat-badge {
  display: inline-block;
  background: var(--bg-soft);
  color: var(--text-soft);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  text-transform: uppercase;
}
.status-badge { padding: 2px 9px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.status-success { background: var(--success-soft); color: #166534; }
.status-fail { background: var(--danger-soft); color: #991b1b; }

/* ---- 表单 ---- */
.page-hint { color: var(--text-soft); font-size: 14px; margin: 0 0 16px; }
.form-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.form-label-text { font-size: 13px; font-weight: 600; color: var(--text-soft); }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 16px; }
.form-actions { margin-top: 8px; }
.narrow-form { max-width: 420px; }

/* 参数表单（后台） */
.params-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; gap: 16px; }
.params-head h2 { margin: 0 0 4px; font-size: 18px; }
.param-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.param-form-grid .form-label { margin-bottom: 0; }
.param-default { font-size: 12px; color: var(--muted); }

/* ---- 日志筛选 ---- */
.logs-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.filter-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filter-form select { width: auto; min-width: 140px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; }
.page-info { font-size: 13px; color: var(--text-soft); }

/* ---- 登录页 ---- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1e3a8a, #2563eb 50%, #7c3aed);
  padding: 20px;
}
.login-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-brand { font-size: 20px; font-weight: 700; margin-bottom: 6px; text-align: center; }
.login-title { text-align: center; margin: 8px 0 18px; font-size: 22px; }
.login-hint { text-align: center; color: var(--text-soft); font-size: 13px; margin-bottom: 20px; }
.login-back { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; font-size: 13px; }

/* 响应式 */
@media (max-width: 720px) {
  .admin-sidebar { width: 60px; }
  .admin-brand { font-size: 0; padding: 0 0 16px; text-align: center; }
  .admin-brand a { justify-content: center; }
  .admin-nav a { padding: 14px 0; text-align: center; font-size: 0; }
  .admin-nav-bottom { padding: 12px 0; align-items: center; }
  .admin-link { font-size: 0; }
}
