/* Layout: una columna de trabajo. Cada herramienta = formulario a la izquierda, resultado a la derecha.
   El recibo explicado es la pieza principal; horas extra lo complementa; lo de empresas va aparte al final. */
:root {
  --paper: #f3f5f2;
  --surface: #ffffff;
  --ink: #15211d;
  --muted: #5a6b65;
  --line: #d5dcd8;
  --accent: #0b6b57;
  --accent-soft: #dcefe9;
  --on-accent: #ffffff;
  --tax: #b3541e;
  --ss: #2f5d9b;
  --warn: #a15c00;
  --warn-soft: #fbefd9;
  --crit: #b3261e;
  --crit-soft: #fbe4e2;
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-num: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1614; --surface: #17211e; --ink: #e6ece9; --muted: #9aaba5; --line: #2b3a35;
    --accent: #4fc3a6; --accent-soft: #17352e; --on-accent: #06211b; --tax: #f0a070; --ss: #8ab4f0;
    --warn: #f0b45a; --warn-soft: #33270f; --crit: #ff8a80; --crit-soft: #3a1917;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1614; --surface: #17211e; --ink: #e6ece9; --muted: #9aaba5; --line: #2b3a35;
  --accent: #4fc3a6; --accent-soft: #17352e; --on-accent: #06211b; --tax: #f0a070; --ss: #8ab4f0;
  --warn: #f0b45a; --warn-soft: #33270f; --crit: #ff8a80; --crit-soft: #3a1917;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.5; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
header.top { padding: 36px 0 20px; }
h1 { font-family: var(--font-display); font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.1; margin: 0 0 10px; text-wrap: balance; letter-spacing: -0.01em; }
.lead { max-width: 62ch; color: var(--muted); margin: 0; }
h2 { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.2; margin: 0 0 4px; text-wrap: balance; }
h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 10px; font-weight: 600; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.bar { position: sticky; top: 0; z-index: 5; background: var(--paper); border-bottom: 1px solid var(--line); padding: 12px 0; }
nav.jump { display: flex; gap: 18px; flex-wrap: wrap; font-size: 0.95rem; font-weight: 500; }

.seg { display: flex; gap: 6px; flex-wrap: wrap; border: 0; padding: 0; margin: 0; }
.seg legend { font-size: 0.85rem; font-weight: 500; padding: 0; margin-bottom: 6px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); font-size: 0.92rem; }
.seg input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.years span { display: flex; flex-direction: column; align-items: center; min-width: 60px; padding: 6px 10px; font-family: var(--font-num); line-height: 1.2; }
.years span small { font-family: var(--font-body); font-size: 0.72rem; font-weight: 400; opacity: 0.8; }

