/* ==========================================================================================
   Cobertura Móvil del Azuay — Estilos
   Hereda el lenguaje visual de la app OFDM: fuente Nunito, azul de marca, tarjetas
   redondeadas, paleta clara. Adaptado a una interfaz centrada en un mapa a pantalla
   completa con paneles flotantes.
   ========================================================================================== */
:root {
  --ink: #0B2540;
  --ink-soft: #1C3A58;
  --muted: #5B6B7E;
  --muted-2: #94A3B5;
  --line: #E4EAF0;
  --line-soft: #F0F4F8;
  --bg: #F6F9FC;
  --surface: #FFFFFF;
  --brand: #1E54E0;
  --brand-dk: #1642B4;
  --brand-tint: #EEF3FE;
  --green: #18A34B;
  --green-dk: #0F7A38;
  --amber: #E8B400;
  --warn: #E0492F;
  --warn-tint: #FDECEC;
  --claro: #E2231A;
  --movistar: #0066CC;
  --shadow-sm: 0 1px 3px rgba(10,37,64,.05);
  --shadow-md: 0 6px 24px rgba(10,37,64,.10);
  --shadow-lg: 0 20px 56px rgba(10,37,64,.18);
  --header-h: 62px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 600;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }

/* === HEADER === */
.header {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 22px;
  box-shadow: var(--shadow-sm);
  position: relative; z-index: 20;
}
.header .marca { display: flex; align-items: center; gap: 12px; min-width: 0; }
.header .logo {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--brand), #3B7BFF);
  display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 18px;
  box-shadow: var(--shadow-sm);
}
.header h1 { margin: 0; font-size: 17px; font-weight: 900; letter-spacing: -.01em; white-space: nowrap; }
.header .sub { font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 1px; }
.header nav { display: flex; gap: 4px; }
.header nav a {
  padding: 9px 16px; border-radius: 9px; font-size: 13.5px; font-weight: 800;
  color: var(--muted); transition: all .15s;
}
.header nav a:hover { background: var(--line-soft); color: var(--ink); }
.header nav a.activo { background: var(--brand-tint); color: var(--brand-dk); }

/* === LAYOUT MAPA === */
.mapa-wrap { position: relative; height: calc(100vh - var(--header-h)); width: 100%; overflow: hidden; }
#mapa { position: absolute; inset: 0; }

/* Paneles flotantes sobre el mapa */
.panel {
  position: absolute; z-index: 10;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.panel-cabecera {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--line-soft); cursor: default;
}
.panel-cabecera h2 { margin: 0; font-size: 14px; font-weight: 900; color: var(--ink); }
.panel-cabecera .icono { color: var(--muted-2); }
.panel-cuerpo { padding: 12px 14px; }

/* Panel de capas (izquierda) */
#panel-capas { top: 14px; left: 14px; width: min(290px, calc(100vw - 28px)); max-height: calc(100vh - var(--header-h) - 28px); display: flex; flex-direction: column; }
#panel-capas .panel-cuerpo { overflow-y: auto; }

.op-grupo { margin-bottom: 14px; }
.op-titulo {
  display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 900;
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px;
}
.op-punto { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.op-punto.claro { background: var(--claro); }
.op-punto.movistar { background: var(--movistar); }

/* Switch de tecnología */
.tech-fila {
  display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 8px;
  transition: background .15s;
}
.tech-fila:hover { background: var(--line-soft); }
.tech-nombre { font-size: 13.5px; font-weight: 800; color: var(--ink-soft); flex: 1; }
.tech-badge { font-size: 10.5px; font-weight: 800; color: var(--muted); }

.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .pista {
  position: absolute; inset: 0; background: var(--line); border-radius: 999px;
  transition: .2s; cursor: pointer;
}
.switch .pista::before {
  content: ''; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s; box-shadow: var(--shadow-sm);
}
.switch input:checked + .pista { background: var(--brand); }
.switch input:checked + .pista::before { transform: translateX(16px); }

/* Control de opacidad */
.opacidad-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.opacidad-row label { font-size: 11.5px; font-weight: 800; color: var(--muted); white-space: nowrap; }
.opacidad-row input[type=range] { flex: 1; accent-color: var(--brand); }

/* Leyenda (abajo izquierda) */
#leyenda { bottom: 16px; left: 14px; width: min(230px, calc(100vw - 28px)); }
.leyenda-item { display: flex; align-items: center; gap: 9px; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); margin: 5px 0; }
.leyenda-swatch { width: 16px; height: 16px; border-radius: 4px; flex: none; border: 1px solid rgba(0,0,0,.08); }

