/* ============================================================
   AutoInsta — Premium Dark SaaS Theme
   Inspired by Linear, Vercel, Raycast
   ============================================================ */

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-body:        #f8fafc;
  --bg-sidebar:     #ffffff;
  --bg-panel:       #ffffff;
  --bg-card:        #ffffff;
  --bg-card-hover:  #f8fafc;
  --bg-input:       #f1f5f9;
  --bg-topbar:      rgba(255, 255, 255, 0.85);
  --bg-modal:       #ffffff;
  --bg-toast:       #ffffff;

  /* Borders */
  --border-subtle:  #e2e8f0;
  --border-medium:  #cbd5e1;
  --border-strong:  #94a3b8;
  --border-input:   #cbd5e1;

  /* Text */
  --text-primary:   #0f172a;
  --text-secondary: #334155;
  --text-muted:     #64748b;
  --text-faint:     #94a3b8;

  /* Accents */
  --accent:         #0f172a;
  --accent-dark:    #000000;
  --accent-glow:    #334155;
  --accent-bg:      #f1f5f9;

  /* Status */
  --success:        #10b981;
  --warning:        #f59e0b;
  --error:          #ef4444;
  --info:           #3b82f6;

  /* Gradients */
  --grad-primary:   linear-gradient(135deg, #0f172a, #334155);
  --grad-glow:      linear-gradient(135deg, #0f172a, #334155);
  --grad-subtle:    linear-gradient(180deg, #f8fafc 0%, transparent 100%);

  /* Shadows */
  --shadow-card:    0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-glow:    0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-glow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
  --shadow-modal:   0 20px 40px rgba(0, 0, 0, 0.12);

  /* Layout */
  --sidebar-w:      260px;
  --topbar-h:       64px;
  --radius-sm:      6px;
  --radius-md:      8px;
  --radius-lg:      12px;
  --radius-xl:      16px;

  /* Transitions */
  --tr-fast:        0.15s ease;
  --tr-base:        0.2s ease;
  --tr-smooth:      0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --tr-bounce:      0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="dark"] {
  /* Backgrounds — deep navy/purple base */
  --bg-body:        #080b14;
  --bg-sidebar:     #0c1021;
  --bg-panel:       #0e1225;
  --bg-card:        #0f1429;
  --bg-card-hover:  #141a35;
  --bg-input:       #111730;
  --bg-topbar:      rgba(12, 16, 33, 0.9);
  --bg-modal:       #111730;
  --bg-toast:       #111730;

  /* Borders — neon glow accents */
  --border-subtle:  rgba(139, 92, 246, 0.15);
  --border-medium:  rgba(139, 92, 246, 0.25);
  --border-strong:  rgba(139, 92, 246, 0.4);
  --border-input:   rgba(139, 92, 246, 0.2);

  /* Text — contrastes calibrados para legibilidade no fundo escuro */
  --text-primary:   #e8eaff;
  --text-secondary: #b4c0f5;
  --text-muted:     #97a2d2;
  --text-faint:     #6470a0;

  /* Accents — vibrant neon */
  --accent:         #a78bfa;
  --accent-dark:    #7c3aed;
  --accent-glow:    #c084fc;
  --accent-bg:      rgba(139, 92, 246, 0.12);

  /* Primary override for buttons */
  --primary:        #8b5cf6;

  /* Gradients — neon purple/cyan */
  --grad-primary:   linear-gradient(135deg, #7c3aed, #06b6d4);
  --grad-glow:      linear-gradient(135deg, #8b5cf6, #22d3ee);
  --grad-subtle:    linear-gradient(180deg, rgba(139, 92, 246, 0.06) 0%, transparent 100%);

  /* Shadows — neon glow */
  --shadow-card:    0 1px 3px rgba(0, 0, 0, 0.4), 0 0 20px rgba(139, 92, 246, 0.05);
  --shadow-glow:    0 4px 20px rgba(139, 92, 246, 0.15), 0 0 40px rgba(139, 92, 246, 0.05);
  --shadow-glow-lg: 0 10px 40px rgba(139, 92, 246, 0.2), 0 0 80px rgba(139, 92, 246, 0.08);
  --shadow-modal:   0 20px 60px rgba(0, 0, 0, 0.6), 0 0 80px rgba(139, 92, 246, 0.12);

  /* Neon extras */
  --neon-purple: #8b5cf6;
  --neon-cyan: #22d3ee;
  --neon-pink: #ec4899;
  --neon-green: #34d399;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  transition: background-color var(--tr-smooth), color var(--tr-smooth);
}

/* ── Custom Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.25);
  border-radius: 100px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(168, 85, 247, 0.45);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(168, 85, 247, 0.25) transparent;
}

/* ── Typography ────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p { color: var(--text-secondary); }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--tr-fast);
}

a:hover {
  color: var(--accent-glow);
}

::selection {
  background: rgba(168, 85, 247, 0.30);
  color: #fff;
}

/* ── App Shell ─────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
  /* No z-index here: an explicit z-index would create a stacking context that
     traps Bootstrap modals below the backdrop (appended to <body>). The shell
     already paints above the fixed .diamond-rain via DOM order. */
}

/* ── Sidebar ───────────────────────────────────────────────── */
.side-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: rgba(12, 16, 33, 0.85);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border-right: 1px solid rgba(139, 92, 246, 0.12);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--tr-smooth);
}

.side-brand {
  padding: 28px 24px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.side-brand .brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.side-brand .brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  box-shadow: 0 4px 25px rgba(139, 92, 246, 0.45), 0 0 40px rgba(34, 211, 238, 0.15);
  flex-shrink: 0;
}

.side-brand .brand-text {
  display: flex;
  flex-direction: column;
}

.side-brand .brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.side-brand .brand-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Nav Links */
.side-links {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.side-links a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--tr-base);
  position: relative;
}

