*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0d0f1a;
  --surface:  #151829;
  --card:     #1c1f35;
  --border:   #2a2d45;
  --accent:   #6366f1;
  --accent2:  #818cf8;
  --success:  #22c55e;
  --warning:  #f59e0b;
  --danger:   #ef4444;
  --text:     #e2e8f0;
  --muted:    #64748b;
  --sidebar-w: 240px;
}

body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* ── LOGIN ────────────────────────────────────────────────────────────────── */
#login-screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--bg); z-index: 1000;
}
.login-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 48px; width: 100%; max-width: 400px;
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo span { font-size: 28px; font-weight: 800; background: linear-gradient(135deg, #6366f1, #818cf8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.login-logo small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; letter-spacing: 2px; text-transform: uppercase; }
.login-box h2 { font-size: 20px; font-weight: 700; margin-bottom: 24px; }

/* ── LAYOUT ───────────────────────────────────────────────────────────────── */
#app { display: none; height: 100vh; overflow: hidden; }
#app.visible { display: flex; }

.sidebar {
  width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto;
}
.sidebar-logo { padding: 24px 20px; border-bottom: 1px solid var(--border); }
.sidebar-logo span { font-size: 20px; font-weight: 800; background: linear-gradient(135deg, #6366f1, #818cf8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.sidebar-logo small { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; letter-spacing: 2px; text-transform: uppercase; }

.nav { padding: 16px 12px; flex: 1; }
.nav-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); padding: 12px 8px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
  cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 500;
  transition: all 0.15s; margin-bottom: 2px;
}
.nav-item:hover { background: var(--card); color: var(--text); }
.nav-item.active { background: rgba(99,102,241,0.15); color: var(--accent2); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer { padding: 16px 12px; border-top: 1px solid var(--border); }
.admin-badge {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
  background: var(--card);
}
.admin-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.admin-info { flex: 1; min-width: 0; }
.admin-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-role { font-size: 11px; color: var(--accent2); }
.logout-btn { background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 4px; }
.logout-btn:hover { color: var(--danger); }

/* ── MAIN ─────────────────────────────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  padding: 16px 28px; border-bottom: 1px solid var(--border); display: flex;
  align-items: center; justify-content: space-between; background: var(--surface); flex-shrink: 0;
}
.topbar h1 { font-size: 20px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.content { flex: 1; overflow-y: auto; padding: 28px; }

/* ── SECTIONS ─────────────────────────────────────────────────────────────── */
.section { display: none; }
.section.active { display: block; }

/* ── STATS GRID ───────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px; position: relative; overflow: hidden;
}
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--accent-line, var(--accent)); }
.stat-card.green  { --accent-line: var(--success); }
.stat-card.yellow { --accent-line: var(--warning); }
.stat-card.red    { --accent-line: var(--danger); }
.stat-card.purple { --accent-line: #a78bfa; }

.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 800; line-height: 1; }
.stat-sub   { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ── SECTION HEADER ───────────────────────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: gap; gap: 12px; }
.section-header h2 { font-size: 18px; font-weight: 700; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ── FORMS ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
input, select {
  width: 100%; background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; color: var(--text); font-size: 14px; outline: none; transition: border 0.2s;
}
input:focus, select:focus { border-color: var(--accent); }
input::placeholder { color: var(--muted); }

.search-input { width: 220px; }
.filter-select { width: 140px; }

/* ── BUTTONS ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px;
  border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
  border: none; transition: all 0.15s; white-space: nowrap;
}
.btn-primary   { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent2); }
.btn-danger    { background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-success   { background: rgba(34,197,94,0.15); color: var(--success); border: 1px solid rgba(34,197,94,0.3); }
.btn-success:hover { background: rgba(34,197,94,0.25); }
.btn-ghost     { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent2); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ── TABLE ────────────────────────────────────────────────────────────────── */
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--surface); }
th { padding: 12px 16px; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 600; }
td { padding: 13px 16px; font-size: 13px; border-top: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: rgba(255,255,255,0.02); }

.td-actions { display: flex; gap: 6px; }

/* ── BADGES ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-active    { background: rgba(34,197,94,0.15);  color: var(--success); }
.badge-suspended { background: rgba(239,68,68,0.15);  color: var(--danger); }
.badge-pending   { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-banned    { background: rgba(239,68,68,0.15);  color: var(--danger); }
.badge-super     { background: rgba(99,102,241,0.2);  color: var(--accent2); }
.badge-published { background: rgba(34,197,94,0.15);  color: var(--success); }
.badge-draft     { background: rgba(100,116,139,0.2); color: var(--muted); }

/* ── PAGINATION ───────────────────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-top: 1px solid var(--border); }
.pagination-info { font-size: 13px; color: var(--muted); }
.pagination-btns { display: flex; gap: 6px; }

/* ── LOADING / EMPTY ──────────────────────────────────────────────────────── */
.loading { text-align: center; padding: 60px; color: var(--muted); font-size: 14px; }
.empty   { text-align: center; padding: 60px; color: var(--muted); }
.empty svg { width: 48px; height: 48px; opacity: 0.3; margin-bottom: 12px; }

/* ── TOAST ────────────────────────────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 18px; border-radius: 10px; font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4); animation: slideIn 0.2s ease;
  max-width: 320px;
}
.toast-success { background: #14532d; border: 1px solid #22c55e; color: #86efac; }
.toast-error   { background: #450a0a; border: 1px solid #ef4444; color: #fca5a5; }
@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── AVATAR ───────────────────────────────────────────────────────────────── */
.user-cell { display: flex; align-items: center; gap: 10px; }
.avatar-circle { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; color: white; overflow: hidden; }
.avatar-circle img { width: 100%; height: 100%; object-fit: cover; }
.user-name  { font-weight: 500; }
.user-email { font-size: 11px; color: var(--muted); }

.amount-positive { color: var(--success); font-weight: 600; }
.amount-negative { color: var(--danger); font-weight: 600; }

/* ── MODAL ────────────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 500; display: none; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px; width: 100%; max-width: 460px; }
.modal h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.modal p  { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