/* Panel de resultado de punto (derecha) */
#panel-punto { top: 14px; right: 14px; width: min(308px, calc(100vw - 28px)); display: none; }
#panel-punto.visible { display: block; }
.reco {
  background: var(--brand-tint); border-radius: 10px; padding: 11px 12px; margin-bottom: 12px;
}
.reco .lbl { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.reco .op { font-size: 19px; font-weight: 900; color: var(--brand-dk); margin-top: 2px; }
.reco.sin { background: var(--warn-tint); }
.reco.sin .op { color: var(--warn); font-size: 16px; }

.tabla-punto { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tabla-punto th, .tabla-punto td { padding: 7px 6px; border-bottom: 1px solid var(--line-soft); text-align: center; }
.tabla-punto th { font-size: 10.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; }
.tabla-punto td.op-celda { text-align: left; font-weight: 800; }
.celda-nivel { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; color: #fff; }
.celda-no { color: var(--muted-2); font-weight: 800; }

/* Barra de herramientas (arriba centro) */
#toolbar {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 11;
  display: flex; gap: 8px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 6px; box-shadow: var(--shadow-md);
  max-width: calc(100vw - 20px); flex-wrap: wrap; justify-content: center;
}
.tool-btn {
  display: inline-flex; align-items: center; gap: 7px; border: none; background: none;
  font-family: inherit; font-size: 12.5px; font-weight: 800; color: var(--muted);
  padding: 8px 13px; border-radius: 9px; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.tool-btn:hover { background: var(--line-soft); color: var(--ink); }
.tool-btn.activo { background: var(--brand); color: #fff; }
.tool-btn svg { width: 16px; height: 16px; }

/* === BOTONES (compartido con OFDM) === */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none;
  border-radius: 10px; padding: 10px 18px; font-family: inherit; font-size: 12.5px;
  font-weight: 800; letter-spacing: .05em; text-transform: uppercase; cursor: pointer; transition: all .2s;
}
.boton-primario { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.boton-primario:hover { background: var(--brand-dk); box-shadow: var(--shadow-md); }
.boton-suave { background: var(--line-soft); color: var(--ink-soft); }
.boton-suave:hover { background: var(--line); }
.boton-bloque { width: 100%; }

/* Badges */
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 800; }
.badge-azul { background: var(--brand-tint); color: var(--brand-dk); }

.muted { color: var(--muted); }
.nota-mini { font-size: 11.5px; font-weight: 700; color: var(--muted); line-height: 1.45; margin-top: 8px; }

/* Spinner */
.spinner { display:inline-block; width:15px; height:15px; border:2.5px solid rgba(30,84,224,.25); border-top-color: var(--brand); border-radius:50%; animation: girar .8s linear infinite; vertical-align: middle; }
@keyframes girar { to { transform: rotate(360deg); } }

/* Etiqueta de swipe */
.swipe-label {
  position: absolute; top: 70px; z-index: 9; padding: 6px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 900; color: #fff; box-shadow: var(--shadow-md); display: none;
}
.swipe-label.visible { display: block; }
#swipe-izq { left: 18px; background: var(--claro); }
#swipe-der { right: 18px; background: var(--movistar); }

/* === PÁGINA /archivos === */
.doc {
  max-width: 1080px; margin: 0 auto; padding: 28px 22px 80px;
}
.doc h1 { font-size: 30px; font-weight: 900; letter-spacing: -.02em; margin: 8px 0 6px; }
.doc .lead { font-size: 16px; font-weight: 700; color: var(--muted); margin: 0 0 26px; line-height: 1.5; }
.doc h2 { font-size: 21px; font-weight: 900; margin: 34px 0 12px; padding-top: 10px; }
.doc h3 { font-size: 16px; font-weight: 800; color: var(--ink-soft); margin: 20px 0 8px; }
.doc p { font-size: 14.5px; font-weight: 600; line-height: 1.65; color: var(--ink-soft); margin: 0 0 12px; }
.doc strong { color: var(--ink); font-weight: 800; }
.doc code { background: var(--line-soft); border-radius: 5px; padding: 1px 6px; font-size: 13px; font-family: 'Cascadia Code', ui-monospace, monospace; color: var(--brand-dk); }

.tarjeta {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-sm); padding: 20px;
}
.tarjetas-grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }

.stat { text-align: center; padding: 16px 12px; }
.stat .valor { font-size: 30px; font-weight: 900; color: var(--brand-dk); line-height: 1; }
.stat .etq { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-top: 7px; }

/* Diagrama de estructura de carpetas */
.arbol {
  background: #0B2540; color: #D7E3F4; border-radius: 12px; padding: 18px 20px;
  font-family: 'Cascadia Code', ui-monospace, monospace; font-size: 12.5px; font-weight: 500;
  line-height: 1.7; overflow-x: auto;
}
.arbol .dir { color: #6FA8FF; font-weight: 700; }
.arbol .c { color: #7FB98A; }
.arbol .m { color: #F2C36B; }
.arbol .note { color: #7E91A8; }

/* Pasos del pipeline */
.pasos { display: flex; flex-direction: column; gap: 12px; counter-reset: paso; }
.paso { display: flex; gap: 14px; align-items: flex-start; }
.paso::before {
  counter-increment: paso; content: counter(paso);
  flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--brand);
  color: #fff; font-weight: 900; display: grid; place-items: center; font-size: 14px;
}
.paso .txt { padding-top: 3px; }
.paso .txt b { font-weight: 900; }

/* Explorador de datos */
.explorador-controles {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px;
}
.explorador-controles select, .explorador-controles input {
  border: 1.5px solid var(--line); border-radius: 9px; padding: 9px 12px; font-family: inherit;
  font-size: 13.5px; font-weight: 700; color: var(--ink); background: var(--surface); outline: none;
}
.explorador-controles select:focus, .explorador-controles input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(30,84,224,.12); }

.tabla-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.datos { width: 100%; border-collapse: collapse; font-size: 13px; }
table.datos th, table.datos td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); text-align: left; white-space: nowrap; }
table.datos thead th {
  position: sticky; top: 0; background: var(--line-soft); font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .03em; color: var(--muted); z-index: 1;
}
table.datos tbody tr:hover { background: var(--brand-tint); }
table.datos td.num { text-align: right; font-variant-numeric: tabular-nums; }
.swatch-rgb { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: middle; margin-right: 6px; border: 1px solid rgba(0,0,0,.1); }

/* Ranking */
.barra-pct { position: relative; background: var(--line-soft); border-radius: 6px; height: 18px; min-width: 90px; overflow: hidden; }
.barra-pct > span { position: absolute; inset: 0 auto 0 0; background: var(--green); border-radius: 6px; }
.barra-pct > em { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; font-size: 11px; font-weight: 800; color: var(--ink); }

/* === MODAL (ranking) === */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-fondo { position: absolute; inset: 0; background: rgba(10,37,64,.55); animation: fadeIn .2s; }
.modal-caja {
  position: relative; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg);
  width: min(940px, 96vw); max-height: 88vh; display: flex; flex-direction: column; overflow: hidden;
  animation: subir .25s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes subir { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-header h2 { margin: 0; font-size: 17px; font-weight: 900; color: var(--ink); }
.modal-body { padding: 18px 20px; overflow: auto; }

@media (max-width: 900px) {
  .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr 1fr; }
  #panel-capas { width: 250px; }
  #panel-punto { width: 250px; }
  .header h1 { font-size: 15px; }
}

/* Header compacto en pantallas pequeñas (con tres secciones ya no cabe el subtítulo).
   Se mantiene la altura de --header-h para no romper el alto del mapa. */
@media (max-width: 620px) {
  .header { padding: 0 12px; }
  .header .sub { display: none; }
  .header .marca > div { min-width: 0; overflow: hidden; }
  .header h1 { font-size: 13.5px; white-space: normal; line-height: 1.15; }
  .header .logo { width: 30px; height: 30px; font-size: 16px; }
  .header nav { flex: none; }
  .header nav a { padding: 8px 10px; font-size: 12.5px; }
}

/* === PÁGINA /roadmap ===================================================================
   El diagrama es un SVG con la geometría exacta de la versión en LaTeX; lo que se estiliza
   aquí es la página que lo enmarca: ancho, barra de zoom y lienzo.
   ====================================================================================== */
.doc.doc-ancho { max-width: 1400px; }

.rm-barra {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; padding: 10px 0 12px; background: var(--bg);
}
.rm-controles {
  display: flex; align-items: center; gap: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 5px; box-shadow: var(--shadow-sm);
}
.rm-controles .tool-btn { padding: 7px 12px; }
.rm-nivel {
  min-width: 56px; text-align: center; font-size: 12.5px; font-weight: 800;
  color: var(--ink-soft); font-variant-numeric: tabular-nums;
}

/* Lienzo: la tarjeta blanca donde vive el diagrama */
.rm-lienzo {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-sm); padding: 18px; overflow: auto;
}
.rm-hoja { margin: 0 auto; }
.rm-lienzo svg { display: block; width: 100%; height: auto; }

