
        .theme-transition {
            transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
        }

        .adaptive-logo {
            filter: drop-shadow(0 0 4px rgba(212, 160, 23, 0.4));
            transition: filter 0.3s ease;
        }

        .landing-content .adaptive-logo {
            filter: drop-shadow(0 0 4px rgba(212, 160, 23, 0.4));
        }

        html[data-bs-theme="light"] .landing-content .adaptive-logo {
            filter: brightness(0) saturate(100%) invert(13%) sepia(94%) saturate(7482%) hue-rotate(233deg) brightness(90%) contrast(90%) drop-shadow(0 0 4px rgba(212, 160, 23, 0.4));
        }

        .card-animate {
            opacity: 1 !important;
            visibility: visible !important;
            animation: slideInUp 0.6s ease-out forwards;
        }

        .fade-in {
            opacity: 1 !important;
            visibility: visible !important;
            animation: fadeIn 0.5s ease-in forwards;
        }

        .float-animation {
            opacity: 1 !important;
            visibility: visible !important;
            animation: floatSubtle 3s ease-in-out infinite;
        }

        .pulse-animation {
            animation: pulse 2s ease-in-out infinite;
        }

        @keyframes slideInUp {
            0% { opacity: 0; transform: translateY(30px); }
            100% { opacity: 1; transform: translateY(0); }
        }

        @keyframes fadeIn {
            0% { opacity: 0; }
            100% { opacity: 1; }
        }

        @keyframes floatSubtle {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-5px); }
        }

        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.7; }
        }

        .stats-card {
            opacity: 1 !important;
            visibility: visible !important;
            display: block !important;
        }

        /* ─── Global Platform Sidebar ─────────────────────── */

        @media (min-width: 992px) {
            body.has-sidebar { overflow: hidden; }
        }

        /* Mobile top bar */
        .gp-topbar {
            height: 52px;
            background: #0d1f35;
            border-bottom: 1px solid rgba(255,255,255,0.06);
            display: flex;
            align-items: center;
            padding: 0 1rem;
            gap: 0.75rem;
            position: sticky;
            top: 0;
            z-index: 300;
        }
        .gp-topbar-toggle {
            background: none;
            border: none;
            color: #94a3b8;
            cursor: pointer;
            padding: 0.3rem;
            border-radius: 6px;
            display: flex;
            align-items: center;
            transition: background 0.15s, color 0.15s;
        }
        .gp-topbar-toggle:hover { background: rgba(255,255,255,0.07); color: #e2e8f0; }
        .gp-topbar-brand {
            display: flex;
            align-items: center;
            gap: 0.6rem;
            font-weight: 700;
            color: #f1f5f9;
            font-size: 0.95rem;
            text-decoration: none;
        }

        /* App layout */
        .gp-app {
            display: flex;
            height: 100vh;
            overflow: hidden;
        }

        /* Sidebar */
        .gp-sidebar {
            width: 280px;
            min-width: 280px;
            height: 100vh;
            background: #0d1f35;
            border-right: 1px solid rgba(255,255,255,0.06);
            display: flex;
            flex-direction: column;
            position: sticky;
            top: 0;
            overflow-y: auto;
            overflow-x: hidden;
            z-index: 200;
            transition: width 0.25s ease, min-width 0.25s ease;
            flex-shrink: 0;
        }

        .gp-sidebar-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 1.1rem 1rem 0.8rem;
            flex-shrink: 0;
            border-bottom: 1px solid rgba(255,255,255,0.05);
            gap: 0.5rem;
        }
        .gp-brand {
            display: flex;
            align-items: center;
            gap: 0.6rem;
            text-decoration: none;
            overflow: hidden;
            min-width: 0;
        }
        .gp-brand-name {
            font-size: 1.05rem;
            font-weight: 700;
            color: #f1f5f9;
            white-space: nowrap;
            overflow: hidden;
        }
        .gp-collapse-btn {
            background: none;
            border: none;
            color: #475569;
            cursor: pointer;
            padding: 0.25rem;
            border-radius: 4px;
            flex-shrink: 0;
            display: none;
            align-items: center;
            transition: color 0.15s, background 0.15s;
        }
        .gp-collapse-btn:hover { color: #94a3b8; background: rgba(255,255,255,0.07); }

        .gp-sidebar-collapse-row {
            display: none;
            align-items: center;
            justify-content: flex-end;
            padding: 0.4rem 0.75rem 0.4rem 0.75rem;
            border-top: 1px solid rgba(255,255,255,0.06);
        }
        .gp-sidebar-collapse-row button {
            background: none;
            border: none;
            color: #475569;
            cursor: pointer;
            padding: 0.3rem 0.4rem;
            border-radius: 5px;
            display: flex;
            align-items: center;
            gap: 0.4rem;
            font-size: 11px;
            transition: color 0.15s, background 0.15s;
            white-space: nowrap;
        }
        .gp-sidebar-collapse-row button:hover { color: #94a3b8; background: rgba(255,255,255,0.07); }
        .gp-sidebar-collapse-row .cr-label { opacity: 0.7; }
        /* collapsed state: center the button, hide label */
        .gp-sidebar.collapsed .gp-sidebar-collapse-row { justify-content: center; }
        .gp-sidebar.collapsed .gp-sidebar-collapse-row .cr-label { display: none; }
        /* icon switching via CSS */
        .gp-sidebar-collapse-row .cr-icon-collapse { display: flex; }
        .gp-sidebar-collapse-row .cr-icon-expand   { display: none;  }
        .gp-sidebar.collapsed .gp-sidebar-collapse-row .cr-icon-collapse { display: none;  }
        .gp-sidebar.collapsed .gp-sidebar-collapse-row .cr-icon-expand   { display: flex;  }

        .gp-nav {
            flex: 1;
            overflow-y: auto;
            overflow-x: hidden;
            padding: 0.5rem 0;
        }

        .gp-nav-link {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            padding: 0.45rem 0.75rem;
            margin: 0.05rem 0.5rem;
            border-radius: 6px;
            font-size: 1.07rem;
            font-weight: 500;
            color: #94a3b8;
            text-decoration: none;
            transition: background 0.15s, color 0.15s;
            white-space: nowrap;
            overflow: hidden;
        }
        .gp-nav-link:hover { background: rgba(255,255,255,0.05); color: #e2e8f0; text-decoration: none; }
        .gp-nav-link.active {
            background: rgba(212,160,23,0.12);
            color: #d4a017;
            border-left: 2px solid #d4a017;
            padding-left: calc(0.75rem - 2px);
        }
        .gp-nav-link.sub.active {
            padding-left: calc(2.5rem - 2px);
        }
        .gp-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.7; }
        .gp-nav-link.active .gp-icon,
        .gp-section-toggle.has-active .gp-icon { opacity: 1; color: #d4a017; }
        .gp-section-toggle.has-active {
            background: rgba(212,160,23,0.06);
            border-left: 2px solid rgba(212,160,23,0.4);
            padding-left: calc(0.75rem - 2px);
        }
        .gp-nav-label { overflow: hidden; white-space: nowrap; flex: 1; min-width: 0; }

        .gp-nav-link.sub {
            padding: 0.35rem 0.75rem 0.35rem 2.5rem;
            font-size: 1.0rem;
            margin: 0.03rem 0.5rem;
        }

        .gp-nav-divider {
            font-size: 0.78rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            color: #334155;
            padding: 0.9rem 1.25rem 0.25rem;
            white-space: nowrap;
            overflow: hidden;
        }

        .gp-nav-section { margin: 0; }
        .gp-section-toggle {
            width: calc(100% - 1rem);
            display: flex;
            align-items: center;
            gap: 0.75rem;
            padding: 0.45rem 0.75rem;
            margin: 0.05rem 0.5rem;
            background: none;
            border: none;
            border-radius: 6px;
            font-size: 1.07rem;
            font-weight: 500;
            color: #94a3b8;
            cursor: pointer;
            text-align: left;
            transition: background 0.15s, color 0.15s;
            overflow: hidden;
            white-space: nowrap;
        }
        .gp-section-toggle:hover { background: rgba(255,255,255,0.05); color: #e2e8f0; }
        .gp-section-toggle.has-active { color: #d4a017; }
        .gp-section-chevron {
            width: 13px;
            height: 13px;
            flex-shrink: 0;
            margin-left: auto;
            opacity: 0.35;
            transition: transform 0.2s ease;
        }
        .gp-section-toggle.open .gp-section-chevron { transform: rotate(90deg); }
        .gp-section-items { display: none; }
        .gp-section-items.open { display: block; }

        .gp-sidebar-footer {
            border-top: 1px solid rgba(255,255,255,0.06);
            padding: 0.875rem 1rem;
            flex-shrink: 0;
            overflow: hidden;
        }
        .gp-user-chip {
            display: flex;
            align-items: center;
            gap: 0.65rem;
            margin-bottom: 0.55rem;
            overflow: hidden;
        }
        .gp-user-avatar {
            width: 30px;
            height: 30px;
            border-radius: 50%;
            background: rgba(212,160,23,0.15);
            border: 1px solid rgba(212,160,23,0.3);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.7rem;
            font-weight: 700;
            color: #d4a017;
            flex-shrink: 0;
        }
        .gp-user-name { font-size: 0.95rem; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; }
        .gp-user-role { font-size: 0.82rem; color: #64748b; white-space: nowrap; overflow: hidden; }
        /* User footer toggle */
        .gp-user-chip { cursor: pointer; user-select: none; }
        .gp-user-chip:hover { opacity: 0.9; }
        .gp-user-chevron {
            width: 14px; height: 14px; flex-shrink: 0;
            color: #475569;
            transition: transform 0.2s ease;
            margin-left: auto;
        }
        .gp-user-chip.open .gp-user-chevron { transform: rotate(180deg); }
        .gp-user-actions {
            display: none;
            flex-direction: column;
            gap: 0;
            padding-top: 0.25rem;
        }
        .gp-user-actions.open { display: flex; }
        .gp-user-action-link {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.28rem 0.4rem;
            border-radius: 5px;
            font-size: 0.9rem;
            color: #64748b;
            text-decoration: none;
            transition: background 0.15s, color 0.15s;
            white-space: nowrap;
            overflow: hidden;
        }
        .gp-user-action-link:hover { background: rgba(255,255,255,0.05); color: #e2e8f0; text-decoration: none; }
        .gp-user-action-link svg { width: 13px; height: 13px; flex-shrink: 0; }
        .gp-user-action-link.danger { color: #f87171; }
        .gp-user-action-link.danger:hover { background: rgba(248,113,113,0.1); color: #fca5a5; }

        /* Main content area */
        .gp-main {
            flex: 1;
            min-width: 0;
            height: 100vh;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            background: #0c1829;
        }

        /* Sidebar overlay (mobile) */
        .gp-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.6);
            z-index: 199;
        }
        .gp-overlay.open { display: block; }

        /* ─── Collapsed state (desktop) ─────────────────── */
        .gp-sidebar.collapsed { width: 52px; min-width: 52px; }
        .gp-sidebar.collapsed .gp-brand-name,
        .gp-sidebar.collapsed .gp-nav-label,
        .gp-sidebar.collapsed .gp-nav-divider,
        .gp-sidebar.collapsed .gp-user-name,
        .gp-sidebar.collapsed .gp-user-role,
        .gp-sidebar.collapsed .gp-user-actions,
        .gp-sidebar.collapsed .gp-user-chevron,
        .gp-sidebar.collapsed .gp-section-items,
        .gp-sidebar.collapsed .gp-section-chevron,
        .gp-sidebar.collapsed .badge { display: none !important; }
        .gp-sidebar.collapsed .gp-sidebar-header { padding: 0.75rem 0.25rem; justify-content: center; flex-direction: column; gap: 0.4rem; align-items: center; }
        .gp-sidebar.collapsed .gp-brand { justify-content: center; width: 100%; }
        .gp-sidebar.collapsed .gp-brand img { flex-shrink: 0; width: 30px; height: 30px; object-fit: contain; }
        .gp-sidebar.collapsed .gp-nav-link,
        .gp-sidebar.collapsed .gp-section-toggle { justify-content: center; padding: 0.45rem 0; margin: 0.05rem 0.35rem; gap: 0; }
        .gp-sidebar.collapsed .gp-section-toggle { width: calc(100% - 0.7rem); }
        .gp-sidebar.collapsed .gp-sidebar-footer { padding: 0.75rem 0; }
        .gp-sidebar.collapsed .gp-user-chip { justify-content: center; margin-bottom: 0; }
        .gp-sidebar.collapsed .gp-icon { opacity: 0.8; }

        /* Show collapse button on desktop */
        @media (min-width: 992px) {
            .gp-collapse-btn { display: flex; }
            .gp-sidebar-collapse-row { display: flex; }
        }

        /* ─── Page Transition Loader ─────────────────────── */
        #gp-page-loader {
            position: fixed;
            inset: 0;
            z-index: 9999;
            background: #0d1f35;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            gap: 1.5rem;
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.18s ease, visibility 0.18s ease;
            pointer-events: none;
        }
        #gp-page-loader.visible {
            opacity: 1;
            visibility: visible;
            pointer-events: all;
        }
        #gp-page-loader.hiding {
            opacity: 0;
            visibility: hidden;
        }
        .gp-loader-logo {
            width: 80px;
            height: 80px;
            object-fit: contain;
            animation: gp-logo-pulse 1.6s ease-in-out infinite alternate;
            filter: drop-shadow(0 0 12px rgba(212,160,23,0.5));
        }
        .gp-loader-dots {
            display: flex;
            gap: 6px;
        }
        .gp-loader-dots span {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: rgba(212,160,23,0.6);
            animation: gp-dot-bounce 1.2s ease-in-out infinite;
        }
        .gp-loader-dots span:nth-child(2) { animation-delay: 0.2s; }
        .gp-loader-dots span:nth-child(3) { animation-delay: 0.4s; }
        @keyframes gp-logo-pulse {
            0%   { transform: scale(0.92); filter: drop-shadow(0 0 8px rgba(212,160,23,0.3)); }
            100% { transform: scale(1.06); filter: drop-shadow(0 0 22px rgba(212,160,23,0.75)); }
        }
        @keyframes gp-dot-bounce {
            0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
            40%            { transform: scale(1.2); opacity: 1; }
        }

        /* ─── Light Mode Overrides (applied via data-bs-theme on <html>, set before body renders — no flash) ─── */
        html[data-bs-theme="light"] .gp-topbar {
            background: #ffffff;
            border-bottom: 1px solid #e2e8f0;
        }
        html[data-bs-theme="light"] .gp-topbar-toggle { color: #374151; }
        html[data-bs-theme="light"] .gp-topbar-toggle:hover { background: rgba(0,0,0,0.05); color: #1e3a8a; }
        html[data-bs-theme="light"] .gp-topbar-brand { color: #1e3a8a; }

        html[data-bs-theme="light"] .gp-sidebar {
            background: #f8fafc;
            border-right: 1px solid #e2e8f0;
        }
        html[data-bs-theme="light"] .gp-sidebar-header { border-bottom: 1px solid #e2e8f0; }
        html[data-bs-theme="light"] .gp-brand-name { color: #1e3a8a; }

        html[data-bs-theme="light"] .gp-nav-divider { color: #94a3b8; }

        html[data-bs-theme="light"] .gp-nav-link { color: #475569; }
        html[data-bs-theme="light"] .gp-nav-link:hover { background: rgba(30,58,138,0.06); color: #1e3a8a; }
        html[data-bs-theme="light"] .gp-nav-link.active {
            background: rgba(212,160,23,0.12);
            color: #92680f;
            border-left-color: #d4a017;
        }
        html[data-bs-theme="light"] .gp-nav-link.active .gp-icon { color: #d4a017; opacity: 1; }

        html[data-bs-theme="light"] .gp-section-toggle { color: #475569; }
        html[data-bs-theme="light"] .gp-section-toggle:hover { background: rgba(30,58,138,0.06); color: #1e3a8a; }
        html[data-bs-theme="light"] .gp-section-toggle.has-active {
            color: #92680f;
            background: rgba(212,160,23,0.08);
            border-left-color: rgba(212,160,23,0.4);
        }
        html[data-bs-theme="light"] .gp-section-toggle.has-active .gp-icon { color: #d4a017; }
        html[data-bs-theme="light"] .gp-section-chevron { color: #94a3b8; }

        html[data-bs-theme="light"] .gp-sidebar-footer { border-top: 1px solid #e2e8f0; }
        html[data-bs-theme="light"] .gp-user-name { color: #1e293b; }
        html[data-bs-theme="light"] .gp-user-role { color: #64748b; }
        html[data-bs-theme="light"] .gp-user-avatar {
            background: rgba(212,160,23,0.1);
            border-color: rgba(212,160,23,0.25);
        }
        html[data-bs-theme="light"] .gp-user-chevron { color: #94a3b8; }
        html[data-bs-theme="light"] .gp-user-action-link { color: #64748b; }
        html[data-bs-theme="light"] .gp-user-action-link:hover { background: rgba(0,0,0,0.04); color: #1e293b; }
        html[data-bs-theme="light"] .gp-user-action-link.danger { color: #dc2626; }
        html[data-bs-theme="light"] .gp-user-action-link.danger:hover { background: rgba(220,38,38,0.06); color: #b91c1c; }

        html[data-bs-theme="light"] .gp-collapse-btn { color: #94a3b8; }
        html[data-bs-theme="light"] .gp-collapse-btn:hover { background: rgba(0,0,0,0.05); color: #475569; }
        html[data-bs-theme="light"] .gp-sidebar-collapse-row { border-top-color: #e2e8f0; }
        html[data-bs-theme="light"] .gp-sidebar-collapse-row button { color: #94a3b8; }
        html[data-bs-theme="light"] .gp-sidebar-collapse-row button:hover { background: rgba(0,0,0,0.05); color: #475569; }

        html[data-bs-theme="light"] .gp-main { background: #f1f5f9; }

        html[data-bs-theme="light"] .gp-main > footer {
            background: #ffffff !important;
            border-top: 1px solid #e2e8f0 !important;
            color: #64748b;
        }

        html[data-bs-theme="light"] #gp-page-loader { background: #f8fafc; }
        html[data-bs-theme="light"] .gp-loader-dots span { background: rgba(212,160,23,0.5); }

        /* Light mode body background — prevents the brief dark flash on light-mode page loads */
        html[data-bs-theme="light"] body { background-color: #f8f9fa !important; color: #374151 !important; }

        /* ─── Mobile overrides ───────────────────────────── */
        @media (max-width: 991.98px) {
            .gp-app { display: block; height: auto; overflow: visible; }
            body.has-sidebar { overflow: auto; }
            .gp-sidebar {
                position: fixed;
                top: 52px;
                left: 0;
                transform: translateX(-100%);
                height: calc(100vh - 52px);
                z-index: 200;
                width: 280px !important;
                min-width: 280px !important;
                transition: transform 0.25s ease !important;
            }
            .gp-sidebar.open { transform: translateX(0); }
            .gp-sidebar.collapsed .gp-brand-name,
            .gp-sidebar.collapsed .gp-nav-label,
            .gp-sidebar.collapsed .gp-nav-divider,
            .gp-sidebar.collapsed .gp-user-name,
            .gp-sidebar.collapsed .gp-user-role,
            .gp-sidebar.collapsed .gp-user-actions,
            .gp-sidebar.collapsed .gp-section-chevron,
            .gp-sidebar.collapsed .badge { display: revert !important; }
            .gp-sidebar.collapsed .gp-section-items { display: none !important; }
            .gp-sidebar.collapsed .gp-section-items.open { display: block !important; }
            .gp-sidebar.collapsed .gp-sidebar-header { padding: 1.1rem 1rem 0.8rem; justify-content: space-between; flex-direction: row; align-items: center; }
            .gp-sidebar.collapsed .gp-brand { justify-content: flex-start; width: auto; }
            .gp-sidebar.collapsed .gp-nav-link,
            .gp-sidebar.collapsed .gp-section-toggle { justify-content: flex-start; padding: 0.45rem 0.75rem; margin: 0.05rem 0.5rem; gap: 0.75rem; }
            .gp-sidebar.collapsed .gp-section-toggle { width: calc(100% - 1rem); }
            .gp-sidebar.collapsed .gp-sidebar-footer { padding: 0.875rem 1rem; }
            .gp-sidebar.collapsed .gp-user-chip { justify-content: flex-start; margin-bottom: 0.55rem; }
            .gp-main { height: auto; min-height: calc(100vh - 52px); }
        }

/* ===== Styles formerly in base.html second inline block ===== */
.mention-tag {
            display: inline-block;
            background: rgba(165,180,252,0.18);
            color: #a5b4fc;
            font-weight: 700;
            padding: 0 0.25em;
            border-radius: 4px;
            font-size: 0.95em;
        }
        .mention-dropdown {
            position: fixed;
            z-index: 9999;
            background: #1e293b;
            border: 1px solid rgba(255,255,255,0.12);
            border-radius: 8px;
            box-shadow: 0 8px 24px rgba(0,0,0,0.5);
            min-width: 170px;
            max-height: 200px;
            overflow-y: auto;
            display: none;
        }
        .mention-dropdown-item {
            padding: 0.45rem 0.85rem;
            font-size: 0.82rem;
            color: #cbd5e1;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 0.4rem;
        }
        .mention-dropdown-item:hover,
        .mention-dropdown-item.active {
            background: rgba(165,180,252,0.18);
            color: #a5b4fc;
        }
        .mention-dropdown-item .mention-at { color: #a5b4fc; font-weight: 700; }
