/* =========================================================
   SUNACAE — Design System: Editorial Financiero Moderno
   Versión mejorada inspirada en Manus
   Paleta: Verde bosque + Lima + Blanco + Carbón
   Tipografía: Sora (display) + Source Sans 3 (body) + JetBrains Mono (datos)
   ========================================================= */

/* Import Google Fonts (ya en HTML, pero CSS las usa) */
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

/* ---------- Design tokens (OKLch perceptual) ---------- */
:root {
  --c-forest:       oklch(0.28 0.08 155);      /* Verde bosque */
  --c-forest-dark:  oklch(0.18 0.07 155);      /* Verde más oscuro */
  --c-lime:         oklch(0.65 0.18 145);      /* Verde lima */
  --c-lime-light:   oklch(0.75 0.15 145);      /* Verde lima claro */
  --c-carbon:       oklch(0.14 0.005 285);     /* Carbón oscuro */
  --c-stone:        oklch(0.55 0.01 285);      /* Gris medio */
  --c-stone-light:  oklch(0.75 0.005 285);     /* Gris claro */
  --c-cream:        oklch(0.98 0.005 90);      /* Crema suave */
  --c-white:        #FFFFFF;

  --f-display: 'Sora', 'Manrope', -apple-system, sans-serif;
  --f-body:    'Source Sans 3', 'Inter', -apple-system, sans-serif;
  --f-mono:    'JetBrains Mono', monospace;

  --fs-xs:    0.65rem;
  --fs-sm:    0.875rem;
  --fs-base:  1rem;
  --fs-md:    1.125rem;
  --fs-lg:    1.25rem;
  --fs-xl:    1.5rem;
  --fs-2xl:   2rem;
  --fs-3xl:   2.5rem;
  --fs-hero:  clamp(2.5rem, 5vw, 3.75rem);

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 20px;

  --sh-sm: 0 1px 2px rgba(15, 39, 64, 0.04);
  --sh-md: 0 4px 12px rgba(15, 39, 64, 0.08);
  --sh-lg: 0 12px 32px rgba(15, 39, 64, 0.12);
  --sh-xl: 0 24px 48px rgba(15, 39, 64, 0.16);

  --gap-sm: 12px;
  --gap-md: 24px;
  --gap-lg: 48px;
  --gap-xl: 80px;

  --t-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Reset universal ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--f-body);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--c-carbon);
  background: white;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { max-width: 100%; display: block; height: auto; }
a { color: inherit; text-decoration: none; transition: color var(--t-fast); }
button { font-family: inherit; cursor: pointer; border: 0; }

/* ---------- Tipografía editorial ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--f-display);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0 0 0.5em;
  color: var(--c-carbon);
}
h1 { font-size: var(--fs-hero); }
h2 { font-size: clamp(2rem, 4vw, 3rem); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
p { margin: 0 0 1em; color: var(--c-stone); }
.lead { font-size: var(--fs-md); color: var(--c-stone); max-width: 65ch; line-height: 1.7; }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.muted { color: var(--c-stone-light); }
strong { font-weight: 700; color: var(--c-forest); }
.stat-number { font-family: var(--f-mono); font-weight: 600; }

/* ---------- Utilities ---------- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
@media (min-width: 1024px) {
  .container { padding: 0 48px; }
}

.section { padding: var(--gap-xl) 0; }
.section--tight { padding: var(--gap-lg) 0; }
.section--alt { background: var(--c-cream); }
.section--dark { background: var(--c-forest); color: white; }
.section--dark h1, .section--dark h2, .section--dark h3 { color: white; }
.section--dark p { color: rgba(255, 255, 255, 0.75); }

.grid { display: grid; gap: var(--gap-md); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.row { display: flex; gap: var(--gap-md); flex-wrap: wrap; align-items: center; }
.center { text-align: center; }
.divider-lime {
  width: 48px;
  height: 4px;
  background: var(--c-lime);
  border-radius: 4px;
  margin: 0 auto;
}

/* Eyebrow / badge pequeño */
.tag-label, .eyebrow {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-lime);
  font-family: var(--f-display);
}

