/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #F6F4EC;
  --surface: #FFFFFF;
  --surface-alt: #EFEBDF;
  --text: #191F1B;
  --text-muted: #5B655D;
  --border: #E3DECD;
  --border-strong: #CFC8AF;

  --accent: #0E8F63;
  --accent-dark: #0A6E4C;
  --accent-soft: #DCF1E5;
  --accent-contrast: #FFFFFF;

  --gold: #C08A2E;
  --gold-soft: #F5E9CE;

  --aportado: #7C8B84;
  --aportado-soft: #E7E9E2;
  --rendimiento: #0E8F63;
  --rendimiento-soft: #DCF1E5;

  --danger: #B7452F;
  --danger-soft: #F7E4DE;

  --cons: #6E9C86;
  --mod: #0E8F63;
  --opt: #C08A2E;

  --shadow-sm: 0 1px 2px rgba(20, 30, 24, 0.06), 0 1px 1px rgba(20, 30, 24, 0.04);
  --shadow-md: 0 8px 24px rgba(20, 30, 24, 0.08), 0 2px 6px rgba(20, 30, 24, 0.05);
  --shadow-lg: 0 20px 48px rgba(20, 30, 24, 0.12), 0 4px 12px rgba(20, 30, 24, 0.06);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Sora", var(--sans);
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.25, 0.46, 0.45, 0.94);

  --container: 1180px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11150F;
    --surface: #191F19;
    --surface-alt: #202720;
    --text: #EEF1EA;
    --text-muted: #9AA69C;
    --border: #2B332B;
    --border-strong: #3B453B;

    --accent: #2FD996;
    --accent-dark: #23B27C;
    --accent-soft: #163427;
    --accent-contrast: #08150F;

    --gold: #E4B75B;
    --gold-soft: #2E260F;

    --aportado: #93A199;
    --aportado-soft: #232B24;
    --rendimiento: #2FD996;
    --rendimiento-soft: #163427;

    --danger: #E58469;
    --danger-soft: #331C15;

    --cons: #7FBF9F;
    --mod: #2FD996;
    --opt: #E4B75B;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.45);
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; overflow-x: clip; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-y: none;
}

img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { font-family: var(--display); text-wrap: balance; line-height: 1.08; letter-spacing: -0.01em; font-weight: 700; }
ul, ol { padding-left: 1.2em; }
::selection { background: var(--accent); color: var(--accent-contrast); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* =============================================================
   3. Utilities
   ============================================================= */
.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--text); color: var(--bg);
  z-index: 9999; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

.container { max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.section { padding-block: clamp(3rem, 7vw, 5.5rem); }
.section-alt { background: var(--surface-alt); }
.section-head { max-width: 62ch; margin-bottom: clamp(1.75rem, 4vw, 2.75rem); }
.section-head.center { margin-inline: auto; text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .4em;
  font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent-dark); margin-bottom: .6em;
}
@media (prefers-color-scheme: dark) { .eyebrow { color: var(--accent); } }
.section-head h2 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); margin-bottom: .5em; }
.section-head p { color: var(--text-muted); font-size: 1.05rem; }

.pill {
  display: inline-flex; align-items: center; gap: .35em;
  padding: .3em .8em; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-dark);
  font-size: .82rem; font-weight: 600;
}
@media (prefers-color-scheme: dark) { .pill { color: var(--accent); } }

/* =============================================================
   4. Typography
   ============================================================= */
.lede { font-size: 1.1rem; color: var(--text-muted); max-width: 60ch; }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }

/* =============================================================
   5. Components
   ============================================================= */

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: .85em 1.5em; border-radius: 999px; font-weight: 600; font-size: .96rem;
  transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out), background .2s var(--ease-out), border-color .2s var(--ease-out);
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--accent-contrast); box-shadow: var(--shadow-sm); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); background: var(--accent-dark); }
.btn-ghost { background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-dark); }
.btn-chip {
  padding: .55em 1.1em; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); font-size: .88rem; font-weight: 600; color: var(--text);
  transition: border-color .2s var(--ease-out), background .2s var(--ease-out), color .2s var(--ease-out);
}
.btn-chip:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.btn-sm { padding: .5em 1em; font-size: .85rem; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; padding-block: .9rem; }
.brand { display: inline-flex; align-items: center; gap: .55em; font-family: var(--display); font-weight: 700; font-size: 1.05rem; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  display: grid; place-items: center; color: #fff;
}
.header-actions { display: flex; align-items: center; gap: .75rem; }
.header-actions .btn-ghost { display: none; }
@media (min-width: 720px) { .header-actions .btn-ghost { display: inline-flex; } }

