﻿/* ============================
   Messages (wm-*) DROP-IN CSS
   Paste at BOTTOM of CSS file
   ============================ */

:root {
    --wm-panel: var(--panel, #ffffff);
    --wm-border: var(--border, #e5e7eb);
    --wm-text: var(--text, #111827);
    --wm-muted: var(--muted, #6b7280);
    --wm-accent: var(--accent, #ffb020);
    --wm-link: var(--link, #2563eb);

    /* pane widths (defaults) */
    --wm-folders-w: 160px;
    --wm-list-w: 380px;
}

body {
    font-family: Georgia, "Times New Roman", Times, serif;
}

/* Root layout */
.wm-root {
    width: 100%;
    box-sizing: border-box;
    display: block;
    background: #f8fafc; /* subtle slate tint */
    padding: 8px; /* gives the tint a chance to show */
    border-radius: 12px;
}

/* Header */
.wm-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    margin-bottom: 12px;
    width: 100%;
}

.wm-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wm-header-title {
    font-size: 20px;
    font-weight: 700;
}

.wm-header-subtitle {
    font-size: 14px;
    color: var(--wm-muted);
}

/* Cards */
.wm-card {
    background: var(--wm-panel);
    border: 1px solid #d1d5db;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    border-radius: 12px;
    padding: 14px 16px 16px;
    box-shadow: 0 1px 0 rgba(0,0,0,.03);
}

.wm-card-header {
    margin-bottom: 10px;
}

.wm-card-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.wm-card-subtitle {
    font-size: 13px;
    color: var(--wm-muted);
}

/* Rows / columns */
.wm-row {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.wm-col-full {
    flex: 1 1 100%;
    min-width: 0;
}

.wm-col-half {
    flex: 1 1 50%;
    min-width: 0;
}

.wm-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--wm-muted);
    margin-bottom: 3px;
}

/* Inputs */
.wm-input,
.wm-select,
.wm-textarea {
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--wm-border);
    padding: 6px 8px;
    font-size: 14px;
    box-sizing: border-box;
    background: #fff;
}

.wm-textarea {
    min-height: 120px;
    resize: vertical;
}

.wm-select {
    padding-right: 28px;
}

    .wm-input:focus,
    .wm-select:focus,
    .wm-textarea:focus {
        outline: none;
        border-color: var(--wm-accent);
        box-shadow: 0 0 0 1px rgba(255,176,32,0.25);
    }

/* Buttons (match your markup: wm-button-primary/secondary/small) */
.wm-button-primary,
.wm-button-secondary,
.wm-button-small {
    border-radius: 999px;
    border: 1px solid var(--wm-border);
    padding: 6px 14px;
    font-size: 14px;
    background: #f9fafb;
    color: #111827;
    box-sizing: border-box;
    min-height: 44px;
    max-width: 100%;
    width: auto;
    white-space: normal;
    line-height: 1.3;
    cursor: pointer;
}

.wm-button-primary {
    background: var(--wm-accent);
    border-color: #fbbf24;
    color: #111827;
    font-weight: 600;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
}

.wm-button-small {
    padding: 4px 10px;
    font-size: 13px;
}

.wm-button-primary:hover {
    filter: brightness(0.98);
}

.wm-button-secondary:hover,
.wm-button-small:hover {
    background: #eef2ff;
}

/* Radio lists */
.wm-rbl {
    font-size: 13px;
    color: var(--wm-muted);
}

    .wm-rbl input {
        margin-right: 4px;
    }

/* To: chips */
.wm-to-row .wm-label {
    margin-bottom: 6px;
}

.wm-to-chips {
    position: relative;
    min-height: 38px;
    padding: 6px 10px;
    border: 1px solid var(--wm-border);
    border-radius: 10px;
    background: #fff;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* Big invisible click target to open pickers */
.wm-to-click {
    position: absolute;
    inset: 0;
    display: block;
    text-decoration: none;
    cursor: pointer;
    z-index: 1; /* behind chips */
    background: transparent;
    pointer-events: auto;
}

/* Chips above overlay so X clicks work */
.wm-chip {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border: 1px solid var(--wm-border);
    border-radius: 999px;
    background: #f9fafb;
    max-width: 100%;
    pointer-events: auto;
}

.wm-chip-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--wm-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 360px;
}

.wm-chip-x {
    position: relative;
    z-index: 3;
    display: inline-block;
    width: 18px;
    height: 18px;
    line-height: 16px;
    text-align: center;
    border-radius: 999px;
    border: 1px solid var(--wm-border);
    background: #fff;
    color: var(--wm-muted);
    font-weight: 700;
    text-decoration: none;
    pointer-events: auto;
}

    .wm-chip-x:hover {
        color: var(--wm-text);
        background: #f3f4f6;
        cursor: pointer;
    }

.wm-to-hint {
    margin-top: 6px;
    font-size: 13px;
    color: var(--wm-muted);
}

/* Recipient pickers */
.wm-recipient-pickers {
    gap: 12px;
}

.wm-picker-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}
    .wm-picker-title, .wm-picker-header .wm-label {
        font-weight: 700;
        letter-spacing: .02em;
        text-transform: uppercase;
    }

.wm-listbox {
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--wm-border);
    min-height: 80px !important;
    height: 100px !important;
    padding: 4px;
    box-sizing: border-box;
    font-size: 14px;
    background: #fff;
}

/* Attachments */
.wm-attach-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wm-attach-icon {
    width: 18px;
    height: 18px;
    display: inline-block;
    background-image: url('../Images/UI/attachment.svg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: .8;
}

/* chips container (matches your received attachment look) */
.wm-attachment-chips {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wm-attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--wm-border);
    border-radius: 999px;
    background: #f9fafb;
    font-size: 13px;
}

    .wm-attachment-chip .wm-chip-x {
        border: none;
        background: transparent;
        cursor: pointer;
        font-size: 16px;
        line-height: 1;
        padding: 0 2px;
        opacity: .7;
    }

        .wm-attachment-chip .wm-chip-x:hover {
            opacity: 1;
        }

.wm-attach-note {
    display: block;
    font-size: 12px;
    color: var(--wm-muted);
    margin-top: 2px;
}

/* Alerts */
.wm-alert-error {
    color: #b91c1c;
    font-size: 13px;
    margin: 4px 0;
}

.wm-alert-info {
    color: #065f46;
    font-size: 13px;
    margin: 4px 0;
}

/* Links */
.wm-link {
    color: var(--wm-link);
    text-decoration: none;
    font-weight: 600;
}

    .wm-link:hover {
        text-decoration: underline;
    }

/* Detail panel */
.wm-detail-meta {
    font-size: 14px;
    color: #111;
    margin-bottom: 6px;
}

.wm-detail-meta-row {
    margin: 2px 0;
}

.wm-meta-label {
    font-weight: 700;
    margin-right: 6px;
}

.wm-detail-body {
    font-size: 14px;
    line-height: 1.5;
    margin-top: 6px;
    padding-bottom: 28px; /* gives room so the float doesn't cover the last lines */
    overflow: visible; /* IMPORTANT: do not create an inner scroller */
}

.wm-detail-recipients-header {
    font-weight: 700;
    margin-top: 10px;
    margin-bottom: 6px;
    font-size: 15px;
}

.wm-recipient-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

    .wm-recipient-table th {
        text-align: left;
        font-size: 12px;
        text-transform: uppercase;
        color: var(--wm-muted);
        border-bottom: 1px solid var(--wm-border);
        padding: 6px 8px;
    }

    .wm-recipient-table td {
        padding: 6px 8px;
        border-bottom: 1px solid #f1f5f9;
    }

.wm-recipient-unread {
    font-weight: 700;
    background-color: #eff6ff;
}

.wm-recipient-read {
    color: var(--wm-muted);
}

.wm-recipient-status,
.wm-recipient-date {
    white-space: nowrap;
}

.wm-recipient-date {
    font-size: 13px;
}

.wm-attachments-list {
    margin-top: 10px;
}

.wm-attachment-item {
    font-size: 12px;
    padding: 4px 0;
    color: #111827;
}

.wm-compose-wrap {
    margin-bottom: 12px;
}

/* folders */
.wm-folder-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-radius: 10px;
    text-decoration: none;
    color: #111827;
    font-weight: 600;
    margin-top: 6px;
}

    .wm-folder-link:hover {
        background: #f3f4f6;
    }

