
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #09090b; 
  --panel: #18181b; 
  --panel2: #27272a; 
  --border: #3f3f46;
  --border-light: rgba(255, 255, 255, 0.08);
  --text: #fafafa; 
  --muted: #a1a1aa; 
  --accent: #6366f1; 
  --accent-hover: #4f46e5;
  --accent2: #818cf8;
  --green: #10b981; 
  --red: #ef4444; 
  --yellow: #f59e0b; 
  --blue: #3b82f6;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 15px rgba(99, 102, 241, 0.3);
  --radius-md: 8px;
  --radius-lg: 12px;
}
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: "Inter", system-ui, -apple-system, sans-serif; font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent2); text-decoration: none; transition: 0.2s; }
a:hover { color: var(--text); }
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; background: var(--bg); border-right: 1px solid var(--border-light);
  padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.sidebar .brand { 
  font-size: 18px; font-weight: 700; padding: 8px 12px 24px; 
  display: flex; align-items: center; gap: 10px; color: var(--text); 
  letter-spacing: -0.02em;
}
.sidebar .brand .dot { 
  width: 10px; height: 10px; border-radius: 50%; 
  background: var(--accent); box-shadow: var(--shadow-glow); 
}
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius-md);
  color: var(--muted); cursor: pointer; font-weight: 500; transition: all 0.2s ease;
}
.nav-item i { font-size: 18px; }
.nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav-item.active { background: rgba(99, 102, 241, 0.15); color: var(--accent2); border-left: 3px solid var(--accent); }
.main { flex: 1; padding: 32px 40px; max-width: 1400px; margin: 0 auto; width: 100%; }
.page { display: none; animation: fadeIn 0.3s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

h1 { font-size: 28px; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.02em; }
h2 { font-size: 18px; font-weight: 600; margin: 24px 0 16px; letter-spacing: -0.01em; }
.sub { color: var(--muted); margin-bottom: 28px; font-size: 15px; }

.card { 
  background: var(--panel); border: 1px solid var(--border-light); 
  border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-md);
}
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stat { 
  background: var(--panel); border: 1px solid var(--border-light); 
  border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 8px; transition: 0.2s;
}
.stat:hover { border-color: var(--border); transform: translateY(-2px); }
.stat .num { font-size: 32px; font-weight: 700; line-height: 1; }
.stat .lbl { color: var(--muted); font-size: 14px; font-weight: 500; }
.stat .num.green { color: var(--green); } .stat .num.red { color: var(--red); }
.stat .num.accent { color: var(--accent2); } .stat .num.blue { color: var(--blue); }

table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: left; padding: 12px 14px; font-size: 14px; vertical-align: middle; border-bottom: 1px solid var(--border-light); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
tr:last-child td { border-bottom: none; }
tr { transition: background 0.15s; }
tr:hover td { background: rgba(255,255,255,0.02); }

.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; letter-spacing: 0.3px; }
.badge.green { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.2); }
.badge.red { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.2); }
.badge.yellow { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.2); }
.badge.blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.2); }
.badge.gray { background: rgba(161, 161, 170, 0.15); color: #a1a1aa; border: 1px solid rgba(161, 161, 170, 0.2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; 
  padding: 10px 16px; border-radius: var(--radius-md); font-weight: 500;
  border: 1px solid var(--border-light); background: rgba(255,255,255,0.05); color: var(--text);
  cursor: pointer; font-size: 14px; transition: all 0.2s ease;
}
.btn:hover:not(:disabled) { background: rgba(255,255,255,0.1); border-color: var(--border); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { 
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.2); 
}
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: 0 0 15px rgba(99, 102, 241, 0.4); }
.btn.danger { border-color: rgba(239, 68, 68, 0.3); color: #f87171; background: rgba(239, 68, 68, 0.05); }
.btn.danger:hover:not(:disabled) { background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.5); }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 6px; }

.nowrap { white-space: nowrap; }
input, select, textarea {
  background: #121214; border: 1px solid var(--border-light); color: var(--text);
  border-radius: var(--radius-md); padding: 10px 12px; font-size: 14px; width: 100%; 
  outline: none; transition: 0.2s; font-family: inherit;
}
input:focus, select:focus, textarea:focus { 
  border-color: var(--accent); box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2); 
}
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 8px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }

.flex { display: flex; gap: 12px; align-items: center; } .wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.g-item { 
  background: var(--panel); border: 1px solid var(--border-light); 
  border-radius: var(--radius-lg); overflow: hidden; transition: 0.2s; box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.g-item:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border); }
.g-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #000; }
.g-item .g-info { padding: 12px; font-size: 13px; color: var(--muted); }
.g-item .g-info .prompt { color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }

