:root {
  --bg: #0e1116;
  --card: #151a22;
  --card-border: #232a36;
  --text: #e6e8eb;
  --muted: #8a93a3;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary: #232a36;
  --erro: #ef4444;
  --ok: #16a34a;
  --req: #ef4444;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  padding: 16px 20px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #0a0d12;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; font-size: 18px; color: var(--primary); }
.step { font-size: 13px; color: var(--muted); }

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
}
.card h2 { margin: 0 0 8px; font-size: 17px; }
.card.center { text-align: center; padding: 32px 20px; }
.muted { color: var(--muted); font-size: 14px; margin: 4px 0 12px; }
.hint { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.req { color: var(--req); }

.row { margin: 12px 0; }
.row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row.three { display: grid; grid-template-columns: 1fr 80px 120px; gap: 12px; }

label { display: block; font-size: 14px; color: var(--text); }
label > input,
label > select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  font-size: 16px;
  background: #0a0d12;
  color: var(--text);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  outline: none;
}
input:focus, select:focus { border-color: var(--primary); }
input[readonly] { color: var(--muted); background: #0a0d12; }

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
  padding: 8px 0;
}
.checkbox input[type="checkbox"] {
  appearance: auto;
  -webkit-appearance: checkbox;
  width: 20px;
  height: 20px;
  margin: 2px 0 0 0;
  flex: 0 0 20px;
  cursor: pointer;
  accent-color: var(--primary);
}
.checkbox span { flex: 1; color: var(--text); }

.btn-primary, .btn-secondary {
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 14px 18px;
  border-radius: 8px;
  border: 0;
  cursor: pointer;
  width: 100%;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { background: #374151; cursor: not-allowed; }
.btn-secondary {
  background: var(--secondary);
  color: var(--text);
  border: 1px solid var(--card-border);
  margin-top: 12px;
}

.actions { padding: 0 4px 24px; }
.erro { color: var(--erro); font-size: 14px; margin-top: 10px; }

.apontamento {
  background: #0a0d12;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}
.apontamento.ro { padding: 12px 14px; }
.apontamento-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.apontamento-head strong { font-size: 14px; }
.ap-valor-tag {
  font-weight: 700;
  color: var(--text);
  background: #1a2330;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 13px;
}
.ap-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 3px 0;
}
.ap-row .ap-k { color: var(--muted); }
.ap-row .ap-v { color: var(--text); }

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--card-border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

.foot {
  text-align: center;
  padding: 24px 16px 32px;
  color: var(--muted);
}

@media (max-width: 480px) {
  .row.two { grid-template-columns: 1fr; }
  .row.three { grid-template-columns: 1fr 1fr; }
  .row.three label:first-child { grid-column: 1 / -1; }
}

/* Total da negativação + comparativo investimento */
.total-box {
  margin-top: 20px;
  padding: 16px;
  background: #0f1620;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
}
.total-box.hidden { display: none; }
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--card-border);
}
.total-row:last-of-type { border-bottom: none; }
.total-label { font-size: 14px; color: var(--text); flex: 1; }
.total-valor { font-size: 18px; font-weight: 700; white-space: nowrap; color: var(--text); }

/* Bloco investimento (destaque) */
.invest-block {
  margin-top: 14px;
  padding: 16px;
  background: rgba(22, 163, 74, 0.08);
  border: 1px solid rgba(22, 163, 74, 0.35);
  border-radius: var(--radius);
}
.invest-titulo {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.45;
}
.invest-parcelas {
  list-style: none;
  margin: 0;
  padding: 0;
}
.invest-parcelas li {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  column-gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(22, 163, 74, 0.25);
}
.invest-parcelas li:last-child { border-bottom: none; }
.invest-label { font-size: 14px; color: var(--text); font-weight: 500; }
.invest-valor { font-size: 18px; font-weight: 700; white-space: nowrap; }
.invest-valor.verde { color: var(--ok); }
.invest-tag {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.invest-total {
  margin: 10px 0 0 0;
  text-align: right;
  font-size: 13px;
  color: var(--muted);
}
.invest-total strong { color: var(--text); font-weight: 700; }
.total-fineprint {
  margin: 14px 0 0 0;
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.06);
  border-left: 3px solid var(--erro);
  border-radius: 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