/* El SVG trae sus propias fuentes incrustadas (las mismas del PDF): no se tocan aquí.
   Bloques con explicación: solo cambia el cursor, sin sombra ni efecto al pasar el ratón.
   El contorno aparece únicamente al navegar con el teclado. */
#diagrama .rm-clicable { cursor: pointer; outline: none; }
#diagrama .rm-clicable:focus-visible > path:first-of-type,
#diagrama .barra.rm-clicable:focus-visible path { stroke: #0B2540; stroke-width: 2.2; }

.rm-ayuda { font-size: 12.5px; font-weight: 700; color: var(--muted); margin-right: auto; }
.rm-ayuda b { color: var(--ink); font-weight: 900; }

@media (max-width: 620px) {
  .rm-lienzo { padding: 10px; border-radius: 12px; }
  .rm-barra { padding-top: 4px; }
  .rm-barra .boton { width: 100%; }
}

/* === POPUP DE EXPLICACIÓN (/roadmap) ===================================================
   Reutiliza .modal / .modal-caja / .modal-header / .modal-body de la app. El color de la
   etapa llega en las variables --etapa y --etapa-tinte (las pone roadmap.js).
   ====================================================================================== */
.modal[hidden] { display: none; }
body.rm-sin-scroll { overflow: hidden; }

