/* ===== Tokens ===== */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1a1d23;
  --text-muted: #5a6270;
  --border: #e2e5ea;
  --accent: #146c43;
  --accent-ink: #ffffff;
  --accent-soft: #e8f5ee;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20,20,30,.04), 0 8px 24px rgba(20,20,30,.06);
  --maxw: 880px;
  font-size: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151a;
    --surface: #1b1f26;
    --text: #eef0f3;
    --text-muted: #9aa3b2;
    --border: #2a2f38;
    --accent: #3ddc84;
    --accent-ink: #0b1510;
    --accent-soft: #16261d;
    --danger: #ff8a80;
    --danger-soft: #3a1f1d;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  --bg: #12151a; --surface: #1b1f26; --text: #eef0f3; --text-muted: #9aa3b2;
  --border: #2a2f38; --accent: #3ddc84; --accent-ink: #0b1510; --accent-soft: #16261d;
  --danger: #ff8a80; --danger-soft: #3a1f1d;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ===== Header ===== */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 20;
}
.site-header .wrap { max-width: 1080px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 14px; }
.logo { font-weight: 800; font-size: 1.05rem; text-decoration: none; color: var(--text); display: flex; align-items: center; gap: 8px; }
.logo .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a { font-size: .88rem; text-decoration: none; color: var(--text-muted); padding: 8px 10px; border-radius: 8px; white-space: nowrap; }
.site-nav a:hover, .site-nav a.is-active { background: var(--accent-soft); color: var(--accent); }
.theme-toggle {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  padding: 0; transition: color .15s, border-color .15s;
}
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 760px) {
  /* En móvil el menú pasa a una segunda fila con scroll horizontal (antes desaparecía) */
  .site-header .wrap { flex-wrap: wrap; padding-bottom: 8px; }
  .theme-toggle { order: 1; margin-left: auto; }
  .site-nav { order: 2; width: 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin: 0 -20px; padding: 0 20px; }
  .site-nav::-webkit-scrollbar { display: none; }
}

/* ===== Hero / H1 ===== */
.tool-hero { padding: 28px 0 8px; max-width: 1080px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
.tool-hero h1 { font-size: clamp(1.4rem, 3vw, 2rem); margin: 0 0 6px; }
.tool-hero p { color: var(--text-muted); margin: 0; max-width: 60ch; }
.breadcrumb { font-size: .82rem; color: var(--text-muted); margin-bottom: 10px; }
.breadcrumb a { color: var(--text-muted); }

/* ===== Tool card ===== */
.tool-card {
  max-width: 1080px; margin: 18px auto 0; padding: 0 20px;
}
.tool-card .card-inner {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px;
}
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .82rem; font-weight: 600; color: var(--text-muted); }
.field input, .field select {
  font-size: 1rem; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); width: 100%; font-family: inherit;
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.field .hint { font-size: .76rem; color: var(--text-muted); }
.field-inline { display: flex; gap: 8px; }
.field-inline input { flex: 1 1 auto; min-width: 0; }
.field-inline select { flex: 0 0 auto; width: auto; padding-right: 30px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink); border: none; border-radius: 10px;
  font-weight: 700; font-size: 1rem; padding: 12px 20px; cursor: pointer; margin-top: 6px;
}
.btn:hover { filter: brightness(1.06); }
.btn.secondary { background: transparent; color: var(--accent); border: 1px solid var(--border); }

