/* =============================================================================
   Identidade visual alinhada ao index_fluxo (login SEC-BA / paleta Bahia)
   ============================================================================= */
:root {
  --cor-verde: #2ecc71;
  --cor-amarelo: #f1c40f;
  --cor-vermelho: #e74c3c;
  --bahia-azul: #002776;
  --bahia-azul-claro: #0044cc;
  --logo-laranja: #f47920;
  --logo-verde: #8cbd28;
  --glass-bg: rgba(255, 255, 255, 0.98);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body.cr-body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: "Montserrat", system-ui, sans-serif;
  background: #e8eef5;
  color: #1e293b;
  overflow-x: hidden;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ----- Barra superior (index_fluxo .top-brand-bar) ----- */
.top-brand-bar {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 80px;
  background-color: rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 40px;
  z-index: 1000;
}

.top-brand-bar .brand-text {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--bahia-azul);
}

.top-brand-bar .brand-sub {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
  margin-top: 2px;
}

.brand-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.cr-pill-ferramenta {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
  background: linear-gradient(90deg, var(--logo-laranja), #d6006e);
  padding: 8px 14px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(212, 0, 110, 0.25);
}

@media (max-width: 768px) {
  .top-brand-bar {
    padding: 0 16px;
    flex-wrap: wrap;
    height: auto;
    min-height: 80px;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .cr-pill-ferramenta {
    font-size: 0.65rem;
  }
}

/* ----- Tela estilo login (index_fluxo): fundo em degradê + onda ----- */
.login-screen.cr-login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding-top: 120px;
  position: relative;
  padding-bottom: 48px;
  background: linear-gradient(
    180deg,
    #dfe7f2 0%,
    #e8eef5 28%,
    #f0f2f5 55%,
    #eef1f6 100%
  );
}

.wave-header.wave-large {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 0;
  height: 420px;
  clip-path: polygon(0 0, 100% 0, 100% 85%, 75% 100%, 35% 85%, 0 95%);
  background: linear-gradient(45deg, #d6006e, var(--logo-laranja));
  opacity: 0.96;
}

/* Cartão-hero: volume e sombra no estilo dos cartões institucionais SEC-BA */
.cr-hero-card {
  position: relative;
  z-index: 10;
  width: 90%;
  max-width: 520px;
  margin-bottom: 22px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 39, 118, 0.22),
    0 4px 0 rgba(251, 191, 36, 0.85);
  animation: fadeInUp 0.5s ease-out both;
}

.cr-hero-card-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    125deg,
    rgba(255, 255, 255, 0.2) 0%,
    transparent 42%,
    transparent 58%,
    rgba(255, 255, 255, 0.06) 100%
  );
  pointer-events: none;
}

.cr-hero-card-inner {
  position: relative;
  padding: 26px 28px 28px;
  background: linear-gradient(
    145deg,
    var(--bahia-azul) 0%,
    #003d99 42%,
    #005c97 78%,
    #0a4f7a 100%
  );
  color: #fff;
  text-align: center;
}

.cr-hero-kicker {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #fbbf24;
  margin-bottom: 8px;
}

.cr-hero-title {
  margin: 0 0 12px;
  font-size: clamp(1.25rem, 4vw, 1.55rem);
  font-weight: 800;
  line-height: 1.2;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.cr-hero-desc {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.9);
  font-family: "Roboto", sans-serif;
}

@media (max-width: 768px) {
  .cr-hero-card {
    max-width: 94vw;
    border-radius: 12px;
  }
  .cr-hero-card-inner {
    padding: 20px 18px 22px;
  }
}

/* Faixa de competências — cores do fluxo, sem animação contínua */
.cr-ribbon {
  position: relative;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 22px;
  padding: 0 16px;
  animation: fadeInUp 0.45s ease-out 0.08s both;
}

