/* ¿Cuánto me toca? — sistema visual v2
   Mobile-first · sin dependencias · un color de acento por calculadora (body[data-accent]) */

:root {
  --paper: #ffffff;
  --paper-2: #f4f5f7;
  --surface: #ffffff;
  --ink: #0f1733;
  --ink-2: #39435f;
  --muted: #5d6578;
  --line: #e3e5ea;
  --line-2: #cfd3db;
  --sun: #ffc53d;
  --navy: #0f1733;
  --navy-2: #172152;
  --ok: #15803d;
  --ok-ink: #166534;
  --radius-lg: 12px;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow-sm: none;
  --shadow: none;
  --shadow-lg: none;
  --font-display: 'Bricolage Grotesque', ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}

/* Acento por calculadora. --accent-ink y --accent-soft se derivan en body. */
body { --accent: #c62828; }
body {
  --accent-ink: color-mix(in srgb, var(--accent) 72%, black);
  --accent-soft: color-mix(in srgb, var(--accent) 11%, white);
  --btn-bg: var(--accent-ink);
  --btn-fg: #fff;
}
@supports not (color: color-mix(in srgb, red, blue)) {
  body { --accent-ink: var(--accent); --accent-soft: #f6eee2; }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #0b1122;
    --paper-2: #111a32;
    --surface: #141d38;
    --ink: #f3f0ea;
    --ink-2: #cdd3e0;
    --muted: #99a2b7;
    --line: #232f53;
    --line-2: #2e3b64;
    --navy: #1a2654;
    --navy-2: #213068;
    --ok: #4ade80;
    --ok-ink: #4ade80;
    color-scheme: dark;
  }
  :root:not([data-theme='light']) body {
    --accent-ink: color-mix(in srgb, var(--accent) 62%, white);
    --accent-soft: color-mix(in srgb, var(--accent) 20%, #141d38);
    --btn-bg: color-mix(in srgb, var(--accent) 78%, white);
    --btn-fg: #0b1122;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 16px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--font-body);
  overflow-x: hidden;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--accent-ink); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
a:hover { color: var(--ink); }
h1, h2, h3 { font-family: var(--font-display); color: var(--ink); letter-spacing: -0.025em; line-height: 1.08; margin: 0 0 0.5em; text-wrap: balance; }
h1 { font-size: clamp(1.85rem, 5.6vw, 3.4rem); font-weight: 800; }
h2 { font-size: clamp(1.42rem, 3.3vw, 2rem); font-weight: 800; margin-top: 2.2em; }
h3 { font-size: 1.18rem; font-weight: 700; margin-top: 1.6em; }
p { margin: 0 0 1em; text-wrap: pretty; }
strong, b { font-weight: 750; }
small { font-size: 0.86em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .wrap { padding: 0 24px; } }
.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 { position: absolute; left: -999px; top: 8px; z-index: 99; background: var(--surface); padding: 10px 14px; border-radius: 10px; }
.skip:focus { left: 12px; }
[hidden] { display: none !important; }

/* ---------- Header ---------- */
.site-header { position: relative; z-index: 5; border-bottom: 1px solid var(--line); background: var(--paper); }
.header-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding-top: 12px; padding-bottom: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 38px; height: 38px; flex: none; transition: transform 0.3s var(--ease); }
.brand-name { font: 800 1.28rem/1 var(--font-display); letter-spacing: -0.035em; white-space: nowrap; }
.brand-name em { font-style: normal; color: #e5383b; }
.header-cta { display: none; margin-left: auto; align-items: center; gap: 6px; font-weight: 750; font-size: 0.92rem; text-decoration: none; color: #2b1d00; background: var(--sun); padding: 9px 15px; border-radius: 8px; white-space: nowrap; }
.header-cta:hover { color: #2b1d00; filter: brightness(0.97); }
.header-cta svg { width: 16px; height: 16px; }
@media (min-width: 640px) { .header-cta { display: inline-flex; } }

.nav { order: 3; flex: 1 0 100%; min-width: 0; margin: 0 -16px; }
@media (min-width: 640px) { .nav { margin: 0 -24px; } }
.nav ul { list-style: none; margin: 0; padding: 2px 16px 4px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
@media (min-width: 640px) { .nav ul { padding: 2px 24px 4px; } }
.nav ul::-webkit-scrollbar { display: none; }
.nav a { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; text-decoration: none; color: var(--ink-2); font-weight: 650; font-size: 0.92rem; padding: 8px 13px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); transition: border-color 0.15s, background 0.15s, color 0.15s; }
.nav a:hover { border-color: var(--line-2); color: var(--ink); }
.nav a[aria-current='page'] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
@media (min-width: 1140px) {
  .nav { order: 0; flex: 1 1 auto; margin: 0; }
  .nav ul { justify-content: center; padding: 0; gap: 2px; overflow: visible; }
  .nav a { background: transparent; border-color: transparent; padding: 8px 11px; }
  .nav a:hover { background: var(--surface); border-color: var(--line); }
  .header-cta { margin-left: 0; }
}

/* ---------- Page top (hero + calculadora) ---------- */
.page-top { position: relative; isolation: isolate; overflow: hidden; overflow: clip; padding-bottom: 8px; }
.page-hero { padding-top: 16px; max-width: 880px; }
@media (min-width: 640px) { .page-hero { padding-top: 26px; } }
.crumbs { display: none; font-size: 0.86rem; color: var(--muted); margin-bottom: 12px; }
@media (min-width: 640px) { .crumbs { display: block; } }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs li + li::before { content: '›'; margin-right: 6px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.kicker { display: block; font: 600 0.92rem/1.3 var(--font-body); color: var(--muted); margin-bottom: 8px; }
.lead { font-size: clamp(1.04rem, 2.3vw, 1.22rem); color: var(--ink-2); max-width: 52ch; margin-bottom: 12px; }
.trust { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.86rem; color: var(--muted); }
.trust li { display: inline-flex; align-items: center; gap: 6px; }
.trust svg { width: 16px; height: 16px; color: var(--ok); flex: none; }
.trust .trust-law { display: none; }
@media (min-width: 640px) { .trust .trust-law { display: inline-flex; } }

/* ---------- Calculadora ---------- */
.calc { display: grid; gap: 18px; margin-top: 18px; }
@media (min-width: 920px) { .calc { grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); gap: 26px; align-items: start; margin-top: 26px; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 20px 18px 22px; }
@media (min-width: 640px) { .card { padding: 28px; } }
.form-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.form-title { font-size: 1.32rem; margin: 0; }
.form-meta { font-size: 0.88rem; font-weight: 500; color: var(--muted); white-space: nowrap; }
.form-meta svg { width: 14px; height: 14px; }
.mem-notice { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 12px 0 0; font-size: 0.9rem; color: var(--muted); }
.mem-notice svg { display: none; }
.linklike { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.q { border: 0; margin: 0; padding: 20px 0 0; min-width: 0; }
.q + .q { margin-top: 8px; }
.q-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 0; margin: 0 0 12px; font-weight: 750; font-size: 1.05rem; line-height: 1.3; color: var(--ink); }
/* <legend> fuera del borde del fieldset: así se comporta como un título normal */
legend.q-head { float: left; }
legend.q-head + * { clear: left; }
.q-num { flex: none; font: 700 1rem/1.3 var(--font-body); color: var(--muted); }
.q-num::after { content: '.'; }
.hint { display: block; font-size: 0.88rem; color: var(--muted); margin: 8px 0 0; line-height: 1.45; }
.rule { margin: 8px 0 0; font-size: 0.9rem; font-weight: 500; color: var(--ink-2); line-height: 1.4; }
.rule:empty { display: none; }
.err { color: #b42318; font-weight: 650; font-size: 0.9rem; margin: 8px 0 0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .err { color: #ff8a80; } }

input[type='number'], input[type='date'], input[type='text'], select {
  width: 100%; min-height: 54px; font: 650 1.08rem/1.2 var(--font-body); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 12px 14px;
  appearance: none; -webkit-appearance: none; transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { margin: 0; -webkit-appearance: none; }
input[type='number'] { -moz-appearance: textfield; }
input:hover, select:hover { border-color: var(--muted); }
input:focus, select:focus { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
select { cursor: pointer; padding-right: 42px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23878fa3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 18px; }
input[type='date']::-webkit-date-and-time-value { text-align: left; }
.row-2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 8px; }
.pay { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.money, .suffixed { position: relative; }
.money-sign { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); font-weight: 800; color: var(--muted); pointer-events: none; }
.money input { padding-left: 31px; }
.suffix { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 650; font-size: 0.95rem; pointer-events: none; }
.suffixed input { padding-right: 82px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font: 600 0.9rem/1 var(--font-body); color: var(--ink-2); background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 14px; min-height: 40px; cursor: pointer; transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.12s var(--ease); }
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip:active { transform: scale(0.96); }
.chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 6px; }
.seg label { position: relative; display: block; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg span { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 50px; padding: 8px 6px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); font-weight: 700; font-size: 0.97rem; color: var(--ink-2); line-height: 1.2; transition: background 0.18s var(--ease), color 0.18s, box-shadow 0.18s; }
.seg small { font-weight: 600; font-size: 0.74rem; color: var(--muted); margin-top: 3px; }
.seg label:hover span { color: var(--ink); }
.seg input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.seg input:checked + span small { color: inherit; opacity: 0.8; }
.seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.followup { margin-top: 12px; }
.followup-q { display: block; font-weight: 700; font-size: 0.94rem; margin-bottom: 8px; }

.stepper { display: grid; grid-template-columns: 54px minmax(0, 1fr) 54px; gap: 6px; max-width: 260px; }
.stepper input { text-align: center; }
.step { min-height: 54px; border-radius: var(--radius-sm); border: 2px solid var(--line); background: var(--surface); font: 800 1.4rem/1 var(--font-body); color: var(--ink); cursor: pointer; }
.step:hover { border-color: var(--accent); color: var(--accent-ink); }
.step:active { transform: scale(0.96); }

.days { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 520px) { .days { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.day label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--muted); text-align: center; margin-bottom: 4px; }
.day input { text-align: center; padding: 10px 4px; min-height: 52px; }

.check { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; cursor: pointer; font-weight: 550; line-height: 1.4; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--accent); cursor: pointer; }
.field { margin-top: 14px; }
.field > label { display: block; font-weight: 700; font-size: 0.95rem; margin-bottom: 6px; }

.more { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 14px; }
.more summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink-2); padding: 4px 0; }
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: '+'; flex: none; width: 14px; color: var(--muted); font-weight: 600; }
.more[open] summary::before { content: '–'; }
.more summary small { font-weight: 550; color: var(--muted); }
.more-body { padding-top: 8px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 12px 20px; border-radius: 8px; font: 750 1rem/1.1 var(--font-body); text-decoration: none; cursor: pointer; border: 2px solid transparent; transition: transform 0.12s var(--ease), background 0.15s, box-shadow 0.15s, filter 0.15s; }
.btn:active { transform: scale(0.98); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--btn-bg); color: var(--btn-fg); }
.btn-primary:hover { color: var(--btn-fg); filter: brightness(1.08); }
.btn-block { width: 100%; margin-top: 24px; min-height: 58px; font-size: 1.08rem; }
.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-outline:hover { color: var(--ink); border-color: var(--ink); }
.btn-sun { background: var(--sun); color: #2b1d00; }
.btn-sun:hover { color: #2b1d00; filter: brightness(0.97); }

/* ---------- Resultado (cheque) ---------- */
.result { position: relative; background: var(--navy); color: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; overflow: clip; scroll-margin-top: 12px; }
@media (min-width: 920px) { .result { position: sticky; top: 20px; } }
.cheque { position: relative; padding: 22px 22px 18px; background: var(--navy); }
@media (min-width: 640px) { .cheque { padding: 26px 26px 20px; } }
.cheque-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 10px; min-height: 26px; margin-bottom: 8px; }
.cheque-eyebrow { font: 600 0.95rem/1.3 var(--font-body); color: rgba(255, 255, 255, 0.8); white-space: nowrap; }
.pill-example { display: none; font: 600 0.85rem/1.3 var(--font-body); color: var(--sun); white-space: nowrap; }
.result.is-example .pill-example { display: inline-flex; }
.result-big { font: 800 clamp(2.9rem, 12.5vw, 4.7rem)/0.98 var(--font-display); letter-spacing: -0.045em; color: var(--sun); font-variant-numeric: tabular-nums; margin: 2px 0 10px; overflow-wrap: anywhere; }
.result-big.is-text { font-size: clamp(1.75rem, 7vw, 2.5rem); line-height: 1.08; letter-spacing: -0.03em; color: #ffd9a3; }
.result-sub { margin: -4px 0 10px; font-weight: 650; color: rgba(255, 255, 255, 0.85); }
.result-note { margin: 0; color: rgba(255, 255, 255, 0.9); font-size: 0.98rem; line-height: 1.5; }
.result-note:empty { display: none; }
.stub { position: relative; padding: 20px 22px 22px; background: var(--navy-2); border-top: 1px solid rgba(255, 255, 255, 0.14); }
@media (min-width: 640px) { .stub { padding: 22px 26px 26px; } }
.result .steps { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 9px; }
.result .steps:empty { display: none; }
.result .steps li { position: relative; padding-left: 22px; font-size: 0.95rem; line-height: 1.45; color: rgba(255, 255, 255, 0.93); }
.result .steps li::before { content: '–'; position: absolute; left: 6px; top: 0; color: rgba(255, 255, 255, 0.6); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; margin: 0 0 16px; }
.stat { border-bottom: 1px solid rgba(255, 255, 255, 0.12); padding: 10px 0; min-width: 0; }
.stat small { display: block; font-size: 0.76rem; color: rgba(255, 255, 255, 0.72); line-height: 1.3; }
.stat b { display: block; font: 800 1.22rem/1.2 var(--font-display); color: #fff; margin-top: 4px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.deadline { display: flex; align-items: baseline; gap: 10px; margin: 0 0 16px; font-size: 0.95rem; line-height: 1.35; }
.deadline b { font: 800 1.6rem/1 var(--font-display); color: var(--sun); font-variant-numeric: tabular-nums; }
.flag { display: block; margin: 0 0 16px; padding-left: 12px; border-left: 3px solid var(--sun); font-size: 0.95rem; line-height: 1.45; }
.flag strong { color: var(--sun); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-wa { flex: 1 1 auto; min-width: 0; background: #25d366; color: #04331a; }
.hide-sm { display: none; }
@media (min-width: 400px) { .hide-sm { display: inline; } }
.btn-wa:hover { color: #04331a; filter: brightness(1.05); }
.btn-icon { background: rgba(255, 255, 255, 0.08); color: #fff; border-color: rgba(255, 255, 255, 0.2); padding: 0 16px; }
.btn-icon:hover { color: #fff; border-color: #fff; }
.next { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.14); color: #fff; text-decoration: none; }
.next:hover { color: #fff; text-decoration: underline; }
.next-icon { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 14%, white); color: color-mix(in srgb, var(--c) 75%, black); }
.next-icon svg { width: 22px; height: 22px; }
.next-text { flex: 1; min-width: 0; line-height: 1.25; }
.next-k { display: block; font: 500 0.85rem/1.2 var(--font-body); color: rgba(255, 255, 255, 0.7); margin-bottom: 3px; }
.next-q { font: 800 1.02rem/1.25 var(--font-display); letter-spacing: -0.01em; }
.next-arrow { flex: none; display: grid; place-items: center; color: #fff; }
.next-arrow svg { width: 16px; height: 16px; }
.help-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; color: rgba(255, 255, 255, 0.85); font-size: 0.9rem; font-weight: 650; }
.help-link:hover { color: #fff; }
.help-link svg { width: 18px; height: 18px; flex: none; }
.result-big.bump { animation: bump 0.35s var(--ease); }
@keyframes bump { 40% { transform: scale(1.035); } }
.result.pulse { animation: pulse 0.7s var(--ease); }
@keyframes pulse { 30% { outline: 3px solid var(--accent); outline-offset: 2px; } }

/* Barra fija de resultado (móvil) */
.dock { position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40; transform: translateY(150%); transition: transform 0.32s var(--ease); pointer-events: none; }
.dock.show { transform: none; pointer-events: auto; }
.dock-inner { display: flex; align-items: center; gap: 12px; max-width: 560px; margin: 0 auto; background: var(--navy); color: #fff; border-radius: 20px; padding: 9px 9px 9px 16px; box-shadow: 0 20px 44px -14px rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 255, 255, 0.08); }
.dock-text { flex: 1; min-width: 0; }
.dock-label { display: block; font-size: 0.8rem; font-weight: 500; color: rgba(255, 255, 255, 0.75); line-height: 1.2; }
.dock-value { display: block; font: 800 1.5rem/1.1 var(--font-display); color: var(--sun); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-btn { flex: none; display: inline-flex; align-items: center; gap: 6px; background: var(--sun); color: #2b1d00; border: 0; border-radius: 14px; font: 800 0.95rem/1 var(--font-body); padding: 0 14px; min-height: 46px; cursor: pointer; }
.dock-btn svg { width: 16px; height: 16px; transform: rotate(90deg); }
@media (min-width: 920px) { .dock { display: none; } }

/* ---------- Anuncios ---------- */
.ad { display: flex; flex-direction: column; align-items: center; width: 100%; margin: 44px auto; }
.ad-label { font: 500 0.75rem/1 var(--font-body); color: var(--muted); margin-bottom: 6px; }
.ad-slot { width: 100%; min-height: 250px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); background: var(--paper-2); overflow: hidden; }
.ad-slot ins { display: block; width: 100%; min-height: 250px; }
.ad--wide { max-width: 970px; }
.ad--sidebar { margin: 0; }
.ad--sidebar .ad-slot, .ad--sidebar .ad-slot ins { min-height: 600px; }
.ad-placeholder { width: 100%; align-self: stretch; display: grid; place-items: center; color: var(--muted); font-size: 0.82rem; border: 2px dashed var(--line-2); border-radius: var(--radius-sm); background: repeating-linear-gradient(45deg, transparent 0 10px, color-mix(in srgb, var(--line) 45%, transparent) 10px 20px); }

/* ---------- Artículo + barra lateral ---------- */
.page-grid { display: grid; gap: 40px; padding-top: 4px; padding-bottom: 56px; }
@media (min-width: 1140px) { .page-grid.has-aside { grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; } }
.article { min-width: 0; }
.has-aside .article { max-width: 780px; }
.aside { display: none; }
@media (min-width: 1140px) { .aside { display: block; } }
.aside-inner { position: sticky; top: 20px; display: grid; gap: 18px; }
.aside-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.aside-card p { font: 800 1.02rem/1.2 var(--font-display); margin: 0 0 10px; }
.aside-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.aside-card a { display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 0.95rem; }
.aside-card a:hover { background: var(--paper); color: var(--ink); }

.toc { display: flex; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 18px; padding: 4px 16px 8px; }
.toc::-webkit-scrollbar { display: none; }
@media (min-width: 640px) { .toc { flex-wrap: wrap; overflow: visible; margin: 0 0 18px; padding: 0; } }
.toc-label { font: 600 0.9rem/1 var(--font-body); color: var(--muted); white-space: nowrap; margin-right: 4px; }
.toc a { white-space: nowrap; text-decoration: none; font-weight: 650; font-size: 0.9rem; color: var(--ink-2); padding: 8px 13px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.toc a:hover { border-color: var(--accent); color: var(--accent-ink); }

.quick { background: var(--paper-2); border: 0; border-radius: var(--radius); padding: 20px 22px; margin: 0 0 8px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; overflow: clip; }
.quick h2 { font-size: 1.25rem; margin: 0 0 10px; }
.quick ul { margin: 0; padding-left: 1.15em; }
.quick li { margin: 7px 0; }
.quick li::marker { color: var(--accent); }

.prose { font-size: 1.06rem; }
.prose h2, .section-title { position: relative; padding-top: 16px; scroll-margin-top: 16px; }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li { margin: 0.45em 0; }
.prose li::marker { color: var(--accent); font-weight: 700; }

.callout { border-radius: var(--radius-sm); padding: 16px 18px; margin: 20px 0; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.callout.warn { background: color-mix(in srgb, #ea7a0c 12%, var(--surface)); border-color: color-mix(in srgb, #ea7a0c 30%, transparent); }
.callout p:last-child { margin-bottom: 0; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 16px 0 26px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.96rem; font-variant-numeric: tabular-nums; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
thead th { background: var(--paper-2); font-weight: 800; font-size: 0.86rem; color: var(--ink-2); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
td.num, th.num { text-align: right; }
caption { caption-side: bottom; text-align: left; padding: 10px 14px; font-size: 0.85rem; color: var(--muted); border-top: 1px solid var(--line); white-space: normal; }

.steps-num { counter-reset: s; list-style: none; padding: 0 !important; display: grid; gap: 10px; }
.steps-num li { counter-increment: s; position: relative; margin: 0 !important; padding: 2px 0 2px 36px; }
.steps-num li::before { content: counter(s) '.'; position: absolute; left: 0; top: 2px; font-weight: 700; color: var(--ink); }

.examples { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); margin: 16px 0; }
.example { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.example h3 { margin: 0 0 6px; font-size: 1.05rem; }
.example p { margin: 0 0 8px; font-size: 0.94rem; color: var(--ink-2); }
.example .amt { font: 800 1.8rem/1.1 var(--font-display); color: var(--accent-ink); letter-spacing: -0.03em; }

.letter { width: 100%; min-height: 280px; font: 0.93rem/1.6 var(--font-mono); background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 16px; resize: vertical; }

.faq { margin-top: 8px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 10px 0; transition: border-color 0.15s; }
.faq details[open] { border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.faq summary { cursor: pointer; list-style: none; position: relative; padding: 17px 54px 17px 18px; font-weight: 700; line-height: 1.4; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; font-size: 1.2rem; }
.faq details[open] summary::after { content: '–'; }
.faq details > div { padding: 0 18px 18px; color: var(--ink-2); }

.sources { list-style: none; padding: 0; display: grid; gap: 8px; }
.sources li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.tag { display: inline-block; font: 600 0.78rem/1.3 var(--font-body); background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok-ink); padding: 1px 6px; border-radius: 4px; margin-right: 8px; vertical-align: 1px; }
.disclaimer { font-size: 0.88rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 16px; margin-top: 36px; }

/* ---------- Tarjetas de calculadoras ---------- */
.tool-list { list-style: none; margin: 8px 0 0; padding: 0; border-top: 1px solid var(--line); }
.tool-list li { border-bottom: 1px solid var(--line); }
.tool-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; align-items: center; padding: 16px 0; color: var(--ink); text-decoration: none; }
.tool-row:hover { color: var(--ink); }
.tool-row:hover .tool-row-title { text-decoration: underline; text-underline-offset: 3px; }
.tool-row-title { font: 700 1.1rem/1.3 var(--font-display); grid-column: 1; }
.tool-row-desc { grid-column: 1; color: var(--muted); font-size: 0.95rem; line-height: 1.45; }
.tool-row svg { grid-column: 2; grid-row: 1 / span 2; width: 20px; height: 20px; color: var(--muted); }
.tile-go svg { width: 16px; height: 16px; transition: transform 0.2s var(--ease); }
.tile:hover .tile-go svg { transform: translateX(4px); }

/* ---------- Inicio ---------- */
.home-hero { padding: 30px 0 6px; max-width: 900px; }
@media (min-width: 640px) { .home-hero { padding-top: 54px; } }
.home-hero h1 { font-size: clamp(2.9rem, 11vw, 6rem); letter-spacing: -0.05em; line-height: 0.92; margin-bottom: 0.32em; }
.home-hero h1 em { font-style: normal; color: #e5383b; }
.home-sub { font-size: clamp(1.1rem, 2.7vw, 1.38rem); color: var(--ink-2); max-width: 42ch; margin-bottom: 18px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }

/* ---------- Feriados ---------- */
.big-count { display: flex; align-items: baseline; gap: 10px; }
.big-count b { font: 800 clamp(4rem, 17vw, 6.6rem)/0.9 var(--font-display); letter-spacing: -0.05em; color: var(--sun); font-variant-numeric: tabular-nums; }
.big-count span { font: 800 1.3rem/1 var(--font-display); color: rgba(255, 255, 255, 0.85); }
.hol-group { margin: 24px 0 8px; font: 700 1rem/1.2 var(--font-body); color: var(--ink); }
.hol-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hol { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 14px; align-items: center; padding: 11px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); transition: opacity 0.2s; }
.hol.past { opacity: 0.5; }
.hol.next { border: 2px solid var(--accent); }
.hol-date { text-align: center; border-radius: 12px; padding: 7px 0 6px; background: var(--accent-soft); color: var(--accent-ink); line-height: 1; }
.hol-date small { display: block; font: 600 0.78rem/1 var(--font-body); }
.hol-date b { display: block; font: 800 1.55rem/1.05 var(--font-display); margin-top: 3px; }
.hol-name { font-weight: 750; line-height: 1.3; }
.hol-sub { font-size: 0.86rem; color: var(--muted); margin-top: 2px; }
.hol-sub::first-letter { text-transform: uppercase; }
.pill { display: inline-block; font: 600 0.78rem/1.3 var(--font-body); padding: 2px 7px; border-radius: 4px; margin-left: 6px; vertical-align: 1px; white-space: nowrap; }
.pill-long { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok-ink); }
.pill-weekend { background: var(--paper-2); color: var(--muted); }
.pill-next { background: var(--accent); color: #fff; }

/* ---------- Footer ---------- */
.site-footer { background: #0f1733; color: #f3f0ea; padding: 48px 0 30px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .site-footer { background: #070b17; } }
.site-footer a { color: inherit; opacity: 0.82; text-decoration: none; }
.site-footer a:hover { opacity: 1; text-decoration: underline; color: inherit; }
.foot-grid { display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.foot-grid h2 { font: 700 0.95rem/1.2 var(--font-body); opacity: 0.7; margin: 0 0 12px; color: inherit; }
.foot-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.foot-brand { font: 800 1.5rem/1 var(--font-display); letter-spacing: -0.035em; margin: 0 0 10px; }
.foot-brand em { font-style: normal; color: var(--sun); }
.foot-note { margin-top: 32px; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, 0.14); font-size: 0.85rem; opacity: 0.72; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 60; transform: translateX(-50%) translateY(calc(100% + 40px)); opacity: 0; visibility: hidden; pointer-events: none; background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 8px; font-weight: 750; transition: transform 0.25s var(--ease), opacity 0.25s; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; }

@media print {
  .site-header, .ad, .aside, .site-footer, .actions, .next, .help-link, .tiles, .faq, .toc, .dock, .calc-form, .pill-example { display: none !important; }
  body { background: #fff; color: #000; }
  .calc { display: block; }
  .result, .cheque, .stub { background: #fff !important; color: #000 !important; box-shadow: none; border: 2px solid #000; }
  .result-big, .result .steps li, .stat b, .stat small, .result-note, .result-sub, .cheque-eyebrow, .stub-title, .line span, .line b, .gross-main b, .gross-main span { color: #000 !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
.stub-title { margin: 0 0 4px; font-weight: 600; font-size: 0.95rem; color: rgba(255, 255, 255, 0.8); }
.seg:has(> label:nth-child(4):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 560px) { .seg:has(> label:nth-child(4):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.gross-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 2px 0 12px; }
.gross-main b { font: 800 clamp(2rem, 8vw, 2.6rem)/1 var(--font-display); letter-spacing: -0.03em; color: #fff; font-variant-numeric: tabular-nums; }
.gross-main span { color: rgba(255, 255, 255, 0.75); font-size: 0.95rem; }
.lines { margin: 0 0 18px; }
.line { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.12); font-size: 0.97rem; }
.line span { color: rgba(255, 255, 255, 0.85); }
.line b { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.net { margin: 0 0 16px; }
.net .result-big { margin-top: 4px; }

/* Cuentas regresivas del inicio: filas en móvil, 3 columnas iguales en pantallas anchas */
.countstrip { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 4px 0 8px; max-width: 760px; }
@media (min-width: 640px) { .countstrip { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; } }
.count { display: grid; grid-template-columns: 3.2ch minmax(0, 1fr); align-items: center; column-gap: 14px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.count:hover { color: var(--ink); border-color: var(--line-2); }
.count b { font: 800 2rem/1 var(--font-display); letter-spacing: -0.03em; text-align: right; font-variant-numeric: tabular-nums; }
.count span { display: block; font-size: 0.85rem; line-height: 1.35; color: var(--muted); }
.count strong { display: block; font-size: 0.95rem; color: var(--ink); }
@media (min-width: 640px) {
  .count { grid-template-columns: 1fr; row-gap: 6px; padding: 16px 18px; align-items: start; }
  .count b { font-size: 2.4rem; text-align: left; }
}
.noscript { margin: 12px auto 0; padding: 12px 16px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--paper-2); font-size: 0.95rem; }