.wm-folder-count {
    color: #6b7280;
}

/* list */
.wm-msg-row {
    border-bottom: 1px solid #e5e7eb;
}

.wm-msg-row-link {
    display: block;
    text-decoration: none;
    padding: 10px;
    color: #111827;
}

    .wm-msg-row-link:hover {
        background: #f3f4ff;
    }

.wm-msg-subject {
    font-weight: 700;
    font-size: 14px;
}

.wm-msg-snippet {
    font-size: 13px;
    color: #6b7280;
    margin-top: 2px;
    overflow-wrap: anywhere;
}

.wm-detail-body,
.wm-detail-headerband,
.wm-msg-subject {
    overflow-wrap: anywhere;
    min-width: 0;
}

.wm-msg-unread {
    background: #eff6ff;
}

.wm-listpane {
    padding: 0;
}
/* list looks better without card padding */
.wm-readingpane {
    overflow: auto;
    position: relative;
}

.wm-listpane .wm-card-header {
    padding: 14px 16px 0;
}

.wm-listpane .wm-muted {
    padding: 10px 16px 14px;
    display: block;
}

/* list row layout (subject left, date right) */
.wm-msg-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.wm-msg-when {
    font-size: 12px;
    color: #9ca3af;
    white-space: nowrap;
    margin-left: auto;
}

.wm-msg-bottom {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 6px;
    font-size: 12px;
    color: #9ca3af;
}

.wm-msg-type,
.wm-msg-status {
    white-space: nowrap;
}

.wm-listpane {
    max-height: calc(100vh - 260px);
    overflow: auto;
}

.wm-readingpane {
    max-height: calc(100vh - 260px);
    overflow: auto;
}

/* ============================
   Selected folder styling
   ============================ */

