/*
 * Messenger tab styles. All selectors are prefixed `msgr-` so they don't collide
 * with the rest of the portal (which lives in /manage/styles.css).
 *
 * The tab is hosted inside `.portal-main`. When messenger is the active tab we
 * promote `.portal-main` to a flex column so the tab pane fills the *actual*
 * remaining space below the header/upload-banner/tabs chrome (instead of
 * computing it from `100dvh` minus the nominal nav heights — that math under-
 * counts the upload banner and any tabs-row growth, which pushed the composer
 * off the bottom on shorter laptop screens). `.msgr-app` then consumes the
 * tab pane so the three internal regions (list, chat, composer) scroll
 * independently without the portal main ever scrolling.
 *
 * Scoped via `:has()` so the other tabs keep `.portal-main`'s default block +
 * overflow:auto behaviour.
 */

.portal-main:has(> #messengerTab.tab-content.active) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.is-logged-in #messengerTab.tab-content.active {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.msgr-app {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--portal-bg);
    border-top: 1px solid var(--portal-border);
    color: var(--portal-text);
    overflow: hidden;
    font-size: 13px;
    --msgr-page: var(--portal-bg);
    --msgr-panel: var(--portal-nav-bg);
    --msgr-card: var(--portal-bg-card-hover);
    --msgr-deep: var(--portal-bg-card);
    --msgr-line: var(--portal-border);
    --msgr-txt: var(--portal-text);
    --msgr-txt-2: var(--portal-text-muted);
    --msgr-txt-3: var(--portal-text-dim);
    --msgr-indigo: var(--portal-accent-indigo);
    --msgr-indigo-soft: rgba(99, 102, 241, .14);
    --msgr-indigo-line: rgba(99, 102, 241, .4);
    --msgr-green: var(--portal-accent-green);
    --msgr-violet: var(--portal-accent-purple);
}

.msgr-body {
    flex: 1;
    display: flex;
    min-height: 0;
}

/* ---- COLUMN 1: conversation list ---- */
.msgr-col-list {
    width: 312px;
    flex: 0 0 312px;
    border-right: 1px solid var(--msgr-line);
    background: var(--msgr-panel);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.msgr-cl-head {
    flex-shrink: 0;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--msgr-line);
}

.msgr-cl-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 13px;
}

.msgr-cl-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--msgr-txt);
}

.msgr-cl-new {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--msgr-card);
    border: 1px solid var(--msgr-line);
    color: var(--msgr-txt-2);
    cursor: pointer;
    transition: .13s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.msgr-cl-new:hover { color: var(--msgr-txt); border-color: var(--portal-text-muted); background: var(--portal-bg-card-hover); }
.msgr-cl-new svg { width: 14px; height: 14px; display: block; }

.msgr-cl-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--msgr-deep);
    border: 1px solid var(--msgr-line);
    border-radius: 9px;
    padding: 8px 11px;
    color: var(--msgr-txt-3);
}

.msgr-cl-search input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--msgr-txt);
    font: inherit;
    font-size: 12.5px;
}
.msgr-cl-search input::placeholder { color: var(--msgr-txt-3); }
.msgr-cl-search svg { width: 15px; height: 15px; flex: 0 0 15px; }

.msgr-cl-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px;
}
.msgr-cl-scroll::-webkit-scrollbar { width: 8px; }
.msgr-cl-scroll::-webkit-scrollbar-thumb { background: var(--msgr-line); border-radius: 8px; border: 2px solid var(--msgr-panel); }

.msgr-cl-empty {
    text-align: center;
    color: var(--msgr-txt-3);
    font-size: 12px;
    padding: 32px 12px;
}

.msgr-cl-sect {
    font: 600 10px/1 'Inter', sans-serif;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--msgr-txt-3);
    padding: 13px 8px 7px;
    display: flex;
    align-items: center;
    gap: 7px;
}
.msgr-cl-sect .msgr-n {
    margin-left: auto;
    color: var(--msgr-txt-3);
    font-family: 'JetBrains Mono', monospace;
}

.msgr-conv {
    display: flex;
    gap: 11px;
    padding: 10px 9px;
    border-radius: 10px;
    cursor: pointer;
    transition: .12s;
    position: relative;
    align-items: center;
}
.msgr-conv:hover { background: var(--msgr-card); }
.msgr-conv.is-active { background: var(--msgr-indigo-soft); box-shadow: inset 0 0 0 1px var(--msgr-indigo-line); }
.msgr-conv-new-hint { color: var(--msgr-txt-3); font-style: italic; }

