/**
 * AegisCore Mail — Bulwark-inspired dark theme
 * Override layer on top of Elastic2022
 * Colors: Bulwark dark palette (#09090b bg, #3b82f6 primary)
 */

/* ═══════════════════════════════════════════════════════════════
   CSS VARIABLES — Override Elastic2022 dark-mode palette
   ═══════════════════════════════════════════════════════════════ */

html, html.dark-mode {
  --font: #e4e4e7;
  --font2: #a1a1aa;
  --background: #09090b;
  --backgroundhover: rgba(59, 130, 246, 0.12);
  --backgroundhoverlight: #141418;
  --backgroundtree: #18181b;
  --backgroundbutton: #18181b;
  --backgroundcompose: #3b82f6;
  --backgroundcomposehover: #2563eb;
  --bordercolor: #1e1e24;

  color-scheme: dark;
  scrollbar-color: #27272a #09090b;
}

/* ═══════════════════════════════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════════════════════════════ */

html:not(.touch) ::-webkit-scrollbar { width: 6px; height: 6px; }
html:not(.touch) ::-webkit-scrollbar-track { background: #09090b; }
html:not(.touch) ::-webkit-scrollbar-thumb { background: #27272a; border-radius: 3px; }
html:not(.touch) ::-webkit-scrollbar-thumb:hover { background: #3b82f6; }

/* ═══════════════════════════════════════════════════════════════
   BASE
   ═══════════════════════════════════════════════════════════════ */

body {
  background: #09090b !important;
  color: #e4e4e7 !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', system-ui, sans-serif !important;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(59, 130, 246, 0.3);
  color: #fafafa;
}

a { color: #60a5fa; }
a:hover { color: #93c5fd; }

/* ═══════════════════════════════════════════════════════════════
   LAYOUT PANELS
   ═══════════════════════════════════════════════════════════════ */

#layout,
#layout-menu,
#layout-sidebar,
#layout-list,
#layout-content {
  background: #09090b !important;
}

#layout-sidebar {
  border-right: 1px solid #1e1e24 !important;
}

#layout-list {
  background: #0c0c0f !important;
  border-right: 1px solid #1e1e24 !important;
}

#layout > div > .header,
.header {
  background: #0c0c0f !important;
  border-bottom: 1px solid #1e1e24 !important;
  color: #e4e4e7 !important;
}

#layout > div > .footer,
.footer {
  background: #0c0c0f !important;
  border-top: 1px solid #1e1e24 !important;
  color: #71717a !important;
}

/* ═══════════════════════════════════════════════════════════════
   TASK MENU (left sidebar icons)
   ═══════════════════════════════════════════════════════════════ */

#layout-menu {
  background: #09090b !important;
  border-right: 1px solid #1e1e24 !important;
}

#layout-menu a.button {
  color: #71717a !important;
  transition: all 0.15s ease;
}

#layout-menu a.button:hover {
  color: #e4e4e7 !important;
  background: #18181b !important;
}

#layout-menu a.button.selected {
  color: #3b82f6 !important;
  background: rgba(59, 130, 246, 0.08) !important;
}

/* Compose button — Bulwark blue */
#layout-menu a.button.compose,
a.compose.button,
#layout-sidebar .header a.compose {
  background: transparent !important;
  color: #ffffff !important;
  border: none !important;
  display: block;
  text-decoration: none;
}

#layout-menu a.button.compose:hover,
a.compose.button:hover,
#layout-sidebar .header a.compose:hover {
  background: transparent !important;
}

/* The inner div of compose button = the visible button */
.compose.button div {
  background: #3b82f6 !important;
  color: #fff !important;
  border-radius: 10px !important;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25) !important;
  width: auto !important;
  max-width: 200px;
  margin: 0.75rem 0.75rem 0.5rem !important;
  padding: 0 1.2rem 0 0.8rem !important;
  height: 40px !important;
  line-height: 40px !important;
  font-weight: 600 !important;
  font-size: 0.9rem !important;
  text-align: center;
  transition: all 0.15s ease;
}