.side-links a i {
  font-size: 1.15rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
  transition: color var(--tr-base);
}

.side-links a:hover {
  background: var(--accent-bg);
  color: var(--text-primary);
}

.side-links a:hover i {
  color: var(--accent);
}

.side-links a.active {
  background: rgba(139, 92, 246, 0.15);
  color: #e8eaff;
  font-weight: 600;
  box-shadow: inset 0 0 20px rgba(139, 92, 246, 0.06);
}

.side-links a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--grad-glow);
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.6);
}

.side-links a.active i {
  color: #a78bfa;
  filter: drop-shadow(0 0 6px rgba(139, 92, 246, 0.5));
}

/* Diamond bullet accent */
.side-links a .nav-diamond {
  width: 5px;
  height: 5px;
  background: var(--accent);
  transform: rotate(45deg);
  opacity: 0;
  transition: opacity var(--tr-base);
  flex-shrink: 0;
  margin-left: auto;
}

.side-links a.active .nav-diamond,
.side-links a:hover .nav-diamond {
  opacity: 0.6;
}

/* Sidebar Footer */
.side-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
}

.side-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.side-status .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
  animation: pulse-dot 2s ease infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 8px rgba(34, 197, 94, 0.4); }
  50% { box-shadow: 0 0 16px rgba(34, 197, 94, 0.7); }
}

/* ── Topbar ────────────────────────────────────────────────── */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  background: var(--bg-topbar);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  gap: 16px;
}

.top-bar .page-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.top-bar .top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
}

/* ── Content Wrap ──────────────────────────────────────────── */
.content-wrap {
  padding: 28px 32px 48px;
  position: relative;
  /* No z-index: keep this out of the modal's stacking ancestry (see .app-shell). */
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  position: relative;
  /* No z-index: keep this out of the modal's stacking ancestry (see .app-shell). */
  display: flex;
  flex-direction: column;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
  transition: all var(--tr-smooth);
  overflow: hidden;
  position: relative;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--grad-subtle);
  opacity: 0;
  transition: opacity var(--tr-smooth);
  pointer-events: none;
}

.card:hover {
  border-color: var(--border-medium);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.card:hover::before {
  opacity: 1;
}

.card-body {
  padding: 24px;
  position: relative;
  z-index: 1;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: transparent;
  position: relative;
  z-index: 1;
}

/* ── Metric Cards ──────────────────────────────────────────── */
.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  backdrop-filter: blur(12px);
  transition: all var(--tr-smooth);
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.metric-card:hover {
  border-color: var(--border-medium);
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
}

.metric-card .metric-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-bg);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--accent);
  margin-bottom: 18px;
}

.metric-card .metric-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 4px;
}

.metric-card .metric-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-card .metric-change {
  margin-top: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.metric-change.up { color: var(--success); }
.metric-change.down { color: var(--error); }

/* ── Hero Section (Dashboard) ──────────────────────────────── */
.hero-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 40px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(16px);
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.10) 0%, transparent 70%);
  pointer-events: none;
}

.hero-section::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -5%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.hero-section .hero-kicker {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}

.hero-section .hero-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -0.03em;
}

.hero-section .hero-sub {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 0;
}

