/* ==========================================================================
   Demo ANÁLISIS MODAL (js/herramientas/modal.js) — slot ≈ 1008 × 666 px
   Fila de controles · puente + indicadores · espectro + tendencia.
   Los dibujos en movimiento van en <canvas>; aquí solo maquetación y estados.
   ========================================================================== */
.demo-modal .mo {
  position: absolute; inset: 0; padding: 14px 20px 14px;
  display: grid; grid-template-rows: 76px 240px minmax(0, 1fr); gap: 10px;
}
.demo-modal canvas { display: block; }

/* ---------- Fila de controles ---------- */
.demo-modal .mo__fila { display: flex; align-items: center; gap: 22px; min-width: 0; }
.demo-modal .mo__modos button { min-width: 104px; }
.demo-modal .mo__pista { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; font: 400 15px/1.35 var(--font-sans); color: var(--fg-2); }
.demo-modal .mo__pista svg { width: 24px; height: 24px; flex: none; color: var(--gamt-teal-text); }
.demo-modal .mo__switch { flex: none; padding-right: 2px; }

/* ---------- Puente + indicadores ---------- */
.demo-modal .mo__medio { display: grid; grid-template-columns: minmax(0, 1fr) 192px; gap: 10px; min-height: 0; }
.demo-modal .mo__puente { position: relative; background: var(--bg-2); border: 1px solid var(--border-1); border-radius: var(--radius-lg); overflow: hidden; }
.demo-modal .mo__puente canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.demo-modal .mo__rotulo { position: absolute; left: 18px; top: 14px; pointer-events: none; }
.demo-modal .mo__rotulo b { display: block; font: 600 20px/1.1 var(--font-display); color: var(--fg-brand); }
.demo-modal .mo__rotulo span { display: block; margin-top: 5px; font: 500 13px/1.2 var(--font-sans); color: var(--fg-2); }
.demo-modal .mo__leyenda { position: absolute; right: 16px; top: 16px; display: flex; gap: 16px; pointer-events: none; }
.demo-modal .mo__leyenda li { display: flex; align-items: center; gap: 8px; font: 500 13px/1 var(--font-sans); color: var(--fg-2); }
.demo-modal .mo__leyenda li.is-off { opacity: .4; }   /* modo 1: sin nodos intermedios */
.demo-modal .mo__ley-sensor { width: 16px; height: 16px; border-radius: 50%; background: var(--gamt-teal); border: 3px solid var(--gamt-white); box-shadow: 0 0 0 1px var(--border-2); }
.demo-modal .mo__ley-nodo { width: 11px; height: 11px; margin: 0 2px; transform: rotate(45deg); background: var(--gamt-white); border: 2px solid var(--gamt-navy); }
.demo-modal .mo__ley-reposo { width: 24px; height: 0; border-top: 2px dashed var(--neutral-400); }
/* Excitación ambiental (estado en vivo): bajo la leyenda, lejos del terreno y de las pilas */
.demo-modal .mo__excita { position: absolute; right: 16px; top: 42px; display: flex; align-items: center; gap: 8px; font: 500 13px/1 var(--font-sans); color: var(--fg-2); pointer-events: none; }
.demo-modal .mo__excita i { width: 9px; height: 9px; border-radius: 50%; background: var(--neutral-400); }
.demo-modal .mo__excita.is-trafico i { background: var(--gamt-blue); }
.demo-modal .mo__excita.is-trafico span { color: var(--fg-brand); }

.demo-modal .mo__kpis { display: grid; grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 8px; min-height: 0; }
.demo-modal .mo__kpi {
  display: flex; flex-direction: column; justify-content: center; min-height: 0;
  padding: 6px 14px; background: var(--bg-1); border: 1px solid var(--border-1); border-radius: 10px; box-shadow: var(--shadow-1);
}
.demo-modal .mo__kpi b { font: 600 12px/1.2 var(--font-sans); letter-spacing: .12em; text-transform: uppercase; color: var(--fg-2); white-space: nowrap; }
.demo-modal .mo__kpi-v { margin-top: 2px; font: 500 24px/1.1 var(--font-mono); font-feature-settings: "tnum" 1, "zero" 1; letter-spacing: .01em; color: var(--gamt-navy); white-space: nowrap; }
.demo-modal .mo__kpi-v small { margin-left: 5px; font: 500 14px/1 var(--font-mono); color: var(--fg-2); }
.demo-modal .mo__kpi-n { margin-top: 2px; font: 500 12px/1.25 var(--font-sans); color: var(--fg-2); white-space: nowrap; }
.demo-modal .mo__kpi-n.is-warn { font: 600 12px/1.25 var(--font-mono); font-feature-settings: "tnum" 1, "zero" 1; color: var(--status-warn-ink); }
/* Triángulo de la delta dibujado en SVG: las fuentes locales no traen ▼ (U+25BC) */
.demo-modal .mo__tri { display: inline-block; width: 9px; height: 7px; margin-right: 6px; vertical-align: 1px; fill: currentColor; stroke: none; }

/* ---------- Espectro + tendencia ---------- */
.demo-modal .mo__baja { display: grid; grid-template-columns: 336px minmax(0, 1fr); gap: 10px; min-height: 0; }
.demo-modal .mo__panel {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  padding: 12px 16px 12px; background: var(--bg-1); border: 1px solid var(--border-1); border-radius: var(--radius-lg);
}
.demo-modal .mo__cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 26px; flex: none; }
.demo-modal .mo__cab b { font: 600 16px/1.2 var(--font-sans); color: var(--fg-1); white-space: nowrap; }
.demo-modal .mo__nota { font: 500 13px/1.2 var(--font-sans); color: var(--fg-2); text-align: right; }
.demo-modal .mo__lienzo { position: relative; flex: 1; min-height: 0; margin-top: 6px; }
.demo-modal .mo__lienzo canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Caso real (lleva a la pantalla de casos) */
.demo-modal .mo__caso {
  flex: none; margin-top: 8px; min-height: 64px; width: 100%;
  display: grid; grid-template-columns: minmax(0, 1fr) 24px; align-items: center; gap: 12px;
  padding: 9px 12px 9px 14px; background: var(--bg-2); border: 1px solid var(--border-1); border-radius: var(--radius-md);
}
.demo-modal .mo__caso:active { background: var(--bg-3); }
.demo-modal .mo__caso.is-warn { border-color: var(--status-warn); }
.demo-modal .mo__caso > svg { width: 24px; height: 24px; color: var(--fg-brand); }
.demo-modal .mo__caso-txt { font: 400 15px/1.38 var(--font-sans); color: var(--fg-1); text-wrap: pretty; }
.demo-modal .mo__caso-txt .tag { vertical-align: 1px; margin: 0 2px; --ok-bg: #E6F7F5; /* fondo de .pill--ok (base.css) */ background: var(--ok-bg); color: var(--gamt-teal-text); }
