/* Calculadora de sueldo neto — estilos. Mobile-first, sin fuentes externas. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --text: #17202b;
  --text-muted: #4a5666;
  --border: #d5dce4;
  --primary: #0b5cad;
  --primary-strong: #084a8c;
  --primary-soft: #e3eefa;
  --focus: #f0a400;
  --warn-bg: #fff6e0;
  --warn-border: #e2b54a;
  --warn-text: #5c4300;
  --c-neto: #12805c;
  --c-ss: #0b5cad;
  --c-irpf: #c25e00;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 4px 16px rgb(16 24 40 / 6%);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141a;
    --surface: #171e27;
    --surface-2: #1f2833;
    --text: #e8edf3;
    --text-muted: #a9b5c3;
    --border: #2f3b49;
    --primary: #6aaef5;
    --primary-strong: #93c4f8;
    --primary-soft: #1c2c40;
    --warn-bg: #2d2513;
    --warn-border: #8a6d22;
    --warn-text: #f3dc9f;
    --c-neto: #3cc495;
    --c-ss: #5ea6f2;
    --c-irpf: #f0954a;
    --shadow: none;
    color-scheme: dark;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.6 var(--font);
}

img, svg { display: block; max-width: 100%; }

a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-strong); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  padding: 8px 12px;
  background: #084a8c;
  color: #fff;
  border-radius: 6px;
  z-index: 10;
}
.skip-link:focus { top: 8px; color: #fff; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Cabecera */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.brand svg { width: 28px; height: 28px; }
.site-header nav a { font-size: .9375rem; }

/* Cabecera de página */
.hero { padding: 24px 0 8px; }
h1 {
  font-size: clamp(1.625rem, 5vw, 2.25rem);
  line-height: 1.2;
  margin: 0 0 8px;
  letter-spacing: -.01em;
}
.lead { margin: 0; color: var(--text-muted); font-size: 1.0625rem; }

h2 { font-size: 1.5rem; line-height: 1.25; margin: 40px 0 12px; }
h3 { font-size: 1.1875rem; line-height: 1.3; margin: 28px 0 8px; }

/* Calculadora */
.calc {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}
@media (min-width: 880px) {
  .calc { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .results { position: sticky; top: 16px; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 16px;
}
@media (min-width: 480px) { .card { padding: 24px; } }

.card > h2:first-child { margin-top: 0; font-size: 1.25rem; }

fieldset {
  border: 0;
  margin: 0 0 20px;
  padding: 0;
  min-width: 0;
}
fieldset:last-of-type { margin-bottom: 0; }
legend {
  font-weight: 700;
  font-size: 1rem;
  padding: 0;
  margin-bottom: 10px;
}

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > label,
.field-label {
  display: block;
  font-weight: 600;
  font-size: .9375rem;
  margin-bottom: 4px;
}
.hint { display: block; color: var(--text-muted); font-size: .875rem; margin-top: 4px; }

.row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }

input[type="number"],
input[type="text"],
select {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid #8592a3;
  border-radius: 8px;
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
input:focus-visible, select:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }

.input-euro { position: relative; }
.input-euro input { padding-right: 36px; font-size: 1.25rem; font-weight: 600; }
.input-euro span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }

.segmented { display: flex; gap: 8px; }
.segmented label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  border: 1px solid #8592a3;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented input:checked + span { color: var(--primary-strong); }
.segmented label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.segmented label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 6px 0;
  cursor: pointer;
  font-size: .9375rem;
}
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--primary); }
.check[hidden] { display: none; }

.dyn-list { display: grid; gap: 10px; margin-top: 10px; }
.dyn-list:empty { display: none; }
.dyn-item { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; padding: 12px; background: var(--surface-2); border-radius: 8px; }
.dyn-item .field { margin: 0; }

.notice {
  border: 1px solid var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn-text);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: .9375rem;
  margin: 12px 0 0;
}
.notice[hidden] { display: none; }
.notice p { margin: 0; }
.notice p + p { margin-top: 6px; }

