/* LegalMail v36 — global Roundcube toast layer (all tasks) */
#messagestack {
    position: fixed !important;
    top: 18px !important;
    right: 18px !important;
    bottom: auto !important;
    left: auto !important;
    z-index: 5000 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    width: min(370px, calc(100vw - 36px)) !important;
    height: auto !important;
    max-height: calc(100vh - 36px) !important;
    margin: 0 !important;
    pointer-events: none !important;
}
#messagestack > div:not(.voice) {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    min-height: 54px !important;
    margin: 0 !important;
    padding: 11px 42px 11px 13px !important;
    border: 1px solid #e3e7eb !important;
    border-radius: 13px !important;
    background: rgba(255,255,255,.97) !important;
    color: #252a2f !important;
    box-shadow: 0 12px 34px rgba(28,39,49,.15), 0 2px 8px rgba(28,39,49,.08) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    line-height: 1.4 !important;
    overflow: hidden !important;
    pointer-events: auto !important;
    transform-origin: top right;
    will-change: transform, opacity;
    animation: legalmail-toast-in .32s cubic-bezier(.2,.8,.2,1) both;
}
#messagestack > div:not(.voice).legalmail-toast-enter {
    animation: legalmail-toast-in .32s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes legalmail-toast-in {
    0% { opacity: 0; transform: translate3d(22px,-5px,0) scale(.97); }
    100% { opacity: 1; transform: translate3d(0,0,0) scale(1); }
}
#messagestack > div:not(.voice)::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    border-radius: 13px 0 0 13px;
    background: #8a949e;
}
#messagestack > div:not(.voice) > i.icon {
    flex: 0 0 28px !important;
    width: 28px !important;
    height: 28px !important;
    margin: 0 10px 0 0 !important;
    border-radius: 50% !important;
    background: #eef1f4 !important;
    color: #5c6670 !important;
    font-size: 14px !important;
    line-height: 28px !important;
    text-align: center !important;
}
#messagestack > div:not(.voice) > i.icon::before {
    float: none !important;
    width: 28px !important;
    height: 28px !important;
    margin: 0 !important;
    color: inherit !important;
    line-height: 28px !important;
}
#messagestack .alert-success::after { background: #64a873; }
#messagestack .alert-success > i.icon { background: #e8f4eb !important; color: #4c8f5b !important; }
#messagestack .alert-info::after,
#messagestack .alert-info.information::after { background: #78a9cc; }
#messagestack .alert-info > i.icon,
#messagestack .alert-info.information > i.icon { background: #eaf3f9 !important; color: #537f9f !important; }
#messagestack .alert-warning::after { background: #d8a64f; }
#messagestack .alert-warning > i.icon { background: #faf1df !important; color: #9b742f !important; }
#messagestack .alert-danger::after { background: #cf6565; }
#messagestack .alert-danger > i.icon { background: #faeaea !important; color: #ad4b4b !important; }
#messagestack .loading::after { background: #8c969f; }
#messagestack .loading > i.icon { background: #edf0f2 !important; color: #66717a !important; }
#messagestack a {
    color: inherit !important;
    text-decoration: underline !important;
    text-decoration-thickness: 1px !important;
    text-underline-offset: 2px !important;
}
html.dark-mode #messagestack > div:not(.voice),
html.dark-mode #messagestack .alert-success,
html.dark-mode #messagestack .alert-info,
html.dark-mode #messagestack .alert-warning,
html.dark-mode #messagestack .alert-danger,
html.dark-mode #messagestack .loading {
    border-color: #3a4046 !important;
    background: rgba(36,40,44,.97) !important;
    color: #edf0f2 !important;
    box-shadow: 0 14px 36px rgba(0,0,0,.34), 0 2px 8px rgba(0,0,0,.24) !important;
}
@media (prefers-reduced-motion: reduce) {
    #messagestack > div:not(.voice),
    #messagestack > div:not(.voice).legalmail-toast-enter { animation: none !important; }
}
@media screen and (max-width: 520px) {
    #messagestack {
        top: 10px !important;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        max-height: calc(100vh - 20px) !important;
    }
}

/* ========================================================================== 
 * LegalMail v38 — final neutral mail toolbars + no recipient focus ring
 * ========================================================================== */
/* Keep the mail action bars neutral in every mail state (list, opened message,
 * new message and reply).  This file is loaded last, after Elastic/plugin CSS,
 * so plugin/theme action colors cannot turn the controls blue again. */
