:root {
  --sidebar-width: 268px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --radius-sm: 0.5rem;
  --radius-md: 0.875rem;
  --radius-lg: 1.25rem;
  --radius-xl: 1.75rem;
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.08);
  --shadow-md: 0 4px 16px -2px rgb(0 0 0 / 0.12);
  --shadow-lg: 0 16px 40px -4px rgb(0 0 0 / 0.18);
  --shadow-glow: 0 0 32px -4px var(--primary-glow);
}

/* ── DARK THEME (default) ─────────────────────────────────── */
[data-theme="dark"], :root {
  --primary:      #f59e0b;   /* Amber-400  */
  --primary-dark: #d97706;   /* Amber-600  */
  --primary-glow: rgba(245, 158, 11, 0.28);
  --accent:       #10b981;   /* Emerald-500*/
  --danger:       #f87171;

  --bg-main:      #0c0f1a;
  --bg-panel:     #111827;
  --bg-card:      #1a2235;
  --bg-glass:     rgba(17, 24, 39, 0.82);
  --bg-input:     rgba(255, 255, 255, 0.06);
  --bg-hover:     rgba(255, 255, 255, 0.05);

  --text-main:    #f1f5f9;
  --text-sub:     #94a3b8;
  --text-muted:   #64748b;

  --border:       rgba(255, 255, 255, 0.08);
  --border-focus: rgba(245, 158, 11, 0.6);

  --sidebar-bg:   #111827;
  --sidebar-sep:  rgba(255,255,255,0.07);
}

/* ── LIGHT THEME ──────────────────────────────────────────── */
[data-theme="light"] {
  --primary:      #d97706;
  --primary-dark: #b45309;
  --primary-glow: rgba(217, 119, 6, 0.18);
  --accent:       #059669;
  --danger:       #dc2626;

  --bg-main:      #f8f9fb;
  --bg-panel:     #ffffff;
  --bg-card:      #ffffff;
  --bg-glass:     rgba(255, 255, 255, 0.88);
  --bg-input:     rgba(0, 0, 0, 0.04);
  --bg-hover:     rgba(0, 0, 0, 0.04);

  --text-main:    #0f172a;
  --text-sub:     #475569;
  --text-muted:   #94a3b8;

  --border:       rgba(0, 0, 0, 0.09);
  --border-focus: rgba(217, 119, 6, 0.5);

  --sidebar-bg:   #ffffff;
  --sidebar-sep:  rgba(0,0,0,0.07);
}

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

html { color-scheme: dark; transition: color-scheme 0.3s; }
[data-theme="light"] html { color-scheme: light; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ── SCROLLBAR ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ── LAYOUT ─────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-sep);
  padding: 1.75rem 1rem;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 200;
  transition: width 0.3s ease, background 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 2.5rem 3rem;
  transition: margin-left 0.3s ease;
}

/* ── BRAND ──────────────────────────────────────────────────── */
.brand {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  letter-spacing: -0.025em;
  flex-shrink: 0;
}

.brand svg { flex-shrink: 0; }

/* ── THEME TOGGLE ───────────────────────────────────────────── */
.theme-toggle-wrap {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-sub);
  font-size: 0.8125rem;
  font-weight: 600;
  transition: var(--transition);
  user-select: none;
}
.theme-toggle-wrap:hover { border-color: var(--primary); color: var(--primary); }
.theme-toggle-wrap .toggle-track {
  width: 34px; height: 18px;
  background: var(--border);
  border-radius: 9px;
  position: relative;
  margin-left: auto;
  transition: background 0.3s;
}
.theme-toggle-wrap .toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.3s, background 0.3s;
}
[data-theme="light"] .theme-toggle-wrap .toggle-thumb {
  transform: translateX(16px);
  background: var(--primary);
}
[data-theme="light"] .theme-toggle-wrap .toggle-track { background: var(--primary-glow); }

/* Server Selector */
.server-selector {
  margin-bottom: 1rem;
  position: relative;
}
.server-selector-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: var(--transition);
}
.server-selector-btn:hover {
  border-color: var(--primary);
  background: var(--bg-hover);
}
.server-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--primary-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--primary);
  flex-shrink: 0;
  overflow: hidden;
}
.server-icon img { width: 100%; height: 100%; object-fit: cover; }
.server-info {
  min-width: 0;
  flex: 1;
}
.server-name {
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.server-status {
  font-size: 0.625rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
}

.server-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 300;
  padding: 0.5rem;
}
.server-selector.active .server-dropdown {
  display: block;
}
.server-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-sub);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: var(--transition);
}
.server-option:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}
.server-option.selected {
  background: var(--primary-glow);
  color: var(--primary);
}

