/* 🔬 Forense — one live aisys decision, audited. Its palette is mapped onto the app theme
   (shell.css) so light mode holds. */
#fx-wrap {
  --borde: var(--border); --tenue: var(--text-dim); --texto: var(--text);
  --ok: var(--buy); --error: var(--sell); --aviso: var(--incomplete); --acento: var(--selected);
  --panel-alto: rgba(127,127,127,.08); --gris: var(--text-dim);
  padding: 14px 20px 60px;
}
/* Inside the Strategy Monitor (the 🕵 Forense pill): the page already pads. */
#vm-wrap #fx-wrap { padding: 12px 0 60px; }
#fx-wrap[hidden] { display: none; }
.fx-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.fx-head h1 { font-size: 20px; margin: 0 0 4px; }
.fx-sub { margin: 0; color: var(--tenue); font-size: 12.5px; max-width: 90ch; }
.fx-sub code { font-size: 11.5px; background: var(--panel-alto); padding: 1px 5px; border-radius: 4px; }
.fx-controles { display: flex; gap: 14px; align-items: center; font-size: 12px; color: var(--tenue); }
.fx-controles label { display: flex; gap: 6px; align-items: center; }
.fx-controles select { background: var(--panel); color: var(--texto); border: 1px solid var(--borde); border-radius: 4px; padding: 3px 6px; font: inherit; }
#fx-wrap .pie { font-size: 11px; color: var(--tenue); margin: 8px 0 0; line-height: 1.5; }
#fx-wrap .pie code { font-size: 11px; }
#fx-wrap button.pequeno { font-size: 11px; padding: 2px 8px; background: var(--panel); color: var(--texto); border: 1px solid var(--borde); border-radius: 4px; cursor: pointer; }
#fx-wrap button.pequeno:hover { border-color: var(--acento); }
#fx-wrap .oculto { display: none; }
/* ══ FORENSE DE AISYS — una decisión, reconstruida ═════════════════════════════════════════════ */
.fx-main { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; padding-top: 14px; align-items: start; }
.fx-check { flex-direction: row !important; align-items: center; gap: 6px !important; font-size: 12px !important; }
.fx-lista { position: sticky; top: 12px; background: var(--panel); border: 1px solid var(--borde); border-radius: 4px; padding: 10px; max-height: calc(100vh - 110px); overflow: auto; }
.fx-lista-resumen { font-size: 12px; color: var(--tenue); margin-bottom: 8px; line-height: 1.4; }
.fx-casos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.fx-casos li { display: grid; grid-template-columns: 40px 44px 1fr; grid-template-rows: auto auto; column-gap: 6px; padding: 6px 8px; border-radius: 4px; cursor: pointer; border-left: 3px solid transparent; font-size: 12.5px; }
.fx-casos li:hover { background: var(--panel-alto); }
.fx-casos li.activo { background: color-mix(in srgb, var(--accent) 14%, transparent); border-left-color: var(--acento); }
.fx-casos li.nulo { border-left-color: var(--error); }
.fx-casos li.activo.nulo { border-left-color: var(--acento); }
.fx-casos li small { grid-column: 1 / -1; font-size: 11px; color: var(--error); }
.fx-casos li small.ok { color: var(--tenue); }
.fx-dia { color: var(--tenue); }
.fx-sen { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--borde); color: var(--tenue); justify-self: start; }
.fx-sen.s1 { color: var(--ok); border-color: color-mix(in srgb, var(--up) 50%, transparent); }
.fx-sen.s-1 { color: var(--error); border-color: color-mix(in srgb, var(--down) 50%, transparent); }

