/* Painel Comercial SST Online — identidade e layout base */
:root {
    --brand: #39995f;
    --brand-escuro: #2c7a4b;
    --brand-claro: #e8f5ee;
    --laranja: #e98c19;
    --ink: #1f2b24;
    --muted: #64748b;
    --linha: #e2e8f0;
    --fundo: #f5f8f6;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--fundo); color: var(--ink); font-size: 14px; }

/* ── Estrutura ─────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }
/* A lateral em si só reserva o espaço; quem aparece é a .lateral-interna, fixa.
   Assim, recolhida, ela cresce POR CIMA do conteúdo no hover em vez de empurrar
   a tela inteira a cada passada de mouse. */
.lateral { width: 216px; flex-shrink: 0; transition: width .16s ease; }
.lateral-interna { position: fixed; top: 0; left: 0; bottom: 0; width: 216px; z-index: 30;
                   background: var(--brand); color: #eaf6ef; padding: 14px 0;
                   overflow-y: auto; overflow-x: hidden; transition: width .16s ease, box-shadow .16s ease; }
.topo-lateral { display: flex; align-items: center; gap: 6px; padding: 0 12px 14px; }
.lateral .marca { flex: 1; min-width: 0; }
.lateral .marca img { height: 30px; display: block; }
.recolher { background: rgba(255,255,255,.14); border: 0; color: #eaf6ef; border-radius: 7px; flex-shrink: 0;
            width: 26px; height: 26px; padding: 0; font-size: 14px; line-height: 1; cursor: pointer; }
.recolher:hover { background: rgba(255,255,255,.28); }
.g-expandir { display: none; }
.lateral nav { display: flex; flex-direction: column; }
.lateral a { color: #d8ede1; text-decoration: none; padding: 9px 16px; display: flex; gap: 9px; align-items: center; font-size: 13.5px; border-left: 3px solid transparent; white-space: nowrap; }
.lateral a:hover { background: var(--brand-escuro); color: #fff; }
.lateral a.ativo { background: var(--brand-escuro); color: #fff; border-left-color: var(--laranja); font-weight: 600; }
.lateral .ico { width: 20px; text-align: center; flex-shrink: 0; }
.lateral .rotulo { transition: opacity .12s ease; }
.grupo-menu { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #a9d4bd; padding: 14px 16px 5px; }

/* ── Menu recolhido: só os ícones; o hover abre por cima ── */
html.menu-recolhido .lateral,
html.menu-recolhido .lateral-interna { width: 58px; }
html.menu-recolhido .lateral-interna:hover { width: 216px; box-shadow: 6px 0 24px rgba(15, 23, 42, .28); transition-delay: .18s; }
html.menu-recolhido .marca { display: none; }
html.menu-recolhido .topo-lateral { justify-content: center; padding: 0 0 14px; }
html.menu-recolhido .rotulo { opacity: 0; }
html.menu-recolhido .g-recolher { display: none; }
html.menu-recolhido .g-expandir { display: inline; }
/* o nome da seção vira um risquinho, que ainda separa os blocos */
html.menu-recolhido .grupo-menu { position: relative; color: transparent; }
html.menu-recolhido .grupo-menu::before { content: ''; position: absolute; left: 14px; right: 14px; top: 50%; height: 1px; background: rgba(255,255,255,.22); }

html.menu-recolhido .lateral-interna:hover .marca { display: block; }
html.menu-recolhido .lateral-interna:hover .topo-lateral { justify-content: flex-start; padding: 0 12px 14px; }
html.menu-recolhido .lateral-interna:hover .rotulo { opacity: 1; }
html.menu-recolhido .lateral-interna:hover .grupo-menu { color: #a9d4bd; }
html.menu-recolhido .lateral-interna:hover .grupo-menu::before { display: none; }
.conteudo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topo { background: #fff; border-bottom: 1px solid var(--linha); padding: 12px 24px; display: flex; align-items: center; gap: 12px; font-size: 15px; }
.seletor-empresa { margin: 0; }
.seletor-empresa select { width: auto; padding: 5px 9px; font-size: 12.5px; border-radius: 999px; background: var(--brand-claro); border-color: transparent; color: var(--brand-escuro); font-weight: 600; cursor: pointer; }
.topo .fim { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.topo form { margin: 0; }
.topo button { background: none; border: 1px solid var(--linha); color: var(--muted); border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 12px; }
.topo button:hover { background: var(--fundo); }
main { padding: 22px 24px 40px; }
@media (max-width: 760px) {
    .app { flex-direction: column; }
    .lateral, html.menu-recolhido .lateral { width: 100%; height: auto; }
    .lateral-interna, html.menu-recolhido .lateral-interna { position: static; width: 100%; height: auto; box-shadow: none; }
    .lateral nav { flex-direction: row; flex-wrap: wrap; }
    .grupo-menu { width: 100%; padding-top: 8px; }
    .recolher { display: none; }
    html.menu-recolhido .marca { display: block; }
    html.menu-recolhido .rotulo { opacity: 1; }
    html.menu-recolhido .grupo-menu { color: #a9d4bd; }
    html.menu-recolhido .grupo-menu::before { display: none; }
}

/* ── Componentes ───────────────────────────────────────── */
h1 { font-size: 19px; margin: 0 0 14px; color: var(--brand-escuro); }
h2 { font-size: 15px; margin: 0 0 12px; }
.panel { background: #fff; border: 1px solid var(--linha); border-radius: 12px; padding: 16px; margin-bottom: 18px; }
.aviso { padding: 9px 13px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; white-space: pre-line; }
.aviso.ok { background: var(--brand-claro); color: var(--brand-escuro); }
.aviso.erro { background: #fee2e2; color: #991b1b; }
.hint { font-size: 12px; color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--linha); }
td { padding: 7px 8px; border-bottom: 1px solid var(--linha); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

input, select, textarea, button { font: inherit; }
input, select, textarea { padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; width: 100%; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
textarea { min-height: 90px; }
label { display: block; font-size: 12px; font-weight: 600; color: #475569; margin: 10px 0 4px; }
button { background: var(--brand); color: #fff; border: 0; border-radius: 8px; padding: 9px 14px; cursor: pointer; font-size: 13px; }
button:hover { background: var(--brand-escuro); }
button.sec { background: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; }
button.sec:hover { background: #e8eef4; }
button.perigo { background: #dc2626; }
button.perigo:hover { background: #b91c1c; }
button.laranja { background: var(--laranja); }
button.laranja:hover { background: #cf7a12; }

.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.tag.sst, .tag.tmb { background: var(--brand-claro); color: var(--brand-escuro); }
.tag.clube-esg { background: #ccfbf1; color: #115e59; }
.tag.eduzz { background: #fdf0dc; color: #9a5c06; }
.tag.open, .tag.concluido, .tag.neste, .tag.efetivado { background: var(--brand-claro); color: var(--brand-escuro); }
.tag.connecting, .tag.close, .tag.pausado, .tag.cancelado { background: #fee2e2; color: #991b1b; }
.tag.agendado { background: #e0e7ff; color: #3730a3; }
.tag.executando { background: #fef3c7; color: #92400e; }
.tag.teste_enviado { background: #e0e7ff; color: #3730a3; }
.tag.outro { background: #fef3c7; color: #92400e; }
.tag.catalogo { background: #f1f5f9; color: var(--muted); }

/* Filtros em pílula e paginação — servem para qualquer lista longa do painel */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: -2px 0 12px; }
.chips a { display: inline-block; text-decoration: none; font-size: 12px; font-weight: 600; padding: 4px 11px;
           border-radius: 999px; border: 1px solid var(--linha); background: #f8fafc; color: #475569; }
.chips a:hover { background: #eef2f5; }
.chips a.ativo { background: var(--brand); border-color: var(--brand); color: #fff; }
.chips a .qtd { opacity: .7; font-weight: 500; }

.paginacao { display: flex; gap: 10px; align-items: center; justify-content: space-between;
             border-top: 1px solid var(--linha); margin-top: 14px; padding-top: 12px; font-size: 12.5px; }
.paginacao a { text-decoration: none; font-weight: 600; padding: 5px 10px; border: 1px solid var(--linha);
               border-radius: 8px; background: #f8fafc; }
.paginacao a:hover { background: #eef2f5; }
.paginacao .inerte { padding: 5px 10px; color: #cbd5e1; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 12px; margin-bottom: 18px; }
.card { background: #fff; border: 1px solid var(--linha); border-radius: 12px; padding: 14px 16px; }
.card .label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.card .value { font-size: 23px; font-weight: 700; margin-top: 4px; }
.card .extra { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card.ok .value { color: var(--brand); }
.card.warn .value { color: #d97706; }
.card.bad .value { color: #dc2626; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
.lista-scroll { max-height: 420px; overflow-y: auto; border: 1px solid var(--linha); border-radius: 8px; }
.bar { background: var(--linha); border-radius: 999px; height: 9px; overflow: hidden; margin-top: 4px; }
.bar > div { background: var(--brand); height: 100%; transition: width .5s; }
a { color: var(--brand-escuro); }
[hidden] { display: none !important; }

/* Placeholder dos módulos que ainda vão nascer */
.embreve { text-align: center; padding: 48px 24px; }
.embreve .icone { font-size: 42px; }
.embreve h2 { font-size: 18px; margin: 12px 0 6px; color: var(--brand-escuro); }
.embreve p { color: var(--muted); max-width: 520px; margin: 0 auto 6px; line-height: 1.5; }
.embreve ul { text-align: left; max-width: 420px; margin: 16px auto 0; color: var(--muted); line-height: 1.7; }

/* ── CRM: histórico de tentativas no card ─────────────────────────── */
.lead details.tentativas { margin-top: 6px; }
.lead details.tentativas > summary {
    cursor: pointer; font-size: 11.5px; color: var(--muted); list-style: none;
    padding: 2px 0; user-select: none;
}
.lead details.tentativas > summary::-webkit-details-marker { display: none; }
.lead details.tentativas > summary::before { content: '▸ '; }
.lead details.tentativas[open] > summary::before { content: '▾ '; }
.lead details.tentativas > summary:hover { color: var(--ink); }
.lead details.tentativas ul { list-style: none; margin: 4px 0 0; padding: 0 0 0 2px; }
.lead details.tentativas li {
    font-size: 11.5px; color: var(--muted); padding: 2px 0; display: flex; gap: 6px; align-items: baseline;
}
/* a tentativa que ainda dá para salvar não pode ter a mesma cor das mortas */
.lead details.tentativas li.viva { color: var(--brand-escuro); font-weight: 600; }
.lead details.tentativas li .q { font-variant-numeric: tabular-nums; opacity: .75; flex-shrink: 0; }

/* ── CRM: abrir conversa com modelo ───────────────────────────────── */
.lead button.zap {
    background: none; border: 0; padding: 0; color: #25d366; cursor: pointer;
    display: inline-flex; align-items: center;
}
.lead button.zap:hover { color: #128c4a; background: none; }
.previa-modelo {
    background: #dcf8c6; color: #1f2b24; border: 1px solid #c8e9ae; border-radius: 10px;
    padding: 10px 12px; font-size: 13px; line-height: 1.45; white-space: pre-wrap; min-height: 54px;
}
.acoes-modal { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.acoes-modal button.sec { background: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; }

.ficha-tentativas { margin: 14px 0; }
.ficha-tentativas h4 { margin: 0 0 7px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ficha-tentativas ul { list-style: none; margin: 0; padding: 0; border: 1px solid var(--linha); border-radius: 9px; overflow: hidden; }
.ficha-tentativas li { display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; font-size: 13px; }
.ficha-tentativas li + li { border-top: 1px solid var(--linha); }
.ficha-tentativas li .q { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; flex-shrink: 0; }
.ficha-tentativas li .t { flex: 1; }
.ficha-tentativas li .v { font-variant-numeric: tabular-nums; color: var(--muted); }
.ficha-tentativas li.viva { background: var(--brand-claro); color: var(--brand-escuro); font-weight: 600; }
.ficha-tentativas li.paga { background: #ecfdf5; color: #065f46; font-weight: 600; }

/* ── CRM: quem já é cliente ───────────────────────────────────────── */
.lead .eh-cliente {
    display: inline-block; margin-top: 6px; font-size: 11.5px; font-weight: 600;
    color: #8a5209; background: #fdf0dc; border-radius: 999px; padding: 2px 9px;
}
/* oferecer o curso que a pessoa já tem é o erro mais caro: fica em vermelho */
.lead .ja-tem {
    margin-top: 6px; font-size: 11.5px; font-weight: 700; color: #991b1b;
    background: #fee2e2; border-radius: 6px; padding: 3px 9px; display: inline-block;
}
.ficha-cliente { margin: 14px 0; }
.ficha-cliente h4 { margin: 0 0 7px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #8a5209; }
.ficha-cliente ul { list-style: none; margin: 0; padding: 0; border: 1px solid #f0dcbb; border-radius: 9px; overflow: hidden; }
.ficha-cliente li { display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; font-size: 13px; background: #fffaf2; }
.ficha-cliente li + li { border-top: 1px solid #f0dcbb; }
.ficha-cliente li .q { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; flex-shrink: 0; }
.ficha-cliente li .t { flex: 1; }
.ficha-cliente li .v { font-variant-numeric: tabular-nums; color: var(--muted); }
.ficha-cliente .total-cliente { margin: 8px 0 0; font-size: 13px; color: var(--ink); }
.ficha-cliente .alerta-ja-tem {
    margin: 0 0 8px; font-size: 12.5px; color: #991b1b; background: #fee2e2;
    border-radius: 8px; padding: 8px 11px;
}

/* ── Balcão de dúvidas ────────────────────────────────────────────── */
#bt-consultor {
    /* fixed na viewport: a dúvida aparece no meio da rolagem, e o botão
       tem que estar no mesmo lugar sempre */
    position: fixed; right: 20px; bottom: 20px; z-index: 900;
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--brand); color: #fff; border: 0; border-radius: 999px;
    padding: 11px 18px 11px 14px; font-size: 13.5px; font-weight: 600; cursor: pointer;
    box-shadow: 0 4px 16px rgba(31,43,36,.22);
}
#bt-consultor:hover { background: var(--brand-escuro); }
#bt-consultor .ic {
    width: 20px; height: 20px; border-radius: 50%; background: rgba(255,255,255,.22);
    display: grid; place-items: center; font-weight: 800; font-size: 13px;
}
@media (max-width: 720px) { #bt-consultor .rot { display: none; } #bt-consultor { padding: 13px; } }

.cns-fundo { position: fixed; inset: 0; background: rgba(15,23,42,.32); z-index: 901; }
.cns-caixa {
    position: fixed; right: 20px; bottom: 20px; z-index: 902; width: min(440px, calc(100vw - 32px));
    height: min(620px, calc(100vh - 40px)); background: #fff; border-radius: 14px;
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 18px 48px rgba(15,23,42,.3);
}
.cns-caixa > header {
    display: flex; align-items: center; gap: 8px; padding: 13px 14px;
    border-bottom: 1px solid var(--linha); flex-wrap: wrap;
}
.cns-caixa > header strong { font-size: 14.5px; }
.cns-dica { font-size: 11.5px; color: var(--muted); flex: 1; min-width: 0; }
.cns-limpar, .cns-x {
    background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; padding: 3px 6px;
}
.cns-x { font-size: 19px; line-height: 1; }
.cns-limpar:hover, .cns-x:hover { color: var(--ink); background: none; }

.cns-fluxo { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.cns-vazio { color: var(--muted); font-size: 13px; }
.cns-vazio p { margin: 0 0 10px; }
.cns-exemplos { display: flex; flex-direction: column; gap: 6px; }
.cns-exemplos button {
    background: var(--fundo); border: 1px solid var(--linha); color: var(--ink);
    border-radius: 9px; padding: 8px 11px; font-size: 12.5px; text-align: left; cursor: pointer;
}
.cns-exemplos button:hover { background: var(--brand-claro); border-color: var(--brand); color: var(--brand-escuro); }

.cns-balao { border-radius: 11px; padding: 10px 12px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; }
.cns-balao.pessoa { background: var(--brand); color: #fff; align-self: flex-end; max-width: 85%; }
.cns-balao.ia { background: var(--fundo); border: 1px solid var(--linha); }
.cns-balao.pensando { color: var(--muted); font-style: italic; }
.cns-balao.aviso { background: #fef3c7; color: #92400e; font-size: 12.5px; }

/* a ficha que respondeu fica clicável: é onde se corrige quando está errada */
.cns-fontes { margin-top: 9px; display: flex; flex-direction: column; gap: 5px; }
.cns-fontes button {
    background: #fff; border: 1px dashed var(--linha); color: var(--ink-2, #475569);
    border-radius: 8px; padding: 6px 9px; font-size: 11.5px; text-align: left; cursor: pointer;
}
.cns-fontes button:hover { border-color: var(--brand); color: var(--brand-escuro); background: var(--brand-claro); }
.cns-fontes .q { color: var(--muted); }

#cns-form { display: flex; gap: 8px; padding: 11px 12px; border-top: 1px solid var(--linha); align-items: flex-end; }
#cns-pergunta { resize: none; font: inherit; font-size: 13.5px; line-height: 1.45; max-height: 130px; }
#cns-enviar { flex-shrink: 0; }

#cns-correcao { border: 0; border-radius: 13px; padding: 20px; width: min(460px, 94vw); box-shadow: 0 16px 48px rgba(15,23,42,.3); }
#cns-correcao::backdrop { background: rgba(15,23,42,.45); }
#cns-correcao h3 { margin: 0 0 3px; font-size: 16.5px; }
#cns-correcao label { display: block; margin: 12px 0 5px; font-size: 12px; font-weight: 600; color: var(--muted); }
.cns-acoes { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.cns-acoes .sec { background: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; }

/* ── Atendimento: o que a pessoa já comprou e já tentou ───────────── */
.historico-cliente { margin: 0 0 10px; border: 1px solid #f0dcbb; background: #fffaf2; border-radius: 9px; padding: 8px 10px; }
.historico-cliente.tent { border-color: var(--linha); background: var(--fundo); }
.historico-cliente > summary {
    cursor: pointer; font-size: 12px; font-weight: 700; color: #8a5209; list-style: none; user-select: none;
}
.historico-cliente.tent > summary { color: var(--muted); font-weight: 600; }
.historico-cliente > summary::-webkit-details-marker { display: none; }
.historico-cliente > summary::before { content: '▸ '; }
.historico-cliente[open] > summary::before { content: '▾ '; }
.historico-cliente ul { list-style: none; margin: 7px 0 0; padding: 0; }
.historico-cliente li { display: flex; gap: 7px; align-items: baseline; font-size: 12px; padding: 2px 0; }
.historico-cliente li .q { color: var(--muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.historico-cliente li .t { flex: 1; min-width: 0; }
.historico-cliente li .v { color: var(--muted); font-variant-numeric: tabular-nums; }
.historico-cliente li.viva { color: var(--brand-escuro); font-weight: 600; }
.historico-cliente li.paga { color: #065f46; font-weight: 600; }
.bloco .ja-tem {
    margin: 0 0 9px; font-size: 12px; font-weight: 700; color: #991b1b;
    background: #fee2e2; border-radius: 7px; padding: 6px 10px;
}

.pagou-por-fora {
    display: block; text-align: center; margin: 10px 0 4px; padding: 8px 10px;
    border: 1px dashed var(--linha); border-radius: 8px; font-size: 12.5px;
    color: var(--muted); text-decoration: none; background: var(--fundo);
}
.pagou-por-fora:hover { border-color: var(--brand); color: var(--brand-escuro); background: var(--brand-claro); }

label.ja-emitida {
    display: flex; align-items: center; gap: 9px; margin-top: 14px; padding: 9px 12px;
    background: #fdf3e3; border: 1px solid #f0dcbb; border-radius: 9px; font-size: 13px; cursor: pointer;
}
label.ja-emitida input { width: 16px; height: 16px; accent-color: var(--brand); flex-shrink: 0; }

/* ── Venda por fora: puxar quem já está na base ───────────────────── */
.busca-pessoa { position: relative; }
.achados {
    position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 3px);
    background: #fff; border: 1px solid var(--linha); border-radius: 9px; padding: 5px;
    box-shadow: 0 8px 24px rgba(31,43,36,.16); max-height: 290px; overflow-y: auto;
}
.achados button {
    display: block; width: 100%; text-align: left; background: none; border: 0;
    padding: 8px 10px; border-radius: 7px; cursor: pointer; color: var(--ink);
}
.achados button:hover { background: var(--brand-claro); }
.achados strong { display: block; font-size: 13.5px; }
.achados .det { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.achados .onde {
    display: inline-block; font-size: 10.5px; font-weight: 700; margin-top: 4px;
    background: var(--linha-2, #eef2f0); color: var(--muted); border-radius: 999px; padding: 1px 8px;
}