.msgr-av {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
    flex: 0 0 auto;
}
.msgr-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.msgr-conv .msgr-av {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 10px;
    font-size: 13px;
}

.msgr-conv .msgr-mid { flex: 1; min-width: 0; }
.msgr-conv .msgr-r1 {
    display: flex;
    align-items: center;
    gap: 7px;
}
.msgr-conv .msgr-nm {
    font-weight: 600;
    font-size: 13px;
    color: var(--msgr-txt);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msgr-conv .msgr-tm {
    margin-left: auto;
    font-size: 10.5px;
    color: var(--msgr-txt-3);
    font-family: 'JetBrains Mono', monospace;
    flex: 0 0 auto;
}
.msgr-conv .msgr-r2 {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
}
.msgr-conv .msgr-pv {
    font-size: 12px;
    color: var(--msgr-txt-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}
.msgr-conv .msgr-unread {
    flex: 0 0 auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--msgr-indigo);
    color: #fff;
    font: 700 10px/18px 'JetBrains Mono', monospace;
    text-align: center;
}
.msgr-conv .msgr-scope {
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--msgr-txt-3);
    padding: 2px 6px;
    border-radius: 5px;
    background: var(--msgr-card);
    flex: 0 0 auto;
}
.msgr-conv.is-active .msgr-scope { background: var(--msgr-deep); }

/* Org / project channel avatars — hero 640 thumb or accent via inline style in messenger.js */
.msgr-av.msgr-av-project { border-radius: 11px; }
.msgr-conv .msgr-av.msgr-av-project { border-radius: 11px; }