/* ── Account Card ──────────────────────────────────────────── */
.account-card {
  background: rgba(17, 17, 17, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: all var(--tr-smooth);
  position: relative;
  overflow: hidden;
}

.account-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), transparent);
  opacity: 0;
  transition: opacity var(--tr-smooth);
  pointer-events: none;
}

.account-card:hover::before {
  opacity: 1;
}

.account-card:hover {
  border-color: var(--border-medium);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.account-card .account-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--border-medium);
  object-fit: cover;
  background: var(--accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--accent);
  flex-shrink: 0;
}

.account-card .account-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.glass-modal {
  background: rgba(12, 16, 33, 0.7);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid rgba(139, 92, 246, 0.12);
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.05);
}

.account-card .account-info {
  flex: 1;
  min-width: 0;
}

.account-card .account-username {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.account-card .account-fullname {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.account-card .account-stats {
  display: flex;
  gap: 20px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.account-card .account-stats .stat {
  text-align: center;
}

.account-card .stat-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
}

.account-card .stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.account-card .account-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

/* ── Post Card ─────────────────────────────────────────────── */
.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--tr-smooth);
}

.post-card:hover {
  border-color: var(--border-medium);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.post-card .post-thumb {
  width: 100%;
  aspect-ratio: 9/16;
  max-height: 200px;
  object-fit: cover;
  background: rgba(168, 85, 247, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 2rem;
}

.post-card .post-body {
  padding: 20px;
}

.post-card .post-caption {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
  line-height: 1.5;
}

.post-card .post-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.post-card .post-time {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Caption Card ──────────────────────────────────────────── */
.caption-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--tr-smooth);
}

.caption-card:hover {
  border-color: var(--border-medium);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.caption-card .caption-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.caption-card .caption-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.caption-card .caption-count {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
}

.caption-card .caption-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

/* ── Audio Card ────────────────────────────────────────────── */
.audio-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--tr-smooth);
}

.audio-card:hover {
  border-color: var(--border-medium);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.audio-card .audio-play {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--grad-primary);
  border: none;
  color: #fff;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--tr-base);
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.25);
}

.audio-card .audio-play:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(168, 85, 247, 0.35);
}

.audio-card .audio-info {
  flex: 1;
  min-width: 0;
}

.audio-card .audio-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.audio-card .audio-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  gap: 16px;
}

