/* Calculadora Salarial SV — UI profesional (paleta STC) */

:root {
  --stc-verde: #035E3D;
  --stc-verde-tinta: #06281B;
  --stc-verde-suave: #0B4A30;
  --stc-dorado: #FCD800;
  --stc-papel: #F6F5F0;
  --stc-linea: #E2E0D6;
  --stc-tinta: #16201A;
  --stc-gris: #5B6A61;
  --stc-blanco: #FFFFFF;
  --stc-sombra: 0 10px 30px rgba(6, 40, 27, 0.08);
  --stc-radio: 14px;
}

html { scroll-behavior: smooth; }

body {
  color: var(--stc-tinta);
  background: var(--stc-papel) !important;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--stc-dorado);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 100;
  width: auto;
  height: auto;
  padding: 0.75rem 1rem;
  background: var(--stc-verde);
  color: #fff;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}

input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

button { -webkit-tap-highlight-color: transparent; }

/* Sidebar STC */
#sidebar {
  background: var(--stc-verde-tinta) !important;
  border-right: 1px solid rgba(252, 216, 0, 0.12);
}
#sidebar .border-gray-700,
#topbar {
  border-color: rgba(255, 255, 255, 0.1) !important;
}
#topbar {
  background: var(--stc-verde-tinta) !important;
}

.mod-item {
  border-radius: 10px;
  transition: background 0.15s ease, color 0.15s ease;
}
.mod-item:hover { background: rgba(255, 255, 255, 0.06); }
.mod-item.active {
  background: var(--stc-verde) !important;
  color: #fff !important;
}
.mod-item.active .mod-sub { color: rgba(255, 255, 255, 0.72) !important; }

.btn-rol.active,
.btn-sect.active {
  background: var(--stc-verde) !important;
  border-color: var(--stc-dorado) !important;
  color: #fff !important;
}

/* Paneles de contenido */
#moduleHeader .bg-white,
#formPanel,
#resultPanel > .bg-white {
  border-color: var(--stc-linea) !important;
  box-shadow: var(--stc-sombra) !important;
  border-radius: var(--stc-radio) !important;
}

/* CTA principal */
#calcFooter button {
  background: linear-gradient(135deg, var(--stc-dorado), #E8C400) !important;
  color: var(--stc-verde-tinta) !important;
  font-weight: 800 !important;
  border-radius: 999px !important;
  box-shadow: 0 8px 20px rgba(252, 216, 0, 0.28) !important;
}
#calcFooter button:hover {
  background: linear-gradient(135deg, #FFE23A, var(--stc-dorado)) !important;
}

/* Aviso legal — discreto, no grita */
.aviso-legal {
  border: 1px solid var(--stc-linea);
  background: #fff;
  color: var(--stc-gris);
  border-radius: 10px;
  font-size: 0.75rem;
  line-height: 1.45;
  padding: 0.65rem 0.9rem;
}

/* Banner temporal de actualizacion */
.update-banner {
  position: sticky;
  top: 0;
  z-index: 60;
  background: linear-gradient(135deg, #06281B 0%, #035E3D 100%);
  color: #fff;
  border-bottom: 2px solid #FCD800;
  box-shadow: 0 6px 18px rgba(6, 40, 27, 0.18);
}
.update-banner[hidden] { display: none !important; }
.update-banner__inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.7rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  justify-content: space-between;
}
.update-banner__text {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.4;
  flex: 1 1 16rem;
}
.update-banner__text strong { color: #FCD800; }
.update-banner__hint {
  display: inline;
  opacity: 0.8;
  font-size: 0.78rem;
}
.update-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  flex: 0 0 auto;
}
.update-banner__btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  font-weight: 800;
  font-size: 0.82rem;
  color: #06281B;
  background: #FCD800;
}
.update-banner__btn:hover { filter: brightness(1.05); }
.update-banner__dismiss {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  color: #fff;
  cursor: pointer;
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-weight: 600;
  font-size: 0.8rem;
}
.update-banner__dismiss:hover { background: rgba(255, 255, 255, 0.1); }
@media (max-width: 1023px) {
  .update-banner { top: 3.25rem; } /* debajo del topbar movil */
}

/* Tipografía de títulos de módulo */
#mhTitulo {
  font-family: Archivo, Inter, system-ui, sans-serif;
  letter-spacing: -0.02em;
  color: var(--stc-verde-tinta) !important;
}

/* Badges */
#mhRol {
  background: #e8f5ee !important;
  color: var(--stc-verde) !important;
}