.compose.button div:hover {
  background: #2563eb !important;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35) !important;
}

.compose.button .composeicon {
  color: #fff !important;
}

/* ═══════════════════════════════════════════════════════════════
   FOLDER LIST (mailbox tree)
   ═══════════════════════════════════════════════════════════════ */

/* Sidebar header (above folder list) */
#layout-sidebar > .header {
  background: #09090b !important;
  border-bottom: 1px solid #1e1e24 !important;
  min-height: 0 !important;
  padding: 0 !important;
}

#folderlist-content {
  background: #09090b !important;
  padding-top: 0.25rem !important;
}

.treelist.listing li a,
.folderlist li a,
.listing li a,
.listing li span {
  color: #a1a1aa !important;
  transition: all 0.12s ease;
  padding: 0 0.75rem !important;
  line-height: 36px !important;
  border-radius: 6px !important;
  margin: 1px 6px !important;
}

.treelist.listing li a:before,
.folderlist li a:before,
.listing.iconized li a:before {
  color: #52525b !important;
  transition: color 0.12s ease;
}

.treelist.listing li a:hover,
.folderlist li a:hover,
.listing li a:hover {
  color: #e4e4e7 !important;
  background: #18181b !important;
}

.treelist.listing li a:hover:before,
.folderlist li a:hover:before {
  color: #71717a !important;
}

.treelist.listing li.selected > a,
.folderlist li.selected > a,
.listing li.selected > a,
.listing li a.selected {
  color: #fafafa !important;
  background: rgba(59, 130, 246, 0.12) !important;
}

.treelist.listing li.selected > a:before,
.folderlist li.selected > a:before {
  color: #3b82f6 !important;
}

/* Unread count badge */
.unreadcount {
  background: #3b82f6 !important;
  color: #fff !important;
  border-radius: 10px !important;
  font-size: 0.7rem !important;
  font-weight: 600 !important;
  padding: 1px 7px !important;
  min-width: 18px;
  text-align: center;
  line-height: 16px !important;
}

/* Tree toggle arrows */
ul.treelist li div.treetoggle:before {
  color: #52525b !important;
}

/* Sidebar bottom settings button */
#folderlist-content .sidebar-menu,
.sidebar-menu {
  color: #52525b !important;
}

.sidebar-menu:hover {
  color: #a1a1aa !important;
}

/* ═══════════════════════════════════════════════════════════════
   MESSAGE LIST — Email rows
   ═══════════════════════════════════════════════════════════════ */

.messagelist tr {
  border-bottom: 1px solid #111114 !important;
  transition: background 0.1s ease;
}

.messagelist tr td {
  color: #a1a1aa !important;
  border-bottom: 1px solid #111114 !important;
}

.messagelist tr:hover td {
  background: #111118 !important;
}

.messagelist tr.selected td {
  background: rgba(59, 130, 246, 0.1) !important;
  color: #fafafa !important;
}

.messagelist tr.focused td {
  background: rgba(59, 130, 246, 0.06) !important;
}

/* Unread — white bold */
.messagelist tr.unread td {
  color: #fafafa !important;
  font-weight: 600;
}

.messagelist tr.unread td.subject span.subject {
  color: #fafafa !important;
}

/* Flagged / starred */
.messagelist tr.flagged td.flag span,
.messagelist tr td.flag span.flagged {
  color: #eab308 !important;
}

/* Date */
.messagelist td.date,
.messagelist td.subject span.date {
  color: #52525b !important;
}

/* Deleted */
.messagelist tr.deleted td {
  color: #3f3f46 !important;
}

/* ═══════════════════════════════════════════════════════════════
   CONTACT AVATARS (Elastic2022 feature) — Bulwark colors
   ═══════════════════════════════════════════════════════════════ */

.messagelist td.fromto .contact-icon,
.contact-icon {
  border-radius: 50% !important;
  font-weight: 600 !important;
}

/* ═══════════════════════════════════════════════════════════════
   TOOLBAR — Actions (Reply, Forward, etc.)
   ═══════════════════════════════════════════════════════════════ */

