/* ===== 极简白色风格 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: #f7f8fa;
  color: #1a1a1a;
  min-height: 100vh;
  line-height: 1.6;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }

/* ===== 设计变量 ===== */
:root {
  --primary: #1a1a1a;
  --primary-hover: #333;
  --accent: #2563eb;
  --accent-light: #eff6ff;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
}

/* ===== 容器 ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 500;
  border: 1px solid transparent; cursor: pointer; transition: all .15s; white-space: nowrap;
  text-decoration: none; line-height: 1.5;
}
.btn-primary {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-accent {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.btn-accent:hover { background: #1d4ed8; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-warning:hover { background: #b45309; }
.btn-outline {
  background: #fff; color: var(--gray-700);
  border-color: var(--border);
}
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-300); }
.btn-ghost {
  background: transparent; color: var(--gray-600); border-color: transparent;
}
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-900); }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 6px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 5px; }
.btn-lg { padding: 10px 24px; font-size: 14px; border-radius: var(--radius); }

/* ===== 表单 ===== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--gray-700); margin-bottom: 5px;
}
.form-control {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 13px; color: var(--gray-900);
  background: #fff; transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}
.form-control::placeholder { color: var(--gray-400); }
.form-hint { font-size: 12px; color: var(--gray-400); margin-top: 4px; }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

/* ===== 卡片 ===== */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border-light);
}
.card-title { font-size: 14px; font-weight: 600; color: var(--gray-900); }
.card-body { padding: 20px; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600;
  color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--gray-50); border-bottom: 1px solid var(--border);
}
.table td {
  padding: 12px 14px; border-bottom: 1px solid var(--border-light);
  color: var(--gray-700); vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--gray-50); }

/* ===== 徽章 ===== */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 500;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-gray    { background: var(--gray-100);       color: var(--gray-500); }
.badge-primary { background: var(--accent-light);   color: var(--accent); }

/* ===== 提示框 ===== */
.alert {
  padding: 12px 16px; border-radius: var(--radius); font-size: 13px;
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px;
  border: 1px solid;
}
.alert-success { background: var(--success-light); color: #166534; border-color: #bbf7d0; }
.alert-danger  { background: var(--danger-light);  color: #991b1b; border-color: #fecaca; }
.alert-warning { background: var(--warning-light); color: #92400e; border-color: #fde68a; }
.alert-info    { background: var(--accent-light);  color: #1e40af; border-color: #bfdbfe; }

/* ===== 分页 ===== */
.pagination { display: flex; justify-content: center; gap: 4px; padding: 16px 0; }
.page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius); font-size: 13px;
  border: 1px solid var(--border); background: #fff; color: var(--gray-700);
  text-decoration: none; transition: all .15s;
}
.page-btn:hover { background: var(--gray-50); border-color: var(--gray-300); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== 模态框 ===== */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.3); align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: #fff; border-radius: var(--radius-lg); padding: 28px;
  width: 90%; max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.12);
  border: 1px solid var(--border);
  animation: modalIn .18s ease;
}
@keyframes modalIn {
  from { opacity:0; transform:translateY(8px); }
  to   { opacity:1; transform:translateY(0); }
}
.modal-title { font-size: 16px; font-weight: 600; color: var(--gray-900); margin-bottom: 6px; }
.modal-desc  { font-size: 13px; color: var(--gray-500); margin-bottom: 20px; line-height: 1.6; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ===== 空状态 ===== */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 64px 24px; text-align: center;
}
.empty-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--gray-100); display: flex; align-items: center;
  justify-content: center; font-size: 28px; margin-bottom: 16px;
}
.empty-title { font-size: 14px; font-weight: 600; color: var(--gray-700); margin-bottom: 4px; }
.empty-sub   { font-size: 13px; color: var(--gray-400); }

/* ===== Toast通知 ===== */
#toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 99999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  animation: toastIn .2s ease;
  min-width: 220px; max-width: 360px;
  background: #fff; border: 1px solid var(--border);
}
@keyframes toastIn {
  from { opacity:0; transform:translateX(16px); }
  to   { opacity:1; transform:translateX(0); }
}
.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-info    { border-left: 3px solid var(--accent); }

/* ===== 管理后台布局 ===== */
.admin-layout { display: flex; min-height: 100vh; }

/* 侧边栏 - 极简白色 */
.sidebar {
  width: 220px; flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  transition: transform .25s;
}
.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border-light);
}
.sidebar-logo-text {
  font-size: 15px; font-weight: 700; color: var(--gray-900); letter-spacing: -0.3px;
  display: flex; align-items: center; gap: 8px;
}
.sidebar-logo-text .logo-icon {
  width: 28px; height: 28px; background: var(--gray-900); border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; flex-shrink: 0;
}
.sidebar-logo-sub {
  font-size: 11px; color: var(--gray-400); margin-top: 3px; padding-left: 36px;
}
.sidebar-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.nav-section-label {
  font-size: 10px; font-weight: 600; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 10px 8px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 6px; font-size: 13px; font-weight: 500;
  color: var(--gray-600); text-decoration: none;
  transition: all .12s; margin-bottom: 1px;
}
.nav-item:hover { background: var(--gray-100); color: var(--gray-900); }
.nav-item.active {
  background: var(--gray-100); color: var(--gray-900); font-weight: 600;
}
.nav-item .nav-icon {
  font-size: 15px; width: 18px; text-align: center; flex-shrink: 0;
  opacity: 0.7;
}
.nav-item.active .nav-icon { opacity: 1; }
.nav-badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 10px;
}
.sidebar-footer {
  padding: 10px 8px 16px;
  border-top: 1px solid var(--border-light);
}

/* 主内容区 */
.admin-main {
  margin-left: 220px; flex: 1; display: flex; flex-direction: column; min-height: 100vh;
}
.admin-topbar {
  position: sticky; top: 0; z-index: 50;
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 52px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar-title { font-size: 14px; font-weight: 600; color: var(--gray-900); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.admin-content { flex: 1; padding: 24px; }

/* 统计卡片 */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px;
}
.stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
}
.stat-icon {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; margin-bottom: 12px;
  background: var(--gray-100);
}
.stat-label { font-size: 12px; color: var(--gray-400); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--gray-900); line-height: 1; }
.stat-sub { font-size: 11px; color: var(--gray-400); margin-top: 4px; }

/* 页面标题 */
.page-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px;
}
.page-title { font-size: 18px; font-weight: 700; color: var(--gray-900); }
.page-sub { font-size: 13px; color: var(--gray-400); margin-top: 2px; }

/* ===== 源码包上传区域 ===== */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--gray-50);
}
.upload-area:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.upload-area.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
}

/* ===== 汉堡菜单 ===== */
.hamburger {
  display: none; background: none; border: none; cursor: pointer; padding: 6px;
}
.hamburger span {
  display: block; width: 20px; height: 1.5px;
  background: var(--gray-700); margin: 4px 0; border-radius: 2px; transition: all .25s;
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.2); z-index: 99;
}
.sidebar-overlay.show { display: block; }

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .hamburger { display: flex; flex-direction: column; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .admin-content { padding: 16px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-card { padding: 14px 16px; }
  .stat-value { font-size: 20px; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== 分割线 ===== */
.divider {
  height: 1px; background: var(--border); margin: 20px 0;
}

/* ===== 代码块 ===== */
code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12px; background: var(--gray-100);
  padding: 2px 6px; border-radius: 4px; color: var(--gray-800);
}
pre code {
  display: block; padding: 12px 16px; overflow-x: auto; line-height: 1.6;
}