/* ---------- Navbar ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.nav__wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  padding: 0 24px;
}
@media (min-width: 1024px) {
  .nav__wrap { padding: 0 48px; }
}
.nav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--c-carbon);
}
.nav__logo { width: 30px; height: 30px; }
.nav__menu {
  display: flex;
  gap: 8px;
  align-items: center;
}
.nav__link {
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--c-stone);
  transition: all var(--t-fast);
}
.nav__link:hover { color: var(--c-carbon); background: var(--c-cream); }
.nav__link--active { color: var(--c-forest); font-weight: 600; }
.nav__cta { margin-left: 8px; }
.nav__toggle {
  display: none;
  background: none;
  border: 0;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
@media (max-width: 900px) {
  .nav__toggle { display: inline-flex; }
  .nav__menu {
    position: absolute;
    top: 72px; left: 0; right: 0;
    background: white;
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: none;
  }
  .nav__menu.is-open { display: flex; }
  .nav__link { padding: 14px 16px; }
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 600;
  border: 1px solid transparent;
  transition: all var(--t-fast);
  white-space: nowrap;
  text-align: center;
  font-family: var(--f-display);
  letter-spacing: -0.01em;
}
.btn:active { transform: translateY(1px); }
.btn--lg { padding: 14px 28px; font-size: var(--fs-base); }
.btn--block { width: 100%; }

.btn-primary, .btn-primary-sunacae {
  background: var(--c-lime);
  color: var(--c-carbon);
}
.btn-primary:hover, .btn-primary-sunacae:hover { background: oklch(0.60 0.18 145); transform: translateY(-1px); box-shadow: var(--sh-md); }

.btn-dark {
  background: var(--c-forest);
  color: white;
}
.btn-dark:hover { background: var(--c-forest-dark); }

.btn-secondary, .btn-outline-sunacae {
  background: transparent;
  color: var(--c-carbon);
  border-color: var(--c-stone-light);
}
.btn-secondary:hover, .btn-outline-sunacae:hover { border-color: var(--c-carbon); background: var(--c-cream); }

.btn-ghost {
  background: transparent;
  color: var(--c-carbon);
}
.btn-ghost:hover { background: var(--c-cream); }

.btn-link {
  background: none;
  color: var(--c-lime);
  padding: 0;
  font-weight: 600;
}
.btn-link:hover { color: var(--c-forest); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 120px 0 80px;
  background: linear-gradient(135deg, rgba(27, 58, 45, 0.95) 0%, rgba(27, 58, 45, 0.85) 50%, rgba(101, 176, 130, 0.3) 100%),
              radial-gradient(800px 600px at 100% 0%, rgba(76, 175, 80, 0.15), transparent 80%);
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(76, 175, 80, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(76, 175, 80, 0.08) 0%, transparent 50%);
  pointer-events: none;
}
.hero__grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 64px;
  align-items: center;
  position: relative;
  z-index: 1;
}
@media (max-width: 980px) {
  .hero__grid { grid-template-columns: 1fr; gap: 40px; }
}
.hero__title { color: white; font-size: var(--fs-hero); }
.hero__sub { font-size: var(--fs-md); color: rgba(255, 255, 255, 0.85); max-width: 56ch; margin-bottom: 28px; }
.hero__bullets {
  list-style: none;
  padding: 0;
  margin: 0 0 32px;
  display: grid;
  gap: 12px;
}
.hero__bullets li {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: var(--fs-sm);
  color: rgba(255, 255, 255, 0.90);
}
.hero__bullets svg { flex-shrink: 0; margin-top: 3px; color: var(--c-lime); }
.hero__ctas { display: flex; gap: 12px; flex-wrap: wrap; }
.hero__micro {
  margin-top: 16px;
  font-size: var(--fs-xs);
  color: rgba(255, 255, 255, 0.65);
}
.hero__card {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xl);
  padding: 28px;
  backdrop-filter: blur(10px);
}

/* ---------- Stats bar ---------- */
.section-forest {
  background: var(--c-forest);
  color: white;
  padding: 56px 0;
}
.stat-number {
  font-size: clamp(2.5rem, 4vw, 4rem);
  color: var(--c-lime-light);
  line-height: 1;
  margin-bottom: 8px;
}
.section-forest .muted { color: rgba(255, 255, 255, 0.65); }