/* ── Status Dots & Badges ──────────────────────────────────── */
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.active {
  background: var(--success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.status-dot.connecting {
  background: var(--warning);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
  animation: pulse-dot-warn 1.5s ease infinite;
}

.status-dot.error {
  background: var(--error);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

@keyframes pulse-dot-warn {
  0%, 100% { box-shadow: 0 0 8px rgba(245, 158, 11, 0.3); }
  50% { box-shadow: 0 0 16px rgba(245, 158, 11, 0.7); }
}

.badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-active {
  background: rgba(34, 197, 94, 0.12);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.badge-connecting {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-error {
  background: rgba(239, 68, 68, 0.12);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge-published {
  background: rgba(34, 197, 94, 0.12);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.badge-queued {
  background: rgba(168, 85, 247, 0.12);
  color: var(--accent);
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.badge-draft {
  background: rgba(163, 160, 181, 0.12);
  color: var(--text-muted);
  border: 1px solid rgba(163, 160, 181, 0.20);
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--tr-base);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1.4;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--grad-primary);
  color: #fff;
  border: none;
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(168, 85, 247, 0.40);
  color: #fff;
}

.btn-primary:active {
  transform: translateY(0);
}

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

.btn-secondary:hover {
  border-color: var(--border-medium);
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border-medium);
}

.btn-outline:hover {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 8px 12px;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(168, 85, 247, 0.08);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.20);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.20);
  border-color: var(--error);
}

.btn-sm {
  font-size: 0.8rem;
  padding: 7px 14px;
}

.btn-lg {
  font-size: 1rem;
  padding: 14px 28px;
}

.btn-icon {
  padding: 10px;
  width: 40px;
  height: 40px;
  justify-content: center;
}

/* ── Form Controls ─────────────────────────────────────────── */
.form-control,
.form-select {
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  padding: 12px 16px;
  transition: all var(--tr-base);
}

.form-control:focus,
.form-select:focus {
  background: var(--bg-input);
  border-color: var(--accent);
  color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
  outline: none;
}

.form-control::placeholder {
  color: var(--text-faint);
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.form-text {
  font-size: 0.78rem;
  color: var(--text-faint);
}

.form-group {
  margin-bottom: 20px;
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

.form-select option {
  background: var(--bg-body);
  color: var(--text-primary);
}

/* ── Tables ────────────────────────────────────────────────── */
.table {
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.table thead th {
  background: rgba(12, 10, 20, 0.50);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 14px 16px;
}

.table tbody td {
  border-bottom: 1px solid var(--border-subtle);
  padding: 14px 16px;
  vertical-align: middle;
  font-size: 0.88rem;
}

.table tbody tr {
  transition: background var(--tr-fast);
}

.table tbody tr:hover {
  background: rgba(168, 85, 247, 0.04);
}

.table-dark {
  --bs-table-bg: transparent;
}

/* ── Modals ────────────────────────────────────────────────── */
.modal-backdrop-custom {
  position: fixed;
  inset: 0;
  background: rgba(2, 1, 5, 0.80);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 999;
  opacity: 0;
  transition: opacity var(--tr-smooth);
  display: none;
}

.modal-backdrop-custom.show {
  display: block;
  opacity: 1;
}

.modal-custom {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  z-index: 1000;
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-modal);
  opacity: 0;
  transition: all var(--tr-smooth);
  display: none;
}

.modal-custom.show {
  display: block;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.modal-custom .modal-header {
  padding: 24px 28px 0;
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-custom .modal-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-custom .modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
  transition: color var(--tr-fast);
  line-height: 1;
}

.modal-custom .modal-close:hover {
  color: var(--text-primary);
}

.modal-custom .modal-body {
  padding: 24px 28px;
}

.modal-custom .modal-footer {
  padding: 0 28px 24px;
  border: none;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Toasts ────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--bg-toast);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  min-width: 320px;
  max-width: 440px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-glow);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  pointer-events: all;
  animation: toastSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.toast.toast-exit {
  animation: toastSlideOut 0.25s ease forwards;
}

.toast .toast-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast .toast-content {
  flex: 1;
}

.toast .toast-title {
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 2px;
}

.toast .toast-message {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.toast .toast-close {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px;
  transition: color var(--tr-fast);
  flex-shrink: 0;
}

.toast .toast-close:hover {
  color: var(--text-primary);
}

.toast-success { border-left: 3px solid var(--success); }
.toast-success .toast-icon { color: var(--success); }

.toast-error { border-left: 3px solid var(--error); }
.toast-error .toast-icon { color: var(--error); }

.toast-warning { border-left: 3px solid var(--warning); }
.toast-warning .toast-icon { color: var(--warning); }

.toast-info { border-left: 3px solid var(--info); }
.toast-info .toast-icon { color: var(--info); }

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
  }
}

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 64px 32px;
}

.empty-state .empty-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent-bg);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 2rem;
  color: var(--accent);
}

.empty-state .empty-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.empty-state .empty-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 400px;
  margin: 0 auto 24px;
  line-height: 1.6;
}

/* ── Auth Shell ────────────────────────────────────────────── */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  padding: 32px 16px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-glow-lg);
  padding: 44px 40px;
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--grad-primary);
  border-radius: 0 0 8px 8px;
}

.auth-card .auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}

.auth-card .auth-logo .brand-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  box-shadow: 0 4px 24px rgba(168, 85, 247, 0.30);
}

.auth-card .auth-logo .brand-name {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.auth-card .auth-kicker {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 600;
  text-align: center;
  margin-bottom: 8px;
}

.auth-card .auth-title {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 32px;
  letter-spacing: -0.03em;
}

.auth-card .auth-footer {
  text-align: center;
  margin-top: 28px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-card .auth-footer a {
  color: var(--accent);
  font-weight: 600;
}

/* Form errors */
.form-errors {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.20);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 20px;
}

.form-errors ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.form-errors li {
  font-size: 0.82rem;
  color: var(--error);
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-errors li + li {
  margin-top: 4px;
}

/* ── Section Headers ───────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.section-header .section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.section-header .section-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Quick Actions ─────────────────────────────────────────── */
.quick-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.quick-action-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all var(--tr-smooth);
  text-decoration: none;
  color: var(--text-primary);
  flex: 1;
  min-width: 200px;
}

.quick-action-btn:hover {
  border-color: var(--border-medium);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
  color: var(--text-primary);
}

.quick-action-btn .qa-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-bg);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--accent);
  flex-shrink: 0;
}

.quick-action-btn .qa-text {
  font-weight: 600;
  font-size: 0.9rem;
}

