:root {
  --brand-color: #bd081b;
  --brand-color-dark: #a80717;
  --brand-color-light: #fbe7ea;
}

/* Primary actions */
.btn-primary,
.btn-primary:visited {
  background-color: var(--brand-color) !important;
  border-color: var(--brand-color) !important;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active,
.show > .btn-primary.dropdown-toggle {
  background-color: var(--brand-color-dark) !important;
  border-color: var(--brand-color-dark) !important;
}
.btn-primary:focus,
.btn-primary.focus {
  box-shadow: 0 0 0 0.2rem rgba(189, 8, 27, 0.25) !important;
}

/* Links */
a,
a:visited {
  color: var(--brand-color);
}
a:hover,
a:focus {
  color: var(--brand-color-dark);
}
.btn-link,
a.btn-link,
button.btn-link {
  color: var(--brand-color) !important;
}
.btn-link:hover,
.btn-link:focus,
a.btn-link:hover,
a.btn-link:focus,
button.btn-link:hover,
button.btn-link:focus {
  color: var(--brand-color-dark) !important;
}
.btn-link,
a.btn-link,
button.btn-link {
  color: var(--brand-color) !important;
}
.btn-link:hover,
.btn-link:focus,
a.btn-link:hover,
a.btn-link:focus,
button.btn-link:hover,
button.btn-link:focus {
  color: var(--brand-color-dark) !important;
}

/* Focus/selection accents */
.form-control:focus,
.custom-select:focus,
.custom-file-input:focus ~ .custom-file-label,
.recipient-input.focus {
  border-color: var(--brand-color) !important;
  box-shadow: 0 0 0 0.2rem rgba(189, 8, 27, 0.15) !important;
}
.custom-control-input:focus ~ .custom-control-label::before {
  box-shadow: 0 0 0 0.2rem rgba(189, 8, 27, 0.15) !important;
  border-color: var(--brand-color) !important;
}
.custom-control-input:checked ~ .custom-control-label::before {
  background-color: var(--brand-color) !important;
  border-color: var(--brand-color) !important;
}
.custom-checkbox .custom-control-input:checked ~ .custom-control-label::before,
.custom-radio .custom-control-input:checked ~ .custom-control-label::before,
.custom-switch .custom-control-input:checked ~ .custom-control-label::before {
  background-color: var(--brand-color) !important;
  border-color: var(--brand-color) !important;
}
.custom-control-input:focus ~ .custom-control-label::before {
  box-shadow: 0 0 0 0.2rem rgba(189, 8, 27, 0.15) !important;
  border-color: var(--brand-color) !important;
}
.custom-control-input:checked ~ .custom-control-label::before {
  background-color: var(--brand-color) !important;
  border-color: var(--brand-color) !important;
}
.custom-checkbox .custom-control-input:checked ~ .custom-control-label::before,
.custom-radio .custom-control-input:checked ~ .custom-control-label::before,
.custom-switch .custom-control-input:checked ~ .custom-control-label::before {
  background-color: var(--brand-color) !important;
  border-color: var(--brand-color) !important;
}

/* Menu/selection highlights */
.menu a.selected,
.menu.toolbar a.selected,
.menu.toolbar .dropbutton a.selected,
.listing li.selected,
.listing tr.selected td,
.listing li.selected > a {
  color: inherit;
}
.listing li.selected,
.listing tr.selected td {
  background-color: var(--brand-color-light) !important;
}

/* Options tables (e.g., priority, return receipt, save sent message) */
.table-widget table.options-table tr.selected td,
.table-widget table.options-table tr.selected th {
  background-color: var(--brand-color-light) !important;
  color: #000 !important;
}

/* Contacts: groups list selection */
#groupstab .listing li.selected,
#groupstab .listing li.selected > a,
#groupslist li.selected,
#groupslist li.selected > a {
  background-color: var(--brand-color-light) !important;
  color: #000 !important;
}

/* Contacts: groups list selection */
#groupstab .listing li.selected,
#groupstab .listing li.selected > a,
#groupslist li.selected,
#groupslist li.selected > a {
  background-color: var(--brand-color-light) !important;
  color: #000 !important;
}

