/* ¿Cuánto me toca? — estilos v1 */
:root {
  --ink: #1B2A41;
  --muted: #55606E;
  --paper: #FFFFFF;
  --panel: #F4F7F9;
  --line: #D3DCE3;
  --accent: #00739E;
  --accent-strong: #005A7D;
  --accent-ink: #FFFFFF;
  --accent-soft: #E2F1F7;
  --ledger: #EDF5EA;
  --ledger-rule: #CFE2CB;
  --ledger-guide: #8FAE8A;
  --stamp: #B3261E;
  --wa: #1F7A4D;
  --focus: #E8A200;
  --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #E4EBF1; --muted: #A7B3BE; --paper: #0E1620; --panel: #15202B; --line: #2A3848;
    --accent: #5BC0E6; --accent-strong: #8AD3EE; --accent-ink: #04202B; --accent-soft: #12313D;
    --ledger: #13251A; --ledger-rule: #26422C; --ledger-guide: #5F8E68; --stamp: #FF8A80; --wa: #2E9E66;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #E4EBF1; --muted: #A7B3BE; --paper: #0E1620; --panel: #15202B; --line: #2A3848;
  --accent: #5BC0E6; --accent-strong: #8AD3EE; --accent-ink: #04202B; --accent-soft: #12313D;
  --ledger: #13251A; --ledger-rule: #26422C; --ledger-guide: #5F8E68; --stamp: #FF8A80; --wa: #2E9E66;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font); font-size: 1.0625rem; line-height: 1.55;
}
img, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.contenedor { max-width: 44rem; margin: 0 auto; padding: 0 1.25rem; }

/* Encabezado y pie */
.sitio-cabecera { border-bottom: 1px solid var(--line); }
.barra { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.6rem; }
.marca { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.2rem; letter-spacing: -0.01em; }
.marca svg { width: 1.6rem; height: 1.6rem; flex: none; }
.barra nav a { font-weight: 700; text-decoration: none; }
.sitio-pie { border-top: 1px solid var(--line); margin-top: 3rem; padding: 1.5rem 0 2.5rem; font-size: 0.95rem; color: var(--muted); }
.sitio-pie nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; margin-bottom: 0.75rem; }
.sitio-pie a { color: var(--muted); }

/* Tipografía */
main { padding: 1.25rem 0 1rem; }
h1 { font-size: clamp(1.8rem, 1.25rem + 2.4vw, 2.55rem); line-height: 1.1; letter-spacing: -0.02em; margin: 0.25rem 0 0.75rem; }
h2 { font-size: 1.45rem; line-height: 1.2; letter-spacing: -0.01em; margin: 2.5rem 0 0.75rem; }
h3 { font-size: 1.15rem; line-height: 1.3; margin: 1.75rem 0 0.4rem; }
p, ul, ol { margin: 0 0 1rem; }
li { margin-bottom: 0.35rem; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 38rem; }
.migas { font-size: 0.95rem; color: var(--muted); margin: 0 0 0.5rem; }
.migas a { color: var(--muted); }
.actualizado { font-size: 0.95rem; color: var(--muted); }

