/* Agente de Prospecção JCA — tema tech escuro, azul/ciano */
:root {
  --bg: #0d1220;
  --bg2: #131a2e;
  --panel: #1a2340;
  --panel2: #212c50;
  --border: #2c3a66;
  --text: #e8ecf7;
  --muted: #94a0c2;
  --accent: #2f7df6;
  --accent2: #38c6f4;
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #f87171;
  --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 250px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
}
.brand { text-align: center; padding: 18px 16px 14px; border-bottom: 1px solid var(--border); }
.brand-logo-img { width: 170px; max-width: 100%; display: block; margin: 0 auto 8px; }
.brand-text strong { display: block; font-size: 13px; }
.brand-text span { font-size: 11px; color: var(--muted); }
nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-btn {
  background: none; border: none; color: var(--muted);
  text-align: left; padding: 10px 12px; border-radius: 8px;
  font-size: 14px; cursor: pointer; transition: 0.15s;
}
.nav-btn:hover { background: var(--panel); color: var(--text); }
.nav-btn.active { background: var(--panel2); color: var(--text); font-weight: 600; }
.sidebar-foot { padding: 14px; border-top: 1px solid var(--border); }
.limite-box { background: var(--panel); border-radius: var(--radius); padding: 12px; }
.limite-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.limite-num { font-size: 20px; font-weight: 700; margin: 4px 0 8px; }
.limite-bar { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.limite-bar > div { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width 0.3s; }

/* ---------- Main ---------- */
.main { margin-left: 250px; flex: 1; padding: 28px 32px 60px; max-width: 1200px; }
.view { display: none; }
.view.active { display: block; }
.view-head { margin-bottom: 22px; }
.view-head h1 { font-size: 26px; }
.view-head p { color: var(--muted); margin-top: 4px; font-size: 14px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}
.panel h2 { font-size: 16px; margin-bottom: 12px; }
.hint { font-size: 13px; color: var(--muted); margin-bottom: 12px; line-height: 1.5; }
.hint code, .view-head code { background: var(--bg); padding: 1px 6px; border-radius: 4px; font-size: 12px; color: var(--accent2); }

/* ---------- Forms ---------- */
input, select, textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; margin-bottom: 10px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.form-row input, .form-row select { width: auto; flex: 1; min-width: 140px; }
.form-row .btn { flex-shrink: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 12px; }

.btn {
  border: none; border-radius: 8px; padding: 10px 18px;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: 0.15s;
  font-family: inherit;
}
.btn.primary { background: linear-gradient(135deg, var(--accent), #245fd1); color: #fff; }
.btn.primary:hover { filter: brightness(1.15); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.ghost:hover { border-color: var(--accent); }
.btn.mini { padding: 5px 10px; font-size: 12px; }
.btn.wa { background: #1faa53; color: #fff; }
.btn.wa:hover { filter: brightness(1.1); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- Dashboard ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat-card .num { font-size: 30px; font-weight: 800; }
.stat-card .lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }
.funil-resumo { display: flex; gap: 8px; flex-wrap: wrap; }
.funil-etapa { flex: 1; min-width: 110px; background: var(--bg); border-radius: 8px; padding: 12px; text-align: center; border-top: 3px solid var(--accent); }
.funil-etapa .n { font-size: 22px; font-weight: 700; }
.funil-etapa .t { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.atividades { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 8px; }
.atividades .ato { padding: 8px 12px; background: var(--bg); border-radius: 8px; }
.atividades .ato b { color: var(--text); }

/* ---------- Tabela ---------- */
.tabela-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; padding: 10px 12px; border-bottom: 1px solid var(--border); }
td { padding: 12px; border-bottom: 1px solid var(--border); }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--panel2); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.novo { background: #2c3a66; color: #b8c6ec; }
.badge.fila { background: #4a3d12; color: var(--yellow); }
.badge.contatado { background: #123c5e; color: var(--accent2); }
.badge.respondeu { background: #143d2e; color: var(--green); }
.badge.reuniao { background: #3d1d4d; color: #d8a5f5; }
.badge.cliente { background: #0f4430; color: #4ade80; }
.badge.perdido { background: #4d1d1d; color: var(--red); }

/* ---------- Abordagem ---------- */
.abordagem-topo { display: flex; justify-content: space-between; align-items: center; }
.card-abordagem {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
}
.card-abordagem.feito { opacity: 0.5; }
.ca-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; flex-wrap: wrap; gap: 8px; }
.ca-head h3 { font-size: 16px; }
.ca-head .meta { font-size: 12px; color: var(--muted); }
.ca-msg {
  background: var(--bg); border-radius: 8px; padding: 12px;
  font-size: 14px; line-height: 1.55; white-space: pre-wrap;
  margin-bottom: 12px; border-left: 3px solid var(--accent);
}
.ca-acoes { display: flex; gap: 8px; flex-wrap: wrap; }

.secao-followup { font-size: 17px; margin: 26px 0 14px; }
.qtd-followup { font-size: 12px; font-weight: 400; color: var(--yellow); background: #4a3d12; padding: 3px 10px; border-radius: 20px; margin-left: 8px; vertical-align: middle; }

/* ---------- Kanban ---------- */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; }
.kanban-col { min-width: 210px; flex: 1; background: var(--bg2); border-radius: var(--radius); border: 1px solid var(--border); }
.kanban-col-head { padding: 12px 14px; font-size: 13px; font-weight: 700; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; }
.kanban-col-head .qtd { color: var(--muted); font-weight: 400; }
.kanban-cards { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; max-height: 65vh; overflow-y: auto; }
.kanban-card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 13px; cursor: pointer; }
.kanban-card:hover { border-color: var(--accent); }
.kanban-card .kc-nome { font-weight: 600; margin-bottom: 3px; }
.kanban-card .kc-meta { font-size: 11px; color: var(--muted); }
.kanban-card .kc-mover { display: flex; justify-content: space-between; margin-top: 8px; }
.kc-mover button { background: var(--bg); border: 1px solid var(--border); color: var(--muted); border-radius: 6px; cursor: pointer; padding: 2px 10px; font-size: 13px; }
.kc-mover button:hover { color: var(--text); border-color: var(--accent); }

/* ---------- Templates ---------- */
.template-card { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 14px; margin-bottom: 10px; }
.template-card .tc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; flex-wrap: wrap; gap: 6px; }
.template-card .tc-head b { font-size: 14px; }
.template-card .tc-texto { font-size: 13px; color: var(--muted); white-space: pre-wrap; line-height: 1.5; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 4px; background: var(--panel2); color: var(--accent2); margin-left: 6px; }

/* ---------- Config ---------- */
.cfg-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chip { background: var(--bg); border: 1px solid var(--border); border-radius: 20px; padding: 5px 12px; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.chip button { background: none; border: none; color: var(--red); cursor: pointer; font-size: 13px; }
.salvo-msg { color: var(--green); font-size: 13px; margin-left: 12px; }
.danger-zone .btn { margin-right: 8px; }

/* ---------- Modal ---------- */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(5, 8, 18, 0.75); z-index: 50;
  align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; width: 100%; max-width: 620px; }
.modal h2 { margin-bottom: 16px; }
.modal .form-grid { margin-bottom: 14px; }
.modal-acoes { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.historico { margin-top: 14px; font-size: 13px; color: var(--muted); }
.historico .h-item { padding: 6px 10px; background: var(--bg); border-radius: 6px; margin-bottom: 6px; }

/* ---------- Rodapé ---------- */
.rodape {
  margin-top: 40px;
  padding: 18px 0 0;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.9;
}
.rodape strong { color: var(--text); }
.rodape a { color: var(--accent2); text-decoration: none; }
.rodape a:hover { text-decoration: underline; }

/* ---------- Login ---------- */
.auth-overlay {
  display: none; position: fixed; inset: 0;
  background: var(--bg); z-index: 300;
  align-items: center; justify-content: center; padding: 20px;
}
.auth-overlay.open { display: flex; }
.auth-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 34px 30px;
  width: 100%; max-width: 400px; text-align: center;
  display: flex; flex-direction: column; gap: 12px;
}
.auth-logo { width: 220px; max-width: 80%; margin: 0 auto 6px; }
.auth-card h2 { font-size: 20px; }
.auth-card .hint { margin-bottom: 0; text-align: left; }
.auth-erro { color: var(--red); font-size: 13px; min-height: 18px; }
.btn-sair { width: 100%; margin-top: 10px; font-size: 13px; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--panel2); border: 1px solid var(--accent);
  color: var(--text); padding: 12px 22px; border-radius: 10px;
  font-size: 14px; opacity: 0; transition: 0.3s; z-index: 100; pointer-events: none;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Resultados Places ---------- */
.res-place { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--bg); border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; font-size: 13px; flex-wrap: wrap; }
.res-place .rp-info b { display: block; font-size: 14px; }
.res-place .rp-info span { color: var(--muted); }

@media (max-width: 900px) {
  .sidebar { width: 64px; }
  .brand { padding: 12px 8px; }
  .brand-logo-img { width: 48px; margin-bottom: 0; }
  .brand-text, .nav-btn span { display: none; }
  .nav-btn { font-size: 18px; text-align: center; padding: 10px 4px; }
  .sidebar-foot { display: none; }
  .main { margin-left: 64px; padding: 20px 14px 60px; }
}
