/* ============================================================
   1. Reset + variables
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }

/* Los elementos con [hidden] deben ocultarse siempre, incluso si otra regla
   de esta hoja (p. ej. .result-zone, .tf-subsection) también define su
   display — si no, [hidden] pierde por especificidad y el elemento se ve
   igual aunque el JS lo haya marcado como oculto. */
[hidden] { display: none !important; }

:root {
  --bg: #0f1720;
  --surface: #16212c;
  --surface-2: #1d2b38;
  --cream: #f4f7f9;
  --text: #e7edf1;
  --text-dim: #9fb0bd;
  --accent: #35c48f;
  --accent-dark: #229c6f;
  --border: #29394a;
  --danger: #e2725b;

  --sans: "Inter", system-ui, sans-serif;
  --display: "Manrope", var(--sans);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f7f9;
    --surface: #ffffff;
    --surface-2: #eef2f5;
    --cream: #0f1720;
    --text: #16212c;
    --text-dim: #4b5c6b;
    --border: #dbe3e9;
  }
}

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-y: none;
}

img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; line-height: 1.1; letter-spacing: -0.02em; font-family: var(--display); }

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

.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--accent); color: #05170f;
  z-index: 9999; border-radius: 8px; font-weight: 700;
}
.skip-link:focus { top: 1rem; }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 1.25rem; }

/* ============================================================
   2. Header / footer
   ============================================================ */
.site-header { border-bottom: 1px solid var(--border); padding: 1rem 0; }
.header-inner { display: flex; align-items: center; justify-content: space-between; }
.logo { font-family: var(--display); font-weight: 800; font-size: 1.1rem; }
.logo span { color: var(--accent); }
.header-nav a { font-size: .9rem; color: var(--text-dim); }
.header-nav a:hover { color: var(--accent); }

.tools-menu { position: relative; }
.tools-menu summary {
  list-style: none; cursor: pointer;
  font-size: .9rem; color: var(--text-dim); font-weight: 600;
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .3rem .5rem; border-radius: 8px;
}
.tools-menu summary::-webkit-details-marker { display: none; }
.tools-menu summary::after { content: "▾"; font-size: .75rem; }
.tools-menu[open] summary, .tools-menu summary:hover { color: var(--accent); }
.tools-menu-list {
  position: absolute; right: 0; top: calc(100% + .5rem);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: .4rem; min-width: 180px;
  display: flex; flex-direction: column; gap: .1rem;
  box-shadow: 0 12px 30px rgba(0,0,0,.25); z-index: 20;
}
.tools-menu-list a {
  padding: .55rem .7rem; border-radius: 8px; font-size: .9rem;
  color: var(--text); white-space: nowrap;
}
.tools-menu-list a:hover { background: var(--surface-2); color: var(--accent); }

.site-footer { border-top: 1px solid var(--border); padding: 2rem 0; margin-top: 3rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; font-size: .85rem; color: var(--text-dim); }
.footer-inner nav { display: flex; gap: 1.25rem; }
.footer-inner a:hover { color: var(--accent); }

/* ============================================================
   3. Hero + tool card
   ============================================================ */
.hero { padding: 2.5rem 0 1rem; text-align: center; }
.hero h1 { font-size: clamp(1.75rem, 5vw, 2.5rem); margin-bottom: .5rem; }
.subtitle { color: var(--text-dim); max-width: 46ch; margin: 0 auto 1.75rem; }

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.75rem;
  max-width: 480px;
  margin: 0 auto;
  text-align: left;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
}

.tool-form { display: flex; flex-direction: column; gap: 1.25rem; }
.field { display: flex; flex-direction: column; gap: .4rem; }
.field label { font-weight: 600; font-size: .9rem; }
.field small { color: var(--text-dim); font-size: .78rem; }