/* ── NAV ────────────────────────────────────────────────────── */
.nav-section-label {
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 1.25rem 0.75rem 0.4rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.6rem 0.875rem;
  color: var(--text-sub);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}
.nav-link svg { width: 1.125rem; height: 1.125rem; flex-shrink: 0; }
.nav-link:hover { background: var(--bg-hover); color: var(--text-main); }
.nav-link.active {
  background: var(--primary-glow);
  color: var(--primary);
  font-weight: 600;
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}
.nav-link.disabled {
  opacity: 0.38;
  cursor: not-allowed;
  pointer-events: none;
}

.nav-sep {
  height: 1px;
  background: var(--sidebar-sep);
  margin: 0.75rem 0.5rem;
}

/* User info block */
.sidebar-user {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--sidebar-sep);
}
.sidebar-user-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  background: var(--bg-input);
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 800; color: white;
  flex-shrink: 0;
}
.user-name { font-size: 0.8125rem; font-weight: 600; }
.user-role { font-size: 0.6875rem; color: var(--primary); font-weight: 600; }

/* ── CARDS ──────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.card-title { font-size: 1rem; font-weight: 700; }
.card-sub { font-size: 0.8125rem; color: var(--text-sub); margin-top: 0.25rem; }

/* Stat Card */
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.stat-label { font-size: 0.8125rem; color: var(--text-sub); font-weight: 600; }
.stat-value { font-size: 2.25rem; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
}
.stat-badge.up { background: rgba(16,185,129,0.1); color: var(--accent); }
.stat-badge.neutral { background: var(--bg-input); color: var(--text-muted); }

.icon-box {
  width: 3rem; height: 3rem;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.icon-box.amber  { background: rgba(245,158,11,0.12); color: var(--primary); }
.icon-box.green  { background: rgba(16,185,129,0.1);  color: var(--accent);  }
.icon-box.purple { background: rgba(168,85,247,0.1);  color: #a855f7;       }
.icon-box.red    { background: rgba(248,113,113,0.1); color: var(--danger); }

/* ── TABLES ─────────────────────────────────────────────────── */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
table { width: 100%; border-collapse: collapse; }
th {
  background: var(--bg-input);
  padding: 0.875rem 1.25rem;
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-align: left;
}
td { padding: 1rem 1.25rem; border-top: 1px solid var(--border); font-size: 0.875rem; }
tr:hover td { background: var(--bg-hover); }

/* ── BADGES ─────────────────────────────────────────────────── */
.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.badge-success { background: rgba(16,185,129,0.12); color: var(--accent); }
.badge-warning { background: rgba(245,158,11,0.12); color: var(--primary); }
.badge-danger  { background: rgba(248,113,113,0.1); color: var(--danger); }

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}
.btn-primary { background: var(--primary); color: #000; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-glow); transform: translateY(-1px); }
.btn-ghost { background: var(--bg-input); color: var(--text-main); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: rgba(248,113,113,0.1); color: var(--danger); border: 1px solid rgba(248,113,113,0.2); }
.btn-danger:hover { background: var(--danger); color: white; }

/* ── PAGE HEADER ────────────────────────────────────────────── */
.page-header { margin-bottom: 2rem; }
.page-header h1 { font-size: 1.875rem; font-weight: 800; letter-spacing: -0.025em; }
.page-header p  { color: var(--text-sub); margin-top: 0.375rem; font-size: 0.9375rem; }

/* ── AUTH PAGES ─────────────────────────────────────────────── */
.auth-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-main);
  position: relative;
  overflow: hidden;
}
.auth-bg::before {
  content: '';
  position: absolute;
  top: -25%;  right: -15%;
  width: 700px; height: 700px;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 65%);
  pointer-events: none;
}
.auth-bg::after {
  content: '';
  position: absolute;
  bottom: -20%; left: -10%;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(16,185,129,0.12) 0%, transparent 65%);
  pointer-events: none;
}

