:root {
  --bg: #f7f8fa; --surface: #ffffff; --text: #18202b; --muted: #5a6575; --border: #dfe3ea;
  --brand: #0b6e4f; --brand-ink: #ffffff; --brand-soft: #e5f3ee; --accent: #f2b705; --error: #b42318;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 12px rgba(16,24,40,.05);
  --max: 1040px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a; --surface: #161d25; --text: #e7ecf2; --muted: #9aa6b5; --border: #2a3440;
    --brand: #3cc497; --brand-ink: #062a1f; --brand-soft: #14322a; --error: #ff8a80;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--brand); }
img, svg { max-width: 100%; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.logo b { color: var(--brand); }
.nav-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; color: var(--text); font: inherit; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: 8px; font-size: .95rem; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 60px; background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px 16px 16px; flex-direction: column; }
  .nav.open { display: flex; }
}

/* Layout */
main { padding: 24px 0 48px; }
.breadcrumb { font-size: .875rem; color: var(--muted); margin-bottom: 8px; }
.breadcrumb a { color: var(--muted); }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 1.35rem; margin: 32px 0 8px; }
h3 { font-size: 1.1rem; margin: 20px 0 6px; }
.lead { color: var(--muted); font-size: 1.05rem; margin: 0 0 20px; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
@media (max-width: 860px) { .grid { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }

/* Formularios */
form .row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 560px) { form .row { grid-template-columns: minmax(0, 1fr); } }
label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
input[type=text], input[type=date], input[type=number], select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); font: inherit; min-height: 44px;
}
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.check input { width: 20px; height: 20px; }
.btn { display: inline-block; background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 10px; padding: 12px 22px; font: inherit; font-weight: 700; cursor: pointer; min-height: 44px; width: 100%; }
.btn:hover { filter: brightness(1.05); }
.link-btn { background: none; border: 0; color: var(--brand); padding: 0; font: inherit; font-size: .85rem; cursor: pointer; text-decoration: underline; }

/* Resultados */
#resultado { margin-top: 20px; }
table.res { width: 100%; border-collapse: collapse; }
table.res th, table.res td { padding: 10px 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.res th { text-align: left; font-weight: 500; }
table.res th small { display: block; color: var(--muted); font-weight: 400; font-size: .8rem; }
table.res td { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.res tr.total th, table.res tr.total td { font-weight: 800; font-size: 1.15rem; color: var(--brand); border-bottom: 0; }
.note { font-size: .875rem; color: var(--muted); background: var(--brand-soft); padding: 10px 12px; border-radius: 8px; }
.error { color: var(--error); font-weight: 600; }
.amort { margin-top: 12px; }
.amort summary { cursor: pointer; font-weight: 600; color: var(--brand); }
.scroll { overflow-x: auto; }
.amort table { width: 100%; border-collapse: collapse; font-size: .85rem; font-variant-numeric: tabular-nums; }
.amort th, .amort td { padding: 6px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }

/* Contenido */
.content { margin-top: 28px; }
.content p, .content li { max-width: 72ch; }
.formula { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; overflow-x: auto; }
.faq details { border-bottom: 1px solid var(--border); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 8px 0 0; }
.disclaimer { font-size: .85rem; color: var(--muted); border-left: 3px solid var(--accent); padding-left: 12px; margin-top: 28px; }

/* Lateral */
aside .card + .card { margin-top: 16px; }
aside h2 { font-size: 1rem; margin: 0 0 8px; }
aside ul { list-style: none; padding: 0; margin: 0; }
aside li a { display: block; padding: 6px 0; text-decoration: none; }
.kv { display: flex; justify-content: space-between; gap: 8px; font-size: .9rem; padding: 4px 0; }
.kv b { font-variant-numeric: tabular-nums; }

/* Inicio */
.hero { padding: 16px 0 8px; }
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 20px; }
.tool { display: block; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); transition: border-color .15s; }
.tool:hover { border-color: var(--brand); }
.tool strong { display: block; font-size: 1.05rem; margin-bottom: 4px; color: var(--brand); }
.tool span { color: var(--muted); font-size: .9rem; }

/* Publicidad */
.ad-slot { margin: 20px 0; min-height: 100px; text-align: center; }
.ad-slot:empty { display: none; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 24px 0; font-size: .9rem; color: var(--muted); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 8px; }
.site-footer a { color: var(--muted); }
