:root {
  --floresta: #1f4a38;
  --musgo: #2f6b52;
  --areia: #f5f1e8;
  --papel: #fffdf8;
  --tinta: #1f2a25;
  --apagado: #667069;
  --linha: #e3dccd;
  --terra: #b85a2a;
  --vermelho: #b3392f;
  --verde: #2f7d4f;
  --ambar: #a9761a;
  --l1: #1f4a38;
  --l2: #1c6580;
  --l3: #a14f25;
  --raio: 12px;
  --sombra: 0 1px 2px rgb(31 42 37 / 6%), 0 6px 18px rgb(31 42 37 / 5%);
  --titulo: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --texto: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--areia); color: var(--tinta); font: 15px/1.45 var(--texto); -webkit-text-size-adjust: 100%; }
h1, h2, h3 { font-family: var(--titulo); font-weight: 600; margin: 0; line-height: 1.2; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
a { color: inherit; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Estrutura */
.shell { display: grid; grid-template-columns: 216px 1fr; height: 100dvh; }
.lateral { background: var(--floresta); color: #f1ede2; display: flex; flex-direction: column; padding: 20px 12px; gap: 4px; }
.marca { font-family: var(--titulo); font-size: 17px; line-height: 1.2; padding: 0 10px 18px; }
.marca small { display: block; font-family: var(--texto); font-size: 12px; opacity: .72; margin-top: 3px; }
.nav-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; border-radius: 9px; text-decoration: none; color: inherit; opacity: .86; }
.nav-item:hover { opacity: 1; background: rgb(255 255 255 / 7%); }
.nav-item.ativo { background: rgb(255 255 255 / 14%); opacity: 1; font-weight: 600; }
.selo { background: var(--terra); color: #fff; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 0 7px; line-height: 19px; min-width: 19px; text-align: center; }
.rodape-nav { margin-top: auto; padding: 8px 10px 0; font-size: 13px; opacity: .8; }
.link-botao { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; color: inherit; }
.conteudo { overflow: auto; min-width: 0; }
.pagina { max-width: 1040px; margin: 0 auto; padding: 24px 22px 56px; display: flex; flex-direction: column; gap: 18px; }
.cabeca { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 10px; }
.sub { color: var(--apagado); }
.vazio { color: var(--apagado); padding: 26px 12px; text-align: center; }

/* Cartões */
.cartao { background: var(--papel); border: 1px solid var(--linha); border-radius: var(--raio); box-shadow: var(--sombra); padding: 16px; }
.grade-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.numero-grande { font-family: var(--titulo); font-size: 30px; line-height: 1.1; }
.pilha { display: flex; flex-direction: column; gap: 10px; }
.fila { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.entre { justify-content: space-between; }

/* Situação */
.ponto { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--apagado); flex: none; }
.ponto.ok { background: var(--verde); }
.ponto.erro { background: var(--vermelho); }
.ponto.espera { background: var(--ambar); }
.alerta { display: flex; gap: 10px; align-items: baseline; padding: 10px 12px; border-radius: 10px; border: 1px solid; text-decoration: none; }
.alerta.erro { background: #fbeeec; border-color: #eccdc8; color: #7f271f; }
.alerta.aviso { background: #fbf4e4; border-color: #eee0bd; color: #6d4e12; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; line-height: 1; padding: 5px 8px; border-radius: 999px; border: 1px solid currentcolor; white-space: nowrap; background: transparent; }
.chip.l1 { color: var(--l1); }
.chip.l2 { color: var(--l2); }
.chip.l3 { color: var(--l3); }
.chip.cheio.l1 { background: var(--l1); border-color: var(--l1); color: #fff; }
.chip.cheio.l2 { background: var(--l2); border-color: var(--l2); color: #fff; }
.chip.cheio.l3 { background: var(--l3); border-color: var(--l3); color: #fff; }
.etiqueta { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 7px; background: #ece6d8; color: #4d5650; white-space: nowrap; }
.etiqueta.ia { background: #dcebe2; color: #1f5a3f; }
.etiqueta.equipe { background: #f6e3d6; color: #8a431c; }
.etiqueta.novo { background: #e4eef2; color: #1c5a72; }
.etiqueta.aguardando_equipe { background: #f6e3d6; color: #8a431c; }
.etiqueta.reservado { background: #dcebe2; color: #1f5a3f; }
.etiqueta.perdido { background: #eee9de; color: #6a746e; }

/* Formulários */
label.campo { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: #3f4944; }
label.campo.pendente span:first-child::after { content: " · falta preencher"; font-weight: 500; color: var(--terra); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], select, textarea {
  width: 100%; background: #fff; border: 1px solid #d6cfbf; border-radius: 9px; padding: 9px 10px; font-weight: 400; font-size: 15px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--musgo); outline-offset: 1px; }
textarea { resize: vertical; min-height: 70px; }
.dica { font-size: 12.5px; font-weight: 400; color: var(--apagado); }
.grade-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.botao { background: var(--floresta); color: #fff; border: 1px solid var(--floresta); border-radius: 9px; padding: 9px 14px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; }
.botao:hover { background: #173a2c; }
.botao.claro { background: transparent; color: var(--floresta); }
.botao.claro:hover { background: #ece6d8; }
.botao.perigo { background: transparent; color: var(--vermelho); border-color: #dfb5b0; }
.botao.perigo:hover { background: #fbeeec; }
.botao[disabled] { opacity: .55; cursor: default; }
.chave { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; }
.chave input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--floresta); flex: none; }
.chave small { display: block; color: var(--apagado); font-size: 13px; }
.salvo { font-size: 13px; color: var(--verde); }
.erro-txt { font-size: 13px; color: var(--vermelho); }

/* Abas */
.abas { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.aba { background: transparent; border: 1px solid var(--linha); border-radius: 999px; padding: 6px 11px; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.aba.ativa { background: var(--floresta); border-color: var(--floresta); color: #fff; }

/* Conversas */
.conversas { display: grid; grid-template-columns: 340px minmax(0, 1fr) 270px; height: 100%; min-height: 0; }
.lista-conversas { border-right: 1px solid var(--linha); background: var(--papel); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.lista-topo { padding: 14px 12px 10px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--linha); }
.lista-rolagem { overflow: auto; flex: 1; }
.conversa-item { display: block; padding: 11px 12px; border-bottom: 1px solid #efe9dc; text-decoration: none; }
.conversa-item:hover { background: #f8f4ea; }
.conversa-item.ativa { background: #eef2ea; }
.conversa-item .nome { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversa-item .previa { color: var(--apagado); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversa-item .hora { color: var(--apagado); font-size: 12px; flex: none; }
.linha-1 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.linha-2 { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-top: 2px; }
.linha-3 { display: flex; gap: 5px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.linha-3 .chip { font-size: 11.5px; padding: 3px 6px; }
.fio { display: flex; flex-direction: column; min-height: 0; background: var(--areia); }
.fio-topo { padding: 10px 14px; background: var(--papel); border-bottom: 1px solid var(--linha); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.voltar { display: none; text-decoration: none; font-size: 22px; line-height: 1; padding: 0 6px 0 0; }
.mensagens { flex: 1; overflow: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 7px; }
.balao { max-width: min(76%, 520px); padding: 8px 11px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 1px 1px rgb(31 42 37 / 6%); }
.balao.entrada { align-self: flex-start; background: var(--papel); border-bottom-left-radius: 4px; }
.balao.saida { align-self: flex-end; background: #dcebe2; border-bottom-right-radius: 4px; }
.balao.saida.celular, .balao.saida.painel { background: #f3e3c9; }
.balao .meta { display: block; margin-top: 3px; font-size: 11.5px; color: var(--apagado); text-align: right; }
.balao .meta.alerta-envio { color: var(--vermelho); font-weight: 600; }
.nota-sistema { align-self: center; font-size: 12.5px; color: #6d4e12; background: #fbf4e4; border: 1px solid #eee0bd; border-radius: 8px; padding: 4px 9px; max-width: 90%; }
.composicao { display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--papel); border-top: 1px solid var(--linha); align-items: flex-end; }
.composicao textarea { min-height: 42px; max-height: 140px; }
.resumo-lead { border-left: 1px solid var(--linha); background: var(--papel); overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.dados { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 13.5px; margin: 0; }
.dados dt { color: var(--apagado); }
.dados dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* Leads */
.lista-leads { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.lead-cartao { text-decoration: none; display: flex; flex-direction: column; gap: 8px; }
.lead-cartao:hover { border-color: #c9c0ad; }
.historico { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.historico time { color: var(--apagado); margin-right: 6px; }

/* WhatsApp */
.numeros { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.qr { width: 100%; max-width: 280px; aspect-ratio: 1; display: block; margin: 0 auto; border-radius: 8px; background: #fff; }
.passos { margin: 0; padding-left: 20px; font-size: 13.5px; color: #3f4944; display: flex; flex-direction: column; gap: 2px; }

/* Acomodações */
.acomodacao { display: grid; grid-template-columns: 170px 1fr; gap: 10px; padding: 12px 0; border-bottom: 1px solid #efe9dc; }
.acomodacao:last-child { border-bottom: 0; }
.acomodacao .campos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.acomodacao .largo { grid-column: 1 / -1; }
.salvar-fixo { position: sticky; bottom: 0; background: linear-gradient(to top, var(--areia) 72%, transparent); padding: 14px 0 8px; display: flex; gap: 12px; align-items: center; }

/* Ensaio */
.ensaio-chat { display: flex; flex-direction: column; gap: 7px; background: var(--areia); border-radius: 10px; padding: 12px; min-height: 280px; max-height: 58dvh; overflow: auto; }

.largura-toda, .cresce { flex: 1; min-width: 0; }
.sem-sublinhado { text-decoration: none; }
a.cartao { text-decoration: none; }

.pilha > .etiqueta, .pilha > .chip { align-self: flex-start; }
.botao { text-align: center; }
@media (min-width: 861px) { .conversas:not(.com-fio) { grid-template-columns: 340px minmax(0, 1fr); } }

/* Entrada */
.tela-entrar { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: var(--floresta); }
.tela-entrar form { width: min(380px, 100%); background: var(--papel); border-radius: 14px; padding: 26px; display: flex; flex-direction: column; gap: 14px; }

@media (max-width: 1180px) {
  .conversas { grid-template-columns: 320px minmax(0, 1fr); }
  .resumo-lead { display: none; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .lateral { order: 2; flex-direction: row; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); gap: 0; justify-content: space-around; }
  .marca, .rodape-nav { display: none; }
  .nav-item { flex-direction: column; flex: 1; gap: 1px; font-size: 12px; padding: 10px 2px 6px; text-align: center; position: relative; }
  .nav-item .selo { position: absolute; top: 0; right: 2px; font-size: 10px; line-height: 14px; min-width: 14px; padding: 0 3px; }
  .pagina { padding: 18px 14px 36px; }
  .grade-3, .numeros { grid-template-columns: 1fr; }
  .grade-3.contagens { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .grade-3.contagens .cartao { padding: 12px; }
  .grade-2 { grid-template-columns: 1fr; }
  .conversas { grid-template-columns: minmax(0, 1fr); }
  .conversas.com-fio .lista-conversas { display: none; }
  .conversas:not(.com-fio) .fio { display: none; }
  .voltar { display: inline-block; }
  .acomodacao { grid-template-columns: 1fr; }
  .balao { max-width: 86%; }
  input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], select, textarea { font-size: 16px; }
}
@media (prefers-reduced-motion: no-preference) {
  .botao, .nav-item, .conversa-item { transition: background-color .12s ease; }
}
