*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --bg: #f5f5f4;
  --surface: #ffffff;
  --surface-2: #fafaf9;
  --border: #e7e5e4;
  --text: #1c1917;
  --muted: #57534e;
  --primary: #1d4ed8;
  --primary-text: #ffffff;
  --warn-bg: #fef3c7;
  --warn-border: #f59e0b;
  --warn-text: #78350f;
  --total-bg: #dcfce7;
  --total-border: #16a34a;
  --total-text: #14532d;
  --error: #b91c1c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1917;
    --surface: #292524;
    --surface-2: #1c1917;
    --border: #44403c;
    --text: #f5f5f4;
    --muted: #a8a29e;
    --primary: #60a5fa;
    --primary-text: #0c111d;
    --warn-bg: #422006;
    --warn-border: #b45309;
    --warn-text: #fde68a;
    --total-bg: #052e16;
    --total-border: #16a34a;
    --total-text: #bbf7d0;
    --error: #fca5a5;
  }
}

html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
main { max-width: 640px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.5rem; margin: 8px 0 4px; }
h2 { font-size: 1.1rem; margin: 24px 0 8px; }
h3 { font-size: 1rem; margin: 16px 0 6px; }
p { margin: 8px 0; }
a { color: var(--primary); }
.subtitle { color: var(--muted); margin: 0 0 16px; font-size: 0.95rem; }

.disclaimer {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn-text);
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin: 12px 0 20px;
}

form { display: flex; flex-direction: column; gap: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 420px) { .row { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 0.95rem; }
.hint { color: var(--muted); font-size: 0.8rem; font-weight: 400; }
.check .hint { display: block; }
.field input,
.field select {
  width: 100%;
  padding: 12px;
  font: inherit;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 44px;
}
.field select:disabled { opacity: 0.7; }
.field input:focus, .field select:focus, button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.check input[type="checkbox"] { width: 20px; height: 20px; flex: none; }
.check label { font-weight: 500; flex: 1; }

details {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 10px 12px;
}
details summary { cursor: pointer; font-weight: 600; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: "+ "; color: var(--muted); }
details[open] summary::before { content: "\2212 "; }
details > * + * { margin-top: 12px; }

button {
  font: inherit;
  padding: 10px 14px;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
button:active { transform: translateY(1px); }
button.primary {
  margin-top: 8px;
  padding: 14px 16px;
  background: var(--primary);
  color: var(--primary-text);
  border: none;
  font-size: 1.05rem;
  font-weight: 600;
  min-height: 48px;
}

.error-box {
  background: var(--surface);
  border: 1px solid var(--error);
  color: var(--error);
  padding: 12px;
  border-radius: 8px;
}
.error-box ul { margin: 6px 0 0 18px; padding: 0; }

.results { margin-top: 24px; }
.verbas {
  list-style: none;
  padding: 0;
  margin: 8px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}
.verbas li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}
.verbas li:first-child { border-top: none; }
.verbas .label { display: flex; flex-direction: column; }
.verbas .label small { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.verbas .value { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.descontos .value { color: var(--error); }

.info-line {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 8px 0;
  font-size: 0.95rem;
}
.total {
  margin-top: 12px;
  padding: 14px 16px;
  background: var(--total-bg);
  border: 1px solid var(--total-border);
  color: var(--total-text);
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 1.15rem;
  font-weight: 700;
}
.total .value { font-variant-numeric: tabular-nums; }
.total small { display: block; font-size: 0.8rem; font-weight: 400; }
.total-fgts {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  font-size: 1rem;
}
.notes { margin: 16px 0; padding-left: 20px; color: var(--muted); font-size: 0.9rem; }
.notes li + li { margin-top: 6px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.actions button { flex: 1 1 140px; }
.status { min-height: 1.5em; color: var(--muted); font-size: 0.9rem; }

.footer {
  margin: 32px 0 16px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

@media print {
  :root {
    --bg: #fff;
    --surface: #fff;
    --text: #000;
    --muted: #333;
    --border: #999;
    --total-bg: #fff;
    --total-text: #000;
    --total-border: #000;
  }
  .no-print, .footer { display: none !important; }
  main { max-width: none; padding: 0; }
  .results { margin-top: 0; }
  .verbas li { break-inside: avoid; }
}

.faq { margin-top: 2.5rem; }
.faq h2 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.faq h3 { font-size: 1rem; margin: 1.25rem 0 0.35rem; }
.faq p { margin: 0; line-height: 1.55; }

.subtotal { display: flex; justify-content: space-between; gap: 1rem; padding: 10px 16px 0; margin-top: 12px; border-top: 1px solid var(--border); font-weight: 600; }
.subtotal .value { font-variant-numeric: tabular-nums; }