html body.task-mail #mailtoolbar.toolbar.menu a,
html body.task-mail #mailtoolbar.toolbar.menu a .inner,
html body.task-mail #mailtoolbar.toolbar.menu a span,
html body.task-mail #mailtoolbar.toolbar.menu a::before,
html body.task-mail #mailtoolbar.toolbar.menu a::after,
html body.task-mail #mailtoolbar.toolbar.menu a .inner::before,
html body.task-mail #mailtoolbar.toolbar.menu a .inner::after,
html body.task-mail #mailtoolbar.toolbar.menu .dropbutton,
html body.task-mail #mailtoolbar.toolbar.menu .dropbutton *,
html body.task-mail.action-compose #messagetoolbar.toolbar.menu a,
html body.task-mail.action-compose #messagetoolbar.toolbar.menu a .inner,
html body.task-mail.action-compose #messagetoolbar.toolbar.menu a span,
html body.task-mail.action-compose #messagetoolbar.toolbar.menu a::before,
html body.task-mail.action-compose #messagetoolbar.toolbar.menu a::after,
html body.task-mail.action-compose #messagetoolbar.toolbar.menu a .inner::before,
html body.task-mail.action-compose #messagetoolbar.toolbar.menu a .inner::after,
html body.task-mail.action-compose #messagetoolbar.toolbar.menu .dropbutton,
html body.task-mail.action-compose #messagetoolbar.toolbar.menu .dropbutton * {
    color: #202428 !important;
    -webkit-text-fill-color: #202428 !important;
    fill: #202428 !important;
    text-decoration-color: #202428 !important;
}
html body.task-mail #mailtoolbar.toolbar.menu a.disabled,
html body.task-mail #mailtoolbar.toolbar.menu a.disabled *,
html body.task-mail #mailtoolbar.toolbar.menu a.disabled::before,
html body.task-mail #mailtoolbar.toolbar.menu a.disabled::after,
html body.task-mail.action-compose #messagetoolbar.toolbar.menu a.disabled,
html body.task-mail.action-compose #messagetoolbar.toolbar.menu a.disabled *,
html body.task-mail.action-compose #messagetoolbar.toolbar.menu a.disabled::before,
html body.task-mail.action-compose #messagetoolbar.toolbar.menu a.disabled::after {
    color: #9aa1a7 !important;
    -webkit-text-fill-color: #9aa1a7 !important;
    fill: #9aa1a7 !important;
}
html body.task-mail #mailtoolbar.toolbar.menu a:not(.disabled):hover,
html body.task-mail #mailtoolbar.toolbar.menu a:not(.disabled):focus,
html body.task-mail #mailtoolbar.toolbar.menu a[aria-expanded="true"],
html body.task-mail.action-compose #messagetoolbar.toolbar.menu a:not(.disabled):hover,
html body.task-mail.action-compose #messagetoolbar.toolbar.menu a:not(.disabled):focus,
html body.task-mail.action-compose #messagetoolbar.toolbar.menu a[aria-expanded="true"] {
    color: #111315 !important;
    -webkit-text-fill-color: #111315 !important;
    background-color: #e8eaec !important;
    border-color: #dfe3e6 !important;
    outline: 0 !important;
}

/* Roundcube adds .focus to recipient-input (and tabindex=-1 to legacy tagedit)
 * while typing.  Suppress only that bright Elastic focus halo; the caret remains
 * visible and the field keeps the same quiet surface as Subject/From. */
html body.task-mail.action-compose #compose-headers .recipient-input.focus,
html body.task-mail.action-compose #compose-headers .recipient-input:focus,
html body.task-mail.action-compose #compose-headers .recipient-input:focus-within,
html body.task-mail.action-compose #compose-headers .tagedit-list[tabindex="-1"],
html body.task-mail.action-compose #compose-headers .tagedit-list:focus,
html body.task-mail.action-compose #compose-headers .tagedit-list:focus-within {
    border-color: transparent !important;
    outline: 0 !important;
    box-shadow: none !important;
}
html body.task-mail.action-compose #compose-headers .recipient-input input:focus,
html body.task-mail.action-compose #compose-headers .recipient-input input:focus-visible,
html body.task-mail.action-compose #compose-headers .tagedit-list input:focus,
html body.task-mail.action-compose #compose-headers .tagedit-list input:focus-visible {
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
}

html.dark-mode body.task-mail #mailtoolbar.toolbar.menu a,
html.dark-mode body.task-mail #mailtoolbar.toolbar.menu a .inner,
html.dark-mode body.task-mail #mailtoolbar.toolbar.menu a::before,
html.dark-mode body.task-mail.action-compose #messagetoolbar.toolbar.menu a,
html.dark-mode body.task-mail.action-compose #messagetoolbar.toolbar.menu a .inner,
html.dark-mode body.task-mail.action-compose #messagetoolbar.toolbar.menu a::before {
    color: #e4e7e9 !important;
    -webkit-text-fill-color: #e4e7e9 !important;
    fill: #e4e7e9 !important;
}
html.dark-mode body.task-mail.action-compose #compose-headers .recipient-input.focus,
html.dark-mode body.task-mail.action-compose #compose-headers .recipient-input:focus-within,
html.dark-mode body.task-mail.action-compose #compose-headers .tagedit-list[tabindex="-1"] {
    border-color: transparent !important;
    box-shadow: none !important;
}

/* ========================================================================== 
 * LegalMail v39 — hard neutral toolbar fallback
 * ========================================================================== */
/* This is intentionally more specific than Elastic/plugin action-color rules.
 * Runtime JS repeats it after Roundcube/plugin initialization as a final guard. */