.fx-caso { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.fx-vacio { color: var(--tenue); padding: 40px 0; text-align: center; }
.fx-loading { color: var(--tenue); padding: 60px 0; text-align: center; font-size: 15px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.fx-loading small { font-size: 12px; }
.fx-loading .vm-monkey { font-size: 28px; animation: fx-hop 2s ease-in-out infinite; display: inline-block; }

.fx-veredicto { background: var(--panel); border: 1px solid var(--borde); border-left: 6px solid var(--ok); border-radius: 4px; padding: 14px 18px; }
.fx-veredicto.error { border-left-color: var(--error); }
.fx-veredicto header { font-size: 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.fx-veredicto ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14.5px; line-height: 1.5; }
.fx-veredicto code, .fx-bloque code { background: var(--panel-alto); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.fx-etiqueta { font-size: 11px; font-weight: 700; letter-spacing: .06em; padding: 3px 10px; border-radius: 4px; background: var(--ok); color: #fff; }
.fx-etiqueta.error { background: var(--error); }
#fx-wrap .rojo { color: var(--error); }
#fx-wrap .verde { color: var(--ok); }

.fx-bloque { background: var(--panel); border: 1px solid var(--borde); border-radius: 4px; padding: 12px 14px; min-width: 0; }
.fx-bloque h3 { margin: 0 0 8px; font-size: 13.5px; }
.fx-bloque h3 small { font-weight: 400; color: var(--tenue); margin-left: 6px; }
.fx-bloque summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.fx-dos { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 14px; }

.fx-tabla { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: 12.5px; }
.fx-tabla th { color: var(--tenue); font-weight: 500; text-align: left; padding: 4px 6px; font-size: 11.5px; }
.fx-tabla td { background: var(--panel-alto); border-radius: 4px; padding: 6px 8px; font-variant-numeric: tabular-nums; }
.fx-tabla td small { display: block; font-size: 10.5px; color: var(--tenue); }
.fx-tabla td.nulo { background: color-mix(in srgb, var(--down) 20%, transparent); border: 1px solid var(--error); color: var(--down); }
.fx-tabla td.nulo b { color: var(--error); }
.fx-tabla td.nulo small { color: var(--down); }
.fx-tabla td.cambio { border: 1px solid var(--aviso); }
.fx-tabla td.falta { background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--down) 15%, transparent), color-mix(in srgb, var(--down) 15%, transparent) 6px, transparent 6px, transparent 12px); color: var(--error); }
.fx-impacto td { text-align: center; }
.fx-otras { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.fx-pre { white-space: pre-wrap; font-size: 12px; color: var(--tenue); background: var(--panel-alto); padding: 10px; border-radius: 4px; max-height: 320px; overflow: auto; }
@keyframes fx-hop { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-8px) } }

@media (max-width: 1300px) { .fx-dos { grid-template-columns: minmax(0, 1fr); } }
.fx-main { grid-template-columns: 330px minmax(0, 1fr); }
.fx-casos li { grid-template-columns: 40px 44px 1fr; }
.fx-chips { display: flex; flex-wrap: wrap; gap: 3px; }
.fx-chip { font-size: 10.5px; font-weight: 600; padding: 1px 5px; border-radius: 4px; background: var(--panel-alto); color: var(--tenue); white-space: nowrap; }
.fx-chip.s1 { color: var(--ok); background: color-mix(in srgb, var(--up) 12%, transparent); }
.fx-chip.s-1 { color: var(--error); background: color-mix(in srgb, var(--down) 12%, transparent); }
.fx-casos li.sin-of { cursor: default; opacity: .6; }
.fx-main { grid-template-columns: 370px minmax(0, 1fr); } .fx-chips { flex-wrap: nowrap; }

