/* Living Dossier Studio — RGC PIPC Suite
   Cumplimiento estricto: cero valores hexadecimales (#...), 100% tokens de variables CSS.
   Lienzo Carta/A4 in-situ interactivo con respuesta reactiva a 35ms.
*/

/* Portal y Contenedor del Escáner de Cancha */
.edge-scanner-portal {
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: scannerFadeIn var(--dur) var(--ease);
}

@keyframes scannerFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.edge-scanner-sheet {
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  background: var(--paper);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scannerSlideUp var(--dur) var(--ease);
}

@keyframes scannerSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.scanner-header {
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.scanner-close-btn {
  background: var(--ghost);
  border: none;
  font-size: var(--text-lg);
  color: var(--muted-strong);
  border-radius: var(--radius-full);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.scanner-close-btn:hover {
  background: var(--danger-bg-soft);
  color: var(--danger);
}

.scanner-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.scanner-tab-btn {
  flex: 1;
  padding: 12px;
  border: none;
  background: transparent;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--muted-strong);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}

.scanner-tab-btn.active {
  background: var(--paper);
  color: var(--navy);
  border-bottom: 2px solid var(--navy);
}

.scanner-body {
  padding: var(--space-4);
  overflow-y: auto;
  flex: 1;
}

.scanner-target-zone {
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: var(--space-5);
  text-align: center;
  background: var(--surface);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}

.scanner-target-zone:hover {
  background: var(--info-bg);
  border-color: var(--navy);
}

/* =========================================
   ESTUDIO SOBERANO DE GEMELO VIVO (DESKTOP)
   ========================================= */

.living-dossier-wrapper {
  margin-top: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Conmutador de Modo en Cabecera */
.dossier-mode-switcher {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  padding: 4px;
  border-radius: var(--radius-full);
  border: 1px solid var(--line);
  gap: 4px;
}

.dossier-mode-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--muted-strong);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dossier-mode-btn.active {
  background: var(--navy);
  color: var(--paper);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}

/* Escenario Principal del Estudio */
.living-dossier-stage {
  display: grid;
  grid-template-columns: var(--spine-w, 260px) 1fr 300px;
  gap: var(--space-4);
  align-items: start;
  min-height: 800px;
}

/* Columna Izquierda: Spine Nav */
.dossier-spine-nav {
  position: sticky;
  top: 90px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  box-shadow: 0 4px 14px var(--shadow-sm);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.dossier-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--navy-ink);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}

.dossier-nav-item:hover {
  background: var(--surface-2);
  color: var(--navy);
}

.dossier-nav-item.active {
  background: var(--info-bg-2);
  color: var(--navy);
  border-color: var(--info-line);
}

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

.dossier-badge-dot.completo { background: var(--ok); }
.dossier-badge-dot.observacion { background: var(--warn); }
.dossier-badge-dot.bloqueo { background: var(--danger); animation: pulseAlert 1.5s infinite; }

@keyframes pulseAlert {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
  100% { transform: scale(1); opacity: 1; }
}

/* Columna Central: Pliegos Carta/A4 */
.dossier-canvas-area {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  min-width: 0;
}

.dossier-paper-sheet {
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  padding: 38px 44px;
  position: relative;
  font-family: var(--font-ui);
  color: var(--ink);
  line-height: 1.6;
}

.dossier-sheet-header {
  border-bottom: 2px solid var(--wine);
  padding-bottom: 12px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.dossier-gov-tag {
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--wine);
  text-transform: uppercase;
}

.dossier-sheet-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  margin: 4px 0 0;
}

.dossier-interactive-cell {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  color: var(--navy);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}

.dossier-interactive-cell:hover {
  background: var(--info-bg);
  border-color: var(--navy);
  box-shadow: 0 0 0 2px rgba(36, 71, 109, 0.15);
}

.dossier-interactive-cell.pulse {
  background: var(--ok-bg-soft);
  border-color: var(--ok);
  animation: cellGlow 0.8s ease;
}

@keyframes cellGlow {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Columna Derecha: HUD Normativo Flotante */
.dossier-hud-column {
  position: sticky;
  top: 90px;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.dossier-kpi-box {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-4);
  box-shadow: 0 4px 14px var(--shadow-sm);
}

.dossier-kpi-box h4 {
  margin: 0 0 10px;
  font-size: var(--text-sm);
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dossier-progress-bar {
  height: 8px;
  background: var(--surface-2);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 6px;
}

.dossier-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--wine), var(--ok));
  transition: width 0.4s var(--ease);
}

/* Adaptabilidad Móvil (<= 900px) */
@media (max-width: 900px) {
  .living-dossier-stage {
    grid-template-columns: 1fr;
  }
  .dossier-spine-nav,
  .dossier-hud-column {
    position: static;
    max-height: none;
  }
  .dossier-paper-sheet {
    padding: 20px;
  }
}

/* Aislamiento Limpio: Ocultar vistas heredadas cuando el Estudio de Gemelo Vivo está activo */
body.living-dossier-active .subnav-steps,
body.living-dossier-active #spine,
body.living-dossier-active #main-project-form,
body.living-dossier-active .readiness-graph,
body.living-dossier-active .xlsx-import-panel,
body.living-dossier-active .preflight-card,
body.living-dossier-active .organization-identity-card,
body.living-dossier-active .next-step-radar,
body.living-dossier-active .sticky-actions {
  display: none !important;
}

