/* ════════════════════════════════════════════════════════════════
   SPARKNAUTIC — MOTION LAYER
   Cinematic animations + transitions for marketing + dashboard.
   Pure CSS. Respects prefers-reduced-motion.
   ════════════════════════════════════════════════════════════════ */

/* ── Global transition base ────────────────────────────────── */
:root {
  --ease-out-quart: cubic-bezier(0.165, 0.84, 0.44, 1);
  --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out-smooth: cubic-bezier(0.65, 0, 0.35, 1);
}

/* Honor reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ════════════════════════════════════════════════
   KEYFRAMES
   ════════════════════════════════════════════════ */

@keyframes mo-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes mo-fade-up {
  from { opacity: 0; transform: translate3d(0, 24px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes mo-fade-down {
  from { opacity: 0; transform: translate3d(0, -16px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes mo-fade-left {
  from { opacity: 0; transform: translate3d(-24px, 0, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes mo-fade-right {
  from { opacity: 0; transform: translate3d(24px, 0, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes mo-scale-in {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes mo-blur-in {
  from { opacity: 0; filter: blur(8px); transform: translateY(12px); }
  to   { opacity: 1; filter: blur(0); transform: translateY(0); }
}
@keyframes mo-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes mo-pulse-soft {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.55; transform: scale(1.04); }
}
@keyframes mo-pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55); }
  100% { box-shadow: 0 0 0 14px rgba(52, 211, 153, 0); }
}
@keyframes mo-pulse-ring-indigo {
  0%   { box-shadow: 0 0 0 0 rgba(129, 140, 248, 0.55); }
  100% { box-shadow: 0 0 0 14px rgba(129, 140, 248, 0); }
}
@keyframes mo-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
@keyframes mo-drift-1 {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.7; }
  50%      { transform: translate(40px, -30px) scale(1.15); opacity: 1; }
}
@keyframes mo-drift-2 {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.6; }
  50%      { transform: translate(-50px, 40px) scale(1.12); opacity: 0.9; }
}
@keyframes mo-spin {
  to { transform: rotate(360deg); }
}
@keyframes mo-spin-slow {
  to { transform: rotate(360deg); }
}
@keyframes mo-gradient-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes mo-draw-line {
  to { stroke-dashoffset: 0; }
}
@keyframes mo-count-flash {
  0%   { color: var(--app-primary-bright, #a5b4fc); transform: translateY(-2px); }
  100% { color: var(--app-text-hero, #f1f5f9); transform: translateY(0); }
}
@keyframes mo-bell-ring {
  0%, 100% { transform: rotate(0); }
  10%, 30% { transform: rotate(14deg); }
  20%, 40% { transform: rotate(-14deg); }
  50%      { transform: rotate(0); }
}
@keyframes mo-slide-up {
  from { opacity: 0; transform: translate3d(0, 100%, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes mo-scan-line {
  0%   { left: -30%; }
  100% { left: 130%; }
}
@keyframes mo-ticker-fade {
  0%   { opacity: 0; transform: translateY(8px); }
  10%  { opacity: 1; transform: translateY(0); }
  90%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-8px); }
}

/* ════════════════════════════════════════════════
   ENTRANCE UTILITIES (declarative)
   ════════════════════════════════════════════════ */

.mo-enter        { animation: mo-fade-up 0.7s var(--ease-out-quart) both; }
.mo-enter-fade   { animation: mo-fade-in 0.6s ease both; }
.mo-enter-down   { animation: mo-fade-down 0.6s var(--ease-out-quart) both; }
.mo-enter-left   { animation: mo-fade-left 0.7s var(--ease-out-quart) both; }
.mo-enter-right  { animation: mo-fade-right 0.7s var(--ease-out-quart) both; }
.mo-enter-scale  { animation: mo-scale-in 0.5s var(--ease-out-back) both; }
.mo-enter-blur   { animation: mo-blur-in 0.8s var(--ease-out-quart) both; }

/* Delays */
.mo-delay-100 { animation-delay: 0.10s; }
.mo-delay-200 { animation-delay: 0.20s; }
.mo-delay-300 { animation-delay: 0.30s; }
.mo-delay-400 { animation-delay: 0.40s; }
.mo-delay-500 { animation-delay: 0.50s; }
.mo-delay-600 { animation-delay: 0.60s; }
.mo-delay-700 { animation-delay: 0.70s; }
.mo-delay-800 { animation-delay: 0.80s; }

/* ════════════════════════════════════════════════
   STAGGER (auto-cascade for grids)
   ════════════════════════════════════════════════ */

.mo-stagger > *,
[data-stagger] > * {
  opacity: 0;
  animation: mo-fade-up 0.65s var(--ease-out-quart) both;
}
.mo-stagger > *:nth-child(1),  [data-stagger] > *:nth-child(1)  { animation-delay: 0.05s; }
.mo-stagger > *:nth-child(2),  [data-stagger] > *:nth-child(2)  { animation-delay: 0.10s; }
.mo-stagger > *:nth-child(3),  [data-stagger] > *:nth-child(3)  { animation-delay: 0.15s; }
.mo-stagger > *:nth-child(4),  [data-stagger] > *:nth-child(4)  { animation-delay: 0.20s; }
.mo-stagger > *:nth-child(5),  [data-stagger] > *:nth-child(5)  { animation-delay: 0.25s; }
.mo-stagger > *:nth-child(6),  [data-stagger] > *:nth-child(6)  { animation-delay: 0.30s; }
.mo-stagger > *:nth-child(7),  [data-stagger] > *:nth-child(7)  { animation-delay: 0.35s; }
.mo-stagger > *:nth-child(8),  [data-stagger] > *:nth-child(8)  { animation-delay: 0.40s; }
.mo-stagger > *:nth-child(9),  [data-stagger] > *:nth-child(9)  { animation-delay: 0.45s; }
.mo-stagger > *:nth-child(10), [data-stagger] > *:nth-child(10) { animation-delay: 0.50s; }
.mo-stagger > *:nth-child(11), [data-stagger] > *:nth-child(11) { animation-delay: 0.55s; }
.mo-stagger > *:nth-child(12), [data-stagger] > *:nth-child(12) { animation-delay: 0.60s; }

/* ════════════════════════════════════════════════
   SCROLL REVEAL (works with IntersectionObserver in JS)
   ════════════════════════════════════════════════ */

.reveal-on-scroll {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition: opacity 0.9s var(--ease-out-quart), transform 0.9s var(--ease-out-quart);
  will-change: opacity, transform;
}
.reveal-on-scroll.visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}
.reveal-on-scroll-left {
  opacity: 0;
  transform: translate3d(-28px, 0, 0);
  transition: opacity 0.9s var(--ease-out-quart), transform 0.9s var(--ease-out-quart);
}
.reveal-on-scroll-left.visible { opacity: 1; transform: translate3d(0, 0, 0); }
.reveal-on-scroll-right {
  opacity: 0;
  transform: translate3d(28px, 0, 0);
  transition: opacity 0.9s var(--ease-out-quart), transform 0.9s var(--ease-out-quart);
}
.reveal-on-scroll-right.visible { opacity: 1; transform: translate3d(0, 0, 0); }
.reveal-on-scroll-scale {
  opacity: 0;
  transform: scale(0.94);
  transition: opacity 0.7s var(--ease-out-quart), transform 0.7s var(--ease-out-back);
}
.reveal-on-scroll-scale.visible { opacity: 1; transform: scale(1); }

/* ════════════════════════════════════════════════
   LIVE / AMBIENT INDICATORS
   ════════════════════════════════════════════════ */

.mo-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
}
.mo-live-dot::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  animation: mo-pulse-ring 2s ease-out infinite;
}
.mo-live-dot.is-indigo { background: #818cf8; box-shadow: 0 0 8px rgba(129, 140, 248, 0.6); }
.mo-live-dot.is-indigo::before { animation: mo-pulse-ring-indigo 2s ease-out infinite; }
.mo-live-dot.is-amber  { background: #fbbf24; box-shadow: 0 0 8px rgba(251, 191, 36, 0.6); }
.mo-live-dot.is-rose   { background: #fb7185; box-shadow: 0 0 8px rgba(251, 113, 133, 0.6); }

.mo-float    { animation: mo-float 6s ease-in-out infinite; }
.mo-pulse    { animation: mo-pulse-soft 2.4s ease-in-out infinite; }
.mo-spin     { animation: mo-spin 1s linear infinite; }
.mo-spin-slow { animation: mo-spin-slow 20s linear infinite; }

/* ════════════════════════════════════════════════
   HOVER MICRO-INTERACTIONS
   ════════════════════════════════════════════════ */

/* Card hover lift */
.mo-lift {
  transition: transform 0.4s var(--ease-out-expo), box-shadow 0.4s var(--ease-out-expo), border-color 0.3s;
}
.mo-lift:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(99, 102, 241, 0.18), 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Button press */
.btn-primary,
.btn-secondary,
.btn-nav,
.btn-plan,
.app-btn {
  transition: all 0.28s var(--ease-out-quart) !important;
  will-change: transform, box-shadow;
}
.btn-primary:active,
.app-btn:active { transform: translateY(0) scale(0.98) !important; }

/* Shimmer sweep on primary buttons */
.btn-primary,
.app-btn-primary {
  position: relative;
  overflow: hidden;
}
.btn-primary::after,
.app-btn-primary::after {
  content: '';
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  left: -60%;
  pointer-events: none;
  transition: left 0.7s var(--ease-out-quart);
}
.btn-primary:hover::after,
.app-btn-primary:hover::after { left: 110%; }

/* Card hover (apply via .mo-card-hover on top of .app-card) */
.app-card.mo-card-hover,
.feature-block,
.feature-card,
.plan-card,
.testimonial,
.faq-item {
  transition: transform 0.4s var(--ease-out-expo), border-color 0.3s, background 0.3s, box-shadow 0.4s var(--ease-out-expo);
}
.app-card.mo-card-hover:hover,
.feature-block:hover,
.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(99, 102, 241, 0.08);
}

/* Icon hover wiggle */
.mo-icon-hover svg { transition: transform 0.4s var(--ease-out-back); }
.mo-icon-hover:hover svg { transform: scale(1.15) rotate(-4deg); }

/* Bell ring animation when unread */
.app-topbar-bell.has-unread svg,
.nav-item.has-unread .nav-item-icon svg {
  transform-origin: 50% 4px;
  animation: mo-bell-ring 4s ease-in-out infinite;
}

/* Active nav item subtle shimmer */
.nav-item.is-active {
  position: relative;
  overflow: hidden;
}
.nav-item.is-active::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: -30%;
  width: 60%;
  background: linear-gradient(90deg, transparent, rgba(165, 180, 252, 0.08), transparent);
  pointer-events: none;
  animation: mo-scan-line 6s linear infinite;
}

/* ════════════════════════════════════════════════
   HERO ENHANCEMENTS
   ════════════════════════════════════════════════ */

/* The landing hero glows breathe naturally already; supercharge them */
.hero-glow,
.hero-glow-secondary {
  will-change: transform, opacity;
}
.hero-glow         { animation: mo-drift-1 18s ease-in-out infinite; }
.hero-glow-secondary { animation: mo-drift-2 22s ease-in-out infinite; }

/* Hero badge dot upgrade */
.badge-dot {
  position: relative;
}
.badge-dot::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: inherit;
  opacity: 0.4;
  animation: mo-pulse-ring 2.2s ease-out infinite;
}

/* Gradient text shimmer on hero h1 */
.landing-h1 .gradient-text {
  background: linear-gradient(
    120deg,
    var(--primary-bright) 0%,
    var(--secondary) 30%,
    var(--green-soft) 55%,
    var(--secondary) 80%,
    var(--primary-bright) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: mo-gradient-shift 7s ease-in-out infinite;
}

/* Marketplace pills float subtly */
.marketplace-pills .pill {
  transition: transform 0.4s var(--ease-out-back);
}
.marketplace-pills .pill:hover {
  transform: translateY(-3px) scale(1.04);
}

/* ════════════════════════════════════════════════
   HERO DASHBOARD PREVIEW MOTION
   ════════════════════════════════════════════════ */

/* Sparkline draws on load */
.hero-preview .mini-sparkline path[stroke] {
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  animation: mo-draw-line 2.4s var(--ease-out-quart) 0.6s forwards;
}
.hero-preview .mini-sparkline path[stroke]:nth-child(4) {
  animation-delay: 1s;
}
.hero-preview .mini-sparkline path[fill] {
  opacity: 0;
  animation: mo-fade-in 1.5s ease 1.4s forwards;
}

/* Mini table rows cascade in */
.hero-preview .mini-table-row {
  animation: mo-fade-up 0.5s var(--ease-out-quart) both;
}
.hero-preview .mini-table-row:nth-child(2) { animation-delay: 0.7s; }
.hero-preview .mini-table-row:nth-child(3) { animation-delay: 0.85s; }
.hero-preview .mini-table-row:nth-child(4) { animation-delay: 1.0s; }
.hero-preview .mini-table-row:nth-child(5) { animation-delay: 1.15s; }
.hero-preview .mini-table-row:nth-child(6) { animation-delay: 1.3s; }

/* Mini stat cards cascade in */
.hero-preview .mini-stat-card {
  animation: mo-fade-up 0.55s var(--ease-out-quart) both;
}
.hero-preview .mini-stat-card:nth-child(1) { animation-delay: 0.25s; }
.hero-preview .mini-stat-card:nth-child(2) { animation-delay: 0.35s; }
.hero-preview .mini-stat-card:nth-child(3) { animation-delay: 0.45s; }
.hero-preview .mini-stat-card:nth-child(4) { animation-delay: 0.55s; }

/* "Processing" status pill in preview gets a subtle pulse */
.hero-preview .mini-status-processing,
.hero-preview .mini-status-pending {
  animation: mo-pulse-soft 2s ease-in-out infinite;
}

/* Nav items active glow in preview */
.hero-preview .mini-nav-item.active {
  position: relative;
}
.hero-preview .mini-nav-item.active::after {
  content: '';
  position: absolute;
  top: 50%; right: 8px;
  transform: translateY(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--primary-bright);
  box-shadow: 0 0 6px var(--primary-bright);
  animation: mo-pulse-soft 1.6s ease-in-out infinite;
}

/* ════════════════════════════════════════════════
   TRUST STRIP + STATS — SUBTLE ENTRANCE
   ════════════════════════════════════════════════ */

.trust-strip .trust-strip-item {
  animation: mo-fade-up 0.55s var(--ease-out-quart) both;
}
.trust-strip .trust-strip-item:nth-child(1) { animation-delay: 0.10s; }
.trust-strip .trust-strip-item:nth-child(2) { animation-delay: 0.20s; }
.trust-strip .trust-strip-item:nth-child(3) { animation-delay: 0.30s; }
.trust-strip .trust-strip-item:nth-child(4) { animation-delay: 0.40s; }
.trust-strip .trust-strip-item svg {
  transition: transform 0.4s var(--ease-out-back), color 0.3s;
}
.trust-strip .trust-strip-item:hover svg {
  transform: scale(1.18) rotate(-6deg);
  color: var(--secondary);
}

/* ════════════════════════════════════════════════
   FEATURE GRID + PRICING + COMPARE — CARD MOTION
   ════════════════════════════════════════════════ */

.feature-card,
.plan-card,
.testimonial,
.why-card,
.feature-block,
.feature-sub {
  transition: transform 0.4s var(--ease-out-expo), border-color 0.3s, background 0.3s, box-shadow 0.4s;
}
.feature-card:hover,
.plan-card:hover:not(.popular),
.testimonial:hover,
.why-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 32px rgba(99, 102, 241, 0.08);
}
.plan-card.popular { animation: mo-float 8s ease-in-out infinite; }

/* Feature icon — animate on card hover */
.feature-card .feature-icon,
.feature-block .feature-icon {
  transition: transform 0.5s var(--ease-out-back), background 0.3s, border-color 0.3s;
}
.feature-card:hover .feature-icon,
.feature-block:hover .feature-icon {
  transform: scale(1.1) rotate(-6deg);
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(129, 140, 248, 0.4);
}

/* Compare table row hover */
.compare-table tbody tr {
  transition: background 0.2s, transform 0.2s;
}
.compare-table tbody tr:hover {
  background: rgba(99, 102, 241, 0.04);
  transform: translateX(2px);
}
.compare-table tbody td.us {
  position: relative;
}

/* FAQ chevron animation */
.faq-item summary::after {
  transition: transform 0.4s var(--ease-out-back), color 0.2s;
}
.faq-item:hover summary::after { color: var(--secondary); }

/* ════════════════════════════════════════════════
   DASHBOARD — APP MOTION
   ════════════════════════════════════════════════ */

/* Subtle entrance on dashboard page load */
.app-page-header { animation: mo-fade-down 0.6s var(--ease-out-quart) both; }
.app-page-title-block { animation: mo-fade-up 0.7s var(--ease-out-quart) 0.05s both; }
.app-page-actions { animation: mo-fade-up 0.7s var(--ease-out-quart) 0.15s both; }

/* App cards animate in cascade */
.app-card,
.app-stat,
.app-table-wrap,
.app-empty {
  animation: mo-fade-up 0.55s var(--ease-out-quart) both;
}

/* Stat grid cascade */
.app-stat-grid .app-stat:nth-child(1) { animation-delay: 0.05s; }
.app-stat-grid .app-stat:nth-child(2) { animation-delay: 0.12s; }
.app-stat-grid .app-stat:nth-child(3) { animation-delay: 0.19s; }
.app-stat-grid .app-stat:nth-child(4) { animation-delay: 0.26s; }
.app-stat-grid .app-stat:nth-child(5) { animation-delay: 0.33s; }
.app-stat-grid .app-stat:nth-child(6) { animation-delay: 0.40s; }

/* App row col cascade */
.app-row > * { animation: mo-fade-up 0.6s var(--ease-out-quart) both; }
.app-row > *:nth-child(1) { animation-delay: 0.06s; }
.app-row > *:nth-child(2) { animation-delay: 0.14s; }
.app-row > *:nth-child(3) { animation-delay: 0.22s; }
.app-row > *:nth-child(4) { animation-delay: 0.30s; }

/* App stat hover */
.app-stat {
  transition: transform 0.4s var(--ease-out-expo), border-color 0.3s, box-shadow 0.4s;
}
.app-stat:hover {
  transform: translateY(-2px);
  border-color: var(--app-border-strong);
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.08);
}

/* App stat icon — animated halo on hover */
.app-stat-icon {
  transition: transform 0.45s var(--ease-out-back), background 0.3s, border-color 0.3s;
}
.app-stat:hover .app-stat-icon {
  transform: scale(1.1) rotate(-6deg);
}

/* App card hover */
.app-card {
  transition: transform 0.4s var(--ease-out-expo), border-color 0.3s, background 0.3s, box-shadow 0.4s;
}
.app-card.is-interactive,
.app-card:hover {
  border-color: var(--app-border-strong);
}

/* Channel rows */
.channel-row {
  transition: background 0.25s, border-color 0.25s, transform 0.25s var(--ease-out-quart);
}
.channel-row:hover { transform: translateX(4px); }

/* Quick action lift + glow */
.quick-action {
  transition: all 0.3s var(--ease-out-expo);
}
.quick-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(99, 102, 241, 0.12);
}
.quick-action-icon {
  transition: transform 0.45s var(--ease-out-back);
}
.quick-action:hover .quick-action-icon { transform: scale(1.12) rotate(-8deg); }

/* App table row hover lift */
.app-table tbody tr {
  transition: background 0.18s;
}

/* App pill: subtle hover for interactive ones */
.app-pill {
  transition: all 0.2s;
}
.app-pill.is-success .app-pill-dot {
  position: relative;
  background: var(--app-green);
}
.app-pill.is-success .app-pill-dot::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: inherit;
  opacity: 0.5;
  animation: mo-pulse-ring 2s ease-out infinite;
}

/* Topbar bell ring + glow */
.app-topbar-bell { transition: all 0.25s; }
.app-topbar-bell:hover svg {
  animation: mo-bell-ring 0.8s ease-in-out;
}
.app-topbar-bell-badge {
  animation: mo-pulse-soft 2s ease-in-out infinite;
}

/* Sidebar nav item — animated icon on hover */
.nav-item .nav-item-icon {
  transition: transform 0.4s var(--ease-out-back), color 0.2s;
}
.nav-item:hover .nav-item-icon {
  transform: scale(1.12) rotate(-6deg);
}

/* Sidebar active nav item — left bar slides in */
.nav-item.is-active::before {
  animation: mo-fade-left 0.35s var(--ease-out-quart) both;
}

/* Sidebar nav item glow on hover */
.nav-item {
  position: relative;
}
.nav-item:not(.is-active)::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px;
  height: 0;
  background: var(--app-primary-bright);
  border-radius: 0 4px 4px 0;
  transition: transform 0.25s var(--ease-out-quart), height 0.25s var(--ease-out-quart);
}
.nav-item:hover:not(.is-active)::before {
  transform: translateY(-50%) scaleY(1);
  height: 16px;
}

/* ════════════════════════════════════════════════
   AMBIENT APP BACKGROUND ORBS
   ════════════════════════════════════════════════ */
.app-bg::before,
.app-bg::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  pointer-events: none;
}
.app-bg::before {
  width: 540px; height: 540px;
  top: -160px; left: -120px;
  background: rgba(99, 102, 241, 0.18);
  animation: mo-drift-1 28s ease-in-out infinite;
}
.app-bg::after {
  width: 480px; height: 480px;
  bottom: -180px; right: -140px;
  background: rgba(34, 211, 238, 0.12);
  animation: mo-drift-2 32s ease-in-out infinite;
}

/* ════════════════════════════════════════════════
   FORM / INPUT FOCUS POLISH
   ════════════════════════════════════════════════ */
.app-input, .app-select, .app-textarea {
  transition: all 0.22s var(--ease-out-quart) !important;
}
.app-input:focus, .app-select:focus, .app-textarea:focus {
  transform: translateY(-1px);
}

/* ════════════════════════════════════════════════
   COUNTER (for animated stat numbers via JS)
   ════════════════════════════════════════════════ */
.mo-count {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}
.mo-count.is-flashing {
  animation: mo-count-flash 0.6s ease;
}

/* ════════════════════════════════════════════════
   PAGE TRANSITION (Turbo View Transitions)
   ════════════════════════════════════════════════ */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) {
    animation: mo-fade-in 0.25s ease reverse;
  }
  ::view-transition-new(root) {
    animation: mo-fade-up 0.45s var(--ease-out-quart);
  }
}

/* ════════════════════════════════════════════════
   ANIMATED BACKGROUND GRID (subtle, for hero)
   ════════════════════════════════════════════════ */
.mo-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(129, 140, 248, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(129, 140, 248, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 50%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 50%, black 30%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}

/* ════════════════════════════════════════════════
   TICKER (for live activity strips)
   ════════════════════════════════════════════════ */
.mo-ticker-item {
  animation: mo-ticker-fade 5s ease-in-out infinite;
}

/* ════════════════════════════════════════════════
   UTILITY: subtle hover glow for any element
   ════════════════════════════════════════════════ */
.mo-glow {
  transition: box-shadow 0.4s var(--ease-out-expo);
}
.mo-glow:hover {
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.3), 0 8px 32px rgba(99, 102, 241, 0.15);
}

/* ════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ════════════════════════════════════════════════ */
.mo-toast {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 320px;
  max-width: 480px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(15, 20, 36, 0.95);
  border: 1px solid var(--app-border-strong, rgba(148, 163, 234, 0.2));
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 6px 20px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--app-text-hero, #f1f5f9);
  font-size: 0.9rem;
  opacity: 0;
  transform: translate3d(110%, 0, 0);
  transition: opacity 0.35s var(--ease-out-quart), transform 0.45s var(--ease-out-back);
}
.mo-toast.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}
.mo-toast.is-leaving {
  opacity: 0;
  transform: translate3d(50%, 0, 0) scale(0.96);
}
.mo-toast-icon {
  width: 24px; height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 8px;
  position: relative;
}
.mo-toast-icon svg { width: 18px; height: 18px; }
.mo-toast-icon::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 12px;
  opacity: 0.18;
}
.mo-toast--success .mo-toast-icon { color: #34d399; }
.mo-toast--success .mo-toast-icon::before { background: #34d399; }
.mo-toast--success .mo-toast-icon svg path,
.mo-toast--success .mo-toast-icon svg polyline {
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: mo-draw-line 0.6s ease-out 0.15s forwards;
}
.mo-toast--error   .mo-toast-icon { color: #fb7185; }
.mo-toast--error   .mo-toast-icon::before { background: #fb7185; }
.mo-toast--warning .mo-toast-icon { color: #fbbf24; }
.mo-toast--warning .mo-toast-icon::before { background: #fbbf24; }
.mo-toast--info    .mo-toast-icon { color: #22d3ee; }
.mo-toast--info    .mo-toast-icon::before { background: #22d3ee; }
.mo-toast-message { flex: 1; line-height: 1.5; font-weight: 500; }
.mo-toast-close {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--app-text-muted, #64748b);
  padding: 4px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.mo-toast-close:hover { color: var(--app-text-hero, #f1f5f9); background: rgba(255, 255, 255, 0.06); }
.mo-toast-close svg { width: 14px; height: 14px; }

/* Auto-dismiss progress bar inside toast */
.mo-toast::after {
  content: '';
  position: absolute;
  left: 14px; right: 14px; bottom: 6px;
  height: 2px;
  border-radius: 100px;
  background: currentColor;
  opacity: 0.25;
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 4s linear;
}
.mo-toast--success::after { color: #34d399; }
.mo-toast--error::after   { color: #fb7185; }
.mo-toast--warning::after { color: #fbbf24; }
.mo-toast--info::after    { color: #22d3ee; }
.mo-toast.is-visible::after { transform: scaleX(1); }

/* ════════════════════════════════════════════════
   FLASH MESSAGES (inline at top of main)
   ════════════════════════════════════════════════ */
.mo-flash {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 11px;
  margin-bottom: 16px;
  font-size: 0.88rem;
  border: 1px solid transparent;
  animation: mo-fade-down 0.5s var(--ease-out-quart) both;
  position: relative;
  z-index: 5;
}
.mo-flash--success { background: rgba(52, 211, 153, 0.08);  border-color: rgba(52, 211, 153, 0.25);  color: #6ee7b7; }
.mo-flash--danger  { background: rgba(251, 113, 133, 0.08); border-color: rgba(251, 113, 133, 0.25); color: #fda4af; }
.mo-flash--info    { background: rgba(99, 102, 241, 0.08);  border-color: rgba(129, 140, 248, 0.25); color: #a5b4fc; }
.mo-flash-icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.mo-flash-icon svg { width: 18px; height: 18px; }
.mo-flash-message { flex: 1; line-height: 1.5; }
.mo-flash-close {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  padding: 4px;
  border-radius: 6px;
  transition: opacity 0.15s, background 0.15s;
  display: inline-flex;
  align-items: center;
}
.mo-flash-close:hover { opacity: 1; background: rgba(255, 255, 255, 0.06); }
.mo-flash-close svg { width: 14px; height: 14px; }

@media (max-width: 480px) {
  .mo-toast { right: 12px; left: 12px; min-width: 0; }
}

/* ════════════════════════════════════════════════
   LOADING BUTTON STATE
   ════════════════════════════════════════════════ */
.app-btn.is-loading,
.btn-primary.is-loading,
.btn-secondary.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.app-btn.is-loading::after,
.btn-primary.is-loading::after,
.btn-secondary.is-loading::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  margin: -8px 0 0 -8px;
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: white;
  animation: mo-spin 0.6s linear infinite;
}
.btn-secondary.is-loading::after { color: var(--app-primary-bright, #a5b4fc); }

/* ════════════════════════════════════════════════
   SKELETON LOADER
   ════════════════════════════════════════════════ */
.mo-skeleton {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  color: transparent !important;
  user-select: none;
}
.mo-skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.06) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: mo-shimmer 1.4s linear infinite;
}

/* ════════════════════════════════════════════════
   EMPTY STATE ANIMATIONS
   ════════════════════════════════════════════════ */
.app-empty .app-empty-icon {
  animation: mo-float 5s ease-in-out infinite;
}
.app-empty .app-empty-icon::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: inherit;
  background: inherit;
  opacity: 0.3;
  filter: blur(12px);
  z-index: -1;
  animation: mo-pulse-soft 3s ease-in-out infinite;
}
.app-empty .app-empty-icon { position: relative; }

/* ════════════════════════════════════════════════
   SIDEBAR LIVE DOT NEXT TO BADGES
   ════════════════════════════════════════════════ */
.nav-item-badge {
  position: relative;
  animation: mo-pulse-soft 2.4s ease-in-out infinite;
}

/* ════════════════════════════════════════════════
   TURBO PROGRESS BAR (Hotwire's default) — restyle
   ════════════════════════════════════════════════ */
.turbo-progress-bar {
  height: 3px !important;
  background: linear-gradient(90deg, #818cf8, #22d3ee, #34d399) !important;
  box-shadow: 0 0 10px rgba(129, 140, 248, 0.55);
}
