#!/usr/bin/env python3
"""Convert morning package to PDF using reportlab for reliable Brother printing."""

from reportlab.lib.pagesizes import letter
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.colors import HexColor
from reportlab.lib.units import inch
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, HRFlowable
from reportlab.lib.enums import TA_CENTER

NAVY = HexColor('#1A376C')
GRAY = HexColor('#555555')
LTGRAY = HexColor('#888888')

def build():
    out = "/Users/joemac/.openclaw/workspace/projects/daily/morning-package-2026-03-30.pdf"
    doc = SimpleDocTemplate(out, pagesize=letter,
                            topMargin=0.6*inch, bottomMargin=0.6*inch,
                            leftMargin=0.75*inch, rightMargin=0.75*inch)

    styles = getSampleStyleSheet()
    # Custom styles
    title_style = ParagraphStyle('Title2', parent=styles['Title'], fontSize=15, textColor=NAVY, spaceAfter=2, alignment=TA_CENTER)
    sub_style = ParagraphStyle('Sub', parent=styles['Normal'], fontSize=9, textColor=GRAY, alignment=TA_CENTER, spaceAfter=6)
    h1 = ParagraphStyle('H1', parent=styles['Heading1'], fontSize=14, textColor=NAVY, spaceBefore=12, spaceAfter=6)
    sh = ParagraphStyle('SH', parent=styles['Heading2'], fontSize=11, textColor=NAVY, spaceBefore=8, spaceAfter=3)
    body = ParagraphStyle('Body', parent=styles['Normal'], fontSize=10, leading=13, spaceAfter=1, spaceBefore=1)
    bold_body = ParagraphStyle('BBody', parent=body, fontName='Helvetica-Bold')
    ital = ParagraphStyle('Ital', parent=body, fontName='Helvetica-Oblique', fontSize=9.5)
    bullet_style = ParagraphStyle('Bul', parent=body, leftIndent=20, bulletIndent=8)
    cb_style = ParagraphStyle('CB', parent=body, leftIndent=20, bulletIndent=8)
    footer_style = ParagraphStyle('Footer', parent=styles['Normal'], fontSize=8, textColor=LTGRAY, alignment=TA_CENTER, fontName='Helvetica-Oblique')

    story = []
    S = lambda pts=4: story.append(Spacer(1, pts))
    HR = lambda: story.append(HRFlowable(width="100%", thickness=1, color=NAVY, spaceAfter=6, spaceBefore=6))
    T = lambda t, s=body: story.append(Paragraph(t, s))
    B = lambda t: story.append(Paragraph(f"<bullet>&bull;</bullet> {t}", bullet_style))
    CB = lambda t: story.append(Paragraph(f"<bullet>&#9744;</bullet> {t}", cb_style))
    KV = lambda k, v: T(f"<b>{k}:</b> {v}")

    # ── HEADER ──
    T("Rob Lobster  |  DAILY MORNING PACKAGE", title_style)
    T("Monday, March 30, 2026  &bull;  6:00 AM  |  LBI / Tuckerton, NJ", sub_style)
    HR()

    # ── SECTION 1 ──
    T("SECTION 1 — MORNING BRIEF", h1)

    T("WEATHER — LBI / Tuckerton Area", sh)
    KV("Today (Mon)", "High 62°F / Low 52°F  |  Partly sunny, isolated showers after 3 PM (20%)")
    KV("Wind", "SW @ 15 mph, gusts to 30 mph — breezy day")
    KV("Tonight", "Low 52°F  |  Scattered showers mainly after 2 AM (30%)")
    KV("Tuesday", "High 68°F  |  Scattered AM showers, then partly sunny")
    KV("Wednesday", "High 71°F  |  Rain likely after 2 PM (50%), T-storms Wed night (70%)")
    KV("Thursday", "High 61°F  |  Chance of AM rain, then clearing")
    S(4)
    T("Spring weather arriving — 60s today, pushing toward 70 by midweek. Umbrella after 3 PM. Good boat weather through Wednesday morning.", ital)
    S(8)

    T("MARKET SNAPSHOT", sh)
    KV("Last Close (Fri 3/27)", "")
    KV("  S&amp;P 500", "6,368.85  vs. Exit Baseline 3/25: 6,591.90  →  DOWN -223.05 (-3.38%)")
    KV("  Dow Jones", "45,167  vs. Exit Baseline 3/25: 46,429.49  →  DOWN -1,263 (-2.72%)")
    S(2)
    KV("Premarket (6 AM Monday)", "")
    KV("  S&amp;P 500 Futures", "6,435.75 (+23.50, +0.37%) — modest green open expected")
    KV("  Dow Futures", "45,576 (+152, +0.33%)")
    KV("  Nasdaq 100 Futures", "23,398 (+70, +0.30%)")
    S(2)
    KV("Commodities", "")
    KV("  Oil (WTI)", "$101.54 (+1.91%)  |  Brent: $114.94 (+0.32%)")
    KV("  Gold", "$4,531.86 (+0.86%) — flight to safety continues")
    S(4)
    T("JFL&amp;KL FUND: Treasury position from March 25 continues to work. S&amp;P down 3.38% since exit. Dow in correction territory (-10% from peak). Five straight losing weeks. Oil above $100. Gold past $4,500. Futures show modest bounce (+0.3-0.4%) — could be dead cat. April 30 execution day is 31 days away. Stay patient. Watch for capitulation signals (VIX &gt;35, high-volume washout).", ital)
    S(8)

    T("TODAY'S SCHEDULE &amp; REMINDERS (Monday, March 30)", sh)
    B("Monday — start of week. Review action card, set priorities.")
    B("Firehouse: structural engineer follow-up + 1st floor V4 iteration")
    B("<b>CHARLESTON TRIP: April 2-6 — 3 DAYS AWAY!</b>")
    B("Vow renewal — Neisha confirmed April 3 availability. BOOK HER.")
    B("<b>ANNIVERSARY: April 3</b> — Joe &amp; Keli. Non-negotiable.")
    B("Isle of Palms rental contract — reviewed, ready to sign")
    B("360 King Boutique Suites — book Thursday April 2 one night")
    B("PORTFOLIO DAY: April 30 — 31 days out")
    S(8)

    T("URGENT / TOP OF MIND", sh)
    B("<b>Charleston vow renewal — Neisha confirmed April 3. CALL/BOOK TODAY. 4 days out!</b>")
    B("<b>360 King Boutique Suites — book April 2 one night. Call (843) 680-7400.</b>")
    B("Isle of Palms rental contract — sign and return")
    B("Squirrely video — need MOV 6136 + MOV 5153 clips from Joe to complete")
    B("TLC Coma video final done — send to jlynch@tlcnj.com")
    B("Joey Young spreadsheet — commission/bonus calcs still waiting")
    B("Certificate of Compliance + $150 fee for Phil Reed")
    S(8)

    T("WEEKEND RECAP (What Rob Got Done)", sh)
    B("Constellation Software deep-dive — Leonard stepping down, stock -55%, recommend 1-2%")
    B("T1D App competitor landscape — Dexcom $75M in Oura, but NOBODY does prediction")
    B("California Closets partnership — Ocean County unserved, Trade Program free to start")
    B("Keli's social media spring content — 2 weeks of posts ready")
    B("ReBolt competitive landscape — Permaplug $665K, power tool niche blue ocean")
    B("LBI spring RE market brief — slowest Feb on record, prices holding 97% of list")
    B("Colorant industry re-entry intel — 4 re-entry angles ranked")
    B("TLC Coma video edited — silent from 0:07, tagline, full-screen portrait")
    B("Firehouse floor plans — 2nd floor V6 final, 1st floor through V4")
    B("Lobster World Cup Pool — Survivor + Takeover designed, vision docs emailed")
    B("OpenClaw migrated to Claude Max ($200/mo)")
    B("Cron jobs fixed, browser automation working")
    S(8)

    T("EMAIL FLAGS", sh)
    B("Neisha (officiant) — confirmed April 3. Waiting on package pricing PDF.")
    B("Danielle's flight — Southwest CHS→AUS, Mon Apr 6, conf B5FIM6, $619. FYI.")
    B("Squirrely video — Joe sent instructions + 1 clip. Needs 2 more clips.")
    B("Firehouse architect plans — received. Studio 513 set (3 pages).")

    HR()
    S(6)

    # ── SECTION 2 — ACTION CARD ──
    T("SECTION 2 — ACTION CARD", h1)
    T("All active tasks by track. Check off as you go. Monday — set the week up right.", ital)
    S(6)

    T("MAC / TECH", sh)
    CB("Gmail send: rob.lobster.claw → jlynch@tlcnj.com ONLY")
    CB("Gmail read-only API on josephfl12@gmail.com")
    CB("Outlook forwarding: Epicor/Surfbox reports → rob.lobster.claw")
    CB("ElevenLabs account + voice plugin on Mac")
    CB("Full M365 read-only on jlynch@tlcnj.com")
    CB("M365 Calendar ICS publishing")
    CB("Morning package cron: output PDF for reliable Brother printing")
    S(6)

    T("CALLS TO MAKE TODAY", sh)
    CB("<b>Nuptials by Neisha — BOOK vow renewal for April 3, Isle of Palms</b>")
    CB("<b>360 King Boutique Suites: (843) 680-7400 — book April 2, request early check-in</b>")
    CB("Jersey Appliance: 609-918-1830 — Thermador hood (svc #275188)")
    CB("Mike the plumber (Ship Bottom) — walk-through, plumbing + HVAC")
    CB("California Closets Marlton: (609) 655-1899 — Trade Program")
    CB("Ray O'Connor — confirm Charleston meetup Apr 3-6")
    S(6)

    T("FIREHOUSE (18 New Street, Crosswicks)", sh)
    CB("First floor plan V4 — review Joe's markup, iterate to V5")
    CB("Send finalized 2nd floor V6 + 1st floor to structural engineer")
    CB("Concrete drain install — target before Easter. Status?")
    CB("Matthew Cassidy — demo / electrical coordination")
    CB("HVAC plan: furnace (1F) + heat pump (2F) + gas hot water (basement)")
    CB("Decision: NJ Redevelopment Plan or single-family luxury conversion")
    CB("Firehouse marketing materials — Rob building")
    S(6)

    T("TLC / SURFBOX", sh)
    CB("Joey Young — chase spreadsheet: commission/bonus + inventory target ($325K/$3,500)")
    CB("Amanda — Epicor credit card surcharge module status")
    CB("Certificate of Compliance + $150 fee → Phil Reed")
    CB("Zoning compliance letter — finalize, borough letterhead")
    CB("Edwin elevation to junior manager — formalize")
    CB("Neal &amp; Denise — priority call list for declining accounts")
    CB("Surf City pricing matrix audit in Epicor")
    CB("TLC Coma video — send final to jlynch@tlcnj.com")
    CB("Squirrely video — need MOV 6136 + MOV 5153 from Joe")
    CB("Surfbox social media — April 30 go-live")
    CB("OBX Surfbox new rental pipeline investigation")
    CB("Equipment: source diesel dually forklift + low forklift")
    CB("Equipment disposals: Surfbox bus, black box truck, older forklift")
    CB("Judy — staffing/overhead reduction")
    S(6)

    T("PROPERTIES", sh)
    CB("Corner Market — 275 W 9th St, Ship Bottom: 50/50 partnership decision")
    CB("Haastrotters Boatyard (Ship Bottom) — for sale or sold?")
    CB("539 paint store building — future uses research")
    CB("Property tax appeals — Chesterfield Block 301, Lots 10 &amp; 12")
    CB("Brother Matt co-owned property — fair buyout discussion")
    S(6)

    T("INVESTING (JFL&amp;KL FUND)", sh)
    B("S&amp;P at 6,369 (-3.4% since exit). Treasuries working. 31 days to April 30.")
    B("Premarket: S&amp;P futures +0.37%, Dow +0.33% — modest bounce")
    B("Gold past $4,500, oil above $100 — inflation pressure building")
    CB("April 30 execution prep — portfolio spreadsheet ready (29 stocks, 3 buckets)")
    B("CSU deep-dive complete. Recommend 1-2% allocation in Opportunistic Value bucket.")
    B("Watch for capitulation signals (VIX &gt;35, high-volume washout)")
    CB("Roth conversion — coordinate with MacArthur")
    CB("Fidelity account — confirm transfer from Wells Fargo")
    B("Colorant re-entry — Ray O'Connor meeting in Charleston, come prepared")
    S(6)

    T("FAMILY", sh)
    CB("<b>Charleston vow renewal — BOOK NEISHA TODAY (4 days!)</b>")
    CB("Anniversary April 3 — Keli gift / special plan finalized?")
    CB("Charleston trip packing + travel logistics")
    CB("360 King Boutique Suites — book April 2 one night")
    CB("Isle of Palms rental contract — sign and return")
    B("Danielle flight confirmed CHS→AUS Mon Apr 6 ($619, conf B5FIM6)")
    CB("Juliana — confidence plan + summer job research")
    CB("Bella — AI education package + OpenClaw setup")
    CB("Matty (Goodwill Fund) — investment updates?")
    CB("Gio — $225 cash check for driveway work")
    B("Keli — slow down, give her attention. Little things matter.")
    S(6)

    T("PROJECTS", sh)
    CB("Lobster World Cup Pool — need Venmo handle, PayPal.me, domain, player cap, invite code")
    CB("ReBolt — competitive landscape done. Next: prototype refinement?")
    CB("T1D App — competitor landscape done. BIG IDEAs Lab dataset. Next step?")
    CB("Keli social media — 2 weeks content ready. Start posting?")
    S(6)

    T("ERRANDS", sh)
    CB("Organize truck key rings (5 rings)")
    CB("Rob Lobster voice clone — gather Robby audio/video (talk to Renee first)")
    S(6)

    T("COMING UP", sh)
    B("Mar 31 (Tue) — 68°F, partly sunny. Last day of March.")
    B("Apr 1 (Wed) — 71°F, rain after 2 PM. April Fools' Day.")
    B("<b>Apr 2 (Thu) — Drive to Charleston. 360 King check-in. Trip begins!</b>")
    B("<b>Apr 3 (Fri) — ANNIVERSARY + Vow Renewal, Isle of Palms</b>")
    B("Apr 5 (Sun) — Easter. Family in Charleston.")
    B("Apr 6 (Mon) — Danielle's flight CHS→AUS. Drive home.")
    B("<b>Apr 30 (Wed) — PORTFOLIO EXECUTION DAY + Surfbox social media go-live</b>")
    B("Jun 11 — FIFA World Cup kicks off (Lobster Pool enrollment: May)")
    B("Sep 6 — Mom's birthday  |  Oct 30 — Dad's birthday")

    HR()
    S(8)
    T("Generated by Rob Lobster  &bull;  Monday, March 30, 2026  &bull;  6:00 AM ET", footer_style)
    T("Set the week up right, Joe. Charleston in 3 days. Make good decisions.", footer_style)

    doc.build(story)
    print(f"PDF saved: {out}")

build()
