/* ==========================================================================
   PRAXEO — Teoría financiera en acción · Sistema de diseño
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Paleta Praxeo - Oscuro */
  --bg-primary: #0B1A2B;
  --bg-surface: #102A43;
  --bg-secondary: #102A43;
  --bg-card: rgba(16, 42, 67, 0.85);
  --bg-card-hover: rgba(36, 65, 94, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --border-glass: #24415E;
  --border-glow: rgba(60, 191, 178, 0.25);
  --praxeo-navy: #102A43;
  --print-border: #C0CBD6;
  --print-th-bg: #F0F4F8;

  /* Fondos suaves de acentos (12–15% de opacidad) */
  --accent-cyan-soft: rgba(60, 191, 178, 0.15);
  --accent-blue-soft: rgba(79, 163, 209, 0.15);
  --accent-emerald-soft: rgba(52, 195, 143, 0.15);
  --accent-amber-soft: rgba(242, 184, 75, 0.15);
  --accent-rose-soft: rgba(240, 113, 103, 0.15);

  /* Bordes de acento */
  --border-cyan: rgba(60, 191, 178, 0.35);
  --border-blue: rgba(79, 163, 209, 0.35);
  --border-emerald: rgba(52, 195, 143, 0.35);
  --border-amber: rgba(242, 184, 75, 0.35);
  --border-rose: rgba(240, 113, 103, 0.35);

  /* Superficies destacadas, botones y sombras suaves */
  --surface-elevated: #132F4C;
  --btn-primary-bg: linear-gradient(135deg, #067A73, #2B6F99);
  --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.25);
  --status-pulse-glow: rgba(52, 195, 143, 0.6);

  /* Colores de Acento Praxeo (Oscuro) */
  --accent-cyan: #3CBFB2;
  --accent-cyan-glow: rgba(16, 42, 67, 0.12);
  --accent-violet: #4FA3D1;
  --accent-purple: #4FA3D1;
  --accent-blue: #4FA3D1;
  --accent-amber: #F2B84B;
  --accent-amber-glow: rgba(16, 42, 67, 0.12);
  --accent-gold: #F2B84B;
  --accent-emerald: #34C38F;
  --accent-emerald-glow: rgba(16, 42, 67, 0.12);
  --accent-rose: #F07167;
  --accent-rose-glow: rgba(16, 42, 67, 0.12);

  /* Textos de Alto Contraste Praxeo (Oscuro) */
  --text-primary: #F5F7F6;
  --text-main: #F5F7F6;
  --text-muted: #C9D6E3;
  --text-dim: #8FA6BC;

  /* Gradientes y Resplandores Praxeo */
  --quantix-gradient: linear-gradient(135deg, #102A43 0%, #067A73 100%);
  --quantix-glow: none;

  /* Sombras y Efectos */
  --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.35);
  --shadow-glow-cyan: 0 4px 16px rgba(16, 42, 67, 0.12);
  --shadow-glow-emerald: 0 4px 16px rgba(16, 42, 67, 0.12);

  /* Espaciado y Dimensiones Unificadas (AG-016) */
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1.0rem;
  --space-lg: 1.5rem;
  --space-xl: 2.0rem;

  /* Superficies y Bordes Reforzados (AG-016) */
  --bg-surface-elevated: #132F4C;
  --border-glass-strong: rgba(255, 255, 255, 0.15);
  --border-muted: #24415E;

  /* Tipografía */
  --font-sans: 'Montserrat', 'Segoe UI', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Transiciones y Bordes */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
}

/* Paleta Praxeo - Modo Claro (Por defecto) */
body.light-mode {
  --bg-primary: #F5F7F6;
  --bg-surface: #FFFFFF;
  --bg-secondary: #FFFFFF;
  --bg-card: rgba(255, 255, 255, 0.95);
  --bg-card-hover: #FFFFFF;
  --bg-glass: rgba(0, 0, 0, 0.02);
  --border-glass: #D5DFE0;
  --border-glow: rgba(6, 122, 115, 0.25);
  --praxeo-navy: #102A43;
  --print-border: #C0CBD6;
  --print-th-bg: #F0F4F8;

  /* Fondos suaves de acentos (12–15% de opacidad) */
  --accent-cyan-soft: rgba(6, 122, 115, 0.12);
  --accent-blue-soft: rgba(43, 111, 153, 0.12);
  --accent-emerald-soft: rgba(14, 122, 78, 0.12);
  --accent-amber-soft: rgba(138, 90, 0, 0.12);
  --accent-rose-soft: rgba(180, 35, 24, 0.12);

  /* Bordes de acento */
  --border-cyan: rgba(6, 122, 115, 0.3);
  --border-blue: rgba(43, 111, 153, 0.3);
  --border-emerald: rgba(14, 122, 78, 0.3);
  --border-amber: rgba(138, 90, 0, 0.3);
  --border-rose: rgba(180, 35, 24, 0.3);

  /* Superficies destacadas, botones y sombras suaves */
  --surface-elevated: #FFFFFF;
  --bg-surface-elevated: #F0F4F8;
  --border-glass-strong: #C0CBD6;
  --border-muted: #D5DFE0;
  --btn-primary-bg: linear-gradient(135deg, #102A43, #067A73);
  --shadow-soft: 0 4px 20px rgba(16, 42, 67, 0.08);
  --status-pulse-glow: rgba(14, 122, 78, 0.5);

  /* Colores de Acento Praxeo (Claro) */
  --accent-cyan: #067A73;
  --accent-cyan-glow: rgba(16, 42, 67, 0.12);
  --accent-violet: #102A43;
  --accent-purple: #102A43;
  --accent-blue: #2B6F99;
  --accent-amber: #8A5A00;
  --accent-amber-glow: rgba(16, 42, 67, 0.12);
  --accent-gold: #8A5A00;
  --accent-emerald: #0E7A4E;
  --accent-emerald-glow: rgba(16, 42, 67, 0.12);
  --accent-rose: #B42318;
  --accent-rose-glow: rgba(16, 42, 67, 0.12);

  /* Textos Praxeo (Claro) */
  --text-primary: #102A43;
  --text-main: #102A43;
  --text-muted: #3E5163;
  --text-dim: #5B6B7A;

  /* Gradientes y Resplandores */
  --quantix-gradient: linear-gradient(135deg, #102A43 0%, #067A73 100%);
  --quantix-glow: none;

  /* Sombras */
  --shadow-card: 0 8px 25px 0 rgba(16, 42, 67, 0.08);
  --shadow-glow-cyan: 0 4px 16px rgba(16, 42, 67, 0.12);
  --shadow-glow-emerald: 0 4px 16px rgba(16, 42, 67, 0.12);

  /* Espaciado y Dimensiones Unificadas (AG-016) */
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1.0rem;
  --space-lg: 1.5rem;
  --space-xl: 2.0rem;

  /* Radios de curvatura */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
}

/* Reset Global */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  background-image: 
    radial-gradient(circle at 15% 15%, var(--accent-cyan-soft) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, var(--accent-blue-soft) 0%, transparent 45%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Contenedor Principal y Regla Estricta de No-Desbordamiento */
html,
body,
main,
.app-container,
.dashboard-grid,
.simulator-layout {
  overflow-x: hidden !important;
  max-width: 100vw;
  box-sizing: border-box;
}

.simulator-layout > *,
.main-content-column,
.dashboard-grid > *,
.tab-content {
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box;
}

.app-container {
  max-width: 1560px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem 1.5rem;
  box-sizing: border-box;
}

/* ==========================================================================
   BARRA SUPERIOR (HEADER)
   ========================================================================== */
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  margin-bottom: 1.5rem;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-logo-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--btn-primary-bg);
  color: #fff;
  font-weight: 800;
  font-size: 1.4rem;
  box-shadow: var(--shadow-soft);
}

.brand-info h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

body.light-mode .brand-info h1 {
  color: var(--text-main);
}

.brand-info .tagline {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

/* Badges y Selectores */
.select-wrapper {
  position: relative;
}

.custom-select {
  appearance: none;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 0.55rem 2.2rem 0.55rem 1rem;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: var(--transition-normal);
}

.custom-select:focus, .custom-select:hover {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

.select-arrow {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* Status Badge */
.status-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-full);
  background: var(--accent-emerald-soft);
  border: 1px solid var(--border-emerald);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent-emerald);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 var(--status-pulse-glow); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(0, 0, 0, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); }
}

