/* Cuentaclaras — hoja de estilos
   Paleta: índigo profundo, violeta de acción, menta para los resultados. */

:root {
  --fondo: #f4f4fb;
  --superficie: #ffffff;
  --superficie-2: #f0effa;
  --indigo: #241c52;
  --indigo-claro: #362a75;
  --violeta: #6244ee;
  --violeta-claro: #7d64f5;
  --menta: #0fae76;
  --menta-suave: #e3f7ef;
  --coral: #ef5f47;
  --ambar: #f5a623;
  --tinta: #1b1733;
  --tinta-suave: #625d80;
  --linea: #e2dff2;

  --sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --titular: "Bricolage Grotesque", var(--sans);

  --r: 14px;
  --r-s: 9px;
  --sombra: 0 18px 40px -24px rgba(36, 28, 82, 0.45);
  --ancho: 74rem;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--fondo);
  color: var(--tinta);
  font-family: var(--sans);
  font-size: 1.0325rem;
  line-height: 1.65;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3 {
  font-family: var(--titular);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 0.55em;
}

h1 { font-size: clamp(2rem, 5.2vw, 3.1rem); }
h2 { font-size: clamp(1.45rem, 3.2vw, 2rem); margin-top: 0; }
h3 { font-size: 1.15rem; margin-top: 1.6em; }

p { margin: 0 0 1.05em; }
p, li { max-width: 42rem; }

a { color: var(--violeta); text-underline-offset: 3px; }
a:hover { color: var(--indigo); }

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

.contenedor { max-width: var(--ancho); margin: 0 auto; padding: 0 1.25rem; }

/* ---------------- Cabecera ---------------- */

.cabecera {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--linea);
}

.cabecera-fila {
  max-width: var(--ancho);
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.marca {
  font-family: var(--titular);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--indigo);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.marca-icono {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 8px;
  background: var(--violeta);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
}

.nav { display: flex; gap: 1.35rem; font-size: 0.94rem; font-weight: 500; margin-left: auto; flex-wrap: wrap; }
.nav a { color: var(--tinta-suave); text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--violeta); }

/* ---------------- Portada: hero ---------------- */

