/* ════════════════════════════════════════════════════════════
 * PAGE TRANSITION LOADER — covers the viewport until the JS
 * shell is mounted, preventing any FOUC (flash of unstyled
 * content). Dismissed by mountShell(); auto-fades via CSS
 * animation as a fallback for pages that don't call it.
 * ════════════════════════════════════════════════════════════ */
.nx-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #05050a;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    animation: nxLoaderAutoFade 0.4s ease 2s forwards;
}
.nx-loader.is-done {
    opacity: 0;
    pointer-events: none;
    animation: none;
}
.nx-loader-ring {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2.5px solid rgba(255, 255, 255, 0.06);
    border-top-color: #38bdf8;
    border-right-color: #6366f1;
    animation: nxSpin 0.65s linear infinite;
    filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.45))
           drop-shadow(0 0 20px rgba(99, 102, 241, 0.2));
}
@keyframes nxSpin {
    to { transform: rotate(360deg); }
}
@keyframes nxLoaderAutoFade {
    to { opacity: 0; pointer-events: none; }
}

/* ════════════════════════════════════════════════════════════
 * HARD VIEWPORT CLAMP — nothing escapes the screen
 * ════════════════════════════════════════════════════════════
 * Aggressive: clamp html + body + every common container so no
 * descendant can produce horizontal overflow. Combined with
 * overflow-x: clip on the root, this guarantees a clean fit even
 * on weird screens. */
html, body {
    max-width: 100vw;
    width: 100%;
    overflow-x: hidden;
    overflow-x: clip;
}
/* Sticky-footer layout: body becomes a flex column so main
   stretches to fill the viewport and the footer sticks to the
   bottom even when page content is short. portal.css already
   sets body { min-height: 100vh } — we just add flex semantics. */
body.nx-shell-mounted {
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}
body.nx-shell-mounted main.page {
    flex: 1 1 0;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-x: clip;
    overflow-y: auto;
    padding-bottom: 12px;
}
body.nx-shell-mounted .nx-tab-layout {
    flex: 1 1 0;
    overflow: hidden;
}
body.nx-shell-mounted .nx-tab-content {
    overflow-y: auto;
}
body.nx-shell-mounted .nx-footer {
    flex-shrink: 0;
}
body.nx-shell-mounted main img,
body.nx-shell-mounted main video,
body.nx-shell-mounted main canvas,
body.nx-shell-mounted .card img,
body.nx-shell-mounted .stat-card img {
    max-width: 100%;
    height: auto;
}
body.nx-shell-mounted iframe { max-width: 100%; }
body.nx-shell-mounted table {
    max-width: 100%;
    table-layout: auto;
}
body.nx-shell-mounted .card,
body.nx-shell-mounted .stat-card,
body.nx-shell-mounted .stat-grid,
body.nx-shell-mounted .grid-2,
body.nx-shell-mounted .grid-3 {
    max-width: 100%;
    min-width: 0;
}
/* Any fixed-position floating element gets its own viewport clamp
   so a mid-animation transform can't push it off-screen. */
.nx-status-card,
.nx-chat-panel,
.nx-status-pill,
.nx-chat-fab {
    max-width: calc(100vw - 16px);
}
/* Topbar and bottom bar themselves clamp to viewport width. */
.nx-topbar,
.nx-bottombar,
.nx-subnav {
    max-width: 100vw;
    box-sizing: border-box;
}

/* ════════════════════════════════════════════════════════════
 * NAV PREMIUM LAYER — next-gen visual polish
 * ════════════════════════════════════════════════════════════
 *
 * Loaded after nav.css by mountShell(). Strip this file to roll
 * back to the baseline shell while keeping all the structure.
 *
 * Themes: depth, glow, motion, micro-feedback. Every interactive
 * element has a hover state, a press state, and a subtle resting
 * animation so the app never feels static.
 *
 * Design tokens reused from portal.css :root.
 * Respects prefers-reduced-motion (portal.css line ~48 strips
 * every transition + animation when the OS flag is set).
 */