/* Calculadora */
.calc { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1.25rem; margin: 1.5rem 0 0; }
.campo { margin: 0 0 1.15rem; }
.campo > label, fieldset > legend { display: block; font-weight: 700; margin: 0 0 0.4rem; padding: 0; }
.ayuda { display: block; font-size: 0.93rem; color: var(--muted); margin-top: 0.3rem; }
.calc input[type="date"], .calc input[type="text"], .calc input[type="number"], .calc select {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper);
  border: 2px solid var(--line); border-radius: 8px; padding: 0.65rem 0.8rem; min-height: 3rem;
}
.calc input:focus, .calc select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.dinero { position: relative; }
.dinero > span { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); font-weight: 700; color: var(--muted); pointer-events: none; }
.calc .dinero input { padding-left: 2rem; }
fieldset { border: 0; padding: 0; margin: 0 0 1.15rem; min-width: 0; }
.opciones { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.opcion { position: relative; }
.opcion input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opcion span {
  display: block; padding: 0.6rem 0.95rem; border: 2px solid var(--line); border-radius: 999px;
  background: var(--paper); cursor: pointer; font-weight: 700; font-size: 0.98rem;
}
.opcion input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.opcion input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.check { display: flex; gap: 0.65rem; align-items: flex-start; margin: 0.75rem 0; }
.check input { width: 1.25rem; height: 1.25rem; margin: 0.2rem 0 0; accent-color: var(--accent); flex: none; }
details.mas { margin: 0 0 1.15rem; border-top: 1px solid var(--line); padding-top: 0.85rem; }
details.mas > summary { cursor: pointer; font-weight: 700; color: var(--accent); }
details.mas[open] > summary { margin-bottom: 0.9rem; }
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font: inherit; font-weight: 700; font-size: 1.05rem; line-height: 1.2; text-align: center;
  border: 0; border-radius: 10px; padding: 0.8rem 1.2rem; min-height: 3.1rem; cursor: pointer; text-decoration: none;
}
.boton-primario { background: var(--accent); color: var(--accent-ink); width: 100%; }
.boton-primario:hover { background: var(--accent-strong); color: var(--accent-ink); }
.boton-sec { background: transparent; color: var(--ink); border: 2px solid var(--ledger-guide); }
.boton-wa { background: var(--wa); color: #FFFFFF; }
.boton-wa:hover { color: #FFFFFF; filter: brightness(1.08); }
.error { color: var(--stamp); font-weight: 700; margin: 0.75rem 0 0; }

/* Hoja de liquidación: el recibo */
.resultado:empty { display: none; }
.hoja {
  position: relative; background: var(--ledger); color: var(--ink);
  padding: 1.25rem 1.1rem 1.6rem; margin: 1.5rem 0 2.5rem; border-radius: 10px 10px 0 0;
  font-variant-numeric: tabular-nums; animation: imprimir 0.5s ease-out;
}
.hoja:focus { outline: none; }
.hoja::after {
  content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 9px; background: var(--ledger);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='9'%3E%3Cpath d='M0 0h18L9 9z'/%3E%3C/svg%3E") repeat-x 0 0 / 18px 9px;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='9'%3E%3Cpath d='M0 0h18L9 9z'/%3E%3C/svg%3E") repeat-x 0 0 / 18px 9px;
}
@keyframes imprimir { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
.hoja-titulo { font-size: 1.3rem; margin: 0 0 0.3rem; }
.hoja-meta { color: var(--muted); font-size: 0.95rem; margin: 0 0 0.75rem; }
.hoja-lineas { list-style: none; margin: 0; padding: 0; }
.linea { padding: 0.75rem 0; margin: 0; border-bottom: 1px solid var(--ledger-rule); }
.linea-fila { display: flex; align-items: flex-end; gap: 0.5rem; }
.concepto { font-weight: 700; }
.guia { flex: 1 1 1.25rem; min-width: 1rem; border-bottom: 2px dotted var(--ledger-guide); margin-bottom: 0.35em; }
.monto { white-space: nowrap; font-weight: 700; }
.linea-det { font-size: 0.9rem; color: var(--muted); margin-top: 0.2rem; }
.hoja-total { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; border-top: 3px double var(--ink); margin-top: 0.9rem; padding-top: 0.8rem; }
.hoja-total .etiqueta { font-weight: 700; }
.hoja-total .monto { font-size: clamp(1.65rem, 1.2rem + 2.2vw, 2.2rem); letter-spacing: -0.01em; }
.hoja-notas { font-size: 0.95rem; margin: 1rem 0 0; padding-left: 1.1rem; }
.sello {
  display: inline-block; margin: 1.1rem 0 0.2rem; padding: 0.35rem 0.7rem; color: var(--stamp); font-weight: 700; font-size: 0.95rem;
  border: 2px solid var(--stamp); outline: 1px solid var(--stamp); outline-offset: 2px; border-radius: 4px; transform: rotate(-2deg);
}
.acciones { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.25rem; }
.acciones .boton { flex: 1 1 10rem; font-size: 1rem; min-height: 2.9rem; }

/* Contenido */
.tabla { overflow-x: auto; margin: 0 0 1.25rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.98rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 700; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.fila-total td { font-weight: 700; border-top: 2px solid var(--ink); }
tr.tuyo td { background: var(--accent-soft); font-weight: 700; }
.faq details { border-bottom: 1px solid var(--line); padding: 0.85rem 0; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq details p { margin: 0.6rem 0 0; }
.nota-legal { font-size: 0.95rem; color: var(--muted); border-left: 4px solid var(--line); padding-left: 1rem; margin: 2rem 0; }
.indice { list-style: none; padding: 0; margin: 1rem 0 1.5rem; border-top: 1px solid var(--line); }
.indice li { border-bottom: 1px solid var(--line); margin: 0; }
.indice a { display: block; padding: 0.95rem 0.2rem; text-decoration: none; color: var(--ink); }
.indice a strong { display: block; font-size: 1.15rem; color: var(--accent); }
.indice a span { color: var(--muted); }
.indice a:hover strong { text-decoration: underline; }
.relacionadas { margin-top: 2.5rem; }
.pronto { color: var(--muted); }
.aviso-preview { background: var(--accent-soft); border-bottom: 1px solid var(--line); font-size: 0.95rem; padding: 0.6rem 0; }

@media (min-width: 48rem) {
  body { font-size: 1.125rem; }
  .calc { padding: 1.75rem; }
  .hoja { padding: 1.5rem 1.6rem 1.8rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  :root { --ink: #000; --muted: #333; --paper: #fff; --ledger: #fff; --ledger-rule: #bbb; --ledger-guide: #999; --stamp: #000; }
  .sitio-cabecera, .sitio-pie, .calc, .acciones, .contenido, .migas, .lede, .actualizado, h1, .ad-slot, .aviso-preview { display: none !important; }
  body.imprimiendo [data-calc]:not(.imprimir-esta) { display: none !important; }
  .hoja { border: 1px solid #999; animation: none; margin: 0; }
  .hoja::after { display: none; }
}

/* Accesibilidad */
.saltar { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: 0.6rem 1rem; z-index: 10; }
.saltar:focus { left: 0.5rem; top: 0.5rem; }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