/* ---------- Cards ---------- */
.card {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--r-lg);
  padding: 28px;
  transition: all var(--t-base);
  box-shadow: var(--sh-sm);
}
.card:hover {
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: var(--sh-lg);
  transform: translateY(-2px);
}
.card-sunacae { @apply card; }
.card__icon {
  width: 44px; height: 44px;
  background: rgba(76, 175, 80, 0.15);
  color: var(--c-lime);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.card h3 { margin-bottom: 8px; font-size: var(--fs-md); }
.card p { font-size: var(--fs-sm); margin: 0; }

/* ---------- Steps / Cómo funciona ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap-md);
  position: relative;
}
@media (max-width: 900px) { .steps { grid-template-columns: 1fr; } }
.step {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--r-lg);
  padding: 24px;
  position: relative;
}
.step__num {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: var(--fs-xl);
  color: var(--c-lime);
  margin-bottom: 12px;
  display: inline-block;
}
.step h4 { margin-bottom: 6px; }
.step p { font-size: var(--fs-sm); margin: 0; }

/* ---------- Calculadora ---------- */
.calc {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--r-lg);
  padding: 32px;
  box-shadow: var(--sh-lg);
}
.calc__tabs {
  display: inline-flex;
  background: var(--c-cream);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 24px;
}
.calc__tab {
  border: 0;
  background: transparent;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--c-stone);
  transition: all var(--t-fast);
  cursor: pointer;
}
.calc__tab.is-active {
  background: var(--c-carbon);
  color: white;
}
.calc__body { display: grid; gap: 16px; }
.calc__row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .calc__row { grid-template-columns: 1fr; } }
.calc__result {
  margin-top: 24px;
  background: var(--c-cream);
  border-radius: var(--r-lg);
  padding: 24px;
  display: none;
}
.calc__result.is-visible { display: block; }
.calc__big {
  font-family: var(--f-mono);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  color: var(--c-forest);
  margin: 0 0 12px;
}
.calc__detail {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}
@media (max-width: 700px) { .calc__detail { grid-template-columns: 1fr; } }
.calc__disclaimer {
  margin-top: 16px;
  font-size: var(--fs-xs);
  color: var(--c-stone-light);
}

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; }
.field label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--c-carbon);
}
.field input, .field select, .field textarea {
  width: 100%;
  font-family: inherit;
  font-size: var(--fs-base);
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: white;
  color: var(--c-carbon);
  transition: all var(--t-fast);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--c-lime);
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}
.field textarea { min-height: 120px; resize: vertical; }
.checkbox {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: var(--fs-sm);
  color: var(--c-stone);
}
.checkbox input { margin-top: 3px; flex-shrink: 0; }
.form-msg {
  margin-top: 12px;
  font-size: var(--fs-sm);
  padding: 12px 14px;
  border-radius: var(--r-md);
  display: none;
}
.form-msg.is-success { display: block; background: rgba(76, 175, 80, 0.1); color: #0d6f49; }
.form-msg.is-error { display: block; background: rgba(244, 67, 54, 0.1); color: #c62828; }

/* ---------- FAQ ---------- */
.faq { display: grid; gap: 12px; }
.faq__item {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--r-lg);
  background: white;
  overflow: hidden;
}
.faq__q {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 20px 24px;
  text-align: left;
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: var(--fs-md);
  color: var(--c-carbon);
  cursor: pointer;
}
.faq__q::after {
  content: "+";
  font-weight: 400;
  font-size: 1.5rem;
  color: var(--c-stone-light);
  transition: transform var(--t-base);
}
.faq__item.is-open .faq__q::after { content: "−"; }
.faq__a {
  padding: 0 24px;
  max-height: 0;
  overflow: hidden;
  transition: all var(--t-base);
  color: var(--c-stone);
  font-size: var(--fs-sm);
}
.faq__item.is-open .faq__a { max-height: 600px; padding: 0 24px 20px; }

/* ---------- CTA Banner ---------- */
.cta-banner {
  background: linear-gradient(135deg, var(--c-forest) 0%, var(--c-forest-dark) 100%);
  border-radius: var(--r-lg);
  padding: 56px;
  color: white;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 40px;
  align-items: center;
}
.cta-banner h2 { color: white; }
.cta-banner p { color: rgba(255, 255, 255, 0.75); }
.cta-banner__actions { display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 800px) {
  .cta-banner { grid-template-columns: 1fr; padding: 36px; }
}

/* ---------- Footer ---------- */
.footer {
  background: var(--c-carbon);
  color: rgba(255, 255, 255, 0.7);
  padding: 64px 0 32px;
}
.footer__grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 40px;
  margin-bottom: 48px;
}
@media (max-width: 900px) { .footer__grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .footer__grid { grid-template-columns: 1fr; } }
.footer__brand {
  display: flex; gap: 10px; align-items: center;
  color: white; font-family: var(--f-display); font-weight: 800; font-size: 1.25rem;
  margin-bottom: 16px;
}
.footer p { color: rgba(255, 255, 255, 0.65); font-size: var(--fs-sm); margin-bottom: 8px; }
.footer h5 {
  color: white;
  font-size: var(--fs-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.footer ul a {
  color: rgba(255, 255, 255, 0.65);
  font-size: var(--fs-sm);
  transition: color var(--t-fast);
}
.footer ul a:hover { color: white; }
.footer__legal {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: var(--fs-xs);
  color: rgba(255, 255, 255, 0.5);
}

/* ---------- Cookies Banner ---------- */
.cookies {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  max-width: 600px;
  margin: 0 auto;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xl);
  padding: 20px 24px;
  display: none;
  z-index: 100;
}
.cookies.is-visible { display: block; }
.cookies p { font-size: var(--fs-sm); margin-bottom: 12px; }
.cookies__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cookies__actions .btn { font-size: var(--fs-xs); padding: 8px 14px; }

/* ---------- Auth Pages ---------- */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.05), rgba(27, 58, 45, 0.05)),
              var(--c-cream);
  padding: 40px 16px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: white;
  border-radius: var(--r-lg);
  padding: 40px;
  box-shadow: var(--sh-lg);
}
.auth-card__brand {
  display: flex; gap: 10px; align-items: center; justify-content: center;
  margin-bottom: 24px;
  font-family: var(--f-display);
  font-weight: 800;
}
.auth-card h1 { font-size: var(--fs-xl); text-align: center; margin-bottom: 8px; }
.auth-card .lead { text-align: center; font-size: var(--fs-sm); margin-bottom: 24px; }
.auth-card form { display: grid; gap: 16px; }
.auth-card__foot {
  margin-top: 24px;
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--c-stone);
}
.auth-card__foot a { color: var(--c-forest); font-weight: 600; }