.input-prefix, .input-suffix {
  display: flex; align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 .9rem;
  transition: border-color .2s var(--ease-out);
}
.input-prefix:focus-within, .input-suffix:focus-within { border-color: var(--accent); }
.input-prefix span, .input-suffix span { color: var(--text-dim); font-weight: 600; }
.input-prefix input, .input-suffix input {
  flex: 1; border: 0; background: transparent; color: var(--text);
  padding: .8rem .5rem; font-size: 1.1rem; font-weight: 600; width: 100%;
}
.input-prefix input:focus, .input-suffix input:focus { outline: none; }

.btn-primary {
  background: var(--accent); color: #05170f;
  font-weight: 700; font-size: 1rem;
  padding: .9rem 1.5rem; border-radius: 12px;
  transition: transform .15s var(--ease-out), background .2s var(--ease-out);
}
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); }

.btn-secondary {
  border: 1px solid var(--border);
  padding: .7rem 1.25rem; border-radius: 10px;
  font-size: .9rem; color: var(--text-dim);
  align-self: center;
}
.btn-secondary:hover { color: var(--text); border-color: var(--accent); }

.result { margin-top: 1.5rem; text-align: center; display: flex; flex-direction: column; gap: 1rem; }
.result h2 { font-size: 1rem; color: var(--text-dim); font-weight: 600; }
.result-neto { font-size: clamp(1.8rem, 6vw, 2.4rem); font-weight: 800; color: var(--accent); font-family: var(--display); }

.result-breakdown { display: flex; flex-direction: column; gap: .5rem; text-align: left; }
.breakdown-row {
  display: flex; justify-content: space-between; font-size: .9rem;
  padding: .5rem .75rem; background: var(--surface-2); border-radius: 8px;
}
.breakdown-row.total { font-weight: 700; border: 1px solid var(--accent); }
.breakdown-row span:last-child { color: var(--text-dim); }
.breakdown-row.total span:last-child { color: var(--accent); }

.result-bar {
  display: flex; height: 10px; border-radius: 999px; overflow: hidden;
  background: var(--surface-2);
}
.result-bar .seg { height: 100%; }

.tool-note { font-size: .78rem; color: var(--text-dim); margin-top: 1.25rem; text-align: center; }

/* ============================================================
   4. Ad slots
   ============================================================ */
.ad-slot {
  max-width: 960px; margin: 2rem auto; min-height: 90px;
  border: 1px dashed var(--border); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: .8rem; letter-spacing: .05em;
  text-transform: uppercase;
}

/* ============================================================
   5. Content sections
   ============================================================ */
.content-section { padding: 2rem 0; }
.content-section h2 { font-size: 1.4rem; margin-bottom: 1rem; }

.steps { list-style: none; display: grid; gap: 1rem; margin-bottom: 2rem; counter-reset: step; }
.steps li {
  counter-increment: step;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 1.1rem 1.25rem 1.1rem 3.25rem; position: relative;
}
.steps li::before {
  content: counter(step);
  position: absolute; left: 1.1rem; top: 1.1rem;
  width: 1.6rem; height: 1.6rem; border-radius: 50%;
  background: var(--accent); color: #05170f;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .85rem;
}
.steps li strong { display: block; margin-bottom: .2rem; }
.steps li p { color: var(--text-dim); font-size: .9rem; }

.seo-text p { margin-bottom: 1rem; color: var(--text-dim); max-width: 70ch; }
.seo-text strong { color: var(--text); }

.faq-list details {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 1rem 1.25rem; margin-bottom: .75rem; background: var(--surface);
}
.faq-list summary { font-weight: 600; cursor: pointer; }
.faq-list p { margin-top: .6rem; color: var(--text-dim); font-size: .92rem; }

.tools-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.tool-link-card {
  border: 1px solid var(--border); border-radius: 14px; padding: 1.1rem 1.25rem;
  display: flex; flex-direction: column; gap: .25rem;
  background: var(--surface); transition: border-color .2s var(--ease-out);
}
.tool-link-card:hover { border-color: var(--accent); }
.tool-link-card span { color: var(--text-dim); font-size: .85rem; }
.tool-link-card--soon { opacity: .55; pointer-events: none; }