/* Hero */
.hero { padding-block: clamp(2.25rem, 6vw, 3.5rem) clamp(1.5rem, 4vw, 2rem); text-align: center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.1rem); max-width: 20ch; margin-inline: auto; }
.hero .lede { margin-inline: auto; margin-top: .9rem; font-size: 1.15rem; }
.trust-row {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem 1.4rem;
  margin-top: 1.4rem; font-size: .86rem; color: var(--text-muted);
}
.trust-row span { display: inline-flex; align-items: center; gap: .4em; }
.trust-row svg { width: 16px; height: 16px; color: var(--accent); flex: none; }

/* Tool shell */
.tool-shell { padding-top: 0; }
.tool-card {
  display: grid; grid-template-columns: 1fr; gap: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
@media (min-width: 960px) { .tool-card { grid-template-columns: 1.05fr 1fr; } }

.tool-inputs { padding: clamp(1.5rem, 3vw, 2.25rem); }
.tool-results {
  padding: clamp(1.5rem, 3vw, 2.25rem);
  background: linear-gradient(165deg, var(--accent-soft), var(--surface) 65%);
  border-top: 1px solid var(--border);
}
@media (min-width: 960px) { .tool-results { border-top: none; border-left: 1px solid var(--border); } }

.field-group { margin-bottom: 1.35rem; }
.field-label {
  display: flex; align-items: baseline; justify-content: space-between; gap: .5rem;
  font-weight: 600; font-size: .92rem; margin-bottom: .5rem;
}
.field-label .unit-hint { font-weight: 500; color: var(--text-muted); font-size: .85rem; }

.field-input-row { display: flex; align-items: center; gap: .6rem; }
.input-number {
  width: 100%; padding: .7em .9em; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong); background: var(--bg); color: var(--text);
  font-size: 1rem; font-weight: 600; font-variant-numeric: tabular-nums;
  transition: border-color .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.input-number:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); outline: none; }
.input-number.invalid { border-color: var(--danger); }

.input-suffix-wrap { position: relative; flex: 1; }
.input-suffix-wrap .input-number { padding-right: 2.6em; }
.input-suffix { position: absolute; right: .9em; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-weight: 600; pointer-events: none; }

input[type="range"] {
  width: 100%; margin-top: .6rem; -webkit-appearance: none; appearance: none;
  height: 6px; border-radius: 999px; background: var(--border-strong); outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--surface); box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform .15s var(--ease-out);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--surface);
  background: var(--accent); box-shadow: var(--shadow-sm); cursor: pointer;
}

.segmented { display: inline-flex; padding: .25rem; border-radius: 999px; background: var(--surface-alt); border: 1px solid var(--border); gap: .2rem; }
.segmented button {
  padding: .5em 1em; border-radius: 999px; font-size: .85rem; font-weight: 600; color: var(--text-muted);
  transition: background .2s var(--ease-out), color .2s var(--ease-out);
}
.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--accent-contrast); }

.advanced-toggle {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: .9em 0; border-top: 1px dashed var(--border-strong); margin-top: .5rem;
  font-weight: 600; font-size: .95rem; color: var(--text);
}
.advanced-toggle .chev { transition: transform .25s var(--ease-out); color: var(--text-muted); }
.advanced-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.advanced-panel {
  display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s var(--ease-out);
}
.advanced-panel.is-open { grid-template-rows: 1fr; }
.advanced-panel-inner { overflow: hidden; }
.advanced-panel .field-group:first-child { margin-top: 1rem; }

.check-row { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.1rem; }
.check-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.check-row label { font-weight: 600; font-size: .92rem; }

