:root {
  --bg: #fafaf8;
  --bg-alt: #f3f2ee;
  --white: #ffffff;
  --accent: #c95f2a;
  --accent-light: #f5e8e0;
  --text: #18181b;
  --text-2: #52525b;
  --text-3: #a1a1aa;
  --border: #e4e4e7;
  --border-light: #f0f0ed;
  --green: #166534;
  --green-bg: #f0fdf4;
  --red: #991b1b;
  --red-bg: #fef2f2;
  --yellow: #92400e;
  --yellow-bg: #fffbeb;
  --radius: 10px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Instrument Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
}

/* ─── INPUT PHASE ─── */
#inputPhase {
  display: block;
}

#outputPhase {
  display: none;
}

.top-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
}

.brand {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}

.brand em {
  color: var(--accent);
  font-style: normal;
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 380px;
  margin: 0 auto;
}

.progress-track {
  flex: 1;
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width .4s ease;
  width: 0%;
}

.progress-pct {
  font-size: 11px;
  color: var(--text-3);
  min-width: 28px;
  text-align: right;
}

.btn-gerar-top {
  background: var(--accent);
  color: white;
  border: none;
  padding: 9px 20px;
  font-family: 'Instrument Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  display: none;
  letter-spacing: 0.3px;
}

.btn-gerar-top:hover {
  background: #b5521f;
}

/* LAYOUT */
.layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  min-height: calc(100vh - 53px);
}

.sidebar {
  border-right: 1px solid var(--border);
  background: var(--white);
  padding: 28px 0;
  position: sticky;
  top: 53px;
  height: calc(100vh - 53px);
  overflow-y: auto;
}

.nav-group {
  padding: 0 16px 20px;
}

.nav-group-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 8px;
  margin-bottom: 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-2);
  transition: all .15s;
  margin-bottom: 1px;
  font-weight: 500;
}

.nav-link:hover {
  background: var(--bg-alt);
  color: var(--text);
}

.nav-link.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.nav-link.done {
  color: var(--text);
}

.nav-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  transition: background .15s;
}

.nav-link.active .nav-dot {
  background: var(--accent);
}

.nav-link.done .nav-dot {
  background: #22c55e;
}

.content {
  padding: 44px 56px;
  max-width: 860px;
}

/* SECTIONS */
.sec {
  display: none;
  animation: fadeUp .25s ease;
}

.sec.active {
  display: block;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.sec-head {
  margin-bottom: 36px;
}

.sec-title {
  font-family: 'Fraunces', serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.sec-sub {
  font-size: 13px;
  color: var(--text-2);
}

/* FIELDS */
.field {
  margin-bottom: 22px;
}

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.5;
}

.field .hint {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 6px;
  font-style: italic;
}

input[type=text],
input[type=number],
textarea,
select {
  width: 100%;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: 'Instrument Sans', sans-serif;
  font-size: 13.5px;
  padding: 10px 14px;
  outline: none;
  transition: border-color .15s;
}

input[type=text]:focus,
input[type=number]:focus,
textarea:focus {
  border-color: var(--accent);
}

textarea {
  resize: vertical;
  min-height: 72px;
}

.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.row3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

/* RADIO CARDS */
.rc-wrap {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.rc {
  flex: 1;
  min-width: 120px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all .15s;
}

.rc input {
  display: none;
}

.rc:hover {
  border-color: var(--text-3);
}

.rc.sel {
  border-color: var(--accent);
  background: var(--accent-light);
}

.rc-name {
  font-size: 12.5px;
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
}

.rc-desc {
  font-size: 11px;
  color: var(--text-3);
}

/* SECTION NAV */
.sec-nav {
  display: flex;
  gap: 10px;
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid var(--border-light);
}

.btn-back {
  padding: 10px 22px;
  border-radius: 7px;
  font-family: 'Instrument Sans', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-2);
}

.btn-back:hover {
  border-color: var(--text-3);
  color: var(--text);
}

.btn-next {
  padding: 10px 24px;
  border-radius: 7px;
  font-family: 'Instrument Sans', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: white;
  border: none;
}

.btn-next:hover {
  background: #b5521f;
}

/* ─── OUTPUT PHASE ─── */
#outputPhase {
  font-family: 'Instrument Sans', sans-serif;
  background: var(--bg);
}

.out-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
}

