/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */







:root {
  --panel-ui-exit-subview-gutter-width: 38px;
}

#PanelUI-popup #PanelUI-contents:empty {
  height: 128px;
}

#PanelUI-button {
  margin-inline-start: 2px;
  border-inline-start: 1px solid;
  border-image: linear-gradient(transparent, rgba(0,0,0,.1) 20%, rgba(0,0,0,.1) 80%, transparent);
  border-image-slice: 1;
}

#nav-bar[brighttext] > #PanelUI-button {
  border-image-source: linear-gradient(transparent, rgba(100%,100%,100%,.2) 20%, rgba(100%,100%,100%,.2) 80%, transparent);
}

#PanelUI-menu-button[badge-status] > .toolbarbutton-badge-stack > .toolbarbutton-badge {
  display: -moz-box;
  height: 10px;
  width: 10px;
  background-size: contain;
  border: none;
}

#PanelUI-menu-button[badge-status="download-success"] > .toolbarbutton-badge-stack > .toolbarbutton-badge {
  display: none;
}

#PanelUI-menu-button[badge-status="update-succeeded"] > .toolbarbutton-badge-stack > .toolbarbutton-badge {
  background: #74BF43 url(chrome://browser/skin/update-badge.svg) no-repeat center;
  height: 13px;
}

#PanelUI-menu-button[badge-status="update-failed"] > .toolbarbutton-badge-stack > .toolbarbutton-badge {
  background: #D90000 url(chrome://browser/skin/update-badge-failed.svg) no-repeat center;
  height: 13px;
}

#PanelUI-menu-button[badge-status="download-warning"] > .toolbarbutton-badge-stack > .toolbarbutton-badge {
  box-shadow: none;
  filter: drop-shadow(0 1px 0 hsla(206, 50%, 10%, .15));
}

#PanelUI-menu-button[badge-status="download-warning"] > .toolbarbutton-badge-stack > .toolbarbutton-badge,
#PanelUI-menu-button[badge-status="download-severe"] > .toolbarbutton-badge-stack > .toolbarbutton-badge {
  width: 7px;
  height: 7px;
  min-width: 0;
  border-radius: 50%;
  /* "!important" is necessary to override the rule in toolbarbutton.css */
  margin-top: -1px !important;
  margin-right: -2px !important;
}

#PanelUI-menu-button[badge-status="download-warning"] > .toolbarbutton-badge-stack > .toolbarbutton-badge {
  background: #FFBF00;
}

#PanelUI-menu-button[badge-status="download-severe"] > .toolbarbutton-badge-stack > .toolbarbutton-badge {
  background: #D90000;
}

#PanelUI-menu-button[badge-status="download-warning"] > .toolbarbutton-badge-stack > .toolbarbutton-badge:-moz-window-inactive {
  filter: none;
}

.panel-subviews {
  padding: 4px;
  background-clip: padding-box;
  border-left: 1px solid var(--arrowpanel-border-color);
  box-shadow: 0 3px 5px hsla(210,4%,10%,.1),
              0 0 7px hsla(210,4%,10%,.1);
  margin-inline-start: var(--panel-ui-exit-subview-gutter-width);
}

.panel-viewstack[viewtype="main"] > .panel-subviews {
  transform: translateX(22.35em);
}

.panel-viewstack[viewtype="main"] > .panel-subviews:-moz-locale-dir(rtl) {
  transform: translateX(-22.35em);
}

panelmultiview[nosubviews=true] > .panel-viewcontainer > .panel-viewstack > .panel-subviews {
  display: none;
}

.panel-viewstack:not([viewtype="main"]) > .panel-mainview > #PanelUI-mainView {
  -moz-box-flex: 1;
}

.panel-subview-body {
  overflow-y: auto;
  overflow-x: hidden;
  -moz-box-flex: 1;
}

#PanelUI-popup .panel-subview-body {
  margin: -4px;
  padding: 4px 4px;
}

.panel-subview-header,
.subviewbutton.panel-subview-footer {
  box-sizing: border-box;
  min-height: 41px;
  padding: 11px 12px;
}

.panel-subview-header {
  margin: -4px -4px 4px;
  border-bottom: 1px solid var(--panel-separator-color);
  color: GrayText;
  font-variant: small-caps;
}

.cui-widget-panelview .panel-subview-header {
  display: none;
}

.cui-widget-panelview .subviewbutton.panel-subview-footer {
  margin: 4px 0 0;
  -moz-box-pack: center;
}

#PanelUI-mainView {
  display: flex;
  flex-direction: column;
}

#PanelUI-popup > arrowscrollbox > autorepeatbutton {
  display: none;
}
#PanelUI-popup > arrowscrollbox > scrollbox {
  overflow: visible;
}

#PanelUI-popup > .panel-arrowcontainer > .panel-arrowcontent {
  overflow: hidden;
}

#PanelUI-popup > .panel-arrowcontainer > .panel-arrowcontent,
.cui-widget-panel > .panel-arrowcontainer > .panel-arrowcontent > .popup-internal-box {
  padding: 0;
}

.panelUI-grid .toolbarbutton-1 > .toolbarbutton-menubutton-button > .toolbarbutton-multiline-text,
.panelUI-grid .toolbarbutton-1 > .toolbarbutton-multiline-text {
  line-height: 1.2;
  max-height: 2.4em;
}

.panelUI-grid .toolbarbutton-1:not([auto-hyphens="off"]) > .toolbarbutton-menubutton-button > .toolbarbutton-multiline-text,
.panelUI-grid .toolbarbutton-1:not([auto-hyphens="off"]) > .toolbarbutton-multiline-text {
  -moz-hyphens: auto;
}

.panelUI-grid:not([customize-transitioning]) .toolbarbutton-1 > .toolbarbutton-menubutton-button > .toolbarbutton-multiline-text,
.panelUI-grid:not([customize-transitioning]) .toolbarbutton-1 > .toolbarbutton-multiline-text {
  position: absolute;
  clip: rect(-0.1em, auto, 2.6em, auto);
}

.panelUI-grid .toolbarbutton-1 > .toolbarbutton-text,
.panelUI-grid .toolbarbutton-1 > .toolbarbutton-multiline-text {
  text-align: center;
  /* Need to override toolkit theming which sets margin: 0 !important; */
  margin: 2px 0 0 !important;
}

.panelUI-grid .toolbarbutton-1 > .toolbarbutton-menubutton-button > .toolbarbutton-multiline-text {
  text-align: center;
  margin: -1px 0 0;
}

#wrapper-edit-controls:-moz-any([place="palette"],[place="panel"]) > #edit-controls,
#wrapper-zoom-controls:-moz-any([place="palette"],[place="panel"]) > #zoom-controls {
  margin-inline-start: 0;
}

#PanelUI-contents {
  max-width: 22.35em;
}

#BMB_bookmarksPopup,
.panel-mainview:not([panelid="PanelUI-popup"]) {
  max-width: 30em;
}

/* Give WebExtension stand-alone panels extra width for Chrome compatibility */
.cui-widget-panel[viewId^=PanelUI-webext-] .panel-mainview {
  max-width: 800px;
}