/* Results */
.result-headline { text-align: left; }
.result-headline .label { font-size: .9rem; font-weight: 600; color: var(--text-muted); }
.result-headline .value {
  font-family: var(--display); font-size: clamp(2.1rem, 5vw, 2.8rem); font-weight: 800;
  color: var(--accent-dark); font-variant-numeric: tabular-nums; margin-top: .1em;
}
@media (prefers-color-scheme: dark) { .result-headline .value { color: var(--accent); } }

.split-bar { height: 14px; border-radius: 999px; overflow: hidden; display: flex; margin: 1.1rem 0 .9rem; background: var(--aportado-soft); box-shadow: var(--shadow-sm) inset; }
.split-bar .seg-aportado { background: var(--aportado); }
.split-bar .seg-rendimiento { background: var(--rendimiento); transition: width .4s var(--ease-out); }

.legend-row { display: flex; flex-wrap: wrap; gap: 1.2rem; font-size: .85rem; margin-bottom: 1.3rem; }
.legend-row span { display: inline-flex; align-items: center; gap: .5em; font-weight: 600; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.legend-dot.aportado { background: var(--aportado); }
.legend-dot.rendimiento { background: var(--rendimiento); }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .9rem 1rem; }
.stat-tile .stat-label { font-size: .78rem; color: var(--text-muted); font-weight: 600; margin-bottom: .3rem; }
.stat-tile .stat-value { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-tile.wide { grid-column: 1 / -1; }
.stat-tile .stat-sub { font-size: .78rem; color: var(--text-muted); margin-top: .2rem; }

/* Ad slots */
.ad-slot {
  display: flex; align-items: center; justify-content: center; text-align: center;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-alt); color: var(--text-muted);
  font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  min-height: 90px; margin-block: 1.5rem;
}
.ad-slot.leaderboard { min-height: 100px; max-width: 728px; margin-inline: auto; }
.ad-slot.in-content { min-height: 250px; max-width: 336px; margin-inline: auto; }
.ad-slot.footer-slot { min-height: 90px; max-width: 728px; margin-inline: auto; }

/* Corner toast */
.corner-toast {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 60; max-width: 280px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); padding: 1rem 1.1rem; display: flex; gap: .7rem; align-items: flex-start;
  transform: translateY(120%); opacity: 0; transition: transform .4s var(--ease-out), opacity .4s var(--ease-out);
}
.corner-toast.is-visible { transform: translateY(0); opacity: 1; }
.corner-toast .toast-badge {
  font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted); background: var(--surface-alt); border: 1px dashed var(--border-strong);
  border-radius: 6px; padding: .8rem .6rem; flex: none; width: 76px; text-align: center;
}
.corner-toast .toast-text { font-size: .82rem; color: var(--text-muted); }
.corner-toast .toast-close { position: absolute; top: .4rem; right: .5rem; color: var(--text-muted); font-size: 1.1rem; line-height: 1; padding: .3rem; }

/* Download interstitial dialog */
dialog.ad-dialog {
  border: none; border-radius: var(--radius-md); padding: 0; max-width: min(92vw, 420px);
  box-shadow: var(--shadow-lg); background: var(--surface); color: var(--text);
}
dialog.ad-dialog::backdrop { background: rgba(10, 15, 12, 0.55); }
.ad-dialog-inner { padding: 1.3rem; }
.ad-dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .9rem; }
.ad-dialog-head strong { font-family: var(--display); font-size: 1rem; }
.ad-dialog-close { font-size: 1.2rem; padding: .3rem .5rem; border-radius: 8px; }
.ad-dialog-close:hover { background: var(--surface-alt); }
.ad-dialog .ad-slot { margin: 0 0 1rem; min-height: 160px; }
.ad-dialog-foot { text-align: right; }

/* Chart */
.chart-card { padding: clamp(1.25rem, 3vw, 2rem); }
.chart-wrap { position: relative; width: 100%; height: clamp(220px, 40vw, 340px); }
.chart-wrap canvas { width: 100%; height: 100%; }
.chart-tooltip {
  position: absolute; pointer-events: none; z-index: 5; opacity: 0; transition: opacity .15s var(--ease-out);
  background: var(--text); color: var(--bg); border-radius: 10px; padding: .6rem .8rem;
  font-size: .78rem; line-height: 1.5; box-shadow: var(--shadow-md); white-space: nowrap; transform: translate(-50%, -110%);
}
.chart-tooltip.is-visible { opacity: 1; }
.chart-tooltip strong { display: block; font-size: .82rem; margin-bottom: .1rem; }
.chart-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .8rem; margin-top: 1rem; font-size: .8rem; color: var(--text-muted); }

