/* ============================================================
   NEFRONA INTERACTIVA — Estilos (misma familia visual que Velocímetro Renal)
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2563eb; --primary-dark: #1d4ed8; --primary-light: #eff6ff; --primary-mid: #bfdbfe;
  --accent: #0ea5e9;
  --dark: #1e293b; --text: #334155; --text-secondary: #475569; --text-muted: #94a3b8;
  --border: #e2e8f0; --bg: #f8fafc; --bg-card: #ffffff; --white: #fff;
  --ok: #2563eb; --parcial: #d97706; --off: #94a3b8;
  --verde: #16a34a; --ambar: #d97706; --rojo: #dc2626;
  --na: #2563eb; --k: #16a34a; --agua: #0ea5e9;
  --luz: #fef3c7; --sangre: #fee2e2;
  --radius-lg: 12px; --radius-md: 8px;
  --shadow-card: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
}

html { scroll-behavior: smooth; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; min-height: 100vh; }

/* ── Cabecera ── */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--white); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-card); }
.header-inner { max-width: 1480px; margin: 0 auto; padding: .7rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.logo { display: flex; align-items: center; gap: .8rem; }
.logo-icon { width: 36px; height: 36px; flex-shrink: 0; }
.logo-title { font-family: 'Outfit', sans-serif; font-size: 1.1rem; font-weight: 800; color: var(--dark); letter-spacing: -.3px; line-height: 1.1; }
.logo-sub { font-size: .72rem; color: var(--text-secondary); }
.badge-version { font-size: .7rem; font-weight: 600; color: var(--primary-dark); background: var(--primary-light); border: 1px solid var(--primary-mid); padding: .25rem .6rem; border-radius: 999px; white-space: nowrap; }

/* ── Layout ── */
.layout { max-width: 1480px; margin: 0 auto; padding: 1rem 1.25rem 2rem; display: grid; grid-template-columns: 290px minmax(0, 1fr) 300px; gap: 1rem; align-items: start; }
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 1rem; position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow: auto; }
.panel-title { font-family: 'Outfit', sans-serif; font-size: 1rem; font-weight: 700; color: var(--dark); margin-bottom: .35rem; }
.panel-title + .panel-title, .panel-title:not(:first-child) { margin-top: 1rem; }
.panel-subtitle { font-family: 'Outfit', sans-serif; font-size: .85rem; font-weight: 700; color: var(--text-secondary); margin: 1rem 0 .3rem; text-transform: uppercase; letter-spacing: .4px; }
.panel-hint { font-size: .75rem; color: var(--text-secondary); margin-bottom: .75rem; }

/* ── Causas ── */
.causa { margin-bottom: .7rem; }
.causa label { display: flex; justify-content: space-between; align-items: baseline; font-size: .82rem; font-weight: 600; color: var(--dark); }
.causa label b { font-weight: 700; color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.causa small { display: block; font-size: .7rem; color: var(--text-muted); line-height: 1.3; }
.causa input[type=range] { width: 100%; margin: .2rem 0; accent-color: var(--primary); cursor: pointer; }
.causa.activa label span { color: var(--primary-dark); }
.causa.activa label b { color: var(--rojo); }
.contexto label b { color: var(--text-secondary); }

.btn { font: inherit; font-size: .82rem; font-weight: 600; padding: .5rem .9rem; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--white); color: var(--dark); cursor: pointer; transition: all .15s; }
.btn:hover { border-color: var(--primary-mid); background: var(--primary-light); }
.btn-primary { background: var(--primary); color: var(--white); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); color: var(--white); }
.btn-secondary { width: 100%; margin-top: .8rem; }