/* Org / project icon logos: contained with inset padding (not cropped like user photos) */
.msgr-av.msgr-av-org img,
.msgr-av.msgr-av-project img,
.msgr-mh-av.msgr-av-org img,
.msgr-mh-av.msgr-av-project img,
.msgr-ctx-link .msgr-av.msgr-av-org img,
.msgr-ctx-link .msgr-av.msgr-av-project img {
    object-fit: contain;
    padding: 4px;
    box-sizing: border-box;
}
.msgr-av.msgr-av-c0 { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.msgr-av.msgr-av-c1 { background: linear-gradient(135deg, #2dd4bf, #0d9488); }
.msgr-av.msgr-av-c2 { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.msgr-av.msgr-av-c3 { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.msgr-av.msgr-av-c4 { background: linear-gradient(135deg, #f59e0b, #d97757); }
.msgr-av.msgr-av-c5 { background: linear-gradient(135deg, #34d399, #059669); }
.msgr-av.msgr-av-c6 { background: linear-gradient(135deg, #f87171, #dc2626); }
.msgr-av.msgr-av-c7 { background: linear-gradient(135deg, #38bdf8, #0ea5e9); }

/* ---- COLUMN 2: main pane ---- */
.msgr-col-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: var(--msgr-page);
}

.msgr-main-head {
    height: 64px;
    flex: 0 0 64px;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 0 20px;
    border-bottom: 1px solid var(--msgr-line);
    background: var(--msgr-panel);
}
.msgr-mh-av {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    flex: 0 0 40px;
    font-size: 14px;
    overflow: hidden;
}
.msgr-mh-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.msgr-mh-meta { min-width: 0; }
.msgr-mh-nm {
    font-weight: 700;
    font-size: 15px;
    color: var(--msgr-txt);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msgr-mh-sub {
    font-size: 11.5px;
    color: var(--msgr-txt-2);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msgr-chat {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px 8px;
    display: flex;
    flex-direction: column;
}
.msgr-chat::-webkit-scrollbar { width: 9px; }
.msgr-chat::-webkit-scrollbar-thumb { background: var(--msgr-line); border-radius: 8px; border: 2px solid var(--msgr-page); }

.msgr-chat-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--msgr-txt-3);
    text-align: center;
}
.msgr-chat-placeholder-inner {
    max-width: 280px;
}
.msgr-chat-placeholder svg {
    width: 36px;
    height: 36px;
    margin: 0 auto 12px;
    color: var(--msgr-txt-3);
    display: block;
}
.msgr-chat-placeholder p {
    font-size: 13px;
    line-height: 1.5;
    color: var(--msgr-txt-2);
    margin: 0;
}

.msgr-day-div {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 8px 0 20px;
}
.msgr-day-div::before,
.msgr-day-div::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--msgr-line);
}
.msgr-day-div span {
    font: 600 10.5px/1 'Inter', sans-serif;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--msgr-txt-3);
}

.msgr-msg {
    display: flex;
    gap: 11px;
    margin-bottom: 18px;
    max-width: 86%;
}
.msgr-msg .msgr-m-av {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11px;
    color: #fff;
    margin-top: 2px;
    overflow: hidden;
}
.msgr-msg .msgr-m-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.msgr-msg .msgr-m-av-spacer {
    visibility: hidden;
    pointer-events: none;
}
.msgr-msg.msgr-msg-continued,
.msgr-msg.msgr-msg-group-mid {
    margin-bottom: 4px;
}
.msgr-msg.msgr-msg-group-end {
    margin-bottom: 18px;
}
.msgr-msg .msgr-m-body { min-width: 0; }
.msgr-msg .msgr-m-top {
    display: flex;
    align-items: baseline;
    gap: 9px;
    margin-bottom: 5px;
}
.msgr-msg .msgr-m-nm { font-weight: 600; font-size: 12.5px; color: var(--msgr-txt); }
.msgr-msg .msgr-m-tm { font-size: 10.5px; color: var(--msgr-txt-3); font-family: 'JetBrains Mono', monospace; }

.msgr-bubble {
    background: var(--msgr-card);
    border: 1px solid var(--msgr-line);
    border-radius: 4px 13px 13px 13px;
    padding: 11px 14px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--msgr-txt);
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.msgr-msg.msgr-me { margin-left: auto; flex-direction: row-reverse; }
.msgr-msg.msgr-me .msgr-m-top { flex-direction: row-reverse; }
.msgr-msg.msgr-me .msgr-bubble {
    background: var(--msgr-indigo);
    border-color: var(--msgr-indigo);
    border-radius: 13px 4px 13px 13px;
    color: #fff;
}

.msgr-msg-pending .msgr-bubble {
    opacity: .65;
}
.msgr-msg-failed .msgr-bubble {
    border-color: rgba(248, 113, 113, .5);
    background: rgba(248, 113, 113, .12);
    color: #fecaca;
}

.msgr-read-rcpt {
    margin-top: 5px;
    font-size: 10px;
    color: var(--msgr-txt-3);
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
}
.msgr-msg.msgr-me .msgr-read-rcpt {
    color: rgba(255, 255, 255, .72);
}
.msgr-read-rcpt.is-seen .msgr-read-rcpt-icon {
    color: #93c5fd;
}
.msgr-read-rcpt-icon {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
}

/* ---- composer ---- */
.msgr-composer {
    flex: 0 0 auto;
    padding: 14px 20px 18px;
    border-top: 1px solid var(--msgr-line);
    background: var(--msgr-panel);
}
.msgr-cmp-box {
    background: var(--msgr-deep);
    border: 1px solid var(--msgr-line);
    border-radius: 13px;
    transition: .15s;
    display: flex;
    flex-direction: column;
}
.msgr-cmp-box:focus-within {
    border-color: var(--msgr-indigo-line);
    box-shadow: 0 0 0 3px var(--msgr-indigo-soft);
}
.msgr-cmp-input {
    padding: 13px 15px;
    font-size: 13px;
    color: var(--msgr-txt);
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    font-family: inherit;
    min-height: 24px;
    max-height: 180px;
    line-height: 1.5;
}
.msgr-cmp-input::placeholder { color: var(--msgr-txt-3); }

.msgr-cmp-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    border-top: 1px solid var(--msgr-line);
}
.msgr-cmp-actions {
    position: relative;
    flex: 0 0 auto;
}
.msgr-cmp-emoji-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--msgr-txt-2);
    cursor: pointer;
    transition: background .13s, color .13s;
}
.msgr-cmp-emoji-btn:hover {
    background: var(--msgr-card);
    color: var(--msgr-txt);
}
.msgr-cmp-emoji-btn[aria-expanded="true"] {
    background: var(--msgr-indigo-soft);
    color: var(--msgr-indigo);
}
.msgr-cmp-emoji-btn svg {
    width: 20px;
    height: 20px;
    display: block;
}
.msgr-emoji-picker {
    position: absolute;
    right: 0;
    left: auto;
    bottom: calc(100% + 8px);
    z-index: 40;
    width: min(320px, calc(100vw - 48px));
    background: var(--msgr-panel);
    border: 1px solid var(--msgr-line);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.msgr-emoji-picker.is-hidden {
    display: none;
}
.msgr-emoji-tabs {
    display: flex;
    gap: 2px;
    padding: 8px 8px 6px;
    border-bottom: 1px solid var(--msgr-line);
    overflow-x: auto;
    overscroll-behavior: contain;
}
.msgr-emoji-tabs::-webkit-scrollbar { height: 4px; }
.msgr-emoji-tabs::-webkit-scrollbar-thumb { background: var(--msgr-line); border-radius: 4px; }
.msgr-emoji-tab {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    transition: background .12s;
}
.msgr-emoji-tab:hover { background: var(--msgr-card); }
.msgr-emoji-tab.is-active {
    background: var(--msgr-indigo-soft);
    box-shadow: inset 0 0 0 1px var(--msgr-indigo-line);
}
.msgr-emoji-tab[aria-label] { font-size: 14px; }
.msgr-emoji-grid-wrap {
    max-height: 220px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.msgr-emoji-grid-wrap::-webkit-scrollbar { width: 8px; }
.msgr-emoji-grid-wrap::-webkit-scrollbar-thumb {
    background: var(--msgr-line);
    border-radius: 8px;
    border: 2px solid var(--msgr-panel);
}
.msgr-emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    padding: 8px;
}
.msgr-emoji-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1;
    min-height: 34px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background .12s, transform .08s;
}
.msgr-emoji-cell:hover {
    background: var(--msgr-card);
    transform: scale(1.08);
}
.msgr-emoji-empty {
    grid-column: 1 / -1;
    padding: 20px 12px;
    text-align: center;
    font-size: 12px;
    color: var(--msgr-txt-3);
}
.msgr-bubble.msgr-bubble-emoji-only {
    font-size: 28px;
    line-height: 1.25;
    padding: 10px 14px;
    letter-spacing: .02em;
}
.msgr-cmp-hint {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 11px;
    color: var(--msgr-txt-3);
}
.msgr-cmp-send {
	width: auto;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--msgr-indigo);
    color: #fff;
    font-weight: 600;
    font-size: 12.5px;
    padding: 8px 15px;
    border-radius: 9px;
    cursor: pointer;
    border: none;
    transition: .13s;
    font-family: inherit;
}
.msgr-cmp-send:hover:not(:disabled) { filter: brightness(.92); }
.msgr-cmp-send:disabled { opacity: .5; cursor: not-allowed; }
.msgr-cmp-send svg { width: 15px; height: 15px; display: block; }

/* ---- COLUMN 3: context panel ---- */
.msgr-col-ctx {
    width: 288px;
    flex: 0 0 288px;
    border-left: 1px solid var(--msgr-line);
    background: var(--msgr-panel);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.msgr-col-ctx[hidden] { display: none; }
.msgr-col-ctx::-webkit-scrollbar { width: 8px; }
.msgr-col-ctx::-webkit-scrollbar-thumb { background: var(--msgr-line); border-radius: 8px; border: 2px solid var(--msgr-panel); }

.msgr-ctx-hero {
    padding: 24px 20px 20px;
    text-align: center;
    border-bottom: 1px solid var(--msgr-line);
}
.msgr-ctx-hero .msgr-ctx-av {
    width: 64px;
    height: 64px;
    border-radius: 17px;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 22px;
    color: #fff;
    overflow: hidden;
}
.msgr-ctx-hero .msgr-ctx-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.msgr-ctx-hero .msgr-ctx-av.msgr-av-org img,
.msgr-ctx-hero .msgr-ctx-av.msgr-av-project img {
    object-fit: contain;
    padding: 5px;
    box-sizing: border-box;
}
.msgr-ctx-hero .msgr-ctx-nm {
    font-size: 16px;
    font-weight: 700;
    color: var(--msgr-txt);
    word-break: break-word;
}
.msgr-ctx-hero .msgr-ctx-role {
    font-size: 12px;
    color: var(--msgr-txt-2);
    margin-top: 4px;
    word-break: break-word;
}

.msgr-ctx-sect {
    padding: 16px 20px;
    border-bottom: 1px solid var(--msgr-line);
}
.msgr-ctx-sect:last-child { border-bottom: none; }
.msgr-ctx-sh {
    font: 600 10.5px/1 'Inter', sans-serif;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--msgr-txt-3);
    margin-bottom: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.msgr-ctx-sh .msgr-ctx-c {
    margin-left: auto;
    font-family: 'JetBrains Mono', monospace;
    color: var(--msgr-txt-3);
}

.msgr-ctx-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 11px;
    border-radius: 10px;
    background: var(--msgr-card);
    border: 1px solid var(--msgr-line);
    cursor: pointer;
    transition: .12s;
    color: inherit;
    text-decoration: none;
    width: 100%;
    text-align: left;
}
.msgr-ctx-link:hover { background: var(--portal-bg-card-hover); border-color: var(--portal-text-muted); }
.msgr-ctx-link .msgr-av {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 9px;
    font-size: 12px;
}
.msgr-ctx-link .msgr-ctx-link-body { min-width: 0; flex: 1; }
.msgr-ctx-link-name {
    font-weight: 600;
    font-size: 12.5px;
    color: var(--msgr-txt);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msgr-ctx-link-meta {
    font-size: 11px;
    color: var(--msgr-txt-2);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msgr-ctx-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 8px;
    border-radius: 9px;
    transition: .12s;
}
.msgr-ctx-row.is-clickable { cursor: pointer; }
.msgr-ctx-row.is-clickable:hover { background: var(--msgr-card); }
.msgr-ctx-row .msgr-av {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 8px;
    font-size: 11px;
}
.msgr-ctx-row-body { min-width: 0; flex: 1; }
.msgr-ctx-row-name {
    font-weight: 600;
    font-size: 12.5px;
    color: var(--msgr-txt);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msgr-ctx-row-sub {
    font-size: 11px;
    color: var(--msgr-txt-2);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msgr-ctx-row-tag {
    margin-left: auto;
    font: 600 9.5px/1 'Inter', sans-serif;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--msgr-txt-3);
    padding: 3px 6px;
    border-radius: 5px;
    background: var(--msgr-deep);
    border: 1px solid var(--msgr-line);
    flex: 0 0 auto;
}

.msgr-ctx-empty {
    font-size: 11.5px;
    color: var(--msgr-txt-3);
    padding: 4px 0;
}

/* ---- new DM modal ---- */
.msgr-new-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
}
.msgr-new-modal.is-hidden { display: none; }
.msgr-new-modal-backdrop {
    position: absolute;
    inset: 0;
    background: var(--portal-modal-backdrop-scrim);
}
.msgr-new-modal-content {
    position: relative;
    width: 480px;
    max-width: calc(100vw - 32px);
    background: var(--portal-modal-bg);
    border: 1px solid var(--portal-border);
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
    overflow: hidden;
    color: var(--msgr-txt);
    display: flex;
    flex-direction: column;
    max-height: 70vh;
}
.msgr-new-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 18px 20px 12px;
    gap: 12px;
    border-bottom: 1px solid var(--msgr-line);
}
.msgr-new-modal-eyebrow {
    font: 600 10.5px/1 'Inter', sans-serif;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--msgr-txt-3);
    margin-bottom: 6px;
}
.msgr-new-modal-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--msgr-txt);
}
.msgr-new-modal-close {
    background: transparent;
    border: none;
    color: var(--msgr-txt-2);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
}
.msgr-new-modal-close:hover { color: var(--msgr-txt); background: var(--msgr-card); }
.msgr-new-modal-close svg { width: 16px; height: 16px; display: block; }

.msgr-new-modal-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--msgr-deep);
    border: 1px solid var(--msgr-line);
    border-radius: 9px;
    margin: 12px 20px 0;
    padding: 8px 11px;
    color: var(--msgr-txt-3);
}
.msgr-new-modal-search svg { width: 15px; height: 15px; flex: 0 0 15px; }
.msgr-new-modal-search input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--msgr-txt);
    font: inherit;
    font-size: 12.5px;
}
.msgr-new-modal-search input::placeholder { color: var(--msgr-txt-3); }

