/* RetencionesEC · «la cinta de la sumadora»
   Tipografías alojadas en el sitio (licencia OFL, ver fonts/). */
@font-face { font-family: "Atkinson Hyperlegible"; src: url("fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  --office: #eef1f4;   /* fondo gris oficina */
  --paper: #ffffff;    /* papel */
  --ink: #1f2328;      /* tinta */
  --red: #c0262d;      /* tinta roja de la cinta: retenciones */
  --brand: #3730a3;    /* índigo de marca: botones y navegación */
  --muted: #59606b;
  --rule: #d5dae1;
  --brand-ink: #ffffff;
  --sans: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root { --office: #15181d; --paper: #1e2228; --ink: #e8eaed; --red: #ff8a8f; --brand: #a9a5ff; --brand-ink: #15142a; --muted: #a2a9b4; --rule: #333a44; }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { font-family: var(--sans); font-size: 17px; line-height: 1.55; color: var(--ink); background: var(--office); -webkit-font-smoothing: antialiased; overflow-x: clip; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; line-height: 1.15; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: fixed; top: -100px; left: 1rem; padding: .6rem 1rem; background: var(--paper); z-index: 99; border-radius: 6px; font-weight: 700; }
.skip-link:focus { top: 1rem; }
.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }

/* ---------- Cabecera ---------- */
.top { background: var(--paper); border-bottom: 1px solid var(--rule); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 10px 20px; padding: 12px 0; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; text-decoration: none; }
.top nav { display: flex; gap: 2px; flex-wrap: wrap; }
.top nav a { padding: 6px 12px; font-size: .95rem; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; }
.top nav a:hover { color: var(--ink); }
.top nav a[aria-current="page"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--brand); }
@media (max-width: 640px) { .top nav { width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; margin: 0 -6px; } .top nav a { white-space: nowrap; } }

/* ---------- Encabezado de la página ---------- */
.hero { padding: 26px 0 18px; }
.hero h1 { font-size: clamp(1.6rem, 3vw + .7rem, 2.45rem); font-weight: 700; letter-spacing: -.01em; max-width: 24ch; }
.sub { color: var(--muted); margin-top: 8px; max-width: 62ch; }

/* ---------- Herramienta: hoja de pasos + cinta ---------- */
.tool { display: grid; grid-template-columns: 1fr; gap: 0; align-items: start; }
.step { background: var(--paper); border: 1px solid var(--rule); border-top: 0; padding: 20px 20px 22px; min-width: 0; }
.step.s1 { border-top: 1px solid var(--rule); border-radius: 10px 10px 0 0; }
.step.last { border-radius: 0 0 10px 10px; }
.step.solo { border-radius: 10px; }
.step-h { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; font-weight: 700; margin-bottom: 14px; }
.step-n { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--ink); display: grid; place-items: center; font-size: .85rem; font-weight: 700; line-height: 1; }
.step-note { font-size: .88rem; color: var(--muted); font-weight: 400; margin: -8px 0 14px 36px; }
.out { min-width: 0; }

@media (max-width: 959px) {
  /* En celular: valor → cinta → ajustes */
  .step.s1 { border-radius: 10px; border-bottom: 1px solid var(--rule); }
  .out { margin: 18px 0; }
  .step.s2 { border-top: 1px solid var(--rule); border-radius: 10px 10px 0 0; }
  .step.s2.last { border-radius: 10px; }
}
@media (min-width: 960px) {
  .tool { grid-template-columns: minmax(0, 1.15fr) minmax(380px, .85fr); column-gap: 40px; }
  .tool > .step { grid-column: 1; }
  .tool > .out { grid-column: 2; grid-row: 1 / span 4; position: sticky; top: 16px; }
}

.grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.fld { display: grid; gap: 5px; align-content: start; min-width: 0; }
.fld > span { font-weight: 700; font-size: .95rem; }
.fld small { color: var(--muted); font-size: .84rem; line-height: 1.4; }
input[type="text"], select { width: 100%; min-height: 46px; padding: 9px 11px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--ink); font: inherit; font-size: 1rem; }
select { text-overflow: ellipsis; }
input:focus, select:focus { border-color: var(--brand); outline: 2px solid color-mix(in srgb, var(--brand) 22%, transparent); }
.fld.big input { font-family: var(--mono); font-size: 1.5rem; font-weight: 600; min-height: 56px; letter-spacing: -.01em; }
.fld.edited input, .fld.edited select { border-color: var(--red); }
.chk { display: flex; align-items: flex-start; gap: 10px; font-size: .95rem; cursor: pointer; margin-top: 14px; }
.chk input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; margin-top: 2px; }

