/* Mail — Outlook-inspired theme */

:root {
    --sm-blue: #0078d4;
    --sm-blue-hover: #106ebe;
    --sm-selected: #deecf9;
    --sm-background: #f3f4f6;
    --sm-sidebar: #f3f4f6;
    --sm-surface: #ffffff;
    --sm-border: #e1e4e8;
    --sm-text: #242424;
    --sm-secondary: #616161;
    --sm-hover: #edf2f7;
}

html.dark-mode {
    --sm-blue: #479ef5;
    --sm-blue-hover: #2886de;
    --sm-selected: #283f59;
    --sm-background: #202020;
    --sm-sidebar: #242424;
    --sm-surface: #292929;
    --sm-border: #383838;
    --sm-text: #e6e6e6;
    --sm-secondary: #a0a0a0;
    --sm-hover: #303030;
}

/* Typography */

body,
button,
input,
select,
textarea {
    font-family: "Segoe UI", Arial, sans-serif;
}

body {
    color: var(--sm-text);
}

/* Main layout */

#layout {
    background: var(--sm-background);
}

#layout-sidebar {
    background: var(--sm-sidebar) !important;
    border-color: var(--sm-border) !important;
}

#layout-list {
    background: var(--sm-surface) !important;
    border-color: var(--sm-border) !important;
}

#layout-content {
    background: var(--sm-surface);
}

#layout > div > .header {
    background: var(--sm-surface) !important;
    color: var(--sm-text) !important;
    border-color: var(--sm-border) !important;
    min-height: 48px;
}

#layout .footer {
    background: var(--sm-surface);
    border-color: var(--sm-border);
}

/* Application navigation */

#layout-menu {
    background: var(--sm-sidebar) !important;
    border-right: 1px solid var(--sm-border);
}

#taskmenu {
    background: var(--sm-sidebar) !important;
}

#taskmenu a {
    color: var(--sm-secondary) !important;
    transition: background-color .15s ease;
}

#taskmenu a:hover {
    background: var(--sm-hover) !important;
    color: var(--sm-blue) !important;
}

#taskmenu a.selected {
    background: var(--sm-selected) !important;
    color: var(--sm-blue) !important;
    box-shadow: inset 3px 0 var(--sm-blue);
}

#taskmenu a.compose {
    background: #0078d4 !important;
    color: #fff !important;
    border-radius: 6px;
    margin: 6px;
}

#taskmenu a.compose:hover {
    background: #106ebe !important;
}

/* Mail folders */

#mailboxlist {
    padding: 8px 6px;
}

#mailboxlist li > a {
    border-radius: 5px;
    min-height: 36px;
    color: var(--sm-text);
}

#mailboxlist li > a:hover {
    background: var(--sm-hover) !important;
}

#mailboxlist li.selected > a {
    background: var(--sm-selected) !important;
    color: var(--sm-blue) !important;
    font-weight: 600;
}

#mailboxlist li.unread > a {
    font-weight: 600;
}

#mailboxlist .unreadcount {
    background: transparent !important;
    color: var(--sm-blue) !important;
    font-weight: 600;
}

/* Message list */

#messagelist {
    background: var(--sm-surface);
}

#messagelist tbody tr {
    transition: background-color .12s ease;
}

#messagelist tbody tr td {
    border-color: var(--sm-border) !important;
}

#messagelist tbody tr:hover td {
    background: var(--sm-hover);
}

#messagelist tbody tr.selected td {
    background: var(--sm-selected) !important;
    color: var(--sm-text) !important;
}

#messagelist tbody tr.unread .subject {
    font-weight: 600;
}

#messagelist tbody tr.unread .subject a {
    color: var(--sm-blue);
}

/* Search */

.searchbar {
    background: var(--sm-background) !important;
    border-color: var(--sm-border) !important;
}

.searchbar input {
    font-size: 14px;
}

/* Buttons */

.btn {
    border-radius: 5px;
    font-weight: 500;
}

.btn-primary {
    background: #0078d4 !important;
    border-color: #0078d4 !important;
    color: #fff !important;
}

.btn-primary:hover,
.btn-primary:focus {
    background: #106ebe !important;
    border-color: #106ebe !important;
}

.form-control {
    border-radius: 5px;
}

.form-control:focus {
    border-color: var(--sm-blue);
    box-shadow: 0 0 0 2px rgba(0,120,212,.15);
}

