/* ============================================================
   Social Odonto — Design System
   Referências: Habitica, LinkedIn Learning
   Modo escuro nativo via prefers-color-scheme + toggle manual
   ============================================================ */

/* ── Tokens ────────────────────────────────────────────────── */
:root {
  /* Paleta primária — violeta/índigo profissional */
  --brand-50:  #f0edff;
  --brand-100: #ddd6ff;
  --brand-200: #c4b5fd;
  --brand-300: #a78bfa;
  --brand-400: #8b5cf6;
  --brand-500: #7c3aed;
  --brand-600: #6d28d9;
  --brand-700: #5b21b6;
  --brand-800: #4c1d95;
  --brand-900: #2e1065;

  /* Acento — âmbar/dourado para XP e conquistas */
  --xp-300: #fde68a;
  --xp-400: #fbbf24;
  --xp-500: #f59e0b;
  --xp-600: #d97706;

  /* Streak — laranja fogo */
  --fire-400: #fb923c;
  --fire-500: #f97316;
  --fire-600: #ea580c;

  /* Sucesso / erro / aviso */
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --red-400:   #f87171;
  --red-500:   #ef4444;
  --red-600:   #dc2626;
  --blue-400:  #60a5fa;
  --blue-500:  #3b82f6;

  /* Rarezas de badge */
  --rarity-common:    #94a3b8;
  --rarity-rare:      #3b82f6;
  --rarity-epic:      #a855f7;
  --rarity-legendary: #f59e0b;

  /* Liga cores */
  --league-bronze:   #cd7f32;
  --league-prata:    #94a3b8;
  --league-ouro:     #f59e0b;
  --league-diamante: #22d3ee;
  --league-mestre:   #a855f7;

  /* Tipografia */
  --font-sans: 'Inter', 'Poppins', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Bordas */
  --radius-sm:  4px;
  --radius-md:  6px;
  --radius-lg:  10px;
  --radius-xl:  16px;
  --radius-full: 9999px;

  /* Sombras — design flat: sem sombreamento */
  --shadow-sm:  none;
  --shadow-md:  none;
  --shadow-lg:  none;
  --shadow-glow: none;

  /* Transições */
  --transition: 180ms ease;
}

/* ── Tema Claro (default) ───────────────────────────────────── */
:root, [data-theme="light"] {
  --bg:          #f8f7ff;
  --bg-card:     #ffffff;
  --bg-card-alt: #f3f0ff;
  --bg-sidebar:  #1e1333;
  --bg-hover:    #f0edff;
  --bg-input:    #ffffff;

  --text:        #1a1523;
  --text-muted:  #6b7280;
  --text-faint:  #9ca3af;
  --text-sidebar: #c4b5fd;
  --text-sidebar-active: #ffffff;

  --border:      #e5e0f5;
  --border-focus: var(--brand-400);

  --sidebar-active-bg: rgba(124,58,237,.25);
  --sidebar-active-border: var(--brand-400);

  --xp-bar-bg:   #e9e5ff;
  --xp-bar-fill: linear-gradient(90deg, var(--brand-400), var(--brand-500));
}

/* ── Tema Escuro ─────────────────────────────────────────────── */
[data-theme="dark"], .dark {
  --bg:          #0f0b1a;
  --bg-card:     #1a1330;
  --bg-card-alt: #221840;
  --bg-sidebar:  #0a0714;
  --bg-hover:    #251c42;
  --bg-input:    #1a1330;

  --text:        #f0edff;
  --text-muted:  #9d8fc7;
  --text-faint:  #6b5fa0;
  --text-sidebar: #9d8fc7;
  --text-sidebar-active: #ffffff;

  --border:      #2e2250;
  --border-focus: var(--brand-400);

  --sidebar-active-bg: rgba(124,58,237,.3);
  --sidebar-active-border: var(--brand-400);

  --xp-bar-bg:   #2e2250;
  --xp-bar-fill: linear-gradient(90deg, var(--brand-400), var(--brand-500));

}

