/* CuentaFiniquito
   Layout: cabecera fina, herramienta a dos columnas (datos | recibo de finiquito), artículo a 68ch debajo.
   El resultado imita un recibo de saldo y finiquito: conceptos con puntos guía e importes en monoespaciada. */
:root{
  --paper:#F2F4F8; --surface:#FFFFFF; --ink:#141B2B; --muted:#586174; --line:#D5DAE3;
  --accent:#1C4C8E; --accent-ink:#FFFFFF; --accent-soft:#E2EBF7;
  --minus:#A8261D; --plus:#1D6A44; --note:#7A5300; --note-soft:#FBF0D9;
  --display:"Archivo", "Arial Narrow", system-ui, sans-serif;
  --body:"Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:"IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){
  --paper:#0E131C; --surface:#161D29; --ink:#E5E9F1; --muted:#9AA3B6;
  --line:#2A3343; --accent:#8EB4F0; --accent-ink:#0B1424; --accent-soft:#1A2A44;
  --minus:#F0938A; --plus:#7FD1A4; --note:#F0C46E; --note-soft:#33280F; color-scheme:dark }}
:root[data-theme="dark"]{
  --paper:#0E131C; --surface:#161D29; --ink:#E5E9F1; --muted:#9AA3B6;
  --line:#2A3343; --accent:#8EB4F0; --accent-ink:#0B1424; --accent-soft:#1A2A44;
  --minus:#F0938A; --plus:#7FD1A4; --note:#F0C46E; --note-soft:#33280F; color-scheme:dark }

*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--paper);color:var(--ink);font-family:var(--body);font-size:17px;line-height:1.6}
a{color:var(--accent);text-underline-offset:3px}
a:hover{text-decoration-thickness:2px}
:focus-visible{outline:3px solid var(--accent);outline-offset:2px}
.wrap{max-width:1120px;margin:0 auto;padding-left:max(16px, env(safe-area-inset-left, 0px));padding-right:max(16px, env(safe-area-inset-right, 0px))}
h1,h2,h3{font-family:var(--display);font-stretch:88%;line-height:1.1;text-wrap:balance;margin:0;letter-spacing:-.01em}
h1{font-size:clamp(2rem,4.6vw,3rem);font-weight:800}
h2{font-size:clamp(1.45rem,2.6vw,1.8rem);font-weight:800}
h3{font-size:1.15rem;font-weight:700}
p{margin:0}

/* Cabecera */
.site-head{background:var(--surface);border-bottom:1px solid var(--line)}
.site-head .wrap{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px 24px;padding-block:14px}
.brand{display:flex;align-items:center;gap:10px;font-family:var(--display);font-stretch:85%;font-weight:800;font-size:1.25rem;color:var(--ink);text-decoration:none}
.brand-mark{width:30px;height:30px;border:2px solid var(--accent);border-radius:4px;display:grid;place-items:center;font-family:var(--mono);font-size:.75rem;font-weight:700;color:var(--accent)}
.nav{display:flex;flex-wrap:wrap;gap:4px 18px;font-size:.95rem}
.nav a{color:var(--muted);text-decoration:none;font-weight:600;padding:4px 0;border-bottom:2px solid transparent}
.nav a:hover,.nav a[aria-current="page"]{color:var(--ink);border-bottom-color:var(--accent)}

/* Cabecera de página */
.intro{padding-block:36px 24px;display:flex;flex-direction:column;gap:12px;max-width:760px}
.eyebrow{font-family:var(--mono);font-size:.74rem;letter-spacing:.1em;text-transform:uppercase;color:var(--accent);font-weight:600}
.lede{font-size:1.15rem;color:var(--muted);max-width:60ch}
.updated{font-size:.88rem;color:var(--muted)}

/* Herramienta */
.tool{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:24px;align-items:start;padding-bottom:16px}
@media (max-width:880px){.tool{grid-template-columns:1fr}}
.panel{background:var(--surface);border:1px solid var(--line);border-radius:8px;padding:clamp(18px,3vw,28px)}
form.calc{display:flex;flex-direction:column;gap:18px}
.example{font-size:.88rem;background:var(--accent-soft);color:var(--ink);padding:8px 12px;border-radius:6px}
fieldset{border:0;padding:0;margin:0;display:flex;flex-direction:column;gap:14px;min-width:0}
legend{font-family:var(--mono);font-size:.74rem;letter-spacing:.1em;text-transform:uppercase;color:var(--muted);font-weight:600;padding:0;margin-bottom:10px}
.row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
@media (max-width:460px){.row{grid-template-columns:1fr}}
.field{display:flex;flex-direction:column;gap:5px;min-width:0}
.field label{font-weight:700;font-size:.95rem}
.hint{font-size:.84rem;color:var(--muted);line-height:1.4}
input[type=date],input[type=number],select{width:100%;font:inherit;font-size:1rem;color:var(--ink);background:var(--paper);border:1.5px solid var(--line);border-radius:6px;padding:10px 12px;min-height:46px}
input[type=number]{font-family:var(--mono);font-variant-numeric:tabular-nums}
input:focus,select:focus{border-color:var(--accent);outline:none;box-shadow:0 0 0 3px var(--accent-soft)}
.check{display:flex;gap:10px;align-items:flex-start;font-size:.95rem}
.check input{width:20px;height:20px;margin-top:2px;accent-color:var(--accent);flex:none}
.err{color:var(--minus);font-weight:700;font-size:.92rem}