/* Botones de Cabecera */
.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition-normal);
}

.btn-icon:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  transform: translateY(-2px);
}

/* ==========================================================================
   NAVEGACIÓN POR PESTAÑAS
   ========================================================================== */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-normal);
}

.tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-glass);
}

.tab-btn.active {
  background: var(--accent-cyan-soft);
  border: 1px solid var(--border-glow);
  color: var(--accent-cyan);
  font-weight: 600;
  box-shadow: var(--shadow-glow-cyan);
}

.tab-badge {
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.tab-btn.active .tab-badge {
  background: var(--accent-cyan);
  color: #000;
  font-weight: 700;
}

/* ==========================================================================
   VISTAS DE CONTENIDO (TABS)
   ========================================================================== */
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Layout Grid Principal */
.simulator-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.5rem;
}

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

/* Tarjetas y Paneles Glassmorphism */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  box-shadow: var(--shadow-card);
  position: relative;
  transition: var(--transition-normal);
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-glass);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   CONTROLES DE FORMULARIO Y SLIDERS PRO
   ========================================================================== */
.control-group {
  margin-bottom: 1.3rem;
}

.control-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
}

.control-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.control-value {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-cyan);
}

.slider-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 7px;
  border-radius: 4px;
  background: var(--bg-secondary);
  outline: none;
  border: 1px solid var(--border-glass);
  transition: var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--btn-primary-bg);
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: var(--shadow-soft);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: var(--shadow-card);
}

.slider-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
  font-family: var(--font-mono);
}

/* Presets Buttons */
.preset-buttons-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.btn-preset {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-preset:hover {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  background: var(--accent-cyan-glow);
}

/* ==========================================================================
   KPIS Y MÉTRICAS DE COMPARACIÓN EN VIVO
   ========================================================================== */
.metrics-comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.metric-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  position: relative;
  overflow: hidden;
  transition: var(--transition-normal);
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--border-glow), transparent);
  opacity: 0;
  transition: var(--transition-normal);
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.metric-card:hover::before {
  opacity: 1;
}

.metric-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.metric-main-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.metric-value-huge {
  font-family: var(--font-mono);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.metric-delta {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.metric-delta.positive { color: var(--accent-emerald); }
.metric-delta.negative { color: var(--accent-rose); }
.metric-delta.neutral  { color: var(--accent-amber); }

.metric-bench-row {
  margin-top: 0.5rem;
  padding-top: 0.45rem;
  border-top: 1px dashed var(--border-glass);
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.metric-bench-value {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-gold);
}

/* ==========================================================================
   PANEL DE DIAGNÓSTICO Y SESGOS (BENCHMARKING)
   ========================================================================== */
.diagnosis-panel {
  background: var(--surface-elevated);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 1.3rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

@media (max-width: 850px) {
  .diagnosis-panel {
    flex-direction: column;
    align-items: flex-start;
  }
}

.score-circle-wrapper {
  position: relative;
  width: 100px;
  height: 100px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.score-circle-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-circle-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 8;
}

.score-circle-progress {
  fill: none;
  stroke: var(--accent-cyan);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 264;
  stroke-dashoffset: 60;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.score-inner-text {
  position: absolute;
  text-align: center;
}

.score-number {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1;
}

.score-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.diagnosis-text-content {
  flex: 1;
}

.diagnosis-header-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.45rem;
}

.diagnosis-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.bias-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  background: var(--accent-rose-soft);
  border: 1px solid var(--border-rose);
  color: var(--accent-rose);
}

.bias-tag.optimal {
  background: var(--accent-emerald-soft);
  border-color: var(--border-emerald);
  color: var(--accent-emerald);
}

.diagnosis-explanation {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 0.65rem;
}

.biases-list {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.bias-pill {
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-sm);
  color: var(--accent-amber);
}

/* ==========================================================================
   CANVAS / SVG CHARTS INTERACTIVOS - ESTANDARIZACIÓN UNIVERSAL
   ========================================================================== */
/* Contenedor universal de gráficas */
.chart-card,
.chart-wrapper,
.chart-container,
.canvas-holder,
.canvas-wrapper {
  width: 100% !important;
  max-width: 100% !important;
  position: relative;
  box-sizing: border-box;
  overflow: hidden !important;
  background: var(--surface-elevated) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass) !important;
  border-radius: 12px;
  padding: 1rem;
  min-height: 320px;
  margin: 0.5rem 0;
}

/* Modo claro para contenedores universales */
body.light-mode .chart-card,
body.light-mode .chart-wrapper,
body.light-mode .chart-container,
body.light-mode .canvas-holder,
body.light-mode .canvas-wrapper {
  background: var(--surface-elevated) !important;
  border: 1px solid var(--border-glass) !important;
}

/* Elementos internos (Canvas o Imágenes) */
.chart-wrapper canvas,
.chart-container canvas,
.chart-card canvas,
.canvas-wrapper canvas,
.canvas-holder canvas,
.chart-wrapper img,
.chart-container img,
.chart-card img,
.canvas-wrapper img,
.canvas-holder img {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  max-height: 440px !important;
  display: block !important;
  object-fit: contain !important;
  margin: 0 auto;
}

.chart-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-color-box {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* ==========================================================================
   MONTE CARLO STRESS TEST SECTION
   ========================================================================== */
.monte-carlo-section {
  margin-top: 1.5rem;
}

.monte-carlo-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--btn-primary-bg);
  color: #ffffff;
  border: none;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: var(--transition-normal);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-normal);
}