/* ── Body backdrop: living mesh + film grain ─────────────── */
/* A pair of slow-shifting radial blooms below the page content
   gives a sense of breathing depth without distracting from
   foreground UI. The grain layer is pure CSS noise via SVG-as-
   data-URI — no extra HTTP request. */
body.nx-shell-mounted::before {
    content: "";
    position: fixed;
    inset: -10%;
    /* z-index: -1 puts the ambient gradient BEHIND in-flow content
       without forcing every body child to be position:relative
       (the previous approach broke the .orb decorations which
       relied on their original absolute positioning). */
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(800px 500px at 88% -10%,
            rgba(99, 102, 241, 0.16) 0%, transparent 55%),
        radial-gradient(900px 600px at -8% 105%,
            rgba(56, 189, 248, 0.12) 0%, transparent 55%),
        radial-gradient(600px 400px at 50% 50%,
            rgba(168, 85, 247, 0.05) 0%, transparent 60%);
    animation: nxBgDrift 22s ease-in-out infinite alternate;
    will-change: transform;
}
@keyframes nxBgDrift {
    0%   { transform: translate(0, 0)        scale(1.0); }
    50%  { transform: translate(-30px, 10px) scale(1.03); }
    100% { transform: translate(20px, -15px) scale(1.02); }
}
body.nx-shell-mounted::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.04;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1 0'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
    background-size: 160px 160px;
}
/* Body needs an isolating stacking context so the z-index: -1
   pseudos sit behind body's own content but above the html
   default background. Without this, z-index: -1 escapes the
   body and gets painted under the html element. */
body.nx-shell-mounted { isolation: isolate; }

/* ── Top nav: gradient hairline + animated shimmer ───────── */
.nx-topbar {
    background:
        radial-gradient(1400px 120px at 50% -20%,
            rgba(14, 165, 233, 0.12) 0%, transparent 60%),
        linear-gradient(180deg,
            rgba(11, 13, 18, 0.92) 0%,
            rgba(8, 10, 15, 0.88) 100%);
    backdrop-filter: blur(22px) saturate(180%);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    border-bottom: 1px solid transparent;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.04) inset,
        0 8px 24px -16px rgba(0, 0, 0, 0.6);
    animation: nxTopbarEnter 420ms cubic-bezier(.2,.9,.25,1.05) both;
}
@keyframes nxTopbarEnter {
    from { transform: translateY(-12px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
.nx-topbar::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(56, 189, 248, 0.30) 25%,
        rgba(99, 102, 241, 0.30) 50%,
        rgba(168, 85, 247, 0.30) 75%,
        transparent 100%);
    background-size: 200% 100%;
    animation: nxHairlineShimmer 8s linear infinite;
    pointer-events: none;
}
@keyframes nxHairlineShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.nx-topbar-brand img {
    transition: filter 250ms cubic-bezier(.2,.9,.25,1),
                transform 250ms cubic-bezier(.2,.9,.25,1);
    filter: drop-shadow(0 2px 12px rgba(56, 189, 248, 0.20));
}
.nx-topbar-brand:hover img {
    filter: drop-shadow(0 4px 20px rgba(56, 189, 248, 0.45))
            drop-shadow(0 0 8px rgba(99, 102, 241, 0.35));
    transform: scale(1.04) rotate(-1deg);
}

/* ── Tab cluster: liquid pill + breathe + spring transitions */
.nx-tabs {
    position: relative;
    background:
        linear-gradient(180deg,
            rgba(255, 255, 255, 0.07) 0%,
            rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 2px 4px rgba(0, 0, 0, 0.20),
        0 1px 0 rgba(0, 0, 0, 0.30);
}

.nx-tab {
    transition:
        background 220ms cubic-bezier(.2,.9,.25,1),
        color 220ms cubic-bezier(.2,.9,.25,1),
        transform 200ms cubic-bezier(.34,1.56,.64,1),
        box-shadow 220ms cubic-bezier(.2,.9,.25,1);
}
.nx-tab:hover:not(.is-active) {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.07);
    transform: translateY(-1px);
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.12);
}
.nx-tab:active { transform: translateY(0) scale(0.97); }