/* Scenario compare */
.scenario-grid { display: grid; gap: 1rem; margin-bottom: 1.5rem; }
@media (min-width: 720px) { .scenario-grid { grid-template-columns: repeat(3, 1fr); } }
.scenario-card { padding: 1.1rem 1.2rem; border-top: 4px solid var(--border-strong); }
.scenario-card[data-key="conservador"] { border-top-color: var(--cons); }
.scenario-card[data-key="moderado"] { border-top-color: var(--mod); }
.scenario-card[data-key="optimista"] { border-top-color: var(--opt); }
.scenario-card .sc-name { font-weight: 700; font-size: .95rem; margin-bottom: .5rem; }
.scenario-card .sc-rate-row { display: flex; align-items: center; gap: .5rem; margin-bottom: .7rem; }
.scenario-card .sc-rate-row input { width: 5.5em; }
.scenario-card .sc-result { font-family: var(--display); font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }

.disclaimer-box {
  display: flex; gap: .7rem; align-items: flex-start; padding: 1rem 1.2rem;
  background: var(--gold-soft); border: 1px solid var(--gold); border-radius: var(--radius-sm);
  font-size: .88rem; color: var(--text);
}
.disclaimer-box svg { flex: none; width: 20px; height: 20px; color: var(--gold); margin-top: .1em; }

/* Reverse calculators */
.reverse-grid { display: grid; gap: 1.5rem; }
@media (min-width: 860px) { .reverse-grid { grid-template-columns: 1fr 1fr; } }
.reverse-card { padding: clamp(1.4rem, 3vw, 1.9rem); }
.reverse-card h3 { font-size: 1.15rem; margin-bottom: .3rem; }
.reverse-card .lede { font-size: .92rem; margin-bottom: 1.1rem; }
.reverse-result {
  margin-top: 1.1rem; padding: 1rem 1.1rem; border-radius: var(--radius-sm);
  background: var(--accent-soft); font-size: .98rem; font-weight: 600; color: var(--accent-dark);
}
@media (prefers-color-scheme: dark) { .reverse-result { color: var(--accent); } }
.reverse-result .big { font-family: var(--display); font-size: 1.5rem; font-weight: 800; display: block; margin-top: .2rem; }

/* How it works */
.steps-grid { display: grid; gap: 1.4rem; }
@media (min-width: 720px) { .steps-grid { grid-template-columns: repeat(3, 1fr); } }
.step-card { display: flex; flex-direction: column; gap: .7rem; }
.step-num {
  width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark);
  display: grid; place-items: center; font-family: var(--display); font-weight: 800;
}
@media (prefers-color-scheme: dark) { .step-num { color: var(--accent); } }
.step-card h3 { font-size: 1.05rem; }
.step-card p { color: var(--text-muted); font-size: .93rem; }

/* Educational example */
.compound-example { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.3rem; }
.compound-example .yr {
  flex: 1 1 130px; padding: .9rem 1rem; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border); text-align: center;
}
.compound-example .yr .yr-label { font-size: .78rem; color: var(--text-muted); font-weight: 600; }
.compound-example .yr .yr-value { font-family: var(--display); font-weight: 800; font-size: 1.2rem; margin-top: .2rem; }
.compound-example .yr.highlight { border-color: var(--accent); background: var(--accent-soft); }

/* Uses grid */
.uses-grid { display: grid; gap: 1.1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .uses-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .uses-grid { grid-template-columns: repeat(4, 1fr); } }
.use-card { padding: 1.2rem 1.3rem; }
.use-card h3 { font-size: .98rem; margin-bottom: .4rem; }
.use-card p { font-size: .87rem; color: var(--text-muted); }