.quick-action-btn .qa-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ── Activity Feed ─────────────────────────────────────────── */
.activity-feed {
  list-style: none;
  padding: 0;
  margin: 0;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-item .activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-item .activity-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.activity-item .activity-time {
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-top: 2px;
}

/* ── Queue Sections ────────────────────────────────────────── */
.queue-section {
  margin-bottom: 40px;
}

.queue-section .queue-title {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.queue-section .queue-count {
  background: var(--accent-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 100px;
  padding: 2px 10px;
  font-size: 0.72rem;
  color: var(--accent);
}

/* ── Loading / Spinner ─────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-shimmer {
  background: linear-gradient(
    90deg,
    rgba(168, 85, 247, 0.05) 25%,
    rgba(168, 85, 247, 0.10) 50%,
    rgba(168, 85, 247, 0.05) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── HTMX Indicator ────────────────────────────────────────── */
.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline-flex;
}

/* ── Mobile Bottom Nav ─────────────────────────────────────── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-subtle);
  z-index: 100;
  padding: 8px 12px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0));
  backdrop-filter: blur(20px);
}

.mobile-nav .mobile-links {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.mobile-nav .mobile-links a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-faint);
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 500;
  padding: 6px 4px;
  transition: color var(--tr-fast);
}

.mobile-nav .mobile-links a i {
  font-size: 1.2rem;
}

.mobile-nav .mobile-links a.active,
.mobile-nav .mobile-links a:hover {
  color: var(--accent);
}

/* ── Utilities ─────────────────────────────────────────────── */
.text-accent { color: var(--accent) !important; }
.text-muted-custom { color: var(--text-muted) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-error { color: var(--error) !important; }

.border-accent { border-color: var(--border-medium) !important; }

.bg-accent-soft { background: var(--accent-bg) !important; }

.glow { box-shadow: var(--shadow-glow) !important; }

.gap-grid { gap: 20px; }

.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;
}

/* ── Divider ───────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 24px 0;
}

/* ── Bootstrap Overrides ───────────────────────────────────── */
.btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

.dropdown-menu {
  background: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal);
  padding: 8px;
}

.dropdown-item {
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 0.88rem;
  transition: all var(--tr-fast);
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: var(--accent-bg);
  color: var(--text-primary);
}

.modal-content {
  background: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-modal);
}

.modal-header {
  border-bottom: 1px solid var(--border-subtle);
  padding: 20px 28px;
}

.modal-body {
  padding: 24px 28px;
}

.modal-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 16px 28px;
}

.modal-backdrop {
  background-color: rgba(2, 1, 5, 0.75);
}

.nav-tabs {
  border-bottom: 1px solid var(--border-subtle);
}

.nav-tabs .nav-link {
  color: var(--text-muted);
  border: none;
  padding: 12px 20px;
  font-weight: 600;
  font-size: 0.88rem;
  transition: all var(--tr-base);
}

.nav-tabs .nav-link:hover {
  color: var(--text-primary);
  border-color: transparent;
}

.nav-tabs .nav-link.active {
  background: transparent;
  color: var(--accent);
  border: none;
  border-bottom: 2px solid var(--accent);
}

.alert {
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: 0.88rem;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.20);
  color: var(--error);
}

.alert-success {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.20);
  color: var(--success);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.20);
  color: var(--warning);
}

/* Override Bootstrap's default bg colors */
.bg-dark { background: var(--bg-card) !important; }