/* Opciones excluyentes como interruptor de dos posiciones */
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; flex-wrap: wrap; }
.seg label { cursor: pointer; flex: 1 1 auto; }
.seg label + label { border-left: 1px solid var(--rule); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 9px 14px; font-size: .95rem; color: var(--muted); text-align: center; }
.seg input:checked + span { background: var(--ink); color: var(--paper); font-weight: 700; }
.seg input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: -3px; }
.row { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-bottom: 14px; }

.why { margin-top: 14px; display: grid; gap: 6px; font-size: .9rem; color: var(--muted); }
.why p { padding-left: 12px; border-left: 3px solid var(--rule); }
.why p.r, .why p.i { border-left-color: var(--red); }
.reset-link { display: inline-block; margin-top: 10px; font-size: .9rem; color: var(--brand); }
details.more-in { margin-top: 14px; }
details.more-in summary { cursor: pointer; font-size: .95rem; color: var(--brand); }
details.more-in .grid { margin-top: 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; min-height: 44px; border-radius: 6px; font-weight: 700; font-size: .95rem; border: 1px solid var(--rule); background: var(--paper); text-decoration: none; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .88rem; }

/* ---------- La cinta ---------- */
.slot { position: relative; overflow: hidden; padding: 0 10px 14px; }
.slot::before { content: ""; display: block; height: 10px; margin: 0 -10px; border-radius: 5px; background: var(--ink); opacity: .9; position: relative; z-index: 2; }
.tape { position: relative; background: var(--paper); margin-top: -5px; padding: 22px 20px 26px; font-family: var(--mono); box-shadow: 0 1px 0 var(--rule), 0 10px 24px rgba(31, 35, 40, .08);
  --tooth: 9px;
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--tooth) * 2) var(--tooth) repeat-x, linear-gradient(#000 0 0) top / 100% calc(100% - var(--tooth)) no-repeat;
          mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--tooth) * 2) var(--tooth) repeat-x, linear-gradient(#000 0 0) top / 100% calc(100% - var(--tooth)) no-repeat; }
.tape.feed { animation: feed .5s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes feed { from { transform: translateY(-100%); } to { transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .tape.feed { animation: none; } }
.t-label { font-family: var(--sans); font-size: .95rem; color: var(--muted); }
.t-big { font-size: clamp(2.1rem, 5vw, 2.7rem); font-weight: 600; letter-spacing: -.03em; line-height: 1.1; margin: 4px 0 6px; font-variant-numeric: tabular-nums; }
.t-cap { font-family: var(--sans); font-size: .92rem; color: var(--muted); }
.t-lines { margin-top: 18px; border-top: 1px dashed var(--rule); padding-top: 10px; }
.t-row { display: grid; grid-template-columns: 1fr auto 1.4em; gap: 4px 10px; align-items: baseline; padding: 5px 0; font-size: .98rem; font-variant-numeric: tabular-nums; }
.t-row .lab { font-family: var(--sans); font-size: .95rem; }
.t-row .lab small { display: block; color: var(--muted); font-size: .8rem; line-height: 1.35; }
.t-row .num { text-align: right; white-space: nowrap; }
.t-row .op { text-align: center; color: var(--muted); }
.t-row.neg, .t-row.neg .op { color: var(--red); }
.t-row.sum { border-top: 1px solid var(--ink); margin-top: 4px; padding-top: 8px; font-weight: 600; }
.t-row.sum .lab { font-weight: 700; }
.t-row.net { border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 10px; font-weight: 600; font-size: 1.1rem; }
.t-row.net .lab { font-weight: 700; font-size: 1rem; }
.t-foot { margin-top: 16px; font-size: .78rem; color: var(--muted); line-height: 1.5; }
.t-empty { font-family: var(--sans); color: var(--muted); padding: 6px 0 4px; }
.t-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding: 0 10px; }
.t-note { margin-top: 10px; padding: 0 10px; font-size: .84rem; color: var(--muted); }

.badge { display: flex; gap: 8px; align-items: flex-start; margin-top: 20px; font-size: .92rem; }
.badge svg { flex: none; margin-top: 4px; color: var(--brand); }
.limits { margin-top: 6px; font-size: .88rem; color: var(--muted); max-width: 80ch; }

/* Barra en celular con el valor principal */
.mini { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 30; display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--ink); color: var(--paper); padding: 11px 16px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); font-size: .92rem; transition: transform .2s, opacity .2s; }
.mini strong { font-family: var(--mono); font-size: 1.15rem; font-weight: 600; }
.mini.off { transform: translateY(140%); opacity: 0; pointer-events: none; }
@media (min-width: 960px) { .mini { display: none; } }