/* ============================================================
   6. Breakpoints
   ============================================================ */
@media (min-width: 540px) {
  .tools-grid { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   8. Radio group (tipo de actividad)
   ============================================================ */
.radio-group { display: flex; gap: .75rem; }
.radio-option {
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: .5rem; padding: .8rem 1rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; cursor: pointer; font-weight: 600; font-size: .92rem;
  transition: border-color .2s var(--ease-out);
}
.radio-option:has(input:checked) { border-color: var(--accent); color: var(--accent); }
.radio-option input { accent-color: var(--accent); }

/* ============================================================
   9. Tabla de categorías
   ============================================================ */
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; }
.tabla-monotributo { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 560px; }
.tabla-monotributo th, .tabla-monotributo td { padding: .7rem 1rem; text-align: left; white-space: nowrap; }
.tabla-monotributo thead th {
  background: var(--surface-2); color: var(--text-dim);
  font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
}
.tabla-monotributo tbody tr { border-top: 1px solid var(--border); }
.tabla-monotributo tbody tr.row-highlight { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tabla-monotributo td:first-child { font-weight: 700; }
/* ============================================================
   10. Componentes propios de la calculadora RG 830
   (fieldset con checkboxes, subsecciones, pills, etc.)
   ============================================================ */

/* Alias de layout: esta página usa nombres de clase distintos
   a sueldo-neto/monotributo para las mismas piezas visuales. */
.header-row { display: flex; align-items: center; justify-content: space-between; }
.footer-row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; font-size: .85rem; color: var(--text-dim); }
.footer-row nav { display: flex; gap: 1.25rem; align-items: center; }
.footer-row a:hover { color: var(--accent); }
.footer-break { display: block; }
.footer-contact { display: inline-block; margin-top: .25rem; }

.content-block { padding: 2rem 0; }
.content-block h2 { font-size: 1.4rem; margin-bottom: 1rem; }

.hero-sub { color: var(--text-dim); max-width: 52ch; margin: 0 auto 1.75rem; text-align: center; }

.seo-copy p { margin-bottom: 1rem; color: var(--text-dim); max-width: 70ch; }
.seo-copy strong { color: var(--text); }

/* Fieldsets ("1. Datos del pago", "2. Ganancias", "3. IIBB") */
.tf-section {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  min-width: 0; /* evita que el fieldset fuerce overflow por su ancho mínimo por defecto */
}
.tf-section:last-of-type { margin-bottom: 1.5rem; }
.tf-section legend {
  padding: 0 .4rem;
  font-weight: 700;
  font-size: .95rem;
  margin: 0 0 .5rem -0.4rem;
}

.grid-2 {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  min-width: 0;
}

/* Inputs y selects sueltos dentro de .field (no todos están dentro de .input-prefix) */
.field { min-width: 0; }
.field input,
.field select {
  width: 100%;
  min-width: 0;
  padding: .8rem .9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: .95rem;
  font-family: inherit;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); }

/* Checkbox que actúa como interruptor de una sección ("2. Calcular retención de...") */
.toggle-check {
  display: flex; align-items: center; gap: .6rem;
  cursor: pointer; font-size: 1rem; font-weight: 700;
}
.toggle-check input { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }

.tf-subsection {
  margin-top: 1rem; padding-top: 1rem;
  border-top: 1px dashed var(--border);
  display: flex; flex-direction: column; gap: 1rem;
  min-width: 0;
}

.field-inline { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.field-inline > span { font-weight: 600; font-size: .9rem; margin-right: .3rem; }

.radio-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem .9rem; border: 1px solid var(--border); border-radius: 999px;
  font-size: .85rem; cursor: pointer; background: var(--surface-2);
  transition: border-color .2s var(--ease-out);
}
.radio-pill:has(input:checked) { border-color: var(--accent); color: var(--accent); }
.radio-pill input { accent-color: var(--accent); }

.hint { font-size: .8rem; color: var(--text-dim); margin-top: .5rem; }

