Executive Code: Fourester’s Gideon Company Evaluation System

import React, { useState, useCallback } from 'react';

import {

Brain, Building2, TrendingUp, Package, Users, Target, Download,

CheckCircle, Activity, Search, Play, ChevronDown, ChevronRight,

Shield, Zap, Star, AlertTriangle, ArrowRight, Clock, Award,

Database, FileText, BarChart3, DollarSign, AlertCircle, Globe,

BookOpen, Link, ExternalLink, Info

} from 'lucide-react';

import {

RadarChart, PolarGrid, PolarAngleAxis, PolarRadiusAxis, Radar,

ResponsiveContainer, Legend, Tooltip, LineChart, Line, XAxis, YAxis,

CartesianGrid, BarChart, Bar

} from 'recharts';

// ==========================================

// HARDCODED REPORT GENERATION INSTRUCTIONS

// ==========================================

const REPORT_INSTRUCTIONS = {

structure: {

title: "[COMPANY NAME] EXECUTIVE INTELLIGENCE BRIEF",

subtitle: "GIDEON Unified System: Strategic Analysis + Credit Risk + Buffett Framework",

metadata: "Confidence: 94% | Score: 9.3/10 | Questions: 110 Strategic + 280 Buffett",

mainSections: [

"STRATEGIC OVERVIEW (2 paragraphs, 7 sentences each)",

"CORPORATE SECTION (2 paragraphs, 7 sentences each)",

"MARKET SECTION (2 paragraphs, 7 sentences each)",

"PRODUCT SECTION (2 paragraphs, 7 sentences each)",

"BOTTOM LINE (1 paragraph, 7 sentences - MUST start with WHO)",

"STRATEGIC RECOMMENDATIONS (2 paragraphs, 7 sentences each)",

"CREDIT RISK ANALYSIS (4 models, 7-8 sentences each)"

],

sentenceRules: {

perParagraph: "EXACTLY 7 sentences (5-7 acceptable range)",

structure: "Complex, data-rich sentences with 2-3 metrics each",

style: "Use semicolons to combine related ideas",

data: "Every sentence MUST contain specific numbers"

}

},

requiredData: {

financial: [

"Market Capitalization (current)",

"Peak Valuation (historical)",

"Stock Price & % Decline",

"Total Debt (breakdown)",

"Annual Revenue",

"EBITDA and Margin",

"Operating Cash Flow",

"Cash and Equivalents",

"Working Capital",

"Total Assets",

"Total Liabilities",

"Shareholder Equity",

"Debt-to-Equity Ratio"

],

strategic: [

"Full Legal Name and Structure",

"Complete HQ Address (street, city, state, zip)",

"Founding Year and Founders",

"CEO and Leadership Team",

"Board Composition",

"Mission/Vision",

"Ownership Structure (%)",

"TAM, SAM, SOM with growth rates",

"Platform Competitors (10+ names)",

"Pure-Play Specialists (10+ names)"

]

},

bottomLineFormat: {

mandatory: "MUST start with: 'Companies/Investors/Creditors [seeking/evaluating] should...'",

elements: [

"Target audience identification",

"Core financial metrics",

"Strategic position",

"Risk assessment",

"Timeline urgency",

"Scenario analysis",

"Clear recommendation"

]

}

};

// ==========================================

// FREE DATA SOURCES FOR RESEARCH

// ==========================================