/* Input group */
.input-group-text {
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── Challenge Code Input ──────────────────────────────────── */
.challenge-input {
  text-align: center;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.4em;
  padding: 16px;
  font-family: 'Inter', monospace;
}

/* ── Progress Bar ──────────────────────────────────────────── */
.progress {
  background: rgba(168, 85, 247, 0.08);
  border-radius: 100px;
  height: 6px;
  overflow: hidden;
}

.progress-bar {
  background: var(--grad-primary);
  border-radius: 100px;
  transition: width 0.6s ease;
}

/* ── Page Transition ───────────────────────────────────────── */
.content-wrap {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@media (max-width: 992px) {
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .side-nav {
    transform: translateX(-100%);
  }

  .side-nav.open {
    transform: translateX(0);
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.6);
  }

  .main-content {
    grid-column: 1;
  }

  .mobile-toggle {
    display: block;
  }

  .mobile-nav {
    display: block;
  }

  .top-bar {
    padding: 0 16px;
  }

  .content-wrap {
    padding: 20px 16px 100px;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .hero-section {
    padding: 28px 20px;
  }

  .auth-card {
    padding: 32px 24px;
  }

  .modal-custom {
    width: 95%;
    max-height: 85vh;
  }

  .quick-actions {
    flex-direction: column;
  }

  .quick-action-btn {
    min-width: 100%;
  }

  .metric-card .metric-value {
    font-size: 1.6rem;
  }
}

@media (max-width: 480px) {
  .hero-section .hero-title {
    font-size: 1.2rem;
  }

  .top-bar .page-title {
    font-size: 1.1rem;
  }

  .toast {
    min-width: 280px;
    max-width: calc(100vw - 40px);
  }
}

/* ── Sidebar overlay for mobile ────────────────────────────── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99;
  display: none;
  opacity: 0;
  transition: opacity var(--tr-smooth);
}

.sidebar-overlay.show {
  display: block;
  opacity: 1;
}

/* ── Campo de senha com botão "olhinho" (revelar/ocultar) ──────
   Envolve um <input type="password"> e um <button.pw-toggle>. O JS
   (app.js) alterna o type do input e a classe .is-visible no wrapper,
   que troca qual ícone (olho / olho cortado) aparece. */
.pw-field {
  position: relative;
}
.pw-field > .form-control {
  padding-right: 44px;
}
.pw-field > .pw-toggle {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--tr-base);
}
.pw-field > .pw-toggle:hover {
  color: var(--text-primary);
}
.pw-field > .pw-toggle .pw-icon-off { display: none; }
.pw-field.is-visible > .pw-toggle .pw-icon-on { display: none; }
.pw-field.is-visible > .pw-toggle .pw-icon-off { display: inline-flex; }

/* ── Painel de verificação INLINE (2FA / checkpoint) ───────────
   Substitui o antigo modal Bootstrap que ficava preso dentro do
   .account-card (backdrop-filter/transform prendiam o position:fixed
   e o polling do HTMX órfãos o backdrop → tela congelava). Inline não
   tem backdrop nem posição fixa: nada trava, nada corta. */
.verify-panel {
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md, 12px);
  background: rgba(245, 197, 24, 0.06);
  padding: 16px;
  margin-bottom: 16px;
}
.verify-panel .verify-title {
  color: #f5c518;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.verify-panel .verify-hint {
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.5;
  margin-bottom: 12px;
}
.verify-panel .verify-code-input {
  text-align: center;
  font-size: 1.4rem;
  letter-spacing: 0.4em;
  font-weight: 700;
  padding: 10px 12px;
}
.verify-panel .verify-code-input::placeholder {
  letter-spacing: 0.2em;
  font-weight: 500;
}
.verify-panel .verify-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.verify-panel .verify-resend {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 6px 4px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.verify-panel .verify-resend:hover {
  color: var(--text-primary);
}
.verify-panel .verify-resend:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  text-decoration: none;
}

/* ============================================================
   NEON OVERRIDES — Cyberpunk Glow System
   ============================================================ */

/* ── Neon Buttons ────────────────────────────────────────── */
[data-theme="dark"] .btn-primary {
  background: linear-gradient(135deg, #7c3aed, #06b6d4) !important;
  border: none !important;
  color: #fff !important;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.35), 0 0 40px rgba(34, 211, 238, 0.1);
  transition: all 0.3s ease;
}

[data-theme="dark"] .btn-primary:hover {
  box-shadow: 0 6px 30px rgba(139, 92, 246, 0.5), 0 0 60px rgba(34, 211, 238, 0.2);
  transform: translateY(-1px);
  filter: brightness(1.1);
}

[data-theme="dark"] .btn-outline-secondary {
  border-color: rgba(139, 92, 246, 0.25) !important;
  color: #a5b4fc !important;
}

[data-theme="dark"] .btn-outline-secondary:hover {
  background: rgba(139, 92, 246, 0.1) !important;
  border-color: rgba(139, 92, 246, 0.4) !important;
  color: #c4b5fd !important;
}

/* ── Neon Form Controls ──────────────────────────────────── */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background: rgba(17, 23, 48, 0.8) !important;
  border: 1px solid rgba(139, 92, 246, 0.15) !important;
  color: #e8eaff !important;
  transition: all 0.2s ease;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
  border-color: rgba(139, 92, 246, 0.5) !important;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1), 0 0 20px rgba(139, 92, 246, 0.08) !important;
  outline: none;
}

[data-theme="dark"] .form-control::placeholder {
  color: #3d4a7a !important;
}

/* ── Neon Tables ─────────────────────────────────────────── */
[data-theme="dark"] .table-dark {
  --bs-table-bg: transparent !important;
  --bs-table-hover-bg: rgba(139, 92, 246, 0.06) !important;
}

[data-theme="dark"] .table-dark thead th {
  color: #6b7ec2 !important;
  border-bottom: 1px solid rgba(139, 92, 246, 0.12) !important;
}

