﻿/* =====================================================================
   Sytrion Portal — identidade aplicada sobre o Bootstrap.
   Fundo claro, muito ar, roxo só como acento.
   ===================================================================== */

:root {
  --ink: #17171a;
  --muted: #56565f;
  --white: #ffffff;
  --surface: #f6f5f8;
  --line: #e9e8ee;
  --violet: #7c3aed;
  --violet-deep: #6d28d9;
  --violet-soft: #f1ecfd;

  --font-sans: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Space Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius-btn: 9px;
  --radius-card: 13px;
  --container: 1080px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--white);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: var(--container); margin-inline: auto; padding-inline: 24px; }

h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.01em; color: var(--ink); margin: 0; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

a { color: var(--violet); text-decoration: none; }
a:hover { color: var(--violet-deep); text-decoration: underline; }

.mono { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.02em; }
.texto-suave { color: var(--muted); }
.texto-mini { font-size: 0.85rem; }

/* ------------------------------- Topo -------------------------------- */

.topo {
  border-bottom: 1px solid var(--line);
  background: var(--white);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topo__linha {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 68px;
  flex-wrap: nowrap;
}

.marca {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ink);
  letter-spacing: -0.02em;
  white-space: nowrap;
  flex: 0 0 auto;
}
.marca__y { color: var(--violet); }
.marca:hover { color: var(--ink); text-decoration: none; }
.marca__tag {
  color: var(--violet);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
  margin-left: 6px;
  vertical-align: middle;
}

