/* Calculadoras laborales — papel cuadriculado tkaed + recibo de caja térmico */

:root {
  --paper: #f2f6f3;
  --card: #ffffff;
  --ink: #112a3a;
  --pencil: #4d626e;
  --line: rgba(17, 42, 58, 0.14);
  --amber: #f2b632;
  --amber-soft: rgba(242, 182, 50, 0.3);
  --yes: #1d6f55;
  --no: #a8324a;
  --slip: #fffdf7;
  --serif: "Young Serif", Georgia, "Times New Roman", serif;
  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "Courier New", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--sans); font-size: 1rem; line-height: 1.55; color: var(--ink);
  background-color: var(--paper);
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 28px 28px;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 0; }
h2 { font-size: 1.45rem; }
p { margin: 0 0 1em; }
[hidden] { display: none !important; }
main, .top, .foot { width: min(1080px, 100% - 2rem); margin-inline: auto; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.7rem 0; }
.brand { font-family: var(--serif); font-size: 1.1rem; text-decoration: none; }
.top nav { display: flex; gap: 1.1rem; font-size: 0.95rem; }
.top nav a { text-decoration: none; border-bottom: 2px solid transparent; }
.top nav a:hover { border-bottom-color: var(--amber); }
@media (max-width: 520px) { .top nav a.opt { display: none; } }

.intro { padding: 0.1rem 0 0.7rem; max-width: 46rem; }
.intro h1 { font-size: clamp(1.45rem, 5.6vw, 2.7rem); margin-bottom: 0.3rem; }
.lede { font-size: 1rem; color: var(--pencil); margin: 0; }
@media (max-width: 520px) { .lede { font-size: 0.93rem; } }

