/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:         #002850;
  --navy-mid:     #143C64;
  --navy-light:   #1A4A78;
  --steel:        #788CA0;
  --steel-light:  #A0B4C8;
  --bg:           #F4F6F8;
  --white:        #ffffff;
  --border:       #DDE4EC;
  --text:         #1A2636;
  --text-muted:   #5A6A7A;

  --red:    #EF4444;
  --orange: #F97316;
  --yellow: #EAB308;
  --green:  #22C55E;
  --green-dark: #16A34A;

  --font-body: 'Sora', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 20px;
  --shadow:    0 4px 24px rgba(0, 40, 80, 0.10);
  --shadow-lg: 0 8px 40px rgba(0, 40, 80, 0.16);
}

html, body {
  height: 100%;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Screens ──────────────────────────────────────────────────────────────── */
.screen {
  display: none;
  min-height: 100vh;
}
.screen.active {
  display: flex;
  flex-direction: column;
}

/* ── Botões ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--navy);
  color: var(--white);
}
.btn-primary:hover:not(:disabled) { background: var(--navy-mid); }

.btn-secondary {
  background: var(--white);
  color: var(--navy);
  border: 2px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--navy); }

.btn-cta {
  background: linear-gradient(135deg, #1A4A78, var(--navy));
  color: var(--white);
  font-size: 1.1rem;
  padding: 18px 36px;
  border-radius: var(--radius);
  box-shadow: 0 6px 32px rgba(0, 40, 80, 0.30);
  width: 100%;
  max-width: 480px;
  letter-spacing: .02em;
}
.btn-cta:hover:not(:disabled) { opacity: .9; }

.btn-pdf {
  background: transparent;
  color: var(--steel);
  border: 1.5px solid var(--border);
  font-size: .9rem;
  padding: 10px 20px;
}
.btn-pdf:hover { color: var(--navy); border-color: var(--navy-light); }

/* ── ══════════════════════════════════════════════════════════════════════════
   SCREEN 1 — Welcome
   ══════════════════════════════════════════════════════════════════════════ */
#screen-welcome {
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-light) 100%);
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.welcome-card {
  max-width: 560px;
  width: 100%;
}

.welcome-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--steel-light);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 24px;
  padding: 6px 14px;
  border: 1px solid rgba(160, 180, 200, 0.3);
  border-radius: 99px;
}

.welcome-title {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
  margin-bottom: 16px;
}

.welcome-subtitle {
  font-size: 1.05rem;
  color: var(--steel-light);
  margin-bottom: 40px;
  line-height: 1.7;
}

.welcome-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 40px;
  text-align: left;
}

.welcome-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--steel-light);
  font-size: .95rem;
}

.welcome-feature-dot {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── ══════════════════════════════════════════════════════════════════════════
   SCREEN 2 — Identificação
   ══════════════════════════════════════════════════════════════════════════ */
#screen-identification {
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.form-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 48px 40px;
  max-width: 560px;
  width: 100%;
}

.form-card-header {
  margin-bottom: 36px;
}

.form-card-label {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--steel);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.form-card-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy);
}

.form-group {
  margin-bottom: 24px;
}

.form-label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.form-input,
.form-select {
  width: 100%;
  padding: 12px 0;
  border: none;
  border-bottom: 2px solid var(--border);
  background: transparent;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text);
  outline: none;
  transition: border-color .2s;
  border-radius: 0;
  appearance: none;
  -webkit-appearance: none;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23788CA0' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
  padding-right: 28px;
  cursor: pointer;
}

.form-input:focus,
.form-select:focus { border-bottom-color: var(--navy); }

.form-input.error,
.form-select.error { border-bottom-color: var(--red); }

.form-error {
  display: none;
  font-size: .8rem;
  color: var(--red);
  margin-top: 6px;
}
.form-error.visible { display: block; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}

.form-submit-area {
  margin-top: 36px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-wa-error {
  display: none;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: #B91C1C;
  font-size: .9rem;
  line-height: 1.5;
}
.form-wa-error.visible { display: block; }

/* ── ══════════════════════════════════════════════════════════════════════════
   SCREEN 3 — Perguntas
   ══════════════════════════════════════════════════════════════════════════ */
#screen-questions {
  padding: 0;
}

