/* ============================================================
   loader.css — MASTRO NEOBRUTALIST LOGO LOADER
   Animated orbit + breathing logo + particles
   ============================================================ */

:root {
  --ink: #0d0d0d;
  --paper: #fafafa;
  --cream: #fffdf7;
  --yellow: #fef9c3;
  --muted: #78716c;
  --stone: #e5e7eb;
  --success: #16a34a;
  --error: #dc2626;
}

/* ========== WRAPPER ========== */
.jarvis-loader-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 200px;
  font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
  box-sizing: border-box;
}

.jarvis-loader-wrapper.overlay {
  position: absolute;
  inset: 0;
  z-index: 9999;
  background: rgba(245, 240, 232, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 0;
}

/* ========== LOGO CONTAINER ========== */
.optlyx-loader-container {
  position: relative;
  width: 168px;
  height: 168px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===================================================================
   CONIC GRADIENT RING — Dual-layer spinning arc
   =================================================================== */
.optlyx-loader-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: 2.5px;
  background: conic-gradient(
    from var(--ring-angle, 0deg),
    transparent 0deg,
    var(--ink) 30deg,
    var(--muted) 90deg,
    var(--stone) 150deg,
    var(--yellow) 200deg,
    transparent 240deg
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2.5px));
  animation: ringSpin 1.6s linear infinite;
}

/* Secondary ring — counter-rotating */
.optlyx-loader-ring::before {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  padding: 1.5px;
  background: conic-gradient(
    from 180deg,
    transparent 0deg,
    rgba(13, 13, 13, 0.3) 40deg,
    rgba(120, 113, 108, 0.15) 80deg,
    transparent 120deg
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 calc(100% - 1.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 calc(100% - 1.5px));
  animation: ringSpinReverse 2.4s linear infinite;
}

/* Glow halo */
.optlyx-loader-ring::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    rgba(13, 13, 13, 0.08),
    rgba(120, 113, 108, 0.06),
    rgba(231, 224, 211, 0.06),
    transparent,
    rgba(13, 13, 13, 0.08)
  );
  filter: blur(10px);
  animation: ringSpin 3s linear infinite;
  z-index: -1;
}

@keyframes ringSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes ringSpinReverse {
  to {
    transform: rotate(-360deg);
  }
}

/* ===================================================================
   LOGO — Center, breathing
   =================================================================== */
.optlyx-loader-logo {
  position: relative;
  width: 92px;
  height: 92px;
  z-index: 2;
  animation: logoBreathe 2.4s ease-in-out infinite;
  filter: drop-shadow(2px 2px 0 var(--ink));
}

.optlyx-loader-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@keyframes logoBreathe {
  0%,
  100% {
    transform: scale(1);
    filter: drop-shadow(2px 2px 0 var(--ink));
  }

  50% {
    transform: scale(1.1);
    filter: drop-shadow(4px 4px 0 var(--ink));
  }
}

/* Shimmer sweep */
.optlyx-loader-logo::after {
  content: '';
  position: absolute;
  inset: -6px;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 253, 247, 0.55) 50%, transparent 65%);
  animation: shimmerSweep 2.4s ease-in-out infinite;
  border-radius: 0;
  pointer-events: none;
}

@keyframes shimmerSweep {
  0% {
    transform: translateX(-150%);
  }

  45% {
    transform: translateX(150%);
  }

  100% {
    transform: translateX(150%);
  }
}

/* ===================================================================
   FLOATING PARTICLES — 3 orbit layers at different depths
   =================================================================== */
.optlyx-loader-particles {
  position: absolute;
  border-radius: 50%;
}

.optlyx-loader-particles span {
  position: absolute;
  border-radius: 0;
}

/* ---- INNER ORBIT (4 dots, 90 apart) ---- */
.orbit-inner {
  inset: 6px;
  animation: ringSpin 4s linear infinite;
}

