* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0f1115;
  color: #e6e6e6;
  height: 100vh;
  overflow: hidden;
}

.oculto { display: none !important; }

/* Login */
.tela-login {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-login {
  background: #1a1d24;
  padding: 32px;
  border-radius: 12px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}
.card-login h1 { margin: 0 0 8px; font-size: 20px; text-align: center; }
.card-login input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #333;
  background: #0f1115;
  color: #e6e6e6;
}
.card-login button {
  padding: 10px;
  border-radius: 8px;
  border: none;
  background: #1e88e5;
  color: white;
  font-weight: 600;
  cursor: pointer;
}
.card-login button:hover { background: #1976d2; }
.erro { color: #ef5350; font-size: 13px; min-height: 16px; margin: 0; }

/* App */
.app {
  display: flex;
  height: 100vh;
}

.lista-conversas {
  width: 320px;
  background: #14161c;
  border-right: 1px solid #22252c;
  display: flex;
  flex-direction: column;
}
.topo-lista {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #22252c;
}
#btn-sair {
  background: none;
  border: 1px solid #333;
  color: #aaa;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}

#conversas { overflow-y: auto; flex: 1; }
.item-conversa {
  padding: 14px 16px;
  border-bottom: 1px solid #1d2027;
  cursor: pointer;
}
.item-conversa:hover { background: #1a1d24; }
.item-conversa.ativa { background: #1e293b; }
.item-conversa .nome { font-weight: 600; font-size: 14px; }
.item-conversa .telefone { font-size: 12px; color: #888; }
.item-conversa .preview {
  font-size: 12px;
  color: #999;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 4px;
}
.tag-status {
  display: inline-block;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  margin-top: 6px;
}
.tag-ia { background: #123524; color: #4caf50; }
.tag-humano { background: #3a2e12; color: #ffb74d; }

/* Chat */
.painel-chat { flex: 1; display: flex; flex-direction: column; }
.chat-vazio {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
}
.chat-ativo { flex: 1; display: flex; flex-direction: column; height: 100%; }
.chat-header {
  padding: 14px 20px;
  border-bottom: 1px solid #22252c;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chat-header .telefone { color: #888; font-size: 12px; margin-left: 8px; }
.chat-status { display: flex; align-items: center; gap: 8px; }
.badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
}
.badge.ia_ativa { background: #123524; color: #4caf50; }
.badge.pausada_humano { background: #3a2e12; color: #ffb74d; }

.chat-status button {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #333;
  background: #1a1d24;
  color: #e6e6e6;
  cursor: pointer;
}
.chat-status button:hover { background: #23262e; }

.mensagens {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bolha {
  max-width: 60%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
}
.bolha .meta { font-size: 10px; opacity: 0.7; margin-top: 4px; }
.bolha.lead { align-self: flex-start; background: #22252c; }
.bolha.ia { align-self: flex-end; background: #123524; }
.bolha.humano { align-self: flex-end; background: #123a52; }

.form-enviar {
  display: flex;
  padding: 14px;
  gap: 10px;
  border-top: 1px solid #22252c;
}
.form-enviar input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #333;
  background: #0f1115;
  color: #e6e6e6;
}
.form-enviar button {
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  background: #1e88e5;
  color: white;
  font-weight: 600;
  cursor: pointer;
}
.form-enviar button:hover { background: #1976d2; }
