/* 
   Diseño Visual Premium de HumanyTic
   CSS Moderno para la Herramienta de Valoración de Cargos y Compensaciones.
   Paleta: Oscuro Profundo (Slate), Índigo Eléctrico y Esmeralda.
*/

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  /* Paleta de Colores HSL - Antropósfera Light Theme */
  --bg-dark: 40 20% 98%;       /* #faf9f6 (Blanco Hueso) */
  --bg-card: 0 0% 100%;        /* #ffffff (Pure White) */
  --bg-sidebar: 48 14% 95%;    /* #f4f3ef (Slightly warmer off-white) */
  --border-light: 214 32% 91%; /* #e2e8f0 (Slate 200) */
  
  --primary: 210 100% 21%;     /* #00386b (Azul Oscuro) */
  --primary-glow: 210 100% 21% / 0.08;
  --secondary: 42 50% 56%;     /* #c5a55a (Dorado) */
  --secondary-glow: 42 50% 56% / 0.08;
  --danger: 0 84% 60%;         /* #ef4444 (Soft red) */
  --danger-glow: 0 84% 60% / 0.08;
  --warning: 38 92% 50%;       /* #f59e0b (Amber) */
  
  --text-main: 222 47% 11%;    /* #0f172a (Slate 900) */
  --text-muted: 215 25% 27%;   /* #334155 (Slate 700) */
  --text-dim: 215 16% 47%;     /* #64748b (Slate 500) */

  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --transition-smooth: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: hsl(var(--bg-dark));
  color: hsl(var(--text-main));
  font-family: var(--font-family);
  height: 100vh;
  overflow: hidden;
  display: flex;
}

/* --- LAYOUT DE LA APLICACIÓN --- */

#app-container {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.app-body {
  display: flex;
  flex: 1;
  width: 100vw;
  height: calc(100vh - 136px); /* 100px top-navbar + 36px top-user-bar */
  overflow: hidden;
}

/* Barra Superior de Módulos */
.top-navbar {
  height: 100px;
  background-color: hsl(var(--bg-card));
  border-bottom: 2px solid hsl(var(--secondary));
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

.top-navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 100%;
}

.top-brand-logo {
  max-height: 78px;
  width: auto;
  object-fit: contain;
  background: transparent !important;
}

.top-navbar-modules {
  display: flex;
  gap: 10px;
  align-items: center;
  height: 100%;
  overflow-x: auto;
  padding: 4px 0;
}

.top-navbar-modules::-webkit-scrollbar {
  height: 4px;
}
.top-navbar-modules::-webkit-scrollbar-thumb {
  background: hsl(var(--border-light));
  border-radius: 2px;
}

.module-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid hsl(var(--border-light));
  background-color: transparent;
  color: hsl(var(--text-muted));
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  white-space: nowrap;
}

.module-tab svg {
  width: 16px;
  height: 16px;
  stroke: hsl(var(--text-muted));
  stroke-width: 2px;
  fill: none;
  transition: var(--transition-smooth);
}

.module-tab:hover {
  background-color: rgba(0, 56, 107, 0.03);
  color: hsl(var(--primary));
  border-color: hsl(var(--secondary) / 0.5);
  transform: translateY(-1px);
}

.module-tab:hover svg {
  stroke: hsl(var(--primary));
}

.module-tab.active {
  background-color: hsl(var(--primary));
  color: #ffffff;
  border-color: hsl(var(--primary));
  box-shadow: 0 4px 6px -1px rgba(0, 56, 107, 0.2);
}

.module-tab.active svg {
  stroke: #ffffff;
}

