/* ── Tela Funil: quadro Kanban ──────────────────────────────────── */
.funil {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 80px);
  gap: 16px;
}

.funil__topo {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.funil__sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

/* Board: colunas lado a lado, rolagem horizontal se faltar espaço */
.funil__board {
  display: flex;
  gap: 14px;
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  padding-bottom: 6px;
}

.funil__coluna {
  display: flex;
  flex-direction: column;
  width: 250px;
  flex-shrink: 0;
  background: var(--sidebar-bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  max-height: 100%;
}

.funil__coluna-cabecalho {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.funil__coluna-check {
  width: 15px; height: 15px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--accent);
}
.funil__coluna-check:disabled { cursor: default; opacity: 0.4; }
.funil__coluna-ponto {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.funil__coluna-contagem {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
}

.funil__cards {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Zona de drop destacada */
.funil__coluna--alvo {
  border-color: var(--accent);
}
.funil__coluna--alvo .funil__cards {
  background: var(--accent-soft);
  border-radius: 0 0 var(--r-md) var(--r-md);
}

/* ── Card de lead ───────────────────────────────────────────────── */
.funil__card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: grab;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.funil__card:hover {
  border-color: #c8cad0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.funil__card:active { cursor: grabbing; }
.funil__card--arrastando { opacity: 0.4; }

.funil__card-nome {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.funil__card-numero {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.funil__vazio {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 16px 8px;
}

/* Botão "Ver mais" no rodapé de cada coluna (paginação do funil) */
.funil__vermais {
  margin: 6px 8px 8px;
  padding: 7px 10px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  flex-shrink: 0;
}
.funil__vermais:hover { background: var(--panel-bg); color: var(--text); }
.funil__vermais[disabled] { opacity: .5; cursor: default; }

/* Onde o lead está no fluxo (badge no card do funil) */
.funil__card-fluxo {
  margin-top: 6px;
  font-size: 11px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 2px 6px;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Topo: wrapper que agrupa os botões de ação ──────────────────── */
.funil__topo-btns {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Botão "+ Nova etapa" ────────────────────────────────────────── */
.funil__btn-nova-etapa {
  padding: 7px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--panel-bg-hover);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.funil__btn-nova-etapa:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.funil__btn-nova-etapa:disabled { opacity: 0.5; cursor: default; }

/* ── Título editável da coluna ───────────────────────────────────── */
.funil__coluna-titulo {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Botões de ação na coluna (✏ renomear e × apagar) ───────────── */
.funil__coluna-btn {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  color: var(--text-muted);
  /* Sempre visível (item 6): antes era opacity:0 e só aparecia no hover, então a
     pessoa não sabia que dava para renomear/excluir a etapa. Discreto por padrão,
     total no hover. */
  opacity: 0.5;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.funil__coluna-cabecalho:hover .funil__coluna-btn { opacity: 1; }
.funil__coluna-btn--ren:hover { background: var(--panel-bg); color: var(--text); }
.funil__coluna-btn--del:hover { background: rgba(239, 68, 68, 0.12); color: #ef4444; }

/* ── Cabeçalho: cursor grab indica que pode reordenar arrastando ─── */
.funil__coluna-cabecalho { cursor: grab; }
.funil__coluna-cabecalho:active { cursor: grabbing; }

/* ── Coluna sendo arrastada (reordenação de colunas) ────────────── */
.funil__coluna--arrastando { opacity: 0.4; }

/* ── Coluna alvo de reordenação (distinto de --alvo usado no LEAD) ─ */
.funil__coluna--alvo-col {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent-soft);
}

/* ── Topo do Funil: busca + painel de resumo (item 6) ─────────────── */
.funil__topo-dir { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.funil__busca { width: 260px; max-width: 100%; }

.funil__resumo {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 4px 0 16px;
}
.funil__resumo-card {
  display: flex;
  flex-direction: column;
  min-width: 120px;
  padding: 10px 14px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--r-sm);
}
.funil__resumo-card strong { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.funil__resumo-card span { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.funil__resumo-card.is-enviado { border-left-color: #16a34a; }
.funil__resumo-card.is-novo    { border-left-color: #2563eb; }
.funil__resumo-card.is-erro    { border-left-color: #e11d2e; }
.funil__resumo-erro { color: #e11d2e; font-size: 0.85rem; }

/* ── Seleção em massa de leads (item 6) ───────────────────────────── */
.funil__card { position: relative; }
.funil__card-check {
  position: absolute;
  top: 8px; right: 8px;
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.funil__card.is-selecionado { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

.funil__selecao {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
}
/* Sem isto o `display:flex` vence o atributo hidden e a barra aparece vazia
   (o "negócio vermelho" na tela do Funil). Só mostra quando há seleção. */
.funil__selecao[hidden] { display: none; }
.funil__selecao-info { font-weight: 700; font-size: 0.9rem; color: var(--text); }
.funil__selecao-etapa { max-width: 200px; }
.funil__selecao-del { color: #e11d2e; }
