/* Calculadero · hoja de estilos
   Layout: cabecera blanca, contenido en columna de 1200px; en calculadoras, formulario a la izquierda y resultado oscuro a la derecha (se apilan en móvil). */

@font-face {
  font-family: 'Jakarta';
  src: url('fonts/plus-jakarta-sans-latin-wght-normal.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --ink: #111827;
  --muted: #4B5563;
  --faint: #6B7280;
  --border: #E5E7EB;
  --field: #D1D5DB;
  --accent: #2747D0;
  --accent-hover: #1A3399;
  --on-accent: #FFFFFF;
  --accent-soft: #EEF1FD;
  --soft-ink: #1F2A44;
  --chip: #E7F6F3;
  --chip-ink: #0B5F58;
  --ok: #0F766E;
  --res-bg: #111827;
  --res-fg: #FFFFFF;
  --res-muted: #C7CDD8;
  --res-line: #2A3242;
  --res-field: #1C2433;
  --res-warn: #FFB27A;
  --res-ok: #7FE0D2;
  --res-bar-a: #8FA8FF;
  --res-bar-b: #5EC2B5;
  --res-bar-off: #2F384A;
  --res-btn: #FFFFFF;
  --res-btn-ink: #111827;
  --hot: #FF8C50;
  --shadow: rgba(17, 24, 39, .08);
  --focus: rgba(39, 71, 208, .35);
  --font: 'Jakarta', 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius: 20px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D1118; --surface: #151B25; --ink: #F1F3F7; --muted: #A9B2C1; --faint: #8C96A7;
    --border: #252D3A; --field: #3A4454; --accent: #8EA6FF; --accent-hover: #B3C3FF; --on-accent: #0B1020;
    --accent-soft: #1C2440; --soft-ink: #DCE3FF; --chip: #12312E; --chip-ink: #7FE0D2; --ok: #5FD0C1;
    --res-bg: #1D2431; --res-fg: #FFFFFF; --res-muted: #B9C1CF; --res-line: #313A4B; --res-field: #262F3F;
    --res-bar-off: #364053; --res-btn: #F1F3F7; --res-btn-ink: #0D1118;
    --shadow: rgba(0, 0, 0, .35); --focus: rgba(142, 166, 255, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D1118; --surface: #151B25; --ink: #F1F3F7; --muted: #A9B2C1; --faint: #8C96A7;
  --border: #252D3A; --field: #3A4454; --accent: #8EA6FF; --accent-hover: #B3C3FF; --on-accent: #0B1020;
  --accent-soft: #1C2440; --soft-ink: #DCE3FF; --chip: #12312E; --chip-ink: #7FE0D2; --ok: #5FD0C1;
  --res-bg: #1D2431; --res-fg: #FFFFFF; --res-muted: #B9C1CF; --res-line: #313A4B; --res-field: #262F3F;
  --res-bar-off: #364053; --res-btn: #F1F3F7; --res-btn-ink: #0D1118;
  --shadow: rgba(0, 0, 0, .35); --focus: rgba(142, 166, 255, .45);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
input:focus-visible, button:focus-visible, a:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 10px 14px; border-radius: 10px; z-index: 20; }
.skip:focus { left: 16px; }

.wrap {
  max-width: 1248px; margin: 0 auto;
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
}

/* ---------- Cabecera ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header .wrap { padding-block: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px 24px; }
@media (max-width: 1000px) {
  .site-header .wrap { flex-direction: column; align-items: stretch; padding-block: 10px 6px; }
  .nav { margin-inline: -12px; padding-inline: 12px; mask-image: linear-gradient(90deg, #000 88%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); }
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.logo:hover { color: var(--ink); }
.logo-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); display: flex; align-items: center; justify-content: center; color: var(--on-accent); }
.logo-word { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.nav { display: flex; gap: 2px; align-items: center; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a { flex: none; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--muted); font-size: 15px; font-weight: 600; white-space: nowrap; }
.nav a:hover { color: var(--ink); background: var(--bg); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--accent-soft); }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 20px; border-radius: 12px; border: 1.5px solid var(--accent); background: var(--accent); color: var(--on-accent); font-family: inherit; font-size: 15px; font-weight: 700; text-decoration: none; cursor: pointer; transition: transform .15s ease, box-shadow .2s ease; }
.btn:hover { color: var(--on-accent); transform: translateY(-2px); box-shadow: 0 10px 24px var(--shadow); }
.btn-sm { min-height: 44px; padding: 0 16px; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--field); }
.btn-ghost:hover { color: var(--ink); }
.arrow { transition: transform .25s ease; flex: none; }
a:hover > .arrow, .card:hover .arrow { transform: translateX(5px); }

/* ---------- Encabezado de página ---------- */
main { padding-block: 28px 72px; }
.calc-main { padding-block: 16px 72px; }
.crumbs { font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; }
.page-head { display: flex; flex-direction: column; gap: 6px; }
.page-head h1 { margin: 4px 0 0; font-size: clamp(26px, 3vw, 34px); line-height: 1.15; font-weight: 800; letter-spacing: -0.025em; max-width: 900px; }
.page-head .lead { font-size: 16px; max-width: 760px; }
.lead { margin: 0; font-size: 18px; line-height: 1.55; color: var(--muted); max-width: 680px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--muted); }
.badge svg { color: var(--ok); }

/* ---------- Calculadora ---------- */
.calc { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 20px; align-items: stretch; scroll-margin-top: 12px; }
.panel { flex: 999 1 560px; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.side { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.side .result { flex: 1; }
.group { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 20px 28px; }
.stack-fields { display: flex; flex-direction: column; gap: 12px; }
.seg-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.seg-row .group-label { flex: none; }
.seg-row .seg { flex: 1 1 260px; max-width: 420px; }
.seg-row .hint { flex: none; }
.group-label { margin: 0; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; }
.step-head { display: flex; align-items: center; gap: 12px; }
.step-num { flex: none; width: 28px; height: 28px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.step-head h2 { margin: 0; font-size: 17px; font-weight: 700; }
.step-head p { margin: 1px 0 0; font-size: 13px; color: var(--muted); }
.divider { height: 1px; background: var(--border); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 14px; font-weight: 600; }
.field label span, .hint { font-weight: 500; color: var(--muted); }
.hint { margin: 0; font-size: 13px; }
.input { display: flex; align-items: center; border: 1.5px solid var(--field); border-radius: 14px; background: var(--surface); overflow: hidden; transition: border-color .15s; }
.input:focus-within { border-color: var(--accent); }
.input input, .input select { flex: 1; min-width: 0; border: 0; padding: 11px 14px; font-family: inherit; font-size: 18px; font-weight: 600; color: var(--ink); background: transparent; font-variant-numeric: tabular-nums; outline: none; }
.input select { font-size: 16px; cursor: pointer; }
.input .unit { padding: 0 14px; font-size: 16px; font-weight: 600; color: var(--muted); }
.input input::placeholder { color: var(--faint); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-2 .input input { font-size: 18px; padding: 12px 14px; }
@media (max-width: 480px) { .grid-2 { grid-template-columns: 1fr; } }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.seg button { min-height: 44px; border-radius: 12px; border: 1.5px solid var(--field); background: var(--surface); color: var(--ink); font-family: inherit; font-size: 16px; font-weight: 700; cursor: pointer; transition: background-color .15s, border-color .15s, color .15s; padding: 0 8px; }
.seg button:hover { border-color: var(--accent); }
.seg button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.seg-narrow { max-width: 380px; }

.text-btn { align-self: flex-start; min-height: 36px; padding: 0 4px; border: 0; background: transparent; color: var(--accent); font-family: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.text-btn:hover { color: var(--accent-hover); }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; padding: 12px 16px; border-radius: 14px; border: 1.5px solid var(--field); background: var(--surface); font-family: inherit; text-align: left; cursor: pointer; color: var(--ink); }
.switch strong { display: block; font-size: 15px; }
.switch small { display: block; font-size: 13px; color: var(--muted); }
.track { flex: none; width: 48px; height: 28px; border-radius: 999px; background: var(--field); position: relative; transition: background-color .2s; }
.track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 999px; background: #FFFFFF; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: left .2s; }
.switch[aria-pressed="true"] .track { background: var(--accent); }
.switch[aria-pressed="true"] .track::after { left: 23px; }

.note { margin: 0; background: var(--accent-soft); color: var(--soft-ink); border-radius: 12px; padding: 10px 14px; font-size: 14px; line-height: 1.5; }

/* Resultado */
.result { background: var(--res-bg); color: var(--res-fg); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 16px; border: 1px solid var(--res-line); scroll-margin-top: 12px; }
.result-kicker { margin: 0; font-size: 14px; font-weight: 600; color: var(--res-muted); }
.result-label { margin: 6px 0 0; font-size: 16px; font-weight: 700; color: var(--res-warn); }
.result-label.is-ok { color: var(--res-ok); }
.result-value { margin: 2px 0 0; font-size: clamp(34px, 3.6vw, 46px); line-height: 1.05; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.result-value small { font-size: 17px; font-weight: 700; color: var(--res-muted); letter-spacing: 0; }
.result-hint { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: var(--res-muted); }
.rows { display: flex; flex-direction: column; gap: 9px; font-size: 14px; }
.row { display: flex; justify-content: space-between; gap: 12px; }
.row > span:first-child { color: var(--res-muted); }
.row strong, .row > span:last-child { font-variant-numeric: tabular-nums; text-align: right; }
.row.dim, .row.dim > span:last-child { color: var(--res-muted); }
.rule { height: 1px; background: var(--res-line); }
.meter { display: flex; flex-direction: column; gap: 6px; }
.meter-track { height: 8px; border-radius: 999px; background: var(--res-bar-off); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 999px; background: var(--res-bar-a); width: 0; transition: width .45s cubic-bezier(.2, .7, .2, 1); }
.meter-fill.b { background: var(--res-bar-b); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; }
.actions button { flex: 1 1 140px; min-height: 44px; border-radius: 12px; font-family: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.btn-copy { border: 0; background: var(--res-btn); color: var(--res-btn-ink); }
.btn-reset { border: 1px solid var(--res-line); background: transparent; color: var(--res-fg); font-weight: 600; }
.tramo-chart { height: 64px; display: flex; align-items: flex-end; gap: 4px; }
.tramo-chart span { flex: 1; border-radius: 4px 4px 2px 2px; background: var(--res-bar-off); transition: height .4s cubic-bezier(.2, .7, .2, 1), background-color .3s; }
.tramo-chart span.on { background: var(--res-bar-a); }
.chart-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--res-muted); }

.xlink { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px 20px; text-decoration: none; color: var(--ink); display: flex; align-items: center; justify-content: space-between; gap: 12px; transition: border-color .2s, transform .2s; }
.xlink:hover { color: var(--ink); border-color: var(--accent); }
.xlink strong { display: block; font-size: 16px; }
.xlink small { display: block; font-size: 14px; color: var(--muted); }
.xlink .arrow { color: var(--accent); }

/* Publicidad */
.ad { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ad-label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.ad ins { display: block; width: 100%; }
.ad-box { width: 100%; min-height: 250px; }
.ad-wide { width: 100%; max-width: 728px; min-height: 100px; }
.ad-placeholder { width: 100%; height: 100%; min-height: inherit; border: 1.5px dashed var(--field); border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--faint); font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; text-align: center; padding: 12px; }

/* Explicación, FAQ, relacionadas */
.section { margin-top: 64px; display: flex; flex-direction: column; gap: 20px; }
.section > h2 { margin: 0; font-size: clamp(24px, 3vw, 30px); font-weight: 800; letter-spacing: -0.02em; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; gap: 8px; }
.step-tag { font-size: 12px; font-weight: 800; letter-spacing: .07em; color: var(--accent); }
.step h3 { margin: 0; font-size: 18px; font-weight: 700; }
.step p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--muted); }
.example { background: var(--accent-soft); border-radius: 16px; padding: 20px 22px; font-size: 15px; line-height: 1.65; color: var(--soft-ink); }
.prose { max-width: 760px; font-size: 16px; line-height: 1.7; color: var(--muted); }
.prose p { margin: 0 0 14px; }
.faq { display: flex; flex-direction: column; gap: 12px; max-width: 860px; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.faq summary { list-style: none; min-height: 60px; padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 17px; font-weight: 700; cursor: pointer; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary svg { flex: none; color: var(--muted); transition: transform .2s; }
.faq details[open] summary svg { transform: rotate(180deg); }
.faq details p { margin: 0; padding: 0 22px 20px; font-size: 15px; line-height: 1.65; color: var(--muted); }
.related { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.related a { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px 20px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 4px; transition: border-color .2s; }
.related a:hover { border-color: var(--accent); color: var(--ink); }
.related strong { font-size: 16px; }
.related span { font-size: 14px; color: var(--muted); }
.disclaimer { margin: 48px 0 0; font-size: 13px; line-height: 1.6; color: var(--muted); max-width: 860px; }

/* ---------- Pie ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); }
.site-footer .wrap { padding-block: 40px 28px; display: flex; flex-direction: column; gap: 28px; }
.foot-cols { display: flex; flex-wrap: wrap; gap: 32px 64px; }
.foot-cols > div { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.foot-cols h2 { margin: 0 0 4px; font-size: 13px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.foot-cols a { color: var(--ink); text-decoration: none; font-size: 15px; }
.foot-cols a:hover { color: var(--accent); }
.foot-about { max-width: 320px; font-size: 14px; color: var(--muted); line-height: 1.6; }
.foot-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 20px; }

/* ---------- Portada ---------- */
.hero-band { background: var(--surface); border-bottom: 1px solid var(--border); }
.hero { padding-block: 56px 64px; display: flex; flex-wrap: wrap; gap: 48px; align-items: center; }
.hero-copy { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.pill { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--soft-ink); font-size: 14px; font-weight: 600; }
.pill b { padding: 3px 9px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 800; }
.hero h1 { margin: 0; font-size: clamp(38px, 5.8vw, 66px); line-height: 1.08; font-weight: 800; letter-spacing: -0.035em; }
.rotator { display: inline-block; height: 1.15em; overflow: hidden; vertical-align: bottom; color: var(--accent); }
.rotator-track { display: flex; flex-direction: column; transition: transform .55s cubic-bezier(.65, 0, .35, 1); }
.rotator-track span { height: 1.15em; line-height: 1.15em; }
.hero .lead { font-size: 19px; line-height: 1.6; max-width: 560px; }
.search { position: relative; max-width: 580px; }
.search-box { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--field); border-radius: 16px; background: var(--surface); padding: 0 8px 0 16px; box-shadow: 0 6px 20px var(--shadow); }
.search-box:focus-within { border-color: var(--accent); }
.search-box svg { color: var(--muted); flex: none; }
.search-box input { flex: 1; min-width: 0; border: 0; padding: 16px 0; font-family: inherit; font-size: 17px; color: var(--ink); background: transparent; outline: none; }
.search-results { position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 5; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 16px 40px var(--shadow); padding: 8px; display: flex; flex-direction: column; }
.search-results a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; text-decoration: none; color: var(--ink); }
.search-results a:hover, .search-results a:focus-visible { background: var(--bg); }
.search-results small { display: block; font-size: 13px; color: var(--muted); }
.search-results em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--accent); white-space: nowrap; }
.search-results p { margin: 0; padding: 12px 14px; font-size: 14px; color: var(--muted); }
.ticks { display: flex; flex-wrap: wrap; gap: 10px 22px; font-size: 14px; font-weight: 600; color: var(--muted); }
.ticks span { display: inline-flex; align-items: center; gap: 6px; }
.ticks svg { color: var(--ok); }
.hero-demo { flex: 1 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.floaters { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.floater { padding: 8px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; font-weight: 700; color: var(--muted); box-shadow: 0 6px 16px var(--shadow); animation: float 5s ease-in-out infinite; }
.floater:nth-child(2) { animation-delay: 1.2s; }
.demo { background: var(--res-bg); color: var(--res-fg); border-radius: 22px; padding: 28px; text-decoration: none; display: flex; flex-direction: column; gap: 18px; border: 1px solid var(--res-line); transition: transform .25s ease, box-shadow .25s ease; }
.demo:hover { color: var(--res-fg); transform: translateY(-4px); box-shadow: 0 18px 40px var(--shadow); }
.demo-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; font-weight: 700; color: var(--res-muted); }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 999px; background: var(--hot); animation: pulse 1.8s infinite; flex: none; }
.demo-body { display: flex; flex-direction: column; gap: 18px; transition: opacity .3s ease; }
.demo-line { padding: 12px 14px; border-radius: 12px; background: var(--res-field); font-size: 15px; color: var(--res-muted); }
.demo-lines { display: flex; flex-direction: column; gap: 8px; }
.demo-label { margin: 0; font-size: 16px; font-weight: 700; color: var(--res-warn); }
.demo-value { margin: 2px 0 0; font-size: clamp(44px, 5vw, 58px); line-height: 1.05; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.demo-progress { height: 4px; border-radius: 999px; background: var(--res-bar-off); overflow: hidden; }
.demo-progress span { display: block; height: 100%; width: 0; background: var(--res-bar-a); border-radius: 999px; }
.demo-cta { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 15px; font-weight: 700; }

.deadline { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 28px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; }
.deadline-info { display: flex; align-items: center; gap: 16px; flex: 1 1 320px; min-width: 0; }
.deadline-info .dot { width: 12px; height: 12px; }
.deadline-text { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.deadline-text p { margin: 0; }
.deadline-kicker { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.deadline-main { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.deadline-main span { font-weight: 600; color: var(--muted); font-size: 17px; letter-spacing: 0; }
.deadline-bar { height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; margin-top: 6px; max-width: 520px; }
.deadline-bar span { display: block; height: 100%; border-radius: 999px; background: var(--hot); }
.deadline-cta { display: flex; flex-wrap: wrap; gap: 10px; }

.home-section { margin-top: 64px; display: flex; flex-direction: column; gap: 22px; }
.home-section:first-child { margin-top: 0; }
.home-section > header h2 { margin: 0; font-size: clamp(26px, 3vw, 34px); font-weight: 800; letter-spacing: -0.025em; }
.home-section > header p { margin: 6px 0 0; font-size: 16px; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 16px; transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
.card:hover { color: var(--ink); transform: translateY(-4px); box-shadow: 0 14px 32px var(--shadow); border-color: var(--accent); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card-badge { min-width: 52px; height: 52px; padding: 0 10px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 800; background: var(--accent-soft); color: var(--accent); }
.card-tag { padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--chip); color: var(--chip-ink); }
.card h3 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.card p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--muted); }
.card-cta { margin-top: auto; display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--accent); }
.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.how > div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.how b { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-weight: 800; display: flex; align-items: center; justify-content: center; }
.how h3 { margin: 0; font-size: 18px; font-weight: 700; }
.how p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--muted); }
.cta-band { margin-top: 64px; background: var(--res-bg); color: var(--res-fg); border-radius: 24px; padding: 40px 32px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; border: 1px solid var(--res-line); }
.cta-band div { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.cta-band h2 { margin: 0; font-size: clamp(24px, 3vw, 32px); font-weight: 800; letter-spacing: -0.025em; }
.cta-band p { margin: 0; font-size: 16px; line-height: 1.6; color: var(--res-muted); }
.cta-band .btn { background: var(--res-btn); color: var(--res-btn-ink); border-color: var(--res-btn); min-height: 52px; font-size: 16px; font-weight: 800; }

/* Páginas de texto */
.legal { max-width: 780px; }
.legal h1 { margin: 20px 0 8px; font-size: clamp(30px, 4vw, 42px); line-height: 1.1; font-weight: 800; letter-spacing: -0.03em; }
.legal h2 { margin: 36px 0 10px; font-size: 22px; font-weight: 800; }
.legal p, .legal li { font-size: 16px; line-height: 1.7; color: var(--muted); }
.legal ul { padding-left: 22px; }
.legal .updated { font-size: 14px; color: var(--faint); }
.legal mark { background: var(--accent-soft); color: var(--soft-ink); padding: 0 4px; border-radius: 4px; }
.notfound { text-align: left; padding-block: 40px; display: flex; flex-direction: column; gap: 16px; max-width: 640px; }
.notfound h1 { margin: 0; font-size: clamp(32px, 5vw, 52px); font-weight: 800; letter-spacing: -0.03em; }

/* Animaciones */
@keyframes fadeUp { from { opacity: .001; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.fu { animation: fadeUp .7s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 140, 80, .6); } 70% { box-shadow: 0 0 0 10px rgba(255, 140, 80, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 140, 80, 0); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
@media (max-width: 560px) {
  .panel, .result { padding: 22px; }
  .deadline, .cta-band { padding: 24px 22px; }
  .hero { padding-block: 36px 44px; gap: 32px; }
}

/* Reparto del dinero (sueldo neto) */
.stack { display: flex; gap: 2px; height: 12px; border-radius: 999px; overflow: hidden; background: var(--res-bar-off); }
.stack span { height: 100%; width: 0; transition: width .45s cubic-bezier(.2, .7, .2, 1); }
.k-neto { background: var(--res-bar-a); }
.k-irpf { background: var(--res-warn); }
.k-cuota { background: var(--res-bar-b); }
.k-gas { background: var(--res-muted); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 12px; color: var(--res-muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.demo-label { display: block; }

/* Debajo de la calculadora */
.trust { margin-top: 16px; }
.below { display: flex; flex-wrap: wrap; gap: 0 20px; align-items: flex-start; }
.below-main { flex: 999 1 560px; min-width: 0; }
.below-side { flex: 1 1 340px; min-width: 0; margin-top: 64px; display: flex; flex-direction: column; gap: 16px; }

/* Barra de resultado en móvil: visible mientras rellenas el formulario */
.mbar { display: none; }
@media (max-width: 899px) {
  .mbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
    background: var(--res-bg); color: var(--res-fg); text-decoration: none; border-top: 1px solid var(--res-line);
    transform: translateY(110%); transition: transform .25s ease; }
  .mbar.show { transform: none; }
  .mbar:hover { color: var(--res-fg); }
  .mbar small { display: block; font-size: 12px; color: var(--res-muted); font-weight: 600; }
  .mbar strong { display: block; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
  .mbar-cta { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 700; color: var(--res-muted); }
  body[data-calc]:not([data-calc="home"]):not([data-calc="text"]) { padding-bottom: 72px; }
}

.link-btn { padding: 0; border: 0; background: none; font: inherit; font-size: 15px; color: var(--ink); text-align: left; cursor: pointer; }
.link-btn:hover { color: var(--accent); }

/* ---------- Menú por secciones con desplegable ---------- */
.nav-item { position: relative; flex: none; }
.nav .dropdown { display: none; }
@media (min-width: 1001px) {
  .nav { overflow: visible; }
  .dropdown { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; min-width: 250px; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 16px 40px var(--shadow); }
  .dropdown::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
  .nav-item:hover > .dropdown, .nav-item:focus-within > .dropdown { display: flex; flex-direction: column; }
  .nav .dropdown a { display: block; padding: 9px 12px; border-radius: 8px; font-weight: 500; color: var(--ink); }
  .nav .dropdown a:hover { background: var(--bg); color: var(--accent); }
}

/* ---------- Portada y secciones ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 18px 20px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: var(--ink); transition: border-color .2s ease, transform .2s ease; }
.tile:hover { color: var(--ink); border-color: var(--accent); transform: translateY(-2px); }
.tile strong { font-size: 17px; }
.tile span { font-size: 14px; color: var(--muted); }
.sec-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 20px; }
.sec-head h2 { margin: 0; font-size: clamp(24px, 3vw, 32px); font-weight: 800; letter-spacing: -0.025em; }
.sec-head p { margin: 6px 0 0; font-size: 16px; color: var(--muted); max-width: 680px; }
.sec-more { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 15px; text-decoration: none; white-space: nowrap; }
.cat-body { margin-top: 24px; display: flex; flex-direction: column; gap: 24px; }
.cat-text { margin: 8px 0 0; }

/* ---------- Controles extra de calculadora ---------- */
.seg-wrap { grid-auto-flow: row; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
.textarea { width: 100%; min-height: 140px; resize: vertical; border: 1.5px solid var(--field); border-radius: 14px; padding: 12px 14px; font-family: inherit; font-size: 17px; line-height: 1.5; color: var(--ink); background: var(--surface); }
.textarea:focus { outline: none; border-color: var(--accent); }
.frac-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.frac { display: flex; flex-direction: column; align-items: stretch; gap: 6px; width: 96px; }
.frac input { width: 100%; border: 1.5px solid var(--field); border-radius: 12px; padding: 10px 8px; text-align: center; font-family: inherit; font-size: 20px; font-weight: 700; color: var(--ink); background: var(--surface); font-variant-numeric: tabular-nums; }
.frac input:focus { outline: none; border-color: var(--accent); }
.frac-line { height: 3px; border-radius: 2px; background: var(--ink); }
.frac-op { width: 180px; }
.prow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 10px; align-items: center; }
.prow + .prow { margin-top: 10px; }
.prow-head { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.prow-del { width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--field); background: var(--surface); color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
.prow-del:hover { border-color: var(--accent); color: var(--ink); }
#prows { display: flex; flex-direction: column; }

/* Gráfico de interés compuesto */
.ic-chart { height: 96px; display: flex; align-items: flex-end; gap: 2px; }
.ic-col { flex: 1; height: 100%; display: flex; flex-direction: column-reverse; min-width: 0; }
.ic-col span { display: block; width: 100%; transition: height .4s cubic-bezier(.2, .7, .2, 1); }
.ic-a { background: var(--res-bar-b); border-radius: 0 0 2px 2px; }
.ic-i { background: var(--res-bar-a); border-radius: 3px 3px 0 0; }

/* Cuadro de amortización */
.table-wrap { overflow-x: auto; max-height: 460px; overflow-y: auto; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.amort { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.amort th, .amort td { padding: 10px 16px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
.amort th:first-child { text-align: left; }
.amort thead th { position: sticky; top: 0; background: var(--surface); font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.amort tbody tr:last-child th, .amort tbody tr:last-child td { border-bottom: 0; }

/* Fuentes oficiales */
.sources ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.sources a { text-underline-offset: 3px; }
.sources > h2 { font-size: clamp(20px, 2.4vw, 24px) !important; }

/* Fechas */
.input input[type="date"] { font-size: 17px; min-height: 48px; }

/* Escala del IMC */
.imc-scale { position: relative; display: grid; grid-template-columns: 14fr 26fr 20fr 40fr; gap: 2px; height: 12px; border-radius: 999px; overflow: visible; }
.imc-scale span { height: 100%; }
.imc-scale span:nth-child(1) { background: var(--res-bar-a); border-radius: 999px 0 0 999px; }
.imc-scale span:nth-child(2) { background: var(--res-bar-b); }
.imc-scale span:nth-child(3) { background: var(--res-warn); }
.imc-scale span:nth-child(4) { background: var(--hot); border-radius: 0 999px 999px 0; }
.imc-scale i { position: absolute; top: -5px; width: 4px; height: 22px; margin-left: -2px; border-radius: 2px; background: var(--res-fg); box-shadow: 0 0 0 2px var(--res-bg); transition: left .4s cubic-bezier(.2, .7, .2, 1); }
.actions .btn-share { border: 1px solid var(--res-line); background: transparent; color: var(--res-fg); }