.auth-card {
  position: relative;
  z-index: 1;
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 3.5rem;
  width: 100%;
  max-width: 460px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.auth-logo-icon {
  width: 72px; height: 72px;
  background: var(--primary-glow);
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  margin-bottom: 2rem;
}
.auth-card h1  { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 0.75rem; }
.auth-card > p { color: var(--text-sub); margin-bottom: 2.5rem; font-size: 1rem; line-height: 1.7; }

.discord-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.875rem;
  padding: 1rem 2rem;
  background: #5865f2;
  color: white;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  transition: var(--transition);
  box-shadow: 0 4px 18px rgba(88,101,242,0.4);
  width: 100%;
  border: none;
  cursor: pointer;
}
.discord-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(88,101,242,0.55);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-footer {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 2rem;
  line-height: 1.7;
}
.auth-footer a { color: var(--primary); text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

/* ── LANDING PAGE ───────────────────────────────────────────── */
.landing-wrap {
  min-height: 100vh;
  background: var(--bg-main);
  position: relative;
  overflow: hidden;
}

/* Top nav */
.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 4rem;
  position: relative;
  z-index: 10;
}
.landing-nav-logo {
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  letter-spacing: -0.02em;
}
.landing-nav-links { display: flex; align-items: center; gap: 1rem; }

/* Hero section */
.hero-section {
  text-align: center;
  padding: 6rem 2rem 5rem;
  position: relative;
  z-index: 2;
}
.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, var(--primary-glow), transparent);
  z-index: -1;
}
.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 1rem;
  background: var(--primary-glow);
  color: var(--primary);
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 700;
  margin-bottom: 2rem;
  border: 1px solid var(--border-focus);
}
.hero-section h1 {
  font-size: clamp(3rem, 6vw, 5.5rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.04em;
  margin-bottom: 1.75rem;
  max-width: 800px;
  margin-inline: auto;
}
.hero-section h1 span {
  background: linear-gradient(135deg, var(--primary) 0%, #ef4444 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-section p {
  font-size: 1.25rem;
  color: var(--text-sub);
  max-width: 560px;
  margin-inline: auto;
  margin-bottom: 3rem;
  line-height: 1.75;
}
.hero-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}
.hero-cta .btn { font-size: 1rem; padding: 0.875rem 2rem; }
.hero-cta .btn-primary { border-radius: var(--radius-lg); }

/* Features section */
.features-section {
  padding: 5rem 4rem;
  position: relative;
  z-index: 2;
}
.section-label {
  font-size: 0.8125rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--primary);
  margin-bottom: 0.75rem;
}
.section-title {
  font-size: clamp(1.75rem, 3.5vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}
.section-sub {
  font-size: 1.0625rem;
  color: var(--text-sub);
  max-width: 540px;
  line-height: 1.7;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 3.5rem;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  transition: var(--transition);
}
.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}
.feature-card h3 { font-size: 1.125rem; font-weight: 700; margin: 1.25rem 0 0.75rem; }
.feature-card p  { font-size: 0.9375rem; color: var(--text-sub); line-height: 1.65; }

/* Stats strip */
.stats-strip {
  display: flex;
  justify-content: center;
  gap: 4rem;
  padding: 4rem 4rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.strip-stat { text-align: center; }
.strip-stat-val {
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--primary), #ef4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.strip-stat-label { font-size: 0.9375rem; color: var(--text-sub); margin-top: 0.4rem; }

/* CTA Banner */
.cta-banner {
  text-align: center;
  padding: 6rem 2rem;
  position: relative;
}
.cta-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 80% at 50% 50%, var(--primary-glow), transparent);
  z-index: -1;
}
.cta-banner h2 { font-size: 2.75rem; font-weight: 900; letter-spacing: -0.03em; margin-bottom: 1.25rem; }
.cta-banner p  { font-size: 1.125rem; color: var(--text-sub); margin-bottom: 2.5rem; }

/* Footer */
.landing-footer {
  text-align: center;
  padding: 2rem 4rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ── SWITCH TOGGLE ─────────────────────────────────────────── */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--bg-input);
  transition: .4s;
  border: 1px solid var(--border);
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-muted);
  transition: .4s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--primary-glow);
  border-color: var(--primary);
}
input:checked + .slider:before {
  transform: translateX(20px);
  background-color: var(--primary);
}

/* ── FORMS ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  color: var(--text-main);
  font-size: 0.9375rem;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 4px var(--primary-glow);
}
.form-input::placeholder { color: var(--text-muted); opacity: 0.5; }

/* ── MISC ────────────────────────────────────────────────────── */
a { transition: color 0.2s; }