.wm-folder-link {
    position: relative;
}

    .wm-folder-link.wm-folder-active {
        background: #eff6ff;
        border: 1px solid var(--wm-border);
    }

        .wm-folder-link.wm-folder-active span {
            font-weight: 800;
        }

        .wm-folder-link.wm-folder-active::before {
            content: "";
            position: absolute;
            left: 6px;
            top: 8px;
            bottom: 8px;
            width: 3px;
            border-radius: 3px;
            background: var(--wm-accent);
        }

/* ============================
   Sticky list header + scroll panes
   ============================ */

    /* Sticky header inside list pane */
    .wm-listpane .wm-card-header {
        position: sticky;
        top: 0;
        z-index: 2;
        background: var(--wm-panel);
        border-bottom: 1px solid var(--wm-border);
        padding: 14px 16px 10px;
        margin: 0; /* overrides your default margin-bottom */
    }

    /* Because we removed header margin-bottom, give content some breathing room */
    .wm-listpane .wm-msg-row:first-child {
        border-top: 0;
    }

/* Let messages use the full content width (your old max-width is forcing stack) */
#MessagesDivMaster.wm-shell {
    margin: 0; /* important */
    padding: 0 8px 24px 8px; /* keep your breathing room */
    box-sizing: border-box;
    max-width: none;
    width: auto; /* right/left now control sizing */
    overflow-x: hidden; /* safety net */
}

/* 3-pane layout */
.wm-mail-layout {
    width: 100%;
    display: grid;
    /* use variables so JS/server can update widths */
    grid-template-columns: var(--wm-folders-w) var(--wm-list-w) minmax(0, 900px);
    gap: 12px;
    align-items: start;
    clear: both;
    margin-top: 12px;
    justify-content: start; /* keep grid from stretching */
}

/* Only collapse on truly small screens */
@media (max-width: 900px) {
    .wm-mail-layout {
        grid-template-columns: 1fr;
    }
}

/* Override site-wide anchor styles for LinkButtons inside our panes */
.wm-folders a.wm-folder-link,
.wm-listpane a.wm-msg-row-link,
.wm-readingpane a.wm-link {
    color: #111827 !important;
    text-decoration: none !important;
}

/* Folder links: make them block/flex even if global CSS fights it */
.wm-folders a.wm-folder-link {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-radius: 10px;
    font-weight: 600;
    margin-top: 6px;
}

    .wm-folders a.wm-folder-link:hover {
        background: #f3f4f6;
    }

/* Message row link */
.wm-listpane a.wm-msg-row-link {
    display: block !important;
    padding: 10px;
}

    .wm-listpane a.wm-msg-row-link:hover {
        background: #f3f4ff;
    }

.wm-msg-row.wm-msg-unread {
    background: #eff6ff;
    border-left: 4px solid #2563eb;
    box-shadow: inset 0 0 0 1px rgba(37,99,235,.25);
}



/* If a message is BOTH unread and selected: keep the unread bar, but use selected background */
.wm-msg-row.wm-msg-unread.wm-msg-active {
    background: #f3f4f6; /* selected wins on background */
    border-left-color: #2563eb; /* keep unread bar */
    box-shadow: inset 0 0 0 1px #d1d5db; /* neutral outline */
}

.wm-readingcol {
    padding-right: 22px;
}
/* important for grid columns */

/* Lock folder link color regardless of visited/active/focus rules elsewhere */
.wm-folders a.wm-folder-link,
.wm-folders a.wm-folder-link:link,
.wm-folders a.wm-folder-link:visited,
.wm-folders a.wm-folder-link:hover,
.wm-folders a.wm-folder-link:active,
.wm-folders a.wm-folder-link:focus {
    color: #111827 !important;
    text-decoration: none !important;
}

.wm-folders .wm-folder-link > span,
.wm-folders .wm-folder-link > label {
    font-weight: 600;
}

.wm-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid var(--wm-border);
    background: #f9fafb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    color: #111827 !important;
    cursor: pointer;
    font-size: 18px; /* size of ↻ */
    line-height: 1;
}

    .wm-icon-btn:hover {
        background: #eef2ff;
    }

