/* ---------- tokens ---------- */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-soft: #64748b;
  --accent: #0f5c8c;
  --accent-soft: #e6f0f7;
  --ok: #0f7b4f;
  --ok-soft: #e4f4ec;
  --warn: #a33a2a;
  --warn-soft: #fbeae6;
  --campo: #f0f7fc;
  --campo-borda: #a9cde6;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --radius: 10px;
}

:root[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #131c2e;
  --surface-2: #182236;
  --border: #253149;
  --border-strong: #33425f;
  --text: #e8eef7;
  --text-soft: #94a3b8;
  --accent: #5aa9dd;
  --accent-soft: #16293a;
  --ok: #5fce9c;
  --ok-soft: #122c22;
  --warn: #f0907c;
  --warn-soft: #331a17;
  --campo: #16293a;
  --campo-borda: #2f5d7e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---------- topbar ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding-top: 16px; padding-bottom: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  font-size: 22px; width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  background: var(--accent-soft); border-radius: var(--radius);
}
.brand h1 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.brand-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--text-soft); }

/* ---------- layout ---------- */
.layout {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 18px; align-items: start;
  padding-top: 22px;
}
.coluna { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
}

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.card-head h2 {
  margin: 0; font-size: 12px; font-weight: 650;
  text-transform: uppercase; letter-spacing: .06em; color: var(--text-soft);
}

/* ---------- linhas rótulo/valor ---------- */
.linhas { display: flex; flex-direction: column; }

.linha {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 10px 18px;
  border-bottom: 1px solid var(--border);
}
.linha:last-child { border-bottom: none; }
label.linha { cursor: pointer; }

.rot { font-size: 13.5px; color: var(--text-soft); flex: 1 1 auto; min-width: 0; }
.rot em { font-style: normal; opacity: .75; }

.val {
  font-size: 15px; font-weight: 600; text-align: right;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.val.vazio, .selo.vazio { color: var(--text-soft); font-weight: 400; }

.linha-forte { background: var(--surface-2); }
.linha-forte .rot { color: var(--text); font-weight: 550; }
.linha-forte .val { font-size: 17px; }

/* ---------- campos de entrada (as "células azuis") ---------- */
.ent {
  display: inline-flex; align-items: center; flex: none;
  background: var(--campo);
  border: 1px solid var(--campo-borda);
  border-radius: 7px; overflow: hidden;
  width: 152px;
}
.ent-curta { width: 104px; }
.ent i {
  font-style: normal; font-size: 12.5px; color: var(--text-soft);
  padding: 0 8px; flex: none;
}
.ent i:last-child { order: 2; }
.ent input {
  font: inherit; color: var(--text);
  background: transparent; border: none; outline: none;
  padding: 8px 10px 8px 0; width: 100%; min-width: 0;
  text-align: right; font-variant-numeric: tabular-nums;
}
.ent:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- destaques (entrada / parcela) ---------- */
.destaques { display: grid; grid-template-columns: 1fr 1fr; }
.dest {
  padding: 16px 18px; display: flex; flex-direction: column; gap: 3px;
  border-right: 1px solid var(--border);
}
.dest:last-child { border-right: none; }
.dest-rot {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-soft); font-weight: 600;
}
.dest-val {
  font-size: 24px; font-weight: 650; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.dest-val.vazio { color: var(--text-soft); font-weight: 400; }
.dest-sub { font-size: 12.5px; color: var(--text-soft); font-variant-numeric: tabular-nums; }

@media (max-width: 420px) {
  .destaques { grid-template-columns: 1fr; }
  .dest { border-right: none; border-bottom: 1px solid var(--border); }
}

/* ---------- proposta ---------- */
.card.destaque { border-color: var(--accent); }
.card.destaque .card-head { background: var(--accent-soft); }
.card.destaque .card-head h2 { color: var(--accent); }

.proposta {
  margin: 0; padding: 18px;
  font-size: 17px; line-height: 1.5; font-weight: 550;
}
.proposta-vazia, .proposta-aviso { font-size: 13.5px; font-weight: 400; color: var(--text-soft); }
.proposta-aviso { color: var(--warn); background: var(--warn-soft); }

.alerta {
  margin: 0; padding: 11px 18px;
  font-size: 12.5px; line-height: 1.5;
  color: var(--warn); background: var(--warn-soft);
  border-top: 1px solid var(--border);
}

/* ---------- selos ---------- */
.selo {
  font-size: 12px; font-weight: 650; letter-spacing: .04em;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.selo-ok { background: var(--ok-soft); color: var(--ok); }
.selo-ruim { background: var(--warn-soft); color: var(--warn); }

/* ---------- notas ---------- */
.note {
  margin: 0; padding: 12px 18px 15px;
  font-size: 12.5px; color: var(--text-soft); line-height: 1.6;
  border-top: 1px solid var(--border);
}
.note-tight { padding-top: 11px; padding-bottom: 13px; }

/* ---------- botões ---------- */
.btn {
  appearance: none; font: inherit; font-weight: 550; cursor: pointer;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 7px;
  padding: 8px 14px;
}
.btn:hover { background: var(--surface-2); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-sm { padding: 4px 11px; font-size: 12.5px; }
.btn-ghost { border-color: transparent; background: transparent; padding: 8px 10px; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger-ghost { color: var(--warn); border-color: transparent; background: transparent; }
.btn-danger-ghost:hover { background: var(--warn-soft); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- footer ---------- */
.foot {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding-top: 20px; padding-bottom: 32px; margin-top: 22px;
  border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-soft);
}
.foot p { margin: 0; }
.foot-brand { font-weight: 600; }

/* ---------- print ---------- */
@media print {
  .topbar, .actions, .btn, .foot p:first-child { display: none !important; }
  body { background: #fff; }
  .layout { grid-template-columns: 1fr; gap: 12px; }
  .card { break-inside: avoid; box-shadow: none; border-color: #999; }
  .ent { border-color: #999; background: #fff; }
}