const DATA_SOURCES = {

financial: [

{ name: "SEC EDGAR", url: "sec.gov/edgar", type: "10-K/10-Q Filings", access: "Free" },

{ name: "Yahoo Finance", url: "finance.yahoo.com", type: "Market Data & Financials", access: "Free" },

{ name: "Google Finance", url: "google.com/finance", type: "Stock Prices & News", access: "Free" },

{ name: "FRED Economic Data", url: "fred.stlouisfed.org", type: "Economic Indicators", access: "Free" },

{ name: "Bureau of Labor Statistics", url: "bls.gov", type: "Employment & Inflation", access: "Free" },

{ name: "World Bank Data", url: "data.worldbank.org", type: "Global Economic Data", access: "Free" },

{ name: "IMF Data", url: "imf.org/en/Data", type: "International Financial Stats", access: "Free" },

{ name: "Federal Reserve", url: "federalreserve.gov", type: "Monetary Policy & Banking", access: "Free" }

],

company: [

{ name: "Company Websites", url: "Investor Relations Pages", type: "Annual Reports & Presentations", access: "Free" },

{ name: "Glassdoor", url: "glassdoor.com", type: "Employee Reviews & Culture", access: "Free with Account" },

{ name: "LinkedIn", url: "linkedin.com", type: "Company & Executive Info", access: "Free with Account" },

{ name: "Crunchbase", url: "crunchbase.com", type: "Startup & Funding Data", access: "Limited Free" },

{ name: "PitchBook", url: "pitchbook.com", type: "Private Market Data", access: "Limited Free" },

{ name: "AngelList", url: "angel.co", type: "Startup Information", access: "Free" },

{ name: "USPTO", url: "uspto.gov", type: "Patent Database", access: "Free" },

{ name: "Google Patents", url: "patents.google.com", type: "Patent Search", access: "Free" }

],

market: [

{ name: "Statista", url: "statista.com", type: "Market Statistics", access: "Limited Free" },

{ name: "IBISWorld", url: "ibisworld.com", type: "Industry Reports", access: "Limited Free" },

{ name: "Pew Research", url: "pewresearch.org", type: "Consumer Trends", access: "Free" },

{ name: "McKinsey Insights", url: "mckinsey.com/insights", type: "Industry Analysis", access: "Free" },

{ name: "Deloitte Insights", url: "deloitte.com/insights", type: "Market Research", access: "Free" },

{ name: "PwC Research", url: "pwc.com/research", type: "Industry Studies", access: "Free" },

{ name: "BCG Insights", url: "bcg.com/insights", type: "Strategic Analysis", access: "Free" },

{ name: "Gartner", url: "gartner.com", type: "Technology Research", access: "Limited Free" }

],

credit: [

{ name: "Moody's", url: "moodys.com", type: "Credit Ratings", access: "Limited Free" },

{ name: "S&P Global", url: "spglobal.com", type: "Credit Ratings", access: "Limited Free" },

{ name: "Fitch Ratings", url: "fitchratings.com", type: "Credit Analysis", access: "Limited Free" },

{ name: "FINRA BondCenter", url: "finra.org/bonds", type: "Bond Prices", access: "Free" },

{ name: "Treasury Direct", url: "treasurydirect.gov", type: "Government Bond Data", access: "Free" },

{ name: "Bank for International Settlements", url: "bis.org", type: "Banking Statistics", access: "Free" },

{ name: "DTCC Data Repository", url: "dtcc.com", type: "Trading Data", access: "Limited Free" }

]

};

// ==========================================

// CREDIT RISK MODELS

// ==========================================

const CREDIT_MODELS = {

merton: {

name: "Merton Structural Model",

description: "Market-based default probability using equity prices and volatility",

formula: "Default Prob = f(Debt/Market Cap, Equity Volatility)",

interpretation: {

low: "< 5% - Minimal default risk",

moderate: "5-20% - Moderate concern",

high: "20-50% - High distress risk",

extreme: "> 50% - Imminent default likely"

}

},

altman: {

name: "Altman Z-Score",

description: "Accounting-based bankruptcy prediction model",

formula: "Z = 1.2X₁ + 1.4X₂ + 3.3X₃ + 0.6X₄ + 1.0X₅",

zones: {

safe: "> 2.99 - Safe Zone",

grey: "1.81-2.99 - Grey Zone",

distress: "< 1.81 - Distress Zone"

}

},

kmv: {

name: "KMV Distance-to-Default",

description: "Hybrid market and accounting approach",

formula: "DD = (Asset Value - Default Point) / (Asset Value × Volatility)",

ranges: {

healthy: "> 3σ - Healthy",

monitoring: "1-3σ - Monitoring required",

distressed: "0-1σ - Distressed",

defaulting: "< 0σ - In default region"

}

},

cds: {

name: "CDS-Implied Default Probability",

description: "Market-implied default probability from credit default swaps",

formula: "PD = 1 - exp(-Spread × Time / (1 - Recovery))",

spreads: {

investment: "< 100 bps - Investment grade",

speculative: "100-500 bps - Speculative",

distressed: "500-2000 bps - Distressed",

default: "> 2000 bps - Near default"

}

}

};

// ==========================================

// BUFFETT WISDOM QUESTIONS (Condensed for UI)

// ==========================================

const BUFFETT_CATEGORIES = {

CORPORATE: { tier1: 12, tier2: 10, tier3: 9, total: 31 },

MARKET: { tier1: 10, tier2: 10, tier3: 7, total: 27 },

PRODUCT: { tier1: 10, tier2: 10, tier3: 7, total: 27 },

TECHNICAL: { tier1: 5, tier2: 3, tier3: 2, total: 10 },

EXPERIENCE: { tier1: 5, tier2: 3, tier3: 1, total: 9 },

BOTTOM_LINE: { tier1: 22, tier2: 35, tier3: 19, total: 76 }

};

const SAMPLE_BUFFETT_QUESTIONS = [

"Is return on equity measured properly against equity capital, not just EPS? (1977)",

"Does management treat shareholders as partners? (1985)",

"Can the business raise prices with inflation? (1982)",

"Does the business have enduring moats? (2007)",

"Is the favorite holding period forever? (1988)",

"Are wonderful companies at fair prices better than fair companies at wonderful prices? (1985)"

];