/* Marca en sidebar */
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--stc-verde), #0a7a4d);
  color: var(--stc-dorado);
  font-weight: 900;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.text-teal-400 { color: #7dd3b0 !important; }
.bg-teal-600 { background-color: var(--stc-verde) !important; }
.bg-teal-100 { background-color: #e8f5ee !important; }
.text-teal-700 { color: var(--stc-verde) !important; }

.print-only { display: none !important; }

/* Sector económico — panel retráctil */
.sector-toggle {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(252, 216, 0, 0.22);
  color: inherit;
  cursor: pointer;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.sector-toggle:hover {
  border-color: rgba(252, 216, 0, 0.55);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 1px rgba(252, 216, 0, 0.15);
}
.sector-expand-cue {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 3.25rem;
}
.sector-expand-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #FCD800;
  line-height: 1;
}
.sector-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55rem;
  height: 1.55rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #FCD800;
  color: #06281B;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(252, 216, 0, 0.35);
}
.sector-chevron {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #06281B;
  background: #FCD800;
  transition: transform 0.2s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 10px rgba(252, 216, 0, 0.4);
}
.sector-toggle.is-open {
  border-color: rgba(252, 216, 0, 0.65);
  background: rgba(252, 216, 0, 0.08);
}
.sector-toggle.is-open .sector-expand-label { color: #fff; }
.sector-toggle.is-open .sector-chevron {
  transform: rotate(180deg);
  background: #fff;
  color: #035E3D;
}
.sector-panel {
  overflow: hidden;
  transition: opacity 0.15s ease;
}
.sector-panel.is-collapsed {
  display: none;
}

/* Bienvenida */
.welcome-panel {
  max-width: 720px;
  margin: 0 auto;
}
.welcome-card {
  background: #fff;
  border: 1px solid var(--stc-linea);
  border-radius: 18px;
  box-shadow: var(--stc-sombra);
  padding: clamp(1.5rem, 4vw, 2.4rem);
}
.welcome-kicker {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--stc-verde);
  background: #e8f5ee;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  margin-bottom: 0.85rem;
}
.welcome-title {
  font-family: Archivo, Inter, system-ui, sans-serif;
  font-size: clamp(1.6rem, 3.5vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--stc-verde-tinta);
  margin: 0 0 0.55rem;
}
.welcome-lead {
  margin: 0 0 1.4rem;
  color: var(--stc-gris);
  font-size: 0.98rem;
  line-height: 1.55;
  max-width: 38rem;
}
.welcome-steps {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}
.welcome-steps li {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--stc-linea);
  border-radius: 12px;
  background: var(--stc-papel);
}
.welcome-step-num {
  flex: 0 0 auto;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--stc-verde);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
}
.welcome-steps strong {
  display: block;
  color: var(--stc-tinta);
  font-size: 0.92rem;
  margin-bottom: 0.15rem;
}
.welcome-steps span {
  display: block;
  color: var(--stc-gris);
  font-size: 0.84rem;
  line-height: 1.4;
}
.welcome-steps em {
  font-style: normal;
  font-weight: 700;
  color: var(--stc-verde);
}
.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1.1rem;
}
.welcome-cta {
  appearance: none;
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 0.75rem 1.25rem;
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--stc-verde-tinta);
  background: linear-gradient(135deg, var(--stc-dorado), #E8C400);
  box-shadow: 0 8px 18px rgba(252, 216, 0, 0.28);
}
.welcome-cta:hover { filter: brightness(1.04); }
.welcome-secondary {
  appearance: none;
  border: 1.5px solid var(--stc-verde);
  background: #fff;
  color: var(--stc-verde);
  cursor: pointer;
  border-radius: 999px;
  padding: 0.72rem 1.15rem;
  font-weight: 700;
  font-size: 0.9rem;
}
.welcome-secondary:hover { background: #e8f5ee; }
.welcome-note {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--stc-gris);
}

@keyframes sidebarPulse {
  0%, 100% { box-shadow: none; }
  40% { box-shadow: inset 0 0 0 2px rgba(252, 216, 0, 0.85); }
}
.sidebar-pulse {
  animation: sidebarPulse 0.7s ease 2;
}