/* Resultado (nombres propios de esta página) */
.result-zone { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 1rem; text-align: center; }
.result-zone h2 { font-size: 1rem; color: var(--text-dim); font-weight: 600; }
.result-actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; }

/* Desglose por impuesto (Ganancias / ARBA / AGIP) dentro del resultado */
#result-body { display: flex; flex-direction: column; gap: 1rem; text-align: left; }
.result-block {
  border: 1px solid var(--border); border-radius: 14px;
  padding: 1.1rem 1.25rem; background: var(--surface); text-align: left;
}
.result-block h3 {
  font-size: .95rem; font-weight: 700; margin-bottom: .75rem;
  font-family: var(--display); letter-spacing: -0.01em;
}
.result-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  font-size: .88rem; padding: .55rem .75rem; margin-bottom: .4rem;
  background: var(--surface-2); border-radius: 8px;
}
.result-row:last-of-type { margin-bottom: 0; }
.result-row .lbl { color: var(--text-dim); }
.result-row span:last-child { font-weight: 600; text-align: right; }
.result-row.total {
  margin-top: .6rem; background: transparent; border: 1px solid var(--accent);
  font-weight: 700;
}
.result-row.total span:last-child { color: var(--accent); font-size: 1rem; }

.grand-total {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: 1.1rem 1.25rem; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--accent);
}
.grand-total span:first-child { font-weight: 700; }
.grand-total .amount {
  font-size: clamp(1.4rem, 5vw, 1.8rem); font-weight: 800;
  color: var(--accent); font-family: var(--display);
}

.btn-link { font-size: .85rem; color: var(--text-dim); text-decoration: underline; }
.btn-link:hover { color: var(--accent); }

.result-note { font-size: .8rem; color: var(--text-dim); margin-top: .5rem; }
.result-note--warn {
  background: rgba(226, 114, 91, .12);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border: 1px solid var(--danger); color: var(--danger);
  border-radius: 10px; padding: .6rem .75rem; font-size: .85rem;
  margin-bottom: .6rem; margin-top: 0; text-align: left;
}

.apoyo-slot { text-align: center; font-size: .85rem; color: var(--text-dim); margin-top: 1rem; }
.apoyo-boton img { display: inline-block; height: 40px; vertical-align: middle; margin-left: .4rem; }

.privacy-badge, .honesty-note {
  max-width: 480px; margin: .75rem auto 0;
  text-align: center; font-size: .78rem; color: var(--text-dim);
}
.honesty-note a { color: var(--accent); text-decoration: underline; }

/* Espacios de anuncio (nombre propio de esta página, equivalente a .ad-slot) */
.promo-espacio {
  max-width: 960px; margin: 2rem auto; min-height: 90px;
  border: 1px dashed var(--border); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: .8rem; letter-spacing: .05em;
  text-transform: uppercase;
}
.promo-espacio--dialogo { max-width: none; margin: 1rem 0; min-height: 160px; }

.corner-toast {
  position: fixed; bottom: 1rem; right: 1rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 1rem 2.5rem 1rem 1rem; max-width: 280px;
  box-shadow: 0 12px 30px rgba(0,0,0,.3); z-index: 50;
}
.corner-toast__close {
  position: absolute; top: .5rem; right: .5rem;
  font-size: 1.2rem; color: var(--text-dim); line-height: 1;
}

.download-dialog { border: none; border-radius: 16px; padding: 1.5rem; background: var(--surface); color: var(--text); max-width: 480px; width: 92vw; position: relative; }
.download-dialog::backdrop { background: rgba(0,0,0,.6); }
.download-dialog__close { position: absolute; top: .75rem; right: .75rem; font-size: 1.3rem; color: var(--text-dim); }
.download-dialog__label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); margin-bottom: .75rem; }
.pdf-preview-frame {
  width: 100%; height: 340px; border: 1px solid var(--border); border-radius: 10px;
  background: #fff; margin-top: .75rem;
}

