root = Card([hubSelector, header, metricsRow, flightsSection, delayedCallout, gateChangesSection, crewsSection, weatherSection, connectionsSection, rebookSection], "card", "column", "l")
hubSelector = Card([hubLabel, hubSelect], "clear", "row", "m", "center", "between")
hubLabel = TextContent("Select Hub:", "small-heavy")
hubSelect = Select("hub", [hubORD, hubATL, hubLAX, hubDFW, hubDEN], "Choose hub", null, "medium")
hubORD = SelectItem("ORD", "Chicago O'Hare (ORD)")
hubATL = SelectItem("ATL", "Atlanta (ATL)")
hubLAX = SelectItem("LAX", "Los Angeles (LAX)")
hubDFW = SelectItem("DFW", "Dallas/Fort Worth (DFW)")
hubDEN = SelectItem("DEN", "Denver (DEN)")
header = CardHeader("Hub Operations Desk — ORD", "Real-time operations snapshot • Updated 14:32 CDT")
metricsRow = Card([otpMetric, loadMetric, turnaroundMetric, cancellationsMetric], "clear", "row", "m", "stretch", "between")
otpMetric = Card([otpLabel, otpValue, otpBar], "sunk", "column", "s")
otpLabel = TextContent("On-Time Performance", "small-heavy")
otpValue = TextContent("78%", "large-heavy")
otpBar = Progress(78, "Target: 85%")
loadMetric = Card([loadLabel, loadValue, loadBar], "sunk", "column", "s")
loadLabel = TextContent("Avg Passenger Load", "small-heavy")
loadValue = TextContent("84%", "large-heavy")
loadBar = Progress(84, "Capacity utilization")
turnaroundMetric = Card([turnLabel, turnValue], "sunk", "column", "s")
turnLabel = TextContent("Avg Turnaround Time", "small-heavy")
turnValue = TextContent("42 min", "large-heavy")
cancellationsMetric = Card([cancelLabel, cancelValue, cancelAlert], "sunk", "column", "s")
cancelLabel = TextContent("Cancellations Today", "small-heavy")
cancelValue = TextContent("6", "large-heavy")
cancelAlert = Alert("6 cancellations", "3 weather-related, 2 crew, 1 mechanical", "warning")
flightsSection = Card([flightsHeader, flightsTable], "card", "column", "m")
flightsHeader = Heading("Active Flights", "h3")
flightsTable = Table([colNum, colRoute, colGate, colStatus, colDept, colArr])
colNum = Col("Flight", ["UA 245", "UA 1182", "UA 567", "UA 890", "UA 334", "UA 712", "UA 156", "UA 2023", "UA 445", "UA 901"])
colRoute = Col("Route", ["ORD→LAX", "ORD→JFK", "ORD→SFO", "ORD→MIA", "ORD→SEA", "ORD→BOS", "ORD→DEN", "ORD→LAS", "ORD→PHX", "ORD→ATL"])
colGate = Col("Gate", ["B12", "C24", "B8", "C31", "B19", "C14", "B22", "C27", "B15", "C18"])
colStatus = Col("Status", ["On Time", "Delayed", "On Time", "Delayed", "On Time", "Boarding", "On Time", "Delayed", "On Time", "On Time"])
colDept = Col("Departure", ["14:45", "15:10", "15:25", "15:40", "16:00", "16:15", "16:30", "16:45", "17:00", "17:15"])
colArr = Col("Arrival", ["16:58", "18:22", "17:40", "18:55", "18:10", "19:30", "18:15", "18:35", "19:45", "20:28"])
delayedCallout = Callout("warning", "Delayed Flights Requiring Attention", "3 flights delayed: UA 1182 (45 min, crew), UA 890 (30 min, weather), UA 2023 (25 min, ATC). 2 connections at risk.")
gateChangesSection = Card([gateHeader, gateList], "card", "column", "m")
gateHeader = Heading("Recent Gate Changes (Last 60 min)", "h3")
gateList = ListBlock([gate1, gate2, gate3, gate4], "number")
gate1 = ListItem("UA 1182 — ORD→JFK", "Gate C24 → C28 • 14:15 • Reason: Congestion", null, "View")
gate2 = ListItem("UA 890 — ORD→MIA", "Gate C31 → C33 • 13:58 • Reason: Aircraft swap", null, "View")
gate3 = ListItem("UA 2023 — ORD→LAS", "Gate C27 → C29 • 13:42 • Reason: Maintenance", null, "View")
gate4 = ListItem("UA 445 — ORD→PHX", "Gate B15 → B17 • 13:20 • Reason: Gate conflict", null, "View")
crewsSection = Card([crewsHeader, crewsTable], "card", "column", "m")
crewsHeader = Heading("Crews Available for Reassignment", "h3")
crewsTable = Table([crewName, crewRole, crewQual, crewAvail, crewHours])
crewName = Col("Crew Member", ["J. Martinez", "S. Chen", "R. Thompson", "A. Patel", "M. Kowalski"])
crewRole = Col("Role", ["Captain", "First Officer", "Captain", "First Officer", "Purser"])
crewQual = Col("Qualified", ["B737, B777", "B737, A320", "B777, B787", "B737, B757", "All narrow-body"])
crewAvail = Col("Available In", ["Now", "15 min", "30 min", "Now", "45 min"])
crewHours = Col("Duty Remaining", ["8:45", "7:30", "9:15", "6:20", "10:00"])
weatherSection = Card([weatherHeader, weatherCallout], "card", "column", "m")
weatherHeader = Heading("Weather Advisories — ORD", "h3")
weatherCallout = Callout("warning", "Convective SIGMET Active", "Thunderstorms moving NE across airfield 14:00-16:00 CDT. Expect 20-30 min departure delays. Wind 280@18G28kt. Ceiling 2500 OVC. Monitor for ground stops.")
connectionsSection = Card([connHeader, connTable], "card", "column", "m")
connHeader = Heading("Connections at Risk (>15 min buffer)", "h3")
connTable = Table([connFlight, connInbound, connOutbound, connBuffer, connPax, connAction])
connFlight = Col("Connecting Flight", ["UA 1182→UA 445", "UA 890→UA 2023"])
connInbound = Col("Inbound", ["UA 1182 (ORD→JFK)", "UA 890 (ORD→MIA)"])
connOutbound = Col("Outbound", ["UA 445 (JFK→PHX)", "UA 2023 (MIA→LAS)"])
connBuffer = Col("Buffer", ["8 min", "12 min"])
connPax = Col("Passengers", ["12", "7"])
connAction = Col("Action", ["Rebook", "Rebook"])
rebookSection = Card([rebookHeader, rebookForm], "card", "column", "m")
rebookHeader = Heading("Rebook Affected Passengers", "h3")
rebookForm = Form("rebook", rebookButtons, [rebookFlight, rebookPax, rebookOption, rebookNotes])
rebookFlight = FormControl("Flight", rebookFlightSelect, "Select delayed/cancelled flight")
rebookFlightSelect = Select("flight", [rebookF1, rebookF2, rebookF3, rebookF4], "Choose flight", null, "medium")
rebookF1 = SelectItem("UA1182", "UA 1182 — ORD→JFK (Delayed 45 min)")
rebookF2 = SelectItem("UA890", "UA 890 — ORD→MIA (Delayed 30 min)")
rebookF3 = SelectItem("UA2023", "UA 2023 — ORD→LAS (Delayed 25 min)")
rebookF4 = SelectItem("UA567", "UA 567 — ORD→SFO (Cancelled)")
rebookPax = FormControl("Passengers", rebookPaxInput, "Number of passengers to rebook")
rebookPaxInput = Input("pax_count", "1", "number")
rebookOption = FormControl("Rebook Option", rebookOptionSelect, "Automatic finds next available")
rebookOptionSelect = Select("option", [optNext, optSameDay, optNextDay, optManual], "Choose rebook strategy", null, "medium")
optNext = SelectItem("next_avail", "Next available flight (any carrier)")
optSameDay = SelectItem("same_day", "Same day on United only")
optNextDay = SelectItem("next_day", "Next morning departure")
optManual = SelectItem("manual", "Manual selection")
rebookNotes = FormControl("Notes", rebookNotesArea, "Special instructions, hotel/meal vouchers, etc.")
rebookNotesArea = TextArea("notes", "Enter notes...", 3)
rebookButtons = Buttons([rebookSubmit, rebookCancel], "row")
rebookSubmit = Button("Process Rebook", null, "primary")
rebookCancel = Button("Cancel", null, "tertiary")