root = Card([header, zoneSection, severitySection, resourcesSection, sheltersSection, routesSection, weatherSection, impactSection, volunteersSection, donationsSection, requestsSection, commsSection, roadsSection, hospitalsSection, tasksSection, actionsSection, requestForm, broadcastForm, focusForm, sitrepForm])

header = CardHeader("Emergency Response Coordination Center", "Live status — updated 14:32 UTC")

zoneSection = Card([zoneHeading, zoneTable], "sunk")
zoneHeading = Heading("Active Incidents by Zone", "h2")
zoneTable = Table([zoneCol, severityCol, incidentCol])
zoneCol = Col("Zone", ["North District", "East Harbor", "West Ridge", "South Valley", "Central City"])
severityCol = Col("Severity", ["Critical", "High", "Moderate", "Critical", "Low"])
incidentCol = Col("Incident", ["Flooding", "Fire", "Landslide", "Structural Collapse", "Power Outage"])

severitySection = Card([severityHeading, severityChart], "sunk")
severityHeading = Heading("Overall Severity Summary", "h3")
severityChart = SingleStackedBarChart(["Critical", "High", "Moderate", "Low"], [2, 1, 1, 1])

resourcesSection = Card([resourcesHeading, resourcesTable], "sunk")
resourcesHeading = Heading("Available Resources", "h3")
resourcesTable = Table([resTypeCol, resCountCol])
resTypeCol = Col("Resource", ["Vehicles", "Personnel", "Supplies (pallets)"])
resCountCol = Col("Available", [34, 156, 212])

sheltersSection = Card([sheltersHeading, sheltersTable], "sunk")
sheltersHeading = Heading("Shelters — Capacity & Occupancy", "h3")
sheltersTable = Table([shelterNameCol, capacityCol, occupancyCol, shelterStatusCol])
shelterNameCol = Col("Shelter", ["North High School", "East Community Hall", "West Arena", "South Civic Center"])
capacityCol = Col("Capacity", [500, 300, 800, 450])
occupancyCol = Col("Occupancy", [412, 289, 620, 118])
shelterStatusCol = Col("Status", ["Open", "Open", "Near Full", "Open"])

routesSection = Card([routesHeading, routesTable], "sunk")
routesHeading = Heading("Evacuation Routes", "h3")
routesTable = Table([routeCol, routeStatusCol])
routeCol = Col("Route", ["Route 1 — North", "Route 2 — East", "Route 3 — West", "Route 4 — South"])
routeStatusCol = Col("Status", ["Open", "Congested", "Closed", "Open"])

weatherSection = Card([weatherHeading, weatherChart], "sunk")
weatherHeading = Heading("Weather Forecast — Next 48 Hours", "h3")
weatherChart = LineChart(["Now", "+6h", "+12h", "+18h", "+24h", "+30h", "+36h", "+42h", "+48h"], [tempSeries, precipSeries], "linear", "Time", "°C / mm")
tempSeries = Series("Temp (°C)", [18, 17, 16, 15, 14, 13, 12, 12, 11])
precipSeries = Series("Precip (mm)", [2, 5, 8, 12, 15, 18, 22, 20, 16])

impactSection = Card([impactHeading, impactChart], "sunk")
impactHeading = Heading("Rescued & Casualties", "h3")
impactChart = BarChart(["Rescued", "Injured", "Fatalities"], [impactSeries])
impactSeries = Series("Count", [1284, 96, 14])

volunteersSection = Card([volunteersHeading, volunteersTable], "sunk")
volunteersHeading = Heading("Volunteers on Duty", "h3")
volunteersTable = Table([volNameCol, volRoleCol, volAssignCol])
volNameCol = Col("Name", ["M. Alvarez", "J. Chen", "S. Patel", "L. Nguyen", "R. Garcia"])
volRoleCol = Col("Role", ["EMT", "Logistics", "Communications", "Medical", "Search & Rescue"])
volAssignCol = Col("Assignment", ["North District", "East Harbor", "Central City", "South Valley", "West Ridge"])

donationsSection = Card([donationsHeading, donationsTable], "sunk")
donationsHeading = Heading("Donations Received", "h3")
donationsTable = Table([donTypeCol, donAmountCol])
donTypeCol = Col("Type", ["Cash", "Food", "Clothing", "Medical Supplies", "Water"])
donAmountCol = Col("Amount", ["$82,400", "1,200 kg", "3,500 items", "48 pallets", "15,000 L"])

requestsSection = Card([requestsHeading, requestsTable], "sunk")
requestsHeading = Heading("Aid Requests Awaiting Action", "h3")
requestsTable = Table([reqIdCol, reqZoneCol, reqNeedCol, reqPriorityCol])
reqIdCol = Col("ID", ["AR-101", "AR-102", "AR-103", "AR-104"])
reqZoneCol = Col("Zone", ["North District", "South Valley", "East Harbor", "West Ridge"])
reqNeedCol = Col("Need", ["Water", "Medical teams", "Boats", "Generators"])
reqPriorityCol = Col("Priority", ["Critical", "High", "High", "Medium"])

commsSection = Card([commsHeading, commsTable], "sunk")
commsHeading = Heading("Communication Channels", "h3")
commsTable = Table([chanCol, chanStatusCol])
chanCol = Col("Channel", ["Radio", "Satellite Phone", "Cellular", "Data Link", "Public Alert"])
chanStatusCol = Col("Status", ["Up", "Up", "Down", "Up", "Up"])

roadsSection = Card([roadsHeading, roadsTable], "sunk")
roadsHeading = Heading("Closed Roads", "h3")
roadsTable = Table([roadCol, roadReasonCol])
roadCol = Col("Road", ["Hwy 12", "Bridge 5", "Cedar Ave", "Ridge Rd"])
roadReasonCol = Col("Reason", ["Flooding", "Structural Damage", "Debris", "Landslide"])

