:root {
  --cor-fundo: #f4f5f7;
  --cor-cartao: #ffffff;
  --cor-borda: #dfe3e8;
  --cor-texto: #1f2933;
  --cor-primaria: #2563eb;
  --cor-erro: #b91c1c;
  --cor-sucesso: #15803d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--cor-fundo);
  color: var(--cor-texto);
}

.topo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: #111827;
  color: #fff;
}

.topo-marca { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 1.05em; }
.topo-usuario a { color: #93c5fd; }

.conteudo {
  max-width: 720px;
  margin: 24px auto;
  padding: 0 16px;
}

/* ---------------------------------------------------------------------- */
/* Tela inicial (hero + grade de aplicações) — porta de entrada pro
   Jojofy, pensada pra quem não quer (ou não precisa) falar com o
   Jojo pra abrir uma aplicação (pedido de 08/08/2026). */
/* ---------------------------------------------------------------------- */
.hero {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 4px 28px;
}

.hero-saudacao {
  margin: 0 0 4px;
  font-size: 1.3em;
  font-weight: 600;
}

.hero-tagline {
  margin: 0;
  color: #6b7280;
  font-size: 0.95em;
  max-width: 480px;
}

.apps-grade {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.app-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--cor-cartao);
  border: 1px solid var(--cor-borda);
  border-radius: 10px;
  padding: 16px;
  text-decoration: none;
  color: var(--cor-texto);
  transition: border-color 0.15s;
}
.app-card:hover { border-color: var(--cor-primaria); }

.app-card-indisponivel {
  opacity: 0.55;
  cursor: default;
}

.app-icone { font-size: 1.6em; }
.app-label { font-weight: 600; font-size: 0.95em; }
.app-descricao { font-size: 0.82em; color: #6b7280; }

.apps-vazio { color: #6b7280; font-size: 0.9em; }

/* ---------------------------------------------------------------------- */
/* Chat flutuante — minimizável (pedido de 08/08/2026: "o chat deve ter
   opção de minimizar, caso o usuário não queira interagir"). Vira uma
   bolha no canto quando fechado, um painel quando aberto. */
/* ---------------------------------------------------------------------- */
.chat-bolha {
  display: none;
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--cor-primaria);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  z-index: 60;
}
.chat-bolha:hover { opacity: 0.92; }

.chat-flutuante {
  display: flex;
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 48px);
  z-index: 60;
}

.chat-cartao {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: calc(100vh - 48px);
  padding: 0;
  overflow: hidden;
}