.msgr-new-modal-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px 16px;
}
.msgr-new-modal-list::-webkit-scrollbar { width: 8px; }
.msgr-new-modal-list::-webkit-scrollbar-thumb { background: var(--msgr-line); border-radius: 8px; border: 2px solid var(--msgr-panel); }

.msgr-new-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 10px;
    border-radius: 9px;
    cursor: pointer;
    transition: .12s;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    color: var(--msgr-txt);
}
.msgr-new-row:hover { background: var(--msgr-card); }
.msgr-new-row .msgr-av { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 9px; font-size: 11px; }
.msgr-new-row-name { font-weight: 600; font-size: 13px; }
.msgr-new-row-sub { font-size: 11.5px; color: var(--msgr-txt-2); margin-top: 2px; }
.msgr-new-row-empty {
    color: var(--msgr-txt-3);
    font-size: 12px;
    text-align: center;
    padding: 24px 8px;
}

/* ---- header tab unread badge (lives in the tabs row, not the messenger pane) ---- */
.messenger-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    margin-left: 6px;
    padding: 0 6px;
    border-radius: 9px;
    background: var(--msgr-indigo, #6366f1);
    color: #fff;
    font: 700 10px/1 'JetBrains Mono', monospace;
    vertical-align: middle;
}
.messenger-tab-badge[hidden] { display: none; }