/* Auto-detect sistema */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #0f0b1a;
    --bg-card:     #1a1330;
    --bg-card-alt: #221840;
    --bg-sidebar:  #0a0714;
    --bg-hover:    #251c42;
    --bg-input:    #1a1330;
    --text:        #f0edff;
    --text-muted:  #9d8fc7;
    --text-faint:  #6b5fa0;
    --text-sidebar: #9d8fc7;
    --text-sidebar-active: #ffffff;
    --border:      #2e2250;
    --xp-bar-bg:   #2e2250;
  }
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

a { color: var(--brand-400); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--brand-300); }

img { max-width: 100%; display: block; }

/* ── Layout Principal (sidebar + content) ─────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  border-right: 1px solid rgba(124,58,237,.2);
  transition: transform var(--transition);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid rgba(124,58,237,.15);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--brand-600);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.logo-text { display: flex; flex-direction: column; }
.logo-title { font-size: 15px; font-weight: 700; color: #fff; line-height: 1.1; }
.logo-sub   { font-size: 11px; color: var(--text-sidebar); font-weight: 400; letter-spacing: .05em; }

/* Perfil mini na sidebar */
.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(124,58,237,.1);
}

.sidebar-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: var(--brand-700);
  border: 2px solid var(--brand-500);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }

.sidebar-profile-info { flex: 1; min-width: 0; }
.sidebar-profile-name  { font-size: 13px; font-weight: 600; color: var(--text-sidebar-active); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-profile-level { font-size: 11px; color: var(--xp-500); font-weight: 500; }

/* XP bar mini na sidebar */
.sidebar-xp {
  padding: 0 20px 12px;
}
.sidebar-xp-bar {
  height: 4px;
  background: rgba(124,58,237,.2);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 6px;
}
.sidebar-xp-fill {
  height: 100%;
  background: var(--xp-bar-fill);
  border-radius: var(--radius-full);
  transition: width .6s ease;
}
.sidebar-xp-label { font-size: 10px; color: var(--text-faint); }

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-sidebar);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  border-left: 3px solid transparent;
  cursor: pointer;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--sidebar-active-bg);
  color: var(--text-sidebar-active);
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--text-sidebar-active);
  border-left-color: var(--sidebar-active-border);
}

.nav-icon { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; }

.nav-section-label {
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 12px 12px 4px;
  font-weight: 600;
}

.nav-badge {
  margin-left: auto;
  background: var(--brand-600);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

/* Streak badge na sidebar */
.nav-streak {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--fire-500);
  font-size: 12px;
  font-weight: 700;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(124,58,237,.1);
}

.nav-logout { color: var(--red-400) !important; }
.nav-logout:hover { background: rgba(239,68,68,.1) !important; }

/* ── Main Area ────────────────────────────────────────────────── */
.main-area {
  flex: 1;
  margin-left: 240px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(8px);
}

.header-left  { display: flex; align-items: center; gap: 16px; }
.header-right { display: flex; align-items: center; gap: 12px; }

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
}
.sidebar-toggle:hover { color: var(--text); }

.page-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

/* Notificações no header */
.header-notif {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--bg-hover);
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border: none;
  text-decoration: none;
}
.header-notif:hover { background: var(--brand-100); color: var(--brand-600); }
.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--red-500);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

/* Dark mode toggle */
.theme-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--bg-hover);
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  font-size: 15px;
  transition: background var(--transition), color var(--transition);
}
.theme-toggle:hover { background: var(--xp-300); color: var(--xp-600); }

/* Header user chip */
.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-hover);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition);
}
.header-user:hover { background: var(--brand-100); }
.header-avatar-mini {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  flex-shrink: 0;
}
.header-avatar-mini img { width: 100%; height: 100%; object-fit: cover; }
.header-user-name { font-size: 13px; font-weight: 600; color: var(--text); }