.out-brand {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.out-brand em {
  color: var(--accent);
  font-style: normal;
}

.out-header-actions {
  display: flex;
  gap: 10px;
}

.btn-print {
  background: var(--accent);
  color: white;
  border: none;
  padding: 9px 20px;
  font-family: 'Instrument Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
}

.btn-print:hover {
  background: #b5521f;
}

.btn-novo-out {
  background: transparent;
  color: var(--text-2);
  border: 1.5px solid var(--border);
  padding: 9px 20px;
  font-family: 'Instrument Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
}

.btn-novo-out:hover {
  border-color: var(--text-3);
  color: var(--text);
}

.out-body {
  max-width: 1060px;
  margin: 0 auto;
  padding: 48px 36px 80px;
}

/* HERO */
.out-hero {
  margin-bottom: 48px;
}

.out-tag {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.out-h1 {
  font-family: 'Fraunces', serif;
  font-size: 40px;
  font-weight: 900;
  letter-spacing: -1.5px;
  line-height: 1.05;
  margin-bottom: 14px;
}

.out-h1 span {
  color: var(--accent);
}

.out-intro {
  font-size: 14px;
  color: var(--text-2);
  max-width: 640px;
  line-height: 1.75;
  margin-bottom: 28px;
}

.meta-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.meta-pill {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

.meta-pill .lbl {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 3px;
}

.meta-pill .val {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.meta-pill .val.accent {
  color: var(--accent);
}

.out-divider {
  height: 1px;
  background: var(--border);
  margin: 48px 0;
}

/* SCORE GRID + RADAR */
.score-overview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 48px;
}

.radar-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.score-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.score-row {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.score-row-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.score-row-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.score-track {
  width: 80px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.score-fill {
  height: 100%;
  border-radius: 2px;
}

.score-num {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  font-weight: 700;
  min-width: 24px;
  text-align: right;
}

.s-hi .score-fill {
  background: #22c55e;
}

.s-hi .score-num {
  color: #166534;
}

.s-md .score-fill {
  background: #f59e0b;
}

.s-md .score-num {
  color: #92400e;
}

.s-lo .score-fill {
  background: #ef4444;
}

.s-lo .score-num {
  color: #991b1b;
}

/* URGÊNCIA */
.urgencia-box {
  border-radius: 12px;
  border: 1.5px solid;
  padding: 20px 24px;
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 32px;
}

.urg-badge {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 20px;
  white-space: nowrap;
  margin-top: 2px;
}

.urg-text {
  font-size: 14px;
  line-height: 1.7;
}

/* GPCT */
.gpct-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 48px;
}

.gpct-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 24px;
}

.gpct-letter {
  font-family: 'Fraunces', serif;
  font-size: 38px;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 2px;
}

.gpct-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 12px;
}

.gpct-body {
  font-size: 13px;
  line-height: 1.75;
  color: var(--text-2);
}

/* PILARES */
.sec-title-out {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.sec-sub-out {
  font-size: 12.5px;
  color: var(--text-2);
  margin-bottom: 24px;
}

.pilar-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 26px 28px;
  margin-bottom: 16px;
}

.pilar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.pilar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pilar-icon {
  font-size: 20px;
}

.pilar-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.pilar-badge {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 700;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pb-hi {
  background: #dcfce7;
  color: #166534;
}

.pb-md {
  background: #fef9c3;
  color: #92400e;
}

.pb-lo {
  background: #fee2e2;
  color: #991b1b;
}

.pilar-row {
  margin-bottom: 14px;
}

.pilar-row-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.dot-g {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
}

.dot-r {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ef4444;
  flex-shrink: 0;
}

.dot-y {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
  flex-shrink: 0;
}

.dot-g+span {
  color: var(--green);
}

.dot-r+span {
  color: var(--red);
}

.dot-y+span {
  color: var(--yellow);
}

.pilar-row p {
  font-size: 13px;
  line-height: 1.75;
  color: var(--text-2);
}

/* TRAVA */
.trava-box {
  background: var(--text);
  border-radius: 14px;
  padding: 32px 36px;
  margin: 48px 0;
  color: white;
}

.trava-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.trava-title {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 14px;
  line-height: 1.25;
}

.trava-text {
  font-size: 13.5px;
  line-height: 1.8;
  color: #d4d4d8;
}

/* PONTOS ATENÇÃO */
.att-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 48px;
}

.att-item {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-2);
  border-left: 3px solid var(--accent);
}

.att-item strong {
  color: var(--text);
}

/* PRÓXIMOS PASSOS */
.passos-box {
  background: var(--white);
  border: 1.5px solid var(--accent);
  border-radius: 14px;
  padding: 28px 32px;
  margin-bottom: 48px;
}

.passos-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}

.passo {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  align-items: flex-start;
}

.passo-n {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
  flex-shrink: 0;
  width: 22px;
}

.passo-text {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-2);
  padding-top: 3px;
}

/* FOOTER */
.out-footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-3);
  padding: 24px;
  border-top: 1px solid var(--border);
  margin-top: 48px;
}

/* LOADING */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(250, 250, 248, .88);
  z-index: 999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  backdrop-filter: blur(4px);
}

.loading-overlay.on {
  display: flex;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
}


/* GAP BLOCK OUTPUT */
.gap-block {
  background: var(--text);
  border-radius: 14px;
  padding: 32px 36px;
  margin-bottom: 48px;
  color: white;
}

.gap-block-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.gap-block-title {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.3px;
  margin-bottom: 24px;
  line-height: 1.3;
  color: white;
}

.gap-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.gap-metric {
  background: rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}

.gap-metric-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 6px;
}

.gap-metric-val {
  font-family: 'Fraunces', serif;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
}

.gap-metric-sub {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 4px;
}

.gap-bar-wrap {
  background: rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 16px;
}

.gap-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 8px;
}

.gap-bar-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.gap-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
}

.gap-bar-subs {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 5px;
}

.gap-frase {
  font-size: 13px;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.75);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 16px;
  margin-top: 4px;
}

.gap-frase strong {
  color: white;
}

@media print {
  .gap-block {
    background: #18181b !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* PRINT */
@media print {

  #inputPhase,
  .out-header {
    display: none !important;
  }

  #outputPhase {
    display: block !important;
  }

  body {
    background: white;
  }

  .out-body {
    padding: 20px;
  }

  .score-overview {
    page-break-inside: avoid;
  }

  .pilar-card {
    page-break-inside: avoid;
  }

  .trava-box {
    background: #18181b !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}