/* Herramienta */
.workbench { display: grid; gap: 1.4rem; align-items: start; margin-bottom: 1.5rem; }
@media (min-width: 900px) { .workbench { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); } }
.tool {
  background: var(--card); border: 2px solid var(--ink); border-radius: 6px;
  box-shadow: 7px 7px 0 var(--amber);
}
.pledge {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.1rem 1rem;
  background: var(--ink); color: #fff; padding: 0.4rem 0.85rem; font-size: 0.8rem; font-weight: 500;
  border-radius: 3px 3px 0 0;
}
.pledge .vig { opacity: 0.85; font-weight: 400; }
.form { padding: 0.8rem 0.85rem 0.9rem; }
.row { display: grid; gap: 0.6rem; grid-template-columns: 1fr 1fr; }
.row > .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; margin-bottom: 0.6rem; }
.field > label, .lbl { font-weight: 700; font-size: 0.9rem; }
.opt-tag { font-weight: 400; color: var(--pencil); }
input[type="text"], input[type="date"], select {
  width: 100%; min-height: 46px; padding: 0.45rem 0.6rem; font: inherit; color: var(--ink);
  background: #fff; border: 2px solid var(--ink); border-radius: 6px;
}
input[inputmode] { text-align: right; font-variant-numeric: tabular-nums; }
input.bad, select.bad { border-color: var(--no); background: #fdf1f3; }
.hint { font-size: 0.82rem; color: var(--pencil); margin: 0.15rem 0 0; }
.pc { display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 0 0.35rem; border: 1.5px dashed var(--pencil); border-radius: 4px; color: var(--pencil); white-space: nowrap; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem; border: 0; padding: 0; margin: 0 0 0.6rem; }
.seg legend { font-weight: 700; font-size: 0.9rem; margin-bottom: 0.2rem; padding: 0; }
.seg label {
  display: flex; align-items: center; justify-content: center; text-align: center; min-height: 46px; padding: 0.3rem;
  border: 2px solid var(--ink); border-radius: 6px; cursor: pointer; font-weight: 700; font-size: 0.9rem; line-height: 1.2;
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input:checked + span { }
.seg label:has(input:checked) { background: var(--ink); color: #fff; box-shadow: 3px 3px 0 var(--amber); }
.seg label:has(input:focus-visible) { outline: 3px solid var(--amber); outline-offset: 2px; }

.quick { display: grid; grid-template-columns: 1fr auto; gap: 0.45rem; align-items: end; }
.btn-primary, .btn-ghost {
  font: inherit; font-weight: 700; min-height: 48px; padding: 0.55rem 1.1rem; border-radius: 6px; cursor: pointer;
  border: 2px solid var(--ink);
}
.btn-primary { width: 100%; background: var(--ink); color: #fff; box-shadow: 4px 4px 0 var(--amber); font-size: 1.05rem; }
.btn-primary:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--amber); }
.btn-primary:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--amber); }
.btn-ghost { background: #fff; color: var(--ink); }
.btn-ghost:hover { background: var(--amber-soft); }
.msg { margin: 0.5rem 0 0; font-weight: 600; color: var(--no); }
.msg:empty { display: none; }
.msg ul { margin: 0; padding-left: 1.1rem; }

/* Cuadrícula de meses */
.months { margin: 0.2rem 0 0.7rem; }
.months summary { cursor: pointer; font-weight: 700; padding: 0.45rem 0; }
.mgrid { display: grid; gap: 0.3rem; }
.mrow { display: grid; grid-template-columns: 7.2rem minmax(0, 1fr) auto; gap: 0.4rem; align-items: center; }
.mrow .mname { font-size: 0.88rem; font-weight: 600; text-transform: capitalize; }
.mrow input[type="text"] { min-height: 40px; padding: 0.3rem 0.5rem; }
.mrow .inc { display: flex; align-items: center; gap: 0.25rem; font-size: 0.78rem; color: var(--pencil); cursor: pointer; min-height: 40px; }
.mrow .inc input { width: 20px; height: 20px; accent-color: var(--ink); }
.mdays { grid-column: 2 / -1; display: flex; gap: 0.4rem; align-items: center; font-size: 0.82rem; }
.mdays input { width: 5rem !important; }

/* Recibo */
.out { min-height: 2rem; }
.empty {
  border: 2px dashed var(--pencil); border-radius: 6px; padding: 1rem; color: var(--pencil); background: rgba(255,255,255,.6);
}
.empty b { color: var(--ink); }
.receipt-wrap { filter: drop-shadow(5px 6px 0 rgba(17,42,58,.18)); }
.receipt {
  position: relative; background: var(--slip); font-family: var(--mono); font-size: 0.86rem; line-height: 1.45;
  padding: 1.1rem 1rem 1.2rem; margin: 10px 0; font-variant-numeric: tabular-nums;
}
.receipt::before, .receipt::after {
  content: ""; position: absolute; left: 0; right: 0; height: 10px;
  background: linear-gradient(-45deg, var(--slip) 5px, transparent 0) 0 0 / 14px 10px repeat-x,
              linear-gradient(45deg, var(--slip) 5px, transparent 0) 0 0 / 14px 10px repeat-x;
}
.receipt::before { top: -10px; transform: scaleY(-1); }
.receipt::after { bottom: -10px; }
.r-head { text-align: center; text-transform: uppercase; letter-spacing: 0.06em; }
.r-head b { display: block; font-size: 1rem; }
.r-sep { border: 0; border-top: 1.5px dashed var(--ink); margin: 0.5rem 0; }
.r-ln { display: flex; justify-content: space-between; gap: 0.8rem; }
.r-ln span:first-child { min-width: 0; }
.r-ln span:last-child { text-align: right; white-space: nowrap; }
.r-ln.muted { color: var(--pencil); }
.r-ln.strike span { text-decoration: line-through; }
.r-total { font-size: 1.15rem; font-weight: 700; padding: 0.35rem 0.4rem; margin: 0.3rem -0.4rem; background: var(--ink); color: #fff; }
.r-total span:last-child { color: var(--amber); }
.r-note { font-size: 0.78rem; color: var(--pencil); margin: 0.35rem 0 0; }
.r-note.warn { color: var(--ink); background: var(--amber-soft); padding: 0.2rem 0.35rem; }
.r-foot { text-align: center; font-size: 0.75rem; margin-top: 0.6rem; }
.receipt.printing .r-anim { opacity: 0; animation: tick 0.18s steps(2) forwards; animation-delay: calc(var(--i) * 70ms); }
@keyframes tick { to { opacity: 1; } }
.receipt.printing { animation: feed 0.5s ease-out; }
@keyframes feed { from { transform: translateY(-14px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .receipt.printing, .receipt.printing .r-anim { animation: none; opacity: 1; }
}

.steps { margin-top: 0.8rem; background: #fff; border: 2px solid var(--ink); border-radius: 6px; }
.steps summary { cursor: pointer; font-weight: 700; padding: 0.6rem 0.8rem; min-height: 44px; }
.steps ol { margin: 0; padding: 0 0.9rem 0.8rem 2rem; }
.steps li { margin-bottom: 0.55rem; }
.steps code { display: block; font-family: var(--mono); font-size: 0.85rem; background: var(--paper); padding: 0.25rem 0.45rem; margin-top: 0.15rem; overflow-wrap: anywhere; }
.steps .src { font-size: 0.8rem; color: var(--pencil); padding: 0 0.9rem 0.8rem; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.8rem; }
.actions .btn-ghost { flex: 1 1 10rem; }
.copied { font-size: 0.85rem; color: var(--yes); font-weight: 600; margin: 0.3rem 0 0; }

.legal {
  font-size: 0.86rem; padding: 0.6rem 0.8rem; border-left: 4px solid var(--amber); background: #fff; margin: 0.9rem 0 0;
}
.legal p { margin: 0 0 0.3rem; }
.legal p:last-child { margin: 0; }

/* Portada de calculadoras */
.picks { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.7rem; }
@media (min-width: 760px) { .picks { grid-template-columns: repeat(3, 1fr); } }
.pick a, .pick > div {
  display: grid; grid-template-columns: auto 1fr; gap: 0.15rem 0.8rem; align-items: center; height: 100%;
  padding: 0.75rem 0.9rem; text-decoration: none; background: #fff; border: 2px solid var(--ink); border-radius: 6px;
}
.pick a { box-shadow: 5px 5px 0 var(--amber); }
.pick a:hover { transform: translate(-1px, -1px); box-shadow: 6px 6px 0 var(--amber); }
.pick .ic { grid-row: span 2; width: 44px; height: 44px; border-radius: 6px; background: var(--ink); color: var(--amber); display: grid; place-items: center; font-family: var(--mono); font-weight: 700; }
.pick b { font-family: var(--serif); font-weight: 400; font-size: 1.15rem; line-height: 1.2; }
.pick small { color: var(--pencil); font-size: 0.85rem; }
.pick.soon > div { border-style: dashed; color: var(--pencil); }

.next {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.3rem 1rem;
  background: var(--ink); color: #fff; border-radius: 6px; padding: 0.7rem 0.9rem; box-shadow: 5px 5px 0 var(--amber);
}
.next .big { font-family: var(--mono); font-size: 1.6rem; font-weight: 700; color: var(--amber); font-variant-numeric: tabular-nums; }
.next p { margin: 0; }
.cal { width: 100%; border-collapse: collapse; background: #fff; border: 2px solid var(--ink); margin: 0.8rem 0; font-size: 0.92rem; }
.cal th, .cal td { padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.cal td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cal thead th { background: var(--paper); font-size: 0.82rem; }
@media (max-width: 560px) {
  .cal { font-size: 0.84rem; }
  .cal th, .cal td { padding: 0.4rem 0.35rem; }
  .cal th:nth-child(3), .cal td:nth-child(3) { display: none; }
}

/* Texto */
.block { max-width: 46rem; margin: 2rem 0; }
.block h2 { margin-bottom: 0.6rem; }
.block h3 { font-size: 1.15rem; margin: 1.2rem 0 0.4rem; }
.block ul { padding-left: 1.2rem; }
.faq details { background: #fff; border: 2px solid var(--ink); border-radius: 6px; margin-bottom: 0.5rem; }
.faq summary { cursor: pointer; font-weight: 700; padding: 0.65rem 0.8rem; }
.faq details p { padding: 0 0.8rem 0.7rem; margin: 0; }
.faq .rev { font-size: 0.85rem; color: var(--pencil); }
.others ul { list-style: none; padding: 0; display: grid; gap: 0.5rem; }
.others a { display: block; padding: 0.6rem 0.8rem; background: #fff; border: 2px solid var(--ink); border-radius: 6px; text-decoration: none; font-weight: 700; }
.others a:hover { background: var(--amber-soft); }
.others [aria-current] { border-style: dashed; color: var(--pencil); }

.ad-slot {
  display: grid; place-items: center; min-height: 100px; margin: 1.5rem 0; border: 1px dashed var(--line); color: var(--pencil); font-size: 0.75rem;
}
.foot { padding: 1.5rem 0 2rem; font-size: 0.9rem; color: var(--pencil); border-top: 2px solid var(--ink); margin-top: 2rem; }
.foot p { margin: 0.2rem 0; }
.noscript { background: var(--amber); padding: 0.8rem; text-align: center; margin: 0; }

/* Impresión: solo el recibo y el detalle */
@media print {
  body { background: #fff; }
  .top, .intro .lede, .form, .pledge, .ad-slot, .block, .faq, .others, .foot, .actions, .copied, .noscript { display: none !important; }
  .tool { border: 0; box-shadow: none; }
  .workbench { display: block; }
  .receipt-wrap { filter: none; }
  .receipt { border: 1px solid #000; background: #fff; }
  .receipt::before, .receipt::after { display: none; }
  .r-total { background: #fff; color: #000; border-top: 2px solid #000; border-bottom: 2px solid #000; }
  .r-total span:last-child { color: #000; }
  .steps { border: 1px solid #000; }
  .steps:not([open]) > *:not(summary) { display: block; }
  .receipt.printing .r-anim { animation: none; opacity: 1; }
}

/* Escondido hasta que AdSense apruebe; entonces borrar esta regla y poner los bloques. */
.ad-slot { display: none !important; }
