/* Balão de IA. Usa os tokens do design system de styles.css. */
.chat-abrir {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.1rem;
  border: 1px solid var(--border-teal);
  border-radius: var(--radius-pill);
  background: var(--surface-elevated);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.chat-abrir:focus-visible,
.chat-painel button:focus-visible,
.chat-painel input:focus-visible {
  outline: 3px solid var(--accent-teal);
  outline-offset: 2px;
}
.chat-painel {
  position: fixed;
  right: 1rem;
  bottom: 4.5rem;
  z-index: 50;
  width: min(360px, calc(100vw - 2rem));
  max-height: min(520px, calc(100vh - 6rem));
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.chat-painel[hidden] { display: none; }
.chat-cabeca {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.chat-cabeca strong { font-family: var(--font-display); }
.chat-fechar {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 220px;
}
.chat-msg {
  max-width: 88%;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.chat-msg-bot {
  align-self: flex-start;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
}
.chat-msg-usuario {
  align-self: flex-end;
  background: var(--gradient-accent);
  color: var(--on-accent);
}
.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}
.chat-form input {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  color: var(--text);
  font: inherit;
}
.chat-form button {
  padding: 0.6rem 0.9rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--gradient-accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.chat-form button:disabled { opacity: 0.6; cursor: wait; }
.chat-aviso {
  margin: 0;
  padding: 0 0.75rem 0.75rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}
@media (max-width: 480px) {
  .chat-abrir { right: 0.75rem; bottom: 0.75rem; }
  .chat-painel { right: 0.75rem; left: 0.75rem; width: auto; bottom: 4.25rem; }
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
