﻿        /* ===== Internal page top bar (logo | portal badge | quick actions) =====
   Sits OUTSIDE #licenseDetails card and is sticky â€” stays visible on scroll. */
        #appHeader {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            width: 100%;
            z-index: 50;
            background: rgba(11, 14, 23, 0.78);
            backdrop-filter: blur(20px) saturate(180%);
            -webkit-backdrop-filter: blur(20px) saturate(180%);
            border-bottom: 1px solid rgba(255, 255, 255, 0.08);
            padding: 14px 28px;
            margin: 0;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
        }

        #appHeader.hidden {
            display: none;
        }

        #appHeader .internal-topbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
            padding: 0;
            margin-bottom: 0;
            border-bottom: none;
            flex-wrap: nowrap;
            max-width: 1400px;
            margin: 0 auto;
        }

        /* ===== App header responsive ===== */

        /* Tablet & below (â‰¤900px): force vertical stack into 2 rows (logo+badge / buttons) */
        @media (max-width: 900px) {
            #appHeader {
                padding: 12px 16px;
            }

            /* Switch to column layout — guaranteed vertical stacking */
            #appHeader .internal-topbar {
                flex-direction: column;
                align-items: stretch;
                gap: 0.75rem;
            }

            #appHeader .topbar-left,
            #appHeader .topbar-right {
                width: 100%;
                display: flex;
                justify-content: center;
            }

            #appHeader .topbar-left {
                gap: 0.75rem;
            }

            #appHeader .topbar-right {
                flex-wrap: wrap;
            }

            #appHeader .topbar-left .brand-logo-img {
                height: 38px;
            }

            /* Hide badge text on small screens, keep icon */
            #appHeader .portal-badge .badge-text-full {
                display: none;
            }
        }

        /* Phone (â‰¤480px): compact everything further */
        @media (max-width: 480px) {
            #appHeader {
                padding: 10px 12px;
            }

            #appHeader .topbar-left .brand-logo-img {
                height: 32px;
                max-width: 160px;
            }

            #appHeader .portal-badge {
                padding: 0.4rem 0.85rem;
                font-size: 0.78rem;
                gap: 0.4rem;
            }

            /* Show full badge text on phones too — keeps branding visible */
            #appHeader .portal-badge .badge-text-full {
                display: inline;
            }

            /* Stack buttons vertically for touch-friendly tap targets on phones */
            #appHeader .topbar-right {
                flex-direction: column;
                align-items: stretch;
                gap: 0.5rem;
            }

            #appHeader .topbar-right .quick-action-btn {
                width: 100%;
                justify-content: center;
                padding: 0.65rem 1rem;
                font-size: 0.85rem;
            }

            /* Show button text on phones — explicit user request for clear labels */
            #appHeader .topbar-right .quick-action-btn .btn-text {
                display: inline;
            }
        }

        /* body.has-app-header padding-top is applied dynamically by
           setInternalViewVisible() using header.clientHeight + 16px so the
           stacked mobile layout (logo + badge + 5 buttons) does not overlap
           the License Portal content. */

        /* Real brand logo image (when src is set) â€” transparent background */
        #appHeader .topbar-left .brand-logo-img {
            height: 46px;
            width: auto;
            max-width: 220px;
            display: block;
            object-fit: contain;
            background: transparent;
            border: none;
            border-radius: 0;
            padding: 0;
        }

        /* Hide fallback text/icon if logo image present */
        #appHeader .topbar-left .brand-logo-img[src]:not([src=""]) ~ .brand-details {
            display: none;
        }

        #appHeader .topbar-left {
            flex: 1 1 0;
            min-width: 60px;
            display: flex;
            align-items: center;
            gap: 0.85rem;
        }

        /* Inline portal badge — sits next to the logo in the same column */
        #appHeader .topbar-left .portal-badge-inline {
            flex-shrink: 0;
        }

        #appHeader .topbar-left .brand-logo {
            display: inline-flex;
            align-items: center;
            gap: 0.7rem;
            text-decoration: none;
            color: inherit;
        }

        #appHeader .topbar-left .logo-icon-wrapper {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 44px;
            height: 44px;
            border-radius: 12px;
            background: linear-gradient(135deg, #00F2FE 0%, #25AEDB 100%);
            border: 1px solid rgba(0, 242, 254, 0.45);
            box-shadow: 0 0 20px rgba(0, 242, 254, 0.45), inset 0 1px 1px rgba(255, 255, 255, 0.4);
            color: #0B0E17;
            font-size: 1.4rem;
            flex-shrink: 0;
        }

        #appHeader .topbar-left .brand-details {
            display: inline-flex;
            flex-direction: column;
            line-height: 1.1;
        }

        #appHeader .topbar-left .brand-title {
            font-size: 1.5rem;
            font-weight: 800;
            letter-spacing: 1px;
            background: linear-gradient(135deg, #FFFFFF 30%, #00F2FE 100%);
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
            color: transparent;
        }

        #appHeader .topbar-left .brand-sub {
            font-size: 0.68rem;
            font-weight: 600;
            letter-spacing: 1.5px;
            color: rgba(255, 255, 255, 0.55);
            margin-top: 2px;
        }

        #appHeader .topbar-center {
            flex: 0 1 auto;
            display: flex;
            justify-content: center;
        }

        #appHeader .topbar-right {
            flex: 1 1 0;
            display: flex;
            justify-content: flex-end;
            gap: 0.5rem;
            flex-wrap: nowrap;
            min-width: 60px;
        }

        #appHeader .portal-badge {
            display: inline-flex;
            align-items: center;
            gap: 0.4rem;
            padding: 0.38rem 0.95rem;
            background: rgba(0, 242, 254, 0.08);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border: 1px solid rgba(0, 242, 254, 0.3);
            border-radius: 999px;
            color: #00F2FE;
            font-size: 0.82rem;
            font-weight: 600;
            letter-spacing: 0.01em;
            box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1), 0 4px 16px rgba(0, 242, 254, 0.15);
        }

        /* Topbar quick action buttons (override .quick-action-btn for compact top-bar use) */
        #appHeader .topbar-right .quick-action-btn {
            display: inline-flex;
            align-items: center;
            gap: 0.45rem;
            padding: 0.5rem 1rem;
            font-size: 0.82rem;
            font-weight: 700;
            border-radius: 999px;
            text-decoration: none;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            border: 1px solid transparent;
            white-space: nowrap;
            flex-shrink: 0;
        }

        /* Variant 1: Installation Guide â€” cyan ghost (btn-guide) */
        #appHeader .topbar-right .quick-action-btn[data-key="installationGuide"] {
            background: rgba(0, 242, 254, 0.07);
            border-color: rgba(0, 242, 254, 0.35);
            color: #00F2FE;
        }
        #appHeader .topbar-right .quick-action-btn[data-key="installationGuide"]:hover {
            background: rgba(0, 242, 254, 0.2);
            border-color: #00F2FE;
            box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.25), 0 0 25px rgba(0, 242, 254, 0.45);
            transform: translateY(-2px);
            color: #FFFFFF;
        }

        /* Variant 2: Theme Updater â€” purpleâ†’emerald gradient (btn-updater) */
        #appHeader .topbar-right .quick-action-btn[data-key="themeUpdater"] {
            background: linear-gradient(135deg, rgba(139, 92, 246, 0.9) 0%, rgba(52, 211, 153, 0.9) 100%);
            color: #FFFFFF;
            box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.25);
        }
        #appHeader .topbar-right .quick-action-btn[data-key="themeUpdater"]:hover {
            transform: translateY(-2px);
            box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.4), 0 0 30px rgba(139, 92, 246, 0.6);
            color: #FFFFFF;
        }

        /* Variant 3: Academy Login â€” cyan solid gradient (btn-academy, primary CTA) */
        #appHeader .topbar-right .quick-action-btn[data-key="academyLogin"] {
            background: linear-gradient(135deg, #00F2FE 0%, #25AEDB 100%);
            color: #0B0E17;
            box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.4), 0 4px 20px rgba(0, 242, 254, 0.35);
        }
        #appHeader .topbar-right .quick-action-btn[data-key="academyLogin"]:hover {
            transform: translateY(-2px);
            box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.5), 0 0 32px rgba(0, 242, 254, 0.7);
            color: #0B0E17;
        }

        /* Pending placeholder (link not configured yet) â€” keep variant color, show amber dot */
        #appHeader .topbar-right .quick-action-btn.quick-action-pending {
            opacity: 0.75;
            border-style: dashed;
            position: relative;
        }

        #appHeader .topbar-right .quick-action-btn.quick-action-pending:hover {
            opacity: 1;
            filter: brightness(1.1);
        }

        #appHeader .topbar-right .quick-action-btn.quick-action-pending .pending-dot {
            width: 7px;
            height: 7px;
            background: #F59E0B;
            border-radius: 50%;
            margin-left: 0.3rem;
            box-shadow: 0 0 6px rgba(245, 158, 11, 0.7);
            animation: pendingPulse 1.6s ease-in-out infinite;
            flex-shrink: 0;
        }

        @keyframes pendingPulse {
            0%, 100% { opacity: 0.5; transform: scale(1); }
            50% { opacity: 1; transform: scale(1.25); }
        }

        /* Page title banner */
        #licenseDetails .page-title-banner {
            text-align: center;
            margin-bottom: 1.5rem;
            padding-bottom: 1rem;
            border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        }

        #licenseDetails .page-title-banner h2 {
            font-size: 1.55rem;
            font-weight: 700;
            margin: 0;
        }

        /* Product download cards (themes rendered by displayLicensesFromAPI) */
        #licenseDetails .product-download-card {
            background: rgba(18, 24, 39, 0.65);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 14px;
            padding: 1.1rem;
            margin-bottom: 1rem;
            transition: border-color 0.25s ease, transform 0.25s ease;
        }

        #licenseDetails .product-download-card:hover {
            border-color: rgba(0, 242, 254, 0.3);
            transform: translateY(-2px);
        }

        #licenseDetails .product-title {
            display: flex;
            align-items: center;
            gap: 0.55rem;
            font-weight: 700;
            font-size: 1rem;
            color: #FFFFFF;
            margin-bottom: 0.65rem;
        }

        #licenseDetails .product-title i {
            color: #00F2FE;
        }

        #licenseDetails .license-badge {
            font-size: 0.72rem;
            font-weight: 700;
            padding: 0.22rem 0.65rem;
            border-radius: 8px;
            margin-left: auto;
        }

        #licenseDetails .license-badge.standard {
            background: rgba(16, 185, 129, 0.15);
            color: #10B981;
            border: 1px solid rgba(16, 185, 129, 0.3);
        }

        #licenseDetails .license-badge.expired {
            background: rgba(239, 68, 68, 0.15);
            color: #EF4444;
            border: 1px solid rgba(239, 68, 68, 0.3);
        }

        /* Hide EXPIRED badge in product download cards (user request: don't show expiry status on theme title) */
        #licenseDetails .product-download-card .license-badge.expired {
            display: none;
        }

        #licenseDetails .addon-purchase-info {
            display: flex;
            gap: 0.85rem;
            flex-wrap: wrap;
            margin-bottom: 0.85rem;
            font-size: 0.82rem;
            color: rgba(255, 255, 255, 0.7);
        }

        #licenseDetails .addon-purchase-meta {
            display: flex;
            align-items: center;
            gap: 0.4rem;
        }

        #licenseDetails .versions-list {
            display: flex;
            flex-direction: column;
            gap: 0.65rem;
            margin-top: 0.65rem;
        }

        #licenseDetails .version-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 0.85rem;
            padding: 0.75rem 0.9rem;
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid rgba(255, 255, 255, 0.06);
            border-radius: 10px;
            flex-wrap: wrap;
        }

        #licenseDetails .version-info-block {
            flex: 1 1 220px;
            min-width: 0;
        }

        #licenseDetails .version-name {
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 0.4rem 0.5rem;
            font-weight: 600;
            color: #F3F4F6;
            font-size: 0.9rem;
            min-width: 0;
        }

        #licenseDetails .version-name i {
            color: #00F2FE;
        }

        /* LATEST badge â€” marks the newest version (first in sorted list) */
        #licenseDetails .badge-latest {
            display: inline-flex;
            align-items: center;
            gap: 0.3rem;
            padding: 0.22rem 0.6rem;
            margin-left: 0.25rem;
            background: linear-gradient(135deg, #10B981 0%, #059669 100%);
            color: #FFFFFF;
            font-size: 0.65rem;
            font-weight: 800;
            letter-spacing: 0.08em;
            border-radius: 6px;
            box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.3), 0 0 12px rgba(16, 185, 129, 0.45);
            text-transform: uppercase;
            flex-shrink: 0;
            white-space: nowrap;
        }

        #licenseDetails .badge-latest i {
            color: #FFFFFF;
            font-size: 0.65rem;
        }

        /* Latest version row gets a subtle highlight */
        #licenseDetails .version-item.version-item-latest {
            border-color: rgba(16, 185, 129, 0.35);
            background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
            box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.06), 0 0 16px rgba(16, 185, 129, 0.15);
        }

        #licenseDetails .version-item.version-item-latest:hover {
            border-color: rgba(16, 185, 129, 0.5);
            background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(255, 255, 255, 0.05) 100%);
        }

        #licenseDetails .version-meta {
            font-size: 0.78rem;
            color: #9CA3AF;
            margin-top: 0.25rem;
        }

        #licenseDetails .no-downloads {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 0.6rem;
            padding: 2.5rem 1rem;
            color: rgba(255, 255, 255, 0.55);
            font-size: 0.9rem;
            text-align: center;
        }

        #licenseDetails .no-downloads i {
            font-size: 2.2rem;
            color: rgba(255, 255, 255, 0.3);
        }

        #licenseDetails .no-downloads p {
            margin: 0;
        }

        /* Quick actions card (bottom of internal page) */
        #licenseDetails #quickActionsCard {
            background: transparent;
            border: none;
            box-shadow: none;
            padding: 0;
            margin: 0 0 20px 0;
        }

        #licenseDetails #quickActionsCard .quick-actions {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 12px;
            margin: 0;
        }

        #licenseDetails #quickActionsCard .quick-action-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            padding: 14px 18px;
            background: rgba(0, 242, 254, 0.07);
            backdrop-filter: blur(12px);
            border: 1px solid rgba(0, 242, 254, 0.3);
            color: #00F2FE;
            border-radius: 9999px;
            font-size: 14px;
            font-weight: 700;
            text-decoration: none;
            flex: 1 1 200px;
            min-width: 180px;
            max-width: 280px;
            transition: all 0.25s ease;
        }

        #licenseDetails #quickActionsCard .quick-action-btn:hover {
            background: rgba(0, 242, 254, 0.18);
            border-color: #00F2FE;
            color: #FFFFFF;
            transform: translateY(-2px);
        }

        /* Stack gap: consistent 24px between major sections inside licenseDetails */
        #licenseDetails > * + * {
            margin-top: 24px;
        }

        .download-section {
            margin-bottom: 0;
            padding-bottom: 0;
            border-bottom: none;
        }

        .download-section h3 {
            color: var(--white);
            margin-bottom: 12px;
            font-size: 18px;
            font-weight: 600;
        }

        .downloads-list {
            margin-top: 15px;
        }

        .product-download-card {
            background: rgba(255,255,255,0.03);
            border: 2px solid rgba(255,255,255,0.1);
            border-radius: 12px;
            padding: 20px;
            margin-bottom: 15px;
            transition: all 0.3s ease;
        }

        .product-download-card:hover {
            border-color: var(--picton-blue);
            box-shadow: 0 4px 20px rgba(4, 169, 236, 0.15);
            background: rgba(255,255,255,0.05);
        }

        .product-title {
            font-size: 18px;
            font-weight: 600;
            color: var(--white);
            margin-bottom: 15px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .version-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px;
            background: rgba(255,255,255,0.05);
            border-radius: 8px;
            margin-bottom: 10px;
            transition: all 0.2s ease;
            border: 1px solid rgba(255,255,255,0.05);
        }

        .version-item:hover {
            background: rgba(255,255,255,0.08);
            border-color: rgba(255,255,255,0.1);
        }

        .version-item.locked-version {
            background: rgba(255, 31, 94, 0.1);
            border: 1px dashed rgba(255, 31, 94, 0.3);
        }

        .version-item.locked-version:hover {
            background: rgba(255, 31, 94, 0.15);
        }

        .version-info-block {
            flex: 1;
        }

        .version-name {
            font-weight: 600;
            color: var(--white);
            font-size: 15px;
            margin-bottom: 4px;
        }

        .version-meta {
            color: rgba(255,255,255,0.5);
            font-size: 13px;
        }

        .version-filename {
            color: rgba(255,255,255,0.5);
            font-weight: normal;
            margin-left: 8px;
        }

        .addon-purchase-info {
            background: rgba(16, 185, 129, 0.08);
            padding: 12px;
            border-radius: 6px;
            margin-bottom: 12px;
            border-left: 3px solid #10b981;
        }

        .addon-purchase-meta {
            font-size: 13px;
            color: rgba(255,255,255,0.7);
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .addon-purchase-meta strong {
            color: var(--white);
        }

        .addon-purchase-meta i {
            color: #10b981;
        }

        .download-btn-small {
            background: linear-gradient(135deg, #059669 0%, #10b981 100%);
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 8px;
            white-space: nowrap;
        }

        .download-btn-small:hover {
            background: linear-gradient(135deg, #047857 0%, #059669 100%);
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(5, 150, 105, 0.4);
        }

        .download-btn-small:disabled {
            background: var(--gray-dark);
            cursor: not-allowed;
            transform: none;
        }

        .download-btn-small.locked {
            background: var(--gray-dark);
            cursor: not-allowed;
        }

        .download-btn-small.locked:hover {
            transform: none;
            box-shadow: none;
        }

        .no-downloads {
            text-align: center;
            padding: 30px;
            color: rgba(255,255,255,0.5);
            background: rgba(255,255,255,0.03);
            border-radius: 8px;
        }

        .no-downloads i {
            font-size: 48px;
            margin-bottom: 10px;
            opacity: 0.5;
        }

        .license-badge {
            display: inline-block;
            padding: 4px 12px;
            border-radius: 20px;
            font-size: 11px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .license-badge.renewed {
            background: rgba(16, 185, 129, 0.2);
            color: #10b981;
        }

        .license-badge.standard {
            background: rgba(4, 169, 236, 0.2);
            color: var(--picton-blue);
        }

        @media (max-width: 768px) {
            .container {
                padding: 10px;
            }

            .card {
                padding: 20px;
            }

            .header h1 {
                font-size: 24px;
            }

            .license-info .field {
                flex-direction: column;
                align-items: flex-start;
                gap: 4px;
            }
        }

        .logo {
            width: auto;
            height: 70px;
            margin-bottom: 20px;
            display: block;
            margin-left: auto;
            margin-right: auto;
            object-fit: contain;
            filter: brightness(1.1);
        }
        
        .logo-error {
            display: none;
            color: var(--folly-pink);
            font-size: 12px;
            text-align: center;
            margin-top: -15px;
            margin-bottom: 15px;
        }

        /* Header gradient bar */
        .card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 4px;
            background: linear-gradient(90deg, var(--folly-pink) 0%, var(--picton-blue) 100%);
            border-radius: 16px 16px 0 0;
        }

        .card {
            position: relative;
            overflow: hidden;
        }

        /* Scrollbar styling */
        ::-webkit-scrollbar {
            width: 8px;
        }

        ::-webkit-scrollbar-track {
            background: var(--oxford-blue);
        }

        ::-webkit-scrollbar-thumb {
            background: var(--folly-pink);
            border-radius: 4px;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: var(--picton-blue);
        }

        /* Input placeholder */
        .form-group input::placeholder {
            color: var(--gray-dark);
        }

        /* Focus ring enhancement */
        .btn:focus {
            outline: none;
            box-shadow: 0 0 0 3px rgba(255, 31, 94, 0.3);
        }