.cui-widget-panel[viewId^=PanelUI-webext-] > .panel-arrowcontainer > .panel-arrowcontent {
  padding: 0;
}

panelview[id^=PanelUI-webext-] {
  overflow: hidden;
}

panelview:not([mainview]) .toolbarbutton-text,
.cui-widget-panel toolbarbutton > .toolbarbutton-text {
  text-align: start;
  display: -moz-box;
}

.cui-widget-panel > .panel-arrowcontainer > .panel-arrowcontent {
  padding: 4px 0;
}

.cui-widget-panel.cui-widget-panelWithFooter > .panel-arrowcontainer > .panel-arrowcontent {
  padding-bottom: 0;
}

#PanelUI-contents {
  display: block;
  flex: 1 0 auto;
  margin-left: auto;
  margin-right: auto;
  padding: .5em 0;
  max-width: 22.35em;
}

#PanelUI-contents-scroller {
  overflow-y: auto;
  overflow-x: hidden;
  width: 22.35em;
  padding-left: 5px;
  padding-right: 5px;
  flex: auto;
}

.panelUI-list #PanelUI-contents {
  padding: 0;
  margin: 0;
}

.panelUI-list #PanelUI-contents-scroller {
  width: auto;
  padding: 0;
}

.toolbaritem-combined-buttons:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]) > toolbarbutton > .toolbarbutton-icon {
  min-width: 0;
  min-height: 0;
  margin: 0;
}

toolbaritem[cui-areatype="menu-panel"][sdkstylewidget="true"]:not(.panel-wide-item),
.panelUI-grid .toolbarbutton-1,
.panel-customization-placeholder-child {
  -moz-appearance: none;
  -moz-box-orient: vertical;
  width: calc((22.35em / 3 - 0.1px));
  height: calc(51px + 2.2em);
}

/* In order to have button labels constrained appropriately, items inside the toolbarpaletteitem
 * should have a min-width set so they abide by the width set above (which they do outside of
 * customize mode because they're in a flexed container) */
toolbarpaletteitem[place="panel"]:not([haswideitem=true]) > .toolbarbutton-1 {
  min-width: 0.01px;
}

/* Help SDK buttons fit in. */
toolbarpaletteitem[place="palette"] > toolbarbutton[constrain-size="true"] > .toolbarbutton-icon,
toolbarpaletteitem[place="palette"] > toolbarbutton[constrain-size="true"] > .toolbarbutton-badge-stack > .toolbarbutton-icon,
toolbarbutton[constrain-size="true"][cui-areatype="menu-panel"] > .toolbarbutton-icon,
toolbarbutton[constrain-size="true"][cui-areatype="menu-panel"] > .toolbarbutton-badge-stack > .toolbarbutton-icon {
  height: 32px;
  width: 32px;
}

toolbarpaletteitem:-moz-any([place="palette"], [place="panel"]) > toolbaritem[sdkstylewidget="true"] > .toolbarbutton-1 > .toolbarbutton-icon {
  width: 32px;
  height: 32px;
}

.customization-palette .toolbarbutton-1 {
  -moz-appearance: none;
  -moz-box-orient: vertical;
}

.panelUI-grid .toolbarbutton-1 > .toolbarbutton-menubutton-button {
  -moz-appearance: none;
  -moz-box-orient: vertical;
  width: calc((22.35em / 3 - 0.1px) - 2px);
  height: calc(49px + 2.2em);
  border: 0;
}

.panelUI-grid .toolbarbutton-1 > .toolbarbutton-menubutton-button > .toolbarbutton-text,
.panelUI-grid .toolbarbutton-1 > .toolbarbutton-menubutton-button > .toolbarbutton-multiline-text {
  margin-top: 2px; /* Hack needed to get the label of type=menu-button aligned with other buttons */
}

.panel-customization-placeholder-child {
  margin: 6px 0 0;
  padding: 2px 6px;
  border: 1px solid transparent;
}

.panelUI-grid .toolbarbutton-1[type="menu"] {
  background-image: url("chrome://browser/skin/toolbarbutton-dropdown-arrow.png");
  background-position: right 3px top 16px;
  background-repeat: no-repeat;
}

.panelUI-grid .toolbarbutton-1[type="menu"]:-moz-locale-dir(rtl) {
  background-position: left 3px top 16px;
}

.panelUI-grid .toolbarbutton-1 > .toolbarbutton-menu-dropmarker {
  display: none;
}

.panelUI-grid .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker {
  -moz-box-align: center;
  width: 16px;
  margin-inline-start: -16px;
  height: 51px;
  margin-bottom: 2.2em;
  padding: 0;
}

.panelUI-grid .toolbarbutton-1:not([buttonover]):not(:-moz-any([disabled],[open],:active)):hover > .toolbarbutton-menubutton-dropmarker {
  background-color: var(--arrowpanel-dimmed) !important;
  border-radius: 0 0 0 2px;
}

.panelUI-grid .toolbarbutton-1:not([buttonover]):not(:-moz-any([disabled],[open],:active)):hover > .toolbarbutton-menubutton-dropmarker:-moz-locale-dir(rtl) {
  border-radius: 0 0 2px 0;
}

#main-window:not([customizing]) .panel-combined-button[disabled] > .toolbarbutton-icon {
  opacity: .5;
}

toolbaritem[cui-areatype="menu-panel"][sdkstylewidget="true"]:not(.panel-wide-item) {
  width: calc((22.35em / 3 - 0.1px));
  margin: 0 !important;
}

toolbaritem[cui-areatype="menu-panel"][sdkstylewidget="true"]:not(.panel-wide-item) {
  -moz-box-align: center;
  -moz-box-pack: center;
}

toolbaritem[cui-areatype="menu-panel"][sdkstylewidget="true"] > iframe {
  margin: 4px auto;
}

#PanelUI-multiView[viewtype="subview"] > .panel-viewcontainer > .panel-viewstack > .panel-mainview >  #PanelUI-mainView {
  background-color: var(--arrowpanel-dimmed);
}

#PanelUI-multiView[viewtype="subview"] #PanelUI-mainView > #PanelUI-contents-scroller > #PanelUI-contents > .panel-wide-item,
#PanelUI-multiView[viewtype="subview"] #PanelUI-mainView > #PanelUI-contents-scroller > #PanelUI-contents > .toolbarbutton-1:not([panel-multiview-anchor="true"]),
#PanelUI-multiView[viewtype="subview"] #PanelUI-mainView > #PanelUI-footer > #PanelUI-update-status,
#PanelUI-multiView[viewtype="subview"] #PanelUI-mainView > #PanelUI-footer > #PanelUI-footer-inner > toolbarseparator,
#PanelUI-multiView[viewtype="subview"] #PanelUI-mainView > #PanelUI-footer > #PanelUI-footer-inner > #PanelUI-customize,
#PanelUI-multiView[viewtype="subview"] #PanelUI-mainView > #PanelUI-footer > #PanelUI-footer-inner > #PanelUI-help:not([panel-multiview-anchor="true"]) {
  opacity: .5;
}