.btn-secondary:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.mc-kpis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.mc-kpi {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
}

.mc-kpi-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.mc-kpi-value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

/* ==========================================================================
   TAB 2: PRESUPUESTO DE CAPITAL
   ========================================================================== */
.budget-bar-wrapper {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.budget-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.budget-progress-track {
  height: 12px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.budget-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-emerald), var(--accent-cyan));
  border-radius: 6px;
  transition: width 0.4s ease;
}

.budget-progress-fill.overbudget {
  background: linear-gradient(90deg, var(--accent-amber), var(--accent-rose));
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.1rem;
  margin-bottom: 1.5rem;
}

.project-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  cursor: pointer;
  transition: var(--transition-normal);
  position: relative;
}

.project-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-cyan);
}

.project-card.selected {
  background: var(--accent-cyan-soft);
  border: 1.5px solid var(--accent-cyan);
  box-shadow: 0 0 16px var(--accent-cyan-soft);
}

.project-card.optimal-choice::after {
  content: '★ ÓPTIMO';
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-gold);
  background: var(--accent-amber-soft);
  border: 1px solid var(--border-amber);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

.project-name {
  font-size: 1.02rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
  padding-right: 4.5rem;
}

.project-metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.8rem;
  font-size: 0.78rem;
}

.project-metric-box {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 0.4rem;
  text-align: center;
}

.project-metric-label {
  color: var(--text-dim);
  font-size: 0.68rem;
}

.project-metric-val {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-main);
}

/* ==========================================================================
   TAB 3: CAPITAL DE TRABAJO (CCC)
   ========================================================================== */
.ccc-visualizer-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.ccc-calc-box {
  text-align: center;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  min-width: 140px;
}

.ccc-operator {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent-cyan);
}


/* ==========================================================================
   TAB 5: SEMILLERO DE INVESTIGACIÓN (DATA HUB)
   ========================================================================== */
.research-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
}

.telemetry-table-container {
  overflow-x: auto;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.telemetry-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.telemetry-table th {
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-glass);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.telemetry-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-glass);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.telemetry-table tr:hover {
  background: var(--bg-glass);
}

/* ==========================================================================
   TAB 6: TRANSPARENCIA & FÓRMULAS
   ========================================================================== */
.formula-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.2rem;
}

.formula-card h3 {
  font-size: 1rem;
  color: var(--accent-cyan);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.math-display {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  font-family: var(--font-mono);
  color: var(--accent-gold);
  font-size: 0.95rem;
  margin: 0.6rem 0;
  overflow-x: auto;
}

/* ==========================================================================
   UTILIDADES & RESPONSIVIDAD
   ========================================================================== */
.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.text-cyan { color: var(--accent-cyan); }
.text-emerald { color: var(--accent-emerald); }
.text-amber { color: var(--accent-amber); }
.text-rose { color: var(--accent-rose); }
.text-gold { color: var(--accent-gold); }

@media (max-width: 768px) {
  .app-container {
    padding: 0.75rem;
  }
  .header-bar {
    padding: 1rem;
  }
  .nav-tabs {
    gap: 0.25rem;
  }
  .tab-btn {
    padding: 0.5rem 0.8rem;
    font-size: 0.82rem;
  }
}

/* ==========================================================================
   FICHAS TÉCNICAS Y CASO DE ESTUDIO EN PDF
   ========================================================================== */
.case-study-export-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-glass);
}

.case-export-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.case-export-icon {
  font-size: 1.35rem;
}

.case-export-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.01em;
}

.case-export-subtitle {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  font-weight: 500;
}

.case-export-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.btn-case-export {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
  width: 100%;
}

.btn-case-export:hover {
  transform: translateY(-1px);
}

.btn-case-export.student:hover {
  border-color: var(--accent-cyan);
  background: var(--accent-cyan-soft);
  box-shadow: var(--shadow-glow-cyan);
}

.btn-case-export.teacher:hover {
  border-color: var(--accent-emerald);
  background: var(--accent-emerald-soft);
  box-shadow: var(--shadow-glow-emerald);
}

.btn-case-export .btn-icon-symbol {
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-case-export .btn-label-block {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.btn-case-export .btn-label-block strong {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

.btn-case-export .btn-label-block small {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Modal Institucional */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg-surface);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6);
  padding: 1.5rem;
  animation: modalSlideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-glass);
}

.callout-alert.warning {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--accent-amber-soft);
  border: 1px solid var(--border-amber);
  color: var(--text-main);
}

/* ==========================================================================
   PANEL DOCENTE / INSTRUCTOR DASHBOARD
   ========================================================================== */
