:root {
  --bg: #0f172a;
  --bg2: #1e293b;
  --card: #ffffff;
  --txt: #0f172a;
  --muted: #64748b;
  --pri: #2563eb;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --line: #e2e8f0;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #f1f5f9;
  color: var(--txt);
}
.escondido { display: none !important; }

/* Login */
#login {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.login-card {
  background: var(--card); padding: 32px; border-radius: 14px; width: 340px;
  box-shadow: 0 10px 40px rgba(0,0,0,.3);
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card p { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
input, button { font: inherit; }
.campo { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 12px; }
.btn { background: var(--pri); color: #fff; border: 0; padding: 11px 16px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.btn:hover { filter: brightness(1.05); }
.btn.sec { background: #e2e8f0; color: var(--txt); }
.erro { color: var(--bad); font-size: 13px; min-height: 18px; }

/* Layout */
#app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
aside {
  background: var(--bg); color: #cbd5e1; padding: 18px 12px; display: flex; flex-direction: column;
}
aside .logo { color: #fff; font-weight: 700; font-size: 18px; padding: 8px 12px 18px; }
aside nav a {
  display: block; color: #cbd5e1; text-decoration: none; padding: 10px 12px;
  border-radius: 8px; margin-bottom: 4px; cursor: pointer; font-size: 14px;
}
aside nav a:hover { background: var(--bg2); color: #fff; }
aside nav a.ativo { background: var(--pri); color: #fff; }
aside .rodape { margin-top: auto; font-size: 12px; color: #64748b; padding: 12px; }
aside .rodape a { color: #94a3b8; cursor: pointer; }

main { padding: 24px 28px; overflow: auto; }
main h2 { margin: 0 0 18px; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px;
}
.card .rotulo { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.card .valor { font-size: 24px; font-weight: 700; margin-top: 6px; }
.card .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Tabelas */
.bloco { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 20px; }
.bloco h3 { margin: 0 0 12px; font-size: 15px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
tr:hover td { background: #f8fafc; }
.tag { padding: 2px 8px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.tag.ok { background: #dcfce7; color: var(--ok); }
.tag.warn { background: #fef3c7; color: var(--warn); }
.tag.bad { background: #fee2e2; color: var(--bad); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
canvas { max-height: 280px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 800px) { .grid2 { grid-template-columns: 1fr; } #app { grid-template-columns: 1fr; } }
.dica { color: var(--muted); font-size: 13px; }
#importResultado { white-space: pre-wrap; font-family: ui-monospace, monospace; font-size: 12px; margin-top: 14px; }

/* Logo na sidebar */
aside .logo { padding: 16px 12px 20px; }
aside .logo img { width: 100%; max-width: 160px; display: block; border-radius: 6px; }

/* Logo na tela de login */
.login-logo { text-align: center; margin-bottom: 20px; background: #0f172a; border-radius: 10px; padding: 16px; }
.login-logo img { width: 180px; display: block; margin: 0 auto; border-radius: 6px; }

/* Rodapé "Desenvolvido por" */
.desenvolvido {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #334155;
  font-size: 13px;
  color: #94a3b8;
  font-style: italic;
  font-weight: 500;
  line-height: 1.4;
}

/* ============================================================
   Fases 6-8 — Estilos adicionais
   ============================================================ */

/* Grupos de navegação */
.nav-grupo {
  display: block;
  padding: 14px 12px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #475569;
  font-weight: 600;
}

/* Tabs bar */
.tabs-bar { display:flex; gap:8px; margin-bottom:16px; }
.tab-btn { padding:8px 18px; border:none; border-radius:6px; background:#1e293b; color:#94a3b8; cursor:pointer; font-size:13px; font-weight:500; }
.tab-btn.ativo { background:#2563eb; color:#fff; }

/* Filtros bar */
.filtros-bar { display:flex; gap:8px; align-items:center; margin-bottom:12px; flex-wrap:wrap; }
.campo-sm { background:#1e293b; border:1px solid #334155; color:#f1f5f9; border-radius:6px; padding:6px 10px; font-size:13px; width:220px; }
.campo-sm:focus { outline:none; border-color:#2563eb; }

/* Modal overlay */
#modalOverlay { position:fixed; inset:0; background:rgba(0,0,0,.65); z-index:100; display:flex; align-items:center; justify-content:center; }
.modal { background:#1e293b; border:1px solid #334155; border-radius:12px; padding:24px; width:min(640px,90vw); max-height:85vh; overflow-y:auto; }
.modal h3 { margin:0 0 16px; font-size:17px; color:#f1f5f9; }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.form-grid label { display:flex; flex-direction:column; gap:4px; font-size:12px; color:#94a3b8; }
.form-check-row { display:flex; gap:16px; margin-top:10px; flex-wrap:wrap; }
.form-check-row label { display:flex; align-items:center; gap:6px; font-size:13px; color:#cbd5e1; cursor:pointer; }
.modal-acoes { display:flex; gap:8px; margin-top:16px; }
.bad-btn { background:#7f1d1d!important; color:#fca5a5!important; }
.ok-btn { background:#14532d!important; color:#86efac!important; }
.btn-mini { padding:2px 8px; font-size:12px; border:none; border-radius:4px; cursor:pointer; }

/* Pipeline cards resumo */
.pipeline-resumo { display:flex; gap:12px; margin-bottom:16px; }

/* Kanban board */
.kanban-board { display:flex; gap:10px; overflow-x:auto; padding-bottom:12px; }
.kanban-col { flex:0 0 200px; }
.kanban-header { background:#1e293b; border-radius:8px 8px 0 0; padding:10px 12px; display:flex; justify-content:space-between; align-items:center; font-size:13px; font-weight:600; }
.kanban-body { background:#0f172a; border-radius:0 0 8px 8px; padding:8px; min-height:80px; }
.kanban-card { background:#1e293b; border:1px solid #334155; border-radius:8px; padding:10px; margin-bottom:8px; cursor:pointer; transition:border-color .15s; }
.kanban-card:hover { border-color:#2563eb; }
.kanban-titulo { font-size:13px; font-weight:600; color:#f1f5f9; margin-bottom:4px; }
.kanban-sub { font-size:11px; color:#64748b; }
.kanban-valor { font-size:12px; color:#22c55e; margin-top:4px; font-weight:600; }
.kanban-rodape { font-size:11px; color:#475569; margin-top:4px; }
.tag-mini { display:inline-block; padding:1px 6px; border-radius:4px; font-size:10px; background:#1d4ed8; color:#bfdbfe; font-weight:600; }

/* Link pessoa */
a.link-pessoa { color:#60a5fa; text-decoration:none; }
a.link-pessoa:hover { text-decoration:underline; }

/* Status WhatsApp no sidebar */
.wa-status-sidebar {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  padding: 7px 10px;
  background: #0f172a;
  border-radius: 8px;
  border: 1px solid #1e293b;
  font-size: 12px;
  color: #94a3b8;
}
.wa-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #475569;
  flex-shrink: 0;
  transition: background .4s;
}
.wa-dot.verde    { background: #22c55e; box-shadow: 0 0 6px #22c55e88; }
.wa-dot.amarelo  { background: #f59e0b; }
.wa-dot.vermelho { background: #ef4444; }

/* Coleta de dados */
.coleta-campos { display:flex; flex-direction:column; gap:10px; }
.coleta-campos > div { display:flex; align-items:center; gap:12px; font-size:13px; }
.coleta-campos > div > span:first-child { width:160px; color:#94a3b8; flex-shrink:0; }
.barra-wrap { display:flex; align-items:center; gap:10px; flex:1; }
.barra-fill { height:8px; background:#2563eb; border-radius:4px; min-width:2px; transition:width .3s; }
.barra-wrap span { font-size:12px; color:#64748b; white-space:nowrap; }
