/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:        #080a0f;
  --bg2:       #0d0f17;
  --surface:   #111520;
  --card:      rgba(255,255,255,0.035);
  --card-hover:rgba(255,255,255,0.06);
  --border:    rgba(255,255,255,0.07);
  --border2:   rgba(255,255,255,0.12);
  --text:      #e8eaf0;
  --muted:     #6b7280;
  --primary:   #6366f1;
  --primary2:  #818cf8;
  --accent:    #8b5cf6;
  --success:   #10b981;
  --warning:   #f59e0b;
  --danger:    #ef4444;
  --info:      #3b82f6;

  --rank-owner:    #ff4757;
  --rank-coowner:  #ff6b35;
  --rank-admin:    #ffd700;
  --rank-srmod:    #c084fc;
  --rank-mod:      #60a5fa;
  --rank-helper:   #34d399;
  --rank-builder:  #2dd4bf;
  --rank-trial:    #94a3b8;

  --sidebar-w: 240px;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 8px 32px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.6);
  --glow:      0 0 20px rgba(99,102,241,0.2);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 14px;
}
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea {
  font-family: inherit;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
}
ul { list-style: none; }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── Background mesh ─────────────────────────────────────── */
body::before {
  content:'';
  position:fixed; inset:0; z-index:-1;
  background:
    radial-gradient(ellipse 80% 60% at 20% -10%, rgba(99,102,241,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 110%, rgba(139,92,246,0.1) 0%, transparent 60%),
    var(--bg);
  pointer-events:none;
}

/* ══════════════════════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
}
.login-page::after {
  content:'';
  position:fixed; inset:0; z-index:0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%239C92AC' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events:none;
}
.login-box {
  position: relative; z-index: 1;
  width: 100%; max-width: 420px;
  background: var(--card);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 40px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.06);
  animation: fadeUp 0.5s var(--ease);
}
.login-logo {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 32px;
}
.login-logo .logo-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: 0 0 20px rgba(99,102,241,0.4);
}
.login-logo .logo-text { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
.login-logo .logo-text span { color: var(--primary2); }
.login-sub { color: var(--muted); font-size: 13px; margin-bottom: 32px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 8px; }
.field-wrap {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.field-wrap svg { color: var(--muted); flex-shrink: 0; }
.field-wrap input { flex: 1; height: 44px; font-size: 14px; background: transparent; }
.field-wrap input::placeholder { color: var(--muted); }
.btn-primary {
  width: 100%; height: 46px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; font-size: 14px; font-weight: 600;
  border-radius: var(--radius-sm);
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 15px rgba(99,102,241,0.35);
  margin-top: 8px;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99,102,241,0.4); }
.btn-primary:active { transform: translateY(0); }
.login-error {
  color: var(--danger); font-size: 12px; margin-top: 12px;
  text-align: center; display: none;
}
.login-error.show { display: block; }
.demo-accounts {
  margin-top: 28px; padding-top: 20px;
  border-top: 1px solid var(--border);
}
.demo-accounts p { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 10px; }
.demo-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.demo-chip {
  font-size: 11px; padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; gap: 5px;
}
.demo-chip:hover { border-color: var(--primary); background: rgba(99,102,241,0.08); }
.demo-chip .chip-dot { width: 6px; height: 6px; border-radius: 50%; }

/* ══════════════════════════════════════════════════════════
   PORTAL SHELL
══════════════════════════════════════════════════════════ */
.portal { display: none; min-height: 100vh; }
.portal.active { display: flex; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  position: fixed; left: 0; top: 0;
  background: rgba(13,15,23,0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100;
  transition: transform 0.3s var(--ease);
}
.sidebar-header {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sb-logo {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: var(--glow);
  flex-shrink: 0;
}
.sb-title { font-size: 15px; font-weight: 700; letter-spacing: -0.3px; }
.sb-title span { color: var(--primary2); }
.sb-subtitle { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.sidebar-user {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sb-avatar {
  width: 34px; height: 34px; border-radius: 8px;
  overflow: hidden; flex-shrink: 0;
  border: 1px solid var(--border2);
}
.sb-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sb-avatar-placeholder {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.sb-user-info { flex: 1; min-width: 0; }
.sb-username { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-role-badge {
  font-size: 10px; font-weight: 700; padding: 1px 7px;
  border-radius: 99px; text-transform: uppercase; letter-spacing: 0.5px;
  display: inline-block; margin-top: 1px;
}
.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-section { margin-bottom: 6px; }
.nav-section-label {
  font-size: 10px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px;
  padding: 8px 8px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; color: var(--muted);
  transition: all 0.15s; cursor: pointer;
  position: relative;
  user-select: none;
}
.nav-item svg { flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav-item.active {
  background: rgba(99,102,241,0.12);
  color: var(--primary2);
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0;
  background: var(--primary2);
}
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 99px;
}
.nav-item.locked { opacity: 0.35; pointer-events: none; }
.nav-item.locked::after {
  content: '🔒';
  margin-left: auto; font-size: 10px;
}
.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
}
.sidebar-footer .nav-item { color: var(--danger); }
.sidebar-footer .nav-item:hover { background: rgba(239,68,68,0.08); }

/* Sidebar toggle for mobile */
.sidebar-toggle {
  display: none;
  position: fixed; top: 16px; left: 16px; z-index: 200;
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  align-items: center; justify-content: center;
  box-shadow: var(--shadow);
}
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 99;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
}

/* ── Main Content ─────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
}
.topbar {
  height: 64px;
  background: rgba(13,15,23,0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); transition: all 0.2s; position: relative;
}
.icon-btn:hover { background: rgba(255,255,255,0.07); color: var(--text); border-color: var(--border2); }
.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger); border: 1px solid var(--bg);
}
.server-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 99px; padding: 5px 12px;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); animation: pulse 2s infinite; }
.page-content {
  flex: 1; padding: 28px;
  animation: fadeIn 0.3s var(--ease);
}
.page { display: none; }
.page.active { display: block; }

/* ── Stats grid ──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative; overflow: hidden;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  animation: fadeUp 0.4s var(--ease) both;
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--border2); box-shadow: var(--shadow); }
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
}
.stat-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px; font-size: 18px;
}
.stat-num { font-size: 28px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat-change { font-size: 11px; margin-top: 6px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ── Section headers ─────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.section-title { font-size: 16px; font-weight: 700; }
.section-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.btn-sm {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600;
  transition: all 0.2s;
}
.btn-ghost {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--muted);
}
.btn-ghost:hover { border-color: var(--border2); color: var(--text); background: rgba(255,255,255,0.06); }
.btn-primary-sm {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}
.btn-primary-sm:hover { opacity: 0.9; transform: translateY(-1px); }

/* ── Staff grid ──────────────────────────────────────────── */
.staff-filters {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.search-wrap {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px; flex: 1; max-width: 280px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }
.search-wrap input { height: 36px; font-size: 13px; }
.filter-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 99px;
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--muted); cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.filter-btn:hover { border-color: var(--border2); color: var(--text); }
.filter-btn.active { color: #fff; border-color: transparent; }
.staff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.staff-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  animation: fadeUp 0.35s var(--ease) both;
  position: relative; overflow: hidden;
  cursor: pointer;
}
.staff-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
}
.staff-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.staff-card-glow {
  position: absolute; top: -30px; left: 50%; transform: translateX(-50%);
  width: 100px; height: 60px; border-radius: 50%;
  opacity: 0.15; filter: blur(20px);
  pointer-events: none;
}
.staff-avatar {
  width: 64px; height: 64px; border-radius: 12px;
  overflow: hidden; margin-bottom: 12px;
  border: 2px solid var(--border2);
  position: relative; z-index: 1;
}
.staff-avatar img { width: 100%; height: 100%; image-rendering: pixelated; }
.staff-name { font-size: 14px; font-weight: 700; margin-bottom: 5px; }
.rank-badge {
  font-size: 10px; font-weight: 800;
  padding: 2px 10px; border-radius: 99px;
  text-transform: uppercase; letter-spacing: 0.8px;
  margin-bottom: 10px;
}
.staff-meta { font-size: 11px; color: var(--muted); line-height: 1.7; }
.staff-status {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; margin-top: 8px;
}
.status-indicator {
  width: 6px; height: 6px; border-radius: 50%;
}
.status-online { background: var(--success); }
.status-offline { background: var(--muted); }
.status-away { background: var(--warning); }
.staff-card-actions {
  display: flex; gap: 6px; margin-top: 12px;
  width: 100%;
}
.staff-card-actions button {
  flex: 1; height: 30px; border-radius: 6px;
  font-size: 11px; font-weight: 600;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  transition: all 0.2s;
}
.staff-card-actions button:hover { background: rgba(255,255,255,0.07); color: var(--text); }

/* Staff table (alternate view) */
.staff-table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.staff-table { width: 100%; border-collapse: collapse; }
.staff-table th {
  padding: 12px 16px; text-align: left;
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.8px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
}
.staff-table td {
  padding: 12px 16px; font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.staff-table tr:last-child td { border-bottom: none; }
.staff-table tr:hover td { background: rgba(255,255,255,0.02); }
.table-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  overflow: hidden; display: inline-block;
  vertical-align: middle; margin-right: 10px;
  border: 1px solid var(--border);
}
.table-avatar img { width: 100%; height: 100%; image-rendering: pixelated; }

/* ── View toggle ─────────────────────────────────────────── */
.view-toggle {
  display: flex; gap: 2px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 3px;
}
.view-toggle button {
  width: 32px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); transition: all 0.2s;
}
.view-toggle button.active { background: rgba(99,102,241,0.2); color: var(--primary2); }

/* ── Activity feed ───────────────────────────────────────── */
.activity-feed {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.activity-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: rgba(255,255,255,0.02); }
.activity-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 14px;
}
.activity-text { flex: 1; font-size: 13px; }
.activity-text strong { font-weight: 600; }
.activity-time { font-size: 11px; color: var(--muted); margin-top: 2px; }
.activity-meta { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ── Reports ─────────────────────────────────────────────── */
.report-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  transition: border-color 0.2s;
  animation: fadeUp 0.35s var(--ease) both;
}
.report-card:hover { border-color: var(--border2); }
.report-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.report-status-badge {
  font-size: 10px; font-weight: 700; padding: 2px 8px;
  border-radius: 99px; text-transform: uppercase;
  margin-left: auto; flex-shrink: 0;
}
.badge-open { background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.badge-investigating { background: rgba(245,158,11,0.15); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }
.badge-resolved { background: rgba(16,185,129,0.15); color: var(--success); border: 1px solid rgba(16,185,129,0.3); }
.report-title { font-size: 14px; font-weight: 600; }
.report-meta { font-size: 11px; color: var(--muted); }
.report-body { font-size: 12px; color: var(--muted); line-height: 1.6; }

/* ── Logs ────────────────────────────────────────────────── */
.log-entry {
  display: flex; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 12px; font-family: 'JetBrains Mono', monospace;
  animation: fadeIn 0.2s var(--ease);
}
.log-entry:last-child { border-bottom: none; }
.log-time { color: var(--muted); flex-shrink: 0; min-width: 85px; }
.log-level { flex-shrink: 0; min-width: 60px; font-weight: 700; text-transform: uppercase; }
.log-level.info { color: var(--info); }
.log-level.warn { color: var(--warning); }
.log-level.error { color: var(--danger); }
.log-level.success { color: var(--success); }
.log-msg { color: #cbd5e1; }
.log-box {
  background: #070810;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  max-height: 500px; overflow-y: auto;
}

/* ── Settings ────────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 24px; }
.settings-nav-list { display: flex; flex-direction: column; gap: 4px; }
.settings-nav-item {
  padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; color: var(--muted);
  cursor: pointer; transition: all 0.15s;
}
.settings-nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.settings-nav-item.active { background: rgba(99,102,241,0.12); color: var(--primary2); }
.settings-panel { display: none; }
.settings-panel.active { display: block; }
.settings-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px; margin-bottom: 16px;
}
.settings-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 18px; }
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
}
.setting-row:last-child { border-bottom: none; padding-bottom: 0; }
.setting-info h4 { font-size: 13px; font-weight: 600; }
.setting-info p { font-size: 12px; color: var(--muted); margin-top: 2px; }
/* Toggle switch */
.toggle { width: 40px; height: 22px; position: relative; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.1);
  border-radius: 99px; cursor: pointer;
  transition: background 0.2s;
}
.toggle input:checked + .toggle-track { background: var(--primary); }
.toggle-track::after {
  content: '';
  position: absolute; left: 3px; top: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform 0.2s var(--ease);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.toggle input:checked + .toggle-track::after { transform: translateX(18px); }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 16px;
  width: 100%; max-width: 520px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s var(--ease);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 16px; font-weight: 700; }
.modal-close {
  width: 30px; height: 30px; border-radius: 8px;
  background: rgba(255,255,255,0.05);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); transition: all 0.2s;
}
.modal-close:hover { background: rgba(255,255,255,0.1); color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* Staff modal */
.staff-modal-header {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 20px;
}
.staff-modal-avatar {
  width: 72px; height: 72px; border-radius: 14px;
  overflow: hidden; border: 2px solid var(--border2);
  flex-shrink: 0;
}
.staff-modal-avatar img { width: 100%; height: 100%; image-rendering: pixelated; }
.modal-rank { font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 99px; text-transform: uppercase; letter-spacing: 0.8px; display: inline-block; }
.modal-info-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-top: 16px;
}
.modal-info-item { background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.modal-info-item .label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 4px; }
.modal-info-item .value { font-size: 13px; font-weight: 600; }

/* ── Announcements ───────────────────────────────────────── */
.announce-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 12px;
  animation: fadeUp 0.35s var(--ease) both;
  border-left: 3px solid transparent;
}
.announce-card.urgent { border-left-color: var(--danger); }
.announce-card.info { border-left-color: var(--info); }
.announce-card.update { border-left-color: var(--primary); }
.announce-title { font-size: 14px; font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.announce-body { font-size: 13px; color: var(--muted); line-height: 1.6; }
.announce-footer { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 11px; color: var(--muted); }

/* ── Dashboard layout helpers ────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .three-col { grid-template-columns: 1fr 1fr; } }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--muted);
}
.empty-state .icon { font-size: 36px; margin-bottom: 12px; }
.empty-state p { font-size: 13px; }

/* ── Progress bars ───────────────────────────────────────── */
.progress-bar {
  height: 5px; border-radius: 99px;
  background: rgba(255,255,255,0.06);
  overflow: hidden; margin-top: 8px;
}
.progress-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.8s var(--ease);
}

/* ── Animations ──────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ── Skeleton loader ─────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.05) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

/* ── Rank badge colors ───────────────────────────────────── */
.rank-owner     { background: rgba(255,71,87,0.15);   color: var(--rank-owner);   border: 1px solid rgba(255,71,87,0.3); }
.rank-manager   { background: rgba(255,107,53,0.15);  color: var(--rank-coowner); border: 1px solid rgba(255,107,53,0.3); }
.rank-admin     { background: rgba(255,215,0,0.15);   color: var(--rank-admin);   border: 1px solid rgba(255,215,0,0.3); }
.rank-moderator { background: rgba(96,165,250,0.15);  color: var(--rank-mod);     border: 1px solid rgba(96,165,250,0.3); }
.rank-helper    { background: rgba(52,211,153,0.15);  color: var(--rank-helper);  border: 1px solid rgba(52,211,153,0.3); }
/* legacy aliases kept for any existing references */
.rank-coowner  { background: rgba(255,107,53,0.15);  color: var(--rank-coowner); border: 1px solid rgba(255,107,53,0.3); }
.rank-srmod    { background: rgba(192,132,252,0.15); color: var(--rank-srmod);   border: 1px solid rgba(192,132,252,0.3); }
.rank-mod      { background: rgba(96,165,250,0.15);  color: var(--rank-mod);     border: 1px solid rgba(96,165,250,0.3); }
.rank-builder  { background: rgba(45,212,191,0.15);  color: var(--rank-builder); border: 1px solid rgba(45,212,191,0.3); }
.rank-trial    { background: rgba(148,163,184,0.15); color: var(--rank-trial);   border: 1px solid rgba(148,163,184,0.3); }

/* ── Glow colors for cards ───────────────────────────────── */
.glow-owner     { background: var(--rank-owner); }
.glow-manager   { background: var(--rank-coowner); }
.glow-admin     { background: var(--rank-admin); }
.glow-moderator { background: var(--rank-mod); }
.glow-helper    { background: var(--rank-helper); }

.filter-btn.rank-owner   { border-color: rgba(255,71,87,0.4);   background: rgba(255,71,87,0.1);   color: var(--rank-owner); }
.filter-btn.rank-manager { border-color: rgba(255,107,53,0.4);  background: rgba(255,107,53,0.1);  color: var(--rank-coowner); }
.filter-btn.rank-admin   { border-color: rgba(255,215,0,0.4);   background: rgba(255,215,0,0.1);   color: var(--rank-admin); }
.filter-btn.rank-helper  { border-color: rgba(52,211,153,0.4);  background: rgba(52,211,153,0.1);  color: var(--rank-helper); }

/* ── Settings form inputs ────────────────────────────────── */
.settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.settings-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.settings-input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.settings-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
  outline: none;
}
.settings-input option { background: var(--surface); }