.hero {
  background: var(--indigo);
  background-image: radial-gradient(120% 90% at 85% -10%, #3d2f8a 0%, transparent 55%);
  color: #fff;
  padding: 3.5rem 0 7rem;
}

.hero h1 { color: #fff; max-width: 18ch; }
.hero p { color: #cfc9f0; font-size: 1.13rem; max-width: 44ch; }

.hero-datos { display: flex; gap: 2.2rem; flex-wrap: wrap; margin-top: 1.8rem; }
.hero-datos div { min-width: 7rem; }
.hero-datos b {
  display: block;
  font-family: var(--titular);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--ambar);
  line-height: 1.1;
}
.hero-datos span { font-size: 0.88rem; color: #b6aee6; }

/* ---------------- Rejilla con carril de anuncios ---------------- */

.disposicion {
  max-width: var(--ancho);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}

@media (min-width: 68rem) {
  .disposicion { grid-template-columns: minmax(0, 1fr) 300px; }
  .carril { display: block; }
}

.carril { display: none; position: sticky; top: 5rem; }

.carril .anuncio { margin: 0 0 1.5rem; }

.subir { margin-top: -5.5rem; position: relative; z-index: 2; }

main { padding-bottom: 4rem; }
.pagina-interior main { padding-top: 2.5rem; }

/* ---------------- Panel de calculadoras ---------------- */

.panel {
  background: var(--superficie);
  border-radius: var(--r);
  box-shadow: var(--sombra);
  border: 1px solid var(--linea);
  overflow: hidden;
}

.pestanas {
  display: flex;
  gap: 0.25rem;
  padding: 0.4rem;
  background: var(--superficie-2);
  overflow-x: auto;
  scrollbar-width: none;
}
.pestanas::-webkit-scrollbar { display: none; }

.pestanas button {
  flex: 1 0 auto;
  border: none;
  background: transparent;
  font-family: var(--sans);
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--tinta-suave);
  padding: 0.6rem 1rem;
  border-radius: var(--r-s);
  cursor: pointer;
  white-space: nowrap;
}
.pestanas button:hover { color: var(--indigo); }
.pestanas button[aria-selected="true"] { background: var(--superficie); color: var(--violeta); box-shadow: 0 2px 8px -4px rgba(36,28,82,.4); }

.panel-cuerpo { padding: 1.6rem; }
.panel-cuerpo > h2 { font-size: 1.25rem; margin-bottom: 0.2rem; }
.panel-cuerpo > .sub { color: var(--tinta-suave); font-size: 0.94rem; margin-bottom: 1.4rem; }

[role="tabpanel"][hidden] { display: none; }

/* ---------------- Formularios ---------------- */

.campos-fila { display: flex; gap: 1rem; flex-wrap: wrap; }
.campos-fila .campo { flex: 1 1 11rem; }
.campo { margin-bottom: 1.05rem; }

.campo label { display: block; font-size: 0.92rem; font-weight: 600; margin-bottom: 0.3rem; }
.campo .ayuda { display: block; font-size: 0.83rem; color: var(--tinta-suave); font-weight: 400; margin-bottom: 0.35rem; }

.campo input[type="number"], .campo input[type="text"], .campo select {
  width: 100%;
  padding: 0.65rem 0.8rem;
  font-family: var(--sans);
  font-size: 1.02rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--tinta);
  background: var(--fondo);
  border: 1.5px solid var(--linea);
  border-radius: var(--r-s);
  transition: border-color .15s, background .15s;
}
.campo input:focus, .campo select:focus { border-color: var(--violeta); background: #fff; }

.opciones { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.opciones label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.45rem 0.85rem;
  border: 1.5px solid var(--linea);
  border-radius: 999px;
  cursor: pointer;
  background: var(--fondo);
}
.opciones label:has(input:checked) { border-color: var(--violeta); background: #efeaff; color: var(--indigo); }
.opciones input { accent-color: var(--violeta); }

.boton {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--violeta);
  color: #fff;
  border: none;
  border-radius: var(--r-s);
  padding: 0.78rem 1.5rem;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 20px -12px var(--violeta);
}
.boton:hover { background: var(--violeta-claro); }

.boton-fantasma {
  display: inline-block;
  background: transparent;
  color: #fff;
  border: 1.5px solid rgba(255,255,255,.45);
  border-radius: var(--r-s);
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  text-decoration: none;
}
.boton-fantasma:hover { background: rgba(255,255,255,.12); color: #fff; }

/* ---------------- Resultados ---------------- */

.resultado { margin-top: 1.5rem; }
.resultado[hidden] { display: none; }

.libro { width: 100%; border-collapse: collapse; font-size: 0.97rem; }
.libro caption {
  caption-side: top;
  text-align: left;
  font-family: var(--titular);
  font-weight: 700;
  font-size: 1.05rem;
  padding-bottom: 0.7rem;
}
.libro th {
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--tinta-suave);
  padding: 0 0.85rem 0.4rem;
}
.libro td { padding: 0.55rem 0.85rem; text-align: right; }
.libro td:first-child { text-align: left; color: var(--tinta-suave); }
.libro tbody tr { border-bottom: 1px solid var(--linea); }
.libro tbody tr:last-child { border-bottom: none; }

.libro tr.total td {
  background: var(--menta-suave);
  color: var(--indigo);
  font-weight: 700;
  font-size: 1.3rem;
  padding: 1rem 0.85rem;
}
.libro tr.total td:first-child {
  color: var(--menta);
  font-size: 0.85rem;
  font-weight: 600;
  vertical-align: middle;
  border-radius: var(--r-s) 0 0 var(--r-s);
}
.libro tr.total td:last-child { border-radius: 0 var(--r-s) var(--r-s) 0; }

.nota-calculo {
  font-size: 0.89rem;
  color: var(--tinta-suave);
  background: var(--superficie-2);
  border-radius: var(--r-s);
  padding: 0.85rem 1rem;
  margin: 1.1rem 0 0;
  max-width: none;
}

.error { color: var(--coral); font-weight: 600; font-size: 0.95rem; }

/* ---------------- Secciones ---------------- */

.seccion { margin-top: 3.5rem; }
.seccion > p { color: var(--tinta-suave); }

.rejilla {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14.5rem, 1fr));
  gap: 1rem;
  margin: 1.6rem 0;
}