/*
 * XXXgijs: this is a workaround for a layout issue that was caused by these iframes,
 * which was affecting subview display. Because of this, we're hiding the iframe *only*
 * when displaying a subview. The discerning user might notice this, but it's not nearly
 * as bad as the brokenness.
 * This hack should be removed once https://bugzilla.mozilla.org/show_bug.cgi?id=975375
 * is addressed.
 */
#PanelUI-multiView[viewtype="subview"] toolbaritem[cui-areatype="menu-panel"][sdkstylewidget="true"]:not(.panel-wide-item) > iframe {
  visibility: hidden;
}

toolbaritem[cui-areatype="menu-panel"][sdkstylewidget="true"]:not(.panel-wide-item) > .toolbarbutton-text {
  text-align: center;
}

.panelUI-grid .toolbarbutton-1 > .toolbarbutton-menubutton-button > .toolbarbutton-icon,
.panelUI-grid .toolbarbutton-1 > .toolbarbutton-icon,
.panelUI-grid .toolbarbutton-1 > .toolbarbutton-badge-stack,
.customization-palette .toolbarbutton-1 > .toolbarbutton-menubutton-button > .toolbarbutton-icon,
.customization-palette .toolbarbutton-1 > .toolbarbutton-icon,
.customization-palette .toolbarbutton-1 > .toolbarbutton-badge-stack,
.panelUI-grid #bookmarks-toolbar-placeholder > .toolbarbutton-icon,
.customization-palette #bookmarks-toolbar-placeholder > .toolbarbutton-icon,
.panel-customization-placeholder-child > .toolbarbutton-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  /* Explanation for the below formula (A / B - C)
     A
       Each button is (22.35em / 3 - 0.1px) wide
     B
       Each button has two margins.
     C (46px / 2 = 23px)
       The button icon is 32 pixels wide.
       The button has 12px of horizontal padding (6 on each side).
       The button has 2px of horizontal border (1 on each side).
       Total width of button's icon + button padding should therefore be 46px,
       which means each horizontal margin should be the half the button's width - (46/2) px.
  */
  margin: 4px calc((22.35em / 3 - 0.1px) / 2 - 23px);
}

/* above we treat the container as the icon for the margins, that is so the
/* badge itself is positioned correctly. Here we make sure that the icon itself
/* has the minimum size we want, but no padding/margin. */
.panelUI-grid .toolbarbutton-1 > .toolbarbutton-badge-stack > .toolbarbutton-icon,
.customization-palette .toolbarbutton-1 > .toolbarbutton-badge-stack > .toolbarbutton-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  margin: 0;
  padding: 0;
}

toolbarpaletteitem[place="palette"] > toolbaritem > toolbarbutton {
  -moz-box-flex: 1;
}

#personal-bookmarks[overflowedItem=true] > #bookmarks-toolbar-placeholder {
  -moz-box-flex: 1;
}

#personal-bookmarks[cui-areatype="toolbar"][overflowedItem=true] > #bookmarks-toolbar-placeholder > .toolbarbutton-icon {
  margin-inline-end: 2px;
}

/* List layout variant */
.panelUI-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.panelUI-list .toolbarbutton-1,
.panelUI-list .toolbarbutton-1 > .toolbarbutton-menubutton-button {
  -moz-appearance: none;
  -moz-box-orient: horizontal;
  width: 100%;
  height: auto;
  min-height: 48px;
  padding: 8px 12px;
  border: none;
  margin: 0;
}

/* Full width items */
.panelUI-list > #new-window-button,
.panelUI-list > #privatebrowsing-button,
.panelUI-list > #save-page-button,
.panelUI-list > #print-button,
.panelUI-list > #history-panelmenu,
.panelUI-list > #find-button,
.panelUI-list > #preferences-button,
.panelUI-list > #add-ons-button,
.panelUI-list > #developer-button,
.panelUI-list > #characterencoding-button {
  grid-column: 1 / -1;
}

.panelUI-list .toolbarbutton-1 > .toolbarbutton-icon,
.panelUI-list .toolbarbutton-1 > .toolbarbutton-badge-stack {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  margin: 0 12px 0 0;
  margin-inline-end: 12px;
}

.panelUI-list .toolbarbutton-1 > .toolbarbutton-badge-stack > .toolbarbutton-icon {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  margin: 0;
}

.panelUI-list .toolbarbutton-1 > .toolbarbutton-text,
.panelUI-list .toolbarbutton-1 > .toolbarbutton-multiline-text,
.panelUI-list .toolbarbutton-1 > .toolbarbutton-menubutton-button > .toolbarbutton-text,
.panelUI-list .toolbarbutton-1 > .toolbarbutton-menubutton-button > .toolbarbutton-multiline-text {
  text-align: start;
  margin: 0;
  display: -moz-box;
  -moz-box-orient: vertical;
  -moz-box-pack: center;
}

.panelUI-list .toolbarbutton-1[type="menu"] {
  background-image: url("chrome://browser/skin/toolbarbutton-dropdown-arrow.png");
  background-position: right 12px center;
  background-repeat: no-repeat;
  padding-inline-end: 28px;
}

.panelUI-list .toolbarbutton-1[type="menu"]:-moz-locale-dir(rtl) {
  background-position: left 12px center;
  padding-inline-start: 28px;
  padding-inline-end: 12px;
}

.panelUI-list .toolbarbutton-1 > .toolbarbutton-menu-dropmarker {
  display: none;
}

.panelUI-list .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker {
  display: none;
}

.panelUI-list .toolbarbutton-1 > .toolbarbutton-multiline-text,
.panelUI-list .toolbarbutton-1 > .toolbarbutton-menubutton-button > .toolbarbutton-multiline-text {
  display: none !important;
}

#edit-controls:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]) > #copy-button,
#zoom-controls:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]) > #zoom-reset-button {
  border-left: none;
  border-right: none;
  border-radius: 0;
}

#zoom-in-button > .toolbarbutton-text,
#zoom-out-button > .toolbarbutton-text,
#zoom-reset-button > .toolbarbutton-icon {
  display: none;
}

#PanelUI-footer {
  display: flex;
  flex-shrink: 0;
  flex-direction: column;
  background-color: var(--arrowpanel-dimmed);
  padding: 0;
  margin: 0;
}


#PanelUI-update-status[update-status]::after {
  content: "";
  width: 14px;
  height: 14px;
  margin-inline-end: 16.5px;
  box-shadow: 0px 1px 0px rgba(255,255,255,.2) inset, 0px -1px 0px rgba(0,0,0,.1) inset, 0px 1px 0px rgba(12,27,38,.2);
  border-radius: 2px;
  background-size: contain;
  display: -moz-box;
}

#PanelUI-update-status[update-status="succeeded"]::after {
  background-image: url(chrome://browser/skin/update-badge.svg);
  background-color: #74BF43;
}

#PanelUI-update-status[update-status="failed"]::after {
  background-image: url(chrome://browser/skin/update-badge-failed.svg);
  background-color: #D90000;
}

#PanelUI-footer-inner {
  display: flex;
  border-top: 1px solid var(--panel-separator-color);
}

#PanelUI-multiView[viewtype="subview"] #PanelUI-footer-inner {
  position: relative;
}