.wm-trashicon-btn {
    width: 23px;
    height: 23px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    background-image: url('../Images/UI/trash.svg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    cursor: pointer;
    line-height: .8;
    padding-left: 14px;
    vertical-align:text-bottom;
}

    .wm-trashicon-btn:hover {
        background-image: url('../Images/UI/trash.svg');
        background-repeat: no-repeat;
        background-position: center;
        background-size: contain;
    }

.wm-restoreicon-btn {
    width: 23px;
    height: 23px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    background-image: url('https://risinginsightsstorage.blob.core.windows.net/backgroundimages/restore.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    cursor: pointer;
    line-height: .8;
    padding-left: 14px;
    vertical-align: text-bottom;
}

.wm-restoreicon-btn:hover {
    background-image: url('https://risinginsightsstorage.blob.core.windows.net/backgroundimages/restore.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.wm-header-left .wm-button-primary {
    margin-left: 10px;
}

/* Selected = neutral focus (applies in any folder) */
.wm-msg-row.wm-msg-active {
    background: #f3f4f6; /* light gray */
    box-shadow: inset 0 0 0 1px #d1d5db; /* gray outline */
    border-left: 4px solid transparent; /* reserve space so list doesn't jump */
    border-radius: 8px;
}

    .wm-msg-row.wm-msg-active .wm-msg-subject {
        font-weight: 800;
    }

/* Unread stays blue */
.wm-msg-row.wm-msg-unread {
    background: #eff6ff;
    border-left: 4px solid #2563eb;
    box-shadow: inset 0 0 0 1px rgba(37,99,235,.25);
}

    /* If BOTH unread + selected: keep unread bar, but selected background */
    .wm-msg-row.wm-msg-unread.wm-msg-active {
        background: #f3f4f6;
        border-left-color: #2563eb;
        box-shadow: inset 0 0 0 1px #d1d5db;
    }

/* Messages tile should be the positioning container */
.wm-messages-tile {
    position: relative; /* key */
    overflow: hidden; /* optional */
}

/* Unread badge: float above without pushing layout */
.ri-unread-badge {
    position: absolute;
    top: 10px;
    right: 10px; /* <-- add */
    left: auto; /* <-- replace left:50% */
    transform: none; /* <-- replace translateX */

    z-index: 10;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 17px;
    height: 22px;
    padding: 0 4px;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    background: #f50505;
    color: #fafbfc;
    border: 1px solid #fbbf24;
}

/* Keep keyboard focus distinct from the currently selected message. */
.wm-listpane a.wm-msg-row-link:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: -3px;
}

.wm-detail-actions {
    position: relative;
    z-index: 9999;
    margin-top: 24px; /* increase/decrease as desired */
    padding-top: 8px; /* optional */
    border-top: 1px solid #f1f5f9; /* optional subtle separator */
}

.wm-message-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px;
    color: inherit;
}

.wm-message-pager input:disabled {
    opacity: 0.55;
    cursor: default;
}

    .wm-detail-actions * {
        pointer-events: auto;
    }

/* Site-consistent secondary button look */
.wm-button-site {
    color: rgba(34,93,138,1);
    background-color: ghostwhite;
    height: 36px;
    padding: 0 14px;
    font-family: Georgia;
    font-size: 14px;
    font-weight: bold;
    border-radius: 999px;
    cursor: pointer;
    transition: 0.2s;
    border: 1px solid #050076;
}

    .wm-button-site:hover {
        filter: brightness(0.98);
    }

.wm-detail-actions-top {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    padding: 5px 0 10px 0;
    margin-bottom: 8px;
    background: var(--wm-panel);
    border-bottom: 1px solid var(--wm-border);
}

.wm-detail-attachments {
    margin: 10px 0 4px 0;
}

.wm-attachment-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-top: 4px;
}

.wm-attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid var(--wm-border);
    border-radius: 999px;
    background: #f9fafb;
    max-width: 100%;
}

/* Darker header band for reading pane message header */
.wm-detail-headerband {
    background: #f3f4f6; /* darker than white, still subtle */
    border: 1px solid var(--wm-border);
    border-radius: 12px;
    padding: 4px 4px 4px 8px;
    margin-bottom: 8px;
}

    /* When header band is used, the subject/header inside it shouldn't add extra padding */
    .wm-detail-headerband .wm-card-header {
        padding: 0;
        margin: 0 0 4px 0;
        border: 0;
        background: transparent;
    }

    /* Sticky actions should “stick” inside the band, not against the outer card */
    .wm-detail-headerband .wm-detail-actions-top {
        background: #f3f4f6;
    }

/* Make header band full-bleed inside the card */
.wm-detail-card .wm-detail-headerband {
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
    margin-top: -14px;
    padding-bottom: 80px; /* room for the floating buttons */
}

/* Make From/To/Sent/Type align perfectly */
.wm-detail-meta-row {
    display: grid;
    grid-template-columns: 45px 1fr; /* adjust 70px if you want more/less */
    column-gap: 10px;
    align-items: baseline;
}

    /* Keep the labels consistent */
    .wm-detail-meta-row .wm-meta-label {
        font-weight: 700;
        margin-right: 0; /* you currently have margin-right: 6px; remove it */
        white-space: nowrap;
    }

    /* Ensure values don’t introduce their own weird spacing */
    .wm-detail-meta-row .wm-meta-value {
        display: block;
        min-width: 0;
    }

/* Sticky container that pins to bottom-right INSIDE the reading pane */
.wm-float-wrap {
    position: fixed;
    right: 100px;
    bottom: 50px;
    z-index: 2147483647;
    display: none; /* JS toggles to flex */
    pointer-events: none; /* wrapper ignores clicks */
}

.wm-float-reply {
    display: flex;
    gap: 10px;
    pointer-events: auto; /* the row itself can receive clicks */
}

.wm-float-reply-btn {
    pointer-events: auto;
}

.wm-picker-header-inline {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* don’t push to far right */
    gap: 10px; /* spacing between title and buttons */
}

.wm-picker-header.wm-picker-header-inline {
    justify-content: flex-start; /* overrides space-between */
}