hospitalsSection = Card([hospitalsHeading, hospitalsTable], "sunk")
hospitalsHeading = Heading("Nearby Hospitals — Free Beds", "h3")
hospitalsTable = Table([hospCol, freeBedsCol, hospStatusCol])
hospCol = Col("Hospital", ["St. Mary's", "County General", "Mercy East", "Valley Health"])
freeBedsCol = Col("Free Beds", [24, 12, 38, 9])
hospStatusCol = Col("Status", ["Accepting", "Critical", "Accepting", "Full"])

tasksSection = Card([tasksHeading, tasksTable], "sunk")
tasksHeading = Heading("Open Tasks", "h3")
tasksTable = Table([taskCol, assigneeCol, taskStatusCol])
taskCol = Col("Task", ["Deliver water to North", "Evacuate East Harbor", "Set up triage at South", "Repair data link"])
assigneeCol = Col("Assignee", ["J. Chen", "M. Alvarez", "R. Garcia", "S. Patel"])
taskStatusCol = Col("Status", ["In Progress", "Pending", "In Progress", "Pending"])

actionsSection = Card([actionsHeading, actionButtons], "sunk")
actionsHeading = Heading("Quick Actions", "h3")
actionButtons = Buttons([focusBtn, sitrepBtn])
focusBtn = Button("Focus on a Zone", null, "primary")
sitrepBtn = Button("File Situation Report", null, "secondary")

requestFormSection = Card([requestFormHeading, requestForm], "sunk")
requestFormHeading = Heading("Request More Resources", "h3")
requestForm = Form("resource-request", requestButtons, [reqTypeField, reqQtyField, reqZoneField])
reqTypeField = FormControl("Resource Type", reqTypeSelect)
reqTypeSelect = Select("resource_type", [reqWater, reqMedical, reqVehicles, reqFood], "Select type")
reqWater = SelectItem("water", "Water")
reqMedical = SelectItem("medical", "Medical Supplies")
reqVehicles = SelectItem("vehicles", "Vehicles")
reqFood = SelectItem("food", "Food")
reqQtyField = FormControl("Quantity", reqQtyInput)
reqQtyInput = Input("quantity", "e.g. 500", "number")
reqZoneField = FormControl("Zone", reqZoneSelect)
reqZoneSelect = Select("zone", [zoneNorth, zoneEast, zoneWest, zoneSouth, zoneCentral], "Select zone")
zoneNorth = SelectItem("north", "North District")
zoneEast = SelectItem("east", "East Harbor")
zoneWest = SelectItem("west", "West Ridge")
zoneSouth = SelectItem("south", "South Valley")
zoneCentral = SelectItem("central", "Central City")
requestButtons = Buttons([submitRequestBtn])
submitRequestBtn = Button("Submit Request", null, "primary")

broadcastSection = Card([broadcastHeading, broadcastForm], "sunk")
broadcastHeading = Heading("Broadcast Update", "h3")
broadcastForm = Form("broadcast", broadcastButtons, [broadcastMsgField])
broadcastMsgField = FormControl("Message", broadcastMsgInput, "This will be sent to all channels")
broadcastMsgInput = TextArea("message", "Type the public update message...", 4)
broadcastButtons = Buttons([broadcastBtn])
broadcastBtn = Button("Broadcast", null, "primary")

focusSection = Card([focusHeading, focusForm], "sunk")
focusHeading = Heading("Focus on One Zone", "h3")
focusForm = Form("focus", focusButtons, [focusZoneField])
focusZoneField = FormControl("Zone", focusZoneSelect)
focusZoneSelect = Select("focus_zone", [focusNorth, focusEast, focusWest, focusSouth, focusCentral], "Select zone")
focusNorth = SelectItem("north", "North District")
focusEast = SelectItem("east", "East Harbor")
focusWest = SelectItem("west", "West Ridge")
focusSouth = SelectItem("south", "South Valley")
focusCentral = SelectItem("central", "Central City")
focusButtons = Buttons([focusSubmitBtn])
focusSubmitBtn = Button("Focus", null, "primary")

sitrepSection = Card([sitrepHeading, sitrepForm], "sunk")
sitrepHeading = Heading("File Situation Report", "h3")
sitrepForm = Form("sitrep", sitrepButtons, [sitrepZoneField, sitrepStatusField, sitrepNotesField])
sitrepZoneField = FormControl("Zone", sitrepZoneSelect)
sitrepZoneSelect = Select("sitrep_zone", [sitrepNorth, sitrepEast, sitrepWest, sitrepSouth, sitrepCentral], "Select zone")
sitrepNorth = SelectItem("north", "North District")
sitrepEast = SelectItem("east", "East Harbor")
sitrepWest = SelectItem("west", "West Ridge")
sitrepSouth = SelectItem("south", "South Valley")
sitrepCentral = SelectItem("central", "Central City")
sitrepStatusField = FormControl("Status", sitrepStatusSelect)
sitrepStatusSelect = Select("sitrep_status", [sitrepStable, sitrepDeteriorating, sitrepImproving], "Select status")
sitrepStable = SelectItem("stable", "Stable")
sitrepDeteriorating = SelectItem("deteriorating", "Deteriorating")
sitrepImproving = SelectItem("improving", "Improving")
sitrepNotesField = FormControl("Notes", sitrepNotesInput)
sitrepNotesInput = TextArea("notes", "Brief summary of the situation...", 4)
sitrepButtons = Buttons([sitrepSubmitBtn])
sitrepSubmitBtn = Button("File Report", null, "primary")