/* Pasos de "Cómo funciona" con ícono SVG propio (en vez del numerito
   en círculo que usan sueldo-neto/monotributo): se anula el contador
   y se estiliza el ícono para que no queden espacios raros. */
.steps li:has(svg) { padding: 1.1rem 1.25rem; }
.steps li:has(svg)::before { content: none; }
.steps li svg {
  width: 28px; height: 28px; margin-bottom: .6rem;
  stroke: var(--accent); fill: none; stroke-width: 2;
}
.steps li h3 { font-size: 1rem; margin-bottom: .3rem; }

@media (min-width: 640px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   11. Reduced motion
/* ============================================================
   12. Tabs (convenio multilateral)
   ============================================================ */
.tabs { display: flex; gap: .5rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.tab-btn {
  padding: .8rem 1rem; font-weight: 700; font-size: .92rem;
  color: var(--text-dim); border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel[hidden] { display: none; }

/* ============================================================
   13. Tabla de jurisdicciones (filas dinámicas)
   ============================================================ */
.tabla-jurisdicciones-wrap { overflow-x: auto; margin-bottom: 1rem; }
.tabla-jurisdicciones { width: 100%; border-collapse: collapse; min-width: 520px; }
.tabla-jurisdicciones th {
  text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-dim); padding: .5rem .5rem;
}
.tabla-jurisdicciones td { padding: .4rem .5rem; vertical-align: middle; }
.tabla-jurisdicciones select,
.tabla-jurisdicciones input {
  width: 100%; padding: .55rem .6rem; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: .9rem;
}
/* El menú desplegable nativo del <select> lo dibuja el sistema operativo con
   fondo claro casi siempre, sin importar el tema de la página — si el texto
   queda en un color claro (como --text en el tema oscuro), las opciones se
   ven "vacías". Fijamos un color oscuro explícito para las opciones. */
.tabla-jurisdicciones select option {
  color: #16212c;
  background: #ffffff;
}
.btn-quitar-fila {
  color: var(--danger); font-size: 1.1rem; font-weight: 700; padding: .3rem .5rem;
}
.btn-quitar-fila:hover { background: var(--surface-2); border-radius: 8px; }

.btn-agregar-fila {
  border: 1px dashed var(--border); border-radius: 10px;
  padding: .6rem 1rem; font-size: .88rem; color: var(--text-dim);
  margin-bottom: 1.25rem;
}
.btn-agregar-fila:hover { color: var(--accent); border-color: var(--accent); }

.coef-resultado-row td { font-weight: 600; }

/* Tarjetas de carga de jurisdicción (paso 1 de Convenio Multilateral).
   A propósito NO usan un contenedor con overflow-x, porque varios
   navegadores recortan/rompen el menú nativo de un <select> cuando
   vive dentro de un contenedor con scroll horizontal. */
.filas-jurisdiccion-lista { display: flex; flex-direction: column; gap: .9rem; margin-bottom: 1.25rem; }
.fila-jurisdiccion-card {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 1rem; background: var(--surface-2);
}
.fila-jurisdiccion-card__fields {
  display: grid; gap: .75rem; grid-template-columns: 1fr;
}
@media (min-width: 480px) {
  .fila-jurisdiccion-card__fields { grid-template-columns: 1.3fr 1fr 1fr; }
}
.fila-jurisdiccion-card__fields label {
  display: flex; flex-direction: column; gap: .3rem;
  font-size: .78rem; color: var(--text-dim); font-weight: 600;
}
.fila-jurisdiccion-card select,
.fila-jurisdiccion-card input {
  width: 100%; padding: .6rem .65rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: .9rem;
}
.fila-jurisdiccion-card select option { color: #16212c; background: #ffffff; }
.btn-quitar-fila-card {
  margin-top: .6rem; font-size: .8rem; color: var(--danger); font-weight: 600;
}
.btn-quitar-fila-card:hover { text-decoration: underline; }

/* ============================================================
   14. Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
}