html body.task-mail.action-show div#layout-content.yandex-message-view > div.header div#mailtoolbar.toolbar.menu.yandex-mailtoolbar a:not(.disabled),
html body.task-mail.action-show div#layout-content.yandex-message-view > div.header div#mailtoolbar.toolbar.menu.yandex-mailtoolbar a:not(.disabled) > .inner,
html body.task-mail.action-show div#layout-content.yandex-message-view > div.header div#mailtoolbar.toolbar.menu.yandex-mailtoolbar a:not(.disabled) > span,
html body.task-mail.action-show div#layout-content.yandex-message-view > div.header div#mailtoolbar.toolbar.menu.yandex-mailtoolbar a:not(.disabled)::before,
html body.task-mail.action-show div#layout-content.yandex-message-view > div.header div#mailtoolbar.toolbar.menu.yandex-mailtoolbar a:not(.disabled)::after,
html body.task-mail.action-show div#layout-content.yandex-message-view > div.header div#mailtoolbar.toolbar.menu.yandex-mailtoolbar a:not(.disabled) > .inner::before,
html body.task-mail.action-compose div#layout-content.legalmail-compose-view > div.header div#messagetoolbar.toolbar.menu a:not(.disabled),
html body.task-mail.action-compose div#layout-content.legalmail-compose-view > div.header div#messagetoolbar.toolbar.menu a:not(.disabled) > .inner,
html body.task-mail.action-compose div#layout-content.legalmail-compose-view > div.header div#messagetoolbar.toolbar.menu a:not(.disabled) > span,
html body.task-mail.action-compose div#layout-content.legalmail-compose-view > div.header div#messagetoolbar.toolbar.menu a:not(.disabled)::before,
html body.task-mail.action-compose div#layout-content.legalmail-compose-view > div.header div#messagetoolbar.toolbar.menu a:not(.disabled)::after,
html body.task-mail.action-compose div#layout-content.legalmail-compose-view > div.header div#messagetoolbar.toolbar.menu a:not(.disabled) > .inner::before {
    color: #202428 !important;
    -webkit-text-fill-color: #202428 !important;
    fill: #202428 !important;
    text-decoration-color: #202428 !important;
}
html body.task-mail.action-show div#layout-content.yandex-message-view > div.header div#mailtoolbar.toolbar.menu.yandex-mailtoolbar a:not(.disabled)::before,
html body.task-mail.action-compose div#layout-content.legalmail-compose-view > div.header div#messagetoolbar.toolbar.menu a:not(.disabled)::before {
    filter: grayscale(1) saturate(0) brightness(.30) !important;
}
html body.task-mail.action-show div#layout-content.yandex-message-view > div.header div#mailtoolbar.toolbar.menu.yandex-mailtoolbar a.disabled,
html body.task-mail.action-show div#layout-content.yandex-message-view > div.header div#mailtoolbar.toolbar.menu.yandex-mailtoolbar a.disabled *,
html body.task-mail.action-show div#layout-content.yandex-message-view > div.header div#mailtoolbar.toolbar.menu.yandex-mailtoolbar a.disabled::before,
html body.task-mail.action-compose div#layout-content.legalmail-compose-view > div.header div#messagetoolbar.toolbar.menu a.disabled,
html body.task-mail.action-compose div#layout-content.legalmail-compose-view > div.header div#messagetoolbar.toolbar.menu a.disabled *,
html body.task-mail.action-compose div#layout-content.legalmail-compose-view > div.header div#messagetoolbar.toolbar.menu a.disabled::before {
    color: #9aa1a7 !important;
    -webkit-text-fill-color: #9aa1a7 !important;
    fill: #9aa1a7 !important;
}
html.dark-mode body.task-mail.action-show div#layout-content.yandex-message-view > div.header div#mailtoolbar.toolbar.menu.yandex-mailtoolbar a:not(.disabled),
html.dark-mode body.task-mail.action-show div#layout-content.yandex-message-view > div.header div#mailtoolbar.toolbar.menu.yandex-mailtoolbar a:not(.disabled) *,
html.dark-mode body.task-mail.action-show div#layout-content.yandex-message-view > div.header div#mailtoolbar.toolbar.menu.yandex-mailtoolbar a:not(.disabled)::before,
html.dark-mode body.task-mail.action-compose div#layout-content.legalmail-compose-view > div.header div#messagetoolbar.toolbar.menu a:not(.disabled),
html.dark-mode body.task-mail.action-compose div#layout-content.legalmail-compose-view > div.header div#messagetoolbar.toolbar.menu a:not(.disabled) *,
html.dark-mode body.task-mail.action-compose div#layout-content.legalmail-compose-view > div.header div#messagetoolbar.toolbar.menu a:not(.disabled)::before {
    color: #e4e7e9 !important;
    -webkit-text-fill-color: #e4e7e9 !important;
    fill: #e4e7e9 !important;
    filter: grayscale(1) saturate(0) brightness(1.25) !important;
}