.btn-instructor-lock {
  border: 1px solid var(--border-amber);
  background: var(--accent-amber-soft);
}

.btn-instructor-lock:hover {
  border-color: var(--accent-gold);
  box-shadow: var(--shadow-soft);
}

.btn-instructor-lock.unlocked {
  border-color: var(--border-emerald);
  background: var(--accent-emerald-soft);
}

.instructor-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-bottom: 0.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-glass);
}

.instructor-subtab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.instructor-subtab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.instructor-subtab-btn.active {
  color: var(--text-main);
  background: var(--accent-cyan-soft);
  border-color: var(--accent-cyan);
  box-shadow: var(--shadow-glow-cyan);
}

.instructor-subview {
  display: none;
}

.instructor-subview.active {
  display: block;
  animation: fadeIn 0.25s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.subview-grid-two-cols {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.25rem;
}

@media (max-width: 1024px) {
  .subview-grid-two-cols {
    grid-template-columns: 1fr;
  }
}

/* Switch Toggle (Modo Proyector) */
.presenter-toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--accent-amber-soft);
  border: 1px solid var(--border-amber);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider.round {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: .25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 34px;
}

.slider.round:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
}

input:checked + .slider.round {
  background-color: var(--accent-gold);
}

input:checked + .slider.round:before {
  transform: translateX(20px);
}

/* Tooltip de Dispersión */
.scatter-tooltip {
  position: absolute;
  background: var(--surface-elevated);
  backdrop-filter: blur(8px);
  border: 1px solid var(--accent-cyan);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  color: var(--text-main);
  font-size: 0.78rem;
  line-height: 1.4;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 100;
  transform: translate(-50%, -120%);
}

/* Tarjetas de Resaltado Pedagógico */
.highlight-card {
  border-left: 4px solid var(--border-glass);
  transition: all var(--transition-fast);
}

.highlight-card.optimal-hl {
  border-left-color: var(--accent-emerald);
}

.highlight-card.conservative-hl {
  border-left-color: var(--accent-cyan);
}

.highlight-card.distress-hl {
  border-left-color: var(--accent-rose);
}

/* Inputs y Formularios Administrativos */
.custom-input {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass-strong);
  color: var(--text-main);
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  width: 100%;
  transition: border-color var(--transition-fast);
}

.custom-input::placeholder,
.pv-input::placeholder {
  color: var(--text-muted);
  opacity: 0.85;
}

.custom-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px var(--accent-cyan-glow);
}

/* Modo Proyector (Agrandar para legibilidad en cañón de aula) */
body.presenter-mode-active #canvas-debrief-scatter {
  filter: contrast(1.1);
}

/* Selector de Rol Institucional */
.role-select-wrapper select {
  border-color: var(--border-amber);
  background: var(--accent-amber-soft);
  color: var(--accent-gold);
  font-weight: 500;
}

.role-select-wrapper select:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 2px var(--accent-amber-glow);
}

/* Conmutador de Métrica en Scatter Plot */
.scatter-metric-toggle .btn-preset {
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.scatter-metric-toggle .btn-preset:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.scatter-metric-toggle .btn-preset.active {
  background: var(--accent-cyan-soft);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 600;
}

/* Impresión formal para Acreditación */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  .modal-card {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
  }
  .header-bar, .nav-tabs, .modal-header button, .modal-footer {
    display: none !important;
  }
}

/* Botones de creación rápida de cohortes */
#btn-modal-new-cohort,
#btn-modal-new-cohort-form {
  background: var(--accent-cyan-soft);
  border: 1px solid var(--border-cyan);
  color: var(--accent-cyan);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

#btn-modal-new-cohort:hover,
#btn-modal-new-cohort-form:hover {
  background: var(--accent-cyan-soft);
  border-color: var(--accent-cyan);
  box-shadow: var(--shadow-soft);
}

/* Opción de crear cohorte en los selects */
select option[value="__new_cohort__"] {
  background-color: var(--bg-surface);
  color: var(--accent-cyan);
  font-weight: 700;
}

/* ==========================================================================
   GATEKEEPER / PANTALLA DE INICIO DE SESIÓN INSTITUCIONAL (RBAC)
   ========================================================================== */
.login-gatekeeper-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow-y: auto;
  animation: fadeIn 0.3s ease;
}

.login-gatekeeper-card {
  width: 100%;
  max-width: 520px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2rem;
  position: relative;
  overflow: hidden;
}

.login-gatekeeper-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--quantix-gradient);
}

.login-brand-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.login-logo-glow {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--quantix-gradient);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.45rem;
  font-family: 'Montserrat', sans-serif;
  letter-spacing: 0.5px;
  box-shadow: var(--quantix-glow);
  flex-shrink: 0;
}

.login-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.login-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.login-notice-banner {
  background: var(--accent-cyan-soft);
  border: 1px solid var(--border-cyan);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.82rem;
  margin-bottom: 1.25rem;
}

.login-form-group {
  margin-bottom: 1rem;
}

.login-form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.input-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-wrapper .input-icon {
  position: absolute;
  left: 0.85rem;
  font-size: 1rem;
  pointer-events: none;
  opacity: 0.7;
}

.input-icon-wrapper input {
  padding-left: 2.5rem;
}

/* UX-12: Contraste de inputs y placeholders en Login Gatekeeper */
.login-gatekeeper-card .custom-input {
  background: var(--bg-card);
  border: 1px solid var(--border-glass-strong);
  color: var(--text-main);
}

.login-gatekeeper-card .custom-input::placeholder {
  color: var(--text-muted);
  opacity: 0.9;
}

body.light-mode .login-gatekeeper-card .custom-input {
  background: #ffffff;
  border: 1px solid var(--border-glass-strong);
  color: var(--text-main);
}

body.light-mode .login-gatekeeper-card .custom-input::placeholder {
  color: var(--text-muted);
  opacity: 0.9;
}

.login-error-alert {
  background: var(--accent-rose-soft);
  border: 1px solid var(--border-rose);
  color: var(--accent-rose);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.login-submit-btn {
  width: 100%;
  padding: 0.8rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: all var(--transition-fast);
}

.login-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}

/* Sección de Botones de Demostración Rápida (1-Click) */
.login-demo-section {
  margin-top: 1.4rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border-glass);
}

