@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,400&display=swap');

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

/* ── Dark theme (default) ───────────────────────────────── */
:root {
  --bg:       #0b0d14;
  --surface:  #12151f;
  --surface2: #1a1e2e;
  --border:   rgba(255,255,255,0.07);
  --text:     #e2e4ef;
  --muted:    #868aa8;
  --accent:   #7c6ffa;
  --accent2:  #5be0c8;
}

/* ── Light theme — applied when body has .light-mode ───── */
body.light-mode {
  --bg:       #f0f2f9;
  --surface:  #ffffff;
  --surface2: #e4e7f5;
  --border:   rgba(0,0,0,0.09);
  --text:     #12151f;
  --muted:    #555a7a;
}

/* ── Base ───────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  line-height: 1.75;
  transition: background 0.25s, color 0.25s;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Avatar background (index + setup) ─────────────────── */
body.avatar-bg {
  background-image:
    linear-gradient(to bottom, rgba(11,13,20,0.55) 0%, rgba(11,13,20,0.70) 100%),
    url('/avatar.png');
  background-size: cover;
  background-position: center center;
  background-attachment: fixed;
}
body.light-mode.avatar-bg {
  background-image:
    linear-gradient(to bottom, rgba(240,242,249,0.55) 0%, rgba(240,242,249,0.70) 100%),
    url('/avatar_white.png');
}

/* ── Navbar ─────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 68px;
  background: rgba(11,13,20,0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background 0.25s;
  flex-shrink: 0;
}
body.light-mode .navbar {
  background: rgba(240,242,249,0.85);
}

.nav-container {
  max-width: 1100px;
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex-shrink: 0;
}

nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 11px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
nav a:hover { color: var(--text); background: var(--border); }
nav a.active { color: var(--accent); }

#themeToggle {
  margin-left: 6px;
  padding: 6px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  white-space: nowrap;
}
#themeToggle:hover { background: var(--accent); color: #fff; border-color: transparent; }

/* ── Page wrapper ───────────────────────────────────────── */
.wrapper {
  max-width: 900px;
  margin: 60px auto;
  padding: 0 20px;
  flex: 1;
}

.content {
  background: rgba(18,21,31,0.60);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 56px;
  box-shadow: 0 8px 48px rgba(0,0,0,0.35);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
body.light-mode .content {
  background: rgba(255,255,255,0.60);
}

/* ── Typography ─────────────────────────────────────────── */
h1 {
  font-family: 'Syne', sans-serif;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.2;
}

h2 {
  font-family: 'Syne', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-top: 44px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent2);
  margin-top: 24px;
  margin-bottom: 5px;
}

p { color: var(--muted); margin-bottom: 12px; }
strong { color: var(--text); font-weight: 600; }
em { color: var(--muted); font-style: italic; }
a { color: var(--accent); }

.page-subtitle, .last-updated {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 40px;
}

ul, ol {
  margin-left: 20px;
  margin-top: 8px;
  margin-bottom: 12px;
  color: var(--muted);
}
li { margin-bottom: 5px; padding-left: 4px; }

pre {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 16px 20px;
  border-radius: 8px;
  margin-top: 10px;
  overflow-x: auto;
  font-size: 13px;
  color: var(--accent2);
  font-family: 'Fira Code', 'Courier New', monospace;
}

code {
  background: var(--surface2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--accent2);
}

