/* ─── DESIGN TOKENS ────────────────────────────────────────────────────────── */
:root {
  --bg: #0d0d1a;
  --bg2: #13132a;
  --bg3: #1a1a35;
  --border: #2a2a50;
  --accent: #e94560;
  --accent2: #7c3aed;
  --accent-glow: rgba(233,69,96,0.2);
  --text: #f0f0ff;
  --text2: #9090b0;
  --text3: #6060a0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.6);
  --sidebar-w: 240px;
  --transition: 0.2s ease;
}

/* ─── RESET ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.8; }
input, textarea, select, button { font-family: inherit; font-size: 0.95rem; }

/* ─── SIDEBAR ───────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  padding: 1.5rem 1rem;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.5rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}
.logo-icon { font-size: 1.6rem; }
.logo-text { font-size: 1.1rem; font-weight: 800; color: var(--text); }
.logo-badge {
  font-size: 0.6rem; font-weight: 700;
  background: var(--accent); color: white;
  padding: 2px 6px; border-radius: 20px;
}
.sidebar-menu { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.menu-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-weight: 500;
  transition: all var(--transition);
}
.menu-item:hover { background: var(--bg3); color: var(--text); opacity: 1; }
.menu-item.active { background: var(--accent-glow); color: var(--accent); font-weight: 600; }
.menu-icon { font-size: 1rem; width: 20px; text-align: center; }
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.user-info { display: flex; align-items: center; gap: 0.65rem; flex: 1; min-width: 0; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; flex-shrink: 0;
}
.user-details { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-weight: 600; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.7rem; color: var(--text3); }
.logout-btn {
  color: var(--text3); font-size: 1.1rem; flex-shrink: 0;
  padding: 4px; border-radius: 6px;
  transition: all var(--transition);
}
.logout-btn:hover { color: var(--danger); background: rgba(239,68,68,0.1); opacity: 1; }

/* ─── MAIN CONTENT ──────────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 2rem 2.5rem;
  min-height: 100vh;
  max-width: calc(100vw - var(--sidebar-w));
}
.main-content.full-width { margin-left: 0; max-width: 100vw; }

/* ─── PAGE HEADER ───────────────────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap; gap: 1rem;
}
.page-title { font-size: 1.75rem; font-weight: 800; color: var(--text); line-height: 1.2; }
.page-subtitle { color: var(--text2); margin-top: 0.25rem; font-size: 0.9rem; }
.breadcrumb { color: var(--text3); font-size: 0.85rem; display: block; margin-bottom: 0.25rem; }
.breadcrumb:hover { color: var(--accent); }

/* ─── BUTTONS ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.9rem;
  cursor: pointer; border: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #c73652);
  color: white;
  box-shadow: 0 4px 15px var(--accent-glow);
}
.btn-primary:hover { box-shadow: 0 6px 20px var(--accent-glow); opacity: 1; color: white; }
.btn-ghost {
  background: transparent; color: var(--text2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg3); color: var(--text); opacity: 1; }
.btn-success {
  background: linear-gradient(135deg, var(--success), #059669);
  color: white;
}
.btn-success:hover { opacity: 0.9; color: white; }
.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: white;
}
.btn-danger:hover { opacity: 0.9; color: white; }
.btn-danger-ghost { color: var(--danger); border-color: var(--danger); }
.btn-danger-ghost:hover { background: rgba(239,68,68,0.1); }
.bg-danger { background: var(--danger) !important; }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.82rem; }
.btn-lg { padding: 0.8rem 1.8rem; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }

/* ─── CARDS ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 1rem; font-weight: 700;
  margin-bottom: 1rem; color: var(--text);
}
.card-desc { color: var(--text2); font-size: 0.9rem; margin-bottom: 1.25rem; }
.card-header-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.card-header-row .card-title { margin-bottom: 0; }

/* ─── STATS ROW ─────────────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  transition: all var(--transition);
}
.stat-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.stat-card.stat-running { border-color: rgba(245,158,11,0.3); }
.stat-card.stat-success { border-color: rgba(16,185,129,0.3); }
.stat-card.stat-leads { border-color: rgba(124,58,237,0.3); }
.stat-icon { font-size: 1.8rem; }
.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: 0.75rem; color: var(--text2); margin-top: 0.2rem; }

/* ─── PROJETOS GRID ──────────────────────────────────────────────────────────── */
.projetos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}
.projeto-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: all 0.25s ease;
  display: flex; flex-direction: column; gap: 0.75rem;
}
.projeto-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.projeto-card-header { display: flex; align-items: center; justify-content: space-between; }
.projeto-nome { font-size: 1rem; font-weight: 700; color: var(--text); }
.projeto-desc { font-size: 0.82rem; color: var(--text2); }
.projeto-data { font-size: 0.75rem; color: var(--text3); }
.projeto-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.meta-item { font-size: 0.78rem; color: var(--text2); }
.projeto-actions {
  display: flex; gap: 0.5rem; margin-top: auto; padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* ─── STATUS BADGES ──────────────────────────────────────────────────────────── */
.projeto-status-badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.75rem; font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
}
.badge-lg { font-size: 0.9rem; padding: 0.4rem 1rem; }
.status-pendente { background: rgba(96,96,160,0.2); color: var(--text2); }
.status-na_fila { background: rgba(59,130,246,0.2); color: var(--info); }
.status-rodando {
  background: rgba(245,158,11,0.2); color: var(--warning);
  animation: pulse-badge 2s infinite;
}
.status-concluido { background: rgba(16,185,129,0.2); color: var(--success); }
.status-erro { background: rgba(239,68,68,0.2); color: var(--danger); }
.status-cancelado { background: rgba(96,96,96,0.2); color: var(--text3); }

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ─── PROGRESS BAR ───────────────────────────────────────────────────────────── */
.progress-container { display: flex; align-items: center; gap: 0.75rem; }
.progress-bar {
  flex: 1; height: 6px;
  background: var(--bg3);
  border-radius: 3px; overflow: hidden;
}
.progress-bar-lg { height: 12px; border-radius: 6px; }
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: inherit;
  transition: width 0.5s ease;
}
.progress-pct { font-size: 0.8rem; color: var(--text2); white-space: nowrap; }
.progress-note { font-size: 0.78rem; color: var(--text3); margin-top: 0.5rem; }

