/* Aliapyme — Calculadora de ahorro con IA
   Mismos tokens que index.html. Móvil primero. */
:root {
  --bg: #FAFAF7;
  --bg-soft: #F2F0EA;
  --ink: #0F172A;
  --ink-soft: #475569;
  --line: #E2E2DC;
  --accent: #7B6CF6;
  --accent-2: #5B4BD8;
  --emerald: #10B981;
  --coral: #FF6B4A;
  --card: #FFFFFF;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 2px 8px rgba(15, 23, 42, .04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .06), 0 8px 32px rgba(15, 23, 42, .06);
  --radius: 14px;
  --radius-lg: 22px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

.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;
}

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
@media (min-width: 761px) { .container { padding: 0 24px; } }

/* ───────── NAV (igual que la landing) ───────── */
nav#nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  background: rgba(250, 250, 247, .9);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
nav#nav.scrolled { border-bottom-color: var(--line); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; padding-bottom: 14px; }
.brand {
  font-weight: 800; font-size: 28px; letter-spacing: -0.03em;
  display: flex; align-items: center; line-height: 1;
  text-decoration: none; color: var(--ink);
}
.brand .brand-ia { color: var(--accent); font-style: italic; font-family: Georgia, 'Times New Roman', serif; }
.nav-links { display: flex; gap: 32px; align-items: center; }
.nav-links a { color: var(--ink-soft); text-decoration: none; font-size: 14.5px; font-weight: 500; transition: color .2s; }
.nav-links a:hover { color: var(--ink); }
.nav-links a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 42px; height: 42px; padding: 0 9px;
  background: none; border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.nav-toggle .bar { display: block; height: 2px; width: 100%; background: var(--ink); border-radius: 2px; transition: transform .25s, opacity .25s; }
.nav-toggle[aria-expanded="true"] .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.btn-primary {
  background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 100px;
  font-weight: 600; font-size: 14.5px; text-decoration: none;
  display: inline-block; border: none; cursor: pointer; font-family: inherit;
  transition: transform .2s, box-shadow .2s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(15, 23, 42, .18); }
.nav-links a.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-weight: 700;
  box-shadow: 0 6px 18px rgba(123, 108, 246, .32), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.nav-links a.btn-primary:hover { filter: brightness(1.08); color: #fff; }
.btn-secondary {
  background: transparent; color: var(--ink); padding: 11px 20px; border-radius: 100px;
  font-weight: 600; font-size: 14.5px; text-decoration: none; font-family: inherit;
  border: 1.5px solid var(--line); transition: border-color .2s, background .2s;
  display: inline-block; cursor: pointer;
}
.btn-secondary:hover { border-color: var(--ink); background: #fff; }
.btn-wa {
  background: #25D366; color: #fff; padding: 14px 20px; border-radius: 100px;
  font-weight: 700; font-size: 15px; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer;
  box-shadow: 0 6px 18px rgba(37, 211, 102, .25);
  transition: transform .2s, box-shadow .2s, filter .2s;
}
.btn-wa:hover { transform: translateY(-1px); filter: brightness(1.05); box-shadow: 0 10px 26px rgba(37, 211, 102, .38); }
.btn-wa svg { flex-shrink: 0; }

@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line); box-shadow: var(--shadow-md);
    padding: 8px 20px 22px;
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity .2s, transform .2s, visibility .2s;
  }
  .nav-links.open { opacity: 1; visibility: visible; transform: translateY(0); }
  .nav-links a { padding: 14px 2px; font-size: 16px; border-bottom: 1px solid var(--line); }
  .nav-links a.btn-primary { margin-top: 14px; text-align: center; border-bottom: 0; }
}

