@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #000000;
  --panel: #0d0d0d;
  --panel-2: #141414;
  --surface: #1a1a1a;
  --text: #ffffff;
  --muted: #8a8f98;
  --primary: #1a76d2;
  --primary-light: #4da3ff;
  --success: #00c853;
  --warning: #f5a623;
  --danger: #ff3b30;
  --border: #222222;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

#particles-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.app {
  position: relative;
  z-index: 1;
}

h1, h2, h3, h4, h5, h6, .brand, .topbar h1, .stat-value, .funnel-stage, .panel-header h2 {
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

a {
  color: inherit;
  text-decoration: none;
}

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: rgba(13, 13, 13, .85);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
}

.brand {
  padding: 28px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.brand img {
  height: 40px;
  width: auto;
}

.brand span {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.nav {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-link {
  padding: 14px 18px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: .95rem;
  font-weight: 500;
  transition: .2s;
}

.nav-link .icon {
  font-size: 1.1rem;
}

.nav-link:hover,
.nav-link.active {
  background: var(--surface);
  color: var(--text);
}

.user-box {
  padding: 20px;
  border-top: 1px solid var(--border);
}

.user-name {
  font-weight: 600;
  font-size: .95rem;
}

.user-role {
  color: var(--muted);
  font-size: .8rem;
  text-transform: capitalize;
  margin-bottom: 12px;
}

.main {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  padding: 24px 40px;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 13, 13, .7);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
}

.content {
  padding: 40px;
  flex: 1;
  background: radial-gradient(circle at 80% 0%, rgba(26, 118, 210, .05) 0%, transparent 40%);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  border-left: 3px solid var(--primary);
  transition: .2s;
}

.stat-card:hover {
  border-color: var(--primary-light);
}

.stat-secondary { border-left-color: #7c4dff; }
.stat-warning { border-left-color: var(--warning); }
.stat-success { border-left-color: var(--success); }

.stat-label {
  color: var(--muted);
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 500;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  margin-top: 8px;
}

.panel {
  background: rgba(13, 13, 13, .7);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
}

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

.panel-header h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  color: var(--muted);
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.table tr:last-child td {
  border-bottom: none;
}

.actions {
  display: flex;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: .2s;
  font-family: 'Rajdhani', sans-serif;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.btn:hover {
  border-color: var(--primary-light);
  background: rgba(26, 118, 210, .1);
}

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

.btn-primary:hover {
  background: var(--primary-light);
  border-color: var(--primary-light);
  color: var(--text);
}

.btn-danger {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-danger:hover {
  background: rgba(255, 59, 48, .1);
}

.btn-sm {
  padding: 7px 12px;
  font-size: .78rem;
}

.btn-block {
  width: 100%;
}

.badge {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
  background: var(--surface);
}

.badge-new { background: rgba(138, 143, 152, .15); color: var(--muted); }
.badge-contacted { background: rgba(26, 118, 210, .15); color: var(--primary-light); }
.badge-qualified { background: rgba(124, 77, 255, .15); color: #a78bfa; }
.badge-visit_scheduled { background: rgba(245, 166, 35, .15); color: var(--warning); }
.badge-installed { background: rgba(0, 200, 83, .15); color: var(--success); }
.badge-activated { background: rgba(0, 200, 83, .15); color: var(--success); }
.badge-lost { background: rgba(255, 59, 48, .15); color: var(--danger); }

.badge-priority-low { background: rgba(138, 143, 152, .15); color: var(--muted); }
.badge-priority-medium { background: rgba(245, 166, 35, .15); color: var(--warning); }
.badge-priority-high { background: rgba(255, 59, 48, .15); color: var(--danger); }

.filters {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filters input,
.filters select {
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: .9rem;
  min-width: 240px;
  outline: none;
}

.filters input:focus,
.filters select:focus {
  border-color: var(--primary-light);
}

.form-panel {
  max-width: 900px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group-full {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: .85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: .95rem;
  outline: none;
  transition: .2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary-light);
}

.error {
  color: var(--danger);
  font-size: .8rem;
}

.form-actions {
  margin-top: 28px;
  display: flex;
  gap: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.notes-box {
  background: var(--panel-2);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border);
}

.notes-box h3 {
  margin-top: 0;
  font-size: 1rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

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

.two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.funnel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 24px 0;
}

.funnel-step {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px;
  color: #fff;
  font-family: 'Rajdhani', sans-serif;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
  font-size: .95rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 4px 20px rgba(26, 118, 210, .15);
  transition: .25s;
}

.funnel-step:nth-child(1) { width: 94%; background: linear-gradient(90deg, #1a76d2, #4da3ff); }
.funnel-step:nth-child(2) { width: 86%; background: linear-gradient(90deg, #1768b7, #4da3ff); }
.funnel-step:nth-child(3) { width: 78%; background: linear-gradient(90deg, #155a9c, #45a0ff); }
.funnel-step:nth-child(4) { width: 70%; background: linear-gradient(90deg, #124c82, #3f9dff); }
.funnel-step:nth-child(5) { width: 62%; background: linear-gradient(90deg, #0f3f68, #3a9aff); }
.funnel-step:nth-child(6) { width: 54%; background: linear-gradient(90deg, #0c324e, #3597ff); }
.funnel-step:nth-child(7) { width: 46%; background: linear-gradient(90deg, #092534, #2f94ff); }

.funnel-step:hover {
  filter: brightness(1.15);
  transform: translateX(4px);
  z-index: 2;
}

.funnel-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.funnel-stage {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.funnel-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  background: rgba(255,255,255,.9);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255,255,255,.6);
}

.funnel-count {
  font-size: 1.1rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 12px;
}

.funnel-percent {
  font-size: .75rem;
  opacity: .85;
  font-weight: 500;
}

.funnel-legend {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 24px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: .85rem;
}

.funnel-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.funnel-legend i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
}

/* Login */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 0%, rgba(26, 118, 210, .15) 0%, transparent 50%), var(--bg);
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-card .brand {
  padding: 0;
  border: none;
  justify-content: center;
  margin-bottom: 20px;
}

.login-card .brand img {
  height: 60px;
}

.login-card h2 {
  margin-top: 0;
  margin-bottom: 28px;
  font-size: 1.5rem;
}

.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: .9rem;
}

.alert-danger {
  background: rgba(255, 59, 48, .1);
  color: var(--danger);
  border: 1px solid rgba(255, 59, 48, .2);
}

.captcha-box {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  display: inline-flex;
  justify-content: center;
  cursor: pointer;
  margin-bottom: 8px;
}

.captcha-box img {
  height: 50px;
  width: 180px;
}

.input-with-btn {
  display: flex;
  gap: 8px;
}

.input-with-btn input {
  flex: 1;
}

.input-with-btn .btn {
  white-space: nowrap;
}

.consulta-resultado pre {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  margin-right: 16px;
}

.menu-toggle span {
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  z-index: 99;
  opacity: 0;
  transition: opacity .3s;
}

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

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrap .table {
  min-width: 700px;
}

@media (max-width: 992px) {
  .content { padding: 24px; }
  .topbar { padding: 18px 24px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .two-columns { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .menu-toggle { display: flex; }

  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    width: 260px;
    z-index: 110;
    border-right: 1px solid var(--border);
    transition: left .3s;
  }

  .sidebar.open {
    left: 0;
  }

  .main {
    margin-left: 0;
  }

  .topbar {
    padding: 16px 20px;
    justify-content: flex-start;
    gap: 12px;
  }

  .topbar h1 {
    font-size: 1.25rem;
  }

  .content {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-value {
    font-size: 2rem;
  }

  .panel {
    padding: 20px;
  }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
  }

  .panel-header .actions {
    width: 100%;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .two-columns {
    grid-template-columns: 1fr;
  }

  .filters {
    flex-direction: column;
  }

  .filters input,
  .filters select {
    min-width: 0;
    width: 100%;
  }

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

  .form-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .funnel-step {
    padding: 14px 16px;
    font-size: .82rem;
  }

  .funnel-step:nth-child(1) { width: 98%; }
  .funnel-step:nth-child(2) { width: 92%; }
  .funnel-step:nth-child(3) { width: 86%; }
  .funnel-step:nth-child(4) { width: 80%; }
  .funnel-step:nth-child(5) { width: 74%; }
  .funnel-step:nth-child(6) { width: 68%; }
  .funnel-step:nth-child(7) { width: 62%; }

  .funnel-content {
    width: 100%;
    padding: 0;
  }

  .funnel-count {
    font-size: .95rem;
  }

  .funnel-stage {
    gap: 6px;
  }

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

  .login-card h2 {
    font-size: 1.25rem;
  }

  .input-with-btn {
    flex-direction: column;
  }

  .input-with-btn .btn {
    width: 100%;
  }

  .actions {
    flex-wrap: wrap;
  }

  .actions .btn-sm {
    padding: 8px 10px;
    font-size: .72rem;
  }

  .table-wrap .table {
    min-width: 900px;
  }

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