/* Movimiento compartido del CRM y del panel del trader (03/11). Ver movimiento.js. Va después de la hoja de cada
   página. Todo lo que se repite usa transform u opacity (no repinta lo de adelante) y se apaga con «reducir movimiento». */

/* ── la aurora: cuatro luces que se mueven despacio detrás de todo ── */
/* z -1 y primera en el body: queda arriba del fondo base (body::before) y abajo de todo el contenido, en las dos páginas */
.mov-aurora { position: fixed; inset: -10vmax; z-index: -1; pointer-events: none; overflow: hidden; }
.mov-aurora i { position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%; filter: blur(60px); opacity: .55; will-change: transform; }
.mov-aurora .indigo { left: 12%; top: 0; background: radial-gradient(circle, rgb(var(--marca-azul-66) / .55), transparent 65%); animation: mov-deriva-1 38s ease-in-out infinite alternate; }
.mov-aurora .violeta { right: 6%; top: 6%; background: radial-gradient(circle, rgb(var(--marca-violeta-70) / .5), transparent 65%); animation: mov-deriva-2 46s ease-in-out infinite alternate; }
.mov-aurora .cian { right: 0; bottom: 4%; width: 34vmax; height: 34vmax; background: radial-gradient(circle, rgb(var(--marca-cian-71) / .26), transparent 65%); animation: mov-deriva-3 52s ease-in-out infinite alternate; }
.mov-aurora .orquidea { left: 0; bottom: 0; width: 38vmax; height: 38vmax; background: radial-gradient(circle, rgb(var(--marca-magenta-59) / .26), transparent 65%); animation: mov-deriva-4 60s ease-in-out infinite alternate; }
.mov-aurora.en-pausa i { animation-play-state: paused; }
@keyframes mov-deriva-1 { to { transform: translate(18vmax, 10vmax) scale(1.15); } }
@keyframes mov-deriva-2 { to { transform: translate(-16vmax, 14vmax) scale(.9); } }
@keyframes mov-deriva-3 { to { transform: translate(-20vmax, -12vmax) scale(1.2); } }
@keyframes mov-deriva-4 { to { transform: translate(14vmax, -16vmax) scale(1.1); } }

/* ── al entrar a una sección: las piezas llegan de a una, con un poco de profundidad ── */
.mov-entra .mov-pieza { animation: mov-llega .6s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--mov-i, 0) * 55ms); }
@keyframes mov-llega { from { opacity: 0; transform: translateY(18px) scale(.97) rotateX(8deg); } }

/* ── lo que aparece al bajar ── */
.mov-revela { opacity: 0; transform: translateY(26px); transition: opacity .7s cubic-bezier(.2, .8, .2, 1), transform .7s cubic-bezier(.2, .8, .2, 1); }
.mov-revela.mov-visto { opacity: 1; transform: none; }