.toolbar,
.toolbar.menu {
  background: #0c0c0f !important;
}

.toolbar a.button,
.toolbar a {
  color: #a1a1aa !important;
  transition: all 0.12s ease;
}

.toolbar a.button:hover,
.toolbar a:hover {
  color: #fafafa !important;
  background: #18181b !important;
}

.toolbar a.button.disabled,
.toolbar a.disabled {
  color: #3f3f46 !important;
}

/* sebicon overrides for Elastic2022 custom icons */
.sebicon {
  color: #a1a1aa !important;
  transition: color 0.12s ease;
}

.sebicon:hover {
  color: #fafafa !important;
}

.sebicon.archive:hover {
  color: #3b82f6 !important;
}

.delete:not(.disabled) {
  color: #a1a1aa !important;
}
.delete:not(.disabled):hover {
  color: #ef4444 !important;
}

/* ═══════════════════════════════════════════════════════════════
   SEARCHBAR
   ═══════════════════════════════════════════════════════════════ */

.searchbar,
.searchbar input,
#searchfilter,
#mailsearchform input {
  background: #141418 !important;
  border-color: #27272a !important;
  color: #e4e4e7 !important;
  border-radius: 6px !important;
}

.searchbar input:focus,
#mailsearchform input:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12) !important;
}

/* ═══════════════════════════════════════════════════════════════
   MESSAGE VIEW — Reading pane
   ═══════════════════════════════════════════════════════════════ */

#message-header,
.message-part,
.message-htmlpart {
  background: #09090b !important;
  color: #e4e4e7 !important;
}

#message-header .subject {
  color: #fafafa !important;
  font-weight: 700 !important;
}

#message-header .header-title {
  color: #71717a !important;
}

#message-header .header,
#message-header span {
  color: #a1a1aa !important;
}

#message-header a {
  color: #60a5fa !important;
}

/* Header back bar (Elastic2022 feature) */
.header_back {
  background: #0c0c0f !important;
  border-bottom: 1px solid #1e1e24 !important;
}

.header_topmenu a,
.header_topmenu .sebicon {
  color: #a1a1aa !important;
}

.header_topmenu a:hover,
.header_topmenu .sebicon:hover {
  color: #fafafa !important;
}

/* Attachment list */
#attachment-list {
  background: #111114 !important;
  border-top: 1px solid #1e1e24 !important;
}

#attachment-list li a { color: #a1a1aa !important; }
#attachment-list li a:hover { color: #3b82f6 !important; }

/* ═══════════════════════════════════════════════════════════════
   FORMS — Inputs, selects, textareas
   ═══════════════════════════════════════════════════════════════ */

.form-control,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="search"],
input[type="number"],
select,
textarea,
.custom-select {
  background: #141418 !important;
  border: 1px solid #27272a !important;
  color: #e4e4e7 !important;
  border-radius: 6px !important;
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12) !important;
  outline: none !important;
}

input::placeholder,
textarea::placeholder {
  color: #52525b !important;
}

/* Primary button */
.btn-primary,
button.btn-primary,
input[type="submit"] {
  background: #3b82f6 !important;
  border-color: #3b82f6 !important;
  color: #fff !important;
  border-radius: 6px !important;
  font-weight: 600 !important;
}

.btn-primary:hover {
  background: #2563eb !important;
  border-color: #2563eb !important;
}

/* Secondary button */
.btn-secondary,
.btn-default {
  background: #18181b !important;
  border: 1px solid #27272a !important;
  color: #e4e4e7 !important;
  border-radius: 6px !important;
}

.btn-secondary:hover,
.btn-default:hover {
  background: #27272a !important;
  border-color: #3b82f6 !important;
}

/* Danger */
.btn-danger {
  background: #ef4444 !important;
  border-color: #ef4444 !important;
  color: #fff !important;
}

.btn-danger:hover {
  background: #dc2626 !important;
}

/* ═══════════════════════════════════════════════════════════════
   POPUP MENUS / DROPDOWNS (Elastic2022 enhanced menus)
   ═══════════════════════════════════════════════════════════════ */

