:root {
  --background: #F5F2EA;
  --foreground: #1E4235;
  --card: #FBFAF6;
  --card-foreground: #1E4235;
  --primary: #2E7D5B;
  --primary-foreground: #FBFAF6;
  --secondary: #EFEBDD;
  --secondary-foreground: #1E4235;
  --muted: #EFEBDD;
  --muted-foreground: #5B6159;
  --accent: #D9A441;
  --accent-foreground: #1E4235;
  --destructive: #B3261E;
  --border: #E4DFCF;
  --ring: #2E7D5B;
  --radius: 0.875rem;
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.06), 0 1px 2px -1px rgb(0 0 0 / 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; background: var(--background); }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--background);
  color: var(--foreground);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

.text-balance { text-wrap: balance; }
.text-pretty { text-wrap: pretty; }

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

.skip-link {
  position: absolute; top: -3rem; left: 1rem; z-index: 100;
  background: var(--primary); color: var(--primary-foreground);
  padding: 0.625rem 1rem; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 600;
  transition: top 0.15s;
}
.skip-link:focus { top: 1rem; }

/* ---------- Header ---------- */
header.site {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in oklch, var(--background) 80%, transparent);
  backdrop-filter: blur(12px);
}
header.site .inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 4rem; max-width: 64rem; margin: 0 auto;
  padding: 0 1rem;
}
@media (min-width: 640px) { header.site .inner { padding: 0 1.5rem; } }
.logo { display: flex; align-items: center; flex-shrink: 0; }
.logo-img {
  display: block;
  height: 2.75rem;
  width: auto;
}
@media (min-width: 640px) {
  .logo-img { height: 3rem; }
}
nav.desktop { display: none; align-items: center; gap: 0.25rem; }
nav.desktop a {
  border-radius: 9999px; padding: 0.5rem 0.875rem;
  font-size: 0.875rem; font-weight: 500; color: var(--muted-foreground);
  transition: background 0.15s, color 0.15s;
}
nav.desktop a:hover { background: var(--secondary); color: var(--foreground); }
.btn-cta {
  display: none; border-radius: 9999px; background: var(--primary);
  color: var(--primary-foreground); padding: 0.5rem 1rem;
  font-size: 0.875rem; font-weight: 600; transition: opacity 0.15s;
}
.btn-cta:hover { opacity: 0.9; }
@media (min-width: 640px) {
  nav.desktop { display: flex; }
  .btn-cta { display: inline-flex; }
}

/* ---------- Main / hero ---------- */
main { max-width: 64rem; margin: 0 auto; padding: 1.5rem 1rem 7rem; }
@media (min-width: 640px) { main { padding: 2.5rem 1.5rem 5rem; } }

.eyebrow { font-size: 0.875rem; font-weight: 500; color: var(--primary); }
h1 {
  margin-top: 0.75rem; font-size: 1.875rem; font-weight: 600;
  letter-spacing: -0.02em; max-width: 42rem;
}
@media (min-width: 640px) { h1 { font-size: 2.25rem; } }
.lead {
  margin-top: 0.75rem; font-size: 1rem; line-height: 1.625;
  color: var(--muted-foreground); max-width: 42rem;
}

.badges {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  margin-top: 1rem; list-style: none;
}
.badges li {
  display: flex; align-items: center; gap: 0.375rem;
  background: var(--card); box-shadow: var(--shadow-sm);
  color: var(--muted-foreground); font-size: 0.75rem; font-weight: 600;
  padding: 0.375rem 0.75rem; border-radius: 9999px;
}
.badges svg { width: 14px; height: 14px; color: var(--primary); flex-shrink: 0; }

.scroll-mt { scroll-margin-top: 5rem; }

/* ---------- Calculator layout ---------- */
.calc-grid { display: grid; gap: 1.5rem; margin-top: 2rem; }
@media (min-width: 1024px) {
  .calc-grid { margin-top: 2.5rem; }
}

.card { background: var(--card); border-radius: 1.5rem; box-shadow: var(--shadow-sm); }
.calc-form { padding: 1.25rem; max-width: 42rem; }
@media (min-width: 640px) { .calc-form { padding: 2rem; } }
.calc-form h2 { font-size: 1.125rem; font-weight: 600; }
.calc-form .sub { font-size: 0.875rem; color: var(--muted-foreground); }

.field-group { display: grid; gap: 1.25rem; }
@media (min-width: 640px) { .two-col { grid-template-columns: 1fr 1fr; } }
.mt-5 { margin-top: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }

