:root {
  --ink: #183134;
  --muted: #617476;
  --primary: #087f78;
  --primary-dark: #05655f;
  --soft: #e9f7f5;
  --page: #f4f8f7;
  --surface: #fff;
  --line: #dce7e6;
  --danger: #a63232;
  --danger-soft: #fff1f1;
  --warning: #7b5807;
  --warning-soft: #fff7df;
  --good: #17724f;
  --good-soft: #eef9f3;
  --info: #0a6b82;
  --info-soft: #e7f6f9;
  --neutral: #496366;
  --shadow: 0 18px 50px rgba(20, 55, 55, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.55;
}

button, input {
  font: inherit;
}

button {
  touch-action: manipulation;
}

a {
  color: var(--primary-dark);
}

[hidden] {
  display: none !important;
}

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

.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: auto;
  padding: 48px 0 72px;
}

.hero {
  max-width: 850px;
  margin: 0 auto 32px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.1rem, 6vw, 3.6rem);
  line-height: 1.06;
  letter-spacing: -0.035em;
}

.subtitle {
  max-width: 760px;
  margin: 16px auto 0;
  color: #40595b;
  font-size: 1.08rem;
}

.hero-note {
  max-width: 720px;
  margin: 12px auto 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.panel, .result-card, .education, .simulation-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}

.calculator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(350px, 0.92fr);
  align-items: start;
  gap: 20px;
}

.steps-column {
  display: grid;
  gap: 18px;
}

.panel {
  padding: clamp(20px, 3vw, 28px);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.25;
}

.section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.step {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 900;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field {
  min-width: 0;
}

.field label {
  display: block;
  margin-bottom: 7px;
  color: #284346;
  font-size: 0.88rem;
  font-weight: 800;
}

.optional {
  color: var(--muted);
  font-weight: 600;
}

.field input {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  padding: 11px 13px;
  border: 1px solid #bfcfcd;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  outline: 0;
}

.field input:focus, .button:focus-visible, .text-button:focus-visible {
  border-color: var(--primary);
  outline: 3px solid rgba(8, 127, 120, 0.18);
  outline-offset: 2px;
}

.field input[aria-invalid="true"] {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.input-affix {
  overflow: hidden;
  border: 1px solid #bfcfcd;
  border-radius: 10px;
  display: flex;
  align-items: center;
  background: #fff;
  transition: border-color 0.16s, box-shadow 0.16s;
}

.input-affix:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(8, 127, 120, 0.14);
}

.input-affix:has(input[aria-invalid="true"]) {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.input-affix span {
  padding-left: 13px;
  color: #567073;
  font-weight: 800;
  white-space: nowrap;
}

.input-affix.suffix span {
  padding: 0 13px 0 6px;
}

.input-affix input {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none !important;
  outline: 0 !important;
}

.input-affix:not(.suffix) input {
  padding-left: 7px;
}

.helper, .error {
  display: block;
  margin-top: 6px;
  font-size: 0.77rem;
  line-height: 1.45;
}

.helper {
  color: var(--muted);
}

.error {
  min-height: 1.1em;
  color: var(--danger);
  font-weight: 750;
}

.running-total {
  margin: 18px 0 0;
  padding: 13px 15px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  background: var(--soft);
  color: #315254;
  font-size: 0.9rem;
}

.running-total strong {
  color: var(--primary-dark);
  font-size: 1rem;
}

/* Assistente expansível de conversão de dias */
.days-helper {
  margin-top: 14px;
  border: 1px dashed #bfcfcd;
  border-radius: 10px;
  background: #fbfdfd;
}

.days-helper summary {
  padding: 10px 14px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--primary-dark);
  cursor: pointer;
}

.days-helper-body {
  padding: 10px 14px 14px;
  border-top: 1px dashed var(--line);
}

.days-helper-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
  gap: 10px;
}

.days-helper-grid .field label {
  font-size: 0.78rem;
  margin-bottom: 4px;
}

.days-helper-grid input {
  min-height: 40px;
  padding: 6px 10px;
  font-size: 0.85rem;
}