.popupmenu,
.popup,
.popover,
.dropdown-menu,
.menu.listing,
#plugin_contextmenu {
  background: #141418 !important;
  border: 1px solid #27272a !important;
  border-radius: 10px !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5) !important;
  color: #e4e4e7 !important;
}

.popupmenu ul.menu li a,
.popup .listing li a,
.dropdown-menu li a,
#plugin_contextmenu a {
  color: #a1a1aa !important;
  border-radius: 6px !important;
  transition: all 0.1s ease;
}

.popupmenu ul.menu li a:hover,
.popup .listing li a:hover,
.dropdown-menu li a:hover,
#plugin_contextmenu a:hover {
  background: rgba(59, 130, 246, 0.12) !important;
  color: #fafafa !important;
}

.popover-header {
  background: #18181b !important;
  border-bottom: 1px solid #27272a !important;
  color: #fafafa !important;
}

/* ═══════════════════════════════════════════════════════════════
   DIALOGS / MODALS
   ═══════════════════════════════════════════════════════════════ */

.ui-dialog,
.modal-content {
  background: #141418 !important;
  border: 1px solid #27272a !important;
  border-radius: 12px !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5) !important;
  color: #e4e4e7 !important;
}

.ui-dialog-titlebar,
.modal-header {
  background: #18181b !important;
  border-bottom: 1px solid #27272a !important;
  color: #fafafa !important;
}

.ui-widget-overlay,
.modal-backdrop {
  background: rgba(0, 0, 0, 0.65) !important;
  backdrop-filter: blur(4px);
}

/* ═══════════════════════════════════════════════════════════════
   NOTIFICATIONS / MESSAGESTACK
   ═══════════════════════════════════════════════════════════════ */

#messagestack div {
  border-radius: 8px !important;
  font-weight: 500;
}

#messagestack div.notice,
#messagestack div.confirmation {
  background: rgba(59, 130, 246, 0.12) !important;
  border: 1px solid rgba(59, 130, 246, 0.2) !important;
  color: #93c5fd !important;
}

#messagestack div.error {
  background: rgba(239, 68, 68, 0.12) !important;
  border: 1px solid rgba(239, 68, 68, 0.2) !important;
  color: #fca5a5 !important;
}

#messagestack div.warning {
  background: rgba(234, 179, 8, 0.12) !important;
  border: 1px solid rgba(234, 179, 8, 0.2) !important;
  color: #fde68a !important;
}

#messagestack div.loading {
  background: #18181b !important;
  border: 1px solid #27272a !important;
  color: #a1a1aa !important;
}

/* ═══════════════════════════════════════════════════════════════
   LOGIN PAGE — Bulwark-style centered card
   ═══════════════════════════════════════════════════════════════ */

body.task-login {
  background: #09090b !important;
}

body.task-login #layout-content {
  background: #09090b !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 100vh !important;
}

body.task-login #logo {
  max-width: 200px !important;
  margin-bottom: 32px !important;
  opacity: 1 !important;
}

body.task-login #login-form {
  background: #141418 !important;
  border: 1px solid #27272a !important;
  border-radius: 12px !important;
  padding: 40px 36px !important;
  max-width: 400px !important;
  width: 100% !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3) !important;
  position: relative;
}

body.task-login #login-form::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, #3b82f6, transparent);
  border-radius: 12px 12px 0 0;
}

body.task-login #login-form .form-group label,
body.task-login #login-form td.title {
  color: #a1a1aa !important;
  font-size: 0.78rem !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;
}

body.task-login #login-form .form-control {
  background: #09090b !important;
  border: 1px solid #27272a !important;
  color: #fafafa !important;
  padding: 12px 16px !important;
  border-radius: 6px !important;
}

body.task-login #login-form .form-control:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15) !important;
}

body.task-login #login-form .btn-primary,
body.task-login #login-form #rcmloginsubmit,
body.task-login #login-form input[type="submit"],
body.task-login #login-form button[type="submit"] {
  background: #3b82f6 !important;
  border: none !important;
  border-radius: 6px !important;
  color: #fff !important;
  padding: 12px !important;
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  width: 100% !important;
  transition: background 0.15s ease;
}