.login-demo-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.login-demo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

.demo-account-pill {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
  color: var(--text-main);
}

.demo-account-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.demo-account-pill .pill-avatar {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.demo-account-pill .pill-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.demo-account-pill .pill-text strong {
  font-size: 0.78rem;
  line-height: 1.2;
}

.demo-account-pill .pill-text small {
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-account-pill.pill-admin:hover {
  border-color: var(--border-amber);
  box-shadow: 0 0 12px var(--accent-amber-soft);
}

.demo-account-pill.pill-instructor:hover {
  border-color: var(--border-cyan);
  box-shadow: 0 0 12px var(--accent-cyan-soft);
}

.demo-account-pill.pill-directivo:hover {
  border-color: var(--border-blue);
  box-shadow: 0 0 12px var(--accent-blue-soft);
}

.demo-account-pill.pill-student:hover {
  border-color: var(--accent-emerald-soft);
  box-shadow: 0 0 12px var(--accent-emerald-soft);
}

.login-footer-info {
  margin-top: 1.2rem;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* ==========================================================================
   WIDGET DE SESIÓN DE USUARIO EN CABECERA
   ========================================================================== */
.user-session-widget {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.user-profile-badge:hover {
  background: rgba(255, 255, 255, 0.08);
}

#btn-logout {
  padding: 0.42rem 0.75rem;
  font-size: 0.78rem;
  white-space: nowrap;
  color: var(--accent-rose);
  border: 1px solid var(--border-rose);
  background: var(--accent-rose-soft);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all var(--transition-fast);
}

#btn-logout:hover {
  background: var(--accent-rose-soft);
  border-color: var(--accent-rose);
  transform: translateY(-1px);
}

/* Pestaña Directivo */
.btn-executive-lock {
  border-color: var(--border-blue) !important;
  color: var(--accent-blue) !important;
}

.btn-executive-lock:hover {
  border-color: var(--accent-blue) !important;
  background: var(--accent-blue-soft) !important;
}

.btn-executive-lock.active {
  background: var(--accent-blue-soft) !important;
  border-color: var(--accent-blue) !important;
  color: var(--accent-blue) !important;
}

/* ==========================================================================
   DASHBOARD EJECUTIVO DE ACREDITACIÓN (CNA / MEN)
   ========================================================================== */
.executive-dashboard-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.executive-header-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding: 1.5rem 1.75rem;
}

.executive-title-block {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.executive-seal-badge {
  padding: 0.6rem 0.9rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border-blue);
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent-blue);
  white-space: nowrap;
  box-shadow: 0 0 15px var(--accent-blue-soft);
}

.executive-controls-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.executive-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.executive-kpi-grid .kpi-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
}

.kpi-icon-bubble {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.kpi-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.kpi-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin: 0.2rem 0;
}

.kpi-value {
  font-size: 1.7rem;
  font-weight: 700;
  font-family: var(--font-mono);
  line-height: 1.1;
}

.kpi-badge {
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.kpi-badge.badge-success {
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald);
  border: 1px solid var(--border-emerald);
}

.kpi-badge.badge-neutral {
  background: var(--accent-amber-soft);
  color: var(--accent-amber);
  border: 1px solid var(--border-amber);
}

.kpi-subtext {
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* RAPs */
.executive-rap-summary-badge {
  font-size: 0.82rem;
  padding: 0.4rem 0.85rem;
  background: var(--accent-emerald-soft);
  border: 1px solid var(--border-emerald);
  border-radius: var(--radius-sm);
}

.executive-rap-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.75rem;
}

.executive-rap-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  transition: all var(--transition-fast);
}

.executive-rap-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
}

.rap-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.rap-title-block {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.rap-tag {
  background: var(--accent-cyan-soft);
  border: 1px solid var(--border-cyan);
  color: var(--accent-cyan);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.rap-score-block {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.rap-score-val {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.1rem;
}

.rap-description {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 0.65rem;
}

.rap-progress-track {
  width: 100%;
  height: 7px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.rap-progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sesgos y Recomendaciones en 2 columnas */
.executive-two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 900px) {
  .executive-two-col-grid {
    grid-template-columns: 1fr;
  }
}

.bias-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 0.5rem;
}

.bias-breakdown-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.bias-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-main);
}

.executive-recommendations-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.exec-rec-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
}

.exec-rec-card .rec-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.exec-rec-card .rec-body strong {
  font-size: 0.82rem;
  color: var(--text-main);
  display: block;
  margin-bottom: 0.2rem;
}

.exec-rec-card .rec-body p {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

/* =============================================================================
   Módulo Proyectos y Valoración (AG-007)
   ============================================================================= */

#pv-root {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
}

.pv-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card);
}

.pv-card-header {
  margin-bottom: 1rem;
}

.pv-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.pv-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pv-controls-grid {
  display: grid;
  grid-template-columns: 1fr 140px auto;
  gap: 1rem;
  align-items: end;
}

.pv-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.pv-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.pv-input, .pv-select {
  padding: 0.6rem 0.85rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.pv-input:focus, .pv-select:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px var(--accent-cyan-glow);
}

.pv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
  text-decoration: none;
}

.pv-btn-primary {
  background: var(--quantix-gradient);
  color: #ffffff;
  box-shadow: var(--shadow-soft);
}

.pv-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--quantix-glow);
}

.pv-btn-secondary {
  background: var(--bg-card);
  border-color: var(--border-glass);
  color: var(--text-main);
}

.pv-btn-secondary:hover {
  background: var(--surface-elevated);
  border-color: var(--border-cyan);
}

.pv-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: auto;
  transform: none !important;
  box-shadow: none !important;
}

.pv-btn-danger {
  background: var(--accent-rose-soft);
  border-color: var(--border-rose);
  color: var(--accent-rose);
}

.pv-btn-danger:hover {
  background: var(--accent-rose);
  color: #ffffff;
}

/* UX-17: Separación del botón secundario "Ver solución completa" */
.pv-btn-solucion,
.btn-ver-solucion,
.btn-solucion-completa,
#pv-btn-ver-solucion,
#mf-btn-ver-solucion,
#ec-btn-ver-solucion,
#af-btn-ver-solucion,
#ct-btn-ver-solucion,
#pc-btn-ver-solucion {
  margin-left: auto;
}