/* Estilos de Soporte para los Nuevos Módulos */
.segment-card {
  border: 1px solid hsl(var(--border-light));
  border-radius: var(--border-radius);
  padding: 16px;
  background-color: hsl(var(--bg-card));
  transition: var(--transition-smooth);
}
.segment-card:hover {
  border-color: hsl(var(--secondary));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.badge-segment {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.total-comp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.total-comp-item {
  padding: 16px;
  border-radius: 8px;
  border: 1px solid hsl(var(--border-light));
  text-align: center;
}


/* Sidebar de Navegación */
.sidebar {
  width: 320px;
  background-color: hsl(var(--bg-sidebar));
  border-right: 1px solid hsl(var(--border-light));
  display: flex;
  flex-direction: column;
  height: 100%;
  flex-shrink: 0;
  z-index: 10;
}

.sidebar-header {
  padding: 15px 24px;
  background-color: transparent; /* Fondo transparente para integrarse con la barra lateral blanco hueso */
  border-bottom: 2px solid hsl(var(--secondary)); /* Separador de color dorado */
  display: flex;
  justify-content: center;
  align-items: center;
  height: 130px;
}

.brand-logo {
  max-width: 100%;
  max-height: 100px;
  object-fit: contain;
  display: block;
  background: transparent !important;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid hsl(var(--border-light));
  background-color: hsl(var(--bg-sidebar));
  display: flex;
  justify-content: center;
  align-items: center;
}

.brand-logo-bottom {
  max-height: 75px;
  max-width: 100%;
  object-fit: contain;
  opacity: 0.85;
  background: transparent !important;
  transition: var(--transition-smooth);
}

.brand-logo-bottom:hover {
  opacity: 1;
}

.steps-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Agrupamiento de Pasos */
.step-group-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: hsl(var(--text-dim));
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin: 12px 8px 4px 8px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  color: hsl(var(--text-muted));
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
  border-left: 3px solid transparent;
}

.step-item:hover {
  background-color: rgba(0, 56, 107, 0.03); /* Suave azul oscuro al pasar */
  color: hsl(var(--primary));
}

.step-item.active {
  background-color: #ffffff; /* Contraste blanco sobre blanco hueso */
  border-left: 4px solid hsl(var(--secondary)); /* Indicador dorado */
  color: hsl(var(--primary)); /* Texto Azul Oscuro */
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.step-number {
  font-size: 0.75rem;
  background-color: rgba(0, 56, 107, 0.05);
  color: hsl(var(--primary));
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 600;
}

.step-item.active .step-number {
  background-color: hsl(var(--primary));
  color: #fff;
}

/* Área de Contenido Principal */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background-color: hsl(var(--bg-dark)); /* Fondo Blanco Hueso */
}

.workspace {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
}

.workspace-footer {
  padding: 16px 40px;
  border-top: 2px solid hsl(var(--secondary)); /* Separador Dorado en el pie */
  background-color: #ffffff; /* Fondo blanco */
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* --- COMPONENTES Y DISEÑO GENERAL --- */

/* Encabezados de Sección */
.section-header {
  margin-bottom: 28px;
  border-bottom: 2px solid hsl(var(--secondary)); /* Separador de color dorado */
  padding-bottom: 14px;
}

.section-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: hsl(var(--primary)); /* Azul Oscuro */
  letter-spacing: -0.5px;
}

.section-header p {
  color: hsl(var(--text-muted));
  font-size: 0.95rem;
  margin-top: 6px;
}

/* Tarjetas y Contenedores */
.card {
  background-color: hsl(var(--bg-card));
  border: 1px solid hsl(var(--border-light));
  border-radius: var(--border-radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: hsl(var(--text-main));
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Grid del Formulario */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

label {
  font-size: 0.85rem;
  font-weight: 500;
  color: hsl(var(--text-muted));
}

input[type="text"],
input[type="number"],
select,
textarea {
  background-color: hsl(var(--bg-dark));
  border: 1px solid hsl(var(--border-light));
  border-radius: 6px;
  color: hsl(var(--text-main));
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  transition: var(--transition-smooth);
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

input::placeholder,
textarea::placeholder {
  color: hsl(var(--text-dim));
}

/* --- TABLAS MODERNAS --- */

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid hsl(var(--border-light));
  border-radius: 8px;
  background-color: hsl(var(--bg-card));
  margin-bottom: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

th, td {
  padding: 12px 16px;
  border-bottom: 1px solid hsl(var(--border-light));
}

th {
  background-color: hsl(var(--primary)) !important; /* Azul Oscuro */
  color: #ffffff !important;             /* Texto blanco para máximo contraste */
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background-color: rgba(0, 56, 107, 0.03); /* Suave azul de realce */
}

/* --- BOTONES Y CONTROLES --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  letter-spacing: 0.3px;
}

.btn-primary {
  background-color: hsl(var(--primary)); /* Azul Oscuro */
  color: #ffffff;
  border: 1px solid hsl(var(--primary));
  box-shadow: 0 2px 4px rgba(0, 56, 107, 0.1), 0 4px 12px rgba(0, 56, 107, 0.15);
}

.btn-primary:hover {
  background-color: #00274c; /* Azul aún más oscuro */
  border-color: #00274c;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 56, 107, 0.15), 0 8px 16px rgba(0, 56, 107, 0.2);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: #ffffff;
  color: hsl(var(--primary));
  border: 1px solid hsl(var(--border-light));
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
  background-color: #faf9f6; /* Blanco hueso */
  border-color: hsl(var(--secondary)); /* Borde Dorado en hover */
  color: hsl(var(--primary));
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: translateY(0);
}

.btn-success {
  background-color: hsl(var(--primary)); /* Azul Oscuro */
  color: #ffffff;
  border: 1px solid hsl(var(--primary));
  box-shadow: 0 2px 4px rgba(0, 56, 107, 0.1), 0 4px 12px rgba(0, 56, 107, 0.15);
}

.btn-success:hover {
  background-color: #00274c;
  border-color: #00274c;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 56, 107, 0.15), 0 8px 16px rgba(0, 56, 107, 0.2);
}

.btn-danger {
  background-color: #ffffff;
  color: hsl(var(--danger));
  border: 1px solid rgba(239, 68, 68, 0.2);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-danger:hover {
  background-color: rgba(239, 68, 68, 0.04);
  border-color: hsl(var(--danger));
  color: #b91c1c;
  transform: translateY(-1px);
}

.btn-icon {
  padding: 8px;
  border-radius: 6px;
  font-size: 0.8rem;
}

.btn-group {
  display: flex;
  gap: 10px;
}

/* Alertas y Notificaciones */
.alert {
  padding: 14px 18px;
  border-radius: var(--border-radius);
  border: 1px solid transparent;
  font-size: 0.85rem;
  margin-bottom: 20px;
  line-height: 1.4;
}

.alert-info {
  background-color: hsl(var(--primary-glow));
  border-color: hsl(var(--primary) / 0.25);
  color: hsl(var(--text-main));
}

.alert-warning {
  background-color: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.2);
  color: #fbd38d;
}

.alert-success {
  background-color: hsl(var(--secondary-glow));
  border-color: hsl(var(--secondary) / 0.25);
  color: #c6f6d5;
}

/* Indicadores de Círculos Salariales */
.badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-green {
  background-color: hsl(var(--secondary-glow));
  color: hsl(var(--secondary));
  border: 1px solid hsl(var(--secondary) / 0.3);
}

.badge-red {
  background-color: hsl(var(--danger-glow));
  color: hsl(var(--danger));
  border: 1px solid hsl(var(--danger) / 0.3);
}

.badge-neutral {
  background-color: rgba(255, 255, 255, 0.05);
  color: hsl(var(--text-muted));
  border: 1px solid hsl(var(--border-light));
}

/* --- COMPONENTES IA SIMULADOS (Gemini) --- */

.ai-container {
  border: 1.5px dashed hsl(var(--secondary)); /* Borde discontinuo de color Dorado */
  background: linear-gradient(135deg, hsl(var(--bg-card)) 0%, rgba(197, 165, 90, 0.05) 100%);
  border-radius: var(--border-radius);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.ai-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, hsl(var(--primary)), hsl(var(--secondary))); /* Gradiente Azul Oscuro a Dorado */
}

.ai-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.ai-sparkle {
  color: hsl(var(--primary));
  font-size: 1.2rem;
  animation: pulse 2s infinite ease-in-out;
}

.ai-content {
  color: hsl(var(--text-muted));
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-line;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* --- GRÁFICOS SVG INTERACTIVOS --- */

.chart-container {
  background-color: hsl(var(--bg-card));
  border: 1px solid hsl(var(--border-light));
  border-radius: var(--border-radius);
  padding: 24px;
  margin-bottom: 24px;
  position: relative;
}

.svg-chart {
  background-color: #ffffff; /* Fondo blanco limpio */
  border: 1px solid hsl(var(--border-light));
  border-radius: 6px;
  width: 100%;
  height: 400px;
  display: block;
}

.chart-dot {
  fill: hsl(var(--primary));
  stroke: hsl(var(--bg-card));
  stroke-width: 2;
  cursor: pointer;
  transition: r 0.2s ease;
}

.chart-dot:hover {
  r: 8;
  fill: #fff;
}

.chart-line {
  fill: none;
  stroke: hsl(var(--secondary));
  stroke-width: 3;
}

.chart-grid-line {
  stroke: hsl(var(--border-light));
  stroke-width: 1;
  stroke-dasharray: 4, 4;
}

.chart-axis {
  stroke: hsl(var(--text-dim));
  stroke-width: 1.5;
}

.chart-text {
  fill: hsl(var(--text-muted));
  font-size: 10px;
  font-family: inherit;
}

.chart-tooltip {
  position: absolute;
  background-color: #ffffff;
  border: 1px solid hsl(var(--secondary)); /* Borde Dorado */
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.8rem;
  color: hsl(var(--text-main));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  z-index: 100;
}

/* --- DIÁLOGOS Y MODALES --- */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-window {
  background-color: hsl(var(--bg-card));
  border: 1px solid hsl(var(--border-light));
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 500px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transform: scale(0.9);
  transition: transform 0.2s ease;
}

.modal-backdrop.show .modal-window {
  transform: scale(1);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid hsl(var(--border-light));
  font-weight: 600;
  font-size: 1.05rem;
}

.modal-body {
  padding: 24px;
  font-size: 0.9rem;
  color: hsl(var(--text-muted));
  line-height: 1.5;
}

.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid hsl(var(--border-light));
  background-color: rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* --- UTILERÍAS --- */

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-secondary { color: hsl(var(--secondary)) !important; }
.text-danger { color: hsl(var(--danger)) !important; }
.text-bold { font-weight: 600; }

.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-10 { gap: 10px; }
.gap-20 { gap: 20px; }

.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }

.slider-container {
  display: flex;
  align-items: center;
  gap: 16px;
  background-color: rgba(255, 255, 255, 0.02);
  padding: 12px 18px;
  border-radius: 8px;
  border: 1px solid hsl(var(--border-light));
}

.slider-container input[type="range"] {
  flex: 1;
  accent-color: hsl(var(--primary));
  cursor: pointer;
}

.slider-value {
  font-size: 1rem;
  font-weight: 700;
  color: hsl(var(--primary));
  width: 50px;
  text-align: right;
}

/* Estilo para los tabs inactivos/activos de gráficos */
.tabs-control {
  display: flex;
  gap: 6px;
  background-color: rgba(0,0,0,0.15);
  padding: 4px;
  border-radius: 6px;
  width: fit-content;
  margin-bottom: 16px;
}

.tab-btn {
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: hsl(var(--text-muted));
  cursor: pointer;
  transition: var(--transition-smooth);
}

.tab-btn.active {
  background-color: hsl(var(--bg-card));
  color: hsl(var(--text-main));
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* --- ACCIONES CSV (BOTONERA DE CONTROL) --- */
.csv-actions-menu {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: -6px;
}

.csv-actions-menu .btn {
  font-size: 0.75rem;
  padding: 6px 12px;
  border-radius: 4px;
}

/* --- DASHBOARD Y VISTA ESTADO --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: linear-gradient(135deg, hsl(var(--bg-card)) 0%, rgba(99, 102, 241, 0.03) 100%);
  border: 1px solid hsl(var(--border-light));
  border-radius: var(--border-radius);
  padding: 20px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: var(--transition-smooth);
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: hsl(var(--primary) / 0.5);
}

.kpi-val {
  font-size: 1.8rem;
  font-weight: 700;
  color: hsl(var(--secondary));
  margin-top: 8px;
}

.kpi-label {
  font-size: 0.8rem;
  color: hsl(var(--text-muted));
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --- COLLAPSE IA ELEMENT --- */
.ai-toggle-btn {
  background: transparent;
  border: 1px solid hsl(var(--primary) / 0.4);
  color: hsl(var(--primary));
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  margin-left: auto;
  transition: var(--transition-smooth);
}

.ai-toggle-btn:hover {
  background-color: hsl(var(--primary-glow));
}

.ai-collapsible {
  max-height: 1000px;
  overflow: hidden;
  transition: max-height 0.4s ease-in-out, opacity 0.3s ease;
  opacity: 1;
}

.ai-collapsible.collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-bottom: 0;
}

/* --- ESTILOS INFORME APA (PASO 19) --- */
.apa-container {
  background-color: #fcfcfc;
  color: #1a1a1a;
  padding: 50px 80px;
  border-radius: var(--border-radius);
  font-family: "Georgia", "Times New Roman", serif;
  line-height: 2;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
  max-width: 900px;
  margin: 0 auto 40px auto;
  text-align: justify;
}

.apa-title-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  text-align: center;
  margin-bottom: 80px;
}

.apa-title-page h1 {
  font-size: 2.2rem;
  margin-bottom: 24px;
  font-weight: normal;
  line-height: 1.3;
}

.apa-title-page .author {
  font-size: 1.1rem;
  margin-top: 40px;
}

.apa-title-page .institution {
  font-size: 1rem;
  color: #555;
  margin-top: 8px;
}

.apa-chapter {
  margin-bottom: 60px;
  page-break-before: always;
}

.apa-chapter h2 {
  font-size: 1.5rem;
  font-weight: bold;
  text-align: center;
  margin-bottom: 30px;
  font-family: "Georgia", serif;
}

.apa-chapter h3 {
  font-size: 1.2rem;
  font-weight: bold;
  margin-top: 24px;
  margin-bottom: 16px;
  text-align: left;
}

.apa-paragraph {
  text-indent: 1.27cm;
  margin-bottom: 20px;
  font-size: 1.05rem;
}

/* Tablas con formato APA */
.apa-table-wrapper {
  margin: 30px 0;
}

.apa-table-caption {
  font-style: italic;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.apa-table-title {
  font-weight: bold;
  margin-bottom: 12px;
  font-size: 1rem;
}

.apa-table {
  width: 100%;
  border-collapse: collapse;
  font-family: Arial, sans-serif;
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 10px;
}

.apa-table th {
  border-top: 2px solid #000;
  border-bottom: 1px solid #000;
  background-color: transparent !important;
  color: #000 !important;
  font-weight: bold;
  text-transform: none;
  font-size: 0.85rem;
  padding: 8px;
  text-align: left;
  letter-spacing: 0;
}

.apa-table td {
  border-bottom: none;
  padding: 8px;
  color: #1a1a1a !important;
}

.apa-table tr:last-child td {
  border-bottom: 2px solid #000;
}

.apa-table tr:hover td {
  background-color: transparent !important;
}

.apa-table-note {
  font-size: 0.8rem;
  font-style: italic;
  margin-top: 6px;
  color: #555;
}

/* Gráficos en formato APA (fondo blanco) */
.apa-chart-wrapper {
  background-color: #fff;
  border: 1px solid #ddd;
  padding: 16px;
  margin: 30px 0;
  text-align: center;
}

.apa-chart-wrapper svg {
  background-color: #fff !important;
}

.apa-chart-wrapper .chart-grid-line {
  stroke: #eee !important;
}

.apa-chart-wrapper .chart-axis {
  stroke: #333 !important;
}

.apa-chart-wrapper .chart-text {
  fill: #444 !important;
}

.apa-chart-wrapper .chart-dot {
  fill: #4338ca !important;
  stroke: #fff !important;
}

.apa-chart-wrapper .chart-line {
  stroke: #10b981 !important;
}

/* --- SIMULADOR DE SALARIO (PASO 20) --- */
.simulator-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .simulator-layout {
    grid-template-columns: 1fr;
  }
}

.simulator-result-box {
  background: linear-gradient(135deg, hsl(var(--primary-glow)) 0%, rgba(197, 165, 90, 0.05) 100%);
  border: 2px solid hsl(var(--primary)); /* Azul Oscuro */
  border-radius: var(--border-radius);
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 56, 107, 0.08);
}