/* ─── FORMS ──────────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1.25rem; }
.form-group label { font-size: 0.85rem; font-weight: 600; color: var(--text2); }
.form-group small { font-size: 0.78rem; color: var(--text3); }
.form-group.flex-1 { flex: 1; }
.form-group.align-bottom { justify-content: flex-end; }
input[type="text"], input[type="email"], input[type="password"], textarea, select {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  width: 100%;
  transition: border-color var(--transition);
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--text3); }
textarea { resize: vertical; min-height: 80px; }

/* ─── AUTH ───────────────────────────────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh; width: 100%;
  display: flex; align-items: center; justify-content: center;
  gap: 4rem; padding: 2rem;
  background: radial-gradient(ellipse at top left, rgba(233,69,96,0.1) 0%, transparent 60%),
              radial-gradient(ellipse at bottom right, rgba(124,58,237,0.1) 0%, transparent 60%),
              var(--bg);
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
}
.auth-header { text-align: center; margin-bottom: 2rem; }
.auth-logo { font-size: 2.5rem; margin-bottom: 0.5rem; }
.auth-title { font-size: 1.5rem; font-weight: 800; }
.auth-subtitle { color: var(--text2); font-size: 0.88rem; margin-top: 0.25rem; }
.auth-form { display: flex; flex-direction: column; }
.auth-switch { text-align: center; color: var(--text2); font-size: 0.88rem; margin-top: 1.25rem; }
.auth-decoration { display: flex; flex-direction: column; gap: 1rem; }
.deco-card {
  display: flex; align-items: center; gap: 1rem;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  animation: float 3s ease-in-out infinite;
  width: 220px;
}
.deco-1 { animation-delay: 0s; }
.deco-2 { animation-delay: 0.7s; }
.deco-3 { animation-delay: 1.4s; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.deco-icon { font-size: 1.6rem; }
.deco-text { display: flex; flex-direction: column; }
.deco-text strong { font-weight: 700; font-size: 0.95rem; }
.deco-text span { font-size: 0.78rem; color: var(--text2); }
@media (max-width: 768px) { .auth-decoration { display: none; } }

/* ─── FLASH MESSAGES ─────────────────────────────────────────────────────────── */
.flash-container { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.5rem; }
.flash {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem; border-radius: var(--radius-sm);
  font-size: 0.88rem; font-weight: 500;
  animation: slideIn 0.3s ease;
}
@keyframes slideIn { from { opacity:0; transform: translateY(-8px); } to { opacity:1; transform:none; } }
.flash button { background: none; border: none; cursor: pointer; color: inherit; opacity: 0.7; font-size: 1rem; }
.flash-success { background: rgba(16,185,129,0.15); color: var(--success); border: 1px solid rgba(16,185,129,0.3); }
.flash-danger { background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.flash-warning { background: rgba(245,158,11,0.15); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }
.flash-info { background: rgba(59,130,246,0.15); color: var(--info); border: 1px solid rgba(59,130,246,0.3); }

/* ─── WIZARD ─────────────────────────────────────────────────────────────────── */
.wizard-container { max-width: 740px; }
.wizard-steps {
  display: flex; align-items: center;
  margin-bottom: 2rem; gap: 0;
}
.step {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.82rem; color: var(--text3); font-weight: 500;
  flex-shrink: 0;
}
.step.active .step-num, .step.done .step-num {
  background: var(--accent); color: white; border-color: var(--accent);
}
.step.active { color: var(--text); }
.step-num {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 700;
  transition: all var(--transition);
}
.step-line { flex: 1; height: 1px; background: var(--border); min-width: 20px; }
.wizard-step { animation: fadeIn 0.25s ease; }
.wizard-step.hidden { display: none; }
@keyframes fadeIn { from { opacity:0; transform: translateX(10px); } to { opacity:1; transform:none; } }
.step-actions {
  display: flex; gap: 0.75rem; margin-top: 1.5rem;
  padding-top: 1.25rem; border-top: 1px solid var(--border);
}
.cidade-add-row { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; }

/* ─── TAGS ───────────────────────────────────────────────────────────────────── */
.tags-container { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tags-container.mini .tag { font-size: 0.78rem; padding: 0.2rem 0.6rem; }
.tag {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 20px; padding: 0.3rem 0.75rem;
  font-size: 0.82rem; color: var(--text);
}
.tag button {
  background: none; border: none; cursor: pointer;
  color: var(--text3); font-size: 0.75rem; padding: 0;
  transition: color var(--transition);
}
.tag button:hover { color: var(--danger); }
.ramo-tag { border-color: rgba(124,58,237,0.4); }
.tag-mini {
  display: inline-block; font-size: 0.75rem;
  background: var(--bg3); border-radius: 4px;
  padding: 0.1rem 0.4rem; color: var(--text2);
}
.tag-pending {
  border: 1px dashed var(--warning);
  color: var(--warning);
  background: rgba(245,158,11,0.05);
}
.tag-pending small {
  margin-left: 4px; font-size: 0.65rem; opacity: 0.7; font-weight: normal;
}
.empty-tags-msg { font-size: 0.82rem; color: var(--text3); margin-top: 0.5rem; }

/* ─── RAMOS CHIPS ────────────────────────────────────────────────────────────── */
.ramos-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
.ramo-chip { cursor: pointer; }
.ramo-chip input { display: none; }
.ramo-chip span {
  display: inline-block;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 20px; padding: 0.35rem 0.9rem;
  font-size: 0.82rem; color: var(--text2);
  transition: all var(--transition); user-select: none;
}
.ramo-chip input:checked + span {
  background: var(--accent-glow); border-color: var(--accent);
  color: var(--accent); font-weight: 600;
}
.ramo-chip:hover span { border-color: var(--accent); color: var(--text); }
.ramos-grid-mini { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip-sm span { padding: 0.2rem 0.6rem; font-size: 0.78rem; border-radius: 15px; }

/* ─── REVIEW ─────────────────────────────────────────────────────────────────── */
.review-block {
  background: var(--bg3); border-radius: var(--radius-sm);
  padding: 1rem; margin-bottom: 0.75rem;
}
.review-block h3 { font-size: 0.82rem; color: var(--text2); margin-bottom: 0.5rem; font-weight: 600; }
.review-warning {
  display: flex; gap: 0.75rem; align-items: flex-start;
  background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3);
  border-radius: var(--radius-sm); padding: 0.85rem;
  font-size: 0.82rem; color: var(--warning); margin-bottom: 0.75rem;
}

/* ─── ACTION BAR ─────────────────────────────────────────────────────────────── */
.action-bar {
  display: flex; flex-wrap: wrap; gap: 0.75rem;
  margin-bottom: 2rem; padding: 1rem;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ─── DETAIL GRID ────────────────────────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

/* ─── TABLE ──────────────────────────────────────────────────────────────────── */
.table-container { overflow-x: auto; }
.data-table {
  width: 100%; border-collapse: collapse; font-size: 0.86rem;
}
.data-table th {
  text-align: left; padding: 0.65rem 0.9rem;
  color: var(--text2); font-weight: 600; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid rgba(42,42,80,0.5);
  color: var(--text);
}
.data-table tr:hover td { background: var(--bg3); }
.data-table .row-inactive td { opacity: 0.4; }
.table-note { font-size: 0.78rem; color: var(--text3); margin-top: 0.75rem; }
.nota-badge { color: var(--warning); font-weight: 600; }
.link-subtle { color: var(--text); font-weight: 500; }
.link-subtle:hover { color: var(--accent); }

/* ─── EMPTY STATE ────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 4rem 2rem;
  max-width: 420px; margin: 0 auto;
}
.empty-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.empty-state h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.5rem; }
.empty-state p { color: var(--text2); margin-bottom: 1.5rem; font-size: 0.9rem; }

/* ─── MISC ───────────────────────────────────────────────────────────────────── */
.text-muted { color: var(--text2) !important; font-size: 0.8rem; }
.hidden { display: none !important; }
.header-actions { display: flex; align-items: center; gap: 0.75rem; }

/* Search Detail Table Styles */
.search-row { transition: all 0.2s ease; }
.search-row:hover { background: rgba(233, 69, 96, 0.05); }
.status-pill { display: inline-flex; align-items: center; padding: 0.25rem 0.75rem; border-radius: 2rem; font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.pill-pendente { background: rgba(100, 116, 139, 0.1); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.2); }
.pill-rodando { background: rgba(59, 130, 246, 0.1); color: #60a5fa; border: 1px solid rgba(96, 165, 250, 0.3); animation: pulse 2s infinite; }
.pill-concluido { background: rgba(34, 197, 94, 0.1); color: #4ade80; border: 1px solid rgba(74, 222, 128, 0.3); }
.pill-erro { background: rgba(239, 68, 68, 0.1); color: #f87171; border: 1px solid rgba(248, 113, 113, 0.3); }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.7; } 100% { opacity: 1; } }
.lead-count-badge { display: inline-block; padding: 0.1rem 0.6rem; background: #1a1a2e; border: 1px solid rgba(255,255,255,0.1); border-radius: 0.5rem; font-family: monospace; font-weight: bold; color: #94a3b8; }
.lead-count-badge.has-leads { color: #f1c40f; border-color: rgba(241, 196, 15, 0.4); background: rgba(241, 196, 15, 0.05); }
.tag-segmento { background: rgba(233, 69, 96, 0.1); color: #e94560; border: 1px solid rgba(233, 69, 96, 0.2); }
.cell-with-icon { display: flex; align-items: center; gap: 0.5rem; }
.cell-icon { font-size: 1.1rem; filter: drop-shadow(0 0 5px rgba(255,255,255,0.2)); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-sm { font-size: 0.85rem; }
