code:
######################################################
################# CHARACTER WINDOW ###################
######################################################

window = {
	name = "character_window"
	widgetid = "character_window"
	datacontext = "[GetVariableSystem]"
	datacontext = "[CharacterWindow.GetCharacter]"
	movable = no
	layer = middle
	allow_outside = yes

	using = Window_Size_Sidebar
	using = Window_Background_Sidebar

	state = {
		name = _show
		using = Animation_FadeIn_Quick
		using = Sound_WindowShow_Standard
		position_x = 0

		on_start = "[GetVariableSystem.Set( 'hide_bottom_left_HUD', 'true' )]"
	}

	state = {
		name = _hide
		using = Animation_FadeOut_Quick
		using = Sound_WindowHide_Standard
		position_x = -60

		on_start = "[GetVariableSystem.Clear( 'hide_bottom_left_HUD' )]"
	}

	vbox = {
		name = "main_content"
		using = Window_Margins_Sidebar

		###############
		# Character box
		widget = {
			name = "main_characters"
			datacontext = "[GetIllustration( 'character_view_bg' )]"
			layoutpolicy_horizontal = expanding
			size = { 0 305 }

			widget = {
				size = { 100% 100% }
				using = Animation_Character_Window_Refresh

				background = {
					texture = "[Illustration.GetTexture( Character.MakeScope )]"
					fittype = centercrop
					margin_bottom = 5
					margin_left = 1

					modify_texture = {
						texture = "gfx/interface/component_masks/mask_rough_edges_down_right.dds"
						spriteType = Corneredtiled
						spriteborder = { 20 20 }
						blend_mode = alphamultiply
						texture_density = 2
					}
				}
			}

			### Primary Spouse
			container_secondary = {
				visible = "[CharacterWindow.ShouldShowSecondary]"
			}

			### Main Character
			portrait_character_view_main = {
				name = "tutorial_highlight_main_character_button"
				parentanchor = bottom|left
				position = { 0 0 }

				using = Animation_Character_Window_Refresh_Short

				blockoverride "portrait_button"
				{
					using = tooltip_es
					tooltip_offset = { -50 0 }
				}

				blockoverride "prison_bars" {
					highlight_icon = {
						parentanchor = center
						name = "prison_bars"
						visible = "[Character.IsImprisoned]"
						visible_at_creation = no
						size = { 33% 100% }

						effectname = "NoHighlight"
						texture = "gfx/portraits/portrait_prison_character_view.dds"

						modify_texture = {
							name = "mask"
							texture = "gfx/portraits/portrait_mask_character_view.dds"
							spriteType = Corneredstretched
							blend_mode = alphamultiply
						}
					}
				}

				blockoverride "portrait_opinion"
				{
					vassal_stance_icon = {
						name = "vassal_stance"
						size = { 20 20 }
					}
				}
			}

			secondary_widget = {
				visible = "[CharacterWindow.ShouldShowSecondary]"
				position = { 250 0 }
			}

			buttons_window_control = {
				parentanchor = top|right

				blockoverride "extra_buttons"
				{
					icon = {
						visible = "[And( InDebugMode, Not( Character.AccessDenied ) )]"
						size = { 30 30 }
						texture = "gfx/interface/icons/icon_group_of_characters.dds"
						tooltip = "CHARACTER_AI_VALUES_DEBUG_TOOLTIP"
					}

					button_copy = {
						visible = "[And( InDebugMode, Not( Character.AccessDenied ) )]"
						size = { 30 30 }
						onclick = "[Character.CopyCharacterDna]"
						raw_tooltip = "Copy DNA"
					}

					button_copy = {
						visible = "[And( InDebugMode, Not( Character.AccessDenied ) )]"
						size = { 30 30 }
						onclick = "[Character.CopyCharacterPersistentDna]"
						raw_tooltip = "Copy Persistent DNA"
					}
				}

				blockoverride "button_close"
				{
					onclick = "[CharacterWindow.Close]"
				}

				blockoverride "button_back"
				{
					visible = "[HasViewHistory]"
					onclick = "[OpenFromViewHistory]"
					tooltip = "[GetViewHistoryTooltip]"
				}

				blockoverride "button_me"
				{
					visible = "[Not(Character.IsLocalPlayer)]"
					onclick = "[DefaultOnCharacterClick(GetPlayer.GetID)]"
				}

				blockoverride "button_pin" {
					visible = "[Not( Character.AccessDenied )]"
				}

				background = {
					using = Background_Area_Solid
					modify_texture = {
						name = "mask"
						texture = "gfx/interface/component_masks/mask_fade_horizontal_middle_thick.dds"
						spriteType = Corneredstretched
						spriteborder = { 0 0 }
						blend_mode = alphamultiply
					}
					alpha = 0.7
					margin_left = 30
					margin_right = 30
				}
			}

			hbox = {
				margin_top = 50
				layoutpolicy_horizontal = expanding
				expand = {}

				### Jailor / Imprisoner / Imprisoned by
				vbox = {
					name = "imprisoned_by"
					datacontext = "[CharacterWindow.GetCharacter.GetImprisonedBy]"
					visible = "[Character.IsValid]"

					margin_right = 20
					layoutpolicy_vertical = expanding
					using = Animation_Character_Window_Refresh

					portrait_head_small = {
						blockoverride "portrait_transformation"
						{
							portrait_scale = { -1 1 }
							portrait_offset = { 1 0 }
						}
					}

					text_label_center = {
						text = "IMPRISONED_BY"
					}
					expand = {}
				}

				### Hostage Home Court
				vbox = {
					name = "hostage_home_court"
					datacontext = "[CharacterWindow.GetCharacter.GetHomeCourt]"
					visible = "[Character.IsValid]"

					margin_right = 20
					layoutpolicy_vertical = expanding
					using = Animation_Character_Window_Refresh

					portrait_head_small = {
						blockoverride "portrait_transformation"
						{
							portrait_scale = { -1 1 }
							portrait_offset = { 1 0 }
						}
					}

					text_label_center = {
						text = "[home_court|E]"
					}
					expand = {}
				}

				### Liege
				vbox = {
					name = "liege"
					datacontext = "[CharacterWindow.GetCharacter.GetLiegeEvenWhenDead]"
					visible = "[CharacterWindow.HasLiegeEvenWhenDead]"
					allow_outside = yes

					margin_right = 20
					layoutpolicy_vertical = expanding
					using = Animation_Character_Window_Refresh

					portrait_head_small = {
						blockoverride "portrait_transformation"
						{
							portrait_scale = { -1 1 }
							portrait_offset = { 1 0 }
						}

						blockoverride "coa" {
							coa_realm_tiny = {
								visible = "[And(CharacterWindow.GetCharacter.IsAlive, CharacterWindow.HasLiegeTitleEvenWhenDead)]"
								parentanchor = bottom|left
								position = { 3 -2 }
								scale = 0.85
							}

							coa_title_tiny = {
								visible = "[And(Not(CharacterWindow.GetCharacter.IsAlive), CharacterWindow.HasLiegeTitleEvenWhenDead)]"
								datacontext = "[CharacterWindow.GetCharacter.GetLiegeTitleEvenWhenDead]"
								parentanchor = bottom|left
								position = { 3 -2 }
								scale = 0.85
							}
						}
					}

					hbox = {
						spacing = 3

						datacontext = "[CharacterWindow.GetCharacter]"

						text_label_center = {
							visible = "[Character.IsHostage]"
							text = "WARDEN_OF"
						}

						text_label_center = {
							visible = "[Not( Character.IsHostage )]"
							text = "[liege|E]"
						}

						icon = {

							name = "non_dejure_liege"
							visible = "[Not( Character.GetVassalContract.IsRightfulLiege )]"
							size = { 30 30 }
							texture = "gfx/interface/icons/levy_tax_reduction.dds"

							using = tooltip_ws
							tooltip = "MRW_TT_NOT_RIGHTFUL_LIEGE"
						}

						icon = {
							name = "diarchy_active_icon"
							visible = "[Character.IsDiarchOf( Character.GetLiege )]"
							size = { 25 25 }
							texture = "gfx/interface/icons/scale_of_power.dds"
							tooltip = DIARCH_ICON_TOOLTIP
							using = tooltip_below
						}
					}

					portrait_opinion = {
						name = "liege_opinion"

						datacontext = "[CharacterWindow.GetCharacter]"
						visible = "[And( Character.GetLiege.IsValid, And( Character.IsAlive, Not(Character.IsLocalPlayer ) ) )]"

						blockoverride "dread_logic" {
							visible = "[Character.ShouldShowDreadEffectIconFor( Character.GetLiege )]"
							frame = "[Character.GetDreadEffectIconFrameFor( Character.GetLiege )]"
							tooltip = "[Character.GetDreadEffectTooltipFor( Character.GetLiege )]"
						}

						blockoverride "opinion_text"
						{
							text = "[Character.GetOpinionOf( Character.GetLiege )|=]"
							fonttintcolor = "[Character.GetOpinionOfTint( CharacterWindow.GetCharacter.GetLiege )]"
						}

						blockoverride "ott_heading_text"
						{
							text = "[Character.GetOpinionHeadingText( CharacterWindow.GetCharacter.GetLiege )]"
						}

						blockoverride "ott_opinion_value_text"
						{
							text = "[Character.GetOpinionOf( Character.GetLiege )|=]"
							fonttintcolor = "[Character.GetOpinionOfTint( CharacterWindow.GetCharacter.GetLiege )]"
						}

						blockoverride "ott_opinion_breakdown_text"
						{
							text = "[Character.GetOpinionBreakdownText( CharacterWindow.GetCharacter.GetLiege )]"
						}
					}
					expand = {}
				}

				### Suzerain
				vbox = {
					name = "suzerain"
					datacontext = "[CharacterWindow.GetCharacter.GetSuzerain]"
					visible = "[CharacterWindow.GetCharacter.HasSuzerain]"
					allow_outside = yes

					margin_right = 20
					layoutpolicy_vertical = expanding
					using = Animation_Character_Window_Refresh

					portrait_head_small = {
						blockoverride "portrait_transformation"
						{
							portrait_scale = { -1 1 }
							portrait_offset = { 1 0 }
						}

						blockoverride "coa" {
							coa_realm_tiny = {
								parentanchor = bottom|left
								position = { 3 -2 }
								scale = 0.85
							}
						}
					}

					hbox = {
						spacing = 3

						datacontext = "[CharacterWindow.GetCharacter]"

						text_label_center = {
							visible = "[Character.IsHostage]"
							text = "WARDEN_OF"
						}

						text_label_center = {
							visible = "[Not( Character.IsHostage )]"
							text = "[suzerain|E]"
							margin_left = 28

							### Tributary Icon
							widget = {
								size = { 24 24 }
								datacontext = "[Character.GetTributaryContract]"
								tooltip = "CONTRACT_NAME"
								using = tooltip_se

								icon = {
									visible = "[And( Not( IsNomad( Character )), Not( IsHerder( Character ) ) )]"
									parentanchor = center
									size = { 24 24 }
									texture = "gfx/interface/icons/tributary_settled_map_icon.dds"
								}

								icon = {
									visible = "[Or(IsNomad( Character ), IsHerder( Character ))]"
									parentanchor = center
									size = { 24 24 }
									texture = "gfx/interface/icons/tributary_nomadic_map_icon.dds"
								}
							}
						}
					}

					portrait_opinion = {
						name = "suzerain_opinion"

						datacontext = "[CharacterWindow.GetCharacter]"
						visible = "[And( Character.GetSuzerain.IsValid, And( Character.IsAlive, Not(Character.IsLocalPlayer ) ) )]"

						blockoverride "opinion_text"
						{
							text = "[Character.GetOpinionOf( Character.GetSuzerain )|=]"
							fonttintcolor = "[Character.GetOpinionOfTint( CharacterWindow.GetCharacter.GetSuzerain )]"
						}

						blockoverride "ott_heading_text"
						{
							text = "[Character.GetOpinionHeadingText( CharacterWindow.GetCharacter.GetSuzerain )]"
						}

						blockoverride "ott_opinion_value_text"
						{
							text = "[Character.GetOpinionOf( Character.GetSuzerain )|=]"
							fonttintcolor = "[Character.GetOpinionOfTint( CharacterWindow.GetCharacter.GetSuzerain )]"
						}

						blockoverride "ott_opinion_breakdown_text"
						{
							text = "[Character.GetOpinionBreakdownText( CharacterWindow.GetCharacter.GetSuzerain )]"
						}
					}
					expand = {}
				}
			}

			### Host
			container = {
				name = "host"
				datacontext = "[CharacterWindow.GetCourtOwner]"
				visible = "[And( Not( CharacterWindow.HasLiegeEvenWhenDead ), And( CharacterWindow.GetCourtOwner.IsValid, Not( CharacterWindow.GetCharacter.IsRuler ) ) )]"
				parentanchor = bottom|right
				widgetanchor = top|left
				position = { -105 -250 }

				using = Animation_Character_Window_Refresh

				portrait_head_small = {
					blockoverride "portrait_transformation"
					{
						portrait_scale = { -1 1 }
						portrait_offset = { 1 0 }
					}
				}

				text_label_center = {
					parentanchor = top|hcenter
					position = { 0 85 }
					text = "[host|E]"
				}

				portrait_opinion = {
					name = "liege_opinion"
					datacontext = "[CharacterWindow.GetCharacter]"
					visible = "[And(Character.IsAlive, Not(Character.IsLocalPlayer))]"
					parentanchor = top|hcenter
					position = { -10 110 }

					blockoverride "dread_logic" {
						visible = "[Character.ShouldShowDreadEffectIconFor( CharacterWindow.GetCourtOwner )]"
						frame = "[Character.GetDreadEffectIconFrameFor( CharacterWindow.GetCourtOwner )]"
						tooltip = "[Character.GetDreadEffectTooltipFor( CharacterWindow.GetCourtOwner )]"
					}

					blockoverride "opinion_text"
					{
						text = "[Character.GetOpinionOf( CharacterWindow.GetCourtOwner )|=]"
						fonttintcolor = "[Character.GetOpinionOfTint( CharacterWindow.GetCourtOwner )]"
					}

					blockoverride "ott_heading_text"
					{
						text = "[Character.GetOpinionHeadingText( CharacterWindow.GetCourtOwner )]"
					}

					blockoverride "ott_opinion_value_text"
					{
						text = "[Character.GetOpinionOf( CharacterWindow.GetCourtOwner )|=]"
						fonttintcolor = "[Character.GetOpinionOfTint( CharacterWindow.GetCourtOwner )]"
					}

					blockoverride "ott_opinion_breakdown_text"
					{
						text = "[Character.GetOpinionBreakdownText( CharacterWindow.GetCourtOwner )]"
					}
				}
			}

			container = { # Player Heir for the local player
				name = "heir_player"
				datacontext = "[CharacterWindow.GetCharacter.GetPlayerHeir]"
				visible = "[And(And( Character.IsValid, CharacterWindow.GetCharacter.IsLocalPlayer ), Not( GreaterThan_CFixedPoint( GetPlayer.MakeScope.Var('hide_ui_spouse').GetValue, '(CFixedPoint)0' ) ))]"
				parentanchor = bottom|right
				position = { -20 -6 }

				using = Animation_Character_Window_Refresh

				portrait_head_small = {
					blockoverride "portrait_transformation"
					{
						portrait_scale = { -1 1 }
						portrait_offset = { 1 0 }
					}
				}

				text_label_center = {
					parentanchor = top|hcenter
					position = { 0 85 }
					text = "[player_heir|E]"
					multiline = yes
					autoresize = yes
					max_width = 100
				}
			}
			container = { # Primary Heir for everyone else
				name = "heir_primary"
				datacontext = "[CharacterWindow.GetCharacter.GetPrimaryTitle.GetHeir]"
				visible = "[And( And( Character.IsValid, Not(CharacterWindow.GetCharacter.IsLocalPlayer) ), CharacterWindow.GetCharacter.IsAlive )]"
				parentanchor = bottom|right
				position = { -20 -6 }

				using = Animation_Character_Window_Refresh

				portrait_head_small = {
					parentanchor = right

					blockoverride "portrait_transformation"
					{
						portrait_scale = { -1 1 }
						portrait_offset = { 1 0 }
					}
				}

				text_label_center = {
					parentanchor = top|hcenter
					position = { 0 85 }
					text = "[primary_heir|E]"
				}
			}

			### DEBUG STUFF, please make sure those are visible and usable, especially the watch button, type "watch" into the console to show it
			widget = {
				name = "debug_buttons"
				size = { 200 50 }
				parentanchor = top|left
				position = { 175 20 }
				visible = "[InDebugMode]"
				allow_outside = yes

				# Debug personality
				vbox = {
					hbox = {
						spacing = 15
						#text_single = {
						#	visible = "[AIWatchWindowsEnabled]"
						#	text = "test_difficulty"
						#	align = nobaseline
						#	using = Background_Full_Dim
						#	tooltipwidget = {
						#		scripted_score_breakdown_tooltip = {
						#			blockoverride "breakdown_datacontext"
						#			{
						#				datacontext = "[Character.GetDestinyScriptedValueBreakdown( 'character_difficulty_value', GetPlayer, GetPlayer.GetPlayerHeir )]"
						#			}
						#
						#			blockoverride "header_text" {
						#				raw_text = "Difficulty Breakdown"
						#			}
						#		}
						#	}
						#}
						#text_single = {
						#	visible = "[AIWatchWindowsEnabled]"
						#	text = "test_interest"
						#	align = nobaseline
						#	using = Background_Full_Dim
						#	tooltipwidget = {
						#		scripted_score_breakdown_tooltip = {
						#			blockoverride "breakdown_datacontext"
						#			{
						#				datacontext = "[Character.GetDestinyScriptedValueBreakdown( 'destiny_score_interest', GetPlayer, GetPlayer.GetPlayerHeir )]"
						#			}
						#
						#			blockoverride "header_text" {
						#				raw_text = "Interest Breakdown"
						#			}
						#		}
						#	}
						#}
						button = {
							using = editor_button
							name = "ai_watch_button"
							size = { 80 20 }
							raw_text = "AI Watch"
							align = center|nobaseline
							onclick = "[CharacterWindow.OnAIWatch]"
							visible = "[AIWatchWindowsEnabled]"
							fontcolor = { 1.0 1.0 1.0 1.0 }
						}

						watch_window_button = {
							size = { 60 40 }
							onclick = "[AddWatchWindow( CharacterWindow.GetCharacter.MakeScope )]"
						}
					}
				}
			}

			flowcontainer = {
				parentanchor = bottom|left
				position = { 5 -5 }
				spacing = 5
				ignoreinvisible = yes
				direction = vertical

				container = {
					visible = "[Character.IsLocalPlayer]"
					tooltip = "PLAYER_STRESS_TOOLTIP"
					using = tooltip_es

					widget = {
						visible = "[Not(GreaterThanOrEqualTo_int32(GetPlayer.GetStressLevel, '(int32)3'))]"
						size = { 100% 100%}

						using = Animation_ShowHide_Standard

						background = {
							texture = "gfx/interface/component_masks/mask_fade_circle.dds"
							color = { 0.15 0.15 0.15 1 }
							margin = { 12 12 }
						}
					}

					widget = {
						visible = "[GreaterThanOrEqualTo_int32(GetPlayer.GetStressLevel, '(int32)3')]"
						parentanchor = center
						size = { 180% 180% }
						using = Animation_ShowHide_Standard

						icon = {
							size = { 100% 100% }
							texture = "gfx/interface/component_masks/mask_fade_circle.dds"
							using = Color_Red
							alpha = 0

							state = {
								name = a
								next = b
								trigger_on_create = yes
								alpha = 0.5
								duration = 0.4
								using = Animation_Curve_Default
							}

							state = {
								name = b
								next = a
								alpha = 0
								duration = 1
								using = Animation_Curve_Default
							}
						}
					}

					icon = {
						parentanchor = vcenter
						size = { 35 35 }
						texture = "gfx/interface/icons/stress/icon_stress_level.dds"
						framesize = { 70 70 }
						frame = "[IntToFrameIndex( GetPlayer.GetStressLevel )]"

						modify_texture = {
							visible = "[GreaterThanOrEqualTo_int32(GetPlayer.GetStressLevel, '(int32)2')]"
							name = "glow"
							texture = "gfx/interface/colors/gold.dds"
							blend_mode = colordodge
							alpha = 0
						}

						state = {
							name = a
							next = b
							duration = 0.4
							trigger_on_create = yes
							using = Animation_Curve_Default

							modify_texture = {
								name = "glow"
								alpha = 0.3
							}
						}

						state = {
							name = b
							next = a
							duration = 1
							using = Animation_Curve_Default

							modify_texture = {
								name = "glow"
								alpha = 0
							}
						}
					}
				}

				container = {
					visible = "[GreaterThan_int32(GetDataModelSize(Character.GetKnownLanguages), '(int32)1')]"
					parentanchor = hcenter
					tooltip = "KNOWN_LANGUAGES_TOOLTIP"
					widget = {
						size = { 100% 100%}

						using = Animation_ShowHide_Standard

						background = {
							texture = "gfx/interface/component_masks/mask_fade_circle.dds"
							color = { 0.15 0.15 0.15 1 }
							margin = { 12 12 }
						}
					}
					icon_culture_pillar = {
						size = { 30 30 }
						texture = "gfx/interface/icons/flat_icons/map_modes/court_languages.dds"
					}
				}

				## barbershop button
				button_normal = {
					name = "open_barbershop"
					visible = "[Character.CanCustomizePortrait]"

					size = { 35 35 }
					datacontext = "[CharacterWindow.AccessCharacter]"
					tooltip = "CV_CUSTOMIZE_PORTRAIT"
					using = tooltip_ne

					icon_round_button_base = {}

					button_barbershop = {
						visible = "[Character.CanCustomizePortrait]"
						onclick = "[Character.OnCustomizePortrait]"
						onclick = "[CloseGameView( 'character_interaction_menu' )]"
						size = { 25 25 }
						parentanchor = center
					}
				}

				button_normal = {
					name = "open_kill_list"
					visible = "[Character.HasKillsKnownTo( GetPlayer )]"

					size = { 35 35 }

					datacontext = "[Character]"
					tooltip = "OPEN_KILL_LIST_TOOLTIP"
					using = tooltip_es

					icon_round_button_base = {}

					button_kill_list = {
						onclick = "[ToggleGameViewData( 'kill_list', Character.GetID  )]"
						size = { 25 25 }
						parentanchor = center

						modify_texture = {
							texture = "gfx/interface/icons/focuses/hud_icon_mask.dds"
							blend_mode = alphamultiply
						}
					}
				}

				button_normal = {
					name = "open_memories"

					size = { 35 35 }
					datacontext = "[Character]"
					tooltip = "OPEN_MEMORIES_TOOLTIP"
					using = tooltip_es

					icon_round_button_base = {}

					button_memories = {
						onclick = "[ToggleGameViewData( 'memories', Character.GetID  )]"
						size = { 25 25 }
						parentanchor = center
					}
				}

				button_normal = {
					name = "open_focus_button"
					size = { 35 35 }

					visible = "[Or( Character.GetFocus.IsValid, Character.PlayerCanManageFocus )]"
					tooltip = "PLAYER_LIFESTYLE_TOOLTIP"
					using = tooltip_ne

					icon_round_button_base = {}

					highlight_icon_lifestyle_focus = {
						size = { 100% 100% }
						visible = "[And(GreaterThan_int32( Character.GetTotalPerkPoints, '(int32)0' ), Character.IsLocalPlayer)]"
						texture = "[CharacterWindow.GetCharacter.GetFocus.GetIcon]"

						modify_texture = {
							texture = "gfx/interface/icons/focuses/hud_icon_mask.dds"
							blend_mode = alphamultiply
						}

						state = {
							name = a
							next = b
							alpha = 0
							trigger_on_create = yes
							duration = 1.2
							using = Animation_Curve_Default
						}

						state = {
							name = b
							next = a
							alpha = 0.5
							duration = 0.6
							using = Animation_Curve_Default
						}

						glow = {
							glow_radius = 2
							glow_generation_rules= {
								glow_alpha_mask = 0
								glow_blur_passes = 2
								glow_texture_downscale = 2.5f
								glow_ignore_inside_pixels = yes
							}
							using = Color_Orange
						}
					}

					highlight_icon_lifestyle_focus = {
						size = { 100% 100% }
						texture = "[CharacterWindow.GetCharacter.GetFocus.GetIcon]"
						onclick = "[CharacterWindow.OnClickFocusButton]"
						enabled = "[CharacterWindow.CanClickFocusButton]"
						tooltip = "[CharacterWindow.GetFocusButtonTooltip]"

						modify_texture = {
							texture = "gfx/interface/icons/focuses/hud_icon_mask.dds"
							blend_mode = alphamultiply
						}
					}
				}

				button_open_inventory = {
					visible = "[Character.IsAlive]"
					name = "open_inventory"
					size = { 35 35 }
				}
			}

			button_normal = {
				name = "open_royal_court"
				size = { 70 70 }
				visible = "[Character.HasRoyalCourt]"

				position = { -30 -30 }

				onclick = "[CharacterWindow.Close]"
				onclick = "[Character.OpenRoyalCourtView( 'throne' )]"
				datacontext = "[Character.GetCourtGrandeurData]"
				tooltip = OPEN_ROYAL_COURT_TOOLTIP

				icon_round_button_base = {}

				button_royal_court = {
					onclick = "[CharacterWindow.Close]"
					onclick = "[Character.OpenRoyalCourtView( 'throne' )]"

					size = { 30 30 }
					parentanchor = center
					position = { 9 10 }

					modify_texture = {
						texture = "gfx/interface/icons/focuses/hud_icon_mask.dds"
						blend_mode = alphamultiply
					}
				}
			}
		}

		############################
		### Character internal info
		hbox = {
			name = "character_info"
			layoutpolicy_horizontal = expanding
			margin = { 0 5 }
			margin_left = 5
			using = Animation_ShowHide_Quick
			visible = "[Not( GreaterThan_CFixedPoint( GetPlayer.MakeScope.Var('hide_ui_character_info').GetValue, '(CFixedPoint)0' ) )]"
			using = Animation_ShowHide_Quick

			background = {
				using = Background_Area_Dark
				margin_left = 5
			}

			vbox = {
				layoutpolicy_horizontal = expanding

				vbox = {
					name = "name_and_traits"
					layoutpolicy_horizontal = expanding

					using = Animation_Character_Window_Refresh

					vbox = {
						name = "name_etc"
						layoutpolicy_horizontal = expanding

						## Name
						hbox = {
							layoutpolicy_horizontal = expanding
							margin = { 3 0 }
							margin_top = 1

							text_single = {
								name = "character_name"
								raw_text = "[Character.GetUINameNotMeNoTooltip], "
								margin_left = 2
								max_width = 398
								fontsize = 20
								fontsize_min = 14
								align = nobaseline
								default_format = "#medium"
								tooltip = "[Character.GetUINameNotMeNoTooltip]"
							}

							text_single = {
								name = "character_age"
								raw_text = " [Character.GetAge]"
								default_format = "#low"
								tooltip = "[Character.GetDeathOrBirthDateInfo]"
								fontsize = 20
								max_width = 28
								align = nobaseline
							}

							hbox = {
								margin_left = 4
								spacing = -3

								icon = {
									visible = "[Not(Character.IsDeadAndValid)]"
									size = { 23 23 }
									framesize = { 60 60 }
									frame = "[Character.GetHealthIconFrame]"
									texture = "gfx/interface/icons/character_status/icon_health.dds"
									tooltip = "[Character.GetHealthInfo]"
								}
								icon = {
									visible = "[Character.IsDeadAndValid]"
									size = { 23 23 }
									texture = "gfx/interface/icons/character_status/icon_dead.dds"
									tooltip = "CHARACTER_DEAD_TOOLTIP"
								}
							}

							expand = {}
						}

						hbox_character_relation_and_ai = {
							name = "character_relation_and_ai"
							margin = { 3 0 }
						}
					}

					## Traits
					hbox_traits_list = {
						name = "tutorial_highlight_traits"
						datacontext = "[CharacterWindow.GetTraitArrays]"
						margin_bottom = 2
					}
				}

				divider_light = {
					layoutpolicy_horizontal = expanding
				}

				## Skills, Culture, Religion
				hbox = {
					name = "skills_culture_religion"
					layoutpolicy_horizontal = expanding

					background = {
						using = Background_Area
					}

					hbox = {
						name = "tutorial_highlight_skills"

						hbox = {
							name = "skills_grid"
							datamodel = "[CharacterWindow.GetSkills]"
							margin = { 2 0 }

							using = Animation_Character_Window_Refresh

							item = {
								vbox = {
									tooltip = "SKILL_ITEM_TOOLTIP"
									using = tooltip_ne
									spacing = -3

									icon = {
										name = "skill_icon"
										size = { 32 32 }
										framesize = { 60 60 }
										frame = "[SkillItem.GetFrame]"
										texture = "gfx/interface/icons/icon_skills.dds"
									}

									text_single = {
										name = "skill_value"
										text = "[SkillItem.GetValue]"
										default_format = "#high"
										align = nobaseline

										background = {
											name = "skill_icon_bg"
											texture = "gfx/interface/window_character/character_view_skills_bg.dds"
											frame = "[SkillItem.GetFrame]"
											framesize = { 70 26 }
											margin = { 10 0 }
										}
									}
								}
							}
						}

						hbox = {
							spacing = -5
							vbox = {
								tooltip = "[CharacterWindow.GetCharacter.GetProwessBreakdown]"
								using = tooltip_ne
								spacing = -3

								using = Animation_Character_Window_Refresh

								icon = {
									name = "prowess_icon"
									size = { 32 32 }
									texture = "gfx/interface/icons/icon_prowess.dds"
								}

								text_single = {
									name = "prowess_value"
									text = "[CharacterWindow.GetCharacter.GetProwess|0]"
									align = nobaseline
								}
							}
						}

						vbox = {
							tooltip = "ADMIN_WINDOW_THEME_GOVERNOR_EFFICIENCY_TT"
							using = tooltip_ne
							spacing = -3
							visible = "[Or( Character.GetGovernment.HasRule( 'administrative' ), And( And( Not( Character.HasLandedTitles ), Not( Character.HasLiege ) ), GetPlayer.GetGovernment.HasRule( 'administrative' ) ) )]"
							margin_right = 3

							using = Animation_Character_Window_Refresh

							icon = {
								name = "char_governor_efficiency_icon"
								size = { 32 32 }
								texture = "gfx/interface/icons/icon_skill_governor_efficiency.dds"
							}

							text_single = {
								name = "char_governor_efficiency_value"
								text = "ADMIN_WINDOW_THEME_GOVERNOR_EFFICIENCY_VALUE"
								align = nobaseline
							}
						}

						divider_light = {
							layoutpolicy_vertical = expanding
						}

						spacer = {
							size = { 5 5 }
						}
					}

					hbox = {
						name = "faith_and_culture"
						layoutpolicy_horizontal = expanding

						using = Animation_Character_Window_Refresh

						button_religion_icon = {
							name = "faith_button"
							datacontext = "[Character.GetFaith]"
							size = { 45 45 }
						}

						vbox = {
							layoutpolicy_horizontal = expanding

							button_tertiary = {
								datacontext = "[Character.GetFaith]"
								layoutpolicy_horizontal = expanding
								size = { 0 25 }
								onclick = "[OpenGameViewData( 'faith', Faith.GetID )]"
								text = "FAITH_CHARACTER_WINDOW"
								default_format = "#clickable;italic"
								align = left|nobaseline
								margin_left = 5

								tooltipwidget = { faith_tooltip_click = {} }
							}

							button_tertiary = {
								datacontext = "[Character.GetCulture]"
								layoutpolicy_horizontal = expanding
								size = { 0 25 }
								onclick = "[OpenGameViewData( 'culture_window', Culture.GetID )]"
								text = "CULTURE_CHARACTER_WINDOW"
								default_format = "#clickable;italic"
								align = left|nobaseline
								margin_left = 5

								tooltipwidget = {
									culture_tooltip_click = {}
								}
							}
						}
					}

					vbox = {
						layoutpolicy_vertical = expanding
						margin = { 0 0 }

						using = Animation_Character_Window_Refresh

						button_group = {
							onclick = "[CharacterWindow.ToggleExpandedModifiers]"
							tooltip = "CHARACTER_WINDOW_MODIFIERS"

							button_tertiary = {
								size = { 100% 100% }
							}

							hbox = {
								set_parent_size_to_minimum = yes
								margin = { 2 2 }

								fixedgridbox = {
									name = "modifiers_grid"
									datamodel = "[CharacterWindow.GetTimedModifiers]"
									addcolumn = 23
									addrow = 23
									datamodel_wrap = 2
									maxhorizontalslots = 2
									maxverticalslots = 2

									layoutpolicy_vertical = expanding

									using = Animation_Character_Window_Refresh

									item = {
										widget = {
											size = { 23 23 }

											modifier_item_icon = {
												parentanchor = center
												size = { 20 20 }

												blockoverride "input_info_text" {
													text = "CHARACTER_WINDOW_MODIFIERS"
												}
											}
										}
									}
								}

								text_single = {
									visible = "[CharacterWindow.IsExtraModifiersNumberShown]"
									min_width = 22
									margin_bottom = 10
									text = "CHARACTER_WINDOW_EXTRA_MODIFIERS"
									default_format = "#low"
								}
							}
						}

						expand = {}
					}

					expand = {}
				}
			}

			divider_light = {
				layoutpolicy_vertical = expanding
			}

			## House
			widget = {
				name = "house"
				datacontext = "[Character.GetHouse]"
				layoutpolicy_vertical = expanding
				size = { 125 0 }

				using = Animation_Character_Window_Refresh

				vbox = {
					expand = {
						maximumsize = { 0 5 }
					}

					coa_house_big = {
						flowcontainer = {
							name = "characters_status_in_house"
							parentanchor = bottom|right
							position = { -10 0 }
							ignoreinvisible = yes

							icon = {
								name = "bastard"
								visible = "[Not(Character.IsLegitimateMemberOfHouse)]"
								framesize = { 40 40 }
								frame = 4
								size = { 20 20 }
								texture = "gfx/interface/icons/portraits/relation.dds"
								tooltip = "CV_TT_BASTARD"
							}

							icon = {
								name = "head_icon"
								visible = "[LessThan_int32(Character.GetDynastyHeadRelationFrame('(bool)no'), '(int32)9')]"
								size = { 20 20 }

								texture = "gfx/interface/icons/portraits/relation.dds"
								framesize = { 40 40 }
								frame = "[Character.GetDynastyHeadRelationFrame('(bool)no')]"
								tooltip = "[Character.GetDynastyHeadTooltip]"
							}
						}
					}

					text_multi = {
						autoresize = yes
						maximumsize = { 118 50 }
						text = "[DynastyHouse.GetBaseNameNoTooltip]"
						default_format = "#high"
						align = top|hcenter
					}

					text_multi = {
						autoresize = yes
						maximumsize = { 118 50 }
						visible = "[Not(DynastyHouse.IsValid)]"
						text = "[lowborn|E]"
						default_format = "#high"
						align = top|hcenter
					}

					expand = {}
				}
			}
		}

		#########################
		### Realm, external info

		widget = {
			datacontext = "[GetIllustration( 'character_location_exterior' )]"
			layoutpolicy_horizontal = expanding
			size = { 0 232 }
			using = Animation_ShowHide_Quick
			visible = "[Not( GreaterThan_CFixedPoint( GetPlayer.MakeScope.Var('hide_ui_realm').GetValue, '(CFixedPoint)0' ) )]"

			background = {
				using = Background_Bottom_Fade
				margin_bottom = 3
				alpha = 0.75
			}

			widget = {
				size = { 100% 100% }

				using = Animation_Character_Window_Refresh

				background = {
					texture = "[Illustration.GetTexture( Character.MakeScope )]"
					alpha = 0.35
					fittype = centercrop

					modify_texture = {
						texture = "gfx/interface/component_masks/mask_fade_vertical.dds"
						blend_mode = alphamultiply
						mirror = vertical
					}

					using = Mask_Rough_Edges
				}
			}

			vbox = {
				name = "realm_info"
				min_width = 592

				hbox_character_view_secondary_stats_bar = {}

				hbox = {
					layoutpolicy_horizontal = expanding
					layoutpolicy_vertical = expanding

					vbox = {
						name = "realm_shield"
						visible = "[Character.HasLandedTitles]"
						layoutpolicy_vertical = expanding
						spacing = 4
						margin_top = -4

						using = Animation_Character_Window_Refresh

						coa_realm_medium_crown = {
							datacontext = "[Character]"

							blockoverride "coa_button"
							{
								name = "realm_shield"
								tooltip = "[Character.GetDefaultRealmFlagTooltipPrimaryTitleClickInfo]"
								onclick = "[DefaultOnCoatOfArmsClick(Character.GetPrimaryTitle.GetID)]"
							}
						}

						vbox = {
							datacontext = "[CharacterWindow.GetCharacter]"
							visible = "[And( Not( Character.GetPrimaryTitle.HasFaction ), And( Character.HasLandedTitles, Character.IsAlive ) )]"
							tooltip = "[Character.GetDomainLimitTooltip]"
							spacing = -2

							background = {
								visible = "[GreaterThan_int32( Character.GetDomainSize, Character.GetDomainLimit )]"
								using = Status_Bad
							}

							icon = {
								name = "domain_icon"
								size = { 30 30 }
								texture = "gfx/interface/icons/icon_domain.dds"
							}

							text_single = {
								name = "domain_limit"
								text = "[Character.GetDomainSize]/[Character.GetDomainLimit]"
								default_format = "#high"
								align = center|nobaseline
							}
						}

						flowcontainer = {
							margin = { 3 2 }
							ignoreinvisible = yes

							background = {
								using = Background_Area_Dark
							}

							flowcontainer = {
								visible = "[Character.IsTheocraticLessee]"
								tooltip = "CV_THEOCRACY_LESSEE_TOOLTIP"
								spacing = -2
								direction = vertical

								icon = {
									name = "theocracy_lessee_info"
									texture = "gfx/interface/icons/icon_holding_church.dds"
									size = { 30 30 }
								}

								text_single = {
									name = "domain_limit"
									parentanchor = hcenter
									text = "[Character.GetNumTitlesFromTheocraticLease]"
									default_format = "#high"
									align = center|nobaseline
								}
							}

							icon = {
								name = "religious_head_info"
								visible = "[Character.IsReligiousHead]"
								size = { 30 30 }
								texture = "gfx/interface/icons/icon_head_of_faith_income.dds"
								tooltip = "CV_THEOCRACY_RELIGIOUS_HEAD_TOOLTIP"
							}
						}

						expand = {}
					}

					vbox = {
						layoutpolicy_horizontal = expanding
						layoutpolicy_vertical = expanding
						margin_left = 5

						## Realm name and stats
						hbox = {
							name = "name_and_stats"
							layoutpolicy_horizontal = expanding
							margin_right = 10

							using = Animation_Character_Window_Refresh

							vbox = {
								visible = "[Not(Character.HasLandedTitles)]"
								layoutpolicy_horizontal = expanding
								margin = { 10 0 }
								max_width = 280

								text_single = {
									name = "character_title"
									layoutpolicy_horizontal = expanding
									text = "CV_UNLANDED"
									using = Font_Size_Medium
									align = nobaseline
								}

								text_single = {
									name = "government_type"
									layoutpolicy_horizontal = expanding
									text = "[Character.GetLocationDesc]"
									default_format = "#low"
									format_override = { high medium }
									format_override = { V medium }
									align = nobaseline
									autoresize = no
								}
							}

							realm_name_and_type_vbox = {
								name = "realm_name_and_type"
								visible = "[Character.HasLandedTitles]"
								datacontext = "[Character.GetPrimaryTitle]"
								max_width = 250
							}

							expand = {}
						}

						hbox = {
							layoutpolicy_horizontal = expanding
							layoutpolicy_vertical = expanding
							margin_right = 2

							vbox_titles_claims_box = {
								visible = "[Not( Character.GetPrimaryTitle.HasFaction )]"
								layoutpolicy_horizontal = expanding
								layoutpolicy_vertical = expanding

								using = Animation_Character_Window_Refresh

								blockoverride "titles_extra_items"
								{
									visible = "[GreaterThan_int32( GetDataModelSize(CharacterWindow.GetTitles), '(int32)8' )]"
									text = "[GetNumberAbove_int32( GetDataModelSize(CharacterWindow.GetTitles), '(int32)8' )|=]"
								}

								blockoverride "titles_max_slots"
								{
									datamodel_wrap = 8
								}

								blockoverride "claims_extra_items"
								{
									visible = "[GreaterThan_int32( GetDataModelSize(CharacterWindow.GetClaims), '(int32)8' )]"
									text = "[GetNumberAbove_int32(GetDataModelSize(CharacterWindow.GetClaims), '(int32)8' )|=]"
								}

								blockoverride "claims_max_slots"
								{
									datamodel_wrap = 8
								}
							}

							expand = {
								layoutpolicy_horizontal = expanding
								visible = "[Character.GetPrimaryTitle.HasFaction]"
							}
							expand = {}
						}
						expand = {}
					}

					expand = {}

					vbox = {
						name = "diplomacy_items"

						layoutpolicy_vertical = expanding

						vbox_diplomacy_box = {
							visible = "[GreaterThan_int32( GetDataModelSize(CharacterWindow.GetDiplomacyItems), '(int32)0' )]"
							margin_top = 4
							margin_right = 5
							using = Animation_Character_Window_Refresh

							blockoverride "diplomacy_extra_items"
							{
								visible = "[GreaterThan_int32( GetDataModelSize(CharacterWindow.GetDiplomacyItems), '(int32)4' )]"
								text = "[GetNumberAbove_int32( GetDataModelSize(CharacterWindow.GetDiplomacyItems), '(int32)4' )|=]"
							}

							blockoverride "diplomacy_slots"
							{
								maxverticalslots = 2
								maxhorizontalslots = 2
								datamodel_wrap = 2
							}
						}
						expand = {}
					}
				}
			}
		}

		######################################################
		################### BOTTOM AREA ######################
		######################################################

		### TABS
		hbox = {
			name = "tabs"
			visible = "[And(CharacterWindow.AreNoneExpanded, Not( GreaterThan_CFixedPoint( GetPlayer.MakeScope.Var('hide_ui_character_sheet_bottom').GetValue, '(CFixedPoint)0' ) ))]"
			layoutpolicy_horizontal = expanding
			using = Animation_ShowHide_Quick

			button_tab = {
				name = "family_button"
				datacontext = "[CharacterWindow.GetCharacter]"
				layoutpolicy_horizontal = expanding

				onclick = "[CharacterWindow.SetTab('family')]"
				down = "[CharacterWindow.IsTabShown('family')]"

				using = tooltip_above

				hbox = {
					text_single = {
						layoutpolicy_horizontal = expanding
						align = center
						text = "CV_TAB_FAMILY"
						default_format = "#low"
					}

					text_single = {
						align = center
						text = "[CharacterWindow.GetTabItemsCount('family')]"
						default_format = "#low"
						margin_right = 15
						min_width = 30

						using = Animation_Character_Window_Refresh
					}
				}
			}

			button_tab = {
				name = "relations_button"
				datacontext = "[CharacterWindow.GetCharacter]"
				layoutpolicy_horizontal = expanding

				onclick = "[CharacterWindow.SetTab('relations')]"
				down = "[CharacterWindow.IsTabShown('relations')]"

				using = tooltip_above

				hbox = {
					text_single = {
						layoutpolicy_horizontal = expanding
						align = center
						text = "CV_TAB_RELATIONS"
						default_format = "#low"
					}

					text_single = {
						align = center
						text = "[CharacterWindow.GetTabItemsCount('relations')]"
						default_format = "#low"
						margin_right = 15
						min_width = 30

						using = Animation_Character_Window_Refresh
					}
				}
			}

			button_tab = {
				name = "court_button"
				datacontext = "[CharacterWindow.GetCharacter]"
				#	visible = "[Not(Character.IsPlayer)]"
				layoutpolicy_horizontal = expanding

				onclick = "[CharacterWindow.SetTab('court')]"
				down = "[CharacterWindow.IsTabShown('court')]"

				using = tooltip_above

				hbox = {
					text_single = {
						layoutpolicy_horizontal = expanding
						align = center
						text = "CV_TAB_COURT"
						default_format = "#low"
					}

					text_single = {
						align = center
						text = "[CharacterWindow.GetTabItemsCount('court')]"
						default_format = "#low"
						margin_right = 15
						min_width = 30

						using = Animation_Character_Window_Refresh
					}
				}
			}

			button_tab = {
				name = "vassals_button"
				datacontext = "[CharacterWindow.GetCharacter]"
				visible = "[And( Character.IsRuler, Not( IsLandlessAdventurer( Character ) ) )]"

				layoutpolicy_horizontal = expanding

				onclick = "[CharacterWindow.SetTab('subjects')]"
				down = "[CharacterWindow.IsTabShown('subjects')]"

				using = tooltip_above

				hbox = {
					text_single = {
						layoutpolicy_horizontal = expanding
						align = center
						text = "CV_TAB_SUBJECTS"
						default_format = "#low"
					}

					text_single = {
						align = center
						text = "[CharacterWindow.GetTabItemsCount('subjects')]"
						default_format = "#low"
						margin_right = 15
						min_width = 30

						using = Animation_Character_Window_Refresh
					}
				}
			}
		}

		spacer = { size = { 0 2 } }

		widget = {
			visible = "[CharacterWindow.AreNoneExpanded]"
			layoutpolicy_vertical = preferred
			layoutpolicy_horizontal = expanding
			size = { 0 350 }

			using = Animation_Tab_Switch

			####################################
			########### FAMILY TAB #############
			####################################

			widget = {
				name = "family"
				visible = "[And(CharacterWindow.IsTabShown('family'), Not( GreaterThan_CFixedPoint( GetPlayer.MakeScope.Var('hide_ui_character_sheet_bottom').GetValue, '(CFixedPoint)0' ) ))]"
				size = { 100% 100% }

				using = Animation_Tab_Switch

				vbox = {
					name = "family_main_view"
					visible = "[Not( Or(CharacterWindow.IsRelationExpanded( 'children' ), CharacterWindow.IsRelationExpanded( 'siblings' ) ) )]"

					widget = {
						name = "parents_grandparents_spouses"
						layoutpolicy_horizontal = expanding
						layoutpolicy_vertical = expanding
						maximumsize = { -1 110 }
						scissor = yes

						hbox = {
							vbox_character_row_item = {
								name = "children"
								layoutpolicy_vertical = expanding

								blockoverride "portrait_datamodel" {
									datamodel = "[CharacterWindow.GetParents]"
								}

								blockoverride "header_text"
								{
									text = "PARENTS"
								}

								blockoverride "expand_button" {}
							}

							vbox_character_row_item = {
								name = "grandparents"
								visible = "[Not(Or(GreaterThan_int32( Character.GetMaxSpouses, '(int32)1' ), GreaterThan_int32( Character.GetMaxConsorts, '(int32)0' )))]"
								layoutpolicy_vertical = expanding

								blockoverride "portrait_datamodel" {
									datamodel = "[CharacterWindow.GetGrandparents]"
								}

								blockoverride "header_text"
								{
									text = "GRANDPARENTS"
								}

								blockoverride "expand_button" {}
							}

							vbox_character_row_item = {
								name = "grandparents_contracted"
								visible = "[Or(GreaterThan_int32( Character.GetMaxSpouses, '(int32)1' ), GreaterThan_int32( Character.GetMaxConsorts, '(int32)0' ))]"
								layoutpolicy_vertical = expanding

								blockoverride "portrait_datamodel" {
									datamodel = "[CharacterWindow.GetGrandparents]"
								}

								blockoverride "header_text"
								{
									text = "GRANDPARENTS"
								}

								blockoverride "expand_button" {}

								blockoverride "gridbox"
								{
									overlappingitembox = {
										size = { 170 90 }

										block "portrait_datamodel" {
											datamodel = "[CharacterWindow.GetParents]"
										}

										item = {
											portrait_head_small = {
												blockoverride "portrait_button"
												{
													using = tooltip_ne
												}

											}
										}
									}
								}
							}

							vbox_character_row_item = {
								name = "secondary_spouses"
								visible = "[GreaterThan_int32( Character.GetMaxSpouses, '(int32)1' )]"
								layoutpolicy_vertical = expanding

								blockoverride "portrait_datamodel" {
									datamodel = "[CharacterWindow.GetSecondarySpouses]"
								}

								blockoverride "header_text"
								{
									text = "SECONDARY_SPOUSES"
								}

								blockoverride "expand_button" {}

								blockoverride "find_partner"
								{
									fixedgridbox = {
										name = "potential"
										datamodel = "[GetNullCharacterDataModel( Character.CalcUnusedSecondarySpouseSlots )]"
										visible = "[Character.IsPlayerInteractionShown('marry_off_interaction')]"

										flipdirection = yes
										addcolumn = 85
										addrow = 90

										item = {
											container = {
												portrait_head_small = {
													visible = "[Not( ObjectsEqual( GetPlayer, CharacterWindow.GetCharacter ) )]"

													blockoverride "portrait_button_template_onclick"
													{
														onclick = "[CharacterWindow.GetCharacter.OpenPlayerInteraction('marry_off_interaction')]"
													}
													blockoverride "portrait_button_template_tooltip"
													{
														tooltip = "CHARACTER_WINDOW_FIND_SPOUSE"
													}
													blockoverride "onclick"
													{
														onclick = "[CharacterWindow.GetCharacter.OpenPlayerInteraction('marry_off_interaction')]"

														button_icon = {
															parentanchor = center
															alwaystransparent = yes
															size = { 20 20 }
															position = {-5 -5}
															texture = "gfx/interface/icons/flat_icons/plus.dds"
														}
													}
												}

												portrait_head_small = {
													visible = "[ObjectsEqual( GetPlayer, CharacterWindow.GetCharacter )]"
													blockoverride "portrait_button_template_onclick"
													{
														onclick = "[CharacterWindow.GetCharacter.OpenPlayerInteraction('marry_off_interaction')]"
													}
													blockoverride "portrait_button_template_tooltip"
													{
														tooltip = "CHARACTER_WINDOW_FIND_SPOUSE_SELF"
													}
													blockoverride "onclick"
													{
														onclick = "[CharacterWindow.GetCharacter.OpenPlayerInteraction('marry_off_interaction')]"

														button_icon = {
															parentanchor = center
															alwaystransparent = yes
															size = { 26 26 }
															position = {-5 0}
															texture = "gfx/interface/icons/flat_icons/plus.dds"
														}
													}
												}
											}
										}
									}
								}
							}

							vbox_character_row_item = {
								name = "consorts"
								visible = "[GreaterThan_int32( Character.GetMaxConsorts, '(int32)0' )]"
								layoutpolicy_vertical = expanding

								blockoverride "portrait_datamodel" {
									datamodel = "[CharacterWindow.GetConcubines]"
								}

								blockoverride "header_text"
								{
									text = "CONCUBINES"
								}

								blockoverride "expand_button" {}

								blockoverride "find_partner"
								{
									fixedgridbox = {
										name = "potential"
										datamodel = "[GetNullCharacterDataModel( Character.CalcUnusedConsortSlots )]"
										visible = "[Character.IsPlayerInteractionShown('find_concubine')]"

										flipdirection = yes
										addcolumn = 85
										addrow = 90
										maxverticalslots = 1

										item = {
											container = {
												portrait_head_small = {
													blockoverride "portrait_button_template_onclick"
													{
														onclick = "[CharacterWindow.GetCharacter.OpenPlayerInteraction('find_concubine')]"
														enabled = "[CharacterWindow.GetCharacter.IsPlayerInteractionValid('find_concubine')]"

														button_plus = {
															parentanchor = center
															alwaystransparent = yes
														}
													}
													blockoverride "portrait_button_template_tooltip"
													{
														tooltip = "[CharacterWindow.GetCharacter.GetPlayerInteractionTooltip('find_concubine')]"
													}
												}
											}
										}
									}
								}
							}

							expand = {}
						}
					}

					widget = {
						name = "children"
						layoutpolicy_horizontal = expanding
						layoutpolicy_vertical = expanding
						maximumsize = { -1 110 }
						scissor = yes

						vbox_character_row_item = {
							name = "children"

							blockoverride "portrait_datamodel" {
								datamodel = "[CharacterWindow.GetChildren]"
							}

							blockoverride "header_text"
							{
								text = "CV_CHILDREN_HEADING"
							}

							blockoverride "remaining_items"
							{
								visible = "[GreaterThan_int32( GetDataModelSize(CharacterWindow.GetChildren), '(int32)7' )]"
								text = "[GetNumberAbove_int32( GetDataModelSize(CharacterWindow.GetChildren), '(int32)7' )|=]"
							}

							blockoverride "expand_button_inside" {
								visible = "[GreaterThan_int32( GetDataModelSize(CharacterWindow.GetChildren), '(int32)7' )]"
								onclick = "[CharacterWindow.ToggleExpandedRelation( 'children' )]"
							}
						}
					}

					widget = {
						name = "siblings"
						layoutpolicy_horizontal = expanding
						layoutpolicy_vertical = expanding
						maximumsize = { -1 110 }
						scissor = yes

						vbox_character_row_item = {
							name = "siblings"

							blockoverride "portrait_datamodel" {
								datamodel = "[CharacterWindow.GetSiblings]"
							}

							blockoverride "header_text"
							{
								text = "CV_SIBLINGS_HEADING"
							}

							blockoverride "remaining_items"
							{
								visible = "[GreaterThan_int32( GetDataModelSize(CharacterWindow.GetSiblings), '(int32)7' )]"
								text = "[GetNumberAbove_int32( GetDataModelSize(CharacterWindow.GetSiblings), '(int32)7' )|=]"
							}

							blockoverride "expand_button_inside" {
								visible = "[GreaterThan_int32( GetDataModelSize(CharacterWindow.GetSiblings), '(int32)7' )]"
								onclick = "[CharacterWindow.ToggleExpandedRelation( 'siblings' )]"
							}
						}
					}

					expand = {}
				}

				### SIBLINGS EXPANDED
				scrollbox = {
					name = "family_siblings_expanded"
					visible = "[CharacterWindow.IsRelationExpanded( 'siblings' )]"
					size = { 100% 100% }

					blockoverride "scrollbox_replace_vbox" {
						vbox_character_row_item = {
							name = "siblings"
							margin_top = 10
							spacing = 5

							blockoverride "portrait_datamodel" {
								datamodel = "[CharacterWindow.GetSiblings]"
							}

							blockoverride "header_text"
							{
								text = "CV_SIBLINGS_HEADING"
							}

							blockoverride "expand_button_inside" {
								onclick = "[CharacterWindow.ToggleExpandedRelation( 'siblings' )]"
								down = "[CharacterWindow.IsRelationExpanded( 'siblings' )]"
							}

							blockoverride "gridbox_slots" {}
						}
					}
				}

				### CHILDREN EXPANDED
				scrollbox = {
					name = "family_children_expanded"
					visible = "[CharacterWindow.IsRelationExpanded( 'children' )]"
					size = { 100% 100% }

					blockoverride "scrollbox_replace_vbox" {
						vbox_character_row_item = {
							name = "children"
							margin_top = 10
							spacing = 5

							blockoverride "portrait_datamodel" {
								datamodel = "[CharacterWindow.GetChildren]"
							}

							blockoverride "header_text"
							{
								text = "CV_CHILDREN_HEADING"
							}

							blockoverride "expand_button_inside" {
								onclick = "[CharacterWindow.ToggleExpandedRelation( 'children' )]"
								down = "[CharacterWindow.IsRelationExpanded( 'children' )]"
							}

							blockoverride "gridbox_slots" {}
						}
					}
				}
			}

			####################################
			########## RELATIONS TAB ###########
			####################################

			widget = {
				name = "relations"
				visible = "[CharacterWindow.IsTabShown('relations')]"
				size = { 100% 100% }

				using = Animation_Tab_Switch

				vbox = {
					name = "relations_main_view"
					visible = "[And(Not(CharacterWindow.AreRelationsExpanded( 'friends', 'rivals', 'lovers') ), Not(CharacterWindow.IsRelationExpanded('grudges'))) ]"

					widget = {
						name = "first_row"
						layoutpolicy_horizontal = expanding
						layoutpolicy_vertical = expanding
						maximumsize = { -1 110 }
						scissor = yes

						hbox = {
							vbox_character_row_item = {
								name = "wards"
								visible = "[CharacterWindow.GetCharacter.IsAdult]"
								layoutpolicy_vertical = expanding

								blockoverride "portrait_datamodel" {
									datamodel = "[CharacterWindow.GetRelationsOfType( GetRelation( 'ward' ) )]"
								}

								blockoverride "header_text"
								{
									text = "WARDS_LABEL"
								}

								blockoverride "expand_button" {}

								### WARD FINDER
								blockoverride "find_partner"
								{

									### FIND WARD FOR ME
									fixedgridbox = {
										name = "educate_ward"
										datamodel = "[GetNullCharacterDataModel( CharacterWindow.CalcUnusedRelationSlots( GetRelation( 'ward' ), '(int32)2' ) )]"
										visible = "[Character.IsPlayerInteractionShown('educate_child_interaction')]"

										flipdirection = yes
										addcolumn = 85
										addrow = 90
										maxverticalslots = 1

										item = {
											container = {
												portrait_head_small = {
													blockoverride "portrait_button_template_onclick"
													{
														onclick = "[CharacterWindow.GetCharacter.OpenPlayerInteraction( 'educate_child_interaction' )]"

														button_icon = {
															parentanchor = center
															alwaystransparent = yes
															size = { 26 26 }
															position = {-2 -4}
															texture = "gfx/interface/icons/flat_icons/plus.dds"
														}
													}
													blockoverride "portrait_button_template_tooltip"
													{
														tooltip = "[CharacterWindow.GetCharacter.GetPlayerInteractionTooltip( 'educate_child_interaction' )]"
													}
												}
											}
										}
									}

									### FIND WARD FOR COURTIER
									fixedgridbox = {
										name = "find_ward"
										datamodel = "[GetNullCharacterDataModel( CharacterWindow.CalcUnusedRelationSlots( GetRelation( 'ward' ), '(int32)2' ) )]"
										visible = "[Character.IsPlayerInteractionShown('offer_ward_interaction')]"

										flipdirection = yes
										addcolumn = 85
										addrow = 90
										maxverticalslots = 1

										item = {
											container = {
												portrait_head_small = {
													blockoverride "portrait_button_template_onclick"
													{
														onclick = "[CharacterWindow.GetCharacter.OpenPlayerInteraction( 'offer_ward_interaction' )]"
														enabled = "[CharacterWindow.GetCharacter.IsPlayerInteractionValid( 'offer_ward_interaction' )]"

														button_icon = {
															parentanchor = center
															alwaystransparent = yes
															size = { 20 20 }
															position = {-2 -5}
															texture = "gfx/interface/icons/flat_icons/plus.dds"
														}
													}
													blockoverride "portrait_button_template_tooltip"
													{
														tooltip = "[CharacterWindow.GetCharacter.GetPlayerInteractionTooltip( 'offer_ward_interaction' )]"
													}
												}
											}
										}
									}
								}
							}

							vbox_character_row_item = {
								name = "diarch"
								datacontext = "[CharacterWindow.GetCharacter.GetDiarchy.GetDiarch]"
								visible = "[CharacterWindow.GetCharacter.HasActiveDiarchy]"
								layoutpolicy_vertical = expanding

								blockoverride "minimum_width" {}

								blockoverride "gridbox" {
									portrait_head_small = {

										blockoverride "portrait_button"
										{
											using = tooltip_ne
										}
										blockoverride "glow_visible"
										{
											visible = no
										}
									}
								}

								blockoverride "header_text"
								{
									text = "[CharacterWindow.GetCharacter.GetDiarchTitle]"
									max_width = 75
								}

								blockoverride "expand_button" {}
							}

							### LOVERS 5 PORTRAITS
							vbox_character_row_relationship_item = {
								name = "lovers_no_diarchy"
								visible = "[And( CharacterWindow.GetCharacter.IsAdult, Not( CharacterWindow.GetCharacter.HasActiveDiarchy ) )]"
								layoutpolicy_vertical = expanding
								layoutpolicy_horizontal = expanding

								blockoverride "portrait_datamodel" {
									datamodel = "[CharacterWindow.GetRelationsOfType( GetRelation( 'lover' ) )]"
								}

								blockoverride "header_text"
								{
									text = "LOVERS_LABEL"
								}

								blockoverride "remaining_items"
								{
									visible = "[GreaterThan_int32( GetDataModelSize( CharacterWindow.GetRelationsOfType( GetRelation( 'lover' ) ) ), '(int32)5' )]"
									text = "[GetNumberAbove_int32( GetDataModelSize( CharacterWindow.GetRelationsOfType( GetRelation( 'lover' ) ) ), '(int32)5' )|=]"
								}

								blockoverride "expand_button_inside" {
									visible = "[GreaterThan_int32( GetDataModelSize( CharacterWindow.GetRelationsOfType( GetRelation( 'lover' ) ) ), '(int32)5' )]"
									onclick = "[CharacterWindow.ToggleExpandedRelation( 'lovers' )]"
								}

								blockoverride "gridbox_slots"
								{
									maxhorizontalslots = 5
								}
							}

							### LOVERS 4 PORTRAITS (FOR WHEN REGENT PORTRAIT IS VISIBLE)
							vbox_character_row_relationship_item = {
								name = "lovers_diarchy"
								visible = "[And( CharacterWindow.GetCharacter.IsAdult, CharacterWindow.GetCharacter.HasActiveDiarchy )]"
								layoutpolicy_vertical = expanding
								layoutpolicy_horizontal = expanding

								blockoverride "portrait_datamodel" {
									datamodel = "[CharacterWindow.GetRelationsOfType( GetRelation( 'lover' ) )]"
								}

								blockoverride "header_text"
								{
									text = "LOVERS_LABEL"
								}

								blockoverride "remaining_items"
								{
									visible = "[GreaterThan_int32( GetDataModelSize( CharacterWindow.GetRelationsOfType( GetRelation( 'lover' ) ) ), '(int32)5' )]"
									text = "[GetNumberAbove_int32( GetDataModelSize( CharacterWindow.GetRelationsOfType( GetRelation( 'lover' ) ) ), '(int32)5' )|=]"
								}

								blockoverride "expand_button_inside" {
									visible = "[GreaterThan_int32( GetDataModelSize( CharacterWindow.GetRelationsOfType( GetRelation( 'lover' ) ) ), '(int32)5' )]"
									onclick = "[CharacterWindow.ToggleExpandedRelation( 'lovers' )]"
								}

								blockoverride "gridbox_slots"
								{
									maxhorizontalslots = 4
								}
							}

							vbox_character_row_item = {
								name = "guardian"
								visible = "[Not(CharacterWindow.GetCharacter.IsAdult)]"
								layoutpolicy_vertical = expanding

								blockoverride "portrait_datamodel" {
									datamodel = "[CharacterWindow.GetRelationsOfType( GetRelation( 'guardian' ) )]"
								}

								blockoverride "header_text"
								{
									text = "GUARDIAN_LABEL"
								}

								blockoverride "expand_button" {}

								### GUARDIAN FINDER
								blockoverride "find_partner"
								{
									### FIND GUARDIAN FOR ME
									fixedgridbox = {
										name = "educate_child"
										datamodel = "[GetNullCharacterDataModel( CharacterWindow.CalcUnusedRelationSlots( GetRelation( 'guardian' ), '(int32)1' ) )]"
										visible = "[Character.IsPlayerInteractionShown( 'educate_child_interaction' )]"

										flipdirection = yes
										addcolumn = 85
										addrow = 90
										maxverticalslots = 1

										item = {
											container = {
												portrait_head_small = {
													blockoverride "portrait_button_template_onclick"
													{
														onclick = "[CharacterWindow.GetCharacter.OpenPlayerInteraction( 'educate_child_interaction' )]"

														button_icon = {
															parentanchor = center
															alwaystransparent = yes
															size = { 20 20 }
															position = {-2 -5}
															texture = "gfx/interface/icons/flat_icons/plus.dds"
														}
													}
													blockoverride "portrait_button_template_tooltip"
													{
														tooltip = "[CharacterWindow.GetCharacter.GetPlayerInteractionTooltip( 'educate_child_interaction' )]"
													}
												}
											}
										}
									}

									### GUARDIAN FINDER FOR COURTIER
									fixedgridbox = {
										name = "find_guardian"
										datamodel = "[GetNullCharacterDataModel( CharacterWindow.CalcUnusedRelationSlots( GetRelation( 'guardian' ), '(int32)1' ) )]"
										visible = "[Character.IsPlayerInteractionShown( 'offer_guardianship_interaction' )]"

										flipdirection = yes
										addcolumn = 85
										addrow = 90
										maxverticalslots = 1

										item = {
											container = {
												portrait_head_small = {
													blockoverride "portrait_button_template_onclick"
													{
														onclick = "[CharacterWindow.GetCharacter.OpenPlayerInteraction( 'offer_guardianship_interaction' )]"
														enabled = "[CharacterWindow.GetCharacter.IsPlayerInteractionValid( 'offer_guardianship_interaction' )]"
														button_icon = {
															parentanchor = center
															alwaystransparent = yes
															size = { 26 26 }
															position = {-2 -4}
															texture = "gfx/interface/icons/flat_icons/plus.dds"
														}
													}
													blockoverride "portrait_button_template_tooltip"
													{
														tooltip = "[CharacterWindow.GetCharacter.GetPlayerInteractionTooltip( 'offer_guardianship_interaction' )]"
													}
												}
											}
										}
									}
								}
							}

							vbox_character_row_item = {
								name = "crushes"
								visible = "[Not(CharacterWindow.GetCharacter.IsAdult)]"
								layoutpolicy_vertical = expanding

								blockoverride "portrait_datamodel" {
									datamodel = "[CharacterWindow.GetRelationsOfType( GetRelation( 'crush' ) )]"
								}

								blockoverride "header_text"
								{
									text = "CRUSHES_LABEL"
								}

								blockoverride "expand_button" {}
							}

							expand = {}
						}
					}

					widget = {
						name = "second_row"
						layoutpolicy_horizontal = expanding
						layoutpolicy_vertical = expanding
						maximumsize = { -1 110 }
						scissor = yes

						hbox = {
							vbox_character_row_relationship_item = {
								name = "friends"
								layoutpolicy_vertical = expanding
								layoutpolicy_horizontal = expanding

								blockoverride "portrait_datamodel" {
									datamodel = "[CharacterWindow.GetRelationsOfType( GetRelation( 'friend' ) )]"
								}

								blockoverride "header_text"
								{
									text = "FRIENDS_LABEL"
								}

								blockoverride "remaining_items"
								{
									visible = "[GreaterThan_int32( GetDataModelSize( CharacterWindow.GetRelationsOfType( GetRelation( 'friend' ) ) ), '(int32)7' )]"
									text = "[GetNumberAbove_int32( GetDataModelSize( CharacterWindow.GetRelationsOfType( GetRelation( 'friend' ) ) ), '(int32)7' )|=]"
								}

								blockoverride "expand_button_inside" {
									visible = "[GreaterThan_int32( GetDataModelSize( CharacterWindow.GetRelationsOfType( GetRelation( 'friend' ) ) ), '(int32)7' )]"
									onclick = "[CharacterWindow.ToggleExpandedRelation( 'friends' )]"
								}
							}

							expand = {}
						}
					}

					widget = {
						name = "third_row"
						layoutpolicy_horizontal = expanding
						layoutpolicy_vertical = expanding
						maximumsize = { -1 110 }
						scissor = yes

						hbox = {
							vbox_character_row_relationship_item = {
								name = "rivals"
								layoutpolicy_vertical = expanding
								layoutpolicy_horizontal = expanding

								blockoverride "portrait_datamodel" {
									datamodel = "[CharacterWindow.GetRelationsOfType( GetRelation( 'rival' ) )]"
								}

								blockoverride "header_text"
								{
									text = "RIVALS_LABEL"
								}

								blockoverride "remaining_items"
								{
									visible = "[GreaterThan_int32( GetDataModelSize(CharacterWindow.GetRelationsOfType( GetRelation( 'rival' ) )), '(int32)7' )]"
									text = "[GetNumberAbove_int32( GetDataModelSize(CharacterWindow.GetRelationsOfType( GetRelation( 'rival' ) )), '(int32)7' )|=]"
								}

								blockoverride "expand_button_inside" {
									visible = "[GreaterThan_int32( GetDataModelSize(CharacterWindow.GetRelationsOfType( GetRelation( 'rival' ) )), '(int32)7' )]"
									onclick = "[CharacterWindow.ToggleExpandedRelation( 'rivals' )]"
								}
							}

							vbox_character_row_relationship_item = {
								name = "bullies"
								visible = "[Not( CharacterWindow.GetCharacter.IsAdult )]"
								layoutpolicy_vertical = expanding
								layoutpolicy_horizontal = expanding

								blockoverride "portrait_datamodel" {
									datamodel = "[CharacterWindow.GetRelationsOfType( GetRelation( 'bully' ) )]"
								}

								blockoverride "header_text"
								{
									text = "BULLIES_LABEL"
								}

								blockoverride "expand_button" {}
							}

							vbox_character_row_relationship_item = {
								name = "victims"
								visible = "[Not( CharacterWindow.GetCharacter.IsAdult )]"
								layoutpolicy_vertical = expanding
								layoutpolicy_horizontal = expanding

								blockoverride "portrait_datamodel" {
									datamodel = "[CharacterWindow.GetRelationsOfType( GetRelation( 'victim' ) )]"
								}

								blockoverride "header_text"
								{
									text = "VICTIMS_LABEL"
								}

								blockoverride "expand_button" {}
							}

							vbox_character_row_relationship_item = {
								name = "grudges"
								visible = "[GreaterThanOrEqualTo_int32(GetDataModelSize(CharacterWindow.GetRelationsOfType( GetRelation( 'grudge' ) )), '(int32)1')]"
								layoutpolicy_vertical = expanding

								blockoverride "portrait_datamodel" {
									datamodel = "[DataModelFirst(CharacterWindow.GetRelationsOfType( GetRelation( 'grudge' ) ), '(int32)2')]"
								}

								blockoverride "header_text"
								{
									text = "GRUDGES_LABEL"
								}

								blockoverride "remaining_items"
								{
									visible = "[GreaterThan_int32( GetDataModelSize(CharacterWindow.GetRelationsOfType( GetRelation( 'grudge' ) )), '(int32)2' )]"
									text = "[GetNumberAbove_int32( GetDataModelSize(CharacterWindow.GetRelationsOfType( GetRelation( 'grudge' ) )), '(int32)2' )|=]"
								}

								blockoverride "expand_button_inside" {
									visible = "[GreaterThan_int32( GetDataModelSize(CharacterWindow.GetRelationsOfType( GetRelation( 'grudge' ) )), '(int32)2' )]"
									onclick = "[CharacterWindow.ToggleExpandedRelation( 'grudges' )]"
								}
							}

							expand = {}
						}
					}

					expand = {}
				}
				### RIVALS EXPANDED
				scrollbox = {
					name = "rivals_expanded"
					visible = "[CharacterWindow.IsRelationExpanded( 'rivals' )]"
					size = { 100% 100% }

					blockoverride "scrollbox_replace_vbox" {
						vbox_character_row_relationship_item = {
							name = "rivals"
							margin_top = 10
							spacing = 5

							blockoverride "portrait_datamodel" {
								datamodel = "[CharacterWindow.GetRelationsOfType( GetRelation( 'rival' ) )]"
							}

							blockoverride "header_text"
							{
								text = "RIVALS_LABEL"
							}

							blockoverride "expand_button_inside" {
								onclick = "[CharacterWindow.ToggleExpandedRelation( 'rivals' )]"
								down = "[CharacterWindow.IsRelationExpanded( 'rivals' )]"
							}

							blockoverride "gridbox_slots" {}
						}
					}
				}

				### FRIENDS EXPANDED
				scrollbox = {
					name = "friends_expanded"
					visible = "[CharacterWindow.IsRelationExpanded( 'friends' )]"
					size = { 100% 100% }

					blockoverride "scrollbox_replace_vbox" {
						vbox_character_row_relationship_item = {
							name = "friends"
							margin_top = 10
							spacing = 5

							blockoverride "portrait_datamodel" {
								datamodel = "[CharacterWindow.GetRelationsOfType( GetRelation( 'friend' ) )]"
							}

							blockoverride "header_text"
							{
								text = "FRIENDS_LABEL"
							}

							blockoverride "expand_button_inside" {
								onclick = "[CharacterWindow.ToggleExpandedRelation( 'friends' )]"
								down = "[CharacterWindow.IsRelationExpanded( 'friends' )]"
							}

							blockoverride "gridbox_slots" {}
						}
					}
				}

				### LOVERS EXPANDED
				scrollbox = {
					name = "lovers_expanded"
					visible = "[CharacterWindow.IsRelationExpanded( 'lovers' )]"
					size = { 100% 100% }

					blockoverride "scrollbox_replace_vbox" {
						vbox_character_row_relationship_item = {
							name = "friends"
							margin_top = 10
							spacing = 5

							blockoverride "portrait_datamodel" {
								datamodel = "[CharacterWindow.GetRelationsOfType( GetRelation( 'lover' ) )]"
							}

							blockoverride "header_text"
							{
								text = "LOVERS_LABEL"
							}

							blockoverride "expand_button_inside" {
								onclick = "[CharacterWindow.ToggleExpandedRelation( 'lovers' )]"
								down = "[CharacterWindow.IsRelationExpanded( 'lovers' )]"
							}

							blockoverride "gridbox_slots" {}
						}
					}
				}

				### GRUDGES EXPANDED
				scrollbox = {
					name = "grudges_expanded"
					visible = "[CharacterWindow.IsRelationExpanded( 'grudges' )]"
					size = { 100% 100% }

					blockoverride "scrollbox_replace_vbox" {
						vbox_character_row_relationship_item = {
							name = "grudges"
							margin_top = 10
							spacing = 5

							blockoverride "portrait_datamodel" {
								datamodel = "[CharacterWindow.GetRelationsOfType( GetRelation( 'grudge' ) )]"
							}

							blockoverride "header_text"
							{
								text = "GRUDGES_LABEL"
							}

							blockoverride "expand_button_inside" {
								onclick = "[CharacterWindow.ToggleExpandedRelation( 'grudges' )]"
								down = "[CharacterWindow.IsRelationExpanded( 'grudges' )]"
							}

							blockoverride "gridbox_slots" {}
						}
					}
				}
			}

			####################################
			############ COURT TAB #############
			####################################

			vbox_character_list = {
				datacontext = "[CharacterWindow.GetCourt]"
				visible = "[CharacterWindow.IsTabShown('court')]"

				blockoverride "sort_dropdown" {
					dropdown_sort_characterlist = {
						# unique name needed to distinct from vassal sort options
						name = "court_sort_options"
					}
				}

				blockoverride "scrollbox_margins" {
					margin_right = 15
					margin_top = 10
				}

				blockoverride "container_implementation" {
					fixedgridbox = {
						name = "characters_grid"
						datamodel = "[CharacterSelectionList.GetList]"
						visible = "[Not(CharacterSelectionList.IsBuildingList)]"
						addcolumn = 560
						addrow = 125
						setitemsizefromcell = yes

						item = {
							widget_courtier_item = {
								datacontext = "[CharacterListItem.GetCharacter]"

								# blockoverride "description_relation_text" {
								# 	text = "[Character.GetSpecialGuestRelationDescription]"
								# }

								blockoverride "gridbox_items"
								{
									datamodel_wrap = 7
									maxverticalslots = 2
								}

								blockoverride "action_buttons" {}
							}
						}
					}
				}

				blockoverride "character_count"
				{
					hbox = {
						layoutpolicy_horizontal = growing
						margin = { 15 0 }
						margin_bottom = 5
						spacing = 5

						block "bottom_bar" {}

						expand = {}

						widget = {
							size = { 20 15 }

							warning_icon = {
								size = { 20 20 }
								visible = "[Not( CharacterSelectionList.IsAllDefault )]"
								tooltip = "CHARACTER_FINDER_FILTER_SET"
							}
						}

						text_single = {
							name = "character_count"
							datacontext = "[CharacterSelectionList]"
							text = "CHARACTER_FINDER_COUNT"
							default_format = "#low"
						}
					}
				}
			}

			####################################
			########### VASSALS TAB ############
			####################################

			vbox_character_list = {
				visible = "[CharacterWindow.IsTabShown('subjects')]"
				datacontext = "[CharacterWindow.GetVassals]"

				blockoverride "sort_dropdown" {
					dropdown_sort_characterlist = {
						# unique name needed to distinct from court sort options
						name = "vassal_sort_options"
					}
				}

				blockoverride "scrollbox_margins" {
					margin = { 0 5 }
					margin_right = 10
				}

				blockoverride "container_implementation" {
					fixedgridbox = {
						name = "characters_grid"
						datamodel = "[CharacterSelectionList.GetList]"
						visible = "[Not(CharacterSelectionList.IsBuildingList)]"
						addcolumn = 575
						addrow = 125
						setitemsizefromcell = yes

						item = {
							widget_vassal_list_item = {
								datacontext = "[CharacterListItem.GetCharacter]"

								blockoverride "vassal_buttons" {
									hbox = {
										layoutpolicy_horizontal = expanding

										text_single = {
											visible = "[And( Character.IsPowerfulVassal, Character.IsVassalOf( Character.GetOverlord ) )]"
											layoutpolicy_horizontal = expanding

											text = "MY_REALM_WINDOW_POWERFUL_VASSAL"
											align = nobaseline
											max_width = 200
										}

										expand = {}
									}
								}
								blockoverride "own_vassal" {}

								blockoverride "realm_size_powerful_status" {
									hbox = {
										spacing = 10

										text_single = {
											visible = "[NotEqualTo_int32(Character.GetPrimaryTitle.GetTierFrame, '(int32)2')]" #nonbaron
											layoutpolicy_horizontal = expanding

											text = "REALM_WINDOW_SIZE"
											align = nobaseline
											max_width = 200

											tooltip = "REALM_WINDOW_SIZE_TT"
										}

										expand = {}
									}
								}

								blockoverride "release_tributary_button" {}
							}
						}
					}
				}

				blockoverride "character_count"
				{
					hbox = {
						layoutpolicy_horizontal = growing
						margin = { 15 0 }
						margin_bottom = 5
						spacing = 5

						block "bottom_bar" {}

						expand = {}

						widget = {
							size = { 20 15 }

							warning_icon = {
								size = { 20 20 }
								visible = "[Not( CharacterSelectionList.IsAllDefault )]"
								tooltip = "CHARACTER_FINDER_FILTER_SET"
							}
						}

						text_single = {
							name = "character_count"
							datacontext = "[CharacterSelectionList]"
							text = "CHARACTER_FINDER_COUNT"
							default_format = "#low"
						}
					}
				}
			}
		}

		### EXPANDED VIEWS

		# TRAITS EXPANDED
		scrollbox = {
			name = "traits_expanded"
			visible = "[CharacterWindow.AreTraitsExpanded]"
			layoutpolicy_vertical = expanding
			layoutpolicy_horizontal = expanding

			using = Animation_Tab_Switch

			blockoverride "scrollbox_content"
			{
				spacing = 10

				vbox = {
					spacing = 10

					text_label_center = {
						text = "MODIFIERS"
					}

					text_single = {
						visible = "[IsDataModelEmpty(CharacterWindow.GetTimedModifiers)]"
						text = "CV_NO_MODIFIERS"
						default_format = "#low;italic"
					}

					dynamicgridbox = {
						name = "modifiers_grid"
						datamodel = "[CharacterWindow.GetTimedModifiers]"
						datamodel_wrap = 8
						flipdirection = yes

						item = {
							modifier_item_icon = {
								size = { 35 35 }
							}
						}
					}
				}

				divider_light = {
					layoutpolicy_horizontal = expanding
				}

				vbox = {
					spacing = 10
					datacontext = "[CharacterWindow.GetTraitArrays]"

					text_label_center = {
						text = "TRAITS"
					}

					fixedgridbox = {
						name = "personality_traits_grid"
						datamodel = "[TraitArrays.GetPersonalityTraits]"
						addcolumn = 85
						addrow = 105
						flipdirection = yes
						datamodel_wrap = 6

						item = {
							icon_trait = {
								text_multi = {
									parentanchor = bottom|hcenter
									widgetanchor = top|hcenter
									position = { 0 -5 }
									autoresize = yes
									max_width = 80
									text = "[Trait.GetNameNoTooltip(Character.Self)]"
									default_format = "#high"
									align = hcenter
								}
							}
						}
					}

					fixedgridbox = {
						name = "traits_grid"
						datamodel = "[TraitArrays.GetTraits]"
						addcolumn = 85
						addrow = 105
						flipdirection = yes
						datamodel_wrap = 6

						item = {
							icon_trait = {
								text_multi = {
									parentanchor = bottom|hcenter
									widgetanchor = top|hcenter
									position = { 0 -5 }
									autoresize = yes
									max_width = 80
									text = "[Trait.GetNameNoTooltip(Character.Self)]"
									default_format = "#high"
									align = hcenter
								}
							}
						}
					}
				}
			}
		}

		# TITLES EXPANDED
		scrollbox = {
			name = "titles_expanded"
			visible = "[CharacterWindow.AreTitlesExpanded]"
			layoutpolicy_vertical = expanding
			layoutpolicy_horizontal = expanding

			using = Animation_Tab_Switch

			blockoverride "scrollbox_content"
			{
				spacing = 15

				text_label_center = {
					text = "CV_TITLES_NOCOUNT"
				}

				fixedgridbox = {
					name = "titles_box_bishop"
					datacontext = "[CharacterWindow.GetCharacter]"
					flipdirection = yes
					addrow = 90
					addcolumn = 270
					datamodel_wrap = 2

					datamodel = "[CharacterWindow.GetTitles]"

					item = {
						flowcontainer = {
							datacontext = "[TitleItem.GetTitle]"
							spacing = 5

							coa_title_small_crown = {
								using = tooltip_ne
							}

							text_multi = {
								text = "[Title.GetNameNoTooltip]"
								parentanchor = vcenter
								autoresize = yes
								default_format = "#high"
								using = Font_Size_Medium
								max_width = 190
								margin_top = 5
							}
						}
					}
				}
			}
		}

		# CLAIMS EXPANDED
		scrollbox = {
			name = "claims_expanded"
			visible = "[CharacterWindow.AreClaimsExpanded]"
			layoutpolicy_vertical = expanding
			layoutpolicy_horizontal = expanding

			using = Animation_Tab_Switch

			blockoverride "scrollbox_content"
			{
				spacing = 10

				text_label_center = {
					text = "CV_CLAIMS_NOCOUNT"
				}

				flowcontainer = {
					name = "titles_box_bishop"
					datacontext = "[CharacterWindow.GetCharacter]"
					datamodel = "[CharacterWindow.GetClaims]"
					direction = vertical
					spacing = 10

					item = {
						flowcontainer = {
							spacing = 5
							using = tooltip_ne
							tooltip = "[Claim.GetTooltip]"

							coa_title_medium = {
								datacontext = "[Claim.GetTitle]"
							}

							flowcontainer = {
								direction = vertical
								ignoreinvisible = yes

								text_single = {
									text = "[Claim.GetTitle.GetNameNoTooltip|U]"
									default_format = "#high"
									using = Font_Size_Big
								}

								text_single = {
									name = "pressed_claim"
									visible = "[And(Claim.IsPressed, Not(Claim.IsImplicit))]"
									text = "[pressed_claim_i][pressed_claim|E]"
								}

								text_single = {
									name = "unpressed_claim"
									visible = "[And(Not(Claim.IsPressed), Not(Claim.IsImplicit))]"
									text = "[unpressed_claim_i][unpressed_claim|E]"
								}

								text_single = {
									name = "implicit_claim"
									visible = "[Claim.IsImplicit]"
									text = "[implicit_claim_i][implicit_claim|E]"
								}

								text_multi = {
									visible = "[Claim.GetTitle.GetHolder.IsValid]"
									text = "CLAIM_TITLE_HOLDER"
									max_width = 400
									autoresize = yes
								}

								text_single = {
									visible = "[Not(Claim.GetTitle.GetHolder.IsValid)]"
									text = "CLAIM_TITLE_NOT_CREATED"
									default_format = "#weak"
									align = nobaseline
								}
							}
						}
					}
				}
			}
		}

		# DIPLOMACY EXPANDED
		scrollbox = {
			name = "diplomacy_expanded"
			visible = "[CharacterWindow.AreDiplomacyExpanded]"
			layoutpolicy_vertical = expanding
			layoutpolicy_horizontal = expanding

			using = Animation_Tab_Switch

			blockoverride "scrollbox_content"
			{
				spacing = 15

				text_label_center = {
					text = "CV_DIPLOMACY"
				}

				vbox = {
					name = "diplomacy_items"
					datamodel = "[CharacterWindow.GetDiplomacyItems]"
					layoutpolicy_horizontal = expanding

					item = {
						vbox = {
							layoutpolicy_horizontal = expanding
							spacing = 10

							divider_light = {
								layoutpolicy_horizontal = expanding
							}

							button_group = {
								layoutpolicy_horizontal = expanding
								alwaystransparent = "[DiplomacyItem.IsConfederation]"

								onclick = "[DiplomacyItem.OnClick]"

								tooltip = "[DiplomacyItem.GetTooltip]"
								using = tooltip_se

								hbox = {
									widget = {
										size = { 65 74 }

										button = {
											parentanchor = top|hcenter
											alwaystransparent = "[DiplomacyItem.IsConfederation]"
											position = { 0 -30 }
											size = { 50 50 }
											texture = "gfx/interface/icons/diplomatic_icons.dds"
											frame = "[DiplomacyItem.GetDiplomacyFrame]"
											framesize = { 120 120 }
											scale = 1.3

											tooltip_visible = no
										}

										coa_realm_medium = {
											visible = "[And(Not(DiplomacyItem.IsStruggle), Not(DiplomacyItem.IsConfederation))]"
											datacontext = "[DiplomacyItem.GetTargetCharacter]"
											parentanchor = hcenter

											tooltip = "[DiplomacyItem.GetTooltip]"

											text_single = {
												name = "warscore"
												visible = "[DiplomacyItem.HasWarScore]"
												parentanchor = hcenter
												position = { 0 -20 }

												text = "[DiplomacyItem.GetWarScoreFraction|0%=+]"
												align = nobaseline
												using = Font_Size_Medium

												background = {
													using = Background_Area_ExtraDark
													margin = { 3 1 }
												}
											}
										}

										coa_confederation_medium = {
											datacontext = "[DiplomacyItem.GetConfederation]"
											visible = "[DiplomacyItem.IsConfederation]"
											parentanchor = hcenter
										}

										button = {
											datacontext = "[DiplomacyItem.GetStruggle]"
											datacontext = "[DiplomacyItem.GetTargetCharacter]"
											visible = "[DiplomacyItem.IsStruggle]"
											position = { 0 -3 }
											size = { 70 90 }

											onclick = "[DiplomacyItem.OnClick]"

											tooltipwidget = struggle_tooltip
											using = tooltip_es
											tooltip_offset = { 0 22 }

											widget_struggle_icon = {}
										}
									}

									text_multi = {
										layoutpolicy_horizontal = expanding
										alwaystransparent = "[DiplomacyItem.IsConfederation]"

										text = "[DiplomacyItem.GetInfo]"
										autoresize = yes
										max_width = 450
										min_height = 120
										using = Font_Size_Tiny
									}
								}
							}

							hbox = {
								name = "reason_characters"
								visible = "[DiplomacyItem.HasReasonCharacters]"
								margin_bottom = 10

								portrait_head_small = {
									name = "reason_character_left"
									datacontext = "[DiplomacyItem.GetLeftReasonCharacter]"
									blockoverride "opinion_box" {}
									blockoverride "status_icons" {}
								}

								portrait_head_small = {
									name = "reason_character_right"
									datacontext = "[DiplomacyItem.GetRightReasonCharacter]"
									blockoverride "opinion_box" {}
									blockoverride "status_icons" {}

									blockoverride "portrait_transformation"
									{
										portrait_scale = { -1 1 }
										portrait_offset = { 1 0 }
									}
								}
							}
						}
					}
				}
			}
		}

		# Modifiers expanded
		scrollbox = {
			name = "modifiers_expanded"
			visible = "[CharacterWindow.AreModifiersExpanded]"
			layoutpolicy_vertical = expanding
			layoutpolicy_horizontal = expanding

			using = Animation_Tab_Switch

			blockoverride "scrollbox_content"
			{
				spacing = 15

				text_label_center = {
					text = "MODIFIERS"
				}

				vbox = {
					layoutpolicy_horizontal = expanding
					datamodel = "[CharacterWindow.GetTimedModifiers]"
					spacing = 2

					item = {
						vbox = {
							layoutpolicy_horizontal = expanding

							hbox = {
								layoutpolicy_horizontal = expanding

								hbox = {
									margin_right = 10
									margin_top = 8
									margin_left = -4

									icon = {
										size = { 32 32 }
										texture = "[ModifierItem.GetIcon]"
									}
								}

								text_single = {
									layoutpolicy_horizontal = expanding
									text = "[ModifierItem.GetStaticModifier.GetName]"
								}
							}

							textbox = {
								layoutpolicy_horizontal = expanding
								visible = "[ModifierItem.HasTooltipDataByTag('single_modifier')]"
								datacontext = "[ModifierItem.GetSingleModifierTooltipData]"
								max_width = 500
								using = DefaultTooltipText
								multiline = yes
								text = "[TimedModifierSingleItem.GetDesc]"
								alwaystransparent = no
							}

							vbox = {
								visible = "[ModifierItem.HasTooltipDataByTag('preview_list')]"
								datacontext = "[ModifierItem.GetPreviewList]"
								layoutpolicy_horizontal = expanding

								textbox = {
									layoutpolicy_horizontal = expanding
									max_width = 500
									using = DefaultTooltipText
									multiline = yes
									text = "[TimedModifierPreviewList.GetScaledDesc]"
									alwaystransparent = no
								}

								vbox = {
									datamodel = "[TimedModifierPreviewList.GetItems]"
									layoutpolicy_horizontal = expanding
									max_width = 500

									item = {
										vbox = {
											layoutpolicy_horizontal = expanding

											text_single = {
												layoutpolicy_horizontal = expanding
												text = "[TimedModifierPreviewItem.GetTitle]"
											}

											text_single = {
												layoutpolicy_horizontal = expanding
												text = "[TimedModifierPreviewItem.GetExpirationDate]"
											}

											expand = {}
										}
									}
								}
							}

							vbox = {
								layoutpolicy_horizontal = expanding
								visible = "[ModifierItem.HasTooltipDataByTag('scaled_single_modifier')]"
								datacontext = "[ModifierItem.GetScaledSingleModifierTooltipData]"

								textbox = {
									layoutpolicy_horizontal = expanding
									max_width = 500
									using = DefaultTooltipText
									multiline = yes
									text = "[TimedModifierScaledSingleItem.GetDesc]"
									alwaystransparent = no
								}

								vbox = {
									layoutpolicy_horizontal = expanding
									datamodel = "[TimedModifierScaledSingleItem.GetEffectItems]"

									item = {
										textbox = {
											layoutpolicy_horizontal = expanding
											max_width = 500
											margin_top = 5
											margin_left = 10
											margin_right = 5
											margin_bottom = 10
											using = DefaultTooltipText
											using = Background_Area
											text = "[CString.GetString]"
											alwaystransparent = no
										}
									}
								}

								text_single = {
									layoutpolicy_horizontal = growing
									max_width = 500
									text = "[TimedModifierScaledSingleItem.GetExpirationDate]"
								}
							}

							spacer = {
								size = { 2 10 }
							}

							divider_light = {
								layoutpolicy_horizontal = expanding
								# Don't show divider after the last item in the datamodel
								visible = "[Not( EqualTo_int32( PdxGuiWidget.GetIndexInDataModel, Subtract_int32( GetDataModelSize( CharacterWindow.GetTimedModifiers ), '(int32)1' ) ) )]"
							}
						}
					}
				}
			}
		}
	}

	window_character_filter = {
		name = "court_character_filter_window"
		datacontext = "[CharacterWindow.GetCourt]"
		size = { 510 860 }
		position = { 525 140 }

		blockoverride "editbox_properties"
		{
			name = "court_text_filter"
			ontextedited = "[CharacterSelectionList.SetPattern]"
			oneditingfinished = "[CharacterSelectionList.FinishEdit]"
		}

		blockoverride "addition_filter" {
			vbox_filter_group = {
				layoutpolicy_horizontal = expanding
				datacontext = "[CharacterSelectionList.GetCategory('age_filter_category')]"
				blockoverride "filters" {
					filter_item = {
						layoutpolicy_horizontal = expanding
						datacontext = "[CharacterSelectionList.GetFilter('adult_filter')]"
					}
				}
			}

			vbox_filter_group = {
				layoutpolicy_horizontal = expanding
				datacontext = "[CharacterSelectionList.GetCategory('personal_filter_category')]"
				blockoverride "filters" {
					filter_item = {
						layoutpolicy_horizontal = expanding
						datacontext = "[CharacterSelectionList.GetFilter('religion_filter')]"
					}
					filter_item = {
						layoutpolicy_horizontal = expanding
						datacontext = "[CharacterSelectionList.GetFilter('culture_filter')]"
					}
					filter_item = {
						layoutpolicy_horizontal = expanding
						datacontext = "[CharacterSelectionList.GetFilter('hook_filter')]"
					}
					filter_item = {
						layoutpolicy_horizontal = expanding
						datacontext = "[CharacterSelectionList.GetFilter('married_filter')]"
					}
					filter_item = {
						layoutpolicy_horizontal = expanding
						datacontext = "[CharacterSelectionList.GetFilter('gender_filter')]"
					}
					filter_item = {
						layoutpolicy_horizontal = expanding
						datacontext = "[CharacterSelectionList.GetFilter('health_filter')]"
					}
					filter_item = {
						layoutpolicy_horizontal = expanding
						datacontext = "[CharacterSelectionList.GetFilter('inspiration_filter')]"
					}
					filter_item = {
						layoutpolicy_horizontal = expanding
						datacontext = "[CharacterSelectionList.GetFilter('sexuality_filter')]"
					}
				}
			}

			vbox_filter_group = {
				layoutpolicy_horizontal = expanding
				datacontext = "[CharacterSelectionList.GetCategory('politics_filter_category')]"
				blockoverride "filters" {
					filter_item = {
						layoutpolicy_horizontal = expanding
						datacontext = "[CharacterSelectionList.GetFilter('dynasty_filter')]"
					}
					filter_item = {
						layoutpolicy_horizontal = expanding
						datacontext = "[CharacterSelectionList.GetFilter('hostage_filter')]"
					}
				}
			}
		}
	}

	window_character_filter = {
		name = "vassal_filter_window"
		datacontext = "[CharacterWindow.GetVassals]"
		size = { 510 820 }
		position = { 525 200 }

		blockoverride "editbox_properties"
		{
			name = "vassal_text_filter"
			ontextedited = "[CharacterSelectionList.SetPattern]"
			oneditingfinished = "[CharacterSelectionList.FinishEdit]"
		}

		blockoverride "addition_filter" {
			vbox_filter_group = {
				layoutpolicy_horizontal = expanding
				datacontext = "[CharacterSelectionList.GetCategory('age_filter_category')]"
				blockoverride "filters" {
					filter_item = {
						layoutpolicy_horizontal = expanding
						datacontext = "[CharacterSelectionList.GetFilter('adult_filter')]"
					}
				}
			}

			vbox_filter_group = {
				layoutpolicy_horizontal = expanding
				datacontext = "[CharacterSelectionList.GetCategory('personal_filter_category')]"
				blockoverride "filters" {
					filter_item = {
						layoutpolicy_horizontal = expanding
						datacontext = "[CharacterSelectionList.GetFilter('vassal_stance_filter')]"
					}
					filter_item = {
						layoutpolicy_horizontal = expanding
						datacontext = "[CharacterSelectionList.GetFilter('religion_filter')]"
					}
					filter_item = {
						layoutpolicy_horizontal = expanding
						datacontext = "[CharacterSelectionList.GetFilter('culture_filter')]"
					}
					filter_item = {
						layoutpolicy_horizontal = expanding
						datacontext = "[CharacterSelectionList.GetFilter('hook_filter')]"
					}
					filter_item = {
						layoutpolicy_horizontal = expanding
						datacontext = "[CharacterSelectionList.GetFilter('married_filter')]"
					}
					filter_item = {
						layoutpolicy_horizontal = expanding
						datacontext = "[CharacterSelectionList.GetFilter('gender_filter')]"
					}
					filter_item = {
						layoutpolicy_horizontal = expanding
						datacontext = "[CharacterSelectionList.GetFilter('health_filter')]"
					}
				}
			}

			vbox_filter_group = {
				layoutpolicy_horizontal = expanding
				datacontext = "[CharacterSelectionList.GetCategory('politics_filter_category')]"
				blockoverride "filters" {
					filter_item = {
						layoutpolicy_horizontal = expanding
						datacontext = "[CharacterSelectionList.GetFilter('dynasty_filter')]"
					}
					filter_item = {
						layoutpolicy_horizontal = expanding
						datacontext = "[CharacterSelectionList.GetFilter('hostage_filter')]"
					}
				}
			}
		}
	}
}