body.task-login #login-form .btn-primary:hover,
body.task-login #login-form button[type="submit"]:hover {
  background: #2563eb !important;
}

body.task-login #login-footer {
  color: #52525b !important;
  font-size: 0.8rem !important;
  margin-top: 20px !important;
}

body.task-login #login-footer a {
  color: #3b82f6 !important;
}

/* ═══════════════════════════════════════════════════════════════
   SETTINGS / PREFERENCES
   ═══════════════════════════════════════════════════════════════ */

.propform td,
.propform th,
.propform label {
  color: #a1a1aa !important;
}

.propform tr {
  border-bottom: 1px solid #1e1e24 !important;
}

fieldset {
  border-color: #27272a !important;
}

fieldset legend {
  color: #fafafa !important;
  font-weight: 600;
}

/* Tabs */
.tabsbar a,
.tabsbar span.tablink {
  color: #71717a !important;
  border-bottom: 2px solid transparent !important;
}

.tabsbar a:hover {
  color: #e4e4e7 !important;
}

.tabsbar a.selected,
.tabsbar span.tablink.selected {
  color: #3b82f6 !important;
  border-bottom-color: #3b82f6 !important;
}

/* ═══════════════════════════════════════════════════════════════
   CONTACTS
   ═══════════════════════════════════════════════════════════════ */

.contacthead {
  background: #0c0c0f !important;
}

.contacthead .names span {
  color: #fafafa !important;
}

#contactpic {
  border-color: #27272a !important;
  background: #18181b !important;
}

/* ═══════════════════════════════════════════════════════════════
   COMPOSE — Email editor
   ═══════════════════════════════════════════════════════════════ */

.compose-headers td,
.compose-headers label {
  color: #a1a1aa !important;
}

.compose-headers button {
  background: #18181b !important;
  color: #a1a1aa !important;
  border: 1px solid #27272a !important;
}

.compose-headers button:hover {
  background: #27272a !important;
  color: #e4e4e7 !important;
}

/* Mini compose (Elastic2022 feature) */
#minicompose_container {
  background: #141418 !important;
  border: 1px solid #27272a !important;
  border-radius: 12px !important;
}

/* ═══════════════════════════════════════════════════════════════
   CHECKBOXES / SWITCHES
   ═══════════════════════════════════════════════════════════════ */

.custom-switch .custom-control-label::before {
  background: #27272a !important;
  border-color: #3f3f46 !important;
}

.custom-switch .custom-control-input:checked ~ .custom-control-label::before,
.custom-control-input:checked ~ .custom-control-label::before {
  background: #3b82f6 !important;
  border-color: #3b82f6 !important;
}

input[type="checkbox"] {
  accent-color: #3b82f6;
}

/* ═══════════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════════ */

table.records-table thead th,
#messagelist-header td {
  background: #0c0c0f !important;
  color: #71717a !important;
  border-bottom: 1px solid #1e1e24 !important;
  font-size: 0.72rem !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

table.records-table tbody td {
  border-bottom: 1px solid #111114 !important;
}

/* ═══════════════════════════════════════════════════════════════
   BOTTOM FOOTER MENU (Elastic2022 mobile feature)
   ═══════════════════════════════════════════════════════════════ */

.footer_menu,
#footer_menu {
  background: #09090b !important;
  border-top: 1px solid #1e1e24 !important;
}

.footer_menu a,
#footer_menu a {
  color: #71717a !important;
}

.footer_menu a:hover,
.footer_menu a.selected,
#footer_menu a:hover,
#footer_menu a.selected {
  color: #3b82f6 !important;
}

/* ═══════════════════════════════════════════════════════════════
   SORT MENU (Elastic2022 feature)
   ═══════════════════════════════════════════════════════════════ */

#listsort-menu {
  background: #141418 !important;
  border: 1px solid #27272a !important;
  border-radius: 10px !important;
}

