:root {
  --bg: #08090c;
  --bg-lift: #10131a;
  --fg: #e6e9ef;
  --fg-dim: #7d8595;
  --fg-faint: #4a5160;
  --line: #1a1d25;
  --line-hi: #2c3140;
  --accent: #7fd3c1;
  --erro: #e07a7a;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --sans: "Inter", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.marca {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--fg-dim);
}

.ponto {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

button {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-dim);
  background: transparent;
  border: 1px solid var(--line-hi);
  padding: 8px 12px;
  cursor: pointer;
}

button:hover:not(:disabled) {
  color: var(--fg);
  border-color: var(--accent);
}

button:disabled {
  opacity: 0.4;
  cursor: default;
}

main {
  flex: 1;
  overflow-y: auto;
  padding: 24px 16px;
}

.vazio {
  max-width: 760px;
  margin: 12vh auto 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--fg-dim);
}

.msg {
  max-width: 760px;
  margin: 0 auto 22px;
}

.papel {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin-bottom: 6px;
}

.msg.assistant .papel { color: var(--accent); }

.corpo {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.65;
  padding-left: 12px;
  border-left: 1px solid var(--line-hi);
}

.msg.assistant .corpo { border-left-color: var(--accent); }
.corpo.erro { color: var(--erro); border-left-color: var(--erro); }

.corpo.ativo::after {
  content: "\258D";
  color: var(--accent);
  animation: piscar 1s steps(2) infinite;
}

.corpo img {
  display: block;
  max-width: 220px;
  max-height: 160px;
  margin-bottom: 8px;
  border: 1px solid var(--line-hi);
}

@keyframes piscar { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .corpo.ativo::after { animation: none; }
}

footer {
  border-top: 1px solid var(--line);
  padding: 12px 16px 14px;
}

footer > * {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

.anexo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-dim);
}

.anexo[hidden] { display: none; }

.anexo img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border: 1px solid var(--line-hi);
}

.status {
  min-height: 16px;
  margin-top: 0;
  margin-bottom: 6px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
}

.status.erro { color: var(--erro); }

form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

textarea {
  flex: 1;
  resize: none;
  max-height: 160px;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.4;
  color: var(--fg);
  background: var(--bg-lift);
  border: 1px solid var(--line-hi);
  padding: 9px 12px;
}

textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.aviso {
  margin-top: 10px;
  margin-bottom: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--fg-faint);
}

@media (max-width: 520px) {
  form { flex-wrap: wrap; }
  textarea { flex-basis: 100%; order: -1; }
  form button { flex: 1; }
}
