/* Estilo de la app: «Mono» (blanco y negro, monoespaciado, bordes de 2 px, sin redondeos ni sombras),
   con un tinte frío apagado y trama de puntos (dithering) como único color.
   Los demás estilos que se probaron están en mockup/estilos-archivados/. */

/* títulos de la barra: nunca en dos líneas */
.cejilla { white-space: nowrap }
.titulos { flex: 0 1 auto; min-width: 0; max-width: 34vw }
.cejilla.contexto { max-width: 100% }
#barra > .boton, #barra > .primario, #barra > #bProb, #barra > .sep-v { flex: none }

/* =====================================================================
   MONO · como the-monospace-web: blanco y negro, todo monoespaciado, bordes de 2 px,
   cero redondeos y cero sombras; lo señalado se invierte (texto claro sobre negro)
   ===================================================================== */
:root[data-estilo="mono"] {
  font-family: "Geist Mono", ui-monospace, "JetBrains Mono", monospace; font-feature-settings: normal; letter-spacing: 0; font-variant-numeric: tabular-nums;
  --fondo: #fff; --tinta: #000; --gris: #555; --suave: #7a7a7a; --linea: #000; --panel: #fff;
  --acento: #000; --acento-2: #000; --acento-suave: #eee; --borde: #000; --sombra: none; --sombra-alta: none;
  --sup: #fff; --sup-2: #eee; --sel: #eee; --hov: rgba(0,0,0,.08); --borde-c: #000; --borde-c2: #000; --sep: #bbb;
  --punto: #d4d4d4; --punto-2: #aaa; --trazo: #000; --trazo-2: #666; --tinta-2: #000; --fin: #000;
  --vidrio: #fff; --vidrio-alto: #fff; --tostada: #000;
}
:root[data-estilo="mono"][data-tema="oscuro"] {
  --fondo: #000; --tinta: #fff; --gris: #aaa; --suave: #888; --linea: #fff; --panel: #000;
  --acento: #fff; --acento-2: #fff; --acento-suave: #111; --borde: #fff; --sombra: none; --sombra-alta: none;
  --sup: #000; --sup-2: #111; --sel: #1a1a1a; --hov: rgba(255,255,255,.12); --borde-c: #fff; --borde-c2: #fff; --sep: #444;
  --punto: #222; --punto-2: #444; --trazo: #fff; --trazo-2: #999; --tinta-2: #fff; --fin: #fff;
  --vidrio: #000; --vidrio-alto: #000; --tostada: #fff;
}
[data-estilo="mono"] * { border-radius: 0 !important; box-shadow: none !important; text-shadow: none !important }
[data-estilo="mono"] :focus-visible, [data-estilo="mono"] .entrada:focus { outline: 2px solid var(--tinta); outline-offset: 2px }
[data-estilo="mono"] .punto { r: 1px }
[data-estilo="mono"] .arista { stroke-width: 2; stroke-linecap: butt; stroke-linejoin: miter }
[data-estilo="mono"] .arista.datos { stroke-width: 4 }
[data-estilo="mono"] .arista.rama, [data-estilo="mono"] .arista.rama.tomada { stroke-width: 2 }
/* nodos: cuadrados con borde; al señalarlos se invierten */
[data-estilo="mono"] .esfera { rx: 0; fill: var(--fondo); stroke: var(--tinta); stroke-width: 2 }
[data-estilo="mono"] .ic { stroke: var(--tinta); stroke-width: 1.8; stroke-linecap: square; stroke-linejoin: miter }
[data-estilo="mono"] .ic.lleno { fill: var(--tinta) }
[data-estilo="mono"] .nodo:hover .esfera { filter: none; fill: var(--tinta) }
[data-estilo="mono"] .nodo:hover .ic { stroke: var(--fondo) }
[data-estilo="mono"] .nodo:hover .ic.lleno { fill: var(--fondo) }
[data-estilo="mono"] .nodo.sel .esfera { stroke-width: 5 }
[data-estilo="mono"] .anillo, [data-estilo="mono"] .sombra { display: none }
[data-estilo="mono"] .bola { filter: none }
[data-estilo="mono"] .nodo .nombre { font-weight: 800; font-size: 13px; text-transform: uppercase }
[data-estilo="mono"] .nodo .sub { font-size: 11.5px; fill: var(--gris) }
[data-estilo="mono"] .nodo .dentro, [data-estilo="mono"] .etq, [data-estilo="mono"] .ficha-t { text-transform: uppercase }
[data-estilo="mono"] .fin .nombre { text-transform: uppercase; font-weight: 800 }
[data-estilo="mono"] .esfera-fin { rx: 0 }
[data-estilo="mono"] .vars-caja { fill: var(--fondo); stroke: var(--tinta); stroke-width: 2 }
[data-estilo="mono"] .vars-t { fill: var(--tinta); opacity: 1 }
/* barra, islas y paneles: marcos de 2 px, sin fondo especial */
[data-estilo="mono"] #barra { background: var(--fondo); border-bottom: 2px solid var(--tinta) }
[data-estilo="mono"] .isla, [data-estilo="mono"] .flota, [data-estilo="mono"] .ventana, [data-estilo="mono"] .dlg-caja, [data-estilo="mono"] .g-caja, [data-estilo="mono"] #datos, [data-estilo="mono"] #menu, [data-estilo="mono"] #peek, [data-estilo="mono"] #peekNodo { border: 2px solid var(--tinta) }
[data-estilo="mono"] .sep-v { width: 2px; background: var(--tinta) }
[data-estilo="mono"] .logo { background: var(--tinta); color: var(--fondo) }
[data-estilo="mono"] .cejilla, [data-estilo="mono"] .sub-sec, [data-estilo="mono"] .m-sec, [data-estilo="mono"] .g-sec, [data-estilo="mono"] .sec > h4, [data-estilo="mono"] details summary { text-transform: uppercase; letter-spacing: .04em; font-weight: 800; color: var(--tinta) }
[data-estilo="mono"] #migas { text-transform: uppercase; font-weight: 800; letter-spacing: 0; font-size: 17px }
[data-estilo="mono"] #migas .nivel-btn { font-weight: 600 }
[data-estilo="mono"] .ico { stroke-width: 2; stroke-linecap: square; stroke-linejoin: miter }
/* botones: marco de 2 px, se invierten al señalarlos */
[data-estilo="mono"] .boton, [data-estilo="mono"] .herr, [data-estilo="mono"] #bProb, [data-estilo="mono"] .pastilla, [data-estilo="mono"] .chip, [data-estilo="mono"] .bx, [data-estilo="mono"] .modo { border: 2px solid var(--tinta); background: var(--fondo); color: var(--tinta); font-weight: 600 }
[data-estilo="mono"] .boton .ico, [data-estilo="mono"] .herr .ico { color: var(--tinta) }
[data-estilo="mono"] .boton:hover, [data-estilo="mono"] .boton.abierto, [data-estilo="mono"] .herr:hover, [data-estilo="mono"] .chip:hover, [data-estilo="mono"] .bx:hover, [data-estilo="mono"] .herr.on, [data-estilo="mono"] #zoom:hover { background: var(--tinta); color: var(--fondo) }
[data-estilo="mono"] .boton:hover .ico, [data-estilo="mono"] .boton.abierto .ico, [data-estilo="mono"] .herr:hover .ico, [data-estilo="mono"] .herr.on .ico { color: var(--fondo) }
[data-estilo="mono"] .primario { background: var(--tinta); color: var(--fondo); border: 2px solid var(--tinta); font-weight: 800; text-transform: uppercase }
[data-estilo="mono"] .primario .ico { color: var(--fondo) }
[data-estilo="mono"] .primario:hover { background: var(--fondo); color: var(--tinta) }
[data-estilo="mono"] .primario:hover .ico { color: var(--tinta) }
[data-estilo="mono"] #bProb.mal, [data-estilo="mono"] #bProb.bien, [data-estilo="mono"] .pastilla.ojo { background: var(--fondo); color: var(--tinta) }
[data-estilo="mono"] #bProb .num { background: var(--tinta); color: var(--fondo) }
[data-estilo="mono"] #bSim.on { background: var(--tinta); color: var(--fondo) }
[data-estilo="mono"] #bSim.on .ico { color: var(--fondo) }
[data-estilo="mono"] #pie { gap: 0; padding: 0; bottom: 20px }
[data-estilo="mono"] #pie .herr, [data-estilo="mono"] #vista .herr { border-width: 0 2px 0 0 } 
[data-estilo="mono"] #pie .herr:last-child, [data-estilo="mono"] #vista .herr:last-child { border-right-width: 0 }
[data-estilo="mono"] #vista { gap: 0; padding: 0 }
[data-estilo="mono"] #zoom { font-weight: 800 }
/* campos y listas */
[data-estilo="mono"] .entrada, [data-estilo="mono"] .cond select, [data-estilo="mono"] #iJson, [data-estilo="mono"] #dBuscar, [data-estilo="mono"] #mBuscar { border: 2px solid var(--tinta); background: var(--fondo) }
[data-estilo="mono"] .entrada.vacia { background: var(--fondo); border-style: dashed }
[data-estilo="mono"] .modo button { background: var(--fondo); color: var(--tinta); border: 0 }
[data-estilo="mono"] .modo button.on, [data-estilo="mono"] #menu .modo-ins button.on { background: var(--tinta); color: var(--fondo) }
[data-estilo="mono"] .flota > button:hover, [data-estilo="mono"] #menu .m-it:hover, [data-estilo="mono"] #menu .m-it.foco, [data-estilo="mono"] #dLista button:hover, [data-estilo="mono"] .g-it:hover, [data-estilo="mono"] .g-it.on, [data-estilo="mono"] #menu button:hover, [data-estilo="mono"] #menu button.foco { background: var(--tinta); color: var(--fondo) }
[data-estilo="mono"] .flota > button:hover small, [data-estilo="mono"] .flota > button:hover .ic-caja, [data-estilo="mono"] .m-it:hover .m-c, [data-estilo="mono"] .g-it:hover small, [data-estilo="mono"] .g-it.on small { color: var(--fondo) }
[data-estilo="mono"] .flota .ic-caja { background: var(--fondo); color: var(--tinta); border: 2px solid var(--tinta) }
[data-estilo="mono"] .flota > button:hover .ic-caja { background: var(--tinta); border-color: var(--fondo) }
[data-estilo="mono"] #ctx .c-it:hover, [data-estilo="mono"] #ctx .c-it.foco, [data-estilo="mono"] #ctx .c-it.peligro:hover, [data-estilo="mono"] #ctx .c-it.peligro.foco { background: var(--tinta); color: var(--fondo) }
[data-estilo="mono"] #ctx .c-it:hover .ico, [data-estilo="mono"] #ctx .c-it.foco .ico, [data-estilo="mono"] #ctx .c-it:hover kbd, [data-estilo="mono"] #ctx .c-it.foco kbd, [data-estilo="mono"] #ctx .c-it .marca { color: var(--fondo) }
[data-estilo="mono"] #ctx .c-sep, [data-estilo="mono"] .aviso-legal { background: var(--tinta); border-color: var(--tinta) }
[data-estilo="mono"] .aviso-legal { background: none; border-top: 2px solid var(--tinta) }
[data-estilo="mono"] .i-pie { border-top: 6px double var(--tinta) }
[data-estilo="mono"] .g-cab { border-bottom: 2px solid var(--tinta) } [data-estilo="mono"] #gLista { border-right: 2px solid var(--tinta) }
[data-estilo="mono"] kbd, [data-estilo="mono"] #ayuda kbd { border: 2px solid var(--tinta); background: var(--fondo); color: var(--tinta) }
[data-estilo="mono"] #aviso, [data-estilo="mono"] #simInfo { background: var(--tinta); color: var(--fondo); font-weight: 600 }
[data-estilo="mono"] #soltar { border: 2px dashed var(--tinta); color: var(--tinta) }