label.lbl { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.375rem; }
.field {
  width: 100%; border-radius: 0.75rem; background: var(--muted);
  padding: 0.625rem 0.875rem; font-size: 0.875rem; color: var(--foreground);
  outline: none; border: none; transition: box-shadow 0.15s;
  font-family: inherit;
}
.field::placeholder { color: var(--muted-foreground); }
.field:focus { box-shadow: 0 0 0 2px color-mix(in oklch, var(--primary) 40%, transparent); }
.hint { margin-top: 0.375rem; font-size: 0.75rem; color: var(--muted-foreground); }

/* Custom select (wraps a visually-hidden native <select>) */
.select { position: relative; }
.native-select {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.select-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  border-radius: 0.75rem; background: var(--muted); padding: 0.625rem 0.875rem;
  font-size: 0.875rem; color: var(--foreground); text-align: left; transition: box-shadow 0.15s;
}
.select-trigger:focus { outline: none; box-shadow: 0 0 0 2px color-mix(in oklch, var(--primary) 40%, transparent); }
.select-trigger .chev { flex-shrink: 0; transition: transform 0.2s; color: var(--muted-foreground); }
.select.open .select-trigger .chev { transform: rotate(180deg); }
.select-panel {
  position: absolute; z-index: 50; top: calc(100% + 0.375rem); left: 0; right: 0;
  background: var(--card); border-radius: 0.875rem; padding: 0.375rem;
  box-shadow: 0 10px 30px -5px rgb(0 0 0 / 0.15), 0 2px 8px -2px rgb(0 0 0 / 0.1);
  display: none; max-height: 16rem; overflow-y: auto;
}
.select.open .select-panel { display: block; }
.select-option {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  width: 100%; border-radius: 0.625rem; padding: 0.5rem 0.625rem; background: transparent;
  font-size: 0.875rem; color: var(--foreground); text-align: left; transition: background 0.12s;
}
.select-option:hover, .select-option.active { background: var(--secondary); }
.select-option .check { color: var(--primary); opacity: 0; flex-shrink: 0; }
.select-option[aria-selected="true"] .check { opacity: 1; }

/* Custom date picker (wraps a visually-hidden native <input type="date">) */
.date-field { position: relative; }
.date-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  border-radius: 0.75rem; background: var(--muted); padding: 0.625rem 0.875rem;
  font-size: 0.875rem; color: var(--foreground); text-align: left; transition: box-shadow 0.15s;
}
.date-trigger:focus { outline: none; box-shadow: 0 0 0 2px color-mix(in oklch, var(--primary) 40%, transparent); }
.date-trigger .cal-icon { flex-shrink: 0; color: var(--muted-foreground); }
.date-value.placeholder { color: var(--muted-foreground); }

.date-panel {
  position: absolute; z-index: 50; top: calc(100% + 0.375rem); left: 0;
  width: 17.5rem; max-width: 90vw;
  background: var(--card); border-radius: 0.875rem; padding: 0.75rem;
  box-shadow: 0 10px 30px -5px rgb(0 0 0 / 0.15), 0 2px 8px -2px rgb(0 0 0 / 0.1);
  display: none;
}
.date-field.open .date-panel { display: block; }

.date-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 0 0.25rem 0.5rem; }
.date-panel-label {
  font-size: 0.8125rem; font-weight: 600; text-transform: capitalize;
  padding: 0.25rem 0.5rem; border-radius: 0.5rem; transition: background 0.12s;
}
.date-panel-label:hover { background: var(--secondary); }
.date-nav-btn {
  display: flex; align-items: center; justify-content: center;
  width: 1.75rem; height: 1.75rem; border-radius: 0.5rem;
  color: var(--muted-foreground); transition: background 0.12s, color 0.12s;
}
.date-nav-btn:hover { background: var(--secondary); color: var(--foreground); }

.date-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 0.25rem; }
.date-weekdays span { font-size: 0.6875rem; font-weight: 600; text-align: center; color: var(--muted-foreground); }

.date-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.date-day {
  display: flex; align-items: center; justify-content: center;
  height: 2rem; border-radius: 0.5rem; font-size: 0.8125rem; color: var(--foreground);
  transition: background 0.12s, color 0.12s;
}
.date-day:hover { background: var(--secondary); }
.date-day.outside { color: var(--muted-foreground); opacity: 0.5; }
.date-day.today { font-weight: 700; color: var(--primary); }
.date-day.selected { background: var(--primary); color: var(--primary-foreground); font-weight: 600; }

.date-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.375rem; }
.date-month {
  display: flex; align-items: center; justify-content: center;
  height: 2.5rem; border-radius: 0.625rem; font-size: 0.8125rem;
  text-transform: capitalize; color: var(--foreground);
  transition: background 0.12s, color 0.12s;
}
.date-month:hover { background: var(--secondary); }
.date-month.today { font-weight: 700; color: var(--primary); }
.date-month.selected { background: var(--primary); color: var(--primary-foreground); font-weight: 600; }