/* ── Reloj ── */
.reloj { display: flex; align-items: center; gap: 1rem; padding: .7rem 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.reloj-dia { display: flex; flex-direction: column; min-width: 92px; }
.reloj-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); font-weight: 600; }
#dia { font-family: 'Outfit', sans-serif; font-size: 1.5rem; font-weight: 800; color: var(--dark); line-height: 1; font-variant-numeric: tabular-nums; }
.reloj-barra { flex: 1; height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; min-width: 120px; }
#dia-barra { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--primary)); transition: width .2s linear; }
.reloj-botones { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.velocidad { display: flex; flex-shrink: 0; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.btn-vel { font: inherit; font-size: .78rem; font-weight: 600; padding: .45rem .6rem; border: none; background: var(--white); color: var(--text-secondary); cursor: pointer; white-space: nowrap; }
.btn-vel + .btn-vel { border-left: 1px solid var(--border); }
.btn-vel.activo { background: var(--primary-light); color: var(--primary-dark); }

/* ── SVG ── */
.svg-card { padding: .5rem; }
.banda-luz { fill: var(--luz); }
.banda-sangre { fill: var(--sangre); }
.banda-titulo { font-size: 12px; font-weight: 800; letter-spacing: 1px; fill: #92400e; }
.banda-sangre ~ .banda-titulo:nth-of-type(2) { fill: #991b1b; }
.banda-valores text { font-size: 13px; font-weight: 600; fill: #78350f; }
#sangre-valores text { fill: #991b1b; }
.banda-valores tspan { font-weight: 800; }
.celula { fill: #f1f5f9; stroke: #cbd5e1; stroke-width: 2; }
.celula-titulo { font-size: 14px; font-weight: 700; fill: var(--text-secondary); text-anchor: middle; }
.membrana { stroke: var(--dark); stroke-width: 4; stroke-linecap: round; }
.membrana-label { font-size: 10px; fill: var(--text-muted); font-weight: 600; }

.flujo { fill: none; stroke-width: 6; stroke-linecap: round; transition: stroke-width .3s, opacity .3s; }
.flujo.na { stroke: var(--na); }
.flujo.k { stroke: var(--k); }
.flujo.agua { stroke: var(--agua); stroke-width: 3; stroke-dasharray: 6 6; opacity: .7; }
.ion-label { font-size: 13px; font-weight: 800; }
.ion-label.na { fill: var(--na); } .ion-label.k { fill: var(--k); } .ion-label.agua { fill: var(--agua); }

.canal, .bomba, .caja, .nucleo, .voltimetro { cursor: pointer; }
.canal .sub, .bomba .sub { fill: var(--ok); stroke: var(--white); stroke-width: 2; transition: fill .3s; }
.canal.parcial .sub, .bomba.parcial .sub { fill: var(--parcial); }
.canal.off .sub, .bomba.off .sub { fill: var(--off); }
.canal .x { display: none; font-size: 18px; font-weight: 800; fill: var(--rojo); text-anchor: middle; }
.canal.off .x { display: block; }
.canal-nombre { font-size: 12px; font-weight: 700; fill: var(--dark); text-anchor: middle; }
.bomba-atp { font-size: 10px; font-weight: 800; fill: var(--white); text-anchor: middle; }
.hit { fill: transparent; }
.canal:hover .sub, .bomba:hover .sub { filter: brightness(1.15); }
.canal.seleccionado .canal-nombre, .bomba.seleccionado .canal-nombre { fill: var(--primary-dark); text-decoration: underline; }

.via { fill: none; stroke: #7c3aed; stroke-width: 2.5; transition: opacity .3s; }
.via.inhib { stroke: var(--rojo); }
.via.tenue { stroke-dasharray: 5 5; opacity: .5; }
.via-label { font-size: 11px; font-weight: 700; fill: #6d28d9; }
.via-nota { font-size: 11px; fill: var(--text-muted); }
.caja rect:not(.hit) { fill: #ede9fe; stroke: #7c3aed; stroke-width: 2; transition: opacity .3s; }
.caja text { font-size: 13px; font-weight: 800; fill: #4c1d95; text-anchor: middle; }
.caja.apagada rect:not(.hit) { fill: #f1f5f9; stroke: var(--off); }
.caja.apagada text { fill: var(--off); }
.aldo-dots circle { fill: #7c3aed; transition: opacity .3s; }
.nucleo ellipse { fill: #dbeafe; stroke: #93c5fd; stroke-width: 2; }
.nucleo text { font-size: 13px; font-weight: 700; fill: var(--primary-dark); text-anchor: middle; }
.nucleo .nucleo-sub { font-size: 10px; font-weight: 500; fill: var(--text-secondary); }

.volt-titulo { font-size: 11px; font-weight: 700; fill: var(--text-secondary); text-anchor: middle; }
.volt-marco { fill: var(--white); stroke: var(--border); stroke-width: 2; }
.volt-barra { fill: url(#gradVolt); fill: #2563eb; opacity: .85; transition: height .3s, y .3s; }
.volt-tick { font-size: 9px; fill: var(--text-muted); text-anchor: end; }
.volt-val { font-family: 'Outfit', sans-serif; font-size: 16px; font-weight: 800; fill: var(--dark); text-anchor: middle; }

.leyenda { display: flex; flex-wrap: wrap; gap: .4rem 1rem; padding: .5rem .6rem .2rem; font-size: .72rem; color: var(--text-secondary); }
.leyenda .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }
.sw.ok { background: var(--ok); } .sw.parcial { background: var(--parcial); } .sw.off { background: var(--off); }
.leyenda-sep { color: var(--text-muted); }

/* ── Tarjeta ¿por qué? ── */
.tarjeta { margin-top: 1rem; padding: .9rem 1rem; border-left: 4px solid var(--primary); min-height: 84px; }
.tarjeta-titulo { font-family: 'Outfit', sans-serif; font-weight: 700; color: var(--dark); margin-bottom: .3rem; }
.tarjeta-texto { font-size: .86rem; color: var(--text); }
.tarjeta-refs { margin-top: .4rem; font-size: .74rem; color: var(--text-secondary); }
.tarjeta-refs a { color: var(--primary-dark); text-decoration: none; }
.tarjeta-refs a:hover { text-decoration: underline; }
.tarjeta-estado { display: inline-block; margin-top: .4rem; font-size: .74rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; background: var(--primary-light); color: var(--primary-dark); }

/* ── Cascada ── */
.cascada { margin-top: 1rem; padding: .9rem 1rem; }
.cascada-titulo { font-family: 'Outfit', sans-serif; font-weight: 700; color: var(--dark); margin-bottom: .4rem; }
.cascada-pasos { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; counter-reset: paso; }
.cascada-pasos li { counter-increment: paso; font-size: .76rem; padding: .3rem .6rem .3rem .4rem; border: 1px solid var(--border); border-radius: 999px; color: var(--text-muted); background: var(--bg); transition: all .3s; }
.cascada-pasos li::before { content: counter(paso); display: inline-block; width: 18px; height: 18px; line-height: 18px; text-align: center; border-radius: 50%; background: var(--border); color: var(--text-secondary); font-weight: 700; font-size: .68rem; margin-right: .4rem; }
.cascada-pasos li.activo { color: var(--dark); border-color: var(--primary-mid); background: var(--primary-light); }
.cascada-pasos li.activo::before { background: var(--primary); color: var(--white); }
.cascada-pasos li.fuerte { border-color: #fca5a5; background: #fef2f2; }
.cascada-pasos li.fuerte::before { background: var(--rojo); color: var(--white); }

/* ── Labs ── */
.labs { width: 100%; border-collapse: collapse; font-size: .82rem; margin-bottom: .6rem; }
.labs td { padding: .3rem .2rem; border-bottom: 1px solid var(--border); }
.labs td:first-child { color: var(--text-secondary); font-weight: 500; }
.labs .val { text-align: right; font-weight: 700; color: var(--dark); font-variant-numeric: tabular-nums; }
.labs .unit { font-size: .68rem; color: var(--text-muted); padding-left: .3rem; white-space: nowrap; }
.labs .flag { text-align: right; font-weight: 800; width: 1.6rem; }
.labs tr.alto .val, .labs tr.alto .flag { color: var(--rojo); }
.labs tr.bajo .val, .labs tr.bajo .flag { color: var(--rojo); }
.labs tr.leve .val, .labs tr.leve .flag { color: var(--ambar); }
.labs tr.ok .flag { color: var(--verde); }
.labs-nota { font-size: .72rem; color: var(--text-secondary); margin-top: .4rem; line-height: 1.4; }

.spark { margin: .2rem 0 .7rem; }
.spark-label { font-size: .68rem; color: var(--text-muted); font-weight: 600; margin-bottom: .1rem; }
.spark svg { width: 100%; height: 50px; display: block; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; }
.spark polyline { fill: none; stroke: var(--primary); stroke-width: 2; vector-effect: non-scaling-stroke; }
.spark line.ref { stroke: var(--text-muted); stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.spark text { font-size: 9px; fill: var(--text-muted); }

/* ── Pie ── */
.site-footer { max-width: 1480px; margin: 0 auto; padding: 0 1.25rem 2rem; font-size: .8rem; color: var(--text-secondary); }
.site-footer details { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: .7rem 1rem; margin-bottom: .6rem; }
.site-footer summary { cursor: pointer; font-weight: 700; color: var(--dark); font-family: 'Outfit', sans-serif; }
.refs ol { margin: .6rem 0 0 1.2rem; font-size: .76rem; line-height: 1.45; }
.refs li { margin-bottom: .3rem; }
.refs a { color: var(--primary-dark); text-decoration: none; }
.refs a:hover { text-decoration: underline; }
.limites p { margin-top: .5rem; }
.footer-firma { text-align: center; font-size: .72rem; color: var(--text-muted); margin-top: 1rem; }

/* ── Responsive ── */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 260px minmax(0, 1fr); }
  .panel-labs { grid-column: 1 / -1; position: static; max-height: none; }
  .panel-labs .labs { display: inline-table; width: 48%; vertical-align: top; }
  .panel-labs .spark { display: inline-block; width: 48%; vertical-align: top; margin-right: 1%; }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; padding: .75rem 1rem 1.5rem; }
  .panel { position: static; max-height: none; }
  .panel-labs .labs, .panel-labs .spark { width: 100%; display: block; }
  .header-inner { padding: .6rem 1rem; }
  .logo-sub { display: none; }
  .reloj { gap: .6rem; }
  .reloj-barra { order: 3; width: 100%; flex-basis: 100%; }
}

/* ── Fase 3: mapa, RAAS, pestañas, partículas ── */
.svg-titulo { font-family: 'Outfit', sans-serif; font-weight: 700; font-size: .9rem; color: var(--dark); padding: .35rem .6rem 0; }
.svg-ayuda { font-family: 'Inter', sans-serif; font-weight: 500; font-size: .72rem; color: var(--text-muted); margin-left: .5rem; }
.svg-card + .svg-card { margin-top: 1rem; }
#svg-nefron, #svg-raas { width: 100%; height: auto; display: block; font-family: 'Inter', system-ui, sans-serif; }
.guias path { fill: none; stroke: #cbd5e1; stroke-width: 2; stroke-dasharray: 4 5; opacity: .7; }
.particula text { pointer-events: none; }
.particula circle { stroke: rgba(255,255,255,.85); stroke-width: 1.5; }
.vista { width: 100%; height: auto; display: block; font-family: 'Inter', system-ui, sans-serif; }
.vista.oculta { display: none; }
.tabs { display: flex; gap: .4rem; margin: 1rem 0 .5rem; flex-wrap: wrap; }
.tab { font: inherit; font-size: .8rem; font-weight: 600; padding: .45rem .8rem; border-radius: 999px; border: 1px solid var(--border); background: var(--white); color: var(--text-secondary); cursor: pointer; }
.tab:hover { border-color: var(--primary-mid); }
.tab.activo { background: var(--primary); color: var(--white); border-color: var(--primary); }
.intersticio { fill: #fff7ed; stroke: #fdba74; stroke-dasharray: 4 4; }
.inter-titulo { font-size: 11px; font-weight: 800; letter-spacing: .8px; fill: #9a3412; }
.inter-pool { fill: #fb923c; opacity: .55; transition: opacity .4s; }
.inter-val { font-size: 12px; font-weight: 700; fill: #7c2d12; text-anchor: middle; }
.orina-titulo { font-size: 12px; font-weight: 800; fill: #92400e; }
.seg { cursor: pointer; }
.seg rect { fill: var(--white); stroke: var(--ok); stroke-width: 2.5; transition: stroke .3s, fill .3s; }
.seg.parcial rect { stroke: var(--parcial); fill: #fffbeb; }
.seg.off rect { stroke: var(--rojo); fill: #fef2f2; }
.seg text { font-size: 14px; font-weight: 700; fill: var(--dark); text-anchor: middle; }
.seg .seg-sub { font-size: 10px; font-weight: 500; fill: var(--text-secondary); }
.seg:hover rect { filter: brightness(.97); }
.seg.seleccionado rect { stroke-width: 4; }
.o-nota { font-size: 10px; font-weight: 700; fill: var(--rojo); text-anchor: middle; opacity: 0; transition: opacity .4s; }
.o-nota.visible { opacity: 1; }
.caja.raas rect:not(.hit) { fill: #faf5ff; }
.caja.raas text { font-size: 13px; }
.caja .caja-sub { font-size: 10px; font-weight: 500; fill: var(--text-secondary); }
.caja.raas.destino rect:not(.hit) { fill: var(--primary-light); stroke: var(--primary); }
.caja.raas.destino text { fill: var(--primary-dark); }
.marca text { font-size: 10.5px; fill: var(--text-muted); text-anchor: middle; }
.marca.activa text { fill: var(--rojo); font-weight: 700; }
.r-val { font-size: 11px; font-weight: 700; fill: #6d28d9; text-anchor: middle; }
.celula.alfa { fill: #fdf2f8; stroke: #f9a8d4; }
.celula.proximal { fill: #f0fdf4; stroke: #86efac; }
.celula.asa { fill: #fffbeb; stroke: #fcd34d; }
.sub.roja { fill: var(--rojo) !important; }
.sub.verdeazul { fill: #0d9488 !important; }
.sub.marron { fill: #92400e !important; }
.sub.naranja { fill: #ea580c !important; }
.bomba.parcial .sub.roja, .bomba.parcial .sub.verdeazul, .canal.parcial .sub.marron, .canal.parcial .sub.naranja { fill: var(--parcial) !important; }
.bomba.off .sub.roja, .bomba.off .sub.verdeazul, .canal.off .sub.marron, .canal.off .sub.naranja { fill: var(--off) !important; }
.sub.ancho { fill: var(--ok); }
.bomba-sub { font-size: 9px; font-weight: 600; fill: var(--white); text-anchor: middle; }
.ion-label.h { fill: var(--rojo); } .ion-label.hco3 { fill: #0d9488; } .ion-label.cl { fill: #6366f1; } .ion-label.nh3, .ion-label.nh4 { fill: #ea580c; } .ion-label.gln { fill: #92400e; } .ion-label.co2 { fill: #64748b; }
.caja.ca rect:not(.hit) { fill: #fef2f2; stroke: var(--rojo); }
.caja.ca text { fill: #991b1b; }
.caja.mito rect:not(.hit) { fill: #ecfdf5; stroke: #16a34a; }
.caja.mito text { fill: #14532d; }
.caja.mito.parcial rect:not(.hit) { fill: #fffbeb; stroke: var(--parcial); }
.caja.mito.off rect:not(.hit) { fill: #f1f5f9; stroke: var(--off); }
.caja.mito.off text { fill: var(--off); }
.caja-estado { font-size: 12px; font-weight: 800; }
.via-label.alerta { fill: var(--rojo); font-size: 12px; }
.via-label.oculta, .oculta-txt { display: none; }
.union line { stroke: var(--dark); stroke-width: 2; stroke-dasharray: 3 4; }
.union text { font-size: 9px; fill: var(--text-muted); }
.union { cursor: pointer; }
.deposito { fill: #fb923c; opacity: .5; transition: opacity .4s; stroke: #c2410c; }
.deposito-txt { font-size: 14px; font-weight: 800; fill: #7c2d12; text-anchor: middle; }
.rebote-x { pointer-events: none; }

/* ── Estilo esquema clásico (luz izquierda, célula arena, intersticio derecha) ── */
.zona-luz { fill: #fffbea; }
.zona-inter { fill: #fdf2f2; }
.zona-titulo { font-size: 15px; font-weight: 800; letter-spacing: .6px; fill: #6b4f3a; text-anchor: middle; }
.celula-cuerpo { fill: #ead9c9; stroke: #1f2937; stroke-width: 3.5; }
.vista .celula-titulo { font-size: 18px; }
.vista .valor { font-size: 14px; font-weight: 600; fill: #4b3a2d; }
.vista .valor tspan { font-weight: 800; }
.flecha { fill: none; stroke: #1f2937; stroke-width: 1.8; }
.flecha.tenue { stroke: #9ca3af; stroke-dasharray: 4 4; }
.flecha.via { stroke: #7c3aed; stroke-width: 2.2; transition: opacity .3s; }
.flecha.via.inhib { stroke: #dc2626; marker-end: url(#punta-inhib) !important; }
.ion-txt { font-size: 16px; font-weight: 800; fill: #1f2937; }
.ion-txt.na { fill: var(--na); } .ion-txt.k { fill: var(--k); } .ion-txt.h { fill: var(--rojo); } .ion-txt.hco3 { fill: #0d9488; } .ion-txt.cl { fill: #6366f1; } .ion-txt.nh3, .ion-txt.nh4 { fill: #ea580c; } .ion-txt.gln { fill: #92400e; } .ion-txt.co2 { fill: #64748b; } .ion-txt.agua { fill: var(--agua); }
.reaccion { font-size: 15px; font-weight: 700; fill: #4b3a2d; }
.glifo { cursor: pointer; }
.glifo.bomba .sub { stroke: #1f2937; stroke-width: 2; transition: fill .3s; }
.glifo.bomba.pasivo .sub { fill: #6b9bd8; }
.glifo.bomba.activo .sub { fill: #cfe3a6; }
.glifo.bomba.parcial .sub { fill: #f6c35c !important; }
.glifo.bomba.off .sub { fill: #cbd5e1 !important; }
.glifo-txt { font-size: 13px; font-weight: 800; fill: #1f2937; text-anchor: middle; }
.glifo.pasivo .glifo-txt { fill: #fff; }
.glifo-atp { font-size: 8px; font-weight: 800; fill: #3f6212; text-anchor: middle; }
.glifo-nombre { font-size: 16px; font-weight: 700; fill: #1f2937; text-anchor: middle; }
.glifo.canal .sub { stroke: #1f2937; stroke-width: 3; stroke-linecap: round; }
.glifo.canal.parcial .sub { stroke: #d97706; }
.glifo.canal.off .sub { stroke: #94a3b8; }
.canal-hueco { fill: #ead9c9; }
.glifo.canal .x { display: none; font-size: 16px; font-weight: 900; fill: var(--rojo); text-anchor: middle; }
.glifo.canal.off .x { display: block; }
.glifo.seleccionado .glifo-nombre, .glifo.seleccionado .glifo-txt { text-decoration: underline; }
.vista .caja rect:not(.hit) { fill: #efe6f9; stroke: #7c3aed; }
.vista .caja.ca rect:not(.hit) { fill: #e8e2f3; stroke: #8b7bb5; }
.vista .caja.ca text { fill: #3b2a66; font-size: 12px; }
.vista .caja.mito rect:not(.hit) { fill: #e3efd3; stroke: #4d7c0f; }
.vista .caja.mito text { fill: #1f3a0a; font-size: 12px; }
.vista .caja.mito.parcial rect:not(.hit) { fill: #fdf3d7; stroke: #d97706; }
.vista .caja.mito.off rect:not(.hit) { fill: #e5e7eb; stroke: #94a3b8; }
.vista .caja .caja-estado { font-size: 11.5px; font-weight: 800; }
.vista .nucleo ellipse { fill: #f5ede4; stroke: #8b6b4f; }
.vista .nucleo text { fill: #4b3a2d; }
.deposito-sub { font-size: 10px; fill: #7c2d12; text-anchor: middle; }
.vista .deposito { opacity: .5; }
.vista .union line { stroke: #1f2937; stroke-width: 2; stroke-dasharray: 4 4; }
.sw.circ { border-radius: 50%; border: 1.5px solid #1f2937; }
.sw.circ.pasivo { background: #6b9bd8; } .sw.circ.activo { background: #cfe3a6; }
.sw.canalito { background: linear-gradient(#1f2937 0 25%, transparent 25% 75%, #1f2937 75% 100%); border-radius: 0; }

/* ── Navegación entre páginas ── */
.nav { display: flex; gap: .4rem; }
.nav-link { font-size: .8rem; font-weight: 600; padding: .4rem .8rem; border-radius: 999px; border: 1px solid var(--border); color: var(--text-secondary); text-decoration: none; }
.nav-link.activo { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* ── Página de animación paso a paso ── */
.anim-layout { max-width: 1700px; margin: 0 auto; padding: 1rem 1.25rem 2rem; display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr) 400px; align-items: start; }
.anim-panel { position: sticky; top: 70px; display: grid; gap: 1rem; max-height: calc(100vh - 86px); overflow-y: auto; }
.anim-controles { padding: .9rem 1.1rem; display: grid; gap: .7rem; }
.mecanismos { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.mec-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); font-weight: 700; width: 100%; }
.mec { font: inherit; font-size: .84rem; font-weight: 600; padding: .45rem .8rem; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--white); color: var(--dark); cursor: pointer; text-align: left; }
.mec:hover { border-color: var(--primary-mid); background: var(--primary-light); }
.mec.activo { background: var(--primary); color: var(--white); border-color: var(--primary); }
.paso-card { min-height: 90px; }
.paso-num { font-size: .72rem; text-transform: uppercase; letter-spacing: .4px; color: var(--primary-dark); font-weight: 700; }
.paso-titulo { font-family: 'Outfit', sans-serif; font-size: 1.2rem; font-weight: 800; color: var(--dark); line-height: 1.2; margin: .15rem 0 .3rem; }
.paso-texto { font-size: .98rem; color: var(--text); line-height: 1.45; }
.paso-botones { display: flex; gap: .4rem; }
.paso-botones .btn { font-size: .95rem; padding: .55rem .9rem; flex: 1; white-space: nowrap; }
.paso-progreso { display: flex; gap: .3rem; }
.paso-progreso i { flex: 1; height: 6px; border-radius: 999px; background: var(--border); }
.paso-progreso i.hecho { background: var(--primary); }
.tarjeta { position: relative; }
.tarjeta-cerrar { display: none; position: absolute; top: .5rem; right: .6rem; font: inherit; font-size: 1rem; font-weight: 700; border: 1px solid var(--border); background: var(--white); border-radius: 999px; width: 30px; height: 30px; cursor: pointer; color: var(--text-secondary); }
.leyenda .sw.espera { border: 2px dashed #111827; background: #2563eb; }
.anim-card { padding: .5rem; }
#svg-nefron-paralelo { width: 100%; height: auto; display: block; font-family: 'Inter', system-ui, sans-serif; }
.leyenda.grande { font-size: .85rem; }
.pagina-animacion .tarjeta-texto { font-size: 1rem; }

/* esquema paralelo */
.np-luz { fill: #fffbea; } .np-sangre { fill: #fdf2f2; }
.np-banda-titulo { font-size: 18px; font-weight: 800; letter-spacing: 1px; fill: #92400e; }
.np-banda-titulo.sangre { fill: #991b1b; }
.np-celula { fill: #ead9c9; stroke: #1f2937; stroke-width: 3.5; }
.np-celula-titulo { font-size: 17px; font-weight: 800; fill: #3b2f26; text-anchor: middle; }
.np-flecha { fill: none; stroke: #1f2937; stroke-width: 2; }
.np-flecha.tenue { stroke: #9ca3af; stroke-dasharray: 5 5; }
.np-flecha.via { stroke: #7c3aed; stroke-width: 2.5; }
.np-flecha.via.inhib { stroke: #dc2626; }
.np-ion { font-size: 17px; font-weight: 800; fill: #1f2937; }
.np-ion.na { fill: var(--na); } .np-ion.k { fill: var(--k); } .np-ion.h { fill: var(--rojo); } .np-ion.hco3 { fill: #0d9488; } .np-ion.cl { fill: #6366f1; } .np-ion.nh4 { fill: #ea580c; } .np-ion.gln { fill: #92400e; } .np-ion.co2 { fill: #64748b; }
.np-nota { font-size: 14px; fill: #57534e; }
.np-reaccion { font-size: 15px; font-weight: 700; fill: #4b3a2d; }
.np-union { stroke: #1f2937; stroke-width: 2; stroke-dasharray: 5 5; }
#svg-nefron-paralelo .glifo-nombre { font-size: 17px; }
#svg-nefron-paralelo .glifo-txt { font-size: 14px; }
#svg-nefron-paralelo .glifo-atp { font-size: 10px; }
#svg-nefron-paralelo .caja text { font-size: 16px; }
#svg-nefron-paralelo .caja .caja-sub { font-size: 13px; }
#svg-nefron-paralelo .nucleo text { font-size: 16px; }
#svg-nefron-paralelo .nucleo .nucleo-sub { font-size: 12px; }
#svg-nefron-paralelo .canal-hueco { fill: #ead9c9; }
.np-carga { font-size: 20px; font-weight: 900; fill: #1d4ed8; letter-spacing: 4px; }
.np-carga.perdida { fill: #9ca3af; }
.np-carga-txt { font-size: 15px; font-weight: 700; fill: #1e3a8a; }
.np-pila-txt { font-size: 15px; font-weight: 800; fill: #1f2937; }
.np-cola-txt { font-size: 13px; font-weight: 700; fill: #475569; }
.particula.aparcada circle { stroke: #111827; stroke-width: 2; stroke-dasharray: 4 3; }
.np-pila circle { stroke: #fff; stroke-width: 1.5; }
.np-pila text { font-size: 11px; font-weight: 800; fill: #fff; text-anchor: middle; pointer-events: none; }
.np-deposito { fill: #fb923c; stroke: #c2410c; stroke-width: 2; }
.np-deposito-txt { font-size: 15px; font-weight: 800; fill: #7c2d12; text-anchor: middle; }
.resalte { animation: pulso 1.2s ease-in-out infinite; }
@keyframes pulso { 0%, 100% { filter: drop-shadow(0 0 0 rgba(37,99,235,0)); } 50% { filter: drop-shadow(0 0 10px rgba(37,99,235,.9)); } }
.np-halo { fill: none; stroke: #2563eb; stroke-width: 4; stroke-dasharray: 10 6; opacity: 0; transition: opacity .3s; }
.np-halo.visible { opacity: .9; animation: girar 6s linear infinite; }
@keyframes girar { to { stroke-dashoffset: -64; } }
@media (max-width: 1180px) {
  .anim-layout { grid-template-columns: 1fr; }
  .anim-panel { position: static; max-height: none; overflow: visible; }
  .anim-card { order: 2; }
  .anim-panel { order: 1; }
  /* en pantallas angostas la explicación del canal se abre como cajón fijo abajo, encima de la animación */
  .tarjeta.abierta { position: fixed; left: .5rem; right: .5rem; bottom: .5rem; z-index: 60; max-height: 38vh; overflow-y: auto; box-shadow: 0 -4px 24px rgba(0,0,0,.18); }
  .tarjeta.abierta .tarjeta-cerrar { display: inline-block; }
}