.result-panel {
  margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--border);
  display: none;
}
.result-panel.is-visible { display: block; animation: rise .22s ease-out both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .result-panel.is-visible { animation: none; }
}
.trust-line {
  display: flex; align-items: center; gap: 6px; font-size: .76rem; color: var(--text-muted);
  margin: 14px 0 0; letter-spacing: .01em;
}
.trust-line svg { width: 14px; height: 14px; color: var(--accent); flex-shrink: 0; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 6px; }
.stat { background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; }
.stat .num { font-size: 1.3rem; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.stat .label { font-size: .78rem; color: var(--text-muted); }
.error-box { display:none; background: var(--danger-soft); color: var(--danger); border-radius: 10px; padding: 10px 14px; font-size: .88rem; margin-top: 10px; }
.error-box.is-visible { display: block; }

.privacy-badge {
  display: flex; align-items: flex-start; gap: 8px; font-size: .8rem; color: var(--text-muted);
  margin-top: 14px;
}
.privacy-badge svg { flex-shrink: 0; width: 16px; height: 16px; margin-top: 1px; color: var(--accent); }

/* ===== Ad slots ===== */
.ad-slot {
  max-width: 1080px; margin: 24px auto; padding: 0 20px;
}
.ad-slot .box {
  border: 1px dashed var(--border); border-radius: 10px; min-height: 90px;
  display: flex; align-items: center; justify-content: center; color: var(--text-muted);
  font-size: .78rem; letter-spacing: .04em; text-transform: uppercase;
}

/* ===== Content sections ===== */
.content { max-width: 1080px; margin: 0 auto; padding: 8px 20px 0; }
.content h2 { font-size: 1.25rem; margin-top: 34px; }
.content p { color: var(--text); max-width: 74ch; }
.content table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.content table caption { text-align: left; font-size: .8rem; color: var(--text-muted); margin-bottom: 6px; }
.content th, .content td { text-align: right; padding: 7px 10px; border-bottom: 1px solid var(--border); }
.content th:first-child, .content td:first-child { text-align: left; }
.content thead th { color: var(--text-muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; }
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; margin-top: 10px; }
.table-scroll table { margin: 0; }

/* FAQ */
.faq details {
  border: 1px solid var(--border); border-radius: 10px; padding: 4px 14px; margin-bottom: 8px; background: var(--surface);
}
.faq summary { cursor: pointer; font-weight: 600; padding: 10px 0; }
.faq p { color: var(--text-muted); margin: 0 0 12px; }

/* Related tools */
.related { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 14px; }
.related a {
  display: block; text-decoration: none; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
}
.related a strong { display: block; font-size: .95rem; margin-bottom: 4px; }
.related a span { font-size: .8rem; color: var(--text-muted); }
.related a:hover { border-color: var(--accent); }

/* Chart canvas */
.chart-wrap { margin-top: 16px; }
canvas.amort-chart { width: 100%; height: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }

/* ===== Home hero ===== */
.home-hero {
  max-width: 1080px; margin: 0 auto; padding: 44px 20px 10px;
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 32px; align-items: center;
}
.home-hero h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); margin: 0 0 12px; }
.home-hero p { color: var(--text-muted); max-width: 52ch; margin: 0; font-size: 1.05rem; }
.hero-art { width: 100%; max-width: 420px; height: auto; margin: 0 auto; display: block; }
.hero-art .line { stroke: var(--accent); }
.hero-art .area { fill: var(--accent); }
.hero-art .grid { stroke: var(--border); }
.hero-art .coin { fill: var(--surface); stroke: var(--accent); }
.hero-art .coin-txt { fill: var(--accent); font-family: var(--font-display); font-weight: 700; }
.hero-art .dot { fill: var(--accent); }
@media (max-width: 760px) {
  .home-hero { grid-template-columns: 1fr; text-align: center; gap: 18px; padding-top: 32px; }
  .home-hero p { margin: 0 auto; }
  .hero-art { max-width: 260px; }
}
.tool-grid { max-width: 1080px; margin: 30px auto; padding: 0 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.tool-grid a {
  text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.tool-grid a { transition: border-color .15s, transform .15s; }
.tool-grid a:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 10px; background: var(--accent-soft); color: var(--accent); margin-bottom: 12px;
}
.tool-icon svg { width: 22px; height: 22px; }
.tool-grid a h3 { margin: 0 0 6px; font-size: 1.05rem; }
.tool-grid a p { margin: 0; color: var(--text-muted); font-size: .88rem; }
.tool-grid a .go { margin-top: 12px; display: inline-block; font-size: .82rem; font-weight: 700; color: var(--accent); }

/* ===== Footer ===== */
.site-footer { border-top: 1px solid var(--border); margin-top: 50px; padding: 26px 0 40px; }
.site-footer .wrap { max-width: 1080px; display: flex; flex-wrap: wrap; gap: 10px 20px; justify-content: space-between; font-size: .82rem; color: var(--text-muted); }
.site-footer a { color: var(--text-muted); }
.site-footer nav { display: flex; gap: 14px; flex-wrap: wrap; }

.legal-page .content { padding-bottom: 60px; }

/* ===== Blog / artículos ===== */
.post-meta { font-size: .82rem; color: var(--text-muted); margin-top: 8px !important; }
.post-body { max-width: 780px; margin-left: auto; margin-right: auto; }
.post-body p, .post-body li { font-size: 1.02rem; line-height: 1.7; }
.post-body h2 { font-size: 1.35rem; margin-top: 36px; }
.post-body ul, .post-body ol { padding-left: 22px; }
.post-body li { margin-bottom: 6px; }
.post-body code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; background: var(--accent-soft); color: var(--text); padding: 3px 8px; border-radius: 6px; }
.post-body table { margin: 12px 0 18px; }
.post-body table caption { caption-side: bottom; margin-top: 6px; }
.post-cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--accent-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin: 30px 0 10px;
}
.post-cta strong { font-size: 1.05rem; }
.post-cta .btn { margin-top: 0; text-decoration: none; }
.post-list { display: grid; gap: 14px; margin-top: 14px; }
.post-list--grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 6px; }
.post-card {
  display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px;
  transition: border-color .15s, transform .15s;
}
.post-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.post-card .post-tag { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.post-card strong { font-size: 1rem; line-height: 1.3; }
.post-card span:last-child { font-size: .84rem; color: var(--text-muted); }
.field textarea {
  font-size: 1rem; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); width: 100%; font-family: inherit; resize: vertical;
}
.field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.home-posts { max-width: 1080px; margin: 0 auto; padding: 8px 20px 0; }
.home-posts h2 { font-size: 1.25rem; margin: 30px 0 4px; }
.home-posts .more { display: inline-block; margin-top: 14px; font-weight: 700; font-size: .9rem; }
