<?php
$page_title = 'Risk Command Center';
require_once __DIR__ . '/../config.php';
if (session_status() === PHP_SESSION_NONE) { session_start(); }
if (!isset($_SESSION['admin_id'])) { redirect(SITE_URL . '/admin/login.php'); }
require_once __DIR__ . '/header.php';
?>
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:24px;">
    <div>
        <h2 style="font-family:'Outfit',sans-serif; font-size:1.8rem; color:#0f172a; margin:0;"><i class="fas fa-shield-alt" style="color:#ef4444; margin-right:10px;"></i>Risk Command Center</h2>
        <p style="color:#64748b; font-size:0.95rem; margin-top:5px;">Enterprise risk register, heat maps, fraud alerts, and compliance tracking.</p>
    </div>
</div>
<div class="grid-4" style="margin-bottom:24px;">
    <div style="background:#fff; padding:20px; border-radius:12px; border:1px solid #e2e8f0; border-top:4px solid #ef4444;">
        <div style="color:#64748b; font-size:0.8rem; font-weight:600; margin-bottom:8px;">HIGH RISKS</div>
        <div style="font-size:1.6rem; font-weight:700; color:#ef4444;">4</div>
        <div style="color:#ef4444; font-size:0.8rem; margin-top:5px;"><i class="fas fa-exclamation-triangle"></i> Requires Action</div>
    </div>
    <div style="background:#fff; padding:20px; border-radius:12px; border:1px solid #e2e8f0; border-top:4px solid #f59e0b;">
        <div style="color:#64748b; font-size:0.8rem; font-weight:600; margin-bottom:8px;">MEDIUM RISKS</div>
        <div style="font-size:1.6rem; font-weight:700; color:#f59e0b;">12</div>
        <div style="color:#f59e0b; font-size:0.8rem; margin-top:5px;"><i class="fas fa-eye"></i> Monitoring</div>
    </div>
    <div style="background:#fff; padding:20px; border-radius:12px; border:1px solid #e2e8f0; border-top:4px solid #10b981;">
        <div style="color:#64748b; font-size:0.8rem; font-weight:600; margin-bottom:8px;">MITIGATED</div>
        <div style="font-size:1.6rem; font-weight:700; color:#10b981;">28</div>
        <div style="color:#10b981; font-size:0.8rem; margin-top:5px;"><i class="fas fa-check-circle"></i> This Quarter</div>
    </div>
    <div style="background:#fff; padding:20px; border-radius:12px; border:1px solid #e2e8f0; border-top:4px solid #3b82f6;">
        <div style="color:#64748b; font-size:0.8rem; font-weight:600; margin-bottom:8px;">INSURANCE COVER</div>
        <div style="font-size:1.6rem; font-weight:700; color:#0f172a;">₹120 Cr</div>
        <div style="color:#3b82f6; font-size:0.8rem; margin-top:5px;"><i class="fas fa-umbrella"></i> Full Coverage</div>
    </div>