.simulator-salary-val {
  font-size: 3rem;
  font-weight: 800;
  color: hsl(var(--primary)); /* Azul Oscuro */
  margin: 16px 0;
  text-shadow: 0 2px 4px rgba(0, 56, 107, 0.1);
}

/* Estilos de líneas extras para gráficos multilínea */
.chart-line-min {
  fill: none;
  stroke: hsl(var(--secondary) / 0.5);
  stroke-width: 1.5;
  stroke-dasharray: 4, 4;
}

.chart-line-max {
  fill: none;
  stroke: hsl(var(--danger) / 0.5);
  stroke-width: 1.5;
  stroke-dasharray: 4, 4;
}

.chart-bar-level {
  fill: hsl(var(--primary-glow));
  stroke: hsl(var(--primary));
  stroke-width: 1.5;
  opacity: 0.85;
}

/* --- ESCALA DE COMPARACION DE FACTORES (Paso 16) --- */
.thermometer-scale-table {
  width: 100%;
  border-collapse: collapse;
}

.thermometer-scale-table th {
  background-color: hsl(var(--primary)) !important;
  color: #ffffff !important;
  text-align: center;
  padding: 12px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
}

.thermometer-scale-table td {
  padding: 12px;
  border-bottom: 1px solid hsl(var(--border-light));
  vertical-align: middle;
}