.orbit-inner span {
  width: 3px;
  height: 3px;
  animation: particlePulse 1.8s ease-in-out infinite;
}

/*  0 */
.orbit-inner span:nth-child(1) {
  top: 0%;
  left: calc(50% - 1.5px);
  background: var(--ink);
  animation-delay: 0s;
}

/* 90 */
.orbit-inner span:nth-child(2) {
  top: calc(50% - 1.5px);
  right: 0%;
  background: var(--muted);
  animation-delay: 0.45s;
}

/*180 */
.orbit-inner span:nth-child(3) {
  bottom: 0%;
  left: calc(50% - 1.5px);
  background: var(--stone);
  animation-delay: 0.9s;
}

/*270 */
.orbit-inner span:nth-child(4) {
  top: calc(50% - 1.5px);
  left: 0%;
  background: var(--ink);
  animation-delay: 1.35s;
}

/* ---- MID ORBIT (6 dots, 60 apart) ---- */
.orbit-mid {
  inset: -10px;
  animation: ringSpinReverse 6s linear infinite;
}

.orbit-mid span {
  width: 4.5px;
  height: 4.5px;
  animation: particlePulse 2.2s ease-in-out infinite;
}

/*  0 */
.orbit-mid span:nth-child(1) {
  top: 0%;
  left: calc(50% - 2.25px);
  background: var(--ink);
  animation-delay: 0s;
}

/* 60 */
.orbit-mid span:nth-child(2) {
  top: 25%;
  left: calc(93.3% - 2.25px);
  background: var(--muted);
  animation-delay: 0.36s;
}

/*120 */
.orbit-mid span:nth-child(3) {
  top: 75%;
  left: calc(93.3% - 2.25px);
  background: var(--stone);
  animation-delay: 0.72s;
}

/*180 */
.orbit-mid span:nth-child(4) {
  bottom: 0%;
  left: calc(50% - 2.25px);
  background: var(--yellow);
  animation-delay: 1.08s;
}

/*240 */
.orbit-mid span:nth-child(5) {
  top: 75%;
  left: calc(6.7% - 2.25px);
  background: var(--ink);
  animation-delay: 1.44s;
}

/*300 */
.orbit-mid span:nth-child(6) {
  top: 25%;
  left: calc(6.7% - 2.25px);
  background: var(--muted);
  animation-delay: 1.8s;
}

/* ---- OUTER ORBIT (8 dots, 45 apart) ---- */
.orbit-outer {
  inset: -28px;
  animation: ringSpin 10s linear infinite;
}

.orbit-outer span {
  width: 3.5px;
  height: 3.5px;
  opacity: 0.5;
  animation: particlePulseOuter 3s ease-in-out infinite;
}

/*  0  */
.orbit-outer span:nth-child(1) {
  top: 0%;
  left: calc(50% - 1.75px);
  background: var(--stone);
  animation-delay: 0s;
}

/* 45  */
.orbit-outer span:nth-child(2) {
  top: 14.6%;
  left: calc(85.4% - 1.75px);
  background: var(--muted);
  animation-delay: 0.38s;
}

/* 90  */
.orbit-outer span:nth-child(3) {
  top: calc(50% - 1.75px);
  right: 0%;
  background: var(--ink);
  animation-delay: 0.75s;
}

/*135  */
.orbit-outer span:nth-child(4) {
  top: 85.4%;
  left: calc(85.4% - 1.75px);
  background: var(--stone);
  animation-delay: 1.12s;
}

/*180  */
.orbit-outer span:nth-child(5) {
  bottom: 0%;
  left: calc(50% - 1.75px);
  background: var(--yellow);
  animation-delay: 1.5s;
}

/*225  */
.orbit-outer span:nth-child(6) {
  top: 85.4%;
  left: calc(14.6% - 1.75px);
  background: var(--yellow);
  animation-delay: 1.88s;
}

