#!/usr/bin/env python3
"""Build Joe's Daily Morning Package - March 28, 2026"""

from docx import Document
from docx.shared import Pt, RGBColor, Inches
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.oxml.ns import qn
from docx.oxml import OxmlElement
import datetime

doc = Document()

# ── Page margins ──────────────────────────────────────────────────────────────
for section in doc.sections:
    section.top_margin    = Inches(0.75)
    section.bottom_margin = Inches(0.75)
    section.left_margin   = Inches(0.85)
    section.right_margin  = Inches(0.85)

# ── Helpers ───────────────────────────────────────────────────────────────────
def add_heading(doc, text, level=1, color=RGBColor(0x1A, 0x37, 0x6C)):
    p = doc.add_heading(text, level=level)
    run = p.runs[0] if p.runs else p.add_run(text)
    run.font.color.rgb = color
    return p

def add_rule(doc):
    p = doc.add_paragraph()
    p.paragraph_format.space_before = Pt(2)
    p.paragraph_format.space_after  = Pt(2)
    pPr = p._p.get_or_add_pPr()
    pBdr = OxmlElement('w:pBdr')
    bottom = OxmlElement('w:bottom')
    bottom.set(qn('w:val'), 'single')
    bottom.set(qn('w:sz'), '6')
    bottom.set(qn('w:space'), '1')
    bottom.set(qn('w:color'), '1A376C')
    pBdr.append(bottom)
    pPr.append(pBdr)

def kv(doc, label, value, bold_label=True):
    p = doc.add_paragraph()
    p.paragraph_format.space_before = Pt(1)
    p.paragraph_format.space_after  = Pt(1)
    r1 = p.add_run(f"{label}: ")
    r1.bold = bold_label
    r1.font.size = Pt(10.5)
    r2 = p.add_run(value)
    r2.font.size = Pt(10.5)
    return p

def bullet(doc, text, checkbox=False, indent=0):
    prefix = "☐  " if checkbox else "•  "
    p = doc.add_paragraph()
    p.paragraph_format.left_indent   = Inches(0.25 * (indent + 1))
    p.paragraph_format.space_before  = Pt(1)
    p.paragraph_format.space_after   = Pt(1)
    r = p.add_run(prefix + text)
    r.font.size = Pt(10.5)
    return p

def section_header(doc, text):
    p = doc.add_paragraph()
    p.paragraph_format.space_before = Pt(6)
    p.paragraph_format.space_after  = Pt(2)
    r = p.add_run(text)
    r.bold = True
    r.font.size = Pt(11)
    r.font.color.rgb = RGBColor(0x1A, 0x37, 0x6C)
    return p


# ══════════════════════════════════════════════════════════════════════════════
#  HEADER
# ══════════════════════════════════════════════════════════════════════════════
title = doc.add_paragraph()
title.alignment = WD_ALIGN_PARAGRAPH.CENTER
r = title.add_run("🦞  ROB LOBSTER  |  DAILY MORNING PACKAGE")
r.bold = True
r.font.size = Pt(16)
r.font.color.rgb = RGBColor(0x1A, 0x37, 0x6C)

sub = doc.add_paragraph()
sub.alignment = WD_ALIGN_PARAGRAPH.CENTER
r2 = sub.add_run("Saturday, March 28, 2026  •  6:00 AM  |  LBI / Tuckerton, NJ")
r2.font.size = Pt(10)
r2.font.color.rgb = RGBColor(0x55, 0x55, 0x55)

add_rule(doc)

# ══════════════════════════════════════════════════════════════════════════════
#  SECTION 1 — MORNING BRIEF
# ══════════════════════════════════════════════════════════════════════════════
add_heading(doc, "SECTION 1 — MORNING BRIEF", level=1)

# ── Weather ───────────────────────────────────────────────────────────────────
section_header(doc, "☁  WEATHER — LBI / Tuckerton Area")
kv(doc, "Current",  "36°F, Overcast, Feels Like 26°F  |  Wind NNW @ 15 mph")
kv(doc, "Today",    "High 48°F / Low 33°F  |  Sunny by mid-morning, clearing nicely")
kv(doc, "Wind",     "NNW 15–17 mph all day — bundle up if heading outside early")
kv(doc, "Tomorrow", "High 51°F / Low 33°F  |  Mostly sunny")
kv(doc, "Monday",   "High 58°F / Low 44°F  |  Overcast, warming up — spring arriving")
kv(doc, "Sunrise",  "6:48 AM  |  Sunset: 7:18 PM")
p = doc.add_paragraph()
r = p.add_run("⚠  Cold start this morning — feels like the mid-20s with that NNW wind. "
              "Should break nicely by 10 AM with full sun. Good afternoon if you're outside.")