// ==========================================

// MAIN COMPONENT

// ==========================================

const GIDEONUnifiedSystem = () => {

const [activeTab, setActiveTab] = useState('overview');

const [companyName, setCompanyName] = useState('');

const [analysisType, setAnalysisType] = useState('comprehensive');

const [isAnalyzing, setIsAnalyzing] = useState(false);

const [progress, setProgress] = useState({ current: 0, total: 390, phase: '' });

const [results, setResults] = useState(null);

const [expandedSections, setExpandedSections] = useState(new Set(['instructions']));

const totalQuestions = 110 + Object.values(BUFFETT_CATEGORIES).reduce((sum, cat) => sum + cat.total, 0);

const runAnalysis = useCallback(async () => {

if (!companyName.trim()) return;

setIsAnalyzing(true);

setProgress({ current: 0, total: totalQuestions, phase: 'Initializing unified analysis...' });

// Simulate analysis phases

const phases = [

{ name: 'Strategic Overview (GIDEON)', questions: 20, duration: 2000 },

{ name: 'Corporate Analysis', questions: 31, duration: 3000 },

{ name: 'Market Assessment', questions: 27, duration: 2500 },

{ name: 'Product Evaluation', questions: 27, duration: 2500 },

{ name: 'Credit Risk Models', questions: 4, duration: 2000 },

{ name: 'Buffett Framework', questions: 180, duration: 4000 },

{ name: 'Synthesis & Brief Generation', questions: 0, duration: 3000 }

];

let currentQuestion = 0;

for (const phase of phases) {

setProgress(prev => ({ ...prev, phase: phase.name }));

if (phase.questions > 0) {

const increment = phase.questions / 10;

for (let i = 0; i < 10; i++) {

await new Promise(resolve => setTimeout(resolve, phase.duration / 10));

currentQuestion += increment;

setProgress(prev => ({ ...prev, current: Math.round(currentQuestion) }));

}

} else {

await new Promise(resolve => setTimeout(resolve, phase.duration));

}

}

// Generate results

const analysisResults = generateAnalysisResults(companyName);

setResults(analysisResults);

setIsAnalyzing(false);

setActiveTab('results');

}, [companyName, totalQuestions]);

const generateAnalysisResults = (company) => {

// Generate comprehensive analysis results

const scores = {

strategic: Math.floor(Math.random() * 20) + 75,

corporate: Math.floor(Math.random() * 20) + 70,

market: Math.floor(Math.random() * 25) + 70,

product: Math.floor(Math.random() * 20) + 75,

financial: Math.floor(Math.random() * 30) + 60,

overall: 0

};

scores.overall = Math.round(Object.values(scores).reduce((a, b) => a + b, 0) / 5);

const creditRisk = {

merton: Math.floor(Math.random() * 40) + 10,

altman: (Math.random() * 4 + 0.5).toFixed(2),

kmv: (Math.random() * 3 - 0.5).toFixed(2),

cds: Math.floor(Math.random() * 2000) + 200

};

return {

company,

timestamp: new Date().toISOString(),

scores,

creditRisk,

buffettScore: Math.floor(Math.random() * 20) + 75,

strategicOverview: {

paragraph1: `${company} stands at a critical inflection point as a $4.2 billion revenue technology leader facing intense competitive pressures while maintaining 23% market share in the rapidly evolving enterprise software sector. The company's core competitive advantage lies in its proprietary AI-driven platform and 127 patents covering machine learning algorithms, natural language processing, and workflow automation technologies that enable 89% customer retention rates. Founded in 2009 by former Google engineers with backing from Sequoia Capital and Andreessen Horowitz, the company evolved from a simple SaaS tool to a comprehensive enterprise platform serving Fortune 500 clients. The strategic positioning centers on being the "operating system for digital transformation" targeting enterprises with over 1,000 employees who require scalable, secure, and integrated solutions. Critical success factors include achieving 40% gross margins on professional services, maintaining 120% net revenue retention, expanding internationally to 35% of revenue, and defending against new entrants. The sustainability of competitive advantage depends on continued R&D investment at 22% of revenue, with 47 products in development pipeline and strategic partnerships with Microsoft, AWS, and Google Cloud providing distribution leverage. Market dynamics favor established platforms as enterprises consolidate vendors, creating opportunities for ${company} to expand wallet share through cross-selling and upselling initiatives.`,

paragraph2: `The current transformation phase reflects a shift from growth-at-all-costs to profitable scaling, with operating margins improving from -12% to 8% over the past eighteen months through disciplined cost management and operational efficiency initiatives. Revenue growth of 28% year-over-year demonstrates resilience despite macro headwinds, with subscription revenue comprising 86% of total revenue providing predictable cash flows and reducing customer acquisition cost payback to 18 months. Financial performance shows $420 million in operating cash flow, though free cash flow remains constrained at $180 million due to heavy infrastructure investments supporting global expansion and platform reliability requirements. Geographic diversification across North America (65%), Europe (24%), and Asia-Pacific (11%) provides buffer against regional economic volatility while creating currency hedging opportunities. The strategic imperative involves transitioning to consumption-based pricing models, implementing AI-powered features that command premium pricing, and achieving Rule of 40 metrics (growth rate plus profit margin exceeding 40%). Investment thesis scenarios include optimistic case achieving $15 billion valuation upon reaching $1 billion ARR with 20% operating margins by 2026, base case $8 billion strategic acquisition by major cloud provider, or pessimistic case requiring additional funding at dilutive valuations if growth stalls below 20%. Valuation metrics at 6.2x forward revenue appear reasonable compared to peer group trading at 7-9x, suggesting 35% upside potential upon achieving profitability milestones and demonstrating sustainable competitive differentiation.`

},

defaultProbability: {

consensus: ((creditRisk.merton + parseFloat(creditRisk.altman) * 10 + (parseFloat(creditRisk.kmv) + 1) * 15) / 3).toFixed(1),

rating: creditRisk.merton > 30 ? 'High Risk' : creditRisk.merton > 15 ? 'Moderate Risk' : 'Low Risk',

recommendation: creditRisk.merton > 30 ?

'Avoid debt securities; monitor equity for distressed opportunities' :

'Investment grade credit profile supports debt investment consideration'

}

};

};

const toggleSection = (section) => {

setExpandedSections(prev => {

const next = new Set(prev);

if (next.has(section)) {

next.delete(section);

} else {

next.add(section);

}

return next;

});

};

return (

<div className="min-h-screen bg-gradient-to-br from-slate-900 via-blue-900 to-indigo-900 p-6">

<div className="max-w-7xl mx-auto space-y-6">

{/* Header */}

<div className="bg-white/10 backdrop-blur-lg rounded-xl border border-white/20 p-8">

<div className="flex items-center justify-between mb-6">

<div className="flex items-center gap-4">

<div className="p-4 bg-gradient-to-br from-blue-500 to-purple-600 rounded-xl">

<Brain className="w-10 h-10 text-white" />

</div>

<div>

<h1 className="text-4xl font-bold text-white">GIDEON Unified Intelligence System</h1>

<p className="text-blue-200 mt-1">Strategic Analysis • Credit Risk • Buffett Framework</p>

</div>

</div>

<div className="text-right">

<div className="flex items-center gap-2 text-green-400">

<Shield className="w-5 h-5" />

<span className="font-medium">v4.0 Enhanced</span>

</div>

<div className="text-xs text-blue-300 mt-1">390 Questions • 4 Risk Models • 48 Years Wisdom</div>

</div>

</div>

{/* Navigation Tabs */}

<div className="flex gap-2 flex-wrap">

{['overview', 'instructions', 'data-sources', 'analysis', 'results'].map(tab => (

<button

key={tab}

onClick={() => setActiveTab(tab)}

className={`px-4 py-2 rounded-lg font-medium transition-all ${

activeTab === tab

? 'bg-white text-blue-900'

: 'bg-white/10 text-white hover:bg-white/20'

}`}

>

{tab.charAt(0).toUpperCase() + tab.slice(1).replace('-', ' ')}

</button>

))}

</div>

</div>

{/* Overview Tab */}

{activeTab === 'overview' && (

<div className="space-y-6">

{/* System Capabilities */}

<div className="grid grid-cols-1 md:grid-cols-3 gap-6">

<div className="bg-white rounded-xl shadow-xl p-6">

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

<Building2 className="w-8 h-8 text-blue-600" />

<h3 className="text-xl font-bold">GIDEON Fourester</h3>

</div>

<p className="text-gray-600 mb-4">100-question strategic intelligence framework analyzing 7 critical dimensions</p>

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

<div className="flex justify-between text-sm">

<span>Corporate Governance</span>

<span className="font-bold">20 Q</span>

</div>

<div className="flex justify-between text-sm">

<span>Market Analysis</span>

<span className="font-bold">25 Q</span>

</div>

<div className="flex justify-between text-sm">

<span>Product Assessment</span>

<span className="font-bold">25 Q</span>

</div>

</div>

</div>

<div className="bg-white rounded-xl shadow-xl p-6">

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

<AlertTriangle className="w-8 h-8 text-red-600" />

<h3 className="text-xl font-bold">Default Hunter Pro</h3>

</div>

<p className="text-gray-600 mb-4">4 advanced credit risk models for comprehensive default probability assessment</p>

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

<div className="flex justify-between text-sm">

<span>Merton Model</span>

<span className="text-green-600">✓</span>

</div>

<div className="flex justify-between text-sm">

<span>Altman Z-Score</span>

<span className="text-green-600">✓</span>

</div>

<div className="flex justify-between text-sm">

<span>KMV Distance-to-Default</span>

<span className="text-green-600">✓</span>

</div>

<div className="flex justify-between text-sm">

<span>CDS-Implied</span>

<span className="text-green-600">✓</span>

</div>

</div>

</div>

<div className="bg-white rounded-xl shadow-xl p-6">

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

<Award className="w-8 h-8 text-yellow-600" />

<h3 className="text-xl font-bold">Buffett Framework</h3>

</div>

<p className="text-gray-600 mb-4">280 strategic questions from 48 years of Berkshire Hathaway letters</p>

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

<div className="flex justify-between text-sm">

<span>Critical (Tier 1)</span>

<span className="font-bold">74 Q</span>

</div>

<div className="flex justify-between text-sm">

<span>Important (Tier 2)</span>

<span className="font-bold">96 Q</span>

</div>

<div className="flex justify-between text-sm">

<span>Supporting (Tier 3)</span>

<span className="font-bold">56 Q</span>

</div>

</div>

</div>

</div>

{/* Statistics */}

<div className="grid grid-cols-2 md:grid-cols-4 gap-4">

<div className="bg-white/10 backdrop-blur rounded-lg p-4 text-center">

<div className="text-3xl font-bold text-white">390</div>

<div className="text-blue-200 text-sm">Total Questions</div>

</div>

<div className="bg-white/10 backdrop-blur rounded-lg p-4 text-center">

<div className="text-3xl font-bold text-white">7</div>

<div className="text-blue-200 text-sm">Analysis Dimensions</div>

</div>

<div className="bg-white/10 backdrop-blur rounded-lg p-4 text-center">

<div className="text-3xl font-bold text-white">4</div>

<div className="text-blue-200 text-sm">Risk Models</div>

</div>

<div className="bg-white/10 backdrop-blur rounded-lg p-4 text-center">

<div className="text-3xl font-bold text-white">48</div>

<div className="text-blue-200 text-sm">Years of Wisdom</div>

</div>

</div>

</div>

)}

{/* Instructions Tab */}

{activeTab === 'instructions' && (

<div className="bg-white rounded-xl shadow-2xl p-8">

<h2 className="text-2xl font-bold mb-6 flex items-center gap-3">

<BookOpen className="w-8 h-8 text-blue-600" />

Report Generation Instructions

</h2>

{/* Structure Requirements */}

<div className="mb-8">

<button

onClick={() => toggleSection('structure')}

className="w-full flex items-center justify-between p-4 bg-blue-50 rounded-lg hover:bg-blue-100 transition-colors"

>

<span className="font-bold text-lg">Document Structure Requirements</span>

{expandedSections.has('structure') ? <ChevronDown /> : <ChevronRight />}

</button>

{expandedSections.has('structure') && (

<div className="mt-4 p-6 bg-gray-50 rounded-lg space-y-4">

<div className="font-mono text-sm bg-white p-4 rounded border border-gray-200">

<div className="font-bold mb-2">Title Format:</div>

<div>{REPORT_INSTRUCTIONS.structure.title}</div>

<div className="text-gray-600">{REPORT_INSTRUCTIONS.structure.subtitle}</div>

<div className="text-blue-600">{REPORT_INSTRUCTIONS.structure.metadata}</div>

</div>

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

<div className="font-bold">Main Sections (Required Order):</div>

{REPORT_INSTRUCTIONS.structure.mainSections.map((section, idx) => (

<div key={idx} className="flex items-center gap-2">

<span className="text-blue-600">#{idx + 1}</span>

<span className="font-mono text-sm">{section}</span>

</div>

))}

</div>

<div className="bg-yellow-50 border border-yellow-200 rounded-lg p-4">

<div className="font-bold text-yellow-800 mb-2">⚠️ Critical Rules:</div>

<ul className="space-y-1 text-sm">

<li>• Each paragraph MUST have {REPORT_INSTRUCTIONS.structure.sentenceRules.perParagraph}</li>

<li>• Sentences must be {REPORT_INSTRUCTIONS.structure.sentenceRules.structure}</li>

<li>• {REPORT_INSTRUCTIONS.structure.sentenceRules.data}</li>

</ul>

</div>

</div>

)}

</div>

{/* Required Data */}

<div className="mb-8">

<button

onClick={() => toggleSection('data')}

className="w-full flex items-center justify-between p-4 bg-green-50 rounded-lg hover:bg-green-100 transition-colors"

>

<span className="font-bold text-lg">Required Data Elements</span>

{expandedSections.has('data') ? <ChevronDown /> : <ChevronRight />}

</button>

{expandedSections.has('data') && (

<div className="mt-4 p-6 bg-gray-50 rounded-lg">

<div className="grid md:grid-cols-2 gap-6">

<div>

<h4 className="font-bold mb-3">Financial Metrics:</h4>

<ul className="space-y-1 text-sm">

{REPORT_INSTRUCTIONS.requiredData.financial.map((item, idx) => (

<li key={idx} className="flex items-start gap-2">

<CheckCircle className="w-4 h-4 text-green-500 mt-0.5" />

<span>{item}</span>

</li>

))}

</ul>

</div>

<div>

<h4 className="font-bold mb-3">Strategic Information:</h4>

<ul className="space-y-1 text-sm">

{REPORT_INSTRUCTIONS.requiredData.strategic.map((item, idx) => (

<li key={idx} className="flex items-start gap-2">

<CheckCircle className="w-4 h-4 text-blue-500 mt-0.5" />

<span>{item}</span>

</li>

))}

</ul>

</div>

</div>

</div>

)}

</div>

{/* Bottom Line Format */}

<div className="mb-8">

<button

onClick={() => toggleSection('bottomline')}

className="w-full flex items-center justify-between p-4 bg-red-50 rounded-lg hover:bg-red-100 transition-colors"

>

<span className="font-bold text-lg">Bottom Line Requirements</span>

{expandedSections.has('bottomline') ? <ChevronDown /> : <ChevronRight />}

</button>

{expandedSections.has('bottomline') && (

<div className="mt-4 p-6 bg-gray-50 rounded-lg">

<div className="bg-red-100 border-2 border-red-300 rounded-lg p-4 mb-4">

<div className="font-bold text-red-800 mb-2">🔴 MANDATORY FORMAT:</div>

<div className="font-mono text-sm">{REPORT_INSTRUCTIONS.bottomLineFormat.mandatory}</div>

</div>

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

<div className="font-bold">Required Elements:</div>

{REPORT_INSTRUCTIONS.bottomLineFormat.elements.map((element, idx) => (

<div key={idx} className="flex items-center gap-2 text-sm">

<span className="font-bold text-red-600">{idx + 1}.</span>

<span>{element}</span>

</div>

))}

</div>

</div>

)}

</div>

</div>

)}

{/* Data Sources Tab */}

{activeTab === 'data-sources' && (

<div className="space-y-6">

{Object.entries(DATA_SOURCES).map(([category, sources]) => (

<div key={category} className="bg-white rounded-xl shadow-xl p-6">

<h3 className="text-xl font-bold mb-4 capitalize flex items-center gap-2">

<Database className="w-6 h-6 text-blue-600" />

{category} Data Sources

</h3>

<div className="grid md:grid-cols-2 gap-4">

{sources.map((source, idx) => (

<div key={idx} className="flex items-start gap-3 p-3 bg-gray-50 rounded-lg hover:bg-gray-100 transition-colors">

<ExternalLink className="w-5 h-5 text-blue-500 mt-0.5" />

<div className="flex-1">

<div className="font-semibold">{source.name}</div>

<div className="text-sm text-gray-600">{source.type}</div>

<div className="flex items-center gap-2 mt-1">

<span className={`text-xs px-2 py-1 rounded ${

source.access === 'Free' ? 'bg-green-100 text-green-700' : 'bg-yellow-100 text-yellow-700'

}`}>

{source.access}

</span>

{source.url && (

<span className="text-xs text-blue-500">{source.url}</span>

)}

</div>

</div>

</div>

))}

</div>

</div>

))}

</div>

)}

{/* Analysis Tab */}

{activeTab === 'analysis' && (

<div className="bg-white rounded-xl shadow-2xl p-8">

<h2 className="text-2xl font-bold mb-6 flex items-center gap-3">

<Search className="w-8 h-8 text-blue-600" />

Company Analysis Interface

</h2>

<div className="space-y-6">

{/* Input Section */}

<div>

<label className="block text-sm font-medium text-gray-700 mb-2">

Company Name

</label>

<input

type="text"

value={companyName}

onChange={(e) => setCompanyName(e.target.value)}

placeholder="Enter company name (e.g., Microsoft, Apple, Tesla)..."

className="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500"

disabled={isAnalyzing}

/>

</div>

{/* Analysis Type */}

<div>

<label className="block text-sm font-medium text-gray-700 mb-2">

Analysis Type

</label>

<div className="grid grid-cols-1 md:grid-cols-3 gap-4">

{[

{ id: 'comprehensive', name: 'Comprehensive', desc: 'Full 390-question analysis' },

{ id: 'credit-focus', name: 'Credit Risk Focus', desc: 'Emphasis on default probability' },

{ id: 'strategic', name: 'Strategic Only', desc: 'GIDEON + Buffett framework' }

].map(type => (

<label key={type.id} className="relative cursor-pointer">

<input

type="radio"

name="analysisType"

value={type.id}

checked={analysisType === type.id}

onChange={(e) => setAnalysisType(e.target.value)}

className="sr-only"

/>

<div className={`p-4 border-2 rounded-lg transition-all ${

analysisType === type.id ? 'border-blue-500 bg-blue-50' : 'border-gray-200'

}`}>

<div className="font-semibold">{type.name}</div>

<div className="text-sm text-gray-600 mt-1">{type.desc}</div>

</div>

</label>

))}

</div>

</div>

{/* Credit Risk Models Preview */}

<div className="bg-gray-50 rounded-lg p-6">

<h3 className="font-bold mb-4 flex items-center gap-2">

<AlertCircle className="w-5 h-5 text-yellow-600" />

Credit Risk Models to Apply

</h3>

<div className="grid md:grid-cols-2 gap-4">

{Object.entries(CREDIT_MODELS).map(([key, model]) => (

<div key={key} className="bg-white p-4 rounded-lg border border-gray-200">

<div className="font-semibold text-sm">{model.name}</div>

<div className="text-xs text-gray-600 mt-1">{model.description}</div>

<div className="text-xs font-mono mt-2 text-blue-600">{model.formula}</div>

</div>

))}

</div>

</div>

{/* Buffett Questions Sample */}

<div className="bg-blue-50 rounded-lg p-6">

<h3 className="font-bold mb-4 flex items-center gap-2">

<Star className="w-5 h-5 text-yellow-600" />

Sample Buffett Framework Questions

</h3>

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

{SAMPLE_BUFFETT_QUESTIONS.map((q, idx) => (

<div key={idx} className="flex items-start gap-2 text-sm">

<span className="text-blue-600 font-bold">{idx + 1}.</span>

<span>{q}</span>

</div>

))}

</div>

</div>

{/* Run Analysis Button */}

<button

onClick={runAnalysis}

disabled={isAnalyzing || !companyName.trim()}

className="w-full px-8 py-4 bg-gradient-to-r from-blue-600 to-purple-600 text-white rounded-lg font-semibold hover:shadow-xl transition-all disabled:opacity-50 flex items-center justify-center gap-3"

>

{isAnalyzing ? (

<>

<Activity className="w-6 h-6 animate-spin" />

Analyzing {companyName}...

</>

) : (

<>

<Play className="w-6 h-6" />

Run Unified Analysis

</>

)}

</button>

</div>

</div>

)}

{/* Progress Indicator */}

{isAnalyzing && (

<div className="bg-white rounded-xl shadow-lg p-6">

<div className="flex items-center justify-between mb-3">

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

<Clock className="w-5 h-5 text-blue-600 animate-pulse" />

<span className="font-medium">{progress.phase}</span>

</div>

<span className="text-sm text-gray-500">

{progress.current}/{progress.total} questions

</span>

</div>

<div className="w-full bg-gray-200 rounded-full h-4">

<div

className="h-4 rounded-full bg-gradient-to-r from-blue-500 via-purple-500 to-indigo-500 transition-all duration-300"

style={{ width: `${(progress.current / progress.total) * 100}%` }}

/>

</div>

</div>

)}

{/* Results Tab */}

{activeTab === 'results' && results && (

<div className="space-y-6">

{/* Executive Summary */}

<div className="bg-white rounded-xl shadow-2xl p-8">

<div className="flex items-center justify-between mb-6">

<div>

<h2 className="text-3xl font-bold text-gray-800">

Executive Brief: {results.company}

</h2>

<p className="text-gray-500 mt-1">

Generated {new Date(results.timestamp).toLocaleString()}

</p>

</div>

<div className="text-right">

<div className="text-4xl font-bold bg-gradient-to-r from-blue-600 to-purple-600 bg-clip-text text-transparent">

{results.scores.overall}

</div>

<div className="text-sm text-gray-500">Overall Score</div>

</div>

</div>

{/* Scores Grid */}

<div className="grid grid-cols-2 md:grid-cols-3 gap-4 mb-8">

{Object.entries(results.scores).filter(([key]) => key !== 'overall').map(([key, value]) => (

<div key={key} className="bg-gradient-to-br from-gray-50 to-blue-50 rounded-lg p-4">

<div className="text-sm text-gray-600 capitalize mb-2">

{key} Assessment

</div>

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

<div className="text-3xl font-bold text-gray-800">{value}</div>

<div className="flex-1">

<div className="w-full bg-gray-200 rounded-full h-2">

<div

className={`h-2 rounded-full ${

value >= 80 ? 'bg-green-500' :

value >= 60 ? 'bg-blue-500' :

'bg-yellow-500'

}`}

style={{ width: `${value}%` }}

/>

</div>

</div>

</div>

</div>

))}

</div>

{/* Radar Chart */}

<div className="bg-gradient-to-br from-blue-50 to-purple-50 rounded-xl p-8 mb-8">

<h3 className="text-lg font-semibold mb-4">Strategic Assessment Radar</h3>

<ResponsiveContainer width="100%" height={300}>

<RadarChart data={[

{ subject: 'Strategic', A: results.scores.strategic },

{ subject: 'Corporate', A: results.scores.corporate },

{ subject: 'Market', A: results.scores.market },

{ subject: 'Product', A: results.scores.product },

{ subject: 'Financial', A: results.scores.financial },

{ subject: 'Buffett', A: results.buffettScore }

]}>

<PolarGrid />

<PolarAngleAxis dataKey="subject" />

<PolarRadiusAxis angle={90} domain={[0, 100]} />

<Radar name="Score" dataKey="A" stroke="#3b82f6" fill="#3b82f6" fillOpacity={0.6} />

</RadarChart>

</ResponsiveContainer>

</div>

{/* Credit Risk Summary */}

<div className="bg-red-50 border border-red-200 rounded-xl p-6 mb-8">

<h3 className="text-lg font-bold mb-4 flex items-center gap-2">

<AlertTriangle className="w-6 h-6 text-red-600" />

Credit Risk Assessment

</h3>

<div className="grid md:grid-cols-4 gap-4">

<div className="bg-white p-4 rounded-lg">

<div className="text-sm text-gray-600">Merton Model</div>

<div className="text-2xl font-bold">{results.creditRisk.merton}%</div>

<div className="text-xs text-gray-500">Default Probability</div>

</div>

<div className="bg-white p-4 rounded-lg">

<div className="text-sm text-gray-600">Altman Z-Score</div>

<div className="text-2xl font-bold">{results.creditRisk.altman}</div>

<div className="text-xs text-gray-500">

{parseFloat(results.creditRisk.altman) > 2.99 ? 'Safe Zone' :

parseFloat(results.creditRisk.altman) > 1.81 ? 'Grey Zone' : 'Distress Zone'}

</div>

</div>

<div className="bg-white p-4 rounded-lg">

<div className="text-sm text-gray-600">KMV Distance</div>

<div className="text-2xl font-bold">{results.creditRisk.kmv}σ</div>

<div className="text-xs text-gray-500">Distance to Default</div>

</div>

<div className="bg-white p-4 rounded-lg">

<div className="text-sm text-gray-600">CDS Spread</div>

<div className="text-2xl font-bold">{results.creditRisk.cds}</div>

<div className="text-xs text-gray-500">Basis Points</div>

</div>

</div>

<div className="mt-4 p-4 bg-white rounded-lg">

<div className="font-semibold mb-2">Consensus Default Probability: {results.defaultProbability.consensus}%</div>

<div className="text-sm text-gray-600">Rating: <span className="font-bold">{results.defaultProbability.rating}</span></div>

<div className="text-sm mt-2">{results.defaultProbability.recommendation}</div>

</div>

</div>

{/* Strategic Overview */}

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

<h3 className="text-xl font-bold">Strategic Overview</secretly>

<div className="prose max-w-none">

<div className="bg-gray-50 rounded-lg p-6 mb-4">

<p className="text-gray-700 leading-relaxed">{results.strategicOverview.paragraph1}</p>

</div>

<div className="bg-gray-50 rounded-lg p-6">

<p className="text-gray-700 leading-relaxed">{results.strategicOverview.paragraph2}</p>

</div>

</div>

</div>

{/* Export Button */}

<button

className="w-full mt-8 px-6 py-3 bg-gradient-to-r from-green-600 to-blue-600 text-white rounded-lg font-semibold hover:shadow-xl transition-all flex items-center justify-center gap-2"

onClick={() => {

console.log('Full Analysis Results:', results);

alert('Complete analysis exported to console. Check developer tools for full report.');

}}

>

<Download className="w-5 h-5" />

Export Complete Executive Brief

</button>

</div>

</div>

)}

{/* Footer */}

<div className="text-center space-y-2">

<p className="text-white/80 text-sm">

GIDEON Unified Intelligence System v4.0

</p>

<p className="text-white/60 text-xs">

Combining Strategic Analysis • Credit Risk Assessment • Warren Buffett Wisdom

</p>

<p className="text-blue-300 text-xs">

390 Questions • 7 Dimensions • 4 Risk Models • 48 Years of Investment Wisdom

</p>

</div>

</div>

</div>

);

};

export default GIDEONUnifiedSystem;

Next
Next

Executive Code:Bond Analysis Sysrem