:root {
  --bg: #f6f8f5;
  --card: #ffffff;
  --ink: #17251d;
  --muted: #5b6b61;
  --line: #dfe6e0;
  --brand: #13795b;
  --brand-ink: #ffffff;
  --brand-soft: #e5f3ec;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --warn-soft: #fff6e0;
  --warn-ink: #7a4b00;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 40, 28, .06), 0 4px 16px rgba(16, 40, 28, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1612; --card: #17211b; --ink: #e8efe9; --muted: #a2b3a8; --line: #2a3a30;
    --brand: #3ccf98; --brand-ink: #062317; --brand-soft: #173428; --bad: #ff8a80; --bad-soft: #3a1d1b;
    --warn-soft: #3a2f12; --warn-ink: #ffd88a; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--brand); }
.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px; }

/* Encabezado */
.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 700; letter-spacing: -.01em; }
.logo svg { flex: none; }
.logo b { color: var(--brand); font-weight: 800; }
.top nav { display: flex; gap: 12px; font-size: 14px; }
@media (max-width: 380px) { .logo span { font-size: 15px; } .top nav { gap: 10px; font-size: 13px; } }
.top nav a { text-decoration: none; color: var(--muted); white-space: nowrap; }
.top nav a[aria-current="page"] { color: var(--brand); font-weight: 600; }

/* Barra del buzón (visible en todas las páginas) */
.buzon-bar { background: var(--brand-soft); font-size: 14px; text-align: center; padding: 8px 16px; }
.buzon-bar a { font-weight: 600; }

h1 { font-size: 1.6rem; line-height: 1.2; margin: 24px 0 6px; letter-spacing: -.02em; }
.lead { color: var(--muted); margin: 0 0 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 16px; margin-bottom: 16px; }
.card h2 { font-size: 1.1rem; margin: 0 0 12px; }

/* Formularios */
.field { margin-bottom: 14px; }
.field > label, .label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 4px; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[inputmode], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; min-height: 48px; appearance: none;
}
textarea { min-height: 140px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
.money { position: relative; }
.money::before { content: "$"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.money input { padding-left: 26px; }
.pct { position: relative; }
.pct::after { content: "%"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { display: block; text-align: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px 8px; cursor: pointer; background: var(--bg); font-weight: 600; min-height: 48px; }
.seg label small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.seg input:checked + label { border-color: var(--brand); background: var(--brand-soft); color: var(--ink); box-shadow: inset 0 0 0 1px var(--brand); }
.seg input:focus-visible + label { outline: 2px solid var(--brand); }
.seg.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

.check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--brand); }
.check span { font-size: 15px; }

.sugerencias { display: grid; gap: 6px; margin-top: 8px; }
.sugerencias label { display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; font-size: 14px; }
.sugerencias input { accent-color: var(--brand); width: 18px; height: 18px; }
.sugerencias small { color: var(--muted); margin-left: auto; font-size: 12px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; border: 0; border-radius: 12px; background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 700; font-size: 17px; cursor: pointer; text-decoration: none; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.alt { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.btn.wa { background: #1f9d55; color: #fff; }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Resultados */
.resultado-top { text-align: center; padding: 6px 0 12px; }
.resultado-top .k { color: var(--muted); font-size: 14px; }
.resultado-top .v { font-size: 2.3rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.resultado-top .m { font-weight: 700; }
.pos { color: var(--brand); }
.neg { color: var(--bad); }
.desglose { width: 100%; border-collapse: collapse; font-size: 15px; }
.desglose td { padding: 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.desglose td:last-child { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; padding-left: 8px; }
.desglose td small { display: block; color: var(--muted); font-size: 12px; }
.desglose tr.sub td { font-weight: 700; border-bottom: 2px solid var(--line); }
.desglose tr.total td { font-weight: 800; font-size: 17px; border-bottom: 0; }
.callout { border-radius: 10px; padding: 12px; font-size: 14px; margin: 12px 0; }
.callout.info { background: var(--brand-soft); }
.callout.warn { background: var(--warn-soft); color: var(--warn-ink); }
.callout.bad { background: var(--bad-soft); color: var(--bad); }
.minimo { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.minimo .v { font-size: 1.4rem; font-weight: 800; }
.minimo .pct { width: 96px; }
.stack > * + * { margin-top: 10px; }
.msg { margin-top: 12px; font-size: 15px; }
.msg.ok { color: var(--brand); font-weight: 600; }
.msg.err { color: var(--bad); }
.radicado { font-size: 1.6rem; font-weight: 800; letter-spacing: .04em; }
[hidden] { display: none !important; }

/* Pie */
footer { color: var(--muted); font-size: 13px; padding: 24px 0 40px; }
footer a { color: var(--muted); }
.legal h2 { font-size: 1.15rem; margin: 22px 0 6px; }
.legal p, .legal li { font-size: 15px; }
.badge { display: inline-block; background: var(--warn-soft); color: var(--warn-ink); border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 700; }

@media (min-width: 700px) {
  h1 { font-size: 2rem; }
  .card { padding: 24px; }
}