/* Toolbar */

.toolbar a {
    border-radius: 5px;
}

.toolbar a:not(.disabled):hover {
    background: var(--sm-hover) !important;
    color: var(--sm-blue) !important;
}

/* Login page */

body.task-login {
    background: linear-gradient(
        135deg,
        #e8f0fa 0%,
        #f5f7fb 50%,
        #dce9f7 100%
    );
}

body.task-login #layout,
body.task-login #layout-content {
    background: transparent !important;
}

body.task-login #login-form {
    background: var(--sm-surface);
    border: 1px solid var(--sm-border);
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 12px 48px rgba(20,50,90,.10);
    width: 100%;
    max-width: 420px;
}

body.task-login #login-form .form-control {
    min-height: 44px;
    font-size: 15px;
}

body.task-login #login-form .btn-primary {
    min-height: 44px;
    font-size: 15px;
}

body.task-login #login-footer {
    color: var(--sm-secondary);
    font-size: 12px;
}

html.dark-mode body.task-login {
    background: linear-gradient(
        135deg,
        #111827,
        #202938
    );
}

/* Desktop */

@media screen and (min-width: 1024px) {
    #layout-sidebar .header-title {
        font-size: 13px;
        font-weight: 600;
    }

    #messagelist-content {
        background: var(--sm-surface);
    }

    #layout-content > .iframe-wrapper {
        background: var(--sm-background);
    }
}

/* Mobile */

@media screen and (max-width: 576px) {
    body.task-login #login-form {
        padding: 24px;
        max-width: calc(100vw - 32px);
    }
}


/* ==========================================
   SAMSONOV MAIL — COMMON DESKTOP INTERFACE
   ========================================== */

#samsonov-topbar,
#samsonov-ribbon {
    display: none;
}