/*270  */
.orbit-outer span:nth-child(7) {
  top: calc(50% - 1.75px);
  left: 0%;
  background: var(--ink);
  animation-delay: 2.25s;
}

/*315  */
.orbit-outer span:nth-child(8) {
  top: 14.6%;
  left: calc(14.6% - 1.75px);
  background: var(--stone);
  animation-delay: 2.62s;
}

@keyframes particlePulse {
  0%,
  100% {
    transform: scale(0.6);
    opacity: 0.25;
  }

  50% {
    transform: scale(1.5);
    opacity: 1;
  }
}

@keyframes particlePulseOuter {
  0%,
  100% {
    transform: scale(0.5);
    opacity: 0.15;
  }

  50% {
    transform: scale(1.3);
    opacity: 0.6;
  }
}

/* ===================================================================
   PAGE TRANSITION LOADER
   Logo + scanner + status ticker
   =================================================================== */
.google-spinner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(245, 240, 232, 0.98);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.google-spinner-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* -- Launch screen wrapper -- */
.prisma-launch-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Logo */
.prisma-launch-logo {
  width: 152px;
  height: 152px;
  object-fit: contain;
  display: block;
  margin-bottom: 30px;
  animation: prismaLogoBreath 2.6s ease-in-out infinite;
}

@keyframes prismaLogoBreath {
  0%,
  100% {
    opacity: 0.65;
  }

  50% {
    opacity: 1;
  }
}

/* Laser scan line */
.prisma-launch-scanner {
  width: 120px;
  height: 2px;
  background: var(--stone);
  border-radius: 0;
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
}

.prisma-launch-scanner::after {
  content: '';
  position: absolute;
  inset-block: 0;
  left: 0;
  width: 45%;
  background: var(--ink);
  will-change: transform;
  animation: prismaLaserScan 1.7s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes prismaLaserScan {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(222%);
  }
}

/* Status ticker — 5 items x 1.8s = 9s cycle */
.prisma-launch-ticker {
  position: relative;
  height: 13px;
  width: 240px;
}

.prisma-tick-item {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  will-change: transform, opacity;
  font-family: 'Inter Tight', -apple-system, sans-serif;
  font-size: 9.5px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  animation: prismaTickShow 9s ease-in-out infinite;
}

@keyframes prismaTickShow {
  0% {
    opacity: 0;
    transform: translateY(4px);
  }

  4% {
    opacity: 1;
    transform: translateY(0);
  }

  17% {
    opacity: 1;
    transform: translateY(0);
  }

  20% {
    opacity: 0;
    transform: translateY(-4px);
  }

  20.01%,
  100% {
    opacity: 0;
    transform: translateY(4px);
  }
}

/* ===================================================================
   ICON CAROUSEL — accountant icons cycle one at a time
   6 icons x 1.5s each = 9s total cycle
   =================================================================== */
.loader-icon-carousel {
  position: relative;
  height: 44px;
  width: 220px;
  margin-top: 22px;
  margin-bottom: 4px;
}

.loader-icon-item {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(6px);
  will-change: opacity, transform;
  animation: iconCycleShow 9s ease-in-out infinite;
}

/* Colored icon chip */
.loader-icon-chip {
  width: 32px;
  height: 32px;
  border-radius: 0;
  border: 2px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 2px 2px 0 var(--ink);
}

