<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>URGENT: Final Day to Resolve Quota Overage</title>
</head>
<body style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; line-height: 1.6; color: #374151; max-width: 600px; margin: 0 auto; padding: 20px;">
    <div style="background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); padding: 30px; border-radius: 12px 12px 0 0; text-align: center;">
        <h1 style="color: white; margin: 0; font-size: 24px;">FINAL NOTICE</h1>
        <p style="color: rgba(255,255,255,0.9); margin: 10px 0 0 0;">Automatic archiving begins tomorrow</p>
    </div>

    <div style="background: #ffffff; padding: 30px; border: 1px solid #e5e7eb; border-top: none; border-radius: 0 0 12px 12px;">
        <p>Hi {{ owner.first_name|default:owner.username }},</p>

        <p><strong>This is your final reminder.</strong> Your <strong>{{ tenant.name }}</strong> account is still over the limit for <strong>{{ display_name }}</strong>, and the grace period ends <strong>tomorrow</strong>.</p>

        <div style="background: #fee2e2; border: 2px solid #dc2626; border-radius: 8px; padding: 20px; margin: 20px 0; text-align: center;">
            <p style="margin: 0 0 10px 0; color: #991b1b; font-size: 24px;">
                <strong>⚠️ LESS THAN 24 HOURS</strong>
            </p>
            <p style="margin: 0; color: #991b1b;">
                Grace period ends: <strong>{{ grace_period_ends|date:"F j, Y" }}</strong>
            </p>
        </div>

        <div style="background: #fef3c7; border: 1px solid #f59e0b; border-radius: 8px; padding: 20px; margin: 20px 0;">
            <div style="display: flex; justify-content: space-between; margin-bottom: 10px;">
                <span style="color: #92400e;">Current Usage:</span>
                <strong style="color: #92400e;">{{ current_usage }}</strong>
            </div>
            <div style="display: flex; justify-content: space-between; margin-bottom: 10px;">
                <span style="color: #92400e;">Your Plan Allows:</span>
                <strong style="color: #92400e;">{{ allowed_limit }}</strong>
            </div>
            <div style="display: flex; justify-content: space-between; border-top: 1px solid #f59e0b; padding-top: 10px;">
                <span style="color: #92400e;">Will Be Archived:</span>
                <strong style="color: #dc2626;">{{ overage_amount }} {{ display_name }}</strong>
            </div>
        </div>

        <h2 style="color: #dc2626; font-size: 18px; margin-top: 30px;">What happens tomorrow?</h2>

        <p>If no action is taken, the <strong>{{ overage_amount }} oldest {{ display_name }}</strong> will be automatically archived:</p>

        <ul style="padding-left: 20px; color: #6b7280;">
            <li style="margin-bottom: 8px;">Archived items will become <strong>read-only</strong></li>
            <li style="margin-bottom: 8px;">You will not be able to make changes to archived items</li>
            <li style="margin-bottom: 8px;">Data may become <strong>permanently unrecoverable</strong> after archiving</li>
        </ul>

        <div style="background: #ecfdf5; border: 1px solid #10b981; border-radius: 8px; padding: 15px; margin: 20px 0;">
            <p style="margin: 0; color: #065f46;">
                <strong>💡 Last chance to export!</strong> Download your data now at <a href="{{ export_url }}" style="color: #059669;">{{ export_url }}</a> before any archiving occurs.
            </p>
        </div>

        <div style="text-align: center; margin: 30px 0;">
            <a href="{{ manage_url }}" style="display: inline-block; background: #dc2626; color: white; padding: 14px 35px; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 16px;">Take Action Now</a>
        </div>

        <div style="text-align: center; margin: 20px 0;">
            <a href="{{ upgrade_url }}" style="color: #10b981; font-weight: 600;">Or upgrade your plan to keep all your {{ display_name }} →</a>
        </div>

        <hr style="border: none; border-top: 1px solid #e5e7eb; margin: 30px 0;">

        <p style="color: #6b7280; font-size: 14px;">
            Need help? Contact our support team immediately and we'll do our best to assist you.
        </p>
    </div>
</body>
</html>