######################################################
################ TYPES AND TEMPLATES #################
######################################################

types CharacterWindow
{
	type modifier_item_icon = widget {
		datacontext = "[ModifierItem.GetStaticModifier]"

		size = { 25 25 }

		# Preview list
		icon = {
			# the tag is hard-coded, if you want to change the name or add a new one please contact someone from code team
			visible = "[ModifierItem.HasTooltipDataByTag('preview_list')]"

			size = { 100% 100% }
			alwaystransparent = no
			texture = "[ModifierItem.GetIcon]"

			block "icon_data" {
				alwaystransparent = no
			}

			tooltipwidget = {
				object_tooltip_pop_out = {
					datacontext = "[ModifierItem.GetPreviewList]"

					blockoverride "header_additions" {
						hbox = {
							margin_right = 10
							margin_top = 8
							margin_left = -4

							icon = {
								size = { 32 32 }
								texture = "[StaticModifier.GetIcon]"
								tintcolor = "[TooltipInfo.GetTintColor]"
							}
						}
					}

					blockoverride "title_text" {
						margin = { 0 8 }
						text = "[StaticModifier.GetName]"
					}

					blockoverride "concept_link" {
						text = ""
					}

					blockoverride "main_description" {
						vbox = {
							layoutpolicy_horizontal = expanding
							layoutpolicy_vertical = expanding

							text_multi = {
								autoresize = yes
								max_width = 350
								text = "[TimedModifierPreviewList.GetScaledDesc]"
							}

							vbox = {
								layoutpolicy_horizontal = expanding
								layoutpolicy_vertical = expanding

								datamodel = "[TimedModifierPreviewList.GetItems]"

								item = {
									vbox = {
										layoutpolicy_horizontal = expanding
										layoutpolicy_vertical = expanding

										text_single = {
											layoutpolicy_horizontal = growing
											text = "[TimedModifierPreviewItem.GetTitle]"
										}

										text_single = {
											layoutpolicy_horizontal = growing
											text = "[TimedModifierPreviewItem.GetExpirationDate]"
										}
									}
								}
							}

							textbox = {
								name = "input_info"
								layoutpolicy_horizontal = expanding
								margin_top = 10
								margin_bottom = 20
								using = DefaultTooltipText
								multiline = yes
								block "input_info_text" {}
								fonttintcolor = "[TooltipInfo.GetTintColor]"
							}
						}
					}
				}
			}
		}

		# Single modifier
		icon = {
			# the tag is hard-coded, if you want to change the name or add a new one please contact someone from code team
			visible = "[ModifierItem.HasTooltipDataByTag('single_modifier')]"
			size = { 100% 100% }
			alwaystransparent = no
			texture = "[ModifierItem.GetIcon]"

			block "icon_data" {
				alwaystransparent = no
			}

			tooltipwidget = {
				static_modifier_tooltip = {
					datacontext = "[ModifierItem.GetSingleModifierTooltipData]"

					blockoverride "description_text_data" {
						text = "[TimedModifierSingleItem.GetDesc]"
					}
				}
			}
		}

		# Scaled single modifier
		icon = {
			# the tag is hard-coded, if you want to change the name or add a new one please contact someone from code team
			visible = "[ModifierItem.HasTooltipDataByTag('scaled_single_modifier')]"

			size = { 100% 100% }
			alwaystransparent = no
			texture = "[ModifierItem.GetIcon]"

			block "icon_data" {
				alwaystransparent = no
			}

			tooltipwidget = {
				scaled_static_modifier_tooltip = {
					datacontext = "[ModifierItem.GetScaledSingleModifierTooltipData]"

					blockoverride "description_text_data" {
						text = "[TimedModifierScaledSingleItem.GetDesc]"
					}

					blockoverride "effects_datamodel" {
						datamodel = "[TimedModifierScaledSingleItem.GetEffectItems]"
					}

					blockoverride "expiration_date" {
						text_single = {
							layoutpolicy_horizontal = growing
							text = "[TimedModifierScaledSingleItem.GetExpirationDate]"
						}
						margin_bottom = 10
					}
				}
			}
		}
	}

	type skill_icon_label_vertical = widget {
		size = { 40 60 }

		icon = {
			name = "skill_icon"
			texture = "gfx/interface/icons/icon_skills.dds"
			size = { 24 24 }
			framesize = { 60 60 }
			position = { -10 17 }

			block "icon"
			{
				frame = "[SkillItem.GetFrame]"
			}
		}

		block "tooltip"
		{
			tooltip = "SKILL_ITEM_TOOLTIP"
			using = tooltip_ne
		}

		text_single = {
			name = "skill_value"
			parentanchor = top|hcenter
			position = { 5 17 }
			align = center

			block "value"
			{
				text = "[SkillItem.GetValue]"
			}
		}
	}

	type hbox_character_relation_and_ai = hbox
	{
		layoutpolicy_horizontal = expanding
		spacing = 2

		hbox = {
			maximumsize = { 430 -1 }

			text_single = {
				maximumsize = { 281 -1 }
				name = "character_relation_to_you"
				text = "[Character.GetRelationToString( GetPlayer )]"
				tooltip = "EXTENDED_RELATIONS_TOOLTIP"
				using = tooltip_se

				fontsize_min = 13
				align = nobaseline
			}

			text_single = {
				maximumsize = { 149 -1 }
				name = "other_player_name"
				visible = "[And( Character.IsPlayer, Not( Character.IsLocalPlayer ) )]"

				raw_text = " • #L [Character.GetHumanName]#!"
				tooltip = "AI_PERSONALITY_IS_PLAYER_TOOLTIP"
				using = tooltip_se

				fontsize_min = 13
				align = nobaseline
			}

			text_single = {
				maximumsize = { 149 -1 }
				name = "ai_personality"
				visible = "[Not( Character.IsPlayer )]"

				raw_text = " • #L [Character.GetAIPersonalityNoTooltip]#!"
				tooltip = "AI_PERSONALITY_TT"
				using = tooltip_se

				fontsize_min = 13
				align = nobaseline
			}
		}

		icon = {
			visible = "[Not(Character.IsFemale)]"
			size = { 20 20 }
			framesize = { 40 40 }
			frame = "[Character.GetSexualityFrame]"
			texture = "gfx/interface/icons/character_status/sexuality_icons_male.dds"
			tooltip = "SEXUALITY_TT"
		}

		icon = {
			visible = "[Character.IsFemale]"
			size = { 20 20 }
			framesize = { 40 40 }
			frame = "[Character.GetSexualityFrame]"
			texture = "gfx/interface/icons/character_status/sexuality_icons_female.dds"
			tooltip = "SEXUALITY_TT"
		}

		expand = {}
	}

	type icon_row_header_background = icon
	{
		size = { 100% 25 }

		texture = "gfx/interface/component_tiles/tile_title_bg_01.dds"
		spritetype = corneredtiled
		spriteborder = { 20 0 }
		texture_density = 2
		alpha = 0.5
	}

	type widget_family_row_item = widget
	{
		layoutpolicy_horizontal = expanding
		layoutpolicy_vertical = expanding
		maximumsize = { -1 110 }
		scissor = yes

		icon_row_header_background = {}

		hbox = {

			block "item_list"
			{
			}

			expand = {}
		}
	}

	type vbox_character_row_item = vbox {
		spacing = -3

		widget = {
			layoutpolicy_horizontal = expanding
			size = { 0 25 }

			block "minimum_width" {
				min_width = 110
			}

			block "expand_button" {
				button_standard_hover = {
					size = { 100% 100% }

					block "expand_button_inside" {}
				}
			}

			hbox = {
				margin = { 10 0 }

				background = {
					using = Text_Label_Background
					alpha = 0.5
					margin = { 0 -2 }
				}

				text_single = {
					align = nobaseline
					fontsize = 14

					block "header_text"
					{
						raw_text = "#D NEEDS TEXT#!"
					}
				}

				expand = {}

				text_single = {
					align = nobaseline
					default_format = "#weak"

					block "remaining_items" {
						visible = no
					}
				}
			}
		}

		hbox = {
			layoutpolicy_horizontal = expanding

			using = Animation_Character_Window_Refresh

			block "gridbox" {
				fixedgridbox = {
					flipdirection = yes
					addcolumn = 85
					addrow = 90
					datamodel_wrap = 7

					block "gridbox_slots"
					{
						maxverticalslots = 1
					}

					block "portrait_datamodel" {
						datamodel = "[CharacterWindow.GetParents]"
					}

					item = {
						block "portrait_head_widget" {
							portrait_head_small = {
								blockoverride "portrait_button"
								{
									using = tooltip_ne
								}
								blockoverride "glow_visible"
								{
									visible = no
								}
							}
						}
					}
				}
			}

			block "find_partner" {}

			expand = {}
		}

		expand = {}
	}

	### Modified character row for relationship tab
	type vbox_character_row_relationship_item = vbox_character_row_item {
		blockoverride "portrait_head_widget" {
			portrait_head_small_relationship = {
				blockoverride "portrait_button"
				{
					using = tooltip_ne
				}
				blockoverride "glow_visible"
				{
					visible = no
				}
			}
		}
	}

	type vbox_titles_claims_box = vbox {
		## Titles
		hbox = {
			name = "titles"
			visible = "[Not( IsDataModelEmpty( CharacterWindow.GetTitles ) )]"
			layoutpolicy_horizontal = expanding
			spacing = 5

			background = {
				margin_left = 5
				using = Background_Area_Titles
			}

			hbox = {
				margin_left = 5

				text_single = {
					visible = "[GreaterThan_int32( GetDataModelSize(CharacterWindow.GetTitles), '(int32)1' )]"

					text = "CV_TITLES"
					align = nobaseline
				}

				text_single = {
					visible = "[Not(GreaterThan_int32( GetDataModelSize(CharacterWindow.GetTitles), '(int32)1' ))]"

					text = "CV_TITLES_SINGULAR"
					align = nobaseline
				}
			}

			button_standard_hover = {
				size = { 25 25 }

				onclick = "[CharacterWindow.ToggleExpandedTitles]"
				down = "[CharacterWindow.AreTitlesExpanded]"

				tooltip = "[SelectLocalization( CharacterWindow.AreTitlesExpanded, 'CV_TITLES_HIDE_TT', 'CV_TITLES_SHOW_TT' )]"

				hbox = {
					layoutpolicy_horizontal = expanding

					text_single = {
						visible = "[LessThan_int32( GetDataModelSize(CharacterWindow.GetTitles), '(int32)9' )]"
						layoutpolicy_horizontal = expanding

						text = "KEY_KP_PLUS"
						align = center|nobaseline
						default_format = "#weak"
					}

					text_single = {
						visible = "[GreaterThan_int32( GetDataModelSize(CharacterWindow.GetTitles), '(int32)8' )]"
						layoutpolicy_horizontal = expanding

						text = "[GetNumberAbove_int32( GetDataModelSize(CharacterWindow.GetTitles), '(int32)8' )|=]"
						align = center|nobaseline
						default_format = "#weak"
					}
				}
			}

			hbox = {
				layoutpolicy_horizontal = expanding

				fixedgridbox = {
					datamodel = "[CharacterWindow.GetTitles]"
					flipdirection = yes
					addrow = 56
					addcolumn = 38
					maxverticalslots = 1

					block "titles_max_slots" {
						datamodel_wrap = 0
					}

					item = {
						coa_title_tiny_crown = {
							datacontext = "[TitleItem.GetTitle]"
							parentanchor = left|vcenter
							using = tooltip_ne

							icon = {
								name = "has_laws"
								visible = "[TitleItem.GetTitle.HasLaws]"
								parentanchor = bottom|right
								size = { 25 25 }
								position = { 5 0 }
								texture = "gfx/interface/icons/title_status/icon_title_law.dds"
							}
							icon = {
								name = "is_nomad"
								visible = "[TitleItem.GetTitle.IsNomad]"
								parentanchor = bottom|right
								size = { 25 25 }
								position = { 5 0 }
								texture = "gfx/interface/icons/title_status/icon_title_nomad.dds"
							}
						}
					}
				}

				expand = {}
			}
		}

		## Claims
		hbox = {
			name = "claims"
			visible = "[Not(IsDataModelEmpty(CharacterWindow.GetClaims))]"
			layoutpolicy_horizontal = expanding

			background = {
				margin_left = 6
				margin_top = -15
				margin_bottom = -15
				using = Background_Area_Titles
			}

			hbox = {
				minimumsize = { 60 0 }

				text_single = {
					visible = "[GreaterThan_int32( GetDataModelSize(CharacterWindow.GetClaims), '(int32)1' )]"
					align = nobaseline
					text = "CV_CLAIMS"
				}

				text_single = {
					visible = "[Not(GreaterThan_int32( GetDataModelSize(CharacterWindow.GetClaims), '(int32)1' ))]"
					align = nobaseline
					text = "CV_CLAIMS_SINGULAR"
				}

				expand = {}
			}

			button_standard_hover = {
				size = { 25 25 }

				onclick = "[CharacterWindow.ToggleExpandedClaims]"
				down = "[CharacterWindow.AreClaimsExpanded]"
				tooltip = "[SelectLocalization( CharacterWindow.AreClaimsExpanded, 'CV_CLAIMS_HIDE_TT', 'CV_CLAIMS_SHOW_TT' )]"

				hbox = {
					layoutpolicy_horizontal = expanding
					text_single = {
						align = nobaseline
						default_format = "#weak"

						visible = "[LessThan_int32( GetDataModelSize(CharacterWindow.GetClaims), '(int32)9' )]"
						text = "KEY_KP_PLUS"
					}
					text_single = {
						align = nobaseline
						default_format = "#weak"

						visible = "[GreaterThan_int32( GetDataModelSize(CharacterWindow.GetClaims), '(int32)8' )]"
						text = "[GetNumberAbove_int32(GetDataModelSize(CharacterWindow.GetClaims), '(int32)8' )|=]"
					}
				}
			}

			hbox = {
				layoutpolicy_horizontal = expanding

				fixedgridbox = {
					name = "claims_box"
					datamodel = "[CharacterWindow.GetClaims]"
					flipdirection = yes
					addrow = 60
					addcolumn = 38
					maxverticalslots = 1

					block "titles_max_slots" {
						datamodel_wrap = 0
					}

					item = {
						container = {
							datacontext = "[Claim.GetTitle]"
							using = tooltip_ne
							tooltip = "CHARACTER_WINDOW_CLAIM_TOOLTIP"

							coa_title_tiny_crown = {
								name = "claim"
								tooltip_visible = no

								highlight_icon = {
									name = "pressed_claim"
									visible = "[And(Claim.IsPressed, Not(Claim.IsImplicit))]"
									texture = "gfx/interface/icons/title_status/icon_claim_pressed.dds"
									position = { 5 3 }
									size = { 24 24 }
									parentanchor = bottom|right
								}

								highlight_icon = {
									name = "unpressed_claim"
									visible = "[And(Not(Claim.IsPressed), Not(Claim.IsImplicit))]"
									texture = "gfx/interface/icons/title_status/icon_claim_unpressed.dds"
									position = { 5 3 }
									size = { 24 24 }
									parentanchor = bottom|right
								}

								highlight_icon = {
									name = "implicit_claim"
									visible = "[Claim.IsImplicit]"
									texture = "gfx/interface/icons/title_status/icon_claim_implicit.dds"
									position = { 5 3 }
									size = { 24 24 }
									parentanchor = bottom|right
								}
							}
						}
					}
				}
				expand = {}
			}
		}
		expand = {}
	}

	type vbox_diplomacy_box = vbox {
		name = "diplomacy"
		layoutpolicy_vertical = expanding
		layoutpolicy_horizontal = expanding

		button_standard_hover = {
			layoutpolicy_horizontal = expanding
			size = { 100 25 }

			onclick = "[SetMapMode( Select_CString( CharacterWindow.AreDiplomacyExpanded, 'realms', 'diplomatic_relations' ) )]"
			onclick = "[CharacterWindow.ToggleExpandedDiplomacy]"
			down = "[Or( CharacterWindow.AreDiplomacyExpanded,  IsMapMode( 'diplomatic_relations' ) )]"

			tooltip = "[SelectLocalization( CharacterWindow.AreDiplomacyExpanded, 'CV_DIPLOMACY_HIDE_TT', 'CV_DIPLOMACY_SHOW_TT' )]"

			hbox = {
				text_label_left = {
					layoutpolicy_horizontal = expanding
					alwaystransparent = yes
					text = "CV_DIPLOMACY"
					autoresize = no
					margin_right = 0
					margin_left = 18

					button_expand = {
						alwaystransparent = yes
						position = { 1 3 }
						alpha = 0.7
						scale = 0.75
						frame = "[BoolTo1And2( CharacterWindow.AreDiplomacyExpanded )]"
					}
				}

				text_single = {
					margin_bottom = 5
					margin_right = 3
					default_format = "#weak"

					block "diplomacy_extra_items"
					{
						visible = no
					}
				}
			}
		}

		vbox = {
			margin_top = 20

			fixedgridbox = {
				name = "diplomacy_items"
				datamodel = "[CharacterWindow.GetDiplomacyItems]"
				addrow = 65
				addcolumn = 50
				flipdirection = yes

				block "diplomacy_slots"
				{
					datamodel_wrap = 2
					maxverticalslots = 2
					maxhorizontalslots = 2
				}

				item = {
					container = {
						onmousehierarchyenter = "[DiplomacyItem.MouseEnter]"
						onmousehierarchyleave = "[DiplomacyItem.MouseLeave]"

						button = {
							visible = "[Not(DiplomacyItem.IsStruggle)]"
							parentanchor = top|hcenter
							alwaystransparent = yes
							position = { 0 -22 }
							size = { 50 50 }
							texture = "gfx/interface/icons/diplomatic_icons.dds"
							# A new icon in diplomatic_icons.dds requires code support for mapping the DiplomacyItem type to that icon via the function below
							frame = "[DiplomacyItem.GetDiplomacyFrame]"
							framesize = { 120 120 }

							tooltip_visible = no
						}

						coa_realm_small = {
							datacontext = "[DiplomacyItem.GetTargetCharacter]"
							visible = "[And(Not(DiplomacyItem.IsStruggle), Not(DiplomacyItem.IsConfederation))]"
							parentanchor = hcenter

							onrightclick = "[DefaultOnRealmFlagClick(Character.GetID)]"

							tooltip = "[DiplomacyItem.GetTooltip]"
							tooltip_offset = { 0 22 }
							using = tooltip_es

							state = {
								name = _mouse_hierarchy_enter
								start_sound = {
									soundeffect = "event:/SFX/UI/Generic/sfx_ui_generic_icon_pointer_over"
								}
							}

							blockoverride "coa_button"
							{
								onclick = "[DiplomacyItem.OnClick]"
								button_ignore = none
							}
						}

						coa_confederation_small = {
							datacontext = "[DiplomacyItem.GetConfederation]"
							visible = "[DiplomacyItem.IsConfederation]"
							parentanchor = hcenter

							tooltip = "[DiplomacyItem.GetTooltip]"
							tooltip_offset = { -20 22 }
							using = tooltip_es
						}

						text_single = {
							name = "warscore"
							visible = "[DiplomacyItem.HasWarScore]"
							parentanchor = top|hcenter
							position = { 0 -12 }

							text = "[DiplomacyItem.GetWarScoreFraction|0%=+]"
							align = nobaseline
							fontsize = 13

							background = {
								using = Background_Area_ExtraDark
								margin = { 0 1 }
							}
						}

						button = {
							datacontext = "[DiplomacyItem.GetStruggle]"
							datacontext = "[DiplomacyItem.GetTargetCharacter]"
							visible = "[DiplomacyItem.IsStruggle]"
							parentanchor = hcenter
							position = { 0 -3 }
							size = { 52 64 }

							onclick = "[DiplomacyItem.OnClick]"

							tooltipwidget = struggle_tooltip;
							using = tooltip_es
							tooltip_offset = { 0 22 }

							widget_struggle_icon = {}
						}
					}
				}
			}
		}

		expand = {}
	}

	type widget_struggle_icon = widget {
		size = { 100% 100% }

		struggle_phase_based_widget = {
			datacontext = "[Struggle.GetCurrentPhase]"
			visible = "[Struggle.IsInvolvedCharacter(Character.Self)]"

			blockoverride "point_based_widget_content" {
				highlight_icon = {
					size = { 100% 100% }
					texture = "gfx/interface/icons/struggle_banners/point_involved_banner_small.dds"
				}
			}

			blockoverride "time_based_widget_content" {
				highlight_icon = {
					size = { 100% 100% }
					texture = "gfx/interface/icons/struggle_banners/time_involved_banner_small.dds"
				}
			}
		}

		struggle_phase_based_widget = {
			datacontext = "[Struggle.GetCurrentPhase]"
			visible = "[Struggle.IsInterloperCharacter(Character.Self)]"

			blockoverride "point_based_widget_content" {
				highlight_icon = {
					size = { 100% 100% }
					texture = "gfx/interface/icons/struggle_banners/point_interloper_banner_small.dds"
				}
			}

			blockoverride "time_based_widget_content" {
				highlight_icon = {
					size = { 100% 100% }
					texture = "gfx/interface/icons/struggle_banners/time_interloper_banner_small.dds"
				}
			}
		}

		widget = {
			size = { 100% 100% }
			position = { 0 -3 }

			icon = {
				visible = "[Struggle.IsInvolvedCharacter(Character.Self)]"
				parentanchor = center
				size = { 34 34 }
				texture = "gfx/interface/icons/struggle_banners/icon_background_02.dds"
			}

			icon = {
				visible = "[Struggle.IsInterloperCharacter(Character.Self)]"
				parentanchor = center
				size = { 34 34 }
				texture = "gfx/interface/icons/struggle_banners/icon_background_01.dds"
			}

			icon = {
				parentanchor = center
				size = { 30 30 }
				texture = "[Struggle.GetCurrentPhase.GetIcon]"
			}
		}
	}

	type realm_name_and_type_vbox = vbox {
		layoutpolicy_horizontal = expanding

		hbox = {
			layoutpolicy_horizontal = expanding

			text_single = {
				name = "character_title"
				layoutpolicy_horizontal = expanding
				text = "[Title.GetNameNoTooltip|U]"
				default_format = "#medium"
				using = Font_Size_Medium
				max_width = 220
			}

			expand = {}
		}

		text_single = {
			name = "faction"
			visible = "[Title.HasFaction]"
			layoutpolicy_horizontal = expanding
			autoresize = no
			text = "CV_CIVIL_WAR_FACTION"
			default_format = "#low"
			align = nobaseline
			fontsize_min = 14
		}

		text_single = {
			name = "government_type"
			visible = "[Not( Title.HasFaction )]"
			layoutpolicy_horizontal = expanding
			autoresize = no
			text = "CV_REALM_TYPE"
			default_format = "#low"
			align = nobaseline
			fontsize_min = 14
		}
	}

	type button_marry_off = button {
		name = "marry_off_button"
		onclick = "[Character.OpenPlayerInteraction( 'marry_off_interaction' )]"
		enabled = "[Character.IsPlayerInteractionValid( 'marry_off_interaction' )]"

		gfxtype = framedbuttongfx
		effectname = "NoHighlight"
		texture = "gfx/portraits/unknown_portraits/unknown_spouse.dds"
		size = { 195 282 }
		framesize = { 554 780 }
		upframe = 1
		overframe = 2
		alpha = 0.8

		button_icon = {
			parentanchor = center
			alwaystransparent = yes
			size = { 50 50 }
			position = { 0 45 }
			texture = "gfx/interface/icons/faith_doctrine_groups/doctrine_marriage_type.dds"
		}
	}

	type container_secondary = container {
		parentanchor = bottom|hcenter
		position = { 15 0 }
		datacontext = "[CharacterWindow.GetSecondaryCharater]"

		using = Animation_Character_Window_Refresh_Short

		# We only have invalid secondary character here if player can marry them off
		container = {
			name = "tutorial_spouse"
			visible = "[And(Not( Character.IsValid ), Not( GreaterThan_CFixedPoint( GetPlayer.MakeScope.Var('hide_ui_spouse').GetValue, '(CFixedPoint)0' ) ))]"
			position = { 0 35 }
			parentanchor = center
			using = Animation_ShowHide_Standard

			button_marry_off = {
				datacontext = "[CharacterWindow.GetCharacter]"
				visible = "[And( Not( ObjectsEqual( GetPlayer, Character.Self ) ), Not( Character.IsConcubine ) )]"
				tooltip = "CHARACTER_WINDOW_FIND_SPOUSE"
			}

			button_marry_off = {
				datacontext = "[CharacterWindow.GetCharacter]"
				visible = "[ObjectsEqual( GetPlayer, Character.Self )]"
				tooltip = "CHARACTER_WINDOW_FIND_SPOUSE_SELF"
			}
		}

		portrait_character_view_spouse = {
			visible = "[Character.IsValid]"

			state = {
				name = cw_spouse_cycle
				using = Animation_Refresh_FadeOut
			}

			state = {
				using = Animation_Refresh_FadeIn
			}
		}

	}

	type secondary_widget = widget {
		parentanchor = bottom
		allow_outside = yes
		position = { 93 0 }
		size = { 182 60 }
		datacontext = "[CharacterWindow.GetSecondaryCharater]"
		visible = "[Not( GreaterThan_CFixedPoint( GetPlayer.MakeScope.Var('hide_ui_spouse').GetValue, '(CFixedPoint)0' ) )]"
		using = Animation_ShowHide_Standard

		flowcontainer = {
			parentanchor = bottom
			widgetanchor = bottom|left
			position = { 33 -3 }
			ignoreinvisible = yes

			flowcontainer = {
				direction = vertical
				parentanchor = bottom
				margin_right = 5

				portrait_opinion = {
					block "portrait_opinion" {}
				}

				flowcontainer = {
					ignoreinvisible = yes

					text_label_center = {
						text = "[CharacterWindow.GetSecondaryText]"
						max_width = 120
						align = nobaseline
					}

					flowcontainer = {
						visible = "[Or( CharacterWindow.HasPreviousSecondary, CharacterWindow.HasNextSecondary )]"
						margin_bottom = 4
						spacing = -5
						parentanchor = bottom

						using = Animation_ShowHide_Standard

						button_expand = {
							enabled = "[CharacterWindow.HasPreviousSecondary]"
							onclick = "[CharacterWindow.PreviousSecondary]"
							onclick = "[PdxGuiTriggerAllAnimations( 'cw_spouse_cycle' )]"
							tooltip = "[CharacterWindow.GetPreviousSecondaryTooltip]"
							mirror = horizontal
						}

						button_expand = {
							enabled = "[CharacterWindow.HasNextSecondary]"
							onclick = "[CharacterWindow.NextSecondary]"
							onclick = "[PdxGuiTriggerAllAnimations( 'cw_spouse_cycle' )]"
							tooltip = "[CharacterWindow.GetNextSecondaryTooltip]"
						}
					}
				}
			}

			flowcontainer = {
				parentanchor = bottom

				coa_realm_small = {
					visible = "[Character.HasLandedTitles]"
					using = Animation_ShowHide_Standard
					parentanchor = bottom
				}

				portrait_status_icons = {
					parentanchor = bottom
					margin_bottom = 4
				}
			}
		}

		icon = {
			name = "diarchy_active_icon"
			visible = "[And(CharacterWindow.GetCharacter.HasActiveDiarchy, Not(CharacterWindow.ShowMarriageIcon))]"
			parentanchor = bottom
			position = { 0 -3 }
			size = { 30 30 }
			texture = "gfx/interface/icons/scale_of_power.dds"
			tooltip = DIARCH_ICON_TOOLTIP
			using = tooltip_below
		}

		icon = {
			name = "marriage_type_icon"
			visible = "[CharacterWindow.ShowMarriageIcon]"
			parentanchor = bottom
			position = { 0 -3 }
			size = { 30 30 }
			framesize = { 60 60 }
			texture = "gfx/interface/icons/marriage_types.dds"
			frame = "[CharacterWindow.GetMarriageIcon]"
			tooltip = "[CharacterWindow.GetMarriageIconTooltip]"
			using = tooltip_below
		}
	}

	type hbox_character_view_secondary_stats_bar = hbox {
		name = "character_view_secondary_stats_bar"
		visible = "[Character.IsAlive]"
		layoutpolicy_horizontal = expanding

		margin = { 0 5 }
		margin_right = 10

		background = {
			using = Background_Area_Dark
			margin_left = 3
		}

		#Gold
		widget = {
			size = { 72 32 }

			hbox = {
				tooltip = "[Character.GetGoldTooltipWithBalance]"
				using = tooltip_se
				spacing = 3

				expand = {}

				icon = {
					name = "icon_gold"
					size = { 30 30 }
					texture = "gfx/interface/icons/icon_gold.dds"
				}

				text_single = {
					name = "total_gold"
					text = "[Character.GetGold|0]"
					default_format = "#high"
					align = center|nobaseline
					fontsize_min = 12
					max_width = 50
				}

				expand = {}
			}
		}

		divider_light = {
			layoutpolicy_vertical = expanding
		}

		#Prestige
		widget = {
			size = { 72 32 }

			hbox = {
				spacing = 3

				tooltip = "[Character.GetPrestigeTooltipWithBalance]"
				using = tooltip_se

				expand = {}

				icon = {
					name = "icon_prestige"
					size = { 30 30 }
					texture = "[Character.GetPrestigeLevelTexture]"
				}

				text_single = {
					name = "prestige"
					text = "[Character.GetPrestige|0]"
					default_format = "#high"
					align = center|nobaseline
					fontsize_min = 12
					max_width = 50
				}

				expand = {}
			}
		}

		divider_light = {
			layoutpolicy_vertical = expanding
		}

		#Piety
		widget = {
			size = { 72 32 }

			hbox = {
				tooltip = "[Character.GetPietyTooltipWithBalance]"
				using = tooltip_se

				expand = {}

				icon = {
					name = "icon_piety"
					size = { 30 30 }
					texture = "[Character.GetPietyLevelTexture]"
				}

				text_single = {
					name = "piety"
					text = "[Character.GetPiety|0]"
					default_format = "#high"
					align = center|nobaseline
					fontsize_min = 12
					max_width = 50
				}

				expand = {}
			}
		}

		divider_light = {
			visible = "[IsNomad( Character )]"
			layoutpolicy_vertical = expanding
		}

		#Herd
		widget = {
			datacontext = "[Character.GetDomicile]"
			visible = "[IsNomad( Character )]"
			size = { 92 32 }

			hbox = {
				spacing = 3

				tooltip = "[Domicile.GetHerdBreakdown]"
				using = tooltip_se

				expand = {}

				icon = {
					name = "herd_icon"
					size = { 30 30 }
					texture = "gfx/interface/icons/icon_herd.dds"
				}

				text_single = {
					name = "total_herd"
					text = "[Domicile.GetHerd|0]"
					default_format = "#high"
					align = center|nobaseline
					fontsize_min = 12
					max_width = 50
				}

				expand = {}
			}
		}

		divider_light = {
			visible = "[Character.GetGovernment.HasRule( 'administrative' )]"
			layoutpolicy_vertical = expanding
		}

		#Influence
		widget = {
			visible = "[Character.GetGovernment.HasRule( 'administrative' )]"
			size = { 72 32 }

			hbox = {
				spacing = 3

				tooltip = "[Character.GetInfluenceTooltipWithBalance]"
				using = tooltip_se

				expand = {}

				icon = {
					name = "icon_influence"
					size = { 30 30 }
					texture = "[Character.GetInfluenceLevelTexture]"
				}

				text_single = {
					name = "influence"
					text = "[Character.GetInfluence|0]"
					default_format = "#high"
					align = center|nobaseline
					fontsize_min = 12
					max_width = 50
				}

				expand = {}
			}
		}

		divider_light = {
			datacontext = "[Character.GetLegitimacyType]"
			datacontext = "[Character.GetLegitimacyLevel]"
			visible = "[And(LegitimacyType.IsValid, Character.GetGovernment.HasRule( 'legitimacy' ))]"
			layoutpolicy_vertical = expanding
		}

		#Legitimacy
		widget = {
			datacontext = "[Character.GetLegitimacyType]"
			datacontext = "[Character.GetLegitimacyLevel]"
			visible = "[And(LegitimacyType.IsValid, Character.GetGovernment.HasRule( 'legitimacy' ))]"
			size = { 72 32 }

			tooltipwidget = {
				legitimacy_hud_tooltip = {
					datacontext = "[CharacterWindow.GetLegitimacyBar]"
				}
			}

			using = tooltip_se

			hbox = {
				spacing = 3

				expand = {}

				icon = {
					size = { 30 30 }

					texture = "[Character.GetLegitimacyType.GetLevelsIcon]"
					framesize = { 70 70 }
					frame = "[IntToFrameIndex( LegitimacyLevel.GetIndex )]"
				}

				text_single = {
					text = CHARACTER_WINDOW_LEGITIMACY_LEVEL
					align = nobaseline
				}

				expand = {}
			}
		}

		divider_light = {
			visible = "[Character.HasLandedTitles]"
			layoutpolicy_vertical = expanding
		}

		#Dread
		widget = {
			visible = "[Character.HasLandedTitles]"
			size = { 72 32 }

			hbox = {
				visible = "[Character.HasLandedTitles]"
				spacing = 3

				tooltip = "[Character.GetDreadBreakdown]"
				using = tooltip_se

				expand = {}

				icon = {
					name = "dread_icon"
					size = { 30 30 }
					texture = "gfx/interface/icons/icon_dread.dds"
				}

				text_single = {
					name = "total_dread"
					text = "[Character.GetDread|0]"
					default_format = "#high"
					align = center|nobaseline
					fontsize_min = 12
					max_width = 50
				}

				expand = {}
			}
		}

		divider_light = {
			visible = "[Character.HasLandedTitles]"
			layoutpolicy_vertical = expanding
		}

		widget = {
			visible = "[Character.HasLandedTitles]"
			size = { 72 32 }

			tooltip = CHARACTER_WINDOW_MILITARY_STRENGTH_TOOLTIP
			using = tooltip_es

			hbox = {
				spacing = 3

				expand = {}

				icon = {
					name = "icon_combat_strength"
					size = { 30 30 }
					texture = "gfx/interface/icons/icon_soldier.dds"
				}

				text_single = {
					name = "military_total_strength"
					text = "[CharacterWindow.GetCachedMilitaryStrengthText]"
					default_format = "#high"
					align = center|nobaseline
					fontsize_min = 12
					max_width = 80

					progressbar_standard = {
						name = "soldiers_max"
						visible = "[NotEqualTo_int32(CharacterWindow.GetMaxSoldiers, '(int32)0')]"
						parentanchor = bottom|hcenter
						position = { 0 5 }
						size = { 33 8 }
						min = 0
						max = "[IntToFloat(CharacterWindow.GetMaxSoldiers)]"
						value = "[IntToFloat(CharacterWindow.GetCurrentSoldiers)]"
					}
				}

				expand = {}
			}
		}
	}
}

template Background_Area_Titles
{
	texture = "gfx/interface/component_masks/mask_rough_edges.dds"
	spriteType = Corneredtiled
	spriteborder = { 20 20 }
	color = { 0 0 0 0.3 }
	texture_density = 2
}

template Animation_Character_Window_Refresh
{
	state = {
		name = character_window_refresh
		using = Animation_Refresh_FadeOut
		alpha = 0.65
	}

	state = {
		using = Animation_Refresh_FadeIn
	}
}

template Animation_Character_Window_Refresh_Short
{
	state = {
		name = character_window_refresh
		using = Animation_Refresh_FadeOut
		alpha = 0.8
	}

	state = {
		using = Animation_Refresh_FadeIn
		duration = 0.25
	}
}

template Character_Window_Relation_Icon
{
	size = { 24 24 }
	framesize = { 40 40 }

	visible = "[ScriptedRelation.HasRelationBetween( CharacterWindow.GetCharacter, Character.Self )]"

	tooltipwidget = {
		scripted_relation_tooltip = {
			blockoverride "description_text"
			{
				text = "[GetScriptedRelationTooltip( ScriptedRelation, CharacterWindow.GetCharacter, Character )]"
			}
		}
	}
}