@media screen and (min-width: 1201px) {

    body.sm-desktop #layout {
        padding-top: 48px;
        box-sizing: border-box;
    }

    body.sm-desktop.sm-has-ribbon #layout {
        padding-top: 112px;
    }

    /* Top application bar */

    body.sm-desktop #samsonov-topbar {
        display: flex;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 48px;
        align-items: center;
        background: #0078d4;
        color: #fff;
        padding: 0 18px;
        z-index: 10;
    }

    .sm-brand {
        display: flex;
        align-items: center;
        gap: 12px;
        font-size: 19px;
        font-weight: 600;
        letter-spacing: -.3px;
    }

    /* Navigation rail */

    body.sm-desktop #layout-menu {
        width: 52px !important;
        min-width: 52px !important;
        max-width: 52px !important;
        flex: 0 0 52px !important;
    }

    body.sm-desktop #layout-menu .popover-header {
        display: none !important;
    }

    body.sm-desktop #taskmenu {
        width: 52px !important;
    }

    body.sm-desktop #taskmenu a {
        width: 52px !important;
        min-height: 48px;
        padding: 0 !important;
        margin: 0 !important;
        text-align: center;
    }

    body.sm-desktop #taskmenu a .inner {
        display: none;
    }

    body.sm-desktop #taskmenu a::before {
        display: block;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        font-size: 20px;
        line-height: 48px;
        text-align: center;
    }

    body.sm-desktop #taskmenu a.selected {
        border-radius: 0 6px 6px 0;
    }

    body.sm-desktop #taskmenu .special-buttons {
        background: var(--sm-sidebar) !important;
    }

    /* Main ribbon */

    body.sm-desktop #samsonov-ribbon:not([hidden]) {
        display: flex;
        position: absolute;
        top: 55px;
        left: 60px;
        right: 8px;
        height: 49px;
        align-items: center;
        gap: 14px;
        padding: 6px 10px;
        background: var(--sm-surface);
        border: 1px solid var(--sm-border);
        border-radius: 7px;
        box-sizing: border-box;
        z-index: 15;
    }

    #samsonov-ribbon .sm-compose-slot {
        flex: 0 0 200px;
    }

    #samsonov-ribbon .sm-toolbar-slot {
        flex: 1;
        min-width: 0;
    }

    #samsonov-ribbon .action-buttons {
        position: static !important;
        display: block !important;
        width: 200px !important;
        overflow: visible !important;
    }

    #samsonov-ribbon a.compose,
    #samsonov-ribbon a.create:not(.disabled) {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        gap: 10px;
        height: 35px;
        padding: 0 14px !important;
        margin: 0 !important;
        background: #0078d4 !important;
        color: #fff !important;
        border-radius: 5px;
        white-space: nowrap;
        font-weight: 600;
        text-decoration: none;
    }

    #samsonov-ribbon a.compose {
        width: 200px !important;
        box-sizing: border-box;
    }

    #samsonov-ribbon a.compose::before {
        content: "+";
        font-family: Arial, sans-serif;
        font-size: 23px;
        font-weight: 400;
    }

    #samsonov-ribbon a.compose .inner {
        display: inline !important;
        font-size: 13px;
        overflow: visible !important;
    }

    /* Native Roundcube toolbars */

    #samsonov-ribbon #toolbar-menu,
    #samsonov-ribbon #addressbooktoolbar {
        position: static !important;
        display: flex !important;
        align-items: center;
        justify-content: flex-start;
        height: 35px;
        width: 100%;
        margin: 0;
        padding: 0;
        gap: 4px;
        list-style: none;
        flex-wrap: nowrap;
        overflow: visible !important;
    }

    #samsonov-ribbon #toolbar-menu > li {
        display: flex;
        align-items: center;
        flex: 0 0 auto;
        margin: 0;
        padding: 0;
    }

    #samsonov-ribbon .toolbar a:not(.hidden):not(.hidden-big):not(.hidden-large):not(.dropdown) {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        gap: 7px;
        width: auto;
        max-width: none !important;
        height: 35px;
        padding: 0 10px;
        white-space: nowrap;
        border-radius: 5px;
        text-decoration: none;
    }

    #samsonov-ribbon .toolbar a::before {
        display: inline-block;
        position: static !important;
        width: auto;
        height: auto;
        margin: 0;
        font-size: 16px;
        line-height: 1;
    }

    #samsonov-ribbon .toolbar a .inner {
        display: inline;
        width: auto;
        max-width: none;
        font-size: 13px;
        overflow: visible;
        text-overflow: clip;
        white-space: nowrap;
    }

    #samsonov-ribbon .toolbar a.hidden,
    #samsonov-ribbon .toolbar a.hidden-big,
    #samsonov-ribbon .toolbar a.hidden-large,
    #samsonov-ribbon .toolbar a.dropdown .inner {
        display: none !important;
    }

    #samsonov-ribbon .dropbutton {
        position: relative;
        display: inline-flex !important;
        align-items: center;
        height: 35px;
    }

    #samsonov-ribbon a.dropdown {
        position: static !important;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        height: 35px;
        width: 22px;
        padding: 0;
        margin: 0;
    }

    #samsonov-ribbon a.dropdown::before {
        font-size: 11px;
    }

    #samsonov-ribbon .toolbar a.disabled {
        opacity: .45;
    }

    #samsonov-ribbon .toolbar .spacer {
        width: 1px;
        height: 24px;
        margin: 0 5px;
        background: var(--sm-border);
    }

    /* Common panels */

    body.sm-desktop #layout-sidebar:not(.sidebar-right) {
        flex: 0 0 225px;
        min-width: 200px;
        max-width: 300px;
        border-right: 0;
    }

    body.sm-desktop #layout-list {
        position: relative;
        flex: 0 0 390px;
        min-width: 280px;
        max-width: 36%;
        margin: 8px 4px 8px 0;
        border: 1px solid var(--sm-border);
        border-radius: 8px;
        overflow: hidden;
    }

    body.sm-desktop #layout-content {
        flex: 1;
        min-width: 0;
        margin: 8px;
        border: 1px solid var(--sm-border);
        border-radius: 8px;
        overflow: hidden;
    }

    body.sm-desktop #layout-sidebar .header {
        background: transparent !important;
        border: 0;
    }

    body.sm-desktop.sm-has-ribbon #layout-content > .header {
        height: 0 !important;
        min-height: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        overflow: visible !important;
    }

    body.sm-desktop.sm-has-ribbon #layout-content > .header > .header-title,
    body.sm-desktop.sm-has-ribbon #layout-content > .header > .toolbar-menu-button,
    body.sm-desktop.sm-has-ribbon #layout-content > .header > .back-list-button {
        display: none !important;
    }

    /* Search in the application bar */

    body.sm-desktop.task-mail.action-none #layout-list > .searchbar,
    body.sm-desktop.task-addressbook #layout-list > .searchbar {
        position: fixed !important;
        top: 7px;
        left: 270px;
        width: min(520px, 38vw);
        height: 34px;
        margin: 0 !important;
        border: 0 !important;
        border-radius: 6px;
        background: #fff !important;
        color: #333 !important;
        z-index: 20;
    }

    body.sm-desktop #layout-list > .searchbar input {
        color: #242424 !important;
        background: transparent !important;
    }

    body.sm-desktop #layout-list > .searchbar a {
        color: #444 !important;
    }

    body.sm-desktop #searchmenu {
        z-index: 30;
    }

    /* Folders and contact groups */

    #mailboxlist,
    #directorylist,
    #savedsearchlist {
        padding: 8px 6px;
    }

    #mailboxlist li > a,
    #directorylist li > a,
    #savedsearchlist li > a {
        min-height: 38px;
        padding-top: 8px;
        padding-bottom: 8px;
        font-size: 14px;
        border-radius: 6px;
    }

    #mailboxlist li.selected > a,
    #directorylist li.selected > a,
    #savedsearchlist li.selected > a {
        background: var(--sm-selected) !important;
        color: var(--sm-blue) !important;
        box-shadow: inset 3px 0 var(--sm-blue);
        font-weight: 600;
    }

    #directorylist li > a:hover,
    #savedsearchlist li > a:hover {
        background: var(--sm-hover) !important;
    }

    /* Message and contact lists */

    #messagelist {
        font-size: 14px;
    }

    #messagelist tbody tr td {
        height: 72px !important;
        vertical-align: middle;
    }

    #messagelist .subject {
        font-size: 14px;
        line-height: 1.5;
    }

    #messagelist .fromto {
        font-size: 13px;
        font-weight: 500;
    }

    #messagelist .date {
        font-size: 12px;
        color: var(--sm-secondary);
    }

    #messagelist tbody tr.selected td:first-child {
        box-shadow: inset 3px 0 var(--sm-blue);
    }

    #contacts-table tbody tr td {
        height: 56px;
        vertical-align: middle;
        border-color: var(--sm-border);
    }

    #contacts-table tbody tr.selected td,
    #sections-table tbody tr.selected td {
        background: var(--sm-selected) !important;
        color: var(--sm-blue) !important;
    }

    #contacts-table tbody tr:not(.selected):hover td {
        background: var(--sm-hover);
    }
}

