/* Layout: una hoja de cálculo limpia; héroe con barra de fórmulas y la mascota saliendo de un dashboard. */
:root {
  --paper: #fdfdfc;
  --surface: #f3f2ef;
  --grid: #e7e5e1;
  --ink: #1e1c1b;
  --muted: #5d5650;
  --xl: #1b6e42;          /* verde de la caja de Excel: acción principal */
  --xl-ink: #ffffff;
  --pbi: #f2c811;         /* amarillo de la caja de Power BI */
  --pbi-ink: #1e1c1b;
  --err: #b84a14;         /* naranja de la camisa: errores */
  --shadow: #1e1c1b;
  --font-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-body: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-cell: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3125rem;
  --step-2: 1.75rem;
  --step-3: clamp(2rem, 4.5vw, 2.75rem);
  --step-4: clamp(2.75rem, 8vw, 5.25rem);
  --wrap: 72rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #161514; --surface: #1f1e1c; --grid: #2b2926; --ink: #f2efeb; --muted: #b5ada5;
    --xl: #34b06c; --xl-ink: #0d1a12; --pbi: #f2c811; --pbi-ink: #1e1c1b; --err: #f08a52; --shadow: #000000;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #161514; --surface: #1f1e1c; --grid: #2b2926; --ink: #f2efeb; --muted: #b5ada5;
  --xl: #34b06c; --xl-ink: #0d1a12; --pbi: #f2c811; --pbi-ink: #1e1c1b; --err: #f08a52; --shadow: #000000;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-underline-offset: 0.18em; }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 3px solid var(--pbi);
  outline-offset: 3px;
  border-radius: 6px;
}
h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin: 0;
}
p { margin: 0; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--pbi); color: var(--pbi-ink); padding: 0.5rem 1rem; z-index: 10;
}
.skip:focus { left: 1rem; }

/* Cabecera */
.top {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 5;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--grid);
}
.top .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding-block: 0.75rem;
}
.brand {
  display: flex; align-items: center; gap: 0.6rem;
  font-family: var(--font-display); font-weight: 800; font-size: 1.125rem;
  text-decoration: none; letter-spacing: -0.01em; white-space: nowrap;
}
.brand img { width: 36px; height: 36px; border-radius: 50%; background: var(--pbi); border: 2px solid var(--ink); }
.nav { display: flex; align-items: center; gap: 1.25rem; font-size: var(--step--1); font-weight: 600; }
.nav a:not(.btn) { text-decoration: none; color: var(--muted); }
.nav a:not(.btn):hover { color: var(--ink); }
@media (max-width: 720px) { .nav a:not(.btn) { display: none; } }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
  font-family: var(--font-body); font-weight: 700; font-size: var(--step-0);
  text-decoration: none; line-height: 1.2;
  padding: 0.9rem 1.35rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--xl); color: var(--xl-ink);
  box-shadow: 4px 4px 0 var(--shadow);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--shadow); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--shadow); }
.btn svg { width: 1.25em; height: 1.25em; flex: none; }
.btn--small { font-size: var(--step--1); padding: 0.5rem 0.95rem; box-shadow: 3px 3px 0 var(--shadow); }
.btn--ghost { background: transparent; color: var(--ink); box-shadow: none; border-color: var(--grid); }
.btn--ghost:hover { box-shadow: none; border-color: var(--ink); }

