/* ═══════════════════════════════════════════════════════
   GHUB Nebula — Design System v2
   Compact · Animated · Performance-first
   ═══════════════════════════════════════════════════════ */

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

@property --orb-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

/* ── Tokens ─────────────────────────────────────────── */
:root {
  --bg-deep: #050a15;
  --bg-base: #0a1020;
  --surface: #111a2e;
  --surface-elevated: #182338;
  --surface-glass: rgba(17, 26, 46, 0.65);
  --surface-hover: #1e2d4a;
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);

  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-blue: #3b82f6;
  --accent-violet: #8b5cf6;
  --accent-cyan: #06b6d4;
  --accent-rose: #ec4899;
  --brand-gradient: linear-gradient(135deg, var(--accent-blue), var(--accent-violet), var(--accent-rose));
  --brand-gradient-soft: linear-gradient(135deg, rgba(59,130,246,0.1), rgba(139,92,246,0.1), rgba(236,72,153,0.1));

  --discord: #5865F2;
  --discord-hover: #4752C4;
  --success: #22c55e;
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.08);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.25);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 24px rgba(139,92,246,0.12);

  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 150ms var(--ease-smooth);
  --transition-normal: 250ms var(--ease-smooth);
}

/* ── Reset ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg-base);
  background-image: radial-gradient(rgba(139,92,246,0.035) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Ambient ceiling glow */
body::after {
  content: '';
  position: fixed;
  top: -30vh; left: 50%;
  transform: translateX(-50%);
  width: 80vw; height: 55vh;
  background: conic-gradient(from var(--orb-angle),
    rgba(59,130,246,0.05), rgba(139,92,246,0.07),
    rgba(236,72,153,0.05), rgba(59,130,246,0.05));
  filter: blur(100px);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  animation: ambient-drift 20s linear infinite;
}
@keyframes ambient-drift { to { --orb-angle: 360deg; } }

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(255,255,255,0.05);
  padding: 0.1em 0.35em;
  border-radius: var(--radius-xs);
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.07); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }

/* ── App Shell ─────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ── Navbar ─────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 52px;
  background: rgba(10,16,32,0.72);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.brand-text {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: brand-glow 8s ease-in-out infinite;
}
@keyframes brand-glow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.2) drop-shadow(0 0 8px rgba(139,92,246,0.3)); }
}

.beta-badge {
  font-size: 0.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--brand-gradient-soft);
  color: var(--accent-blue);
  border: 1px solid rgba(59,130,246,0.2);
  padding: 2px 6px;
  border-radius: var(--radius-full);
  -webkit-text-fill-color: initial;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0.6rem 0.2rem 0.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  transition: border-color var(--transition-fast);
}
.user-profile:hover { border-color: var(--border-hover); }
.user-profile img { width: 28px; height: 28px; border-radius: 50%; }
.user-profile span { font-weight: 500; font-size: 0.8rem; }

.mode-switcher {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}
.mode-btn {
  background: transparent;
  color: var(--text-dim);
  border: none;
  padding: 0.3rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
}
.mode-btn.active {
  background: var(--surface-elevated);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.mode-btn:hover:not(.active) { color: var(--text-muted); }

/* ── Buttons ───────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: var(--surface-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.42rem 0.85rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.btn:active:not(:disabled) { transform: translateY(0) scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: var(--text);
  color: var(--bg-deep);
  border-color: transparent;
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) {
  background: #f1f5f9;
  box-shadow: 0 4px 16px rgba(255,255,255,0.08);
}

.btn-discord {
  background: var(--discord);
  color: white;
  border-color: transparent;
  font-weight: 600;
}
.btn-discord:hover:not(:disabled) {
  background: var(--discord-hover);
  box-shadow: 0 4px 16px rgba(88,101,242,0.2);
}

.btn-danger {
  background: var(--danger-soft);
  color: #fca5a5;
  border-color: rgba(239,68,68,0.12);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.25);
}

/* ── Container ─────────────────────────────────────── */
.container {
  flex: 1;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ── Guest Hero ────────────────────────────────────── */
.guest-hero {
  position: relative;
  text-align: center;
  padding: 5rem 1rem 3rem;
  max-width: 760px;
  margin: 0 auto;
}

/* Animated gradient orb */
.hero-orb {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -55%);
  width: min(400px, 75vw);
  height: min(400px, 75vw);
  border-radius: 50%;
  background: conic-gradient(from var(--orb-angle),
    var(--accent-blue), var(--accent-violet),
    var(--accent-rose), var(--accent-blue));
  filter: blur(85px);
  opacity: 0.22;
  pointer-events: none;
  z-index: 0;
  animation: orb-spin 15s linear infinite, orb-breathe 6s ease-in-out infinite;
}
@keyframes orb-spin { to { --orb-angle: 360deg; } }
@keyframes orb-breathe {
  0%, 100% { opacity: 0.18; transform: translate(-50%,-55%) scale(1); }
  50%      { opacity: 0.32; transform: translate(-50%,-55%) scale(1.06); }
}