html.dark-mode #samsonov-topbar {
    background: #173b65 !important;
}

/* Contacts and settings refinement */

@media screen and (min-width: 1201px) {

    /* Hide compose button outside mail */

    body.sm-desktop.task-addressbook #taskmenu .action-buttons,
    body.sm-desktop.task-settings #taskmenu .action-buttons {
        display: none !important;
    }

    /* Create contact button */

    body.task-addressbook #samsonov-ribbon a.create {
        background: #0078d4 !important;
        color: #fff !important;
        min-width: 160px;
        font-weight: 600;
        border-radius: 5px;
    }

    body.task-addressbook #samsonov-ribbon a.create:hover {
        background: #106ebe !important;
    }

    /* More compact folder and group navigation */

    #mailboxlist li > a,
    #directorylist li > a {
        min-height: 38px !important;
        padding-top: 6px !important;
        padding-bottom: 6px !important;
    }

    /* Selected settings section */

    body.task-settings .listing li.selected > a {
        background: var(--sm-selected) !important;
        color: var(--sm-blue) !important;
        box-shadow: inset 3px 0 var(--sm-blue);
        font-weight: 600;
    }

}


/* ==========================================
   SAMSONOV MAIL — COMPOSE EDITOR
   ========================================== */

@media screen and (min-width: 1201px) {

    body.sm-desktop.task-mail.action-compose
    #taskmenu .action-buttons {
        display: none !important;
    }

    /* Attachments and options panel */

    body.sm-desktop.task-mail.action-compose
    #layout-sidebar.sidebar-right {
        flex: 0 0 340px !important;
        width: 340px !important;
        min-width: 340px !important;
        max-width: 340px !important;
        margin: 8px 8px 8px 0;
        background: var(--sm-surface) !important;
        border: 1px solid var(--sm-border);
        border-radius: 8px;
        overflow: hidden;
    }

    body.sm-desktop.task-mail.action-compose
    #layout-sidebar > .header {
        background: var(--sm-surface) !important;
        border-bottom: 1px solid var(--sm-border);
        font-size: 14px;
        font-weight: 600;
    }

    /* Editor */

    body.sm-desktop.task-mail.action-compose
    #layout-content {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        background: var(--sm-surface);
    }

    body.task-mail.action-compose .form-control {
        border-color: var(--sm-border);
        min-height: 36px;
        font-size: 14px;
    }

    body.task-mail.action-compose .form-control:focus {
        border-color: var(--sm-blue);
        box-shadow: 0 0 0 2px rgba(0,120,212,.12);
    }

    body.task-mail.action-compose .btn {
        border-radius: 5px;
        font-size: 14px;
    }

    /* Compose footer */

    body.task-mail.action-compose
    #layout-content > .footer {
        background: var(--sm-surface);
        border-top: 1px solid var(--sm-border);
        padding: 10px 16px;
    }

    /* Links */

    body.task-mail.action-compose
    a:not(.btn):not(.disabled):not(.button) {
        color: var(--sm-blue);
    }

}