/* ── Account management row ──────────────────────────────── */
.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.account-row:last-child { border-bottom: none; padding-bottom: 0; }

/* ── Permissions grid ────────────────────────────────────── */
.perms-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.perm-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.perm-item:hover { border-color: var(--border2); background: rgba(255,255,255,0.04); }
.perm-item input[type="checkbox"] {
  width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px;
  accent-color: var(--primary); cursor: pointer;
}

/* ── Textarea in settings ────────────────────────────────── */
textarea.settings-input {
  resize: vertical;
  min-height: 80px;
  padding-top: 10px;
  line-height: 1.5;
}

/* ── Report action row ───────────────────────────────────── */
.report-card .btn-sm { padding: 5px 10px; }

/* ── Logo images ─────────────────────────────────────────── */
.login-logo-img { width: 52px; height: 52px; object-fit: contain; border-radius: 10px; }
.sb-logo-img    { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; }

/* ── Light mode ──────────────────────────────────────────── */
body.light-mode {
  --bg:         #f0f2f7;
  --bg2:        #e8eaf2;
  --surface:    #ffffff;
  --card:       rgba(0,0,0,0.04);
  --card-hover: rgba(0,0,0,0.07);
  --border:     rgba(0,0,0,0.09);
  --border2:    rgba(0,0,0,0.15);
  --text:       #1a1d2e;
  --muted:      #6b7280;
}
body.light-mode .sidebar, body.light-mode .topbar { background: rgba(240,242,247,0.9); }
body.light-mode .log-box { background: #f5f5f8; }

/* ── No animations ───────────────────────────────────────── */
body.no-animations *, body.no-animations *::before, body.no-animations *::after {
  animation-duration: 0.001ms !important;
  animation-delay:    0.001ms !important;
  transition-duration:0.001ms !important;
}

/* ── Notification dropdown ───────────────────────────────── */
.notif-dropdown {
  position: absolute; top: 44px; right: 0;
  width: 320px; max-height: 420px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  z-index: 500;
}
.notif-dd-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface);
}
.notif-item {
  padding: 12px 16px; cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--card-hover); }