/* Héroe */
.hero { overflow-x: clip; padding-block: clamp(2.5rem, 7vw, 5rem) clamp(2.5rem, 6vw, 4.5rem); }
.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
.hero-copy { display: grid; gap: 1.5rem; min-width: 0; }
.hero h1 { font-size: var(--step-4); font-weight: 800; letter-spacing: -0.035em; }
.hero h1 .comma { color: var(--muted); }
.lead { font-size: var(--step-1); line-height: 1.45; color: var(--muted); max-width: 34ch; }
.lead strong { color: var(--ink); font-weight: 700; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.reassure { font-size: var(--step--1); color: var(--muted); }

/* Mascota: sale de un lienzo de dashboard con tarjetas de KPI y un gráfico de barras que crece */
.mascot {
  position: relative;
  justify-self: center;
  width: min(100%, 400px);
  aspect-ratio: 4 / 5;
}
.stage {
  position: absolute;
  inset: 24% -12% 10% -12%;
  transform: rotate(-3deg);
  opacity: 0.3;
}
.dash {
  position: absolute;
  inset: 0;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 6px 6px 0 var(--shadow);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 5%;
  padding: 0 5% 5%;
  font-family: var(--font-body);
  font-size: clamp(0.5rem, 1.5vw, 0.68rem);
  line-height: 1.2;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.dash-top {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5em;
  margin-inline: -5.5%;
  padding: 0.75em 5.5%;
  background: var(--paper);
  border-bottom: 1px solid var(--grid);
  white-space: nowrap;
}
.dash-top b { color: var(--ink); font-weight: 700; }
.dash-tabs { display: flex; gap: 0.4em; }
.dash-tabs span { padding: 0.15em 0.6em; border-radius: 999px; border: 1px solid var(--grid); }
.dash-tabs span:first-child { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.dash-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4%; }
.kpi {
  background: var(--paper);
  border: 1px solid var(--grid);
  border-radius: 8px;
  padding: 0.6em 0.7em;
  display: grid; gap: 0.15em;
  min-width: 0;
}
.kpi b { font-family: var(--font-display); font-size: 1.9em; line-height: 1; color: var(--ink); white-space: nowrap; }
.kpi .up { color: var(--xl); font-weight: 700; }
.dash-chart {
  background: var(--paper);
  border: 1px solid var(--grid);
  border-radius: 8px;
  padding: 0.7em 0.8em 0.4em;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0.5em;
  min-height: 0;
}
.dash-chart > b { color: var(--ink); font-weight: 700; }
.stage-bars {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: end;
  background-image: linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 100% 25%;
  border-bottom: 1.5px solid var(--ink);
}
.stage-bars span {
  justify-self: center;
  width: 62%;
  background: var(--pbi);
  border: 2px solid var(--ink);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  transform-origin: bottom;
  position: relative;
}
.stage-bars span:nth-child(1) { height: 34%; }
.stage-bars span:nth-child(2) { height: 46%; }
.stage-bars span:nth-child(3) { height: 41%; }
.stage-bars span:nth-child(4) { height: 62%; }
.stage-bars span:nth-child(5) { height: 74%; }
.stage-bars span:nth-child(6) { height: 92%; outline: 2.5px solid var(--xl); outline-offset: 3px; }
.stage-bars span:nth-child(6)::after {
  content: "Oct · 312 k€";
  position: absolute;
  right: 0; bottom: calc(100% + 0.9em);
  padding: 0.25em 0.55em;
  background: var(--ink); color: var(--paper);
  border-radius: 4px;
  white-space: nowrap;
}
.dash-axis { display: grid; grid-template-columns: repeat(6, 1fr); text-align: center; }
.mascot img {
  position: absolute;
  left: 50%; bottom: 0;
  height: 100%; width: auto; max-width: none;
  transform: translateX(-50%);
  filter: drop-shadow(5px 6px 0 color-mix(in srgb, var(--shadow) 22%, transparent));
}
@media (prefers-reduced-motion: no-preference) {
  .stage-bars span { animation: grow 0.6s cubic-bezier(.2,.9,.3,1.2) both; }
  .stage-bars span:nth-child(2) { animation-delay: 0.08s; }
  .stage-bars span:nth-child(3) { animation-delay: 0.16s; }
  .stage-bars span:nth-child(4) { animation-delay: 0.24s; }
  .stage-bars span:nth-child(5) { animation-delay: 0.32s; }
  .stage-bars span:nth-child(6) { animation-delay: 0.4s; }
  .stage-bars span:nth-child(6)::after { animation: show-ok 0.4s ease 1s both; }
}
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

@media (max-width: 760px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .mascot { order: -1; width: min(78%, 280px); }
}

/* Barra de fórmulas: el momento del héroe */
.sheet {
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: 5px 5px 0 var(--shadow);
  overflow: hidden;
  font-family: var(--font-cell);
  font-size: 0.875rem;
  max-width: 34rem;
}
.sheet-bar {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  border-bottom: 1px solid var(--grid);
  background: var(--surface);
}
.sheet-bar > span { padding: 0.55rem 0.75rem; white-space: nowrap; }
.sheet-name { border-right: 1px solid var(--grid); font-weight: 600; }
.sheet-fx { border-right: 1px solid var(--grid); color: var(--muted); font-style: italic; }
.sheet-bar > .sheet-formula { white-space: normal; overflow-wrap: anywhere; line-height: 1.5; }
.sheet-grid {
  display: grid;
  grid-template-columns: 2rem minmax(0, 0.9fr) repeat(2, minmax(0, 1fr));
  font-variant-numeric: tabular-nums;
}
.sheet-grid > span {
  padding: 0.45rem 0.6rem;
  border-right: 1px solid var(--grid);
  border-bottom: 1px solid var(--grid);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sheet-grid > span:nth-child(4n) { border-right: 0; }
.sheet-grid .hd { background: var(--surface); color: var(--muted); text-align: center; font-size: 0.75rem; }
.sheet-grid .num { text-align: right; }
.cell-live { position: relative; text-align: right; background: color-mix(in srgb, var(--xl) 10%, transparent); }
.cell-live .err, .cell-live .ok { display: block; }
.cell-live .err { color: var(--err); font-weight: 600; }
.cell-live .ok { color: var(--xl); font-weight: 600; }
.sheet-note {
  padding: 0.6rem 0.75rem;
  font-family: var(--font-body);
  font-size: var(--step--1);
  color: var(--muted);
  background: var(--surface);
}
.sheet-note b { color: var(--ink); }

/* Estado final por defecto (página completa en reposo); la animación muestra antes el error */
.cell-live .err { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .cell-live .err { display: block; position: absolute; inset: 0.45rem 0.6rem; text-align: right; animation: hide-err 0.2s steps(1) 1.8s forwards; }
  .cell-live .ok { animation: show-ok 0.45s ease 1.8s both; }
  .sheet-note { animation: show-ok 0.45s ease 2s both; }
}
@keyframes hide-err { to { visibility: hidden; } }
@keyframes show-ok { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Secciones */
.section { padding-block: clamp(3rem, 8vw, 5.5rem); border-top: 1px solid var(--grid); }
.section-head { display: grid; gap: 0.75rem; max-width: 40rem; margin-bottom: clamp(2rem, 4vw, 3rem); }
.section h2 { font-size: var(--step-3); font-weight: 800; }
.section-head p { color: var(--muted); font-size: var(--step-1); line-height: 1.45; }

/* Qué arreglamos */
.fixes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(1.5rem, 3vw, 2.5rem); }
@media (max-width: 1020px) { .fixes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .fixes { grid-template-columns: 1fr; } }
.fix { display: grid; gap: 0.9rem; align-content: start; min-width: 0; }
.fix h3 { font-size: var(--step-2); display: flex; align-items: center; gap: 0.65rem; }
.chip { width: 1.1rem; height: 1.1rem; border: 2px solid var(--ink); border-radius: 4px; flex: none; }
.chip--pbi { background: var(--pbi); }
.chip--pp { background: var(--err); }
.chip--xl { background: var(--xl); }
.chip--az { background: var(--ink); }
.fix ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.15rem; }
.fix li { padding-block: 0.55rem; border-bottom: 1px dashed var(--grid); }
.fix li:last-child { border-bottom: 0; }

/* Cómo funciona */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.5rem, 3vw, 2.5rem); counter-reset: paso; }
@media (max-width: 860px) { .steps { grid-template-columns: 1fr; } }
.steps li { counter-increment: paso; display: grid; gap: 0.6rem; align-content: start; min-width: 0; }
.steps li::before {
  content: counter(paso);
  font-family: var(--font-display); font-weight: 800; font-size: 1.5rem;
  width: 2.75rem; height: 2.75rem; display: grid; place-items: center;
  border: 2px solid var(--ink); border-radius: 50%;
  background: var(--paper);
}
.steps h3 { font-size: var(--step-1); }
.steps p { color: var(--muted); }