.wm-picker-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px; /* spacing between Add and Reset */
}

/* optional style for reset */
.wm-button-ghost {
    background: transparent;
    border: 1px solid rgba(255,255,255,.25); /* adjust to your theme */
}
    .wm-button-ghost:hover {
        background: #eef2ff; /* matches your small hover */
    }

.ri-toast {
    padding: 10px 14px;
    border: 1px solid rgba(0,0,0,.12);
    background: #111;
    color: #fff;
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    font-size: 14px;
}

/* Container beside New Message / Refresh */
.wm-toast-host {
    display: flex;
    align-items: center;
    margin-left: 10px; /* spacing from the buttons */
}

/* The toast itself */
.wm-toast-inline {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: #ECFDF3; /* soft green */
    color: #067647; /* green text */
    border: 1px solid #ABEFC6; /* light green border */
    box-shadow: 0 6px 18px rgba(0,0,0,.08);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}
.wm-msg-row-selectable {
    cursor: pointer;
}

.wm-card-header-split {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* =========================================================
   MULTI-SELECT MUST WIN (place at VERY BOTTOM of CSS file)
   ========================================================= */

/* Selected always wins (even if unread and/or active) */
.wm-msg-row-selectable.wm-msg-selected {
    outline: 2px solid rgba(59,130,246,.35) !important;
    background: rgba(59,130,246,.08) !important;
    border-radius: 10px !important;
    /* kill unread + active decorations while selected */
    box-shadow: none !important;
    border-left: 4px solid transparent !important;
}

/* While multi-select is on, suppress the single-open "active" look
   ONLY if that row is NOT selected */
#wmMsgListHost.wm-multi-select .wm-msg-row.wm-msg-active:not(.wm-msg-selected) {
    background: transparent !important;
    outline: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    border-left: 4px solid transparent !important;
}

/* Optional: while multi-select is on, remove unread treatment unless it's selected */
#wmMsgListHost.wm-multi-select .wm-msg-row.wm-msg-unread:not(.wm-msg-selected) {
    background: transparent !important;
    box-shadow: none !important;
    border-left: 4px solid transparent !important;
}

.wm-listpane-wrap {
    position: relative;
    min-width: 260px; /* “within reason” min */
    max-width: 720px; /* “within reason” max */
}

.wm-resize-handle {
    position: absolute;
    top: 8px;
    right: -6px; /* sits between pane 2 and pane 3 */
    width: 12px;
    height: calc(100% - 16px);
    cursor: col-resize;
    border-radius: 10px;
    background: transparent;
    z-index: 50;
}

    .wm-resize-handle:hover {
        background: rgba(37,99,235,.12);
    }

body.wm-resizing {
    cursor: col-resize !important;
    user-select: none !important;
}