/* ───────── CABECERA ───────── */
.calc-hero { padding: 28px 0 8px; position: relative; }
.breadcrumb { font-size: 13px; color: var(--ink-soft); margin-bottom: 18px; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumb li + li::before { content: '/'; margin-right: 6px; color: #94A3B8; }
.breadcrumb a { color: var(--ink-soft); }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 13px; background: #fff;
  border: 1px solid var(--line); border-radius: 100px;
  font-size: 13px; font-weight: 500; color: var(--ink-soft);
  box-shadow: var(--shadow-sm); margin-bottom: 18px;
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--emerald); }
h1 {
  font-size: clamp(32px, 5.4vw, 54px); font-weight: 700;
  letter-spacing: -.03em; line-height: 1.08; margin-bottom: 16px; max-width: 860px;
}
h1 em, h2 em {
  font-family: 'Instrument Serif', serif; font-style: italic; font-weight: 400; color: var(--accent-2);
}
.hero-sub { font-size: clamp(16.5px, 1.6vw, 19px); color: var(--ink-soft); max-width: 680px; line-height: 1.55; }
.hero-note { margin-top: 12px; font-size: 14px; color: var(--ink-soft); max-width: 680px; }
.hero-note strong { color: var(--ink); }

/* ───────── CALCULADORA ───────── */
.calc { padding: 28px 0 56px; }
.calc-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
@media (min-width: 980px) {
  .calc-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, .9fr); gap: 32px; align-items: start; }
  .result-col { position: sticky; top: 92px; }
}
.calc-inputs { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 20px 18px; min-width: 0;
}
@media (min-width: 761px) { .panel { padding: 26px; } }
fieldset.panel { min-inline-size: 0; }
.panel > legend, .step-title {
  font-size: 17px; font-weight: 700; letter-spacing: -.01em; padding: 0; margin-bottom: 4px;
  float: left; width: 100%;
}
.panel > legend + * { clear: both; }
.step-num {
  display: inline-grid; place-items: center; width: 26px; height: 26px; margin-right: 8px;
  border-radius: 8px; background: rgba(123, 108, 246, .12); color: var(--accent-2);
  font-size: 13.5px; font-weight: 700; vertical-align: 1px;
}
.panel-help { font-size: 14px; color: var(--ink-soft); margin: 2px 0 14px; }

/* Selector de sector: radios reales con aspecto de chip */
.sector-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (min-width: 620px) { .sector-list { grid-template-columns: repeat(3, 1fr); } }
.sector-opt { position: relative; display: block; }
.sector-opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.sector-opt span {
  display: flex; align-items: center; min-height: 50px; padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
  font-size: 14.5px; font-weight: 600; line-height: 1.25; color: var(--ink);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.sector-opt input:hover + span { border-color: #C9C4F5; }
.sector-opt input:checked + span {
  border-color: var(--accent); background: rgba(123, 108, 246, .08);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.sector-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Campos: etiqueta + número + deslizador */
.field { min-width: 0; }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field-head label { font-size: 14px; font-weight: 500; color: var(--ink); line-height: 1.3; min-width: 0; }
.field-head label small { display: block; font-size: 12.5px; font-weight: 400; color: var(--ink-soft); }
.num-wrap {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff; padding: 0 10px 0 0;
  transition: border-color .15s;
}
.num-wrap:focus-within { border-color: var(--accent); }
.num-wrap input {
  width: 78px; height: 44px; border: 0; background: transparent; border-radius: 10px;
  font: inherit; font-size: 16px; font-weight: 600; color: var(--ink);
  text-align: right; padding: 0 2px 0 10px; font-variant-numeric: tabular-nums;
  -moz-appearance: textfield; appearance: textfield;
}
.num-wrap input::-webkit-outer-spin-button,
.num-wrap input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num-wrap input:focus { outline: none; }
.num-wrap .unit { font-size: 13px; color: var(--ink-soft); white-space: nowrap; min-width: 28px; }
.field input[type="range"] {
  display: block; width: 100%; height: 32px; margin: 4px 0 0; cursor: pointer;
  accent-color: var(--accent); background: transparent;
}

.general-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 620px) { .general-grid { grid-template-columns: 1fr 1fr; gap: 20px; } }

.tasks { display: flex; flex-direction: column; gap: 14px; }
.task {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 14px; background: #fff;
  min-inline-size: 0;
}
@media (min-width: 761px) { .task { padding: 20px; } }
.task legend { font-size: 15.5px; font-weight: 700; letter-spacing: -.005em; padding: 0; float: left; width: 100%; line-height: 1.3; }
.task-hint { clear: both; font-size: 13.5px; color: var(--ink-soft); margin: 4px 0 12px; }
.task-fields { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 620px) { .task-fields { grid-template-columns: 1fr 1fr; gap: 12px 22px; } }
.field.assumption {
  background: var(--bg-soft); border-radius: 12px; padding: 10px 12px 4px;
}
@media (min-width: 620px) { .field.assumption { grid-column: 1 / -1; } }
.tag-assumption {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent-2); margin-bottom: 2px;
}
.task-out {
  margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line);
  font-size: 14px; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 4px 16px;
}
.task-out strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.tasks-foot { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-top: 16px; }
.tasks-foot p { font-size: 13.5px; color: var(--ink-soft); }
.btn-link {
  background: none; border: 0; padding: 10px 0; font: inherit; font-size: 14px; font-weight: 600;
  color: var(--accent-2); cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}