/* Power of time */
.time-grid { display: grid; gap: 1.2rem; }
@media (min-width: 780px) { .time-grid { grid-template-columns: repeat(3, 1fr); } }
.time-card { padding: 1.4rem 1.4rem 1.6rem; text-align: center; }
.time-card .age { font-size: .85rem; color: var(--text-muted); font-weight: 600; margin-bottom: .3rem; }
.time-card .name { font-family: var(--display); font-weight: 800; font-size: 1.15rem; margin-bottom: 1rem; }
.time-bar-wrap { height: 14px; background: var(--surface-alt); border-radius: 999px; overflow: hidden; margin-bottom: .9rem; }
.time-bar { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent-dark), var(--accent)); transition: width .6s var(--ease-out); }
.time-card .final-value { font-family: var(--display); font-weight: 800; font-size: 1.7rem; color: var(--accent-dark); }
@media (prefers-color-scheme: dark) { .time-card .final-value { color: var(--accent); } }
.time-card .final-note { font-size: .8rem; color: var(--text-muted); margin-top: .3rem; }

/* Table */
.table-toggle { display: inline-flex; align-items: center; gap: .5rem; }
.table-scroll { overflow-x: auto; margin-top: 1.2rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table.evo-table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: .87rem; }
table.evo-table th, table.evo-table td {
  padding: .65rem .9rem; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
table.evo-table th:first-child, table.evo-table td:first-child { text-align: left; }
table.evo-table thead th { background: var(--surface-alt); font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); position: sticky; top: 0; }
table.evo-table tbody tr:hover { background: var(--surface-alt); }
.table-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .8rem; margin-top: 1.2rem; }

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: .7rem; }
.faq-item { padding: 0; overflow: hidden; }
.faq-item summary {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.3rem; font-weight: 700; font-size: .98rem;
}
.faq-item summary .plus { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); display: grid; place-items: center; transition: transform .25s var(--ease-out); font-size: 1rem; }
@media (prefers-color-scheme: dark) { .faq-item summary .plus { color: var(--accent); } }
.faq-item[open] summary .plus { transform: rotate(45deg); }
.faq-item .faq-a { padding: 0 1.3rem 1.2rem; color: var(--text-muted); font-size: .93rem; max-width: 68ch; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding-block: 2.5rem; background: var(--surface-alt); }
.footer-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.5rem; align-items: flex-start; }
.footer-brand { max-width: 34ch; }
.footer-brand p { color: var(--text-muted); font-size: .87rem; margin-top: .5rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1rem 1.6rem; font-size: .88rem; }
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--accent-dark); }
.footer-links .link-reset { background: none; border: none; padding: 0; margin: 0; font: inherit; cursor: pointer; color: var(--text-muted); }
.footer-links .link-reset:hover { color: var(--accent-dark); }
@media (prefers-color-scheme: dark) { .footer-links a:hover, .footer-links .link-reset:hover { color: var(--accent); } }
.footer-bottom { margin-top: 1.8rem; padding-top: 1.3rem; border-top: 1px solid var(--border); font-size: .8rem; color: var(--text-muted); }

/* Cookie banner */
.cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
  background: var(--surface); border-top: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  padding: 1.1rem var(--gutter);
  transform: translateY(100%); transition: transform .4s var(--ease-out);
}
.cookie-banner.is-visible { transform: translateY(0); }
.cookie-banner-inner {
  max-width: var(--container); margin-inline: auto;
  display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: center; justify-content: space-between;
}
.cookie-banner-text { flex: 1 1 320px; font-size: .87rem; color: var(--text-muted); margin: 0; }
.cookie-banner-text a { color: var(--accent-dark); text-decoration: underline; }
@media (prefers-color-scheme: dark) { .cookie-banner-text a { color: var(--accent); } }
.cookie-banner-actions { display: flex; flex-wrap: wrap; gap: .6rem; flex: none; }

.legal-note { font-size: .82rem; color: var(--text-muted); margin-top: .8rem; }

