# Project export: MicroMentor

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: OpenAI Build Week
- Tagline: Saving micro-businesses from failing through bilingual, agentic AI workflows.
- Devpost: https://devpost.com/software/micromentor-souf06
- GitHub: https://github.com/cryptXploit/MicroBusinessMentor.ai.git
- Video: https://www.youtube.com/embed/4LW7L6CG180?enablejsapi=1&hl=en_US&rel=0&start=&version=3&wmode=transparent
- Team: 1 GitHub contributor(s) — cryptXploit (6 commits)

## Devpost submission (written by the team)

### Overview

💡

### Inspiration

In regions like Rajshahi, Bangladesh, micro-entrepreneurs—ranging from seasonal mango orchard owners to local boutique operators—face an alarming 80% failure rate within their first year. They don't fail due to lack of grit; they fail due to a lack of strategic foresight, financial literacy, and immediate crisis management. While enterprise corporations have access to seasoned CFOs, legal teams, and market analysts, micro-business owners operate in total isolation. MicroMentor was born out of a single question: What if a local street vendor or small agro-business could afford a Fortune 500-level Board of Directors for free? Our mission is to democratize high-level business intelligence by combining Agentic AI workflows, native bilingual support (English & Bengali), and accessible low-latency architectures. 🏗️ How We Built It MicroMentor was engineered from the ground up using a Hub-and-Spoke architecture on Next.js 14, paired with Supabase for secure data isolation and real-time state management. ⚡ Powered by OpenAI Codex & GPT-5.6 Codex as the Execution Engine: We adopted a Pre-planned Prompt Architecture methodology. Instead of typing vague queries, we drafted structured system specifications locally and passed them to OpenAI Codex. Codex handled ~80% of our frontend Glassmorphism UI components, Tailwind styling, and Next.js API routing setup, drastically accelerating development. Dynamic Model Routing ($GPT\text{-}5.6$): To deliver deep reasoning without frustrating latency, we implemented a dynamic router between the GPT-5.6 model family based on task complexity: $GPT\text{-}5.6\text{-}Luna$ (Deep Reasoning): Powers our multi-agent War Room (AI Board of Directors), SOS Crisis Manager, and Legal Desk where zero-shot accuracy and complex trade-off evaluation are required. $GPT\text{-}5.6\text{-}Mini$ (Flash Execution): Powers low-latency daily utilities such as AI Khata (Voice-to-Ledger), Smart SMS, and Customer Roleplay. 🧮 Model Routing & Latency Optimization Formula To optimize the balance between execution speed and intelligence quality, we defined the routing decision utility function $U(M)$ for selecting model $M \in {\text{Luna}, \text{Mini}}$ given a user request $R$: $$U(M) = w_1 \cdot \text{ReasoningDepth}(R, M) - w_2 \cdot \text{Latency}(M) - w_3 \cdot \text{Cost}(M)$$ Where weights $w_1, w_2, w_3$ dynamically shift depending on whether the feature is real-time interactive (e.g., chat) or deep analytical (e.g., legal drafting). 🚧 Challenges We Faced Latency vs. User Perception: Deep multi-agent reasoning in the AI Board of Directors takes processing time. To prevent user drop-off, we built an Agentic Streaming UI that displays real-time thought logs ("Analyzing supply chain...", "Consulting Financial Advisor...") to mask execution latency smoothly. Bilingual Context Precision: Translating complex business logic into localized Bengali without losing technical context (e.g., profit margin calculations or partnership clauses) required fine-tuning system prompts and structured JSON outputs. Push Protection & Security: Managing secrets while maintaining rapid git cycles during the hackathon forced us to implement strict pre-commit verification workflows. 📚 What We Learned AI as a Pair Programmer: Using OpenAI Codex with strict architectural constraints yields production-grade code in minutes rather than hours, provided the developer designs the system boundaries first. Designing for Micro-Users: True accessibility isn't just about dark mode or glassmorphism—it’s about enabling voice inputs, native regional language understanding, and actionable, one-click execution plans. 🚀 What's Next for MicroMentor WhatsApp & SMS Bot Integration: Allowing vendors to update their ledger and query their AI Co-Founder via basic feature phones without requiring continuous internet access. Localized Logistics Integration: Connecting local transport systems directly with the Autonomous Lead Sniper to automate supply chain fulfillment.

## README (from the GitHub repository)

# 🚀 MicroMentor: The Enterprise-Grade AI Co-Founder for Micro-Entrepreneurs

