/* ===== DESIGN SYSTEM · Vamos Juntos =====
   Direction: Modern Corporate Premium
   Palette: Deep Purple #312783 + Cyan Blue #2596be
   Fonts: Space Grotesk (display) · DM Sans (body)
   Dual-theme: [data-theme="dark"] / [data-theme="light"]
*/
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

/* ===== DARK THEME (default) ===== */
:root,
[data-theme="dark"] {
  --brand-primary: #2596be;
  --brand-secondary: #312783;
  --brand-primary-rgb: 37,150,190;
  --brand-secondary-rgb: 49,39,131;

  --bg-base: #080c18;
  --bg-surface: #0f1528;
  --bg-card: rgba(15, 21, 40, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.035);
  --bg-elevated: rgba(37, 150, 190, 0.06);

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.1);
  --border-active: rgba(37, 150, 190, 0.4);

  --text-primary: #f0f4f8;
  --text-secondary: #94a3b8;
  --text-muted: #5a6a80;
  --text-inverse: #080c18;

  --accent-glow: rgba(37, 150, 190, 0.25);
  --gradient-brand: linear-gradient(135deg, #312783, #2596be);
  --gradient-brand-h: linear-gradient(90deg, #312783, #2596be);
  --gradient-subtle: linear-gradient(135deg, rgba(49,39,131,0.25), rgba(37,150,190,0.15));

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #38bdf8;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.35);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.45);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.55);
  --shadow-glow: 0 0 30px rgba(37,150,190,0.2);
  --shadow-brand: 0 4px 20px rgba(49,39,131,0.3);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ===== LIGHT THEME ===== */
[data-theme="light"] {
  --bg-base: #f5f7fb;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-glass: rgba(49, 39, 131, 0.03);
  --bg-elevated: rgba(37, 150, 190, 0.06);

  --border-subtle: rgba(49, 39, 131, 0.06);
  --border-default: rgba(49, 39, 131, 0.12);
  --border-active: rgba(37, 150, 190, 0.5);

  --text-primary: #1a1a2e;
  --text-secondary: #5a6178;
  --text-muted: #8e95a8;
  --text-inverse: #f0f4f8;

  --accent-glow: rgba(37, 150, 190, 0.15);
  --gradient-subtle: linear-gradient(135deg, rgba(49,39,131,0.08), rgba(37,150,190,0.05));

  --shadow-sm: 0 2px 8px rgba(49,39,131,0.06);
  --shadow-md: 0 4px 20px rgba(49,39,131,0.08);
  --shadow-lg: 0 8px 40px rgba(49,39,131,0.1);
  --shadow-glow: 0 0 30px rgba(37,150,190,0.1);
  --shadow-brand: 0 4px 20px rgba(49,39,131,0.12);
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Space Grotesk', sans-serif;
}

/* ===== ANIMATED BACKGROUND ===== */
.bg-pattern {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-pattern::before {
  content: '';
  position: absolute;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(var(--brand-secondary-rgb), 0.1) 0%, transparent 70%);
  top: -250px;
  right: -150px;
  animation: bgDrift 25s ease-in-out infinite;
}

.bg-pattern::after {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(var(--brand-primary-rgb), 0.07) 0%, transparent 70%);
  bottom: -200px;
  left: -150px;
  animation: bgDrift 30s ease-in-out infinite reverse;
}

@keyframes bgDrift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, -40px) scale(1.06); }
  66% { transform: translate(-30px, 30px) scale(0.94); }
}

/* ===== VIEWS ===== */
.view { display: none; position: relative; z-index: 1; }
.view.active { display: block; }

/* ===== LOGIN ===== */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  animation: cardEnter 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-brand-h);
}

