/* TRACE · Red de plantas. Colores de ie.css: funciona en tema claro y oscuro. */
.t-red { --red-h: clamp(440px, 72vh, 760px); }
.t-red-miga { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.t-red-miga button { font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; background: var(--surface); color: var(--text-2); border: 1px solid var(--line-strong); border-radius: var(--r-control); padding: 5px 9px; cursor: pointer; }
.t-red-miga button[aria-current] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); cursor: default; }
.t-red-miga button:not([aria-current]):hover { border-color: var(--text-3); color: var(--text); }
.t-red-cuerpo { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; align-items: start; }
@media (max-width: 1100px) { .t-red-cuerpo { grid-template-columns: minmax(0, 1fr); } }
.t-red-lienzo { position: relative; min-width: 0; border: 1px solid var(--line-strong); border-radius: var(--r-panel); background: var(--bg); overflow: hidden; }
.t-red-v { display: block; width: 100%; height: var(--red-h); touch-action: none; cursor: grab; user-select: none; }
@media (max-width: 640px) { .t-red-v { height: 400px; } }
.t-red-v.arrastrando { cursor: grabbing; }
.t-red-ctrl { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 6px; }
.t-red-ayuda { position: absolute; left: 12px; bottom: 14px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .06em; color: var(--text-3); text-transform: uppercase; pointer-events: none; }
@media (max-width: 640px) { .t-red-ayuda { display: none; } }
.t-red-aviso { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: var(--bg); padding: 24px; }

/* textos del SVG */
.t-red-v .n-mono { font-family: var(--font-mono); fill: var(--text-2); letter-spacing: .08em; }
.t-red-v .n-cifra { font-family: var(--font-mono); font-weight: 500; fill: var(--text); }
.t-red-v .n-tit { font-family: var(--font-display); font-weight: 700; fill: var(--text); }
.t-red-v .n-sub { font-family: var(--font); font-weight: 600; fill: var(--text); }
.t-red-v .n-cuerpo { font-family: var(--font); fill: var(--text); }
.t-red-v .n-inv { fill: var(--surface); }
.t-red-v .n-warn { fill: var(--warn-text); }
.t-red-v .n-bad { fill: var(--bad-text); }
.t-red-v .nodo { cursor: pointer; }
.t-red-v .nodo .marco { transition: stroke .2s; }
.t-red-v .nodo:hover .marco, .t-red-v .nodo:focus-visible .marco { stroke: var(--accent) !important; }
.t-red-v .nodo:focus { outline: none; }
.t-red-v .nodo:focus-visible .marco { stroke-width: 3; }
.t-red-v .raiz.enfocado .nodo { opacity: .35; transition: opacity .3s; }
.t-red-v .raiz.enfocado .nodo.abierto { opacity: 1; }

/* ventana del nodo abierto */
.t-red-exp { position: absolute; z-index: 5; width: min(330px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-top: 3px solid var(--accent); border-radius: var(--r-panel); box-shadow: var(--shadow-overlay); padding: 14px 16px 16px; transform-origin: var(--ox, 0) var(--oy, 0); transition: transform .3s cubic-bezier(.2,.8,.2,1), opacity .3s; }
.t-red-exp.cerrado { transform: scale(.2); opacity: 0; }
.t-red-exp .x { position: absolute; top: 6px; right: 8px; border: 0; background: none; color: var(--text-2); font-size: 20px; cursor: pointer; }
.t-red-exp h3 { margin: 4px 0 8px; font-family: var(--font-display); font-size: 17px; }
.t-red-exp .vivo, .t-red-exp .subt, .t-red-panel .subt { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); margin: 8px 0 4px; }
.t-red-exp .exp-txt { margin: 0 0 8px; font-size: 13px; }
.t-red-exp .exp-entrar { width: 100%; margin-top: 10px; justify-content: center; }
@media (prefers-reduced-motion: reduce) { .t-red-exp { transition: none; } }

