/* Zap Negocial - assets/css/main.css */

:root {
  --brand:        #0a7d33;
  --brand-escuro: #096b2c;
  --brand-claro:  #25D366;
  --lateral:      #111c26;
  --texto:        #1f2937;
  --suave:        #6b7280;
  --borda:        #e5e7eb;
  --fundo:        #f3f4f6;
}

* { box-sizing: border-box; }

/* O atributo hidden precisa vencer qualquer display definido aqui.
   Sem isto o modal, que e display:flex, aparece mesmo escondido. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  color: var(--texto);
  background: var(--fundo);
}

a { color: var(--brand); }
.mono { font-family: Consolas, monospace; font-size: 12.5px; }

/* ---------- Layout ---------- */

.layout { display: flex; min-height: 100vh; }

nav.lateral {
  width: 230px; flex-shrink: 0;
  background: var(--lateral); color: #cbd5e1;
  display: flex; flex-direction: column;
}
nav.lateral .marca {
  padding: 20px 18px; font-weight: 700; font-size: 17px; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
nav.lateral .marca small { display: block; font-weight: 400; font-size: 12px; color: #7c8b9a; margin-top: 3px; }
nav.lateral a {
  display: block; padding: 12px 18px; font-size: 14.5px;
  color: #cbd5e1; text-decoration: none; border-left: 3px solid transparent;
}
nav.lateral a:hover { background: rgba(255,255,255,.05); color: #fff; }
nav.lateral a.ativo { background: rgba(37,211,102,.12); border-left-color: var(--brand-claro); color: #fff; font-weight: 600; }
nav.lateral .rodape-lateral {
  margin-top: auto; padding: 16px 18px; font-size: 12px; color: #8fa0b0;
  border-top: 1px solid rgba(255,255,255,.08);
}

.conteudo { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topo {
  display: flex; align-items: center; gap: 14px;
  background: #fff; border-bottom: 1px solid var(--borda); padding: 14px 26px;
}
.topo-titulo { font-size: 17px; font-weight: 600; }
.topo-acoes { margin-left: auto; }
.menu-toggle { display: none; background: none; border: 0; font-size: 21px; cursor: pointer; color: var(--texto); }

.pagina { padding: 26px; max-width: 900px; }

/* ---------- Componentes ---------- */

.card { background: #fff; border: 1px solid var(--borda); border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; }
.card h3 { margin: 0 0 4px; font-size: 16px; }

.linha { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.espaco { margin-left: auto; }
.sub { color: var(--suave); font-size: 14px; margin: 0 0 18px; }
.dica { font-size: 12.5px; color: var(--suave); margin-top: 5px; }

.btn {
  display: inline-block; background: var(--brand); color: #fff;
  border: 0; border-radius: 7px; padding: 10px 18px;
  font-size: 14.5px; font-family: inherit; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--brand-escuro); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.claro { background: #fff; color: #374151; border: 1px solid #d1d5db; }
.btn.claro:hover { background: #f9fafb; }
.btn.perigo { background: #fff; color: #b91c1c; border: 1px solid #fca5a5; }
.btn.pequeno { padding: 6px 12px; font-size: 13px; }
.btn.meta { background: #1877F2; font-size: 16px; padding: 14px 26px; }
.btn.meta:hover { background: #166fe0; }

label { display: block; font-size: 13.5px; font-weight: 600; margin: 14px 0 5px; color: #374151; }
input[type=text], input[type=password], select, textarea {
  width: 100%; padding: 10px 12px; font-size: 14.5px; font-family: inherit;
  border: 1px solid #d1d5db; border-radius: 7px; background: #fff;
}
input[readonly] { background: #f9fafb; font-family: Consolas, monospace; font-size: 13px; }

.selo { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 20px; }
.selo.on     { background: #dcfce7; color: #166534; }
.selo.off    { background: #fee2e2; color: #991b1b; }
.selo.espera { background: #fef3c7; color: #92400e; }

.aviso { padding: 12px 14px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; }
.aviso.erro { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.aviso.ok   { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.aviso.info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
th { font-size: 12.5px; text-transform: uppercase; color: var(--suave); letter-spacing: .03em; }

.vazio { text-align: center; color: var(--suave); padding: 34px 20px; }

/* ---------- Eventos ---------- */

.ev { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f3f4f6; font-size: 14px; }
.ev:last-child { border-bottom: 0; }
.ev .hora { color: #9ca3af; font-size: 12.5px; white-space: nowrap; padding-top: 2px; }
.ev .tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 12px; white-space: nowrap; height: fit-content; }
.ev .det { color: var(--suave); font-size: 12.5px; }
/* Ciclo de uma mensagem: enviada, saiu, entregue, lida.
   Falhou e falha ficam em vermelho. */
.tag.recebida { background: #dbeafe; color: #1e40af; }
.tag.enviada  { background: #dcfce7; color: #166534; }
.tag.saiu     { background: #f3f4f6; color: #4b5563; }
.tag.entregue { background: #ccfbf1; color: #115e59; }
.tag.lida     { background: #bbf7d0; color: #14532d; }
.tag.falhou   { background: #fee2e2; color: #991b1b; }
.tag.falha    { background: #fee2e2; color: #991b1b; }
.tag.status   { background: #f3f4f6; color: #374151; }
.tag.conexao  { background: #ede9fe; color: #5b21b6; }

/* ---------- Simulador ---------- */

.chat { background: #e5ddd5; border-radius: 8px; padding: 14px; height: 430px; overflow-y: auto; margin: 12px 0; }
.bolha {
  max-width: 82%; width: fit-content; padding: 8px 12px; margin-bottom: 9px;
  border-radius: 8px; font-size: 14px; line-height: 1.45;
  box-shadow: 0 1px 1px rgba(0,0,0,.12); word-wrap: break-word;
}
.bolha.cliente { background: #dcf8c6; margin-left: auto; }
.bolha.bot     { background: #fff; }

/* ---------- Modal e toast ---------- */

.modal-fundo {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal { background: #fff; border-radius: 12px; padding: 24px; max-width: 420px; width: 100%; }
.modal h3 { margin: 0 0 8px; font-size: 17px; }
.modal p { margin: 0; color: #374151; }
.modal-acoes { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.tipo-erro .modal h3 { color: #b91c1c; }
.tipo-sucesso .modal h3 { color: #166534; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 12px 22px; border-radius: 8px; font-size: 14px; color: #fff; z-index: 60;
  box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
.toast.ok   { background: #166534; }
.toast.erro { background: #b91c1c; }

/* ---------- Login ---------- */

body.login { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.caixa-login {
  background: #fff; border: 1px solid var(--borda); border-radius: 12px;
  padding: 32px; width: 100%; max-width: 380px; box-shadow: 0 4px 18px rgba(0,0,0,.05);
}
.caixa-login h1 { font-size: 21px; text-align: center; margin: 0 0 4px; }
.caixa-login .sub { text-align: center; }
.caixa-login .btn { width: 100%; margin-top: 20px; }

/* ---------- Telas estreitas ---------- */

@media (max-width: 820px) {
  .menu-toggle { display: block; }
  nav.lateral { position: fixed; inset: 0 auto 0 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  body.menu-aberto nav.lateral { transform: none; }
  .pagina { padding: 18px 16px; }
}