/* ── Neon Badges ─────────────────────────────────────────── */
[data-theme="dark"] .badge.bg-success { box-shadow: 0 0 10px rgba(52, 211, 153, 0.2); }
[data-theme="dark"] .badge.bg-danger { box-shadow: 0 0 10px rgba(236, 72, 153, 0.2); }
[data-theme="dark"] .badge.bg-warning { box-shadow: 0 0 10px rgba(251, 191, 36, 0.2); }
[data-theme="dark"] .badge.bg-info { box-shadow: 0 0 10px rgba(34, 211, 238, 0.2); }
[data-theme="dark"] .badge.bg-primary { box-shadow: 0 0 10px rgba(139, 92, 246, 0.2); }

/* ── Neon Scrollbar ──────────────────────────────────────── */
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.5);
}
[data-theme="dark"] * {
  scrollbar-color: rgba(139, 92, 246, 0.3) transparent;
}

/* ── Neon Category Labels ────────────────────────────────── */
[data-theme="dark"] .nav-category {
  color: #4c5fa0 !important;
  text-shadow: 0 0 20px rgba(139, 92, 246, 0.15);
}

/* ── Neon Card Hover Glow ────────────────────────────────── */
[data-theme="dark"] .card:hover {
  border-color: rgba(139, 92, 246, 0.25);
  box-shadow: 0 4px 30px rgba(139, 92, 246, 0.12), 0 0 60px rgba(139, 92, 246, 0.04);
}

/* ── Neon Dropdown ───────────────────────────────────────── */
[data-theme="dark"] .dropdown-menu {
  background: rgba(14, 18, 37, 0.95) !important;
  border: 1px solid rgba(139, 92, 246, 0.15) !important;
  backdrop-filter: blur(20px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 40px rgba(139, 92, 246, 0.08);
}

[data-theme="dark"] .dropdown-item {
  color: #a5b4fc !important;
}

[data-theme="dark"] .dropdown-item:hover {
  background: rgba(139, 92, 246, 0.12) !important;
  color: #e8eaff !important;
}

/* ── Neon Topbar ─────────────────────────────────────────── */
[data-theme="dark"] .top-bar {
  border-bottom-color: rgba(139, 92, 246, 0.1);
}

/* ============================================================
   ONDA 1 — Fundação de UX: sidebar colapsável · ⌘K · progresso
   ============================================================ */

/* ── Barra de progresso global (navegação + HTMX) ─────────── */
.app-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  background: var(--grad-primary, linear-gradient(90deg, #7c3aed, #06b6d4));
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.7);
  z-index: 2000;
  opacity: 0;
  transition: width 0.2s ease, opacity 0.3s ease;
  pointer-events: none;
}
.app-progress.active { opacity: 1; }

/* ── Toggle de colapsar a sidebar (somente desktop) ───────── */
.desk-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  transition: all var(--tr-base);
}
.desk-toggle:hover { color: var(--text-primary); background: var(--accent-bg); }

@media (min-width: 769px) {
  .desk-toggle { display: inline-flex; align-items: center; }

  :root[data-nav="collapsed"] { --sidebar-w: 78px; }

  [data-nav="collapsed"] .side-brand { padding: 24px 0; }
  [data-nav="collapsed"] .side-brand .brand-logo { justify-content: center; gap: 0; }
  [data-nav="collapsed"] .brand-text { display: none; }
  [data-nav="collapsed"] .side-links { padding: 16px 10px; }
  [data-nav="collapsed"] .side-links .nav-text,
  [data-nav="collapsed"] .nav-category { display: none; }
  [data-nav="collapsed"] .side-links a { justify-content: center; padding: 12px 0; gap: 0; }
  [data-nav="collapsed"] .side-links a i { width: auto; }
  [data-nav="collapsed"] .side-links a.active::before { display: none; }

  /* Tooltip do rótulo ao passar o mouse na sidebar colapsada */
  [data-nav="collapsed"] .side-links a::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    padding: 6px 11px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    transition: opacity var(--tr-base);
    z-index: 300;
  }
  [data-nav="collapsed"] .side-links a:hover::after { opacity: 1; }
}

/* ── Gatilho da busca ⌘K na topbar ────────────────────────── */
.cmdk-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 12px;
  min-width: 220px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--tr-base);
}
.cmdk-trigger:hover { border-color: var(--primary); color: var(--text-primary); }
.cmdk-trigger .cmdk-trigger-label { flex: 1; text-align: left; }
.cmdk-kbd {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-app, transparent);
  color: var(--text-muted);
  line-height: 1;
}
@media (max-width: 768px) {
  .cmdk-trigger { min-width: 0; }
  .cmdk-trigger .cmdk-trigger-label, .cmdk-trigger .cmdk-kbd { display: none; }
}

