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

:root {
  --bg-0: #0a0a0a;
  --bg-1: #111;
  --bg-2: #1a1a1a;
  --bg-3: #222;
  --bg-hover: #2a2a2a;
  --bg-input: #1e1e1e;
  --border: #2a2a2a;
  --border-light: #333;
  --text: #eee;
  --text-2: #ccc;
  --text-muted: #777;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --accent-glow: rgba(88,101,242,0.25);
  --green: #23a55a;
  --red: #ed4245;
  --gold: #f5a623;
  --purple: #9b59b6;
  --radius: 8px;
  --radius-lg: 12px;
}

html, body { height: 100%; font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg-0); color: var(--text); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
.hidden { display: none !important; }
.view { height: 100%; }
input, select, textarea, button { font-family: inherit; }
/* Global dark form controls — prevents any white boxes in the dashboard */
input, select, textarea {
  background: rgba(30, 30, 30, 0.8); color: var(--text); border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius); padding: 8px 10px; font-size: 14px; outline: none; transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
select option { background: #1e1e1e; color: var(--text); }
input[type="color"] { padding: 2px; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { width: auto; padding: 0; background: transparent; border: none; }
button, a, label, .toggle, .guild-item, .tab, .template-chip { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* ═══ Landing / Login ═══════════════════════════════════════════════ */
.landing {
  height: 100%; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at top, #1a1a3e 0%, var(--bg-0) 70%);
}
.landing-content { text-align: center; max-width: 440px; }
.landing-logo { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 8px; }
.logo-icon {
  width: 48px; height: 48px; background: var(--accent); border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800; color: #fff;
}
.logo-icon.small { width: 32px; height: 32px; font-size: 16px; border-radius: 8px; }
.landing h1 { font-size: 36px; font-weight: 800; letter-spacing: -0.02em; }
.landing-subtitle { color: var(--text-muted); font-size: 16px; margin-bottom: 24px; }
.landing-stats { display: flex; justify-content: center; gap: 32px; margin-bottom: 32px; }
.landing-stats .stat { text-align: center; }
.landing-stats .stat-value { font-size: 24px; font-weight: 700; color: var(--text); }
.landing-stats .stat-label { font-size: 12px; color: var(--text-muted); }
.landing-note { font-size: 12px; color: var(--text-muted); margin-top: 16px; }

.btn-discord {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 32px; background: #5865f2; color: #fff;
  border: none; border-radius: var(--radius); font-size: 16px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.btn-discord:hover { background: #4752c4; transform: translateY(-1px); box-shadow: 0 4px 24px rgba(88,101,242,0.3); }

/* ═══ Topbar ════════════════════════════════════════════════════════ */
.topbar {
  height: 56px;
  background: rgba(10, 10, 10, 0.8);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-brand {
  font-size: 16px; font-weight: 800; letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent), #7c6cf2);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-pill { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; }
.user-pill img { width: 28px; height: 28px; border-radius: 50%; }

.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 6px; cursor: pointer; border: none; font-weight: 500; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: var(--bg-hover); }

/* ═══ Dashboard body ════════════════════════════════════════════════ */
#dashboard-view:not(.hidden) { display: flex; flex-direction: column; height: 100vh; }
.dashboard-body { display: flex; flex: 1; overflow: visible; margin-top: 56px; /* offset for fixed topbar */ height: calc(100vh - 56px); }

/* Sidebar — fixed left */
.sidebar {
  width: 260px; min-width: 260px;
  background: rgba(17, 17, 17, 0.9);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  display: flex; flex-direction: column;
  position: fixed; top: 56px; bottom: 0; left: 0; z-index: 50;
  transition: width 0.25s ease, min-width 0.25s ease;
  overflow: hidden;
}
/* Collapsed server sidebar */
body.sidebar-collapsed .sidebar { width: 0; min-width: 0; border-right: none; }
body.sidebar-collapsed .nav-sidebar { left: 0; transition: left 0.25s ease; }
body.sidebar-collapsed .content { margin-left: 200px; }
.nav-sidebar { transition: left 0.25s ease; }
/* Toggle button */
.btn-sidebar-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; background: none; border: none;
  color: var(--text-muted); cursor: pointer; border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}
.btn-sidebar-toggle:hover { color: var(--text); background: var(--bg-hover); }
.sidebar-scroll {
  flex: 1; overflow-y: auto; padding: 16px 12px;
}
.sidebar-section h3 {
  font-size: 11px; text-transform: uppercase; color: var(--text-muted);
  letter-spacing: 0.05em; margin-bottom: 4px; padding: 0 8px;
}
.sidebar-hint {
  font-size: 11px; color: var(--text-muted); padding: 0 8px; margin-bottom: 10px;
  opacity: 0.7;
}
.guild-list { display: flex; flex-direction: column; gap: 2px; }
.guild-item {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border-radius: var(--radius); cursor: pointer; transition: background 0.15s;
}
.guild-item:hover { background: var(--bg-hover); }
.guild-item.active { background: var(--accent); }
.guild-item img { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.guild-initial {
  width: 36px; height: 36px; border-radius: 50%; background: var(--bg-3);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.guild-item-info { flex: 1; min-width: 0; }
.guild-item-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guild-item-meta { font-size: 11px; color: var(--text-muted); }
.guild-item.active .guild-item-meta { color: rgba(255,255,255,0.7); }
.guild-item.guild-no-bot { opacity: 0.4; cursor: default; }
.guild-item.guild-no-bot img, .guild-item.guild-no-bot .guild-initial { filter: grayscale(100%); }
.guild-item.guild-no-bot:hover { background: var(--bg-2); opacity: 0.65; }
.guild-invite-btn { background: var(--accent); color: #fff; border: none; border-radius: 6px; font-size: 11px; padding: 3px 10px; cursor: pointer; flex-shrink: 0; font-weight: 600; }
.guild-invite-btn:hover { filter: brightness(1.15); }

/* Sidebar upgrade CTA */
.sidebar-upgrade {
  flex-shrink: 0;
  padding: 16px 14px;
  background: linear-gradient(180deg, rgba(245, 166, 35, 0.06) 0%, rgba(245, 166, 35, 0.02) 100%);
  border-top: 1px solid rgba(245, 166, 35, 0.15);
  display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center;
}
.sidebar-upgrade-icon { font-size: 24px; }
.sidebar-upgrade-text strong {
  display: block; font-size: 13px; font-weight: 700; color: var(--gold); margin-bottom: 2px;
}
.sidebar-upgrade-text span {
  font-size: 11px; color: var(--text-muted); line-height: 1.4; display: block;
}
.sidebar-upgrade-btn {
  width: 100%; padding: 8px 16px;
  background: linear-gradient(135deg, #f5a623, #f57731); color: #000;
  border: none; border-radius: var(--radius); font-size: 13px; font-weight: 700;
  cursor: pointer; transition: all 0.2s;
}
.sidebar-upgrade-btn:hover {
  transform: translateY(-1px); box-shadow: 0 4px 16px rgba(245, 166, 35, 0.3);
}

/* Content — offset for both sidebars */
.content { flex: 1; overflow-y: auto; padding: 24px 40px 40px; margin-left: 460px; /* 260 server + 200 nav */ }

/* ═══ Empty state — "no guild selected" ════════════════════════════ */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; color: var(--text-muted); gap: 12px; text-align: center;
}
.empty-state-icon { margin-bottom: 8px; opacity: 0.4; }
.empty-state h2 { color: var(--text); font-size: 22px; }
.empty-state > p { max-width: 420px; line-height: 1.6; font-size: 14px; }
.empty-steps {
  display: flex; gap: 24px; margin-top: 24px; flex-wrap: wrap; justify-content: center;
}
.empty-step {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 18px; font-size: 13px; color: var(--text-2);
}
.step-num {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent);
  color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* Header */
.content-header { margin-bottom: 16px; }
.guild-header-info { display: flex; align-items: center; gap: 14px; }
.guild-avatar { width: 44px; height: 44px; border-radius: 50%; }
.guild-header-info h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.header-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.tier-badge {
  display: inline-block; padding: 2px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
}
.tier-badge.free { background: var(--bg-3); color: var(--text-muted); }
.tier-badge.premium { background: linear-gradient(135deg, #f5a623, #f57731); color: #000; }
.meta { font-size: 13px; color: var(--text-muted); }

/* ═══ Tab Intro (description at top of each tab) ═══════════════════ */
.tab-intro {
  margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.tab-intro h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; letter-spacing: -0.02em; }
.tab-intro p { font-size: 13px; color: var(--text-muted); line-height: 1.5; max-width: 640px; }
.tab-intro-legend {
  display: flex; gap: 18px; margin-top: 14px; flex-wrap: wrap;
}
.legend-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted);
}
.legend-dot {
  width: 10px; height: 10px; border-radius: 50%;
}
.legend-dot.green { background: var(--green); }
.legend-dot.gray { background: var(--bg-3); border: 1px solid var(--border-light); }
.legend-dot.gold { background: var(--gold); }
.legend-dot.purple { background: var(--purple); }

/* ═══ Help badge (?) ═══════════════════════════════════════════════ */
.help-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--bg-3); border: 1px solid var(--border-light);
  color: var(--text-muted); font-size: 11px; font-weight: 700;
  cursor: help; position: relative; flex-shrink: 0;
}
.help-badge.small { width: 16px; height: 16px; font-size: 10px; }
.help-badge:hover { color: var(--text); border-color: var(--accent); background: var(--bg-hover); }
.help-badge[title]:hover::after {
  content: attr(title);
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--bg-1); border: 1px solid var(--border-light); border-radius: var(--radius);
  padding: 10px 14px; font-size: 12px; font-weight: 400; color: var(--text-2);
  white-space: normal; width: 260px; line-height: 1.5;
  z-index: 100; pointer-events: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* ═══ Status indicators ════════════════════════════════════════════ */
.status-indicator {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: var(--radius);
  background: var(--bg-3); margin-bottom: 18px;
  font-size: 13px;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.status-dot.on { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.off { background: var(--text-muted); }
.status-text { color: var(--text-muted); }
.status-indicator.active { background: rgba(35,165,90,0.08); border: 1px solid rgba(35,165,90,0.2); }
.status-indicator.active .status-text { color: var(--green); }

/* ═══ Section title row (title + action) ═══════════════════════════ */
.section-title-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.section-title-row h3 { font-size: 16px; font-weight: 600; }
.section-hint {
  font-size: 12px; color: var(--text-muted); margin-bottom: 14px; line-height: 1.5;
}
.section-hint strong { color: var(--text-2); }

/* ═══ Hint box (variable list etc) ════════════════════════════════ */
.hint-box {
  margin-top: 8px; padding: 10px 14px;
  background: rgba(88,101,242,0.06); border: 1px solid rgba(88,101,242,0.12);
  border-radius: var(--radius); font-size: 12px; color: var(--text-2);
}
.hint-box strong { color: var(--text); display: block; margin-bottom: 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; }
.hint-vars { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 4px; }
.hint-vars code {
  background: var(--bg-3); padding: 1px 6px; border-radius: 4px;
  font-size: 12px; color: var(--accent); font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ═══ Command reference (niche tabs) ═══════════════════════════════ */
.command-list { display: flex; flex-direction: column; gap: 0; }
.cmd-ref {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.cmd-ref:last-child { border-bottom: none; }
.cmd-ref code {
  background: var(--bg-3); padding: 4px 10px; border-radius: 4px;
  font-size: 13px; color: var(--accent); font-family: 'SF Mono', 'Fira Code', monospace;
  white-space: nowrap; flex-shrink: 0;
}
.cmd-ref span { font-size: 13px; color: var(--text-muted); text-align: right; }
.niche-card-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }

/* ═══ Nav Sidebar (section navigation) ════════════════════════════ */
.nav-sidebar {
  width: 200px; min-width: 200px;
  position: fixed; top: 56px; bottom: 0; left: 260px; z-index: 40;
  background: rgba(14, 14, 14, 0.95);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  overflow-y: auto; padding: 16px 10px;
  display: flex; flex-direction: column; gap: 2px;
}
.nav-section-label {
  font-size: 10px; text-transform: uppercase; color: var(--text-muted);
  letter-spacing: 0.06em; font-weight: 700; padding: 12px 14px 4px; opacity: 0.6;
}
.nav-separator {
  height: 1px; background: var(--border); margin: 8px 10px;
}
.nav-tab {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; background: none; border: none;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-muted); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.15s; text-align: left;
  white-space: nowrap; width: 100%;
}
.nav-tab:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav-tab.active {
  background: rgba(88,101,242,0.08); border-left-color: var(--accent); color: var(--accent);
}
.tab-svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-tab.dynamic { position: relative; }
.nav-tab.dynamic::after {
  content: ''; position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 6px; height: 6px; border-radius: 50%; background: var(--green);
}
.nav-tab.dynamic.active { border-left-color: var(--purple); color: var(--purple); }

.tab-content { display: none; animation: fadeIn 0.25s ease; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ═══ Dashboard Overview ═══════════════════════════════════════════ */
.overview-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 16px; margin-bottom: 20px;
}
.overview-card {
  background: rgba(26, 26, 26, 0.7); border: 1px solid rgba(255, 255, 255, 0.06); border-radius: var(--radius-lg);
  padding: 22px 24px; transition: all 0.2s;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.overview-card:hover { border-color: rgba(255, 255, 255, 0.12); }
.overview-card .ov-icon { margin-bottom: 10px; opacity: 0.85; color: var(--text-muted); }
.overview-card .ov-icon svg { width: 24px; height: 24px; }
.overview-card .ov-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.overview-card .ov-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ═══ Roleplay Spotlight (Dashboard Overview) ═════════════════════ */
.rp-spotlight {
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.06), rgba(124, 108, 242, 0.03));
  border: 1px solid rgba(88, 101, 242, 0.15);
  border-radius: var(--radius-lg);
  padding: 24px 28px; margin-bottom: 24px;
}
.rp-spotlight-header {
  display: flex; align-items: center; gap: 14px; margin-bottom: 18px;
}
.rp-spotlight-icon { font-size: 32px; }
.rp-spotlight-header h3 { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.rp-spotlight-sub { font-size: 12px; color: var(--text-muted); }
.rp-spotlight-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px;
}
.rp-spot-card {
  background: rgba(26, 26, 26, 0.7); border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius); padding: 16px; text-align: center;
  transition: border-color 0.2s;
}
.rp-spot-card:hover { border-color: rgba(88, 101, 242, 0.3); }
.rp-spot-card .rp-spot-icon { font-size: 24px; margin-bottom: 8px; }
.rp-spot-card .rp-spot-val { font-size: 20px; font-weight: 700; }
.rp-spot-card .rp-spot-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.rp-spot-card.rp-spot-locked {
  opacity: 0.5; position: relative;
}
.rp-spot-card.rp-spot-locked .rp-spot-val { color: var(--gold); }
.rp-spot-card.rp-spot-upgrade {
  background: linear-gradient(135deg, rgba(245, 166, 35, 0.08), rgba(245, 166, 35, 0.02));
  border-color: rgba(245, 166, 35, 0.2); cursor: pointer;
}
.rp-spot-card.rp-spot-upgrade:hover {
  border-color: rgba(245, 166, 35, 0.4);
}
.rp-spot-card.rp-spot-upgrade .rp-spot-val { color: var(--gold); font-size: 16px; }

/* ═══ Server Info Grid (real stats) ═══════════════════════════════ */
.server-info-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px; margin-bottom: 28px;
}
.server-info-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: rgba(26, 26, 26, 0.5); border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg); transition: border-color 0.2s;
}
.server-info-item:hover { border-color: rgba(255, 255, 255, 0.1); }
.server-info-item .si-icon { flex-shrink: 0; color: var(--text-muted); opacity: 0.7; }
.server-info-item .si-icon svg { width: 20px; height: 20px; }
.server-info-item .si-data { min-width: 0; }
.server-info-item .si-value { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.server-info-item .si-label { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.server-info-item.si-online .si-icon { color: var(--green); opacity: 1; }
.server-info-item.si-boost .si-icon { color: #f47fff; opacity: 1; }

/* ═══ Quick Actions ═══════════════════════════════════════════════ */
.quick-actions { margin-top: 4px; }
.quick-actions h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.quick-actions-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px;
}
.quick-action-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; background: rgba(26, 26, 26, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06); border-radius: var(--radius-lg);
  color: var(--text-2); font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all 0.2s; text-align: left;
}
.quick-action-btn:hover {
  border-color: var(--accent); background: rgba(88,101,242,0.06);
  color: var(--text); transform: translateY(-1px);
}
.quick-action-btn svg { flex-shrink: 0; color: var(--text-muted); }
.pack-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; margin-top: 4px; }
.pack-card {
  background: var(--bg-3); border: 1px solid var(--border-light); border-radius: var(--radius-lg);
  padding: 20px; position: relative; overflow: hidden;
}
.pack-card.active { border-color: var(--accent); }
.pack-card-icon { font-size: 32px; margin-bottom: 8px; }
.pack-card h4 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.pack-card p { font-size: 12px; color: var(--text-muted); line-height: 1.4; margin-bottom: 12px; }
.pack-card .pack-status { font-size: 11px; font-weight: 600; text-transform: uppercase; }
.pack-card .pack-status.active { color: var(--green); }
.pack-card .pack-status.locked { color: var(--gold); }

/* ═══ Module grid ═══════════════════════════════════════════════════ */
.module-category { margin-bottom: 32px; }
.module-category-header {
  font-size: 11px; text-transform: uppercase; color: var(--text-muted);
  letter-spacing: 0.08em; margin-bottom: 14px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
.module-category-header::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.modules-grid { display: flex; flex-direction: column; gap: 6px; }
.module-card {
  background: rgba(26, 26, 26, 0.7); border: 1px solid rgba(255, 255, 255, 0.06); border-radius: var(--radius);
  padding: 14px 18px; transition: all 0.2s;
  display: flex; align-items: center; gap: 16px;
}
.module-card:hover { border-color: rgba(255, 255, 255, 0.12); background: rgba(30, 30, 30, 0.9); }
.module-card.enabled { border-left: 3px solid var(--green); }
.module-card.locked { opacity: 0.55; }
.module-card.niche { border-left: 3px solid var(--purple); background: rgba(155,89,182,0.03); }
.module-card.niche.locked { border-left-color: var(--border); background: var(--bg-2); }
.module-card-icon { font-size: 20px; flex-shrink: 0; width: 32px; text-align: center; }
.module-card-body { flex: 1; min-width: 0; }
.module-card-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.module-card-title h4 { font-size: 14px; font-weight: 600; margin: 0; white-space: nowrap; }
.module-card p { font-size: 12px; color: var(--text-muted); margin: 2px 0 0; line-height: 1.4; }
.module-card-meta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.module-tier { font-size: 9px; padding: 2px 6px; border-radius: 4px; font-weight: 700; text-transform: uppercase; }
.module-tier.premium { background: #2a1a0a; color: var(--gold); }
.module-tier.pack { background: rgba(155,89,182,0.15); color: var(--purple); }
.module-cmd-count {
  font-size: 10px; color: var(--text-muted); background: var(--bg-3);
  padding: 2px 8px; border-radius: 10px; white-space: nowrap;
}
.module-limits { margin-top: 4px; }
.module-status-badge {
  font-size: 9px; padding: 2px 7px; border-radius: 4px; font-weight: 600;
  text-transform: uppercase; white-space: nowrap;
}
.module-status-badge.always-on { background: rgba(46,204,113,0.12); color: var(--green); }
.module-status-badge.free-toggle { background: rgba(46,204,113,0.08); color: var(--green); }
.module-status-badge.premium-lock { background: rgba(245,166,35,0.1); color: var(--gold); }
.module-status-badge.limited { background: rgba(245,166,35,0.08); color: #e8a838; }
.module-commands { display: none; }
.module-toggle-hint { display: none; }
.module-discord-only {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9px; color: var(--text-muted); margin-left: 8px;
  opacity: 0.7;
}
.module-card-header { display: contents; }

/* Toggle */
.toggle { position: relative; width: 42px; height: 24px; cursor: pointer; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider {
  position: absolute; inset: 0; background: var(--bg-3); border-radius: 24px; transition: 0.25s;
}
.toggle .slider::before {
  content: ''; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: 0.25s;
}
.toggle input:checked + .slider { background: var(--green); }
.toggle input:checked + .slider::before { transform: translateX(18px); }
.toggle input:disabled + .slider { opacity: 0.3; cursor: not-allowed; }

/* ═══ Automation layout (sidebar + panels) ═════════════════════════ */
.auto-layout { display: flex; gap: 24px; }
.auto-nav {
  width: 180px; min-width: 180px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 60px; align-self: flex-start;
}
.auto-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: none; border: 1px solid transparent;
  border-radius: var(--radius); color: var(--text-muted); font-size: 13px;
  font-weight: 500; cursor: pointer; transition: all 0.15s; text-align: left;
}
.auto-nav-item:hover { background: var(--bg-2); color: var(--text); }
.auto-nav-item.active { background: var(--bg-2); border-color: var(--accent); color: var(--text); }
.auto-nav-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--bg-3); margin-left: auto; flex-shrink: 0;
}
.auto-nav-dot.on { background: var(--green); box-shadow: 0 0 6px var(--green); }

.auto-panels { flex: 1; min-width: 0; max-width: 680px; }
.auto-panel { display: none; animation: fadeIn 0.2s ease; }
.auto-panel.active { display: block; }

/* Message type toggle */
.msg-type-toggle { display: flex; gap: 0; border: 1px solid var(--border-light); border-radius: var(--radius); overflow: hidden; width: fit-content; }
.msg-type-btn {
  padding: 8px 20px; background: var(--bg-input); border: none; color: var(--text-muted);
  font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s;
}
.msg-type-btn:not(:last-child) { border-right: 1px solid var(--border-light); }
.msg-type-btn.active { background: var(--accent); color: #fff; }
.msg-type-btn:hover:not(.active) { background: var(--bg-hover); color: var(--text); }

.auto-msg-embed { margin-top: 8px; padding: 16px; background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius-lg); }

/* Block Automations */
.block-zone { margin-bottom: 4px; }
.block-zone-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 8px; color: var(--text-muted);
}
.block-zone-icon { font-size: 16px; }
.block-zone-trigger .block-zone-label { color: #f5a623; }
.block-zone-condition .block-zone-label { color: #5865f2; }
.block-zone-action .block-zone-label { color: #57f287; }

.block-card {
  display: flex; border-radius: 10px; overflow: hidden;
  background: var(--bg-2); border: 1px solid var(--border);
  margin-bottom: 8px; transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
}
.block-card:hover { border-color: var(--border-light); box-shadow: 0 2px 8px rgba(0,0,0,0.2); }

.block-bar {
  width: 5px; flex-shrink: 0;
}
.block-bar.trigger { background: #f5a623; }
.block-bar.condition { background: #5865f2; }
.block-bar.action { background: #57f287; }

.block-body {
  flex: 1; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px;
}
.block-body select, .block-body input, .block-body textarea {
  width: 100%; padding: 8px 10px; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 13px;
}
.block-body select { cursor: pointer; }
.block-body textarea { resize: vertical; min-height: 60px; font-family: inherit; }
.block-body label { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 2px; }

.block-remove {
  position: absolute; top: 8px; right: 8px; width: 22px; height: 22px;
  border-radius: 50%; background: rgba(237,66,69,0.15); border: none;
  color: #ed4245; font-size: 14px; cursor: pointer; display: flex;
  align-items: center; justify-content: center; transition: background 0.15s;
  line-height: 1;
}
.block-remove:hover { background: rgba(237,66,69,0.35); }

.block-connector { display: flex; justify-content: center; padding: 2px 0; }

.btn-block-add {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 10px; background: transparent; border: 2px dashed var(--border);
  border-radius: 10px; color: var(--text-muted); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.15s; margin-bottom: 8px;
}
.btn-block-add:hover { background: var(--bg-2); color: var(--text); }
.btn-block-add.condition:hover { border-color: #5865f2; color: #5865f2; }
.btn-block-add.action:hover { border-color: #57f287; color: #57f287; }

.block-and-badge {
  display: flex; justify-content: center; margin: -2px 0;
}
.block-and-badge span {
  font-size: 10px; font-weight: 700; color: #5865f2; background: rgba(88,101,242,0.15);
  padding: 2px 10px; border-radius: 10px; letter-spacing: 1px;
}

.automation-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 8px; transition: border-color 0.15s;
}
.automation-item:hover { border-color: var(--border-light); }
.automation-item .auto-info { flex: 1; min-width: 0; }
.automation-item .auto-name { font-weight: 600; color: var(--text); font-size: 14px; }
.automation-item .auto-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.automation-item .auto-actions { display: flex; gap: 6px; flex-shrink: 0; }

.btn-sm {
  padding: 4px 10px; font-size: 12px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg-3); color: var(--text-muted); cursor: pointer; transition: all 0.15s;
}
.btn-sm:hover { background: var(--bg-hover); color: var(--text); }
.btn-sm.danger { border-color: rgba(237,66,69,0.3); color: #ed4245; }
.btn-sm.danger:hover { background: rgba(237,66,69,0.15); }

.toggle-switch {
  position: relative; width: 36px; height: 20px; cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--bg-3); border-radius: 20px;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: ''; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; left: 3px; top: 3px; transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--green, #57f287); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); }

/* Command list items */
.cmd-list { display: flex; flex-direction: column; gap: 8px; }
.cmd-item {
  display: flex; align-items: baseline; gap: 12px;
  padding: 12px 16px; background: rgba(26, 26, 26, 0.7); border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius); transition: border-color 0.15s;
}
.cmd-item:hover { border-color: var(--accent); }
.cmd-name { font-weight: 600; color: var(--accent); font-size: 14px; white-space: nowrap; }
.cmd-desc { color: var(--text-muted); font-size: 13px; }
.cmd-count { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }

@media (max-width: 700px) {
  .auto-layout { flex-direction: column; gap: 16px; }
  .auto-nav {
    width: 100%; flex-direction: row; overflow-x: auto; position: static;
    gap: 2px; max-height: 52px; min-width: 0;
  }
  .auto-nav-item { white-space: nowrap; min-width: auto; }
}

/* ═══ Config sections ═══════════════════════════════════════════════ */
.config-section { max-width: 680px; }
.section-header { margin-bottom: 16px; }
.section-header h3 { font-size: 18px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.section-desc { font-size: 13px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; }
.config-card {
  background: rgba(26, 26, 26, 0.7); border: 1px solid rgba(255, 255, 255, 0.06); border-radius: var(--radius-lg);
  padding: 24px; margin-bottom: 24px;
}
.config-row { margin-bottom: 18px; }
.config-row:last-of-type { margin-bottom: 20px; }
.config-row label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.config-row input, .config-row select, .config-row textarea {
  width: 100%; padding: 10px 12px; background: rgba(30, 30, 30, 0.8); border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius); color: var(--text); font-size: 14px; outline: none; transition: border-color 0.2s;
}
.config-row input:focus, .config-row select:focus, .config-row textarea:focus { border-color: var(--accent); }
.config-row textarea { resize: vertical; }
.config-row input[type="color"] { height: 40px; padding: 4px; cursor: pointer; }
.config-row-inline { display: flex; gap: 16px; }
.config-row-inline .config-row { flex: 1; }
.hint { font-size: 11px; color: var(--text-muted); display: block; margin-top: 4px; }

/* ═══ Chips (removable tags) ════════════════════════════════════ */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; background: rgba(88, 101, 242, 0.15); color: var(--accent);
  border-radius: 12px; font-size: 13px; font-weight: 500;
}
.chip-remove {
  background: none; border: none; color: var(--text-muted); font-size: 16px;
  cursor: pointer; padding: 0 2px; line-height: 1; transition: color 0.2s;
}
.chip-remove:hover { color: #ed4245; }

.btn-primary {
  padding: 10px 24px; background: var(--accent); color: #fff; border: none;
  border-radius: var(--radius); font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all 0.2s;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(88,101,242,0.25); }
.btn-gold { background: linear-gradient(135deg, #f5a623, #f57731); }
.btn-gold:hover { opacity: 0.9; }

/* Server Stats preset chips */
.ss-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.ss-preset-btn {
  padding: 5px 14px; border-radius: 20px; font-size: 12px; font-weight: 500; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text-muted);
  transition: all 0.15s;
}
.ss-preset-btn:hover { border-color: var(--accent); color: var(--text); }
.ss-preset-btn.active { border-color: var(--accent); background: var(--accent); color: #fff; }

/* Premium gate */
.premium-gate { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.premium-gate-icon { font-size: 48px; margin-bottom: 12px; }
.premium-gate h3 { font-size: 20px; color: var(--gold); margin-bottom: 8px; }
.premium-gate p { margin-bottom: 20px; max-width: 360px; margin-left: auto; margin-right: auto; line-height: 1.5; }

/* ═══ Embed Creator ═════════════════════════════════════════════════ */
.embed-creator { display: flex; flex-direction: column; gap: 24px; }
.embed-form { min-width: 0; }
.embed-preview-container h4 { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.preview-hint { font-size: 11px; color: var(--text-muted); margin-bottom: 12px; opacity: 0.7; }
.embed-preview {
  background: #2b2d31; border-radius: 4px; padding: 12px 16px 12px 16px;
  border-left: 4px solid var(--accent); position: sticky; top: 80px;
  display: grid; grid-template-columns: 1fr auto; gap: 8px;
}
.ep-body { min-width: 0; }
.ep-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; color: #fff; }
.ep-description { font-size: 14px; color: #dcddde; white-space: pre-wrap; margin-bottom: 8px; }
.ep-fields { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.ep-field { min-width: 100px; }
.ep-field-name { font-size: 13px; font-weight: 700; color: #fff; }
.ep-field-value { font-size: 13px; color: #dcddde; }
.ep-image img { max-width: 100%; border-radius: 4px; margin-top: 8px; }
.ep-thumbnail img { width: 80px; height: 80px; object-fit: cover; border-radius: 4px; }
.ep-footer { grid-column: 1 / -1; font-size: 12px; color: #72767d; }

.field-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: start; }
.field-row input { flex: 1; }
.field-row .btn-sm { margin-top: 24px; color: var(--red); }

/* ═══ Toast ═════════════════════════════════════════════════════════ */
.toast {
  position: fixed; bottom: 24px; right: 24px; padding: 14px 28px;
  background: var(--green); color: #fff; border-radius: var(--radius);
  font-size: 14px; font-weight: 500; opacity: 0; transition: all 0.3s; z-index: 200;
  pointer-events: none; box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  max-width: 400px;
}
.toast.show { opacity: 1; transform: translateY(-4px); }
.toast.error { background: var(--red); }

/* ═══ Embed Templates ══════════════════════════════════════════════ */
.templates-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; padding: 12px 16px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.templates-bar-left { display: flex; align-items: center; gap: 12px; }
.templates-bar-left h4 { font-size: 14px; font-weight: 600; }
.template-count {
  font-size: 12px; color: var(--text-muted); background: var(--bg-3);
  padding: 2px 10px; border-radius: 12px;
}
.template-count.at-limit { color: var(--red); }

.templates-list {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 24px; min-height: 32px;
}
.template-empty { font-size: 13px; color: var(--text-muted); padding: 4px 0; }

.template-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; transition: all 0.15s;
  font-size: 13px; font-weight: 500;
}
.template-chip:hover { border-color: var(--accent); background: var(--bg-3); }
.template-chip.active { border-color: var(--accent); background: rgba(88, 101, 242, 0.1); }
.template-chip-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.template-chip-actions { display: flex; gap: 4px; }
.template-chip-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 12px; padding: 2px 4px; border-radius: 4px; transition: all 0.15s;
}
.template-chip-btn:hover { color: var(--text); background: var(--bg-hover); }
.template-chip-btn.delete:hover { color: var(--red); }

/* Image upload input combo */
.input-with-upload {
  display: flex; gap: 8px; align-items: center;
}
.input-with-upload input[type="text"] { flex: 1; }
.btn-upload {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; background: var(--bg-3); border: 1px solid var(--border-light);
  border-radius: var(--radius); cursor: pointer; color: var(--text-muted);
  transition: all 0.15s; flex-shrink: 0;
}
.btn-upload:hover { color: var(--accent); border-color: var(--accent); background: var(--bg-hover); }

.embed-actions { display: flex; align-items: center; gap: 12px; }

/* Save template modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 100;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.15s ease;
}
.modal {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; width: 400px; max-width: 90vw;
}
.modal h3 { font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.btn-cancel {
  padding: 8px 16px; background: var(--bg-3); color: var(--text-muted); border: none;
  border-radius: var(--radius); font-size: 14px; cursor: pointer;
}
.btn-cancel:hover { color: var(--text); background: var(--bg-hover); }

/* ═══ Dynamic niche tab content ════════════════════════════════════ */
.niche-overview {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
  max-width: 900px;
}
@media (max-width: 768px) {
  .niche-overview { grid-template-columns: 1fr; }
  /* Hide custom tooltips on mobile — let native title attr handle it */
  .help-badge[title]:hover::after { display: none; }
}
.niche-stat-card {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px;
}
.niche-stat-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.niche-list { font-size: 13px; color: var(--text-2); line-height: 2; }
.niche-list .empty { color: var(--text-muted); font-style: italic; font-size: 13px; line-height: 1.5; }
.niche-list .empty code {
  background: var(--bg-3); padding: 1px 6px; border-radius: 4px;
  font-size: 12px; color: var(--accent);
}
.niche-full-width { grid-column: 1 / -1; }
.niche-item {
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.niche-item:nth-child(odd) { background: rgba(255,255,255,.02); }
.niche-rank { min-width: 24px; text-align: center; }

/* ═══ Analytics ════════════════════════════════════════════════════ */
.analytics-period {
  display: flex; gap: 8px; margin-bottom: 20px; align-items: center;
}
.period-label { font-size: 13px; color: var(--text-muted); margin-right: 4px; }
.analytics-btn {
  background: var(--bg-3); color: var(--text-muted); border: 1px solid var(--border);
  padding: 6px 16px; border-radius: 20px; font-size: 13px; cursor: pointer;
  transition: all 0.15s;
}
.analytics-btn:hover { border-color: var(--accent); color: var(--text); }
.analytics-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.analytics-stats {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.analytics-stat {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px;
}
.analytics-stat .as-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.analytics-stat .as-value { font-size: 24px; font-weight: 700; }
.analytics-stat .as-change { font-size: 11px; margin-top: 2px; }
.analytics-stat .as-change.positive { color: var(--green); }
.analytics-stat .as-change.negative { color: var(--red); }

.analytics-grid {
  display: grid; grid-template-columns: 2fr 1fr; gap: 24px;
}
@media (max-width: 900px) { .analytics-grid { grid-template-columns: 1fr; } }

.analytics-card {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px;
}
.analytics-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.card-hint { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }

.chart-container { min-height: 200px; }
.chart-bar-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 12px;
}
.chart-bar-label { width: 50px; text-align: right; color: var(--text-muted); flex-shrink: 0; }
.chart-bar-track { flex: 1; height: 24px; background: var(--bg-3); border-radius: 4px; overflow: hidden; position: relative; }
.chart-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; min-width: 2px; }
.chart-bar-fill.messages { background: var(--accent); }
.chart-bar-fill.commands { background: var(--green); }
.chart-bar-value { width: 50px; font-size: 11px; color: var(--text-muted); }

.chart-legend {
  display: flex; gap: 16px; margin-top: 12px; font-size: 11px; color: var(--text-muted);
}
.chart-legend-item { display: flex; align-items: center; gap: 6px; }
.chart-legend-dot { width: 10px; height: 10px; border-radius: 2px; }

.analytics-list { font-size: 13px; }
.analytics-list-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.analytics-list-item:last-child { border-bottom: none; }
.analytics-list-item .cmd-name { font-weight: 500; }
.analytics-list-item .cmd-count { color: var(--text-muted); font-size: 12px; }
.analytics-list-bar {
  height: 4px; background: var(--bg-3); border-radius: 2px; margin-top: 4px;
}
.analytics-list-bar-fill {
  height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.5s;
}
.analytics-empty { color: var(--text-muted); font-size: 13px; padding: 20px 0; text-align: center; }

/* ═══ Upsell Banner ════════════════════════════════════════════════ */
.upsell-banner {
  background: linear-gradient(135deg, rgba(245,166,35,0.06), rgba(155,89,182,0.06));
  border: 1px solid rgba(245,166,35,0.2);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 28px;
  position: relative;
}
.upsell-content {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
}
.upsell-text {
  display: flex; align-items: flex-start; gap: 16px; flex: 1; min-width: 0;
}
.upsell-icon { flex-shrink: 0; }
.upsell-icon svg { width: 36px; height: 36px; color: var(--gold); }
.upsell-text h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; color: var(--gold); }
.upsell-text p { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.btn-lg { padding: 12px 28px; font-size: 14px; white-space: nowrap; flex-shrink: 0; }

/* ═══ Overview card variants ═══════════════════════════════════════ */
.overview-card.card-locked {
  border-color: rgba(245,166,35,0.3);
  background: rgba(245,166,35,0.04);
}
.overview-card.card-locked .ov-label {
  color: var(--gold); font-size: 11px;
}
.overview-card.card-upgrade {
  border-color: rgba(245,166,35,0.4);
  background: linear-gradient(135deg, rgba(245,166,35,0.06), rgba(245,119,49,0.06));
  cursor: pointer; transition: all 0.2s;
}
.overview-card.card-upgrade:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(245,166,35,0.15);
}
.overview-card.card-upgrade .ov-value { color: var(--gold); }
.overview-card .ov-cta {
  margin-top: 8px; font-size: 12px; font-weight: 600;
  color: var(--gold); text-transform: uppercase; letter-spacing: 0.05em;
}
.overview-card.card-premium {
  border-color: rgba(245,166,35,0.3);
  background: rgba(245,166,35,0.04);
}
.overview-card.card-premium .ov-value { color: var(--gold); }

/* ═══ Module pill lock icon ════════════════════════════════════════ */
.pill-lock { font-size: 10px; margin-left: 2px; }

/* ═══ Pack cards — locked showcase (the money maker) ══════════════ */
.pack-card.locked-showcase {
  border-color: rgba(245,166,35,0.3);
  background: linear-gradient(180deg, rgba(245,166,35,0.04) 0%, rgba(155,89,182,0.04) 100%);
  opacity: 1; position: relative; overflow: hidden;
}
.pack-card.locked-showcase:hover {
  border-color: var(--gold);
  box-shadow: 0 4px 24px rgba(245,166,35,0.1);
}
.pack-card-glow {
  position: absolute; top: -30px; right: -30px;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(245,166,35,0.12), transparent 70%);
  pointer-events: none;
}
.pack-premium-tag {
  font-size: 10px; padding: 2px 8px; border-radius: 4px;
  background: linear-gradient(135deg, #f5a623, #f57731); color: #000;
  font-weight: 700; text-transform: uppercase; vertical-align: middle;
}
.pack-highlights {
  display: flex; flex-direction: column; gap: 8px;
  margin: 14px 0 16px; padding: 14px; background: rgba(255,255,255,0.02);
  border-radius: var(--radius); border: 1px solid var(--border);
}
.pack-highlight {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-2);
}
.pack-highlight span:first-child { flex-shrink: 0; }
.btn-block { width: 100%; text-align: center; }

/* ═══ Module card — locked niche showcase ═════════════════════════ */
.module-card.locked-showcase-module {
  opacity: 1 !important;
  border-color: rgba(245,166,35,0.2);
  border-left: 3px solid var(--gold);
  background: linear-gradient(90deg, rgba(245,166,35,0.04) 0%, var(--bg-2) 40%);
  flex-wrap: wrap;
}
.module-card.locked-showcase-module:hover {
  border-color: rgba(245,166,35,0.35);
}
.locked-badge {
  font-size: 9px; font-weight: 700; color: var(--gold);
  background: rgba(245,166,35,0.12); padding: 2px 8px;
  border-radius: 4px; white-space: nowrap; text-transform: uppercase;
}
.module-showcase-details {
  width: 100%; padding-left: 48px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.module-highlights {
  display: flex; gap: 12px; flex-wrap: wrap;
}
.mh-item {
  font-size: 11px; color: var(--text-muted);
  display: flex; align-items: center; gap: 4px;
}
.module-showcase-details .btn-primary {
  margin-left: auto; padding: 6px 16px; font-size: 11px;
}

/* ═══ Responsive ═══════════════════════════════════════════════════ */
/* ═══ Hamburger (hidden on desktop) ═══════════════════════════════ */
.hamburger {
  display: none; background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 4px; border-radius: 6px; line-height: 0;
}
.hamburger:hover { color: var(--text); background: var(--bg-hover); }

/* Mobile sidebar overlay */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 45;
}
.sidebar-overlay.visible { display: block; }

/* ═══ Responsive — Tablet (< 900px) ═══════════════════════════════ */
@media (max-width: 900px) {
  .hamburger { display: flex; }
  .sidebar {
    transform: translateX(-100%); transition: transform 0.25s ease;
    z-index: 50;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  /* Nav sidebar becomes horizontal scroll bar on mobile */
  .nav-sidebar {
    position: static; width: 100%; min-width: 0; left: auto; top: auto; bottom: auto;
    flex-direction: row; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: 8px 12px; gap: 2px;
    border-right: none; border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(10, 10, 10, 0.9);
  }
  .nav-sidebar .nav-section-label { display: none; }
  .nav-sidebar .nav-separator { width: 1px; height: 20px; margin: 0 4px; }
  .nav-tab {
    border-left: none; border-bottom: 2px solid transparent;
    border-radius: 6px 6px 0 0; padding: 8px 12px; font-size: 12px;
    white-space: nowrap; flex-shrink: 0;
  }
  .nav-tab.active { border-left-color: transparent; border-bottom-color: var(--accent); background: transparent; }
  .nav-tab span { display: none; }
  .nav-tab.active span { display: inline; }
  .content { margin-left: 0; padding: 24px 20px; }
  .dashboard-body { flex-direction: column; }
  .overview-grid { grid-template-columns: repeat(2, 1fr); }
  .server-info-grid { grid-template-columns: repeat(2, 1fr); }
  .empty-steps { flex-direction: column; align-items: center; }
  .upsell-content { flex-direction: column; align-items: flex-start; }
  .embed-creator { grid-template-columns: 1fr; }
  .modules-grid { flex-direction: column; }
  .module-card { flex-wrap: wrap; }
  .module-card p { width: 100%; padding-left: 48px; }
  .module-showcase-details { padding-left: 0; }
  .pack-cards { grid-template-columns: 1fr; }
  .config-row-inline { flex-direction: column; gap: 0; }
  .niche-overview { grid-template-columns: 1fr; }
  .analytics-grid { grid-template-columns: 1fr; }
  .quick-actions-grid { grid-template-columns: repeat(2, 1fr); }
  /* Prevent sidebar upgrade CTA from overlapping guild list */
  .sidebar-upgrade { position: sticky; bottom: 0; overflow: hidden; }
  .sidebar-upgrade-text span { word-break: break-word; }
}

/* ═══ Responsive — Phone (< 500px) ════════════════════════════════ */
@media (max-width: 500px) {
  .overview-grid { grid-template-columns: 1fr; }
  .server-info-grid { grid-template-columns: 1fr; }
  .quick-actions-grid { grid-template-columns: 1fr; }
  .content { padding: 14px 10px; }
  .topbar { padding: 0 12px; }
  .topbar-brand { font-size: 14px; }
  .tab-intro h2 { font-size: 17px; }
  .tab-intro p { font-size: 12px; }
  .section-header h3 { font-size: 16px; }
  .config-card { padding: 16px; }
  .overview-card { padding: 16px; }
  .overview-card .ov-value { font-size: 20px; }
  .btn-primary { padding: 12px 20px; font-size: 14px; width: 100%; text-align: center; }
  .templates-bar { flex-direction: column; gap: 10px; align-items: stretch; }
  .templates-bar-right { order: -1; }
  .toast { left: 12px; right: 12px; bottom: 12px; max-width: none; text-align: center; }
  .nav-sidebar { padding: 6px 8px; scroll-snap-type: x mandatory; }
  .nav-tab { scroll-snap-align: start; padding: 8px 10px; }

  /* Bigger touch targets */
  .toggle { width: 48px; height: 28px; }
  .toggle .slider::before { width: 22px; height: 22px; }
  .toggle input:checked + .slider::before { transform: translateX(20px); }
  .guild-item { padding: 12px; }
  select, input[type="text"], textarea { font-size: 16px !important; /* prevents iOS zoom */ }
  .autostyle-templates { grid-template-columns: repeat(2, 1fr) !important; }

  /* Module cards — meta wraps below body, showcase stacks, remove p indent */
  .module-card-meta { width: 100%; justify-content: flex-start; margin-top: 8px; }
  .module-showcase-details { flex-direction: column; align-items: flex-start; gap: 10px; }
  .module-card p { padding-left: 0; }

  .embed-preview-container { min-width: 0; }

  /* Config row inline — stack on phone too */
  .config-row-inline { flex-direction: column; gap: 0; }

  /* Analytics — single column stats, shrink bar labels */
  .analytics-stats { grid-template-columns: 1fr; }
  .chart-bar-label { width: 36px; font-size: 11px; }
  .chart-bar-value { width: 36px; }

  /* Tabs — smooth scroll with snap on phone */
  .tabs { -webkit-overflow-scrolling: touch; scroll-snap-type: x mandatory; scroll-behavior: smooth; }
  .tab { scroll-snap-align: start; }

  /* Template chips — single column, full width */
  .templates-list { flex-direction: column; }
  .template-chip { width: 100%; }

  /* Automation items — stack vertically */
  .automation-item { flex-direction: column; align-items: stretch; gap: 8px; }
  .automation-item .auto-actions { justify-content: flex-end; }

  /* Block builder — full width, reduce padding */
  .block-card { width: 100%; }
  .block-body { padding: 10px 12px; }
}

/* ═══ AutoStyle ═══════════════════════════════════════════════════ */
.autostyle-templates {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.autostyle-template-card {
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 12px 10px;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.autostyle-template-card:hover { border-color: var(--accent); background: var(--bg-tertiary); }
.autostyle-template-card.selected { border-color: var(--accent); background: rgba(88,101,242,.12); }
.autostyle-template-preview { font-size: 15px; font-weight: 600; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.autostyle-template-name { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }

.autostyle-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.autostyle-preset-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: border-color .15s, background .15s;
}
.autostyle-preset-btn:hover { border-color: var(--accent); background: var(--bg-tertiary); }

.autostyle-preview {
  background: #2b2d31;
  border-radius: 8px;
  padding: 12px 16px;
  font-family: 'gg sans', 'Noto Sans', sans-serif;
}
.autostyle-preview-category {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #949ba4;
  letter-spacing: .5px;
  margin-bottom: 6px;
  padding: 4px 0;
}
.autostyle-preview-channel {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 14px;
  color: #949ba4;
}
.autostyle-preview-channel:hover { background: rgba(255,255,255,.04); color: #dbdee1; }
.autostyle-preview-hash { color: #949ba4; font-size: 18px; font-weight: 500; }
.autostyle-preview-name { color: #949ba4; }
.autostyle-preview-original {
  margin-left: auto;
  font-size: 11px;
  color: #5c6370;
  font-style: italic;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
}
.toggle-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }

/* ═══ Emoji Picker ═══════════════════════════════════════════════════ */
.emoji-picker-wrap {
  position: relative;
  display: inline-block;
}
.emoji-trigger-btn {
  width: 42px; height: 36px;
  font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-input); border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius); cursor: pointer; transition: border-color 0.2s;
  padding: 0; line-height: 1;
}
.emoji-trigger-btn:hover { border-color: var(--accent); }
.emoji-trigger-btn.is-custom img {
  width: 22px; height: 22px; object-fit: contain;
}

.emoji-popup {
  position: fixed;
  z-index: 9999;
  width: 320px;
  background: var(--bg-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.emoji-popup-search {
  padding: 8px;
  border-bottom: 1px solid var(--border);
}
.emoji-popup-search input {
  width: 100%; padding: 6px 10px; font-size: 13px;
  background: var(--bg-3); border-color: var(--border-light);
}
.emoji-popup-cats {
  display: flex; gap: 2px; padding: 4px 6px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
.emoji-popup-cats::-webkit-scrollbar { display: none; }
.emoji-cat-btn {
  flex-shrink: 0; width: 30px; height: 28px;
  font-size: 15px; background: none; border: none; border-radius: 6px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: background 0.15s, color 0.15s;
}
.emoji-cat-btn:hover, .emoji-cat-btn.active {
  background: var(--bg-hover); color: var(--text);
}
.emoji-cat-btn.active { color: var(--accent); }
.emoji-cat-divider {
  width: 1px; height: 20px; background: var(--border-light);
  flex-shrink: 0; align-self: center; margin: 0 2px;
}
.emoji-cat-server { color: var(--accent) !important; }
.emoji-cat-server:hover, .emoji-cat-server.active { background: rgba(88,101,242,0.15) !important; }

.emoji-popup-body {
  overflow-y: auto; max-height: 260px; padding: 6px 4px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.emoji-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted);
  padding: 4px 6px 2px;
}
.emoji-grid {
  display: grid; grid-template-columns: repeat(8, 1fr);
  gap: 1px;
}
.emoji-btn {
  width: 100%; aspect-ratio: 1; font-size: 20px;
  background: none; border: none; border-radius: 6px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.1s; line-height: 1;
}
.emoji-btn:hover { background: var(--bg-hover); }
.emoji-btn img { width: 22px; height: 22px; object-fit: contain; }
.emoji-none { padding: 20px; text-align: center; color: var(--text-muted); font-size: 13px; }