/* Legacy heartbeat (hidden) */
.heartbeat-container { display: none; }
.heartbeat-line { display: none; }

.guest-hero-content { position: relative; z-index: 1; }

.guest-hero h1 {
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 0.75rem;
  text-wrap: balance;
}
.guest-hero p {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.7;
  max-width: 520px;
  margin: 0 auto 2rem;
}

.guest-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.hero-actions-wrapper {
  max-width: 400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.hero-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}
.hero-grid-2.single-btn { grid-template-columns: 1fr; }
.hero-grid-2 .btn {
  width: 100%;
  padding: 0.7rem 0;
  font-size: 0.82rem;
  justify-content: center;
}
.hero-grid-2 .stat-glow-box { min-width: 0; width: 100%; }

/* ── Stat Glow Boxes (Public counters) ─────────────── */
.stat-glow-box {
  position: relative;
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  text-align: center;
  overflow: visible;
  transition: all 0.3s var(--ease-smooth);
  z-index: 1;
}
.stat-glow-box:hover {
  border-color: rgba(139,92,246,0.22);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}
.stat-glow-value {
  font-size: 1.65rem;
  font-weight: 800;
  font-family: var(--font-mono);
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
  margin-bottom: 0.1rem;
}
.stat-glow-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  font-weight: 600;
  line-height: 1.3;
}

.stat-particle {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  border-radius: 2px;
  pointer-events: none;
  z-index: 100;
  animation: burst 2.5s cubic-bezier(0.1,0.8,0.3,1) forwards;
}
@keyframes burst {
  0%   { transform: translate(-50%,-50%) scale(1) rotate(0deg); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0) rotate(var(--rot)); opacity: 0; }
}

/* ── Section Title ─────────────────────────────────── */
.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.section-title::before {
  content: '';
  width: 3px; height: 1em;
  border-radius: 2px;
  background: var(--brand-gradient);
  flex-shrink: 0;
}

/* ── Command Cards ─────────────────────────────────── */
.cmd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.65rem;
}

.cmd-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.95rem 1rem;
  display: flex;
  flex-direction: column;
  transition: all 0.3s var(--ease-smooth);
  overflow: hidden;
  cursor: default;
  animation: card-rise 0.4s var(--ease-smooth) both;
  animation-delay: calc(var(--card-index, 0) * 45ms);
}

/* Cursor spotlight (JS sets --mouse-x / --mouse-y) */
.cmd-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.35s;
  background: radial-gradient(
    320px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(139,92,246,0.07), transparent 50%
  );
  pointer-events: none;
  z-index: 1;
}

.cmd-card:hover {
  border-color: rgba(139,92,246,0.18);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}
.cmd-card:hover::after { opacity: 1; }

@keyframes card-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cmd-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.45rem;
}
.cmd-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--accent-cyan);
  background: rgba(6,182,212,0.08);
  padding: 0.12rem 0.4rem;
  border-radius: var(--radius-xs);
  font-weight: 500;
}
.cmd-title {
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 0.15rem;
  position: relative;
  z-index: 2;
}
.cmd-desc {
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.55;
  flex: 1;
  position: relative;
  z-index: 2;
}

/* ── Dashboard Layout ──────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 232px 1fr;
  gap: 1.25rem;
  align-items: start;
}

/* ── Sidebar ───────────────────────────────────────── */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 68px;
}