r.font.size = Pt(10)
r.italic = True

doc.add_paragraph()

# ── Market Snapshot ───────────────────────────────────────────────────────────
section_header(doc, "📈  MARKET SNAPSHOT  (Friday Close, March 27)")

kv(doc, "S&P 500",     "6,368.85          vs. Exit Baseline 3/25: 6,591.90   →  DOWN  -223.05  (-3.38%)")
kv(doc, "Dow Jones",   "45,167            vs. Exit Baseline 3/25: 46,429.49  →  DOWN  -1,262  (-2.72%)")
kv(doc, "Nasdaq",      "20,948  (-2.15% Friday)")
kv(doc, "Oil (Brent)", "≈ $108 / barrel")

p = doc.add_paragraph()
r = p.add_run(
    "📊  JFL&KL FUND POSITIONING:  You went 100% treasuries on March 25 at S&P 6,591.90 / "
    "Dow 46,429.49.  The market has dropped -3.38% on the S&P since your exit.  "
    "That is a correct call so far.  Friday's -1.7% drop pushed the Dow into official correction territory "
    "(-10% from recent peak).  Five consecutive down weeks.  Tariff uncertainty + Iran tension driving the selloff.  "
    "April 30 restructuring date is looking even smarter.  Watch for capitulation signals as a potential "
    "accelerated entry trigger.  Stay the course."
)
r.font.size = Pt(10)
r.italic = True

doc.add_paragraph()

# ── Schedule / Reminders ──────────────────────────────────────────────────────
section_header(doc, "📅  TODAY'S SCHEDULE & REMINDERS  (Saturday, March 28)")
bullet(doc, "Weekend — no standing meetings. Use the day.")
bullet(doc, "CHARLESTON TRIP: Thursday April 3 → Sunday April 6  (Easter weekend, 6 days away!)")
bullet(doc, "🤫 PRIVATE: Vow renewal — Friday April 4 beach ceremony. Officiant still needed. → Rob working on this.")
bullet(doc, "ANNIVERSARY: April 3 — Joe & Keli. Non-negotiable most important day.")
bullet(doc, "PORTFOLIO DAY: April 30 — Big execution day. 29-stock restructuring.")
bullet(doc, "Surfbox Social Media: April 30 go-live target.")
bullet(doc, "Mom's birthday: September 6  |  Dad's birthday: October 30  (plan ahead)")

doc.add_paragraph()

# ── Urgent Items ──────────────────────────────────────────────────────────────
section_header(doc, "🚨  URGENT / TOP OF MIND")
bullet(doc, "Charleston vow renewal logistics — officiant not booked yet. 6 days out. ACTION NEEDED.")
bullet(doc, "Brave Search API key expired — blocks Rob's web research. Refresh the subscription token.")
bullet(doc, "Switch to Claude Max $200/mo plan (was on tonight's Mac to-do from March 25).")
bullet(doc, "Gmail API setup (rob.lobster → jlynch@tlcnj.com) + Gmail read-only — still pending.")
bullet(doc, "Joey Young spreadsheet — commission/bonus calcs + inventory target input still waiting.")
bullet(doc, "Certificate of Compliance application + $150 fee for Phil Reed — upload form to Rob.")
bullet(doc, "Jersey Appliance call: 609-918-1830 — Thermador hood (svc #275188). Fix hood + door + racking.")
bullet(doc, "Concrete drain install — target before Easter. On track?")

doc.add_paragraph()

# ── Flagged Emails ────────────────────────────────────────────────────────────
section_header(doc, "📧  EMAIL NOTE")
p = doc.add_paragraph()
r = p.add_run(
    "Email access not yet configured (Gmail API + M365 setup still pending).  "
    "Once live, Rob will flag urgent emails here automatically.  "
    "Check jlynch@tlcnj.com and josephfl12@gmail.com manually this morning."
)
r.font.size = Pt(10)
r.italic = True

add_rule(doc)
doc.add_paragraph()

# ══════════════════════════════════════════════════════════════════════════════
#  SECTION 2 — ACTION CARD
# ══════════════════════════════════════════════════════════════════════════════
add_heading(doc, "SECTION 2 — ACTION CARD", level=1)

p = doc.add_paragraph()
r = p.add_run("All active tasks organized by track. Check off as you go.")
r.font.size = Pt(10)
r.italic = True

doc.add_paragraph()