#listsort-menu ul.menu li a {
  color: #a1a1aa !important;
}

#listsort-menu ul.menu li a:hover {
  background: rgba(59, 130, 246, 0.12) !important;
  color: #fafafa !important;
}

.ultitle {
  color: #52525b !important;
  font-size: 0.72rem !important;
  letter-spacing: 0.06em;
  text-transform: uppercase !important;
}

.ultitleseparator {
  border-top: 1px solid #27272a !important;
}

/* ═══════════════════════════════════════════════════════════════
   PULL-TO-REFRESH (Elastic2022 feature)
   ═══════════════════════════════════════════════════════════════ */

#dragdiv {
  background: #18181b !important;
  border-top: 1px solid #27272a !important;
}

html.dark-mode #dragdiv .hint {
  color: #a1a1aa !important;
}

/* ═══════════════════════════════════════════════════════════════
   CUBE SELECT / CHECKBOX (Elastic2022 feature)
   ═══════════════════════════════════════════════════════════════ */

.cubeselect {
  border-color: #52525b !important;
}

.cubeselect.checked {
  background: #3b82f6 !important;
  border-color: #3b82f6 !important;
}

/* ═══════════════════════════════════════════════════════════════
   WATERMARK / EMPTY STATE
   ═══════════════════════════════════════════════════════════════ */

.watermark,
#messagecontframe {
  background: #09090b !important;
}

/* ═══════════════════════════════════════════════════════════════
   QUOTA BAR
   ═══════════════════════════════════════════════════════════════ */

.quota .bar {
  background: #27272a !important;
  border-radius: 4px !important;
}

.quota .bar .value {
  background: #3b82f6 !important;
  border-radius: 4px !important;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile
   ═══════════════════════════════════════════════════════════════ */

@media screen and (max-width: 768px) {
  body.task-login #login-form {
    margin: 16px !important;
    padding: 28px 20px !important;
  }

  #layout-menu {
    background: #09090b !important;
    border-top: 1px solid #1e1e24 !important;
    border-right: none !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   TRANSITIONS
   ═══════════════════════════════════════════════════════════════ */

.listing li a,
.messagelist tr td,
.toolbar a,
.btn,
a {
  transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

/* ═══════════════════════════════════════════════════════════════
   COMPOSE — Email editor (Elastic2022 custom layout fixes)
   ═══════════════════════════════════════════════════════════════ */

/* Compose header buttons (To, CC, BCC, From) */
.compose-headers button {
  background: #18181b !important;
  color: #a1a1aa !important;
  border: 1px solid #27272a !important;
  border-radius: 6px !important;
  font-weight: 500;
}

.compose-headers button:hover {
  background: #27272a !important;
  color: #e4e4e7 !important;
}

.compose-headers td {
  color: #a1a1aa !important;
  border-color: #1e1e24 !important;
}

.compose-headers label {
  color: #a1a1aa !important;
}

/* Send button in compose */
.btn.sendmain,
#compose_button_send .btn-primary {
  background: #3b82f6 !important;
  border-color: #3b82f6 !important;
  color: #fff !important;
  border-radius: 8px !important;
  font-weight: 700 !important;
}

.btn.sendmain:hover,
#compose_button_send .btn-primary:hover {
  background: #2563eb !important;
}

/* Send icon (mobile) */
.sebicon.sendicon {
  color: #3b82f6 !important;
}

/* Back icon */
.sebicon.backicon {
  color: #a1a1aa !important;
}

.sebicon.backicon:hover {
  color: #fafafa !important;
}

/* Compose icon */
.sebicon.composeicon {
  color: #fff !important;
}

/* Subject field */
#compose-subject {
  background: #141418 !important;
  border: 1px solid #27272a !important;
  color: #fafafa !important;
  border-radius: 6px !important;
  font-size: 1rem !important;
}

#compose-subject:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12) !important;
}

#compose-subject::placeholder {
  color: #52525b !important;
}

/* Compose body / textarea */
#composebody,
#composebodycontainer {
  background: #09090b !important;
  color: #e4e4e7 !important;
  border-color: #27272a !important;
}