.tarjeta {
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: var(--r);
  padding: 1.25rem;
  text-decoration: none;
  color: var(--tinta);
  display: block;
}
.tarjeta:hover { border-color: var(--violeta); color: var(--tinta); }
.tarjeta strong { display: block; font-family: var(--titular); font-size: 1.05rem; margin-bottom: 0.3rem; color: var(--indigo); }
.tarjeta span { font-size: 0.9rem; color: var(--tinta-suave); }
.tarjeta .icono {
  width: 2.2rem; height: 2.2rem; border-radius: var(--r-s);
  display: grid; place-items: center; margin-bottom: 0.8rem;
  background: var(--superficie-2); color: var(--violeta);
}

/* ---------------- Acordeón ---------------- */

.acordeon {
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: var(--r);
  margin-bottom: 0.6rem;
  overflow: hidden;
}
.acordeon summary {
  padding: 1rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}
.acordeon summary::-webkit-details-marker { display: none; }
.acordeon summary::after { content: "+"; color: var(--violeta); font-size: 1.3rem; font-weight: 400; }
.acordeon[open] summary::after { content: "−"; }
.acordeon summary:hover { background: var(--superficie-2); }
.acordeon .cuerpo { padding: 0 1.25rem 1.1rem; }
.acordeon .cuerpo p { margin-bottom: 0; color: var(--tinta-suave); font-size: 0.96rem; }

/* ---------------- Tablas de datos ---------------- */

.tabla-envoltorio {
  overflow-x: auto;
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: var(--r);
  margin: 1.4rem 0 2rem;
}
.tabla-datos { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
.tabla-datos th {
  text-align: left;
  background: var(--indigo);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.7rem 0.9rem;
  white-space: nowrap;
}
.tabla-datos td { padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--linea); }
.tabla-datos td + td { text-align: right; }
.tabla-datos tbody tr:last-child td { border-bottom: none; }
.tabla-datos tbody tr:hover { background: var(--superficie-2); }

/* ---------------- Pasos ---------------- */

.pasos { list-style: none; padding: 0; counter-reset: paso; max-width: 42rem; }
.pasos li { counter-increment: paso; position: relative; padding-left: 3rem; margin-bottom: 1.5rem; }
.pasos li::before {
  content: counter(paso);
  position: absolute; left: 0; top: 0;
  width: 2.1rem; height: 2.1rem;
  background: var(--violeta); color: #fff;
  border-radius: 50%;
  font-size: 0.92rem; font-weight: 700;
  display: grid; place-items: center;
}
.pasos li strong { display: block; font-family: var(--titular); font-size: 1.05rem; color: var(--indigo); }

ul.marcada { list-style: none; padding: 0; max-width: 42rem; }
ul.marcada li { padding-left: 1.6rem; position: relative; margin-bottom: 0.5rem; }
ul.marcada li::before { content: "✓"; position: absolute; left: 0; color: var(--menta); font-weight: 700; }

/* ---------------- Avisos ---------------- */

