<!doctype html>

<html lang="en" class="h-full">

 <head>

  <meta charset="UTF-8">

  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>ARIA - Financial Intelligence Platform</title>

  <script src="https://cdn.tailwindcss.com"></script>

  <script src="/_sdk/element_sdk.js"></script>

  <link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&amp;family=Inter:wght@400;500;600&amp;display=swap" rel="stylesheet">

  <style>

    body {

      box-sizing: border-box;

    }

   

    .font-display {

      font-family: 'Outfit', sans-serif;

    }

   

    .font-body {

      font-family: 'Inter', sans-serif;

    }

   

    @keyframes slide-up {

      from {

        opacity: 0;

        transform: translateY(30px);

      }

      to {

        opacity: 1;

        transform: translateY(0);

      }

    }

   

    @keyframes fade-in {

      from { opacity: 0; }

      to { opacity: 1; }

    }

   

    @keyframes scale-in {

      from {

        opacity: 0;

        transform: scale(0.95);

      }

      to {

        opacity: 1;

        transform: scale(1);

      }

    }

   

    .animate-slide-up {

      animation: slide-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;

    }

   

    .animate-fade-in {

      animation: fade-in 0.4s ease-out forwards;

    }

   

    .animate-scale-in {

      animation: scale-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;

    }

   

    .card-gamma {

      transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);

      background: white;

      border-radius: 16px;

    }

   

    .card-gamma:hover {

      transform: translateY(-8px);

      box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);

    }

   

    .btn-gamma {

      transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);

    }

   

    .btn-gamma:hover {

      transform: translateY(-2px);

      box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);

    }

   

    .tab-btn {

      transition: all 0.2s ease;

      position: relative;

    }

   

    .tab-btn::after {

      content: '';

      position: absolute;

      bottom: 0;

      left: 0;

      right: 0;

      height: 2px;

      background: #6366f1;

      transform: scaleX(0);

      transition: transform 0.3s ease;

    }

   

    .tab-btn.active::after {

      transform: scaleX(1);

    }

   

    .gradient-mesh {

      background:

        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),

        radial-gradient(at 100% 0%, rgba(139, 92, 246, 0.06) 0px, transparent 50%),

        radial-gradient(at 100% 100%, rgba(236, 72, 153, 0.05) 0px, transparent 50%),

        radial-gradient(at 0% 100%, rgba(59, 130, 246, 0.07) 0px, transparent 50%);

    }

   

    ::-webkit-scrollbar {

      width: 8px;

      height: 8px;

    }

   

    ::-webkit-scrollbar-track {

      background: transparent;

    }

   

    ::-webkit-scrollbar-thumb {

      background: #e2e8f0;

      border-radius: 4px;

    }

   

    ::-webkit-scrollbar-thumb:hover {

      background: #cbd5e1;

    }

   

    .metric-card {

      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

    }

   

    .status-dot {

      animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;

    }

   

    @keyframes pulse {

      0%, 100% {

        opacity: 1;

      }

      50% {

        opacity: 0.5;

      }

    }

   

    .frosted-glass {

      backdrop-filter: blur(12px) saturate(180%);

      background: rgba(255, 255, 255, 0.8);

      border: 1px solid rgba(255, 255, 255, 0.3);

    }

  </style>

  <style>@view-transition { navigation: auto; }</style>

  <script src="/_sdk/data_sdk.js" type="text/javascript"></script>

 </head>

 <body class="h-full bg-slate-50 text-slate-900 font-body overflow-auto">

  <div id="app-wrapper" class="h-full w-full relative gradient-mesh"><!-- Floating Header -->

   <header class="sticky top-0 z-50 frosted-glass border-b border-slate-200/60">

    <div class="max-w-7xl mx-auto px-6 py-4">

     <div class="flex items-center justify-between">

      <div class="flex items-center gap-3">

       <div class="w-10 h-10 rounded-xl bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center shadow-lg">

        <svg class="w-5 h-5 text-white" fill="none" stroke="currentColor" viewbox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M13 10V3L4 14h7v7l9-11h-7z" />

        </svg>

       </div>

       <div>

        <h1 id="assistant-name" class="text-xl font-display font-bold text-slate-900">ARIA</h1>

       </div>

      </div>

      <div class="flex items-center gap-3"><button class="px-4 py-2 text-sm font-medium text-slate-700 hover:bg-white rounded-lg transition-colors">

        <svg class="w-5 h-5" fill="none" stroke="currentColor" viewbox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9" />

        </svg></button>

       <div class="flex items-center gap-2 px-3 py-2 bg-white rounded-lg border border-slate-200">

        <div class="w-8 h-8 rounded-full bg-gradient-to-br from-indigo-400 to-purple-500 flex items-center justify-center text-white text-sm font-semibold">

         A

        </div><span class="text-sm font-medium text-slate-700">Admin</span>

       </div>

      </div>

     </div>

    </div>

   </header>

   <main class="max-w-7xl mx-auto px-6 py-12"><!-- Hero Section -->

    <div class="mb-16 text-center animate-slide-up">

     <div class="inline-flex items-center gap-2 px-4 py-2 bg-indigo-50 rounded-full mb-6">

      <div class="w-2 h-2 bg-indigo-500 rounded-full status-dot"></div><span class="text-sm font-medium text-indigo-700">All systems operational</span>

     </div>

     <h2 id="main-title" class="text-5xl md:text-6xl font-display font-bold text-slate-900 mb-4 leading-tight">Financial Intelligence<br>

      Made Simple</h2>

     <p id="subtitle" class="text-xl text-slate-600 max-w-2xl mx-auto mb-8">Transform Data into Living Stories — Where Insights Spark Impact</p><!-- Search Bar -->

     <form onsubmit="handleGenerate(event)" class="max-w-3xl mx-auto mb-6">

      <div class="relative group"><label for="user-input" class="sr-only">Search or ask anything</label> <input type="text" id="user-input" placeholder="Ask about revenue trends, generate briefings, or explore your data..." class="w-full px-6 py-5 pr-32 bg-white border-2 border-slate-200 rounded-2xl text-base text-slate-900 placeholder-slate-400 focus:border-indigo-500 focus:ring-4 focus:ring-indigo-100 transition-all shadow-lg shadow-slate-200/50"> <button type="submit" class="absolute right-2 top-1/2 -translate-y-1/2 px-6 py-3 bg-indigo-600 hover:bg-indigo-700 text-white font-semibold rounded-xl transition-all flex items-center gap-2 btn-gamma"> <span>Generate</span>

        <svg class="w-4 h-4" fill="none" stroke="currentColor" viewbox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7l5 5m0 0l-5 5m5-5H6" />

        </svg></button>

      </div>

     </form><!-- Quick Actions -->

     <div class="flex flex-wrap items-center justify-center gap-3"><button onclick="quickAction('briefing')" class="px-4 py-2 bg-white hover:bg-slate-50 border border-slate-200 rounded-xl text-sm font-medium text-slate-700 transition-all flex items-center gap-2"> <span>📄</span> Executive Brief </button> <button onclick="quickAction('analytics')" class="px-4 py-2 bg-white hover:bg-slate-50 border border-slate-200 rounded-xl text-sm font-medium text-slate-700 transition-all flex items-center gap-2"> <span>📊</span> SAP Analytics </button> <button onclick="quickAction('timeline')" class="px-4 py-2 bg-white hover:bg-slate-50 border border-slate-200 rounded-xl text-sm font-medium text-slate-700 transition-all flex items-center gap-2"> <span>📅</span> Timeline </button> <button onclick="quickAction('podcast')" class="px-4 py-2 bg-white hover:bg-slate-50 border border-slate-200 rounded-xl text-sm font-medium text-slate-700 transition-all flex items-center gap-2"> <span>🎙️</span> Audio Overview </button>

     </div>

    </div><!-- Tabs -->

    <div class="mb-8">

     <div class="flex items-center gap-1 border-b border-slate-200"><button onclick="setTab('all')" class="tab-btn active px-6 py-3 text-sm font-semibold text-slate-900" data-tab="all"> All Content </button> <button onclick="setTab('reports')" class="tab-btn px-6 py-3 text-sm font-semibold text-slate-500 hover:text-slate-900" data-tab="reports"> Reports </button> <button onclick="setTab('analytics')" class="tab-btn px-6 py-3 text-sm font-semibold text-slate-500 hover:text-slate-900" data-tab="analytics"> Analytics </button> <button onclick="setTab('insights')" class="tab-btn px-6 py-3 text-sm font-semibold text-slate-500 hover:text-slate-900" data-tab="insights"> Insights </button>

     </div>

    </div><!-- Content Grid -->

    <div id="content-grid" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"><!-- Generated cards will appear here -->

    </div>

   </main><!-- Floating Action Button --> <button onclick="scrollToTop()" class="fixed bottom-8 right-8 w-14 h-14 bg-indigo-600 hover:bg-indigo-700 text-white rounded-full shadow-2xl shadow-indigo-500/30 flex items-center justify-center transition-all btn-gamma">

    <svg class="w-6 h-6" fill="none" stroke="currentColor" viewbox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 10l7-7m0 0l7 7m-7-7v18" />

    </svg></button>

  </div>

  <script>

    const defaultConfig = {

      assistant_name: 'ARIA',

      main_title: 'Financial Intelligence\nMade Simple',

      subtitle: 'Transform Data into Living Stories — Where Insights Spark Impact',

      primary_color: '#6366f1',

      secondary_color: '#8b5cf6',

      background_color: '#f8fafc',

      text_color: '#1e293b',

      accent_color: '#ec4899'

    };

   

    let config = { ...defaultConfig };

    let currentTab = 'all';

    let audioPlaying = false;

   

    const contentTemplates = {

      briefing: {

        title: 'Q4 Executive Briefing',

        type: 'briefing',

        category: 'reports',

        icon: '📄',

        color: 'from-blue-500 to-cyan-500',

        data: {

          summary: 'Strong quarterly performance with 34% revenue growth and improved operational metrics across all segments.',

          keyMetrics: [

            { label: 'Revenue', value: '$12.4M', change: '+34%' },

            { label: 'EBITDA Margin', value: '28%', change: '+6%' },

            { label: 'Operating Cash', value: '$4.1M', change: '+42%' }

          ],

          insights: [

            'Customer acquisition costs decreased by 15%',

            'Enterprise segment grew 47% YoY',

            'International expansion contributed $2.1M in new revenue'

          ]

        }

      },

      analytics: {

        title: 'SAP Revenue Analytics',

        type: 'analytics',

        category: 'analytics',

        icon: '📊',

        color: 'from-purple-500 to-pink-500',

        data: {

          metric: 'Total Revenue',

          value: '$12.4M',

          change: '+34%',

          trend: [65, 68, 72, 78, 82, 85, 88, 92, 95, 98, 100],

          breakdown: [

            { label: 'Americas', value: '$6.2M', percent: 50 },

            { label: 'EMEA', value: '$3.7M', percent: 30 },

            { label: 'APAC', value: '$2.5M', percent: 20 }

          ]

        }

      },

      timeline: {

        title: 'Financial Timeline 2024',

        type: 'timeline',

        category: 'insights',

        icon: '📅',

        color: 'from-emerald-500 to-teal-500',

        events: [

          { quarter: 'Q1 2024', revenue: '$9.2M', growth: '+12%', status: 'completed', highlight: 'Successful product launch' },

          { quarter: 'Q2 2024', revenue: '$10.8M', growth: '+17%', status: 'completed', highlight: 'Expanded to EMEA' },

          { quarter: 'Q3 2024', revenue: '$12.4M', growth: '+34%', status: 'completed', highlight: 'Record quarter' },

          { quarter: 'Q4 2024', revenue: '$14.5M*', growth: '+40%*', status: 'projected', highlight: 'Projected growth' }

        ]

      },

      podcast: {

        title: 'Financial Deep Dive Podcast',

        type: 'podcast',

        category: 'insights',

        icon: '🎙️',

        color: 'from-orange-500 to-red-500',

        data: {

          duration: '12:45',

          description: 'AI-generated discussion covering Q4 performance, market trends, and strategic outlook',

          topics: ['Revenue Analysis', 'Market Expansion', 'Strategic Initiatives', 'Q1 Outlook'],

          hosts: ['Financial AI', 'Data Expert']

        }

      },

      studyguide: {

        title: 'Financial Study Guide',

        type: 'studyguide',

        category: 'reports',

        icon: '📚',

        color: 'from-indigo-500 to-blue-500',

        sections: [

          {

            title: 'Key Takeaways',

            items: [

              'Revenue increased 34% YoY to $12.4M',

              'Customer retention improved to 94%',

              'New product lines contributed $1.8M'

            ]

          },

          {

            title: 'Strategic Priorities',

            items: [

              'Expand international presence',

              'Launch 3 new product features',

              'Optimize customer acquisition funnel'

            ]

          }

        ]

      },

      faq: {

        title: 'Financial FAQ',

        type: 'faq',

        category: 'insights',

        icon: '',

        color: 'from-violet-500 to-purple-500',

        questions: [

          {

            q: 'What drove the 34% revenue growth?',

            a: 'Growth was driven by strong enterprise sales (+47%), successful international expansion ($2.1M), and improved pricing strategy resulting in 18% higher average contract values.'

          },

          {

            q: 'How sustainable is this growth rate?',

            a: 'Based on current pipeline and market conditions, we project 25-30% growth for next quarter with strong indicators for continued expansion in our core segments.'

          },

          {

            q: 'What are the biggest risks?',

            a: 'Key risks include customer concentration (top 5 = 42% revenue), FX exposure in international markets, and potential economic headwinds affecting enterprise spending.'

          }

        ]

      }

    };

   

    function renderCard(template) {

      const container = document.getElementById('content-grid');

      let cardHTML = '';

     

      if (template.type === 'briefing') {

        cardHTML = `

          <div class="card-gamma p-6 shadow-lg animate-scale-in" data-category="${template.category}">

            <div class="flex items-start justify-between mb-4">

              <div class="flex items-center gap-3">

                <div class="w-12 h-12 rounded-xl bg-gradient-to-br ${template.color} flex items-center justify-center text-2xl shadow-lg">

                  ${template.icon}

                </div>

                <div>

                  <h3 class="text-lg font-display font-bold text-slate-900">${template.title}</h3>

                  <p class="text-sm text-slate-500">Executive Report</p>

                </div>

              </div>

            </div>

           

            <p class="text-sm text-slate-600 leading-relaxed mb-4">${template.data.summary}</p>

           

            <div class="grid grid-cols-3 gap-3 mb-4">

              ${template.data.keyMetrics.map(metric => `

                <div class="p-3 bg-slate-50 rounded-lg">

                  <div class="text-xs text-slate-500 mb-1">${metric.label}</div>

                  <div class="text-lg font-bold text-slate-900">${metric.value}</div>

                  <div class="text-xs font-semibold text-emerald-600">${metric.change}</div>

                </div>

              `).join('')}

            </div>

           

            <div class="space-y-2">

              ${template.data.insights.map(insight => `

                <div class="flex items-start gap-2 text-sm text-slate-600">

                  <svg class="w-4 h-4 text-indigo-500 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">

                    <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>

                  </svg>

                  <span>${insight}</span>

                </div>

              `).join('')}

            </div>

           

            <button class="mt-4 w-full py-2.5 bg-slate-900 hover:bg-slate-800 text-white text-sm font-semibold rounded-lg transition-all">

              View Full Report

            </button>

          </div>

        `;

      } else if (template.type === 'analytics') {

        cardHTML = `

          <div class="card-gamma p-6 shadow-lg animate-scale-in" data-category="${template.category}">

            <div class="flex items-start justify-between mb-4">

              <div class="flex items-center gap-3">

                <div class="w-12 h-12 rounded-xl bg-gradient-to-br ${template.color} flex items-center justify-center text-2xl shadow-lg">

                  ${template.icon}

                </div>

                <div>

                  <h3 class="text-lg font-display font-bold text-slate-900">${template.title}</h3>

                  <p class="text-sm text-slate-500">${template.data.metric}</p>

                </div>

              </div>

              <div class="px-2 py-1 bg-emerald-50 text-emerald-700 text-xs font-semibold rounded-md">Live</div>

            </div>

           

            <div class="mb-6">

              <div class="text-3xl font-display font-bold text-slate-900 mb-1">${template.data.value}</div>

              <div class="text-sm font-semibold text-emerald-600">${template.data.change} from last quarter</div>

            </div>

           

            <div class="flex items-end justify-between gap-1 h-24 mb-6">

              ${template.data.trend.map(v => `

                <div class="flex-1 bg-gradient-to-t ${template.color} rounded-t opacity-80 hover:opacity-100 transition-opacity" style="height: ${v}%"></div>

              `).join('')}

            </div>

           

            <div class="space-y-3">

              ${template.data.breakdown.map(item => `

                <div>

                  <div class="flex items-center justify-between text-sm mb-1">

                    <span class="text-slate-600">${item.label}</span>

                    <span class="font-semibold text-slate-900">${item.value}</span>

                  </div>

                  <div class="w-full bg-slate-100 rounded-full h-2">

                    <div class="bg-gradient-to-r ${template.color} h-2 rounded-full transition-all" style="width: ${item.percent}%"></div>

                  </div>

                </div>

              `).join('')}

            </div>

          </div>

        `;

      } else if (template.type === 'timeline') {

        cardHTML = `

          <div class="card-gamma p-6 shadow-lg animate-scale-in" data-category="${template.category}">

            <div class="flex items-center gap-3 mb-6">

              <div class="w-12 h-12 rounded-xl bg-gradient-to-br ${template.color} flex items-center justify-center text-2xl shadow-lg">

                ${template.icon}

              </div>

              <div>

                <h3 class="text-lg font-display font-bold text-slate-900">${template.title}</h3>

                <p class="text-sm text-slate-500">Quarterly Performance</p>

              </div>

            </div>

           

            <div class="space-y-4">

              ${template.events.map((event, i) => `

                <div class="relative ${i !== template.events.length - 1 ? 'pb-4 border-l-2 border-slate-200 ml-3' : 'ml-3'}">

                  <div class="absolute -left-[13px] top-0 w-6 h-6 rounded-full ${

                    event.status === 'completed' ? 'bg-emerald-500' :

                    event.status === 'projected' ? 'bg-slate-300' : 'bg-indigo-500'

                  } border-4 border-white shadow-md"></div>

                  <div class="ml-6 ${event.status === 'projected' ? 'opacity-60' : ''}">

                    <div class="flex items-center justify-between mb-1">

                      <span class="text-sm font-semibold text-slate-900">${event.quarter}</span>

                      <span class="text-sm font-bold ${event.status === 'projected' ? 'text-slate-500' : 'text-emerald-600'}">${event.growth}</span>

                    </div>

                    <div class="text-lg font-bold text-slate-900 mb-1">${event.revenue}</div>

                    <div class="text-xs text-slate-500">${event.highlight}</div>

                  </div>

                </div>

              `).join('')}

            </div>

          </div>

        `;

      } else if (template.type === 'podcast') {

        cardHTML = `

          <div class="card-gamma p-6 shadow-lg animate-scale-in" data-category="${template.category}">

            <div class="flex items-center gap-3 mb-4">

              <div class="w-12 h-12 rounded-xl bg-gradient-to-br ${template.color} flex items-center justify-center text-2xl shadow-lg">

                ${template.icon}

              </div>

              <div>

                <h3 class="text-lg font-display font-bold text-slate-900">${template.title}</h3>

                <p class="text-sm text-slate-500">${template.data.duration}</p>

              </div>

            </div>

           

            <p class="text-sm text-slate-600 mb-4">${template.data.description}</p>

           

            <div class="flex justify-center mb-4">

              <button onclick="toggleAudio(this)" class="w-16 h-16 rounded-full bg-gradient-to-br ${template.color} hover:shadow-2xl flex items-center justify-center transition-all">

                <svg class="w-8 h-8 text-white ml-1" fill="currentColor" viewBox="0 0 24 24">

                  <path d="M8 5v14l11-7z"/>

                </svg>

              </button>

            </div>

           

            <div class="space-y-2 mb-4">

              <div class="text-xs text-slate-500 font-semibold uppercase mb-2">Topics Covered:</div>

              ${template.data.topics.map(topic => `

                <div class="flex items-center gap-2 text-sm text-slate-600">

                  <div class="w-1.5 h-1.5 bg-indigo-500 rounded-full"></div>

                  <span>${topic}</span>

                </div>

              `).join('')}

            </div>

           

            <div class="pt-4 border-t border-slate-100 text-xs text-slate-500">

              Hosts: ${template.data.hosts.join(' & ')}

            </div>

          </div>

        `;

      } else if (template.type === 'studyguide') {

        cardHTML = `

          <div class="card-gamma p-6 shadow-lg animate-scale-in" data-category="${template.category}">

            <div class="flex items-center gap-3 mb-6">

              <div class="w-12 h-12 rounded-xl bg-gradient-to-br ${template.color} flex items-center justify-center text-2xl shadow-lg">

                ${template.icon}

              </div>

              <div>

                <h3 class="text-lg font-display font-bold text-slate-900">${template.title}</h3>

                <p class="text-sm text-slate-500">Comprehensive Overview</p>

              </div>

            </div>

           

            <div class="space-y-4">

              ${template.sections.map(section => `

                <div class="p-4 bg-slate-50 rounded-lg">

                  <h4 class="text-sm font-semibold text-slate-900 mb-3">${section.title}</h4>

                  <ul class="space-y-2">

                    ${section.items.map(item => `

                      <li class="flex items-start gap-2 text-sm text-slate-600">

                        <svg class="w-4 h-4 text-indigo-500 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">

                          <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>

                        </svg>

                        <span>${item}</span>

                      </li>

                    `).join('')}

                  </ul>

                </div>

              `).join('')}

            </div>

           

            <button class="mt-4 w-full py-2.5 bg-indigo-600 hover:bg-indigo-700 text-white text-sm font-semibold rounded-lg transition-all">

              Export Guide

            </button>

          </div>

        `;

      } else if (template.type === 'faq') {

        cardHTML = `

          <div class="card-gamma p-6 shadow-lg animate-scale-in" data-category="${template.category}">

            <div class="flex items-center gap-3 mb-6">

              <div class="w-12 h-12 rounded-xl bg-gradient-to-br ${template.color} flex items-center justify-center text-2xl shadow-lg">

                ${template.icon}

              </div>

              <div>

                <h3 class="text-lg font-display font-bold text-slate-900">${template.title}</h3>

                <p class="text-sm text-slate-500">${template.questions.length} Questions</p>

              </div>

            </div>

           

            <div class="space-y-4">

              ${template.questions.map((faq, i) => `

                <div class="p-4 bg-slate-50 rounded-lg">

                  <div class="text-sm font-semibold text-slate-900 mb-2">${faq.q}</div>

                  <div class="text-sm text-slate-600 leading-relaxed">${faq.a}</div>

                </div>

              `).join('')}

            </div>

           

            <button class="mt-4 w-full py-2.5 border-2 border-slate-200 hover:border-slate-300 text-slate-700 text-sm font-semibold rounded-lg transition-all">

              Generate More

            </button>

          </div>

        `;

      }

     

      container.insertAdjacentHTML('afterbegin', cardHTML);

    }

   

    function quickAction(action) {

      if (contentTemplates[action]) {

        renderCard(contentTemplates[action]);

      }

    }

   

    function handleGenerate(event) {

      event.preventDefault();

      const input = document.getElementById('user-input');

      const text = input.value.toLowerCase().trim();

     

      if (!text) return;

     

      let matchedTemplate = null;

     

      if (text.includes('brief') || text.includes('executive') || text.includes('report')) {

        matchedTemplate = contentTemplates.briefing;

      } else if (text.includes('analytics') || text.includes('sap') || text.includes('revenue')) {

        matchedTemplate = contentTemplates.analytics;

      } else if (text.includes('timeline') || text.includes('quarter') || text.includes('history')) {

        matchedTemplate = contentTemplates.timeline;

      } else if (text.includes('podcast') || text.includes('audio') || text.includes('listen')) {

        matchedTemplate = contentTemplates.podcast;

      } else if (text.includes('study') || text.includes('guide') || text.includes('overview')) {

        matchedTemplate = contentTemplates.studyguide;

      } else if (text.includes('faq') || text.includes('question')) {

        matchedTemplate = contentTemplates.faq;

      } else {

        const templates = Object.values(contentTemplates);

        matchedTemplate = templates[Math.floor(Math.random() * templates.length)];

      }

     

      renderCard(matchedTemplate);

      input.value = '';

    }

   

    function setTab(tab) {

      currentTab = tab;

      document.querySelectorAll('.tab-btn').forEach(btn => {

        if (btn.dataset.tab === tab) {

          btn.classList.add('active');

          btn.classList.remove('text-slate-500');

          btn.classList.add('text-slate-900');

        } else {

          btn.classList.remove('active');

          btn.classList.add('text-slate-500');

          btn.classList.remove('text-slate-900');

        }

      });

     

      filterCards();

    }

   

    function filterCards() {

      const cards = document.querySelectorAll('[data-category]');

      cards.forEach(card => {

        if (currentTab === 'all' || card.dataset.category === currentTab) {

          card.style.display = 'block';

        } else {

          card.style.display = 'none';

        }

      });

    }

   

    function toggleAudio(btn) {

      audioPlaying = !audioPlaying;

      const svg = btn.querySelector('svg');

     

      if (audioPlaying) {

        svg.innerHTML = '<path d="M6 4h4v16H6V4zm8 0h4v16h-4V4z"/>';

      } else {

        svg.innerHTML = '<path d="M8 5v14l11-7z"/>';

      }

    }

   

    function scrollToTop() {

      window.scrollTo({ top: 0, behavior: 'smooth' });

    }

   

    async function onConfigChange(cfg) {

      config = { ...defaultConfig, ...cfg };

     

      document.getElementById('assistant-name').textContent = config.assistant_name || defaultConfig.assistant_name;

      document.getElementById('main-title').textContent = (config.main_title || defaultConfig.main_title).replace('\\n', '\n');

      document.getElementById('subtitle').textContent = config.subtitle || defaultConfig.subtitle;

    }

   

    function mapToCapabilities(cfg) {

      return {

        recolorables: [

          {

            get: () => cfg.background_color || defaultConfig.background_color,

            set: (v) => { cfg.background_color = v; window.elementSdk.setConfig({ background_color: v }); }

          },

          {

            get: () => cfg.primary_color || defaultConfig.primary_color,

            set: (v) => { cfg.primary_color = v; window.elementSdk.setConfig({ primary_color: v }); }

          },

          {

            get: () => cfg.secondary_color || defaultConfig.secondary_color,

            set: (v) => { cfg.secondary_color = v; window.elementSdk.setConfig({ secondary_color: v }); }

          },

          {

            get: () => cfg.text_color || defaultConfig.text_color,

            set: (v) => { cfg.text_color = v; window.elementSdk.setConfig({ text_color: v }); }

          },

          {

            get: () => cfg.accent_color || defaultConfig.accent_color,

            set: (v) => { cfg.accent_color = v; window.elementSdk.setConfig({ accent_color: v }); }

          }

        ],

        borderables: [],

        fontEditable: undefined,

        fontSizeable: undefined

      };

    }

   

    function mapToEditPanelValues(cfg) {

      return new Map([

        ['assistant_name', cfg.assistant_name || defaultConfig.assistant_name],

        ['main_title', cfg.main_title || defaultConfig.main_title],

        ['subtitle', cfg.subtitle || defaultConfig.subtitle]

      ]);

    }

   

    function init() {

      renderCard(contentTemplates.briefing);

      renderCard(contentTemplates.analytics);

      renderCard(contentTemplates.timeline);

      renderCard(contentTemplates.podcast);

      renderCard(contentTemplates.studyguide);

      renderCard(contentTemplates.faq);

     

      if (window.elementSdk) {

        window.elementSdk.init({

          defaultConfig,

          onConfigChange,

          mapToCapabilities,

          mapToEditPanelValues

        });

      }

    }

   

    init();

  </script>

 <script>(function(){function c(){var b=a.contentDocument||a.contentWindow.document;if(b){var d=b.createElement('script');d.innerHTML="window.__CF$cv$params={r:'9c164883b0b4178f',t:'MTc2ODk5Mjk2OC4wMDAwMDA='};var a=document.createElement('script');a.nonce='';a.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js';document.getElementsByTagName('head')[0].appendChild(a);";b.getElementsByTagName('head')[0].appendChild(d)}}if(document.body){var a=document.createElement('iframe');a.height=1;a.width=1;a.style.position='absolute';a.style.top=0;a.style.left=0;a.style.border='none';a.style.visibility='hidden';document.body.appendChild(a);if('loading'!==document.readyState)c();else if(window.addEventListener)document.addEventListener('DOMContentLoaded',c);else{var e=document.onreadystatechange||function(){};document.onreadystatechange=function(b){e(b);'loading'!==document.readyState&&(document.onreadystatechange=e,c())}}}})();</script></body>

</html>