/* panel */
.t-red-panel { min-width: 0; border: 1px solid var(--line-strong); border-top: 3px solid var(--accent); border-radius: var(--r-panel); background: var(--surface); padding: 16px 18px; max-height: calc(var(--red-h) + 2px); overflow: auto; overscroll-behavior: contain; }
@media (max-width: 1100px) { .t-red-panel { max-height: none; } }
.t-red-eti { display: inline-block; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; background: var(--accent); color: var(--on-accent); padding: 3px 8px; }
.t-red-h { font-family: var(--font-display); font-weight: 700; font-size: 21px; line-height: 1.15; margin: 10px 0 8px; text-wrap: balance; }
.t-red-panel p { margin: 0 0 12px; color: var(--text-2); }
.t-red-nota { color: var(--text-2); font-size: 12.5px; }
.t-red-cifras { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); margin: 4px 0 12px; }
.t-red-cifras div { padding: 8px 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.t-red-cifras div:nth-child(2n) { border-right: 0; }
.t-red-cifras div:nth-last-child(-n+2) { border-bottom: 0; }
.t-red-exp .t-red-cifras { grid-template-columns: repeat(3, 1fr); }
.t-red-exp .t-red-cifras div { border-bottom: 0; border-right: 1px solid var(--line); }
.t-red-cifras dt { font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.t-red-cifras dd { margin: 2px 0 0; font-family: var(--font-display); font-weight: 700; font-size: 19px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.t-red .bad { color: var(--bad-text) !important; } .t-red .warn { color: var(--warn-text) !important; }
.t-red-lista { list-style: none; margin: 0 0 12px; padding: 0; border-top: 1px solid var(--line); }
.t-red-lista li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.t-red-lista li > span:last-child { font-family: var(--font-mono); font-size: 12px; text-align: right; }
.t-red-lista small, .t-red-fila small { display: block; color: var(--text-2); font-size: 11.5px; }
.t-red-fila { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line); color: var(--text); font: inherit; font-size: 13px; padding: 7px 4px; cursor: pointer; }
.t-red-fila:hover, .t-red-fila:focus-visible { background: var(--selected); outline: none; }
.t-red-fila:has(.t-red-bc) { display: block; }
.t-red-fila > span:first-child { min-width: 0; }
.t-red-fila b { font-family: var(--font-mono); font-weight: 500; }
.t-red-bc { display: grid; grid-template-columns: 52px 1fr 54px; gap: 8px; align-items: center; font-family: var(--font-mono); font-size: 11.5px; }
.t-red-bc > span:last-child { text-align: right; }
.t-red-barra { display: block; height: 6px; background: var(--line); }
.t-red-barra b { display: block; height: 100%; background: var(--neutral); }
.t-red-barra b.ok { background: var(--ok); } .t-red-barra b.warn { background: var(--warn); }
.t-red-chip { display: inline-block; min-width: 30px; text-align: center; font-family: var(--font-mono); font-weight: 500; font-size: 10.5px; padding: 1px 5px; border-radius: 2px; }
.t-red-chip.si { background: var(--ok); color: var(--surface); } .t-red-chip.no { background: var(--bad); color: var(--surface); }
.t-red-chip.na { background: var(--neutral); color: var(--surface); } .t-red-chip.pend { border: 1px solid var(--warn); color: var(--warn-text); }
.t-red-acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.t-red-tabs, .t-red-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 12px; }
.t-red-tabs button, .t-red-chips button { font-family: var(--font-mono); font-size: 11px; background: transparent; color: var(--text-2); border: 1px solid var(--line-strong); border-radius: var(--r-control); padding: 5px 8px; cursor: pointer; }
.t-red-tabs button[aria-selected="true"], .t-red-chips button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.t-red-mat { display: grid; gap: 3px; align-items: center; margin: 4px 0 12px; font-family: var(--font-mono); font-size: 11px; }
.t-red-mat > b { font-weight: 500; color: var(--text-2); text-align: center; }
.t-red-mat > button { text-align: left; background: transparent; border: 0; color: var(--text); font: inherit; font-size: 12.5px; padding: 5px 0; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-red-mat > button:hover { color: var(--accent); }
.t-red-mat > i { font-style: normal; text-align: center; padding: 5px 0; background: var(--ok-bg); }
.t-red-mat > i.baja { background: var(--warn-bg); color: var(--warn-text); }
.t-red-qtabla .t-red-qcab, .t-red-qtabla .qfila { display: grid; grid-template-columns: minmax(0, 1fr) 58px 30px 46px; gap: 6px; align-items: center; }
.t-red-qcab { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); padding: 0 4px 6px; border-bottom: 1px solid var(--line); }
.t-red-qtabla .qfila > span:not(:first-child) { font-family: var(--font-mono); font-size: 11.5px; text-align: center; }
.t-red-qtabla em { font-style: normal; font-family: var(--font-mono); font-size: 10px; color: var(--ok-text); }