.questions-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.progress-bar-track {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--navy);
  border-radius: 2px;
  transition: width .4s ease;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .8rem;
  color: var(--text-muted);
}

.progress-category {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--navy);
}

.questions-body {
  flex: 1;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px;
}

.category-title-block {
  margin-bottom: 40px;
}

.category-label {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--steel);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 8px;
}

.category-name {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--navy);
}

.question-block {
  margin-bottom: 36px;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--border);
}
.question-block:last-child { border-bottom: none; }

.question-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.5;
}

.question-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-label {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-size: .95rem;
  line-height: 1.4;
  user-select: none;
}
.option-label:hover {
  border-color: var(--steel-light);
  background: rgba(0, 40, 80, .03);
}
.option-label.selected {
  border-color: var(--navy);
  background: rgba(0, 40, 80, .06);
  color: var(--navy);
  font-weight: 600;
}

.option-value-badge {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
  font-family: var(--font-mono);
  font-size: .75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--steel);
  transition: background .15s, color .15s;
}
.option-label.selected .option-value-badge {
  background: var(--navy);
  color: var(--white);
}

.option-input { display: none; }

.questions-nav {
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  position: sticky;
  bottom: 0;
}

.questions-unanswered-msg {
  display: none;
  font-size: .85rem;
  color: var(--red);
  text-align: center;
  flex: 1;
}
.questions-unanswered-msg.visible { display: block; }

/* ── ══════════════════════════════════════════════════════════════════════════
   SCREEN 4 — Loading
   ══════════════════════════════════════════════════════════════════════════ */
#screen-loading {
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: var(--bg);
}

.loading-spinner {
  width: 56px;
  height: 56px;
  border: 4px solid var(--border);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  font-size: 1rem;
  color: var(--text-muted);
  text-align: center;
}

.loading-progress-track {
  width: 280px;
  max-width: 90vw;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.loading-progress-fill {
  height: 100%;
  background: var(--navy);
  border-radius: 3px;
  width: 0%;
}
.loading-progress-label {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--steel);
  text-align: center;
}

.loading-subtitle {
  font-size: .85rem;
  color: var(--steel);
  text-align: center;
  margin-top: -8px;
}

/* ── ══════════════════════════════════════════════════════════════════════════
   SCREEN 5 — Resultados
   ══════════════════════════════════════════════════════════════════════════ */
#screen-results {
  background: var(--bg);
  align-items: stretch;
}

.results-wrapper {
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Header do resultado */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.results-meta {}
.results-company {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}
.results-details {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--steel);
  line-height: 1.8;
}

.results-date {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--steel);
  text-align: right;
}

/* Score hero */
.score-hero {
  background: var(--navy);
  border-radius: var(--radius-lg);
  padding: 40px;
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}

.score-circle {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.score-circle svg {
  transform: rotate(-90deg);
}

.score-circle-bg { fill: none; stroke: rgba(255,255,255,.12); stroke-width: 8; }
.score-circle-fill { fill: none; stroke-width: 8; stroke-linecap: round;
  transition: stroke-dashoffset .8s ease; }

.score-circle-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--white);
}
.score-circle-number {
  font-size: 2rem;
  font-weight: 700;
  font-family: var(--font-mono);
  line-height: 1;
}
.score-circle-max {
  font-size: .75rem;
  color: var(--steel-light);
  font-family: var(--font-mono);
}

