/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f6f4ee;
  --surface: #ffffff;
  --ink: #16211d;
  --muted: #5d6a64;
  --line: #e2ded2;
  --accent: #0f5c4a;
  --accent-soft: #e3efe9;
  --on-accent: #ffffff;
  --isr: #d9822b;
  --imss: #5b6fb5;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
  --radius: 18px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow: 0 1px 2px rgba(22, 33, 29, .05), 0 12px 32px -12px rgba(22, 33, 29, .18);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1513;
    --surface: #17201d;
    --ink: #eef2ef;
    --muted: #9aa8a1;
    --line: #2a3531;
    --accent: #3fb592;
    --accent-soft: #1d3029;
    --on-accent: #0f1513;
    --isr: #f0a35a;
    --imss: #8fa0e0;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -12px rgba(0, 0, 0, .6);
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; line-height: 1.1; letter-spacing: -0.02em; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: min(100% - 32px, 1080px); margin-inline: auto; }
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 99;
  padding: .6rem 1rem; background: var(--surface); border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   4. Header / footer
   ============================================================= */
.site-header { border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; text-decoration: none; color: var(--accent); }
.logo span { color: var(--ink); letter-spacing: -0.01em; }
.header-link { font-size: .9rem; font-weight: 600; color: var(--muted); text-decoration: none; }
.header-link:hover { color: var(--accent); }

.site-footer { border-top: 1px solid var(--line); margin-top: 64px; padding: 28px 0 40px; font-size: .85rem; color: var(--muted); }
.footer-inner { display: grid; gap: 12px; }
.footer-inner nav { display: flex; gap: 18px; flex-wrap: wrap; }

/* =============================================================
   5. Hero + tool card
   ============================================================= */
.hero { padding: 24px 0 8px; }
.eyebrow { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.hero h1 { font-family: var(--display); font-weight: 700; font-size: clamp(1.9rem, 6vw, 3rem); margin: 6px 0 6px; }
.lede { color: var(--muted); font-size: 1.02rem; margin-bottom: 18px; max-width: 46ch; }

.tool-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
}
.tool-inputs { padding: 18px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-content: start; }
.tool-result { padding: 18px; background: var(--accent-soft); }

.field-label { display: block; font-size: .82rem; font-weight: 700; margin-bottom: 6px; }
.money-input {
  display: flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 0 14px;
  background: var(--bg); transition: border-color .2s var(--ease-out);
}
.money-input:focus-within { border-color: var(--accent); }
.money-input span { color: var(--muted); font-weight: 700; }
.money-input .unit { font-size: .75rem; }
.money-input input {
  flex: 1; min-width: 0; border: 0; background: none; outline: none;
  font: 800 1.6rem/1 var(--sans); color: var(--ink); padding: 12px 0;
  font-variant-numeric: tabular-nums;
}
.hint { font-size: .8rem; color: var(--muted); margin-top: -8px; }