#composebody {
  background: #0c0c0f !important;
  color: #e4e4e7 !important;
  border: 1px solid #1e1e24 !important;
  border-radius: 0 !important;
}

/* Compose content area */
#compose-content {
  background: #09090b !important;
}

#compose-content .formcontainer {
  background: #09090b !important;
}

/* Compose sidebar (attachments/options) */
#layout-sidebar.sidebar-right {
  background: #0c0c0f !important;
  border-left: 1px solid #1e1e24 !important;
}

#layout-sidebar.sidebar-right .header {
  background: #0c0c0f !important;
  border-bottom: 1px solid #1e1e24 !important;
}

#layout-sidebar.sidebar-right .header .header-title {
  color: #a1a1aa !important;
}

/* Attachment upload area */
.file-upload {
  background: #0c0c0f !important;
}

.file-upload .btn-secondary {
  background: #18181b !important;
  border: 1px solid #27272a !important;
  color: #a1a1aa !important;
}

.file-upload .btn-secondary:hover {
  background: #27272a !important;
  color: #e4e4e7 !important;
}

/* Compose options panel */
#compose-options {
  background: #0c0c0f !important;
  color: #a1a1aa !important;
}

#compose-options .form-group label {
  color: #a1a1aa !important;
}

#compose-options .form-check-input {
  accent-color: #3b82f6;
}

/* Input group (To, CC, BCC fields) */
.input-group .form-control,
.input-group input {
  background: #141418 !important;
  border: 1px solid #27272a !important;
  color: #e4e4e7 !important;
}

.input-group .form-control:focus,
.input-group input:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12) !important;
}

.input-group-append,
.input-group-prepend {
  background: #18181b !important;
  border-color: #27272a !important;
}

.input-group-append a,
.input-group-prepend a,
.input-group-text {
  color: #71717a !important;
  background: #18181b !important;
  border-color: #27272a !important;
}

.input-group-append a:hover,
.input-group-text:hover {
  color: #3b82f6 !important;
}

/* CC / BCC quick buttons */
#mini_cc a,
#mini_bcc a {
  background: #18181b !important;
  color: #71717a !important;
  border-color: #27272a !important;
  border-radius: 4px !important;
  font-size: 0.82rem !important;
}

#mini_cc a:hover,
#mini_bcc a:hover {
  color: #3b82f6 !important;
  border-color: #3b82f6 !important;
}

/* Recipient chips / tokens */
.recipient-input .token,
.recipient-input span.token {
  background: rgba(59, 130, 246, 0.12) !important;
  border: 1px solid rgba(59, 130, 246, 0.2) !important;
  color: #93c5fd !important;
  border-radius: 4px !important;
}

.recipient-input .token a.removetoken {
  color: #71717a !important;
}

.recipient-input .token a.removetoken:hover {
  color: #ef4444 !important;
}

/* TinyMCE / HTML editor */
div.tox {
  background: #09090b !important;
  border-color: #1e1e24 !important;
}

div.tox .tox-toolbar,
div.tox .tox-toolbar__primary,
div.tox .tox-toolbar__overflow {
  background: #0c0c0f !important;
  border-bottom: 1px solid #1e1e24 !important;
}

div.tox .tox-tbtn {
  color: #a1a1aa !important;
}

div.tox .tox-tbtn:hover {
  background: #18181b !important;
  color: #fafafa !important;
}

div.tox .tox-tbtn--enabled,
div.tox .tox-tbtn--enabled:hover {
  background: rgba(59, 130, 246, 0.12) !important;
  color: #3b82f6 !important;
}

div.tox .tox-tbtn svg {
  fill: #a1a1aa !important;
}

div.tox .tox-tbtn:hover svg {
  fill: #fafafa !important;
}

div.tox .tox-edit-area__iframe {
  background: #09090b !important;
}

div.tox .tox-statusbar {
  background: #0c0c0f !important;
  border-top: 1px solid #1e1e24 !important;
  color: #52525b !important;
}