.notif-item.read { opacity: 0.6; }
.notif-badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 16px; height: 16px; border-radius: 99px;
  background: var(--danger); color: #fff;
  font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px; line-height: 1;
}

/* ── Announcement reactions ──────────────────────────────── */
.announce-reactions {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 10px 0 4px;
}
.reaction-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 99px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  font-size: 14px; cursor: pointer;
  transition: all 0.15s;
}
.reaction-btn:hover { border-color: var(--primary); background: rgba(99,102,241,0.1); }
.reaction-btn.active { border-color: var(--primary); background: rgba(99,102,241,0.15); color: var(--primary2); }
.reaction-btn span { font-size: 11px; font-weight: 600; }

/* ── Events ──────────────────────────────────────────────── */
.event-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  margin-bottom: 12px; animation: fadeUp 0.35s var(--ease) both;
}
.event-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.event-title  { font-size: 15px; font-weight: 700; }
.event-meta   { font-size: 12px; color: var(--muted); margin-top: 3px; }
.event-desc   { font-size: 13px; color: var(--muted); line-height: 1.5; margin-bottom: 12px; }
.event-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.event-attendance { display: flex; flex-direction: column; gap: 6px; }
.attendee-list { display: flex; flex-wrap: wrap; gap: 4px; }

/* ── Changelog ───────────────────────────────────────────── */
.changelog-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  margin-bottom: 12px; animation: fadeUp 0.35s var(--ease) both;
  border-left: 3px solid var(--primary);
}
.changelog-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.changelog-version { background: rgba(99,102,241,0.15); color: var(--primary2); border: 1px solid rgba(99,102,241,0.3); padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.changelog-title   { font-size: 14px; font-weight: 600; }
.changelog-date    { font-size: 11px; color: var(--muted); }
.changelog-body    { font-size: 13px; color: var(--muted); line-height: 1.7; white-space: pre-wrap; }

/* ── Messages layout ─────────────────────────────────────── */
.messages-layout {
  display: grid; grid-template-columns: 280px 1fr;
  height: calc(100vh - 120px); gap: 0;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.conv-list {
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow-y: auto;
}
.conv-list-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.conv-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; cursor: pointer; transition: background 0.15s;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.conv-item:hover { background: var(--card-hover); }
.conv-item.active { background: rgba(99,102,241,0.1); }
.conv-view { display: flex; flex-direction: column; overflow: hidden; }
.conv-header {
  display: flex; align-items: center; padding: 14px 16px;
  border-bottom: 1px solid var(--border); font-size: 14px;
  background: var(--surface);
}
.conv-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.conv-input-row {
  display: flex; gap: 8px; padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.msg-bubble { max-width: 70%; display: flex; flex-direction: column; gap: 2px; }
.msg-bubble.sent { align-self: flex-end; align-items: flex-end; }
.msg-bubble.received { align-self: flex-start; align-items: flex-start; }
.msg-text {
  padding: 8px 12px; border-radius: 12px;
  font-size: 13px; line-height: 1.4; word-break: break-word;
}
.msg-bubble.sent     .msg-text { background: rgba(99,102,241,0.25); border-radius: 12px 12px 4px 12px; }
.msg-bubble.received .msg-text { background: var(--card-hover); border-radius: 12px 12px 12px 4px; }
.msg-time { font-size: 10px; color: var(--muted); padding: 0 4px; }

@media(max-width:768px){
  .messages-layout { grid-template-columns: 1fr; }
  .conv-list { max-height: 280px; border-right: none; border-bottom: 1px solid var(--border); }
}

/* ── Toast ───────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 10px; padding: 12px 16px;
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow);
  animation: fadeUp 0.3s var(--ease);
  pointer-events: all;
  max-width: 320px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--info); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-240px);
    width: 240px;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .sidebar-toggle { display: flex; }
  .main { margin-left: 0; }
  .topbar { padding: 0 16px 0 64px; }
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .staff-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .settings-grid { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .three-col { grid-template-columns: 1fr; }
  .modal-info-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .staff-filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
}

/* ── Misc utilities ──────────────────────────────────────── */
.text-muted { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-2 { gap: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.hidden { display: none !important; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; padding: 2px 8px; border-radius: 99px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  color: var(--muted);
}
