* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #f4f5f7;
  color: #1a1a1a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Layout em grid de 3 linhas (header / tabs / conteúdo) preenchendo exatamente a altura da
   tela, sem "números mágicos" de px a subtrair — se o header ou as abas mudarem de altura no
   futuro, o conteúdo se ajusta sozinho. 100dvh (onde suportado) evita que a barra de endereço
   do navegador do celular corte o rodapé, já que ela conta a altura visível de verdade. */
body {
  display: grid;
  grid-template-rows: auto auto 1fr;
  height: 100vh;
  height: 100dvh;
}

header {
  background: #1f2937;
  color: white;
  padding: 18px 16px;
  text-align: center;
}
header h1 { margin: 0; font-size: 1.25rem; }
.subtitle { margin: 4px 0 0; opacity: 0.75; font-size: 0.85rem; }

.tabs {
  display: flex;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
  border-bottom: 1px solid #e2e2e2;
  background: white;
}
.tab-btn {
  flex: 1;
  border: none;
  background: none;
  padding: 12px 8px;
  font-size: 0.95rem;
  font-family: inherit;
  color: #666;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab-btn.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
  font-weight: 600;
}

main {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.intro { font-weight: 600; margin: 4px 0 14px; }

.persona-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.persona-card {
  text-align: left;
  background: white;
  border: 1px solid #e2e2e2;
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  font-size: 0.95rem;
  font-family: inherit;
}
.persona-card:active { background: #eef2ff; }
.persona-card .cargo { color: #555; font-size: 0.85rem; }
.persona-card .teaser { color: #888; font-size: 0.82rem; }

.chat-log {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 12px;
  min-height: 200px;
}
.msg {
  padding: 10px 12px;
  border-radius: 12px;
  max-width: 85%;
  font-size: 0.95rem;
  white-space: pre-wrap;
  line-height: 1.4;
}
.msg.scene {
  align-self: center;
  background: transparent;
  color: #888;
  font-style: italic;
  text-align: center;
  max-width: 100%;
  font-size: 0.85rem;
}
.msg.user {
  align-self: flex-end;
  background: #2563eb;
  color: white;
}
.msg.assistant {
  align-self: flex-start;
  background: white;
  border: 1px solid #e2e2e2;
}
.msg.loading { opacity: 0.6; }
.msg.error {
  align-self: center;
  background: #fee2e2;
  color: #991b1b;
  font-size: 0.85rem;
}

.chat-input {
  border-top: 1px solid #e2e2e2;
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
textarea {
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 10px;
  font-size: 1rem;
  resize: none;
  font-family: inherit;
}
.chat-actions { display: flex; gap: 8px; }
.mic-hint {
  min-height: 16px;
  margin: 0;
  font-size: 0.78rem;
  color: #2563eb;
}
.icon-btn {
  font-size: 1.3rem;
  background: white;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
}
.icon-btn.listening { background: #fee2e2; border-color: #ef4444; }
.primary-btn {
  flex: 1;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 1rem;
  cursor: pointer;
}
.primary-btn:disabled { opacity: 0.6; }
.end-btn {
  background: #f3f4f6;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  color: #444;
}

.save-status {
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: 8px;
  margin: 0 0 12px;
}
.save-ok { background: #dcfce7; color: #166534; }
.save-fail { background: #fef3c7; color: #92400e; }

.eval-report {
  background: white;
  border-radius: 10px;
  padding: 16px;
  border: 1px solid #e2e2e2;
  overflow-x: auto;
}
.eval-report table { border-collapse: collapse; width: 100%; margin: 10px 0; }
.eval-report th, .eval-report td { border: 1px solid #ddd; padding: 6px 8px; text-align: left; font-size: 0.88rem; }
.eval-report h2 { font-size: 1.05rem; margin: 18px 0 8px; }
.eval-report ul, .eval-report ol { padding-left: 20px; }
.eval-report p { margin: 8px 0; line-height: 1.5; }
.eval-actions { margin-top: 16px; }

.copiloto-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.copiloto-form label {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: -6px;
}
.copiloto-form textarea {
  min-height: 160px;
  font-family: inherit;
}
.copiloto-form input[type="text"] {
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 10px;
  font-size: 1rem;
  font-family: inherit;
}
.copiloto-hint {
  font-size: 0.8rem;
  color: #888;
  margin: -6px 0 0;
}
.copiloto-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.secondary-btn {
  background: white;
  color: #2563eb;
  border: 1px solid #2563eb;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.95rem;
  cursor: pointer;
}

.nome-field {
  margin-bottom: 14px;
}
.nome-field label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 6px;
}
.nome-field input {
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 10px;
  font-size: 1rem;
  font-family: inherit;
}

.dash-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.dash-card {
  background: white;
  border: 1px solid #e2e2e2;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dash-stat { font-size: 0.85rem; color: #555; }

.dash-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dash-row {
  background: white;
  border: 1px solid #e2e2e2;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}
.dash-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}
.dash-row-nota {
  font-size: 0.85rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #444;
}
.dash-faixa-critico { background: #fee2e2; color: #991b1b; }
.dash-faixa-desenvolvimento { background: #fef3c7; color: #92400e; }
.dash-faixa-bom { background: #dcfce7; color: #166534; }
.dash-faixa-excelente { background: #dbeafe; color: #1e40af; }
.dash-row-sub {
  font-size: 0.82rem;
  color: #888;
  margin-top: 2px;
}
.dash-row-detail {
  margin: -4px 0 4px;
  border-radius: 0 0 10px 10px;
  border-top: none;
}

.back-link {
  background: none;
  border: none;
  color: #2563eb;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0 0 12px;
  text-align: left;
  align-self: flex-start;
}
