/* =============================================================
   CalculaISR.mx — hoja de estilos única
   1 Tokens · 2 Reset · 3 Utilidades · 4 Tipografía · 5 Componentes
   6 Cabecera · 7 Herramienta · 8 Anuncios · 9 Secciones · 10 Pie
   11 Responsive · 12 Impresión · 13 Reduced motion
   ============================================================= */

/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --ink:        #0f172a;
  --ink-2:      #334155;
  --muted:      #64748b;
  --muted-2:    #94a3b8;
  --line:       #e2e8f0;
  --line-2:     #cbd5e1;
  --bg:         #f5f8fa;
  --bg-2:       #eef4f5;
  --surface:    #ffffff;

  --brand:      #0f766e;
  --brand-dark: #115e59;
  --brand-deep: #134e4a;
  --brand-soft: #d7f2ee;
  --brand-tint: #f0faf8;

  --tax:        #b45309;
  --tax-soft:   #fef3e2;
  --net:        #0d9488;

  --danger:     #b91c1c;
  --danger-soft:#fef2f2;

  --sans:    "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --display: "Plus Jakarta Sans", var(--sans);

  --wrap:   1140px;
  --gutter: clamp(1.15rem, 4vw, 2.5rem);

  --r-sm: 8px;
  --r:    14px;
  --r-lg: 22px;
  --r-xl: 30px;

  --sh-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .05);
  --sh:    0 4px 12px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --sh-lg: 0 24px 60px -20px rgba(15, 42, 55, .22), 0 8px 20px -12px rgba(15, 42, 55, .12);

  --ease-out:   cubic-bezier(.16, 1, .3, 1);
  --ease-soft:  cubic-bezier(.25, .46, .45, .94);
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  tab-size: 2;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.62;
  color: var(--ink-2);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  font-variant-numeric: tabular-nums;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3, h4 {
  font-family: var(--display);
  color: var(--ink);
  text-wrap: balance;
  line-height: 1.14;
  letter-spacing: -.022em;
  font-weight: 800;
}
::selection { background: var(--brand-soft); color: var(--brand-deep); }
:focus-visible {
  outline: 2.5px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

/* =============================================================
   3. Utilidades
   ============================================================= */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.wrap--narrow { max-width: 780px; }

.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;
}
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 999;
  padding: .7rem 1.1rem; border-radius: var(--r-sm);
  background: var(--brand); color: #fff; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   4. Componentes base
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .6rem;
  padding: .95rem 1.6rem;
  border-radius: 999px;
  font-weight: 650;
  font-size: .98rem;
  letter-spacing: -.01em;
  transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out),
              background-color .2s var(--ease-out), color .2s var(--ease-out);
}
.btn svg { width: 1.2em; height: 1.2em; flex: none; }

.btn--primary {
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  box-shadow: 0 10px 24px -10px rgba(15, 118, 110, .65);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 16px 32px -12px rgba(15, 118, 110, .7); }
.btn--primary:active { transform: translateY(0); }
.btn--primary[disabled] { opacity: .62; cursor: progress; transform: none; }