#PanelUI-footer-inner > toolbarseparator {
  border: 0;
  border-left: 1px solid var(--panel-separator-color);
  margin: 7px 0 7px;
  -moz-appearance: none;
}

#PanelUI-footer-inner:hover > toolbarseparator {
  margin: 0;
}

#PanelUI-update-status,
#PanelUI-help,
#PanelUI-customize,
#PanelUI-quit {
  margin: 0;
  padding: 11px 0;
  box-sizing: border-box;
  min-height: 40px;
  -moz-appearance: none;
  box-shadow: none;
  border: none;
  border-radius: 0;
  transition: background-color;
  -moz-box-orient: horizontal;
}

#PanelUI-update-status {
  border-top: 1px solid var(--panel-separator-color);
}

#PanelUI-update-status {
  border-bottom: 1px solid transparent;
  margin-bottom: -1px;
}

#PanelUI-update-status > .toolbarbutton-text {
  width: 0; /* Fancy cropping solution for flexbox. */
}

#PanelUI-help,
#PanelUI-quit {
  min-width: 46px;
}

#PanelUI-update-status > .toolbarbutton-text,
#PanelUI-customize > .toolbarbutton-text {
  margin: 0;
  padding: 0 6px;
  text-align: start;
}

#PanelUI-help > .toolbarbutton-text,
#PanelUI-quit > .toolbarbutton-text {
  display: none;
}

#PanelUI-update-status > .toolbarbutton-icon,
#PanelUI-customize > .toolbarbutton-icon,
#PanelUI-help > .toolbarbutton-icon,
#PanelUI-quit > .toolbarbutton-icon {
  margin-inline-end: 0;
}

#PanelUI-customize {
  flex: 1;
  padding-inline-start: 15px;
  border-inline-start-style: none;
}

#PanelUI-update-status {
  width: calc(22.35em + 30px);
  padding-inline-start: 15px;
  border-inline-start-style: none;
}

#PanelUI-update-status {
  list-style-image: url(chrome://branding/content/icon16.png);
}

#PanelUI-customize {
  list-style-image: url(chrome://browser/skin/menuPanel-customize.png);
}

#customization-panelHolder #PanelUI-customize {
  list-style-image: url(chrome://browser/skin/customizableui/menuPanel-customizeFinish.png);
}

#PanelUI-help {
  list-style-image: url(chrome://browser/skin/menuPanel-help.png);
}

#PanelUI-quit {
  border-inline-end-style: none;
  list-style-image: url(chrome://browser/skin/menuPanel-exit.png);
}

#PanelUI-customize,
#PanelUI-help,
#PanelUI-quit {
  -moz-image-region: rect(0, 16px, 16px, 0);
}

#PanelUI-customize:hover,
#PanelUI-help:not([disabled]):hover,
#PanelUI-quit:not([disabled]):hover {
  -moz-image-region: rect(0, 32px, 16px, 16px);
}

#PanelUI-customize:hover:active,
#PanelUI-help:not([disabled]):hover:active,
#PanelUI-quit:not([disabled]):hover:active {
  -moz-image-region: rect(0, 48px, 16px, 32px);
}

#PanelUI-help[panel-multiview-anchor="true"] {
  -moz-image-region: rect(0, 64px, 16px, 48px);
}

#PanelUI-help[disabled],
#PanelUI-quit[disabled] {
  opacity: 0.4;
}

#PanelUI-help:not([disabled]):hover,
#PanelUI-customize:hover,
#PanelUI-quit:not([disabled]):hover {
  outline: 1px solid var(--arrowpanel-dimmed);
  background-color: var(--arrowpanel-dimmed);
}

#PanelUI-help:not([disabled]):hover:active,
#PanelUI-customize:hover:active,
#PanelUI-quit:not([disabled]):hover:active {
  outline: 1px solid var(--arrowpanel-dimmed-further);
  background-color: var(--arrowpanel-dimmed-further);
  box-shadow: 0 1px 0 hsla(210,4%,10%,.05) inset;
}

#PanelUI-update-status {
  color: black;
}

#PanelUI-update-status[update-status="succeeded"] {
  background-color: hsla(96,65%,75%,.5);
}

#PanelUI-update-status[update-status="succeeded"]:not([disabled]):hover {
  background-color: hsla(96,65%,75%,.8);
}

#PanelUI-update-status[update-status="succeeded"]:not([disabled]):hover:active {
  background-color: hsl(96,65%,75%);
}

#PanelUI-update-status[update-status="failed"] {
  background-color: hsla(359,69%,84%,.5);
}

#PanelUI-update-status[update-status="failed"]:not([disabled]):hover {
  background-color: hsla(359,69%,84%,.8);
}

#PanelUI-update-status[update-status="failed"]:not([disabled]):hover:active {
  background-color: hsl(359,69%,84%);
}

#PanelUI-quit:not([disabled]):hover {
  background-color: #d94141;
  outline-color: #c23a3a;
}

#PanelUI-quit:not([disabled]):hover:active {
  background-color: #ad3434;
  outline-color: #992e2e;
}

#customization-panelHolder #PanelUI-customize {
  color: white;
  background-color: hsl(108,66%,30%);
  text-shadow: none;
  margin-top: -1px;
}

#customization-panelHolder #PanelUI-customize + toolbarseparator {
  display: none;
}

#customization-panelHolder #PanelUI-customize:hover {
  background-color: hsl(109,65%,26%);
}

#customization-panelHolder #PanelUI-customize:hover:active {
  background-color: hsl(109,65%,22%);
}

#customization-palette .toolbarbutton-multiline-text,
#customization-palette .toolbarbutton-text {
  display: none;
}

panelview .toolbarbutton-1,
.subviewbutton,
.widget-overflow-list .toolbarbutton-1,
.panelUI-grid .toolbarbutton-1 > .toolbarbutton-menubutton-button,
.toolbaritem-combined-buttons:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]) > toolbarbutton {
  -moz-appearance: none;
  padding: 0 6px;
  background-color: transparent;
  border-radius: 2px;
  border-style: solid;
  border-color: transparent;
}

panelview .toolbarbutton-1,
.subviewbutton,
.widget-overflow-list .toolbarbutton-1,
.toolbaritem-combined-buttons:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]) > toolbarbutton {
  border-width: 1px;
}

.subviewbutton.panel-subview-footer {
  border-radius: 0;
  border: none;
}

.subviewbutton.panel-subview-footer > .menu-text {
  -moz-appearance: none;
  margin-inline-start: 0px !important;
  padding-inline-start: 6px;
  padding-inline-end: 6px;
  -moz-box-flex: 0;
  text-align: center;
}

.subviewbutton.panel-subview-footer > .toolbarbutton-icon {
  margin: 0;
}

.subviewbutton.panel-subview-footer > .toolbarbutton-text {
  text-align: center;
  padding: 0;
}

.subviewbutton.panel-subview-footer > .menu-accel-container {
  padding-inline-start: 6px;
}

.subviewbutton:not(.panel-subview-footer) {
  margin: 0;
}

