/* Cores e escalas vêm de tokens.css (partilhado com o backoffice). */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
.chat {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 640px;
  margin: 0 auto;
  background: var(--surface);
  border-inline: 1px solid var(--border);
}
.chat__header { padding: 16px; border-bottom: 1px solid var(--border); }
.chat__header h1 { margin: 0; font-size: 1.15rem; }
.chat__header p { margin: 2px 0 0; font-size: 0.85rem; color: var(--muted); }
.chat__log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg--bot { align-self: flex-start; background: var(--bot); }
.msg--user { align-self: flex-end; background: var(--accent); color: var(--accent-text); }
.msg--error { align-self: flex-start; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; color: var(--error); border: 1px solid var(--error); }
.msg--falhou { outline: 1px dashed var(--error); outline-offset: 2px; }
.msg--pending { color: var(--muted); font-style: italic; }
.chat__form { display: flex; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
.chat__form input {
  flex: 1;
  min-width: 0;
  padding: 12px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-control);
  border-radius: 10px;
}
.chat__form button {
  padding: 12px 18px;
  font: inherit;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
.msg--error button { font: inherit; font-size: 0.9rem; font-weight: 600; padding: 6px 12px; color: var(--text); background: var(--bot); border: 1px solid var(--border-control); border-radius: 8px; cursor: pointer; }
.chat__form button:disabled, .chat__form input:disabled { opacity: 0.6; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