@keyframes cardEnter {
  from { opacity: 0; transform: translateY(40px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo { text-align: center; margin-bottom: 36px; }

.logo-img {
  max-width: 200px;
  height: auto;
  margin-bottom: 12px;
}

.logo-img-header {
  height: 90px;
  width: auto;
}

.login-logo h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 30px;
  font-weight: 700;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.login-logo p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 8px;
  letter-spacing: 0.3px;
}

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

.form-group label {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.form-group input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  transition: var(--transition);
  outline: none;
}

.form-group input::placeholder { color: var(--text-muted); }

.form-group input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border: none;
  border-radius: var(--radius-md);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  letter-spacing: 0.3px;
}

.btn-primary {
  width: 100%;
  background: var(--gradient-brand);
  color: white;
  box-shadow: var(--shadow-brand);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow), var(--shadow-brand);
}

.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.login-error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  color: var(--danger);
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 20px;
  display: none;
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.login-error.show { display: block; }

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: none;
}

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

/* ===== DASHBOARD LAYOUT ===== */
.dashboard-container {
  min-height: 100vh;
  padding: 24px;
  max-width: 1440px;
  margin: 0 auto;
}

/* Header */
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.header-left h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.header-left p {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 4px;
}

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

/* ===== NAVIGATION ===== */
.nav-links {
  display: flex;
  gap: 2px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 3px;
}

.nav-link {
  padding: 7px 16px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-full);
  transition: var(--transition);
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-glass);
}

.nav-link.active {
  color: white;
  background: var(--gradient-brand);
  box-shadow: var(--shadow-brand);
}

/* Unit Badge */
.unit-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-secondary);
}

.unit-badge .dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
  50% { opacity: 0.6; box-shadow: 0 0 0 4px rgba(16,185,129,0); }
}

/* Theme Toggle */
.theme-toggle {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 18px;
  transition: var(--transition);
  color: var(--text-secondary);
  line-height: 1;
}

.theme-toggle:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: var(--bg-elevated);
}

/* Logout */
.btn-logout {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 8px 16px;
  font-size: 13px;
  border-radius: var(--radius-full);
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
  color: var(--danger);
}

/* ===== STATS CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  animation: cardEnter 0.6s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }

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

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-brand-h);
  opacity: 0;
  transition: var(--transition);
}

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

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  margin-bottom: 14px;
  background: var(--gradient-subtle);
}

.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 5px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: 6px;
}

.stat-change.positive {
  color: var(--success);
  background: rgba(16, 185, 129, 0.08);
}

/* ===== CONTENT GRID ===== */
.content-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 20px;
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  animation: cardEnter 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.3s backwards;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===== FUNNEL ===== */
.funnel-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 0;
}

.funnel-stage {
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative;
  animation: slideRight 0.5s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.funnel-stage:nth-child(1) { animation-delay: 0.3s; }
.funnel-stage:nth-child(2) { animation-delay: 0.4s; }
.funnel-stage:nth-child(3) { animation-delay: 0.5s; }
.funnel-stage:nth-child(4) { animation-delay: 0.6s; }

@keyframes slideRight {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

.funnel-bar-wrapper { flex: 1; position: relative; }

.funnel-bar {
  height: 52px;
  border-radius: var(--radius-sm);
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 20px;
  transition: var(--transition);
  overflow: hidden;
  cursor: pointer;
}

.funnel-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06));
  opacity: 0;
  transition: var(--transition);
}

.funnel-bar:hover::after { opacity: 1; }
.funnel-bar:hover { transform: scaleX(1.02); box-shadow: var(--shadow-md); }