.guild-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.3rem;
}
.guild-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}
.guild-btn:hover { background: var(--surface-elevated); }
.guild-btn.active {
  background: var(--brand-gradient-soft);
  box-shadow: inset 2px 0 0 var(--accent-blue);
}
.guild-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.guild-icon-fallback {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--surface-elevated);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.7rem;
  color: var(--text-dim);
  flex-shrink: 0;
}
.guild-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.guild-name {
  font-weight: 600;
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.guild-access {
  font-size: 0.62rem;
  color: var(--text-dim);
}

/* ── Tab Navigation ────────────────────────────────── */
.tab-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 0.5rem 0.65rem;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
}
.tab-btn:hover:not(:disabled) {
  color: var(--text-muted);
  background: rgba(255,255,255,0.025);
}
.tab-btn.active {
  color: var(--text);
  background: var(--surface);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.tab-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.tab-btn-copy {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.tab-btn-copy svg { opacity: 0.45; flex-shrink: 0; }
.tab-btn.active .tab-btn-copy svg { opacity: 0.75; }
.tab-btn-label { display: block; line-height: 1.3; }
.tab-btn-meta {
  display: block;
  font-size: 0.58rem;
  color: var(--text-dim);
  margin-top: 1px;
  font-weight: 400;
}

/* ── Tab Content ───────────────────────────────────── */
.main-content { min-width: 0; }

.tab-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-height: 460px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}
/* Applied via JS only when the tab actually changes */
.tab-content.tab-entering {
  animation: tab-slide 0.28s var(--ease-smooth);
}
@keyframes tab-slide {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0); }
}

.tab-header {
  padding: 1.35rem 1.35rem 1.1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.tab-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.tab-header p {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 0.15rem;
}
.tab-body {
  padding: 1.35rem;
  flex: 1;
}

/* ── Stat Grid (Dashboard) ─────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}
.stat-box {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: border-color var(--transition-fast);
}
.stat-box:hover { border-color: var(--border-hover); }

.stat-value {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-value-plain {
  background: none;
  -webkit-background-clip: initial;
  -webkit-text-fill-color: initial;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}
.stat-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.stat-copy {
  font-size: 0.68rem;
  color: var(--text-dim);
  line-height: 1.45;
}

/* ── Panel Layouts ─────────────────────────────────── */
.panel-stack { display: flex; flex-direction: column; gap: 1rem; }
.compact-stack { gap: 0.65rem; }
.panel-grid { display: grid; gap: 0.85rem; }
.panel-grid-2 { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }

/* ── Feature Cards & Panel Sections ────────────────── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.65rem;
}

.feature-card,
.panel-section-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.05rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.feature-card:hover,
.panel-section-card:hover { border-color: var(--border-hover); }

.feature-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 100%;
}
.feature-card-head,
.panel-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}
.panel-section-head {
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}
.feature-kicker {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-blue);
  font-weight: 700;
}
.feature-card h3,
.panel-section-head h3 { font-size: 0.9rem; font-weight: 700; }
.feature-card p,
.panel-section-head p { color: var(--text-muted); font-size: 0.78rem; line-height: 1.55; }

.feature-detail-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.75rem;
}
.feature-detail-list span,
.detail-note {
  padding: 0.5rem 0.65rem;
  background: rgba(255,255,255,0.018);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.45;
}
.detail-note { display: flex; flex-direction: column; gap: 0.2rem; }
.feature-card-footer { margin-top: auto; padding-top: 0.4rem; }
.panel-section-body { display: flex; flex-direction: column; gap: 0.65rem; }

/* ── Status Pill ───────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-full);
  padding: 0.18rem 0.45rem;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  color: var(--text-dim);
  font-size: 0.56rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.status-pill-neutral {
  color: var(--accent-blue);
  border-color: rgba(59,130,246,0.18);
  background: rgba(59,130,246,0.05);
}

/* ── Action Tiles ──────────────────────────────────── */
.action-tile {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.75rem 0.85rem;
  background: rgba(255,255,255,0.018);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast);
}
.action-tile:hover { border-color: var(--border-hover); }
.action-tile h3 { font-size: 0.85rem; font-weight: 600; }
.action-tile p { color: var(--text-muted); font-size: 0.75rem; }
.action-tile-danger {
  background: var(--danger-soft);
  border-color: rgba(239,68,68,0.1);
}