/* Precio */
.pricing { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(2rem, 5vw, 4rem); align-items: start; }
@media (max-width: 860px) { .pricing { grid-template-columns: 1fr; } }
.price-card {
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--pbi);
  color: var(--pbi-ink);
  box-shadow: 6px 6px 0 var(--shadow);
  padding: clamp(1.5rem, 4vw, 2.25rem);
  display: grid; gap: 1rem;
}
.price {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(3.5rem, 11vw, 6rem); line-height: 0.95; letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.price small { font-size: 0.24em; letter-spacing: 0; font-weight: 700; display: block; margin-top: 0.35rem; }
.price-card ul { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.35rem; font-weight: 500; }
.price-detail { display: grid; gap: 1.5rem; min-width: 0; }
.guarantee {
  border: 2px solid var(--xl);
  border-radius: 14px;
  padding: 1.25rem 1.4rem;
  display: grid; gap: 0.4rem;
}
.guarantee h3 { font-size: var(--step-1); color: var(--xl); }
.example { display: grid; gap: 0.5rem; }
.example h3 { font-size: var(--step-1); }
.example table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.example td { padding: 0.5rem 0; border-bottom: 1px solid var(--grid); }
.example td:last-child { text-align: right; white-space: nowrap; padding-left: 1rem; }
.example tr:last-child td { border-bottom: 0; font-weight: 700; }
.fine { font-size: var(--step--1); color: var(--muted); }

/* Preguntas */
.faq { display: grid; gap: 0.75rem; max-width: 46rem; }
.faq details { border: 1px solid var(--grid); border-radius: 10px; background: var(--paper); }
.faq details[open] { border-color: var(--ink); }
.faq summary {
  cursor: pointer; list-style: none;
  padding: 1rem 1.25rem;
  font-weight: 700;
  display: flex; justify-content: space-between; gap: 1rem; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--font-display); font-size: 1.5rem; line-height: 1; color: var(--muted); }