.aviso {
  background: #fff5f2;
  border: 1px solid #fbd9d1;
  border-radius: var(--r);
  padding: 1.1rem 1.3rem;
  font-size: 0.92rem;
  margin: 3rem 0 0;
}
.aviso p { max-width: none; margin: 0; color: #8c3a2a; }
.aviso p + p { margin-top: 0.6rem; }
.aviso strong { color: var(--coral); }

/* ---------------- Publicidad ---------------- */

.anuncio { margin: 2.5rem 0; text-align: center; }
.anuncio::before {
  content: "Publicidad";
  display: block;
  font-size: 0.68rem;
  color: #a29dbd;
  letter-spacing: .06em;
  margin-bottom: 0.35rem;
}
.anuncio ins { display: block; width: 100%; }
.anuncio-carril { min-height: 600px; background: var(--superficie-2); border-radius: var(--r); }
.anuncio-horizontal { min-height: 100px; }

/* ---------------- Pie ---------------- */

.pie { background: var(--indigo); color: #b6aee6; padding: 3rem 0 2rem; font-size: 0.92rem; }
.pie-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 2rem; margin-bottom: 2rem; }
.pie h2 { font-size: 0.82rem; font-family: var(--sans); font-weight: 700; color: #fff; margin: 0 0 0.7rem; }
.pie ul { list-style: none; padding: 0; margin: 0; }
.pie li { margin-bottom: 0.4rem; }
.pie a { color: #b6aee6; text-decoration: none; }
.pie a:hover { color: #fff; }
.pie p { max-width: 40rem; color: #9990cf; font-size: 0.86rem; }
.pie-legal { border-top: 1px solid #3a2f7a; padding-top: 1.5rem; }

/* ---------------- Varios ---------------- */

.migas { font-size: 0.88rem; color: var(--tinta-suave); margin-bottom: 1.2rem; }
.migas a { color: var(--tinta-suave); }
.intro p { font-size: 1.12rem; color: var(--tinta-suave); max-width: 44rem; }
.fecha-datos { font-size: 0.86rem; color: var(--tinta-suave); }

.saltar { position: absolute; left: -9999px; }
.saltar:focus { left: 1rem; top: 1rem; background: #fff; padding: 0.6rem 1rem; z-index: 100; }

/* ---------------- Cookies ---------------- */

#cookies {
  position: fixed; inset: auto 1rem 1rem 1rem; z-index: 60;
  background: var(--indigo); color: #fff;
  border-radius: var(--r);
  padding: 1.2rem 1.4rem;
  box-shadow: 0 24px 50px -20px rgba(27,23,51,.6);
}
#cookies .cookies-caja {
  max-width: var(--ancho); margin: 0 auto;
  display: flex; gap: 1.2rem; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
#cookies p { margin: 0; max-width: 44rem; font-size: 0.9rem; color: #cfc9f0; }
#cookies a { color: #fff; }
#cookies .acciones { display: flex; gap: 0.6rem; flex-wrap: wrap; }
#cookies button {
  font-family: var(--sans); font-size: 0.9rem; font-weight: 600;
  padding: 0.55rem 1.1rem; border-radius: var(--r-s); cursor: pointer;
  border: 1.5px solid rgba(255,255,255,.4); background: transparent; color: #fff;
}
#cookies button.principal { background: var(--violeta); border-color: var(--violeta); }

@media (prefers-reduced-motion: no-preference) {
  .resultado { animation: aparecer .28s cubic-bezier(.2,.8,.2,1); }
  @keyframes aparecer { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
}

@media (max-width: 46rem) {
  .hero { padding: 2.5rem 0 6rem; }
  .panel-cuerpo { padding: 1.2rem; }
  .nav { display: none; }
  .cabecera-fila { justify-content: space-between; }
  .nav-movil { display: flex; }
}

.nav-movil {
  display: none;
  gap: 1rem;
  overflow-x: auto;
  padding: 0.5rem 1.25rem;
  border-top: 1px solid var(--linea);
  font-size: 0.88rem;
  font-weight: 600;
  scrollbar-width: none;
}
.nav-movil::-webkit-scrollbar { display: none; }
.nav-movil a { color: var(--tinta-suave); text-decoration: none; white-space: nowrap; }

/* ---------------- Calculadora en páginas interiores ---------------- */

.calc {
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: var(--r);
  box-shadow: var(--sombra);
  padding: 1.6rem;
  margin: 0 0 2.5rem;
}

.calc-titulo {
  font-family: var(--titular);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--indigo);
  margin: 0 0 1.3rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--linea);
}

.rejilla > a:not(.tarjeta) {
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: var(--r);
  padding: 1.25rem;
  text-decoration: none;
  color: var(--tinta);
  display: block;
}
.rejilla > a:not(.tarjeta):hover { border-color: var(--violeta); }
.rejilla > a:not(.tarjeta) strong {
  display: block; font-family: var(--titular); font-size: 1.05rem;
  margin-bottom: 0.3rem; color: var(--indigo);
}
.rejilla > a:not(.tarjeta) span { font-size: 0.9rem; color: var(--tinta-suave); }

.pagina-interior h2 { margin-top: 2.5rem; }