.date-panel-footer { display: flex; justify-content: center; margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.date-today-btn { font-size: 0.75rem; font-weight: 600; color: var(--primary); padding: 0.25rem 0.625rem; border-radius: 0.5rem; }
.date-today-btn:hover { background: var(--secondary); }

/* Toast de erro (substitui os balões nativos de validação) */
.toast {
  position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%);
  z-index: 60; display: flex; align-items: flex-start; gap: 0.625rem;
  max-width: 24rem; width: calc(100% - 2rem);
  background: var(--card); color: var(--foreground);
  border-radius: 0.875rem; padding: 0.875rem 1rem;
  box-shadow: 0 10px 30px -5px rgb(0 0 0 / 0.2), 0 2px 8px -2px rgb(0 0 0 / 0.1);
  border-left: 4px solid var(--destructive);
}
@media (max-width: 639px) { .toast { bottom: calc(4.5rem + env(safe-area-inset-bottom)); } }
.toast .icon { color: var(--destructive); flex-shrink: 0; margin-top: 0.125rem; }
.toast p { font-size: 0.8125rem; line-height: 1.5; flex: 1; }
.toast .toast-close {
  flex-shrink: 0; color: var(--muted-foreground); padding: 0.125rem; border-radius: 0.375rem; transition: background 0.12s, color 0.12s;
}
.toast .toast-close:hover { background: var(--secondary); color: var(--foreground); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 0.5rem); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast:not(.hidden) { animation: toast-in 0.18s ease-out; }

.actions { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 0.75rem; }
@media (min-width: 640px) { .actions { flex-direction: row; } }
.btn-primary {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  border-radius: 0.75rem; background: var(--primary); color: var(--primary-foreground);
  padding: 0.75rem 1.25rem; font-size: 0.875rem; font-weight: 600; transition: background 0.15s, opacity 0.15s;
}
.btn-primary:hover { background: color-mix(in oklch, var(--primary) 90%, black); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  border-radius: 0.75rem; background: var(--muted); color: var(--foreground);
  padding: 0.75rem 1.25rem; font-size: 0.875rem; font-weight: 500; transition: background 0.15s;
}
.btn-secondary:hover { background: var(--secondary); }

/* ---------- Result ---------- */
.result-stack { display: flex; flex-direction: column; gap: 1rem; }
.total-card {
  border-radius: 1.5rem; background: var(--primary); color: var(--primary-foreground);
  padding: 1.5rem; box-shadow: var(--shadow-sm);
}
.total-card .cap { font-size: 0.875rem; color: color-mix(in oklch, var(--primary-foreground) 80%, transparent); }
.total-card .val { margin-top: 0.5rem; font-size: 2.25rem; font-weight: 600; letter-spacing: -0.02em; }
.total-card .meta { margin-top: 0.5rem; font-size: 0.75rem; color: color-mix(in oklch, var(--primary-foreground) 70%, transparent); }

