/* CifraLaboral. Concepto: el impreso oficial bien hecho. Campos con el azul de los formularios de Hacienda,
   titulares en serifa de prensa económica y el total con doble subrayado contable.
   Un solo color (azul tinta). Radio único de 6px; nada de píldoras. */
:root {
  --paper: #f5f7fa; --white: #ffffff; --ink: #14213a; --muted: #56627a; --line: #d6dce6;
  --blue: #1d3f7a; --blue-ink: #ffffff; --field: #e9eff8; --field-line: #9fb1cc; --wash: #edf2f9;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 6px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #10151e; --white: #171e2a; --ink: #e5eaf2; --muted: #a2adbf; --line: #2a3446;
    --blue: #8fb2ee; --blue-ink: #0d1626; --field: #1c2638; --field-line: #4a5d80; --wash: #172133;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 17px/1.65 var(--sans); }
a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; letter-spacing: -.01em; }
h1 { font-size: clamp(2.1rem, 1.4rem + 2.6vw, 3.2rem); margin: 44px 0 14px; max-width: 20ch; }
h2 { font-size: clamp(1.45rem, 1.2rem + .9vw, 1.85rem); margin: 52px 0 12px; }
h3 { font-size: 1.2rem; margin: 0 0 6px; }
p, li { max-width: 66ch; }
.lead { font-size: 1.15rem; line-height: 1.55; color: var(--muted); margin: 0 0 8px; max-width: 54ch; }
.updated { font-size: .88rem; color: var(--muted); margin: 6px 0 0; }
.note { font-size: .92rem; color: var(--muted); }

/* Cabecera con barra de progreso de lectura en el borde inferior */
header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 90%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
header .wrap { display: flex; align-items: center; gap: 26px; height: 66px; }
.logo { font: 600 1.35rem/1 var(--serif); letter-spacing: -.01em; color: var(--ink); text-decoration: none; margin-right: auto; }
.logo span { color: inherit; }
header nav { display: flex; align-items: center; gap: 24px; }
header nav a { color: var(--ink); text-decoration: none; font-size: .95rem; padding: 6px 0; border-bottom: 2px solid transparent; }
header nav a:hover { border-bottom-color: var(--blue); }
header nav .pill { border-bottom: 0; padding: 9px 14px; }
@supports (animation-timeline: scroll()) {
  header::after { content: ""; position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%; background: var(--blue); transform-origin: 0 50%; transform: scaleX(0); animation: progreso linear both; animation-timeline: scroll(root); }
  @keyframes progreso { to { transform: scaleX(1); } }
}
.nav-mob { display: none; }
@media (max-width: 767px) {
  .nav-desk { display: none; }
  .nav-mob { display: inline; }
  header nav { gap: 16px; }
}

/* Botones: rectangulares, sin píldoras */
.pill, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; font: 500 .95rem/1 var(--sans); padding: 13px 20px; border-radius: var(--r); border: 1px solid var(--blue); background: var(--blue); color: var(--blue-ink); text-decoration: none; cursor: pointer; transition: background-color .15s, transform .15s; }
header nav .pill, header nav .pill:hover { color: var(--blue-ink); }
.pill:hover, .btn:hover { background: color-mix(in srgb, var(--blue) 85%, var(--ink)); }
.pill:active, .btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-ghost { background: transparent; color: var(--blue); }
.btn-ghost:hover { background: var(--wash); }
.calc .btn { margin-top: 18px; }

/* Página de calculadora */
.col > :first-child { margin-top: 44px; }
.rail:empty { display: none; }
@media (min-width: 1024px) {
  .page { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 60px; align-items: start; }
  .rail { position: sticky; top: 100px; margin-top: 44px; }
}

/* Formulario con aspecto de impreso */
.calc { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; margin: 30px 0; }
.calc label { display: block; font-size: .9rem; font-weight: 500; color: var(--muted); margin: 16px 0 6px; }
.calc > label:first-child, .calc > .grid:first-child label { margin-top: 0; }
.calc input, .calc select { width: 100%; min-height: 50px; padding: 12px 14px; font: 500 1.05rem var(--sans); font-variant-numeric: tabular-nums; color: var(--ink); background: var(--field); border: 0; border-bottom: 2px solid var(--field-line); border-radius: var(--r) var(--r) 0 0; transition: border-color .15s, background-color .15s; }
.calc input:hover, .calc select:hover { border-bottom-color: var(--muted); }
.calc input:focus, .calc select:focus { outline: none; border-bottom-color: var(--blue); background: color-mix(in srgb, var(--field) 70%, var(--white)); }
.calc input::placeholder { color: var(--muted); }
.calc .check { display: flex; gap: 10px; align-items: center; font-size: .95rem; color: var(--ink); margin-top: 18px; }
.calc .check input { width: 20px; min-height: 20px; height: 20px; flex: none; accent-color: var(--blue); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px 20px; }
.grid label { margin-top: 0; }

