/* AfiliadoCash - Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --green-900: #0a2e1a;
  --green-800: #0d3d24;
  --green-700: #115c35;
  --green-600: #1a7a47;
  --green-500: #22a55b;
  --green-400: #3dd47a;
  --gradient-primary: linear-gradient(135deg, #0d3d24 0%, #22a55b 50%, #1a7a47 100%);
  --gradient-card: linear-gradient(145deg, rgba(34,165,91,0.12) 0%, rgba(13,61,36,0.05) 100%);
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.12);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --font: 'Inter', system-ui, sans-serif;
  --sidebar-width: 260px;
  --header-height: 64px;
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --bg-body: #0a0f0c;
  --bg-card: #111916;
  --bg-sidebar: #0d1410;
  --bg-input: #1a2420;
  --text-primary: #f0f4f2;
  --text-secondary: #9ca8a2;
  --text-muted: #6b7872;
  --border: #1e2e26;
  --hover: rgba(34,165,91,0.1);
}

[data-theme="light"] {
  --bg-body: #f4f7f5;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-input: #f0f4f2;
  --text-primary: #0a1a12;
  --text-secondary: #4a5c52;
  --text-muted: #7a8a82;
  --border: #dce5e0;
  --hover: rgba(34,165,91,0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--green-500); text-decoration: none; }
a:hover { color: var(--green-400); }

/* Auth */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--bg-body);
  position: relative;
  overflow: hidden;
}
.auth-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-primary);
  opacity: 0.15;
  pointer-events: none;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
}
.auth-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}
.auth-logo h1 {
  font-size: 1.75rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.auth-logo p { color: var(--text-secondary); font-size: 0.875rem; margin-top: 0.25rem; }

/* Layout painel */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition);
}
.sidebar-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand {
  line-height: 0;
}

/* Logo tema claro / escuro */
.brand-logo {
  line-height: 0;
}

.brand-logo-img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
}

.brand-logo--auth .brand-logo-img {
  max-height: 44px;
}

.brand-logo--sidebar .brand-logo-img {
  max-height: 36px;
}

.brand-logo--light {
  display: none;
}

[data-theme="light"] .brand-logo--dark {
  display: none;
}

[data-theme="light"] .brand-logo--light {
  display: block;
}
.sidebar-nav-zone {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border);
}
.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 0.75rem 0.75rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.sidebar-nav::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.sidebar-scroll-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: calc(100% - 1rem);
  margin: 0.25rem auto;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.sidebar-scroll-btn.is-visible {
  display: flex;
}
.sidebar-scroll-btn:hover {
  background: var(--hover);
  color: var(--green-500);
  border-color: rgba(34, 165, 91, 0.35);
}
.sidebar-scroll-btn--up { margin-top: 0.35rem; }
.sidebar-scroll-btn--down { margin-bottom: 0.35rem; }
.nav-section { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); padding: 0.75rem 0.75rem 0.25rem; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
}
.nav-link:hover, .nav-link.active {
  background: var(--hover);
  color: var(--green-500);
}
.nav-link svg { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
}
.user-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}
.user-menu:hover { background: var(--hover); }
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 0.875rem;
}
.user-info { flex: 1; min-width: 0; }
.user-info strong { display: block; font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info span { font-size: 0.75rem; color: var(--text-muted); }

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 1rem; }
.topbar-titles { min-width: 0; }
.page-title { font-size: 1.125rem; font-weight: 700; margin: 0; letter-spacing: -0.02em; }
.topbar-subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}
.content-area { flex: 1; padding: 1.5rem; max-width: 1400px; width: 100%; }

/* Mobile */
.menu-toggle, .sidebar-overlay { display: none; }
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
  }
  .sidebar-overlay.show { display: block; }
  .main-content { margin-left: 0; }
  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    cursor: pointer;
    color: var(--text-primary);
  }
}