/* Resultados */
.results h2 { margin-top: 0; font-size: 1.25rem; }
.kpi-main {
  background: var(--primary-soft);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.kpi-main .label { font-weight: 600; color: var(--text-muted); font-size: .9375rem; }
.kpi-main .value { display: block; font-size: clamp(2rem, 9vw, 2.75rem); font-weight: 800; line-height: 1.15; color: var(--text); font-variant-numeric: tabular-nums; }
.kpi-main .sub { font-size: .875rem; color: var(--text-muted); }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.kpi { background: var(--surface-2); border-radius: 10px; padding: 12px; }
.kpi .label { display: block; font-size: .8125rem; color: var(--text-muted); font-weight: 600; }
.kpi .value { display: block; font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .hint { margin-top: 0; }
.kpis .kpi:first-child:nth-last-child(3) { grid-column: 1 / -1; }

.chart-wrap { display: grid; grid-template-columns: 132px 1fr; gap: 16px; align-items: center; margin: 20px 0 8px; }
.chart-wrap svg { width: 132px; height: 132px; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: .9375rem; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend .dot { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.legend .pct { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .9375rem; font-variant-numeric: tabular-nums; }
caption { text-align: left; font-weight: 700; padding-bottom: 8px; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: right; vertical-align: top; }
th:first-child, td:first-child { text-align: left; }
td { white-space: nowrap; }
td.texto, th.texto, .legal td { white-space: normal; text-align: left; }
thead th { font-size: .8125rem; color: var(--text-muted); font-weight: 700; }
tbody th { font-weight: 400; }
tr.total th, tr.total td { font-weight: 700; border-bottom: 2px solid var(--border); }
tr.group th { padding-top: 14px; font-weight: 700; }
.breakdown td small { display: block; color: var(--text-muted); font-size: .8125rem; }

.disclaimer {
  margin-top: 16px;
  font-size: .875rem;
  color: var(--text-muted);
  border-left: 3px solid var(--primary);
  padding-left: 10px;
}

details.more { margin-top: 12px; font-size: .9375rem; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--primary); min-height: 32px; }

/* Resumen fijo en móvil */
.sticky-sum {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 10px 16px;
  background: #084a8c;
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgb(0 0 0 / 25%);
  text-decoration: none;
  font-size: 1rem;
}
.sticky-sum:hover { color: #fff; }
.sticky-sum strong { font-size: 1.125rem; font-variant-numeric: tabular-nums; }
.sticky-sum .sticky-cta { font-size: .875rem; white-space: nowrap; text-decoration: underline; }
.sticky-sum[hidden] { display: none; }
@media (min-width: 880px) { .sticky-sum { display: none !important; } }

/* Espacios publicitarios: altura reservada para evitar saltos de diseño (CLS) */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  margin: 28px auto;
  max-width: 100%;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: .75rem;
  overflow: hidden;
}
@media (min-width: 768px) { .ad-slot { min-height: 250px; } }
/* Mientras un hueco no tenga su bloque <ins class="adsbygoogle">, no se muestra */
.ad-slot:not(:has(ins)) { display: none; }

/* Contenido */
.content { max-width: 760px; }
.content p, .content li { color: var(--text); }
.content table { margin: 12px 0 4px; }
.content .table-note { font-size: .875rem; color: var(--text-muted); margin-top: 4px; }

.faq details {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  padding: 0 16px;
  margin-bottom: 10px;
}
.faq summary {
  cursor: pointer;
  font-weight: 700;
  padding: 14px 0;
  list-style-position: outside;
}
.faq summary h3 { display: inline; font-size: 1rem; margin: 0; }
.faq details p { margin: 0 0 14px; }

/* Pie */
.site-footer {
  margin-top: 48px;
  padding: 24px 0 32px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: .9375rem;
  color: var(--text-muted);
}
.site-footer ul { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.site-footer a { display: inline-block; padding: 4px 0; }
.site-footer p { margin: 6px 0; }

/* Navegación del sitio y páginas de sueldos */
.site-header .container { flex-wrap: wrap; gap: 0 16px; }
.site-nav { display: flex; gap: 4px 18px; flex-wrap: wrap; }
.site-nav a { padding: 6px 0; font-size: .9375rem; color: var(--text-muted); text-decoration: none; }
.site-nav a:hover { color: var(--primary); }
.site-nav a[aria-current="page"] { color: var(--primary); font-weight: 700; box-shadow: inset 0 -2px 0 var(--primary); }
@media (max-width: 559px) {
  .site-nav { width: 100%; padding-bottom: 6px; justify-content: space-between; }
}

/* Selector «de bruto a neto / de neto a bruto» encima de las calculadoras */
.modo {
  display: inline-flex;
  margin-top: 16px;
  padding: 4px;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 100%;
}
.modo a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 14px;
  border-radius: 9px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: .9375rem;
  text-decoration: none;
  white-space: nowrap;
}
.modo a:hover { color: var(--text); }
.modo a[aria-current="page"] { background: var(--surface); color: var(--primary-strong); box-shadow: var(--shadow), 0 0 0 1px var(--border); }

.breadcrumbs { padding-top: 16px; font-size: .875rem; color: var(--text-muted); }
.breadcrumbs a { color: var(--text-muted); }

.resumen { margin-top: 16px; }
@media (min-width: 720px) { .kpis-4 { grid-template-columns: repeat(4, 1fr); } }
.kpis-4 { margin-top: 0; }
.cta { margin: 16px 0 0; text-align: center; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 20px;
  border-radius: 10px;
  background: #084a8c;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
.button:hover { background: #063a6e; color: #fff; }

.pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; margin: 28px 0 8px; }
.pager a { display: inline-block; padding: 8px 0; font-weight: 600; }

/* Páginas legales */
.legal { max-width: 760px; padding-bottom: 24px; }
.legal .placeholder { background: var(--warn-bg); color: var(--warn-text); padding: 0 4px; border-radius: 4px; }