/* ── Content ──────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 28px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* ── Flash messages ──────────────────────────────────────────── */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
}
.flash-success { background: rgba(34,197,94,.12); color: var(--green-600); border: 1px solid rgba(34,197,94,.25); }
.flash-error   { background: rgba(239,68,68,.12);  color: var(--red-600);   border: 1px solid rgba(239,68,68,.25); }
.flash-info    { background: rgba(59,130,246,.12); color: var(--blue-500);  border: 1px solid rgba(59,130,246,.25); }
[data-theme="dark"] .flash-success { color: var(--green-400); }
[data-theme="dark"] .flash-error   { color: var(--red-400);   }
[data-theme="dark"] .flash-info    { color: var(--blue-400);  }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: background var(--transition), border-color var(--transition);
}
.card:hover { border-color: var(--brand-400); }

.card-sm   { padding: 16px; }
.card-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.card-title i { color: var(--brand-400); }

/* Card com destaque */
.card-glow {
  border-color: var(--brand-500);
}

/* ── Grid helpers ─────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* ── XP Bar ──────────────────────────────────────────────────── */
.xp-bar-wrap  { position: relative; }
.xp-bar-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.xp-bar {
  height: 10px;
  background: var(--xp-bar-bg);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.xp-bar-fill {
  height: 100%;
  background: var(--xp-bar-fill);
  border-radius: var(--radius-full);
  position: relative;
  transition: width .8s cubic-bezier(.4,0,.2,1);
}
.xp-bar-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  width: 12px;
  height: 100%;
  background: rgba(255,255,255,.4);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
  animation: shimmer 2s infinite;
}
@keyframes shimmer { 0%,100% { opacity: .4; } 50% { opacity: .9; } }

/* ── Streak flame ─────────────────────────────────────────────── */
.streak-display {
  display: flex;
  align-items: center;
  gap: 8px;
}
.streak-flame {
  font-size: 28px;
  animation: flicker 1.5s ease-in-out infinite alternate;
}
@keyframes flicker {
  0%   { transform: scale(1)    rotate(-2deg); filter: brightness(1); }
  100% { transform: scale(1.08) rotate(2deg);  filter: brightness(1.2); }
}
.streak-count { font-size: 28px; font-weight: 800; color: var(--fire-500); }
.streak-label { font-size: 12px; color: var(--text-muted); }

/* Streak morta */
.streak-count.streak-zero { color: var(--text-faint); }

/* ── Level badge ─────────────────────────────────────────────── */
.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-400));
  color: #fff;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
}
.level-badge .level-num { font-size: 16px; }

/* ── Badges de conquista ─────────────────────────────────────── */
.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: var(--radius-md);
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  text-align: center;
  transition: border-color var(--transition);
  cursor: default;
}
.badge-item:hover { border-color: var(--brand-400); }

.badge-icon { font-size: 32px; line-height: 1; }
.badge-name { font-size: 11px; font-weight: 600; color: var(--text-muted); }

.badge-item.common    { border-color: var(--rarity-common); }
.badge-item.rare      { border-color: var(--rarity-rare); }
.badge-item.epic      { border-color: var(--rarity-epic); }
.badge-item.legendary { border-color: var(--rarity-legendary); }

.badge-locked { opacity: .35; filter: grayscale(.8); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background var(--transition), opacity var(--transition), border-color var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { opacity: .85; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--brand-500);
  color: #fff;
}
.btn-primary:hover { background: var(--brand-600); }

.btn-secondary {
  background: var(--bg-card-alt);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); }

.btn-danger {
  background: var(--red-600);
  color: #fff;
}
.btn-danger:hover { background: var(--red-500); }