.cr-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--bahia-azul), #005c97);
  box-shadow: 0 4px 14px rgba(0, 39, 118, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.cr-chip-plus {
  background: linear-gradient(135deg, var(--logo-verde), #005c97);
}

/* Grade das duas caixas (vidro) */
.cr-dual-grid {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  width: 100%;
  max-width: 1100px;
  padding: 0 24px 32px;
  align-items: stretch;
  animation: fadeInUp 0.55s ease-out 0.18s both;
}

@media (min-width: 980px) {
  .cr-dual-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Caixa vidro (index_fluxo .login-box) — largura fluida nesta ferramenta */
.login-box.cr-panel {
  width: 100%;
  max-width: none;
  margin: 0;
  text-align: left;
}

.login-box {
  background: rgba(255, 255, 255, 0.97);
  padding: 36px 32px 40px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0, 39, 118, 0.12),
    0 2px 0 rgba(255, 255, 255, 0.9) inset;
  z-index: 10;
  border: 1px solid rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(14px);
}

.cr-panel-form {
  border-top: 4px solid var(--bahia-azul);
}

.cr-panel-result {
  border-top: 4px solid var(--logo-laranja);
}

.login-title {
  color: var(--logo-laranja);
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 6px;
  display: block;
}

.login-subtitle {
  color: #64748b;
  font-size: 0.9rem;
  margin-bottom: 26px;
  display: block;
  font-weight: 500;
  line-height: 1.45;
}

.cr-field-label {
  display: block;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 8px;
  margin-top: 4px;
}

.cr-field-label:first-of-type {
  margin-top: 0;
}

.login-input {
  width: 100%;
  padding: 15px;
  margin: 0 0 14px 0;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  box-sizing: border-box;
  font-size: 1rem;
  transition: 0.3s;
  background: #f8fafc;
  font-family: "Roboto", sans-serif;
  color: #334155;
}

.login-input:focus {
  outline: none;
  border-color: var(--bahia-azul);
  background: white;
}

.cr-textarea {
  min-height: 260px;
  resize: vertical;
  line-height: 1.5;
  margin-bottom: 18px;
}

.cr-actions {
  margin-top: 8px;
}

.btn-primary.cr-btn-send {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--logo-verde), #005c97);
  color: white;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 6px;
  box-shadow: 0 4px 6px rgba(140, 189, 40, 0.3);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: "Montserrat", sans-serif;
  transition: filter 0.2s, transform 0.2s;
}

.btn-primary.cr-btn-send:hover:not(:disabled) {
  filter: brightness(1.05);
  transform: translateY(-2px);
}

.btn-primary.cr-btn-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.cr-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
}

.cr-btn-ghost {
  padding: 10px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: var(--bahia-azul);
  cursor: pointer;
  font-family: "Montserrat", sans-serif;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.cr-btn-ghost:hover:not(:disabled) {
  border-color: var(--bahia-azul);
  background: #f8fafc;
}

.cr-btn-ghost:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.cr-char-count {
  display: block;
  text-align: center;
  margin-top: 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  font-family: "Roboto", sans-serif;
}

.login-version-toggle.cr-hint-block {
  margin-top: 22px;
  font-size: 0.8rem;
  color: #475569;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.cr-hint-lines {
  line-height: 1.5;
  font-weight: 500;
  font-family: "Roboto", sans-serif;
}

.cr-hint-lines code {
  font-size: 0.85em;
}

#form-error,
.cr-form-error {
  color: var(--cor-vermelho);
  margin-top: 16px;
  text-align: center;
  font-weight: 600;
  padding: 10px;
  background: rgba(231, 76, 60, 0.08);
  border-radius: 10px;
  border: 1px solid rgba(231, 76, 60, 0.35);
}

/* Painel resultado — loading / placeholder */
.cr-loading:not([hidden]) {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 12px;
  text-align: center;
}

.cr-loading[hidden] {
  display: none !important;
}

.cr-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(0, 39, 118, 0.12);
  border-top-color: var(--bahia-azul);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

.cr-loading-text {
  margin: 0;
  color: #64748b;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: "Roboto", sans-serif;
}

.cr-placeholder {
  color: #64748b;
  padding: 32px 16px;
  text-align: center;
  font-weight: 600;
  font-family: "Roboto", sans-serif;
}

.cr-placeholder-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--bahia-azul), #005c97);
  opacity: 0.2;
}