/* Publicidad */
.ad-slot { min-height: 90px; margin: 30px 0; border: 1px dashed var(--rule); border-radius: 6px; display: grid; place-items: center; color: var(--muted); font-size: .8rem; }
.ad-top .ad-slot { margin: 14px 0 0; }
@media (max-width: 640px) {
  .ad-top { display: none; } .hero { padding-top: 18px; }
  .row { display: grid; gap: 10px; }
  .seg { display: grid; grid-template-columns: 1fr 1fr; }
  .seg span { padding: 9px 8px; height: 100%; display: grid; place-items: center; }
}

/* ---------- Contenido ---------- */
.prose { padding: 8px 0; width: min(70ch, 100% - 32px); margin-inline: auto; }
.prose h2 { font-size: 1.45rem; margin: 30px 0 10px; }
.prose h3 { font-size: 1.1rem; margin: 20px 0 6px; }
.prose p, .prose li { margin-bottom: 10px; }
.prose ol, .prose ul { padding-left: 22px; margin-bottom: 12px; }
.prose a { color: var(--brand); text-underline-offset: 3px; }
.prose code { font-family: var(--mono); font-size: .92em; }
.tbl { overflow-x: auto; margin: 12px 0 18px; background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; }
.tbl table { border-collapse: collapse; width: 100%; font-size: .93rem; min-width: 480px; }
.tbl th, .tbl td { padding: 9px 12px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl th { background: #1f2328; color: #fff; font-weight: 700; text-align: center; }
.tbl td.n { text-align: right; white-space: nowrap; font-family: var(--mono); font-weight: 600; }
.faq details { border-bottom: 1px solid var(--rule); padding: 13px 0; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq details p { margin-top: 8px; color: var(--muted); }
.legal { padding: 32px 0; }
.legal h1 { font-size: 2rem; margin-bottom: 16px; }

.more-sec { width: min(70ch, 100% - 32px); margin: 10px auto 40px; }
.more-h { font-size: 1.3rem; margin: 26px 0 8px; }
.more { list-style: none; padding: 0; border-top: 1px solid var(--rule); }
.more li { border-bottom: 1px solid var(--rule); }
.more a { display: grid; gap: 2px; padding: 12px 0; text-decoration: none; }
.more a strong { color: var(--brand); }
.more a:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.more a span { color: var(--muted); font-size: .92rem; }

.foot { border-top: 1px solid var(--rule); background: var(--paper); padding: 26px 0 96px; color: var(--muted); font-size: .92rem; }
.foot .wrap { display: grid; gap: 10px; }
.foot-contact { color: var(--ink); font-weight: 700; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 20px; list-style: none; padding: 0; }
.foot a { text-underline-offset: 3px; }

.toast { position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 20px); background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 6px; font-size: .92rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 90; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* Cookies */
.cookie-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; background: var(--paper); border-top: 1px solid var(--rule); box-shadow: 0 -4px 24px rgba(31, 35, 40, .14); }
.cookie-bar-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 14px 0; }
.cookie-bar p { flex: 1 1 320px; font-size: .9rem; color: var(--muted); }
.cookie-bar a { color: var(--ink); }
.cookie-actions { display: flex; gap: 8px; flex: none; }
@media (max-width: 560px) { .cookie-bar-inner { flex-direction: column; align-items: stretch; } .cookie-bar p { flex: 0 1 auto; } .cookie-actions { justify-content: flex-end; } }

@media print {
  .top, .hero, .step, .t-actions, .badge, .limits, .ad-slot, .ad-top, .prose, .more-sec, .foot, .toast, .skip-link, .mini, .cookie-bar { display: none !important; }
  body { background: #fff; color: #000; }
  .tool { display: block; }
  .tape { box-shadow: none; border: 1px solid #999; -webkit-mask: none; mask: none; }
  .slot::before { display: none; }
}