main { display: flex; flex-direction: column; gap: 28px; padding: 28px 0 40px; }
section.calc { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; scroll-margin-top: 70px; }
.calc > p.sub { color: var(--muted); margin: 0 0 20px; max-width: 65ch; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
@media (max-width: 760px) { .cols { grid-template-columns: 1fr; } section.calc { padding: 18px; } }
form, .stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label, .field .lbl { font-size: 0.85rem; font-weight: 500; }
input[type="number"], input[type="date"], input[type="text"], select { font: inherit; font-family: var(--font-num); color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; min-width: 0; }
select, input[type="text"] { font-family: var(--font-body); }
.hint { font-size: 0.78rem; color: var(--muted); }
.check { display: flex; gap: 8px; align-items: center; font-size: 0.92rem; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.week .field label { text-align: center; font-family: var(--font-num); font-size: 0.78rem; color: var(--muted); }
.week input { padding: 8px 2px; text-align: center; }
@media (max-width: 420px) { .week { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.btn { display: inline-block; cursor: pointer; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--accent); color: var(--accent); background: var(--surface); font: inherit; font-weight: 600; font-size: 0.9rem; }
.btn:hover { background: var(--accent-soft); }
.btn.quiet { border-color: var(--line); color: var(--muted); font-weight: 500; }
.vh { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.vh:focus-visible + .btn { outline: 3px solid var(--accent); outline-offset: 2px; }
.box { border: 1px dashed var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
details { font-size: 0.88rem; }
details summary { cursor: pointer; color: var(--accent); font-weight: 500; }
details ul, details ol { margin: 8px 0 0; padding-left: 20px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }

.group { display: flex; flex-direction: column; gap: 8px; }
.group .ghead { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.group .ghead b { font-size: 0.95rem; }
.rrow { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.rrow .name { grid-column: 1 / -1; }
.rrow .hx { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.rrow .hx label { font-size: 0.78rem; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.rrow button { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.rrow button:hover { color: var(--crit); border-color: var(--crit); }
.banner { background: var(--warn-soft); border-left: 4px solid var(--warn); border-radius: 8px; padding: 9px 12px; font-size: 0.88rem; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

.out { display: flex; flex-direction: column; gap: 16px; }
.big { font-family: var(--font-num); font-size: clamp(1.9rem, 5vw, 2.6rem); font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.big small { display: block; font-family: var(--font-body); font-size: 0.85rem; font-weight: 400; color: var(--muted); margin-top: 4px; }
dl.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; margin: 0; font-size: 0.95rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; font-family: var(--font-num); font-variant-numeric: tabular-nums; text-align: right; }
.split { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--line); }
.split i { display: block; height: 100%; }
.split .ord { background: var(--muted); opacity: 0.45; }
.split .dob, .split .net { background: var(--accent); }
.split .tri { background: var(--warn); }
.split .isr { background: var(--tax); }
.split .imss { background: var(--ss); }
.split .otr { background: var(--muted); }
.legend { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 0.82rem; color: var(--muted); }
.legend b { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
ul.notes, ul.lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
ul.notes li { padding: 9px 12px; border-radius: 8px; font-size: 0.9rem; border-left: 4px solid; }
li.ok { background: var(--accent-soft); border-color: var(--accent); }
li.warn { background: var(--warn-soft); border-color: var(--warn); }
li.crit { background: var(--crit-soft); border-color: var(--crit); }
li.info { background: var(--paper); border-color: var(--line); }
ul.lines li { border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; display: flex; flex-direction: column; gap: 3px; }
ul.lines .lt { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
ul.lines .lt b { font-size: 0.98rem; }
ul.lines .lt span { font-family: var(--font-num); font-variant-numeric: tabular-nums; white-space: nowrap; }
ul.lines p { margin: 0; font-size: 0.88rem; color: var(--muted); }
ul.lines small { font-size: 0.78rem; color: var(--muted); }
.gtitle { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 6px 0 0; font-weight: 600; }
.gtitle span { font-family: var(--font-num); }
.law { font-size: 0.8rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; margin: 0; }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th { font-size: 0.78rem; font-weight: 600; color: var(--muted); white-space: normal; vertical-align: bottom; }
th:first-child, td:first-child { text-align: left; }
td { font-family: var(--font-num); }
tr.sel td { background: var(--accent-soft); font-weight: 600; }
.aviso { margin-top: 16px; max-width: 75ch; background: var(--warn-soft); border-left: 4px solid var(--warn); border-radius: 8px; padding: 10px 14px; font-size: 0.9rem; }
.pdfbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pdfbar span { font-size: 0.8rem; color: var(--muted); }
.empresas { border-top: 2px solid var(--line); padding-top: 24px; display: flex; flex-direction: column; gap: 20px; scroll-margin-top: 70px; }
.empresas > p { color: var(--muted); margin: -12px 0 0; max-width: 65ch; }
footer { border-top: 1px solid var(--line); padding: 22px 0 48px; color: var(--muted); font-size: 0.85rem; }
footer p { max-width: 75ch; margin: 0 0 8px; }

.site { border-bottom: 1px solid var(--line); background: var(--surface); }
.site .wrap { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; justify-content: space-between; padding-top: 14px; padding-bottom: 14px; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.brand b { color: var(--accent); }
.site nav { display: flex; gap: 6px 18px; flex-wrap: wrap; font-size: 0.95rem; font-weight: 500; }
.site nav a { color: var(--muted); text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.site nav a:hover { color: var(--ink); }
.site nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.crumbs { font-size: 0.85rem; color: var(--muted); margin: 0 0 8px; }
article.guide { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
article.guide > * { max-width: 68ch; }
article.guide h2 { margin: 28px 0 8px; }
article.guide h2:first-child { margin-top: 0; }
article.guide h3 { text-transform: none; letter-spacing: 0; font-size: 1.05rem; color: var(--ink); margin: 20px 0 6px; }
article.guide p, article.guide li { line-height: 1.65; }
article.guide ul, article.guide ol { padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
article.guide .tablewrap { max-width: 100%; margin: 12px 0; }
article.guide table { max-width: 560px; }
.faq { display: flex; flex-direction: column; gap: 8px; }
.faq details { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 1rem; }
.faq summary { color: var(--ink); font-weight: 600; }
.faq details p { margin: 8px 0 0; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; text-decoration: none; color: var(--ink); }
.card:hover { border-color: var(--accent); }
.card h2 { font-size: 1.2rem; margin: 0; }
.card p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.card span { margin-top: auto; color: var(--accent); font-weight: 600; font-size: 0.92rem; }
article.guide > .points { max-width: none; }
.points { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.points div { border-top: 2px solid var(--accent); padding-top: 10px; }
.points b { display: block; margin-bottom: 4px; }
.points p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.legal { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.legal > * { max-width: 70ch; }
.legal h2 { font-size: 1.15rem; margin: 24px 0 6px; }
.legal .ph { background: var(--warn-soft); padding: 0 4px; border-radius: 4px; }
footer nav { display: flex; gap: 8px 18px; flex-wrap: wrap; margin-bottom: 12px; }
@media (max-width: 760px) { article.guide, .legal { padding: 20px; } }
