path = "/home/crogers2287/cfrmanager/src/app/properties/[id]/ledger/page.tsx"
with open(path, 'r') as f:
    content = f.read()

# Replace the income card + add a deposits card after it
old = """            <Card className="bg-green-50/50 dark:bg-green-950/20 border-green-100 dark:border-green-900">
              <CardHeader className="flex flex-row items-center justify-between pb-2">
                <CardTitle className="text-sm font-medium text-green-700">
                  Total Income ({selectedYear})
                </CardTitle>
                <TrendingUp className="h-4 w-4 text-green-600" />
              </CardHeader>
              <CardContent>
                <div className="text-3xl font-bold text-green-600">
                  {new Intl.NumberFormat("en-US", {
                    style: "currency",
                    currency: "USD",
                  }).format(summary.totalIncome)}
                </div>
                <p className="text-xs text-muted-foreground">
                  {entries.filter(e => e.isIncome).length} income entries
                </p>
              </CardContent>
            </Card>"""

new = """            <Card className="bg-green-50/50 dark:bg-green-950/20 border-green-100 dark:border-green-900">
              <CardHeader className="flex flex-row items-center justify-between pb-2">
                <CardTitle className="text-sm font-medium text-green-700">
                  Total Income ({selectedYear})
                </CardTitle>
                <TrendingUp className="h-4 w-4 text-green-600" />
              </CardHeader>
              <CardContent>
                <div className="text-3xl font-bold text-green-600">
                  {new Intl.NumberFormat("en-US", {
                    style: "currency",
                    currency: "USD",
                  }).format(summary.totalIncome)}
                </div>
                <p className="text-xs text-muted-foreground">
                  {entries.filter(e => e.isIncome && e.category !== "security_deposit").length} income entries
                </p>
              </CardContent>
            </Card>

            <Card className="bg-teal-50/50 dark:bg-teal-950/20 border-teal-100 dark:border-teal-900">
              <CardHeader className="flex flex-row items-center justify-between pb-2">
                <CardTitle className="text-sm font-medium text-teal-700">
                  Deposits Held
                </CardTitle>
                <Wallet className="h-4 w-4 text-teal-600" />
              </CardHeader>
              <CardContent>
                <div className="text-3xl font-bold text-teal-600">
                  {new Intl.NumberFormat("en-US", {
                    style: "currency",
                    currency: "USD",
                  }).format(summary.depositsHeld)}
                </div>
                <p className="text-xs text-muted-foreground">
                  Liability — not income (FL §83.49)
                </p>
              </CardContent>
            </Card>"""

if old in content:
    content = content.replace(old, new)
    with open(path, 'w') as f:
        f.write(content)
    print("ledger/page.tsx: Fixed")
else:
    print("ledger/page.tsx: Pattern not found")