/* Compose send button */

@media screen and (min-width: 1201px) {

    #samsonov-ribbon .sm-send-slot {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
    }

    #samsonov-ribbon .sm-send-slot a.send {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        gap: 9px;
        min-width: 160px;
        height: 35px;
        padding: 0 18px !important;
        margin: 0 !important;
        background: #0078d4 !important;
        color: #fff !important;
        border: 0;
        border-radius: 5px;
        font-size: 14px;
        font-weight: 600;
        text-decoration: none;
        white-space: nowrap;
    }

    #samsonov-ribbon .sm-send-slot a.send:hover {
        background: #106ebe !important;
    }

    #samsonov-ribbon .sm-send-slot a.send::before {
        display: inline-block;
        position: static !important;
        font-size: 17px;
        margin: 0;
        line-height: 1;
    }

    #samsonov-ribbon .sm-send-slot a.send .inner {
        display: inline !important;
    }

    #samsonov-ribbon .sm-send-slot a.send.disabled {
        opacity: .45;
        pointer-events: none;
    }

}


/* Compose editor refinement */

@media screen and (min-width: 1201px) {

    /* Hide duplicate send button only when ribbon exists */

    body.task-mail.action-compose:has(#samsonov-ribbon .sm-send-slot a.send)
    #layout-content .footer a.send {
        display: none !important;
    }

    /* Send icon */

    #samsonov-ribbon .sm-send-slot a.send::before {
        content: "\f1d8";
        font-family: "Icons";
        font-weight: 900;
        font-size: 16px;
        display: inline-block !important;
        margin-right: 3px;
    }

    /* Consistent toolbar colors */

    body.task-mail.action-compose
    #samsonov-ribbon #toolbar-menu a:not(.disabled) {
        color: var(--sm-text) !important;
    }

    body.task-mail.action-compose
    #samsonov-ribbon #toolbar-menu a:not(.disabled):hover {
        color: var(--sm-blue) !important;
        background: var(--sm-hover) !important;
    }

    /* Attachment drop area */

    body.task-mail.action-compose
    #layout-sidebar .file-upload {
        min-height: 140px !important;
        height: auto !important;
    }

    body.task-mail.action-compose
    #layout-sidebar .file-upload::after {
        font-size: 40px !important;
    }

    /* Prevent awkward word wrapping */

    body.task-mail.action-compose
    #layout-sidebar label {
        word-break: normal;
        overflow-wrap: normal;
        hyphens: none;
    }

}


/* ==========================================
   COMPOSE — FINAL REFINEMENT
   ========================================== */