.subviewbutton:not(.panel-subview-footer) > .toolbarbutton-text,
/* Bookmark items need a more specific selector. */
.PanelUI-subView .subviewbutton:not(.panel-subview-footer) > .menu-text,
.PanelUI-subView .subviewbutton:not(.panel-subview-footer) > .menu-iconic-text {
  font: menu;
}

.PanelUI-subView .subviewbutton[shortcut]::after {
  content: attr(shortcut);
  float: right;
  color: GrayText;
}

.PanelUI-subView.cui-widget-panelview .subviewbutton[shortcut]::after {
  margin-inline-start: 10px;
}

/* This is a <label> but it should fit in with the menu font- and colorwise. */
#PanelUI-characterEncodingView-autodetect-label {
  font: menu;
  color: inherit;
}

.cui-widget-panelview .subviewbutton:not(.panel-subview-footer) {
  margin-left: 4px;
  margin-right: 4px;
}

panelview .toolbarbutton-1,
.widget-overflow-list > .toolbarbutton-1:not(:first-child),
.widget-overflow-list > toolbaritem:not(:first-child) {
  margin-top: 6px;
}

panelview .toolbarbutton-1:not(:-moz-any([disabled],[open],:active)):hover,
toolbarbutton.subviewbutton:not(:-moz-any([disabled],[open],:active)):hover,
menu.subviewbutton:not(:-moz-any([disabled],:active))[_moz-menuactive],
menuitem.subviewbutton:not(:-moz-any([disabled],:active))[_moz-menuactive],
.widget-overflow-list .toolbarbutton-1:not(:-moz-any([disabled],[open],:active)):hover,
.toolbaritem-combined-buttons:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]) > toolbarbutton:not(:-moz-any([disabled],[open],:active)):hover {
  background-color: var(--arrowpanel-dimmed);
  border-color: var(--panel-separator-color);
}

.toolbaritem-combined-buttons:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]):not(:-moz-any([disabled],[open],:active)):hover {
  border-color: var(--panel-separator-color);
}

panelview .toolbarbutton-1:-moz-any(:not([disabled]):-moz-any([open],:hover:active),[checked=true]),
toolbarbutton.subviewbutton:not([disabled]):-moz-any([open],:hover:active),
menu.subviewbutton:not([disabled])[_moz-menuactive]:active,
menuitem.subviewbutton:not([disabled])[_moz-menuactive]:active,
.widget-overflow-list .toolbarbutton-1:not([disabled]):-moz-any([open],:hover:active),
.toolbaritem-combined-buttons:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]) > toolbarbutton:not([disabled]):-moz-any([open],:hover:active) {
  background-color: var(--arrowpanel-dimmed-further);
  border-color: var(--panel-separator-color);
  box-shadow: 0 1px 0 hsla(210,4%,10%,.03) inset;
}

.subviewbutton.panel-subview-footer {
  margin: 4px -4px -4px;
  background-color: var(--arrowpanel-dimmed);
  border-top: 1px solid var(--panel-separator-color);
  border-radius: 0;
}

menuitem.panel-subview-footer:not(:-moz-any([disabled],:active))[_moz-menuactive],
.subviewbutton.panel-subview-footer:not(:-moz-any([disabled],[open],:active)):hover {
  background-color: var(--arrowpanel-dimmed-further);
}

menuitem.panel-subview-footer:not([disabled])[_moz-menuactive]:active,
.subviewbutton.panel-subview-footer:not([disabled]):-moz-any([open],:hover:active) {
  background-color: var(--arrowpanel-dimmed-even-further);
  box-shadow: 0 1px 0 hsla(210,4%,10%,.05) inset;
}

#BMB_bookmarksPopup .subviewbutton {
  font: menu;
  font-weight: normal;
}

#BMB_bookmarksPopup .subviewbutton:not([disabled="true"]) {
  color: inherit;
}

#BMB_bookmarksPopup .panel-arrowcontainer > .panel-arrowcontent > .popup-internal-box > .autorepeatbutton-up,
#BMB_bookmarksPopup .panel-arrowcontainer > .panel-arrowcontent > .popup-internal-box > .autorepeatbutton-down {
  -moz-appearance: none;
  margin-top: 0;
  margin-bottom: 0;
}

/* Remove padding on xul:arrowscrollbox to avoid extra padding on footer */
#BMB_bookmarksPopup arrowscrollbox {
  padding-bottom: 0px;
}

#BMB_bookmarksPopup menupopup > .bookmarks-actions-menuseparator {
  /* Hide bottom separator as the styled footer includes a top border serving the same purpose */
  display: none;
}

/* Popups with only one item don't have a footer */
#BMB_bookmarksPopup menupopup[placespopup=true][singleitempopup=true] > hbox > .popup-internal-box > .arrowscrollbox-scrollbox > .scrollbox-innerbox,
/* These popups never have a footer */
#BMB_bookmarksToolbarPopup > hbox > .popup-internal-box > .arrowscrollbox-scrollbox > .scrollbox-innerbox,
#BMB_unsortedBookmarksPopup > hbox > .popup-internal-box > .arrowscrollbox-scrollbox > .scrollbox-innerbox {
  /* And so they need some bottom padding: */
  padding-bottom: 4px;
}

/* Disabled (empty) item is always alone and never has an icon, so fix its left padding */
#BMB_bookmarksPopup menupopup[emptyplacesresult] .bookmark-item.subviewbutton {
  padding-left: 6px;
}

.PanelUI-subView menuseparator,
.PanelUI-subView toolbarseparator,
.cui-widget-panelview menuseparator {
  -moz-appearance: none;
  min-height: 0;
  border-top: 1px solid var(--panel-separator-color);
  border-bottom: none;
  margin: 6px 0;
  padding: 0;
}

.PanelUI-subView menuseparator,
.PanelUI-subView toolbarseparator {
  margin-inline-start: -5px;
  margin-inline-end: -4px;
}

.PanelUI-subView menuseparator.small-separator,
.PanelUI-subView toolbarseparator.small-separator {
  margin-left: 5px;
  margin-right: 5px;
}

.cui-widget-panelview menuseparator.small-separator {
  margin-left: 10px;
  margin-right: 10px;
}

.subviewbutton > .menu-accel-container {
  -moz-box-pack: start;
  margin-inline-start: 10px;
  margin-inline-end: auto;
  color: GrayText;
}

#PanelUI-historyItems > toolbarbutton {
  list-style-image: url("chrome://mozapps/skin/places/defaultFavicon.png");
}

@media (min-resolution: 1.1dppx) {
  #PanelUI-historyItems > toolbarbutton {
    list-style-image: url("chrome://mozapps/skin/places/defaultFavicon@2x.png");
  }
}

#PanelUI-recentlyClosedWindows > toolbarbutton > .toolbarbutton-icon,
#PanelUI-recentlyClosedTabs > toolbarbutton > .toolbarbutton-icon,
#PanelUI-historyItems > toolbarbutton > .toolbarbutton-icon {
  width: 16px;
  height: 16px;
}

toolbarbutton[panel-multiview-anchor="true"],
toolbarbutton[panel-multiview-anchor="true"] > .toolbarbutton-menubutton-button {
  color: HighlightText;
  background-color: Highlight;
}