/* ── forense: la línea de tiempo ── */
.tl-lectura { font-size: 15px; margin: 2px 0 10px; }
.tl-lectura.mal b { color: var(--error); }
.tl-linea { position: relative; height: 170px; margin: 0 8px; }
.tl-eje { position: absolute; left: 0; right: 0; top: 84px; height: 3px; background: var(--borde); border-radius: 2px; }
.tl-hueco { position: absolute; top: 76px; height: 19px; background: color-mix(in srgb, var(--down) 28%, transparent); border: 1px solid var(--error); border-radius: 4px; }
.tl-hueco span { position: absolute; left: 6px; top: 1px; font-size: 11px; color: var(--down); white-space: nowrap; }
.tl-hito { position: absolute; top: 0; height: 170px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; }
.tl-punto { position: absolute; top: 76px; width: 18px; height: 18px; border-radius: 50%; background: var(--tenue); border: 2px solid var(--panel);
  display: flex; align-items: center; justify-content: center; font-size: 13px; color: #fff; z-index: 2; }
.tl-hito.barra .tl-punto { background: var(--gris, var(--text-dim)); }
.tl-hito.mal .tl-punto { background: var(--error); }
.tl-hito.bien .tl-punto { background: var(--ok); }
.tl-hito.fuente .tl-punto { background: var(--aviso); border-radius: 3px; transform: rotate(45deg); font-size: 0; }
.tl-hito.aisys .tl-punto { background: var(--acento); width: 26px; height: 26px; top: 72px; font-size: 16px; }
.tl-texto { position: absolute; width: 150px; text-align: center; font-size: 11.5px; line-height: 1.3; color: var(--texto); }
.tl-texto b { display: block; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.tl-hito.arriba .tl-texto { bottom: 104px; }
.tl-hito.abajo .tl-texto { top: 104px; }
.tl-hito.aisys .tl-texto b { color: var(--acento); }
.tl-hito.mal .tl-texto b, .tl-hito.fuente .tl-texto b { color: var(--aviso); }
.tl-hito.bien .tl-texto b { color: var(--ok); }
.tl-pasos { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; }
.tl-pasos li { display: grid; grid-template-columns: 64px 70px 14px 1fr; align-items: start; gap: 8px; padding: 5px 0; border-top: 1px dashed var(--borde); font-size: 13px; }
.tl-pasos li:first-child { border-top: 0; }
.tl-gap { grid-column: 1; color: var(--tenue); font-size: 11px; text-align: right; padding-top: 2px; }
.tl-hora { font-variant-numeric: tabular-nums; font-weight: 600; }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--tenue); margin-top: 5px; }
.tl-pasos li.mal .tl-dot, .tl-pasos li.merge .tl-dot { background: var(--error); }
.tl-pasos li.bien .tl-dot, .tl-pasos li.fuente-ok .tl-dot { background: var(--ok); }
.tl-pasos li.fuente .tl-dot { background: var(--aviso); }
.tl-pasos li.aisys .tl-dot, .tl-pasos li.signal .tl-dot { background: var(--acento); }
.tl-pasos li.fuente-ok { opacity: .65; }
.tl-pasos small { display: block; color: var(--tenue); font-size: 12px; }