.detail-card { border-radius: 1.5rem; background: var(--card); padding: 1.5rem; box-shadow: var(--shadow-sm); }
.detail-card h3 { margin-bottom: 1rem; font-size: 0.875rem; font-weight: 600; }
.detail-list { list-style: none; display: flex; flex-direction: column; gap: 1rem; }
.detail-list li { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.detail-list .tt { font-size: 0.875rem; font-weight: 500; }
.detail-list .dd { font-size: 0.75rem; color: var(--muted-foreground); }
.detail-list .amt { flex-shrink: 0; font-size: 0.875rem; font-weight: 600; }
.detail-list .amt.neg { color: var(--destructive); }

.fgts-card {
  border-radius: 1.5rem; padding: 1.25rem;
  background: color-mix(in oklch, var(--accent) 20%, transparent);
}
.fgts-card p { font-size: 0.75rem; line-height: 1.625; color: color-mix(in oklch, var(--accent-foreground) 90%, transparent); }
.disclaimer { padding: 0 0.25rem; font-size: 0.75rem; line-height: 1.625; color: var(--muted-foreground); }

/* ---------- Result modal ---------- */
.result-modal {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
@media (min-width: 640px) {
  .result-modal { align-items: center; padding: 1.5rem; }
}
.result-modal-backdrop {
  position: absolute; inset: 0;
  background: rgb(15 25 20 / 0.55);
  backdrop-filter: blur(6px);
}
.result-modal-panel {
  position: relative; z-index: 1;
  width: 100%; max-width: 32rem;
  max-height: min(92vh, 44rem);
  display: flex; flex-direction: column;
  background: var(--background);
  border-radius: 1.25rem 1.25rem 0 0;
  box-shadow: 0 20px 50px rgb(0 0 0 / 0.25);
  overflow: hidden;
}
@media (min-width: 640px) {
  .result-modal-panel { border-radius: 1.25rem; }
}
.result-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.result-modal-header h2 { font-size: 1.0625rem; font-weight: 600; }
.result-modal-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; border-radius: 9999px;
  color: var(--muted-foreground); transition: background 0.15s, color 0.15s;
}
.result-modal-close:hover { background: var(--secondary); color: var(--foreground); }
.result-modal-body {
  overflow-y: auto; padding: 1.25rem;
  display: flex; flex-direction: column; gap: 1rem;
  -webkit-overflow-scrolling: touch;
}
body.modal-resultado-aberto { overflow: hidden; }

/* Anti-print / anti-capture (navegador não bloqueia Print Screen 100%) */
.no-capture,
.no-capture * {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
.result-modal.is-obscured .no-capture {
  filter: blur(14px);
  opacity: 0.2;
  transition: filter 0.08s, opacity 0.08s;
}
.result-modal:not(.is-obscured) .no-capture {
  transition: filter 0.25s ease, opacity 0.25s ease;
}
@media print {
  .result-modal,
  .no-capture,
  #resultado-protegido { display: none !important; }
}

/* ---------- Pagamento (PIX / PDF) ---------- */
.pagamento-card { border-radius: 1.5rem; background: var(--card); padding: 1.5rem; box-shadow: var(--shadow-sm); }
.pagamento-card h3 { font-size: 0.875rem; font-weight: 600; }
.pagamento-card > p { margin-top: 0.375rem; font-size: 0.75rem; line-height: 1.625; color: var(--muted-foreground); }
.pagamento-card .btn-primary { width: 100%; margin-top: 1rem; }

.pix-qrcode {
  display: flex; justify-content: center; padding: 1.25rem; margin-top: 1rem;
  background: var(--muted); border-radius: 0.875rem;
}
.pix-qrcode svg { max-width: 200px; width: 100%; height: auto; }

label.lbl + textarea.pix-copia-cola,
.pix-copia-cola {
  width: 100%; margin-top: 0.75rem; resize: vertical;
  border-radius: 0.75rem; background: var(--muted); border: none;
  padding: 0.625rem 0.875rem; font-size: 0.75rem; color: var(--foreground);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}
.pix-copia-cola:focus { outline: none; box-shadow: 0 0 0 2px color-mix(in oklch, var(--primary) 40%, transparent); }

.pagamento-card .btn-secondary { width: 100%; margin-top: 0.75rem; }
#pix-status { margin-top: 0.75rem; font-size: 0.75rem; color: var(--muted-foreground); }

/* ---------- Verbas ---------- */
section.verbas { margin-top: 4rem; }
section.verbas h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; }
section.verbas .sub { margin-top: 0.375rem; font-size: 0.875rem; color: var(--muted-foreground); }
.verbas-grid { margin-top: 1.5rem; display: grid; gap: 1rem; }
@media (min-width: 640px) { .verbas-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .verbas-grid { grid-template-columns: 1fr 1fr 1fr; } }
.verba-card { border-radius: 1rem; background: var(--card); padding: 1.25rem; box-shadow: var(--shadow-sm); }
.verba-card .icon { color: var(--primary); }
.verba-card h3 { margin-top: 0.75rem; font-size: 0.875rem; font-weight: 600; }
.verba-card p { margin-top: 0.375rem; font-size: 0.875rem; line-height: 1.625; color: var(--muted-foreground); }

/* ---------- Footer ---------- */
footer.site { margin-top: 4rem; background: color-mix(in oklch, var(--secondary) 60%, transparent); }
footer.site .inner { max-width: 64rem; margin: 0 auto; padding: 2rem 1rem; }
@media (min-width: 640px) { footer.site .inner { padding: 2rem 1.5rem; } }
footer.site h2 { font-size: 0.875rem; font-weight: 600; }
footer.site p { margin-top: 0.5rem; font-size: 0.75rem; line-height: 1.625; color: var(--muted-foreground); }
footer.site p + p { margin-top: 1rem; }
footer.site strong { font-weight: 600; color: var(--foreground); }

/* ---------- Mobile nav ---------- */
nav.mobile {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 40;
  background: color-mix(in oklch, var(--background) 90%, transparent);
  backdrop-filter: blur(12px);
}
nav.mobile .inner {
  max-width: 64rem; margin: 0 auto; display: flex; align-items: stretch;
  justify-content: space-around; padding: 0 0.5rem;
  padding-bottom: env(safe-area-inset-bottom);
}
nav.mobile a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.25rem;
  padding: 0.625rem 0; color: var(--muted-foreground); transition: color 0.15s;
}
nav.mobile a:hover { color: var(--primary); }
nav.mobile span { font-size: 0.6875rem; font-weight: 500; }
@media (min-width: 640px) { nav.mobile { display: none; } }