.menu {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.menu__lista {
  list-style: none;
  display: flex;
  gap: 2px;
  margin: 0;
  padding: 0;
  min-width: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.menu__lista::-webkit-scrollbar { display: none; }

.menu__link {
  display: inline-block;
  white-space: nowrap;
  padding: 7px 10px;
  border-radius: var(--radius-btn);
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 500;
}
.menu__link:hover { background: var(--surface); color: var(--ink); text-decoration: none; }
.menu__link--ativo { background: var(--violet-soft); color: var(--violet-deep); }

.usuario-chip { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.usuario-chip__nome {
  font-weight: 500;
  font-size: 0.92rem;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.usuario-chip__perfil { color: var(--muted); white-space: nowrap; }
.form-sair { margin: 0; }
.btn-sair {
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: var(--radius-btn);
  padding: 6px 12px;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
}
.btn-sair:hover { border-color: var(--violet); color: var(--violet-deep); }

.menu-botao {
  display: none;
  margin-left: auto;
  width: 40px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  background: var(--white);
  cursor: pointer;
  position: relative;
}
.menu-botao__barra,
.menu-botao__barra::before,
.menu-botao__barra::after {
  content: "";
  position: absolute;
  left: 11px;
  width: 16px;
  height: 1.5px;
  background: var(--ink);
}
.menu-botao__barra { top: 16px; }
.menu-botao__barra::before { top: -5px; left: 0; }
.menu-botao__barra::after { top: 5px; left: 0; }

@media (max-width: 860px) {
  .topo__linha { flex-wrap: wrap; }
  .menu-botao { display: block; }
  .menu__lista { flex-wrap: nowrap; overflow-x: visible; }
  .usuario-chip__nome { max-width: none; }
  .menu { display: none; flex-direction: column; align-items: flex-start; width: 100%; padding-bottom: 14px; }
  .menu--aberto { display: flex; }
  .menu__lista { flex-direction: column; width: 100%; }
  .menu__link { display: block; }
  .usuario-chip { padding-top: 10px; }
}

/* ----------------------------- Conteúdo ------------------------------ */

.conteudo { padding-block: 40px 72px; min-height: 60vh; }

.cabecalho-pagina {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.cabecalho-pagina p { margin: 4px 0 0; color: var(--muted); font-size: 0.94rem; }

.olho { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase;
        letter-spacing: 0.09em; color: var(--violet); margin-bottom: 6px; }

/* ------------------------------ Cartões ------------------------------ */

.cartao {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 22px;
}
.cartao + .cartao { margin-top: 18px; }
.cartao__titulo {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}

.grade { display: grid; gap: 18px; }
.grade--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grade--3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grade--4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.metrica {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 18px;
}
.metrica__valor { font-size: 1.9rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.metrica__rotulo { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase;
                   letter-spacing: 0.08em; color: var(--muted); margin-top: 6px; }

/* ------------------------------- Selos ------------------------------- */

.selo {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  white-space: nowrap;
}
.selo--ativo  { background: var(--violet-soft); color: var(--violet-deep); border-color: #ddd0fa; }
.selo--espera { background: #fff6e6; color: #8a5a00; border-color: #f2e2c4; }
.selo--pausa  { background: #f3f3f5; color: #56565f; }
.selo--ok     { background: #e9f7ef; color: #1c6b41; border-color: #cfead9; }
.selo--fim    { background: #f6f5f8; color: #7a7a84; }

/* ------------------------------ Tabelas ------------------------------ */

.tabela-rolagem { overflow-x: auto; }

.tabela { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
.tabela th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 400;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tabela td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabela tr:last-child td { border-bottom: 0; }
.tabela tbody tr:hover { background: var(--surface); }
.tabela .acoes { text-align: right; white-space: nowrap; }

.vazio { text-align: center; padding: 44px 16px; color: var(--muted); }

/* ----------------------------- Formulários --------------------------- */

.form-rotulo {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--ink);
}

.campo {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 0.96rem;
  color: var(--ink);
  background: var(--white);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.campo:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}
textarea.campo { min-height: 120px; resize: vertical; line-height: 1.55; }
select.campo { appearance: none; background-image: none; }

.grupo { margin-bottom: 18px; }
.ajuda { font-size: 0.82rem; color: var(--muted); margin-top: 6px; }

.filtros { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filtros .grupo { margin-bottom: 0; }

/* ------------------------------- Botões ------------------------------ */

.btn {
  display: inline-block;
  border-radius: var(--radius-btn);
  padding: 10px 18px;
  font-size: 0.94rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn-roxo { background: var(--violet); color: var(--white); }
.btn-roxo:hover { background: var(--violet-deep); color: var(--white); }
.btn-linha { background: var(--white); color: var(--ink); border-color: var(--line); }
.btn-linha:hover { border-color: var(--violet); color: var(--violet-deep); }
.btn-perigo { background: var(--white); color: #a1232b; border-color: #eccfd2; }
.btn-perigo:hover { background: #a1232b; color: var(--white); border-color: #a1232b; }
.btn-mini { padding: 6px 12px; font-size: 0.85rem; }
.btn-largo { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.acoes-linha { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ------------------------------ Alertas ------------------------------ */

.alerta {
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  padding: 12px 16px;
  font-size: 0.93rem;
  margin-bottom: 20px;
}
.alert-success { background: #e9f7ef; border-color: #cfead9; color: #1c6b41; }
.alert-danger  { background: #fdecee; border-color: #f6d3d7; color: #8f1f28; }
.alert-warning { background: #fff6e6; border-color: #f2e2c4; color: #7a5200; }
.alert-secondary { background: var(--surface); color: var(--muted); }

/* ------------------------- Telas públicas ---------------------------- */

.pagina-publica {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  padding: 40px 20px;
}

.caixa-publica {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 40px 34px;
}
.caixa-publica--larga { max-width: 520px; }
.caixa-publica h1 { font-size: 1.4rem; margin-bottom: 6px; }
.caixa-publica .marca { display: inline-block; margin-bottom: 22px; }

.rodape-publico { text-align: center; margin-top: 20px; font-size: 0.88rem; }

/* ------------------------------ Rodapé ------------------------------- */

.rodape { border-top: 1px solid var(--line); background: var(--white); }
.rodape__linha {
  display: flex; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; padding-block: 22px; font-size: 0.85rem; color: var(--muted);
}

/* --------------------------- Página de erro -------------------------- */

.pagina-erro {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--surface); padding: 24px;
}
.erro-caixa {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-card);
  padding: 44px 38px; max-width: 480px; text-align: center;
}
.erro-codigo { color: var(--violet); margin-bottom: 4px; }
.erro-caixa h1 { font-size: 1.35rem; margin-bottom: 10px; }
.erro-caixa .btn { margin-top: 22px; }
.erro-detalhe {
  background: var(--surface); border-radius: 8px; padding: 10px 12px;
  color: var(--muted); word-break: break-word; text-align: left;
}

/* ------------------------ Blocos específicos ------------------------- */

.dados { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 20px; }
.dado__rotulo { font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase;
                letter-spacing: 0.08em; color: var(--muted); }
.dado__valor { font-size: 0.98rem; margin-top: 3px; }

.codigo-convite {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-btn); padding: 10px 12px;
}
.codigo-convite input {
  flex: 1; min-width: 220px; border: 0; background: transparent;
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink);
}
.codigo-convite input:focus { outline: none; }

.linha-etapas { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.etapa-passo {
  flex: 1; min-width: 110px; border: 1px solid var(--line); border-radius: var(--radius-btn);
  padding: 10px 12px; font-size: 0.85rem; color: var(--muted); background: var(--white);
}
.etapa-passo--feita { background: var(--surface); }
.etapa-passo--atual { border-color: var(--violet); background: var(--violet-soft); color: var(--violet-deep); font-weight: 600; }

.perigo-zona { border-color: #eccfd2; background: #fffafa; }

.separador { border: 0; border-top: 1px solid var(--line); margin: 26px 0; }

.espaco-topo { margin-top: 18px; }
.espaco-topo-g { margin-top: 30px; }

[hidden] { display: none !important; }

/* ============================ Fase 2 — chat =========================== */

.visualmente-oculto {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.badge-novas {
  display: inline-block;
  min-width: 20px;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--violet);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.5;
  text-align: center;
  vertical-align: middle;
}

/* ----------------------------- Estrutura ----------------------------- */

.chat {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 460px;
  max-height: calc(100vh - 230px);
}

.chat__janela {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.chat__historico {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  scroll-behavior: smooth;
}

.chat__mais { text-align: center; margin: 0; }

/* ------------------------- Separadores de dia ------------------------ */

.dia {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 2px;
  color: var(--muted);
}
.dia::before, .dia::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.dia span {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 12px;
}

.novas-aqui {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0;
  color: var(--violet-deep);
}
.novas-aqui::before, .novas-aqui::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--violet);
  opacity: 0.45;
}
.novas-aqui span {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ------------------------------ Balões ------------------------------- */

.msg {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  max-width: 100%;
}

.msg--minha { flex-direction: row-reverse; }

.msg--seguida { margin-top: -9px; }
.msg--seguida .msg__avatar { visibility: hidden; }
.msg--seguida .msg__cabeca { display: none; }

.msg__avatar {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--violet-soft);
  color: var(--violet-deep);
  border: 1px solid #ddd0fa;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.msg__bloco {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  max-width: min(78%, 560px);
}
.msg--minha .msg__bloco { align-items: flex-end; }

.msg__cabeca {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  padding-inline: 2px;
}
.msg__autor { font-weight: 600; font-size: 0.85rem; }

.msg__balao {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px 14px 14px 4px;
  padding: 9px 13px 7px;
  min-width: 0;
}
.msg--minha .msg__balao {
  background: var(--violet-soft);
  border-color: #ddd0fa;
  border-radius: 14px 14px 4px 14px;
}
.msg--seguida .msg__balao { border-radius: 14px; }

.msg__corpo {
  font-size: 0.94rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg__corpo--removida { color: var(--muted); font-style: italic; }

.msg__pe {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 3px;
}

.msg__hora,
.msg__estado {
  font-family: var(--font-mono);
  font-size: 0.63rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.msg__estado--erro { color: #a1232b; }

.btn-remover,
.msg__repetir {
  border: 0;
  background: none;
  padding: 0;
  font-size: 0.7rem;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
}
.btn-remover:hover { color: #a1232b; }
.msg__repetir { color: var(--violet-deep); font-weight: 600; }

.msg__acao { margin: 0; }

.msg--removida .msg__balao { border-style: dashed; background: var(--surface); }
.msg--pendente { opacity: 0.65; }
.msg--falhou { opacity: 1; }
.msg--falhou .msg__balao { border-color: #eccfd2; background: #fffafa; }
.msg__anexo-pendente {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 4px;
  overflow-wrap: anywhere;
}

/* ------------------------------ Anexos ------------------------------- */

.anexos {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.anexo__imagem { display: block; }
.anexo__imagem img {
  max-width: 100%;
  max-height: 230px;
  border-radius: 9px;
  border: 1px solid var(--line);
  display: block;
}

.anexo__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.76rem;
  margin-top: 5px;
}

.anexo__nome { overflow-wrap: anywhere; }
.anexo__tamanho { color: var(--muted); }

.anexo__tipo {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 6px;
  color: var(--violet-deep);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
}

.anexo__arquivo {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 11px;
  background: var(--white);
  font-size: 0.82rem;
  color: var(--ink);
}
.anexo__arquivo:hover { border-color: var(--violet); text-decoration: none; }

.anexo__audio { display: flex; flex-direction: column; gap: 6px; }
.anexo__audio audio { width: 100%; max-width: 320px; height: 36px; }

/* ---------------------- Pílula, overlay, vazio ----------------------- */

.chat__descer {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--violet);
  color: var(--white);
  border: 0;
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.25);
}
.chat__descer:hover { background: var(--violet-deep); }

.chat__solte {
  position: absolute;
  inset: 6px;
  border: 2px dashed var(--violet);
  border-radius: var(--radius-card);
  background: rgba(241, 236, 253, 0.92);
  color: var(--violet-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.95rem;
  pointer-events: none;
  z-index: 3;
}

.chat__vazio {
  margin: auto;
  text-align: center;
  padding: 30px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.chat__vazio h3 { font-size: 1.02rem; }
.chat__vazio-marca {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--violet-soft);
  color: var(--violet-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

/* ---------------------------- Compositor ----------------------------- */

.compositor {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--white);
  padding: 10px 12px;
}
.compositor:focus-within { border-color: var(--violet); }

.compositor__chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
  padding: 0;
}

.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 5px 8px;
  font-size: 0.78rem;
  max-width: 230px;
}
.chip__mini { width: 30px; height: 30px; object-fit: cover; border-radius: 6px; display: block; }
.chip__tipo {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 3px 6px;
  color: var(--violet-deep);
  font-size: 0.6rem;
}
.chip__nome {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chip__remover {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}
.chip__remover:hover { color: #a1232b; }

.compositor__campo {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.compositor__arquivo {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  overflow: hidden;
}

.compositor__botao {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.compositor__botao:hover { border-color: var(--violet); color: var(--violet-deep); }
.compositor__arquivo:focus-visible + .compositor__botao,
.compositor__botao:focus-visible {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.14);
}

.compositor__enviar {
  background: var(--violet);
  border-color: var(--violet);
  color: var(--white);
}
.compositor__enviar:hover { background: var(--violet-deep); border-color: var(--violet-deep); color: var(--white); }
.compositor__enviar:disabled { opacity: 0.55; cursor: not-allowed; }

.compositor__texto {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  resize: none;
  padding: 9px 4px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink);
  background: transparent;
  max-height: 170px;
  overflow-y: auto;
}

.compositor__progresso {
  height: 3px;
  background: var(--line);
  border-radius: 999px;
  margin-top: 9px;
  overflow: hidden;
}
.compositor__progresso span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--violet);
  transition: width 0.15s linear;
}

.compositor__erro { color: #8f1f28; font-size: 0.82rem; margin: 8px 0 0; }

.compositor__dica {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 8px 0 0;
}
.compositor__dica .mono {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.66rem;
}

.chat__fechado {
  border: 1px dashed var(--line);
  border-radius: var(--radius-card);
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
}

/* ---------------------------- Responsivo ----------------------------- */

@media (max-width: 780px) {
  .chat {
    max-height: none;
    height: calc(100vh - 190px);
    min-height: 380px;
  }
  .chat__historico { padding: 14px; gap: 12px; }
  .msg__bloco { max-width: 86%; }
  .compositor__dica { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .chat__historico { scroll-behavior: auto; }
  .compositor__progresso span { transition: none; }
}

/* ================== Fase 3 — questionários e arquivos ================= */

/* ---------------------------- Gravador ------------------------------- */

.gravador {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.gravador--compacto { margin-top: 0; }

.gravador__estado {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--violet-soft);
  border: 1px solid #ddd0fa;
  border-radius: 999px;
  padding: 4px 11px;
  color: var(--violet-deep);
}

.gravador__ponto {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--violet);
  animation: pulso 1.2s ease-in-out infinite;
}

@keyframes pulso {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.35; transform: scale(0.8); }
}

.gravador--ativo .compositor__parar { color: var(--violet-deep); border-color: var(--violet); }
.gravador__erro { color: #8f1f28; width: 100%; }

@media (prefers-reduced-motion: reduce) {
  .gravador__ponto { animation: none; }
}

/* --------------------------- Perguntas ------------------------------- */

.pergunta {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.pergunta:last-of-type { border-bottom: 0; padding-bottom: 0; }

.pergunta__enunciado {
  display: block;
  font-weight: 600;
  font-size: 0.97rem;
  margin-bottom: 4px;
}

.pergunta__obrigatoria { color: var(--violet); font-weight: 700; }

.opcoes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.opcao {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.93rem;
  cursor: pointer;
}
.opcao input { accent-color: var(--violet); width: 16px; height: 16px; }

.campo-opcao + .campo-opcao { margin-top: 8px; }

.lista-arquivos {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.lista-arquivos__item {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* ---------------------- Construtor de perguntas ---------------------- */

.perguntas {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: pergunta;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pergunta-item {
  counter-increment: pergunta;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  background: var(--white);
}

.pergunta-item__topo {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.pergunta-item__topo > div:first-child::before {
  content: counter(pergunta) ". ";
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--violet);
}

.pergunta-item__editar { margin-top: 12px; }
.pergunta-item__editar summary {
  cursor: pointer;
  font-size: 0.84rem;
  color: var(--violet-deep);
}
.pergunta-item__editar[open] {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

/* ---------------------------- Respostas ------------------------------ */

.resposta {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.resposta:last-of-type { border-bottom: 0; padding-bottom: 0; }

.resposta__pergunta {
  display: flex;
  align-items: baseline;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.resposta__tipo {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 7px;
  color: var(--violet-deep);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.resposta__valor {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.94rem;
}

.resposta__lista { margin: 0; padding-left: 20px; font-size: 0.94rem; }
.resposta__lista li::marker { color: var(--violet); }

.resposta__vazia { color: var(--muted); font-style: italic; font-size: 0.9rem; }
.resposta__autor { color: var(--muted); margin-top: 6px; }

.grupo-arquivos {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--violet);
  margin: 22px 0 8px;
}
.grupo-arquivos:first-of-type { margin-top: 0; }

/* ==================== Fase 4 — contexto de prévia ==================== */

.msg__contexto {
  display: block;
  font-size: 0.64rem;
  color: var(--violet-deep);
  background: var(--violet-soft);
  border: 1px solid #ddd0fa;
  border-radius: 6px;
  padding: 3px 8px;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}
.msg--minha .msg__contexto { background: var(--white); }

.editor-codigo {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.55;
  min-height: 420px;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
  tab-size: 2;
}