/* Botón PDF en pantalla */
.btn-pdf {
  background: linear-gradient(135deg, var(--stc-dorado), #E8C400);
  color: var(--stc-verde-tinta);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(252, 216, 0, 0.28);
}
.btn-pdf:hover { filter: brightness(1.04); }

/* Documento PDF — oculto en pantalla */
.pdf-document {
  display: none;
}

/* ─── Documento PDF / impresión carta (configuración exacta) ─────────── */
@page {
  size: letter portrait;
  margin: 14mm 16mm 16mm 16mm;
}

@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  html, body {
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }

  body.print-pdf-mode #app-root,
  body.print-pdf-mode .skip-link,
  body.print-pdf-mode #welcomePanel {
    display: none !important;
  }

  body.print-pdf-mode .pdf-document {
    display: block !important;
  }

  .pdf-page {
    font-family: Inter, "Segoe UI", system-ui, sans-serif;
    color: #16201A;
    font-size: 10pt;
    line-height: 1.4;
  }

  .pdf-masthead {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 10px;
  }

  .pdf-brand {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .pdf-mark {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #035E3D;
    color: #FCD800;
    font-weight: 800;
    font-size: 11pt;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .pdf-brand-name {
    font-family: Archivo, Inter, sans-serif;
    font-weight: 800;
    font-size: 13pt;
    color: #06281B;
    letter-spacing: -0.02em;
  }

  .pdf-brand-sub {
    font-size: 8.5pt;
    color: #5B6A61;
    margin-top: 1px;
  }

  .pdf-meta {
    text-align: right;
    font-size: 8.5pt;
    color: #405267;
    display: grid;
    gap: 6px;
  }

  .pdf-label {
    font-size: 7.5pt;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #5B6A61;
  }

  .pdf-rule {
    height: 2px;
    background: linear-gradient(90deg, #035E3D 0%, #FCD800 55%, #E2E0D6 100%);
    margin: 8px 0 14px;
  }

  .pdf-title-block {
    margin-bottom: 12px;
  }

  .pdf-h1 {
    font-family: Archivo, Inter, sans-serif;
    font-size: 16pt;
    font-weight: 800;
    color: #06281B;
    margin: 0 0 4px;
    letter-spacing: -0.02em;
  }

  .pdf-lead {
    margin: 0;
    font-size: 9pt;
    color: #5B6A61;
  }

  .pdf-subject {
    margin-top: 10px;
    padding: 8px 10px;
    border: 1px solid #E2E0D6;
    border-left: 3px solid #035E3D;
    border-radius: 6px;
    background: #F6F5F0;
  }

  .pdf-subject-value {
    font-size: 11pt;
    font-weight: 700;
    color: #16201A;
    margin-top: 2px;
  }

  .pdf-body {
    font-size: 9.5pt;
  }

  .pdf-body .text-sm { font-size: 9.5pt !important; }
  .pdf-body .text-xs { font-size: 8.5pt !important; }
  .pdf-body .text-xl { font-size: 12pt !important; font-weight: 700 !important; }
  .pdf-body .mb-4 { margin-bottom: 8px !important; }
  .pdf-body .mb-3 { margin-bottom: 6px !important; }
  .pdf-body .rounded-xl,
  .pdf-body .rounded-lg { border-radius: 4px !important; }
  .pdf-body table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 9pt !important;
  }
  .pdf-body th,
  .pdf-body td {
    padding: 4px 6px !important;
    border-bottom: 1px solid #E2E0D6 !important;
  }
  .pdf-body .bg-gray-800 {
    background: #06281B !important;
    color: #fff !important;
  }
  .pdf-body .bg-teal-50,
  .pdf-body .bg-teal-100 {
    background: #e8f5ee !important;
  }

  .pdf-sign {
    margin-top: 18px;
    page-break-inside: avoid;
  }

  .pdf-sign-box {
    border: 1px solid #E2E0D6;
    border-radius: 8px;
    padding: 12px 14px;
    background: #fff;
  }

  .pdf-sign-title {
    font-size: 7.5pt;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #035E3D;
    margin-bottom: 10px;
  }

  .pdf-sign-line {
    height: 1px;
    background: #035E3D;
    width: 42%;
    margin-bottom: 8px;
  }

  .pdf-sign-name {
    font-family: Archivo, Inter, sans-serif;
    font-weight: 800;
    font-size: 11pt;
    color: #06281B;
  }

  .pdf-sign-detail {
    font-size: 8pt;
    color: #5B6A61;
    margin-top: 2px;
  }

  .pdf-disclaimer {
    margin: 10px 0 0;
    font-size: 7.5pt;
    line-height: 1.35;
    color: #6b7280;
    text-align: justify;
  }
}