.btn-success {
  background: var(--green-600);
  color: #fff;
}
.btn-success:hover { background: var(--green-500); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn-sm  { padding: 6px 14px; font-size: 13px; }
.btn-lg  { padding: 14px 28px; font-size: 16px; }
.btn-full { width: 100%; }

/* XP button (check-in) */
.btn-xp {
  background: linear-gradient(135deg, var(--xp-500), var(--xp-400));
  color: #1a1523;
  font-weight: 700;
}
.btn-xp:hover { background: var(--xp-600); }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: .02em;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-sans);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  outline: 2px solid rgba(124,58,237,.2);
  outline-offset: 0;
}
.form-input::placeholder { color: var(--text-faint); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-error { font-size: 12px; color: var(--red-500); margin-top: 4px; }
.form-hint  { font-size: 12px; color: var(--text-faint); margin-top: 4px; }

/* ── Stat cards (dashboard) ──────────────────────────────────── */
.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.purple { background: rgba(124,58,237,.15); color: var(--brand-400); }
.stat-icon.amber  { background: rgba(245,158,11,.15);  color: var(--xp-500); }
.stat-icon.orange { background: rgba(249,115,22,.15);  color: var(--fire-500); }
.stat-icon.green  { background: rgba(34,197,94,.15);   color: var(--green-500); }
.stat-icon.blue   { background: rgba(59,130,246,.15);  color: var(--blue-500); }

.stat-value { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── Ranking list ─────────────────────────────────────────────── */
.rank-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  transition: background var(--transition);
}
.rank-row:hover { background: var(--bg-hover); }
.rank-row.is-me  { background: var(--brand-50); border: 1px solid var(--brand-200); }
[data-theme="dark"] .rank-row.is-me { background: rgba(124,58,237,.15); border-color: var(--brand-700); }

.rank-pos {
  width: 32px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-faint);
  flex-shrink: 0;
}
.rank-pos.top-1 { color: var(--rarity-legendary); font-size: 18px; }
.rank-pos.top-2 { color: var(--rarity-common); }
.rank-pos.top-3 { color: var(--league-bronze); }

.rank-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-700);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.rank-avatar img { width: 100%; height: 100%; object-fit: cover; }
.rank-name  { flex: 1; font-weight: 600; font-size: 14px; }
.rank-level { font-size: 12px; color: var(--text-muted); }
.rank-xp    { font-weight: 700; color: var(--xp-500); font-size: 14px; }

/* ── Mission / Task items ─────────────────────────────────────── */
.mission-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  margin-bottom: 10px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.mission-item:hover { border-color: var(--brand-300); }
.mission-item.done  { opacity: .6; }

