:root {
    --arrowpanel-background: white !important;
}

toolbarbutton {
    menupopup {
        &[placespopup] {
            --panel-shadow-margin: 0 !important;
            --panel-background: transparent !important;
            --panel-color: unset !important;
            --panel-border-color: transparent !important;
            --panel-border-radius: 0 !important;
            --panel-padding: 0 !important;
            
            appearance: auto !important;
            -moz-default-appearance: menupopup !important;

            &::part(content) {
                border: 0 !important;
            }

            &::part(content),
            arrowscrollbox {
                box-shadow: none !important;
                margin: 0 !important;
                padding: 0 !important;
            }

            @media not (-moz-windows-non-native-menus) {
                toolbarbutton menupopup[placespopup] {
                    --panel-shadow-margin: 0px !important;
                }
            }

            menuseparator {
                appearance: auto !important;
                margin: 0 !important;

                &::before {
                    content: unset !important;
                }
            }

            > :is(menu, menuitem) {
                min-height: unset !important;
                appearance: auto !important;
                margin: 0 !important;
                min-height: 0 !important;
                margin-inline-start: 2px !important;
                padding-inline-end: 2px !important;
                padding-inline-start: 1.45em !important;
                padding: 1px 0 !important;

                @media (-moz-windows-classic) {
                    min-height: 19px !important;
                    height: 19px !important;
                    max-height: 19px !important;
                }

                :is(.menu-text, .menu-iconic-text, .menu-iconic-icon, .menu-iconic-left, .menu-iconic-accel, .menu-accel-container, .menu-accel, .menu-right) {
                    margin: unset !important;
                    appearance: auto !important;
                }

                .menu-right {
                    transform: translateX(5px) !important;
                }
            }

            > :is(.menu-iconic, .menuitem-iconic) {
                > .menu-iconic-left {
                    margin-inline-start: -2px !important;
                    margin-inline-end: 4px !important;
                }
            }
        }
    }
}

#appMenu-protonMainView {
    background-color: transparent !important;
}

#appMenu-zoom-controls {
    .toolbarbutton-text {
        appearance: menuitemtext !important;
        margin-inline-start: 2px !important;
    }
}

#appMenu-fxa-text {
    appearance: menuitemtext !important;
    margin-inline-start: 2px !important;
}

.menu-right {
    list-style-image: none !important;
}

.menu-accel-container {
    appearance: auto !important;
    margin-left: 24px !important;
}

panel {
    &:is(:not(.cui-widget-panel)) {
        &.panel-no-padding {
            --arrowpanel-border-color: rgb(100,100,100) !important;
            
            toolbarbutton:is(:not(.panel-subview-footer-button)) {
                &:hover {
                    background-color: transparent !important;
                }

                &#identity-popup-security-button {
                    color: rgb(0,0,139) !important;
                    width: fit-content !important;

                    &::after {
                        content: unset !important;
                    }
        
                    &:hover {
						background-color: transparent;
                        text-decoration: underline !important;
                        cursor: pointer !important;

                        .identity-popup-connection-secure {
                            text-decoration: underline !important;
                        }
                    }

                    .toolbarbutton-icon {
                        display: none !important;
                    }

                    .toolbarbutton-text {
                        padding: 0 !important;
                    }
                }
            }

            toolbaritem {
                &.unified-extensions-item {
                    padding-top: 10px !important;
                    padding-bottom: 6px !important;
                }
            }
        }
        
        &#identity-popup,
        &#unified-extensions-panel {
            .panel-header {
                &::before {
                    content: '';
                    min-width: 32px;
                    width: 32px;
                    height: 32px;
                    background-size: 32px;
                    background-position: center;
                    background-repeat: no-repeat;
                    margin-right: 7px !important;
                }
            }
        }
        
        &#identity-popup {
            .panel-header {
                &::before {
                    background-image: url("chrome://userchrome/content/resources/ieframe.dll/Icon Group/31056.ico");
                }
            }

            .subviewbutton-back {
                display: none !important;
            }
        }

        &#unified-extensions-panel {
            .panel-header {
                &::before {
                    background-image: url("chrome://userchrome/content/resources/ieframe.dll/Bitmap/697_30.png");
                }
            }
        }
        
        #unified-extensions-area {
            --uei-icon-size: 32px !important;

            overflow-x: auto !important;
            max-height: 420px !important;
        
            .unified-extensions-item-action-button {
                &:hover {
                    cursor: pointer !important;
        
                    .unified-extensions-item-name {
                        text-decoration: underline !important;
                    }
                }
        
                .unified-extensions-item-name {
                    color: rgb(0,0,139) !important;
                }
            }
        }
        
        .unified-extensions-item-menu-button {
            display: none !important;
        }
        
        .panel-header {
            padding: 13px !important;
        
            h1 {
                font-weight: normal !important;
                font-size: 11pt !important;
                color: rgb(68,101,162);
                text-align: left !important;
            }
        
            + toolbarseparator {
                display: none !important;
            }
        }
        
        .panel-subview-body {
            padding: 20px !important;
            padding-top: 11px !important;
            padding-bottom: 14px !important;
        }
        
        toolbarseparator {
            &:last-of-type {
                width: 100% !important;
                border-top: 1px solid rgb(227,227,227) !important;
                margin: 0 !important;
        
                + .panel-subview-footer-button {
                    border-top: 1px solid white !important;
                }
            }
        }
        
        .panel-subview-footer-button {
            margin: 0 !important;
            height: 35px !important;
            border-top: 1px solid rgb(227,227,227) !important;
            background-color: rgb(240,240,240) !important;
            align-items: center !important;
            display: flex !important;
        
            > toolbarseparator:first-of-type {
                width: 100% !important;
                border-top: 1px solid white !important;
                margin: 0 !important;
            }
        
            > toolbarbutton:last-of-type {
                width: fit-content !important;
                margin: auto !important;
                color: rgb(0,0,139) !important;
                transform: translateY(-1px) !important;
        
                &:hover {
                    text-decoration: underline !important;
                    cursor: pointer !important;
                }
            }
        }
        
        toolbarbutton {
            &.panel-subview-footer-button {
                color: rgb(0,0,139) !important;
        
                &:hover {
                    text-decoration: underline !important;
                    cursor: pointer !important;
                }
        
                .toolbarbutton-text {
                    text-align: center !important;
                    transform: translateY(-1px) !important;
                }
            }
        }
    }

    &.cui-widget-panel {
        toolbarbutton {
            min-height: 24px !important;

            @media (-moz-windows-classic) {
                min-height: 15px !important;
            }

            &:hover {
                background-color: -moz-menuhover !important;

                &::after {
                    color: white !important;
                }

                label {
                    color: white !important;
                }
            }

            &.subviewbutton-nav {
                &::after {
                    content: '' !important;
                    appearance: menuarrow !important;
                }
            }

            &::after {
                margin-inline-end: 10px !important;
            }

            label {
                appearance: auto !important;
                -moz-default-appearance: menuitemtext !important;
                margin-inline-start: 2px !important;
                padding-inline-end: 2px !important;

                @media (-moz-windows-classic) {
                    padding-inline-start: 1.45em !important;
                }
            }
        }

        toolbarseparator {
            appearance: auto !important;
            -moz-default-appearance: menuseparator !important;
            margin: 0 !important;
        }
    }

    panelmultiview[transitioning] {
        pointer-events: auto !important;
    }

    .panel-viewcontainer,
    .panel-viewstack {
        transition: none !important;
    }
}

.panel-footer {
    color-scheme: unset !important;

    button {
        appearance: auto !important;
        color: black !important;
        font-weight: normal !important;
    }
}