.rm-modal { --etapa: #7030A0; --etapa-tinte: #F2EBF7; }
.rm-caja { width: min(980px, 96vw); max-height: 90vh; border-top: 5px solid var(--etapa); }
.rm-cabecera { align-items: flex-start; }
.rm-cabecera-txt { min-width: 0; }
.rm-etiquetas { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.rm-chip-etapa, .rm-chip-tipo {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 800;
}
.rm-chip-etapa { background: var(--etapa-tinte); color: var(--etapa); }
.rm-chip-tipo { background: var(--line-soft); color: var(--muted); }
.rm-cabecera h2 { font-size: 20px !important; line-height: 1.25; }
.rm-cerrar {
  flex: none; width: 36px; height: 36px; border: none; border-radius: 10px; cursor: pointer;
  background: var(--line-soft); color: var(--ink-soft); font-size: 22px; line-height: 1;
  font-family: inherit; font-weight: 700;
}
.rm-cerrar:hover { background: var(--line); }

.rm-cuerpo { padding: 20px 24px 8px; }
.rm-cuerpo h3 {
  font-size: 15px; font-weight: 900; color: var(--ink); margin: 26px 0 10px;
  padding-left: 10px; border-left: 4px solid var(--etapa);
}
.rm-cuerpo p, .rm-cuerpo li { font-size: 14.5px; font-weight: 600; line-height: 1.65; color: var(--ink-soft); }
.rm-cuerpo p { margin: 0 0 10px; }
.rm-cuerpo ul { margin: 0 0 10px; padding-left: 22px; }
.rm-cuerpo strong, .rm-cuerpo b { color: var(--ink); font-weight: 800; }
.rm-cuerpo code {
  background: var(--line-soft); border-radius: 5px; padding: 1px 6px; font-size: 12.5px;
  font-family: 'Cascadia Code', ui-monospace, Consolas, monospace; color: var(--brand-dk);
}

/* Réplica del bloque: una copia exacta del símbolo del diagrama */
.rm-simbolo {
  position: relative; margin: 6px 0 18px; padding: 18px 14px 12px; text-align: center;
  border: 1px solid var(--line); border-radius: 12px; background: #FAFBFD;
}
.rm-simbolo-svg { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.rm-simbolo-etq {
  position: absolute; top: -9px; left: 12px; padding: 0 6px; background: #fff; border-radius: 4px;
  font-family: 'Nunito', sans-serif; font-size: 10.5px; font-weight: 800; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted);
}

.rm-lema {
  font-size: 16px !important; font-weight: 700 !important; color: var(--ink) !important;
  line-height: 1.55 !important; margin-bottom: 4px !important;
}

/* "En esta tesis" */
.rm-tesis {
  margin: 16px 0; padding: 14px 16px; border-radius: 12px; background: var(--etapa-tinte);
  border-left: 4px solid var(--etapa); font-size: 14.5px; font-weight: 600; line-height: 1.6;
  color: var(--ink-soft);
}
.rm-tesis strong:first-child { color: var(--etapa); }

/* Glosario de términos del bloque */
.rm-terminos { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin: 0; }
.rm-terminos > div {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface);
}
.rm-terminos dt { font-size: 14px; font-weight: 900; color: var(--etapa); margin-bottom: 4px; }
.rm-terminos dd { margin: 0; font-size: 13.5px; font-weight: 600; line-height: 1.55; color: var(--ink-soft); }

/* Fórmulas (KaTeX) */
.rm-cuerpo .katex-display {
  margin: 8px 0 12px; padding: 12px 10px; background: #FAFBFD; border: 1px solid var(--line-soft);
  border-radius: 12px; overflow-x: auto; overflow-y: hidden;
}
.rm-cuerpo .katex { font-size: 1.08em; }

/* Ejemplos */
.rm-ejemplo {
  margin: 10px 0 12px; padding: 14px 16px; border-radius: 12px;
  background: #FFF8E6; border: 1px solid #F3E2B3;
}
.rm-ejemplo p:last-child { margin-bottom: 0; }
.rm-nota { font-size: 12.5px !important; color: var(--muted) !important; font-style: italic; }

/* Código Python */
.rm-cuerpo pre { margin: 8px 0 14px; border-radius: 12px; overflow: auto; background: #0B2540; }
.rm-cuerpo pre code, .rm-cuerpo pre code.hljs {
  display: block; padding: 14px 16px; background: #0B2540; color: #D7E3F4;
  font-size: 12.5px; line-height: 1.6; border-radius: 12px;
}

/* Tablas */
.rm-cuerpo .tabla-wrap { margin: 8px 0 10px; }
.rm-cuerpo table.datos td, .rm-cuerpo table.datos th { white-space: nowrap; }
.rm-fila-ganadora td { background: var(--etapa-tinte); }

/* Pasos numerados */
.rm-pasos { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 10px; }
.rm-paso {
  display: flex; gap: 12px; align-items: flex-start; font-size: 14.5px; font-weight: 600;
  line-height: 1.6; color: var(--ink-soft);
}
.rm-paso > span {
  flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--etapa); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 900; margin-top: 1px;
}

/* Entra / Sale */
.rm-io { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 24px 0 14px; }
.rm-io > div {
  border: 1px dashed var(--line); border-radius: 12px; padding: 10px 14px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-soft); line-height: 1.5;
}
.rm-io span {
  display: block; font-size: 10.5px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em;
  color: var(--etapa); margin-bottom: 3px;
}