.btn--ghost {
  background: transparent;
  color: var(--muted);
  border: 1.5px solid var(--line-2);
}
.btn--ghost:hover { color: var(--ink); border-color: var(--muted-2); background: #fff; }

/* =============================================================
   5. Cabecera
   ============================================================= */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 4.1rem;
}
.brand { display: inline-flex; align-items: center; gap: .6rem; }
.brand__mark {
  display: grid; place-items: center;
  width: 2.1rem; height: 2.1rem; border-radius: 9px;
  background: linear-gradient(145deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: #fff;
}
.brand__mark svg { width: 1.15rem; height: 1.15rem; }
.brand__text {
  font-family: var(--display); font-weight: 700; font-size: 1.09rem;
  color: var(--ink); letter-spacing: -.03em;
}
.brand__text strong { font-weight: 800; color: var(--brand); }
.brand__tld { color: var(--muted-2); font-weight: 600; }

/* En móvil se oculta: la página es un único scroll y el pie repite los enlaces. */
.site-nav { display: none; gap: 1.5rem; }
.site-nav a {
  font-size: .92rem; font-weight: 550; color: var(--muted);
  white-space: nowrap;
  transition: color .2s var(--ease-out);
}
.site-nav a:hover { color: var(--brand); }

/* =============================================================
   6. Hero
   ============================================================= */
.hero {
  background:
    radial-gradient(900px 420px at 50% -8%, rgba(15, 118, 110, .10), transparent 65%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 58%);
  padding: clamp(1.9rem, 5vw, 3.4rem) 0 clamp(2rem, 4vw, 2.8rem);
  text-align: center;
}
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .38rem .9rem .38rem .7rem;
  border-radius: 999px;
  background: #fff; border: 1px solid var(--line);
  font-size: .765rem; font-weight: 600; letter-spacing: .01em;
  color: var(--brand-dark);
  box-shadow: var(--sh-sm);
}
.hero__eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--net);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, .18);
}
.hero__title {
  margin: .85rem auto .65rem;
  font-size: clamp(1.72rem, 5.1vw, 3.05rem);
  max-width: 17ch;
}
.hero__sub {
  max-width: 56ch; margin: 0 auto;
  font-size: clamp(.94rem, 1.9vw, 1.09rem);
  line-height: 1.5;
  color: var(--muted);
}
.hero__sub strong { color: var(--ink-2); font-weight: 650; }

/* =============================================================
   7. La herramienta
   ============================================================= */
.tool {
  margin: clamp(1.6rem, 4vw, 2.4rem) auto 0;
  max-width: 940px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  overflow: hidden;
  text-align: left;
}

/* --- Formulario --- */
.tool__form {
  padding: clamp(1.25rem, 3.4vw, 2rem);
  display: grid;
  gap: 1.4rem;
  border-bottom: 1px solid var(--line);
}
.field { border: 0; padding: 0; min-width: 0; }
.field__label {
  display: block;
  font-size: .855rem; font-weight: 650; color: var(--ink);
  letter-spacing: -.005em;
  margin-bottom: .6rem; padding: 0;
}
.field__label strong { color: var(--brand-dark); }
.field__help { font-size: .8rem; color: var(--muted-2); margin-top: .5rem; }
.field__error {
  font-size: .82rem; font-weight: 600; color: var(--danger);
  margin-top: .5rem; padding: .5rem .75rem;
  background: var(--danger-soft); border-radius: var(--r-sm);
}

/* Selector de periodo */
.periods { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.period { position: relative; display: block; }
.period input {
  position: absolute; opacity: 0; inset: 0;
  width: 100%; height: 100%; margin: 0; cursor: pointer;
}
.period__box {
  display: flex; flex-direction: column; align-items: center; gap: .12rem;
  padding: .85rem .5rem;
  border: 1.5px solid var(--line-2);
  border-radius: var(--r);
  background: #fff;
  text-align: center;
  transition: border-color .2s var(--ease-out), background-color .2s var(--ease-out),
              box-shadow .2s var(--ease-out), transform .2s var(--ease-out);
}
.period__name { font-weight: 650; font-size: .95rem; color: var(--ink); letter-spacing: -.01em; }
.period__meta { font-size: .73rem; color: var(--muted-2); }
.period input:hover + .period__box { border-color: var(--brand); transform: translateY(-1px); }
.period input:checked + .period__box {
  border-color: var(--brand);
  background: var(--brand-tint);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .13);
}
.period input:checked + .period__box .period__name { color: var(--brand-dark); }
.period input:checked + .period__box .period__meta { color: var(--brand); }
.period input:focus-visible + .period__box { outline: 2.5px solid var(--brand); outline-offset: 2px; }

/* Importe */
.amount {
  display: flex; align-items: center;
  border: 1.5px solid var(--line-2);
  border-radius: var(--r);
  background: #fff;
  transition: border-color .2s var(--ease-out), box-shadow .2s var(--ease-out);
  overflow: hidden;
}
.amount:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .13);
}
.amount--error { border-color: var(--danger); }
.amount__currency {
  padding-left: 1rem;
  font-family: var(--display); font-weight: 700;
  font-size: clamp(1.35rem, 3.6vw, 1.7rem);
  color: var(--muted-2);
}
.amount input {
  flex: 1; min-width: 0;
  padding: .8rem .55rem;
  border: 0; background: none; outline: none;
  font-family: var(--display); font-weight: 750;
  font-size: clamp(1.35rem, 3.6vw, 1.7rem);
  letter-spacing: -.02em; color: var(--ink);
}
.amount__suffix {
  padding-right: 1rem;
  font-size: .8rem; font-weight: 600; color: var(--muted-2);
  letter-spacing: .04em;
}