</div>
<div class="grid-2">
    <div style="background:#fff; padding:20px; border-radius:12px; border:1px solid #e2e8f0;">
        <h3 style="margin:0 0 15px; font-size:1.15rem; color:#0f172a;"><i class="fas fa-th" style="color:#ef4444; margin-right:8px;"></i>Risk Heat Map</h3>
        <div style="display:grid; grid-template-columns:repeat(4,1fr); gap:6px; margin-bottom:15px;">
            <div style="background:#fee2e2; padding:12px 8px; border-radius:6px; text-align:center; font-size:0.7rem; color:#991b1b; font-weight:600;">Market<br>Risk</div>
            <div style="background:#fef3c7; padding:12px 8px; border-radius:6px; text-align:center; font-size:0.7rem; color:#92400e; font-weight:600;">Credit<br>Risk</div>
            <div style="background:#fee2e2; padding:12px 8px; border-radius:6px; text-align:center; font-size:0.7rem; color:#991b1b; font-weight:600;">Cyber<br>Risk</div>
            <div style="background:#dcfce7; padding:12px 8px; border-radius:6px; text-align:center; font-size:0.7rem; color:#166534; font-weight:600;">Legal<br>Risk</div>
            <div style="background:#fef3c7; padding:12px 8px; border-radius:6px; text-align:center; font-size:0.7rem; color:#92400e; font-weight:600;">Supply<br>Chain</div>
            <div style="background:#dcfce7; padding:12px 8px; border-radius:6px; text-align:center; font-size:0.7rem; color:#166534; font-weight:600;">Ops<br>Risk</div>
            <div style="background:#fef3c7; padding:12px 8px; border-radius:6px; text-align:center; font-size:0.7rem; color:#92400e; font-weight:600;">Fraud<br>Risk</div>
            <div style="background:#fee2e2; padding:12px 8px; border-radius:6px; text-align:center; font-size:0.7rem; color:#991b1b; font-weight:600;">Compliance<br>Risk</div>
        </div>
        <div style="border-left:3px solid #ef4444; padding-left:12px; margin-bottom:12px;">
            <div style="font-weight:600; font-size:0.9rem;">Fraud Alert: Duplicate vendor invoices</div>
            <div style="font-size:0.8rem; color:#64748b;">₹4.2L flagged · Under investigation</div>
        </div>
        <div style="border-left:3px solid #f59e0b; padding-left:12px;">
            <div style="font-weight:600; font-size:0.9rem;">Compliance: GST filing delay risk</div>
            <div style="font-size:0.8rem; color:#64748b;">3 entities pending · Due in 5 days</div>
        </div>
    </div>
    <div style="display:flex; flex-direction:column; gap:24px;">
        <div style="background:#fff; padding:20px; border-radius:12px; border:1px solid #e2e8f0;">
            <h3 style="margin:0 0 15px; font-size:1.15rem; color:#0f172a;"><i class="fas fa-chart-line" style="color:#8b5cf6; margin-right:8px;"></i>Scenario Simulation</h3>
            <div style="display:grid; grid-template-columns:1fr 1fr; gap:12px;">
                <div style="background:#f8fafc; padding:12px; border-radius:8px; text-align:center;">
                    <div style="font-size:1.3rem; font-weight:700; color:#ef4444;">-8%</div>
                    <div style="font-size:0.7rem; color:#94a3b8;">If Nickel +20%</div>
                </div>
                <div style="background:#f8fafc; padding:12px; border-radius:8px; text-align:center;">
                    <div style="font-size:1.3rem; font-weight:700; color:#10b981;">+5%</div>
                    <div style="font-size:0.7rem; color:#94a3b8;">If INR weakens 5%</div>
                </div>
                <div style="background:#f8fafc; padding:12px; border-radius:8px; text-align:center;">
                    <div style="font-size:1.3rem; font-weight:700; color:#f59e0b;">-3%</div>
                    <div style="font-size:0.7rem; color:#94a3b8;">If Demand drops 10%</div>
                </div>
                <div style="background:#f8fafc; padding:12px; border-radius:8px; text-align:center;">
                    <div style="font-size:1.3rem; font-weight:700; color:#ef4444;">-12%</div>
                    <div style="font-size:0.7rem; color:#94a3b8;">Worst Case</div>
                </div>
            </div>
        </div>
        <div style="background:linear-gradient(135deg,#ef4444,#dc2626); color:#fff; padding:20px; border-radius:12px;">
            <h3 style="margin:0 0 8px; font-size:1.1rem;"><i class="fas fa-umbrella"></i> Insurance Tracker</h3>
            <div style="display:flex; justify-content:space-between; font-size:0.85rem; margin-bottom:8px;">
                <span>Property</span><span style="font-weight:bold;">₹80 Cr</span>
            </div>
            <div style="display:flex; justify-content:space-between; font-size:0.85rem; margin-bottom:8px;">
                <span>Liability</span><span style="font-weight:bold;">₹25 Cr</span>
            </div>
            <div style="display:flex; justify-content:space-between; font-size:0.85rem;">
                <span>Key Person</span><span style="font-weight:bold;">₹15 Cr</span>
            </div>
        </div>
    </div>
</div>
<?php require_once __DIR__ . '/footer.php'; ?>