# ── TRACK: MAC / TECH ─────────────────────────────────────────────────────────
section_header(doc, "💻  MAC / TECH")
bullet(doc, "Switch to Claude Max $200/mo plan on Mac",                                checkbox=True)
bullet(doc, "Set up Gmail send: rob.lobster.colle → jlynch@tlcnj.com ONLY",           checkbox=True)
bullet(doc, "Set up Gmail read-only API on josephfl12@gmail.com",                      checkbox=True)
bullet(doc, "Set up Outlook forwarding: Epicor/Surfbox reports → rob.lobster.colle",   checkbox=True)
bullet(doc, "Set up ElevenLabs account + enable voice plugin on Mac",                  checkbox=True)
bullet(doc, "Refresh Brave Search API subscription token (expired — blocking research)",checkbox=True)
bullet(doc, "Full Microsoft 365 read-only on jlynch@tlcnj.com",                       checkbox=True)
bullet(doc, "M365 Calendar ICS publishing",                                            checkbox=True)

doc.add_paragraph()

# ── TRACK: CALLS ──────────────────────────────────────────────────────────────
section_header(doc, "📞  CALLS")
bullet(doc, "Jersey Appliance: 609-918-1830 — Thermador hood (svc #275188)", checkbox=True)
bullet(doc, "Mike the plumber (Ship Bottom Code Official) — walk-through, plumbing reno + HVAC", checkbox=True)
bullet(doc, "Charleston officiant — book for Friday April 4 beach ceremony 🤫", checkbox=True)
bullet(doc, "Ray O'Connor — confirm Charleston meetup (dye/colorant connection)", checkbox=True)

doc.add_paragraph()

# ── TRACK: FIREHOUSE (Old School Firehouse, Crosswicks) ──────────────────────
section_header(doc, "🏛  FIREHOUSE  (18 New Street, Crosswicks)")
bullet(doc, "Confirm concrete drain install timeline — before Easter?",                checkbox=True)
bullet(doc, "Coordinate with Matthew Cassidy (ex-Marines) on demo / electrical",       checkbox=True)
bullet(doc, "Firehouse marketing materials — Rob building (architects + developers, central/south NJ + Philly)", checkbox=True)
bullet(doc, "Decide: stay in NJ Redevelopment Plan or cancel → convert to single-family luxury residence", checkbox=True)
bullet(doc, "HVAC plan: furnace (1F) + heat pump (2F) + gas hot water (basement) — contractor lined up?", checkbox=True)

doc.add_paragraph()

# ── TRACK: TLC / SURFBOX ─────────────────────────────────────────────────────
section_header(doc, "🏗  TLC / SURFBOX")
bullet(doc, "Joey Young — chase spreadsheet: commission/bonus calcs + inventory target ($325K/$3,500)", checkbox=True)
bullet(doc, "Amanda — status on Epicor credit card surcharge automation module",       checkbox=True)
bullet(doc, "Certificate of Compliance application + $150 fee → upload form to Rob for Phil Reed", checkbox=True)
bullet(doc, "Zoning compliance letter — tweak to make specific, request borough letterhead", checkbox=True)
bullet(doc, "Edwin elevation to junior manager — formalize",                           checkbox=True)
bullet(doc, "Neal & Denise — priority call list for declining accounts (Amon, Pagnotta targets)", checkbox=True)
bullet(doc, "Surf City pricing matrix audit in Epicor",                                checkbox=True)
bullet(doc, "Surfbox social media program — April 30 go-live (one video per store per week)", checkbox=True)
bullet(doc, "OBX Surfbox new rental pipeline investigation",                           checkbox=True)
bullet(doc, "Equipment: source used newer diesel dually forklift + low forklift (2026)", checkbox=True)
bullet(doc, "Equipment disposals: Surfbox bus (NC office), black box truck, one older forklift", checkbox=True)
bullet(doc, "Judy — staffing/overhead reduction (Joe oversight)",                      checkbox=True)

doc.add_paragraph()

# ── TRACK: PROPERTIES ─────────────────────────────────────────────────────────
section_header(doc, "🏠  PROPERTIES")
bullet(doc, "Corner Market deal — 275 W 9th St, Ship Bottom: 50/50 partnership decision", checkbox=True)
bullet(doc, "Haastrotters Boatyard (causeway, Ship Bottom) — for sale or sold? Get details", checkbox=True)
bullet(doc, "539 paint store building — research future uses: marine shop, landscape, Harbor Freight model, office tenants", checkbox=True)
bullet(doc, "Property tax appeals — Chesterfield Twp Block 301, Lots 10 & 12 (procedural strategy)", checkbox=True)
bullet(doc, "Brother Matt co-owned property — fair buyout discussion",                checkbox=True)
bullet(doc, "Keli's real estate social media content calendar — Rob building",         checkbox=True)