/* Mode / choice cards (p.ej. Hipoteca vs Préstamo, Nueva vs Segunda mano) */
.mode-grid { display: grid; gap: 1rem; margin-bottom: 1.6rem; }
@media (min-width: 600px) { .mode-grid { grid-template-columns: repeat(2, 1fr); } }
.mode-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: .35rem;
  width: 100%; text-align: left; padding: 1.3rem 1.4rem;
  border: 2px solid var(--border); border-radius: var(--radius-md); background: var(--surface);
  transition: border-color .2s var(--ease-out), background .2s var(--ease-out), transform .2s var(--ease-out);
}
.mode-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.mode-card .mode-icon { font-size: 1.9rem; line-height: 1; }
.mode-card .mode-title { font-family: var(--display); font-weight: 700; font-size: 1.08rem; }
.mode-card .mode-desc { font-size: .85rem; color: var(--text-muted); }
.mode-card[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--shadow-sm); }
.mode-card[aria-pressed="true"] .mode-desc { color: var(--text); }

/* Flow: precio → entrada → importe de la hipoteca */
.flow-row { display: flex; align-items: stretch; gap: .6rem; flex-wrap: wrap; margin: 1.1rem 0; }
.flow-step { flex: 1 1 140px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .8rem 1rem; }
.flow-step .flow-label { font-size: .74rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.flow-step .flow-value { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: .15rem; }
.flow-step.is-result { background: var(--accent-soft); border-color: var(--accent); }
.flow-arrow { flex: none; align-self: center; color: var(--text-muted); font-size: 1.3rem; }
@media (max-width: 599px) { .flow-arrow { transform: rotate(90deg); } }

/* Desglose de gastos */
.expense-list { display: flex; flex-direction: column; margin: 1rem 0; }
.expense-row { display: flex; justify-content: space-between; gap: 1rem; font-size: .9rem; padding: .55rem 0; border-bottom: 1px dashed var(--border); }
.expense-row .expense-label { color: var(--text-muted); }
.expense-row .expense-value { font-weight: 600; font-variant-numeric: tabular-nums; flex: none; }
.expense-row.expense-total { border-top: 2px solid var(--border-strong); border-bottom: none; margin-top: .2rem; padding-top: .8rem; font-weight: 700; font-size: 1rem; }

/* Badge pequeño (p.ej. "Estimado") */
.badge { display: inline-flex; align-items: center; padding: .2em .65em; border-radius: 999px; font-size: .7rem; font-weight: 700; background: var(--gold-soft); color: var(--gold); text-transform: uppercase; letter-spacing: .03em; }
@media (prefers-color-scheme: dark) { .badge { color: var(--gold); } }

/* Select (para comunidad autónoma, índice de referencia, etc.) */
.input-select {
  width: 100%; padding: .7em 2.2em .7em .9em; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong); background: var(--bg); color: var(--text);
  font: inherit; font-size: 1rem; font-weight: 600;
  transition: border-color .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.input-select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); outline: none; }

/* No-js */
.no-js-note { display: none; }
.no-js .no-js-note { display: block; padding: .9rem 1.1rem; background: var(--gold-soft); border: 1px solid var(--gold); border-radius: var(--radius-sm); font-size: .88rem; margin-bottom: 1rem; }
.no-js .js-only { display: none; }

/* =============================================================
   6. Sections spacing helpers
   ============================================================= */
.stack { display: flex; flex-direction: column; }
.gap-sm { gap: .6rem; }
.gap-md { gap: 1rem; }
.gap-lg { gap: 1.6rem; }

/* =============================================================
   7. Effects
   ============================================================= */
[data-reveal] { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease-out), transform .6s var(--ease-out); }
[data-reveal].is-revealed { opacity: 1; transform: none; }

@keyframes pulseDot { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulseDot 2s ease-in-out infinite; }

/* =============================================================
   8. Responsive
   ============================================================= */
@media (min-width: 540px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 720px) {
  .header-actions .btn-ghost { display: inline-flex; }
}
@media (min-width: 960px) {
  .hero h1 { max-width: 24ch; }
}

/* =============================================================
   9. Reduced motion
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .corner-toast, .cookie-banner, .split-bar .seg-rendimiento, .time-bar { transition: none; }
  .live-dot { animation: none; }
  [data-reveal] { opacity: 1; transform: none; transition: none; }
}

/* =============================================================
   10. Simulador de Cuotas — plazo chip selected state
   ============================================================= */
.btn-chip.is-selected { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn-chip.is-selected:hover { background: var(--accent); color: var(--accent-contrast); }