/* Cards & Stats */
.admin-dash-hero {
  margin-bottom: 1.5rem;
}
.admin-dash-hero h2 {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}
.admin-dash-hero p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.25rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-primary);
}
.stat-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}
.stat-card .label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.stat-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-card-icon svg { width: 20px; height: 20px; }
.stat-card-icon--green { background: rgba(34, 165, 91, 0.18); color: #3dd47a; }
.stat-card-icon--blue { background: rgba(59, 130, 246, 0.18); color: #60a5fa; }
.stat-card-icon--purple { background: rgba(168, 85, 247, 0.18); color: #c084fc; }
.stat-card-icon--orange { background: rgba(249, 115, 22, 0.18); color: #fb923c; }
.stat-card-icon--gold { background: rgba(234, 179, 8, 0.18); color: #fbbf24; }
.stat-card .value { font-size: 1.55rem; font-weight: 800; line-height: 1.1; }
.stat-card .sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.35rem; }
.stat-card .sub strong { color: var(--green-400); font-weight: 600; }

.stats-grid--compact {
  grid-template-columns: repeat(3, 1fr);
  margin-top: -0.5rem;
}
.stats-grid--compact .stat-card { padding: 1rem 1.1rem; }
.stats-grid--compact .stat-card .value { font-size: 1.25rem; }

.grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.25rem;
  align-items: start;
}
.card-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
}
.card-empty svg {
  width: 48px;
  height: 48px;
  opacity: 0.25;
  margin-bottom: 0.75rem;
}
.card-empty p { margin: 0; font-size: 0.9rem; }

/* Ranking afiliados — Top 1, 2, 3 */
.rank-cell {
  width: 52px;
  text-align: center;
  vertical-align: middle;
  padding: 0.35rem 0.5rem !important;
}

.rank-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.rank-medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  line-height: 0;
}

.rank-medal-img {
  display: block;
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.rank-row--1 td:first-child {
  border-left: 3px solid #fbbf24;
}

.rank-row--2 td:first-child {
  border-left: 3px solid #cbd5e1;
}

.rank-row--3 td:first-child {
  border-left: 3px solid #d97706;
}

/* Detalhe do lead (admin) */
.card--lead-detail {
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
  overflow: hidden;
}

.card-header--lead-detail {
  display: flex;
  justify-content: flex-end;
  padding: 0.75rem 1.25rem;
  border-bottom: none;
  background: transparent;
}

.lead-detail-header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  width: 100%;
}

.lead-detail-close {
  margin-left: 0;
}

.card--lead-editar {
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.lead-editar-body {
  padding: 1.25rem 1.5rem 1.75rem;
}

.lead-editar-subtitle {
  margin: 0 0 1.5rem;
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 0.75rem;
  text-align: center;
}

.lead-editar-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.lead-editar-form {
  max-width: 100%;
}

.lead-editar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.lead-detail {
  padding: 0 1.5rem 1.75rem;
  text-align: center;
}

.lead-detail-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0 1.75rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

.lead-detail-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  background: var(--gradient-primary);
  box-shadow: 0 8px 24px rgba(34, 165, 91, 0.25);
  margin-bottom: 0.35rem;
}

.lead-detail-id {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.lead-detail-name {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
}

.lead-detail-status-wrap {
  margin-top: 0.35rem;
}

.lead-detail-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
  text-align: center;
}

.lead-info-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 1.15rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.lead-info-card:hover {
  border-color: rgba(34, 165, 91, 0.35);
  box-shadow: var(--shadow-sm);
}

.lead-info-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(34, 165, 91, 0.12);
  color: var(--green-400);
}

.lead-info-card__label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.lead-info-card__value {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  word-break: break-word;
}

.lead-info-card__value--badge .badge {
  font-size: 0.8rem;
}

.lead-info-card__action {
  margin-top: 0.25rem;
}

.lead-info-card__hint {
  font-size: 0.72rem;
  line-height: 1.35;
  max-width: 12rem;
}

.lead-detail-bets,
.lead-detail-form-wrap {
  margin-bottom: 2rem;
}

.lead-detail-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.lead-detail-edit-whatsapp {
  grid-column: 1 / -1;
}

.lead-detail-edit-whatsapp small {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.75rem;
}

@media (max-width: 560px) {
  .lead-detail-edit-grid {
    grid-template-columns: 1fr;
  }
}

.lead-detail-section-head {
  margin-bottom: 1.25rem;
}

.lead-detail-section-title {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.lead-detail-section-desc {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.lead-detail-empty {
  padding: 1.5rem;
  background: var(--bg-input);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

.lead-bet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  max-width: 100%;
  margin: 0 auto;
}

.lead-detail .lead-bet-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  padding: 1.15rem 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-input);
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.lead-detail .lead-bet-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.lead-detail .lead-bet-card--tem {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.06);
}

.lead-detail .lead-bet-card--nao {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.06);
}

.lead-detail .lead-bet-card--feito {
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(59, 130, 246, 0.08);
}

.lead-detail .lead-bet-card__logo-box {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 12px;
  background: #fff;
  padding: 6px;
  box-sizing: border-box;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.lead-detail .lead-bet-card__logo {
  display: block;
  width: auto !important;
  height: auto !important;
  max-width: 52px !important;
  max-height: 52px !important;
  object-fit: contain;
  object-position: center;
}

.lead-detail .lead-bet-card__logo-ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--green-600), var(--green-800));
  color: #fff;
  font-weight: 800;
  font-size: 1.35rem;
}