/* UX-13: Botón "Usuarios" de la cabecera */
#btn-header-usuarios {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

#btn-header-usuarios:hover {
  background: var(--surface-elevated);
  border-color: var(--border-cyan);
  color: var(--text-main);
}

#btn-header-usuarios.active {
  background: var(--accent-cyan-soft);
  border-color: var(--border-cyan);
  color: var(--accent-cyan);
}

.pv-error-inline {
  color: var(--accent-rose);
  font-size: 0.82rem;
  font-weight: 500;
  margin-top: 0.4rem;
}

.pv-error-banner {
  padding: 1rem 1.25rem;
  background: var(--accent-rose-soft);
  border: 1px solid var(--border-rose);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.9rem;
}

.pv-table-container {
  width: 100%;
  overflow-x: auto;
  margin: 0.75rem 0;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}

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

.pv-table th, .pv-table td {
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border-glass);
  white-space: nowrap;
}

.pv-table th {
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pv-table td {
  color: var(--text-main);
}

.pv-table th.pv-cell-num,
.pv-table td.pv-cell-num,
.pv-cell-num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.pv-table th.pv-cell-center,
.pv-table td.pv-cell-center,
.pv-cell-center {
  text-align: center;
}

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

.pv-table tr:hover td {
  background: var(--bg-glass);
}

.pv-market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.pv-market-item {
  padding: 0.65rem 0.85rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.pv-market-item .pv-mkt-label {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.pv-market-item .pv-mkt-val {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.pv-conventions-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-left: 1.25rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.45;
  margin: 0.75rem 0;
}

/* Formularios y cuadrículas estandarizadas (UX-05, UX-19) */
.pv-inputs-grid,
.pv-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
  align-items: start;
}

.input-compact,
.input-case-num {
  width: 100%;
  max-width: 110px;
}

.input-pct {
  width: 100%;
  max-width: 170px;
  padding-left: 0.55rem;
  padding-right: 0.55rem;
}

.input-days {
  width: 100%;
  max-width: 110px;
}

.input-ratio {
  width: 100%;
  max-width: 170px;
}

.input-money {
  width: 100%;
  max-width: 185px;
}

.input-select {
  min-width: 190px;
  max-width: 260px;
}

/* Caja de Feedback estandarizada (UX-16) */
.pv-feedback-container,
.pv-feedback-box,
.pv-feedback-card {
  margin-top: 1.25rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.pv-feedback-summary {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Insignias de Estado Unificadas (UX-06) */
.badge-status,
.pv-status-badge,
.pv-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-xs);
  font-size: 0.74rem;
  font-weight: 600;
  font-family: var(--font-sans);
  line-height: 1.25;
}

.badge-status.status-correct,
.status-correct,
.pv-status-badge.pv-status-ok,
.pv-status-ok,
.pv-badge-correcto {
  background: var(--accent-emerald-soft);
  border: 1px solid var(--border-emerald);
  color: var(--accent-emerald);
}

.badge-status.status-error,
.status-error,
.pv-status-badge.pv-status-error,
.pv-status-error,
.pv-badge-incorrecto {
  background: var(--accent-rose-soft);
  border: 1px solid var(--border-rose);
  color: var(--accent-rose);
}

.badge-status.status-unanswered,
.status-unanswered,
.pv-status-badge.pv-status-pending,
.pv-status-pending,
.pv-badge-sin-responder {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
}

.badge-status.status-hidden,
.status-hidden,
.pv-badge-oculto {
  background: var(--bg-glass);
  border: 1px dashed var(--border-glass);
  color: var(--text-dim);
}

.badge-status.status-locked,
.status-locked {
  background: var(--accent-amber-soft);
  border: 1px solid var(--border-amber);
  color: var(--accent-amber);
}

/* Estado bloqueado de Parte B (UX-07) */
.pv-section-locked,
.pv-locked-card,
#mf-bloqueo-parte-b,
#af-bloqueo-parte-b,
#ct-bloqueo-parte-b,
#ec-bloqueo-parte-b {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.pv-locked-banner,
.pv-banner-bloqueado {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--accent-amber-soft);
  border: 1px solid var(--border-amber);
  border-radius: var(--radius-sm);
  color: var(--accent-amber);
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.pv-diagnostico-card {
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--accent-amber);
  background: var(--accent-amber-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 0.5rem 0;
  font-size: 0.83rem;
  color: var(--text-main);
  line-height: 1.45;
}

.pv-aviso-card {
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--accent-cyan);
  background: var(--accent-cyan-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 0.5rem 0;
  font-size: 0.83rem;
  color: var(--text-main);
  line-height: 1.45;
}

/* Vista previa de lectura unificada (UX-21) */
.pv-input-preview,
.pv-preview-lectura {
  display: block;
  min-height: 1.15rem;
  font-size: 0.72rem;
  margin-top: 0.25rem;
  font-family: var(--font-mono);
  line-height: 1.25;
}

.pv-preview-lectura.pv-preview-ok {
  color: var(--text-muted);
}

.pv-preview-lectura.pv-preview-error {
  color: var(--accent-rose);
}

/* Alineación de botón Guía y subtítulo de ayuda (UX-22) */
.pv-guia-btn-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  vertical-align: top;
  gap: 0.25rem;
}

.pv-guia-ayuda,
#pv-guia-ayuda,
#mf-guia-ayuda,
#af-guia-ayuda,
#ct-guia-ayuda,
#ec-guia-ayuda {
  font-size: 0.70rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.pv-tornado-legend {
  display: flex;
  gap: 1.5rem;
  margin: 0.5rem 0 0.85rem 0;
  font-size: 0.82rem;
}

.pv-tornado-legend-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-main);
}

.pv-tornado-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.pv-tornado-legend-dot.aumenta {
  background: var(--accent-cyan);
  border: 1px solid var(--accent-cyan);
}

.pv-tornado-legend-dot.reduce {
  background: var(--accent-amber);
  border: 1px solid var(--accent-amber);
}

.pv-tornado-chart {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 1rem;
}