.loader-icon-item span {
  font-family: 'Inter Tight', -apple-system, sans-serif;
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

@keyframes iconCycleShow {
  /* Visible window: 0%-16.67% (1.5s out of 9s) */
  0% {
    opacity: 0;
    transform: translateY(6px);
  }

  3.3% {
    opacity: 1;
    transform: translateY(0);
  }

  13.3% {
    opacity: 1;
    transform: translateY(0);
  }

  16.67% {
    opacity: 0;
    transform: translateY(-5px);
  }

  16.68%,
  100% {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ========== TEXT ========== */
.jarvis-text {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  animation: fadeInUp 0.6s ease-out 0.4s forwards;
}

.loader-title {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
}

.loader-sub {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* ========== UTILITY ANIMATIONS ========== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ===================================================================
   MASTRO IN-PAGE LOADER
   Loading indicator for data/content loading inside pages.
   =================================================================== */
.prisma-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px 24px;
  animation: prismaFadeIn 0.4s ease-out;
}

.prisma-loader-spinner {
  position: relative;
  width: 40px;
  height: 40px;
}

.prisma-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2.5px solid var(--stone);
  border-top-color: var(--ink);
  animation: prismaRotate 0.9s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.prisma-ring-inner {
  inset: 5px;
  border-color: var(--paper);
  border-top-color: var(--muted);
  animation-duration: 1.4s;
  animation-direction: reverse;
}

.prisma-loader-text {
  font-family: 'Inter Tight', -apple-system, sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}

/* Shimmer text effect */
.prisma-loader-text::after {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 253, 247, 0.7) 50%, transparent 100%);
  animation: prismaTextShimmer 2s ease-in-out infinite;
  pointer-events: none;
}

/* Compact variant */
.prisma-loader.compact {
  flex-direction: row;
  gap: 10px;
  padding: 16px;
}

.prisma-loader.compact .prisma-loader-spinner {
  width: 20px;
  height: 20px;
}

.prisma-loader.compact .prisma-ring {
  border-width: 2px;
}

.prisma-loader.compact .prisma-ring-inner {
  inset: 3px;
}

.prisma-loader.compact .prisma-loader-text {
  font-size: 11px;
}

.prisma-loader.compact .prisma-loader-text::after {
  display: none;
}

/* Large variant — for full-page or modal use */
.prisma-loader.large {
  padding: 60px 24px;
}

.prisma-loader.large .prisma-loader-spinner {
  width: 52px;
  height: 52px;
}

.prisma-loader.large .prisma-ring {
  border-width: 3px;
}

.prisma-loader.large .prisma-ring-inner {
  inset: 7px;
}

.prisma-loader.large .prisma-loader-text {
  font-size: 13px;
  margin-top: 4px;
}

/* Pulsing dots variant */
.prisma-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}

.prisma-dots span {
  width: 6px;
  height: 6px;
  border-radius: 0;
  background: var(--ink);
  animation: prismaDotPulse 1.4s ease-in-out infinite;
}

.prisma-dots span:nth-child(2) {
  animation-delay: 0.16s;
}

.prisma-dots span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes prismaRotate {
  to {
    transform: rotate(360deg);
  }
}

@keyframes prismaFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes prismaTextShimmer {
  0% {
    transform: translateX(-100%);
  }

  50% {
    transform: translateX(100%);
  }

  100% {
    transform: translateX(100%);
  }
}