/* Messaging workspace polish. Existing controls, selection and resize behavior remain authoritative. */
#MessagesDivMaster.wm-shell {
    --wm-panel: var(--ri-panel, #fff);
    --wm-surface: var(--ri-raised, #f6f8f8);
    --wm-border: var(--ri-border, #d7dfe0);
    --wm-text: var(--ri-text, #172126);
    --wm-muted: var(--ri-muted, #68747a);
    --wm-link: var(--ri-link, #2563eb);
    --wm-focus: var(--ri-teal, #043436);
    --wm-accent: #ffb020;
    min-width: 0;
    padding: 30px 32px 64px 0;
    color: var(--wm-text);
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    overflow-x: visible;
}
#MessagesDivMaster .wm-root { min-width: 0; max-width: 100%; padding: 0; border-radius: 0; background: transparent; }
#MessagesDivMaster .wm-root *, #MessagesDivMaster .wm-root *::before, #MessagesDivMaster .wm-root *::after { box-sizing: border-box; }
#MessagesDivMaster .wm-header { justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 18px; margin: 0 0 24px; }
#MessagesDivMaster .wm-header-left { flex: 1 1 auto; min-width: 0; flex-wrap: wrap; gap: 12px; }
#MessagesDivMaster .wm-header-intro { min-width: 0; margin-right: auto; }
#MessagesDivMaster .wm-header-title { display: block; margin: 0 auto 0 0; color: var(--wm-focus); font: 750 34px/1.12 "Segoe UI", system-ui, sans-serif; letter-spacing: -.035em; }
#MessagesDivMaster .wm-header-subtitle { display: block; margin-top: 7px; color: var(--wm-muted); font-size: 14px; line-height: 1.55; }
#MessagesDivMaster .wm-header-eyebrow { display: block; margin-bottom: 7px; color: var(--wm-muted); font-size: 11px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
#MessagesDivMaster .wm-header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
#MessagesDivMaster .wm-header-left .wm-button-primary { margin-left: 0; }
#MessagesDivMaster .wm-card { min-width: 0; max-width: 100%; padding: 22px; border: 1px solid var(--wm-border); border-radius: 12px; background: var(--wm-panel); box-shadow: 0 2px 8px rgba(15, 23, 42, .045); }
#MessagesDivMaster .wm-card-title { color: var(--wm-text); font-size: 16px; font-weight: 700; line-height: 1.4; }
#MessagesDivMaster .wm-card-subtitle, #MessagesDivMaster .wm-muted { color: var(--wm-muted); font-size: 13px; line-height: 1.55; }

/* Folders are a compact navigation row above the conversation list and reader. */
#MessagesDivMaster .wm-mail-layout { display: grid; grid-template-columns: clamp(260px, var(--wm-list-w, 360px), 42%) minmax(0, 1fr); gap: 18px; align-items: start; justify-content: stretch; width: 100%; min-width: 0; margin-top: 0; }
#MessagesDivMaster .wm-mail-layout > * { min-width: 0; max-width: 100%; }
#MessagesDivMaster .wm-folders { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 5px; border-radius: 10px; background: var(--wm-surface); box-shadow: none; }
#MessagesDivMaster .wm-folders > .wm-card-header { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#MessagesDivMaster .wm-folders a.wm-folder-link { flex: 0 0 auto; gap: 9px; min-height: 40px; margin: 0; padding: 9px 15px; border: 1px solid transparent; border-radius: 7px; color: var(--wm-muted) !important; font-size: 13px; font-weight: 650; line-height: 1.3; white-space: nowrap; background: transparent; }
#MessagesDivMaster .wm-folders a.wm-folder-link:hover { background: var(--wm-panel); color: var(--wm-text) !important; }
#MessagesDivMaster .wm-folders a.wm-folder-active { border-color: var(--wm-border); background: var(--wm-panel); color: var(--wm-focus) !important; box-shadow: 0 1px 3px rgba(15, 23, 42, .06); }
#MessagesDivMaster .wm-folder-active::before { display: none; }
#MessagesDivMaster .wm-folder-count { display: inline-flex; min-width: 20px; justify-content: center; padding: 2px 6px; border-radius: 999px; background: var(--wm-surface); color: var(--wm-muted); font-size: 11px; font-weight: 700; }
#MessagesDivMaster .wm-folder-count:empty { display: none; }
#MessagesDivMaster .wm-listpane-wrap { min-width: 0; max-width: none; }
#MessagesDivMaster .wm-listpane { padding: 0; min-height: 380px; }
#MessagesDivMaster .wm-listpane, #MessagesDivMaster .wm-readingpane { max-height: max(380px, calc(100vh - 310px)); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--wm-border) transparent; }
#MessagesDivMaster .wm-readingcol { min-width: 0; padding-right: 0; }
#MessagesDivMaster .wm-readingpane { min-width: 0; position: relative; }
#MessagesDivMaster .wm-readingpane > .wm-card { margin-bottom: 0; }
#MessagesDivMaster #pnlNoMessageSelected { display: grid; min-height: 380px; align-content: center; padding: 40px 28px; text-align: center; background: var(--wm-panel); }
#MessagesDivMaster #pnlNoMessageSelected .wm-card-title { display: block; margin-bottom: 9px; color: var(--wm-focus); font-size: 22px; }
#MessagesDivMaster .wm-listpane .wm-card-header { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px; background: var(--wm-panel); border-bottom: 1px solid var(--wm-border); }
#MessagesDivMaster .wm-listpane .wm-card-title { flex: 1; }
#MessagesDivMaster .wm-msg-row { border-bottom: 1px solid var(--wm-border); border-left: 3px solid transparent; border-radius: 0; }
#MessagesDivMaster .wm-listpane a.wm-msg-row-link { min-width: 0; padding: 16px 15px; color: var(--wm-text) !important; }
#MessagesDivMaster .wm-listpane a.wm-msg-row-link:hover { background: var(--wm-surface); }
#MessagesDivMaster .wm-msg-subject { flex: 1 1 auto; min-width: 0; font-size: 14px; font-weight: 650; line-height: 1.4; }
#MessagesDivMaster .wm-msg-person { display: block; min-width: 0; max-width: 100%; margin-bottom: 5px; overflow: hidden; color: var(--wm-muted); font-size: 12px; font-weight: 600; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
#MessagesDivMaster .wm-msg-person:empty { display: none; }
#MessagesDivMaster .wm-msg-top { gap: 12px; }
#MessagesDivMaster .wm-msg-when { flex: 0 1 auto; max-width: 40%; color: var(--wm-muted); font-size: 11px; line-height: 1.5; text-align: right; white-space: normal; }
#MessagesDivMaster .wm-msg-snippet { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin-top: 7px; color: var(--wm-muted); font-size: 13px; line-height: 1.55; }
#MessagesDivMaster .wm-msg-bottom { margin-top: 9px; color: var(--wm-muted); font-size: 11px; }
#MessagesDivMaster .wm-msg-row.wm-msg-unread { border-left-color: var(--wm-link); background: var(--wm-surface); box-shadow: none; }
#MessagesDivMaster .wm-msg-unread .wm-msg-subject { font-weight: 750; }
#MessagesDivMaster .wm-msg-row.wm-msg-active { background: var(--wm-surface); border-left-color: var(--wm-focus); box-shadow: inset 0 0 0 1px var(--wm-border); border-radius: 0; }
#MessagesDivMaster .wm-message-pager { flex-wrap: wrap; justify-content: space-between; gap: 8px; margin: 0; padding: 14px 16px; border-top: 1px solid var(--wm-border); color: var(--wm-muted); font-size: 12px; }
#MessagesDivMaster .wm-resize-handle { top: 0; right: -12px; width: 12px; height: 100%; border-radius: 4px; }
#MessagesDivMaster .wm-resize-handle:hover { background: var(--wm-border); }

/* Compose and reading reuse the existing fields, handlers and attachment controls. */
#MessagesDivMaster .wm-label { margin-bottom: 7px; color: var(--wm-text); font-size: 12px; font-weight: 650; line-height: 1.4; }
#MessagesDivMaster .wm-row { flex-wrap: wrap; gap: 16px; margin-bottom: 18px; }
#MessagesDivMaster .wm-col-half { flex: 1 1 220px; }
#MessagesDivMaster .wm-input, #MessagesDivMaster .wm-select, #MessagesDivMaster .wm-textarea, #MessagesDivMaster .wm-listbox { min-width: 0; max-width: 100%; padding: 10px 12px; border-color: var(--wm-border); border-radius: 8px; background: var(--wm-panel); color: var(--wm-text); font-family: inherit; font-size: 14px; line-height: 1.5; }
#MessagesDivMaster .wm-textarea { min-height: 240px; }
#MessagesDivMaster .wm-to-chips { min-width: 0; padding: 9px 10px; background: var(--wm-panel); border-color: var(--wm-border); }
#MessagesDivMaster .wm-chip, #MessagesDivMaster .wm-attachment-chip { min-width: 0; max-width: 100%; background: var(--wm-surface); border-color: var(--wm-border); }
#MessagesDivMaster .wm-chip-text { min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
#MessagesDivMaster .wm-chip-x { flex-shrink: 0; border-color: var(--wm-border); background: var(--wm-panel); color: var(--wm-muted); }
#MessagesDivMaster .wm-to-hint, #MessagesDivMaster .wm-attach-note { color: var(--wm-muted); font-size: 12px; line-height: 1.5; }
#MessagesDivMaster .wm-readingpane a.wm-link { color: var(--wm-link) !important; }
#MessagesDivMaster .wm-detail-card .wm-detail-headerband { margin: 0 0 20px; padding: 0 0 20px; border: 0; border-bottom: 1px solid var(--wm-border); border-radius: 0; background: transparent; }
#MessagesDivMaster .wm-detail-headerband .wm-card-title { display: block; font-size: 23px; font-weight: 700; line-height: 1.35; }
#MessagesDivMaster .wm-detail-actions-top { position: static; flex-wrap: wrap; gap: 8px; margin: 14px 0; padding: 0; border: 0; background: transparent; }
#MessagesDivMaster .wm-detail-meta { margin: 16px 0 0; color: var(--wm-muted); font-size: 12px; line-height: 1.7; }
#MessagesDivMaster .wm-detail-meta-row { grid-template-columns: 44px minmax(0, 1fr); gap: 9px; }
#MessagesDivMaster .wm-meta-value { min-width: 0; color: var(--wm-text); overflow-wrap: anywhere; }
#MessagesDivMaster .wm-detail-body { min-width: 0; max-width: 100%; padding-bottom: 36px; color: var(--wm-text); font-size: 14px; line-height: 1.8; overflow-x: auto; }
#MessagesDivMaster .wm-detail-body img { max-width: 100%; height: auto; }
#MessagesDivMaster .wm-detail-body pre { max-width: 100%; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
#MessagesDivMaster .wm-detail-attachments { margin: 20px 0; }
#MessagesDivMaster .wm-attachment-item { max-width: 100%; overflow-wrap: anywhere; }
#MessagesDivMaster .wm-detail-recipients { max-width: 100%; overflow-x: auto; }
#MessagesDivMaster .wm-recipient-table { min-width: 460px; color: var(--wm-text); }
#MessagesDivMaster .wm-recipient-table th, #MessagesDivMaster .wm-recipient-table td { padding: 10px; border-bottom-color: var(--wm-border); }
#MessagesDivMaster .wm-recipient-table th { color: var(--wm-muted); font-size: 10px; letter-spacing: .06em; }
#MessagesDivMaster .wm-recipient-unread { background: var(--wm-surface); }
#MessagesDivMaster .wm-button-primary, #MessagesDivMaster .wm-button-secondary, #MessagesDivMaster .wm-button-small, #MessagesDivMaster .wm-button-site, #MessagesDivMaster .wm-mobile-back { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; height: auto; max-width: 100%; margin: 0; padding: 9px 14px; border: 1px solid var(--wm-border); border-radius: 7px; background: var(--wm-panel); color: var(--wm-text); font: 650 13px/1.3 "Segoe UI", system-ui, sans-serif; text-decoration: none; white-space: normal; cursor: pointer; }
#MessagesDivMaster .wm-button-primary { border-color: #ffb020; background: #ffb020; color: #111827; box-shadow: 0 3px 8px rgba(15, 23, 42, .07); }
#MessagesDivMaster .wm-header .wm-button-primary { min-height: 44px; padding: 11px 19px; font-size: 14px; white-space: nowrap; }
#MessagesDivMaster .wm-button-primary:hover:not(:disabled) { background: #ffb020; filter: brightness(.96); }
#MessagesDivMaster .wm-button-secondary:hover:not(:disabled), #MessagesDivMaster .wm-button-small:hover:not(:disabled), #MessagesDivMaster .wm-button-site:hover:not(:disabled), #MessagesDivMaster .wm-mobile-back:hover { background: var(--wm-surface); }
#MessagesDivMaster .wm-button-small { min-height: 32px; padding: 6px 10px; font-size: 12px; }
#MessagesDivMaster .wm-icon-btn { width: 40px; height: 40px; border-radius: 7px; background: var(--wm-panel); color: var(--wm-text) !important; border-color: var(--wm-border); }
#MessagesDivMaster .wm-icon-btn:hover { background: var(--wm-surface); }
#MessagesDivMaster .wm-trashicon-btn, #MessagesDivMaster .wm-restoreicon-btn { width: 32px; height: 32px; padding: 6px; background-size: 18px 18px; flex-shrink: 0; }
#MessagesDivMaster input:disabled, #MessagesDivMaster button:disabled, #MessagesDivMaster .aspNetDisabled { opacity: .5; cursor: not-allowed; }
#MessagesDivMaster :is(a, button, input, select, textarea, [tabindex]):focus-visible { outline: 2px solid var(--wm-focus); outline-offset: 3px; }
#MessagesDivMaster .wm-toast-host { min-width: 0; margin-left: 0; }
#MessagesDivMaster .wm-toast-inline { max-width: 100%; white-space: normal; font-family: inherit; }
#MessagesDivMaster .wm-float-wrap { max-width: calc(100vw - 32px); }
#MessagesDivMaster .wm-mobile-back, #MessagesDivMaster .wm-resume-message { display: none; }

/* Match the established section shell transition exactly. */
@media screen and (max-width: 1280px) {
    #MessagesDivMaster.wm-shell .wm-root { padding: 20px 0 40px; }
    #MessagesDivMaster .wm-resize-handle { display: none; }
}
@media screen and (min-width: 1281px) {
    #MessagesDivMaster.wm-shell { position: absolute; top: 150px; left: 275px; right: 0; width: calc(100% - 275px); }
}
@media screen and (max-width: 900px) {
    #MessagesDivMaster .wm-mail-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    #MessagesDivMaster .wm-folders { grid-column: 1; }
    #MessagesDivMaster .wm-listpane, #MessagesDivMaster .wm-readingpane { max-height: none; overflow: visible; }
    #MessagesDivMaster .wm-listpane { min-height: 280px; }
    #MessagesDivMaster .wm-mobile-back { display: inline-flex; margin: 0 0 12px; }
    #MessagesDivMaster .wm-mail-layout.wm-view-list .wm-readingcol,
    #MessagesDivMaster .wm-mail-layout.wm-mobile-list .wm-readingcol { display: none; }
    #MessagesDivMaster .wm-mail-layout.wm-view-detail:not(.wm-mobile-list) .wm-listpane-wrap,
    #MessagesDivMaster .wm-mail-layout.wm-view-compose:not(.wm-mobile-list) .wm-listpane-wrap { display: none; }
    #MessagesDivMaster .wm-mail-layout.wm-mobile-list .wm-listpane-wrap { display: block; }
    #MessagesDivMaster .wm-mail-layout.wm-mobile-list:is(.wm-view-detail, .wm-view-compose) .wm-resume-message { display: inline-flex; order: 3; flex: 1 1 100%; }
    #MessagesDivMaster .wm-readingcol { grid-column: 1; }
    #MessagesDivMaster .wm-card { padding: 18px; }
    #MessagesDivMaster .wm-listpane { padding: 0; }
    #MessagesDivMaster .wm-header-title { font-size: 28px; }
    #MessagesDivMaster .wm-header { gap: 14px; margin-bottom: 20px; }
    #MessagesDivMaster .wm-detail-headerband .wm-card-title { font-size: 21px; }
}
@media screen and (max-width: 480px) {
    #MessagesDivMaster .wm-header-left, #MessagesDivMaster .wm-header-actions { width: 100%; }
    #MessagesDivMaster .wm-header .wm-button-primary { flex: 1 1 auto; }
    #MessagesDivMaster .wm-folder-link { flex: 1 1 auto; padding-inline: 11px; justify-content: center; }
    #MessagesDivMaster .wm-folder-count { flex: 0 0 auto; }
    #MessagesDivMaster .wm-card { padding: 16px; }
    #MessagesDivMaster .wm-listpane { padding: 0; }
    #MessagesDivMaster .wm-row { gap: 12px; }
    #MessagesDivMaster .wm-detail-actions-top > * { flex: 1 1 auto; }
    #MessagesDivMaster .wm-picker-header { flex-wrap: wrap; }
    #MessagesDivMaster .wm-msg-person { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; white-space: normal; overflow-wrap: anywhere; }
    #MessagesDivMaster .wm-chip-text { max-width: 100%; }
}