.pv-tornado-row {
  display: grid;
  grid-template-columns: 200px 1fr 240px;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
}

.pv-tornado-label {
  color: var(--text-main);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pv-tornado-track {
  position: relative;
  height: 22px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  overflow: hidden;
}

.pv-tornado-center-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.4);
  z-index: 2;
}

.pv-tornado-bar {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border-radius: 2px;
}

.pv-tornado-bar-aumenta {
  background: var(--accent-cyan-soft);
  border: 1px solid var(--accent-cyan);
}

.pv-tornado-bar-reduce {
  background: var(--accent-amber-soft);
  border: 1px solid var(--accent-amber);
}

.pv-tornado-bar-neg {
  background: var(--accent-rose-soft);
  border: 1px solid var(--accent-rose);
}

.pv-tornado-bar-pos {
  background: var(--accent-emerald-soft);
  border: 1px solid var(--accent-emerald);
}

.pv-tornado-vals {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}

.pv-confirm-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--accent-amber-soft);
  border: 1px solid var(--accent-amber);
  border-radius: var(--radius-sm);
  margin-top: 0.75rem;
  font-size: 0.85rem;
}

@media (max-width: 768px) {
  .pv-controls-grid {
    grid-template-columns: 1fr;
  }
  .pv-inputs-grid,
  .pv-form-grid {
    grid-template-columns: 1fr !important;
  }
  .pv-inputs-grid .pv-input,
  .pv-form-grid .pv-input,
  .pv-inputs-grid .pv-select,
  .pv-form-grid .pv-select,
  .input-pct,
  .input-ratio,
  .input-days,
  .input-money,
  .input-select {
    max-width: 100%;
  }
  .pv-tornado-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
  .pv-tornado-vals {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .pv-controls-grid:not(.pv-form-grid) {
    grid-template-columns: 1fr 120px !important;
  }
  .pv-controls-grid:not(.pv-form-grid) .pv-actions-group,
  .pv-controls-grid:not(.pv-form-grid) .pv-btn {
    grid-column: span 2;
  }
  .input-case-num,
  input[type="number"]#pv-input-caso,
  input[type="number"]#ec-caso,
  input[type="number"]#af-caso,
  input[type="number"]#ct-caso,
  input[type="number"]#mf-caso {
    max-width: 120px !important;
  }

  /* UX-09: Desplazamiento horizontal fluido en móvil para subpestañas docentes */
  .instructor-subtabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }
  .instructor-subtabs::-webkit-scrollbar {
    height: 3px;
  }
  .instructor-subtabs::-webkit-scrollbar-thumb {
    background: var(--border-glass-strong);
    border-radius: 3px;
  }

  /* UX-20: Enrolamiento móvil en subview-students */
  #subview-students .subview-grid-two-cols {
    display: flex;
    flex-direction: column;
  }
  #subview-students .subview-grid-two-cols > div:last-child {
    order: -1;
  }
  #subview-students #form-enroll-single {
    grid-template-columns: 1fr !important;
  }
  #subview-students #form-enroll-single > * {
    grid-column: span 1 !important;
  }
  #subview-students div[style*="dashed"] > div {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  #subview-students #file-bulk-students {
    width: 100%;
    margin-bottom: 0.5rem;
  }
  #subview-students #btn-upload-csv-students {
    width: 100%;
    justify-content: center;
  }

  /* UX-01: Desplazamiento horizontal y pistas visuales en pestañas móviles */
  .nav-tabs {
    mask-image: linear-gradient(to right, black 85%, transparent);
    -webkit-mask-image: linear-gradient(to right, black 85%, transparent);
    padding: 0.35rem 0.45rem;
    gap: 0.35rem;
  }
  .tab-btn {
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
    gap: 0.4rem;
  }

  /* UX-11: Cabecera móvil compacta */
  .header-bar {
    padding: 0.65rem 0.85rem;
    gap: 0.65rem;
  }
  .header-controls {
    gap: 0.4rem;
    width: 100%;
    justify-content: space-between;
  }
  #current-user-role-label {
    display: none;
  }
  #current-user-name {
    max-width: 110px !important;
  }
  #btn-cambiar-mi-password,
  #btn-logout {
    padding: 0.35rem 0.5rem !important;
    font-size: 0.72rem !important;
  }
  #backend-status-text {
    display: none;
  }
  #backend-status-badge {
    padding: 0.4rem !important;
  }

  /* UX-23: Fila de ayuda y botón Mostrar en modal de cambio de contraseña */
  .cp-help-row,
  #cp-overlay .login-form-group > div[style*="justify-content: space-between"] {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.35rem !important;
  }
}

/* ==========================================================================
   Impresión (AG-009)
   ========================================================================== */
#pv-print,
#ce-print {
  display: none;
}