/* ---------- Dashboard ---------- */
.dash {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  background: var(--c-cream);
}
@media (max-width: 900px) { .dash { grid-template-columns: 1fr; } }
.dash__side {
  background: white;
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
}
@media (max-width: 900px) { .dash__side { display: none; } }
.dash__main { padding: 32px; overflow-x: auto; }
.dash__head {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  margin-bottom: 32px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--sh-sm);
}
.stat strong { display: block; font-family: var(--f-mono); font-size: 1.75rem; color: var(--c-forest); margin-top: 8px; }

/* ---------- Reveal on scroll animation ---------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(10px); transition: opacity 600ms ease, transform 600ms ease; }
  .reveal.is-in { opacity: 1; transform: translateY(0); }
}

/* ---------- Legal pages ---------- */
.legal {
  max-width: 800px;
  padding: 64px 24px;
  margin: 0 auto;
}
.legal h2 { font-size: var(--fs-2xl); margin-top: 40px; margin-bottom: 12px; }
.legal h3 { font-size: var(--fs-lg); margin-top: 28px; margin-bottom: 8px; }
.legal p, .legal li { font-size: var(--fs-sm); color: var(--c-stone); }
.legal ul { padding-left: 20px; }

/* ---------- Utilities ---------- */
.empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--c-stone-light);
}
.divider {
  height: 1px; background: rgba(0, 0, 0, 0.08);
  margin: 32px 0;
}
.check-list {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 10px;
}
.check-list li {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: var(--fs-sm); color: var(--c-carbon);
}
.check-list svg { flex-shrink: 0; margin-top: 3px; color: var(--c-lime); }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--c-forest); color: white;
  padding: 8px 12px; z-index: 1000;
}
.skip:focus { left: 12px; top: 12px; }