/* Resultado: el total con doble subrayado contable */
.result { margin-top: 24px; padding: 22px 24px 18px; background: var(--white); color: var(--muted); border: 1px solid var(--line); border-top: 3px solid var(--blue); border-radius: var(--r); font-size: .95rem; }
.calc .result { background: var(--wash); border-color: transparent; border-top-color: var(--blue); }
.rail .result { margin-top: 0; }
.result .big { display: inline-block; font: 600 clamp(2.2rem, 1.7rem + 2vw, 2.9rem)/1.1 var(--serif); font-variant-numeric: lining-nums tabular-nums; color: var(--ink); margin: 6px 0 16px; padding-bottom: 4px; border-bottom: 4px double var(--ink); }
.result p { color: var(--ink); line-height: 1.55; }
.result table { width: 100%; border-collapse: collapse; }
.result td { padding: 9px 0; border-top: 1px solid var(--line); vertical-align: top; }
.result td:first-child { padding-right: 12px; }
.result td:last-child { text-align: right; color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: no-preference) {
  .result.tick .big { animation: tick .35s ease-out; }
  @keyframes tick { from { opacity: .4; } }
}
.acciones { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 14px 2px 0; font-size: .92rem; }
.acciones button { background: none; border: 0; padding: 4px 0; font: inherit; color: var(--blue); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.acciones button:hover { text-decoration-thickness: 2px; }

/* Barra con la cifra en móvil (la crea site.js) */
.peek { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); border: 0; border-top: 3px solid var(--blue); background: var(--white); color: var(--muted); font: 400 .9rem var(--sans); text-align: left; box-shadow: 0 -8px 24px -12px rgb(20 33 58 / .25); transform: translateY(110%); transition: transform .3s ease-out; cursor: pointer; }
.peek strong { font: 600 1.35rem/1 var(--serif); color: var(--ink); white-space: nowrap; }
.peek.show { transform: none; }
@media (min-width: 1024px) { .peek { display: none; } }

/* Contenido */
details { border-top: 1px solid var(--line); padding: 14px 0; }
details:last-of-type { border-bottom: 1px solid var(--line); }
summary { font-weight: 500; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font: 400 1.4rem/1 var(--sans); color: var(--blue); transition: transform .2s; }
details[open] summary::after { transform: rotate(45deg); }
details p { margin: 10px 0 0; color: var(--muted); }
.col table { width: 100%; border-collapse: collapse; font-size: .95rem; font-variant-numeric: tabular-nums; }
.col table th { font-weight: 500; color: var(--muted); padding: 0 0 8px; }
.col table td { padding: 8px 0; border-top: 1px solid var(--line); }
.promo { display: block; margin: 30px 0; padding: 18px 20px; border-left: 4px solid var(--blue); border-radius: 0 var(--r) var(--r) 0; background: var(--wash); color: var(--ink); text-decoration: none; }
.promo strong { color: var(--blue); }
.promo:hover { background: color-mix(in srgb, var(--wash) 70%, var(--field)); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 0 32px; margin: 20px 0; }
.feature { padding: 18px 0; border-top: 2px solid var(--ink); }
.feature strong { display: block; font: 600 1.15rem var(--serif); margin-bottom: 4px; }
.prose { max-width: 760px; padding-bottom: 24px; }
.prose > :first-child { margin-top: 44px; }

/* Portada */
.hero { padding: 56px 0 24px; max-width: 760px; }
.hero h1 { font-size: clamp(2.6rem, 1.5rem + 4.4vw, 4.6rem); line-height: 1.04; margin: 0 0 18px; max-width: 13ch; }
.hero .lead { font-size: 1.2rem; margin-bottom: 30px; }
.buscar label { display: block; font-weight: 500; margin-bottom: 8px; }
.buscar input { width: 100%; min-height: 60px; padding: 14px 18px; font: 400 1.2rem var(--sans); color: var(--ink); background: var(--field); border: 0; border-bottom: 2px solid var(--field-line); border-radius: var(--r) var(--r) 0 0; }
.buscar input:focus { outline: none; border-bottom-color: var(--blue); }
.buscar p { margin: 8px 0 0; font-size: .9rem; color: var(--muted); }
.indice { display: grid; gap: 8px 48px; margin: 36px 0 0; }
@media (min-width: 900px) { .indice { grid-template-columns: 1fr 1fr; } }
.grupo h2 { font-size: 1.35rem; margin: 26px 0 4px; }
.grupo ul { list-style: none; margin: 0; padding: 0; }
.grupo li a { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.grupo li a span { color: var(--muted); font-size: .92rem; text-align: right; }
.grupo li a:hover b { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.grupo li a b { font-weight: 500; }
@media (max-width: 599px) { .grupo li a { display: block; } .grupo li a span { display: block; text-align: left; } }
.vacio { margin: 24px 0; padding: 18px 20px; background: var(--wash); border-radius: var(--r); }
.destacado { margin: 64px 0; display: grid; gap: 28px; padding: 32px 26px; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); }
.destacado h2 { margin: 0 0 8px; }
.destacado p { margin: 0 0 18px; color: var(--muted); }
@media (min-width: 900px) { .destacado { grid-template-columns: 1fr 1fr; gap: 48px; padding: 44px; } .destacado > div + div { border-left: 1px solid var(--line); padding-left: 48px; } }
.fecha { font: 600 clamp(2.4rem, 2rem + 2vw, 3.4rem)/1 var(--serif); margin: 4px 0 12px; }
.fecha s { color: var(--muted); font-weight: 400; text-decoration-thickness: 2px; }
.fuentes { margin: 56px 0 8px; max-width: 66ch; }

/* Pie */
footer { margin-top: 80px; padding: 48px 0 32px; border-top: 1px solid var(--line); background: var(--white); font-size: .93rem; }
.foot { display: grid; gap: 28px; }
@media (min-width: 768px) { .foot { grid-template-columns: 1.2fr 1fr 1fr 1fr; } }
.foot h3 { font-size: 1.05rem; margin: 0 0 10px; }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li { margin: 6px 0; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--blue); text-decoration: underline; }
.foot p { color: var(--muted); margin: 8px 0 0; }
.legal { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .86rem; }

/* Impresión: solo el título, el formulario y el resultado */
@media print {
  header, footer, .peek, .promo, .acciones, details, .col > h2, .col > p:not(.lead), .col > ul, .col > ol, .col > div:not(.calc), .note { display: none !important; }
  body { background: #fff; color: #000; }
  .page { display: block; }
  .rail { position: static; margin-top: 16px; }
  .result { border-color: #000; break-inside: avoid; }
}
