/* ═══════════════════════════════════════════════════════════════════════════
   ActivityBoard — Design System
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── TOKENS ──────────────────────────────────────────────────────────────── */
:root {
  --bg: #0a0b0f;
  --bg2: #0f1117;
  --bg3: #161a24;
  --bg4: #1c2130;
  --border: #252a38;
  --border2: #2e3448;
  --text: #e8ecf5;
  --muted: #6b7694;
  --muted2: #8892b0;
  --accent: #5b73ff;
  --accent2: #7c91ff;
  --accent-glow: rgba(91, 115, 255, 0.35);
  --green: #34d984;
  --yellow: #f5c842;
  --red: #ff5f5f;
  --orange: #ff8c42;
  --purple: #a67cff;
  --cyan: #42d4f5;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --sidebar-w: 260px;
  --topbar-h: 56px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── RESET & BASE ────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  height: 100%;
}
body {
  font-family: "DM Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* ─── ANIMATIONS ──────────────────────────────────────────────────────────── */
@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
@keyframes slideDown {
  from {
    transform: translateY(-10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}
@keyframes toastIn {
  from {
    transform: translateY(10px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}
@keyframes cardEnter {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   AUTH SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */
#authScreen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
#authScreen::before {
  content: "";
  position: absolute;
  width: 700px;
  height: 700px;
  background: radial-gradient(
    circle,
    rgba(91, 115, 255, 0.1) 0%,
    rgba(166, 124, 255, 0.05) 40%,
    transparent 70%
  );
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  animation: pulse 6s ease-in-out infinite;
}
#authScreen::after {
  content: "";
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(
    circle,
    rgba(166, 124, 255, 0.08) 0%,
    transparent 70%
  );
  bottom: -100px;
  right: -50px;
  pointer-events: none;
}

.auth-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 40px;
  width: min(420px, 92vw);
  position: relative;
  z-index: 1;
  box-shadow:
    0 40px 80px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  animation: slideUp 0.5s ease;
}

.auth-logo {
  font-family: "Space Mono", monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.auth-logo span {
  color: var(--muted);
}

.auth-card h2 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}
.auth-card p {
  color: var(--muted2);
  font-size: 14px;
  margin-bottom: 32px;
}

.auth-err {
  background: rgba(255, 95, 95, 0.1);
  border: 1px solid rgba(255, 95, 95, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--red);
  font-size: 13px;
  margin-top: 12px;
  display: none;
  animation: slideDown 0.2s ease;
}

/* ─── FORMS ───────────────────────────────────────────────────────────────── */
.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 7px;
}
.field input,
.field select {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: "DM Sans", sans-serif;
  font-size: 14px;
  outline: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}
.field input:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 115, 255, 0.15);
}
.field input::placeholder {
  color: var(--muted);
}

/* ─── BUTTONS ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: "DM Sans", sans-serif;
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06) 0%,
    transparent 100%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
}
.btn:hover::after {
  opacity: 1;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #4a5fe0);
  color: #fff;
  width: 100%;
  padding: 13px;
  font-size: 15px;
  border-radius: var(--radius-sm);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
}
.btn-primary:active {
  transform: translateY(0);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}
.btn-ghost {
  background: var(--bg3);
  color: var(--muted2);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--bg4);
  color: var(--text);
  border-color: var(--border2);
}
.btn-danger {
  background: rgba(255, 95, 95, 0.12);
  color: var(--red);
  border: 1px solid rgba(255, 95, 95, 0.2);
}
.btn-danger:hover {
  background: rgba(255, 95, 95, 0.22);
}
.btn-success {
  background: rgba(52, 217, 132, 0.12);
  color: var(--green);
  border: 1px solid rgba(52, 217, 132, 0.2);
}
.btn-success:hover {
  background: rgba(52, 217, 132, 0.22);
}
.btn-icon {
  background: var(--bg3);
  color: var(--muted2);
  border: 1px solid var(--border);
  padding: 6px 10px;
}
.btn-icon:hover {
  color: var(--text);
  background: var(--bg4);
}

/* ═══════════════════════════════════════════════════════════════════════════
   APP LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */
#appScreen {
  display: none;
  height: 100vh;
  flex-direction: column;
}