/* Options tables (e.g., priority, return receipt, save sent message) */
.table-widget table.options-table tr.selected td,
.table-widget table.options-table tr.selected th {
  background-color: var(--brand-color-light) !important;
  color: #000 !important;
}

/* Dropdowns/menus (select menus, spellcheck, priority, etc.) */
.select-menu .listing li.selected,
.select-menu .listing li.selected > a,
.select-menu .listing li.selected > div > a,
.select-menu .listing li a:hover,
.select-menu .listing li a:focus,
.popupmenu .listing li.selected,
.popupmenu .listing li.selected > a,
.popupmenu .listing li > a:hover,
.popupmenu .listing li > a:focus,
.ui-menu .ui-state-hover,
.ui-menu .ui-state-focus,
.ui-menu .ui-state-active,
.ui-menu .ui-state-active > a,
.ui-menu .ui-state-active .ui-menu-item-wrapper {
  background-color: var(--brand-color-light) !important;
  color: #000 !important;
}

/* Dropdowns/menus (select menus, spellcheck, priority, etc.) */
.select-menu .listing li.selected,
.select-menu .listing li.selected > a,
.select-menu .listing li.selected > div > a,
.select-menu .listing li a:hover,
.select-menu .listing li a:focus,
.popupmenu .listing li.selected,
.popupmenu .listing li.selected > a,
.popupmenu .listing li > a:hover,
.popupmenu .listing li > a:focus,
.ui-menu .ui-state-hover,
.ui-menu .ui-state-focus,
.ui-menu .ui-state-active,
.ui-menu .ui-state-active > a,
.ui-menu .ui-state-active .ui-menu-item-wrapper {
  background-color: var(--brand-color-light) !important;
  color: #000 !important;
}

/* Badges and indicators */
.badge.badge-primary,
.message-partheaders .tag,
.folderlist li.mailbox .unreadcount {
  background-color: var(--brand-color) !important;
  color: #fff !important;
}

/* Dark mode tweaks */
html.dark-mode .btn-primary,
html.dark-mode .btn-primary:visited {
  color: #fff !important;
}
html.dark-mode .listing li.selected,
html.dark-mode .listing tr.selected td {
  background-color: rgba(189, 8, 27, 0.2) !important;
}

/* Sidebar popover (task menu) */
#layout-menu,
#layout-menu .popover-header,
#layout-menu .popover-body {
  background-color: var(--brand-color) !important;
}
#layout-menu .popover-header .button.icon,
#layout-menu .popover-header .button.icon:before,
#layout-menu .popover-header .button.icon .icon:before {
  color: #fff !important;
}

#layout-menu #taskmenu a,
#layout-menu #taskmenu a:before {
  color: #fff !important;
}
#layout-menu #taskmenu .special-buttons a,
#layout-menu #taskmenu .special-buttons a:before {
  color: #fff !important;
}
#layout-menu #taskmenu .special-buttons {
  background-color: var(--brand-color) !important;
}
#layout-menu #taskmenu .special-buttons a,
#layout-menu #taskmenu .special-buttons a:not(:focus) {
  background-color: var(--brand-color) !important;
}
html.dark-mode #layout-menu #taskmenu .special-buttons a:not(:focus) {
  background-color: var(--brand-color) !important;
}
#layout-menu #taskmenu .special-buttons {
  background-color: var(--brand-color) !important;
}
#layout-menu #taskmenu .special-buttons a,
#layout-menu #taskmenu .special-buttons a:not(:focus) {
  background-color: var(--brand-color) !important;
}
html.dark-mode #layout-menu #taskmenu .special-buttons a:not(:focus) {
  background-color: var(--brand-color) !important;
}

#layout-menu #taskmenu a.selected,
#layout-menu #taskmenu a.selected:hover,
#layout-menu #taskmenu a.selected:focus {
  background-color: #fbba09 !important;
  color: #000 !important;
}
#layout-menu #taskmenu a.selected:before,
#layout-menu #taskmenu a.selected:hover:before,
#layout-menu #taskmenu a.selected:focus:before {
  color: #000 !important;
}

/* Hover state: slightly darker red */
#layout-menu #taskmenu a:hover,
#layout-menu #taskmenu a:focus {
  background-color: var(--brand-color-dark) !important;
}