@media screen and (min-width: 1201px) {

    /* Hide original bottom send button */

    body.task-mail.action-compose:has(
        #samsonov-ribbon .sm-send-slot a.send
    )
    #layout-content .formbuttons button.send {
        display: none !important;
    }

    /* Compact attachment area */

    body.task-mail.action-compose
    #compose-attachments {
        min-height: 140px !important;
        height: auto !important;
        padding: 14px 10px !important;
        background: var(--sm-background);
        border-radius: 6px;
    }

    body.task-mail.action-compose
    #compose-attachments::before,
    body.task-mail.action-compose
    #compose-attachments::after {
        font-size: 36px !important;
    }

    /* Compact options */

    body.task-mail.action-compose
    #compose-options {
        padding-top: 8px !important;
        font-size: 13px;
    }

    body.task-mail.action-compose
    #compose-options td {
        padding-top: 5px !important;
        padding-bottom: 5px !important;
        vertical-align: middle;
    }

    /* Attachment button */

    body.task-mail.action-compose
    #compose-attachments .btn {
        background: var(--sm-surface);
        color: var(--sm-blue);
        border: 1px solid var(--sm-blue);
        border-radius: 5px;
    }

    body.task-mail.action-compose
    #compose-attachments .btn:hover {
        background: var(--sm-selected);
    }

}


/* ==========================================
   COMPOSE — COMPACT HEADER FIELDS
   ========================================== */

@media screen and (min-width: 1201px) {

    body.task-mail.action-compose
    #layout-content .form-group.row > label.col-form-label {
        flex: 0 0 90px !important;
        width: 90px !important;
        max-width: 90px !important;
        font-size: 14px;
        font-weight: 500;
        color: var(--sm-secondary);
    }

    body.task-mail.action-compose
    #layout-content .form-group.row > label.col-form-label + div {
        flex: 1 1 0 !important;
        width: auto !important;
        max-width: none !important;
        min-width: 0 !important;
    }

    body.task-mail.action-compose
    #layout-content .form-group.row {
        margin-bottom: 8px;
    }

}


/* ==========================================
   SAMSONOV MAIL — MESSAGE LIST AVATARS
   ========================================== */

.sm-avatar {
    display: none;
}

@media screen and (min-width: 1201px) {

    body.task-mail #messagelist tr.message td.subject {
        position: relative;
        padding-left: 58px !important;
        min-height: 72px;
        vertical-align: middle;
    }

    body.task-mail #messagelist .sm-avatar {
        position: absolute;
        display: flex;
        align-items: center;
        justify-content: center;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        width: 36px;
        height: 36px;
        border-radius: 50%;
        color: #ffffff;
        font-family: "Segoe UI", Arial, sans-serif;
        font-size: 13px;
        font-weight: 600;
        line-height: 1;
        letter-spacing: .2px;
        pointer-events: none;
        user-select: none;
    }

    /* Sender */

    body.task-mail #messagelist .fromto {
        font-size: 14px !important;
        font-weight: 500;
        color: var(--sm-text) !important;
    }

    /* Subject */

    body.task-mail #messagelist span.subject {
        font-size: 13px !important;
        color: var(--sm-text);
    }

    /* Date */

    body.task-mail #messagelist .date {
        font-size: 11px !important;
        color: var(--sm-secondary) !important;
        font-weight: 400;
    }

    /* Unread messages */

    body.task-mail #messagelist tr.unread .fromto,
    body.task-mail #messagelist tr.unread span.subject {
        font-weight: 700 !important;
    }

    body.task-mail #messagelist tr.unread .date {
        color: var(--sm-blue) !important;
        font-weight: 600;
    }

    body.task-mail #messagelist tr.unread span.subject a {
        color: var(--sm-blue) !important;
    }

    /* Selected message */

    body.task-mail #messagelist tr.selected td {
        background: var(--sm-selected) !important;
    }

    body.task-mail #messagelist tr.selected td:first-child {
        box-shadow: inset 3px 0 0 var(--sm-blue);
    }

    /* Hover */

    body.task-mail #messagelist tr.message:not(.selected):hover td {
        background: var(--sm-hover) !important;
    }

}


/* ==========================================
   SAMSONOV MAIL — MESSAGE LIST POLISH
   ========================================== */

@media screen and (min-width: 1201px) {

    body.task-mail #messagelist tr.message {
        height: 64px !important;
    }

    body.task-mail #messagelist tr.message td.subject {
        height: 64px !important;
        min-height: 64px !important;
        padding-left: 60px !important;
    }

    body.task-mail #messagelist .sm-avatar {
        left: 14px;
        width: 36px;
        height: 36px;
    }

    body.task-mail #messagelist .fromto {
        padding-left: 0 !important;
        margin-left: 0 !important;
        font-weight: 500;
    }

    body.task-mail #messagelist span.subject {
        padding-left: 0 !important;
        margin-left: 0 !important;
    }

    body.task-mail #messagelist .date {
        font-size: 11px !important;
        opacity: .85;
    }

    body.task-mail #messagelist tr.unread .msgicon {
        color: var(--sm-blue) !important;
    }

    body.task-mail #messagelist tr.unread td.subject {
        box-shadow: inset 3px 0 0 var(--sm-blue);
    }

    body.task-mail #messagelist tr.selected td {
        background: var(--sm-selected) !important;
    }

}