/* ─── TOPBAR ──────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: rgba(15, 17, 23, 0.85);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-logo {
  font-family: "Space Mono", monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.topbar-logo .dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 3s ease-in-out infinite;
}

.guild-header {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 12px 5px 8px;
  font-size: 13px;
  font-weight: 600;
  animation: slideDown 0.2s ease;
}
.guild-header .guild-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}
.guild-header .guild-icon-fallback {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}
.guild-id-chip {
  font-family: "Space Mono", monospace;
  font-size: 10px;
  color: var(--muted);
  background: var(--bg4);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 4px 14px 4px 6px;
  font-size: 13px;
}
.user-pill .av {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}
.user-pill .name {
  font-weight: 600;
}

.role-chip {
  font-size: 10px;
  font-family: "Space Mono", monospace;
  color: var(--yellow);
  background: rgba(245, 200, 66, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(245, 200, 66, 0.2);
}

/* ─── HAMBURGER ───────────────────────────────────────────────────────────── */
.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--muted2);
  cursor: pointer;
  padding: 6px;
  font-size: 18px;
  transition: color var(--transition);
}
.hamburger:hover {
  color: var(--text);
}
@media (max-width: 768px) {
  .topbar {
    padding: 0 12px;
    gap: 8px;
  }
  .hamburger {
    display: flex;
  }
  .topbar-logo span {
    display: none;
  }
  .topbar-logo {
     font-size: 0;
  }
  .guild-header {
    max-width: 140px;
    padding: 4px 8px;
  }
  .guild-header span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .guild-id-chip {
    display: none;
  }
  .user-pill {
    padding: 2px;
    gap: 0;
  }
  .user-pill .name, .role-chip {
    display: none;
  }
}

/* ─── BODY WRAP ───────────────────────────────────────────────────────────── */
.body-wrap {
  display: flex;
  flex: 1;
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  transition: transform 0.25s ease;
}
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    z-index: 200;
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
  }
  .sidebar-overlay.open {
    display: block;
  }
}

.sidebar-section {
  padding: 16px 12px 8px;
}
.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0 8px;
  margin-bottom: 6px;
}

/* ─── NAV ITEMS ───────────────────────────────────────────────────────────── */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted2);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: all 0.15s;
  position: relative;
}
.nav-item:hover {
  background: var(--bg3);
  color: var(--text);
}
.nav-item.active {
  background: var(--bg4);
  color: var(--text);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav-item .icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  transition: background 0.15s;
}
.nav-item.active .icon,
.nav-item:hover .icon {
  background: var(--bg4);
}
.nav-item .badge-count {
  margin-left: auto;
  font-size: 11px;
  background: var(--bg4);
  color: var(--muted2);
  padding: 1px 7px;
  border-radius: 99px;
  font-family: "Space Mono", monospace;
}

/* ─── GUILD ITEMS ─────────────────────────────────────────────────────────── */
.guild-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted2);
  border: 1px solid transparent;
  background: none;
  width: 100%;
  text-align: left;
  transition: all 0.15s;
}
.guild-item:hover {
  background: var(--bg3);
  color: var(--text);
  border-color: var(--border);
}
.guild-item.active {
  background: rgba(91, 115, 255, 0.1);
  color: var(--text);
  border-color: rgba(91, 115, 255, 0.3);
}
.guild-item .g-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.guild-item .g-icon-fallback {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  color: #fff;
  font-weight: 700;
}
.guild-item .g-info {
  min-width: 0;
  flex: 1;
}
.guild-item .g-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.guild-item .g-id {
  font-size: 10px;
  font-family: "Space Mono", monospace;
  color: var(--muted);
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 12px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAIN CONTENT AREA
   ═══════════════════════════════════════════════════════════════════════════ */
.main {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
}
.page {
  display: none;
  padding: 28px;
  animation: fadeIn 0.25s ease;
}
.page.active {
  display: block;
}
@media (max-width: 600px) {
  .page {
    padding: 16px;
  }
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-title .sub {
  font-size: 14px;
  font-weight: 400;
  color: var(--muted2);
}

/* ═══════════════════════════════════════════════════════════════════════════
   WELCOME PAGE
   ═══════════════════════════════════════════════════════════════════════════ */
.welcome-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
}
.welcome-inner {
  text-align: center;
  max-width: 520px;
}
.welcome-icon {
  font-size: 64px;
  margin-bottom: 20px;
  display: block;
  filter: drop-shadow(0 0 30px rgba(91, 115, 255, 0.4));
  animation: pulse 3s ease-in-out infinite;
}
.welcome-inner h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}
.welcome-inner p {
  color: var(--muted2);
  margin-bottom: 32px;
  line-height: 1.6;
}

