root = Card([header, overview, activitySection, contactsSection, followupsSection, noteSection, renewalSection, callSection], "card", "column", "l")

header = CardHeader("Acme Corporation", "Owned by Sarah Mitchell • Enterprise Account")

overview = Card([valueCard, stageCard], "clear", "row", "m", "stretch", "between")
valueCard = Card([valueLabel, valueAmount], "sunk", "column", "s")
valueLabel = TextContent("Total Deal Value", "small-heavy")
valueAmount = TextContent("$2.4M", "large-heavy")
stageCard = Card([stageLabel, stageTag], "sunk", "column", "s")
stageLabel = TextContent("Current Stage", "small-heavy")
stageTag = Tag("Negotiation", null, "lg", "warning")

activitySection = Card([activityHeader, activityList], "card", "column", "m")
activityHeader = Heading("Recent Activity", "h3")
activityList = ListBlock([act1, act2, act3, act4], "number")
act1 = ListItem("Contract sent for review", "Legal team reviewing MSA • 2 hours ago", null, null)
act2 = ListItem("Demo completed with IT team", "Technical deep-dive on API integration • Yesterday", null, null)
act3 = ListItem("Pricing proposal delivered", "3-year enterprise tier with volume discount • 3 days ago", null, null)
act4 = ListItem("Discovery call completed", "Identified 5 new use cases for expansion • 1 week ago", null, null)

contactsSection = Card([contactsHeader, contactsTable], "card", "column", "m")
contactsHeader = Heading("Key Contacts", "h3")
contactsTable = Table([contactName, contactRole, contactEmail, contactPhone])
contactName = Col("Name", ["James Chen", "Maria Rodriguez", "David Park", "Lisa Thompson"])
contactRole = Col("Role", ["CTO / Decision Maker", "VP Engineering / Champion", "Procurement Lead", "Security Architect / Influencer"])
contactEmail = Col("Email", ["jchen@acme.com", "mrodriguez@acme.com", "dpark@acme.com", "lthompson@acme.com"])
contactPhone = Col("Phone", ["+1 415-555-0123", "+1 415-555-0145", "+1 415-555-0167", "+1 415-555-0189"])

followupsSection = Card([followupsHeader, followupsList], "card", "column", "m")
followupsHeader = Heading("Open Follow-ups", "h3")
followupsList = ListBlock([fu1, fu2, fu3], "number")
fu1 = ListItem("Send security questionnaire", "Due: Today • Assigned to: Sarah Mitchell", null, null)
fu2 = ListItem("Schedule exec alignment call", "Due: Tomorrow • Assigned to: Sarah Mitchell", null, null)
fu3 = ListItem("Provide ROI calculator", "Due: In 3 days • Assigned to: Sales Engineering", null, null)

noteSection = Card([noteHeader, noteForm], "card", "column", "m")
noteHeader = Heading("Quick Note", "h3")
noteForm = Form("quick-note", noteButtons, [noteField])
noteField = FormControl("Add a note", noteInput, "Visible to account team only")
noteInput = TextArea("note", "Type your note here...", 3, null, null)
noteButtons = Buttons([saveNoteBtn], "row")
saveNoteBtn = Button("Save Note", null, "primary")

renewalSection = Card([renewalHeader, renewalAlert], "card", "column", "m")
renewalHeader = Heading("Renewal", "h3")
renewalAlert = Callout("warning", "Renewal Approaching", "Contract renews in 45 days (March 15, 2025). Start renewal conversation now to avoid auto-renewal at current terms.")

callSection = Card([callHeader, callForm], "card", "column", "m")
callHeader = Heading("Log a Call", "h3")
callForm = Form("log-call", callButtons, [callTypeField, callDurationField, callOutcomeField, callNotesField])
callTypeField = FormControl("Call Type", callTypeSelect)
callTypeSelect = Select("call_type", [typeDiscovery, typeDemo, typeNegotiation, typeCheckin, typeOther], "Select call type")
typeDiscovery = SelectItem("discovery", "Discovery")
typeDemo = SelectItem("demo", "Demo / Presentation")
typeNegotiation = SelectItem("negotiation", "Negotiation")
typeCheckin = SelectItem("checkin", "Check-in")
typeOther = SelectItem("other", "Other")
callDurationField = FormControl("Duration (minutes)", callDurationInput)
callDurationInput = Input("duration", "30", "number", null, null)
callOutcomeField = FormControl("Outcome", callOutcomeSelect)
callOutcomeSelect = Select("outcome", [outcomePositive, outcomeNeutral, outcomeNegative, outcomeScheduled], "Select outcome")
outcomePositive = SelectItem("positive", "Positive - Moved forward")
outcomeNeutral = SelectItem("neutral", "Neutral - No change")
outcomeNegative = SelectItem("negative", "Negative - Blocked / At risk")
outcomeScheduled = SelectItem("scheduled", "Follow-up scheduled")
callNotesField = FormControl("Call Notes", callNotesInput, "Key discussion points, decisions, next steps")
callNotesInput = TextArea("call_notes", "Summarize the call...", 4, null, null)
callButtons = Buttons([logCallBtn, cancelCallBtn], "row")
logCallBtn = Button("Log Call", null, "primary")
cancelCallBtn = Button("Cancel", null, "tertiary")