.button-apply {
  min-height: 40px;
  padding: 6px 14px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: var(--soft);
  color: var(--primary-dark);
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.button-apply:hover {
  background: var(--primary);
  color: #fff;
}

.calculator-actions {
  padding: 4px 2px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.calculator-actions p {
  flex: 1 0 100%;
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.button {
  min-height: 48px;
  padding: 11px 17px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 850;
  cursor: pointer;
}

.button.primary {
  background: var(--primary);
  color: #fff;
}

.button.primary:hover {
  background: var(--primary-dark);
}

.button.secondary {
  border-color: #b9ccca;
  background: #fff;
  color: #365456;
}

.button.secondary:hover {
  background: var(--soft);
}

/* Card de Resultado */
.result-card {
  position: sticky;
  top: 18px;
  padding: clamp(24px, 3vw, 34px);
  overflow: hidden;
}

.result-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: var(--primary);
  content: "";
}

.result-card h2 {
  margin: 0;
  font-size: 1.32rem;
}

.main-result {
  display: block;
  margin: 12px 0 4px;
  color: var(--primary-dark);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
  overflow-wrap: anywhere;
}

.result-status {
  min-height: 1.45em;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.result-status.error-state {
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 750;
}

/* Badges de Classificação */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.status-badge.healthy {
  background: var(--good-soft);
  color: var(--good);
  border: 1px solid #c7ebd7;
}

.status-badge.acceptable {
  background: var(--info-soft);
  color: var(--info);
  border: 1px solid #bde4ed;
}

.status-badge.warning {
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid #fae4a7;
}

.status-badge.critical {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #f8cdcd;
}

/* Bloco Destaque Financeiro */
.financial-highlight {
  margin: 16px 0 20px;
  padding: 16px;
  border: 1px solid #b7d8d4;
  border-radius: 12px;
  background: var(--soft);
}

.financial-highlight span {
  display: block;
  color: #315456;
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.financial-highlight strong {
  display: block;
  margin: 4px 0 3px;
  color: var(--primary-dark);
  font-size: 1.7rem;
}

.financial-highlight small {
  display: block;
  color: #496568;
  font-size: 0.75rem;
  line-height: 1.45;
}

/* Detalhamento de métricas */
.result-list {
  margin: 0;
  border-top: 1px solid var(--line);
}

.result-list div {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.result-list dt {
  color: var(--muted);
  font-size: 0.86rem;
}

.result-list dd {
  margin: 0;
  color: var(--ink);
  font-weight: 850;
  text-align: right;
  font-size: 0.88rem;
}

/* Composição Visual */
.composition {
  margin-top: 18px;
}

.composition h3 {
  margin: 0 0 10px;
  font-size: 0.96rem;
}

.composition-bar {
  width: 100%;
  height: 24px;
  overflow: hidden;
  border-radius: 7px;
  display: flex;
  background: #edf2f1;
}

.composition-bar span {
  width: 0;
  min-width: 0;
  transition: width 0.25s ease;
}

.worked-segment {
  background: var(--primary);
}

.lost-segment {
  background: #d85741;
}

.composition-legend {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.composition-legend p {
  margin: 0;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 3px 6px;
  color: var(--muted);
  font-size: 0.74rem;
}

.composition-legend strong {
  grid-column: 2;
  color: var(--ink);
  font-size: 0.85rem;
}

.legend-marker {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  grid-row: 1/3;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 900;
}

.worked-marker {
  background: var(--primary);
}

.lost-marker {
  background: #d85741;
}

/* Card de Simulação de Economia */
.simulation-card {
  margin-top: 24px;
  padding: clamp(20px, 3vw, 26px);
  background: #fbfdfd;
}

.simulation-card h2 {
  margin: 0 0 8px;
  font-size: 1.3rem;
}

.simulation-card .sim-intro {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.88rem;
}

.sim-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.sim-stat {
  padding: 16px;
  border: 1px solid #cae4df;
  border-radius: 12px;
  background: #fff;
}

.sim-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 750;
  text-transform: uppercase;
}

.sim-stat strong {
  display: block;
  margin-top: 4px;
  color: var(--primary-dark);
  font-size: 1.35rem;
}

.sim-stat small {
  display: block;
  margin-top: 4px;
  color: #557275;
  font-size: 0.74rem;
  line-height: 1.35;
}

/* Guia Rápido de Benchmarks */
.quick-guide {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.quick-guide article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}

.quick-guide h3 {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.3;
}

.quick-guide p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.ad-space {
  min-height: 120px;
  margin: 35px 0;
  overflow: hidden;
  display: grid;
  place-items: center;
}

/* Conteúdo Educativo */
.education {
  padding: clamp(24px, 5vw, 46px);
}

.education > h2 {
  margin: 30px 0 7px;
  font-size: 1.45rem;
}

.education > .eyebrow + h2 {
  margin-top: 0;
}

.education > p:not(.eyebrow) {
  max-width: 850px;
  color: #496366;
}

.education ul {
  max-width: 850px;
  padding-left: 20px;
  color: #496366;
  font-size: 0.94rem;
}

.education li {
  margin-bottom: 6px;
}

.related {
  margin-top: 35px;
  padding-top: 25px;
  border-top: 1px solid var(--line);
}

.related h2 {
  margin: 0 0 14px;
  font-size: 1.25rem;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.related-grid a {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
}

.related-grid a:hover {
  border-color: #9ccdc8;
  background: var(--soft);
}

.related-grid span {
  color: var(--muted);
  font-size: 0.8rem;
}

.related-grid strong {
  color: var(--primary-dark);
  font-size: 0.82rem;
}

.disclaimer {
  margin-top: 28px;
  padding: 16px;
  border-left: 4px solid var(--primary);
  border-radius: 0 10px 10px 0;
  background: var(--soft);
  color: #405d60;
  font-size: 0.8rem;
}

.notice {
  padding: 13px;
  border-radius: 10px;
}

.workweek-notice {
  margin: 18px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  background: var(--soft);
  color: var(--ink);
  font-size: .85rem;
  line-height: 1.6;
}

.workweek-notice h3 { margin: 0 0 8px; font-size: 1rem; }
.workweek-notice ul { margin: 0; padding-left: 20px; }
.workweek-notice p { margin: 10px 0 0; }

.notice.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Responsividade */
@media (max-width: 950px) {
  .calculator-layout {
    grid-template-columns: 1fr;
  }
  .result-card {
    position: static;
  }
  .sim-grid {
    grid-template-columns: 1fr;
  }
  .quick-guide {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 680px) {
  .page-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 34px;
  }
  .hero {
    margin-bottom: 25px;
  }
  .field-grid, .related-grid, .days-helper-grid {
    grid-template-columns: 1fr;
  }
  .calculator-actions .button {
    width: 100%;
  }
  .quick-guide {
    grid-template-columns: 1fr;
  }
  .composition-legend {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .page-shell {
    width: min(100% - 16px, 1120px);
  }
  .panel, .result-card, .simulation-card {
    border-radius: 14px;
  }
  .main-result {
    font-size: 2.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .composition-bar span {
    transition: none;
  }
}