/* Recibo */
.receipt{position:sticky;top:16px;display:flex;flex-direction:column;gap:16px}
@media (max-width:880px){.receipt{position:static}}
.receipt-head{display:flex;justify-content:space-between;align-items:baseline;gap:12px;border-bottom:2px solid var(--ink);padding-bottom:10px;flex-wrap:wrap}
.receipt-head h2{font-size:1.3rem}
.receipt-head span{font-family:var(--mono);font-size:.78rem;color:var(--muted)}
.lines{list-style:none;margin:0;padding:0;display:flex;flex-direction:column}
.line{display:flex;align-items:baseline;gap:8px;padding:9px 0;border-bottom:1px dotted var(--line)}
.line .concept{min-width:0}
.line .concept small{display:block;color:var(--muted);font-size:.82rem;line-height:1.35}
.line .lead{flex:1;border-bottom:1px dotted var(--muted);opacity:.5;transform:translateY(-4px);min-width:12px}
.line .amt{font-family:var(--mono);font-variant-numeric:tabular-nums;font-weight:600;white-space:nowrap}
.line .amt.minus{color:var(--minus)}
.sub{display:flex;justify-content:space-between;gap:12px;font-weight:700;padding-top:6px}
.sub .amt{font-family:var(--mono);font-variant-numeric:tabular-nums}
.total{display:flex;justify-content:space-between;align-items:baseline;gap:12px;background:var(--accent);color:var(--accent-ink);border-radius:6px;padding:14px 16px;flex-wrap:wrap}
.total span{font-family:var(--display);font-stretch:88%;font-weight:800;font-size:1.1rem}
.total strong{font-family:var(--mono);font-variant-numeric:tabular-nums;font-size:clamp(1.5rem,4vw,2rem)}
.split{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.split div{border:1px solid var(--line);border-radius:6px;padding:10px 12px;display:flex;flex-direction:column;gap:2px}
.split small{color:var(--muted);font-size:.8rem;line-height:1.3}
.split b{font-family:var(--mono);font-variant-numeric:tabular-nums}
.notice{background:var(--note-soft);color:var(--note);border-radius:6px;padding:10px 12px;font-size:.9rem;font-weight:600;line-height:1.45}
.fine{font-size:.82rem;color:var(--muted);line-height:1.45}
.copy{font:inherit;font-weight:700;cursor:pointer;background:transparent;color:var(--ink);border:1.5px solid var(--line);border-radius:6px;padding:9px 14px;align-self:flex-start}
.copy:hover{border-color:var(--accent)}
.toast{font-size:.86rem;color:var(--plus);font-weight:700;min-height:1.2em}

/* Tabla de tramos */
.table-scroll{overflow-x:auto}
table{width:100%;border-collapse:collapse;font-size:.92rem}
th,td{text-align:left;padding:8px 10px;border-bottom:1px solid var(--line);vertical-align:top}
th{font-family:var(--mono);font-size:.74rem;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);font-weight:600}
td.num,th.num{text-align:right;font-family:var(--mono);font-variant-numeric:tabular-nums;white-space:nowrap}

/* Artículo */
.article{max-width:720px;padding-block:32px 48px;display:flex;flex-direction:column;gap:18px}
.article h2{margin-top:18px}
.article h3{margin-top:8px}
.article ul,.article ol{margin:0;padding-left:1.3em;display:flex;flex-direction:column;gap:6px}
.article .table-scroll{border:1px solid var(--line);border-radius:8px;background:var(--surface)}
.article blockquote{margin:0;border-left:3px solid var(--accent);padding:4px 0 4px 16px;color:var(--muted)}
.formula{font-family:var(--mono);font-size:.92rem;background:var(--surface);border:1px solid var(--line);border-radius:6px;padding:12px 14px;overflow-x:auto;white-space:pre}
.faq{display:flex;flex-direction:column;gap:8px}
.faq details{background:var(--surface);border:1px solid var(--line);border-radius:8px;padding:12px 16px}
.faq summary{cursor:pointer;font-weight:700}
.faq details p{margin-top:8px}
.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));gap:12px}
.cards a{display:flex;flex-direction:column;gap:4px;background:var(--surface);border:1px solid var(--line);border-radius:8px;padding:14px 16px;text-decoration:none;color:var(--ink)}
.cards a:hover{border-color:var(--accent)}
.cards a span{color:var(--muted);font-size:.9rem;line-height:1.4}

/* Publicidad: se oculta si no hay anuncio cargado */
.ad-slot{margin-block:20px;min-height:90px;display:flex;justify-content:center}
.ad-slot:empty{display:none}

/* Pie */
.site-foot{border-top:1px solid var(--line);background:var(--surface);font-size:.9rem;color:var(--muted)}
.site-foot .wrap{padding-block:28px 40px;display:flex;flex-direction:column;gap:14px}
.foot-links{display:flex;flex-wrap:wrap;gap:6px 18px}
.foot-links a{color:var(--muted)}
.legal{max-width:720px;padding-block:32px 56px;display:flex;flex-direction:column;gap:14px}
.legal h2{font-size:1.3rem;margin-top:14px}
.placeholder{background:var(--note-soft);color:var(--note);padding:0 4px;border-radius:3px;font-weight:700}

@media (prefers-reduced-motion: reduce){*{transition:none!important;animation:none!important}}
@media print{.site-head,.site-foot,.ad-slot,form.calc,.copy{display:none}.tool{grid-template-columns:1fr}}