.lead-detail .lead-bet-card__name {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

.lead-detail .lead-bet-resposta {
  margin: 0;
  width: 100%;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  line-height: 1.3;
}

.lead-detail .lead-bet-resposta--tem {
  color: #f87171 !important;
  background: rgba(239, 68, 68, 0.22) !important;
  border: 1px solid rgba(248, 113, 113, 0.55) !important;
}

.lead-detail .lead-bet-resposta--nao {
  color: #4ade80 !important;
  background: rgba(34, 197, 94, 0.22) !important;
  border: 1px solid rgba(74, 222, 128, 0.55) !important;
}

.lead-detail .lead-bet-resposta--feito {
  color: #93c5fd !important;
  background: rgba(59, 130, 246, 0.25) !important;
  border: 1px solid rgba(147, 197, 253, 0.55) !important;
}

.lead-bet-feito-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.15rem;
}

.lead-bet-feito-btn {
  width: 100%;
  max-width: 200px;
}

.lead-bet-feito-meta {
  margin: 0;
  font-size: 0.7rem;
  text-align: center;
}

.relatorio-cadastros-filtro {
  margin-bottom: 1.25rem;
}

.relatorio-cadastros-resumo {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
  padding: 0.85rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.relatorio-cadastros-empty {
  padding: 2rem;
  text-align: center;
}

.relatorio-cadastros-detalhe-title {
  margin: 2rem 0 1rem;
  font-size: 1rem;
  font-weight: 700;
}

.relatorio-cadastros-export-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.relatorio-cadastros-pix-form {
  margin-bottom: 1.25rem;
  max-width: 480px;
}

.relatorio-cadastros-pix-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.relatorio-cadastros-pix-row input {
  flex: 1;
  min-width: 200px;
}

.relatorio-cadastros-resumo-comissao {
  color: var(--green-400);
}

.relatorio-cadastros-valores-hint {
  font-size: 0.8rem;
  margin: -0.5rem 0 1.25rem;
}

.relatorio-whatsapp-preview {
  margin-bottom: 2rem;
  padding: 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.relatorio-whatsapp-preview-head {
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}

.relatorio-whatsapp-preview-head .relatorio-cadastros-detalhe-title {
  margin: 0;
}

.relatorio-whatsapp-text {
  margin: 0;
  padding: 1rem;
  background: #0b1410;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-primary);
  max-height: 320px;
  overflow: auto;
}

.relatorio-cadastros-table tfoot td {
  border-top: 2px solid var(--border);
  font-weight: 700;
}

.relatorio-por-plataforma {
  margin-top: 2rem;
}

.relatorio-plataforma-grid {
  margin-top: 0.5rem;
  align-items: start;
}

.relatorio-por-plataforma .lead-bet-card__logo-box {
  flex-shrink: 0;
  width: 64px !important;
  height: 64px !important;
  min-width: 64px !important;
  max-width: 64px !important;
  min-height: 64px !important;
  max-height: 64px !important;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden !important;
  border-radius: 10px;
  background: #fff;
  padding: 6px;
  box-sizing: border-box;
}

.relatorio-por-plataforma .lead-bet-card__logo,
.relatorio-por-plataforma .lead-bet-card__logo-box img {
  display: block !important;
  width: auto !important;
  height: auto !important;
  max-width: 52px !important;
  max-height: 52px !important;
  object-fit: contain !important;
}

.relatorio-plataforma-card {
  text-align: center;
  overflow: hidden;
  max-width: 100%;
}

.relatorio-plataforma-comissao {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.relatorio-plataforma-comissao strong {
  color: var(--green-400);
}

.relatorio-plataforma-lista {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  width: 100%;
  text-align: left;
  border-top: 1px solid var(--border);
  padding-top: 0.65rem;
}

.relatorio-plataforma-item {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.15rem 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
}

.relatorio-plataforma-item:last-child {
  border-bottom: none;
}

.relatorio-plataforma-item__hora {
  grid-row: 1 / 3;
  color: var(--text-muted);
  font-weight: 600;
}

.relatorio-plataforma-item__wa {
  color: var(--text-primary);
  font-weight: 600;
}

.relatorio-plataforma-item__nome {
  grid-column: 2;
  color: var(--text-secondary);
}

.relatorio-plataforma-item__valor {
  grid-column: 3;
  grid-row: 1 / 3;
  align-self: center;
  font-weight: 700;
  color: var(--green-400);
  white-space: nowrap;
}

.relatorio-por-plataforma .lead-detail-section-head {
  text-align: center;
}

@media (max-width: 640px) {
  .relatorio-plataforma-item {
    grid-template-columns: 2.5rem 1fr;
  }

  .relatorio-plataforma-item__valor {
    grid-column: 2;
    grid-row: auto;
  }
}

.lead-detail-form-wrap {
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.lead-detail-form {
  max-width: 520px;
  margin: 0 auto;
  text-align: left;
}

.lead-detail-form .form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.lead-detail-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 1rem;
}

.lead-detail-actions .btn {
  min-width: 140px;
}

@media (max-width: 768px) {
  .lead-detail-info-grid {
    grid-template-columns: 1fr;
  }

  .lead-bet-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .lead-detail-name {
    font-size: 1.25rem;
  }
}

@media (max-width: 480px) {
  .lead-detail {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .lead-bet-grid {
    grid-template-columns: 1fr;
  }

  .lead-detail-actions .btn {
    flex: 1;
    min-width: calc(50% - 0.35rem);
  }
}

@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid--compact { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .stats-grid,
  .stats-grid--compact { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.card-header h2 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 1.25rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--text-secondary);
}
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
input, select, textarea {
  width: 100%;
  padding: 0.65rem 0.875rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color var(--transition);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(34,165,91,0.2);
}
textarea { min-height: 100px; resize: vertical; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  text-decoration: none;
}
.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
}
.btn-primary:hover { opacity: 0.9; color: #fff; transform: translateY(-1px); }
.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--hover); }
.btn-danger { background: #dc3545; color: #fff; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }
.btn-block { width: 100%; }
.btn-icon {
  width: 40px; height: 40px;
  padding: 0;
  border-radius: var(--radius);
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

/* Table */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--text-secondary); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: var(--hover); }

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-success { background: rgba(34,165,91,0.2); color: var(--green-400); }
.badge-warning { background: rgba(255,193,7,0.2); color: #ffc107; }
.badge-danger { background: rgba(220,53,69,0.2); color: #f87171; }
.badge-info { background: rgba(13,202,240,0.2); color: #38bdf8; }
.badge-secondary { background: var(--hover); color: var(--text-secondary); }

/* Alerts */
.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.875rem;
}
.alert-success { background: rgba(34,165,91,0.15); border: 1px solid var(--green-600); color: var(--green-400); }
.alert-error { background: rgba(220,53,69,0.15); border: 1px solid #dc3545; color: #f87171; }
.alert-info { background: rgba(13,202,240,0.15); border: 1px solid #0dcaf0; color: #38bdf8; }

/* Utilities */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.gap-1 { gap: 0.5rem; }

/* Link copy box */
.link-box {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  margin-bottom: 0.75rem;
}
.link-box input {
  border: none;
  background: transparent;
  flex: 1;
  font-size: 0.8rem;
}
.link-box .btn { flex-shrink: 0; }

/* Captura pública */
.captura-page {
  min-height: 100vh;
  background: var(--bg-body);
  padding: 1.5rem 1rem;
}
.captura-container {
  max-width: 520px;
  margin: 0 auto;
}
.captura-header {
  text-align: center;
  margin-bottom: 2rem;
}
.captura-header h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.captura-header p { color: var(--text-secondary); }
.bet-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.bet-item img { max-height: 32px; max-width: 100px; object-fit: contain; }
.radio-group { display: flex; gap: 1rem; }
.radio-group label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  font-size: 0.875rem;
}
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
}
.checkbox-label input { width: auto; margin-top: 0.2rem; }

/* Pagination */
.pagination {
  display: flex;
  gap: 0.35rem;
  justify-content: center;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.pagination a:hover, .pagination .active {
  background: var(--green-600);
  border-color: var(--green-600);
  color: #fff;
}

/* Filters bar */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: flex-end;
}
.filters-bar .form-group { margin-bottom: 0; flex: 1; min-width: 140px; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state svg { width: 64px; height: 64px; opacity: 0.3; margin-bottom: 1rem; }

/* Theme toggle in topbar */
.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }

/* Rede de afiliados */
.rede-convite-box {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.rede-convite-box .form-control { flex: 1; min-width: 200px; }
.rede-nivel-indent {
  display: inline-block;
  width: calc((var(--nivel, 1) - 1) * 1.25rem);
  min-width: 0;
}
.rede-table .table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.inline-form { display: inline; }
.mb-4 { margin-bottom: 1.5rem; }