.chat-cabecalho {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #111827;
  padding: 10px 12px;
}
.chat-cabecalho-titulo { color: #fff; font-size: 0.9em; font-weight: 600; flex: 1; }
.btn-minimizar {
  background: transparent;
  border: none;
  color: #93c5fd;
  font-size: 1.3em;
  line-height: 1;
  cursor: pointer;
  padding: 2px 8px;
}
.btn-minimizar:hover { color: #fff; }

.chat-cartao .saudacao-proativa,
.chat-cartao .mensagens,
.chat-cartao .detalhe-log,
.chat-cartao .form-composicao,
.chat-cartao .form-acoes {
  margin-left: 16px;
  margin-right: 16px;
}
.chat-cartao .saudacao-proativa { margin-top: 12px; }
.chat-cartao .form-acoes { margin-bottom: 14px; }
.chat-cartao .mensagens { max-height: 320px; }

.cartao {
  background: var(--cor-cartao);
  border: 1px solid var(--cor-borda);
  border-radius: 8px;
  padding: 20px;
}

.ajuda { color: #6b7280; font-size: 0.9em; }

.form-linhas { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.linha-campo { display: flex; flex-direction: column; gap: 4px; }
.linha-campo label { font-size: 0.85em; font-weight: 600; }
.linha-campo input, .linha-campo select {
  padding: 8px 10px;
  border: 1px solid var(--cor-borda);
  border-radius: 6px;
  font-size: 1em;
}

.form-acoes { margin-top: 8px; }

.btn {
  background: var(--cor-primaria);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 9px 18px;
  font-size: 1em;
  cursor: pointer;
}
.btn:hover { opacity: 0.9; }
.btn-secundario { background: #6b7280; }

.detalhe-upload, .detalhe-log { margin-top: 16px; }
.detalhe-upload summary, .detalhe-log summary { cursor: pointer; color: var(--cor-primaria); }

.login-wrap { display: flex; justify-content: center; margin-top: 60px; }
.login-cartao { width: 320px; }

.flashes { max-width: 720px; margin: 12px auto 0; padding: 0 16px; }
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 8px; }
.flash-erro { background: #fee2e2; color: var(--cor-erro); }
.flash-info { background: #dbeafe; color: #1e3a8a; }

.chat-wrap { display: flex; flex-direction: column; gap: 16px; }

.saudacao-proativa {
  margin: 0 0 4px;
  color: var(--texto-suave, #6b7280);
  font-size: 0.95em;
}


.chat-cartao { display: flex; flex-direction: column; }

.btn-pequeno { padding: 6px 12px; font-size: 0.85em; }

.composicao-linha input:disabled,
.composicao-linha button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-composicao { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }

.composicao-linha {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--cor-borda);
  border-radius: 8px;
  padding: 6px 6px 6px 10px;
}
.composicao-linha input[type="text"] {
  flex: 1;
  border: none;
  outline: none;
  padding: 8px 4px;
  font-size: 1em;
  background: transparent;
}
.btn-anexo {
  background: transparent;
  border: 1px solid var(--cor-borda);
  border-radius: 6px;
  width: 34px;
  height: 34px;
  font-size: 1.1em;
  cursor: pointer;
}
.btn-anexo:hover { background: #f3f4f6; }

.chip-arquivo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  background: #eef2ff;
  color: var(--cor-primaria);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.85em;
}
.chip-arquivo button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 1.1em;
  line-height: 1;
  padding: 0;
}

.opcoes-avancadas {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid var(--cor-borda);
}
.opcoes-avancadas .linha-campo { flex: 1; min-width: 160px; }


.mensagens {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
  padding: 8px 0;
}

.mensagem {
  padding: 10px 14px;
  border-radius: 10px;
  max-width: 85%;
  white-space: pre-wrap;
  font-size: 0.95em;
}

.mensagem-usuario {
  align-self: flex-end;
  background: var(--cor-primaria);
  color: #fff;
}

.mensagem-jojo {
  align-self: flex-start;
  background: #f3f4f6;
}

.mensagem-pausa { border-left: 3px solid #f59e0b; }
.mensagem-sistema { align-self: center; color: var(--cor-sucesso); font-weight: 600; }
.mensagem-erro { align-self: flex-start; background: #fee2e2; color: var(--cor-erro); }

.form-resposta { display: flex; gap: 8px; }
.form-resposta input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--cor-borda);
  border-radius: 6px;
}

#log-tecnico {
  background: #111827;
  color: #d1d5db;
  padding: 12px;
  border-radius: 6px;
  font-size: 0.8em;
  max-height: 240px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* ---------------------------------------------------------------------- */
/* Ícone informativo "i" — mesmo padrão do validador_web (ver
   web/templates/_macros.html -> info_icon()). Qualquer texto de
   comentário/explicação usa isso, em vez de texto solto na tela. */
/* ---------------------------------------------------------------------- */
.info-wrap { position: relative; display: inline-flex; vertical-align: middle; }
.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #eef2ff;
  color: var(--cor-primaria);
  border: 1px solid #d7d9fb;
  font-size: 12px;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.info-btn:hover { background: #e2e5fd; }
.info-popover {
  display: none;
  position: absolute;
  top: 26px;
  left: 0;
  z-index: 40;
  width: 320px;
  max-width: min(80vw, 360px);
  background: #111827;
  color: #e7e8f2;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.55;
  padding: 12px 14px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 16, 24, 0.28);
}
.info-popover.aberta { display: block; }