#PanelUI-help[panel-multiview-anchor="true"] + toolbarseparator {
  display: none;
}

#PanelUI-help[panel-multiview-anchor="true"] {
  background-image: linear-gradient(rgba(255,255,255,0.3), transparent);
  background-position: 0;
}

#PanelUI-help[panel-multiview-anchor="true"]::after {
  content: "";
  position: absolute;
  top: 0;
  height: 100%;
  width: var(--panel-ui-exit-subview-gutter-width);
  background-image: url(chrome://browser/skin/customizableui/subView-arrow-back-inverted.png),
                    linear-gradient(rgba(255,255,255,0.3), transparent);
  background-repeat: no-repeat;
  background-color: Highlight;
  background-position: left 10px center, 0;
}

#PanelUI-help[panel-multiview-anchor="true"]:-moz-locale-dir(rtl)::after {
  background-image: url(chrome://browser/skin/customizableui/subView-arrow-back-inverted-rtl.png),
                    linear-gradient(rgba(255,255,255,0.3), transparent);
  background-position: right 10px center, 0;
}

toolbarbutton[panel-multiview-anchor="true"] {
  background-image: url(chrome://browser/skin/customizableui/subView-arrow-back-inverted.png),
                    linear-gradient(rgba(255,255,255,0.3), transparent);
  background-position: right calc((22.35em / 3 - 0.1px) / 2 - var(--panel-ui-exit-subview-gutter-width) + 2px) center;
  background-repeat: no-repeat, repeat;
}

toolbarbutton[panel-multiview-anchor="true"]:-moz-locale-dir(rtl) {
  background-image: url(chrome://browser/skin/customizableui/subView-arrow-back-inverted-rtl.png),
                    linear-gradient(rgba(255,255,255,0.3), transparent);
  background-position: left calc((22.35em / 3 - 0.1px) / 2 - var(--panel-ui-exit-subview-gutter-width) + 2px) center;
}

toolbarpaletteitem[place="palette"] > .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker,
#bookmarks-menu-button[cui-areatype="menu-panel"] > .toolbarbutton-menubutton-dropmarker {
  display: none;
}

#search-container[cui-areatype="menu-panel"],
#wrapper-search-container[place="panel"] {
  width: 22.35em;
}

#search-container[cui-areatype="menu-panel"] {
  margin-top: 6px;
  margin-bottom: 6px;
}

toolbarpaletteitem[place="palette"] > #search-container {
  min-width: 7em;
  width: 7em;
}

.toolbaritem-combined-buttons:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]) {
  background-color: transparent;
  border-radius: 2px;
  border: 1px solid;
  border-color: transparent;
  border-bottom-color: var(--panel-separator-color);
  padding: 0;
  transition-property: background-color, border-color;
  transition-duration: 150ms;
}

/* Make direct siblings overlap borders: */
.toolbaritem-combined-buttons + .toolbaritem-combined-buttons:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]) {
  border-top-color: transparent !important;
}

.toolbaritem-combined-buttons + .toolbaritem-combined-buttons:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]),
toolbarpaletteitem[haswideitem][place="panel"] + toolbarpaletteitem[haswideitem][place="panel"] {
  margin-top: -1px;
}

.toolbaritem-combined-buttons:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]) > toolbarbutton {
  border: 0;
  padding: .5em;
  margin: 0;
  -moz-box-flex: 1;
  min-width: calc((22.35em / 3 - 0.1px));
  max-width: calc((22.35em / 3 - 0.1px));
  /* We'd prefer to use height: auto here but it leads to layout bugs in the panel. Cope:
     1.2em for line height + 2 * .5em padding + margin on the label (2 * 2px) */
  height: calc(2.2em + 4px);
  max-height: none;
  -moz-box-orient: horizontal;
}

#edit-controls:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]) > #copy-button,
#zoom-controls:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]) > #zoom-reset-button {
  /* reduce the width with 2px for this button to compensate for two separators
     of 1px. */
  min-width: calc((22.35em / 3 - 0.1px) - 2px);
  max-width: calc((22.35em / 3 - 0.1px) - 2px);
}

#main-window:not([customizing]) .toolbaritem-combined-buttons:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]) > toolbarbutton[disabled] > .toolbarbutton-icon {
  opacity: .25;
}

#zoom-controls[cui-areatype="toolbar"] > #zoom-reset-button > .toolbarbutton-text {
  min-width: 7ch;
}

#edit-controls:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]) > #cut-button:-moz-locale-dir(ltr),
#edit-controls:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]) > #paste-button:-moz-locale-dir(rtl),
#zoom-controls:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]) > #zoom-out-button:-moz-locale-dir(ltr),
#zoom-controls:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]) > #zoom-in-button:-moz-locale-dir(rtl) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

#edit-controls:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]) > #cut-button:-moz-locale-dir(rtl),
#edit-controls:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]) > #paste-button:-moz-locale-dir(ltr),
#zoom-controls:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]) > #zoom-out-button:-moz-locale-dir(rtl),
#zoom-controls:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]) > #zoom-in-button:-moz-locale-dir(ltr) {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.toolbaritem-combined-buttons:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]) > separator {
  -moz-appearance: none;
  -moz-box-align: stretch;
  margin: .5em 0;
  width: 1px;
  height: auto;
  background: var(--panel-separator-color);
  transition-property: margin;
  transition-duration: 10ms;
  transition-timing-function: ease;
}

.toolbaritem-combined-buttons:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]):hover > separator {
  margin: 0;
}

#widget-overflow > .panel-arrowcontainer > .panel-arrowcontent {
  padding: 0;
}

.cui-widget-panelview,
#widget-overflow-scroller {
  overflow-y: auto;
  overflow-x: hidden;
}

#widget-overflow-scroller {
  max-height: 30em;
  margin-top: 10px;
  margin-bottom: 10px;
}

#widget-overflow-list {
  width: 22.35em;
  padding-left: 10px;
  padding-right: 10px;
}

toolbaritem[overflowedItem=true],
.widget-overflow-list .toolbarbutton-1 {
  width: 100%;
  max-width: 22.35em;
  min-height: 36px;
  background-repeat: no-repeat;
  background-position: 0 center;
}

.widget-overflow-list .toolbarbutton-1,
.widget-overflow-list .toolbarbutton-1 > .toolbarbutton-menubutton-button {
  -moz-box-align: center;
  -moz-box-orient: horizontal;
}

.widget-overflow-list .toolbarbutton-1:not(.toolbarbutton-combined) > .toolbarbutton-text,
.widget-overflow-list .toolbarbutton-1 > .toolbarbutton-menubutton-button > .toolbarbutton-text {
  text-align: start;
  padding-inline-start: .5em;
}

#widget-overflow-list > .toolbaritem-combined-buttons {
  min-height: 28px;
}

.widget-overflow-list .toolbarbutton-1 > .toolbarbutton-menubutton-button::after {
  content: "";
  display: -moz-box;
  width: 1px;
  height: 18px;
  margin-inline-end: -1px;
  background-image: linear-gradient(hsla(210,54%,20%,.2) 0, hsla(210,54%,20%,.2) 18px);
  background-clip: padding-box;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 1px 18px;
  box-shadow: 0 0 0 1px hsla(0,0%,100%,.2);
}