/* Campos numéricos pequeños (días, horas) */
.mini-input {
  display: flex; align-items: center; gap: .5rem;
  border: 1.5px solid var(--line-2);
  border-radius: var(--r);
  background: #fff;
  padding-right: .5rem;
  transition: border-color .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.mini-input:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .13);
}
.mini-input input {
  flex: 1; min-width: 0;
  padding: .7rem .9rem;
  border: 0; background: none; outline: none;
  font-family: var(--display); font-weight: 750;
  font-size: 1.24rem; letter-spacing: -.02em; color: var(--ink);
}
.mini-input__unit {
  font-size: .8rem; font-weight: 600; color: var(--muted-2);
  white-space: nowrap;
}
.mini-input__btn {
  padding: .38rem .7rem; border-radius: 999px;
  background: var(--brand-tint); color: var(--brand-dark);
  font-size: .78rem; font-weight: 650; white-space: nowrap;
  transition: background-color .2s var(--ease-out);
}
.mini-input__btn:hover { background: var(--brand-soft); }

/* Fechas */
.date-input {
  width: 100%;
  padding: .7rem .9rem;
  border: 1.5px solid var(--line-2);
  border-radius: var(--r);
  background: #fff;
  font-family: var(--display); font-weight: 700;
  font-size: 1.05rem; color: var(--ink);
  transition: border-color .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.date-input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .13);
}

/* Atajos rápidos */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
.chip-btn {
  padding: .38rem .8rem; border-radius: 999px;
  border: 1.5px solid var(--line-2); background: #fff;
  font-size: .8rem; font-weight: 600; color: var(--muted);
  transition: border-color .2s var(--ease-out), color .2s var(--ease-out),
              background-color .2s var(--ease-out);
}
.chip-btn:hover {
  border-color: var(--brand); color: var(--brand-dark); background: var(--brand-tint);
}

/* Aviso dentro del resultado */
.warn {
  margin: 1.1rem 0 0;
  padding: .8rem 1rem;
  background: var(--tax-soft); border: 1px solid #fbe3c2;
  border-radius: var(--r);
  font-size: .845rem; color: #8a4508; line-height: 1.5;
}
.warn[hidden] { display: none; }
.warn strong { font-weight: 700; }

/* Interruptor del subsidio */
.switch { display: flex; align-items: flex-start; gap: .8rem; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
  flex: none; position: relative;
  width: 2.85rem; height: 1.6rem; border-radius: 999px;
  background: var(--line-2); margin-top: .1rem;
  transition: background-color .25s var(--ease-out);
}
.switch__thumb {
  position: absolute; top: 3px; left: 3px;
  width: 1.15rem; height: 1.15rem; border-radius: 50%;
  background: #fff; box-shadow: var(--sh-sm);
  transition: transform .25s var(--ease-out);
}
.switch input:checked + .switch__track { background: var(--brand); }
.switch input:checked + .switch__track .switch__thumb { transform: translateX(1.24rem); }
.switch input:focus-visible + .switch__track { outline: 2.5px solid var(--brand); outline-offset: 2px; }
.switch__text { font-size: .875rem; color: var(--ink-2); }
.switch__text strong { color: var(--ink); font-weight: 650; }
.switch__note { display: block; font-size: .765rem; color: var(--muted-2); }

/* --- Resultado --- */
.result { padding: clamp(1.25rem, 3.4vw, 2rem); }

.result__headline { text-align: center; }
.result__label {
  font-size: .8rem; font-weight: 650; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted-2);
}
.result__net {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(2.55rem, 9.5vw, 4.1rem);
  line-height: 1.02; letter-spacing: -.045em;
  color: var(--brand-deep);
  margin: .25rem 0 .35rem;
}
.result__cur { font-size: .55em; vertical-align: .28em; color: var(--brand); margin-right: .06em; }
.result__caption { font-size: .92rem; color: var(--muted); }
.result__caption strong { color: var(--ink-2); font-weight: 650; }