.funnel-stage:nth-child(1) .funnel-bar {
  width: 100%;
  background: linear-gradient(135deg, #312783, #4338a8);
}

.funnel-stage:nth-child(2) .funnel-bar {
  width: 80%;
  background: linear-gradient(135deg, #2d3a9e, #2596be);
}

.funnel-stage:nth-child(3) .funnel-bar {
  width: 60%;
  background: linear-gradient(135deg, #2596be, #38bdf8);
}

.funnel-stage:nth-child(4) .funnel-bar {
  width: 40%;
  background: linear-gradient(135deg, #10b981, #2596be);
}

.funnel-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: white;
  z-index: 1;
  white-space: nowrap;
}

.funnel-value {
  position: absolute;
  right: 20px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: white;
  z-index: 1;
}

.funnel-meta { width: 80px; text-align: right; }

.funnel-percentage {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.funnel-drop {
  font-size: 11px;
  color: var(--text-muted);
}

/* ===== TOP AMBASSADORS ===== */
.top-ambassadors {
  animation: cardEnter 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.5s backwards;
}

.ambassador-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ambassador-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.ambassador-item:hover {
  background: var(--bg-elevated);
  border-color: var(--border-active);
  transform: translateX(4px);
}

.ambassador-rank {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.ambassador-rank.gold { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.ambassador-rank.silver { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
.ambassador-rank.bronze { background: rgba(217, 119, 6, 0.15); color: #d97706; }
.ambassador-rank.default { background: var(--bg-glass); color: var(--text-muted); }

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

.ambassador-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ambassador-detail {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.ambassador-count {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--brand-primary);
  flex-shrink: 0;
}

/* ===== FILTERS BAR ===== */
.filters-bar {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  margin-bottom: 18px;
  padding: 18px 22px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  animation: cardEnter 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.1s backwards;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 140px;
}

.filter-group label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.filter-input {
  padding: 9px 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  transition: var(--transition);
  outline: none;
  width: 100%;
}

.filter-input::placeholder { color: var(--text-muted); }

.filter-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.filter-input::-webkit-calendar-picker-indicator {
  filter: invert(0.6);
  cursor: pointer;
}

[data-theme="light"] .filter-input::-webkit-calendar-picker-indicator {
  filter: none;
}

select.filter-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

select.filter-input option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.filter-actions {
  flex-direction: row;
  align-items: flex-end;
  gap: 8px;
  min-width: auto;
  flex: 0;
}

.btn-filter {
  background: var(--gradient-brand);
  color: white;
  padding: 9px 18px;
  white-space: nowrap;
  font-size: 13px;
  box-shadow: var(--shadow-brand);
}

.btn-filter:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow), var(--shadow-brand);
}

.btn-clear {
  background: var(--bg-glass);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  padding: 9px 14px;
  white-space: nowrap;
  font-size: 13px;
}

.btn-clear:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
  color: var(--danger);
}

/* ===== TABLE SUMMARY ===== */
.table-summary { margin-bottom: 14px; }

.summary-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 13px;
  color: var(--text-secondary);
}

.chip strong {
  font-family: 'Space Grotesk', sans-serif;
  color: var(--text-primary);
  font-weight: 700;
}

/* ===== DATA TABLE ===== */
.table-card {
  padding: 0;
  overflow: hidden;
  animation: cardEnter 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s backwards;
}

.table-responsive { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table th {
  padding: 13px 16px;
  text-align: left;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}

.th-rank { width: 50px; text-align: center; }

.th-sortable {
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}

.th-sortable:hover { color: var(--brand-primary); }

.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.table-row {
  transition: var(--transition);
  animation: fadeIn 0.35s ease backwards;
}

.table-row:hover { background: var(--bg-elevated); }

.table-rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 700;
}

.table-rank.gold { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.table-rank.silver { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
.table-rank.bronze { background: rgba(217, 119, 6, 0.15); color: #d97706; }
.table-rank.default { background: var(--bg-glass); color: var(--text-muted); }

.cell-name { font-weight: 500; color: var(--text-primary); }
.cell-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.cell-number { text-align: center; font-variant-numeric: tabular-nums; }
.cell-center { text-align: center; }
.cell-date { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }

.rate-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 600;
}

.rate-high { background: rgba(16, 185, 129, 0.12); color: #34d399; }
.rate-mid { background: rgba(245, 158, 11, 0.12); color: #fbbf24; }
.rate-low { background: rgba(100, 116, 139, 0.08); color: var(--text-muted); }

.empty-state {
  text-align: center;
  padding: 48px 16px !important;
  color: var(--text-muted);
  font-size: 14px;
}

/* ===== CLICKABLE ELEMENTS ===== */
.clickable-name {
  cursor: pointer;
  color: var(--brand-primary);
  transition: var(--transition);
}

.clickable-name:hover {
  color: #38bdf8;
  text-decoration: underline;
}

.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--bg-elevated) !important; }

/* ===== STATUS BADGES ===== */
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.status-converted { background: rgba(16, 185, 129, 0.12); color: #34d399; }
.status-vlida { background: rgba(37, 150, 190, 0.12); color: var(--brand-primary); }
.status-invlida { background: rgba(239, 68, 68, 0.12); color: #fca5a5; }
.status-descartada { background: rgba(100, 116, 139, 0.1); color: var(--text-muted); }
.status-pending { background: rgba(245, 158, 11, 0.12); color: #fbbf24; }

/* ===== SLIDE-OUT PANEL ===== */
.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(6px);
}

.panel-overlay.show { opacity: 1; }

.slide-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(560px, 92vw);
  height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-default);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.4);
}

.slide-panel.show { transform: translateX(0); }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
  background: var(--gradient-subtle);
}

.panel-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-close {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 15px;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.panel-close:hover {
  background: rgba(239, 68, 68, 0.08);
  color: var(--danger);
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.panel-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  gap: 16px;
  color: var(--text-muted);
}

.panel-empty {
  text-align: center;
  padding: 48px 0;
  color: var(--text-muted);
}

.panel-summary { margin-bottom: 18px; }

.panel-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-list-item {
  padding: 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.panel-list-item.clickable { cursor: pointer; }

.panel-list-item.clickable:hover {
  background: var(--bg-elevated);
  border-color: var(--border-active);
  transform: translateX(4px);
}

.panel-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}

.panel-item-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 14px;
}

.panel-item-details {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.panel-item-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* Detail Sections */
.detail-sections {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-section {
  padding: 18px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.detail-section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.detail-grid {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.detail-label {
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.detail-value {
  font-size: 14px;
  font-weight: 500;
  text-align: right;
  word-break: break-word;
}

.detail-empty {
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
}

/* ===== LOADING ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.5s ease;
}

.loading-overlay.hide {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border-default);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.loading-text {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 16px;
}

/* ===== SETTINGS VIEW ===== */
.settings-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  padding: 22px 26px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  animation: cardEnter 0.5s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.settings-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.settings-subtitle {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 4px;
}

.btn-add {
  width: auto;
  padding: 10px 22px;
  font-size: 14px;
  white-space: nowrap;
  box-shadow: var(--shadow-brand);
}

.btn-add:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow), var(--shadow-brand);
}

/* Action Buttons in Table */
.th-actions { width: 100px; text-align: center; }

.btn-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition);
  margin: 0 2px;
}

.btn-icon.btn-edit:hover {
  background: rgba(37, 150, 190, 0.1);
  border-color: var(--brand-primary);
}

.btn-icon.btn-delete:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(6px);
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: min(480px, 92vw);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  z-index: 301;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-container.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.modal-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-brand-h);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
}

.modal-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 17px;
  font-weight: 700;
}

.modal-body {
  padding: 0 24px 8px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
}

.btn-modal-save {
  width: auto;
  padding: 10px 28px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .dashboard-container { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr; }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .header-right {
    width: 100%;
    flex-wrap: wrap;
  }

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

  .funnel-bar { height: 46px; }
  .funnel-value { font-size: 16px; }
  .funnel-meta { display: none; }

  .filters-bar {
    flex-direction: column;
    gap: 10px;
  }

  .filter-group { min-width: 100%; }

  .filter-actions {
    flex-direction: row;
    width: 100%;
  }

  .filter-actions .btn { flex: 1; }

  .data-table { font-size: 13px; }
  .data-table th, .data-table td { padding: 10px 12px; }

  .nav-links {
    border-radius: var(--radius-md);
  }

  .settings-section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .btn-add { width: 100%; }

  .modal-container {
    width: 95vw;
  }
}