[![Next.js](https://img.shields.io/badge/Next.js-14-black?style=for-the-badge&logo=next.js)](https://nextjs.org/)
[![OpenAI](https://img.shields.io/badge/OpenAI-GPT--5.6%20%7C%20Sora%20%7C%20DALL--E%203-412991?style=for-the-badge&logo=openai)](https://openai.com/)
[![Supabase](https://img.shields.io/badge/Supabase-Database-3ECF8E?style=for-the-badge&logo=supabase)](https://supabase.com/)
[![Tailwind CSS](https://img.shields.io/badge/Tailwind-CSS-38B2AC?style=for-the-badge&logo=tailwind-css)](https://tailwindcss.com/)

**MicroMentor** is an advanced, multi-modal, agentic AI platform designed to democratize enterprise-level business intelligence for micro-entrepreneurs. It acts as a 24/7 AI Co-Founder, Business Strategist, and Legal/Financial Advisor.

---

## ⚠️ The Problem: The "Death Valley" of Micro-Businesses
Across the globe, particularly in developing economies like Bangladesh, **80% of micro-businesses shut down within their first year**. Why?
1. **Financial Illiteracy:** Founders don't understand cash flow, burn rate, or ledgers.
2. **Lack of Strategy:** Decisions are made on gut feelings, not data or market trends.
3. **Resource Scarcity:** Hiring a marketing agency, a corporate lawyer, or a business consultant is financially impossible.
4. **Language & Tech Barriers:** Existing enterprise tools (like Salesforce or SAP) are too complex, expensive, and English-only.

## 💡 The Solution: MicroMentor
MicroMentor bridges this massive gap by providing a **Bilingual (English & Bengali), Mobile-first, Hub-and-Spoke Ecosystem**. We utilize **GPT-5.6, Agentic Workflows, RAG (Live Web Search), and Multi-Modal AI (Sora/DALL-E 3)** to give a local mango seller in Rajshahi the same strategic power as a Fortune 500 CEO.

---

## 🌟 The 12 "God-Tier" Features (What makes us stand out)

### 🧠 Agentic Intelligence & Strategy
*   **⚖️ Multi-Agent War Room:** When facing a crisis, summon an AI Board of Directors. 3 distinct personas (The Conservative CFO, The Aggressive CMO, and The Wise CEO) debate in real-time to provide a balanced verdict.
*   **🎯 Autonomous Lead Sniper:** Type your product, and the AI autonomously scours the internet, finds 3-4 real-world B2B companies/buyers, and drafts hyper-personalized outreach pitches.
*   **🕵️ Live Competitor Spy:** Uses real-time DuckDuckGo web scraping to analyze current market prices, find local competitors, and cite verified sources.

### 💰 Finance & Compliance
*   **⏳ Financial Time Machine (Burn-Rate Simulator):** An interactive slider that calculates runway. If bankruptcy is imminent (<3 months), it triggers an **AI Survival Pivot** to save the business.
*   **📓 AI Khata (Voice-to-Ledger):** Users can simply speak or type messy daily transactions (e.g., "Sold 2 shirts for $20, bought packaging for $5"). The AI structures it into a professional Balance Sheet.
*   **⚖️ AI Legal Desk:** Drafts court-ready legal documents (Partnership Deeds, NDAs, Trade License forms) customized to the specific business, ready to print.

### 🚀 Marketing & Media
*   **🎬 Viral Marketing Studio:** Generates cinematic prompt engineering (camera angles, lighting, psychological hooks) for 30-sec viral reels and graphic posts.
*   **🪄 End-to-End Media Generator (FAB):** A smart Floating Action Button integrated with **DALL-E 3** and **OpenAI Sora**. It maintains "Consistent Brand Characters" across sequential video generations directly within the app.
*   **💬 Smart SMS Communicator:** Drafts professional B2B/B2C texts for difficult scenarios (e.g., angry customer apologies, supplier negotiations).

### 🔮 Data & Ecosystem
*   **🔮 Predictive Radar:** Generates a 12-month local trend and seasonality heatmap based on geographic location and weather patterns, providing pre-emptive tasks.
*   **🚚 Supply Chain Matchmaker:** Finds real-world wholesale markets and suppliers using live web search, providing negotiation tips.
*   **🔊 The Mentor's Voice & Bilingual Core:** OpenAI TTS integration with a 100% lightweight bilingual architecture (`?lang=bn`) for deep local penetration.

---
## Section Title: 🛠️ Development Workflow: How I Used Codex & GPT-5.6

As a developer with a background in Full-Stack Engineering and Data Structures, I knew that relying on AI blindly leads to spaghetti code and excessive DOM bloat. Therefore, I treated OpenAI Codex not just as a chatbot, but as an execution engine.

Instead of writing vague queries in the Codex prompt box, I adopted a strict 'Pre-planned Prompt Architecture' methodology. Here is my exact workflow:

System Design First: Before writing a single line of code, I mapped out the entire Next.js 14 App Router structure, the Hub-and-Spoke architecture, and the Supabase database schema offline.

Offline Prompt Drafting: To ensure zero-shot success and avoid wasting context windows, I drafted highly structured, detailed prompts in my local code editor first. I explicitly defined the UI requirements (Glassmorphism, Tailwind), routing logic, and state management rules in these text files.

Codex Execution: I then pasted these hyper-structured prompts into Codex. This is why my Codex session logs show large, well-formatted prompt pastes. Codex acted as my senior pair-programmer—it took my architectural instructions and rapidly generated the modular components, drastically cutting down my frontend UI development time by 80%.

GPT-5.6 for the 'Brain': While Codex built the body (the app), I integrated GPT-5.6-Luna and GPT-5.6-Mini via API to act as the 'brain'. I used Luna for heavy, multi-agent reasoning (like the War Room and SOS Crisis) and Mini for low-latency tasks (like AI Khata and Smart SMS).

Human-in-the-Loop Refinement: After Codex generated the initial codebase, I manually refined the routing middleware, fixed Next.js hydration issues, and polished the bilingual (English/Bengali) translation logic to ensure a seamless UX.



---

## 🏗️ System Architecture
We implemented a **"Hub and Spoke" Architecture** to prevent DOM Bloat and ensure extreme performance on low-end devices:
*   **The Hub:** A sleek, gamified Dashboard (`/dashboard`) acting as the AI Command Center.
*   **The Spokes:** Isolated Next.js routes (`/radar`, `/war-room`, `/legal-desk`) for heavy AI tools, ensuring zero latency on the main dashboard.
*   **Agentic Streaming UI:** Masks API latency with dynamic "thought-process" loading states (e.g., *Deploying AI Agent... -> Fetching local data...*).

---

## 💻 Tech Stack
*   **Frontend:** Next.js 14 (App Router), React, Tailwind CSS, Lucide Icons, Canvas-Confetti (Magic moves).
*   **Backend:** Next.js Route Handlers (API).
*   **AI & ML:** OpenAI SDK (`gpt-5.6`, `gpt-5.6-mini`, `dall-e-3`, `sora` concept), Web Speech API.
*   **Search/RAG:** DuckDuckGo Web Scraper Utility.
*   **Database:** Supabase (PostgreSQL) with JSONB structures.

---

## 🚀 Installation & Local Setup

### Prerequisites
*   Node.js (v18.x or later)
*   An OpenAI API Key (with GPT-5.6 access)
*   A Supabase Project

### 1. Clone the Repository
```bash
git clone [https://github.com/your-username/micro-mentor.git](https://github.com/your-username/micro-mentor.git)
cd micro-mentor





2. Install Dependencies
Bash
npm install
# or
yarn install
3. Setup Environment Variables
Create a .env.local file in the root directory and add the following keys:

Code snippet
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
OPENAI_API_KEY=your_openai_api_key
4. Database Setup (Supabase SQL Editor)
Run the following SQL commands in your Supabase SQL Editor to set up the necessary tables and JSONB columns:



```sql
-- WARNING: This schema is for context only and is not meant to be run.
-- Table order and constraints may not be valid for execution.

CREATE TABLE public.users (
  id uuid NOT NULL,
  email text NOT NULL UNIQUE,
  created_at timestamp with time zone NOT NULL DEFAULT timezone('u

[README truncated for size]

## Detected evidence (automated analysis)

Indexed codebase: 72 recognized source files, 522 KB.
- CSS (language) — detected in the code
- Next.js (technology) — detected in the code
- OpenAI (technology) — detected in the code
- React (technology) — detected in the code
- SQL (language) — detected in the code
- Supabase (technology) — detected in the code
- Tailwind CSS (technology) — detected in the code
- TypeScript (language) — detected in the code
- JavaScript (language) — claimed on Devpost, not found in the code
- Node.js (technology) — claimed on Devpost, not found in the code
- PostgreSQL (technology) — claimed on Devpost, not found in the code

## Codebase structure (from repository index)

### Files (81 of 81)

```
.env.example
.eslintrc.json
.gitignore
components.json
next.config.mjs
package.json
postcss.config.mjs
README.md
src/app/ai-khata/page.tsx
src/app/api/deep-dive/route.ts
src/app/api/financial-pivot/route.ts
src/app/api/generate-audio/route.ts
src/app/api/generate-media/route.ts
src/app/api/generate-pitch/route.ts
src/app/api/generate-script/route.ts
src/app/api/generate/route.ts
src/app/api/khata-transcribe/route.ts
src/app/api/khata/route.ts
src/app/api/lead-sniper/route.ts
src/app/api/legal/route.ts
src/app/api/marketing-brand/route.ts
src/app/api/marketing-character/route.ts
src/app/api/marketing-content/route.ts
src/app/api/marketing-studio/route.ts
src/app/api/phase-two/route.ts
src/app/api/questions/route.ts
src/app/api/radar-search/route.ts
src/app/api/radar/route.ts
src/app/api/roleplay/route.ts
src/app/api/smart-sms/route.ts
src/app/api/sos/route.ts
src/app/api/speak/route.ts
src/app/api/supply-chain/route.ts
src/app/api/survival-pivot/route.ts
src/app/api/task-solution/route.ts
src/app/api/war-room/route.ts
src/app/consultation/page.tsx
src/app/dashboard/page.tsx
src/app/globals.css
src/app/layout.tsx
src/app/lead-sniper/page.tsx
src/app/legal-desk/page.tsx
src/app/login/page.tsx
src/app/page.tsx
src/app/radar/page.tsx
src/app/services/mockAiService.ts
src/app/signup/page.tsx
src/app/smart-sms/page.tsx
src/app/supply-chain/page.tsx
src/components/ActionPlan.tsx
src/components/AgenticLoader.tsx
src/components/AgentReasoningLoading.tsx
src/components/AudioGenerator.tsx
src/components/AuthPanel.tsx
src/components/BudgetChart.tsx
src/components/BusinessInsights.tsx
src/components/DashboardSkeleton.tsx
src/components/FinancialTimeMachine.tsx
src/components/FloatingAssetGenerator.tsx
src/components/FundingPitch.tsx
src/components/MarketingStudio.tsx
src/components/Navbar.tsx
src/components/RiskAlerts.tsx
src/components/RoleplaySimulator.tsx
src/components/ui/button.tsx
src/components/ui/card.tsx
src/components/ui/checkbox.tsx
src/components/ui/input.tsx
src/components/ui/progress.tsx
src/components/WarRoom.tsx
src/data/case_studies.json
src/lib/utils.ts
src/types/index.ts
src/utils/mockBusinessPlan.ts
src/utils/supabase/client.ts
src/utils/translations.ts
supabase.sql
supabase/schema.sql
supabase/semantic-cache.sql
tailwind.config.ts
tsconfig.json
```

### Dependencies

- package.json: @base-ui/react@^1.6.0, @supabase/supabase-js@^2.110.4, @types/canvas-confetti@^1.9.0, @types/node@^20, @types/react@^18, @types/react-dom@^18, canvas-confetti@^1.9.4, class-variance-authority@^0.7.1, clsx@^2.1.1, eslint@^8, eslint-config-next@14.2.35, lucide-react@^1.24.0, next@14.2.35, openai@^6.46.0, postcss@^8, react@^18, react-dom@^18, recharts@^3.9.2, shadcn@^4.13.0, tailwind-merge@^3.6.0, tailwindcss@^3.4.1, tailwindcss-animate@^1.0.7, tw-animate-css@^1.4.0, typescript@^5

### Recent commits (newest first)

- Add example environment variables to .env.example
- Document development workflow with Codex and GPT-5.6
- Revise README for MicroMentor project
- Removed Chatgpt Some prompt what i generated for Codex resources folder
- Final Release: MicroMentor Hackathon 2026
- Initial commit from Create Next App

## Key source files (fetched from GitHub, selected and truncated for size)

### package.json

```
{
  "name": "micro-business-mentor",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@base-ui/react": "^1.6.0",
    "@supabase/supabase-js": "^2.110.4",
    "canvas-confetti": "^1.9.4",
    "class-variance-authority": "^0.7.1",
    "clsx": "^2.1.1",
    "lucide-react": "^1.24.0",
    "next": "14.2.35",
    "openai": "^6.46.0",
    "react": "^18",
    "react-dom": "^18",
    "recharts": "^3.9.2",
    "shadcn": "^4.13.0",
    "tailwind-merge": "^3.6.0",
    "tailwindcss-animate": "^1.0.7",
    "tw-animate-css": "^1.4.0"
  },
  "devDependencies": {
    "@types/canvas-confetti": "^1.9.0",
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "eslint": "^8",
    "eslint-config-next": "14.2.35",
    "postcss": "^8",
    "tailwindcss": "^3.4.1",
    "typescript": "^5"
  }
}

```

### src/app/layout.tsx

```typescript
// app/layout.tsx
import type { Metadata } from "next";
import { Inter } from "next/font/google";
// @ts-ignore
import "./globals.css";
import Navbar from "@/components/Navbar";

const inter = Inter({ subsets: ["latin"] });

export const metadata: Metadata = {
  title: "MicroMentor AI",
  description: "Your AI-powered micro-business mentor.",
};

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  return (
    <html lang="en">
      <body className={inter.className}>
        <Navbar />
        {children}
      </body>
    </html>
  );
}

```

### src/types/index.ts

```typescript
export interface BusinessPlan {
  businessName: string;
  totalBudget: number;
  allocatedBudget: Record<string, number>;
}

export interface ActionStep {
  timeframe: string;
  task: string;
  isCompleted: boolean;
  mentorSolution?: string;
  generatedScript?: string;
}

export interface RiskAlert {
  title: string;
  description: string;
}

export interface AgentStep {
  id: string;
  label: string;
  detail: string;
  status: "pending" | "active" | "complete";
}

export interface UnitEconomics {
  product: string;
  costToMake: number;
  sellingPrice: number;
  profitPerUnit: number;
  breakEvenUnits: number;
  microBOM: { item: string; cost: number }[];
}

export interface GeneratedBusinessPlan {
  uiLanguage?: "en" | "bn";
  businessPlan: BusinessPlan;
  actionSteps: ActionStep[];
  riskAlerts: RiskAlert[];
  aiConfidenceScore: number;
  reasoningSummary: string;
  references: string[];
  unitEconomics: UnitEconomics;
  personalizedStrategy: string;
  deepDives?: Record<string, { text: string; source: string }[]>;
  crisisLogs?: { issue: string; advice: string; date: string }[];
  financialLogs?: { date: string; feedback: string; advice: string }[];
  warRoomLogs?: {
    date: string;
    crisis: string;
    cfo: { name: string; argument: string };
    cmo: { name: string; argument: string };
    ceo: { name: string; verdict: string };
  }[];
  fundingPitch?: string;
  marketingAssets?: {
    branding?: {
      brandName: string;
      bio: string;
      profilePicPrompt: string;
      coverPicPrompt: string;
      brandCharacter?: { imageUrl: string; description: string };
    };
    contentHistory?: {
      date: string;
      type: "post" | "reels";
      duration?: number;
      imagePrompt?: string;
      sequences?: { timestamp: string; cinematicPrompt: string; dialogue: string }[];
      baseImage?: string;
      caption: string;
    }[];
  } | null;
  roleplayLogs?: { scenario: string; userReply: string; aiFeedback: string; score: number; nextScenario?: string }[];
  radarForecast?: {
    month: string;
    trendLevel: "High" | "Medium" | "Low";
    insight: string;
    preEmptiveTask: string;
  }[];
  radarSearchHistory?: {
    query: string;
    date: string;
    marketSummary: string;
    competitors: { name: string; detail: string; link?: string }[];
    sources: { title: string; url: string }[];
  }[];
  survivalPlan?: { stepTitle: string; action: string }[];
  legalDocs?: { docType: string; content: string }[];
}

export interface GeneratedPlanStreamResult {
  data: GeneratedBusinessPlan;
  planId: string;
}

```

### src/app/login/page.tsx

```typescript
import AuthPanel from "@/components/AuthPanel";

export default function LoginPage() {
  return <AuthPanel mode="login" />;
}

```

### src/app/signup/page.tsx

```typescript
import AuthPanel from "@/components/AuthPanel";

export default function SignupPage() {
  return <AuthPanel mode="signup" />;
}

```

### src/app/consultation/page.tsx

```typescript
"use client";

import { FormEvent, useEffect, useState } from "react";
import { useRouter } from "next/navigation";
import { ArrowRight, BrainCircuit, CheckCircle2, Sparkles } from "lucide-react";
import { Button } from "@/components/ui/button";

type BusinessSetup = { idea: string; budget: string; language: "en" | "bn"; timeline: string; answers?: string[] };

export default function ConsultationPage() {
  const router = useRouter();
  const [setup, setSetup] = useState<BusinessSetup | null>(null);
  const [questions, setQuestions] = useState<string[]>([]);
  const [answers, setAnswers] = useState(["", "", ""]);
  const [error, setError] = useState("");

  useEffect(() => {
    let parsed: BusinessSetup | null = null;
    try { parsed = JSON.parse(sessionStorage.getItem("biz_setup") ?? "null") as BusinessSetup | null; } catch { parsed = null; }
    if (!parsed?.idea || !parsed.budget) { router.replace("/"); return; }
    setSetup(parsed);
    const { idea, budget, language } = parsed;
    if (!idea || !budget) {
      router.replace("/");
      return;
    }

    let active = true;
    async function loadQuestions() {
      try {
        const response = await fetch("/api/questions", {
          method: "POST",
          headers: { "Content-Type": "application/json" },
          body: JSON.stringify({ idea, budget: Number(budget), language }),
        });
        const result = await response.json();
        if (!response.ok || !Array.isArray(result.questions) || result.questions.length !== 3) {
          throw new Error("Unable to prepare your consultation.");
        }
        if (active) setQuestions(result.questions);
      } catch (consultationError) {
        if (active) setError(consultationError instanceof Error ? consultationError.message : "Unable to prepare your consultation.");
      }
    }

    loadQuestions();
    return () => {
      active = false;
    };
  }, [router]);

  function handleSubmit(event: FormEvent<HTMLFormElement>) {
    event.preventDefault();
    if (answers.some((answer) => !answer.trim())) return;
    if (!setup) return;
    sessionStorage.setItem("biz_setup", JSON.stringify({ ...setup, answers: answers.map((answer) => answer.trim()) }));
    sessionStorage.setItem("micromentor_language", setup.language);
    router.push("/dashboard");
  }

  const language = setup?.language ?? "en";

  if (!questions.length && !error) {
    return (
      <main className="relative flex min-h-[calc(100vh-4rem)] items-center justify-center overflow-hidden bg-slate-950 px-4">
        <div className="absolute h-96 w-96 rounded-full bg-indigo-600/30 blur-[130px] animate-pulse" />
        <section className="relative w-full max-w-xl rounded-3xl border border-white/10 bg-white/[0.06] p-10 text-center shadow-2xl backdrop-blur-2xl">
          <span className="mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-indigo-400 to-cyan-300 text-slate-950 shadow-xl shadow-indigo-500/30"><BrainCircuit className="h-8 w-8 animate-pulse" /></span>
          <p className="mt-7 text-xs font-bold uppercase tracking-[0.18em] text-cyan-300">Adaptive consultation</p>
          <h1 className="mt-3 text-3xl font-bold text-white">{language === "bn" ? "মেন্টর আপনার ধারণা বিশ্লেষণ করছেন..." : "Mentor is analyzing your idea..."}</h1>
          <p className="mt-3 text-sm leading-6 text-slate-400">{language === "bn" ? "আপনার জন্য তিনটি নির্দিষ্ট প্রশ্ন প্রস্তুত করা হচ্ছে।" : "Preparing three precise questions for your business reality."}</p>
          <div className="mx-auto mt-7 h-1.5 max-w-xs overflow-hidden rounded-full bg-white/10"><div className="h-full w-2/3 animate-pulse rounded-full bg-gradient-to-r from-indigo-500 to-cyan-300" /></div>
        </section>
      </main>
    );
  }

  if (error) {
    return <main className="flex min-h-[calc(100vh-4rem)] items-center justify-center bg-slate-950 px-4"><section className="w-full max-w-md rounded-3xl bg-white p-8 text-center"><h1 className="text-xl font-bold text-slate-900">{error}</h1><Button className="mt-6" onClick={() => router.replace("/")}>Return home</Button></section></main>;
  }

  return (
    <main className="relative min-h-[calc(100vh-4rem)] overflow-hidden bg-slate-950 px-4 py-12">
      <div className="pointer-events-none absolute -left-24 top-10 h-80 w-80 rounded-full bg-indigo-600/30 blur-[130px]" />
      <div className="pointer-events-none absolute -bottom-24 right-0 h-96 w-96 rounded-full bg-cyan-500/20 blur-[140px]" />
      <section className="relative mx-auto max-w-3xl rounded-[2rem] border border-white/10 bg-white/[0.06] p-6 shadow-2xl backdrop-blur-2xl sm:p-10">
        <div className="flex items-start gap-4"><span className="flex h-12 w-12 shrink-0 items-center justify-center rounded-2xl bg-gradient-to-br from-indigo-400 to-cyan-300 text-slate-950"><Sparkles className="h-6 w-6" /></span><div><p className="text-xs font-bold uppercase tracking-[0.16em] text-cyan-300">Super-human mentor consultation</p><h1 className="mt-2 text-3xl font-bold text-white">{language === "bn" ? "আপনার বাস্তবতা বুঝতে চাই" : "Let’s understand your real operating reality"}</h1><p className="mt-2 text-sm leading-6 text-slate-400">{language === "bn" ? "আপনার উত্তরগুলো দিয়ে এআই পরিকল্পনা, ঝুঁকি ও ইউনিট ইকোনমিকস ব্যক্তিগতভাবে সাজাবে।" : "Your answers shape the strategy, risks, and unit economics around you."}</p></div></div>
        <form onSubmit={handleSubmit} className="mt-9 space-y-5">
          {questions.map((question, index) => <label key={question} className="block rounded-2xl border border-white/10 bg-slate-950/35 p-5 transition hover:border-indigo-400/35"><div className="flex gap-3"><span className="flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-indigo-400/15 text-xs font-bold text-indigo-200">{index + 1}</span><p className="text-sm font-semibold leading-6 text-white">{question}</p></div><textarea value={answers[index]} onChange={(event) => setAnswers((current) => current.map((answer, answerIn
[truncated — 1103 more characters]
```

### src/app/smart-sms/page.tsx

```typescript
"use client";

import Link from "next/link";
import { FormEvent, useState } from "react";
import { useSearchParams } from "next/navigation";
import { Check, Copy, Lightbulb, LoaderCircle, MessageCircleMore, Send } from "lucide-react";
import { Button } from "@/components/ui/button";
import { supabase } from "@/utils/supabase/client";
import { uiTranslations } from "@/utils/translations";

type SmsResult = {
  message: string;
  tip: string;
};

export default function SmartSmsPage() {
  const searchParams = useSearchParams();
  const planId = searchParams.get("planId") ?? "";
  const language: "en" | "bn" = searchParams.get("lang") === "bn" ? "bn" : "en";
  const t = uiTranslations[language];
  const scenarios = [t.angryCustomer, t.supplierDiscount, t.paymentReminder, t.festivalOffer];
  const [scenario, setScenario] = useState("");
  const [context, setContext] = useState("");
  const [result, setResult] = useState<SmsResult | null>(null);
  const [isGenerating, setIsGenerating] = useState(false);
  const [copied, setCopied] = useState(false);
  const [error, setError] = useState("");

  async function generateMessage(event: FormEvent<HTMLFormElement>) {
    event.preventDefault();
    if (!planId || !scenario || isGenerating) return;
    setIsGenerating(true);
    setError("");

    try {
      const { data: { session } } = await supabase.auth.getSession();
      if (!session) throw new Error(language === "bn" ? "অনুগ্রহ করে আবার সাইন ইন করুন।" : "Please sign in again.");
      const response = await fetch("/api/smart-sms", {
        method: "POST",
        headers: { "Content-Type": "application/json", Authorization: "Bearer " + session.access_token },
        body: JSON.stringify({ scenario, context: context.trim(), planId, language }),
      });
      const payload = await response.json().catch(() => ({}));
      if (!response.ok || typeof payload.message !== "string" || typeof payload.tip !== "string") {
        throw new Error((payload.error === "AI Server is resting. Please try again." ? t.serverBusy : payload.error) || (language === "bn" ? "বার্তা তৈরি করা যায়নি।" : "The message could not be generated."));
      }
      setResult(payload as SmsResult);
      setCopied(false);
    } catch (smsError) {
      setError(smsError instanceof Error ? smsError.message : t.serverBusy);
    } finally {
      setIsGenerating(false);
    }
  }

  async function copyMessage() {
    if (!result?.message) return;
    try {
      await navigator.clipboard.writeText(result.message);
      setCopied(true);
      window.setTimeout(() => setCopied(false), 2000);
    } catch {
      setError(language === "bn" ? "বার্তা কপি করা যায়নি।" : "The message could not be copied.");
    }
  }

  return (
    <main className={"min-h-screen bg-slate-50 px-4 py-8 sm:px-6 lg:px-8 " + (language === "bn" ? "font-bengali" : "")}>
      <div className="mx-auto max-w-5xl">
        <Link href="/dashboard" className="inline-flex rounded-xl border border-slate-200 bg-white px-4 py-2.5 text-sm font-bold text-slate-700 shadow-sm transition hover:border-fuchsia-200 hover:text-fuchsia-700">{t.backToDash}</Link>

        <section className="mt-6 overflow-hidden rounded-3xl border border-fuchsia-200 bg-gradient-to-br from-slate-950 via-fuchsia-950 to-purple-950 p-6 text-white shadow-[0_24px_65px_-30px_rgba(192,38,211,.68)] sm:p-9">
          <div className="flex items-start gap-4">
            <span className="flex h-12 w-12 shrink-0 items-center justify-center rounded-2xl bg-fuchsia-300/15 text-fuchsia-50"><MessageCircleMore className="h-6 w-6" /></span>
            <div><p className="text-xs font-bold uppercase tracking-[.18em] text-fuchsia-100">MicroMentor AI</p><h1 className="mt-1 text-3xl font-extrabold">{t.smartSmsTitle}</h1><p className="mt-3 max-w-2xl text-sm leading-6 text-fuchsia-50/90">{t.smartSmsSubtitle}</p></div>
          </div>
        </section>

        <section className="mt-6 rounded-3xl border border-fuchsia-100 bg-white/80 p-5 shadow-xl shadow-fuchsia-100/50 backdrop-blur-xl sm:p-6">
          <p className="text-sm font-bold text-slate-800">{language === "bn" ? "একটি পরিস্থিতি বেছে নিন" : "Choose a scenario"}</p>
          <div className="mt-3 grid gap-3 sm:grid-cols-2">
            {scenarios.map((option) => <button key={option} type="button" onClick={() => { setScenario(option); setResult(null); }} className={"rounded-2xl border p-4 text-left text-sm font-bold transition " + (scenario === option ? "border-fuchsia-400 bg-fuchsia-50 text-fuchsia-900 shadow-md shadow-fuchsia-100" : "border-slate-200 bg-white text-slate-700 hover:border-fuchsia-200 hover:bg-fuchsia-50/40")}>{option}</button>)}
          </div>

          {scenario && <form onSubmit={generateMessage} className="mt-5">
            <textarea value={context} onChange={(event) => setContext(event.target.value)} placeholder={t.smsContextPlaceholder} className="min-h-32 w-full resize-y rounded-2xl border border-fuchsia-100 bg-white p-4 text-sm leading-6 text-slate-800 outline-none transition placeholder:text-slate-400 focus:border-fuchsia-400 focus:ring-4 focus:ring-fuchsia-100" />
            <div className="mt-4 flex justify-end">
              <Button type="submit" disabled={!planId || isGenerating} className="h-11 rounded-xl bg-gradient-to-r from-fuchsia-600 to-purple-600 px-6 font-bold text-white shadow-lg shadow-fuchsia-600/20 hover:brightness-110">
                {isGenerating ? <><LoaderCircle className="mr-2 h-4 w-4 animate-spin" />{t.generatingMessage}</> : <><Send className="mr-2 h-4 w-4" />{t.generateMessage}</>}
              </Button>
            </div>
          </form>}
          {!planId && <p className="mt-4 text-sm font-medium text-rose-600">{language === "bn" ? "বার্তা তৈরির জন্য একটি বৈধ প্ল্যান প্রয়োজন।" : "A valid business plan is required to generate a message."}</p>}
          {error && <p className="mt-4 rounded-xl bg-rose-50 px-4 py-3 text-sm font-medium text-rose-700">{error}</p>}
        </section>

        {result && 
[truncated — 1549 more characters]
```

### src/app/legal-desk/page.tsx

```typescript
"use client";

import Link from "next/link";
import { FormEvent, useEffect, useState } from "react";
import { useSearchParams } from "next/navigation";
import { FileText, LoaderCircle, Printer, Scale } from "lucide-react";
import { Button } from "@/components/ui/button";
import { supabase } from "@/utils/supabase/client";
import { uiTranslations } from "@/utils/translations";
import type { GeneratedBusinessPlan } from "@/types";

type LegalDoc = NonNullable<GeneratedBusinessPlan["legalDocs"]>[number];

export default function LegalDeskPage() {
  const searchParams = useSearchParams();
  const planId = searchParams.get("planId") ?? "";
  const language: "en" | "bn" = searchParams.get("lang") === "bn" ? "bn" : "en";
  const t = uiTranslations[language];
  const [docType, setDocType] = useState("");
  const [document, setDocument] = useState<LegalDoc | null>(null);
  const [isGenerating, setIsGenerating] = useState(false);
  const [isLoading, setIsLoading] = useState(true);
  const [error, setError] = useState("");

  useEffect(() => {
    let active = true;

    async function loadLatestDocument() {
      if (!planId) {
        if (active) {
          setError(language === "bn" ? "কোনো প্ল্যান পাওয়া যায়নি।" : "No plan was provided.");
          setIsLoading(false);
        }
        return;
      }

      const { data, error: readError } = await supabase
        .from("generated_plans")
        .select("full_json_response")
        .eq("id", planId)
        .single();

      if (!active) return;

      if (readError || !data) {
        setError(
          language === "bn"
            ? "প্ল্যান পাওয়া যায়নি অথবা আপনার অনুমতি নেই।"
            : "Plan not found or access denied.",
        );
      } else {
        const plan = data.full_json_response as GeneratedBusinessPlan;
        const latest = plan.legalDocs?.at(-1);
        if (latest) setDocument(latest);
      }

      setIsLoading(false);
    }

    void loadLatestDocument();
    return () => {
      active = false;
    };
  }, [language, planId]);

  async function generateDocument(event: FormEvent<HTMLFormElement>) {
    event.preventDefault();
    if (!planId || !docType.trim() || isGenerating) return;

    setIsGenerating(true);
    setError("");

    try {
      const {
        data: { session },
      } = await supabase.auth.getSession();

      if (!session) {
        throw new Error(
          language === "bn" ? "অনুগ্রহ করে আবার সাইন ইন করুন।" : "Please sign in again.",
        );
      }

      const response = await fetch("/api/legal", {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Authorization: `Bearer ${session.access_token}`,
        },
        body: JSON.stringify({ planId, docType: docType.trim(), language }),
      });
      const result = await response.json().catch(() => ({}));

      if (
        !response.ok ||
        typeof result.docType !== "string" ||
        typeof result.content !== "string"
      ) {
        throw new Error(
          (result.error === "AI Server is resting. Please try again." ? t.serverBusy : result.error) ||
            (language === "bn"
              ? "আইনি ডকুমেন্ট তৈরি হয়নি।"
              : "Legal document could not be generated."),
        );
      }

      setDocument(result as LegalDoc);
    } catch (generationError) {
      setError(
        generationError instanceof Error
          ? generationError.message
          : t.serverBusy,
      );
    } finally {
      setIsGenerating(false);
    }
  }

  return (
    <main
      data-print-root
      className={`min-h-screen bg-slate-100 px-4 py-8 sm:px-6 lg:px-8 ${
        language === "bn" ? "font-bengali" : ""
      }`}
    >
      <div className="mx-auto max-w-5xl">
        <Link
          href="/dashboard"
          className="print:hidden inline-flex rounded-xl border border-slate-200 bg-white px-4 py-2.5 text-sm font-bold text-slate-700 shadow-sm transition hover:border-indigo-200 hover:text-indigo-700"
        >
          {t.backToDash}
        </Link>

        <section className="print:hidden mt-6 rounded-3xl bg-slate-950 p-6 text-white shadow-2xl sm:p-8">
          <div className="flex items-start gap-3">
            <span className="flex h-11 w-11 items-center justify-center rounded-2xl bg-indigo-400/20 text-indigo-100">
              <Scale className="h-5 w-5" />
            </span>
            <div>
              <p className="text-xs font-bold uppercase tracking-[.16em] text-indigo-200">
                MicroMentor AI
              </p>
              <h1 className="mt-1 text-3xl font-extrabold">
                {language === "bn"
                  ? "এআই লিগ্যাল ও কমপ্লায়েন্স ডেস্ক"
                  : "AI Legal & Compliance Desk"}
              </h1>
              <p className="mt-2 text-sm leading-6 text-slate-300">
                {language === "bn"
                  ? "আপনার ব্যবসার তথ্য ব্যবহার করে প্রয়োজনীয় ডকুমেন্টের একটি পেশাদার খসড়া তৈরি করুন।"
                  : "Create a professional draft using the context of your business plan."}
              </p>
            </div>
          </div>

          <form onSubmit={generateDocument} className="mt-6 flex flex-col gap-3 sm:flex-row">
            <input
              value={docType}
              onChange={(event) => setDocType(event.target.value)}
              placeholder={t.docTypePlaceholder}
              className="h-11 flex-1 rounded-xl border border-white/10 bg-white/10 px-4 text-sm text-white outline-none placeholder:text-slate-400 focus:border-indigo-300 focus:ring-4 focus:ring-indigo-400/20"
            />
            <Button
              type="submit"
              disabled={!docType.trim() || isGenerating || isLoading}
              className="h-11 rounded-xl bg-gradient-to-r from-indigo-500 to-cyan-500 px-5 font-bold text-white hover:brightness-110"
            >
              {isGenerating ? (
                <>
                  <LoaderCircle className="mr-2 h-4 w-4 animate-spin" />
   
[truncated — 2628 more characters]
```

### src/app/lead-sniper/page.tsx

```typescript
"use client";

import Link from "next/link";
import { FormEvent, useState } from "react";
import { useSearchParams } from "next/navigation";
import { Building2, Check, Copy, Crosshair, ExternalLink, LoaderCircle, Radar, Search } from "lucide-react";
import { Button } from "@/components/ui/button";
import AgenticLoader from "@/components/AgenticLoader";
import { supabase } from "@/utils/supabase/client";
import { uiTranslations } from "@/utils/translations";

type Lead = {
  leadName: string;
  whyTargetThem: string;
  outreachMessage: string;
  sourceLink: string;
};

function isWebUrl(value: string) {
  try {
    const url = new URL(value);
    return url.protocol === "https:" || url.protocol === "http:";
  } catch {
    return false;
  }
}

export default function LeadSniperPage() {
  const searchParams = useSearchParams();
  const planId = searchParams.get("planId") ?? "";
  const language: "en" | "bn" = searchParams.get("lang") === "bn" ? "bn" : "en";
  const t = uiTranslations[language];
  const [product, setProduct] = useState("");
  const [leads, setLeads] = useState<Lead[]>([]);
  const [isHunting, setIsHunting] = useState(false);
  const [status, setStatus] = useState("");
  const [copiedLead, setCopiedLead] = useState<number | null>(null);
  const [error, setError] = useState("");

  async function huntForClients(event: FormEvent<HTMLFormElement>) {
    event.preventDefault();
    if (!product.trim() || !planId || isHunting) return;
    setIsHunting(true);
    setError("");
    setStatus(t.deployingAgent);
    const analyzeTimer = window.setTimeout(() => setStatus(t.analyzingLeads), 1000);
    const pitchTimer = window.setTimeout(() => setStatus(t.draftingPitches), 2400);

    try {
      const { data: { session } } = await supabase.auth.getSession();
      if (!session) throw new Error(language === "bn" ? "অনুগ্রহ করে আবার সাইন ইন করুন।" : "Please sign in again.");
      const response = await fetch("/api/lead-sniper", {
        method: "POST",
        headers: { "Content-Type": "application/json", Authorization: "Bearer " + session.access_token },
        body: JSON.stringify({ product: product.trim(), planId, language }),
      });
      const payload = await response.json().catch(() => ({}));
      if (!response.ok || !Array.isArray(payload.leads)) {
        throw new Error(payload.error === "AI Server is resting. Please try again." ? t.serverBusy : payload.error || (language === "bn" ? "ক্লায়েন্ট অনুসন্ধান সম্পন্ন করা যায়নি।" : "Lead hunting could not be completed."));
      }
      setLeads(payload.leads as Lead[]);
    } catch (huntError) {
      setError(huntError instanceof Error ? huntError.message : t.serverBusy);
    } finally {
      window.clearTimeout(analyzeTimer);
      window.clearTimeout(pitchTimer);
      setIsHunting(false);
      setStatus("");
    }
  }

  async function copyPitch(message: string, index: number) {
    try {
      await navigator.clipboard.writeText(message);
      setCopiedLead(index);
      window.setTimeout(() => setCopiedLead(null), 2000);
    } catch {
      setError(language === "bn" ? "পিচ কপি করা যায়নি।" : "The pitch could not be copied.");
    }
  }

  return (
    <main className={"min-h-screen bg-slate-950 px-4 py-8 text-white sm:px-6 lg:px-8 " + (language === "bn" ? "font-bengali" : "")}>
      <div className="mx-auto max-w-6xl">
        <Link href="/dashboard" className="print:hidden inline-flex rounded-xl border border-slate-700 bg-slate-900 px-4 py-2.5 text-sm font-bold text-slate-100 shadow-sm transition hover:border-lime-300 hover:text-lime-200">{t.backToDash}</Link>

        <section className="mt-6 overflow-hidden rounded-3xl border border-lime-300/30 bg-[radial-gradient(circle_at_top_right,rgba(132,204,22,.2),transparent_38%),linear-gradient(135deg,#0f172a,#042f2e)] p-6 shadow-[0_24px_70px_-30px_rgba(163,230,53,.75)] sm:p-9">
          <div className="flex items-start gap-4">
            <span className="flex h-12 w-12 shrink-0 items-center justify-center rounded-2xl border border-lime-300/30 bg-lime-300/10 text-lime-200"><Crosshair className="h-6 w-6" /></span>
            <div><p className="text-xs font-bold uppercase tracking-[.18em] text-lime-200">MicroMentor AI · Autonomous Agent</p><h1 className="mt-1 text-3xl font-extrabold">{t.sniperTitle}</h1><p className="mt-3 max-w-2xl text-sm leading-6 text-slate-300">{language === "bn" ? "লাইভ ওয়েব রিসার্চ ব্যবহার করে সম্ভাব্য ক্রেতা ও ব্যবসায়িক পার্টনার খুঁজুন, তারপর তাদের জন্য ব্যক্তিগত পিচ পান।" : "Use live web research to locate prospective buyers and business partners, then receive a tailored outreach pitch for each one."}</p></div>
          </div>
        </section>

        <section className="print:hidden mt-6 rounded-3xl border border-cyan-300/20 bg-slate-900/75 p-5 shadow-xl shadow-cyan-950/30 backdrop-blur-xl sm:p-6">
          <form onSubmit={huntForClients} className="flex flex-col gap-3 sm:flex-row">
            <div className="relative flex-1"><Search className="pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-lime-300" /><input value={product} onChange={(event) => setProduct(event.target.value)} placeholder={t.targetProduct} className="h-12 w-full rounded-xl border border-slate-700 bg-slate-950 py-3 pl-11 pr-4 text-sm text-white outline-none transition placeholder:text-slate-500 focus:border-lime-300 focus:ring-4 focus:ring-lime-300/10" /></div>
            <Button type="submit" disabled={!product.trim() || !planId || isHunting} className="h-12 rounded-xl bg-gradient-to-r from-lime-400 to-cyan-400 px-6 font-extrabold text-slate-950 shadow-lg shadow-lime-400/20 hover:brightness-110">
              {isHunting ? <><LoaderCircle className="mr-2 h-4 w-4 animate-spin" />{status}</> : <><Radar className="mr-2 h-4 w-4" />{t.huntButton}</>}
            </Button>
          </form>
          {isHunting && <div className="mt-4"><AgenticLoader feature="sniper" language={language} /></div>}
          {!planId && <p className="mt-4 text-sm font-me
[truncated — 2628 more characters]
```

### src/app/supply-chain/page.tsx

```typescript
"use client";

import Link from "next/link";
import { FormEvent, useState } from "react";
import { useSearchParams } from "next/navigation";
import {
  ExternalLink,
  Lightbulb,
  Link2,
  LoaderCircle,
  MapPin,
  Search,
  Truck,
} from "lucide-react";
import { Button } from "@/components/ui/button";
import AgenticLoader from "@/components/AgenticLoader";
import { supabase } from "@/utils/supabase/client";
import { uiTranslations } from "@/utils/translations";

type SupplierResult = {
  summary: string;
  vendors: {
    name: string;
    location: string;
    contactOrLink: string;
    negotiationTip: string;
  }[];
};

function isWebUrl(value: string) {
  try {
    const url = new URL(value);
    return url.protocol === "https:" || url.protocol === "http:";
  } catch {
    return false;
  }
}

export default function SupplyChainPage() {
  const searchParams = useSearchParams();
  const planId = searchParams.get("planId") ?? "";
  const language: "en" | "bn" = searchParams.get("lang") === "bn" ? "bn" : "en";
  const t = uiTranslations[language];
  const [query, setQuery] = useState("");
  const [result, setResult] = useState<SupplierResult | null>(null);
  const [isSearching, setIsSearching] = useState(false);
  const [error, setError] = useState("");

  async function searchSuppliers(event: FormEvent<HTMLFormElement>) {
    event.preventDefault();
    if (!planId || !query.trim() || isSearching) return;

    setIsSearching(true);
    setError("");

    try {
      const {
        data: { session },
      } = await supabase.auth.getSession();

      if (!session) {
        throw new Error(
          language === "bn" ? "অনুগ্রহ করে আবার সাইন ইন করুন।" : "Please sign in again.",
        );
      }

      const response = await fetch("/api/supply-chain", {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Authorization: `Bearer ${session.access_token}`,
        },
        body: JSON.stringify({ query: query.trim(), planId, language }),
      });
      const payload = await response.json().catch(() => ({}));

      if (
        !response.ok ||
        typeof payload.summary !== "string" ||
        !Array.isArray(payload.vendors)
      ) {
        throw new Error(
          (payload.error === "AI Server is resting. Please try again." ? t.serverBusy : payload.error) ||
            (language === "bn"
              ? "সরবরাহকারী অনুসন্ধান সম্পন্ন করা যায়নি।"
              : "Supplier search could not be completed."),
        );
      }

      setResult(payload as SupplierResult);
    } catch (searchError) {
      setError(
        searchError instanceof Error
          ? searchError.message
          : t.serverBusy,
      );
    } finally {
      setIsSearching(false);
    }
  }

  return (
    <main
      className={`min-h-screen bg-slate-50 px-4 py-8 sm:px-6 lg:px-8 ${
        language === "bn" ? "font-bengali" : ""
      }`}
    >
      <div className="mx-auto max-w-6xl">
        <Link
          href="/dashboard"
          className="inline-flex items-center rounded-xl border border-slate-200 bg-white px-4 py-2.5 text-sm font-bold text-slate-700 shadow-sm transition hover:border-indigo-200 hover:text-indigo-700"
        >
          {t.backToDash}
        </Link>

        <section className="mt-6 overflow-hidden rounded-3xl border border-cyan-200 bg-gradient-to-br from-slate-950 via-cyan-950 to-indigo-950 p-6 text-white shadow-[0_24px_65px_-30px_rgba(6,182,212,.72)] sm:p-9">
          <div className="flex items-start gap-4">
            <span className="flex h-12 w-12 shrink-0 items-center justify-center rounded-2xl bg-cyan-300/15 text-cyan-100">
              <Truck className="h-6 w-6" />
            </span>
            <div>
              <p className="text-xs font-bold uppercase tracking-[.18em] text-cyan-100">
                MicroMentor AI
              </p>
              <h1 className="mt-1 text-3xl font-extrabold">{t.supplyChainTitle}</h1>
              <p className="mt-3 max-w-2xl text-sm leading-6 text-cyan-50/90">
                {t.supplyChainSubtitle}
              </p>
            </div>
          </div>
        </section>

        <section className="mt-6 rounded-3xl border border-cyan-100 bg-white/80 p-5 shadow-xl shadow-cyan-100/50 backdrop-blur-xl sm:p-6">
          <form onSubmit={searchSuppliers} className="flex flex-col gap-3 sm:flex-row">
            <div className="relative flex-1">
              <Search className="pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-cyan-700" />
              <input
                value={query}
                onChange={(event) => setQuery(event.target.value)}
                placeholder={t.supplierQueryPlaceholder}
                className="h-12 w-full rounded-xl border border-cyan-100 bg-white py-3 pl-11 pr-4 text-sm text-slate-800 outline-none transition placeholder:text-slate-400 focus:border-cyan-500 focus:ring-4 focus:ring-cyan-100"
              />
            </div>
            <Button
              type="submit"
              disabled={!query.trim() || !planId || isSearching}
              className="h-12 rounded-xl bg-gradient-to-r from-cyan-600 to-indigo-600 px-6 font-bold text-white shadow-lg shadow-cyan-600/20 hover:brightness-110"
            >
              {isSearching ? (
                <>
                  <LoaderCircle className="mr-2 h-4 w-4 animate-spin" />
                  {t.searchingSuppliers}
                </>
              ) : (
                <>
                  <Search className="mr-2 h-4 w-4" />
                  {t.searchSuppliers}
                </>
              )}
            </Button>
          </form>
          {isSearching && <div className="mt-4"><AgenticLoader feature="supply" language={language} /></div>}

          {!planId && (
            <p className="mt-3 text-sm font-medium text-rose-600">
              {language === "bn"
                ? "সাপ্লাই চেইন অনুসন্ধানের জন্য একটি বৈধ প্ল্যান প্রয়োজন।"
               
[truncated — 4808 more characters]
```

[61 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]