{
  "id": "pension_calculator",
  "type": "module",
  "version": "1.1",
  "context": {
    "title": "Pension Calculator",
    "icon": "🏦"
  },
  "state": {
    "currentAgeText": "35",
    "retirementAgeText": "65",
    "currentSavingsText": "10000",
    "monthlyContributionText": "500",
    "annualReturnText": "5",
    "focused": "",
    "inputError": "",
    "showToast": false
  },
  "dependencies": [
    {
      "service": {
        "audio": {
          "id": "pension_audio"
        }
      }
    }
  ],
  "children": [
    {
      "id": "pension_root_scroll",
      "type": "scroll",
      "style": {
        "layout": {
          "maxWidth": "infinity",
          "maxHeight": "infinity"
        },
        "scroll": {
          "dismissesKeyboard": "interactively"
        },
        "common": {
          "background": {
            "gradient": {
              "linear": {
                "colors": [
                  "#0F172A",
                  "#1E293B",
                  "#2F4F46"
                ],
                "startPoint": "top",
                "endPoint": "bottom"
              }
            }
          }
        }
      },
      "children": [
        {
          "id": "pension_content",
          "type": "vstack",
          "context": {
            "_spacing": 20,
            "_alignment": "leading",
            "currentAge": "{{ cast(${currentAgeText}, 'double') ?? 0 }}",
            "retirementAge": "{{ cast(${retirementAgeText}, 'double') ?? 0 }}",
            "currentSavings": "{{ cast(${currentSavingsText}, 'double') ?? 0 }}",
            "monthlyContribution": "{{ cast(${monthlyContributionText}, 'double') ?? 0 }}",
            "annualReturn": "{{ cast(${annualReturnText}, 'double') ?? 0 }}",
            "yearsToRetire": "{{ @{retirementAge} - @{currentAge} }}",
            "monthsToRetire": "{{ @{yearsToRetire} * 12 }}",
            "monthlyRate": "{{ @{annualReturn} / 100 / 12 }}",
            "growthFactor": "{{ (1 + @{monthlyRate}) ^ @{monthsToRetire} }}",
            "futureSavings": "{{ @{monthsToRetire} > 0 ? @{currentSavings} * @{growthFactor} : @{currentSavings} }}",
            "futureContributions": "{{ @{monthsToRetire} > 0 ? (@{monthlyRate} > 0 ? @{monthlyContribution} * ((@{growthFactor} - 1) / @{monthlyRate}) : @{monthlyContribution} * @{monthsToRetire}) : 0 }}",
            "projectedTotal": "{{ @{futureSavings} + @{futureContributions} }}",
            "totalContributed": "{{ @{currentSavings} + (@{monthlyContribution} * @{monthsToRetire}) }}",
            "investmentGrowth": "{{ @{projectedTotal} - @{totalContributed} }}",
            "isValid": "{{ @{currentAge} > 0 && @{retirementAge} > @{currentAge} && @{currentSavings} >= 0 && @{monthlyContribution} >= 0 && @{annualReturn} >= 0 }}",
            "validationMessage": "{{ switch(@{currentAge} <= 0, 'Enter your current age.', @{retirementAge} <= @{currentAge}, 'Retirement age must be higher than current age.', @{currentSavings} < 0, 'Current savings cannot be negative.', @{monthlyContribution} < 0, 'Monthly contribution cannot be negative.', @{annualReturn} < 0, 'Expected return cannot be negative.', '') }}",
            "yearlyWithdrawalIntact": "{{ @{projectedTotal} * 0.04 }}"
          },
          "style": {
            "layout": {
              "maxWidth": "infinity",
              "padding": {
                "top": 20,
                "bottom": 28,
                "leading": 16,
                "trailing": 16
              }
            }
          },
          "children": [
            {
              "id": "pension_hero_card",
              "type": "vstack",
              "context": {
                "_spacing": 12,
                "_alignment": "leading"
              },
              "style": {
                "layout": {
                  "maxWidth": "infinity",
                  "padding": 20
                },
                "common": {
                  "background": {
                    "gradient": {
                      "linear": {
                        "colors": [
                          "#2F7D62",
                          "#5FAE8B"
                        ],
                        "startPoint": "topLeading",
                        "endPoint": "bottomTrailing"
                      }
                    }
                  },
                  "foreground": {
                    "color": "white"
                  },
                  "cornerRadius": 24,
                  "glass": "regular"
                },
                "shadow": {
                  "color": {
                    "color": "black",
                    "opacity": 0.24
                  },
                  "radius": 14,
                  "y": 8
                }
              },
              "children": [
                {
                  "id": "pension_hero_row",
                  "type": "hstack",
                  "context": {
                    "_spacing": 10,
                    "_alignment": "center"
                  },
                  "children": [
                    {
                      "id": "pension_hero_icon",
                      "type": "image",
                      "context": {
                        "_source": "sf://chart.line.uptrend.xyaxis"
                      },
                      "style": {
                        "layout": {
                          "width": 26,
                          "height": 26
                        },
                        "common": {
                          "foreground": {
                            "color": "white"
                          }
                        }
                      }
                    },
                    {
                      "id": "pension_hero_label",
                      "type": "text",
                      "context": {
                        "_text": "Projected pension pot"
                      },
                      "style": {
                        "common": {
                          "font": "headline",
                          "foreground": {
                            "color": "white"
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "id": "pension_hero_total",
                  "type": "text",
                  "context": {
                    "_text": "@{projectedTotal}",
                    "_format": {
                      "number": {
                        "style": "currency",
                        "currencyCode": "#{currency}",
                        "maximumFractionDigits": 0
                      }
                    }
                  },
                  "style": {
                    "common": {
                      "font": {
                        "kind": "largeTitle",
                        "weight": "bold"
                      },
                      "foreground": {
                        "color": "white"
                      }
                    },
                    "animation": {
                      "kind": "spring",
                      "value": "@{projectedTotal}",
                      "duration": 0.35,
                      "bounce": 0.25
                    }
                  }
                },
                {
                  "id": "pension_hero_sub",
                  "type": "text",
                  "context": {
                    "_text": "{{ @{yearsToRetire} > 0 ? cast(@{yearsToRetire}, 'int') + ' years of saving at ' + @{annualReturn} + '% annual return' : 'Adjust ages to see your projection' }}"
                  },
                  "style": {
                    "common": {
                      "font": "subheadline",
                      "foreground": {
                        "color": {
                          "color": "white",
                          "opacity": 0.82
                        }
                      }
                    },
                    "text": {
                      "lineLimit": 2
                    }
                  }
                }
              ]
            },
            {
              "id": "pension_inputs_card",
              "type": "vstack",
              "context": {
                "_spacing": 14,
                "_alignment": "leading"
              },
              "style": {
                "layout": {
                  "maxWidth": "infinity",
                  "padding": 18
                },
                "common": {
                  "background": {
                    "material": "regular"
                  },
                  "foreground": {
                    "color": "primary"
                  },
                  "cornerRadius": 22,
                  "glass": "regular"
                },
                "shadow": {
                  "color": {
                    "color": "black",
                    "opacity": 0.18
                  },
                  "radius": 12,
                  "y": 6
                }
              },
              "children": [
                {
                  "id": "pension_inputs_header",
                  "type": "hstack",
                  "context": {
                    "_spacing": 8,
                    "_alignment": "center"
                  },
                  "children": [
                    {
                      "id": "pension_inputs_icon",
                      "type": "image",
                      "context": {
                        "_source": "sf://slider.horizontal.3"
                      },
                      "style": {
                        "layout": {
                          "width": 20,
                          "height": 20
                        },
                        "common": {
                          "foreground": {
                            "color": "#2F7D62"
                          }
                        }
                      }
                    },
                    {
                      "id": "pension_inputs_title",
                      "type": "text",
                      "context": {
                        "_text": "Your assumptions"
                      },
                      "style": {
                        "common": {
                          "font": "headline",
                          "foreground": {
                            "color": "primary"
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "id": "pension_assumption_note",
                  "type": "text",
                  "context": {
                    "_text": "Assumes monthly contributions, annual compounding approximated monthly, and no tax or inflation adjustment."
                  },
                  "style": {
                    "common": {
                      "font": "caption",
                      "foreground": {
                        "color": "secondary"
                      }
                    },
                    "text": {
                      "lineSpacing": 2
                    }
                  }
                },
                {
                  "id": "pension_age_row",
                  "type": "hstack",
                  "context": {
                    "_spacing": 12
                  },
                  "children": [
                    {
                      "id": "pension_current_age_group",
                      "type": "vstack",
                      "context": {
                        "_spacing": 6,
                        "_alignment": "leading"
                      },
                      "style": {
                        "layout": {
                          "maxWidth": "infinity"
                        }
                      },
                      "children": [
                        {
                          "id": "pension_current_age_label",
                          "type": "label",
                          "context": {
                            "_title": "Current age",
                            "_image": "sf://person.fill"
                          },
                          "style": {
                            "common": {
                              "font": "caption",
                              "foreground": {
                                "color": "secondary"
                              }
                            }
                          }
                        },
                        {
                          "id": "pension_current_age_field",
                          "type": "textfield",
                          "context": {
                            "_label": "35",
                            "_text": "${currentAgeText}",
                            "_keyboard": "numberPad",
                            "_focused": "${focused}",
                            "_debounce": 0
                          },
                          "style": {
                            "textField": {
                              "standard": "roundedBorder",
                              "keyboardType": "numberPad"
                            },
                            "common": {
                              "foreground": {
                                "color": "primary"
                              },
                              "background": "{{ notEmpty(${inputError}) && @{currentAge} <= 0 ? { 'color': 'red', 'opacity': 0.10 } : { 'color': 'clear' } }}"
                            }
                          },
                          "events": {
                            "onChange": {
                              "observed": "currentAgeText",
                              "actions": [
                                {
                                  "state": {
                                    "id": "pension_clear_error_age",
                                    "input": {
                                      "inputError": ""
                                    }
                                  }
                                }
                              ]
                            }
                          }
                        }
                      ]
                    },
                    {
                      "id": "pension_retirement_age_group",
                      "type": "vstack",
                      "context": {
                        "_spacing": 6,
                        "_alignment": "leading"
                      },
                      "style": {
                        "layout": {
                          "maxWidth": "infinity"
                        }
                      },
                      "children": [
                        {
                          "id": "pension_retirement_age_label",
                          "type": "label",
                          "context": {
                            "_title": "Retire at",
                            "_image": "sf://flag.checkered"
                          },
                          "style": {
                            "common": {
                              "font": "caption",
                              "foreground": {
                                "color": "secondary"
                              }
                            }
                          }
                        },
                        {
                          "id": "pension_retirement_age_field",
                          "type": "textfield",
                          "context": {
                            "_label": "67",
                            "_text": "${retirementAgeText}",
                            "_keyboard": "numberPad",
                            "_focused": "${focused}",
                            "_debounce": 0
                          },
                          "style": {
                            "textField": {
                              "standard": "roundedBorder",
                              "keyboardType": "numberPad"
                            },
                            "common": {
                              "foreground": {
                                "color": "primary"
                              },
                              "background": "{{ notEmpty(${inputError}) && @{retirementAge} <= @{currentAge} ? { 'color': 'red', 'opacity': 0.10 } : { 'color': 'clear' } }}"
                            }
                          },
                          "events": {
                            "onChange": {
                              "observed": "retirementAgeText",
                              "actions": [
                                {
                                  "state": {
                                    "id": "pension_clear_error_retire",
                                    "input": {
                                      "inputError": ""
                                    }
                                  }
                                }
                              ]
                            }
                          }
                        }
                      ]
                    }
                  ]
                },
                {
                  "id": "pension_savings_group",
                  "type": "vstack",
                  "context": {
                    "_spacing": 6,
                    "_alignment": "leading"
                  },
                  "style": {
                    "layout": {
                      "maxWidth": "infinity"
                    }
                  },
                  "children": [
                    {
                      "id": "pension_savings_label",
                      "type": "label",
                      "context": {
                        "_title": "Current pension savings",
                        "_image": "sf://building.columns.fill"
                      },
                      "style": {
                        "common": {
                          "font": "caption",
                          "foreground": {
                            "color": "secondary"
                          }
                        }
                      }
                    },
                    {
                      "id": "pension_savings_field",
                      "type": "textfield",
                      "context": {
                        "_label": "10000",
                        "_text": "${currentSavingsText}",
                        "_keyboard": "decimalPad",
                        "_focused": "${focused}",
                        "_debounce": 0
                      },
                      "style": {
                        "textField": {
                          "standard": "roundedBorder",
                          "keyboardType": "decimalPad"
                        },
                        "common": {
                          "foreground": {
                            "color": "primary"
                          },
                          "background": "{{ notEmpty(${inputError}) && @{currentSavings} < 0 ? { 'color': 'red', 'opacity': 0.10 } : { 'color': 'clear' } }}"
                        }
                      },
                      "events": {
                        "onChange": {
                          "observed": "currentSavingsText",
                          "actions": [
                            {
                              "state": {
                                "id": "pension_clear_error_savings",
                                "input": {
                                  "inputError": ""
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                },
                {
                  "id": "pension_contribution_group",
                  "type": "vstack",
                  "context": {
                    "_spacing": 6,
                    "_alignment": "leading"
                  },
                  "style": {
                    "layout": {
                      "maxWidth": "infinity"
                    }
                  },
                  "children": [
                    {
                      "id": "pension_contribution_label",
                      "type": "label",
                      "context": {
                        "_title": "Monthly contribution",
                        "_image": "sf://plus.circle.fill"
                      },
                      "style": {
                        "common": {
                          "font": "caption",
                          "foreground": {
                            "color": "secondary"
                          }
                        }
                      }
                    },
                    {
                      "id": "pension_contribution_field",
                      "type": "textfield",
                      "context": {
                        "_label": "500",
                        "_text": "${monthlyContributionText}",
                        "_keyboard": "decimalPad",
                        "_focused": "${focused}",
                        "_debounce": 0
                      },
                      "style": {
                        "textField": {
                          "standard": "roundedBorder",
                          "keyboardType": "decimalPad"
                        },
                        "common": {
                          "foreground": {
                            "color": "primary"
                          },
                          "background": "{{ notEmpty(${inputError}) && @{monthlyContribution} < 0 ? { 'color': 'red', 'opacity': 0.10 } : { 'color': 'clear' } }}"
                        }
                      },
                      "events": {
                        "onChange": {
                          "observed": "monthlyContributionText",
                          "actions": [
                            {
                              "state": {
                                "id": "pension_clear_error_contribution",
                                "input": {
                                  "inputError": ""
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                },
                {
                  "id": "pension_return_group",
                  "type": "vstack",
                  "context": {
                    "_spacing": 6,
                    "_alignment": "leading"
                  },
                  "style": {
                    "layout": {
                      "maxWidth": "infinity"
                    }
                  },
                  "children": [
                    {
                      "id": "pension_return_label",
                      "type": "label",
                      "context": {
                        "_title": "Expected annual return (%)",
                        "_image": "sf://percent"
                      },
                      "style": {
                        "common": {
                          "font": "caption",
                          "foreground": {
                            "color": "secondary"
                          }
                        }
                      }
                    },
                    {
                      "id": "pension_return_field",
                      "type": "textfield",
                      "context": {
                        "_label": "5",
                        "_text": "${annualReturnText}",
                        "_keyboard": "decimalPad",
                        "_focused": "${focused}",
                        "_debounce": 0
                      },
                      "style": {
                        "textField": {
                          "standard": "roundedBorder",
                          "keyboardType": "decimalPad"
                        },
                        "common": {
                          "foreground": {
                            "color": "primary"
                          },
                          "background": "{{ notEmpty(${inputError}) && @{annualReturn} < 0 ? { 'color': 'red', 'opacity': 0.10 } : { 'color': 'clear' } }}"
                        }
                      },
                      "events": {
                        "onChange": {
                          "observed": "annualReturnText",
                          "actions": [
                            {
                              "state": {
                                "id": "pension_clear_error_return",
                                "input": {
                                  "inputError": ""
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                },
                {
                  "id": "pension_error_cond",
                  "type": "conditional",
                  "context": {
                    "_condition": "{{ notEmpty(${inputError}) }}",
                    "_trueComponent": {
                      "id": "pension_error_text",
                      "type": "label",
                      "context": {
                        "_title": "${inputError}",
                        "_image": "sf://exclamationmark.triangle.fill"
                      },
                      "style": {
                        "common": {
                          "font": "caption",
                          "foreground": {
                            "color": "red"
                          }
                        }
                      }
                    },
                    "_falseComponent": {
                      "id": "pension_error_empty",
                      "type": "empty"
                    }
                  }
                },
                {
                  "id": "pension_calculate_button",
                  "type": "button",
                  "context": {
                    "_label": "{{ @{isValid} ? 'Review projection' : 'Fix inputs to calculate' }}",
                    "_image": "sf://checkmark.seal.fill"
                  },
                  "style": {
                    "button": {
                      "custom": {
                        "layout": {
                          "maxWidth": "infinity",
                          "minHeight": 50
                        },
                        "common": {
                          "background": {
                            "gradient": {
                              "linear": {
                                "colors": [
                                  "#2F7D62",
                                  "#7CC7A2"
                                ],
                                "startPoint": "leading",
                                "endPoint": "trailing"
                              }
                            }
                          },
                          "foreground": {
                            "color": "white"
                          },
                          "cornerRadius": 16,
                          "font": {
                            "kind": "headline"
                          },
                          "opacity": "{{ @{isValid} ? 1.0 : 0.65 }}"
                        }
                      }
                    }
                  },
                  "events": {
                    "onTap": [
                      {
                        "state": {
                          "id": "pension_validate_inputs",
                          "input": {
                            "inputError": "@{validationMessage}",
                            "focused": "",
                            "showToast": "@{isValid}"
                          },
                          "output": {
                            "success": [
                              {
                                "condition": {
                                  "id": "pension_validation_haptic_guard",
                                  "input": "@{isValid}",
                                  "output": {
                                    "success": [
                                      {
                                        "service": {
                                          "id": "pension_success_haptic",
                                          "input": {
                                            "serviceId": "pension_audio",
                                            "params": {
                                              "sound": "none",
                                              "haptic": "success"
                                            }
                                          }
                                        }
                                      },
                                      {
                                        "interval": {
                                          "id": "pension_toast_timer",
                                          "input": {
                                            "delay": 2
                                          },
                                          "output": {
                                            "success": [
                                              {
                                                "interval": {
                                                  "id": "pension_toast_timer",
                                                  "input": {
                                                    "cancel": true
                                                  }
                                                }
                                              },
                                              {
                                                "state": {
                                                  "id": "pension_hide_toast",
                                                  "input": {
                                                    "showToast": false
                                                  }
                                                }
                                              }
                                            ]
                                          }
                                        }
                                      }
                                    ],
                                    "failure": [
                                      {
                                        "service": {
                                          "id": "pension_warning_haptic",
                                          "input": {
                                            "serviceId": "pension_audio",
                                            "params": {
                                              "sound": "none",
                                              "haptic": "warning"
                                            }
                                          }
                                        }
                                      }
                                    ]
                                  }
                                }
                              }
                            ]
                          }
                        }
                      }
                    ]
                  }
                }
              ]
            },
            {
              "id": "pension_breakdown_card",
              "type": "vstack",
              "context": {
                "_spacing": 12,
                "_alignment": "leading"
              },
              "style": {
                "layout": {
                  "maxWidth": "infinity",
                  "padding": 18
                },
                "common": {
                  "background": {
                    "light": "#F8FAFC",
                    "dark": "#111827"
                  },
                  "foreground": {
                    "light": "#0F172A",
                    "dark": "white"
                  },
                  "cornerRadius": 22,
                  "glass": "regular"
                },
                "shadow": {
                  "color": {
                    "color": "black",
                    "opacity": 0.18
                  },
                  "radius": 12,
                  "y": 6
                },
                "animation": {
                  "kind": "spring",
                  "value": "@{projectedTotal}",
                  "duration": 0.35,
                  "bounce": 0.22
                }
              },
              "children": [
                {
                  "id": "pension_breakdown_header",
                  "type": "hstack",
                  "context": {
                    "_spacing": 8,
                    "_alignment": "center"
                  },
                  "children": [
                    {
                      "id": "pension_breakdown_icon",
                      "type": "image",
                      "context": {
                        "_source": "sf://list.bullet.rectangle.portrait.fill"
                      },
                      "style": {
                        "layout": {
                          "width": 20,
                          "height": 20
                        },
                        "common": {
                          "foreground": {
                            "color": "#5FAE8B"
                          }
                        }
                      }
                    },
                    {
                      "id": "pension_breakdown_title",
                      "type": "text",
                      "context": {
                        "_text": "Projection breakdown"
                      },
                      "style": {
                        "common": {
                          "font": "headline",
                          "foreground": {
                            "light": "#0F172A",
                            "dark": "white"
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "id": "pension_years_row",
                  "type": "hstack",
                  "context": {
                    "_spacing": 8
                  },
                  "children": [
                    {
                      "id": "pension_years_label",
                      "type": "label",
                      "context": {
                        "_title": "Time to retirement",
                        "_image": "sf://calendar"
                      },
                      "style": {
                        "layout": {
                          "maxWidth": "infinity"
                        },
                        "common": {
                          "font": "subheadline",
                          "foreground": {
                            "color": "secondary"
                          }
                        }
                      }
                    },
                    {
                      "id": "pension_years_value",
                      "type": "text",
                      "context": {
                        "_text": "{{ @{yearsToRetire} > 0 ? cast(@{yearsToRetire}, 'int') + ' years' : '—' }}"
                      },
                      "style": {
                        "common": {
                          "font": {
                            "kind": "subheadline",
                            "weight": "semibold"
                          },
                          "foreground": {
                            "light": "#0F172A",
                            "dark": "white"
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "id": "pension_contributed_row",
                  "type": "hstack",
                  "context": {
                    "_spacing": 8
                  },
                  "children": [
                    {
                      "id": "pension_contributed_label",
                      "type": "label",
                      "context": {
                        "_title": "Total paid in",
                        "_image": "sf://tray.and.arrow.down.fill"
                      },
                      "style": {
                        "layout": {
                          "maxWidth": "infinity"
                        },
                        "common": {
                          "font": "subheadline",
                          "foreground": {
                            "color": "secondary"
                          }
                        }
                      }
                    },
                    {
                      "id": "pension_contributed_value",
                      "type": "text",
                      "context": {
                        "_text": "@{totalContributed}",
                        "_format": {
                          "number": {
                            "style": "currency",
                            "currencyCode": "#{currency}",
                            "maximumFractionDigits": 0
                          }
                        }
                      },
                      "style": {
                        "common": {
                          "font": {
                            "kind": "subheadline",
                            "weight": "semibold"
                          },
                          "foreground": {
                            "light": "#0F172A",
                            "dark": "white"
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "id": "pension_growth_row",
                  "type": "hstack",
                  "context": {
                    "_spacing": 8
                  },
                  "children": [
                    {
                      "id": "pension_growth_label",
                      "type": "label",
                      "context": {
                        "_title": "Estimated growth",
                        "_image": "sf://leaf.fill"
                      },
                      "style": {
                        "layout": {
                          "maxWidth": "infinity"
                        },
                        "common": {
                          "font": "subheadline",
                          "foreground": {
                            "color": "secondary"
                          }
                        }
                      }
                    },
                    {
                      "id": "pension_growth_value",
                      "type": "text",
                      "context": {
                        "_text": "@{investmentGrowth}",
                        "_format": {
                          "number": {
                            "style": "currency",
                            "currencyCode": "#{currency}",
                            "maximumFractionDigits": 0
                          }
                        }
                      },
                      "style": {
                        "common": {
                          "font": {
                            "kind": "subheadline",
                            "weight": "semibold"
                          },
                          "foreground": {
                            "color": "#5FAE8B"
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "id": "pension_withdraw_row",
                  "type": "hstack",
                  "context": {
                    "_spacing": 8
                  },
                  "children": [
                    {
                      "id": "pension_withdraw_label",
                      "type": "label",
                      "context": {
                        "_title": "Yearly withdrawal",
                        "_image": "sf://arrow.up.forward.circle.fill"
                      },
                      "style": {
                        "layout": {
                          "maxWidth": "infinity"
                        },
                        "common": {
                          "font": "subheadline",
                          "foreground": {
                            "color": "secondary"
                          }
                        }
                      }
                    },
                    {
                      "id": "pension_withdraw_value",
                      "type": "text",
                      "context": {
                        "_text": "@{yearlyWithdrawalIntact}",
                        "_format": {
                          "number": {
                            "style": "currency",
                            "currencyCode": "#{currency}",
                            "maximumFractionDigits": 0
                          }
                        }
                      },
                      "style": {
                        "common": {
                          "font": {
                            "kind": "subheadline",
                            "weight": "semibold"
                          },
                          "foreground": {
                            "color": "#5FAE8B"
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "id": "pension_withdraw_note",
                  "type": "text",
                  "context": {
                    "_text": "Forecast annual withdrawal using the rule-of-thumb 4% drawdown rate."
                  },
                  "style": {
                    "common": {
                      "font": "caption",
                      "foreground": {
                        "color": "secondary"
                      }
                    },
                    "text": {
                      "lineSpacing": 2
                    }
                  }
                },
                {
                  "id": "pension_divider",
                  "type": "divider"
                },
                {
                  "id": "pension_monthly_income_hint",
                  "type": "text",
                  "context": {
                    "_safeDraw": "{{ @{projectedTotal} * 0.04 / 12 }}",
                    "_text": "{{ 'Rule-of-thumb income at 4% drawdown: ' + format(@{_safeDraw}, { 'number': { 'style': 'currency', 'currencyCode': #{currency}, 'maximumFractionDigits': 0 } }) + ' / month' }}"
                  },
                  "style": {
                    "common": {
                      "font": "caption",
                      "foreground": {
                        "color": "secondary"
                      }
                    },
                    "text": {
                      "lineSpacing": 2
                    }
                  }
                }
              ]
            },
            {
              "id": "pension_toast",
              "type": "hstack",
              "context": {
                "_spacing": 8,
                "_alignment": "center"
              },
              "style": {
                "layout": {
                  "padding": {
                    "top": 10,
                    "bottom": 10,
                    "leading": 16,
                    "trailing": 16
                  }
                },
                "common": {
                  "background": {
                    "material": "regular"
                  },
                  "foreground": {
                    "color": "primary"
                  },
                  "cornerRadius": 18,
                  "opacity": "{{ ${showToast} ? 1.0 : 0.0 }}",
                  "scale": "{{ ${showToast} ? 1.0 : 0.92 }}"
                },
                "shadow": {
                  "color": {
                    "color": "black",
                    "opacity": 0.2
                  },
                  "radius": 10,
                  "y": 4
                },
                "animation": {
                  "kind": "spring",
                  "value": "${showToast}",
                  "duration": 0.35,
                  "bounce": 0.25
                }
              },
              "children": [
                {
                  "id": "pension_toast_icon",
                  "type": "image",
                  "context": {
                    "_source": "sf://checkmark.circle.fill"
                  },
                  "style": {
                    "layout": {
                      "width": 16,
                      "height": 16
                    },
                    "common": {
                      "foreground": {
                        "color": "#5FAE8B"
                      }
                    }
                  }
                },
                {
                  "id": "pension_toast_text",
                  "type": "text",
                  "context": {
                    "_text": "Projection updated"
                  },
                  "style": {
                    "common": {
                      "font": "subheadline",
                      "foreground": {
                        "color": "primary"
                      }
                    }
                  }
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}