.cr-footer {
  position: relative;
  z-index: 10;
  margin-top: 8px;
  text-align: center;
  padding: 0 20px 24px;
}

.cr-footer small {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 500;
  font-family: "Roboto", sans-serif;
}

code {
  font-size: 0.85em;
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-family: ui-monospace, "Cascadia Code", monospace;
}

/* ----- Conteúdo dinâmico da API (mantém classes usadas pelo app.js) ----- */
.resultado-wrap {
  text-align: left;
  margin-top: 8px;
  max-width: 100%;
  overflow-x: auto;
  font-family: "Roboto", sans-serif;
  color: #334155;
  font-size: 0.92rem;
}

.muted {
  color: #64748b;
}

.score-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.score-banner strong {
  font-family: "Montserrat", sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--bahia-azul);
}

.score-banner .muted {
  font-size: 0.88rem;
  font-weight: 500;
}

.uso-meta {
  margin: 0.5rem 0 0;
  width: 100%;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #475569;
}

.uso-panel {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid #e2e8f0;
  width: 100%;
  overflow-x: auto;
  max-width: 100%;
}

.uso-panel summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--bahia-azul);
  font-family: "Montserrat", sans-serif;
  font-size: 0.88rem;
}

.uso-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin: 0.55rem 0;
}

.uso-table th,
.uso-table td {
  border: 1px solid #e2e8f0;
  padding: 0.45rem 0.55rem;
  text-align: left;
}

.uso-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}

.uso-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.uso-foot {
  font-size: 0.76rem;
  margin: 0.35rem 0 0;
  color: #64748b;
}

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.28rem 0.55rem;
  border-radius: 6px;
  font-family: "Montserrat", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge.ok {
  background: rgba(46, 204, 113, 0.15);
  color: #15803d;
  border: 1px solid rgba(46, 204, 113, 0.45);
}

.badge.warn {
  background: rgba(241, 196, 15, 0.2);
  color: #a16207;
  border: 1px solid rgba(241, 196, 15, 0.55);
}

.comp-grid {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.comp-card {
  min-width: 0;
  max-width: 100%;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  border-left: 4px solid var(--bahia-azul);
  padding: 0.9rem 1rem;
  font-size: 0.9rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  overflow-wrap: break-word;
}

.comp-card h3 {
  margin: 0 0 0.4rem;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--bahia-azul);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-family: "Montserrat", sans-serif;
}

.comp-card .nota {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--logo-laranja);
  font-family: "Montserrat", sans-serif;
}

.comp-card p:not(.nota) {
  margin: 0.35rem 0 0;
  line-height: 1.5;
}

.comp-card--vazio {
  border-left-color: var(--cor-vermelho);
  background: #fff8f8;
}

.small-preview {
  font-size: 0.75rem;
  word-break: break-word;
  margin-top: 0.5rem !important;
}

.comp-details {
  margin-top: 0.6rem;
  font-size: 0.85rem;
}

.comp-details summary {
  cursor: pointer;
  color: var(--bahia-azul-claro);
  font-weight: 700;
  font-family: "Montserrat", sans-serif;
}

.extra-dl {
  margin: 0.45rem 0 0;
  padding-left: 0;
}

.extra-dl dt {
  margin-top: 0.4rem;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 600;
}

.extra-dl dd {
  margin: 0.12rem 0 0 0.65rem;
}

.extra-dl ul {
  margin: 0.2rem 0 0;
  padding-left: 1.05rem;
}

.json-mini {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.sug-block {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 2px solid #e2e8f0;
}

.sug-block h3 {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--bahia-azul);
  font-family: "Montserrat", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-bottom: 0.45rem;
  border-bottom: 2px solid var(--logo-laranja);
  display: inline-block;
  width: 100%;
}

.sug-item {
  min-width: 0;
  max-width: 100%;
  margin-bottom: 0.9rem;
  padding: 0.65rem 0.75rem 0.65rem 0.85rem;
  border-left: 4px solid var(--logo-laranja);
  background: #fff;
  border-radius: 0 8px 8px 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  overflow-wrap: break-word;
}

.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: var(--bahia-azul);
  color: #fff;
  margin-bottom: 0.35rem;
  font-family: "Montserrat", sans-serif;
}