/* Message row alignment */
@media screen and (min-width: 1201px) {

    body.task-mail #messagelist tr.message > td {
        height: 72px !important;
        min-height: 72px !important;
        box-sizing: border-box;
        vertical-align: middle;
    }

    body.task-mail #messagelist tr.message {
        height: 72px !important;
    }

    body.task-mail #messagelist tr.message > td {
        border-bottom: 1px solid var(--sm-border) !important;
    }

}


/* Fix message row height mismatch */
@media screen and (min-width: 1201px) {

    body.task-mail #messagelist tr.message td.subject {
        height: 72px !important;
        min-height: 72px !important;
    }

}


/* ==========================================
   SAMSONOV MAIL — MESSAGE READING PANE
   ========================================== */

#message-header {
    padding: 24px 28px 20px !important;
    background: var(--sm-surface);
    border-bottom: 1px solid var(--sm-border);
}

#message-header h2.subject {
    font-size: 22px !important;
    font-weight: 600 !important;
    line-height: 1.4;
    color: var(--sm-text);
    margin: 0 0 20px !important;
}

#message-header h2.subject .extwin {
    font-size: 14px;
    margin-left: 8px;
    color: var(--sm-secondary);
}

#message-header > .header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: transparent !important;
    border: 0 !important;
}

#message-header .contactphoto {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px;
    border-radius: 50% !important;
    object-fit: cover;
}

#message-header .header-content {
    flex: 1;
    min-width: 0;
    padding-top: 3px;
}

#message-header .header-summary {
    font-size: 14px;
    line-height: 24px;
    color: var(--sm-text);
}

#message-header .header-summary a {
    color: var(--sm-text);
    font-weight: 600;
}

#message-header .header-links {
    margin-top: 5px;
    font-size: 12px;
}

#message-header .header-links a {
    color: var(--sm-secondary);
    margin-right: 14px;
}

#message-header .header-links a:hover {
    color: var(--sm-blue);
}

#message-content {
    padding: 24px 28px !important;
    background: var(--sm-surface);
}

#messagebody {
    line-height: 1.6;
}

#message-content .attachmentslist {
    border-radius: 6px;
}

@media screen and (max-width: 768px) {

    #message-header {
        padding: 16px !important;
    }

    #message-header h2.subject {
        font-size: 18px !important;
        margin-bottom: 14px !important;
    }

    #message-content {
        padding: 16px !important;
    }

    #message-header .contactphoto {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px;
    }

}


/* Mail - message sender */

#message-header .sm-message-avatar {
    width: 48px;
    height: 48px;
    min-width: 48px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 17px;
    font-weight: 600;
    margin-right: 16px;
}

#message-header .header-content {
    flex: 1;
    min-width: 0;
}

#message-header .sm-message-sender {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
    width: 100%;
    min-height: 24px;
}

#message-header .sm-message-sender .adr {
    font-size: 15px;
    font-weight: 600;
}

#message-header .sm-message-sender .rcmContactAddress {
    color: var(--sm-text);
}

#message-header .sm-message-date {
    font-size: 12px;
    font-weight: 400;
    color: var(--sm-secondary);
    margin-left: auto;
}

#message-header .sm-message-recipient {
    font-size: 13px;
    color: var(--sm-secondary);
    margin-top: 4px;
    overflow-wrap: anywhere;
}

#message-header .header-links {
    margin-top: 10px;
}

#message-header .header-links a {
    font-size: 12px;
}


/* Message avatar alignment */

#message-header > .header {
    align-items: flex-start;
}

#message-header .sm-message-avatar {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    margin-top: 2px;
    margin-right: 16px;
    border: none;
    border-radius: 50%;
    font-size: 17px;
    font-weight: 600;
    line-height: 1;
}


/* MS brand logo */

.sm-brand-logo {
    display: block;
    width: 34px;
    height: 34px;
    min-width: 34px;
    object-fit: contain;
    flex-shrink: 0;
}