.mission-icon { font-size: 24px; flex-shrink: 0; }
.mission-title { font-size: 14px; font-weight: 600; }
.mission-desc  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.mission-xp    {
  margin-left: auto;
  flex-shrink: 0;
  background: rgba(245,158,11,.15);
  color: var(--xp-500);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

/* ── Attendance code input ────────────────────────────────────── */
.code-input-wrap {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.code-input {
  flex: 1;
  font-size: 22px;
  font-family: var(--font-mono);
  letter-spacing: .2em;
  text-align: center;
  text-transform: uppercase;
  font-weight: 700;
  padding: 14px 20px;
}

/* ── Agenda / Event cards ─────────────────────────────────────── */
.event-card {
  display: flex;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  margin-bottom: 12px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.event-card:hover { border-color: var(--brand-300); }

.event-date-box {
  flex-shrink: 0;
  width: 54px;
  text-align: center;
  background: var(--brand-600);
  border-radius: var(--radius-md);
  padding: 8px 4px;
  color: #fff;
}
.event-date-day { font-size: 22px; font-weight: 800; line-height: 1; }
.event-date-mon { font-size: 11px; font-weight: 500; opacity: .8; letter-spacing: .05em; text-transform: uppercase; }

.event-info  { flex: 1; min-width: 0; }
.event-title { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-meta  { font-size: 12px; color: var(--text-muted); margin-top: 4px; display: flex; gap: 12px; flex-wrap: wrap; }
.event-meta span { display: flex; align-items: center; gap: 4px; }

.event-type-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  background: rgba(124,58,237,.15);
  color: var(--brand-400);
}
.event-xp {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
}
.event-xp-val { font-size: 18px; font-weight: 800; color: var(--xp-500); }
.event-xp-label { font-size: 10px; color: var(--text-faint); }

/* ── Calendário ───────────────────────────────────────────────── */
.cal-grid-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
}
.cal-grid-header > div {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faint);
  padding: 4px 0;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.cal-day {
  min-height: 72px;
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: var(--bg-card-alt);
  transition: border-color var(--transition), background var(--transition);
  overflow: hidden;
}
.cal-day-empty { background: transparent; border-color: transparent; }
.cal-day-today { border-color: var(--brand-500); background: rgba(124,58,237,.08); }
.cal-day-has-event { cursor: pointer; }
.cal-day-has-event:hover { border-color: var(--brand-400); background: rgba(124,58,237,.12); }
.cal-day-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.cal-day-today .cal-day-num {
  color: var(--brand-400);
}
.cal-event-dot {
  font-size: 9px;
  font-weight: 600;
  background: var(--brand-700);
  color: var(--brand-200);
  border-radius: 3px;
  padding: 2px 4px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-dot-done {
  background: rgba(22,163,74,.2);
  color: var(--green-400);
}

@media (max-width: 768px) {
  .cal-day { min-height: 48px; padding: 4px; }
  .cal-event-dot { display: none; }
  .cal-day-has-event .cal-day-num::after { content: ' ●'; color: var(--brand-400); font-size: 8px; }
}

/* ── Agenda cards ─────────────────────────────────────────────── */
.agenda-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 16px;
  margin-bottom: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition);
}
.agenda-card:hover { border-color: var(--brand-400); }
.agenda-attended   { border-color: var(--green-700); background: rgba(22,163,74,.04); }
.agenda-past       { opacity: .6; }

.agenda-date-box {
  flex-shrink: 0;
  width: 58px;
  text-align: center;
  border-radius: var(--radius-md);
  padding: 10px 4px;
  color: #fff;
}
.agenda-date-day { font-size: 24px; font-weight: 800; line-height: 1; }
.agenda-date-mon { font-size: 11px; font-weight: 600; opacity: .8; letter-spacing: .06em; }

.agenda-info { flex: 1; min-width: 0; }
.agenda-side { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-start; }

/* ── Liga tiers ───────────────────────────────────────────────── */
.league-tier {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
}
.league-tier.bronze   { background: rgba(205,127,50,.15); color: var(--league-bronze); }
.league-tier.prata    { background: rgba(148,163,184,.15); color: var(--league-prata); }
.league-tier.ouro     { background: rgba(245,158,11,.15); color: var(--league-ouro); }
.league-tier.diamante { background: rgba(34,211,238,.15); color: var(--league-diamante); }
.league-tier.mestre   { background: rgba(168,85,247,.15);  color: var(--league-mestre); }

/* ── Avatar grid ─────────────────────────────────────────────── */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
}
.avatar-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
  background: var(--bg-card-alt);
}
.avatar-opt:hover { border-color: var(--brand-400); }
.avatar-opt.selected { border-color: var(--brand-500); background: rgba(124,58,237,.1); }
.avatar-opt img, .avatar-opt .avatar-placeholder {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
}
.avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-700);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
}
.avatar-opt-name { font-size: 10px; color: var(--text-muted); text-align: center; }
.avatar-opt.locked { opacity: .4; cursor: not-allowed; }

/* ── Auth layout ─────────────────────────────────────────────── */
.auth-layout {
  min-height: 100vh;
  display: flex;
}

.auth-brand {
  width: 420px;
  flex-shrink: 0;
  background: linear-gradient(160deg, var(--brand-800) 0%, #0a0714 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 48px;
  position: relative;
  overflow: hidden;
}
.auth-brand::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -80px;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(124,58,237,.25) 0%, transparent 70%);
  border-radius: 50%;
}
.auth-brand::after {
  content: '';
  position: absolute;
  bottom: -60px;
  left: -60px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(245,158,11,.12) 0%, transparent 70%);
  border-radius: 50%;
}

.auth-brand-inner { position: relative; z-index: 1; }

.auth-brand-logo {
  width: 72px;
  height: 72px;
  background: var(--brand-600);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin-bottom: 28px;
}

.auth-brand-title {
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 14px;
}
.auth-brand-title span { color: var(--brand-300); }

.auth-brand-desc {
  font-size: 15px;
  color: rgba(196,181,253,.7);
  line-height: 1.7;
  margin-bottom: 40px;
}

.auth-brand-stats {
  display: flex;
  gap: 24px;
}
.auth-stat { text-align: center; }
.auth-stat-num   { display: block; font-size: 24px; font-weight: 800; color: var(--xp-400); }
.auth-stat-label { font-size: 11px; color: rgba(196,181,253,.6); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }

