root = Card([header, hubSelector, kpiRow, alertsSection, flightsTable, delayedSection, gateChangesSection, crewSection, connectionsSection, weatherSection, rebookSection], "card", "column", "l")
header = CardHeader("Hub Operations Desk", "ORD — Chicago O'Hare — Live Operations")
hubSelector = Select("hub_select", [hubOrd, hubJfk, hubLax, hubAtl, hubDfw], "Select hub", null, null, "medium")
hubOrd = SelectItem("ORD", "ORD — Chicago O'Hare")
hubJfk = SelectItem("JFK", "JFK — New York Kennedy")
hubLax = SelectItem("LAX", "LAX — Los Angeles")
hubAtl = SelectItem("ATL", "ATL — Atlanta Hartsfield")
hubDfw = SelectItem("DFW", "DFW — Dallas Fort Worth")
kpiRow = Card([otpCard, paxLoadCard, turnaroundCard, cancellationsCard], "clear", "row", "m", "stretch", "between", true)
otpCard = Card([otpLabel, otpValue], "sunk", "column", "xs", "center")
otpLabel = TextContent("On-Time Performance", "small")
otpValue = TextContent("78%", "large-heavy")
paxLoadCard = Card([paxLabel, paxValue], "sunk", "column", "xs", "center")
paxLabel = TextContent("Avg Passenger Load", "small")
paxValue = TextContent("84%", "large-heavy")
turnaroundCard = Card([turnLabel, turnValue], "sunk", "column", "xs", "center")
turnLabel = TextContent("Avg Turnaround", "small")
turnValue = TextContent("42 min", "large-heavy")
cancellationsCard = Card([cancelLabel, cancelValue], "sunk", "column", "xs", "center")
cancelLabel = TextContent("Cancellations Today", "small")
cancelValue = TextContent("6", "large-heavy")
alertsSection = Card([alertsHeader, delayedAlert, connectionAlert], "card", "column", "m")
alertsHeader = Heading("Active Alerts", "h3")
delayedAlert = Callout("warning", "12 Flights Delayed", "Average delay: 38 min. 3 aircraft awaiting gates.")
connectionAlert = Callout("error", "24 Connections at Risk", "Next 90 min: 24 passengers with <30 min connection windows.")
flightsTable = Card([flightsHeader, flightsTableComp], "card", "column", "m")
flightsHeader = Heading("All Flights — Next 4 Hours", "h3")
flightsTableComp = Table([colFlight, colRoute, colGate, colStatus, colDepTime, colArrTime])
colFlight = Col("Flight", ["UA1234", "UA567", "UA8901", "UA246", "UA1357", "UA9753", "UA8642", "UA1111"])
colRoute = Col("Route", ["ORD→LAX", "ORD→JFK", "ORD→SFO", "ORD→ATL", "ORD→DEN", "ORD→SEA", "ORD→MIA", "ORD→BOS"])
colGate = Col("Gate", ["B12", "C8", "B24", "C15", "B6", "C22", "B18", "C3"])
colStatus = Col("Status", ["On Time", "Delayed", "On Time", "Gate Change", "On Time", "Delayed", "On Time", "Cancelled"])
colDepTime = Col("STD", ["08:15", "08:30", "08:45", "09:00", "09:15", "09:30", "09:45", "10:00"])
colArrTime = Col("STA", ["10:45", "11:15", "11:30", "10:40", "10:55", "11:50", "12:20", "12:45"])
delayedSection = Card([delayedHeader, delayedList], "card", "column", "m")
delayedHeader = Heading("Delayed Flights — Detail", "h3")
delayedList = ListBlock([delayed1, delayed2], "number")
delayed1 = ListItem("UA567 — ORD→JFK", "Gate C8 • Delayed 45 min • Weather at JFK • New ETD 09:15", null, "Rebook")
delayed2 = ListItem("UA9753 — ORD→SEA", "Gate C22 • Delayed 30 min • ATC hold • New ETD 10:00", null, "Rebook")
gateChangesSection = Card([gateHeader, gateList], "card", "column", "m")
gateHeader = Heading("Recent Gate Changes", "h3")
gateList = ListBlock([gate1, gate2, gate3], "number")
gate1 = ListItem("UA246 — ORD→ATL", "C15 → C18 • 07:42 • Aircraft swap", null, null)
gate2 = ListItem("UA1111 — ORD→BOS", "C3 → C5 • 07:55 • Gate conflict", null, null)
gate3 = ListItem("UA8642 — ORD→MIA", "B18 → B20 • 08:10 • Maintenance", null, null)
crewSection = Card([crewHeader, crewTable], "card", "column", "m")
crewHeader = Heading("Crews Available for Reassignment", "h3")
crewTable = Table([colCrewId, colCrewBase, colCrewQual, colCrewStatus, colCrewHours])
colCrewId = Col("Crew ID", ["CRW-4421", "CRW-4435", "CRW-4450", "CRW-4462"])
colCrewBase = Col("Base", ["ORD", "ORD", "ORD", "ORD"])
colCrewQual = Col("Qualified", ["737/320", "737/320/777", "737", "320/321"])
colCrewStatus = Col("Status", ["Standby", "Standby", "Off-duty (recallable)", "Standby"])
colCrewHours = Col("Hours Avail", ["10.5", "8.0", "12.0", "9.5"])
connectionsSection = Card([connHeader, connList], "card", "column", "m")
connHeader = Heading("Connections at Risk — Next 90 Min", "h3")
connList = ListBlock([conn1, conn2, conn3, conn4], "number")
conn1 = ListItem("UA567 → UA221 (JFK→LAX)", "3 passengers • 22 min connection • UA221 dep 11:37", null, "Protect")
conn2 = ListItem("UA9753 → UA444 (SEA→ANC)", "2 passengers • 18 min connection • UA444 dep 12:08", null, "Protect")
conn3 = ListItem("UA1357 → UA777 (DEN→PHX)", "1 passenger • 25 min connection • UA777 dep 11:20", null, "Protect")
conn4 = ListItem("UA8901 → UA888 (SFO→HNL)", "4 passengers • 28 min connection • UA888 dep 12:15", null, "Protect")
weatherSection = Card([weatherHeader, weatherAdvisory], "card", "column", "m")
weatherHeader = Heading("Weather Advisories — ORD", "h3")
weatherAdvisory = Callout("info", "Low Ceiling / Visibility", "Ceiling 800 ft, visibility 2.5 SM. Winds 280@15G22 kt. Expect arrival delays 30-45 min. Improving after 14Z.")
rebookSection = Card([rebookHeader, rebookForm], "card", "column", "m")
rebookHeader = Heading("Rebook Affected Passengers", "h3")
rebookForm = Form("rebook", rebookButtons, [rebookFlight, rebookPax, rebookNewFlight])
rebookFlight = FormControl("Affected Flight", rebookFlightSelect, "Select the delayed/cancelled flight")
rebookFlightSelect = Select("affected_flight", [rebookF1, rebookF2, rebookF3], "Choose flight")
rebookF1 = SelectItem("UA567", "UA567 — ORD→JFK (Delayed 45 min)")
rebookF2 = SelectItem("UA9753", "UA9753 — ORD→SEA (Delayed 30 min)")
rebookF3 = SelectItem("UA1111", "UA1111 — ORD→BOS (Cancelled)")
rebookPax = FormControl("Passengers", rebookPaxInput, "Number of passengers to rebook")
rebookPaxInput = Input("pax_count", "3", "number")
rebookNewFlight = FormControl("Alternate Flight", rebookAltSelect, "Select next available option")
rebookAltSelect = Select("alt_flight", [alt1, alt2, alt3], "Choose alternate")
alt1 = SelectItem("UA569", "UA569 — ORD→JFK dep 09:45 (737-800, 12 seats)")
alt2 = SelectItem("UA571", "UA571 — ORD→JFK dep 10:30 (A320, 8 seats)")
alt3 = SelectItem("UA573", "UA573 — ORD→JFK dep 11:15 (737-900, 15 seats)")
rebookButtons = Buttons([rebookSubmit, rebookCancel], "row")
rebookSubmit = Button("Confirm Rebooking", null, "primary")
rebookCancel = Button("Cancel", null, "tertiary")