.erros-api {
  margin-top: 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: 8px;
  background: rgba(231, 76, 60, 0.08);
  border: 1px solid rgba(231, 76, 60, 0.4);
  font-size: 0.85rem;
  color: #991b1b;
}

/* ----- Comparativo multi-modelo ----- */
.cr-comparativo-section {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 1400px;
  padding: 0 24px 32px;
  margin: 0 auto;
}

.cr-panel-wide {
  max-width: none;
  border-top: 4px solid var(--bahia-azul-claro);
}

.cr-panel-status {
  border-top: 4px solid var(--logo-verde);
}

.cr-provedores-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  text-align: left;
  font-size: 0.85rem;
}

.cr-prov-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.45rem;
  border-radius: 8px;
  border-left: 4px solid #cbd5e1;
  background: #f8fafc;
}

.cr-prov-item.ok {
  border-left-color: var(--logo-verde);
}

.cr-prov-item.off {
  border-left-color: var(--cor-vermelho);
  opacity: 0.92;
}

.cr-prov-item span {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 500;
}

.cr-resumo-bar {
  margin-bottom: 1.25rem;
  padding: 0.85rem 1rem;
  background: #f0f7ff;
  border-radius: 10px;
  border: 1px solid #bfdbfe;
  font-size: 0.88rem;
}

.cr-resumo-custo {
  font-size: 1rem;
  color: var(--bahia-azul);
}

.cr-resumo-custos-list {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
}

.cr-analise-comparativa {
  margin-top: 1.75rem;
}

.cr-analise-box {
  padding: 1rem 1.1rem;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  border-left: 5px solid #4d6bfe;
  text-align: left;
}

.cr-analise-erro {
  border-left-color: var(--cor-vermelho);
  background: #fef2f2;
}

.cr-analise-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}

.cr-analise-title {
  margin: 0;
  font-size: 1.05rem;
  color: var(--bahia-azul);
}

.cr-analise-metrics {
  margin-bottom: 1rem;
}

.cr-analise-block {
  margin-top: 1.1rem;
}

.cr-analise-block h4 {
  margin: 0 0 0.5rem;
  font-size: 0.92rem;
  color: #334155;
}

.cr-analise-block p {
  margin: 0;
  line-height: 1.55;
  font-size: 0.88rem;
}

.cr-analise-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.cr-analise-table th,
.cr-analise-table td {
  padding: 0.4rem 0.5rem;
  border: 1px solid #e2e8f0;
  text-align: center;
}

.cr-analise-table th:first-child,
.cr-analise-table td:first-child {
  text-align: left;
}

.cr-analise-table thead {
  background: #f1f5f9;
}