.subviewbutton[checked="true"] {
  background: url("chrome://global/skin/menu/shared-menu-check.png") center left 7px / 11px 11px no-repeat transparent;
}

.subviewbutton[checked="true"]:-moz-locale-dir(rtl) {
  background-position: center right 7px;
}

.subviewbutton > .menu-iconic-left {
  -moz-appearance: none;
  margin-inline-end: 3px;
}

menuitem[checked="true"].subviewbutton > .menu-iconic-left {
  visibility: hidden;
}

#PanelUI-containersItems > .subviewbutton > .toolbarbutton-icon {
  width: 16px;
  height: 16px;
}

.panel-mainview[panelid=customizationui-widget-panel],
#customizationui-widget-multiview > .panel-viewcontainer,
#customizationui-widget-multiview > .panel-viewcontainer > .panel-viewstack,
#PanelUI-panicView > .panel-subview-body,
#PanelUI-panicView {
  overflow: visible;
}

#PanelUI-panicView.cui-widget-panelview {
  min-width: 280px;
}

#PanelUI-panic-timeframe {
  padding: 15px;
  border-bottom: 1px solid var(--panel-separator-color);
}

#panic-button-success-icon,
#PanelUI-panic-timeframe-icon,
#PanelUI-panic-timeframe-icon-small {
  background-color: transparent;
  margin-inline-end: 10px;
}

#panic-button-success-icon,
#PanelUI-panic-timeframe-icon {
  list-style-image: url(chrome://browser/skin/panic-panel/header.png);
  max-height: 48px;
  width: 48px;
}

#PanelUI-panic-timeframe-icon-small {
  list-style-image: url(chrome://browser/skin/panic-panel/header-small.png);
  max-height: 32px;
  width: 32px;
}

/* current attribute is only set when in use as a subview instead of a main view */
#PanelUI-panicView[current] #PanelUI-panic-timeframe-icon {
  display: none;
}

#PanelUI-panicView.cui-widget-panelview #PanelUI-panic-timeframe-icon-small {
  display: none;
}

#panic-button-success-header,
#PanelUI-panic-header {
  -moz-box-align: center;
  margin-bottom: 5px;
}

#PanelUI-panicView.cui-widget-panelview #PanelUI-panic-header {
  margin-bottom: 0;
}

#PanelUI-panic-timeframe-icon-small:-moz-locale-dir(rtl),
#PanelUI-panic-timeframe-icon:-moz-locale-dir(rtl) {
  transform: scaleX(-1);
}

.subviewradio {
  -moz-binding: url(chrome://global/content/bindings/radio.xml#radio);
  -moz-appearance: none;
  -moz-box-align: center;
  padding: 1px;
  margin: 0 0 2px;
  background-color: transparent;
  border-radius: 2px;
  border: 1px solid transparent;
}

.subviewradio:not(:-moz-any([disabled],[open],:active)):hover {
  background-color: var(--arrowpanel-dimmed);
  border-color: var(--panel-separator-color);
}

.subviewradio[selected],
.subviewradio[selected]:hover,
.subviewradio:not([disabled]):-moz-any([open],:hover:active) {
  background-color: var(--arrowpanel-dimmed-further);
  border-color: var(--panel-separator-color);
  box-shadow: 0 1px 0 hsla(210,4%,10%,.03) inset;
}

.subviewradio > .radio-check {
  -moz-appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid #e7e7e7;
  border-radius: 50%;
  margin: 1px 5px;
  background-color: #f1f1f1;
}

.subviewradio > .radio-check[selected] {
  background-color: #fff;
  border: 4px solid #177ee6;
}

#PanelUI-panic-explanations {
  padding: 10px 10px 0;
}

#PanelUI-panic-actionlist-main-label {
  color: GrayText;
  font-size: 0.9em;
}

.PanelUI-panic-actionlist {
  padding-inline-start: 20px;
  padding-top: 2px;
  padding-bottom: 2px;
  background-size: 16px 16px;
  background-repeat: no-repeat;
  background-color: transparent;
  background-position: center left;
}

.PanelUI-panic-actionlist:-moz-locale-dir(rtl) {
  background-position: center right;
}

#PanelUI-panic-actionlist-cookies {
  background-image: -moz-image-rect(url(chrome://browser/skin/panic-panel/icons.png), 0, 16, 16, 0);
}

#PanelUI-panic-actionlist-history {
  background-image: -moz-image-rect(url(chrome://browser/skin/panic-panel/icons.png), 0, 32, 16, 16);
}

#PanelUI-panic-actionlist-windows {
  background-image: -moz-image-rect(url(chrome://browser/skin/panic-panel/icons.png), 0, 48, 16, 32);
}

#PanelUI-panic-actionlist-newwindow {
  background-image: -moz-image-rect(url(chrome://browser/skin/panic-panel/icons.png), 0, 64, 16, 48);
}

#PanelUI-panic-warning {
  color: #C11F14;
  text-align: center;
  width: 100%;
  margin-top: 20px;
}

#PanelUI-panic-view-button {
  -moz-appearance: none;
  background-color: #d92316;
  color: white;
  margin: 5px 15px 11px;
  border: 1px solid #c92014;
  border-radius: 3px;
  padding: 10px;
}

#PanelUI-panic-view-button:hover {
  background-color: #bf1f13;
  border-color: #b81d12;
}

#PanelUI-panic-view-button:hover:active {
  background-color: #99180f;
  border-color: #91170f;
}

#PanelUI-panic-view-button > .toolbarbutton-text {
  text-align: center;
  text-shadow: none;
}

#panic-button-success-closebutton {
  background-color: #e5e5e5;
  color: black;
  margin: 5px 0 0;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 10px;
  -moz-appearance: none;
}

#panic-button-success-closebutton:hover {
  background-color: #dedede;
  border-color: #bbb;
}

#panic-button-success-closebutton:hover:active {
  background-color: #d0d0d0;
  border-color: #aaa;
}