.segmented { border: 0; padding: 0; margin: 0; min-width: 0; min-inline-size: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.segmented legend { width: 100%; }
.segmented label { flex: 1 1 0; min-width: 0; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: block; text-align: center; cursor: pointer;
  padding: 9px 6px; border-radius: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1.5px solid var(--line);
  font-size: .9rem; font-weight: 600; transition: all .2s var(--ease-out);
}
.segmented label:hover span { border-color: var(--accent); }
.segmented input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.check { display: flex; align-items: center; gap: 10px; font-size: .92rem; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Estados */
.result-idle, .result-error, .result-done { display: none; }
.tool-card[data-state="idle"] .result-idle,
.tool-card[data-state="error"] .result-error,
.tool-card[data-state="done"] .result-done { display: block; }
.tool-card:not([data-js]) .result-idle { display: none; }
.result-idle p, .result-error p, .noscript { color: var(--muted); font-weight: 600; padding: 24px 0; text-align: center; }
.result-error p { color: var(--isr); }

.result-label { font-size: .82rem; font-weight: 700; color: var(--muted); }
.result-big {
  font: 700 clamp(2.2rem, 9vw, 3.1rem)/1.05 var(--display);
  color: var(--accent); font-variant-numeric: tabular-nums; margin: 2px 0 14px;
}
.result-big small { font: 600 .95rem var(--sans); color: var(--muted); }

.bar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--line); }
.bar span { height: 100%; transition: width .5s var(--ease-out); }
.bar-neto { background: var(--accent); }
.bar-isr { background: var(--isr); }
.bar-imss { background: var(--imss); }
.legend { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 12px; font-size: .82rem; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend b { color: var(--ink); font-variant-numeric: tabular-nums; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-neto { background: var(--accent); } .dot-isr { background: var(--isr); } .dot-imss { background: var(--imss); }

.note { background: var(--surface); border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 12px; font-size: .88rem; margin-bottom: 12px; }

.breakdown { display: grid; gap: 2px; font-size: .92rem; font-variant-numeric: tabular-nums; }
.breakdown div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed color-mix(in srgb, var(--muted) 30%, transparent); }
.breakdown .sub { font-size: .82rem; color: var(--muted); padding-left: 12px; }
.breakdown .total { border-bottom: 0; font-weight: 800; font-size: 1rem; }
.breakdown dd { font-weight: 600; text-align: right; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.stats div { background: var(--surface); border-radius: 10px; padding: 10px 12px; }
.stats span { display: block; font-size: .74rem; color: var(--muted); font-weight: 600; }
.stats b { font-variant-numeric: tabular-nums; font-size: .98rem; }

.btn-copy {
  width: 100%; padding: 12px; border-radius: 12px;
  background: var(--accent); color: var(--on-accent); font-weight: 700;
  transition: transform .2s var(--ease-out), filter .2s var(--ease-out);
}
.btn-copy:hover { filter: brightness(1.08); }
.btn-copy:active { transform: scale(.98); }

.trust { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: .86rem; font-weight: 600; color: var(--accent); }
.trust svg { flex: none; }
.disclaimer { font-size: .78rem; color: var(--muted); margin-top: 4px; }

/* =============================================================
   6. Content
   ============================================================= */
.ad-slot { margin: 32px 0; }
.ad-slot > span { display: none; } /* los anuncios automáticos de AdSense se colocan solos */

.content h2 { font-family: var(--display); font-size: clamp(1.5rem, 4vw, 2rem); margin: 40px 0 16px; }
.steps { list-style: none; padding: 0; display: grid; gap: 12px; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.steps svg { color: var(--accent); margin-bottom: 10px; }
.steps h3 { font-size: 1.02rem; margin-bottom: 4px; }
.steps p { color: var(--muted); font-size: .92rem; }

.prose { max-width: 70ch; }
.prose h3 { font-size: 1.1rem; margin: 22px 0 6px; }
.prose p { margin-bottom: 10px; color: color-mix(in srgb, var(--ink) 85%, var(--muted)); }

.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; max-width: 70ch; }
.faq summary { font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 1.3rem; line-height: 1; transition: transform .25s var(--ease-out); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin-top: 8px; color: var(--muted); }

.more-grid { list-style: none; padding: 0; display: grid; gap: 10px; }
.more-grid li { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.more-grid .soon span { font-size: .72rem; font-weight: 700; color: var(--muted); background: var(--bg); padding: 4px 8px; border-radius: 99px; white-space: nowrap; }

/* Páginas legales */
.legal { padding: 32px 0; max-width: 70ch; }
.legal h1 { font-family: var(--display); font-size: 2rem; margin-bottom: 16px; }
.legal h2 { font-size: 1.1rem; margin: 22px 0 6px; }
.legal p, .legal li { margin-bottom: 8px; color: color-mix(in srgb, var(--ink) 85%, var(--muted)); }
.legal .todo { background: #fff3c4; color: #5a4500; padding: 0 4px; border-radius: 4px; }

/* =============================================================
   8. Responsive
   ============================================================= */
@media (min-width: 720px) {
  .hero { padding-top: 40px; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .more-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-inner { grid-template-columns: 1fr auto; align-items: center; }
}
@media (min-width: 960px) {
  .tool-card { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
  .tool-inputs, .tool-result { padding: 26px; }
}

/* =============================================================
   9. Reduced motion
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .bar span { transition: none; }
}

/* =============================================================
   10. Herramientas adicionales (aguinaldo, vacaciones, finiquito)
   ============================================================= */
.field-input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 12px;
  background: var(--bg); color: var(--ink); font: 700 1rem var(--sans); outline: none;
  font-variant-numeric: tabular-nums; min-width: 0;
}
.field-input:focus { border-color: var(--accent); }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.row2 > div { min-width: 0; }
.opciones { border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; }
.opciones summary { font-size: .85rem; font-weight: 700; cursor: pointer; color: var(--muted); }
.opciones[open] summary { margin-bottom: 10px; }
.opciones > div { display: grid; gap: 12px; }
[hidden] { display: none !important; }

.nav-tools { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.nav-tools::-webkit-scrollbar { display: none; }
.nav-tools a {
  flex: none; font-size: .82rem; font-weight: 700; text-decoration: none; color: var(--muted);
  border: 1.5px solid var(--line); border-radius: 99px; padding: 6px 12px; background: var(--surface);
}
.nav-tools a:hover { color: var(--accent); border-color: var(--accent); }
.nav-tools a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.more-grid a { text-decoration: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; }
.more-grid li:has(a):hover { border-color: var(--accent); }
.more-grid .go { color: var(--accent); font-weight: 800; }
.more-grid small { display: block; color: var(--muted); font-weight: 500; font-size: .82rem; }

.tabla { width: 100%; max-width: 480px; border-collapse: collapse; font-size: .92rem; margin: 8px 0 12px; font-variant-numeric: tabular-nums; }
.tabla th, .tabla td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tabla th { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.tabla tr.is-current td { background: var(--accent-soft); font-weight: 800; color: var(--accent); }