.cr-analise-divs {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.cr-analise-div-card {
  padding: 0.65rem 0.75rem;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.cr-analise-div-card h5 {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
  color: var(--bahia-azul);
}

.cr-analise-notas-line {
  font-size: 0.85rem;
  margin-bottom: 0.35rem !important;
}

.cr-analise-list {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.86rem;
  line-height: 1.5;
}

.cr-analise-list li {
  margin-bottom: 0.5rem;
}

.cr-analise-list li .muted {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.8rem;
}

.cr-analise-consensos li {
  color: #166534;
}

.cr-analise-rec {
  padding: 0.75rem;
  background: #eff6ff;
  border-radius: 8px;
  border: 1px solid #bfdbfe;
}

.cr-compare-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (min-width: 900px) {
  .cr-compare-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.compare-col {
  min-width: 0;
  max-height: 75vh;
  overflow-y: auto;
  padding: 0.85rem;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  border-top: 4px solid var(--col-accent, var(--bahia-azul));
  background: #fff;
  box-shadow: 0 4px 16px rgba(0, 39, 118, 0.08);
}

.compare-col--erro {
  background: #fef2f2;
}

.compare-col-head h3 {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--bahia-azul);
  font-family: "Montserrat", sans-serif;
}

.compare-model {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  display: block;
  margin-bottom: 0.65rem;
}

.compare-erro {
  color: #991b1b;
  font-size: 0.85rem;
  line-height: 1.45;
}

.compare-score {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  border-bottom: none;
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
}

.compare-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.metric {
  text-align: center;
  padding: 0.4rem 0.25rem;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.metric-label {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.metric strong {
  font-size: 0.82rem;
  color: var(--bahia-azul);
  font-variant-numeric: tabular-nums;
}

.metric-custo {
  color: var(--logo-laranja) !important;
}

.compare-metrics--tokens {
  grid-template-columns: repeat(2, 1fr);
}

.compare-metrics--dupla {
  grid-template-columns: repeat(3, 1fr);
}

.compare-metrics--custo-unico {
  grid-template-columns: 1fr;
  max-width: 50%;
}

.metric-sub {
  display: block;
  font-size: 0.58rem;
  color: #94a3b8;
  font-weight: 600;
  margin-top: 0.12rem;
}

.metric--promo {
  border-color: rgba(46, 204, 113, 0.45);
  background: rgba(46, 204, 113, 0.06);
}

.metric--tabela {
  border-color: #cbd5e1;
}

.metric--econ .metric-econ,
.metric-econ {
  color: #15803d !important;
}

.custo-dupla-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin: 0.5rem 0;
}

@media (min-width: 720px) {
  .custo-dupla-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.custo-tarifa-block {
  padding: 0.5rem;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.custo-block--promo {
  border-color: rgba(46, 204, 113, 0.4);
  background: rgba(46, 204, 113, 0.04);
}

.custo-block--tabela {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.custo-tarifa-title {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--bahia-azul);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.custo-promo-badge {
  font-size: 0.72rem;
  color: #15803d;
  font-weight: 600;
}

.custo-total-linha {
  font-size: 0.82rem;
  margin: 0.5rem 0 0;
  line-height: 1.45;
}

/* ----- Transcrição por imagem (lacunas inline) ----- */
.cr-upload-block {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.cr-upload-hint {
  font-size: 0.82rem;
  color: #64748b;
  margin: 0 0 8px;
  line-height: 1.45;
}

.cr-upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}

.cr-file-input {
  font-size: 0.85rem;
  max-width: 100%;
}

.cr-file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cr-upload-row--pick {
  gap: 8px;
}

.cr-btn-upload {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: center;
  text-align: center;
}

.cr-btn-upload--camera {
  border-color: var(--bahia-azul);
  color: var(--bahia-azul);
  font-weight: 700;
}

.cr-imagem-label {
  margin: 8px 0 0;
  font-size: 0.82rem;
  word-break: break-word;
}

.cr-imagem-preview-wrap {
  margin-top: 10px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  max-height: 200px;
}

.cr-imagem-preview {
  display: block;
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  background: #f8fafc;
}

@media (max-width: 520px) {
  .cr-upload-row--pick {
    flex-direction: column;
    align-items: stretch;
  }

  .cr-btn-upload,
  #btn-transcrever-imagem {
    width: 100%;
  }
}

/* ----- Viabilidade financeira (resumo) ----- */
.cr-viabilidade {
  margin: 16px 0 20px;
  padding: 16px 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f0f9ff 0%, #ecfdf5 100%);
  border: 1px solid #bae6fd;
}

.cr-viabilidade h4 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: var(--bahia-azul);
}

.cr-viab-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.cr-viab-table th,
.cr-viab-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.cr-viab-table th {
  font-weight: 700;
  color: #475569;
}

.cr-viab-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cr-viab-totais {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 2px solid rgba(15, 23, 42, 0.1);
  font-size: 0.9rem;
  line-height: 1.55;
}

.cr-viab-totais strong {
  color: #0f172a;
}

.cr-viab-projecao {
  margin-top: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #0369a1;
}

.cr-resultado-unico {
  margin-top: 8px;
}

.cr-resultado-unico .compare-col {
  max-width: 100%;
}

.cr-nota-destaque {
  font-size: 1.35rem;
  color: var(--bahia-azul);
}

.cr-transcricao-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--bahia-azul);
}

.cr-spinner--inline {
  width: 1.1rem;
  height: 1.1rem;
  border-width: 2px;
  flex-shrink: 0;
}

.cr-lacunas-banner {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.4;
}

.cr-lacunas-banner--alert {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
}

.cr-lacunas-banner--ok {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #34d399;
}

.cr-inline-host[hidden] {
  display: none !important;
}

.cr-inline-host {
  margin-top: 12px;
  padding: 14px 16px;
  min-height: 120px;
  max-height: 420px;
  overflow-y: auto;
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-family: "Roboto", system-ui, sans-serif;
  font-size: 0.95rem;
  line-height: 1.65;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 4px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.cr-inline-lit {
  white-space: pre-wrap;
  word-break: break-word;
}

.cr-inline-gap-wrap {
  display: inline-flex;
  align-items: center;
  vertical-align: baseline;
  margin: 0 1px;
  padding: 0 2px 1px;
  border-radius: 6px;
  border-bottom: 2px dashed var(--logo-laranja);
  background: rgba(244, 121, 32, 0.1);
}

.cr-inline-gap-wrap:focus-within {
  outline: 2px solid var(--bahia-azul-claro);
  outline-offset: 1px;
}

.cr-inline-gap {
  border: none;
  background: transparent;
  min-width: 4.5ch;
  max-width: 18ch;
  width: auto;
  font: inherit;
  font-weight: 600;
  color: #0f172a;
  padding: 2px 4px;
  margin: 0;
}

.cr-inline-gap::placeholder {
  color: #94a3b8;
  font-weight: 500;
}

.cr-upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.cr-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.cr-modal-backdrop[hidden] {
  display: none !important;
}

.cr-modal-card {
  width: min(420px, 94vw);
  background: #fff;
  border-radius: 16px;
  padding: 22px 20px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.25);
  border: 1px solid #e2e8f0;
  text-align: center;
}

.cr-modal-card .cr-spinner {
  margin: 0 auto 14px;
}

.cr-modal-card h3 {
  margin: 0 0 8px;
  color: var(--bahia-azul);
  font-size: 1.05rem;
}

.cr-modal-card p {
  margin: 0;
  color: #475569;
  font-size: 0.9rem;
  line-height: 1.45;
}

@media (prefers-reduced-motion: reduce) {
  .cr-hero-card,
  .cr-ribbon,
  .cr-dual-grid {
    animation: none;
  }
  .cr-spinner {
    animation-duration: 1.4s;
  }
}

/* =============================================================================
   Trajetória — histórico de evolução (página de exemplo)
   ============================================================================= */
.cr-body--trajetoria .cr-traj-page {
  position: relative;
  max-width: 960px;
  margin: 0 auto;
  padding: 120px 20px 48px;
}

.cr-btn-nav {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bahia-azul);
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 999px;
  text-decoration: none;
  font-family: "Montserrat", sans-serif;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  white-space: nowrap;
}

.cr-btn-nav:hover {
  border-color: var(--bahia-azul);
  background: #f8fafc;
  transform: translateY(-1px);
}

.cr-btn-nav--back {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 700;
}

.cr-traj-demo-banner {
  position: relative;
  z-index: 10;
  margin: 0 0 20px;
  padding: 12px 16px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(241, 196, 15, 0.2), rgba(244, 121, 32, 0.12));
  border: 1px solid rgba(241, 196, 15, 0.45);
  font-size: 0.88rem;
  line-height: 1.45;
  color: #334155;
}