.auth-feature-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 32px;
}
.auth-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: rgba(196,181,253,.8);
}
.auth-feature-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(124,58,237,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

/* Auth form side */
.auth-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
}
.auth-form-box {
  width: 100%;
  max-width: 420px;
}
.auth-form-box h2 { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.auth-form-box .auth-sub { font-size: 14px; color: var(--text-muted); margin-bottom: 32px; }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  background: var(--bg-card-alt);
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-hover); }

/* ── Tabs ────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab-btn {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--brand-500); border-bottom-color: var(--brand-500); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Progress ring ───────────────────────────────────────────── */
.progress-ring { transform: rotate(-90deg); }
.progress-ring-bg  { fill: none; stroke: var(--xp-bar-bg); }
.progress-ring-bar { fill: none; stroke: var(--brand-400); stroke-linecap: round; transition: stroke-dashoffset .8s cubic-bezier(.4,0,.2,1); }

/* ── Tooltip ─────────────────────────────────────────────────── */
[data-tip] { position: relative; cursor: default; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a1523;
  color: #fff;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  z-index: 200;
}
[data-tip]:hover::after { opacity: 1; }

/* ── Onboarding step indicator ───────────────────────────────── */
.onboard-steps {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
}
.onboard-step {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-card-alt);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-faint);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.onboard-step.done    { background: var(--green-500); border-color: var(--green-500); color: #fff; }
.onboard-step.active  { background: var(--brand-500); border-color: var(--brand-500); color: #fff; }
.onboard-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  border-radius: 1px;
}
.onboard-connector.done { background: var(--green-500); }

/* ── XP pop animation ────────────────────────────────────────── */
.xp-pop {
  position: fixed;
  pointer-events: none;
  font-size: 20px;
  font-weight: 800;
  color: var(--xp-400);
  text-shadow: 0 2px 8px rgba(245,158,11,.5);
  z-index: 9999;
  animation: xpFly 1.4s ease-out forwards;
}
@keyframes xpFly {
  0%   { transform: translateY(0)   scale(1);    opacity: 1; }
  60%  { transform: translateY(-60px) scale(1.2); opacity: 1; }
  100% { transform: translateY(-100px) scale(.8);  opacity: 0; }
}

/* ── Utilities ───────────────────────────────────────────────── */
.flex     { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.gap-6  { gap: 24px; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-sm   { font-size: 13px; }
.text-xs   { font-size: 11px; }
.text-lg   { font-size: 18px; }
.text-xl   { font-size: 22px; }
.font-bold { font-weight: 700; }
.font-black { font-weight: 900; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    border-right: 1px solid var(--border);
  }
  .main-area { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .auth-brand { display: none; }
  .auth-form-side { padding: 32px 20px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .main-content { padding: 20px 16px; }
  .app-header { padding: 0 16px; }
}

/* Overlay mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
}
.sidebar-overlay.visible { display: block; }

/* ── Avatar option (profile/edit) ──────────────────────────── */
.avatar-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
  background: var(--bg-card-alt);
}
.avatar-option:hover:not(.locked) { border-color: var(--brand-400); }
.avatar-option.selected { border-color: var(--brand-500); background: rgba(124,58,237,.1); }
.avatar-option.locked { opacity: .5; cursor: not-allowed; }
.avatar-option img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; }
.avatar-lock {
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  font-size: 9px;
  text-align: center;
  color: var(--text-faint);
}

/* ── Admin table ────────────────────────────────────────────── */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--bg-card-alt); }

/* ── Badge rarities ─────────────────────────────────────────── */
.badge-rarity-common    { background: rgba(148,163,184,.2); color: var(--text-secondary); }
.badge-rarity-rare      { background: rgba(59,130,246,.2);  color: #60a5fa; }
.badge-rarity-epic      { background: rgba(124,58,237,.2);  color: var(--brand-400); }
.badge-rarity-legendary { background: rgba(245,158,11,.2);  color: var(--xp-500); }

/* ── Avatar circle (profile display) ───────────────────────── */
.avatar-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-700);
  color: #fff;
  font-weight: 700;
  border-radius: 50%;
  overflow: hidden;
}