.thermometer-scale-table tr:hover {
  background-color: rgba(197, 165, 90, 0.03) !important; /* Soft gold hover */
}

/* Dashboard Method Box Styles */
.card-method-dashboard {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.card-method-dashboard[onclick]:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px hsl(var(--primary) / 0.08);
  border-color: hsl(var(--primary)) !important;
}

/* Sub-pestañas de navegación interna */
.sub-tabs-container {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 2px solid hsl(var(--border-light));
  padding-bottom: 8px;
  flex-wrap: wrap;
}

.sub-tab-btn {
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: hsl(var(--text-muted));
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: var(--transition-smooth);
  font-family: var(--font-family);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sub-tab-btn:hover {
  color: hsl(var(--primary));
  background-color: rgba(0, 56, 107, 0.02);
}

.sub-tab-btn.active {
  color: hsl(var(--primary));
  border-bottom-color: hsl(var(--primary));
}

/* --- ESTILOS DE AUTENTICACIÓN Y PERFIL DE USUARIO --- */

.auth-page-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, hsl(var(--bg-sidebar)) 0%, hsl(var(--bg-dark)) 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  overflow-y: auto;
  padding: 24px;
}

.auth-card-glass {
  background-color: hsl(var(--bg-card));
  border: 1px solid hsl(var(--border-light));
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.06);
  transition: var(--transition-smooth);
}