.faq details[open] summary::after { content: "−"; }
.faq details > div { padding: 0 1.25rem 1.1rem; color: var(--muted); display: grid; gap: 0.6rem; }

/* Llamada final */
.cta-band { background: var(--surface); border-top: 1px solid var(--grid); }
.cta-band .wrap { padding-block: clamp(3rem, 7vw, 4.5rem); display: grid; gap: 1.25rem; justify-items: start; }
.cta-band h2 { font-size: var(--step-3); font-weight: 800; max-width: 22ch; }
.cta-band p { color: var(--muted); }
.phone { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); user-select: all; }

/* Pie */
.foot { border-top: 1px solid var(--grid); font-size: var(--step--1); color: var(--muted); }
.foot .wrap { padding-block: 2rem; display: grid; gap: 1rem; }
.foot-row { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: space-between; }
.foot-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.foot a { color: var(--ink); }

/* Páginas legales */
.legal { padding-block: clamp(2.5rem, 6vw, 4rem); }
.legal .wrap { max-width: 48rem; }
.legal h1 { font-size: var(--step-3); font-weight: 800; margin-bottom: 0.75rem; }
.legal .meta { color: var(--muted); font-size: var(--step--1); margin-bottom: 2rem; }
.legal h2 { font-size: var(--step-1); margin: 2.25rem 0 0.75rem; }
.legal h3 { font-size: var(--step-0); margin: 1.5rem 0 0.5rem; }
.legal p, .legal li { color: var(--ink); }
.legal p + p { margin-top: 0.75rem; }
.legal ul, .legal ol { padding-left: 1.25rem; margin: 0.5rem 0; display: grid; gap: 0.4rem; }
.legal .summary {
  border: 2px solid var(--ink); border-radius: 12px; background: var(--surface);
  padding: 1rem 1.25rem; margin-bottom: 1.5rem;
}
.table-scroll { overflow-x: auto; margin: 0.75rem 0; }
.legal table { border-collapse: collapse; width: 100%; min-width: 30rem; font-size: 0.95rem; }
.legal th, .legal td { text-align: left; vertical-align: top; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--grid); }
.legal th { background: var(--surface); font-weight: 700; }
.back { display: inline-block; margin-bottom: 1.5rem; font-weight: 600; font-size: var(--step--1); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
}
