xaml/VCFRecoveryCoordinatorUI.xaml

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="VMware Cloud Foundation Recovery Coordinator" Height="820" Width="1100" WindowState="Maximized">
    <!--
        Loaded via XamlReader.Load from VCFRecoveryCoordinatorUI.ps1 (launched, as its own
        detached process, by Start-VCFRecoveryCoordinator in the module's .psm1).
        There is no code-behind class, so this file deliberately has no x:Class, no inline event
        handler attributes (Click=/SelectionChanged=), and no data-binding markup on the list
        boxes. All wiring and list population happens imperatively in the PowerShell loader script.
 
        Visual language is modeled on VMware's Clarity design system (as seen in vSphere Client):
        dark header bar, light gray canvas, plain white cards with a bold title (no separate header
        strip), flat underline tabs. This is a visual approximation, not certified brand colors.
    -->
    <Window.Resources>
        <SolidColorBrush x:Key="HeaderBarBrush" Color="#1D2731" />
        <SolidColorBrush x:Key="AccentBrush" Color="#0095D3" />
        <SolidColorBrush x:Key="AccentHoverBrush" Color="#0077AA" />
        <SolidColorBrush x:Key="PanelBackgroundBrush" Color="#FFFFFF" />
        <SolidColorBrush x:Key="WindowBackgroundBrush" Color="#F5F5F5" />
        <SolidColorBrush x:Key="PanelBorderBrush" Color="#E0E0E0" />
        <SolidColorBrush x:Key="HeaderTextBrush" Color="#22313F" />
        <SolidColorBrush x:Key="SubtleTextBrush" Color="#6B7280" />
        <SolidColorBrush x:Key="InactiveTabTextBrush" Color="#565656" />
        <SolidColorBrush x:Key="HoverBackgroundBrush" Color="#EAF6FC" />
        <SolidColorBrush x:Key="ToggleOnBrush" Color="#43A047" />
        <SolidColorBrush x:Key="ToggleOffBrush" Color="#D3D3D3" />
 
        <Style TargetType="Window">
            <Setter Property="Background" Value="{StaticResource WindowBackgroundBrush}" />
            <Setter Property="FontFamily" Value="Segoe UI" />
            <Setter Property="FontSize" Value="13" />
        </Style>
 
        <Style TargetType="TextBlock">
            <Setter Property="Foreground" Value="{StaticResource HeaderTextBrush}" />
        </Style>
 
        <!-- Plain white card with a bold title directly on it (no separate header-bar strip),
             matching Clarity's dashboard card style (e.g. "Folder Details", "Usage" panels). -->
        <Style TargetType="GroupBox">
            <Setter Property="Padding" Value="10" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="GroupBox">
                        <Border Background="{StaticResource PanelBackgroundBrush}"
                                BorderBrush="{StaticResource PanelBorderBrush}"
                                BorderThickness="1"
                                CornerRadius="4"
                                SnapsToDevicePixels="True">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="*" />
                                </Grid.RowDefinitions>
                                <TextBlock Grid.Row="0"
                                           Text="{TemplateBinding Header}"
                                           Foreground="{StaticResource HeaderTextBrush}"
                                           FontWeight="Bold"
                                           FontSize="15"
                                           Margin="{TemplateBinding Padding}"
                                           Padding="0,0,0,8" />
                                <!-- Optional element shown at the right end of the title row, supplied through the
                                     GroupBox's Tag (null for every card that doesn't set one). Used by Recovery
                                     Tasks for its badge legend. Top margin 14 (the title's own 10px margin plus the ~4px between its text box and the top of its capitals) puts the top of the 22px legend level with the top of the title text. -->
                                <ContentPresenter Grid.Row="0" Content="{TemplateBinding Tag}" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,14,10,0" />
                                <ContentPresenter Grid.Row="1" Margin="{TemplateBinding Padding}" />
                            </Grid>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
 
        <Style TargetType="Button">
            <Setter Property="Background" Value="{StaticResource AccentBrush}" />
            <Setter Property="Foreground" Value="White" />
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="Padding" Value="10,5" />
            <Setter Property="Cursor" Value="Hand" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border x:Name="ButtonBorder" Background="{TemplateBinding Background}" CornerRadius="3">
                            <ContentPresenter Margin="{TemplateBinding Padding}" HorizontalAlignment="Center" VerticalAlignment="Center" />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="ButtonBorder" Property="Background" Value="{StaticResource AccentHoverBrush}" />
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="ButtonBorder" Property="Opacity" Value="0.5" />
                            </Trigger>
                            <!-- A step row's own Run button is disabled for the whole app while a Run All
                                 chain is in progress (see Set-AllStepButtonsEnabled), including rows that
                                 are already Running/Done/Failed/Skipped - those four states are real
                                 status indicators, not idle "can't click this" buttons, so they must stay
                                 full color even while disabled. Declared after the IsEnabled trigger above
                                 so they win over its dimming (later same-property setters take precedence);
                                 harmless for every other button in the app (Run All, Load Variables, etc.)
                                 since none of them ever show these exact Content values. -->
                            <Trigger Property="Content" Value="Running">
                                <Setter TargetName="ButtonBorder" Property="Opacity" Value="1" />
                            </Trigger>
                            <Trigger Property="Content" Value="Done">
                                <Setter TargetName="ButtonBorder" Property="Opacity" Value="1" />
                            </Trigger>
                            <Trigger Property="Content" Value="Failed">
                                <Setter TargetName="ButtonBorder" Property="Opacity" Value="1" />
                            </Trigger>
                            <Trigger Property="Content" Value="Skipped">
                                <Setter TargetName="ButtonBorder" Property="Opacity" Value="1" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
 
        <!-- iOS-style sliding switch (pill track + round knob) used for each Recovery Plan's
             on/off options, standing in for what used to be a row of CheckBoxes. The switch itself
             carries no text - Content is deliberately left unused by this template, since each
             usage pairs the ToggleButton with a separate sibling TextBlock label to its right (see
             the Recovery Plan header DockPanels). CheckBox IS a ToggleButton subclass, so every
             existing Add_Checked/Add_Unchecked/.IsChecked caller in the loader script keeps working
             unchanged against an actual ToggleButton. -->
        <Style x:Key="ToggleSwitchStyle" TargetType="ToggleButton">
            <Setter Property="Width" Value="30" />
            <Setter Property="Height" Value="16" />
            <Setter Property="Cursor" Value="Hand" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ToggleButton">
                        <Border x:Name="Track" Background="{StaticResource ToggleOffBrush}" CornerRadius="8">
                            <Ellipse x:Name="Knob" Width="12" Height="12" Fill="White" HorizontalAlignment="Left" Margin="2,0,0,0" />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsChecked" Value="True">
                                <Setter TargetName="Track" Property="Background" Value="{StaticResource ToggleOnBrush}" />
                                <Setter TargetName="Knob" Property="HorizontalAlignment" Value="Right" />
                                <Setter TargetName="Knob" Property="Margin" Value="0,0,2,0" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
 
        <Style TargetType="TextBox">
            <Setter Property="Padding" Value="6,4" />
            <Setter Property="BorderBrush" Value="{StaticResource PanelBorderBrush}" />
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="Background" Value="White" />
        </Style>
 
        <Style TargetType="PasswordBox">
            <Setter Property="Padding" Value="6,4" />
            <Setter Property="BorderBrush" Value="{StaticResource PanelBorderBrush}" />
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="Background" Value="White" />
        </Style>
 
        <!-- Left at its native ComboBox chrome (toggle button/popup arrow) - only Padding/
             BorderBrush/Background are overridden, to match TextBox/PasswordBox above, rather than
             a full ControlTemplate replacement like Button/GroupBox get. This is the first ComboBox
             in the app (Recovery Type/Recovery Plan/Data Source, added when those three were
             collapsed from stacks of RadioButtons into one "Recovery Parameters" card - see the
             .ps1's Sync-RecoveryPlanSelection), so a "visual approximation" is good enough here, the
             same standard this file's own header comment already sets for the app as a whole. -->
        <Style TargetType="ComboBox">
            <Setter Property="Padding" Value="6,4" />
            <Setter Property="BorderBrush" Value="{StaticResource PanelBorderBrush}" />
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="Background" Value="White" />
        </Style>
 
        <Style TargetType="ListBox">
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="Background" Value="Transparent" />
        </Style>
 
        <!-- Flat hover/selected highlight instead of the default gray selection box + dotted
             focus rectangle. -->
        <Style TargetType="ListBoxItem">
            <Setter Property="Padding" Value="3,1" />
            <Setter Property="HorizontalContentAlignment" Value="Stretch" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListBoxItem">
                        <!-- HorizontalAlignment must be bound explicitly here - a ContentPresenter
                             inside a fully custom template does NOT stretch to the item's available
                             width on its own just because HorizontalContentAlignment is set to
                             Stretch above; without this binding, each row's Grid (see New-StepRow)
                             sizes itself to its own natural/widest content instead of shrinking its
                             Star-width name column to fit, so in a narrow window the fixed-width Run
                             button column gets pushed off the right edge, with no horizontal
                             scrollbar on the ListBox to ever reach it. -->
                        <Border x:Name="ItemBorder" Background="Transparent" CornerRadius="3">
                            <ContentPresenter Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="ItemBorder" Property="Background" Value="{StaticResource HoverBackgroundBrush}" />
                            </Trigger>
                            <Trigger Property="IsSelected" Value="True">
                                <Setter TargetName="ItemBorder" Property="Background" Value="{StaticResource HoverBackgroundBrush}" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
 
        <!-- Radio buttons use the same green as an "on" toggle switch for the selected dot/ring
             (the stock template's dot is black). -->
        <Style TargetType="RadioButton">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="RadioButton">
                        <!-- DockPanel, not a horizontal StackPanel: a horizontal stack measures its content
                             with unlimited width, so a long label never wraps and gets clipped instead. -->
                        <DockPanel Background="Transparent">
                            <Grid DockPanel.Dock="Left" Width="16" Height="16" VerticalAlignment="Center">
                                <Ellipse x:Name="Ring" Stroke="{StaticResource ToggleOffBrush}" StrokeThickness="1.5" Fill="White" />
                                <Ellipse x:Name="Dot" Width="8" Height="8" Fill="{StaticResource ToggleOnBrush}" Visibility="Collapsed" />
                            </Grid>
                            <ContentPresenter Margin="8,0,0,0" VerticalAlignment="Center" RecognizesAccessKey="True" />
                        </DockPanel>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsChecked" Value="True">
                                <Setter TargetName="Dot" Property="Visibility" Value="Visible" />
                                <Setter TargetName="Ring" Property="Stroke" Value="{StaticResource ToggleOnBrush}" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
 
        <!-- Flat underline tabs, blue-when-active/gray-when-inactive text, matching the
             Summary/Monitor/Configure... tab strip style. -->
        <Style TargetType="TabItem">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="TabItem">
                        <Border x:Name="TabBorder" Background="Transparent" BorderBrush="{StaticResource AccentBrush}" BorderThickness="0,0,0,2" Margin="0,0,16,0">
                            <ContentPresenter x:Name="TabContent" ContentSource="Header" Margin="2,6,2,8" />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="True">
                                <Setter TargetName="TabContent" Property="TextElement.Foreground" Value="{StaticResource AccentBrush}" />
                                <Setter TargetName="TabContent" Property="TextElement.FontWeight" Value="SemiBold" />
                            </Trigger>
                            <Trigger Property="IsSelected" Value="False">
                                <Setter TargetName="TabBorder" Property="BorderThickness" Value="0" />
                                <Setter TargetName="TabContent" Property="TextElement.Foreground" Value="{StaticResource InactiveTabTextBrush}" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
 
        <!-- The VMware logo mark, reproduced as vector geometry rather than a bundled image file,
             since SVG path data and WPF's Geometry mini-language share the same command syntax
             (M/L/C/H/V/A/Z, same relative-vs-absolute case convention), so these two Data strings
             are the official mark's own path data, copied over unchanged. Used both for the small
             badge in the header below and, rendered to a bitmap in the .ps1, for the window/taskbar
             icon, so both places always match one shared definition. -->
        <DrawingImage x:Key="VmwLogoImage">
            <DrawingImage.Drawing>
                <DrawingGroup>
                    <GeometryDrawing Geometry="M938.667 1024H85.333C38.116 1024 0 985.884 0 938.667V85.333C0 38.116 38.116 0 85.333 0h853.334C985.884 0 1024 38.116 1024 85.333v853.334c0 47.217-38.116 85.333-85.333 85.333z">
                        <GeometryDrawing.Brush>
                            <LinearGradientBrush StartPoint="0.0244,0.9756" EndPoint="0.9756,0.0244">
                                <GradientStop Color="#005c8a" Offset="0" />
                                <GradientStop Color="#0098c7" Offset="1" />
                            </LinearGradientBrush>
                        </GeometryDrawing.Brush>
                    </GeometryDrawing>
                    <GeometryDrawing Brush="White" Geometry="m697.173 613.831-54.329-157.013c-1.137-3.698-2.844-9.956-2.844-15.36 0-14.507 11.662-28.73 30.435-28.73 15.645 0 26.17 9.957 30.72 24.463l34.134 112.925 34.987-112.64c4.55-15.076 16.213-25.316 32.426-25.316h3.698c16.213 0 27.875 10.524 32.427 25.315l35.27 112.925 34.987-113.778c4.267-13.369 13.654-24.178 30.436-24.178 17.351 0 29.582 13.37 29.582 29.014 0 4.266-1.138 9.955-1.991 12.8L910.222 613.83c-6.542 19.627-19.627 28.16-34.987 28.16h-1.99c-15.36 0-28.16-8.818-34.134-27.022L803.84 502.898 768 614.968c-5.69 18.205-18.773 27.023-34.134 27.023h-1.99c-15.076 0-28.16-8.818-34.703-28.16zM112.924 422.969c-7.11-15.929-25.03-23.04-41.813-15.644-16.782 7.395-22.755 25.884-15.36 41.813l69.973 152.178c11.094 23.893 22.756 36.408 44.374 36.408 23.324 0 33.564-13.653 44.373-36.408 0 0 61.156-133.12 61.724-134.543.57-1.422 2.56-5.689 8.818-5.689 5.405 0 9.671 4.267 9.671 9.956v130.276c0 19.91 11.094 36.409 32.427 36.409s32.996-16.498 32.996-36.41V494.934c0-20.48 14.79-33.848 34.702-33.848s33.28 13.653 33.28 33.848v106.383c0 19.91 11.093 36.409 32.426 36.409s32.996-16.498 32.996-36.41V494.934c0-20.48 14.791-33.848 34.702-33.848s33.28 13.653 33.28 33.848v106.383c0 19.91 11.093 36.409 32.427 36.409s32.995-16.498 32.995-36.41V480.143c0-44.657-35.84-75.662-78.79-75.662s-69.974 29.867-69.974 29.867c-14.222-18.489-34.133-29.867-67.413-29.867-35.272 0-66.276 29.867-66.276 29.867-14.507-18.489-38.684-29.867-58.88-29.867-31.289 0-56.036 13.653-71.111 48.356l-44.658 105.529-56.889-135.396" />
                </DrawingGroup>
            </DrawingImage.Drawing>
        </DrawingImage>
    </Window.Resources>
 
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
 
        <!-- Header bar, modeled on the vSphere Client dark top bar -->
        <Border Grid.Row="0" Background="{StaticResource HeaderBarBrush}" Padding="18,12">
            <DockPanel>
                <StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
                    <!-- Help: opens the shipped HTML user guide (help\VCF-RecoveryCoordinator-UserGuide.html) in
                         the default browser. Same size/grey as the User | Engineering links beside it, turning
                         white on hover (see the .ps1), so it reads as part of the same row of header links
                         rather than as another button. -->
                    <TextBlock x:Name="HelpLink" Text="Help" Foreground="#B9C2CC" FontSize="14" Cursor="Hand" VerticalAlignment="Center" Margin="0,0,20,0" ToolTip="Open the user guide in your web browser" />
                    <!-- User/Engineering mode switch: governs Advanced-tab visibility on every plan
                         and, only in Engineering mode, the Recovery Plan tab's pause-point drop-zone
                         (see Set-UIMode in the .ps1). Styled to match the header's own "Recovery
                         Coordinator" subtitle: same FontSize, same grey (#B9C2CC) for whichever side
                         is inactive; the active side uses AccentBrush, the app's "Clarity blue". -->
                    <StackPanel Orientation="Horizontal" Margin="0,0,16,0" VerticalAlignment="Center">
                        <TextBlock x:Name="UserModeLink" Text="User" Foreground="{StaticResource AccentBrush}" FontSize="14" Cursor="Hand" VerticalAlignment="Center" />
                        <TextBlock Text=" | " Foreground="#B9C2CC" FontSize="14" VerticalAlignment="Center" />
                        <TextBlock x:Name="EngineeringModeLink" Text="Engineering" Foreground="#B9C2CC" FontSize="14" Cursor="Hand" VerticalAlignment="Center" />
                    </StackPanel>
                    <Button x:Name="ResumeButton" Content="Resume" Width="90" Margin="0,0,8,0" />
                    <Button x:Name="ExitButton" Content="Save &amp; Exit" Width="90" />
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <Image Source="{StaticResource VmwLogoImage}" Width="34" Height="34" Margin="0,0,10,0" VerticalAlignment="Center" />
                    <StackPanel VerticalAlignment="Center">
                        <TextBlock Text="VMware Cloud Foundation" Foreground="White" FontSize="15" FontWeight="SemiBold" />
                        <TextBlock Text="Recovery Coordinator" Foreground="#B9C2CC" FontSize="14" />
                    </StackPanel>
                </StackPanel>
            </DockPanel>
        </Border>
 
        <!-- Update banner: hidden unless the check (see Show-ModuleUpdateStatus in the .ps1, run before
             this process ever started by Start-VCFRecoveryCoordinator) finds a newer module in the repository it was installed from.
             If several updates are pending, the chevrons page between them; X dismisses the one on show for
             this session only (it returns on the next launch while the update is still pending). -->
        <Border x:Name="UpdateBanner" Grid.Row="1" Background="#F57C00" Padding="18,8" Visibility="Collapsed">
            <DockPanel>
                <Button x:Name="UpdateBannerCloseButton" DockPanel.Dock="Right" Content="&#x2715;" Background="Transparent" Foreground="White" FontSize="14" Padding="6,0" ToolTip="Dismiss" VerticalAlignment="Center" />
                <StackPanel x:Name="UpdateBannerPager" DockPanel.Dock="Left" Orientation="Horizontal" Margin="0,0,14,0" VerticalAlignment="Center">
                    <Button x:Name="UpdateBannerPrevButton" Content="&#x2039;" Background="Transparent" Foreground="White" FontSize="20" FontWeight="Bold" Padding="6,0" />
                    <TextBlock x:Name="UpdateBannerCounter" Foreground="White" FontSize="12" VerticalAlignment="Center" Margin="4,0" />
                    <Button x:Name="UpdateBannerNextButton" Content="&#x203A;" Background="Transparent" Foreground="White" FontSize="20" FontWeight="Bold" Padding="6,0" />
                </StackPanel>
                <TextBlock x:Name="UpdateBannerText" Foreground="White" FontSize="14" FontWeight="SemiBold" VerticalAlignment="Center" TextWrapping="Wrap" />
            </DockPanel>
        </Border>
 
        <!-- Left rail (30%) and console (70%) are two independent columns, not one big stacked
             column including the console, specifically so the console's size never depends on how
             tall the left rail's panes get (that coupling used to push the console off the bottom
             of the window once Steps/Variables appeared). -->
        <Grid Grid.Row="2" Margin="14">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="3*" />
                <ColumnDefinition Width="12" />
                <ColumnDefinition Width="7*" />
            </Grid.ColumnDefinitions>
 
            <!--
                Data Source / Discovered Infrastructure / Recovery Tasks (Steps, Variables), stacked
                top to bottom. Recovery Tasks stays collapsed until a domain is picked (see the
                .ps1's domain SelectionChanged handler). Steps show only the cmdlet name; the full
                command line with its parameters lives in the plan file (see plans/{ibr,fdr}/*.json) and is
                never rendered here. Variable values come from a JSON answer file (flat
                {"variableName": "value", ...}) loaded via the button below; each entry is sent to
                the console as "$variableName = 'value'" immediately on load, so every step's Run
                button can just send its command line directly without per-step lookups.
            -->
            <!-- Wrapped in its own ScrollViewer, separate from the console column, so a short window
                 (a small screen, or a small RDP session, either is easy to end up with) still lets
                 every card scroll into view instead of Recovery Tasks' Steps just getting clipped off
                 the bottom with no way to reach them. The last row below is Auto, not the Star it
                 used to be, specifically so this ScrollViewer has something finite to measure and
                 scroll: a Star row only makes sense when something else (the window) is already
                 bounding it, which is exactly what no longer holds once this can scroll on its own. -->
            <ScrollViewer Grid.Column="0" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
 
                <!-- Recovery Type/Recovery Plan/Data Source used to be three separate cards, each
                     with its own stack of RadioButtons; collapsed into one card with three combo
                     boxes so a new plan can be added by editing plans/recovery-plan-catalog.json
                     alone, without touching this markup. Every item in all three combos (including
                     their BETA badges) is built in the .ps1 from that catalog file - see
                     New-RecoveryOptionComboBoxItem/Sync-RecoveryPlanSelection - so none of the
                     three ComboBoxes below carry any static Items here. -->
                <!-- Only a negative top margin on the content here, not the Console pane's extra
                     Padding-bottom-to-0 trick as well, since these are Auto-height cards stacked in
                     a scrolling list, where the card's own bottom padding is still doing real work
                     (breathing room before the next card), unlike Console, which fills all the
                     vertical space its column has. -->
                <GroupBox Grid.Row="0" Header="Recovery Parameters" Margin="0,0,0,12">
                    <StackPanel Margin="0,-8,0,0">
                        <TextBlock Text="Recovery Type" FontWeight="SemiBold" Margin="0,0,0,4" />
                        <ComboBox x:Name="RecoveryTypeComboBox" Margin="0,0,0,10" />
 
                        <TextBlock Text="Recovery Plan" FontWeight="SemiBold" Margin="0,0,0,4" />
                        <!-- Repopulated by RecoveryTypeComboBox's own SelectionChanged - its
                             Items are always just whichever plans the catalog lists under the
                             currently selected Recovery Type. -->
                        <ComboBox x:Name="RecoveryPlanComboBox" Margin="0,0,0,10" />
 
                        <!-- Collapsed entirely for a plan whose catalog entry permits no data
                             source at all (Recover Fleet, FDR's only plan) - see the "FDR should
                             not require a data source" requirement and Sync-RecoveryPlanSelection
                             in the .ps1, which is what actually toggles this. -->
                        <StackPanel x:Name="DataSourceRowPanel">
                            <TextBlock Text="Data Source" FontWeight="SemiBold" Margin="0,0,0,4" />
                            <ComboBox x:Name="DataSourceComboBox" Margin="0,0,0,6" />
                            <DockPanel Margin="0,4,0,0">
                                <Button x:Name="BrowseButton" Content="Browse..." Width="80" DockPanel.Dock="Right" />
                                <TextBox x:Name="FilePathTextBox" IsReadOnly="True" Margin="0,0,8,0" VerticalContentAlignment="Center" />
                            </DockPanel>
                        </StackPanel>
                    </StackPanel>
                </GroupBox>
 
                <!-- Split out of Data Source into its own card: this is what loading an
                     extracted-sddc-data.json actually reveals, not part of choosing where that
                     file comes from. Workload Domains and Additional Clusters share it as tabs
                     since both are just different views over the same loaded data. -->
                <!-- Collapsed until extracted-sddc-data is actually loaded (see
                     Import-ExtractedSddcDataFile in the .ps1); there's nothing meaningful to
                     show in either tab before then. -->
                <GroupBox x:Name="DiscoveredInfrastructureGroupBox" Grid.Row="1" Header="Discovered Infrastructure" Margin="0,0,0,12" Visibility="Collapsed">
                    <DockPanel Margin="0,-8,0,0">
                    <TextBlock DockPanel.Dock="Top" Text="Click on the element you wish to recover" FontWeight="Normal" Foreground="{StaticResource SubtleTextBrush}" Margin="0,0,0,8" />
                    <TabControl x:Name="DiscoveredInfrastructureTabControl" Background="Transparent" BorderThickness="0">
                        <!-- Column headers are static markup; the ListBox's own rows are built to
                             match, using the same SharedSizeGroup names, in the .ps1 (see
                             New-TableRow). Width="Auto" plus a shared group is what makes a
                             column hug its own content instead of stretching to fill the card,
                             which is what "tight" columns actually requires: Star widths always
                             fill 100% of the row regardless of their ratio, so no amount of
                             re-weighting alone would have tightened anything. IsSharedSizeScope
                             is set per tab, not on the whole TabControl, so the two tables' column
                             groups never influence each other. Virtualization is switched off on
                             the ListBox so every row (not just the currently-visible ones)
                             contributes to that measurement, since otherwise column widths could
                             visibly jump while scrolling.
 
                             The header Grid and the ListBox both sit inside one shared horizontal
                             ScrollViewer, rather than each scrolling independently, so a header
                             cell always stays lined up with its own column instead of staying put
                             while the rows underneath it scroll out from beneath it (which would
                             make the header meaningless the moment horizontal scrolling was ever
                             needed, e.g. once "Dependent On" made a row wider than the card).
                             HorizontalScrollBarVisibility="Disabled" on the ListBox itself is what
                             makes this work: Disabled (unlike the default Hidden) doesn't just hide
                             the bar, it stops the ListBox from constraining/clipping its content to
                             its own width at all, so its true, possibly-wider-than-the-card desired
                             width reaches the outer ScrollViewer for it to actually scroll against.
                             The outer ScrollViewer's own VerticalScrollBarVisibility is Disabled for
                             the same reason in the other axis: vertical scrolling of the rows stays
                             owned entirely by the ListBox's own MaxHeight+VerticalScrollBarVisibility
                             below, not duplicated by the outer ScrollViewer as well. -->
                        <TabItem x:Name="WorkloadDomainsTabItem" Header="Workload Domains">
                            <DockPanel Margin="0,8,0,0" Grid.IsSharedSizeScope="True">
                                <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled">
                                    <StackPanel>
                                        <Grid Margin="3,0,3,4">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="Auto" SharedSizeGroup="WorkloadDomainsCol0" />
                                                <ColumnDefinition Width="Auto" SharedSizeGroup="WorkloadDomainsCol1" />
                                            </Grid.ColumnDefinitions>
                                            <TextBlock Grid.Column="0" Text="Domain Name" FontWeight="Bold" Margin="0,0,10,0" />
                                            <TextBlock Grid.Column="1" Text="Domain Type" FontWeight="Bold" />
                                        </Grid>
                                        <ListBox x:Name="WorkloadDomainsListBox" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Disabled" VirtualizingPanel.IsVirtualizing="False" MaxHeight="160" />
                                    </StackPanel>
                                </ScrollViewer>
                            </DockPanel>
                        </TabItem>
                        <!-- Any cluster (in any workload domain) beyond a domain's own default
                             cluster (isDefault 'f' in the raw extracted data). These need the
                             same recovery attention as the default cluster but aren't covered by
                             the Recover Default Cluster plan, so surfacing them here is what tells
                             you whether there's extra work to plan for at all. -->
                        <TabItem x:Name="AdditionalClustersTabItem" Header="Additional Clusters">
                            <DockPanel Margin="0,8,0,0" Grid.IsSharedSizeScope="True">
                                <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled">
                                    <StackPanel>
                                        <Grid Margin="3,0,3,4">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="Auto" SharedSizeGroup="AdditionalClustersCol0" />
                                                <ColumnDefinition Width="Auto" SharedSizeGroup="AdditionalClustersCol1" />
                                                <ColumnDefinition Width="Auto" SharedSizeGroup="AdditionalClustersCol2" />
                                                <ColumnDefinition Width="Auto" SharedSizeGroup="AdditionalClustersCol3" />
                                                <ColumnDefinition Width="Auto" SharedSizeGroup="AdditionalClustersCol4" />
                                            </Grid.ColumnDefinitions>
                                            <TextBlock Grid.Column="0" Text="Cluster Name" FontWeight="Bold" Margin="0,0,10,0" />
                                            <TextBlock Grid.Column="1" Text="Domain" FontWeight="Bold" Margin="0,0,10,0" />
                                            <TextBlock Grid.Column="2" Text="Storage" FontWeight="Bold" Margin="0,0,10,0" />
                                            <TextBlock Grid.Column="3" Text="Stretched" FontWeight="Bold" Margin="0,0,10,0" />
                                            <!-- Comma-separated, in recovery order; see Get-ClusterDependencies in
                                                 the .ps1. Purely informational: nothing here feeds back into plan
                                                 conditions or Run All sequencing, it's a hint for whoever's deciding
                                                 what order to work through multiple additional clusters in by hand. -->
                                            <TextBlock Grid.Column="4" Text="Dependent On" FontWeight="Bold" />
                                        </Grid>
                                        <ListBox x:Name="AdditionalClustersListBox" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Disabled" VirtualizingPanel.IsVirtualizing="False" MaxHeight="160" />
                                    </StackPanel>
                                </ScrollViewer>
                            </DockPanel>
                        </TabItem>
                    </TabControl>
                    </DockPanel>
                </GroupBox>
 
                <!-- Steps and Variables share one card as tabs: each gets the whole remaining
                     pane's height instead of splitting it permanently, since you're typically
                     working in one or the other, not both at once. -->
                <!-- One single Steps/Variables pane for whichever plan is currently selected (see
                     plans/recovery-plan-catalog.json and the .ps1's Sync-RecoveryPlanSelection) -
                     every plan, regardless of id, is rendered through this exact same set of
                     controls. A plan that needs an extra plan-specific toggle (e.g. Fleet Component
                     Recovery's "Original VCF Installer Available") declares it in the catalog's
                     extraToggleDefinitions/extraToggles rather than getting its own hand-authored
                     control here - see ExtraTogglesPanel below and Update-ExtraTogglesPanel in the
                     .ps1. -->
                <GroupBox x:Name="StepsVariablesGroupBox" Grid.Row="2" Header="Recovery Tasks" Visibility="Collapsed">
                    <!-- Legend for the round badges on interactive step rows (see Set-InteractiveBadgeState in the
                         .ps1, which fills these two empty discs in with the same code the rows use, so they always match). -->
                    <GroupBox.Tag>
                        <StackPanel Orientation="Horizontal">
                            <Border x:Name="LegendRequiresInputBadge" Width="22" Height="22" CornerRadius="11" VerticalAlignment="Center" />
                            <TextBlock Text="Requires input" Foreground="Gray" FontSize="11" Margin="5,0,16,0" VerticalAlignment="Center" />
                            <Border x:Name="LegendAutoAnsweredBadge" Width="22" Height="22" CornerRadius="11" VerticalAlignment="Center" />
                            <TextBlock Text="Auto-answered" Foreground="Gray" FontSize="11" Margin="5,0,0,0" VerticalAlignment="Center" />
                        </StackPanel>
                    </GroupBox.Tag>
                    <TabControl x:Name="StepsVariablesTabControl" Background="Transparent" BorderThickness="0" Margin="0,-8,0,0">
                        <TabItem Header="Variables">
                            <DockPanel Margin="0,8,0,0">
                                <!-- New Variables File starts from the variables the currently-loaded
                                     plan's steps actually reference (see Get-ReferencedVariableNames), not a
                                     fixed template file, so it's always in sync with whatever's on the
                                     Steps tab right now, for any plan. It reuses this same panel/rows
                                     (New-VariableRow) to capture values, and saves to the chosen file
                                     automatically as each field loses focus, so there's no separate "Save"
                                     step to remember. -->
                                <StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="0,0,0,8">
                                    <Button x:Name="LoadVariablesButton" Content="Load Variables File" Margin="0,0,8,0" />
                                    <Button x:Name="NewVariablesFileButton" Content="New Variables File" />
                                </StackPanel>
                                <TextBlock x:Name="LoadedVariablesTextBlock" DockPanel.Dock="Top" Margin="0,0,0,8" TextWrapping="Wrap" Foreground="{StaticResource SubtleTextBrush}" Text="No variables loaded yet." />
                                <ScrollViewer VerticalScrollBarVisibility="Auto">
                                    <StackPanel x:Name="VariablesItemsPanel" />
                                </ScrollViewer>
                            </DockPanel>
                        </TabItem>
                        <TabItem Header="Recovery Plan">
                            <!-- READ-ONLY, Run-All-driven view of the exact same steps Advanced shows
                                 interactively: every row's button starts as a disabled, grey "Pending"
                                 placeholder (see New-StepRow's -ReadOnly variant) and is updated to
                                 Running/Done/Failed/Skipped by the very same Invoke-Step/Add-StepWatch
                                 code that drives Advanced's own buttons; both are just two Button
                                 references on one underlying row object (see New-StepRow's
                                 PlanButton/ManualButton), always kept in sync regardless of which tab
                                 (or Run All) actually triggered the change. -->
                            <DockPanel Margin="0,8,0,0">
                                <DockPanel DockPanel.Dock="Top" Margin="0,0,0,8">
                                    <Grid DockPanel.Dock="Top">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="Auto" />
                                            <ColumnDefinition x:Name="ExtraColumnDefinition" Width="Auto" />
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto" />
                                            <RowDefinition Height="Auto" />
                                        </Grid.RowDefinitions>
                                        <!-- Column widths: the Run Options column takes all the space when the plan has no
                                             radio group; when it has one, Update-ExtraTogglesPanel splits the width 50/50
                                             (ExtraColumnDefinition -> 1*) and every label wraps (DockPanel + TextWrapping),
                                             so nothing is clipped at any window width. -->
                                        <!-- Two matched, unframed column groups under small muted captions
                                             (same grey as an inactive tab). The left column is the same for
                                             every plan, so its caption is static; the right column and the
                                             divider are populated/shown by Update-ExtraTogglesPanel in the
                                             .ps1 from the plan's catalog "extraToggles"/"extraRadioGroups"
                                             and stay collapsed for a plan that declares none. -->
                                        <TextBlock Grid.Row="0" Grid.Column="0" Text="RUN OPTIONS" FontSize="11" FontWeight="SemiBold" Foreground="{StaticResource InactiveTabTextBrush}" Margin="0,0,0,6" />
                                        <StackPanel Grid.Row="1" Grid.Column="0">
                                            <DockPanel Margin="0,0,0,6">
                                                <ToggleButton x:Name="RunAllParallelCheckBox" DockPanel.Dock="Left" IsChecked="True" Style="{StaticResource ToggleSwitchStyle}" VerticalAlignment="Center" />
                                                <TextBlock Text="Run parallel tasks using multiple threads (numbered circles)" TextWrapping="Wrap" VerticalAlignment="Center" Margin="8,0,0,0" />
                                            </DockPanel>
                                            <DockPanel>
                                                <ToggleButton x:Name="RunAllAnswerFileCheckBox" DockPanel.Dock="Left" Style="{StaticResource ToggleSwitchStyle}" VerticalAlignment="Center" />
                                                <TextBlock Text="Use answer file for interactive tasks" TextWrapping="Wrap" VerticalAlignment="Center" Margin="8,0,0,0" />
                                            </DockPanel>
                                            <!-- Plan-specific toggles (catalog "extraToggles") are appended here by
                                                 Update-ExtraTogglesPanel, so they sit with the other Run Options. -->
                                            <StackPanel x:Name="ExtraRunOptionsPanel" />
                                        </StackPanel>
                                        <Border x:Name="ExtraTogglesDivider" Grid.Row="0" Grid.RowSpan="2" Grid.Column="1" Width="1" Background="{StaticResource PanelBorderBrush}" Margin="16,0,16,0" Visibility="Collapsed" />
                                        <TextBlock x:Name="ExtraTogglesHeader" Grid.Row="0" Grid.Column="2" FontSize="11" FontWeight="SemiBold" Foreground="{StaticResource InactiveTabTextBrush}" Margin="0,0,0,6" Visibility="Collapsed" />
                                        <StackPanel x:Name="ExtraTogglesPanel" Grid.Row="1" Grid.Column="2" VerticalAlignment="Top" />
                                    </Grid>
                                    <!-- "Task List" heading, the "Duration" column header and Run Plan share one row,
                                         below the toggle stack and above the ListBox: heading docked Left, the two
                                         docked Right, all VerticalAlignment="Center" so they line up with each other.
                                         Margin right=6 on Run Plan lines its right edge up with the right edge of every
                                         step row's own status button in the ListBox below. The 6px is the ListBox chrome
                                         the rows sit inside but this button does not: ListBox Padding (1) + ListBoxItem
                                         Padding (3, see the style above) + each row Grid's own Margin (2, set in
                                         New-StepRow). It holds whether or not the ListBox is showing a vertical
                                         scrollbar - the scrollbar narrows the header and the rows by the same amount.
                                         "Duration" is the same 80px width as the duration button under it, with the 8px
                                         gap New-StepRow leaves between the two buttons (6px status button margin + 2px
                                         duration column padding). The badge legend lives in the card's title row (see
                                         the Recovery Tasks GroupBox's Tag). -->
                                    <DockPanel DockPanel.Dock="Top" Margin="0,8,0,0" LastChildFill="False">
                                        <TextBlock x:Name="RecoveryTaskListHeader" Text="Task List" FontWeight="Bold" FontSize="14" DockPanel.Dock="Left" VerticalAlignment="Center" />
                                        <Button x:Name="RunAllButton" Content="Run Plan" Width="80" Margin="0,0,6,0" DockPanel.Dock="Right" VerticalAlignment="Center" />
                                        <TextBlock Text="Duration" Width="80" TextAlignment="Center" Foreground="Gray" FontSize="11" FontWeight="SemiBold" Margin="0,0,8,0" DockPanel.Dock="Right" VerticalAlignment="Center" />
                                    </DockPanel>
                                </DockPanel>
                                <ListBox x:Name="RecoveryPlanStepsListBox" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Disabled" VirtualizingPanel.IsVirtualizing="False" />
                            </DockPanel>
                        </TabItem>
                        <TabItem Header="Advanced">
                            <DockPanel Margin="0,8,0,0">
                                <Border DockPanel.Dock="Top" Background="#FFF3CD" BorderBrush="#E0A800" BorderThickness="1" CornerRadius="3" Padding="10,7" Margin="0,0,0,8">
                                    <TextBlock TextWrapping="Wrap" FontWeight="SemiBold" Foreground="#664D03" Text="FOR ADVANCED USE ONLY: Use only on advice from Broadcom Support. Running a step out of sequence may leave the environment in an inconsistent state." />
                                </Border>
                                <ListBox x:Name="RecoveryManualStepsListBox" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Disabled" VirtualizingPanel.IsVirtualizing="False" />
                            </DockPanel>
                        </TabItem>
                    </TabControl>
                </GroupBox>
 
            </Grid>
            </ScrollViewer>
 
            <!-- Console: one tab per real, separate pwsh.exe console window, each reparented into its
                 own Border (see ConsoleHwndHost/New-EmbeddedConsole in the .ps1) rather than rendered
                 by any control of ours. Nothing here draws a single character of any of them;
                 Windows' own console host does that, exactly as reliably as it always has, and we
                 only relocate each already-correct window to sit inside its own tab instead of
                 floating separately. Starts empty; the loader script adds the "Main" tab at startup
                 and further tabs on demand, one per background thread Run All spawns to run that
                 thread's own steps concurrently with everything else. -->
            <!-- Padding's bottom component trimmed to 0 (from the shared GroupBox style's default of
                 10 on every side) and a small negative top margin on the TabControl itself together
                 close up the header-to-content gap that's appropriate for a card full of prose or a
                 table, but reads as wasted space directly above a tab strip. Left/top/right padding
                 stays the shared 10 so this still lines up with every other panel around it. -->
            <Grid Grid.Column="2">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <GroupBox Grid.Row="0" Header="Console" Padding="10,10,10,0">
                    <Grid>
                        <!-- Shared by all three Steps panels' Run All buttons (Domain Recovery /
                             Additional Cluster Recovery / Recover Fleet) rather than one per panel,
                             since only one Run All can ever be active across the whole app at a time
                             anyway (see Set-AllStepButtonsEnabled). Overlaid top-right of the console
                             pane. Starts Collapsed; Start-RunTimer/Stop-RunTimer (in the .ps1) show and
                             hide the whole panel for the lifetime of one Run All chain. The label is
                             plain bold black text on the card's own white background, not part of the
                             timer badge itself; only the value gets the green, rounded-corner badge
                             treatment (matching the Button style's own CornerRadius, and the same green
                             used for a completed step's Button.Background). -->
                        <StackPanel x:Name="OverallRecoveryTimePanel" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,4,4,0" Panel.ZIndex="1" Visibility="Collapsed">
                            <TextBlock Text="Overall Recovery Time" FontWeight="Bold" Foreground="Black" VerticalAlignment="Center" Margin="0,0,6,0" />
                            <Border Background="Green" CornerRadius="3" Padding="8,3">
                                <TextBlock x:Name="OverallRecoveryTimeTextBlock" Text="00:00:00" FontFamily="Consolas" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" />
                            </Border>
                        </StackPanel>
                        <TabControl x:Name="ConsoleTabControl" Background="Transparent" BorderThickness="0" Margin="0,-8,0,0" />
                    </Grid>
                </GroupBox>
                <!-- Runs every message that used to be the single-line, overwritten StatusTextBlock
                     (formerly sitting inside Data Source) - see New-Advisory in the .ps1. A
                     read-only RichTextBox rather than a TextBox: each advisory needs its OWN
                     formatting (bold black normally, bold red for a failure), which a TextBox
                     cannot do since Foreground/FontWeight there apply to the whole control. It
                     still gets a working, independently-scrollable vertical scrollbar for free,
                     entirely separate from the Console pane's own native console window/scrolling
                     above - the two never interact. Height is sized for exactly 6 lines: every line is
                     pinned to a fixed 18px height (FontSize 12, BlockLineHeight; see the Paragraph
                     style below and New-Advisory) and Padding/PagePadding are zero, so Height = 6 x 18
                     + 2px border and the viewport always ends on a line boundary, never showing a
                     sliver of the line above. VerticalScrollBarVisibility="Auto" only shows the bar
                     once there's actually more history than that to scroll through. Newest advisory is inserted at the
                     TOP (see New-Advisory), so the most recent is always the one on screen.
                     The Paragraph style zeroes the default paragraph margin, which would otherwise
                     put a blank line's worth of space between every advisory. -->
                <GroupBox Grid.Row="1" Header="Advisories" Margin="0,12,0,0" Padding="10,10,10,10">
                    <RichTextBox x:Name="AdvisoriesRichTextBox" IsReadOnly="True" IsReadOnlyCaretVisible="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" FontSize="12" Padding="0" BorderThickness="1" Height="110">
                        <RichTextBox.Resources>
                            <Style TargetType="Paragraph">
                                <Setter Property="Margin" Value="0" />
                                <Setter Property="LineStackingStrategy" Value="BlockLineHeight" />
                                <Setter Property="LineHeight" Value="18" />
                            </Style>
                        </RichTextBox.Resources>
                        <FlowDocument PagePadding="0" />
                    </RichTextBox>
                </GroupBox>
            </Grid>
        </Grid>
    </Grid>
</Window>