.auth-card-large {
  max-width: 760px;
}

.auth-card-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo {
  max-height: 52px;
  width: auto;
  margin-bottom: 16px;
  object-fit: contain;
}

.auth-card-header h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: hsl(var(--primary));
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.auth-card-header p {
  font-size: 0.88rem;
  color: hsl(var(--text-dim));
  line-height: 1.4;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.grid-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.grid-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: hsl(var(--secondary));
  border-bottom: 1px solid hsl(var(--border-light));
  padding-bottom: 8px;
  margin-bottom: 4px;
}

.grid-full-width {
  grid-column: span 2;
  margin-top: 8px;
}

.form-group-modern {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group-modern label {
  font-size: 0.8rem;
  font-weight: 600;
  color: hsl(var(--text-muted));
}

.form-group-modern input,
.form-group-modern select {
  font-family: var(--font-family);
  font-size: 0.9rem;
  padding: 10px 14px;
  border: 1.5px solid hsl(var(--border-light));
  border-radius: 8px;
  background-color: hsl(var(--bg-card));
  color: hsl(var(--text-main));
  transition: var(--transition-smooth);
}

.form-group-modern input:focus,
.form-group-modern select:focus {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 4px hsl(var(--primary) / 0.08);
  outline: none;
}

.btn-auth-primary {
  width: 100%;
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 600;
  color: #ffffff;
  background-color: hsl(var(--primary));
  border: none;
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

.btn-auth-primary:hover:not(:disabled) {
  background-color: hsl(var(--primary) / 0.9);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px hsl(var(--primary) / 0.15);
}

.btn-auth-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.auth-alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 20px;
  border: 1px solid transparent;
  line-height: 1.4;
}

.auth-alert-danger {
  background-color: hsl(var(--danger-glow));
  border-color: hsl(var(--danger) / 0.2);
  color: hsl(var(--danger));
}

.auth-alert-success {
  background-color: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.2);
  color: #166534;
}

