& {
	--toolbar-start-end-padding: 3px !important;

	--nav-bar-height: 36px;

	--toolbarbutton-border-radius: 5px !important;
	--toolbarbutton-width: var(--toolbarbutton-height);
	--toolbarbutton-menu-width: var(--toolbarbutton-width);
	--toolbarbutton-outer-padding: .5px !important;
	--toolbarbutton-icon-drop-shadow: drop-shadow(0 1px 0 rgba(255, 255, 255, 1));

	--personal-toolbar-height: 24px;

	&:not([personalbar="newtab"]) #PersonalToolbar {
		padding: 1px !important;
		padding-inline: 3px !important;
		
		> * {
			margin-top: -2px !important;
			margin-bottom: 2px !important;
		}
	}

	&[chromehidden~="toolbar"] {
		#nav-bar {
			padding-inline: 2px !important;
			padding-block: 2px !important;
			height: fit-content !important;
		}

		#urlbar-container {
			margin-inline-start: 0 !important;
			margin-inline-end: 0 !important;
		}
	}

	:not(.widget-overflow-list) > .toolbarbutton-1:not(
		#gkavatar-container > #gk-firefox-account-button,
		#tabs-newtab-button,
		#new-tab-button,
		.subviewbutton,
		#go-button-box) {
		background: transparent !important;
		border: 1px solid transparent !important;

		&::before {
			position: absolute;
			inset: 0;
			background: linear-gradient(
				to bottom,
				var(--toolbarbutton-texture-hot, var(--default-toolbarbutton-texture-hot)),
				transparent
			) !important;
			transition: all 150ms linear;
			opacity: 0;
			height: 100%;
		}

		&::after {
			content: unset;
		}

		&:not([disabled]) {
			&:hover {
				border-color: color-mix(
					in srgb,
					var(--toolbarbutton-border-color-hot, var(--default-toolbarbutton-border-color-hot)) 45%,
					transparent
				) !important;
				box-shadow: 0 1px 0 0 rgba(255,255,255,.3);
				
				&::before {
					opacity: .8;
				}

				.toolbarbutton-badge-stack,
				.toolbarbutton-icon,
				image:first-of-type {
					filter: var(--toolbarbutton-icon-drop-shadow, var(--default-toolbarbutton-icon-drop-shadow));
				}
			}

			&:active,
			&[open] {
				background: linear-gradient(
					to bottom,
					rgb(120,120,120,.4),
					rgb(200,200,200,.35) 10%,
					rgb(120,120,120,.25)
				) !important;
				box-shadow: none !important;
				border-color: var(--toolbarbutton-border-color-active, var(--default-toolbarbutton-border-color-active)) !important;

				&::before {
					transition: none !important;
					opacity: 0;
				}
			}
		}

		.toolbarbutton-badge-stack,
		.toolbarbutton-icon,
		image:first-of-type {
			position: relative;
			z-index: 1;
		}

		&#back-button,
		&#forward-button {
			&:not([disabled]) {
				&:hover {
					border: 1px solid var(--toolbarbutton-border-color-hot, var(--default-toolbarbutton-border-color-hot));
				}

				&:active,
				&[open] {
					border: 1px solid var(--toolbarbutton-border-color-active, var(--default-toolbarbutton-border-color-active)) !important;
				}
			}
		}

		/* bruni: Navigation buttons needs some rethinking. */
		&#back-button {
			border-top-right-radius: var(--toolbarbutton-border-radius) !important;
			border-bottom-right-radius: var(--toolbarbutton-border-radius) !important;
			border-right: 1px solid var(--toolbarbutton-border-color-normal, var(--default-toolbarbutton-border-color-normal));

			&::before,
			&::after {
				border-top-right-radius: var(--toolbarbutton-border-radius) !important;
				border-bottom-right-radius: var(
					--toolbarbutton-border-radius
				) !important;
			}

			&::after {
				border-right: 0;
			}
		}

		&#forward-button {
			margin-inline-start: var(--toolbarbutton-outer-padding) !important;
			border-top-left-radius: var(--toolbarbutton-border-radius) !important;
			border-bottom-left-radius: var(--toolbarbutton-border-radius) !important;
			border-left: 1px solid var(--toolbarbutton-border-color-normal, var(--default-toolbarbutton-border-color-normal));

			&::before,
			&::after {
				border-top-left-radius: var(--toolbarbutton-border-radius) !important;
				border-bottom-left-radius: var(
					--toolbarbutton-border-radius
				) !important;
			}
		}

		&#unified-extensions-button,
		&#searchmode-switcher-button,
		&[type="menu"]:not(#back-button, #forward-button),
		&#PanelUI-menu-button,
		&[class*="webextension"],
		&#gsettings-button,
		&#nav-bar-overflow-button,
		&#developer-button  {
			transition: none;

			&::before {
				transition: none;
			}

			&#searchmode-switcher-button .toolbarbutton-icon {
				width: 19px !important;
				height: 19px !important;
			}
		}
	}


	/*
		GTK+ SysTheme - exclusive toolbarbutton styling
	*/
	&[gksystheme="gtk"]:not([gkthemed], [gkchrthemed], [geckium-sixtyeight]) {
		:not(.widget-overflow-list)
		> .toolbarbutton-1:not(
			#gkavatar-container > #gk-firefox-account-button,
			#tabs-newtab-button,
			#new-tab-button,
			.subviewbutton) {
			&:not([disabled]) {
				&:hover {
					border: none !important;
				}
				&:active,
				&[open] {
					background: unset !important;
					box-shadow: unset !important;
					border: none !important;
				}
			}
		}
	}
	&[gksystheme="gtk"]:not([gkthemed], [gkchrthemed], [geckium-thirtyseven]) {
		#PanelUI-menu-button,
		#chrome-button {
			width: 33px !important;
		}
	}
}