/* Grafo de matemática (/matematica/grafo/). Colores por área, en claro y oscuro. */
:root{
  --a-fundamentos:#f4d58d; --a-algebra:#b8d4f8; --a-analisis:#c6e6be; --a-geometria:#e3c8f2; --a-numerico:#d6d9de;
  --a-probabilidad:#ffcfb3; --a-procesos:#ffb9b9; --a-estadistica:#b5e9e2; --a-actuarial:#efdfae;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --a-fundamentos:#6b5a22; --a-algebra:#26456e; --a-analisis:#2c5a2a; --a-geometria:#55306b; --a-numerico:#3d4350;
    --a-probabilidad:#6e3d22; --a-procesos:#6b2a2a; --a-estadistica:#1f5a54; --a-actuarial:#5e5128;
  }
}
:root[data-theme="dark"]{
  --a-fundamentos:#6b5a22; --a-algebra:#26456e; --a-analisis:#2c5a2a; --a-geometria:#55306b; --a-numerico:#3d4350;
  --a-probabilidad:#6e3d22; --a-procesos:#6b2a2a; --a-estadistica:#1f5a54; --a-actuarial:#5e5128;
}
.grafo-ctl{display:flex;flex-wrap:wrap;gap:14px;align-items:center;margin:14px 0 8px;font:500 .95rem var(--f-display)}
.grafo-ctl label:first-child{flex:1 1 280px;min-width:0;max-width:560px}
.grafo-ctl select{display:block;width:100%;max-width:100%;margin-top:4px;font:inherit;padding:7px 10px;border:1px solid var(--line);border-radius:8px;background:var(--card);color:var(--ink)}
.grafo-pagina{min-width:0;max-width:100%}
.grafo-cuerpo>*{min-width:0}
.grafo-check{display:flex;gap:6px;align-items:center;cursor:pointer}
.grafo-leyenda{display:flex;flex-wrap:wrap;gap:6px 14px;font:.82rem var(--f-display);color:var(--muted);margin-bottom:12px}
.grafo-leyenda i{display:inline-block;width:12px;height:12px;border-radius:3px;margin-right:5px;vertical-align:-1px;border:1px solid var(--line)}
.grafo-cuerpo{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:14px;align-items:start}
@media (max-width:900px){.grafo-cuerpo{grid-template-columns:minmax(0,1fr)}}
.grafo-lienzo{overflow:auto;background:var(--card);border:1px solid var(--line);border-radius:12px;max-height:78vh}
.grafo-lienzo[hidden]{display:none}
#grafo-svg text{font:12px var(--f-display);fill:var(--ink);pointer-events:none}
#grafo-svg .n rect{stroke:var(--line);stroke-width:1;cursor:pointer}
#grafo-svg .n:focus{outline:none}
#grafo-svg .n:focus rect,#grafo-svg .n.sel rect{stroke:var(--ink);stroke-width:2.5}
#grafo-svg .n.dim{opacity:.18}
#grafo-svg .n .paso{font-weight:700;font-size:11px}
#grafo-svg .e{fill:none;stroke:var(--muted);stroke-opacity:.35}
#grafo-svg .e.on{stroke:var(--accent);stroke-opacity:.95;stroke-width:2}
#grafo-svg .e.dim{stroke-opacity:.06}
.grafo-ficha{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:14px 16px;font-size:.95rem}
.grafo-ficha h2{font:700 1.15rem var(--f-display);margin:0 0 4px}
.grafo-ficha h3{font:700 .72rem var(--f-display);letter-spacing:.1em;text-transform:uppercase;color:var(--muted);margin:14px 0 4px}
.grafo-ficha ul,.grafo-ficha ol{margin:0;padding-left:20px}
.grafo-ficha .area{color:var(--muted);font:.85rem var(--f-display)}
.grafo-ficha button.ir{background:none;border:0;padding:0;color:var(--accent);font:inherit;text-decoration:underline;cursor:pointer;text-align:left}
.grafo-lista{display:grid;gap:10px}
.grafo-lista[hidden]{display:none}
.grafo-lista h3{font:700 .78rem var(--f-display);letter-spacing:.1em;text-transform:uppercase;color:var(--muted);margin:8px 0 0}
.grafo-lista button{display:block;width:100%;text-align:left;font:600 .95rem var(--f-display);color:var(--ink);padding:10px 12px;border:1px solid var(--line);border-radius:10px;cursor:pointer}
.grafo-lista button small{display:block;font-weight:400;color:var(--muted);margin-top:2px}
.grafo-lista button.dim{opacity:.35}
.aviso-curado{margin:12px 0;padding:10px 14px;border:1px solid var(--warm);border-left:4px solid var(--warm);border-radius:8px;background:var(--card);font:500 .92rem var(--f-display);color:var(--ink)}
