/* Diagramas animados de la web (index.html: #proyectos, #sectores, #gastos).
   Solo CSS y SVG, sin librerías. Las animaciones arrancan cuando el bloque
   entra en pantalla (app.js le pone .visible) y se apagan con
   prefers-reduced-motion. Colores de la app: violeta, noche y verde. */
:root {
  --dg-c1: #7c3aed; --dg-c2: #0ea5e9; --dg-c3: #10b981;
  --dg-c4: #f59e0b; --dg-c5: #ec4899; --dg-c6: #6366f1;
}
.dg-dos { display: grid; grid-template-columns: 1fr 1.05fr; gap: 56px; align-items: center; }
svg use { pointer-events: none; }
.dg-pestana svg, .dg-insignia svg, .dg-fuentes-lista svg {
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Pasos numerados (texto del diagrama de proyectos) ---------- */
.dg-pasos { list-style: none; counter-reset: dg; padding: 0; margin: 30px 0 0; display: grid; gap: 22px; }
.dg-pasos li { counter-increment: dg; display: grid; grid-template-columns: 42px 1fr; column-gap: 16px; }
.dg-pasos li::before { content: counter(dg); grid-row: span 2; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: var(--violeta); background: var(--violeta-tenue); }
.dg-pasos li:nth-child(2)::before { color: #0284c7; background: #e0f2fe; }
.dg-pasos li:nth-child(3)::before { color: #059669; background: #d1fae5; }
.dg-pasos b { font-size: 1.12rem; }
.dg-pasos span { color: var(--tinta-suave); }

/* ---------- 1. La línea del proyecto (un punto recorre sus paradas) ----------
   Ciclo de 10 s, el mismo que el animateMotion del SVG: el punto para en cada
   estación (0 %, 20 %, 40 %, 60 % y 80 % del ciclo) y la parada se enciende. */
.dg-ruta { position: relative; width: 100%; max-width: 480px; margin: 0 auto; padding: 18px 18px 10px; border-radius: 26px; background: #fff; border: 1px solid var(--borde); box-shadow: 0 30px 60px -34px rgba(76, 29, 149, .45); }
.dg-ruta-cabecera { display: flex; align-items: center; gap: 12px; padding: 4px 4px 14px; border-bottom: 1px solid var(--borde); }
.dg-ruta-cabecera div { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.dg-ruta-cabecera b { font-size: 1rem; }
.dg-ruta-cabecera div span { font-size: .8rem; color: var(--tinta-suave); }
.dg-ruta-estado { display: grid; font-size: .76rem; font-weight: 700; }
.dg-ruta-estado i { grid-area: 1 / 1; font-style: normal; padding: 4px 10px; border-radius: 999px; white-space: nowrap; opacity: 0; }
.dg-ruta-estado i:nth-child(1) { background: #f1ebff; color: var(--violeta); opacity: 1; }
.dg-ruta-estado i:nth-child(2) { background: #e0f2fe; color: #0369a1; }
.dg-ruta-estado i:nth-child(3) { background: #d1fae5; color: #047857; }
.dg-ruta-mapa { position: relative; aspect-ratio: 100 / 120; margin-bottom: 26px; }
.dg-ruta-mapa > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.dg-ruta-fondo { fill: none; stroke: #e5e7f0; stroke-width: 2.2; stroke-linecap: round; }
.dg-ruta-traza { fill: none; stroke: url(#dg-grad-ruta); stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.dg-estacion { fill: #fff; stroke: #cfd5e3; stroke-width: 1; }
.dg-ruta-punto { fill: #fff; stroke: var(--violeta); stroke-width: 1.3; filter: drop-shadow(0 0 2px rgba(124, 58, 237, .8)); opacity: 0; }
.dg-ruta.visible .dg-ruta-punto { opacity: 1; }
.dg-parada { position: absolute; top: var(--y); transform: translateY(-50%); display: flex; align-items: center; gap: 10px; max-width: 34%; padding: 8px 10px; border-radius: 14px; background: #fff; border: 1px solid var(--borde); box-shadow: 0 8px 22px -14px rgba(15, 23, 42, .35); transition: border-color .3s, box-shadow .3s; }
.dg-parada.p1, .dg-parada.p3, .dg-parada.p5 { right: calc(100% - var(--x) + 6%); }
.dg-parada.p2, .dg-parada.p4 { left: calc(var(--x) + 6%); }
.dg-parada > svg { width: 30px; height: 30px; padding: 6px; border-radius: 10px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; color: #94a3b8; background: #f1f5f9; transition: color .3s, background .3s; }
.dg-parada b { display: block; font-size: .92rem; line-height: 1.2; }
.dg-parada small { display: block; font-size: .74rem; line-height: 1.3; color: var(--tinta-suave); }
.dg-parada.encendida, .dg-ruta.visible .dg-parada.p1 { border-color: #c4b5fd; box-shadow: 0 10px 26px -12px rgba(124, 58, 237, .55); }
.dg-suma { position: absolute; top: calc(var(--y) + 6.2%); font-size: .78rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; color: #047857; background: #d1fae5; white-space: nowrap; opacity: 0; transform: translateY(6px); }
.dg-suma.s3, .dg-suma.s5 { right: calc(100% - var(--x) + 6%); }
.dg-suma.s2, .dg-suma.s4 { left: calc(var(--x) + 6%); }
.dg-suma-final { color: #fff; background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 6px 16px -6px rgba(16, 185, 129, .8); }

.dg-ruta.visible .dg-ruta-traza { animation: dg-traza 10s linear infinite; }
.dg-ruta.visible .dg-ruta-estado i:nth-child(1) { animation: dg-estado-1 10s linear infinite; }
.dg-ruta.visible .dg-ruta-estado i:nth-child(2) { animation: dg-estado-2 10s linear infinite; }
.dg-ruta.visible .dg-ruta-estado i:nth-child(3) { animation: dg-estado-3 10s linear infinite; }
.dg-ruta.visible .p1 > svg { color: var(--dg-c1); background: #f1ebff; }
.dg-ruta.visible .p2 { animation: dg-para-2 10s linear infinite; } .dg-ruta.visible .p2 > svg { animation: dg-icono-2 10s linear infinite; }
.dg-ruta.visible .p3 { animation: dg-para-3 10s linear infinite; } .dg-ruta.visible .p3 > svg { animation: dg-icono-3 10s linear infinite; }
.dg-ruta.visible .p4 { animation: dg-para-4 10s linear infinite; } .dg-ruta.visible .p4 > svg { animation: dg-icono-4 10s linear infinite; }
.dg-ruta.visible .p5 { animation: dg-para-5 10s linear infinite; } .dg-ruta.visible .p5 > svg { animation: dg-icono-5 10s linear infinite; }
.dg-ruta.visible .s2 { animation: dg-suma-2 10s ease infinite; } .dg-ruta.visible .s3 { animation: dg-suma-3 10s ease infinite; }
.dg-ruta.visible .s4 { animation: dg-suma-4 10s ease infinite; } .dg-ruta.visible .s5 { animation: dg-suma-5 10s ease infinite; }
@keyframes dg-traza { 0%, 8% { stroke-dashoffset: 1; } 20%, 28% { stroke-dashoffset: .75; } 40%, 48% { stroke-dashoffset: .5; } 60%, 68% { stroke-dashoffset: .25; } 80%, 96% { stroke-dashoffset: 0; opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes dg-estado-1 { 0%, 19% { opacity: 1; } 20%, 100% { opacity: 0; } }
@keyframes dg-estado-2 { 0%, 19% { opacity: 0; } 20%, 79% { opacity: 1; } 80%, 100% { opacity: 0; } }
@keyframes dg-estado-3 { 0%, 79% { opacity: 0; } 80%, 99% { opacity: 1; } 100% { opacity: 0; } }
/* Una parada se enciende cuando llega el punto y sigue encendida hasta el final del ciclo. */
@keyframes dg-para-2 { 0%, 19% { border-color: var(--borde); } 20%, 97% { border-color: #7dd3fc; box-shadow: 0 10px 26px -12px rgba(14, 165, 233, .55); } }
@keyframes dg-para-3 { 0%, 39% { border-color: var(--borde); } 40%, 97% { border-color: #6ee7b7; box-shadow: 0 10px 26px -12px rgba(16, 185, 129, .55); } }
@keyframes dg-para-4 { 0%, 59% { border-color: var(--borde); } 60%, 97% { border-color: #fcd34d; box-shadow: 0 10px 26px -12px rgba(245, 158, 11, .55); } }
@keyframes dg-para-5 { 0%, 79% { border-color: var(--borde); } 80%, 97% { border-color: #6ee7b7; box-shadow: 0 10px 26px -12px rgba(16, 185, 129, .6); } }
@keyframes dg-icono-2 { 0%, 19% { color: #94a3b8; background: #f1f5f9; } 20%, 97% { color: var(--dg-c2); background: #e0f2fe; } }
@keyframes dg-icono-3 { 0%, 39% { color: #94a3b8; background: #f1f5f9; } 40%, 97% { color: var(--dg-c3); background: #d1fae5; } }
@keyframes dg-icono-4 { 0%, 59% { color: #94a3b8; background: #f1f5f9; } 60%, 97% { color: var(--dg-c4); background: #fef3c7; } }
@keyframes dg-icono-5 { 0%, 79% { color: #94a3b8; background: #f1f5f9; } 80%, 97% { color: var(--dg-c3); background: #d1fae5; } }
@keyframes dg-suma-2 { 0%, 21% { opacity: 0; transform: translateY(6px); } 24%, 95% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes dg-suma-3 { 0%, 41% { opacity: 0; transform: translateY(6px); } 44%, 95% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes dg-suma-4 { 0%, 61% { opacity: 0; transform: translateY(6px); } 64%, 95% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes dg-suma-5 { 0%, 81% { opacity: 0; transform: translateY(6px) scale(.9); } 85%, 95% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* ---------- 2. Tu sector (el especial) ---------- */
.dg-sectores { position: relative; overflow: hidden; color: #fff; background: radial-gradient(900px 500px at 15% 0%, rgba(124, 58, 237, .35), transparent 60%), radial-gradient(700px 420px at 95% 100%, rgba(14, 165, 233, .18), transparent 60%), linear-gradient(180deg, var(--noche), var(--noche-2)); }
.dg-sectores .antetitulo { color: var(--violeta-claro); }
.dg-sectores .texto-seccion { color: #cbd5e1; margin: 0 auto; }
.dg-sectores-cabecera { text-align: center; max-width: 760px; margin: 0 auto 34px; }
.dg-sectores-cabecera h2 { margin-inline: auto; max-width: none; text-wrap: balance; }
.dg-pestanas { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 30px; }
.dg-pestana { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: .93rem; font-weight: 650; color: #cbd5e1; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .12); border-radius: 999px; padding: 9px 16px; cursor: pointer; transition: background .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease; }
.dg-pestana svg { width: 18px; height: 18px; }
.dg-pestana:hover { color: #fff; background: rgba(255, 255, 255, .09); }
.dg-pestana[aria-selected="true"] { color: #fff; background: linear-gradient(135deg, rgba(124, 58, 237, .55), rgba(124, 58, 237, .25)); border-color: rgba(167, 139, 250, .7); box-shadow: 0 0 0 4px rgba(124, 58, 237, .15), 0 10px 26px -10px rgba(124, 58, 237, .8); }
.dg-pestana:focus-visible { outline: 2px solid var(--violeta-claro); outline-offset: 3px; }
.dg-lienzo { display: grid; grid-template-columns: .9fr 1.1fr; gap: 36px; align-items: stretch; }

/* Montaje: base fija abajo, piezas del sector encajando encima */
.dg-montaje { display: flex; flex-direction: column; justify-content: space-between; gap: 18px; padding: 26px; border-radius: 22px; background: rgba(255, 255, 255, .03); border: 1px solid rgba(255, 255, 255, .08); min-height: 360px; }
.dg-piezas { position: relative; flex: 1; min-height: 190px; }
.dg-montaje-titulo { margin: 0; font-size: 1.25rem; font-weight: 750; color: #fff; letter-spacing: -.01em; }
.dg-montaje-titulo span { display: none; background: linear-gradient(90deg, var(--violeta-claro), #7dd3fc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.dg-montaje-titulo span.activo { display: inline; }
.dg-grupo-piezas { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: end; gap: 12px; visibility: hidden; }
.dg-grupo-piezas span { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 12px 14px; border-radius: 14px; font-weight: 700; font-size: .98rem; line-height: 1.25; background: linear-gradient(145deg, rgba(167, 139, 250, .22), rgba(124, 58, 237, .10)); border: 1px solid rgba(167, 139, 250, .45); box-shadow: 0 14px 30px -18px rgba(124, 58, 237, .9); opacity: 0; transform: translateY(-38px) scale(.96); }
.dg-grupo-piezas span::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: var(--violeta-claro); box-shadow: 0 0 10px var(--violeta-claro); flex: none; }
.dg-grupo-piezas.activo { visibility: visible; }
.dg-grupo-piezas.activo span { animation: dg-encajar .6s cubic-bezier(.2, .9, .25, 1.15) forwards; animation-delay: calc(var(--i) * .14s + .1s); }
@keyframes dg-encajar { 0% { opacity: 0; transform: translateY(-38px) scale(.96); } 70% { opacity: 1; transform: translateY(3px) scale(1); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
.dg-base { border-radius: 16px; padding: 14px; background: rgba(255, 255, 255, .06); border: 1px dashed rgba(255, 255, 255, .22); }
.dg-base-titulo { display: flex; align-items: center; gap: 8px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: #94a3b8; margin-bottom: 10px; }
.dg-base-piezas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.dg-base-piezas span { display: flex; align-items: center; justify-content: center; text-align: center; line-height: 1.25; padding: 9px 6px; border-radius: 10px; font-size: .84rem; font-weight: 650; color: #e2e8f0; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1); }

/* Pantalla del sector */
/* Todas las fichas en la misma celda: la pantalla mide lo que la más alta (sin cortes en el móvil). */
.dg-pantalla { position: relative; display: grid; grid-template-rows: auto 1fr; border-radius: 18px; overflow: hidden; background: #f8fafc; color: var(--tinta); box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .85), 0 0 0 1px rgba(255, 255, 255, .1); min-height: 360px; }
.dg-pantalla-barra { display: flex; align-items: center; gap: 6px; padding: 10px 14px; background: #e9edf4; border-bottom: 1px solid var(--borde); }
.dg-pantalla-barra i { width: 10px; height: 10px; border-radius: 50%; background: #cbd5e1; }
.dg-pantalla-titulo { margin-left: 8px; font-size: .78rem; font-weight: 700; color: #64748b; }
.dg-ficha { grid-area: 2 / 1; padding: 22px 24px; display: flex; flex-direction: column; gap: 10px; opacity: 0; transform: translateY(14px); pointer-events: none; transition: opacity .45s ease, transform .45s ease; }
.dg-ficha.activo { opacity: 1; transform: none; pointer-events: auto; }
.dg-ficha header { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.dg-ficha-tipo { font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--violeta); }
.dg-estado { position: relative; display: inline-grid; font-size: .76rem; font-weight: 700; }
.dg-estado b { grid-area: 1 / 1; padding: 4px 10px; border-radius: 999px; background: #e0f2fe; color: #0369a1; white-space: nowrap; }
.dg-estado-cambia b:last-child { background: #d1fae5; color: #047857; opacity: 0; }
.dg-ficha.activo .dg-estado-cambia b:first-child { animation: dg-salir .4s ease 2.6s forwards; }
.dg-ficha.activo .dg-estado-cambia b:last-child { animation: dg-entrar .4s ease 2.7s forwards; }
@keyframes dg-salir { to { opacity: 0; transform: scale(.9); } }
@keyframes dg-entrar { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
.dg-ficha h3 { margin: 4px 0 0; font-size: 1.35rem; }
.dg-ficha-sub { margin: 0; color: var(--tinta-suave); font-size: .93rem; }
.dg-alerta { color: #b45309; font-weight: 650; }
.dg-lineas { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 8px; }
.dg-lineas li { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 11px 13px; border-radius: 11px; background: #fff; border: 1px solid var(--borde); font-size: .9rem; opacity: 0; transform: translateX(-10px); }
.dg-lineas li span { color: var(--tinta-suave); }
.dg-lineas li small { margin-left: 6px; font-size: .72rem; font-weight: 700; color: #0284c7; background: #e0f2fe; padding: 2px 6px; border-radius: 6px; }
.dg-lineas li b { white-space: nowrap; }
.dg-ficha.activo .dg-lineas li { animation: dg-linea .45s ease forwards; animation-delay: calc(var(--i) * .22s + .35s); }
@keyframes dg-linea { to { opacity: 1; transform: none; } }
.dg-ok { color: #047857; } .dg-aviso { color: #b45309; }
.dg-ficha footer { margin-top: auto; display: flex; justify-content: space-between; align-items: center; padding-top: 12px; border-top: 1px solid var(--borde); color: var(--tinta-suave); font-size: .9rem; }
.dg-ficha footer b { font-size: 1.2rem; color: var(--tinta); }
.dg-barra-mini { display: block; width: 120px; height: 8px; border-radius: 999px; background: #e2e8f0; overflow: hidden; }
.dg-barra-mini i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--violeta), #38bdf8); }
.dg-ficha.activo .dg-barra-mini i { transition: width 1s ease .8s; width: var(--p); }
.dg-lista-alumnos { display: grid; grid-template-columns: repeat(7, minmax(0, 30px)); gap: 10px; margin: 6px 0 4px; }
.dg-lista-alumnos i { aspect-ratio: 1; border-radius: 50%; background: #e2e8f0; }
.dg-ficha.activo .dg-lista-alumnos i { animation: dg-lista .3s ease forwards; }
.dg-ficha.activo .dg-lista-alumnos i.si { --c: #10b981; } .dg-ficha.activo .dg-lista-alumnos i.no { --c: #f87171; }
.dg-lista-alumnos i:nth-child(1) { animation-delay: .3s !important; } .dg-lista-alumnos i:nth-child(2) { animation-delay: .4s !important; }
.dg-lista-alumnos i:nth-child(3) { animation-delay: .5s !important; } .dg-lista-alumnos i:nth-child(4) { animation-delay: .6s !important; }
.dg-lista-alumnos i:nth-child(5) { animation-delay: .7s !important; } .dg-lista-alumnos i:nth-child(6) { animation-delay: .8s !important; }
.dg-lista-alumnos i:nth-child(7) { animation-delay: .9s !important; } .dg-lista-alumnos i:nth-child(8) { animation-delay: 1s !important; }
.dg-lista-alumnos i:nth-child(9) { animation-delay: 1.1s !important; } .dg-lista-alumnos i:nth-child(10) { animation-delay: 1.2s !important; }
.dg-lista-alumnos i:nth-child(11) { animation-delay: 1.3s !important; } .dg-lista-alumnos i:nth-child(12) { animation-delay: 1.4s !important; }
.dg-lista-alumnos i:nth-child(13) { animation-delay: 1.5s !important; } .dg-lista-alumnos i:nth-child(14) { animation-delay: 1.6s !important; }
@keyframes dg-lista { to { background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 25%, transparent); } }
.dg-firma { margin-top: auto; padding: 12px 14px; border-radius: 12px; background: #fff; border: 1px dashed #cbd5e1; }
.dg-firma span { display: block; font-size: .78rem; font-weight: 700; color: #64748b; margin-bottom: 4px; }
.dg-firma svg { width: 100%; height: 64px; }
.dg-firma path { fill: none; stroke: #1e293b; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.dg-ficha.activo .dg-firma path { animation: dg-firmar 1.8s ease-in-out 1s forwards; }
@keyframes dg-firmar { to { stroke-dashoffset: 0; } }
.dg-progreso { height: 3px; max-width: 360px; margin: 26px auto 0; border-radius: 999px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.dg-progreso i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--violeta-claro), #38bdf8); }
.dg-progreso.corre i { animation: dg-progreso var(--dg-tiempo, 6.5s) linear forwards; }
.dg-progreso.parado { opacity: 0; }
@keyframes dg-progreso { to { width: 100%; } }

/* Texto de la tarjeta oscura de gastos */
.dg-tarjeta-oscura { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; padding: 48px; border-radius: 28px; color: #fff; background: radial-gradient(700px 380px at 100% 100%, rgba(37, 99, 235, .45), transparent 60%), radial-gradient(600px 300px at 0% 0%, rgba(124, 58, 237, .3), transparent 60%), linear-gradient(160deg, #111a33, #0b1022); box-shadow: var(--sombra); overflow: hidden; }
.dg-tarjeta-oscura h2 { color: #fff; margin-top: 18px; }
.dg-tickets-texto > p { color: #cbd5e1; font-size: 1.08rem; max-width: 48ch; }
.dg-insignia { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; font-size: .88rem; font-weight: 700; color: #6ee7b7; border: 1px solid rgba(52, 211, 153, .55); background: rgba(16, 185, 129, .1); box-shadow: 0 0 22px rgba(16, 185, 129, .22); }
.dg-insignia svg { width: 18px; height: 18px; }
.dg-fuentes-lista { list-style: none; padding: 0; margin: 26px 0 30px; display: grid; gap: 18px; }
.dg-fuentes-lista li { display: grid; grid-template-columns: 46px 1fr; gap: 14px; align-items: start; }
.dg-fuentes-lista svg { width: 46px; height: 46px; padding: 11px; border-radius: 12px; color: #e2e8f0; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); }
.dg-fuentes-lista b { display: block; font-size: 1.08rem; }
.dg-fuentes-lista span { color: #94a3b8; }

/* ---------- 3. Del ticket al dossier de la gestoría ----------
   Ciclo de 9 s: foto (0-16 %), se rellena el gasto (16-55 %), el ticket vuela
   al dossier (56-70 %) y el dossier suma uno (70-96 %). */
.dg-flujo-gasto { position: relative; display: grid; grid-template-columns: 1fr 1.05fr; align-items: center; gap: 28px; padding: 10px 0; }
.dg-movil { justify-self: center; width: min(100%, 220px); aspect-ratio: 9 / 18.5; padding: 9px; border-radius: 34px; background: #05070f; box-shadow: 0 0 0 2px #2a3150, 0 30px 60px -20px rgba(0, 0, 0, .9); }
.dg-movil-pantalla { position: relative; width: 100%; height: 100%; border-radius: 26px; overflow: hidden; background: #f8fafc; }
.dg-visor { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, #3b3f52, #15171f 75%); }
.dg-mini-ticket { width: 66%; padding: 12px 10px 14px; background: #fff; color: #1e293b; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .58rem; transform: rotate(-5deg); box-shadow: 0 14px 24px -10px rgba(0, 0, 0, .8); }
.dg-mini-ticket b { display: block; text-align: center; font-size: .6rem; margin-bottom: 6px; }
.dg-mini-ticket p { display: flex; justify-content: space-between; margin: 0; padding: 3px 0; border-top: 1px dashed #cbd5e1; }
.dg-mini-ticket p.t { font-weight: 800; }
.dg-marco { position: absolute; inset: 22% 12%; border-radius: 12px; background:
  linear-gradient(#fff, #fff) top left / 18px 3px, linear-gradient(#fff, #fff) top left / 3px 18px,
  linear-gradient(#fff, #fff) top right / 18px 3px, linear-gradient(#fff, #fff) top right / 3px 18px,
  linear-gradient(#fff, #fff) bottom left / 18px 3px, linear-gradient(#fff, #fff) bottom left / 3px 18px,
  linear-gradient(#fff, #fff) bottom right / 18px 3px, linear-gradient(#fff, #fff) bottom right / 3px 18px; background-repeat: no-repeat; opacity: .85; }
.dg-disparador { position: absolute; bottom: 7%; left: 50%; width: 42px; height: 42px; margin-left: -21px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(255, 255, 255, .35); }
.dg-destello { position: absolute; inset: 0; background: #fff; opacity: 0; }
.dg-formulario-gasto { position: absolute; inset: 0; padding: 22px 12px 12px; display: flex; flex-direction: column; gap: 8px; background: #f8fafc; color: var(--tinta); opacity: 0; }
.dg-fg-titulo { font-size: .9rem; }
.dg-fg-foto { display: flex; align-items: center; gap: 8px; font-size: .7rem; font-weight: 650; color: #047857; padding: 6px; border-radius: 10px; background: #ecfdf5; border: 1px solid #a7f3d0; }
.dg-fg-foto span { width: 26px; height: 32px; border-radius: 4px; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transform: rotate(-5deg); background-image: repeating-linear-gradient(180deg, transparent 0 5px, #cbd5e1 5px 6px); }
.dg-fg-campo { padding: 6px 8px; border-radius: 10px; background: #fff; border: 1px solid var(--borde); opacity: 0; transform: translateY(6px); }
.dg-fg-campo small { display: block; font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; }
.dg-fg-campo b { font-size: .8rem; }
.dg-fg-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.dg-fg-chips i { font-style: normal; font-size: .64rem; font-weight: 650; padding: 2px 6px; border-radius: 999px; background: #f1f5f9; color: #64748b; }
.dg-fg-chips i.si { background: var(--violeta); color: #fff; }
.dg-fg-guardar { margin-top: auto; text-align: center; font-size: .8rem; font-weight: 700; color: #fff; padding: 8px; border-radius: 10px; background: linear-gradient(135deg, #10b981, #059669); }
.dg-volando { position: absolute; z-index: 3; left: 24%; top: 46%; width: 34px; height: 44px; border-radius: 5px; background: #fff; box-shadow: 0 8px 18px rgba(0, 0, 0, .5); background-image: repeating-linear-gradient(180deg, transparent 0 7px, #cbd5e1 7px 8px); opacity: 0; }
.dg-dossier { position: relative; justify-self: center; width: min(100%, 250px); }
.dg-dossier-pestana { width: 44%; height: 18px; border-radius: 10px 10px 0 0; background: #fbbf24; }
.dg-dossier-cuerpo { padding: 16px; border-radius: 0 16px 16px 16px; background: linear-gradient(160deg, #fcd34d, #f59e0b); color: #422006; box-shadow: 0 26px 50px -22px rgba(0, 0, 0, .9); display: flex; flex-direction: column; gap: 6px; }
.dg-dossier-cuerpo > small { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; opacity: .75; }
.dg-dossier-cuerpo > b { font-size: 1.08rem; }
.dg-dossier-pila { position: relative; height: 54px; margin: 4px 0 6px; }
.dg-dossier-pila i { position: absolute; bottom: 0; width: 34px; height: 44px; border-radius: 5px; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .25); background-image: repeating-linear-gradient(180deg, transparent 0 7px, #e2e8f0 7px 8px); }
.dg-dossier-pila i:nth-child(1) { left: 0; transform: rotate(-8deg); } .dg-dossier-pila i:nth-child(2) { left: 26px; transform: rotate(3deg); }
.dg-dossier-pila i:nth-child(3) { left: 52px; transform: rotate(-4deg); } .dg-dossier-pila i.nuevo { left: 78px; transform: rotate(6deg); opacity: 0; }
.dg-dossier-cuerpo p { display: flex; justify-content: space-between; margin: 0; padding: 6px 10px; border-radius: 9px; background: rgba(255, 255, 255, .45); font-size: .86rem; }
.dg-cambia { display: grid; }
.dg-cambia i { grid-area: 1 / 1; font-style: normal; text-align: right; }
.dg-cambia i:last-child { opacity: 0; }
.dg-dossier-envio { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: .76rem; font-weight: 750; color: #fff; padding: 7px 10px; border-radius: 10px; background: rgba(66, 32, 6, .78); }
.dg-dossier-envio svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.dg-flujo-gasto.visible .dg-destello { animation: dg-g-destello 9s linear infinite; }
.dg-flujo-gasto.visible .dg-disparador { animation: dg-g-disparar 9s linear infinite; }
.dg-flujo-gasto.visible .dg-formulario-gasto { animation: dg-g-form 9s linear infinite; }
.dg-flujo-gasto.visible .f1 { animation: dg-g-f1 9s ease infinite; }
.dg-flujo-gasto.visible .f2 { animation: dg-g-f2 9s ease infinite; }
.dg-flujo-gasto.visible .f3 { animation: dg-g-f3 9s ease infinite; }
.dg-flujo-gasto.visible .dg-fg-guardar { animation: dg-g-guardar 9s ease infinite; }
.dg-flujo-gasto.visible .dg-volando { animation: dg-g-vuela 9s cubic-bezier(.45, 0, .2, 1) infinite; }
.dg-flujo-gasto.visible .dg-dossier-pila i.nuevo { animation: dg-g-nuevo 9s ease infinite; }
.dg-flujo-gasto.visible .dg-cambia i:first-child { animation: dg-g-antes 9s linear infinite; }
.dg-flujo-gasto.visible .dg-cambia i:last-child { animation: dg-g-despues 9s linear infinite; }
.dg-flujo-gasto.visible .dg-dossier-cuerpo { animation: dg-g-dossier 9s ease infinite; }
@keyframes dg-g-destello { 0%, 12% { opacity: 0; } 13% { opacity: .95; } 17%, 100% { opacity: 0; } }
@keyframes dg-g-disparar { 0%, 11% { transform: scale(1); } 12.5% { transform: scale(.82); } 14%, 100% { transform: scale(1); } }
@keyframes dg-g-form { 0%, 15% { opacity: 0; } 17%, 94% { opacity: 1; } 99%, 100% { opacity: 0; } }
@keyframes dg-g-f1 { 0%, 22% { opacity: 0; transform: translateY(6px); } 25%, 94% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes dg-g-f2 { 0%, 30% { opacity: 0; transform: translateY(6px); } 33%, 94% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes dg-g-f3 { 0%, 38% { opacity: 0; transform: translateY(6px); } 41%, 94% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes dg-g-guardar { 0%, 48% { transform: none; filter: none; } 50% { transform: scale(.94); filter: brightness(1.2); } 53%, 100% { transform: none; filter: none; } }
@keyframes dg-g-vuela { 0%, 54% { opacity: 0; left: 24%; top: 46%; transform: rotate(0) scale(.8); } 56% { opacity: 1; left: 24%; top: 46%; transform: rotate(-6deg) scale(1); } 69% { opacity: 1; left: 72%; top: 36%; transform: rotate(8deg) scale(.95); } 70%, 100% { opacity: 0; left: 72%; top: 36%; } }
@keyframes dg-g-nuevo { 0%, 69% { opacity: 0; transform: translateY(-10px) rotate(6deg); } 72%, 95% { opacity: 1; transform: rotate(6deg); } 100% { opacity: 0; } }
@keyframes dg-g-antes { 0%, 70% { opacity: 1; } 71%, 97% { opacity: 0; } 100% { opacity: 1; } }
@keyframes dg-g-despues { 0%, 70% { opacity: 0; } 71%, 97% { opacity: 1; } 100% { opacity: 0; } }
@keyframes dg-g-dossier { 0%, 69% { transform: none; } 72% { transform: scale(1.04); } 76%, 100% { transform: none; } }

/* ---------- Móvil y tablet ---------- */
@media (max-width: 980px) {
  .dg-dos, .dg-lienzo, .dg-tarjeta-oscura { grid-template-columns: 1fr; }
  .dg-dos { gap: 36px; }
  .dg-tarjeta-oscura { padding: 34px 26px; }
  .dg-montaje { min-height: 0; }
  .dg-piezas { min-height: 160px; }
}
@media (max-width: 600px) {
  .dg-pestanas { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; margin-inline: -16px; padding: 4px 16px 10px; scrollbar-width: none; }
  .dg-pestanas::-webkit-scrollbar { display: none; }
  .dg-pestana { flex: none; }
  .dg-ruta { padding: 14px 10px 6px; }
  .dg-parada { max-width: 37%; padding: 6px 7px; gap: 6px; }
  .dg-parada.p1, .dg-parada.p3, .dg-parada.p5 { right: calc(100% - var(--x) + 6%); }
  .dg-parada.p2, .dg-parada.p4 { left: calc(var(--x) + 6%); }
  .dg-parada > svg { width: 24px; height: 24px; padding: 4px; }
  .dg-parada b { font-size: .8rem; }
  .dg-parada { max-width: 31%; }
  .dg-parada small { display: none; }
  .dg-fg-chips i:nth-child(3) { display: none; }
  .dg-fg-chips i { font-size: .58rem; }
  .dg-formulario-gasto { padding: 16px 9px 9px; gap: 6px; }
  .dg-fg-titulo { font-size: .8rem; }
  .dg-fg-foto { font-size: .62rem; padding: 4px; }
  .dg-fg-foto span { width: 18px; height: 24px; }
  .dg-fg-campo { padding: 4px 7px; }
  .dg-fg-campo b { font-size: .72rem; }
  .dg-fg-guardar { padding: 6px; font-size: .72rem; }
  .dg-suma { font-size: .7rem; }
  .dg-grupo-piezas span { min-height: 54px; font-size: .84rem; padding: 10px; gap: 8px; hyphens: auto; }
  .dg-montaje { padding: 16px; }
  .dg-base-piezas { grid-template-columns: 1fr 1fr; }
  .dg-ficha { padding: 18px; }
  .dg-tarjeta-oscura { padding: 28px 18px; border-radius: 22px; }
  .dg-flujo-gasto { gap: 14px; }
  .dg-dossier-cuerpo { padding: 12px; }
  .dg-dossier-cuerpo > b { font-size: .95rem; }
  .dg-dossier-cuerpo p { font-size: .76rem; padding: 5px 7px; }
  .dg-dossier-envio { font-size: .68rem; }
  .dg-dossier-pila i { width: 26px; height: 34px; }
  .dg-dossier-pila i:nth-child(2) { left: 18px; } .dg-dossier-pila i:nth-child(3) { left: 36px; } .dg-dossier-pila i.nuevo { left: 54px; }
}

/* Sin animaciones si el sistema lo pide: se ve el final de cada historia, quieto. */
@media (prefers-reduced-motion: reduce) {
  .dg-ruta *, .dg-sectores *, .dg-flujo-gasto * { animation: none !important; transition: none !important; }
  .dg-ruta-punto { display: none; }
  .dg-ruta-traza { stroke-dashoffset: 0; }
  .dg-suma { opacity: 1 !important; transform: none !important; }
  .dg-ruta-estado i { opacity: 0 !important; } .dg-ruta-estado i:nth-child(3) { opacity: 1 !important; }
  .dg-parada > svg { color: var(--violeta); background: #f1ebff; }
  .dg-lineas li, .dg-grupo-piezas.activo span { opacity: 1 !important; transform: none !important; }
  .dg-estado-cambia b:first-child { opacity: 0; } .dg-estado-cambia b:last-child { opacity: 1; }
  .dg-firma path { stroke-dashoffset: 0; }
  .dg-barra-mini i { width: var(--p); }
  .dg-lista-alumnos i.si { background: #10b981; } .dg-lista-alumnos i.no { background: #f87171; }
  .dg-progreso { display: none; }
  .dg-visor { display: none; }
  .dg-formulario-gasto, .dg-fg-campo, .dg-dossier-pila i.nuevo { opacity: 1 !important; transform: none !important; }
  .dg-cambia i:first-child { opacity: 0; } .dg-cambia i:last-child { opacity: 1; }
}
