@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: dark;
  --bg: #0a0e17;
  --panel: #111827;
  --panel-alt: #0d1420;
  --sidebar: #0d1320;
  --border: #1f2937;
  --border-soft: #182233;
  --text: #f3f5f9;
  --text-dim: #8a94a6;
  --accent: #4f9fe0;
  --accent-soft: #8fd4ff;
  --accent-hover: #3d84c2;
  --danger: #ed4245;
  --danger-hover: #c93638;
  --success: #22c55e;
  --warning: #f5a524;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body.centered {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

a { color: inherit; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
}

.login-card {
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
  text-align: center;
}

.login-card .brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.login-card .brand img { width: 48px; height: 48px; }
.login-card h1 { font-size: 20px; margin: 0; font-weight: 800; letter-spacing: -0.02em; }
.login-card p.muted { margin: 0 0 4px; }

.discord-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #5865f2;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
}
.discord-login-btn:hover { background: #4752c4; }

.invite-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  color: var(--text-dim);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
}
.invite-btn:hover { color: var(--text); border-color: var(--accent); }

.invite-btn-small {
  color: var(--text);
  text-decoration: none;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.invite-btn-small:hover { border-color: var(--accent); }

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-dim);
}

input, select, textarea {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

textarea { resize: vertical; }

button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
button:hover { background: var(--accent-hover); }
button.danger { background: var(--danger); }
button.danger:hover { background: var(--danger-hover); }
button.secondary { background: var(--panel-alt); border: 1px solid var(--border); color: var(--text); }
button.secondary:hover { border-color: var(--accent); }

.error { color: var(--danger); font-size: 13px; min-height: 16px; }

/* --- Global navbar (server picker view) --- */
header.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 19, 32, 0.6);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand-mark { display: flex; align-items: center; gap: 10px; }
.brand-mark img { width: 26px; height: 26px; }
.brand-mark span { font-weight: 800; font-size: 16px; letter-spacing: -0.01em; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
}

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.online { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.offline { background: var(--danger); }

.user-menu { position: relative; }
.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid transparent;
  padding: 4px 8px 4px 4px;
  border-radius: 999px;
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
}
.user-menu-btn:hover { background: var(--panel-alt); border-color: var(--border); }
.user-menu-btn img { width: 24px; height: 24px; border-radius: 50%; }
.user-menu-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 160px;
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.user-menu-dropdown.open { display: flex; }
.user-menu-dropdown button {
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 8px 10px;
  font-weight: 500;
  border-radius: 6px;
}
.user-menu-dropdown button:hover { background: var(--panel-alt); }

.row { display: flex; gap: 10px; align-items: center; }

/* --- Servers picker view --- */
main.servers-view {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px;
}
main.servers-view h1 { font-size: 26px; margin: 0 0 6px; font-weight: 800; letter-spacing: -0.02em; }
main.servers-view > p.muted { margin: 0 0 24px; }

.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.server-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  cursor: pointer;
}
.server-card:hover { border-color: var(--accent); }
.server-card .server-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--panel-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
  color: var(--accent-soft);
}
.server-card .server-name { font-weight: 700; font-size: 15px; }
.server-card .server-meta { color: var(--text-dim); font-size: 13px; }

.empty-state { color: var(--text-dim); padding: 40px 0; text-align: center; }

/* --- Dashboard (sidebar) layout --- */
.dashboard-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 14px;
  gap: 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 8px;
  text-decoration: none;
  cursor: pointer;
}
.sidebar-brand img { width: 22px; height: 22px; }
.sidebar-brand span { font-weight: 800; font-size: 15px; }

.server-switcher select {
  width: 100%;
  font-weight: 600;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.sidebar-section-label {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 14px 10px 4px;
}
.sidebar-nav button.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--text-dim);
  border: none;
  border-left: 2px solid transparent;
  border-radius: 6px;
  padding: 9px 10px;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}
.sidebar-nav button.nav-item:hover { background: var(--panel-alt); color: var(--text); }
.sidebar-nav button.nav-item.active {
  background: rgba(79, 159, 224, 0.12);
  color: var(--text);
  border-left-color: var(--accent);
}

.sidebar-footer { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.sidebar-footer .status-pill { width: 100%; justify-content: center; }
.sidebar-footer .row { gap: 8px; }
.sidebar-footer .invite-btn-small { flex: 1; text-align: center; }
.sidebar-footer .user-menu-btn { width: 100%; justify-content: flex-start; }
.sidebar-footer .user-menu-dropdown { left: 0; right: auto; bottom: calc(100% + 6px); top: auto; width: 100%; }

.dashboard-main { flex: 1; min-width: 0; }
.dashboard-content { max-width: 900px; margin: 0 auto; padding: 28px 28px 60px; display: flex; flex-direction: column; gap: 20px; }

.banner {
  background: rgba(245, 165, 36, 0.1);
  border: 1px solid rgba(245, 165, 36, 0.35);
  color: var(--warning);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
}

.section-header h1 { font-size: 22px; margin: 0 0 4px; font-weight: 800; letter-spacing: -0.02em; }
.section-header p { margin: 0; color: var(--text-dim); font-size: 14px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 18px; }
.stat-card .stat-value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.stat-card .stat-value.ok { color: var(--success); }
.stat-card .stat-value.warn { color: var(--warning); }
.stat-card .stat-label { color: var(--text-dim); font-size: 13px; margin-top: 4px; }

.activity-panel-header { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.activity-panel-header .bar { width: 3px; height: 16px; background: var(--accent); border-radius: 2px; }
.activity-panel-header h3 { margin: 0; font-size: 15px; font-weight: 700; }

.activity-row { padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.activity-row:last-child { border-bottom: none; }
.activity-row .activity-title { font-weight: 600; font-size: 14px; }
.activity-row .activity-meta { color: var(--text-dim); font-size: 12px; margin-top: 2px; }

.panel { display: none; flex-direction: column; gap: 20px; }
.panel.active { display: flex; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }

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

.faq-form { display: grid; gap: 10px; grid-template-columns: 1fr; }
.faq-form textarea { min-height: 70px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
}

.muted { color: var(--text-dim); font-size: 13px; }

@media (max-width: 720px) {
  .dashboard-layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
}