.nx-tab.is-active {
    background:
        linear-gradient(180deg,
            rgba(56, 189, 248, 0.22) 0%,
            rgba(99, 102, 241, 0.10) 100%);
    color: #7dd3fc;
    box-shadow:
        0 0 0 1px rgba(56, 189, 248, 0.30),
        0 6px 22px rgba(56, 189, 248, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        inset 0 -1px 0 rgba(99, 102, 241, 0.18);
    text-shadow:
        0 0 12px rgba(125, 211, 252, 0.50),
        0 0 24px rgba(56, 189, 248, 0.30);
    animation: nxTabBreathe 4.5s ease-in-out infinite;
}
@keyframes nxTabBreathe {
    0%, 100% {
        box-shadow:
            0 0 0 1px rgba(56, 189, 248, 0.30),
            0 6px 22px rgba(56, 189, 248, 0.28),
            inset 0 1px 0 rgba(255, 255, 255, 0.18),
            inset 0 -1px 0 rgba(99, 102, 241, 0.18);
    }
    50% {
        box-shadow:
            0 0 0 1px rgba(56, 189, 248, 0.42),
            0 8px 32px rgba(56, 189, 248, 0.42),
            inset 0 1px 0 rgba(255, 255, 255, 0.22),
            inset 0 -1px 0 rgba(99, 102, 241, 0.22);
    }
}

/* ── Search trigger: depth + spring ──────────────────────── */
.nx-search-trigger {
    background:
        linear-gradient(180deg,
            rgba(255, 255, 255, 0.06) 0%,
            rgba(255, 255, 255, 0.02) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 2px 4px rgba(0, 0, 0, 0.15);
    transition:
        background 220ms cubic-bezier(.2,.9,.25,1),
        border-color 220ms cubic-bezier(.2,.9,.25,1),
        transform 180ms cubic-bezier(.34,1.56,.64,1),
        box-shadow 220ms cubic-bezier(.2,.9,.25,1);
}
.nx-search-trigger:hover {
    background:
        linear-gradient(180deg,
            rgba(56, 189, 248, 0.10) 0%,
            rgba(99, 102, 241, 0.04) 100%);
    border-color: rgba(56, 189, 248, 0.35);
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 6px 16px rgba(56, 189, 248, 0.18);
    color: #cbd5e1;
}
.nx-search-trigger:active { transform: translateY(0) scale(0.98); }
.nx-search-kbd {
    background:
        linear-gradient(180deg,
            rgba(255, 255, 255, 0.10) 0%,
            rgba(255, 255, 255, 0.04) 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ── Avatar: tri-stop gradient + magnetic hover ────────── */
.nx-avatar {
    background:
        radial-gradient(circle at 30% 25%,
            rgba(255, 255, 255, 0.30) 0%, transparent 45%),
        linear-gradient(135deg, #0ea5e9 0%, #6366f1 50%, #a855f7 100%);
    box-shadow:
        0 2px 14px rgba(14, 165, 233, 0.32),
        0 0 0 0 rgba(168, 85, 247, 0.40),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transition:
        transform 250ms cubic-bezier(.34,1.56,.64,1),
        box-shadow 250ms cubic-bezier(.2,.9,.25,1);
}
.nx-avatar:hover {
    transform: scale(1.10) rotate(-3deg);
    box-shadow:
        0 6px 24px rgba(14, 165, 233, 0.50),
        0 0 0 4px rgba(168, 85, 247, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.nx-avatar:active { transform: scale(1.02); }

/* ── Sub-nav: glow underline that draws in ───────────────── */
.nx-subnav-pill {
    transition:
        background 200ms cubic-bezier(.2,.9,.25,1),
        color 200ms cubic-bezier(.2,.9,.25,1),
        transform 180ms cubic-bezier(.34,1.56,.64,1),
        box-shadow 200ms cubic-bezier(.2,.9,.25,1);
}
.nx-subnav-pill:hover:not(.is-active) {
    transform: translateY(-1px);
    color: #e2e8f0;
}
.nx-subnav-pill.is-active {
    background:
        linear-gradient(180deg,
            rgba(56, 189, 248, 0.18) 0%,
            rgba(99, 102, 241, 0.06) 100%);
    box-shadow:
        0 0 0 1px rgba(56, 189, 248, 0.20),
        0 4px 14px rgba(56, 189, 248, 0.22);
}
.nx-subnav-pill.is-active::after {
    content: "";
    position: absolute;
    left: 12px; right: 12px; bottom: -10px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #38bdf8, #6366f1, transparent);
    border-radius: 2px;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.55);
    animation: nxIndicatorIn 320ms cubic-bezier(.2,.9,.25,1.05) both;
}
@keyframes nxIndicatorIn {
    from { opacity: 0; transform: scaleX(0.2); }
    to   { opacity: 1; transform: scaleX(1); }
}

/* Sidebar (Conocimiento): glowing left edge on active item */
.nx-sidebar-link {
    transition:
        background 200ms cubic-bezier(.2,.9,.25,1),
        color 200ms cubic-bezier(.2,.9,.25,1),
        padding-left 200ms cubic-bezier(.34,1.56,.64,1);
}
.nx-sidebar-link:hover:not(.is-active) {
    padding-left: 16px;
    color: #e2e8f0;
}
.nx-sidebar-link.is-active {
    background:
        linear-gradient(90deg,
            rgba(56, 189, 248, 0.18) 0%,
            rgba(99, 102, 241, 0.04) 100%);
}
.nx-sidebar-link.is-active::before {
    content: "";
    position: absolute;
    left: -12px; top: 6px; bottom: 6px;
    width: 3px;
    background: linear-gradient(180deg, #0ea5e9, #6366f1, #a855f7);
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.7);
}

/* ── Bottom tab bar mobile: ambient glow + spring icon ─── */
@media (max-width: 767px) {
    .nx-bottombar {
        background:
            radial-gradient(800px 80px at 50% 120%,
                rgba(14, 165, 233, 0.14) 0%, transparent 60%),
            linear-gradient(180deg,
                rgba(8, 10, 15, 0.95) 0%,
                rgba(11, 13, 18, 0.98) 100%);
        backdrop-filter: blur(28px) saturate(200%);
        -webkit-backdrop-filter: blur(28px) saturate(200%);
        animation: nxTopbarEnter 420ms cubic-bezier(.2,.9,.25,1.05) both;
        box-shadow: 0 -8px 24px -16px rgba(0, 0, 0, 0.6);
    }
    .nx-bottom-tab {
        transition:
            color 200ms cubic-bezier(.2,.9,.25,1),
            transform 200ms cubic-bezier(.34,1.56,.64,1);
    }
    .nx-bottom-tab.is-active {
        transform: translateY(-2px);
    }
    .nx-bottom-tab.is-active::before {
        content: "";
        position: absolute;
        top: 0; left: 30%; right: 30%;
        height: 3px;
        background: linear-gradient(90deg, #0ea5e9, #6366f1, #a855f7);
        border-radius: 0 0 3px 3px;
        box-shadow: 0 0 14px rgba(56, 189, 248, 0.7);
    }
    .nx-bottom-tab.is-active svg {
        filter: drop-shadow(0 0 12px rgba(56, 189, 248, 0.6));
        animation: nxBottomIconPop 320ms cubic-bezier(.34,1.56,.64,1);
    }
    @keyframes nxBottomIconPop {
        0%   { transform: scale(1); }
        50%  { transform: scale(1.18); }
        100% { transform: scale(1); }
    }
}

/* ── Chat FAB: living gradient + ring pulse + tilt ──────── */
.nx-chat-fab {
    background:
        radial-gradient(circle at 30% 25%,
            rgba(255, 255, 255, 0.30) 0%, transparent 55%),
        conic-gradient(from 0deg at 50% 50%,
            #0ea5e9 0%,
            #6366f1 33%,
            #a855f7 66%,
            #0ea5e9 100%);
    background-size: 100% 100%, 200% 200%;
    box-shadow:
        0 6px 28px rgba(14, 165, 233, 0.40),
        0 0 0 0 rgba(56, 189, 248, 0.50),
        inset 0 2px 0 rgba(255, 255, 255, 0.30),
        inset 0 -2px 4px rgba(99, 102, 241, 0.30);
    transition:
        transform 220ms cubic-bezier(.34,1.56,.64,1),
        box-shadow 220ms cubic-bezier(.2,.9,.25,1);
    animation:
        nxFabBreathe 3.4s ease-in-out infinite,
        nxFabRotate 14s linear infinite;
}
@keyframes nxFabBreathe {
    0%, 100% {
        box-shadow:
            0 6px 28px rgba(14, 165, 233, 0.40),
            0 0 0 0 rgba(56, 189, 248, 0.40),
            inset 0 2px 0 rgba(255, 255, 255, 0.30),
            inset 0 -2px 4px rgba(99, 102, 241, 0.30);
    }
    50% {
        box-shadow:
            0 8px 36px rgba(14, 165, 233, 0.55),
            0 0 0 14px rgba(56, 189, 248, 0.0),
            inset 0 2px 0 rgba(255, 255, 255, 0.32),
            inset 0 -2px 4px rgba(99, 102, 241, 0.30);
    }
}
@keyframes nxFabRotate {
    from { background-position: 0% 50%, 0% 50%; }
    to   { background-position: 0% 50%, 200% 50%; }
}
.nx-chat-fab:hover {
    transform: scale(1.10) rotate(-4deg);
    box-shadow:
        0 12px 40px rgba(14, 165, 233, 0.60),
        0 0 0 6px rgba(168, 85, 247, 0.20),
        inset 0 2px 0 rgba(255, 255, 255, 0.40);
    animation: nxFabRotate 8s linear infinite;
}
.nx-chat-fab:active { transform: scale(0.96); }
.nx-chat-fab svg {
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.30));
    transition: transform 200ms cubic-bezier(.34,1.56,.64,1);
}
.nx-chat-fab:hover svg { transform: rotate(-8deg) scale(1.08); }

/* ── Status pill: shimmer border + iridescent gradient ──── */
.nx-status-pill {
    background:
        linear-gradient(180deg,
            rgba(255, 255, 255, 0.07) 0%,
            rgba(255, 255, 255, 0.02) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 6px 18px rgba(0, 0, 0, 0.25);
    transition:
        background 220ms cubic-bezier(.2,.9,.25,1),
        border-color 220ms cubic-bezier(.2,.9,.25,1),
        transform 180ms cubic-bezier(.34,1.56,.64,1);
}
.nx-status-pill::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 20px;
    padding: 1px;
    background: linear-gradient(135deg,
        rgba(56, 189, 248, 0.30) 0%,
        rgba(99, 102, 241, 0.20) 50%,
        rgba(168, 85, 247, 0.25) 100%);
    background-size: 200% 200%;
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
    opacity: 0.7;
    animation: nxBorderShimmer 6s ease-in-out infinite;
}
@keyframes nxBorderShimmer {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}
.nx-status-pill:hover {
    transform: translateY(-2px);
    background:
        linear-gradient(180deg,
            rgba(56, 189, 248, 0.10) 0%,
            rgba(255, 255, 255, 0.04) 100%);
}
.nx-status-pill:hover::before { opacity: 1; }

/* The dots: more vibrant, with ring + glow ─────────────────── */
.nx-status-dot {
    transition: background-color 320ms ease, box-shadow 320ms ease;
}
.nx-status-dot.is-ok {
    background: #22c55e;
    box-shadow:
        0 0 0 3px rgba(34, 197, 94, 0.20),
        0 0 12px rgba(34, 197, 94, 0.50);
    animation: nxStatusPulse 2.6s ease-in-out infinite;
}
@keyframes nxStatusPulse {
    0%, 100% {
        box-shadow:
            0 0 0 3px rgba(34, 197, 94, 0.20),
            0 0 12px rgba(34, 197, 94, 0.50);
    }
    50% {
        box-shadow:
            0 0 0 7px rgba(34, 197, 94, 0.05),
            0 0 18px rgba(34, 197, 94, 0.70);
    }
}

/* ── Command palette: depth + glow accent + spring ───────── */
.nx-cmdk-backdrop {
    background:
        radial-gradient(800px 600px at 50% 30%,
            rgba(56, 189, 248, 0.06) 0%, transparent 50%),
        rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px) saturate(120%);
    -webkit-backdrop-filter: blur(8px) saturate(120%);
}
.nx-cmdk-modal {
    background:
        radial-gradient(900px 240px at 50% -20%,
            rgba(56, 189, 248, 0.16) 0%, transparent 65%),
        linear-gradient(180deg,
            #0e1622 0%,
            #0a0f17 100%);
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow:
        0 32px 80px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(56, 189, 248, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    animation: nxCmdkEnter 280ms cubic-bezier(.2,.9,.25,1.05) both;
}
@keyframes nxCmdkEnter {
    from { transform: scale(0.94) translateY(-8px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}
.nx-cmdk-input {
    color: #f1f5f9;
}
.nx-cmdk-item {
    transition:
        background 140ms cubic-bezier(.2,.9,.25,1),
        color 140ms cubic-bezier(.2,.9,.25,1),
        padding-left 200ms cubic-bezier(.34,1.56,.64,1);
}
.nx-cmdk-item.is-active {
    background:
        linear-gradient(90deg,
            rgba(56, 189, 248, 0.16) 0%,
            rgba(99, 102, 241, 0.04) 100%);
    color: #fff;
    padding-left: 14px;
    box-shadow: inset 3px 0 0 #38bdf8;
    text-shadow: 0 0 12px rgba(56, 189, 248, 0.30);
}

/* ── Floating dock entry animations (one-shot on mount) ──── */
.nx-status-pill {
    animation:
        nxDockEnterLeft 480ms cubic-bezier(.2,.9,.25,1.05) 200ms both,
        nxBorderShimmer 6s ease-in-out 700ms infinite;
}
@keyframes nxDockEnterLeft {
    from { transform: translateX(-16px) scale(0.9); opacity: 0; }
    to   { transform: translateX(0) scale(1); opacity: 1; }
}
.nx-chat-fab {
    animation:
        nxDockEnterRight 480ms cubic-bezier(.2,.9,.25,1.05) 250ms both,
        nxFabBreathe 3.4s ease-in-out 750ms infinite,
        nxFabRotate 14s linear 750ms infinite;
}
@keyframes nxDockEnterRight {
    from { transform: translateX(16px) scale(0.9); opacity: 0; }
    to   { transform: translateX(0) scale(1); opacity: 1; }
}

/* ── Existing card / stat / page reveal — punch up the
       defaults so the content area also feels next-gen ─── */
.card,
.stat-card {
    transition:
        transform 280ms cubic-bezier(.2,.9,.25,1),
        border-color 280ms cubic-bezier(.2,.9,.25,1),
        box-shadow 280ms cubic-bezier(.2,.9,.25,1);
}
.card:hover,
.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(56, 189, 248, 0.18);
    box-shadow:
        var(--shadow-lg),
        0 0 0 1px rgba(56, 189, 248, 0.10),
        0 12px 40px rgba(56, 189, 248, 0.10);
}

/* ── Voice-input button (added to chat composer) ─────────── */
.nx-voice-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    color: #94a3b8;
    cursor: pointer;
    transition:
        background 200ms cubic-bezier(.2,.9,.25,1),
        color 200ms cubic-bezier(.2,.9,.25,1),
        transform 180ms cubic-bezier(.34,1.56,.64,1),
        box-shadow 200ms cubic-bezier(.2,.9,.25,1);
    flex-shrink: 0;
}
.nx-voice-btn:hover {
    background: rgba(56, 189, 248, 0.10);
    color: #7dd3fc;
    border-color: rgba(56, 189, 248, 0.30);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.20);
}
.nx-voice-btn.is-recording {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border-color: rgba(239, 68, 68, 0.5);
    animation: nxRecPulse 1.1s ease-in-out infinite;
}
@keyframes nxRecPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.50); }
    50%      { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.0); }
}
.nx-voice-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}
.nx-voice-status {
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
    margin-top: 4px;
    min-height: 14px;
}
.nx-voice-status.is-recording { color: #f87171; }
.nx-voice-status.is-transcribing { color: #7dd3fc; }

/* ── Copyright footer (auto-mounted on every authed page) ─── */
.nx-footer {
    margin-top: 16px;
    padding: 12px 24px 10px;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: rgba(203, 213, 225, 0.75);
    letter-spacing: 0.04em;
    position: relative;
    z-index: 1;
}
.nx-footer::before {
    content: "";
    display: block;
    width: 120px;
    height: 2px;
    margin: 0 auto 10px;
    background: linear-gradient(90deg,
        transparent,
        rgba(56, 189, 248, 0.5),
        rgba(99, 102, 241, 0.5),
        rgba(168, 85, 247, 0.5),
        transparent);
    border-radius: 2px;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}
@media (max-width: 767px) {
    .nx-footer {
        margin-bottom: 16px;
        padding: 12px 16px 8px;
        font-size: 12px;
    }
}
/* Hide footer when chat dock is iframed (embed mode). */
body.nx-embed .nx-footer { display: none; }

/* ════════════════════════════════════════════════════════════
 * PAGE-ENTER CASCADE — staggered reveal of dashboard content
 * Visible WOW the moment the user lands on any page.
 * ════════════════════════════════════════════════════════════ */

@keyframes nxCascadeIn {
    from {
        transform: translateY(16px);
        opacity: 0;
        filter: blur(4px);
    }
    to {
        transform: translateY(0);
        opacity: 1;
        filter: blur(0);
    }
}

/* Cascade reveal applied to direct children of .page on first
   paint. Each child animates with a small staggered delay so
   the page assembles itself rather than appearing all at once. */
body.nx-shell-mounted main.page > * {
    animation: nxCascadeIn 480ms cubic-bezier(.2,.9,.25,1.05) both;
}
body.nx-shell-mounted main.page > *:nth-child(1) { animation-delay: 60ms; }
body.nx-shell-mounted main.page > *:nth-child(2) { animation-delay: 120ms; }
body.nx-shell-mounted main.page > *:nth-child(3) { animation-delay: 180ms; }
body.nx-shell-mounted main.page > *:nth-child(4) { animation-delay: 240ms; }
body.nx-shell-mounted main.page > *:nth-child(5) { animation-delay: 300ms; }
body.nx-shell-mounted main.page > *:nth-child(6) { animation-delay: 360ms; }
body.nx-shell-mounted main.page > *:nth-child(7) { animation-delay: 420ms; }
body.nx-shell-mounted main.page > *:nth-child(8) { animation-delay: 480ms; }
body.nx-shell-mounted main.page > *:nth-child(n+9) { animation-delay: 540ms; }

/* Cards inside grids cascade too — adds a second layer of motion. */
body.nx-shell-mounted .stat-grid > .stat-card,
body.nx-shell-mounted .grid-2 > *,
body.nx-shell-mounted .grid-3 > * {
    animation: nxCascadeIn 540ms cubic-bezier(.2,.9,.25,1.05) both;
}
body.nx-shell-mounted .stat-grid > .stat-card:nth-child(1),
body.nx-shell-mounted .grid-2 > *:nth-child(1),
body.nx-shell-mounted .grid-3 > *:nth-child(1) { animation-delay: 200ms; }
body.nx-shell-mounted .stat-grid > .stat-card:nth-child(2),
body.nx-shell-mounted .grid-2 > *:nth-child(2),
body.nx-shell-mounted .grid-3 > *:nth-child(2) { animation-delay: 280ms; }
body.nx-shell-mounted .stat-grid > .stat-card:nth-child(3),
body.nx-shell-mounted .grid-2 > *:nth-child(3),
body.nx-shell-mounted .grid-3 > *:nth-child(3) { animation-delay: 360ms; }
body.nx-shell-mounted .stat-grid > .stat-card:nth-child(4),
body.nx-shell-mounted .grid-2 > *:nth-child(4),
body.nx-shell-mounted .grid-3 > *:nth-child(4) { animation-delay: 440ms; }
body.nx-shell-mounted .stat-grid > .stat-card:nth-child(n+5),
body.nx-shell-mounted .grid-2 > *:nth-child(n+5),
body.nx-shell-mounted .grid-3 > *:nth-child(n+5) { animation-delay: 520ms; }

/* ════════════════════════════════════════════════════════════
 * PAGE-LEVEL HEADING — gradient sweep animation
 * Makes h1 on every page feel alive without touching content.
 * ════════════════════════════════════════════════════════════ */
body.nx-shell-mounted main.page h1 {
    background: linear-gradient(120deg,
        #f1f5f9 0%,
        #cbd5e1 25%,
        #7dd3fc 50%,
        #cbd5e1 75%,
        #f1f5f9 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: nxHeadingSheen 8s linear infinite;
}
@keyframes nxHeadingSheen {
    0%   { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

/* ════════════════════════════════════════════════════════════
 * STAT-VALUE: large numbers get a gradient + count-up vibe
 * ════════════════════════════════════════════════════════════ */
body.nx-shell-mounted .stat-value {
    background: linear-gradient(135deg, #f1f5f9 0%, #7dd3fc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    text-shadow: none;
}
body.nx-shell-mounted .stat-value.accent {
    background: linear-gradient(135deg, #38bdf8 0%, #6366f1 50%, #a855f7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ════════════════════════════════════════════════════════════
 * Cards: cursor-tracking spotlight (mouse-only, desktop)
 * ════════════════════════════════════════════════════════════ */
@media (hover: hover) and (min-width: 768px) {
    body.nx-shell-mounted .card,
    body.nx-shell-mounted .stat-card {
        position: relative;
        overflow: hidden;
    }
    body.nx-shell-mounted .card::before,
    body.nx-shell-mounted .stat-card::before {
        content: "";
        position: absolute;
        inset: 0;
        background: radial-gradient(
            500px circle at var(--mx, 50%) var(--my, 50%),
            rgba(56, 189, 248, 0.10) 0%,
            transparent 40%);
        opacity: 0;
        transition: opacity 250ms var(--ease);
        pointer-events: none;
        border-radius: inherit;
    }
    body.nx-shell-mounted .card:hover::before,
    body.nx-shell-mounted .stat-card:hover::before {
        opacity: 1;
    }
}

/* ════════════════════════════════════════════════════════════
 * TopNav brand: shimmer pass on the logo every 6s
 * ════════════════════════════════════════════════════════════ */
.nx-topbar-brand::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg,
        transparent 30%,
        rgba(255, 255, 255, 0.12) 50%,
        transparent 70%);
    animation: nxBrandShimmer 6s ease-in-out infinite;
    pointer-events: none;
    border-radius: 8px;
}
@keyframes nxBrandShimmer {
    0%, 100% { transform: translateX(-100%); }
    50%      { transform: translateX(100%); }
}

/* ════════════════════════════════════════════════════════════
 * Active tab: even more visible glow + gradient sheen
 * ════════════════════════════════════════════════════════════ */
.nx-tab.is-active {
    background:
        linear-gradient(110deg,
            rgba(14, 165, 233, 0.28) 0%,
            rgba(99, 102, 241, 0.22) 40%,
            rgba(168, 85, 247, 0.20) 80%,
            rgba(14, 165, 233, 0.28) 100%);
    background-size: 200% 100%;
    color: #ffffff;
    text-shadow:
        0 0 16px rgba(125, 211, 252, 0.65),
        0 0 32px rgba(56, 189, 248, 0.40);
    animation:
        nxTabBreathe 4.5s ease-in-out infinite,
        nxTabSheen 8s linear infinite;
}
@keyframes nxTabSheen {
    0%   { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}