.auth-card-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 0.85rem;
  color: hsl(var(--text-dim));
}

.auth-card-footer a {
  color: hsl(var(--primary));
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition-smooth);
}

.auth-card-footer a:hover {
  text-decoration: underline;
}

/* --- PERFIL DE USUARIO Y NUBE EN NAVBAR --- */

.top-navbar-user {
  height: 100%;
  display: flex;
  align-items: center;
  margin-left: 20px;
  flex-shrink: 0;
}

.user-profile-widget {
  display: flex;
  align-items: center;
  gap: 16px;
  background-color: hsl(var(--bg-sidebar));
  border: 1px solid hsl(var(--border-light));
  border-radius: 24px;
  padding: 6px 14px 6px 18px;
  transition: var(--transition-smooth);
}

.user-profile-widget:hover {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
}

.user-info-text {
  display: flex;
  flex-direction: column;
}

.user-display-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: hsl(var(--text-main));
  line-height: 1.2;
}

.company-display-name {
  font-size: 0.72rem;
  font-weight: 500;
  color: hsl(var(--text-dim));
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cloud-sync-status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: hsl(var(--text-muted));
  border-left: 1px solid hsl(var(--border-light));
  padding-left: 14px;
  height: 24px;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sync-dot-green {
  background-color: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.sync-dot-yellow {
  background-color: #eab308;
  box-shadow: 0 0 8px rgba(234, 179, 8, 0.4);
}

.sync-dot-red {
  background-color: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.sync-text {
  font-size: 0.72rem;
  font-weight: 500;
  color: hsl(var(--text-dim));
  white-space: nowrap;
}

.btn-sync-retry {
  background: none;
  border: none;
  color: hsl(var(--text-dim));
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  transition: var(--transition-smooth);
}

.btn-sync-retry:hover {
  color: hsl(var(--danger));
  transform: rotate(45deg);
}

.btn-sync-retry svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-navbar-logout {
  background: none;
  border: none;
  color: hsl(var(--text-dim));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 50%;
  transition: var(--transition-smooth);
}

.btn-navbar-logout:hover {
  color: hsl(var(--danger));
  background-color: hsl(var(--danger-glow));
}

.animate-pulse {
  animation: pulse-glow 1.5s infinite ease-in-out;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* --- ESTILOS DEL MODAL DE PROGRESO DE REPORTES --- */

.report-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 99999;
}

.report-modal-card {
  background-color: hsl(var(--bg-card));
  border: 1px solid hsl(var(--border-light));
  border-radius: 12px;
  padding: 30px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.report-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1.5px solid hsl(var(--border-light));
  padding-bottom: 14px;
}

.report-modal-icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: hsl(var(--primary));
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.report-modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: hsl(var(--primary));
}

.report-modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.report-status-desc {
  font-size: 0.85rem;
  color: hsl(var(--text-dim));
  line-height: 1.4;
}

.report-progress-container {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 10px 0;
}

.report-progress-bar {
  flex: 1;
  height: 8px;
  background-color: hsl(var(--bg-sidebar));
  border: 1px solid hsl(var(--border-light));
  border-radius: 4px;
  overflow: hidden;
}

.report-progress-bar-fill {
  height: 100%;
  width: 0%;
  background-color: hsl(var(--primary));
  border-radius: 4px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
}

.report-progress-percent {
  font-size: 0.9rem;
  font-weight: 700;
  color: hsl(var(--text-main));
  min-width: 40px;
  text-align: right;
}

.report-status-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: hsl(var(--text-muted));
  transition: color 0.3s ease;
}

.report-modal-footer {
  display: flex;
  justify-content: flex-end;
  border-top: 1.5px solid hsl(var(--border-light));
  padding-top: 14px;
}

/* --- ESTILOS DE LA BARRA DE USUARIO SUPERIOR FIJA --- */

.top-user-bar {
  height: 36px;
  background-color: hsl(var(--primary));
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  font-size: 0.72rem;
  font-weight: 500;
  z-index: 1000;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.user-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-bar-separator {
  color: rgba(255, 255, 255, 0.3);
  margin: 0 6px;
}

.user-bar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.top-user-bar .cloud-sync-status-indicator {
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  padding-left: 14px;
  height: 16px;
  display: flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.9);
}

.top-user-bar .sync-text {
  color: rgba(255, 255, 255, 0.7);
}

.top-user-bar .btn-sync-retry {
  color: rgba(255, 255, 255, 0.8);
}

.top-user-bar .btn-sync-retry:hover {
  color: #ff8b8b;
}

.btn-user-bar-logout {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-family: var(--font-family);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 4px;
  transition: var(--transition-smooth);
}

.btn-user-bar-logout:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.btn-user-bar-logout svg {
  stroke: currentColor;
}

/* --- BOTÓN DE HAMBURGUESA Y ADAPTACIÓN RESPONSIVA --- */

.menu-hamburger-btn {
  display: none; /* Oculto en escritorio */
  background: none;
  border: none;
  color: hsl(var(--primary));
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: var(--transition-smooth);
}

.menu-hamburger-btn:hover {
  background-color: hsl(var(--primary-glow));
}

@media (max-width: 1024px) {
  .top-navbar {
    height: 72px;
    padding: 0 16px;
  }

  .top-brand-logo {
    max-height: 52px;
  }

  .app-body {
    height: calc(100vh - 108px); /* 72px top-navbar + 36px top-user-bar */
  }

  .menu-hamburger-btn {
    display: block; /* Mostrar hamburguesa */
  }

  .top-navbar-modules {
    display: none;
    position: absolute;
    top: 108px; /* debajo del navbar + barra de usuario */
    left: 0;
    width: 100vw;
    background-color: hsl(var(--bg-card));
    border-bottom: 2px solid hsl(var(--secondary));
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 6px;
    z-index: 9999;
    max-height: calc(100vh - 108px);
    overflow-y: auto;
  }

  .top-navbar-modules.open {
    display: flex; /* Desplegar al estar abierto */
  }

  .module-tab {
    width: 100%;
    justify-content: flex-start;
    padding: 12px 16px;
    height: auto;
    border-bottom: none !important;
    border-radius: 8px;
    background-color: hsl(var(--bg-sidebar) / 0.3);
  }

  .module-tab:hover {
    background-color: hsl(var(--bg-sidebar) / 0.7);
  }

  .module-tab.active {
    background-color: hsl(var(--primary-glow));
    color: hsl(var(--primary));
    border-left: 4px solid hsl(var(--primary));
    border-radius: 0 8px 8px 0;
  }
}