/* ---------- color: un tinte frío apagado; la trama (dithering) solo vive en las esquinas de las ventanas ---------- */
:root[data-estilo="mono"] { --tinte: #3f58a8; --sel: #e9edf9; --acento-suave: #e9edf9; --vent: #f1f1f1; }
:root[data-estilo="mono"][data-tema="oscuro"] { --tinte: #8ea6ee; --sel: #151a2c; --acento-suave: #151a2c; --vent: #121212; }
/* iconos de los nodos: línea negra con el color de su tipo, apagado */
[data-estilo="mono"] .bola { --cc: color-mix(in srgb, var(--c) 72%, var(--tinta)) }
[data-tema="oscuro"][data-estilo="mono"] .bola { --cc: color-mix(in srgb, var(--c) 50%, #fff) }
[data-estilo="mono"] .ic { stroke: var(--cc) }
[data-estilo="mono"] .ic.lleno { fill: var(--cc) }
[data-estilo="mono"] .nodo.sel .esfera { stroke: var(--tinte); stroke-width: 4 }
[data-estilo="mono"] :focus-visible, [data-estilo="mono"] .entrada:focus { outline-color: var(--tinte) }
[data-estilo="mono"] .cejilla { color: var(--tinte) }
/* ventanas: sin borde, un fondo ligeramente distinto y trama en dos esquinas */
[data-estilo="mono"] .ventana, [data-estilo="mono"] .dlg-caja, [data-estilo="mono"] .g-caja, [data-estilo="mono"] .flota, [data-estilo="mono"] #menu, [data-estilo="mono"] #datos { border: 0; background: var(--vent) }
[data-estilo="mono"] .ventana .p-cab, [data-estilo="mono"] .g-cab { background: transparent }
[data-estilo="mono"] .ventana .p-datos { background: var(--sup-2) }
[data-estilo="mono"] .g-caja, [data-estilo="mono"] .dlg-caja { position: relative }
/* trama (dithering) dentro de las ventanas: una capa tintada detrás del contenido, recortada por una máscara de puntos.
   La máscara cambia con data-trama (botón junto a la rejilla). Los PNG están en estilos/tramas/ (los genera un script de 1 bit, Bayer 8x8). */
[data-estilo="mono"] :is(.ventana, .dlg-caja, .g-caja, #listaEj, #listaSol, #listaExp, #listaProb, #ayuda, #menu, #datos) { isolation: isolate }
[data-estilo="mono"] :is(.ventana, .dlg-caja, .g-caja, #listaEj, #listaSol, #listaExp, #listaProb, #ayuda, #menu, #datos)::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: var(--tinte); opacity: var(--trama-op, .5);
  -webkit-mask: var(--trama); mask: var(--trama) }
:root[data-trama="esquinas"] { --trama-op: .3; --trama: url(tramas/esq-ai.png) top left no-repeat, url(tramas/esq-bd.png) bottom right no-repeat }
:root[data-trama="lavado"]   { --trama: url(tramas/lavado.png) top left repeat-x }
:root[data-trama="marea"]    { --trama: url(tramas/marea.png) bottom left repeat-x }
:root[data-trama="marco"]    { --trama: url(tramas/marco-a.png) top left repeat-x, url(tramas/marco-b.png) bottom left repeat-x, url(tramas/marco-i.png) top left repeat-y, url(tramas/marco-d.png) top right repeat-y }
:root[data-trama="diagonal"] { --trama: url(tramas/diagonal.png) top left no-repeat }
:root[data-trama="grano"]    { --trama: url(tramas/grano.png) top left repeat; --trama-op: .4 }
:root[data-trama="ninguna"] { --trama: none; --trama-op: 0 }

/* ---------- rejilla del lienzo (se cambia con el botón de la esquina inferior derecha) ---------- */
.g-cruces, .g-lineas, .g-guiones, .g-pixeles { display: none }
.g-cruces, .g-lineas, .g-guiones { fill: none; stroke: var(--punto); stroke-width: 1 }
#lienzo.moviendo .g-cruces, #lienzo.moviendo .g-lineas, #lienzo.moviendo .g-guiones { fill: none; stroke: var(--punto-2) }
:root[data-rejilla="cruces"] .g-puntos, :root[data-rejilla="lineas"] .g-puntos, :root[data-rejilla="guiones"] .g-puntos, :root[data-rejilla="pixeles"] .g-puntos, :root[data-rejilla="ninguna"] .g-puntos { display: none }
:root[data-rejilla="cruces"] .g-cruces, :root[data-rejilla="lineas"] .g-lineas, :root[data-rejilla="guiones"] .g-guiones, :root[data-rejilla="pixeles"] .g-pixeles { display: inline }

/* ---------- panel «Nuevo»: mis flujos guardados ---------- */
#listaEj { max-height: 76vh; overflow-y: auto }
#listaEj .m-sec-n { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--suave); margin-left: 6px }
#listaEj > button[data-mio] { position: relative; padding-right: 40px }
#listaEj > button[data-mio].on span { text-decoration: underline; text-underline-offset: 3px }
.mio-x { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 18px; line-height: 1; width: 24px; height: 24px; display: grid; place-items: center; color: var(--suave); opacity: 0 }
#listaEj > button[data-mio]:hover .mio-x { opacity: 1 }
.mio-x:hover { color: #ff5d78 }

/* barra: sin logo ni texto fijo; la cejilla solo aparece con contexto (bucle, ámbito, solución) */
.cejilla:empty { display: none }

/* problemas: la acción señalada en el lienzo */
.nodo.senalado .esfera { fill: var(--tinte, var(--acento)); stroke: var(--tinte, var(--acento)); stroke-width: 6; animation: senal .8s ease-in-out infinite alternate }
.nodo.senalado .ic { stroke: var(--fondo) } .nodo.senalado .ic.lleno { fill: var(--fondo) }
.nodo.senalado .nombre { fill: var(--tinte, var(--acento)) }
@keyframes senal { to { stroke-width: 14 } }
/* mientras se señala un problema, el resto del lienzo se apaga */
#lienzo.senalando .nodo:not(.senalado), #lienzo.senalando .ar, #lienzo.senalando .vars, #lienzo.senalando .fin { opacity: .22; transition: opacity .15s }
/* peeks más grandes: el mapa de un contenedor se tiene que poder leer */
#peekNodo.ancho { width: min(780px, 62vw) }
#peekNodo .pn-mapa { max-height: 52vh }
#peekNodo { width: 360px }
.pn-donde { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--sep); font-size: 12px; color: var(--suave) }

/* «Mis flujos»: carpetas a la izquierda, flujos a la derecha (mismo esqueleto que el gestor de conectores) */
/* hub: lo primero que se ve al entrar. Tus flujos por carpetas y unos ejemplos; ocupa toda la pantalla */
#biblio { position: fixed; inset: 0; z-index: 9500; display: none; background: var(--fondo) }
#biblio.ver { display: block }
body.en-hub #barra, body.en-hub #pie, body.en-hub #vista { visibility: hidden }
#biblio .g-caja { width: 100%; height: 100%; border: 0 !important; background: var(--fondo) !important }
#biblio .g-caja::before, #biblio .g-caja::after { display: none }
.hub-cab { height: 68px; padding: 0 24px !important; align-items: center !important; border-bottom: 2px solid var(--tinta) !important }
.hub-marca { font-size: 20px !important; letter-spacing: .12em; margin-right: 18px }
#bibBuscar { width: 300px }
#biblio .g-cuerpo { grid-template-columns: 280px 1fr }
.hub-rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px }
.hub-t { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 18px 18px 16px; border: 2px solid var(--tinta); cursor: pointer; min-height: 150px }
.hub-t:hover, .hub-t:focus-visible { background: var(--tinta); color: var(--fondo); outline: none }
.hub-t:hover small, .hub-t:focus-visible small { color: var(--fondo) }
.hub-t:hover .hub-ico { border-color: var(--fondo) }
.hub-t.on { border-color: var(--tinte) }
.hub-t b { font-size: 15px; margin-top: 8px } .hub-t small { color: var(--suave); font-size: 12px; line-height: 1.45 }
.hub-ico { width: 40px; height: 40px; border: 2px solid currentColor; display: grid; place-items: center }
.hub-ico .ico { width: 20px; height: 20px }
.hub-t.ej { border-style: dashed }
.hub-acc { display: flex; gap: 6px; align-items: center; margin-top: auto; padding-top: 10px; opacity: 0 }
.hub-t:hover .hub-acc, .hub-t:focus-within .hub-acc { opacity: 1 }
.hub-acc .bib-mover { flex: 1; height: 32px; background: var(--fondo); color: var(--tinta) }
.hub-acc .bib-x { opacity: 1; color: var(--fondo) }
.hub-sec { margin: 40px 0 14px; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--gris) }
.hub-n { color: var(--suave); font-size: 13px; margin-right: auto }
.hub-vacio { padding: 18px 2px 4px; max-width: 60ch; line-height: 1.5 }
#biblio .g-cab { align-items: center }
.bib-nota { color: var(--suave); font-size: 12.5px }
#bibCarpetas { overflow-y: auto; border-right: 2px solid var(--tinta); padding: 8px 10px }
#bibCarpetas .g-it { position: relative }
#bibCarpetas .g-it small { margin-left: auto }
.bib-acc { font-style: normal; opacity: 0; padding: 0 4px; color: var(--suave) } .g-it:hover .bib-acc { opacity: 1 } .bib-acc:hover { color: var(--tinte) }
.bib-nueva { display: flex; gap: 6px; padding: 10px 2px 4px } .bib-nueva .entrada { flex: 1; min-width: 0; height: 38px }
.bib-nueva .boton { height: 38px }
#bibFlujos { overflow-y: auto; padding: 22px 28px 28px }
.bib-cab { display: flex; align-items: center; gap: 10px; margin-bottom: 16px } .bib-cab b { font-size: 18px; margin-right: auto; text-transform: uppercase }
.bib-cab .boton { height: 38px; font-size: 13px }
.bib-fila { display: grid; grid-template-columns: 1fr 200px 34px; gap: 12px; align-items: center; padding: 12px 10px; border-bottom: 1px solid var(--sep); cursor: pointer }
.bib-fila:hover { background: var(--hov) }
.bib-fila.on b { text-decoration: underline; text-underline-offset: 3px }
.bib-n b { display: block; font-size: 15px } .bib-n small { color: var(--suave); font-size: 12px }
.bib-mover { height: 34px; padding: 0 8px; font-size: 12.5px }
.bib-x { border: 0; background: none; color: var(--suave); font-size: 20px; cursor: pointer; opacity: 0 } .bib-fila:hover .bib-x { opacity: 1 } .bib-x:hover { color: #ff5d78 }

/* fondo del lienzo (Ajustes) */
#fondoArte { position: fixed; left: 0; top: 0; pointer-events: none; image-rendering: pixelated }
#bibCerrar[hidden] { display: none }
#biblio .bib-cab b { margin-right: 0 } .hub-n { margin-left: 4px }
/* carpetas: el recuento a la derecha; al señalar, en su sitio salen renombrar y quitar */
#bibCarpetas .bib-acc { display: none; opacity: 1 }
#bibCarpetas .g-it[data-carpeta]:hover .bib-acc { display: inline }
#bibCarpetas .g-it:hover .bib-acc ~ small, #bibCarpetas .g-it:has(.bib-acc):hover small { display: none }

/* hub: flores al pie */
#hubFlores { position: absolute; left: 0; bottom: 0; pointer-events: none; image-rendering: pixelated; z-index: 0 }
#biblio .g-caja { position: relative }
#biblio .g-cuerpo { position: relative; z-index: 1 }
#bibFlujos { padding-bottom: 240px }
/* diálogo propio (confirmar, pedir un nombre) */
#dlgSi { position: fixed; inset: 0; z-index: 9800; display: none; place-items: center; background: rgba(0,0,0,.55) }
#dlgSi.ver { display: grid }
#dlgSi .dlg-caja { width: min(460px, 92vw); padding: 26px 26px 22px; gap: 12px; animation: dlg-entra .16s ease-out }
@keyframes dlg-entra { from { opacity: 0; transform: translateY(6px) } }
#dlgSi h3 { margin: 0; font-size: 17px; line-height: 1.3 }
#dlgSi p { margin: 0; color: var(--gris); font-size: 14px; line-height: 1.5 }
#dlgSi .entrada { height: 42px; font-size: 15px }
.dlg-pie { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px }
.dlg-pie .boton, .dlg-pie .primario { height: 40px }
#dlgSiOk.peligro { background: #ff5d78; border-color: #ff5d78; color: #000 }
#dlgSiOk.peligro:hover { background: var(--fondo); color: #ff5d78 }
