* { box-sizing: border-box; }

:root {
  --vinho: #5c1414;
  --vinho-escuro: #3d0d0d;
  --creme: #f6f0ea;
  --creme-escuro: #ece1d7;
  --texto: #2b1414;
  --texto-suave: #6b5a54;
  --fonte-destaque: "Outfit", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: linear-gradient(to top, #2a0606 0%, #4a0f0f 45%, #7a1e1b 100%);
  background-attachment: fixed;
  color: var(--texto);
  min-height: 100vh;
}

/* ---------- Login ---------- */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-box {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 340px;
  text-align: center;
}

.login-box img.logo {
  width: 72px;
  height: 72px;
  margin-bottom: 12px;
  background: var(--vinho);
  border-radius: 50%;
  padding: 4px;
}

.login-box h1 {
  font-family: var(--fonte-destaque);
  font-weight: 500;
  font-size: 21px;
  margin: 0 0 4px;
  color: var(--vinho);
}

.login-box p {
  color: var(--texto-suave);
  font-size: 13px;
  margin: 0 0 20px;
}

.voltar-site {
  display: inline-block;
  margin-top: 16px;
  font-size: 13px;
  color: var(--texto-suave);
  text-decoration: none;
}
.voltar-site:hover { color: var(--vinho); }

input[type="password"], input[type="text"], textarea {
  width: 100%;
  background: #fff;
  border: 1px solid var(--creme-escuro);
  color: var(--texto);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 12px;
  font-family: inherit;
}

input:focus, textarea:focus { outline: 2px solid #b8645c; outline-offset: 0; }

textarea {
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}

button {
  background: var(--vinho);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
button:hover { background: var(--vinho-escuro); }
button:disabled { opacity: 0.6; cursor: default; }

button.secundario {
  background: var(--creme-escuro);
  color: var(--texto);
}
button.secundario:hover { background: #ddcfc2; }

button.perigo { background: #8a2e2e; }
button.perigo:hover { background: #6e2222; }

button.claro {
  background: transparent;
  color: var(--creme);
  border: 1px solid rgba(246,240,234,0.6);
  padding: 8px 16px;
  font-size: 13px;
}
button.claro:hover { background: rgba(246,240,234,0.15); }
button.claro.invertido { background: var(--creme); color: #8a1f1b; border-color: var(--creme); }
button.claro.invertido:hover { background: #fff; }

.erro {
  color: #a4303f;
  font-size: 13px;
  min-height: 18px;
  margin-bottom: 8px;
}

/* ---------- Estrutura ---------- */
#app { display: none; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 28px;
  color: var(--creme);
  flex-wrap: wrap;
}

.marca { display: flex; align-items: center; gap: 12px; }
.marca img.logo { width: 42px; height: 42px; }

.marca .titulos h1 {
  font-family: var(--fonte-destaque);
  font-weight: 500;
  font-size: 18px;
  margin: 0;
  line-height: 1.2;
  color: var(--creme);
}
.marca .titulos span { font-size: 12px; color: #e3b9af; }

nav { display: flex; gap: 6px; flex-wrap: wrap; }

nav button {
  background: transparent;
  color: var(--creme);
  border: 1px solid transparent;
  padding: 8px 16px;
  font-size: 13px;
}
nav button:hover { background: rgba(246,240,234,0.12); }
nav button.ativo { background: var(--creme); color: #4a0f0f; }
nav button.secundario {
  background: transparent;
  color: var(--creme);
  border: 1px solid rgba(246,240,234,0.7);
}
nav button.secundario:hover { background: rgba(246,240,234,0.15); }

main {
  padding: 8px 28px 40px;
  max-width: 1050px;
  margin: 0 auto;
}

.pagina { display: none; }
.pagina.ativa { display: block; }

.aviso-pausa-geral {
  background: #fff;
  color: #6e2222;
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 14px;
}

.aviso-saude {
  background: #fff4d6;
  color: #6b4200;
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.5;
}
.aviso-saude.grave { background: #fde2e2; color: #7a1414; }

.barra-acoes {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}
.barra-acoes .resumo { color: #e3b9af; font-size: 13px; }
.barra-acoes .botoes-direita { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Lista de conversas (cartoes brancos) ---------- */
.lista-conversas { display: flex; flex-direction: column; gap: 10px; }

.cartao-conversa {
  background: #fff;
  border-radius: 14px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: transform .12s;
}
.cartao-conversa:hover { transform: translateY(-1px); }

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f3e3e0;
  color: #7a1e1b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--fonte-destaque);
  font-size: 14px;
  flex: none;
}

.cartao-conversa .meio { flex: 1; min-width: 0; }
.cartao-conversa .linha-nome { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cartao-conversa .nome {
  font-family: var(--fonte-destaque);
  font-weight: 500;
  font-size: 15px;
  color: #2a0606;
}
.cartao-conversa .id { font-size: 11px; color: #9a8a82; }
.cartao-conversa .ultima {
  font-size: 13px;
  color: var(--texto-suave);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.cartao-conversa .qtd { font-size: 12px; color: #8a7b72; flex: none; }

.vazio {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  text-align: center;
  color: var(--texto-suave);
}

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
}
.tag.ativa { background: #e3f3e4; color: #1e5a24; }
.tag.pausada { background: #fce4e4; color: #8a1f1b; }
.tag.revisao { background: #fde9c9; color: #7a4a00; }
.tag.docs { background: #fff1d6; color: #7a4a00; }
.tag.contrato { background: #e5ecfb; color: #1e3f8a; }
.tag.enviado { background: #e3f3e4; color: #1e5a24; }

/* ---------- Cartoes brancos (configuracoes / editor) ---------- */
.cartao {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 16px;
}

h2.destaque {
  font-family: var(--fonte-destaque);
  font-weight: 500;
  font-size: 19px;
  color: var(--vinho);
  margin: 0 0 12px;
}

.ajuda { font-size: 13px; color: var(--texto-suave); line-height: 1.5; margin: 0 0 14px; }

label {
  font-size: 13px;
  color: var(--texto-suave);
  display: block;
  margin-bottom: 6px;
}

.campo { margin-bottom: 20px; }
.linha-botoes { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.salvo-ok { color: #1f7a44; font-size: 13px; }

.editor-status { margin-top: 14px; font-size: 14px; color: var(--texto-suave); }
.editor-status.erro-box { color: #a4303f; }
.resumo-editor {
  background: #f9f3ee;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 16px 0 12px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}
details { margin-bottom: 14px; font-size: 13px; }
details summary { cursor: pointer; color: var(--vinho); margin-bottom: 8px; }
pre {
  background: #1e1414;
  color: #f1e6e0;
  border-radius: 10px;
  padding: 12px;
  overflow: auto;
  max-height: 340px;
  font-size: 12px;
  line-height: 1.45;
}

/* ---------- Modal da conversa ---------- */
#modal-conversa {
  position: fixed;
  inset: 0;
  background: rgba(30,8,8,0.65);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#modal-conversa.aberto { display: flex; }

.modal-caixa {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-caixa h2 {
  font-family: var(--fonte-destaque);
  font-weight: 500;
  margin: 0;
  font-size: 17px;
  word-break: break-word;
  color: var(--vinho);
}

#historico-conversa {
  overflow-y: auto;
  flex: 1;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--creme-escuro);
  border-radius: 12px;
  padding: 12px;
  min-height: 200px;
}

.balao {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.balao.cliente {
  align-self: flex-start;
  background: #f4efea;
  color: var(--texto);
}
.balao.izabella {
  align-self: flex-end;
  background: var(--vinho);
  color: var(--creme);
}

.resposta-manual { display: flex; gap: 8px; margin-bottom: 12px; }
.resposta-manual textarea { margin-bottom: 0; flex: 1; }
.resposta-manual button { align-self: flex-end; }

.modal-acoes { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Celular ---------- */
@media (max-width: 700px) {
  header { padding: 14px 16px; }
  nav { width: 100%; }
  nav button { flex: 1 1 auto; padding: 8px 10px; }
  main { padding: 6px 14px 32px; }
  .cartao { padding: 18px; }
  .cartao-conversa { padding: 10px 12px; gap: 10px; }
  .cartao-conversa .qtd { display: none; }
  .barra-acoes .botoes-direita { width: 100%; }
  .barra-acoes .botoes-direita button { flex: 1; }
  .modal-caixa { padding: 16px; max-height: 94vh; }
  .balao { max-width: 90%; }
  .resposta-manual { flex-direction: column; }
}