div.tox .tox-menu,
div.tox .tox-collection__item {
  background: #141418 !important;
  color: #a1a1aa !important;
}

div.tox .tox-collection__item:hover {
  background: #18181b !important;
  color: #fafafa !important;
}

div.tox .tox-dialog {
  background: #141418 !important;
  border: 1px solid #27272a !important;
  color: #e4e4e7 !important;
}

div.tox .tox-dialog__header {
  background: #18181b !important;
  color: #fafafa !important;
}

div.tox .tox-dialog__footer {
  background: #141418 !important;
  border-top: 1px solid #1e1e24 !important;
}

div.tox .tox-dialog__body-content input,
div.tox .tox-dialog__body-content textarea,
div.tox .tox-dialog__body-content select {
  background: #09090b !important;
  border: 1px solid #27272a !important;
  color: #e4e4e7 !important;
}

/* ═══════════════════════════════════════════════════════════════
   MINI COMPOSE (Elastic2022 feature) — Bulwark style
   ═══════════════════════════════════════════════════════════════ */

.minicompose_maindiv {
  background: #141418 !important;
  border: 1px solid #27272a !important;
  border-radius: 12px 12px 0 0 !important;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.4) !important;
}

.minicompose_header {
  background: #18181b !important;
  border-bottom: 1px solid #1e1e24 !important;
  border-radius: 12px 12px 0 0 !important;
}

.minicompose_header,
.minicompose_title {
  color: #e4e4e7 !important;
}

.minicompose_send {
  background: #3b82f6 !important;
  color: #fff !important;
  border-radius: 6px !important;
}

.minicompose_send:hover {
  background: #2563eb !important;
}

.minicompose_send .sendicon {
  color: #fff !important;
}

/* ═══════════════════════════════════════════════════════════════
   SEBICONS — Elastic2022 custom font icons
   ═══════════════════════════════════════════════════════════════ */

.sebicon {
  color: #a1a1aa !important;
}

/* ═══════════════════════════════════════════════════════════════
   POPOVER / SCROLLER backgrounds
   ═══════════════════════════════════════════════════════════════ */

.scroller {
  background: transparent !important;
}

.formcontainer,
.formcontent {
  background: transparent !important;
  color: #a1a1aa !important;
}

/* ═══════════════════════════════════════════════════════════════
   HEADER USERNAME (Elastic2022 feature)
   ═══════════════════════════════════════════════════════════════ */

.header-title.username {
  color: #71717a !important;
  font-size: 0.8rem;
}

/* ═══════════════════════════════════════════════════════════════
   MISC ELASTIC2022 OVERRIDES
   ═══════════════════════════════════════════════════════════════ */

/* (Compose button styles consolidated in main compose section above) */

/* Message popmenu (Elastic2022) */
#message-menu-inner,
.message-popmenu {
  background: #141418 !important;
  border: 1px solid #27272a !important;
  border-radius: 10px !important;
}

/* Recipient dialog */
#recipient-dialog {
  background: #141418 !important;
  border: 1px solid #27272a !important;
}

#recipient-dialog .searchbar {
  background: #0c0c0f !important;
}

#recipient-dialog .listing li a {
  color: #a1a1aa !important;
}

#recipient-dialog .listing li a:hover {
  background: rgba(59, 130, 246, 0.1) !important;
  color: #fafafa !important;
}

/* Separator labels in menus */
li.separator label {
  color: #52525b !important;
  font-size: 0.72rem !important;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Editor selector (plain/html toggle) */
#editor-selector {
  background: #0c0c0f !important;
}

#editor-selector label {
  color: #a1a1aa !important;
}

/* Drag div (file drop zone) */
#dragdiv.droptarget {
  background: rgba(59, 130, 246, 0.08) !important;
  border: 2px dashed #3b82f6 !important;
  border-radius: 8px !important;
}

/* Font override — use Inter/system instead of Roboto */
body,
.popover,
button,
div.tox,
div.tox :not(.svg),
input,
optgroup,
select,
textarea {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', system-ui, sans-serif !important;
}
