/* ===== PARK SAÚDE CRM ===== */
:root {
    --navy: #070d1f;
    --navy-2: #0f1830;
    --navy-3: #1a2544;
    --lima: #a6f21c;
    --lima-esc: #86c90f;
    --fundo: #f2f4f8;
    --branco: #fff;
    --texto: #18203a;
    --cinza: #6b7490;
    --borda: #e2e6ef;
    --vermelho: #ef4444;
    --raio: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--fundo); color: var(--texto); font-size: 14px; display: flex; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 12px; }
h3 { font-size: 15px; }
code { background: #eef1f6; padding: 1px 5px; border-radius: 4px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; white-space: nowrap; }
.vazio { color: var(--cinza); text-align: center; padding: 20px; }
.txt-vermelho { color: var(--vermelho); font-weight: 600; }
.ajuda { color: var(--cinza); font-size: 13px; line-height: 1.5; }
[hidden] { display: none !important; }

/* ---- menu lateral ---- */
.lateral { width: 240px; flex-shrink: 0; background: var(--navy); color: #fff; display: flex; flex-direction: column; height: 100vh; position: sticky; top: 0; }
.lateral-logo { padding: 18px 26px 6px; display: block; }
.lateral-logo img { width: 100%; }
.lateral nav { flex: 1; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.lateral nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px; color: #c5cbe0; font-weight: 500; text-decoration: none; position: relative; }
.lateral nav a svg { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }
.lateral nav a:hover { background: var(--navy-2); color: #fff; }
.lateral nav a.ativo { background: var(--lima); color: var(--navy); font-weight: 700; }
.lateral nav .badge { margin-left: auto; background: var(--vermelho); color: #fff; border-radius: 20px; font-size: 11px; padding: 2px 7px; }
.lateral-usuario { display: flex; align-items: center; gap: 10px; padding: 16px; border-top: 1px solid var(--navy-3); }
.lateral-usuario b { display: block; font-size: 13px; }
.lateral-usuario small { color: #8a93b0; font-size: 12px; }
.lateral-usuario .sair { margin-left: auto; color: #8a93b0; }
.lateral-usuario .sair svg { width: 20px; fill: currentColor; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--lima); color: var(--navy); font-weight: 800; display: grid; place-items: center; flex-shrink: 0; }

/* ---- conteúdo ---- */
.conteudo { flex: 1; min-width: 0; padding: 0 28px 28px; overflow-x: hidden; }
.topo { display: flex; align-items: center; gap: 16px; padding: 22px 0 18px; flex-wrap: wrap; }
.topo h1 { font-size: 22px; margin: 0; }
.topo-acoes { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.menu-mobile { display: none; background: var(--navy); color: #fff; border: 0; border-radius: 8px; font-size: 20px; padding: 6px 12px; cursor: pointer; }

/* ---- componentes ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; background: var(--navy); color: #fff; text-decoration: none !important; white-space: nowrap; }
.btn:hover { background: var(--navy-3); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-verde { background: var(--lima); color: var(--navy); }
.btn-verde:hover { background: var(--lima-esc); }
.btn-sec { background: #e8ecf4; color: var(--texto); }
.btn-sec:hover { background: #dbe1ec; }
.btn-perigo { background: #fee2e2; color: #b91c1c; }
.btn-perigo:hover { background: #fecaca; }
.btn-peq { padding: 6px 10px; font-size: 12px; }
.btn-bloco { width: 100%; margin-top: 8px; }

input, select, textarea { font: inherit; padding: 10px 12px; border: 1px solid var(--borda); border-radius: 10px; background: #fff; color: var(--texto); width: 100%; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--lima-esc); box-shadow: 0 0 0 3px rgba(166, 242, 28, .25); }
input:disabled { background: #f4f6fa; color: var(--cinza); }
input[type=color] { padding: 2px; height: 40px; width: 60px; }
input[type=checkbox] { width: auto; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; margin-bottom: 12px; }
label small { font-weight: 400; color: var(--cinza); }
label.chk { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }

.painel { background: #fff; border-radius: var(--raio); padding: 20px; box-shadow: 0 1px 3px rgba(10, 20, 50, .06); margin-bottom: 18px; }
.alerta { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 500; }
.alerta.ok { background: #ecfccb; color: #3f6212; }
.alerta.erro { background: #fee2e2; color: #991b1b; }
.alerta.aviso { background: #fef3c7; color: #92400e; }

.etiqueta { --c: #999; display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, white); white-space: nowrap; }
.origem { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: #eef1f6; color: var(--cinza); white-space: nowrap; }
.origem.ads { background: #ecfccb; color: #3f6212; font-weight: 700; }
.bolinha { background: #22c55e; color: #fff; border-radius: 20px; font-size: 11px; font-weight: 700; padding: 1px 7px; min-width: 20px; text-align: center; display: inline-block; }

.filtros { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filtros input, .filtros select { width: auto; min-width: 160px; flex: 1; }
.filtros .btn { flex: 0; }

/* ---- tabelas ---- */
.tabela-scroll { overflow-x: auto; }
.tabela { width: 100%; border-collapse: collapse; }
.tabela th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--cinza); padding: 10px; border-bottom: 2px solid var(--borda); white-space: nowrap; }
.tabela td { padding: 11px 10px; border-bottom: 1px solid var(--borda); vertical-align: middle; }
.tabela tr:hover td { background: #fafbfd; }
.tabela.compacta td, .tabela.compacta th { padding: 7px 6px; }
.tabela td small { color: var(--cinza); }
.tabela .acoes { white-space: nowrap; font-size: 18px; }
.tabela .acoes a { margin-right: 8px; text-decoration: none; position: relative; }
.tabela .acoes .bolinha { position: absolute; top: -8px; right: -12px; font-size: 10px; }
.tabela tr.inativo td { opacity: .5; }
.tabela-topo { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 10px; flex-wrap: wrap; }
.tabela-topo select { width: auto; }
.paginacao { display: flex; gap: 6px; flex-wrap: wrap; }
.paginacao a { padding: 7px 12px; border-radius: 8px; background: #fff; color: var(--texto); }
.paginacao a.ativo { background: var(--navy); color: #fff; }

/* ---- painel (dashboard) ---- */
.cards-num { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card-num { background: #fff; border-radius: var(--raio); padding: 18px; box-shadow: 0 1px 3px rgba(10, 20, 50, .06); color: var(--texto); text-decoration: none !important; }
.card-num small { color: var(--cinza); font-weight: 600; display: block; }
.card-num b { font-size: 30px; display: block; margin-top: 6px; }
.card-num span { font-weight: 700; color: var(--lima-esc); }
.card-num.destaque { background: var(--navy); color: #fff; }
.card-num.destaque small { color: #9aa3c0; }
.card-num.destaque span { color: var(--lima); }
.grade-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grade-2 .painel { margin: 0; }
.barra-linha { display: grid; grid-template-columns: 170px 1fr 40px; gap: 10px; align-items: center; margin-bottom: 9px; }
.barra-linha span { font-size: 13px; }
.barra { background: #eef1f6; height: 12px; border-radius: 10px; overflow: hidden; }
.barra i { display: block; height: 100%; border-radius: 10px; min-width: 3px; }
.lista-simples { list-style: none; margin: 0; padding: 0; }
.lista-simples li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--borda); }
.lista-simples li span { color: var(--cinza); }
.lista-simples li:last-child { border: 0; }
.lista-simples li b { text-align: right; }
.painel h4 { margin: 18px 0 8px; font-size: 13px; color: var(--cinza); }

/* ---- funil (kanban) ---- */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start; min-height: calc(100vh - 110px); }
.coluna { width: 285px; flex-shrink: 0; background: #e8ecf3; border-radius: var(--raio); display: flex; flex-direction: column; max-height: calc(100vh - 120px); transition: background .15s; }
.coluna.sobre { background: #d9f7a8; }
.coluna-topo { --c: #999; padding: 12px 14px; border-top: 4px solid var(--c); border-radius: var(--raio) var(--raio) 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.coluna-topo b { font-size: 14px; }
.coluna-topo .qtd { background: #fff; border-radius: 20px; padding: 1px 8px; font-size: 12px; font-weight: 700; }
.coluna-topo small { width: 100%; color: var(--cinza); font-weight: 600; }
.coluna-cards { padding: 0 10px 10px; overflow-y: auto; flex: 1; min-height: 80px; }
.card-lead { background: #fff; border-radius: 10px; padding: 12px; margin-bottom: 9px; cursor: grab; box-shadow: 0 1px 2px rgba(10, 20, 50, .08); border-left: 3px solid transparent; transition: transform .1s, box-shadow .1s; }
.card-lead:hover { box-shadow: 0 4px 12px rgba(10, 20, 50, .12); border-left-color: var(--lima); }
.card-lead.arrastando { opacity: .4; }
.card-lead-topo { display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.card-lead-info { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.card-lead-info span { font-size: 11px; background: #f1f4f9; padding: 2px 7px; border-radius: 6px; color: #4b5574; }
.card-lead-valor { margin-top: 7px; font-weight: 800; color: #3f6212; }
.card-lead-rodape { display: flex; gap: 6px; align-items: center; margin-top: 9px; font-size: 11px; color: var(--cinza); flex-wrap: wrap; }
.card-lead-rodape .mini-zap { margin-left: auto; text-decoration: none; font-size: 15px; }

/* ---- ficha ---- */
.grade-ficha { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
.form-grade { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
.form-grade h3 { grid-column: 1 / -1; margin-top: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--borda); }
.col-2 { grid-column: 1 / -1; }
.form-acoes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--borda); max-height: 420px; overflow-y: auto; }
.timeline li { position: relative; padding: 0 0 14px 8px; }
.timeline li::before { content: ""; position: absolute; left: -21px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--lima); border: 2px solid #fff; }
.timeline b { display: block; font-weight: 500; font-size: 13px; }
.timeline small { color: var(--cinza); font-size: 12px; }

/* ---- conversas ---- */
.chat { display: grid; grid-template-columns: 340px 1fr; background: #fff; border-radius: var(--raio); overflow: hidden; height: calc(100vh - 100px); box-shadow: 0 1px 3px rgba(10, 20, 50, .06); }
.chat-lista { border-right: 1px solid var(--borda); display: flex; flex-direction: column; min-height: 0; }
.chat-busca { padding: 12px; border-bottom: 1px solid var(--borda); }
.chat-busca .chk { margin: 8px 0 0; font-size: 12px; }
#lista { overflow-y: auto; flex: 1; }
.conversa { display: flex; gap: 10px; padding: 12px; border-bottom: 1px solid #f0f2f7; color: var(--texto); text-decoration: none !important; }
.conversa:hover { background: #f7f9fc; }
.conversa.ativa { background: #f2fbe3; border-left: 3px solid var(--lima-esc); }
.conversa-meio { flex: 1; min-width: 0; }
.conversa .linha { display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.conversa .linha b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversa .linha small { color: var(--cinza); font-size: 11px; flex-shrink: 0; }
.conversa .previa { color: var(--cinza); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversa .etiqueta { margin-top: 4px; font-size: 10px; }
.chat-janela { display: flex; flex-direction: column; min-height: 0; background: #efeae2; background-image: radial-gradient(rgba(7, 13, 31, .05) 1px, transparent 1px); background-size: 18px 18px; }
.chat-vazio { margin: auto; text-align: center; color: var(--cinza); }
.chat-vazio img { width: 90px; border-radius: 20px; }
.chat-topo { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--borda); flex-wrap: wrap; }
.chat-topo select { width: auto; padding: 8px; }
.chat-quem { flex: 1; min-width: 140px; }
.chat-quem b { display: block; }
.chat-quem small { color: var(--cinza); }
.voltar-mobile { display: none; font-size: 22px; text-decoration: none !important; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 18px 6%; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 70%; padding: 8px 10px 5px; border-radius: 10px; box-shadow: 0 1px 1px rgba(0, 0, 0, .08); word-wrap: break-word; }
.msg.in { background: #fff; align-self: flex-start; border-top-left-radius: 2px; }
.msg.out { background: #e2f7c3; align-self: flex-end; border-top-right-radius: 2px; }
.msg .autor { display: block; font-size: 11px; font-weight: 700; color: #3f6212; margin-bottom: 2px; }
.msg img, .msg video { max-width: 280px; max-height: 320px; border-radius: 8px; display: block; }
.msg audio { width: 260px; }
.msg .doc { display: inline-block; padding: 8px 10px; background: rgba(0, 0, 0, .05); border-radius: 8px; }
.msg-rodape { text-align: right; font-size: 10.5px; color: #7a8399; margin-top: 3px; }
.msg-rodape .lido { color: #2563eb; font-weight: 700; }
.msg-rodape .falhou { color: var(--vermelho); font-weight: 700; cursor: help; }
.aviso-janela { background: #fef3c7; color: #92400e; padding: 10px 14px; font-size: 13px; }
.chat-envio { display: flex; gap: 8px; padding: 10px; background: #f0f2f5; align-items: flex-end; }
.chat-envio textarea { resize: none; max-height: 140px; }
.modal { border: 0; border-radius: 14px; padding: 24px; width: min(460px, 92vw); }
.modal::backdrop { background: rgba(7, 13, 31, .55); }
.modal-acoes { display: flex; justify-content: flex-end; gap: 8px; }

/* ---- login ---- */
.login-body { background: radial-gradient(circle at 70% 20%, #16234a, var(--navy) 60%); align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-box { width: 100%; max-width: 380px; background: var(--navy-2); border: 1px solid var(--navy-3); border-radius: 18px; padding: 32px; color: #fff; box-shadow: 0 20px 60px rgba(0, 0, 0, .4); }
.login-box h2 { text-align: center; }
.login-logo { width: 240px; display: block; margin: 0 auto 6px; }
.login-sub { text-align: center; color: #9aa3c0; margin: 0 0 22px; }
.login-box label { color: #c5cbe0; }
.login-box input { background: var(--navy); border-color: var(--navy-3); color: #fff; }

/* ---- celular ---- */
@media (max-width: 1100px) {
    .grade-2, .grade-ficha { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
    .lateral { position: fixed; left: -260px; z-index: 50; transition: left .2s; }
    .lateral.aberta { left: 0; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .4); }
    .menu-mobile { display: block; }
    .conteudo { padding: 0 12px 16px; }
    .form-grade { grid-template-columns: 1fr; }
    .barra-linha { grid-template-columns: 110px 1fr 30px; }
    .chat { grid-template-columns: 1fr; height: calc(100vh - 80px); }
    .chat.com-lead .chat-lista { display: none; }
    .chat:not(.com-lead) .chat-janela { display: none; }
    .voltar-mobile { display: block; }
    .msg { max-width: 88%; }
    .topo-acoes { margin-left: 0; width: 100%; }
}