.preview { max-width: 100%; border-radius: var(--radius-lg); border: 1px solid var(--border-light); }
.toast-wrap { position: fixed; top: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { 
  background: var(--panel); border: 1px solid var(--border-light); border-left: 4px solid var(--accent);
  padding: 14px 18px; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); 
  min-width: 280px; font-weight: 500; display: flex; align-items: center; gap: 10px;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1); pointer-events: auto;
}
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.ok { border-left-color: var(--green); } .toast.err { border-left-color: var(--red); }

.empty { color: var(--muted); text-align: center; padding: 60px 0; font-size: 15px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty i { font-size: 32px; opacity: 0.5; }

.mono { font-family: "JetBrains Mono", Consolas, monospace; font-size: 13px; word-break: break-all; }
.switch { position: relative; width: 44px; height: 24px; display: inline-block; }
.switch input { display: none; }
.switch .sl { 
  position: absolute; inset: 0; background: rgba(255,255,255,0.1); 
  border-radius: 24px; cursor: pointer; transition: 0.3s; 
  border: 1px solid transparent;
}
.switch .sl:before { 
  content: ""; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; 
  background: #fff; border-radius: 50%; transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.switch input:checked + .sl { background: var(--accent); }
.switch input:checked + .sl:before { transform: translateX(20px); }

.code { 
  background: #121214; border: 1px solid var(--border-light); 
  border-radius: var(--radius-md); padding: 16px; 
  font-family: "JetBrains Mono", Consolas, monospace; font-size: 13px; 
  overflow-x: auto; color: var(--accent2); line-height: 1.5;
}

.login-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(8px);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease;
}
.login-box {
  background: var(--panel); border: 1px solid var(--border-light); border-radius: 16px;
  padding: 32px; width: 380px; max-width: 90vw; box-shadow: var(--shadow-lg);
}
.login-box h2 { margin: 0 0 8px; text-align: center; }
.login-box p { text-align: center; margin-bottom: 24px; line-height: 1.5; }
.login-box input { margin-bottom: 16px; }

@media (max-width: 800px) { 
  .sidebar { width: 70px; padding: 20px 10px; } 
  .sidebar .brand { padding: 8px; justify-content: center; }
  .sidebar .brand span { display: none; } 
  .nav-item { justify-content: center; padding: 12px; }
  .nav-item span { display: none; } 
  .main { padding: 20px; } 
  .stats { grid-template-columns: 1fr 1fr; }
}

/* ====== 交互与加载动画增强 ====== */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes pulseGlow {
  0% { box-shadow: 0 0 0 0 rgba(99,102,241,0.4); }
  70% { box-shadow: 0 0 0 6px rgba(99,102,241,0); }
  100% { box-shadow: 0 0 0 0 rgba(99,102,241,0); }
}
.login-box { animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
tbody tr { animation: slideUp 0.3s ease backwards; }
tbody tr:nth-child(1) { animation-delay: 0.04s; }
tbody tr:nth-child(2) { animation-delay: 0.08s; }
tbody tr:nth-child(3) { animation-delay: 0.12s; }
tbody tr:nth-child(4) { animation-delay: 0.16s; }
tbody tr:nth-child(5) { animation-delay: 0.20s; }
tbody tr:nth-child(n+6) { animation-delay: 0.24s; }

.g-item { animation: scaleIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) backwards; }
.g-item:nth-child(1) { animation-delay: 0.05s; }
.g-item:nth-child(2) { animation-delay: 0.10s; }
.g-item:nth-child(3) { animation-delay: 0.15s; }
.g-item:nth-child(4) { animation-delay: 0.20s; }
.g-item:nth-child(5) { animation-delay: 0.25s; }
.g-item:nth-child(n+6) { animation-delay: 0.30s; }

.stat { animation: slideUp 0.4s ease backwards; }
.stat:nth-child(1) { animation-delay: 0.03s; }
.stat:nth-child(2) { animation-delay: 0.06s; }
.stat:nth-child(3) { animation-delay: 0.09s; }
.stat:nth-child(4) { animation-delay: 0.12s; }
.stat:nth-child(5) { animation-delay: 0.15s; }
.stat:nth-child(n+6) { animation-delay: 0.18s; }

/* 刷新反馈特效 */
.refresh-highlight { animation: pulseGlow 0.8s ease-out; border-color: var(--accent) !important; }

/* 优化表单布局视觉 */
.card h2 { border-bottom: 1px solid var(--border-light); padding-bottom: 10px; margin-bottom: 20px; }
.form-row, .form-grid { background: rgba(0,0,0,0.15); padding: 16px; border-radius: var(--radius-md); border: 1px solid rgba(255,255,255,0.02); }