@keyframes prismaDotPulse {
  0%,
  80%,
  100% {
    transform: scale(0.4);
    opacity: 0.3;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ===================================================================
   MASTRO THREE-DOT LOADER — shared with the React dashboard component
   =================================================================== */
@keyframes dot-3-move {
  20% { transform: scale(1); }
  45% { transform: translateY(-18px) scale(0.45); }
  60%, 80% { transform: translateY(-90px) scale(0.45); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes dot-2-move {
  20% { transform: scale(1); }
  45% { transform: translate(-16px, 12px) scale(0.45); }
  60%, 80% { transform: translate(-80px, 60px) scale(0.45); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes dot-1-move {
  20% { transform: scale(1); }
  45% { transform: translate(16px, 12px) scale(0.45); }
  60%, 80% { transform: translate(80px, 60px) scale(0.45); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes rotate-move {
  55% { transform: translate(-50%, -50%) rotate(0deg); }
  80%, 100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes index {
  0%, 100% { z-index: 3; }
  33.3% { z-index: 2; }
  66.6% { z-index: 1; }
}

.prisma-three-dots-loader {
  position: relative;
  width: 120px;
  height: 112px;
  flex: 0 0 auto;
}

.prisma-three-dots-canvas {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 190px;
  height: 190px;
  transform: translate(-50%, -50%) scale(0.58);
  transform-origin: center;
}

.prisma-three-dots-stage {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100px;
  height: 100px;
  animation: rotate-move 2s ease-in-out infinite;
}

.prisma-three-dot {
  position: absolute;
  top: 35px;
  left: 35px;
  width: 30px;
  height: 30px;
  border-radius: 9999px;
}

.prisma-three-dot-1 {
  background: #14161a;
  animation: dot-1-move 2s ease-in-out infinite, index 6s ease-in-out infinite;
}

.prisma-three-dot-2 {
  background: #19c37d;
  animation: dot-2-move 2s ease-in-out infinite, index 6s -4s ease-in-out infinite;
}

.prisma-three-dot-3 {
  background: #a7f3d0;
  animation: dot-3-move 2s ease-in-out infinite, index 6s -2s ease-in-out infinite;
}

.prisma-three-dots-filter {
  position: absolute;
  pointer-events: none;
}

/* ──────────────────────────────────────────────────────────────────────────
   Text loader stile OpenAI — gemello vanilla del React <TextLoader>.
   Classi `prisma-tl-*` IDENTICHE a scadenziario-app/src/components/shared/
   TextLoader.tsx, così shell e micro-app condividono lo stesso look.
   `.prisma-fs-loader` lo monta a tutto schermo (overlay) su boot e cambio pagina.
   ────────────────────────────────────────────────────────────────────────── */
@keyframes prisma-tl-shimmer {
  0%   { background-position: 140% 0; }
  100% { background-position: -40% 0; }
}
@keyframes prisma-tl-cycle {
  0%        { opacity: 0; transform: translate(-50%, calc(-50% + 5px)); }
  3%        { opacity: 1; transform: translate(-50%, -50%); }
  17%       { opacity: 1; transform: translate(-50%, -50%); }
  20%, 100% { opacity: 0; transform: translate(-50%, calc(-50% - 5px)); }
}
.prisma-tl { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; width: 100%; }
.prisma-tl-text { position: relative; height: 1.6em; }

/* Legacy ring rules remain for backwards-compatible cached markup. */
.prisma-tl-mark { position: relative; display: grid; place-items: center; }
.prisma-tl-ring {
  width: 30px; height: 30px; border-radius: 50%;
  background: conic-gradient(from 90deg, rgba(20, 22, 26, 0) 6%, #14161a 100%);
  -webkit-mask: radial-gradient(farthest-side, #0000 calc(100% - 2.5px), #000 calc(100% - 2.5px));
          mask: radial-gradient(farthest-side, #0000 calc(100% - 2.5px), #000 calc(100% - 2.5px));
  animation: prisma-tl-spin 0.9s linear infinite;
}
@keyframes prisma-tl-spin { to { transform: rotate(360deg); } }
@keyframes prisma-tl-breathe {
  0%, 100% { transform: scale(0.82); opacity: 0.45; }
  50%      { transform: scale(1.12); opacity: 0.9; }
}

/* Entrata in stagger: prima il mark, poi il testo — salita + dissolvenza. */
@keyframes prisma-tl-rise {
  0%   { opacity: 0; transform: translateY(7px); }
  100% { opacity: 1; transform: translateY(0); }
}
.prisma-fs-loader .prisma-tl-mark { animation: prisma-tl-rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.04s both; }
.prisma-fs-loader .prisma-tl-text { animation: prisma-tl-rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.16s both; }
.prisma-tl-text > span {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  font-family: 'Inter Tight', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px; font-weight: 800; letter-spacing: 0.01em;
  opacity: 0;
  background: linear-gradient(100deg, #b4b9c1 0%, #b4b9c1 38%, #14161a 50%, #b4b9c1 62%, #b4b9c1 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: prisma-tl-cycle 12.5s linear infinite, prisma-tl-shimmer 2.4s linear infinite;
}

/* Overlay a tutto schermo. Agganciato a <html> (non a <body>, che resta
   display:none fino al via libera dell'auth) così è visibile già al primo boot. */
.prisma-fs-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.34s ease, transform 0.34s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Uscita: leggero zoom-in + dissolvenza → sensazione di "entrare" nella pagina. */
.prisma-fs-loader.is-hiding { opacity: 0; transform: scale(1.02); }

/* Barra di progresso in cima alla pagina, stile LinkedIn (NProgress-like):
   parte da sinistra, avanza con trickle indeterminato e scatta al 100% a fine
   load. Sopra l'overlay testo (z-index più alto) così resta sempre visibile. */
.prisma-topbar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  z-index: 100000;
  overflow: hidden;
  background: linear-gradient(90deg, #15a36b 0%, #19c37d 60%, #34d39b 100%);
  opacity: 1;
  transition: width 0.2s ease, opacity 0.45s ease;
}
/* Scia di luce che scorre dentro la barra — tocco premium, clippata alla larghezza. */
.prisma-topbar::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0; width: 55%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  animation: prisma-topbar-sheen 1.5s ease-in-out infinite;
}
@keyframes prisma-topbar-sheen {
  0%   { transform: translateX(-130%); }
  100% { transform: translateX(330%); }
}
.prisma-topbar.is-done { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .prisma-tl-text > span {
    animation: prisma-tl-cycle 12.5s linear infinite;
    background: none;
    -webkit-text-fill-color: #5b6068; color: #5b6068;
  }
  .prisma-tl-ring { animation: none; }
  .prisma-three-dots-stage,
  .prisma-three-dot { animation: none !important; }
  .prisma-three-dot-1 { transform: translateX(36px) scale(0.72); }
  .prisma-three-dot-2 { transform: scale(0.72); }
  .prisma-three-dot-3 { transform: translateX(-36px) scale(0.72); }
  .prisma-fs-loader .prisma-tl-mark,
  .prisma-fs-loader .prisma-tl-text { animation: none; }
}

/* ── Attesa silenziosa (sostituisce .prisma-loader-text) ─────────────────
   Le cinque frasi a rotazione — «Un attimo… Preparo la vista… Recupero i
   dati… Ci siamo quasi… Pronti…» — non misuravano niente: «Ci siamo quasi»
   compariva identico dopo mezzo secondo e dopo venti. Un'attesa che parla
   senza sapere quello che dice e' peggio di un'attesa muta. Resta una
   superficie che respira. */
.prisma-loader-bar {
    width: min(280px, 60%);
    height: 6px;
    border-radius: 999px;
    background: currentColor;
    opacity: .12;
    position: relative;
    overflow: hidden;
    margin: 0 auto;
}
.prisma-loader-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: currentColor;
    animation: prisma-loader-breathe 1.6s ease-in-out infinite;
}
@keyframes prisma-loader-breathe { 0%, 100% { opacity: .55 } 50% { opacity: 1 } }
@media (prefers-reduced-motion: reduce) {
    .prisma-loader-bar::after { animation: none; opacity: .5 }
}

/* ──────────────────────────────────────────────────────────────────────────
   Loader «flux» — gemello vanilla del componente React ProgressiveFluxLoader.
   Etichetta di fase con entrata lettera per lettera, barra blu → ciano con
   glow e scia bianca. Il riempimento segue il progresso reale (trickle del
   router nell'overlay, giro autonomo nei loader inline).
   ────────────────────────────────────────────────────────────────────────── */
.prisma-flux { gap: 28px; max-width: 448px; width: 100%; margin: 0 auto; padding: 0 24px; box-sizing: border-box; }
.prisma-flux .prisma-tl-mark { margin-bottom: -4px; }

.prisma-flux-label {
  position: relative;
  width: 100%;
  height: 56px;
  perspective: 1000px;
  user-select: none;
}
.prisma-flux-word {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  font-family: 'Plus Jakarta Sans', 'Inter Tight', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #6b7280;
  transform-style: preserve-3d;
  animation: prisma-flux-word-in 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.prisma-flux-word.is-out {
  animation: prisma-flux-word-out 0.45s cubic-bezier(0.7, 0, 0.84, 0) both;
  pointer-events: none;
}
.prisma-flux-char {
  display: inline-block;
  animation: prisma-flux-char-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes prisma-flux-word-in {
  0%   { opacity: 0; transform: translateZ(-380px) scale(0.65); filter: blur(14px); }
  33%  { opacity: 1; transform: translateZ(60px) scale(1.08); filter: blur(0); }
  66%  { opacity: 1; transform: translateZ(-8px) scale(0.985); filter: blur(0); }
  100% { opacity: 1; transform: translateZ(0) scale(1); filter: blur(0); }
}
@keyframes prisma-flux-word-out {
  to { opacity: 0; transform: translateZ(220px) scale(1.35); filter: blur(10px); }
}
@keyframes prisma-flux-char-in {
  0%   { opacity: 0; transform: translateY(12px); filter: blur(8px); }
  100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.prisma-flux-track {
  --flux-from: #1d6ffb;
  --flux-to: #74e1ff;
  --flux-mid: color-mix(in oklab, var(--flux-from), var(--flux-to));
  position: relative;
  width: 100%;
  height: 20px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.09), inset 0 -1px 2px rgba(255, 255, 255, 0.7);
}
.prisma-flux-fill {
  position: relative;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--flux-from) 0%, var(--flux-mid) 35%, var(--flux-to) 55%, var(--flux-mid) 78%, var(--flux-from) 100%);
  box-shadow:
    0 0 18px color-mix(in oklab, var(--flux-from) 55%, transparent),
    0 0 32px color-mix(in oklab, var(--flux-to) 40%, transparent),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.5),
    inset 0 -2px 3px rgba(0, 40, 120, 0.35);
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.prisma-flux-sheen {
  pointer-events: none;
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 50%;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.55) 50%, transparent 100%);
  mix-blend-mode: screen;
  animation: prisma-flux-sheen 1.6s linear infinite;
}
@keyframes prisma-flux-sheen {
  0%   { transform: translateX(-110%); }
  100% { transform: translateX(210%); }
}

/* La barra in cima prende la stessa palette della barra grande. */
.prisma-topbar {
  background: linear-gradient(90deg, #1d6ffb 0%, #74e1ff 60%, #1d6ffb 100%);
  box-shadow: 0 0 10px rgba(29, 111, 251, 0.45);
}

@media (max-width: 640px) {
  .prisma-flux-word { font-size: 24px; }
  .prisma-flux-label { height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  .prisma-flux-word, .prisma-flux-word.is-out, .prisma-flux-char { animation: none; }
  .prisma-flux-word.is-out { display: none; }
  .prisma-flux-sheen { animation: none; display: none; }
  .prisma-flux-fill { transition: none; }
}

/* Variante compatta: dentro liste, pannelli e modali. Niente puntini, testo
   piccolo, barra sottile. I segnaposto [data-prisma-flux] si centrano da sé. */
[data-prisma-flux] { display: flex; align-items: center; justify-content: center; width: 100%; }
.prisma-flux.is-compact { gap: 10px; max-width: 320px; padding: 0 12px; }
.prisma-flux.is-compact .prisma-flux-label { height: 22px; perspective: none; }
.prisma-flux.is-compact .prisma-flux-word { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.prisma-flux.is-compact .prisma-flux-track { height: 8px; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08); }
.prisma-flux.is-compact .prisma-flux-fill { box-shadow: 0 0 10px color-mix(in oklab, var(--flux-from) 45%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.45); }