/* ── Forms ──────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 0.85rem;
}
.form-group { display: flex; flex-direction: column; gap: 0.3rem; }
.form-group label { font-size: 0.78rem; font-weight: 600; color: var(--text); }
.form-hint { font-size: 0.65rem; color: var(--text-dim); }

.form-control {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  transition: all var(--transition-fast);
  outline: none;
}
.form-control:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
  background: var(--surface);
}
.form-control::placeholder { color: var(--text-dim); }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2rem;
  cursor: pointer;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  padding: 0.5rem 0.65rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 500;
  transition: border-color var(--transition-fast);
}
.toggle-label:hover { border-color: var(--border-hover); }
.toggle-label input[type="checkbox"] {
  width: 0.95rem; height: 0.95rem;
  accent-color: var(--accent-violet);
  cursor: pointer;
}

.form-actions {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

/* ── Member Search ─────────────────────────────────── */
.member-search-wrap { position: relative; }

.search-results {
  position: absolute;
  top: calc(100% + 0.3rem);
  left: 0; right: 0;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  z-index: 20;
  box-shadow: var(--shadow-lg);
}
.search-item {
  padding: 0.5rem 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: rgba(255,255,255,0.035); }
.search-item img { width: 24px; height: 24px; border-radius: 5px; }
.search-item-info { display: flex; flex-direction: column; }
.search-item-name { font-weight: 600; font-size: 0.78rem; }
.search-item-id { font-size: 0.6rem; color: var(--text-dim); font-family: var(--font-mono); }

/* ── Leaderboard ───────────────────────────────────── */
.lb-list { display: flex; flex-direction: column; gap: 0.3rem; }
.lb-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.7rem;
  background: rgba(255,255,255,0.018);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: background var(--transition-fast);
}
.lb-row:hover { background: rgba(255,255,255,0.035); }
.lb-user { font-weight: 600; font-size: 0.78rem; }
.lb-score {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-rose);
  font-weight: 600;
}

/* ── Empty States ──────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-dim);
}
.empty-state h3 { color: var(--text); font-size: 1rem; margin-bottom: 0.3rem; }
.empty-state p { font-size: 0.78rem; max-width: 340px; }

/* ── Toasts ────────────────────────────────────────── */
#toast-host {
  position: fixed;
  bottom: 1rem; right: 1rem;
  z-index: 1000;
}
.toast-container { display: flex; flex-direction: column; gap: 0.4rem; }
.toast {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
  font-size: 0.78rem;
  animation: toast-pop 0.3s var(--ease-spring);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
@keyframes toast-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Tooltip ───────────────────────────────────────── */
.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--surface-hover);
  color: var(--text-dim);
  font-size: 9px;
  font-weight: 700;
  cursor: help;
  position: relative;
  margin-left: 0.3rem;
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.tooltip-icon:hover {
  background: var(--accent-blue);
  color: white;
  border-color: var(--accent-blue);
}
.tooltip-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  font-weight: 500;
  white-space: nowrap;
  max-width: 250px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s var(--ease-smooth);
  box-shadow: var(--shadow-lg);
  z-index: 100;
}
.tooltip-icon:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Spinner ───────────────────────────────────────── */
.loading-spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive: Tablet ────────────────────────────── */
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    gap: 0.6rem;
    padding-bottom: 0.4rem;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar > * { flex-shrink: 0; }
  .tab-nav { flex-direction: row; overflow-x: auto; gap: 2px; }
  .tab-btn { white-space: nowrap; padding: 0.45rem 0.65rem; }
  .tab-btn-meta { display: none; }
  .guild-card { min-width: 190px; }
}

/* ── Responsive: Mobile ────────────────────────────── */
@media (max-width: 640px) {
  body { font-size: 13px; }
  .navbar {
    height: auto;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    gap: 0.4rem;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--bg-base);
  }
  .brand { order: 1; }
  .nav-actions { order: 2; }
  .mode-switcher { order: 3; width: 100%; justify-content: center; }
  .container { padding: 0.75rem; }
  .guest-hero { padding: 2.5rem 0.5rem 1.5rem; }
  .guest-hero h1 { font-size: 1.8rem; }
  .guest-hero p { font-size: 0.82rem; }
  .hero-orb { width: 260px; height: 260px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .panel-grid-2 { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .cmd-grid { grid-template-columns: 1fr; }
  .tab-header { padding: 0.85rem; }
  .tab-body { padding: 0.85rem; }
  .tooltip-icon::after {
    white-space: normal;
    max-width: 160px;
    text-align: center;
    font-size: 0.58rem;
  }
}

/* ── Reduced Motion ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .hero-orb { opacity: 0.12; }
  body::after { animation: none; }
}