/* ───────── RESULTADO ───────── */
.result {
  background: linear-gradient(160deg, #0F172A, #1E1B4B);
  color: #fff; border-radius: var(--radius-lg); padding: 22px 18px;
  box-shadow: var(--shadow-md); min-width: 0;
}
@media (min-width: 761px) { .result { padding: 28px; } }
.result h2 { font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #C4BCFF; margin-bottom: 14px; }
.result-main { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
/* Cifras muy largas: una columna para que no se partan */
.result-main.is-long { grid-template-columns: minmax(0, 1fr); }
.result-main.is-long .stat.big .stat-value { font-size: clamp(24px, 6.6vw, 32px); }
.stat { min-width: 0; }
.stat-label { font-size: 13px; color: #CBD5E1; line-height: 1.3; }
.stat-value {
  display: block; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin-top: 4px;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.stat.big .stat-value { font-size: clamp(26px, 7.4vw, 38px); }
.stat.big .stat-value small { font-size: .45em; font-weight: 600; color: #CBD5E1; letter-spacing: 0; margin-left: 2px; }
.stat.small .stat-value { font-size: 19px; font-weight: 700; }
.result-sep { grid-column: 1 / -1; height: 1px; background: rgba(255, 255, 255, .12); }
.result-extra {
  margin-top: 16px; padding: 12px 14px; border-radius: 12px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12);
  font-size: 14px; color: #E2E8F0;
}
.result-extra strong { color: #fff; font-variant-numeric: tabular-nums; }
.result-extra[hidden], .result-warn[hidden] { display: none; }
.result-warn {
  margin-top: 12px; padding: 10px 14px; border-radius: 12px; font-size: 13.5px;
  background: rgba(255, 107, 74, .14); border: 1px solid rgba(255, 107, 74, .4); color: #FFD9CF;
}
.breakdown { list-style: none; margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.breakdown li { font-size: 13.5px; color: #E2E8F0; }
.bd-row { display: flex; justify-content: space-between; gap: 12px; }
.bd-row span:last-child { white-space: nowrap; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; }
.bd-bar { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .1); margin-top: 5px; overflow: hidden; }
.bd-bar i { display: block; height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg, var(--accent), #C4BCFF); transition: width .3s var(--ease-out); }
.result-disclaimer { margin-top: 16px; font-size: 13px; color: #CBD5E1; line-height: 1.5; }
.result-disclaimer a { color: #C4BCFF; }

.cta-box { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.cta-box .btn-wa { width: 100%; text-align: center; min-height: 52px; }
.cta-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px;
  padding: 10px 12px; border-radius: 100px; border: 1.5px solid rgba(255, 255, 255, .28);
  background: transparent; color: #fff; font: inherit; font-size: 14px; font-weight: 600;
  text-decoration: none; cursor: pointer; text-align: center; line-height: 1.2;
  transition: background .2s, border-color .2s;
}
.btn-ghost:hover { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .6); }
.result a:focus-visible, .result button:focus-visible { outline-color: #C4BCFF; }
.copy-status { min-height: 20px; font-size: 13.5px; color: #6EE7B7; }
.privacy-note { font-size: 12.5px; color: #94A3B8; line-height: 1.5; }
.privacy-note a { color: #C4BCFF; }

/* Barra fija en móvil con el resultado siempre a la vista */
.mobile-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(15, 23, 42, .97); color: #fff;
  box-shadow: 0 -6px 24px rgba(15, 23, 42, .2);
  transition: transform .25s var(--ease-out), visibility .25s;
}
.mobile-bar.is-hidden { transform: translateY(110%); visibility: hidden; }
.mobile-bar-text { min-width: 0; font-size: 12px; color: #CBD5E1; line-height: 1.25; }
.mobile-bar-text strong { display: block; font-size: 16px; color: #fff; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mobile-bar a {
  flex-shrink: 0; background: #fff; color: var(--ink); text-decoration: none;
  font-size: 14px; font-weight: 700; padding: 11px 16px; border-radius: 100px;
}
body.has-mobile-bar { padding-bottom: 72px; }
@media (min-width: 980px) {
  .mobile-bar { display: none; }
  body.has-mobile-bar { padding-bottom: 0; }
}

/* ───────── TEXTO, FÓRMULA, FAQ ───────── */
.block { padding: 56px 0; }
.block.soft { background: var(--bg-soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.prose { max-width: 760px; }
.section-eyebrow { font-size: 13px; font-weight: 600; color: var(--accent-2); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 12px; }
.block h2 { font-size: clamp(26px, 3.6vw, 38px); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin-bottom: 18px; }
.block h3 { font-size: 18px; font-weight: 700; margin: 26px 0 8px; }
.prose p, .prose li { color: var(--ink-soft); font-size: 16px; margin-bottom: 14px; }
.prose ul { padding-left: 20px; margin-bottom: 14px; }
.prose a { color: var(--accent-2); }
.prose strong { color: var(--ink); }
.formula {
  background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 12px; padding: 16px 18px; margin: 16px 0; font-size: 15px; color: var(--ink);
}
.formula p { color: var(--ink); margin-bottom: 8px; font-size: 15px; }
.formula p:last-child { margin-bottom: 0; }
.formula b { font-weight: 600; }

.faq-list { max-width: 820px; }
.faq-item { border-bottom: 1px solid var(--line); padding: 20px 0; }
.faq-item summary {
  cursor: pointer; font-weight: 600; font-size: 17px;
  display: flex; justify-content: space-between; align-items: center; gap: 16px; list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; font-size: 24px; font-weight: 400; color: var(--accent); transition: transform .25s; flex-shrink: 0; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { color: var(--ink-soft); margin-top: 12px; font-size: 15.5px; line-height: 1.65; }

.closing { text-align: left; }
.closing .closing-ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }

/* ───────── FOOTER (igual que la landing) ───────── */
footer { padding: 40px 0; border-top: 1px solid var(--line); }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: center; }
.footer-meta { font-size: 13.5px; color: var(--ink-soft); font-style: normal; }
.footer-links { display: flex; gap: 12px 24px; flex-wrap: wrap; }
.footer-links a { color: var(--ink-soft); font-size: 13.5px; text-decoration: none; }
.footer-links a:hover { color: var(--ink); }
@media (max-width: 600px) {
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 18px; }
  .footer-links { flex-direction: column; gap: 12px; }
  .block { padding: 44px 0; }
}

.noscript-msg { background: #FFF4E5; border: 1px dashed #E0A33E; border-radius: 12px; padding: 14px 16px; color: #7A5200; font-size: 15px; }

/* ───────── ACCESIBILIDAD ───────── */
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--accent-2); color: #fff;
  padding: 10px 18px; border-radius: 0 0 10px 10px;
  font-weight: 600; font-size: 14px; text-decoration: none; transition: top .2s;
}
.skip-link:focus { top: 0; }
a:focus-visible, button:focus-visible, summary:focus-visible,
input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px;
}
.num-wrap input:focus-visible { outline: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