.guild-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}
.guild-card-big {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 24px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
  position: relative;
  overflow: hidden;
}
.guild-card-big::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  opacity: 0;
  transition: opacity var(--transition);
}
.guild-card-big:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(91, 115, 255, 0.15);
}
.guild-card-big:hover::before {
  opacity: 1;
}
.guild-card-big .icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}
.guild-card-big .icon-fallback {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  color: #fff;
  font-weight: 700;
}
.guild-card-big .info .name {
  font-weight: 700;
  font-size: 15px;
}
.guild-card-big .info .id {
  font-size: 11px;
  font-family: "Space Mono", monospace;
  color: var(--muted);
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   KPI CARDS
   ═══════════════════════════════════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition:
    border-color var(--transition),
    transform var(--transition);
}
.kpi-card:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
}
.kpi-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  opacity: 0.07;
  transform: translate(20px, -20px);
}
.kpi-card.c-blue::after {
  background: var(--accent);
}
.kpi-card.c-green::after {
  background: var(--green);
}
.kpi-card.c-yellow::after {
  background: var(--yellow);
}
.kpi-card.c-purple::after {
  background: var(--purple);
}

.kpi-val {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 6px;
}
.kpi-card.c-blue .kpi-val {
  color: var(--accent2);
}
.kpi-card.c-green .kpi-val {
  color: var(--green);
}
.kpi-card.c-yellow .kpi-val {
  color: var(--yellow);
}
.kpi-card.c-purple .kpi-val {
  color: var(--purple);
}
.kpi-label {
  font-size: 12px;
  color: var(--muted2);
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FILTERS
   ═══════════════════════════════════════════════════════════════════════════ */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
}
.filter-bar input,
.filter-bar select {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: "DM Sans", sans-serif;
  font-size: 14px;
  padding: 8px 12px;
  outline: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}
.filter-bar input {
  flex: 1;
  min-width: 180px;
}
.filter-bar input:focus,
.filter-bar select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 115, 255, 0.1);
}
.filter-bar input::placeholder {
  color: var(--muted);
}

.date-filter-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: -10px;
  margin-bottom: 16px;
}
.date-filter-row .date-label {
  font-size: 12px;
  color: var(--muted2);
  font-weight: 600;
}
.date-filter-row input[type="date"] {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 6px;
  color: var(--text);
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  padding: 5px 10px;
  outline: none;
  transition: border-color var(--transition);
}
.date-filter-row input[type="date"]:focus {
  border-color: var(--accent);
}
.date-filter-row .date-sep {
  color: var(--muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   USER CARDS
   ═══════════════════════════════════════════════════════════════════════════ */
.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.user-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  animation: cardEnter 0.3s ease both;
}
.user-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  opacity: 0;
  transition: opacity var(--transition);
}
.user-card:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.user-card:hover::before {
  opacity: 1;
}

.card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--bg3);
  flex-shrink: 0;
}
.avatar-ph {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  flex-shrink: 0;
  color: #fff;
}
.card-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 2px;
}
.card-sub {
  font-size: 12px;
  color: var(--muted2);
}
.card-sub2 {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

.card-stats {
  display: flex;
  gap: 10px;
}
.cs-item {
  flex: 1;
  background: var(--bg3);
  border-radius: 8px;
  padding: 10px 10px;
  text-align: center;
  border: 1px solid transparent;
  transition: border-color var(--transition);
}
.user-card:hover .cs-item {
  border-color: var(--border);
}
.cs-val {
  font-size: 16px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}
.cs-lbl {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ─── TAGS ────────────────────────────────────────────────────────────────── */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
}
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg4);
  color: var(--muted2);
  border: 1px solid var(--border);
}
.tag-self {
  background: rgba(52, 217, 132, 0.1);
  color: var(--green);
  border-color: rgba(52, 217, 132, 0.2);
}
.tag-moved {
  background: rgba(245, 200, 66, 0.1);
  color: var(--yellow);
  border-color: rgba(245, 200, 66, 0.2);
}
.tag-role {
  background: rgba(91, 115, 255, 0.1);
  color: var(--accent2);
  border-color: rgba(91, 115, 255, 0.2);
}
.game-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(166, 124, 255, 0.12);
  color: var(--purple);
  border: 1px solid rgba(166, 124, 255, 0.25);
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECTION TITLES
   ═══════════════════════════════════════════════════════════════════════════ */