@media print {
  @page {
    size: letter;
    margin: 18mm;
  }

  @page landscape-sheet {
    size: letter landscape;
    margin: 15mm;
  }

  body * {
    visibility: hidden;
  }

  /* Sin páginas en blanco al final: lo oculto no ocupa espacio (AG-010, auditor) */
  body > *:not(#pv-print):not(#ce-print) {
    display: none !important;
  }

  #pv-print,
  #pv-print *,
  #ce-print,
  #ce-print * {
    visibility: visible;
  }

  #pv-print,
  #ce-print {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: #ffffff !important;
    color: var(--praxeo-navy) !important;
    font-family: 'Montserrat', Arial, sans-serif !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .ce-tarjetas-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5mm;
    padding: 4mm;
  }

  .ce-tarjeta-item {
    border: 1.5px dashed var(--text-muted);
    border-radius: 6px;
    padding: 4mm 5mm;
    page-break-inside: avoid;
    break-inside: avoid;
    background: #ffffff;
    color: var(--praxeo-navy);
    font-size: 0.82rem;
    line-height: 1.35;
  }

  .ce-tarjeta-header {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--praxeo-navy);
    margin-bottom: 2mm;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 1.5mm;
  }

  .ce-tarjeta-body {
    margin-bottom: 2mm;
  }

  .ce-tarjeta-fila {
    margin: 0 0 1mm;
  }

  .ce-tarjeta-pass {
    margin-top: 2.5mm;
    margin-bottom: 1.5mm;
  }

  .ce-tarjeta-code {
    font-family: monospace;
    font-size: 1rem;
    font-weight: 700;
    background: var(--bg-glass);
    padding: 1px 4px;
    border-radius: 4px;
    border: 1px solid var(--border-glass);
    white-space: nowrap; /* la contraseña nunca se parte en dos líneas (auditor) */
  }

  .ce-tarjeta-vence {
    font-size: 0.74rem;
    color: var(--text-muted);
    margin-top: 1.5mm;
  }

  .ce-tarjeta-footer {
    font-size: 0.7rem;
    color: var(--text-muted);
    border-top: 1px dashed var(--border-glass);
    padding-top: 2mm;
  }

  .pv-print-section {
    margin-bottom: 2rem;
  }

  .pv-print-nueva-pagina {
    page-break-before: always;
    break-before: page;
  }

  .pv-print-portada {
    page-break-after: always;
    break-after: page;
  }

  .pv-print-avoid-break {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .pv-print-landscape {
    page: landscape-sheet;
  }

  .pv-print-table {
    width: 100%;
    border-collapse: collapse;
    page-break-inside: avoid;
    break-inside: avoid;
    margin-bottom: 1.25rem;
    font-size: 8.5pt;
  }

  .pv-print-table th,
  .pv-print-table td {
    border: 1px solid var(--print-border);
    padding: 4px 6px;
    text-align: left;
    color: var(--praxeo-navy);
  }

  .pv-print-table th {
    background-color: var(--print-th-bg);
    font-weight: 600;
  }

  .pv-print-formula {
    font-family: 'Courier New', Courier, monospace;
    background-color: var(--print-th-bg);
    border-left: 3px solid var(--praxeo-navy);
    padding: 4px 8px;
    margin: 6px 0;
    font-size: 8.5pt;
  }

  .pv-print-footer {
    border-top: 1px solid var(--print-border);
    margin-top: 2rem;
    padding-top: 0.5rem;
    font-size: 8pt;
    color: var(--praxeo-navy);
    display: flex;
    justify-content: space-between;
  }
}

/* ==========================================================================
   LABORATORIOS DEMO PLEGABLES (AG-016 / UX-24)
   ========================================================================== */
#ec-laboratorio-demo,
#ct-laboratorio-demo,
details.demo-lab-accordion {
  margin-top: 2rem;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  padding: 1.15rem 1.4rem;
  box-shadow: var(--shadow-card);
}

#ec-laboratorio-demo summary,
#ct-laboratorio-demo summary,
details.demo-lab-accordion summary {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text-main);
  cursor: pointer;
  outline: none;
  padding: 0.25rem 0;
  user-select: none;
  transition: color var(--transition-fast);
}

#ec-laboratorio-demo summary:hover,
#ct-laboratorio-demo summary:hover,
details.demo-lab-accordion summary:hover {
  color: var(--accent-cyan);
}

#ec-laboratorio-demo[open] summary,
#ct-laboratorio-demo[open] summary,
details.demo-lab-accordion[open] summary {
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 0.75rem;
}

/* ==========================================================================
   GESTOR DE USUARIOS Y ACCESOS (ADMIN) - TASK AG-014
   ========================================================================== */
.us-main-card {
  margin-bottom: 1.5rem;
}

.us-resumen-banner {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.us-mensaje {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.us-mensaje-exito {
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald);
  border: 1px solid var(--border-emerald);
}

.us-mensaje-error {
  background: var(--accent-rose-soft);
  color: var(--accent-rose);
  border: 1px solid var(--border-rose);
}

.us-mensaje-info {
  background: var(--accent-cyan-soft);
  color: var(--accent-cyan);
  border: 1px solid var(--border-cyan);
}

.us-toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.us-toolbar #us-input-buscar {
  flex: 1 1 240px;
  min-width: 200px;
}

.us-toolbar .pv-select {
  flex: 0 1 180px;
}

.us-inline-form, .us-confirm-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.us-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
}

.us-pass-help-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.us-help-text {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.us-warning-text {
  font-size: 0.82rem;
  color: var(--accent-amber);
  margin: 0.35rem 0 0.75rem;
  font-weight: 500;
}

.us-confirm-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.75rem;
}

.us-form-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-top: 0.5rem;
}

.us-table-container {
  overflow-x: auto;
}

.us-cell-mono {
  font-family: var(--font-mono);
  font-size: 0.84rem;
}

.us-cell-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.us-btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
}

.us-badge-tu {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: var(--accent-cyan-soft);
  color: var(--accent-cyan);
  font-size: 0.72rem;
  font-weight: 700;
}

.us-badge-activo {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald);
  border: 1px solid var(--border-emerald);
  font-size: 0.74rem;
  font-weight: 600;
}

.us-badge-inactivo {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--accent-rose-soft);
  color: var(--accent-rose);
  border: 1px solid var(--border-rose);
  font-size: 0.74rem;
  font-weight: 600;
}

.us-empty-state {
  text-align: center;
  padding: 2rem 1rem !important;
  color: var(--text-muted);
  font-style: italic;
}

/* =============================================================================
   CAMBIO DE CONTRASEÑA (AG-015)
   ============================================================================= */
.cp-mensaje-error {
  background: var(--accent-rose-soft);
  border: 1px solid var(--border-rose);
  color: var(--accent-rose);
}

.cp-mensaje-exito {
  background: var(--accent-emerald-soft);
  border: 1px solid var(--border-emerald);
  color: var(--accent-emerald);
}

/* Aviso de éxito tras crear la contraseña (auditor) */
.cp-aviso-exito {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  max-width: calc(100% - 2rem);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-emerald);
  border-left: 4px solid var(--accent-emerald);
  color: var(--accent-emerald);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: var(--shadow-card);
}
.cp-aviso-exito[hidden] {
  display: none;
}
@media print {
  .cp-aviso-exito { display: none !important; }
}

/* =============================================================================
   PIE DE PÁGINA UNIFICADO (AG-016 / UX-25)
   ============================================================================= */
.app-footer,
.login-footer-info,
footer.app-footer {
  text-align: center;
  padding: 2rem 0 1rem;
  font-size: 0.76rem;
  color: var(--text-muted);
}