.cr-traj-profile {
  margin-bottom: 24px;
  animation: fadeInUp 0.45s ease-out both;
}

.cr-traj-profile-main {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 20px;
}

.cr-traj-avatar {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--bahia-azul), #005c97);
  box-shadow: 0 6px 18px rgba(0, 39, 118, 0.25);
}

.cr-traj-nome {
  margin: 0 0 4px;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--bahia-azul);
}

.cr-traj-meta,
.cr-traj-periodo {
  margin: 0;
  font-size: 0.88rem;
  color: #64748b;
  font-weight: 600;
}

.cr-traj-periodo {
  margin-top: 4px;
  font-size: 0.82rem;
}

.cr-traj-kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 600px) {
  .cr-traj-kpis {
    grid-template-columns: repeat(4, 1fr);
  }
}

.cr-traj-kpi {
  text-align: center;
  padding: 14px 10px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.cr-traj-kpi-val {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--bahia-azul);
  line-height: 1.1;
}

.cr-traj-kpi--up .cr-traj-kpi-val {
  color: var(--logo-verde);
}

.cr-traj-kpi-lbl {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.cr-traj-chart-card,
.cr-traj-detail {
  margin-bottom: 24px;
  animation: fadeInUp 0.45s ease-out 0.06s both;
}

.cr-traj-section-title {
  margin: 0 0 6px;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--bahia-azul);
}