/* ── Permission badges ──────────────────────────────────── */
.perm {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 2px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.perm-owner    { background: rgba(124,111,250,0.15); color: #a89cff; border: 1px solid rgba(124,111,250,0.3); }
.perm-true     { background: rgba(91,224,200,0.12);  color: #5be0c8; border: 1px solid rgba(91,224,200,0.25); }
.perm-tadmin   { background: rgba(242,90,90,0.12);   color: #f28080; border: 1px solid rgba(242,90,90,0.25); }
.perm-everyone { background: rgba(134,138,168,0.12); color: #868aa8; border: 1px solid rgba(134,138,168,0.2); }

/* ── Home hero ──────────────────────────────────────────── */
.home-hero {
  text-align: center;
  padding: 30px 0 20px;
}

.hero-eyebrow {
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 18px;
}

.home-hero h1 {
  font-size: clamp(32px, 5vw, 52px);
  letter-spacing: -1.5px;
  margin-bottom: 18px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  font-size: 16px;
  color: var(--muted);
  max-width: 520px;
  margin: 0 auto 32px;
}

.hero-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.cta-button {
  display: inline-block;
  padding: 13px 30px;
  background: linear-gradient(135deg, var(--accent), #5b5fef);
  color: #fff;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: 0 4px 24px rgba(124,111,250,0.35);
}
.cta-button:hover { opacity: 0.85; transform: translateY(-1px); }

.cta-invite {
  background: linear-gradient(135deg, #5865f2, #404eed);
  box-shadow: 0 4px 24px rgba(88,101,242,0.35);
}

/* ── Feature cards ──────────────────────────────────────── */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.feature-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 22px;
  transition: border-color 0.2s, transform 0.2s;
}
.feature-card:hover { border-color: rgba(124,111,250,0.4); transform: translateY(-2px); }
.feature-card h3    { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; color: var(--text); margin: 0 0 8px; }
.feature-card p     { font-size: 14px; color: var(--muted); margin: 0; }


/* ── Dashboard layout ───────────────────────────────────── */
body.dash-layout {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100vh;
}

.dash-shell {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.dash-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: rgba(11,13,20,0.92);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px 12px;
  gap: 4px;
  backdrop-filter: blur(16px);
}
body.light-mode .dash-sidebar {
  background: rgba(240,242,249,0.92);
}

.dash-server-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}
.dash-server-selector:hover { border-color: rgba(124,111,250,0.4); }

.dash-server-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.dash-server-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.dash-server-caret { color: var(--muted); font-size: 11px; }

.dash-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 12px 6px;
}

.dash-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.dash-nav-item:hover { background: var(--surface2); color: var(--text); }
.dash-nav-item.active { background: rgba(124,111,250,0.15); color: var(--accent); }
.dash-nav-item .icon { font-size: 16px; width: 20px; text-align: center; }
.dash-nav-item .badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
}

.dash-main {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.dash-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.dash-page-title {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}
.dash-page-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

.dash-topbar-actions { display: flex; align-items: center; gap: 10px; }

.dash-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.dash-stat-card {
  background: rgba(18,21,31,0.75);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  backdrop-filter: blur(10px);
  transition: border-color 0.2s, transform 0.2s;
}
body.light-mode .dash-stat-card { background: rgba(255,255,255,0.75); }
.dash-stat-card:hover { border-color: rgba(124,111,250,0.35); transform: translateY(-1px); }

.dash-stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted); margin-bottom: 8px; }
.dash-stat-value { font-family: 'Syne', sans-serif; font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; }
.dash-stat-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }
.dash-stat-accent { color: var(--accent); }
.dash-stat-green  { color: #22c55e; }
.dash-stat-orange { color: #f97316; }
.dash-stat-red    { color: #ef4444; }

.dash-card {
  background: rgba(18,21,31,0.75);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px 28px;
  backdrop-filter: blur(10px);
}
body.light-mode .dash-card { background: rgba(255,255,255,0.75); }

.dash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.dash-card-title {
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.dash-card-action {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  padding: 5px 12px;
  border: 1px solid rgba(124,111,250,0.3);
  border-radius: 6px;
  transition: background 0.15s;
  background: none;
}
.dash-card-action:hover { background: rgba(124,111,250,0.12); }

.dash-user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.dash-user-row:last-child { border-bottom: none; }
.dash-user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.dash-user-name { font-size: 13.5px; font-weight: 500; color: var(--text); }
.dash-user-id   { font-size: 11px; color: var(--muted); font-family: monospace; }
.dash-user-role {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.role-owner   { background: rgba(124,111,250,0.15); color: #a89cff; border: 1px solid rgba(124,111,250,0.3); }
.role-tadmin  { background: rgba(242,90,90,0.12);   color: #f28080; border: 1px solid rgba(242,90,90,0.25); }
.role-wl      { background: rgba(91,224,200,0.12);  color: #5be0c8; border: 1px solid rgba(91,224,200,0.25); }

.dash-tag-warning { background: rgba(249,115,22,0.12); color: #fb923c; border: 1px solid rgba(249,115,22,0.25); }
.dash-tag-danger  { background: rgba(239,68,68,0.12);  color: #f87171; border: 1px solid rgba(239,68,68,0.25); }

.dash-backup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.dash-backup-row:last-child { border-bottom: none; }
.dash-backup-slot {
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  width: 46px;
  flex-shrink: 0;
}
.dash-backup-name { font-size: 13px; color: var(--text); flex: 1; }
.dash-backup-meta { font-size: 11px; color: var(--muted); }
.dash-backup-empty { font-size: 13px; color: var(--muted); font-style: italic; }

.dash-threat-bar {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.dash-threat-seg {
  flex: 1;
  height: 6px;
  border-radius: 99px;
  background: var(--surface2);
}
.dash-threat-seg.active-0 { background: #22c55e; }
.dash-threat-seg.active-1 { background: #f97316; }
.dash-threat-seg.active-2 { background: #ef4444; }
.dash-threat-seg.active-3 { background: #7f1d1d; }

.dash-score-ring {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 4px;
}
.dash-score-circle {
  width: 72px; height: 72px;
  border-radius: 50%;
  border: 4px solid #22c55e;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dash-score-number {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: #22c55e;
}
.dash-score-detail { font-size: 13px; color: var(--muted); line-height: 1.8; }
.dash-score-grade {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: #22c55e;
}

.dash-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  border: none;
  transition: opacity 0.2s, transform 0.15s;
  text-decoration: none;
}
.dash-btn:hover { opacity: 0.82; transform: translateY(-1px); }
.dash-btn-primary { background: linear-gradient(135deg, var(--accent), #5b5fef); color: #fff; }
.dash-btn-danger  { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.dash-btn-ghost   { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }

.dash-empty { text-align: center; padding: 32px; color: var(--muted); font-size: 13px; }
.dash-empty-icon { font-size: 32px; margin-bottom: 10px; }

.dash-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .dash-two-col { grid-template-columns: 1fr; } }

/* ── Footer ─────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 36px 20px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}