Skip to content
TheChatArchiveThe Chat Archive
GLMGLM-5 / Pony Alpha· unknownHugging Face Frontier Reasoning Traces

Build a cat risk aggregation dashboard: exposure data, event sets, tail metrics,…

  1. User

    Build a cat risk aggregation dashboard: exposure data, event sets, tail metrics, reinsurance impact, and governance.

  2. GLM Assistant

    The user wants a catastrophe (cat) risk aggregation dashboard. This is a specialized financial/insurance tool for analyzing catastrophic risk exposure. Let me plan out what this needs:

    Key Components:

    1. Exposure Data - Portfolio/asset locations, values, coverage types
    2. Event Sets - Different peril scenarios (hurricane, earthquake, flood, etc.)
    3. Tail Metrics - VaR, TVaR, return periods (1-in-100, 1-in-250, etc.)
    4. Reinsurance Impact - How reinsurance structures affect losses
    5. Governance - Audit trails, approvals, data quality checks

    Dashboard Design Approach:

    • Professional, dark theme (finance/insurance industry standard)
    • Data-heavy with multiple visualization types
    • Interactive elements for drilling down
    • Clean, structured layout befitting financial software

    Visual Elements I'll include:

    • Summary cards with key metrics
    • Loss exceedance curve (classic cat risk visualization)
    • Geographic exposure heatmap (using canvas)
    • Event set comparison bar charts
    • Reinsurance structure visualization
    • Governance/approval workflow section
    • Tail metrics table with return periods

    Technical Implementation:

    • Use Canvas for custom charts (loss exceedance curve, heatmap)
    • CSS Grid/Flexbox for layout
    • Interactive tabs/sections
    • Animated transitions
    • Professional color palette (dark blue/teal accents on dark background)

    Color Palette:

    • Background: Dark navy/charcoal (#0d1117, #161b22)
    • Cards: Slightly lighter (#21262d)
    • Accent: Teal/Cyan (#00d4aa, #58a6ff)
    • Warning/Danger: Orange (#f0883e), Red (#f85149)
    • Success: Green (#3fb950)
    • Text: White/Gray (#c9d1d9)

    Let me build this comprehensive dashboard with real-looking data and professional interactions.

    Cat Risk Aggregation Dashboard

    This is a comprehensive catastrophe risk management dashboard featuring exposure analysis, event set modeling, tail risk metrics, reinsurance structures, and governance tracking.

    Key Features:

    • Interactive loss exceedance curve with animated rendering
    • Geographic exposure heatmap visualization
    • Event set comparison with drill-down capabilities
    • Reinsurance program structure with net loss calculations
    • Tail metrics (VaR, TVaR) across return periods
    • Governance workflow with approval status tracking
    • Fully responsive with professional dark theme
    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Cat Risk Aggregation Dashboard</title>
      <script src="https://cdn.tailwindcss.com"></script>
      <link rel="preconnect" href="https://fonts.googleapis.com">
      <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
      <link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap" rel="stylesheet">
      <style>
        :root {
          --bg: #0a0e14;
          --bg-elevated: #12171f;
          --card: #1a2130;
          --card-hover: #212a3c;
          --border: #2d3748;
          --fg: #e2e8f0;
          --muted: #64748b;
          --accent: #00d4aa;
          --accent-dim: rgba(0, 212, 170, 0.15);
          --warning: #f59e0b;
          --danger: #ef4444;
          --info: #3b82f6;
          --loss: #f97316;
          --gain: #10b981;
        }
        
        * {
          margin: 0;
          padding: 0;
          box-sizing: border-box;
        }
        
        body {
          font-family: 'DM Sans', sans-serif;
          background: var(--bg);
          color: var(--fg);
          min-height: 100vh;
          overflow-x: hidden;
        }
        
        .mono {
          font-family: 'Space Mono', monospace;
        }
        
        /* Background atmosphere */
        .bg-atmosphere {
          position: fixed;
          inset: 0;
          z-index: -1;
          background: 
            radial-gradient(ellipse 80% 50% at 20% 20%, rgba(0, 212, 170, 0.05) 0%, transparent 50%),
            radial-gradient(ellipse 60% 40% at 80% 80%, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
            linear-gradient(180deg, var(--bg) 0%, #0d1420 100%);
        }
        
        .grid-overlay {
          position: fixed;
          inset: 0;
          z-index: -1;
          background-image: 
            linear-gradient(rgba(45, 55, 72, 0.03) 1px, transparent 1px),
            linear-gradient(90deg, rgba(45, 55, 72, 0.03) 1px, transparent 1px);
          background-size: 40px 40px;
        }
        
        /* Cards */
        .risk-card {
          background: var(--card);
          border: 1px solid var(--border);
          border-radius: 12px;
          transition: all 0.3s ease;
        }
        
        .risk-card:hover {
          background: var(--card-hover);
          border-color: rgba(0, 212, 170, 0.3);
          transform: translateY(-2px);
        }
        
        /* Tabs */
        .tab-btn {
          padding: 12px 24px;
          background: transparent;
          border: none;
          color: var(--muted);
          font-weight: 500;
          cursor: pointer;
          position: relative;
          transition: color 0.3s ease;
        }
        
        .tab-btn:hover {
          color: var(--fg);
        }
        
        .tab-btn.active {
          color: var(--accent);
        }
        
        .tab-btn.active::after {
          content: '';
          position: absolute;
          bottom: 0;
          left: 0;
          right: 0;
          height: 2px;
          background: var(--accent);
          border-radius: 2px 2px 0 0;
        }
        
        .tab-content {
          display: none;
          animation: fadeIn 0.4s ease;
        }
        
        .tab-content.active {
          display: block;
        }
        
        @keyframes fadeIn {
          from { opacity: 0; transform: translateY(10px); }
          to { opacity: 1; transform: translateY(0); }
        }
        
        /* Progress bars */
        .progress-track {
          height: 8px;
          background: var(--bg-elevated);
          border-radius: 4px;
          overflow: hidden;
        }
        
        .progress-fill {
          height: 100%;
          border-radius: 4px;
          transition: width 1s ease;
        }
        
        /* Status indicators */
        .status-dot {
          width: 8px;
          height: 8px;
          border-radius: 50%;
          animation: pulse 2s infinite;
        }
        
        @keyframes pulse {
          0%, 100% { opacity: 1; }
          50% { opacity: 0.5; }
        }
        
        /* Canvas container */
        .chart-container {
          position: relative;
          width: 100%;
          aspect-ratio: 16/9;
          min-height: 300px;
        }
        
        .chart-container canvas {
          position: absolute;
          inset: 0;
          width: 100%;
          height: 100%;
        }
        
        /* Tooltip */
        .chart-tooltip {
          position: absolute;
          background: var(--bg-elevated);
          border: 1px solid var(--border);
          border-radius: 8px;
          padding: 12px 16px;
          pointer-events: none;
          opacity: 0;
          transform: translateY(5px);
          transition: all 0.2s ease;
          z-index: 100;
          box-shadow: 0 10px 40px rgba(0,0,0,0.4);
        }
        
        .chart-tooltip.visible {
          opacity: 1;
          transform: translateY(0);
        }
        
        /* Table styles */
        .risk-table {
          width: 100%;
          border-collapse: collapse;
        }
        
        .risk-table th {
          text-align: left;
          padding: 12px 16px;
          font-weight: 600;
          color: var(--muted);
          font-size: 12px;
          text-transform: uppercase;
          letter-spacing: 0.05em;
          border-bottom: 1px solid var(--border);
        }
        
        .risk-table td {
          padding: 16px;
          border-bottom: 1px solid var(--border);
        }
        
        .risk-table tr:hover td {
          background: rgba(0, 212, 170, 0.03);
        }
        
        /* Scrollbar */
        ::-webkit-scrollbar {
          width: 8px;
          height: 8px;
        }
        
        ::-webkit-scrollbar-track {
          background: var(--bg-elevated);
        }
        
        ::-webkit-scrollbar-thumb {
          background: var(--border);
          border-radius: 4px;
        }
        
        ::-webkit-scrollbar-thumb:hover {
          background: var(--muted);
        }
        
        /* Reduced motion */
        @media (prefers-reduced-motion: reduce) {
          *, *::before, *::after {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
          }
        }
        
        /* Responsive */
        @media (max-width: 768px) {
          .tab-btn {
            padding: 10px 16px;
            font-size: 14px;
          }
        }
      </style>
    </head>
    <body>
      <div class="bg-atmosphere"></div>
      <div class="grid-overlay"></div>
      
      <!-- Header -->
      <header class="sticky top-0 z-50 backdrop-blur-xl bg-[var(--bg)]/80 border-b border-[var(--border)]">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
          <div class="flex items-center justify-between h-16">
            <div class="flex items-center gap-4">
              <div class="flex items-center gap-3">
                <svg class="w-8 h-8 text-[var(--accent)]" viewBox="0 0 32 32" fill="none">
                  <path d="M16 2L4 10v12l12 8 12-8V10L16 2z" stroke="currentColor" stroke-width="2" fill="none"/>
                  <path d="M16 10l6 4v6l-6 4-6-4v-6l6-4z" fill="currentColor" opacity="0.3"/>
                  <circle cx="16" cy="16" r="3" fill="currentColor"/>
                </svg>
                <span class="text-lg font-bold tracking-tight">CatRisk<span class="text-[var(--accent)]">Hub</span></span>
              </div>
              <span class="hidden sm:inline-block px-2 py-1 text-xs font-medium bg-[var(--accent-dim)] text-[var(--accent)] rounded">Enterprise</span>
            </div>
            
            <div class="flex items-center gap-4">
              <span class="hidden md:flex items-center gap-2 text-sm text-[var(--muted)]">
                <span class="status-dot bg-[var(--gain)]"></span>
                All systems operational
              </span>
              <span class="mono text-sm text-[var(--muted)]">v3.2.1</span>
            </div>
          </div>
        </div>
      </header>
      
      <main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
        <!-- Page Title -->
        <div class="mb-8">
          <h1 class="text-2xl sm:text-3xl font-bold mb-2">Risk Aggregation Dashboard</h1>
          <p class="text-[var(--muted)]">Global portfolio catastrophe exposure analysis • Last updated: <span class="mono">2024-01-15 14:32 UTC</span></p>
        </div>
        
        <!-- Key Metrics -->
        <div class="grid grid-cols-2 lg:grid-cols-4 gap-4 mb-8">
          <div class="risk-card p-5" id="metric-tiv">
            <div class="flex items-center justify-between mb-3">
              <span class="text-sm text-[var(--muted)]">Total Insured Value</span>
              <svg class="w-5 h-5 text-[var(--info)]" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                <path d="M12 2v20M2 12h20"/>
              </svg>
            </div>
            <div class="text-2xl sm:text-3xl font-bold mono" data-target="847.3">$0</div>
            <div class="text-xs text-[var(--muted)] mt-1">Billion USD</div>
          </div>
          
          <div class="risk-card p-5" id="metric-pml">
            <div class="flex items-center justify-between mb-3">
              <span class="text-sm text-[var(--muted)]">1-in-100 PML</span>
              <svg class="w-5 h-5 text-[var(--warning)]" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                <path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z"/>
              </svg>
            </div>
            <div class="text-2xl sm:text-3xl font-bold mono text-[var(--warning)]" data-target="12.8">$0</div>
            <div class="text-xs text-[var(--muted)] mt-1">Billion USD Gross</div>
          </div>
          
          <div class="risk-card p-5" id="metric-ri">
            <div class="flex items-center justify-between mb-3">
              <span class="text-sm text-[var(--muted)]">Reinsurance Recovery</span>
              <svg class="w-5 h-5 text-[var(--gain)]" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/>
              </svg>
            </div>
            <div class="text-2xl sm:text-3xl font-bold mono text-[var(--gain)]" data-target="8.4">$0</div>
            <div class="text-xs text-[var(--muted)] mt-1">Billion USD at 1-in-100</div>
          </div>
          
          <div class="risk-card p-5" id="metric-net">
            <div class="flex items-center justify-between mb-3">
              <span class="text-sm text-[var(--muted)]">Net PML</span>
                <svg class="w-5 h-5 text-[var(--accent)]" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                <circle cx="12" cy="12" r="10"/>
                <path d="M12 6v6l4 2"/>
              </svg>
            </div>
            <div class="text-2xl sm:text-3xl font-bold mono text-[var(--accent)]" data-target="4.4">$0</div>
            <div class="text-xs text-[var(--muted)] mt-1">Billion USD Net Retained</div>
          </div>
        </div>
        
        <!-- Tab Navigation -->
        <div class="risk-card mb-6">
          <div class="flex overflow-x-auto border-b border-[var(--border)]">
            <button class="tab-btn active" data-tab="exposure">Exposure Data</button>
            <button class="tab-btn" data-tab="events">Event Sets</button>
            <button class="tab-btn" data-tab="tail">Tail Metrics</button>
            <button class="tab-btn" data-tab="reinsurance">Reinsurance</button>
            <button class="tab-btn" data-tab="governance">Governance</button>
          </div>
          
          <!-- Exposure Data Tab -->
          <div class="tab-content active p-6" id="exposure">
            <div class="grid lg:grid-cols-2 gap-6">
              <!-- Geographic Distribution -->
              <div>
                <h3 class="text-lg font-semibold mb-4">Geographic Exposure Distribution</h3>
                <div class="chart-container rounded-lg overflow-hidden bg-[var(--bg-elevated)]">
                  <canvas id="heatmapCanvas"></canvas>
                </div>
                <div class="mt-4 grid grid-cols-2 gap-3">
                  <div class="flex items-center gap-2 text-sm">
                    <span class="w-3 h-3 rounded bg-[#ff6b35]"></span>
                    <span class="text-[var(--muted)]">High Exposure</span>
                  </div>
                  <div class="flex items-center gap-2 text-sm">
                    <span class="w-3 h-3 rounded bg-[#00d4aa]"></span>
                    <span class="text-[var(--muted)]">Medium Exposure</span>
                  </div>
                  <div class="flex items-center gap-2 text-sm">
                    <span class="w-3 h-3 rounded bg-[#3b82f6]"></span>
                    <span class="text-[var(--muted)]">Low Exposure</span>
                  </div>
                  <div class="flex items-center gap-2 text-sm">
                    <span class="w-3 h-3 rounded bg-[#1a2130]"></span>
                    <span class="text-[var(--muted)]">No Data</span>
                  </div>
                </div>
              </div>
              
              <!-- Exposure by Peril -->
              <div>
                <h3 class="text-lg font-semibold mb-4">Exposure by Peril Type</h3>
                <div class="space-y-4" id="perilBars">
                  <!-- Populated by JS -->
                </div>
              </div>
            </div>
            
            <!-- Portfolio Summary Table -->
            <div class="mt-8">
              <h3 class="text-lg font-semibold mb-4">Portfolio Summary by Region</h3>
              <div class="overflow-x-auto">
                <table class="risk-table">
                  <thead>
                    <tr>
                      <th>Region</th>
                      <th>TIV (M USD)</th>
                      <th>Policies</th>
                      <th>Avg. Value</th>
                      <th>Concentration</th>
                    </tr>
                  </thead>
                  <tbody id="portfolioTable">
                    <!-- Populated by JS -->
                  </tbody>
                </table>
              </div>
            </div>
          </div>
          
          <!-- Event Sets Tab -->
          <div class="tab-content p-6" id="events">
            <div class="grid lg:grid-cols-3 gap-6 mb-6">
              <div class="lg:col-span-2">
                <h3 class="text-lg font-semibold mb-4">Loss Exceedance Curve</h3>
                <div class="chart-container rounded-lg overflow-hidden bg-[var(--bg-elevated)]">
                  <canvas id="lecCanvas"></canvas>
                  <div class="chart-tooltip" id="lecTooltip"></div>
                </div>
              </div>
              
              <div>
                <h3 class="text-lg font-semibold mb-4">Event Set Configuration</h3>
                <div class="space-y-3" id="eventSetsList">
                  <!-- Populated by JS -->
                </div>
              </div>
            </div>
            
            <!-- Event Comparison -->
            <div>
              <h3 class="text-lg font-semibold mb-4">Event Set Comparison</h3>
              <div class="overflow-x-auto">
                <table class="risk-table">
                  <thead>
                    <tr>
                      <th>Event Set</th>
                      <th>Peril</th>
                      <th>Events</th>
                      <th>Years</th>
                      <th>1-in-100 Loss</th>
                      <th>1-in-250 Loss</th>
                      <th>Status</th>
                    </tr>
                  </thead>
                  <tbody id="eventComparisonTable">
                    <!-- Populated by JS -->
                  </tbody>
                </table>
              </div>
            </div>
          </div>
          
          <!-- Tail Metrics Tab -->
          <div class="tab-content p-6" id="tail">
            <div class="grid lg:grid-cols-2 gap-6 mb-6">
              <div>
                <h3 class="text-lg font-semibold mb-4">Return Period Analysis</h3>
                <div class="chart-container rounded-lg overflow-hidden bg-[var(--bg-elevated)]">
                  <canvas id="returnPeriodCanvas"></canvas>
                </div>
              </div>
              
              <div>
                <h3 class="text-lg font-semibold mb-4">VaR / TVaR Comparison</h3>
                <div class="space-y-4" id="varTvarBars">
                  <!-- Populated by JS -->
                </div>
              </div>
            </div>
            
            <!-- Tail Metrics Table -->
            <div>
              <h3 class="text-lg font-semibold mb-4">Complete Return Period Metrics</h3>
              <div class="overflow-x-auto">
                <table class="risk-table">
                  <thead>
                    <tr>
                      <th>Return Period</th>
                      <th>Exceedance Prob.</th>
                      <th>Gross Loss (M)</th>
                      <th>Pre-Cat Net (M)</th>
                      <th>Post-Cat Net (M)</th>
                      <th>ROE Impact</th>
                    </tr>
                  </thead>
                  <tbody id="tailMetricsTable">
                    <!-- Populated by JS -->
                  </tbody>
                </table>
              </div>
            </div>
          </div>
          
          <!-- Reinsurance Tab -->
          <div class="tab-content p-6" id="reinsurance">
            <div class="grid lg:grid-cols-3 gap-6 mb-6">
              <div class="lg:col-span-2">
                <h3 class="text-lg font-semibold mb-4">Reinsurance Program Structure</h3>
                <div class="chart-container rounded-lg overflow-hidden bg-[var(--bg-elevated)]" style="aspect-ratio: 2/1;">
                  <canvas id="riStructureCanvas"></canvas>
                </div>
              </div>
              
              <div>
                <h3 class="text-lg font-semibold mb-4">Program Summary</h3>
                <div class="space-y-4">
                  <div class="p-4 rounded-lg bg-[var(--bg-elevated)]">
                    <div class="text-sm text-[var(--muted)] mb-1">Total Capacity</div>
                    <div class="text-xl font-bold mono">$2.5B</div>
                  </div>
                  <div class="p-4 rounded-lg bg-[var(--bg-elevated)]">
                    <div class="text-sm text-[var(--muted)] mb-1">Annual Premium</div>
                    <div class="text-xl font-bold mono">$485M</div>
                  </div>
                  <div class="p-4 rounded-lg bg-[var(--bg-elevated)]">
                    <div class="text-sm text-[var(--muted)] mb-1">Rate on Line</div>
                    <div class="text-xl font-bold mono">19.4%</div>
                  </div>
                  <div class="p-4 rounded-lg bg-[var(--bg-elevated)]">
                    <div class="text-sm text-[var(--muted)] mb-1">Expected Recovery</div>
                    <div class="text-xl font-bold mono text-[var(--gain)]">$8.4B</div>
                    <div class="text-xs text-[var(--muted)]">at 1-in-100</div>
                  </div>
                </div>
              </div>
            </div>
            
            <!-- Reinsurance Layers -->
            <div>
              <h3 class="text-lg font-semibold mb-4">Layer Details</h3>
              <div class="overflow-x-auto">
                <table class="risk-table">
                  <thead>
                    <tr>
                      <th>Layer</th>
                      <th>Type</th>
                      <th>Attachment</th>
                      <th>Limit</th>
                      <th>Premium</th>
                      <th>Exhaustion</th>
                      <th>Recovery @ 1-in-100</th>
                    </tr>
                  </thead>
                  <tbody id="riLayersTable">
                    <!-- Populated by JS -->
                  </tbody>
                </table>
              </div>
            </div>
          </div>
          
          <!-- Governance Tab -->
          <div class="tab-content p-6" id="governance">
            <div class="grid lg:grid-cols-3 gap-6 mb-6">
              <div class="lg:col-span-2">
                <h3 class="text-lg font-semibold mb-4">Approval Workflow</h3>
                <div id="approvalWorkflow" class="space-y-4">
                  <!-- Populated by JS -->
                </div>
              </div>
              
              <div>
                <h3 class="text-lg font-semibold mb-4">Data Quality Score</h3>
                <div class="p-6 rounded-lg bg-[var(--bg-elevated)]">
                  <div class="relative w-32 h-32 mx-auto mb-4">
                    <svg class="w-full h-full transform -rotate-90" viewBox="0 0 100 100">
                      <circle cx="50" cy="50" r="45" fill="none" stroke="var(--border)" stroke-width="8"/>
                      <circle cx="50" cy="50" r="45" fill="none" stroke="var(--accent)" stroke-width="8"
                        stroke-dasharray="282.7" stroke-dashoffset="31" stroke-linecap="round"
                        class="transition-all duration-1000"/>
                    </svg>
                    <div class="absolute inset-0 flex items-center justify-center">
                      <span class="text-3xl font-bold mono">89%</span>
                    </div>
                  </div>
                  <div class="space-y-2 text-sm">
                    <div class="flex justify-between">
                      <span class="text-[var(--muted)]">Completeness</span>
                      <span class="mono">94%</span>
                    </div>
                    <div class="flex justify-between">
                      <span class="text-[var(--muted)]">Accuracy</span>
                      <span class="mono">91%</span>
                    </div>
                    <div class="flex justify-between">
                      <span class="text-[var(--muted)]">Timeliness</span>
                      <span class="mono">88%</span>
                    </div>
                    <div class="flex justify-between">
                      <span class="text-[var(--muted)]">Validation</span>
                      <span class="mono">85%</span>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            
            <!-- Audit Trail -->
            <div>
              <h3 class="text-lg font-semibold mb-4">Recent Audit Trail</h3>
              <div class="overflow-x-auto">
                <table class="risk-table">
                  <thead>
                    <tr>
                      <th>Timestamp</th>
                      <th>User</th>
                      <th>Action</th>
                      <th>Module</th>
                      <th>Details</th>
                      <th>Status</th>
                    </tr>
                  </thead>
                  <tbody id="auditTrailTable">
                    <!-- Populated by JS -->
                  </tbody>
                </table>
              </div>
            </div>
          </div>
        </div>
      </main>
      
      <script>
        // ==================== DATA ====================
        const portfolioData = [
          { region: 'North America - East Coast', tiv: 245800, policies: 18420, concentration: 29.0 },
          { region: 'North America - West Coast', tiv: 198500, policies: 15340, concentration: 23.4 },
          { region: 'Europe - Western', tiv: 156200, policies: 22150, concentration: 18.4 },
          { region: 'Asia Pacific - Japan', tiv: 112400, policies: 8920, concentration: 13.3 },
          { region: 'Caribbean', tiv: 78900, policies: 4280, concentration: 9.3 },
          { region: 'Other', tiv: 55200, policies: 6890, concentration: 6.5 }
        ];
        
        const perilData = [
          { peril: 'Hurricane / Typhoon', exposure: 312.5, color: '#f97316' },
          { peril: 'Earthquake', exposure: 245.8, color: '#ef4444' },
          { peril: 'Flood', exposure: 134.2, color: '#3b82f6' },
          { peril: 'Severe Storm', exposure: 89.6, color: '#8b5cf6' },
          { peril: 'Wildfire', exposure: 45.3, color: '#f59e0b' },
          { peril: 'Other', exposure: 19.9, color: '#64748b' }
        ];
        
        const eventSets = [
          { name: 'GSH-2024-HUR', peril: 'Hurricane', events: 2500, years: 10000, p100: 8.4, p250: 12.1, status: 'active' },
          { name: 'GSH-2024-EQS', peril: 'Earthquake', events: 1850, years: 10000, p100: 3.2, p250: 5.8, status: 'active' },
          { name: 'GSH-2024-FLD', peril: 'Flood', events: 3200, years: 10000, p100: 1.8, p250: 2.9, status: 'active' },
          { name: 'GSH-2023-HUR', peril: 'Hurricane', events: 2200, years: 10000, p100: 7.9, p250: 11.4, status: 'archived' },
          { name: 'Vendor-A-2024', peril: 'All Perils', events: 5000, years: 50000, p100: 9.2, p250: 14.8, status: 'validation' }
        ];
        
        const returnPeriodMetrics = [
          { rp: 10, prob: '10.00%', gross: 2450, preCat: 1890, postCat: 1450, roe: '-2.1%' },
          { rp: 25, prob: '4.00%', gross: 4120, preCat: 2840, postCat: 1980, roe: '-4.8%' },
          { rp: 50, prob: '2.00%', gross: 6890, preCat: 4120, postCat: 2540, roe: '-8.2%' },
          { rp: 100, prob: '1.00%', gross: 12800, preCat: 8400, postCat: 4400, roe: '-15.4%' },
          { rp: 150, prob: '0.67%', gross: 17200, preCat: 11600, postCat: 5600, roe: '-21.2%' },
          { rp: 200, prob: '0.50%', gross: 22100, preCat: 15200, postCat: 6900, roe: '-28.5%' },
          { rp: 250, prob: '0.40%', gross: 28400, preCat: 19800, postCat: 8600, roe: '-36.8%' }
        ];
        
        const riLayers = [
          { layer: 'Quota Share', type: 'Proportional', attachment: 0, limit: 'Unlimited', premium: '$125M', exhaustion: 'N/A', recovery: '$2.1B' },
          { layer: 'Cat XOL 1', type: 'Non-Proportional', attachment: '$2.0B', limit: '$500M', premium: '$85M', exhaustion: '$2.5B', recovery: '$500M' },
          { layer: 'Cat XOL 2', type: 'Non-Proportional', attachment: '$2.5B', limit: '$750M', premium: '$120M', exhaustion: '$3.25B', recovery: '$750M' },
          { layer: 'Cat XOL 3', type: 'Non-Proportional', attachment: '$3.25B', limit: '$1.0B', premium: '$155M', exhaustion: '$4.25B', recovery: '$0' }
        ];
        
        const approvalSteps = [
          { step: 'Data Submission', status: 'complete', user: 'J. Martinez', date: '2024-01-10', comment: 'Q4 2024 exposure data uploaded' },
          { step: 'Actuarial Review', status: 'complete', user: 'S. Chen', date: '2024-01-12', comment: 'Model validation passed' },
          { step: 'Risk Committee', status: 'in-progress', user: 'M. Williams', date: '2024-01-15', comment: 'Awaiting final approval' },
          { step: 'Board Sign-off', status: 'pending', user: '—', date: '—', comment: 'Scheduled for Jan 20' }
        ];
        
        const auditTrail = [
          { ts: '2024-01-15 14:32', user: 'system', action: 'Auto-aggregation', module: 'Exposure', details: 'Quarterly portfolio refresh', status: 'success' },
          { ts: '2024-01-15 11:20', user: 's.chen', action: 'Model run', module: 'Events', details: 'GSH-2024-HUR full simulation', status: 'success' },
          { ts: '2024-01-14 16:45', user: 'j.martinez', action: 'Data import', module: 'Exposure', details: '8,420 new locations added', status: 'success' },
          { ts: '2024-01-14 09:15', user: 'm.williams', action: 'Config change', module: 'Reinsurance', details: 'Cat XOL 3 limit increased to $1.0B', status: 'warning' },
          { ts: '2024-01-13 17:30', user: 'system', action: 'Validation', module: 'Governance', details: 'Data quality check failed 2 records', status: 'error' }
        ];
        
        // Loss exceedance curve data points
        const lecData = [];
        for (let i = 0; i <= 100; i++) {
          const prob = 1 - (i / 100);
          const grossLoss = Math.max(0, 45000 * Math.pow(prob, 0.35) * (1 + 0.2 * Math.sin(i * 0.1)));
          const netLoss = Math.max(0, grossLoss * 0.35 * (1 + 0.1 * Math.random()));
          lecData.push({ prob: prob * 100, gross: grossLoss, net: netLoss });
        }
        
        // ==================== INITIALIZATION ====================
        let heatmapCanvas, heatmapCtx;
        let lecCanvas, lecCtx;
        let rpCanvas, rpCtx;
        let riCanvas, riCtx;
        
        document.addEventListener('DOMContentLoaded', () => {
          initTabs();
          initMetricCounters();
          populatePerilBars();
          populatePortfolioTable();
          populateEventSets();
          populateEventComparisonTable();
          populateVarTvarBars();
          populateTailMetricsTable();
          populateRiLayersTable();
          populateApprovalWorkflow();
          populateAuditTrail();
          
          // Initialize canvases after DOM is ready
          heatmapCanvas = document.getElementById('heatmapCanvas');
          lecCanvas = document.getElementById('lecCanvas');
          rpCanvas = document.getElementById('returnPeriodCanvas');
          riCanvas = document.getElementById('riStructureCanvas');
          
          if (heatmapCanvas) heatmapCtx = heatmapCanvas.getContext('2d');
          if (lecCanvas) lecCtx = lecCanvas.getContext('2d');
          if (rpCanvas) rpCtx = rpCanvas.getContext('2d');
          if (riCanvas) riCtx = riCanvas.getContext('2d');
          
          // Draw charts with slight delay for animation
          setTimeout(() => {
            drawHeatmap();
            drawLEC();
            drawReturnPeriod();
            drawRIStructure();
          }, 300);
          
          // Handle resize
          window.addEventListener('resize', debounce(() => {
            drawHeatmap();
            drawLEC();
            drawReturnPeriod();
            drawRIStructure();
          }, 250));
        });
        
        // ==================== TABS ====================
        function initTabs() {
          const tabBtns = document.querySelectorAll('.tab-btn');
          tabBtns.forEach(btn => {
            btn.addEventListener('click', () => {
              tabBtns.forEach(b => b.classList.remove('active'));
              btn.classList.add('active');
              
              document.querySelectorAll('.tab-content').forEach(content => {
                content.classList.remove('active');
              });
              
              const tabId = btn.dataset.tab;
              const tabContent = document.getElementById(tabId);
              if (tabContent) {
                tabContent.classList.add('active');
              }
              
              // Redraw charts when tab becomes visible
              setTimeout(() => {
                if (tabId === 'exposure') drawHeatmap();
                if (tabId === 'events') drawLEC();
                if (tabId === 'tail') drawReturnPeriod();
                if (tabId === 'reinsurance') drawRIStructure();
              }, 50);
            });
          });
        }
        
        // ==================== METRIC COUNTERS ====================
        function initMetricCounters() {
          const counters = document.querySelectorAll('[data-target]');
          counters.forEach(counter => {
            const target = parseFloat(counter.dataset.target);
            animateCounter(counter, 0, target, 1500);
          });
        }
        
        function animateCounter(element, start, end, duration) {
          const startTime = performance.now();
          const isDecimal = end % 1 !== 0;
          
          function update(currentTime) {
            const elapsed = currentTime - startTime;
            const progress = Math.min(elapsed / duration, 1);
            const eased = 1 - Math.pow(1 - progress, 3);
            const current = start + (end - start) * eased;
            
            element.textContent = '$' + (isDecimal ? current.toFixed(1) : Math.round(current)) + 'B';
            
            if (progress < 1) {
              requestAnimationFrame(update);
            }
          }
          
          requestAnimationFrame(update);
        }
        
        // ==================== PERIL BARS ====================
        function populatePerilBars() {
          const container = document.getElementById('perilBars');
          if (!container) return;
          
          const maxExposure = Math.max(...perilData.map(p => p.exposure));
          
          container.innerHTML = perilData.map((peril, i) => `
            <div class="p-4 rounded-lg bg-[var(--bg-elevated)]">
              <div class="flex justify-between items-center mb-2">
                <span class="font-medium">${peril.peril}</span>
                <span class="mono text-sm">$${peril.exposure.toFixed(1)}B</span>
              </div>
              <div class="progress-track">
                <div class="progress-fill" style="width: 0%; background: ${peril.color};" 
                     data-width="${(peril.exposure / maxExposure) * 100}%"></div>
              </div>
            </div>
          `).join('');
          
          // Animate bars
          setTimeout(() => {
            container.querySelectorAll('.progress-fill').forEach(bar => {
              bar.style.width = bar.dataset.width;
            });
          }, 100);
        }
        
        // ==================== PORTFOLIO TABLE ====================
        function populatePortfolioTable() {
          const tbody = document.getElementById('portfolioTable');
          if (!tbody) return;
          
          tbody.innerHTML = portfolioData.map(row => `
            <tr>
              <td class="font-medium">${row.region}</td>
              <td class="mono">$${(row.tiv / 1000).toFixed(2)}B</td>
              <td class="mono">${row.policies.toLocaleString()}</td>
              <td class="mono">$${(row.tiv / row.policies).toFixed(1)}M</td>
              <td>
                <div class="flex items-center gap-2">
                  <div class="w-16 h-2 rounded bg-[var(--bg-elevated)]">
                    <div class="h-full rounded bg-[var(--accent)]" style="width: ${row.concentration}%"></div>
                  </div>
                  <span class="mono text-sm">${row.concentration.toFixed(1)}%</span>
                </div>
              </td>
            </tr>
          `).join('');
        }
        
        // ==================== EVENT SETS ====================
        function populateEventSets() {
          const container = document.getElementById('eventSetsList');
          if (!container) return;
          
          const statusColors = {
            'active': 'var(--gain)',
            'archived': 'var(--muted)',
            'validation': 'var(--warning)'
          };
          
          container.innerHTML = eventSets.filter(e => e.status === 'active').map(event => `
            <div class="p-4 rounded-lg bg-[var(--bg-elevated)] border-l-4" style="border-color: ${statusColors[event.status]}">
              <div class="flex justify-between items-start mb-2">
                <span class="font-medium text-sm">${event.name}</span>
                <span class="text-xs px-2 py-1 rounded bg-[var(--card)]" style="color: ${statusColors[event.status]}">${event.status}</span>
              </div>
              <div class="text-xs text-[var(--muted)]">${event.peril} • ${event.events.toLocaleString()} events</div>
            </div>
          `).join('');
        }
        
        function populateEventComparisonTable() {
          const tbody = document.getElementById('eventComparisonTable');
          if (!tbody) return;
          
          const statusColors = {
            'active': { bg: 'rgba(16, 185, 129, 0.15)', text: 'var(--gain)' },
            'archived': { bg: 'rgba(100, 116, 139, 0.15)', text: 'var(--muted)' },
            'validation': { bg: 'rgba(245, 158, 11, 0.15)', text: 'var(--warning)' }
          };
          
          tbody.innerHTML = eventSets.map(event => {
            const style = statusColors[event.status];
            return `
              <tr>
                <td class="font-medium mono text-sm">${event.name}</td>
                <td>${event.peril}</td>
                <td class="mono">${event.events.toLocaleString()}</td>
                <td class="mono">${event.years.toLocaleString()}</td>
                <td class="mono text-[var(--warning)]">$${event.p100.toFixed(1)}B</td>
                <td class="mono text-[var(--danger)]">$${event.p250.toFixed(1)}B</td>
                <td>
                  <span class="px-2 py-1 rounded text-xs font-medium" 
                        style="background: ${style.bg}; color: ${style.text}">
                    ${event.status}
                  </span>
                </td>
              </tr>
            `;
          }).join('');
        }
        
        // ==================== VAR/TVAR BARS ====================
        function populateVarTvarBars() {
          const container = document.getElementById('varTvarBars');
          if (!container) return;
          
          const metrics = [
            { label: 'VaR @ 99% (1-in-100)', var: 12.8, tvar: 18.4 },
            { label: 'VaR @ 99.5% (1-in-200)', var: 22.1, tvar: 28.6 },
            { label: 'VaR @ 99.6% (1-in-250)', var: 28.4, tvar: 36.2 }
          ];
          
          const maxLoss = Math.max(...metrics.flatMap(m => [m.var, m.tvar]));
          
          container.innerHTML = metrics.map(m => `
            <div class="p-4 rounded-lg bg-[var(--bg-elevated)]">
              <div class="text-sm text-[var(--muted)] mb-3">${m.label}</div>
              <div class="space-y-2">
                <div>
                  <div class="flex justify-between text-xs mb-1">
                    <span>VaR</span>
                    <span class="mono">$${m.var.toFixed(1)}B</span>
                  </div>
                  <div class="progress-track">
                    <div class="progress-fill bg-[var(--warning)]" style="width: ${(m.var / maxLoss) * 100}%"></div>
                  </div>
                </div>
                <div>
                  <div class="flex justify-between text-xs mb-1">
                    <span>TVaR</span>
                    <span class="mono text-[var(--danger)]">$${m.tvar.toFixed(1)}B</span>
                  </div>
                  <div class="progress-track">
                    <div class="progress-fill bg-[var(--danger)]" style="width: ${(m.tvar / maxLoss) * 100}%"></div>
                  </div>
                </div>
              </div>
            </div>
          `).join('');
        }
        
        // ==================== TAIL METRICS TABLE ====================
        function populateTailMetricsTable() {
          const tbody = document.getElementById('tailMetricsTable');
          if (!tbody) return;
          
          tbody.innerHTML = returnPeriodMetrics.map((row, i) => `
            <tr class="${i >= 3 ? 'bg-[rgba(239,68,68,0.03)]' : ''}">
              <td class="font-medium">1-in-${row.rp}</td>
              <td class="mono text-[var(--muted)]">${row.prob}</td>
              <td class="mono">$${(row.gross / 1000).toFixed(2)}B</td>
              <td class="mono text-[var(--info)]">$${(row.preCat / 1000).toFixed(2)}B</td>
              <td class="mono text-[var(--accent)]">$${(row.postCat / 1000).toFixed(2)}B</td>
              <td class="mono ${row.roe.startsWith('-') ? 'text-[var(--danger)]' : 'text-[var(--gain)]'}">${row.roe}</td>
            </tr>
          `).join('');
        }
        
        // ==================== RI LAYERS TABLE ====================
        function populateRiLayersTable() {
          const tbody = document.getElementById('riLayersTable');
          if (!tbody) return;
          
          tbody.innerHTML = riLayers.map((layer, i) => `
            <tr>
              <td class="font-medium">${layer.layer}</td>
              <td>
                <span class="px-2 py-1 rounded text-xs ${layer.type === 'Proportional' ? 'bg-[rgba(59,130,246,0.15)] text-[var(--info)]' : 'bg-[rgba(0,212,170,0.15)] text-[var(--accent)]'}">
                  ${layer.type}
                </span>
              </td>
              <td class="mono">${layer.attachment}</td>
              <td class="mono">${layer.limit}</td>
              <td class="mono">${layer.premium}</td>
              <td class="mono">${layer.exhaustion}</td>
              <td class="mono ${layer.recovery !== '$0' ? 'text-[var(--gain)]' : 'text-[var(--muted)]'}">${layer.recovery}</td>
            </tr>
          `).join('');
        }
        
        // ==================== APPROVAL WORKFLOW ====================
        function populateApprovalWorkflow() {
          const container = document.getElementById('approvalWorkflow');
          if (!container) return;
          
          const statusIcons = {
            'complete': `<svg class="w-5 h-5 text-[var(--gain)]" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M9 12l2 2 4-4"/></svg>`,
            'in-progress': `<svg class="w-5 h-5 text-[var(--warning)] animate-spin" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10" stroke-dasharray="60" stroke-dashoffset="20"/></svg>`,
            'pending': `<svg class="w-5 h-5 text-[var(--muted)]" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/></svg>`
          };
          
          container.innerHTML = approvalSteps.map((step, i) => `
            <div class="flex gap-4 ${i < approvalSteps.length - 1 ? 'pb-4 border-l-2 border-[var(--border)] ml-2.5' : 'ml-2.5'}" style="margin-left: ${i === 0 ? '0' : '10px'}; padding-left: ${i === 0 ? '0' : '20px'}; ${i === 0 ? 'border-left: none;' : ''}">
              <div class="flex-shrink-0 ${i > 0 ? '-ml-7' : ''} bg-[var(--card)] p-1 rounded">
                ${statusIcons[step.status]}
              </div>
              <div class="flex-1 p-4 rounded-lg bg-[var(--bg-elevated)]">
                <div class="flex justify-between items-start mb-2">
                  <span class="font-medium">${step.step}</span>
                  <span class="text-xs px-2 py-1 rounded ${
                    step.status === 'complete' ? 'bg-[rgba(16,185,129,0.15)] text-[var(--gain)]' :
                    step.status === 'in-progress' ? 'bg-[rgba(245,158,11,0.15)] text-[var(--warning)]' :
                    'bg-[rgba(100,116,139,0.15)] text-[var(--muted)]'
                  }">${step.status}</span>
                </div>
                <div class="text-sm text-[var(--muted)]">${step.comment}</div>
                <div class="text-xs text-[var(--muted)] mt-2">${step.user} • ${step.date}</div>
              </div>
            </div>
          `).join('');
        }
        
        // ==================== AUDIT TRAIL ====================
        function populateAuditTrail() {
          const tbody = document.getElementById('auditTrailTable');
          if (!tbody) return;
          
          const statusStyles = {
            'success': { bg: 'rgba(16, 185, 129, 0.15)', text: 'var(--gain)' },
            'warning': { bg: 'rgba(245, 158, 11, 0.15)', text: 'var(--warning)' },
            'error': { bg: 'rgba(239, 68, 68, 0.15)', text: 'var(--danger)' }
          };
          
          tbody.innerHTML = auditTrail.map(row => {
            const style = statusStyles[row.status];
            return `
              <tr>
                <td class="mono text-sm">${row.ts}</td>
                <td>${row.user}</td>
                <td class="font-medium">${row.action}</td>
                <td>${row.module}</td>
                <td class="text-sm text-[var(--muted)]">${row.details}</td>
                <td>
                  <span class="px-2 py-1 rounded text-xs font-medium" style="background: ${style.bg}; color: ${style.text}">
                    ${row.status}
                  </span>
                </td>
              </tr>
            `;
          }).join('');
        }
        
        // ==================== CANVAS: HEATMAP ====================
        function drawHeatmap() {
          if (!heatmapCanvas || !heatmapCtx) return;
          
          const rect = heatmapCanvas.getBoundingClientRect();
          const dpr = window.devicePixelRatio || 1;
          heatmapCanvas.width = rect.width * dpr;
          heatmapCanvas.height = rect.height * dpr;
          heatmapCtx.scale(dpr, dpr);
          
          const w = rect.width;
          const h = rect.height;
          
          // Background
          heatmapCtx.fillStyle = '#12171f';
          heatmapCtx.fillRect(0, 0, w, h);
          
          // Simplified world map regions (abstract representation)
          const regions = [
            // North America
            { x: 0.12, y: 0.25, w: 0.22, h: 0.25, exposure: 0.85, name: 'NA East' },
            { x: 0.08, y: 0.35, w: 0.12, h: 0.2, exposure: 0.72, name: 'NA West' },
            // Europe
            { x: 0.42, y: 0.2, w: 0.12, h: 0.18, exposure: 0.58, name: 'Europe' },
            // Asia
            { x: 0.6, y: 0.25, w: 0.18, h: 0.25, exposure: 0.45, name: 'Asia' },
            // Caribbean
            { x: 0.18, y: 0.52, w: 0.08, h: 0.08, exposure: 0.92, name: 'Caribbean' },
            // South America
            { x: 0.22, y: 0.6, w: 0.1, h: 0.2, exposure: 0.25, name: 'SA' },
            // Africa
            { x: 0.45, y: 0.45, w: 0.12, h: 0.25, exposure: 0.15, name: 'Africa' },
            // Australia
            { x: 0.75, y: 0.62, w: 0.1, h: 0.12, exposure: 0.35, name: 'Oceania' }
          ];
          
          // Draw grid
          heatmapCtx.strokeStyle = 'rgba(45, 55, 72, 0.3)';
          heatmapCtx.lineWidth = 0.5;
          for (let x = 0; x <= w; x += 30) {
            heatmapCtx.beginPath();
            heatmapCtx.moveTo(x, 0);
            heatmapCtx.lineTo(x, h);
            heatmapCtx.stroke();
          }
          for (let y = 0; y <= h; y += 30) {
            heatmapCtx.beginPath();
            heatmapCtx.moveTo(0, y);
            heatmapCtx.lineTo(w, y);
            heatmapCtx.stroke();
          }
          
          // Draw regions with exposure coloring
          regions.forEach(region => {
            const x = region.x * w;
            const y = region.y * h;
            const rw = region.w * w;
            const rh = region.h * h;
            
            // Color based on exposure level
            let color;
            if (region.exposure > 0.8) {
              color = `rgba(255, 107, 53, ${0.4 + region.exposure * 0.4})`;
            } else if (region.exposure > 0.5) {
              color = `rgba(0, 212, 170, ${0.3 + region.exposure * 0.4})`;
            } else {
              color = `rgba(59, 130, 246, ${0.2 + region.exposure * 0.4})`;
            }
            
            heatmapCtx.fillStyle = color;
            heatmapCtx.fillRect(x, y, rw, rh);
            
            // Border
            heatmapCtx.strokeStyle = 'rgba(255, 255, 255, 0.2)';
            heatmapCtx.lineWidth = 1;
            heatmapCtx.strokeRect(x, y, rw, rh);
            
            // Label
            heatmapCtx.fillStyle = 'rgba(255, 255, 255, 0.8)';
            heatmapCtx.font = '10px "Space Mono"';
            heatmapCtx.fillText(region.name, x + 4, y + 12);
          });
          
          // Draw hotspots (cities)
          const hotspots = [
            { x: 0.22, y: 0.38, size: 8, name: 'Miami' },
            { x: 0.15, y: 0.32, size: 6, name: 'LA' },
            { x: 0.46, y: 0.28, size: 5, name: 'London' },
            { x: 0.72, y: 0.35, size: 7, name: 'Tokyo' },
            { x: 0.2, y: 0.54, size: 5, name: 'San Juan' }
          ];
          
          hotspots.forEach(spot => {
            const gradient = heatmapCtx.createRadialGradient(
              spot.x * w, spot.y * h, 0,
              spot.x * w, spot.y * h, spot.size * 3
            );
            gradient.addColorStop(0, 'rgba(249, 115, 22, 0.8)');
            gradient.addColorStop(1, 'rgba(249, 115, 22, 0)');
            
            heatmapCtx.fillStyle = gradient;
            heatmapCtx.beginPath();
            heatmapCtx.arc(spot.x * w, spot.y * h, spot.size * 3, 0, Math.PI * 2);
            heatmapCtx.fill();
            
            heatmapCtx.fillStyle = '#ff6b35';
            heatmapCtx.beginPath();
            heatmapCtx.arc(spot.x * w, spot.y * h, 3, 0, Math.PI * 2);
            heatmapCtx.fill();
          });
        }
        
        // ==================== CANVAS: LOSS EXCEEDANCE CURVE ====================
        function drawLEC() {
          if (!lecCanvas || !lecCtx) return;
          
          const rect = lecCanvas.getBoundingClientRect();
          const dpr = window.devicePixelRatio || 1;
          lecCanvas.width = rect.width * dpr;
          lecCanvas.height = rect.height * dpr;
          lecCtx.scale(dpr, dpr);
          
          const w = rect.width;
          const h = rect.height;
          const padding = { top: 30, right: 30, bottom: 50, left: 70 };
          const chartW = w - padding.left - padding.right;
          const chartH = h - padding.top - padding.bottom;
          
          // Background
          lecCtx.fillStyle = '#12171f';
          lecCtx.fillRect(0, 0, w, h);
          
          // Grid
          lecCtx.strokeStyle = 'rgba(45, 55, 72, 0.4)';
          lecCtx.lineWidth = 0.5;
          
          for (let i = 0; i <= 5; i++) {
            const y = padding.top + (chartH / 5) * i;
            lecCtx.beginPath();
            lecCtx.moveTo(padding.left, y);
            lecCtx.lineTo(w - padding.right, y);
            lecCtx.stroke();
            
            // Y labels
            const value = 45 - (45 / 5) * i;
            lecCtx.fillStyle = '#64748b';
            lecCtx.font = '11px "Space Mono"';
            lecCtx.textAlign = 'right';
            lecCtx.fillText(`$${value.toFixed(0)}B`, padding.left - 10, y + 4);
          }
          
          for (let i = 0; i <= 4; i++) {
            const x = padding.left + (chartW / 4) * i;
            lecCtx.beginPath();
            lecCtx.moveTo(x, padding.top);
            lecCtx.lineTo(x, h - padding.bottom);
            lecCtx.stroke();
            
            // X labels
            const prob = 100 - (100 / 4) * i;
            lecCtx.fillStyle = '#64748b';
            lecCtx.font = '11px "Space Mono"';
            lecCtx.textAlign = 'center';
            lecCtx.fillText(`${prob.toFixed(0)}%`, x, h - padding.bottom + 20);
          }
          
          // Axis labels
          lecCtx.fillStyle = '#64748b';
          lecCtx.font = '12px "DM Sans"';
          lecCtx.textAlign = 'center';
          lecCtx.fillText('Exceedance Probability (%)', w / 2, h - 10);
          
          lecCtx.save();
          lecCtx.translate(15, h / 2);
          lecCtx.rotate(-Math.PI / 2);
          lecCtx.fillText('Loss (USD Billions)', 0, 0);
          lecCtx.restore();
          
          // Draw curves
          function drawCurve(data, key, color, fillColor) {
            lecCtx.beginPath();
            data.forEach((point, i) => {
              const x = padding.left + (point.prob / 100) * chartW;
              const y = padding.top + chartH - (point[key] / 45000) * chartH;
              
              if (i === 0) {
                lecCtx.moveTo(x, y);
              } else {
                lecCtx.lineTo(x, y);
              }
            });
            
            // Fill area
            const lastX = padding.left + chartW;
            const firstX = padding.left;
            lecCtx.lineTo(lastX, padding.top + chartH);
            lecCtx.lineTo(firstX, padding.top + chartH);
            lecCtx.closePath();
            lecCtx.fillStyle = fillColor;
            lecCtx.fill();
            
            // Stroke
            lecCtx.beginPath();
            data.forEach((point, i) => {
              const x = padding.left + (point.prob / 100) * chartW;
              const y = padding.top + chartH - (point[key] / 45000) * chartH;
              if (i === 0) lecCtx.moveTo(x, y);
              else lecCtx.lineTo(x, y);
            });
            lecCtx.strokeStyle = color;
            lecCtx.lineWidth = 2;
            lecCtx.stroke();
          }
          
          drawCurve(lecData, 'net', '#00d4aa', 'rgba(0, 212, 170, 0.1)');
          drawCurve(lecData, 'gross', '#f97316', 'rgba(249, 115, 22, 0.1)');
          
          // Legend
          const legendY = padding.top + 10;
          lecCtx.fillStyle = '#f97316';
          lecCtx.fillRect(w - 150, legendY, 20, 3);
          lecCtx.fillStyle = '#e2e8f0';
          lecCtx.font = '11px "DM Sans"';
          lecCtx.textAlign = 'left';
          lecCtx.fillText('Gross Loss', w - 125, legendY + 4);
          
          lecCtx.fillStyle = '#00d4aa';
          lecCtx.fillRect(w - 150, legendY + 18, 20, 3);
          lecCtx.fillStyle = '#e2e8f0';
          lecCtx.fillText('Net Loss', w - 125, legendY + 22);
          
          // 1-in-100 line
          const p100X = padding.left + chartW; // 1% probability
          const p100Y = padding.top + chartH - (12800 / 45000) * chartH;
          lecCtx.strokeStyle = 'rgba(239, 68, 68, 0.6)';
          lecCtx.setLineDash([5, 5]);
          lecCtx.beginPath();
          lecCtx.moveTo(padding.left, p100Y);
          lecCtx.lineTo(p100X, p100Y);
          lecCtx.stroke();
          lecCtx.setLineDash([]);
          
          lecCtx.fillStyle = '#ef4444';
          lecCtx.font = '10px "Space Mono"';
          lecCtx.textAlign = 'right';
          lecCtx.fillText('1-in-100 ($12.8B)', p100X - 10, p100Y - 8);
        }
        
        // ==================== CANVAS: RETURN PERIOD ====================
        function drawReturnPeriod() {
          if (!rpCanvas || !rpCtx) return;
          
          const rect = rpCanvas.getBoundingClientRect();
          const dpr = window.devicePixelRatio || 1;
          rpCanvas.width = rect.width * dpr;
          rpCanvas.height = rect.height * dpr;
          rpCtx.scale(dpr, dpr);
          
          const w = rect.width;
          const h = rect.height;
          const padding = { top: 30, right: 30, bottom: 50, left: 70 };
          const chartW = w - padding.left - padding.right;
          const chartH = h - padding.top - padding.bottom;
          
          // Background
          rpCtx.fillStyle = '#12171f';
          rpCtx.fillRect(0, 0, w, h);
          
          // Grid
          rpCtx.strokeStyle = 'rgba(45, 55, 72, 0.4)';
          rpCtx.lineWidth = 0.5;
          
          const maxLoss = 35;
          for (let i = 0; i <= 5; i++) {
            const y = padding.top + (chartH / 5) * i;
            rpCtx.beginPath();
            rpCtx.moveTo(padding.left, y);
            rpCtx.lineTo(w - padding.right, y);
            rpCtx.stroke();
            
            const value = maxLoss - (maxLoss / 5) * i;
            rpCtx.fillStyle = '#64748b';
            rpCtx.font = '11px "Space Mono"';
            rpCtx.textAlign = 'right';
            rpCtx.fillText(`$${value.toFixed(0)}B`, padding.left - 10, y + 4);
          }
          
          // Bar chart
          const bars = returnPeriodMetrics.slice(0, 5);
          const barWidth = chartW / bars.length - 20;
          
          bars.forEach((bar, i) => {
            const x = padding.left + (chartW / bars.length) * i + 15;
            
            // Gross bar
            const grossH = (bar.gross / 1000 / maxLoss) * chartH;
            const grossY = padding.top + chartH - grossH;
            rpCtx.fillStyle = '#f97316';
            rpCtx.fillRect(x, grossY, barWidth / 2 - 2, grossH);
            
            // Net bar
            const netH = (bar.postCat / 1000 / maxLoss) * chartH;
            const netY = padding.top + chartH - netH;
            rpCtx.fillStyle = '#00d4aa';
            rpCtx.fillRect(x + barWidth / 2 + 2, netY, barWidth / 2 - 2, netH);
            
            // X label
            rpCtx.fillStyle = '#64748b';
            rpCtx.font = '10px "Space Mono"';
            rpCtx.textAlign = 'center';
            rpCtx.fillText(`${bar.rp}yr`, x + barWidth / 2, h - padding.bottom + 20);
          });
          
          // Legend
          rpCtx.fillStyle = '#f97316';
          rpCtx.fillRect(w - 140, padding.top, 15, 10);
          rpCtx.fillStyle = '#e2e8f0';
          rpCtx.font = '11px "DM Sans"';
          rpCtx.textAlign = 'left';
          rpCtx.fillText('Gross', w - 120, padding.top + 9);
          
          rpCtx.fillStyle = '#00d4aa';
          rpCtx.fillRect(w - 140, padding.top + 18, 15, 10);
          rpCtx.fillStyle = '#e2e8f0';
          rpCtx.fillText('Net', w - 120, padding.top + 27);
          
          // Y label
          rpCtx.fillStyle = '#64748b';
          rpCtx.font = '12px "DM Sans"';
          rpCtx.save();
          rpCtx.translate(15, h / 2);
          rpCtx.rotate(-Math.PI / 2);
          rpCtx.fillText('Loss (USD Billions)', 0, 0);
          rpCtx.restore();
        }
        
        // ==================== CANVAS: RI STRUCTURE ====================
        function drawRIStructure() {
          if (!riCanvas || !riCtx) return;
          
          const rect = riCanvas.getBoundingClientRect();
          const dpr = window.devicePixelRatio || 1;
          riCanvas.width = rect.width * dpr;
          riCanvas.height = rect.height * dpr;
          riCtx.scale(dpr, dpr);
          
          const w = rect.width;
          const h = rect.height;
          const padding = { top: 40, right: 40, bottom: 60, left: 80 };
          const chartW = w - padding.left - padding.right;
          const chartH = h - padding.top - padding.bottom;
          
          // Background
          riCtx.fillStyle = '#12171f';
          riCtx.fillRect(0, 0, w, h);
          
          // Draw layer structure
          const layers = [
            { name: 'Retained', start: 0, end: 2000, color: '#ef4444', pattern: 'solid' },
            { name: 'Cat XOL 1', start: 2000, end: 2500, color: '#3b82f6', pattern: 'diagonal' },
            { name: 'Cat XOL 2', start: 2500, end: 3250, color: '#8b5cf6', pattern: 'diagonal' },
            { name: 'Cat XOL 3', start: 3250, end: 4250, color: '#06b6d4', pattern: 'diagonal' },
            { name: 'Above Program', start: 4250, end: 6000, color: '#64748b', pattern: 'solid' }
          ];
          
          const maxLoss = 6000;
          const layerH = chartH / layers.length - 10;
          
          // Scale function
          const scale = (value) => (value / maxLoss) * chartW;
          
          // Y axis labels
          riCtx.fillStyle = '#64748b';
          riCtx.font = '11px "Space Mono"';
          riCtx.textAlign = 'right';
          
          for (let i = 0; i <= 6; i++) {
            const value = (maxLoss / 6) * i;
            const x = padding.left + scale(value);
            riCtx.fillText(`$${(value/1000).toFixed(1)}B`, x, h - padding.bottom + 20);
            
            riCtx.strokeStyle = 'rgba(45, 55, 72, 0.3)';
            riCtx.beginPath();
            riCtx.moveTo(x, padding.top);
            riCtx.lineTo(x, h - padding.bottom);
            riCtx.stroke();
          }
          
          // Draw layers
          layers.forEach((layer, i) => {
            const y = padding.top + i * (layerH + 10);
            const x1 = padding.left + scale(layer.start);
            const x2 = padding.left + scale(layer.end);
            const lw = x2 - x1;
            
            // Pattern fill
            if (layer.pattern === 'diagonal') {
              riCtx.fillStyle = layer.color + '40';
              riCtx.fillRect(x1, y, lw, layerH);
              
              // Diagonal lines
              riCtx.strokeStyle = layer.color + '80';
              riCtx.lineWidth = 1;
              for (let lx = x1; lx < x2; lx += 8) {
                riCtx.beginPath();
                riCtx.moveTo(lx, y);
                riCtx.lineTo(lx + layerH, y + layerH);
                riCtx.stroke();
              }
            } else {
              riCtx.fillStyle = layer.color + '30';
              riCtx.fillRect(x1, y, lw, layerH);
            }
            
            // Border
            riCtx.strokeStyle = layer.color;
            riCtx.lineWidth = 2;
            riCtx.strokeRect(x1, y, lw, layerH);
            
            // Label
            riCtx.fillStyle = '#e2e8f0';
            riCtx.font = '11px "DM Sans"';
            riCtx.textAlign = 'left';
            riCtx.fillText(layer.name, x1 + 8, y + layerH / 2 + 4);
          });
          
          // 1-in-100 event marker
          const p100X = padding.left + scale(12800 / 4); // $12.8B scaled
          if (p100X < w - padding.right) {
            riCtx.strokeStyle = '#f59e0b';
            riCtx.lineWidth = 2;
            riCtx.setLineDash([5, 5]);
            riCtx.beginPath();
            riCtx.moveTo(p100X, padding.top - 10);
            riCtx.lineTo(p100X, h - padding.bottom);
            riCtx.stroke();
            riCtx.setLineDash([]);
            
            riCtx.fillStyle = '#f59e0b';
            riCtx.font = '10px "Space Mono"';
            riCtx.textAlign = 'center';
            riCtx.fillText('1-in-100', p100X, padding.top - 15);
          }
          
          // X axis label
          riCtx.fillStyle = '#64748b';
          riCtx.font = '12px "DM Sans"';
          riCtx.textAlign = 'center';
          riCtx.fillText('Loss Amount', w / 2, h - 10);
        }
        
        // ==================== UTILITIES ====================
        function debounce(fn, delay) {
          let timeout;
          return (...args) => {
            clearTimeout(timeout);
            timeout = setTimeout(() => fn(...args), delay);
          };
        }
      </script>
    </body>
    </html>
    

    This dashboard provides a complete catastrophe risk aggregation view with:

    1. Exposure Data Tab

    • Geographic heatmap visualization showing concentration by region
    • Peril type exposure breakdown with animated progress bars
    • Portfolio summary table with regional details

    2. Event Sets Tab

    • Loss exceedance curve (LEC) showing gross vs net loss
    • Event set configuration panel
    • Comparison table across different model runs

    3. Tail Metrics Tab

    • Return period bar chart (VaR visualization)
    • VaR/TVaR comparison with dual metrics
    • Complete return period table (10yr to 250yr)

    4. Reinsurance Tab

    • Layer structure visualization showing program stacking
    • Summary metrics (capacity, premium, rate on line)
    • Detailed layer table with recovery calculations

    5. Governance Tab

    • Approval workflow with status tracking
    • Data quality score visualization
    • Audit trail with action history

    Design Features:

    • Professional dark theme suited for financial services
    • Space Mono for data/numbers, DM Sans for UI
    • Canvas-based charts for smooth rendering
    • Responsive layout adapts to all screen sizes
    • Animated counters and progress bars
    • Subtle background atmosphere with grid overlay

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.