.tl-svg { width: 100%; height: auto; display: block; margin: 4px 0 6px; }
.fx-q { border-top: 1px dashed var(--borde); padding: 10px 0; }
.fx-q:first-child { border-top: 0; }
.fx-q header { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: start; }
.fx-q header small { display: block; color: var(--tenue); font-size: 12px; }
.fx-q-n { width: 24px; height: 24px; border-radius: 50%; background: var(--acento); color: #fff; font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.fx-sql { margin: 8px 0 4px 36px; background: var(--bg); border: 1px solid var(--borde); border-radius: 4px; padding: 10px 12px; font-size: 12px; color: var(--accent); overflow-x: auto; white-space: pre; }
.fx-espera { margin: 0 0 0 36px; font-size: 12px; color: var(--ok); }

/* ── forense: el paso a paso ── */
.fx-seccion { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--tenue); margin: 8px 0 -4px; }
.fx-veredicto.aviso { border-left-color: var(--aviso); }
.fx-etiqueta.aviso { background: var(--aviso); }
#fx-wrap .ambar { color: var(--aviso); font-weight: 600; }
.px-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.px-paso { position: relative; padding: 8px 0 8px 40px; border-left: 2px solid var(--borde); margin-left: 14px; }
.px-cab { display: flex; align-items: center; gap: 10px; margin: 0 0 6px -55px; font-size: 14px; }
.px-n { width: 28px; height: 28px; border-radius: 50%; background: var(--ok); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 3px solid var(--panel); }
.px-paso.aviso .px-n { background: var(--aviso); }
.px-paso.error .px-n { background: var(--error); }
.px-items { width: 100%; border-collapse: collapse; font-size: 13px; }
.px-items td { padding: 5px 8px; vertical-align: top; border-top: 1px dashed var(--borde); }
.px-items tr:first-child td { border-top: 0; }
.px-est span { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); margin-top: 4px; }
.px-items tr.aviso .px-est span { background: var(--aviso); }
.px-items tr.error .px-est span { background: var(--error); }
.px-hora { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; width: 70px; }
.px-items tr.error .px-hora, .px-items tr.error .px-que b { color: var(--error); }
.px-items tr.aviso .px-hora, .px-items tr.aviso .px-que b { color: var(--aviso); }
.px-tabla { width: 290px; }
.px-tabla code { font-size: 11.5px; background: var(--panel-alto); padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.px-que small { display: block; color: var(--tenue); font-size: 12px; }
.px-sql { width: 50px; text-align: right; }
.px-sqlfila td { border-top: 0 !important; padding-top: 0; }
.px-sqlfila .fx-sql { margin: 0 0 6px; }
.px-sqlfila.oculto { display: none; }
.px-items { table-layout: fixed; }
.px-items td.px-est { width: 22px; }
.px-items td.px-hora { width: 78px; }
.px-items td.px-tabla { width: 300px; }
.px-items td.px-sql { width: 64px; }
/* The list starts from the trigger: its cross, and the triggers aisys never answered. */
.fx-casos li .fx-cruce { grid-column: 3; color: var(--tenue); font-size: 10.5px; }
.fx-casos li.sin-senal { border-left-color: var(--aviso); }
.fx-casos li.sin-trigger { border-left-color: var(--error); }
.fx-chip.fx-falta { color: var(--aviso); background: color-mix(in srgb, var(--warn) 12%, transparent); }
#fx-wrap .fx-lista-resumen .fx-sql { margin: 6px 0 0; font-size: 10.5px; white-space: pre-wrap; }
/* The case in reading order: an index, the chart first, the WHY (live vs backtest) third. */
.fx-indice { display: flex; flex-wrap: wrap; gap: 6px; position: sticky; top: 0; z-index: 3; padding: 6px 0; background: var(--bg); }
.fx-indice a { font-size: 11.5px; padding: 2px 10px; border: 1px solid var(--borde); border-radius: 999px; color: var(--tenue); text-decoration: none; }
.fx-indice a:hover { color: var(--texto); border-color: var(--acento); }
.fx-seccion-n { font-weight: 700; color: var(--tenue); }
.fx-why h3 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fx-why h3::before { content: "③"; color: var(--tenue); font-weight: 700; }
.fx-why h4 { margin: 12px 0 6px; font-size: 12.5px; }
.tl-detalle { margin-top: 6px; }
.tl-detalle > summary { cursor: pointer; font-size: 12px; color: var(--tenue); }
.fx-casos li small.fx-solo-why { color: var(--tenue); font-style: italic; }
.fx-controles { flex-wrap: wrap; gap: 8px; }
.fx-controles input[type="date"] { background: var(--panel); color: var(--texto); border: 1px solid var(--borde); border-radius: 4px; padding: 2px 6px; font: inherit; color-scheme: inherit; }
/* The NULL's lineage (under its row in ④) and ⑦ the conclusion. */
.fx-linaje { margin: 4px 0 10px; padding: 8px 10px; border-left: 3px solid var(--error); background: color-mix(in srgb, var(--down) 5%, transparent); border-radius: 0 4px 4px 0; }
.fx-linaje h4 { margin: 0 0 6px; font-size: 12.5px; }
.fx-linaje ol { list-style: none; margin: 0; padding: 0; }
.fx-linaje li { display: grid; grid-template-columns: 70px minmax(150px, 230px) 1fr auto auto; gap: 8px; align-items: baseline; padding: 4px 0; border-bottom: 1px dashed var(--borde); font-size: 12px; }
.fx-linaje li:last-child { border-bottom: 0; }
.fx-linaje li.error .fx-l-hora { color: var(--error); }
.fx-linaje li.aviso .fx-l-hora { color: var(--aviso); }
.fx-linaje li.ok .fx-l-hora { color: var(--ok, var(--up)); }
.fx-l-hora { font-variant-numeric: tabular-nums; font-weight: 700; }
.fx-l-donde { font-size: 11px; overflow-wrap: anywhere; }
.fx-linaje li pre { grid-column: 1 / -1; margin: 4px 0 0; }
.fx-conclusion { border: 1px solid var(--borde); border-left: 4px solid var(--ok, var(--up)); border-radius: 4px; padding: 12px 14px; margin: 12px 0; background: var(--panel); }
.fx-conclusion.error { border-left-color: var(--error); }
.fx-conclusion header { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.fx-causa { font-size: 14px; line-height: 1.5; margin: 8px 0 4px; }
.fx-conclusion ul { margin: 4px 0 0; padding-left: 20px; font-size: 13px; line-height: 1.55; }
.fx-l-ver { margin: 6px 0 0; font-size: 11.5px; }
@media (max-width: 800px) { .fx-linaje li { grid-template-columns: 60px 1fr; } .fx-l-txt { grid-column: 1 / -1; } }
.fx-l-ver a { color: var(--acento); text-decoration: none; }