doc.add_paragraph()

# ── TRACK: INVESTING ──────────────────────────────────────────────────────────
section_header(doc, "📈  INVESTING  (JFL&KL FUND)")
bullet(doc, "S&P at 6,368 (-3.4% since exit). Treasuries working. Stay patient.", checkbox=False)
bullet(doc, "April 30 execution prep — Rob has portfolio spreadsheet (29 stocks, 3 buckets) ready",  checkbox=True)
bullet(doc, "Watch for capitulation signals — could accelerate entry timeline",        checkbox=False)
bullet(doc, "Constellation Software (CSU) — research post-Leonard crash (waiting on Brave API key)", checkbox=True)
bullet(doc, "Roth conversion — coordinate with MacArthur: LLC distributions → W-2 salary restructure", checkbox=True)
bullet(doc, "Fidelity account setup — confirm transfer from Wells Fargo resolved",     checkbox=True)
bullet(doc, "Colorant industry re-entry scan — watching for opportunity (NDA expired April 2025)", checkbox=False)

doc.add_paragraph()

# ── TRACK: FAMILY ─────────────────────────────────────────────────────────────
section_header(doc, "👨‍👩‍👧‍👧  FAMILY")
bullet(doc, "🤫 PRIVATE: Charleston vow renewal — officiant URGENT (6 days!)",         checkbox=True)
bullet(doc, "Anniversary April 3 — Keli gift / special plan finalized?",               checkbox=True)
bullet(doc, "Charleston Easter trip: April 3–6 — family + Ray O'Connor meetup",        checkbox=False)
bullet(doc, "Juliana — confidence plan + summer waitressing job research",              checkbox=True)
bullet(doc, "Bella — AI education package + her own OpenClaw setup",                   checkbox=True)
bullet(doc, "Danielle — PSI.inc physics AI model research (autonomous submarine connection)", checkbox=True)
bullet(doc, "Matty (Goodwill Fund) — any investment updates to discuss?",              checkbox=True)
bullet(doc, "Keli — slow down, give her attention. Little things matter. ❤️",         checkbox=False)
bullet(doc, "Gio — $225 cash check owed for driveway work at Mom & Dad's",             checkbox=True)

doc.add_paragraph()

# ── TRACK: ERRANDS ────────────────────────────────────────────────────────────
section_header(doc, "🔧  ERRANDS")
bullet(doc, "Organize truck key rings (5 rings: Firehouse, TD Bank, Truist, Surf City, Tuckerton)", checkbox=True)
bullet(doc, "Rob Lobster voice clone — gather Robby audio/video from Facebook (talk to Renee first)", checkbox=True)

doc.add_paragraph()

# ── TRACK: COMING UP ─────────────────────────────────────────────────────────
section_header(doc, "🗓  COMING UP")
bullet(doc, "Mar 29 (Sun) — High 51°F, sunny")
bullet(doc, "Mar 30 (Mon) — High 58°F, overcast. Spring is arriving.")
bullet(doc, "Apr 3 (Fri) — ANNIVERSARY + Charleston trip begins 🎉")
bullet(doc, "Apr 4 (Sat) — 🤫 Vow renewal ceremony (beach)")
bullet(doc, "Apr 5 (Sun) — Easter. Whole family in Charleston.")
bullet(doc, "Apr 30 (Thu) — BIG PORTFOLIO EXECUTION DAY + Surfbox social media go-live")
bullet(doc, "Sep 6 — Mom's 84th birthday")
bullet(doc, "Oct 30 — Dad's 87th birthday")

add_rule(doc)
doc.add_paragraph()

# ── Footer ─────────────────────────────────────────────────────────────────────
footer_p = doc.add_paragraph()
footer_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
r_f = footer_p.add_run(
    "Generated by Rob Lobster 🦞 • Saturday, March 28, 2026 • 6:00 AM ET\n"
    "Make good decisions today, Joe. 🤝"
)
r_f.font.size = Pt(9)
r_f.font.color.rgb = RGBColor(0x88, 0x88, 0x88)
r_f.italic = True

# ── Save ──────────────────────────────────────────────────────────────────────
out = "/Users/joemac/.openclaw/workspace/projects/daily/morning-package-2026-03-28.docx"
doc.save(out)
print(f"Saved: {out}")