.score-info { flex: 1; min-width: 200px; }
.score-faixa-label {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--steel-light);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.score-faixa-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 12px;
  line-height: 1.2;
}
.score-faixa-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: .78rem;
  font-weight: 600;
  font-family: var(--font-mono);
}
.badge-critica   { background: rgba(239,68,68,.2);  color: #FCA5A5; }
.badge-fragilizada { background: rgba(249,115,22,.2); color: #FDB67A; }
.badge-base      { background: rgba(234,179,8,.2);  color: #FDE68A; }
.badge-madura    { background: rgba(34,197,94,.2);  color: #86EFAC; }

/* Gráfico por categoria */
.category-chart-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
}

.section-label {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--steel);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.category-bars { display: flex; flex-direction: column; gap: 20px; }

.category-bar-item {}
.category-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
}
.category-bar-name {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
.category-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.category-bar-pct {
  font-family: var(--font-mono);
  font-size: .85rem;
  color: var(--steel);
}
.pilar-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: .7rem;
  font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase;
}
.pilar-Critico   { background: #FEE2E2; color: #B91C1C; }
.pilar-Baixo     { background: #FFEDD5; color: #C2410C; }
.pilar-Medio     { background: #FEF9C3; color: #92400E; }
.pilar-Alto      { background: #DCFCE7; color: #15803D; }
.pilar-Excelente { background: #D1FAE5; color: #065F46; }

.category-bar-track {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.category-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .8s ease;
}
.bar-critico   { background: var(--red); }
.bar-baixo     { background: var(--orange); }
.bar-medio     { background: var(--yellow); }
.bar-alto      { background: var(--green); }
.bar-excelente { background: var(--green-dark); }

/* Relatório parcial */
.report-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
}

.report-section { margin-bottom: 32px; }
.report-section:last-child { margin-bottom: 0; }

.report-section-title {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--steel);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.report-text {
  font-size: .97rem;
  color: var(--text);
  line-height: 1.8;
}
.report-text p { margin-bottom: 1em; }
.report-text p:last-child { margin-bottom: 0; }
.report-text strong { color: var(--navy); font-weight: 700; }
.report-list-num {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .85rem;
  font-weight: 700;
  color: var(--navy);
  min-width: 1.6em;
}

/* Ação imediata */
.report-acao-imediata {
  margin-top: 28px;
  background: rgba(239, 68, 68, 0.05);
  border: 1.5px solid rgba(239, 68, 68, 0.25);
  border-left: 4px solid var(--red);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
}

.report-acao-label {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--red);
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 10px;
}

.report-acao-text {
  font-size: .97rem;
  color: var(--text);
  line-height: 1.75;
}
.report-acao-text p { margin-bottom: .75em; }
.report-acao-text p:last-child { margin-bottom: 0; }
.report-acao-text strong { color: var(--navy); font-weight: 700; }

/* CTA */
.cta-block {
  background: linear-gradient(135deg, #F0F7FF 0%, #E8F0FB 100%);
  border: 1px solid rgba(0, 40, 80, 0.12);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
}

.cta-eyebrow {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--steel);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.cta-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
  line-height: 1.3;
}

.cta-subtitle {
  font-size: .95rem;
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.6;
}

.cta-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 20, 40, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 100%;
  padding: 48px 40px;
  text-align: center;
  animation: modalIn .25s ease;
}
@keyframes modalIn { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-icon {
  width: 64px;
  height: 64px;
  background: #DCFCE7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}
.modal-icon svg { width: 32px; height: 32px; color: var(--green-dark); }

.modal-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 12px;
}

.modal-body {
  font-size: .95rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 28px;
}

/* ── Responsivo ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .form-card { padding: 32px 24px; }
  .form-row { grid-template-columns: 1fr; }
  .score-hero { padding: 28px; flex-direction: column; align-items: flex-start; }
  .score-circle { width: 96px; height: 96px; }
  .score-circle-number { font-size: 1.6rem; }
  .report-card { padding: 28px 20px; }
  .cta-block { padding: 28px 20px; }
  .modal-box { padding: 36px 24px; }
  .category-chart-card { padding: 24px 20px; }
}

/* ── Print ────────────────────────────────────────────────────────────────── */
@media print {
  .screen { display: flex !important; }
  #screen-welcome,
  #screen-identification,
  #screen-questions,
  #screen-loading { display: none !important; }
  #screen-results { display: flex !important; }
  .questions-nav,
  .cta-block,
  .btn-pdf,
  .results-header .results-date { display: none !important; }
  .results-wrapper { padding: 0; }
  body { background: white; }
}