/* ── Command Palette (overlay + caixa) ────────────────────── */
.cmdk-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 15, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 2500;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
.cmdk-overlay.open { display: flex; }
.cmdk-box {
  width: 100%;
  max-width: 560px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 60px rgba(139, 92, 246, 0.12);
  overflow: hidden;
  animation: cmdk-in 0.16s ease;
}
@keyframes cmdk-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.cmdk-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-subtle);
}
.cmdk-input-wrap i { color: var(--text-muted); font-size: 1.1rem; }
.cmdk-input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 1rem;
}
.cmdk-input-wrap .cmdk-esc {
  font-size: 0.7rem;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  padding: 2px 7px;
  border-radius: 6px;
}
.cmdk-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  max-height: 46vh;
  overflow-y: auto;
}
.cmdk-list a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}
.cmdk-list a i { font-size: 1.05rem; width: 22px; text-align: center; }
.cmdk-list li.active a,
.cmdk-list a:hover {
  background: rgba(139, 92, 246, 0.15);
  color: var(--text-primary);
}
.cmdk-list li.active a i { color: var(--primary); }
.cmdk-empty {
  padding: 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ============================================================
   Correção de contraste — texto auxiliar em dark mode
   ------------------------------------------------------------
   O Bootstrap acha que estamos em light (usamos data-theme, não
   data-bs-theme), então .text-muted/.text-secondary e placeholders
   saem com cinza de light-mode e ficam ilegíveis sobre o fundo
   escuro. Forçamos tons legíveis.
   ============================================================ */
[data-theme="dark"] .text-muted,
[data-theme="dark"] .text-body-secondary,
[data-theme="dark"] small.text-muted,
[data-theme="dark"] .form-text {
  color: var(--text-muted) !important;
}
[data-theme="dark"] .form-label.text-muted,
[data-theme="dark"] label.text-muted {
  color: #c0c8ea !important;
}
[data-theme="dark"] .text-secondary {
  color: var(--text-secondary) !important;
}
[data-theme="dark"] .form-control::placeholder,
[data-theme="dark"] .form-select::placeholder {
  color: #6e7aab !important;
}
/* Garante contraste do corpo de texto padrão do Bootstrap em dark */
[data-theme="dark"] .card-body,
[data-theme="dark"] .modal-body,
[data-theme="dark"] .dropdown-item {
  color: var(--text-primary);
}

/* ============================================================
   Ranking de Produtividade (componente dark próprio)
   ============================================================ */
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ranking-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--bg-card-hover);
  border: 1px solid var(--border-subtle);
  transition: border-color var(--tr-base), transform var(--tr-base);
}
.ranking-row:hover {
  border-color: var(--border-medium);
  transform: translateX(2px);
}
.ranking-row.is-me {
  background: rgba(139, 92, 246, 0.12);
  border-color: var(--border-strong);
  box-shadow: inset 0 0 24px rgba(139, 92, 246, 0.08);
}
.ranking-pos { flex-shrink: 0; }
.ranking-medal {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
}
.ranking-medal.gold {
  background: linear-gradient(135deg, #fde047, #f59e0b);
  color: #3a2a00;
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.45);
}
.ranking-medal.silver {
  background: linear-gradient(135deg, #e2e8f0, #94a3b8);
  color: #1e293b;
}
.ranking-medal.bronze {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #fff;
}
.ranking-medal.plain {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}
.ranking-user {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.ranking-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.ranking-name {
  color: var(--text-primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ranking-you {
  font-size: 0.62rem;
  background: var(--primary);
  color: #fff;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 700;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.ranking-sub {
  color: #97a2d2;
  font-size: 0.8rem;
  margin-top: 2px;
}
.ranking-sub .ranking-dot { margin: 0 6px; opacity: 0.5; }
.ranking-score {
  flex-shrink: 0;
  font-weight: 700;
  font-size: 0.88rem;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.28);
  padding: 7px 14px;
  border-radius: 20px;
  white-space: nowrap;
}
.min-w-0 { min-width: 0; }
@media (max-width: 576px) {
  .ranking-row { gap: 10px; padding: 10px 12px; }
  .ranking-sub { font-size: 0.72rem; }
  .ranking-score { padding: 6px 10px; font-size: 0.78rem; }
}