.sec-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 24px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sec-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════════════════════ */
.tbl-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg2);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  padding: 10px 14px;
  text-align: left;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
  white-space: nowrap;
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td {
  border-bottom: none;
}
tr:hover td {
  background: rgba(255, 255, 255, 0.015);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CHARTS
   ═══════════════════════════════════════════════════════════════════════════ */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 700px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}
.chart-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color var(--transition);
}
.chart-card:hover {
  border-color: var(--border2);
}
.chart-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}
.chart-wrap {
  height: 190px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════════════════════ */
.modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 500;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-bg.open {
  display: flex;
}
.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 860px;
  padding: 28px;
  position: relative;
  box-shadow:
    0 40px 80px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  animation: slideUp 0.3s ease;
}
.modal-x {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted2);
  font-size: 16px;
  transition: all 0.15s;
}
.modal-x:hover {
  background: var(--bg4);
  color: var(--text);
}
.modal-kpi {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px 0;
}
.modal-kpi .kpi-card {
  flex: 1;
  min-width: 110px;
}

.date-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
}
.date-row label {
  font-size: 12px;
  color: var(--muted2);
  font-weight: 600;
}
.date-row input {
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: 6px;
  color: var(--text);
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  padding: 5px 10px;
  outline: none;
  transition: border-color var(--transition);
}
.date-row input:focus {
  border-color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ADMIN PAGE
   ═══════════════════════════════════════════════════════════════════════════ */
.admin-form {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}
.admin-form h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
}
.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.form-row .field {
  flex: 1;
  min-width: 140px;
  margin-bottom: 0;
}

.guild-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  min-height: 42px;
}
.guild-check-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg3);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  font-size: 13px;
}
.guild-check-item input[type="checkbox"] {
  display: none;
}
.guild-check-item.checked {
  background: rgba(91, 115, 255, 0.15);
  border-color: rgba(91, 115, 255, 0.4);
  color: var(--accent2);
}
.guild-check-item .checkmark {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1.5px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.15s;
}
.guild-check-item.checked .checkmark {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.all-access-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid rgba(52, 217, 132, 0.3);
  background: rgba(52, 217, 132, 0.1);
  color: var(--green);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s;
}
.all-access-chip.checked {
  background: rgba(52, 217, 132, 0.2);
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
}
.badge-super {
  background: rgba(91, 115, 255, 0.2);
  color: var(--accent2);
  border: 1px solid rgba(91, 115, 255, 0.3);
}
.badge-admin {
  background: var(--bg4);
  color: var(--muted2);
  border: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════════════════════
   UTILITY / MISC
   ═══════════════════════════════════════════════════════════════════════════ */
.empty {
  text-align: center;
  color: var(--muted2);
  padding: 50px 20px;
  font-size: 15px;
}
.empty span {
  display: block;
  font-size: 40px;
  margin-bottom: 10px;
}

.loading {
  text-align: center;
  color: var(--muted2);
  padding: 60px;
}
.loading::after {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}

/* ─── SKELETON ────────────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg3) 25%,
    var(--bg4) 50%,
    var(--bg3) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* ─── TOAST ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.3s ease;
  max-width: 340px;
  backdrop-filter: blur(8px);
}
.toast.ok {
  border-color: rgba(52, 217, 132, 0.3);
  color: var(--green);
}
.toast.err {
  border-color: rgba(255, 95, 95, 0.3);
  color: var(--red);
}

/* ─── ACTIVE INDICATOR ────────────────────────────────────────────────────── */
.online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--green);
  animation: pulse 2s ease-in-out infinite;
}

/* ─── RESPONSIVE ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .users-grid {
    grid-template-columns: 1fr;
  }
  .modal {
    padding: 20px;
  }
  .guild-cards {
    flex-direction: column;
  }
  .guild-card-big {
    min-width: unset;
    width: 100%;
  }
}
@media (max-width: 480px) {
  .topbar {
    padding: 0 12px;
    gap: 10px;
  }
  .topbar-logo {
    font-size: 11px;
  }
  .user-pill .name {
    display: none;
  }
}
