* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #f1f5f9;
  color: #1e293b;
}
#app { max-width: 720px; margin: 0 auto; height: 100vh; display: flex; flex-direction: column; }

.topo {
  padding: 16px 20px;
  background: #4f46e5;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topo .titulo { font-size: 17px; font-weight: 700; }
.topo a {
  color: #fff;
  font-size: 12px;
  text-decoration: underline;
  opacity: .9;
}

.aviso {
  margin: 40px 20px;
  background: #fee2e2;
  color: #991b1b;
  padding: 16px 18px;
  border-radius: 10px;
  font-size: 14px;
}

main#conversa { flex: 1; display: flex; flex-direction: column; min-height: 0; }

#mensagens {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
}
.msg {
  margin-bottom: 12px;
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.45;
}
.msg-user { background: #4f46e5; color: #fff; align-self: flex-end; border-bottom-right-radius: 3px; }
.msg-ia { background: #fff; color: #1e293b; align-self: flex-start; border: 1px solid #e2e8f0; border-bottom-left-radius: 3px; }
.msg-erro { background: #fee2e2; color: #991b1b; align-self: flex-start; }

#form {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid #e2e8f0;
}
#input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
}
#enviar {
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
#enviar:disabled { opacity: .5; cursor: default; }
