/* ============================================================
   FAVA × Davi Mariano — Painel de Leads (CRM Corretores)
   Visual no padrão FAVA (roxo) — estilo SaaS limpo
   ============================================================ */

:root {
  --roxo: #7b3ff2;
  --roxo-2: #a87bff;
  --roxo-dark: #6b2ed6;
  --bg: #f5f4fa;
  --card: #ffffff;
  --linha: #ececf3;
  --texto: #1a1726;
  --texto-2: #6b6680;
  --texto-3: #9893a8;
  --verde: #1f9d63;
  --verde-bg: #e7f7ee;
  --amarelo: #d9920a;
  --amarelo-bg: #fbf2dd;
  --vermelho: #e0455b;
  --vermelho-bg: #fce8eb;
  --azul: #2f7ad9;
  --azul-bg: #e6f0fc;
  --sombra: 0 1px 3px rgba(26,23,38,.06), 0 4px 16px rgba(26,23,38,.04);
  --sombra-hover: 0 4px 20px rgba(123,63,242,.16);
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--bg);
  color: var(--texto);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 24px;
  background: linear-gradient(100deg, #1a1430 0%, #2a1d52 55%, var(--roxo-dark) 100%);
  color: #fff;
  position: sticky; top: 0; z-index: 50;
}
.topbar .logo {
  font-weight: 800; font-size: 17px; letter-spacing: -.3px;
  display: flex; align-items: center; gap: 10px;
}
.topbar .logo .marca {
  background: rgba(255,255,255,.14); padding: 4px 10px; border-radius: 8px;
  font-size: 13px;
}
.topbar .sub { color: rgba(255,255,255,.6); font-size: 12.5px; font-weight: 500; }
.topbar .spacer { flex: 1; }
.topbar .estado {
  font-size: 12px; display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.1); padding: 6px 12px; border-radius: 20px;
  cursor: pointer; transition: background .15s;
}
.topbar .estado:hover { background: rgba(255,255,255,.18); }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.on { background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.25); }
.dot.off { background: #fbbf24; }
.link-radar { color: #fff; text-decoration: none; background: rgba(255,255,255,.12); padding: 7px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; margin-right: 10px; transition: background .15s; }
.link-radar:hover { background: rgba(255,255,255,.22); }

/* ---------- Stats ---------- */
.stats {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px;
  padding: 20px 24px 4px;
}
.stat {
  background: var(--card); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--sombra); position: relative; overflow: hidden;
}
.stat .n { font-size: 26px; font-weight: 800; letter-spacing: -1px; }
.stat .l { color: var(--texto-2); font-size: 12.5px; margin-top: 2px; font-weight: 500; }
.stat .ico { position: absolute; top: 14px; right: 16px; font-size: 18px; opacity: .9; }
.stat.alerta { border: 1.5px solid var(--vermelho); }
.stat.alerta .n { color: var(--vermelho); }
.stat.ok .n { color: var(--verde); }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 18px 24px 8px;
}
.tabs { display: flex; gap: 4px; background: #eceaf3; padding: 4px; border-radius: 10px; }
.tab {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 7px;
  font-size: 13px; font-weight: 600; color: var(--texto-2); cursor: pointer;
  transition: all .15s;
}
.tab.active { background: #fff; color: var(--roxo); box-shadow: var(--sombra); }
.toolbar .spacer { flex: 1; }
.busca {
  display: flex; align-items: center; gap: 8px; background: #fff;
  border: 1px solid var(--linha); border-radius: 10px; padding: 8px 12px; min-width: 220px;
}
.busca input { border: 0; outline: 0; font-size: 13px; width: 100%; background: transparent; color: var(--texto); }
select.filtro {
  border: 1px solid var(--linha); background: #fff; border-radius: 10px;
  padding: 8px 12px; font-size: 13px; color: var(--texto); cursor: pointer; font-weight: 500;
}
.btn {
  border: 0; border-radius: 10px; padding: 9px 16px; font-size: 13px; font-weight: 700;
  cursor: pointer; transition: all .15s; display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary { background: var(--roxo); color: #fff; }
.btn-primary:hover { background: var(--roxo-dark); box-shadow: var(--sombra-hover); }
.btn-ghost { background: #fff; border: 1px solid var(--linha); color: var(--texto); }
.btn-ghost:hover { border-color: var(--roxo-2); color: var(--roxo); }

/* ---------- Kanban ---------- */
.board { display: flex; gap: 14px; padding: 12px 24px 32px; overflow-x: auto; align-items: flex-start; }
.coluna {
  flex: 0 0 282px; background: #ecebf2; border-radius: var(--radius); padding: 10px;
  min-height: 120px;
}
.coluna.drag-over { background: #e0d6fb; outline: 2px dashed var(--roxo-2); }
.coluna-head {
  display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; font-weight: 700; font-size: 13px;
}
.coluna-head .badge-cont {
  margin-left: auto; background: #fff; color: var(--texto-2); border-radius: 20px;
  padding: 1px 9px; font-size: 12px; font-weight: 700;
}
.coluna .faixa { width: 9px; height: 9px; border-radius: 50%; }

/* cores das etapas */
.c-novo .faixa { background: var(--azul); }
.c-atendendo .faixa { background: var(--roxo); }
.c-visita .faixa { background: #d9920a; }
.c-proposta .faixa { background: #b45ad9; }
.c-fechado .faixa { background: var(--verde); }
.c-perdido .faixa { background: var(--texto-3); }

/* ---------- Card de lead ---------- */
.lead {
  background: var(--card); border-radius: 11px; padding: 12px; margin-bottom: 9px;
  box-shadow: var(--sombra); cursor: grab; border-left: 3px solid transparent; transition: box-shadow .15s, transform .05s;
}
.lead:hover { box-shadow: var(--sombra-hover); }
.lead:active { cursor: grabbing; }
.lead.dragging { opacity: .4; }
.lead.parado { border-left-color: var(--vermelho); }
.lead .nome { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.lead .linha2 { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.tag {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px;
}
.tag.meta { background: var(--azul-bg); color: var(--azul); }
.tag.whats { background: var(--verde-bg); color: var(--verde); }
.tag.google { background: var(--amarelo-bg); color: var(--amarelo); }
.tag.indicacao { background: #efe7fb; color: var(--roxo); }
.tag.manual { background: #eee; color: var(--texto-2); }
.lead .meta-row {
  display: flex; align-items: center; justify-content: space-between; margin-top: 9px;
  font-size: 11.5px; color: var(--texto-3);
}
.avatar {
  width: 22px; height: 22px; border-radius: 50%; background: var(--roxo);
  color: #fff; font-size: 10px; font-weight: 700; display: inline-flex;
  align-items: center; justify-content: center;
}
.tempo.parado-txt { color: var(--vermelho); font-weight: 700; }
.lead .acoes-mini { display: flex; gap: 6px; margin-top: 9px; }
.zap {
  flex: 1; text-align: center; text-decoration: none; background: var(--verde-bg);
  color: var(--verde); font-weight: 700; font-size: 11.5px; padding: 5px; border-radius: 7px;
}
.zap:hover { background: #d4f0e0; }

/* ---------- Tabela (lista) ---------- */
.tabela-wrap { padding: 4px 24px 32px; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--sombra); }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--texto-3); padding: 12px 14px; border-bottom: 1px solid var(--linha); }
td { padding: 12px 14px; border-bottom: 1px solid var(--linha); font-size: 13px; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #faf9fe; }
.pill { font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 20px; display: inline-block; }
.pill.novo { background: var(--azul-bg); color: var(--azul); }
.pill.atendendo { background: #efe7fb; color: var(--roxo); }
.pill.visita { background: var(--amarelo-bg); color: var(--amarelo); }
.pill.proposta { background: #f6e7fb; color: #a13bc7; }
.pill.fechado { background: var(--verde-bg); color: var(--verde); }
.pill.perdido { background: #eee; color: var(--texto-2); }

/* ---------- Ranking ---------- */
.ranking-wrap { padding: 4px 24px 32px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 14px; }
.rank-card { background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: var(--sombra); }
.rank-card .topo { display: flex; align-items: center; gap: 12px; }
.rank-card .av-big { width: 42px; height: 42px; border-radius: 50%; background: var(--roxo); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.rank-card .nome { font-weight: 700; font-size: 15px; }
.rank-card .num { display: flex; gap: 18px; margin-top: 14px; }
.rank-card .num div span { display: block; font-size: 20px; font-weight: 800; }
.rank-card .num div small { color: var(--texto-3); font-size: 11.5px; }
.barra { height: 6px; background: #eee; border-radius: 5px; margin-top: 14px; overflow: hidden; }
.barra i { display: block; height: 100%; background: linear-gradient(90deg, var(--roxo), var(--roxo-2)); }

/* ---------- Pós-venda ---------- */
.posvenda-wrap { padding: 4px 24px 32px; }
.pv-card { background: #fff; border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--sombra); margin-bottom: 12px; }
.pv-card .topo { display: flex; align-items: center; gap: 10px; }
.pv-card .nome { font-weight: 700; }
.pv-card .checks { display: flex; gap: 18px; margin-top: 12px; flex-wrap: wrap; }
.pv-card label { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--texto-2); cursor: pointer; }
.pv-card input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--roxo); }

/* ---------- Drawer (detalhe do lead) ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20,16,40,.4); z-index: 100; display: none; }
.overlay.show { display: block; }
.drawer {
  position: fixed; top: 0; right: -460px; width: 440px; max-width: 92vw; height: 100%;
  background: #fff; z-index: 101; box-shadow: -8px 0 40px rgba(0,0,0,.18);
  transition: right .25s cubic-bezier(.4,0,.2,1); overflow-y: auto; padding: 0;
}
.drawer.show { right: 0; }
.drawer-head { padding: 22px 24px; background: linear-gradient(120deg, #2a1d52, var(--roxo-dark)); color: #fff; }
.drawer-head .x { float: right; cursor: pointer; font-size: 22px; opacity: .8; line-height: 1; }
.drawer-head h2 { font-size: 20px; letter-spacing: -.5px; }
.drawer-head .tel { margin-top: 4px; opacity: .85; font-size: 13.5px; }
.drawer-body { padding: 22px 24px; }
.campo { margin-bottom: 16px; }
.campo label { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--texto-3); margin-bottom: 5px; font-weight: 700; }
.campo input, .campo select, .campo textarea {
  width: 100%; border: 1px solid var(--linha); border-radius: 9px; padding: 9px 11px;
  font-size: 13.5px; color: var(--texto); font-family: inherit; outline: 0;
}
.campo input:focus, .campo select:focus, .campo textarea:focus { border-color: var(--roxo-2); }
.campo textarea { resize: vertical; min-height: 70px; }
.drawer .zap-big { display: block; text-align: center; text-decoration: none; background: var(--verde); color: #fff; font-weight: 700; padding: 11px; border-radius: 10px; margin-bottom: 16px; }
.drawer .zap-big:hover { background: #178a55; }
.drawer-foot { padding: 16px 24px; border-top: 1px solid var(--linha); display: flex; gap: 10px; }

/* ---------- Modal config ---------- */
.modal { position: fixed; inset: 0; background: rgba(20,16,40,.5); z-index: 200; display: none; align-items: center; justify-content: center; }
.modal.show { display: flex; }
.modal .box { background: #fff; border-radius: 16px; padding: 28px; width: 480px; max-width: 92vw; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal h3 { font-size: 18px; margin-bottom: 6px; }
.modal p { color: var(--texto-2); font-size: 13px; margin-bottom: 16px; line-height: 1.5; }

.vazio { text-align: center; color: var(--texto-3); padding: 60px 20px; font-size: 14px; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2,1fr); }
  .topbar .sub { display: none; }
}