/* ── el borde de luz: un hilo que recorre el contorno (conic + máscara: sólo se ve el borde) ── */
@property --mov-giro { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.mov-borde { position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: inherit; padding: 1px;
  background: conic-gradient(from var(--mov-giro), transparent 0deg, transparent 250deg, rgb(var(--marca-cian-71) / .0) 270deg, rgb(var(--marca-cian-71) / .75) 320deg, rgb(var(--marca-violeta-70) / .6) 345deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0; transition: opacity .4s; }
/* medido: 15 bordes girando sin parar bajaban el Resumen de 60 a 21 cuadros por segundo (el degradé se repinta en cada
   cuadro). Ahora dan una vuelta al entrar a la sección y giran mientras el mouse está encima */
.mov-entra .mov-borde { opacity: .8; animation: mov-gira 1.6s cubic-bezier(.4, 0, .2, 1) both .2s; }
@keyframes mov-gira { to { --mov-giro: 360deg; } }
*:hover > .mov-borde { opacity: 1; animation: mov-gira 3s linear infinite; }

/* ── el menú: la píldora que se desliza ── */
.mov-pildora { position: absolute; left: 0; top: 0; z-index: 0; pointer-events: none; border-radius: 10px; opacity: 0;
  background: linear-gradient(90deg, rgb(var(--marca-azul-66) / .26), rgb(var(--marca-violeta-70) / .14)); box-shadow: inset 0 0 0 1px rgb(var(--marca-azul-75) / .3), 0 6px 18px -8px rgb(var(--marca-azul-66) / .7);
  transition: transform .45s cubic-bezier(.2, .9, .2, 1.05), width .45s cubic-bezier(.2, .9, .2, 1), height .45s cubic-bezier(.2, .9, .2, 1), opacity .3s; }

/* ── los contadores rebotan ── */
.mov-rebota { animation: mov-rebota .6s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes mov-rebota { 0% { transform: scale(1); } 35% { transform: scale(1.45); } 100% { transform: scale(1); } }

/* ── la onda al apretar ── */
.mov-con-onda { overflow: hidden; isolation: isolate; }
.mov-onda { position: absolute; z-index: -1; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, rgba(255, 255, 255, .35), rgb(var(--marca-cian-71) / .12) 45%, transparent 70%);
  transform: scale(0); animation: mov-onda .6s cubic-bezier(.2, .7, .2, 1) forwards; }
@keyframes mov-onda { to { transform: scale(1); opacity: 0; } }

/* ── el imán de los botones principales ── */
.mov-iman { transition: transform .25s cubic-bezier(.2, .8, .2, 1); transform: translate(var(--mov-x, 0), var(--mov-y, 0)); }

@media (prefers-reduced-motion: reduce) {
  .mov-aurora i, .mov-entra .mov-pieza, .mov-borde, .mov-rebota, .mov-onda { animation: none !important; }
  .mov-revela { opacity: 1; transform: none; transition: none; }
  .mov-pildora, .mov-iman { transition: none; }
  .mov-iman { transform: none; }
  .mov-borde, .mov-onda { display: none; }
}

/* ══ El riel (03/11, referencia del equipo: «Glassy Dashboard V5», «así me gusta más»): el menú es una píldora fina de
   vidrio que flota al costado, centrada en el alto, con cada sección como un botón redondo. La activa es un círculo
   lleno y luminoso; el nombre sale en una etiqueta al lado (la activa siempre, las demás al pasar). En el celular, nada
   cambia: el CRM sigue con su menú que se abre y el panel con su barra de abajo. ══ */

.riel-etiqueta { position: fixed; z-index: 60; pointer-events: none; padding: 6px 12px; border-radius: 999px; font: 600 12px var(--sans, system-ui); color: rgb(var(--marca-fondo-9)); white-space: nowrap;
  background: linear-gradient(110deg, rgb(var(--marca-azul-95-100)), rgb(var(--marca-azul-88))); box-shadow: 0 10px 24px -10px rgb(var(--marca-azul-72) / .8); opacity: 0; transform: translateX(-8px) scale(.96); transition: opacity .2s, transform .3s cubic-bezier(.2, .9, .2, 1.15); }
.riel-etiqueta.visible { opacity: 1; transform: none; }
.riel-etiqueta.activa { background: linear-gradient(110deg, rgb(var(--marca-cian-71)), rgb(var(--marca-azul-80))); }
.riel-etiqueta::before { content: ""; position: absolute; left: -4px; top: calc(50% - 4px); width: 8px; height: 8px; transform: rotate(45deg); background: inherit; border-radius: 2px; }

/* el botón redondo de cada sección, en las dos páginas */
body.con-riel .riel-boton { width: 40px; height: 40px; padding: 0 !important; display: grid !important; place-items: center; border-radius: 50% !important; position: relative; z-index: 1;
  color: var(--tenue); background: rgba(255, 255, 255, .04); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); transition: background .25s, color .25s, transform .25s cubic-bezier(.2, .9, .2, 1.2), box-shadow .25s; }
body.con-riel .riel-boton:hover { color: var(--texto); background: rgba(255, 255, 255, .1); transform: scale(1.08); }
/* el círculo lleno es la píldora que se desliza (movimiento.js): el botón activo sólo cambia el color del ícono */
body.con-riel .riel-boton.riel-activo { color: rgb(var(--marca-fondo-9)); background: transparent; box-shadow: none; }
body.con-riel .mov-pildora { border-radius: 50%; background: linear-gradient(140deg, #ffffff, rgb(var(--marca-azul-88))); box-shadow: 0 0 0 4px rgb(var(--marca-azul-75) / .18), 0 8px 22px -6px rgb(var(--marca-azul-80) / .9); transition: transform .5s cubic-bezier(.3, 1.3, .4, 1), opacity .3s; }
body.con-riel .riel-boton.riel-activo svg { stroke: rgb(var(--marca-fondo-9)) !important; color: rgb(var(--marca-fondo-9)) !important; }
body.con-riel .riel-boton svg { width: 18px !important; height: 18px !important; }

/* ── CRM (firma.html): la barra fija de 256 px pasa a la píldora ── */
@media (min-width: 901px) {
  body.con-riel { --ancho-lateral: 96px; }
  body.con-riel .lateral { inset: 50% auto auto 20px; transform: translateY(-50%); width: 56px; max-height: calc(100vh - 40px); padding: 8px; gap: 6px; align-items: center; border-radius: 999px; overflow: hidden auto; scrollbar-width: none;
    background: linear-gradient(180deg, rgb(var(--marca-fondo-22-58) / .6), rgb(var(--marca-fondo-10-62) / .7)); -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12), inset 0 1px 0 rgba(255, 255, 255, .18), 0 24px 60px -24px rgba(0, 0, 0, .85); }
  body.con-riel .lateral::-webkit-scrollbar { display: none; }
  body.con-riel .lateral .item > span, body.con-riel .lateral .firma .rol, body.con-riel .lateral #nombreFirma, body.con-riel .lateral .pie { display: none; }
  /* el logo: un círculo arriba de todo, sólo la gema */
  body.con-riel .lateral .firma { width: 40px; height: 40px; min-height: 0; padding: 0; margin: 0 0 4px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; flex: none; background: rgba(255, 255, 255, .06); }
  body.con-riel .lateral .firma img, body.con-riel .lateral .firma svg { max-width: 26px; max-height: 26px; }
  /* sólo se esconde la palabra: la gema (logoDe) vive adentro de .marca-cuerpo, que tiene que quedar */
  body.con-riel .lateral .firma .palabra { display: none; }
  body.con-riel .lateral .firma .marca-cuerpo { display: grid; place-items: center; }
  /* los títulos de grupo son separadores finos */
  body.con-riel .lateral .grupo { width: 20px; height: 1px; padding: 0; margin: 4px 0; font-size: 0; background: rgb(var(--marca-azul-75) / .3); flex: none; }
  /* el contador, un puntito sobre el ícono */
  body.con-riel .lateral .item .cuenta-n { position: absolute; right: -3px; top: -3px; min-width: 16px; height: 16px; padding: 0 4px; font-size: 9.5px; line-height: 16px; margin: 0; }
  body.con-riel .lateral .item.activo::before { display: none; }
  body.con-riel .lateral .item { flex: none; }

  /* al pasar el mouse (o con el foco del teclado) la píldora se ensancha y cada ícono muestra su sección al lado
     (pedido del equipo, 03/11). Los íconos no se mueven: van pegados a la izquierda, que a 56 px es lo mismo que centrados,
     así la píldora del activo no tiene que reubicarse. Se ensancha encima del contenido, sin empujarlo. */
  body.con-riel .lateral { align-items: flex-start; transition: width .35s cubic-bezier(.2, .9, .2, 1.05), box-shadow .35s; }
  body.con-riel .lateral .item > span { display: block; position: absolute; left: 52px; top: 50%; transform: translate(-6px, -50%); white-space: nowrap;
    font: 600 13.5px var(--sans, system-ui); letter-spacing: -.005em; color: var(--tenue); opacity: 0; transition: opacity .2s, transform .3s cubic-bezier(.2, .9, .2, 1.1), color .2s; }
  body.con-riel .lateral:is(:hover, :focus-within) { width: 228px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14), inset 0 1px 0 rgba(255, 255, 255, .2), 0 30px 70px -20px rgba(0, 0, 0, .9), 0 0 40px -12px rgb(var(--marca-azul-66) / .55); }
  body.con-riel .lateral:is(:hover, :focus-within) .item > span { opacity: 1; transform: translate(0, -50%); transition-delay: .08s; }
  body.con-riel .lateral .item:is(:hover, :focus-visible) > span { color: var(--texto); }
  body.con-riel .lateral .item.riel-activo > span { color: #fff; }
  /* con el nombre al lado, el globito suelto sobra; el botón no crece para que el texto no tiemble */
  body.con-riel:has(.lateral:is(:hover, :focus-within)) .riel-etiqueta { display: none; }
  body.con-riel .lateral .item.riel-boton:hover { transform: none; }
  /* los separadores acompañan el ancho */
  body.con-riel .lateral:is(:hover, :focus-within) .grupo { width: calc(100% - 24px); margin-left: 10px; }
  body.con-riel .lateral .grupo { transition: width .35s cubic-bezier(.2, .9, .2, 1.05), margin .35s; margin-left: 10px; }
}

/* ── Panel del trader (panel.html): el menú de 216 pasa a la píldora ── */
@media (min-width: 861px) {
  body.con-riel .app-panel { grid-template-columns: 56px minmax(0, 1fr); gap: 28px; }
  body.con-riel .menu-panel { position: sticky; top: calc(50vh - 150px); z-index: 25; width: 56px; padding: 8px; gap: 6px; justify-items: center; border-radius: 999px;
    background: linear-gradient(180deg, rgb(var(--marca-fondo-22-58) / .6), rgb(var(--marca-fondo-10-62) / .7)); -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12), inset 0 1px 0 rgba(255, 255, 255, .18), 0 24px 60px -24px rgba(0, 0, 0, .85); }
  body.con-riel .menu-panel a .largo, body.con-riel .menu-panel a .corto { display: none; }
  /* «Nueva cuenta»: el + en un círculo con el degradé de la marca */
  body.con-riel .menu-panel a.cta-menu { margin-top: 6px; background: var(--pr-cristal); color: #fff; box-shadow: 0 8px 20px -6px rgb(var(--marca-azul-66) / .9); }
  body.con-riel .menu-panel a.cta-menu svg { stroke: #fff; color: #fff; }
}

@media (prefers-reduced-motion: reduce) {
  .riel-boton, .riel-etiqueta { transition: none; }
  .riel-boton:hover { transform: none; }
}

/* ── la franja «En vivo» (CRM y panel): lo último que pasó, pasando de derecha a izquierda; se frena con el mouse ── */
.wow-franja { display: flex; align-items: center; gap: 14px; margin: 0 0 14px; padding: 8px 8px 8px 14px; border-radius: 14px; overflow: hidden;
  background: linear-gradient(90deg, rgb(var(--marca-fondo-22-58) / .55), rgb(var(--marca-fondo-10-62) / .45)); box-shadow: inset 0 0 0 1px rgb(var(--marca-azul-75) / .18); }
.wow-en-vivo { flex: none; display: inline-flex; align-items: center; gap: 8px; font: 700 10.5px var(--titulo, system-ui); letter-spacing: .16em; text-transform: uppercase; color: #ff9aaa; }
.wow-en-vivo i { position: relative; width: 8px; height: 8px; border-radius: 50%; background: #ff6b81; }
.wow-en-vivo i::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: rgba(255, 107, 129, .7); animation: wow-vivo 1.6s ease-out infinite; }
@keyframes wow-vivo { to { transform: scale(3.2); opacity: 0; } }
.wow-pista { flex: 1; min-width: 0; overflow: hidden; -webkit-mask: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); mask: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.wow-cinta { display: flex; gap: 10px; width: max-content; animation: wow-cinta 40s linear infinite; }
.wow-franja:hover .wow-cinta { animation-play-state: paused; }
@keyframes wow-cinta { to { transform: translateX(-50%); } }
.wow-suceso { display: inline-flex; align-items: baseline; gap: 8px; padding: 5px 12px; border-radius: 999px; white-space: nowrap; font-size: 12.5px; font-variant-numeric: tabular-nums; background: rgba(255, 255, 255, .05); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07); }
.wow-suceso b { font-weight: 600; color: var(--texto); }
.wow-suceso small { color: var(--apagado); font-size: 11px; }
.wow-suceso::before { content: ""; align-self: center; width: 7px; height: 7px; border-radius: 50%; background: var(--cr-claro, rgb(var(--marca-azul-80))); }
.wow-suceso[data-tipo="venta"]::before { background: #3ddc97; box-shadow: 0 0 8px #3ddc97; }
.wow-suceso[data-tipo="pago"]::before { background: #ffc940; box-shadow: 0 0 8px #ffc940; }
.wow-suceso[data-tipo="retiro"]::before { background: #ffc940; }
.wow-suceso[data-tipo="alta"]::before { background: rgb(var(--marca-cian-71)); box-shadow: 0 0 8px rgb(var(--marca-cian-71)); }
.wow-suceso[data-tipo="riesgo"]::before { background: #ff6b81; box-shadow: 0 0 8px #ff6b81; }
@media (max-width: 640px) { .wow-franja { gap: 10px; padding-left: 10px; } .wow-en-vivo { font-size: 9.5px; } }
@media (prefers-reduced-motion: reduce) { .wow-cinta, .wow-en-vivo i, .wow-en-vivo i::after { animation: none; } .wow-pista { overflow-x: auto; } }

/* el panel del trader: la franja arriba del tablero */
.wow-franja-trader { margin: 0 0 16px; }
.wow-suceso[data-tipo="noticia"]::before { background: #ffc940; box-shadow: 0 0 8px #ffc940; }
.wow-suceso[data-tipo="sube"]::before { background: #3ddc97; box-shadow: 0 0 8px #3ddc97; }
.wow-suceso[data-tipo="baja"]::before { background: #ff6b81; box-shadow: 0 0 8px #ff6b81; }

/* ── el panel del trader: la curva del saldo se traza sola, las barras se llenan y el drawdown late si queda poco ── */
.mov-entra svg.curva :is(path, polyline) { stroke-dasharray: 4000; animation: mov-traza 1.6s cubic-bezier(.3, .7, .2, 1) both .25s; }
@keyframes mov-traza { from { stroke-dashoffset: 4000; } to { stroke-dashoffset: 0; } }
.mov-entra .pista > i { animation: mov-llena 1s cubic-bezier(.2, .8, .2, 1) both .3s; transform-origin: left; }
@keyframes mov-llena { from { transform: scaleX(0); } }
.pista.wow-poco-margen > i { animation: mov-poco 1.4s ease-in-out infinite; }
@keyframes mov-poco { 50% { filter: brightness(1.5); box-shadow: 0 0 14px rgba(255, 107, 129, .8); } }
@media (prefers-reduced-motion: reduce) { .mov-entra svg.curva :is(path, polyline), .mov-entra .pista > i, .pista.wow-poco-margen > i { animation: none; } }

/* ── el modo liviano (movimiento.js lo pone si la compu no llega a 40 cuadros por segundo): la aurora queda quieta y
   la luz del mouse se apaga; el resto de las animaciones sigue ── */
.mov-liviano .mov-aurora i { animation-play-state: paused; }
.mov-liviano .wow-luz { display: none; }