.cr-traj-section-desc {
  margin: 0 0 16px;
  font-size: 0.88rem;
  color: #64748b;
  line-height: 1.45;
}

.cr-traj-chart-wrap {
  position: relative;
  height: 260px;
  width: 100%;
}

.cr-traj-chart-wrap--tall {
  height: 320px;
}

.cr-traj-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 12px;
}

.cr-traj-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #475569;
}

.cr-traj-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cr-traj-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.cr-traj-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  font-family: "Roboto", sans-serif;
}

.cr-traj-table th,
.cr-traj-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.cr-traj-table th {
  font-weight: 700;
  color: var(--bahia-azul);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.cr-traj-table tbody tr {
  cursor: pointer;
  transition: background 0.15s;
}

.cr-traj-table tbody tr:hover,
.cr-traj-table tbody tr.cr-traj-row--active {
  background: rgba(0, 39, 118, 0.06);
}

.cr-traj-table tbody tr:focus-visible {
  outline: 2px solid var(--bahia-azul);
  outline-offset: -2px;
}

.cr-traj-tema-cell {
  max-width: 220px;
  line-height: 1.35;
}

.cr-traj-detail-tema {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
}

.cr-traj-detail-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0;
}

.cr-traj-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1fr auto;
  gap: 10px;
  align-items: center;
}

@media (max-width: 520px) {
  .cr-traj-bar-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

.cr-traj-bar-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
}

.cr-traj-bar-track {
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.cr-traj-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.cr-traj-bar-val {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--bahia-azul);
  min-width: 2.5em;
  text-align: right;
}

.cr-traj-footer {
  text-align: center;
  margin-top: 8px;
}

.cr-traj-footer a {
  color: var(--bahia-azul-claro);
  font-weight: 600;
}

@media (max-width: 768px) {
  .brand-right {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .cr-body--trajetoria .cr-traj-page,
  .cr-body--gestao .cr-traj-page {
    padding-top: 140px;
  }
}

/* =============================================================================
   Gestão da turma — painel fictício do professor
   ============================================================================= */
.cr-body--gestao .cr-traj-page {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  padding: 120px 20px 48px;
}

.cr-gest-avatar-prof {
  background: linear-gradient(135deg, var(--logo-verde), #005c97);
}

.cr-gest-participacao-resumo {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.cr-gest-part-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  min-width: 88px;
}

.cr-gest-part-chip-data {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--bahia-azul);
  text-transform: uppercase;
}

.cr-gest-part-chip-val {
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
}

.cr-gest-part-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: #dcfce7;
  color: #166534;
}

.cr-gest-det-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 12px;
}

@media (min-width: 640px) {
  .cr-gest-det-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.cr-gest-det-card {
  text-align: center;
  padding: 12px 8px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.cr-gest-det-val {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--bahia-azul);
}

.cr-gest-det-val--muted {
  color: #94a3b8;
}

.cr-gest-det-lbl {
  display: block;
  margin-top: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
}

.cr-gest-table-alunos th,
.cr-gest-table-alunos td {
  font-size: 0.78rem;
  text-align: center;
  vertical-align: middle;
}

.cr-gest-table-alunos .cr-gest-nome-cell {
  text-align: left;
  min-width: 160px;
  font-weight: 600;
  color: #1e293b;
}

.cr-gest-cell-nao {
  background: #f8fafc;
}

.cr-gest-nao {
  color: #cbd5e1;
  font-weight: 700;
}

.cr-gest-nota {
  font-weight: 700;
  color: var(--bahia-azul);
}

.cr-gest-part-pct {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
}