@media (min-resolution: 1.1dppx) {
  #PanelUI-help[panel-multiview-anchor="true"]::after,
  toolbarbutton[panel-multiview-anchor="true"] {
    background-image: url(chrome://browser/skin/customizableui/subView-arrow-back-inverted@2x.png),
                      linear-gradient(rgba(255,255,255,0.3), transparent);
    background-size: 16px, auto;
  }

  #PanelUI-help[panel-multiview-anchor="true"]:-moz-locale-dir(rtl)::after,
  toolbarbutton[panel-multiview-anchor="true"]:-moz-locale-dir(rtl) {
    background-image: url(chrome://browser/skin/customizableui/subView-arrow-back-inverted-rtl@2x.png),
                      linear-gradient(rgba(255,255,255,0.3), transparent);
  }

  #PanelUI-update-status {
    list-style-image: url(chrome://branding/content/icon32.png);
  }

  #PanelUI-customize {
    list-style-image: url(chrome://browser/skin/menuPanel-customize@2x.png);
  }

  #customization-panelHolder #PanelUI-customize {
    list-style-image: url(chrome://browser/skin/customizableui/menuPanel-customizeFinish@2x.png);
  }

  #PanelUI-help {
    list-style-image: url(chrome://browser/skin/menuPanel-help@2x.png);
  }

  #PanelUI-quit {
    list-style-image: url(chrome://browser/skin/menuPanel-exit@2x.png);
  }

  #PanelUI-customize,
  #PanelUI-help,
  #PanelUI-quit {
    -moz-image-region: rect(0, 32px, 32px, 0);
  }

  #PanelUI-update-status > .toolbarbutton-icon,
  #PanelUI-customize > .toolbarbutton-icon,
  #PanelUI-help > .toolbarbutton-icon,
  #PanelUI-quit > .toolbarbutton-icon {
    width: 16px;
  }

  #PanelUI-customize:hover,
  #PanelUI-help:not([disabled]):hover,
  #PanelUI-quit:not([disabled]):hover {
    -moz-image-region: rect(0, 64px, 32px, 32px);
  }

  #PanelUI-customize:hover:active,
  #PanelUI-help:not([disabled]):hover:active,
  #PanelUI-quit:not([disabled]):hover:active {
    -moz-image-region: rect(0, 96px, 32px, 64px);
  }

  #PanelUI-help[panel-multiview-anchor="true"] {
    -moz-image-region: rect(0, 128px, 32px, 96px);
    background-size: auto;
  }

  .subviewbutton[checked="true"] {
    background-image: url("chrome://global/skin/menu/shared-menu-check@2x.png");
  }

  #panic-button-success-icon,
  #PanelUI-panic-timeframe-icon {
    list-style-image: url(chrome://browser/skin/panic-panel/header@2x.png);
  }

  #PanelUI-panic-timeframe-icon-small {
    list-style-image: url(chrome://browser/skin/panic-panel/header-small@2x.png);
  }

  #PanelUI-panic-actionlist-cookies {
    background-image: -moz-image-rect(url(chrome://browser/skin/panic-panel/icons@2x.png), 0, 32, 32, 0);
  }

  #PanelUI-panic-actionlist-history {
    background-image: -moz-image-rect(url(chrome://browser/skin/panic-panel/icons@2x.png), 0, 64, 32, 32);
  }

  #PanelUI-panic-actionlist-windows {
    background-image: -moz-image-rect(url(chrome://browser/skin/panic-panel/icons@2x.png), 0, 96, 32, 64);
  }

  #PanelUI-panic-actionlist-newwindow {
    background-image: -moz-image-rect(url(chrome://browser/skin/panic-panel/icons@2x.png), 0, 128, 32, 96);
  }
}

.panel-subviews {
  background-color: var(--arrowpanel-background);
}

#PanelUI-contents #zoom-out-btn {
  padding-left: 12px;
  padding-right: 12px;
}

#PanelUI-contents #zoom-in-btn {
  padding-left: 12px;
  padding-right: 12px;
}

/* bookmark panel submenus */

#BMB_bookmarksPopup menupopup[placespopup=true] {
  -moz-appearance: none;
  background: transparent;
  border: none;
  padding: 6px;
}

#BMB_bookmarksPopup menupopup[placespopup=true] > hbox {
  /* emulating chrome://browser/content/places/menu.xml#places-popup-arrow but without the arrow */
  box-shadow: 0 0 4px rgba(0,0,0,0.2);
  background: var(--arrowpanel-background);
  color: var(--arrowpanel-color);
  border: 1px solid var(--arrowpanel-border-color);
  border-radius: 3.5px;
  margin-top: -4px;
}

#BMB_bookmarksPopup menupopup {
  padding-top: 2px;
}

/* Add some space at the top because there are no headers: */
#BMB_bookmarksPopup menupopup[placespopup=true] > hbox > .popup-internal-box > .arrowscrollbox-scrollbox > .scrollbox-innerbox  {
  padding-top: 4px;
}

/* bookmark panel separator */
#BMB_bookmarksPopup menuseparator {
  padding-top: 0;
  padding-bottom: 0;
}

.subviewbutton > .menu-right,
.subviewbutton > .menu-iconic-left {
  padding-top: 1px;
  margin-top: 1px;
  margin-bottom: 2px;
}

/* Disabled empty item looks too small otherwise, because it has no icon. */
menuitem.subviewbutton[disabled]:not(.menuitem-iconic),
/* Same for checkbox menu items, whose icons lose size due to -moz-appearance: none: */
menuitem[type="checkbox"].subviewbutton {
  /* This is 16px for an icon + 3px for its margins + 1px for its padding +
   * 2px for its border, see above */
  min-height: 22px;
}

.subviewbutton > .toolbarbutton-text {
  padding-top: 3px;
  padding-bottom: 3px;
}

.widget-overflow-list .toolbarbutton-1 > .toolbarbutton-menubutton-button {
  -moz-appearance: none;
  border: 0;
  margin-inline-start: 3px;
}

.widget-overflow-list .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker {
  padding: 0 2px;
  padding-inline-start: 0;
  height: 18px;
}

.widget-overflow-list .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon {
  padding: 0 6px;
}

.subviewbutton > .toolbarbutton-text {
  padding-inline-start: 16px;
}

.subviewbutton:-moz-any([image],[targetURI],.cui-withicon, .restoreallitem, .bookmark-item) > .toolbarbutton-text {
  padding-inline-start: 0;
}

.subviewbutton:-moz-any([image],[targetURI],.cui-withicon, .restoreallitem, .bookmark-item)[checked="true"] > .toolbarbutton-icon {
  visibility: hidden;
}

menu.subviewbutton > .menu-right {
  -moz-appearance: none;
  list-style-image: url(chrome://browser/skin/customizableui/menu-arrow.svg#arrow);
  /* Reset the rect we inherit from the button: */
  -moz-image-region: auto;
}

menu[disabled="true"].subviewbutton > .menu-right {
  list-style-image: url(chrome://browser/skin/customizableui/menu-arrow.svg#arrow-disabled);
}

@media not all and (-moz-windows-default-theme) {
  menu[_moz-menuactive].subviewbutton > .menu-right {
    list-style-image: url(chrome://browser/skin/customizableui/menu-arrow.svg#arrow-hover);
  }
}

menu.subviewbutton > .menu-right:-moz-locale-dir(rtl) {
  transform: scaleX(-1);
}

/* Win8 and beyond. */
@media not all and (-moz-os-version: windows-xp) {
  @media not all and (-moz-os-version: windows-vista) {
    @media not all and (-moz-os-version: windows-win7) {
      panelview .toolbarbutton-1,
      .subviewbutton,
      .widget-overflow-list .toolbarbutton-1,
      .panelUI-grid .toolbarbutton-1 > .toolbarbutton-menubutton-button,
      #BMB_bookmarksPopup menupopup[placespopup=true] > hbox,
      #edit-controls:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]),
      #zoom-controls:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]),
      #edit-controls:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]) > toolbarbutton,
      #zoom-controls:-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true]) > toolbarbutton {
        border-radius: 0;
      }
    }
  }
}