/* Validación cruzada por bloques */
.rm-bloques { display: flex; gap: 16px; align-items: center; margin: 6px 0 10px; flex-wrap: wrap; }
.rm-bloques-malla { display: grid; grid-template-columns: repeat(5, 38px); gap: 4px; }
.rm-bloques-malla span {
  height: 38px; border-radius: 6px; display: grid; place-items: center; font-size: 12px; font-weight: 900;
  background: var(--etapa-tinte); color: var(--etapa); border: 1px solid rgba(112,48,160,.25);
}
.rm-bloques-malla span.prueba { background: #F4A340; color: #fff; border-color: #E08A1E; }
.rm-bloques p { flex: 1; min-width: 220px; margin: 0; }

/* Matriz de confusión */
.rm-matriz { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin: 8px 0 10px; }
.rm-matriz-tabla { display: grid; grid-template-columns: auto 1fr 1fr; gap: 4px; min-width: 330px; }
.rm-matriz-tabla > div { padding: 10px; border-radius: 8px; font-size: 13px; font-weight: 800; text-align: center; }
.rm-matriz-tabla .cab { background: none; color: var(--muted); font-size: 11.5px; display: grid; place-items: center; }
.rm-matriz-tabla .ok { background: #E3F5EA; color: var(--green-dk); }
.rm-matriz-tabla .mal { background: var(--warn-tint); color: var(--warn); }

/* Barras de importancia */
.rm-barras { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.rm-barras > div { display: grid; grid-template-columns: 150px 1fr 44px; gap: 10px; align-items: center; }
.rm-barras span { font-family: 'Cascadia Code', ui-monospace, monospace; font-size: 12.5px; color: var(--ink-soft); }
.rm-barras i { display: block; height: 14px; border-radius: 4px; background: var(--etapa); width: var(--v); }
.rm-barras i.resto { background: var(--muted-2); }
.rm-barras b { font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums; }

/* Escala de colores del mapa de idoneidad */
.rm-escala { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 8px 0 10px; }
.rm-escala > div {
  background: var(--c); border-radius: 8px; padding: 10px 6px; text-align: center;
  font-size: 12px; font-weight: 700; color: var(--ink-soft);
}
.rm-escala > div.osc { color: #fff; }
.rm-escala b { display: block; font-size: 12.5px; font-weight: 900; }

/* Camino del conector */
.rm-camino { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0 12px; }
.rm-camino > span {
  padding: 8px 12px; border-radius: 10px; border: 1.5px solid var(--line); font-size: 13px; font-weight: 700;
  color: var(--ink-soft); background: #fff;
}
.rm-camino > span.a {
  width: 34px; height: 34px; padding: 0; border-radius: 50%; display: grid; place-items: center;
  border-color: #4D4D4D; font-weight: 900; color: var(--ink);
}
.rm-camino > i { font-style: normal; font-size: 12px; font-weight: 900; color: var(--muted); }
.rm-camino > i::after { content: " →"; }

/* Pie del popup: navegación */
.rm-pie {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 20px; border-top: 1px solid var(--line);
}
.rm-pie .boton:disabled { opacity: .4; cursor: default; }
.rm-posicion { font-size: 12.5px; font-weight: 800; color: var(--muted); white-space: nowrap; }

@media (max-width: 700px) {
  .rm-cuerpo { padding: 16px 14px 6px; }
  .rm-io { grid-template-columns: 1fr; }
  .rm-barras > div { grid-template-columns: 110px 1fr 40px; }
  .rm-escala { grid-template-columns: repeat(3, 1fr); }
  .rm-matriz-tabla { min-width: 0; width: 100%; }
  .rm-ayuda { order: 3; width: 100%; }
  .rm-pie .boton { padding: 10px 16px; font-size: 16px; }
  .rm-txt-btn { display: none; }
}

/* === PÁGINA /cronograma =================================================================
   El roadmap con fechas. Hereda la tipografía y la paleta del resto de la app; cada
   actividad se tiñe con el color de su etapa a través de las variables --c y --t.
   ====================================================================================== */
.cr { padding-bottom: 60px; }

/* Cifras de cabecera */
.cr-cifras {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px;
  margin: 0 0 20px;
}
.cr-cifras > div {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; box-shadow: var(--shadow-sm);
}
.cr-cifras b { display: block; font-size: 22px; font-weight: 900; letter-spacing: -.02em; }
.cr-cifras span { font-size: 11.5px; font-weight: 800; color: var(--muted); }

/* Advertencia */
.cr-aviso {
  background: var(--warn-tint); border: 1px solid #F3C4BC; border-left: 5px solid var(--warn);
  border-radius: 12px; padding: 14px 18px; margin: 0 0 16px;
}
.cr-aviso-etq {
  font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em;
  color: var(--warn); margin-bottom: 6px;
}
.cr-aviso p { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.6; color: var(--ink); }

/* Plegable de supuestos */
.cr-plegable {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 16px; margin: 0 0 22px;
}
.cr-plegable > summary {
  cursor: pointer; font-size: 14px; font-weight: 800; color: var(--ink-soft); list-style: none;
}
.cr-plegable > summary::before { content: "▸ "; color: var(--muted-2); }
.cr-plegable[open] > summary::before { content: "▾ "; }
.cr-lista { margin: 12px 0 6px; padding-left: 20px; }
.cr-lista li { font-size: 13.5px; font-weight: 600; line-height: 1.6; color: var(--ink-soft); margin-bottom: 7px; }

/* Pestañas */
.cr-tabs {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); padding-bottom: 10px; margin: 0 0 18px;
  position: sticky; top: 0; background: var(--bg); z-index: 5; padding-top: 10px;
}
.cr-tab {
  border: 1px solid transparent; background: none; cursor: pointer; font-family: inherit;
  padding: 8px 14px; border-radius: 9px; font-size: 13.5px; font-weight: 800; color: var(--muted);
}
.cr-tab:hover { background: var(--line-soft); color: var(--ink); }
.cr-tab.activo { background: var(--brand-tint); color: var(--brand-dk); }
.cr-tabs-sep { flex: 1; }

/* Filtros por etapa / carril */
.cr-filtros { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 18px; }
.cr-filtros > span { font-size: 12.5px; font-weight: 800; color: var(--muted); margin-right: 4px; }
.cr-chip {
  --c: var(--muted); --t: var(--line-soft);
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-family: inherit;
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 800; color: var(--muted);
}
.cr-chip:hover { border-color: var(--c); color: var(--c); }
.cr-chip.activo { background: var(--t); border-color: var(--c); color: var(--c); }

/* Semana */
.cr-semana {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px 18px; margin: 0 0 16px; box-shadow: var(--shadow-sm);
}
.cr-semana.cr-vacio { display: none; }
.cr-semana.completa { border-color: #BFE3CC; }
.cr-sem-cab { display: flex; align-items: center; gap: 14px; }
.cr-sem-n {
  width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center;
  background: var(--brand-tint); color: var(--brand-dk); font-weight: 900; font-size: 15px;
}
.cr-sem-txt { min-width: 0; flex: 1; }
.cr-sem-txt h2 { margin: 0; font-size: 17px; font-weight: 900; padding: 0; }
.cr-sem-fechas { margin: 2px 0 0; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.cr-sem-prog { display: flex; align-items: center; gap: 8px; flex: none; }
.cr-sem-prog i { display: block; width: 90px; height: 7px; border-radius: 999px; background: var(--line); position: relative; }
.cr-sem-prog i::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: var(--p, 0%);
  background: var(--green); border-radius: 999px; transition: width .2s;
}
.cr-sem-prog span { font-size: 11.5px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.cr-sem-toggle {
  border: none; background: none; cursor: pointer; font-size: 16px; color: var(--muted-2);
  padding: 4px 8px; border-radius: 8px;
}
.cr-sem-toggle:hover { background: var(--line-soft); color: var(--ink); }
.cr-sem-obj, .cr-sem-nota {
  margin: 12px 0 0; font-size: 13.5px; font-weight: 600; line-height: 1.6; color: var(--ink-soft);
}
.cr-sem-nota { background: var(--line-soft); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.cr-semana.plegada .cr-sem-cuerpo,
.cr-semana.plegada .cr-sem-obj,
.cr-semana.plegada .cr-sem-nota { display: none; }

/* Día */
.cr-dia { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.cr-dia.cr-vacio { opacity: .35; }
.cr-dia.es-hoy, .cr-dia.es-proximo {
  border-left: 3px solid var(--brand); padding-left: 12px; margin-left: -15px;
  border-radius: 0 10px 10px 0; background: var(--brand-tint);
}
.cr-dia.es-proximo { border-left-color: var(--muted-2); background: var(--line-soft); }
.cr-dia-cab { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.cr-fecha { display: flex; align-items: baseline; gap: 7px; flex: none; }
.cr-fecha b { font-size: 14.5px; font-weight: 900; color: var(--ink); }
.cr-fecha span { font-size: 13px; font-weight: 700; color: var(--muted); }
.cr-feriado {
  font-size: 10.5px; font-weight: 800; font-style: normal; color: var(--amber);
  background: #FDF6E0; border-radius: 6px; padding: 2px 7px;
}
.cr-foco { flex: 1; min-width: 180px; font-size: 13.5px; font-weight: 700; color: var(--ink-soft); }
.cr-dia-h {
  font-size: 11.5px; font-weight: 800; color: var(--muted); background: var(--line-soft);
  border-radius: 6px; padding: 3px 8px; flex: none;
}

/* Actividad */
.cr-act {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 12px;
  padding: 12px 14px; margin: 0 0 8px; background: var(--surface);
}
.cr-act[hidden] { display: none; }
.cr-act.hecha { opacity: .5; }
.cr-act.hecha .cr-act-cab h3 { text-decoration: line-through; }
.cr-check { flex: none; cursor: pointer; padding-top: 2px; }
.cr-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.cr-check span {
  display: block; width: 18px; height: 18px; border: 2px solid var(--line);
  border-radius: 6px; transition: all .15s;
}
.cr-check input:checked + span { background: var(--green); border-color: var(--green); }
.cr-check input:checked + span::after {
  content: "✓"; display: block; color: #fff; font-size: 12px; font-weight: 900;
  line-height: 14px; text-align: center;
}
.cr-check input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.cr-act-txt { min-width: 0; flex: 1; }
.cr-act-cab { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cr-act-cab h3 { margin: 0; font-size: 14.5px; font-weight: 900; color: var(--ink); flex: 1; min-width: 200px; }
.cr-h {
  font-size: 11.5px; font-weight: 900; color: var(--c); background: var(--t);
  border-radius: 6px; padding: 2px 8px; flex: none;
}
.cr-quien { font-size: 11.5px; font-weight: 800; color: var(--muted); flex: none; }

.cr-bloques { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 0; }
.cr-bloque {
  font-size: 11.5px; font-weight: 800; color: var(--ink-soft); background: var(--line-soft);
  border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px;
}
.cr-bloque:hover { background: var(--t); border-color: var(--c); color: var(--c); }

.cr-pasos { margin: 9px 0 0; padding-left: 20px; }
.cr-pasos li { font-size: 13.5px; font-weight: 600; line-height: 1.6; color: var(--ink-soft); margin-bottom: 5px; }

.cr-cierre { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 0; }
.cr-cierre > div { background: var(--line-soft); border-radius: 9px; padding: 8px 11px; }
.cr-cierre span {
  display: block; font-size: 10px; font-weight: 900; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin-bottom: 3px;
}
.cr-cierre p { margin: 0; font-size: 13px; font-weight: 600; line-height: 1.5; color: var(--ink-soft); }

.cr-cmd { margin: 9px 0 0; background: var(--ink); border-radius: 9px; padding: 9px 12px; overflow-x: auto; }
.cr-cmd code {
  font-family: 'Cascadia Code', ui-monospace, monospace; font-size: 12px;
  color: #CBE0F7; white-space: pre-wrap; word-break: break-word;
}
.cr-recurso { margin: 8px 0 0; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.cr-recurso span {
  font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em;
  color: var(--c); margin-right: 5px;
}
.cr-recurso em { font-style: normal; color: var(--muted-2); }

/* Carril de Freddy */
.cr-freddy { margin: 20px 0 0; padding: 14px 16px; background: var(--line-soft); border-radius: 12px; }
.cr-freddy h3 { margin: 0 0 2px; font-size: 14px; font-weight: 900; color: var(--ink); }
.cr-ftarea { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; margin-top: 9px; }
.cr-ftarea-cab { display: flex; align-items: baseline; gap: 8px; }
.cr-ftarea-cab h4 { margin: 0; font-size: 13.5px; font-weight: 900; flex: 1; }
.cr-ftarea-cab span { font-size: 11.5px; font-weight: 800; color: var(--muted); }
.cr-fguia { margin: 6px 0 0; font-size: 13px; font-weight: 600; line-height: 1.55; color: var(--ink-soft); }

/* Tablas y vistas secundarias */
.cr-intro { font-size: 14px; font-weight: 700; color: var(--muted); line-height: 1.6; margin: 0 0 16px; }
.cr-et-tit { font-size: 16px !important; color: var(--c); border-bottom: 2px solid var(--c); padding-bottom: 6px !important; }
table.datos.cr-tabla { width: 100%; table-layout: fixed; }
table.datos.cr-tabla td, table.datos.cr-tabla th {
  font-size: 12.5px; vertical-align: top; white-space: normal; word-break: break-word;
}
table.datos.cr-tabla td.cr-nw { white-space: nowrap; }
.cr-tabla th:nth-child(1), .cr-tabla td:nth-child(1) { width: 22%; }
.cr-tabla th:nth-child(2), .cr-tabla td:nth-child(2) { width: 8%; }
.cr-tabla th:nth-child(3), .cr-tabla td:nth-child(3),
.cr-tabla th:nth-child(4), .cr-tabla td:nth-child(4) { width: 9%; }
.cr-tabla th:nth-child(5), .cr-tabla td:nth-child(5) { width: 17%; }
.cr-nw { white-space: nowrap; font-variant-numeric: tabular-nums; }
.cr-dep { font-family: 'Cascadia Code', ui-monospace, monospace; font-size: 11px; color: var(--muted); }

.cr-tipo {
  font-size: 10.5px; font-weight: 800; color: var(--muted); background: var(--line-soft);
  border-radius: 5px; padding: 2px 7px; white-space: nowrap;
}

/* Hitos */
.cr-hitos { list-style: none; margin: 0; padding: 0 0 0 4px; }
.cr-hito { display: flex; gap: 16px; padding: 0 0 16px 20px; border-left: 2px solid var(--line); position: relative; }
.cr-hito::before {
  content: ""; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--brand); border: 2px solid var(--surface);
}
.cr-hito-producto::before { background: var(--green); }
.cr-hito-f { flex: none; font-size: 12.5px; font-weight: 800; color: var(--muted); width: 88px; font-variant-numeric: tabular-nums; }
.cr-hito-txt h3 { margin: 0 0 3px; font-size: 14.5px; font-weight: 900; }
.cr-hito-txt p { margin: 0; font-size: 13.5px; font-weight: 600; line-height: 1.55; color: var(--ink-soft); }

/* Riesgos */
.cr-riesgos { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; margin: 0 0 30px; }
.cr-riesgo { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; }
.cr-riesgo-cab { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 9px; }
.cr-riesgo-id {
  font-size: 11px; font-weight: 900; color: var(--warn); background: var(--warn-tint);
  border-radius: 6px; padding: 2px 7px; flex: none;
}
.cr-riesgo-cab h3 { margin: 0; font-size: 14px; font-weight: 900; flex: 1; min-width: 180px; }
.cr-riesgo-f { font-size: 11px; font-weight: 800; color: var(--muted); }
.cr-riesgo dl { margin: 0; }
.cr-riesgo dl > div { margin-bottom: 7px; }
.cr-riesgo dt {
  font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin-bottom: 2px;
}
.cr-riesgo dd { margin: 0; font-size: 13px; font-weight: 600; line-height: 1.55; color: var(--ink-soft); }

@media (max-width: 720px) {
  .cr-cierre { grid-template-columns: 1fr; }
  .cr-sem-prog i { width: 56px; }
  .cr-tabs { position: static; }
  .cr-hito-f { width: 78px; }
}
/* Dentro del bloque de comando no se repinta el chip claro de .doc code */
.cr-cmd code { background: none; padding: 0; color: #CBE0F7; }
.cr-pasos code, .cr-cierre code, .cr-fguia code, .cr-aviso code, .cr-act-cab code,
.cr-riesgo dd code, .cr-cierre-td code { font-size: 12px; }
/* Las rutas largas no deben ensanchar la tarjeta en pantallas estrechas */
.cr-cierre > div { min-width: 0; }
.cr-act-txt, .cr-pasos li, .cr-cierre p, .cr-fguia { overflow-wrap: anywhere; }
.cr-bloques { max-width: 100%; }
