<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Client Report - {{ client.get_full_name }} - HAVEN GRAZURI ADVANCE</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <style>
        :root {
            --primary: #0A3D62;
            --secondary: #3C9EBD;
            --background: #FFFFFF;
            --success: #2ECC71;
            --error: #E74C3C;
        }
        .bg-primary { background-color: var(--primary); }
        .bg-secondary { background-color: var(--secondary); }
        .text-primary { color: var(--primary); }
        .text-secondary { color: var(--secondary); }
        .border-primary { border-color: var(--primary); }
        .border-secondary { border-color: var(--secondary); }
        
        @media print {
            .no-print { display: none !important; }
            .print-break { page-break-before: always; }
        }
    </style>
</head>
<body class="bg-gray-50">
    <div class="min-h-screen">
        <!-- Header -->
        <div class="bg-primary shadow no-print">
            <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
                <div class="flex justify-between h-16">
                    <div class="flex items-center">
                        <h1 class="text-xl font-bold text-white">HAVEN GRAZURI ADVANCE</h1>
                    </div>
                    <div class="flex items-center space-x-4">
                        <a href="/clients/" class="text-white hover:text-gray-300">← Back to Clients</a>
                        <button onclick="window.print()" class="bg-white text-primary px-4 py-2 rounded-md hover:bg-gray-100">
                            <i class="fas fa-print mr-2"></i>Print Report
                        </button>
                        <a href="{% url 'users:client_download_report' client_id=client.id %}" class="bg-green-600 text-white px-4 py-2 rounded-md hover:bg-green-700">
                            <i class="fas fa-download mr-2"></i>Download PDF
                        </a>
                    </div>
                </div>
            </div>
        </div>

        <!-- Report Content -->
        <div class="max-w-6xl mx-auto py-8 px-4 sm:px-6 lg:px-8">
            <!-- Report Header -->
            <div class="bg-white shadow-lg rounded-lg overflow-hidden mb-8">
                <div class="bg-primary px-6 py-4">
                    <div class="flex items-center justify-between">
                        <div>
                            <h2 class="text-2xl font-bold text-white">CLIENT REPORT</h2>
                            <p class="text-blue-100 mt-1">Comprehensive client analysis and loan history</p>
                        </div>
                        <div class="text-right text-white">
                            <p class="text-sm">Report Generated</p>
                            <p class="font-semibold">{{ report_date|date:"F d, Y" }}</p>
                            <p class="text-sm">{{ report_date|date:"g:i A" }}</p>
                        </div>
                    </div>
                </div>
                
                <!-- Client Summary -->
                <div class="p-6">
                    <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-6">
                        <div class="text-center">
                            <div class="text-3xl font-bold text-primary">{{ client.get_full_name }}</div>
                            <div class="text-sm text-gray-600">Client Name</div>
                        </div>
                        <div class="text-center">
                            <div class="text-2xl font-bold text-green-600">{{ loan_stats.total_loans }}</div>
                            <div class="text-sm text-gray-600">Total Loans</div>
                        </div>
                        <div class="text-center">
                            <div class="text-2xl font-bold {% if credit_score >= 80 %}text-green-600{% elif credit_score >= 60 %}text-yellow-600{% else %}text-red-600{% endif %}">
                                {{ credit_score }}/100
                            </div>
                            <div class="text-sm text-gray-600">Credit Score</div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Personal Information -->
            <div class="bg-white shadow-lg rounded-lg overflow-hidden mb-8">
                <div class="bg-gray-50 px-6 py-4 border-b">
                    <h3 class="text-lg font-semibold text-gray-900">
                        <i class="fas fa-user mr-2 text-primary"></i>Personal Information
                    </h3>
                </div>
                <div class="p-6">
                    <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
                        <div>
                            <label class="block text-sm font-medium text-gray-500">Full Name</label>
                            <p class="text-sm text-gray-900 font-medium">{{ client.get_full_name }}</p>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-500">Nickname</label>
                            <p class="text-sm text-gray-900">{{ client.nickname|default:"Not provided" }}</p>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-500">Phone Number</label>
                            <p class="text-sm text-gray-900">{{ client.phone_number }}</p>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-500">Email</label>
                            <p class="text-sm text-gray-900">{{ client.email|default:"Not provided" }}</p>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-500">ID Number</label>
                            <p class="text-sm text-gray-900">{{ client.id_number|default:"Not provided" }}</p>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-500">Date of Birth</label>
                            <p class="text-sm text-gray-900">{{ client.date_of_birth|date:"F d, Y"|default:"Not provided" }}</p>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-500">Gender</label>
                            <p class="text-sm text-gray-900">{{ client.get_gender_display|default:"Not provided" }}</p>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-500">Marital Status</label>
                            <p class="text-sm text-gray-900">{{ client.get_marital_status_display|default:"Not provided" }}</p>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-500">Nationality</label>
                            <p class="text-sm text-gray-900">{{ client.nationality|default:"Not provided" }}</p>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-500">Country</label>
                            <p class="text-sm text-gray-900">{{ client.country|default:"Not provided" }}</p>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-500">Place of Birth</label>
                            <p class="text-sm text-gray-900">{{ client.place_of_birth|default:"Not provided" }}</p>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-500">Registration Date</label>
                            <p class="text-sm text-gray-900">{{ client.registration_date|date:"F d, Y"|default:"Not provided" }}</p>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-500">Status</label>
                            <span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full 
                                {% if client.status == 'active' %}bg-green-100 text-green-800
                                {% elif client.status == 'inactive' %}bg-yellow-100 text-yellow-800
                                {% elif client.status == 'suspended' %}bg-red-100 text-red-800
                                {% else %}bg-gray-100 text-gray-800{% endif %}">
                                {{ client.get_status_display }}
                            </span>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Address Information -->
            <div class="bg-white shadow-lg rounded-lg overflow-hidden mb-8">
                <div class="bg-gray-50 px-6 py-4 border-b">
                    <h3 class="text-lg font-semibold text-gray-900">
                        <i class="fas fa-map-marker-alt mr-2 text-primary"></i>Address Information
                    </h3>
                </div>
                <div class="p-6">
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                        <div>
                            <label class="block text-sm font-medium text-gray-500">Physical Address</label>
                            <p class="text-sm text-gray-900">{{ client.physical_address|default:"Not provided" }}</p>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-500">City</label>
                            <p class="text-sm text-gray-900">{{ client.city|default:"Not provided" }}</p>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-500">County</label>
                            <p class="text-sm text-gray-900">{{ client.county|default:"Not provided" }}</p>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-500">Postal Code</label>
                            <p class="text-sm text-gray-900">{{ client.postal_code|default:"Not provided" }}</p>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-500">Physical Location</label>
                            <p class="text-sm text-gray-900">{{ client.physical_location|default:"Not provided" }}</p>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-500">Domicile</label>
                            <p class="text-sm text-gray-900">{{ client.domicile|default:"Not provided" }}</p>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Business Information -->
            <div class="bg-white shadow-lg rounded-lg overflow-hidden mb-8">
                <div class="bg-gray-50 px-6 py-4 border-b">
                    <h3 class="text-lg font-semibold text-gray-900">
                        <i class="fas fa-briefcase mr-2 text-primary"></i>Business Information
                    </h3>
                </div>
                <div class="p-6">
                    <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
                        <div>
                            <label class="block text-sm font-medium text-gray-500">Business Name</label>
                            <p class="text-sm text-gray-900 font-medium">{{ client.business_name|default:"Not provided" }}</p>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-500">Business Type</label>
                            <p class="text-sm text-gray-900">{{ client.business_type|default:"Not provided" }}</p>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-500">Other Business Type</label>
                            <p class="text-sm text-gray-900">{{ client.other_business_type|default:"Not provided" }}</p>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-500">Business Address</label>
                            <p class="text-sm text-gray-900">{{ client.business_address|default:"Not provided" }}</p>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-500">Employer</label>
                            <p class="text-sm text-gray-900">{{ client.employer|default:"Not provided" }}</p>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-500">Monthly Income</label>
                            <p class="text-sm text-gray-900">KES {{ client.monthly_income|floatformat:2|default:"0.00" }}</p>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-500">Capital Invested</label>
                            <p class="text-sm text-gray-900">KES {{ client.capital_invested|floatformat:2|default:"0.00" }}</p>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-500">Expected Turnover</label>
                            <p class="text-sm text-gray-900">KES {{ client.expected_turnover|floatformat:2|default:"0.00" }}</p>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-500">Source of Funds</label>
                            <p class="text-sm text-gray-900">{{ client.source_of_funds|default:"Not provided" }}</p>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Loan Statistics -->
            <div class="bg-white shadow-lg rounded-lg overflow-hidden mb-8">
                <div class="bg-gray-50 px-6 py-4 border-b">
                    <h3 class="text-lg font-semibold text-gray-900">
                        <i class="fas fa-chart-pie mr-2 text-primary"></i>Loan Statistics
                    </h3>
                </div>
                <div class="p-6">
                    <div class="grid grid-cols-2 md:grid-cols-4 gap-4">
                        <div class="bg-blue-50 p-4 rounded-lg text-center">
                            <p class="text-sm text-blue-600 font-medium">Total Loans</p>
                            <p class="text-2xl font-bold text-blue-900">{{ loan_stats.total_loans }}</p>
                        </div>
                        <div class="bg-green-50 p-4 rounded-lg text-center">
                            <p class="text-sm text-green-600 font-medium">Active Loans</p>
                            <p class="text-2xl font-bold text-green-900">{{ loan_stats.active_loans }}</p>
                        </div>
                        <div class="bg-yellow-50 p-4 rounded-lg text-center">
                            <p class="text-sm text-yellow-600 font-medium">Total Borrowed</p>
                            <p class="text-2xl font-bold text-yellow-900">KES {{ loan_stats.total_borrowed|floatformat:2 }}</p>
                        </div>
                        <div class="bg-purple-50 p-4 rounded-lg text-center">
                            <p class="text-sm text-purple-600 font-medium">Total Repaid</p>
                            <p class="text-2xl font-bold text-purple-900">KES {{ loan_stats.total_repaid|floatformat:2 }}</p>
                        </div>
                    </div>
                    <div class="mt-6">
                        <div class="bg-red-50 p-4 rounded-lg text-center">
                            <p class="text-sm text-red-600 font-medium">Outstanding Amount</p>
                            <p class="text-2xl font-bold text-red-900">KES {{ loan_stats.outstanding_amount|floatformat:2 }}</p>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Credit Score Analysis -->
            <div class="bg-white shadow-lg rounded-lg overflow-hidden mb-8">
                <div class="bg-gray-50 px-6 py-4 border-b">
                    <h3 class="text-lg font-semibold text-gray-900">
                        <i class="fas fa-chart-line mr-2 text-primary"></i>Credit Score Analysis
                    </h3>
                </div>
                <div class="p-6">
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                        <div>
                            <div class="text-center mb-4">
                                <div class="text-4xl font-bold {% if credit_score >= 80 %}text-green-600{% elif credit_score >= 60 %}text-yellow-600{% else %}text-red-600{% endif %}">
                                    {{ credit_score }}/100
                                </div>
                                <div class="text-sm text-gray-600">Overall Credit Score</div>
                            </div>
                        </div>
                        <div>
                            {% if credit_score_details %}
                            <div class="space-y-3">
                                <div class="flex justify-between">
                                    <span class="text-sm font-medium text-gray-500">Payment History</span>
                                    <span class="text-sm text-gray-900">{{ credit_score_details.payment_history|default:"N/A" }}</span>
                                </div>
                                <div class="flex justify-between">
                                    <span class="text-sm font-medium text-gray-500">Credit Utilization</span>
                                    <span class="text-sm text-gray-900">{{ credit_score_details.credit_utilization|default:"N/A" }}</span>
                                </div>
                                <div class="flex justify-between">
                                    <span class="text-sm font-medium text-gray-500">Credit History Length</span>
                                    <span class="text-sm text-gray-900">{{ credit_score_details.credit_history_length|default:"N/A" }}</span>
                                </div>
                                <div class="flex justify-between">
                                    <span class="text-sm font-medium text-gray-500">Income Stability</span>
                                    <span class="text-sm text-gray-900">{{ credit_score_details.income_stability|default:"N/A" }}</span>
                                </div>
                                <div class="flex justify-between">
                                    <span class="text-sm font-medium text-gray-500">Employment History</span>
                                    <span class="text-sm text-gray-900">{{ credit_score_details.employment_history|default:"N/A" }}</span>
                                </div>
                            </div>
                            {% else %}
                            <div class="text-center text-gray-500">
                                <p>Credit score details not available</p>
                            </div>
                            {% endif %}
                        </div>
                    </div>
                </div>
            </div>

            <!-- Document Status -->
            <div class="bg-white shadow-lg rounded-lg overflow-hidden mb-8">
                <div class="bg-gray-50 px-6 py-4 border-b">
                    <h3 class="text-lg font-semibold text-gray-900">
                        <i class="fas fa-file-alt mr-2 text-primary"></i>Document Status
                    </h3>
                </div>
                <div class="p-6">
                    <div class="grid grid-cols-2 md:grid-cols-4 gap-4">
                        <div class="text-center">
                            <div class="w-12 h-12 mx-auto mb-2 rounded-full flex items-center justify-center {% if documents.id_document %}bg-green-100{% else %}bg-red-100{% endif %}">
                                <i class="fas fa-id-card text-lg {% if documents.id_document %}text-green-600{% else %}text-red-600{% endif %}"></i>
                            </div>
                            <p class="text-sm font-medium text-gray-900">ID Document</p>
                            <p class="text-xs text-gray-500">{{ documents.id_document|yesno:"Uploaded,Missing" }}</p>
                        </div>
                        <div class="text-center">
                            <div class="w-12 h-12 mx-auto mb-2 rounded-full flex items-center justify-center {% if documents.selfie %}bg-green-100{% else %}bg-red-100{% endif %}">
                                <i class="fas fa-camera text-lg {% if documents.selfie %}text-green-600{% else %}text-red-600{% endif %}"></i>
                            </div>
                            <p class="text-sm font-medium text-gray-900">Selfie Photo</p>
                            <p class="text-xs text-gray-500">{{ documents.selfie|yesno:"Uploaded,Missing" }}</p>
                        </div>
                        <div class="text-center">
                            <div class="w-12 h-12 mx-auto mb-2 rounded-full flex items-center justify-center {% if documents.utility_bill %}bg-green-100{% else %}bg-red-100{% endif %}">
                                <i class="fas fa-file-invoice text-lg {% if documents.utility_bill %}text-green-600{% else %}text-red-600{% endif %}"></i>
                            </div>
                            <p class="text-sm font-medium text-gray-900">Utility Bill</p>
                            <p class="text-xs text-gray-500">{{ documents.utility_bill|yesno:"Uploaded,Missing" }}</p>
                        </div>
                        <div class="text-center">
                            <div class="w-12 h-12 mx-auto mb-2 rounded-full flex items-center justify-center {% if documents.bank_statement %}bg-green-100{% else %}bg-red-100{% endif %}">
                                <i class="fas fa-university text-lg {% if documents.bank_statement %}text-green-600{% else %}text-red-600{% endif %}"></i>
                            </div>
                            <p class="text-sm font-medium text-gray-900">Bank Statement</p>
                            <p class="text-xs text-gray-500">{{ documents.bank_statement|yesno:"Uploaded,Missing" }}</p>
                        </div>
                        <div class="text-center">
                            <div class="w-12 h-12 mx-auto mb-2 rounded-full flex items-center justify-center {% if documents.logbook %}bg-green-100{% else %}bg-red-100{% endif %}">
                                <i class="fas fa-car text-lg {% if documents.logbook %}text-green-600{% else %}text-red-600{% endif %}"></i>
                            </div>
                            <p class="text-sm font-medium text-gray-900">Logbook</p>
                            <p class="text-xs text-gray-500">{{ documents.logbook|yesno:"Uploaded,Missing" }}</p>
                        </div>
                        <div class="text-center">
                            <div class="w-12 h-12 mx-auto mb-2 rounded-full flex items-center justify-center {% if documents.title_deed %}bg-green-100{% else %}bg-red-100{% endif %}">
                                <i class="fas fa-home text-lg {% if documents.title_deed %}text-green-600{% else %}text-red-600{% endif %}"></i>
                            </div>
                            <p class="text-sm font-medium text-gray-900">Title Deed</p>
                            <p class="text-xs text-gray-500">{{ documents.title_deed|yesno:"Uploaded,Missing" }}</p>
                        </div>
                        <div class="text-center">
                            <div class="w-12 h-12 mx-auto mb-2 rounded-full flex items-center justify-center {% if documents.signature %}bg-green-100{% else %}bg-red-100{% endif %}">
                                <i class="fas fa-signature text-lg {% if documents.signature %}text-green-600{% else %}text-red-600{% endif %}"></i>
                            </div>
                            <p class="text-sm font-medium text-gray-900">Signature</p>
                            <p class="text-xs text-gray-500">{{ documents.signature|yesno:"Uploaded,Missing" }}</p>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Loan History -->
            <div class="bg-white shadow-lg rounded-lg overflow-hidden mb-8 print-break">
                <div class="bg-gray-50 px-6 py-4 border-b">
                    <h3 class="text-lg font-semibold text-gray-900">
                        <i class="fas fa-history mr-2 text-primary"></i>Loan History
                    </h3>
                </div>
                <div class="p-6">
                    {% if loans %}
                    <div class="overflow-x-auto">
                        <table class="min-w-full divide-y divide-gray-200">
                            <thead class="bg-gray-50">
                                <tr>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Loan ID</th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Principal</th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Interest</th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Amount Paid</th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Disbursement Date</th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Due Date</th>
                                </tr>
                            </thead>
                            <tbody class="bg-white divide-y divide-gray-200">
                                {% for loan in loans %}
                                <tr>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">{{ loan.id }}</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">KES {{ loan.principal_amount|floatformat:2 }}</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">KES {{ loan.interest_amount|floatformat:2 }}</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">KES {{ loan.amount_paid|floatformat:2 }}</td>
                                    <td class="px-6 py-4 whitespace-nowrap">
                                        <span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full 
                                            {% if loan.status == 'active' %}bg-green-100 text-green-800
                                            {% elif loan.status == 'completed' %}bg-blue-100 text-blue-800
                                            {% elif loan.status == 'defaulted' %}bg-red-100 text-red-800
                                            {% else %}bg-gray-100 text-gray-800{% endif %}">
                                            {{ loan.get_status_display }}
                                        </span>
                                    </td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ loan.disbursement_date|date:"M d, Y"|default:"N/A" }}</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ loan.due_date|date:"M d, Y"|default:"N/A" }}</td>
                                </tr>
                                {% endfor %}
                            </tbody>
                        </table>
                    </div>
                    {% else %}
                    <div class="text-center py-8">
                        <i class="fas fa-inbox text-4xl text-gray-300 mb-4"></i>
                        <p class="text-gray-500">No loan history available</p>
                    </div>
                    {% endif %}
                </div>
            </div>

            <!-- Additional Information -->
            <div class="bg-white shadow-lg rounded-lg overflow-hidden mb-8">
                <div class="bg-gray-50 px-6 py-4 border-b">
                    <h3 class="text-lg font-semibold text-gray-900">
                        <i class="fas fa-info-circle mr-2 text-primary"></i>Additional Information
                    </h3>
                </div>
                <div class="p-6">
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                        <div>
                            <h4 class="text-md font-semibold text-gray-900 mb-3">Declaration</h4>
                            <div class="space-y-2">
                                <div>
                                    <label class="block text-sm font-medium text-gray-500">Declaration Name</label>
                                    <p class="text-sm text-gray-900">{{ client.declaration_name|default:"Not provided" }}</p>
                                </div>
                                <div>
                                    <label class="block text-sm font-medium text-gray-500">Personal PIN</label>
                                    <p class="text-sm text-gray-900">{{ client.personal_pin|default:"Not provided" }}</p>
                                </div>
                            </div>
                        </div>
                        <div>
                            <h4 class="text-md font-semibold text-gray-900 mb-3">Recommender</h4>
                            <div class="space-y-2">
                                <div>
                                    <label class="block text-sm font-medium text-gray-500">Name</label>
                                    <p class="text-sm text-gray-900">{{ client.recommender_name|default:"Not provided" }}</p>
                                </div>
                                <div>
                                    <label class="block text-sm font-medium text-gray-500">ID Number</label>
                                    <p class="text-sm text-gray-900">{{ client.recommender_id|default:"Not provided" }}</p>
                                </div>
                                <div>
                                    <label class="block text-sm font-medium text-gray-500">Telephone</label>
                                    <p class="text-sm text-gray-900">{{ client.recommender_tel|default:"Not provided" }}</p>
                                </div>
                                <div>
                                    <label class="block text-sm font-medium text-gray-500">Mobile</label>
                                    <p class="text-sm text-gray-900">{{ client.recommender_mobile|default:"Not provided" }}</p>
                                </div>
                                <div>
                                    <label class="block text-sm font-medium text-gray-500">Residence</label>
                                    <p class="text-sm text-gray-900">{{ client.recommender_residence|default:"Not provided" }}</p>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    {% if client.guarantor_name %}
                    <div class="mt-6">
                        <h4 class="text-md font-semibold text-gray-900 mb-3">Guarantor</h4>
                        <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                            <div>
                                <label class="block text-sm font-medium text-gray-500">Name</label>
                                <p class="text-sm text-gray-900">{{ client.guarantor_name }}</p>
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-500">ID Number</label>
                                <p class="text-sm text-gray-900">{{ client.guarantor_id|default:"Not provided" }}</p>
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-500">Telephone</label>
                                <p class="text-sm text-gray-900">{{ client.guarantor_tel|default:"Not provided" }}</p>
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-500">Mobile</label>
                                <p class="text-sm text-gray-900">{{ client.guarantor_mobile|default:"Not provided" }}</p>
                            </div>
                            <div class="md:col-span-2">
                                <label class="block text-sm font-medium text-gray-500">Residence</label>
                                <p class="text-sm text-gray-900">{{ client.guarantor_residence|default:"Not provided" }}</p>
                            </div>
                        </div>
                    </div>
                    {% endif %}
                </div>
            </div>

            <!-- Report Footer -->
            <div class="bg-white shadow-lg rounded-lg overflow-hidden">
                <div class="p-6 text-center">
                    <p class="text-sm text-gray-600">
                        This report was generated on {{ report_date|date:"F d, Y at g:i A" }} by HAVEN GRAZURI VESTMENT LIMITEDsystem.
                    </p>
                    <p class="text-xs text-gray-500 mt-2">
                        For any questions regarding this report, please contact our support team.
                    </p>
                </div>
            </div>
        </div>
    </div>
</body>
</html> 