/* Barra proporcional */
.bar {
  display: flex; height: 13px; margin: 1.35rem 0 .55rem;
  border-radius: 999px; overflow: hidden; background: var(--line);
}
.bar__net { background: linear-gradient(90deg, var(--net), var(--brand)); transition: width .5s var(--ease-out); }
.bar__tax { background: linear-gradient(90deg, #f59e0b, var(--tax)); transition: width .5s var(--ease-out); }
.bar__legend {
  display: flex; justify-content: center; gap: 1.4rem;
  font-size: .79rem; color: var(--muted);
}
.bar__legend span { display: inline-flex; align-items: center; gap: .4rem; }
.chip { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chip--net { background: var(--net); }
.chip--tax { background: var(--tax); }

/* Tarjetas de cifras */
.stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem;
  margin: 1.5rem 0 1.35rem;
}
.stat {
  min-width: 0;                 /* deja que la celda encoja en móvil */
  padding: .85rem .7rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: #fbfdfd;
  text-align: center;
}
.stat__k {
  font-size: .74rem; font-weight: 600; color: var(--muted-2);
  text-transform: uppercase; letter-spacing: .045em;
  margin-bottom: .2rem;
}
.stat__v {
  font-family: var(--display); font-weight: 750;
  font-size: clamp(.98rem, 2.9vw, 1.22rem);
  letter-spacing: -.025em; color: var(--ink);
}
.stat--tax { background: var(--tax-soft); border-color: #fbe3c2; }
.stat--tax .stat__v { color: var(--tax); }
.stat--net { background: var(--brand-tint); border-color: var(--brand-soft); }
.stat--net .stat__v { color: var(--brand-dark); }

/* Desglose */
.breakdown {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: #fbfdfd;
  overflow: hidden;
}
.breakdown__summary {
  display: flex; align-items: center; justify-content: space-between;
  gap: .6rem; padding: .85rem 1rem;
  font-size: .88rem; font-weight: 650; color: var(--ink);
  cursor: pointer; list-style: none;
}
.breakdown__summary::-webkit-details-marker { display: none; }
.breakdown__summary svg {
  width: 1.05rem; height: 1.05rem; color: var(--muted-2);
  transition: transform .3s var(--ease-out);
}
.breakdown[open] .breakdown__summary svg { transform: rotate(180deg); }
.breakdown[open] .breakdown__summary { border-bottom: 1px solid var(--line); }

.breakdown__table { width: 100%; border-collapse: collapse; }
.breakdown__table th,
.breakdown__table td {
  padding: .58rem 1rem;
  font-size: .87rem;
  border-bottom: 1px solid #eef2f5;
}
.breakdown__table th {
  text-align: left; font-weight: 500; color: var(--muted);
}
.breakdown__table td {
  text-align: right; font-weight: 650; color: var(--ink-2);
  white-space: nowrap;
}
.breakdown__table tr:last-child th,
.breakdown__table tr:last-child td { border-bottom: 0; }
.breakdown__table .is-sub th,
.breakdown__table .is-sub td { background: #f6fafa; }
.breakdown__table .is-total th { font-weight: 650; color: var(--ink); }
.breakdown__table .is-total td { color: var(--ink); }
.breakdown__table .is-strong th,
.breakdown__table .is-strong td { background: var(--tax-soft); color: var(--tax); font-weight: 750; }
.breakdown__table .is-net th,
.breakdown__table .is-net td { background: var(--brand-tint); color: var(--brand-dark); font-weight: 750; }
.breakdown__table tr[hidden] { display: none; }
.breakdown__note {
  padding: .7rem 1rem .85rem;
  font-size: .775rem; color: var(--muted-2);
  border-top: 1px solid #eef2f5;
}

/* Acciones */
.result__actions {
  display: flex; flex-wrap: wrap; gap: .7rem;
  justify-content: center; align-items: center;
  margin-top: 1.35rem;
}
.result__actions .btn--primary { flex: 1 1 auto; min-width: 250px; }
.result__pdfnote {
  margin-top: .6rem; text-align: center;
  font-size: .79rem; color: var(--muted-2); min-height: 1.1em;
}
.result__pdfnote.is-error { color: var(--danger); font-weight: 600; }

/* Estado de trabajo */
.tool[data-state="working"] .btn--primary { opacity: .62; cursor: progress; }

.noscript {
  margin: 0 clamp(1.25rem, 3.4vw, 2rem) clamp(1.25rem, 3.4vw, 2rem);
  padding: .85rem 1rem;
  background: var(--tax-soft); border: 1px solid #fbe3c2;
  border-radius: var(--r); font-size: .86rem; color: #8a4508;
}

/* Distintivos de confianza */
.trust {
  max-width: 940px; margin: 1.4rem auto 0;
  display: grid; gap: .55rem;
  text-align: left;
}
.trust__item {
  display: flex; gap: .6rem; align-items: flex-start;
  font-size: .825rem; color: var(--muted);
  line-height: 1.5;
}
.trust__item strong { color: var(--ink-2); font-weight: 650; }

/* =============================================================
   8. Huecos de publicidad (placeholders — sin scripts de terceros)
   ============================================================= */
.ad-slot {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: .3rem;
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r);
  background:
    repeating-linear-gradient(-45deg, #fbfcfd 0 10px, #f4f7f9 10px 20px);
  color: var(--muted-2);
  text-align: center;
}
.ad-slot__tag {
  font-family: var(--display); font-weight: 800;
  font-size: .78rem; letter-spacing: .18em;
  color: var(--muted);
}
.ad-slot__size { font-size: .7rem; letter-spacing: .03em; }

/* Cuando el hueco lleva un anuncio real se quita el marco de relleno. */
.ad-slot--live {
  border: 0; background: none; display: block; padding: 0;
}

.ad-slot--leaderboard { min-height: 96px; margin: clamp(1.5rem, 4vw, 2.4rem) 0 0; }
.ad-slot--incontent   { min-height: 254px; margin: clamp(1.5rem, 4vw, 2.4rem) auto; max-width: 340px; }
.ad-slot--modal       { min-height: 220px; width: 100%; }
.ad-slot--corner      { min-height: 84px; width: 100%; border-radius: var(--r-sm); }

/* Pop-up tras la descarga */
.ad-modal {
  border: 0; padding: 0; max-width: 400px; width: calc(100% - 2rem);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-lg);
  color: var(--ink-2);
}
.ad-modal::backdrop { background: rgba(15, 42, 55, .5); backdrop-filter: blur(3px); }
.ad-modal__inner { position: relative; padding: 1.5rem 1.35rem 1.2rem; }
.ad-modal__close {
  position: absolute; top: .7rem; right: .7rem;
  display: grid; place-items: center;
  width: 2.1rem; height: 2.1rem; border-radius: 50%;
  color: var(--muted); background: var(--bg);
  transition: background-color .2s var(--ease-out), color .2s var(--ease-out);
}
.ad-modal__close:hover { background: var(--line); color: var(--ink); }
.ad-modal__close svg { width: 1.05rem; height: 1.05rem; }
.ad-modal__kicker {
  font-family: var(--display); font-weight: 700; font-size: 1rem;
  color: var(--brand-dark); text-align: center;
  margin-bottom: 1rem; padding-right: 1.6rem;
}
.ad-modal__cta { width: 100%; margin-top: 1rem; }

/* Notificación en la esquina */
.ad-corner {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 60;
  width: min(310px, calc(100vw - 2rem));
  padding: .55rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh-lg);
  animation: adSlideIn .5s var(--ease-out) both;
}
.ad-corner[hidden] { display: none; }
.ad-corner__close {
  position: absolute; top: -.55rem; right: -.55rem;
  display: grid; place-items: center;
  width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: var(--ink); color: #fff;
  box-shadow: var(--sh);
  transition: transform .2s var(--ease-out);
}
.ad-corner__close:hover { transform: scale(1.08); }
.ad-corner__close svg { width: .8rem; height: .8rem; }
@keyframes adSlideIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Aviso de cookies (solo aparece si hay publicidad activa) */
.cookie-notice {
  position: fixed; inset: auto 0 0 0; z-index: 70;
  display: flex; flex-direction: column; gap: .9rem;
  padding: 1.1rem var(--gutter) 1.2rem;
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -12px 40px -18px rgba(15, 42, 55, .28);
  animation: cookieUp .45s var(--ease-out) both;
}
.cookie-notice__text {
  font-size: .85rem; color: var(--muted); line-height: 1.55;
  max-width: 72ch;
}
.cookie-notice__text strong { color: var(--ink-2); font-weight: 650; }
.cookie-notice__text a {
  color: var(--brand); font-weight: 600;
  text-decoration: underline; text-underline-offset: 2px;
}
.cookie-notice__actions {
  display: flex; flex-wrap: wrap; gap: .55rem;
}
.cookie-notice .btn { padding: .7rem 1.15rem; font-size: .87rem; }
@keyframes cookieUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* Datos del titular pendientes de rellenar en las páginas legales */
mark.todo {
  background: #fef3c7; color: #92400e;
  padding: .05em .35em; border-radius: 4px;
  font-weight: 650; font-style: normal;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}

/* =============================================================
   9. Secciones de contenido
   ============================================================= */
.section { padding: clamp(2.6rem, 7vw, 4.6rem) 0; }
.section--alt {
  background: linear-gradient(180deg, #fff 0%, #fbfdfd 100%);
  border-block: 1px solid var(--line);
}
.section__eyebrow {
  font-size: .77rem; font-weight: 700; letter-spacing: .13em;
  text-transform: uppercase; color: var(--brand);
  margin-bottom: .55rem;
}
.section__title {
  font-size: clamp(1.55rem, 3.9vw, 2.25rem);
  margin-bottom: .7rem;
}
.section__lead {
  max-width: 62ch; color: var(--muted);
  font-size: clamp(.96rem, 1.7vw, 1.04rem);
  margin-bottom: clamp(1.6rem, 4vw, 2.4rem);
}

/* Pasos */
.steps {
  display: grid; gap: 1rem;
  grid-template-columns: 1fr;
  list-style: none; padding: 0; counter-reset: none;
}
.step {
  position: relative;
  padding: 1.5rem 1.35rem 1.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  transition: transform .3s var(--ease-out), box-shadow .3s var(--ease-out);
}
.step:hover { transform: translateY(-3px); box-shadow: var(--sh); }
.step__n {
  position: absolute; top: -.75rem; left: 1.35rem;
  display: grid; place-items: center;
  width: 1.85rem; height: 1.85rem; border-radius: 50%;
  background: var(--brand); color: #fff;
  font-family: var(--display); font-weight: 800; font-size: .88rem;
  box-shadow: 0 4px 12px -4px rgba(15, 118, 110, .6);
}
.step__icon {
  display: grid; place-items: center;
  width: 2.9rem; height: 2.9rem; border-radius: var(--r);
  background: var(--brand-tint); color: var(--brand);
  margin-bottom: .9rem;
}
.step__icon svg { width: 1.45rem; height: 1.45rem; }
.step__title { font-size: 1.08rem; font-weight: 750; margin-bottom: .35rem; }
.step__text { font-size: .9rem; color: var(--muted); }

/* Ideas de uso */
.ideas { display: grid; gap: .9rem; grid-template-columns: 1fr; }
.idea {
  padding: 1.25rem 1.25rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand-soft);
  border-radius: var(--r);
  transition: border-left-color .3s var(--ease-out), transform .3s var(--ease-out);
}
.idea:hover { border-left-color: var(--brand); transform: translateX(2px); }
.idea__title { font-size: 1rem; font-weight: 750; margin-bottom: .3rem; }
.idea p { font-size: .885rem; color: var(--muted); }

/* Enlaces a las otras calculadoras */
.tool-cards { display: grid; gap: .8rem; grid-template-columns: 1fr; }
.tool-card {
  display: block;
  padding: 1.2rem 1.25rem 1.05rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  transition: transform .3s var(--ease-out), box-shadow .3s var(--ease-out),
              border-color .3s var(--ease-out);
}
.tool-card:hover {
  transform: translateY(-3px);
  border-color: var(--brand-soft);
  box-shadow: var(--sh);
}
.tool-card__title {
  font-size: 1.02rem; font-weight: 750; margin-bottom: .3rem;
  color: var(--brand-dark);
}
.tool-card__text { font-size: .875rem; color: var(--muted); margin-bottom: .6rem; }
.tool-card__go { font-size: .82rem; font-weight: 650; color: var(--brand); }

/* Cabecera de las páginas de guía (sin calculadora) */
.guide-hero {
  max-width: 720px; margin: clamp(1.4rem, 4vw, 2.2rem) auto 0;
  padding: clamp(1.3rem, 3.4vw, 2rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  text-align: left;
}
.guide-hero__lead { font-size: 1.01rem; color: var(--ink-2); }
.guide-hero__lead + .guide-hero__lead { margin-top: .85rem; }
.guide-hero__lead strong { color: var(--ink); font-weight: 650; }
.guide-hero__links {
  display: flex; flex-wrap: wrap; gap: .7rem;
  margin-top: 1.2rem;
}

/* Prosa SEO */
.prose h3 {
  font-size: 1.16rem; font-weight: 750;
  margin: 1.9rem 0 .55rem;
}
.prose p { margin-bottom: .95rem; font-size: 1rem; }
.prose ol { margin: 0 0 1.1rem 1.15rem; padding: 0; }
.prose ol li { margin-bottom: .5rem; padding-left: .25rem; font-size: 1rem; }
.prose strong { color: var(--ink); font-weight: 650; }
.prose em { color: var(--brand-dark); font-style: normal; font-weight: 550; }
.prose__note {
  margin-top: 1.5rem; padding: 1rem 1.15rem;
  background: var(--brand-tint);
  border: 1px solid var(--brand-soft);
  border-radius: var(--r);
  font-size: .89rem; color: var(--brand-deep);
}

/* Tablas oficiales */
.tables { display: grid; gap: 1.15rem; grid-template-columns: 1fr; }
.tbl {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color .3s var(--ease-out), box-shadow .3s var(--ease-out);
}
.tbl[data-active] { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 118, 110, .1); }
.tbl__title {
  font-size: 1rem; font-weight: 750;
  padding: 1rem 1.15rem .1rem;
}
.tbl__ref {
  padding: 0 1.15rem .8rem;
  font-size: .755rem; color: var(--muted-2);
}
.tbl__scroll { overflow-x: auto; }
.tbl table { width: 100%; border-collapse: collapse; min-width: 420px; }
.tbl th, .tbl td {
  padding: .5rem .8rem; font-size: .8rem;
  text-align: right; white-space: nowrap;
  border-bottom: 1px solid #eef2f5;
}
.tbl thead th {
  position: sticky; top: 0;
  background: #f6fafa; color: var(--muted);
  font-weight: 650; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .045em;
  border-bottom: 1.5px solid var(--line);
}
.tbl td:first-child, .tbl th:first-child { text-align: left; }
.tbl tbody tr:last-child td { border-bottom: 0; }
/* Tabla de fuentes de «Quiénes somos»: texto, no cifras */
.tbl--sources { max-width: 820px; margin-inline: auto; }
.tbl--sources table { min-width: 560px; }
.tbl--sources th, .tbl--sources td { text-align: left; white-space: normal; }
.tbl--sources td:first-child { font-weight: 650; color: var(--ink); }
.tbl--sources td:last-child { white-space: nowrap; color: var(--brand-dark); font-weight: 600; }

.tbl tbody tr[data-hit] {
  background: var(--brand-tint);
  color: var(--brand-deep);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--brand);
}

/* FAQ */
.faq { display: grid; gap: .55rem; }
.faq__item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color .25s var(--ease-out);
}
.faq__item[open] { border-color: var(--brand-soft); }
.faq__item summary {
  display: flex; align-items: center; justify-content: space-between;
  gap: .8rem; padding: 1rem 1.15rem;
  font-family: var(--display); font-weight: 650; font-size: .96rem;
  color: var(--ink); cursor: pointer; list-style: none;
}
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary::after {
  content: ""; flex: none;
  width: .62rem; height: .62rem;
  border-right: 2.2px solid var(--muted-2);
  border-bottom: 2.2px solid var(--muted-2);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .3s var(--ease-out), border-color .3s var(--ease-out);
}
.faq__item[open] summary::after {
  transform: rotate(225deg) translate(-2px, -2px);
  border-color: var(--brand);
}
.faq__item summary:hover { color: var(--brand-dark); }
.faq__body { padding: 0 1.15rem 1.1rem; }
.faq__body p { font-size: .9rem; color: var(--muted); margin-bottom: .6rem; }
.faq__body p:last-child { margin-bottom: 0; }
.faq__body strong { color: var(--ink-2); font-weight: 650; }
.faq__body a { color: var(--brand); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* =============================================================
   10. Pie
   ============================================================= */
.site-footer {
  background: var(--brand-deep);
  color: #a7d5cf;
  padding: clamp(2.2rem, 5vw, 3.2rem) 0 1.6rem;
  font-size: .88rem;
}
.site-footer__inner {
  display: grid; gap: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.site-footer .brand__text { color: #fff; font-size: 1.15rem; }
.site-footer .brand__text strong { color: #5eead4; }
.site-footer .brand__tld { color: #6fb3ab; }
.site-footer__brand p { margin-top: .5rem; max-width: 46ch; color: #93c6c0; font-size: .85rem; }
.site-footer__nav { display: flex; flex-wrap: wrap; gap: 1rem 1.6rem; align-content: start; }
.site-footer__nav a {
  color: #c8e9e4; font-weight: 550;
  transition: color .2s var(--ease-out);
}
.site-footer__nav a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.site-footer__legal {
  padding-top: 1.4rem;
  font-size: .77rem; color: #7fb5ae; max-width: 78ch;
}

/* =============================================================
   11. Responsive
   ============================================================= */
/* Móvil: se aprieta la cabecera del hero para que el resultado del cálculo
   quede a la vista sin hacer scroll en una pantalla de 375 × 812. */
@media (max-width: 719px) {
  .hero { padding-top: 1.2rem; }
  .hero__eyebrow { font-size: .715rem; padding: .32rem .8rem .32rem .62rem; }
  .tool__form { gap: 1.05rem; }
  .field__help { font-size: .765rem; margin-top: .4rem; }
  .switch__note { font-size: .74rem; }
  .tool { margin-top: 1.2rem; }

  /* Las tres cifras deben caber en 360 px sin recortarse. */
  .stats { gap: .4rem; }
  .stat { padding: .7rem .35rem; }
  .stat__k { font-size: .63rem; letter-spacing: .02em; }
  .stat__v { font-size: .93rem; letter-spacing: -.035em; overflow-wrap: anywhere; }
}

@media (min-width: 720px) {
  .site-nav { display: flex; }
  .cookie-notice {
    flex-direction: row; align-items: center; justify-content: space-between;
    gap: 1.6rem; padding-block: .95rem;
  }
  .cookie-notice__actions { flex-wrap: nowrap; }
  .tool__form { grid-template-columns: 1fr 1fr; gap: 1.5rem 1.6rem; }
  .field--periods { grid-column: 1 / -1; }
  .field--switch { align-self: end; padding-bottom: .35rem; }
  .steps { grid-template-columns: repeat(3, 1fr); gap: 1.15rem; }
  .ideas { grid-template-columns: repeat(2, 1fr); }
  .trust { grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
  .tool-cards { grid-template-columns: repeat(2, 1fr); }
  .site-footer__inner { grid-template-columns: 1.4fr 1fr; }
  .site-footer__nav { justify-content: flex-end; }
  .ad-slot--incontent { max-width: none; min-height: 110px; }
}

@media (min-width: 960px) {
  .ideas { grid-template-columns: repeat(3, 1fr); }
  .tables { grid-template-columns: repeat(3, 1fr); align-items: start; }
  .tool-cards { grid-template-columns: repeat(4, 1fr); }
  .result__actions .btn--primary { flex: 0 1 auto; }
}

/* =============================================================
   12. Impresión — la página también se imprime decentemente
   ============================================================= */
@media print {
  .site-header, .site-nav, .ad-slot, .ad-corner, .ad-modal,
  .result__actions, .skip-link, .site-footer__nav { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .hero { background: none; padding-top: 0; }
  .tool { box-shadow: none; border: 1px solid #999; }
  .section, .section--alt { break-inside: avoid; background: none; }
  a[href^="#"]::after { content: ""; }
}

/* =============================================================
   13. Reduced motion — solo lo intrusivo
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ad-corner { animation: none; }
  .bar__net, .bar__tax { transition: none; }
}
