#erpMessagingPage {
    --messaging-line: rgba(36, 33, 40, .1);
    --messaging-muted: #6f7480;
    --messaging-paper: #fff;
    --messaging-soft: #f5f7fb;
    --messaging-accent: #ffe700;
    min-height: 100%;
}

.dark #erpMessagingPage {
    --messaging-line: rgba(255, 255, 255, .1);
    --messaging-muted: #b2b5bc;
    --messaging-paper: #2f2b34;
    --messaging-soft: rgba(0, 0, 0, .18);
}

.erp-messaging-pagebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: .2rem 0 .9rem;
    border-bottom: 1px solid var(--messaging-line);
}

.erp-messaging-pagebar-copy {
    min-width: 0;
}

.erp-messaging-pagebar-copy p {
    margin: 0 0 .2rem;
    color: var(--messaging-accent);
    font-size: .62rem;
    font-weight: 900;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.erp-messaging-pagebar-copy h1 {
    margin: 0;
    color: #242128;
    font-family: Outfit, sans-serif;
    font-size: clamp(1.45rem, 2vw, 2rem);
    font-weight: 800;
    letter-spacing: -.035em;
    line-height: 1;
}

.dark .erp-messaging-pagebar-copy h1 {
    color: #fff;
}

.erp-messaging-pagebar-copy span {
    display: block;
    max-width: 58ch;
    margin-top: .35rem;
    color: var(--messaging-muted);
    font-size: .72rem;
    line-height: 1.4;
}

.erp-messaging-pagebar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .45rem;
    flex-wrap: wrap;
}

.erp-messaging-pagebar-actions button {
    white-space: nowrap;
}

.erp-messaging-shell {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    height: min(770px, calc(100dvh - 156px));
    min-height: 520px;
    overflow: hidden;
    border: 1px solid var(--messaging-line);
    border-radius: 1.35rem;
    background: var(--messaging-paper);
    box-shadow: 0 22px 60px rgba(36, 33, 40, .1);
}

.dark .erp-messaging-shell {
    box-shadow: 0 24px 70px rgba(0, 0, 0, .24);
}

.erp-messaging-inbox-panel,
.erp-messaging-thread-panel {
    min-width: 0;
    min-height: 0;
}

.erp-messaging-inbox-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--messaging-line);
    background: var(--messaging-soft);
}

.erp-messaging-inbox-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex: 0 0 auto;
    padding: 1rem 1rem .8rem;
    border-bottom: 1px solid var(--messaging-line);
}

.erp-messaging-inbox-head p {
    margin: 0 0 .2rem;
    color: var(--messaging-muted);
    font-size: .58rem;
    font-weight: 900;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.erp-messaging-inbox-head strong {
    display: block;
    color: #242128;
    font-size: .86rem;
    font-weight: 800;
}

.dark .erp-messaging-inbox-head strong {
    color: #fff;
}

.erp-messaging-inbox-mark {
    width: 2.35rem;
    height: 2.35rem;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 231, 0, .35);
    border-radius: .8rem;
    color: #242128;
    background: rgba(255, 231, 0, .72);
}

.erp-messaging-search {
    position: relative;
    flex: 0 0 auto;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--messaging-line);
}

.erp-messaging-search input {
    border-color: var(--messaging-line) !important;
    background: rgba(255, 255, 255, .72) !important;
}

.dark .erp-messaging-search input {
    background: rgba(255, 255, 255, .05) !important;
}

.erp-messaging-inbox-list {
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    padding: .65rem;
    scrollbar-gutter: stable;
}

.erp-messaging-inbox-list > button {
    position: relative;
    min-height: 4.4rem;
    border-color: transparent !important;
    border-radius: .95rem !important;
}

.erp-messaging-inbox-list > button::before {
    content: '';
    position: absolute;
    inset: .7rem auto .7rem 0;
    width: 3px;
    border-radius: 99px;
    background: transparent;
}

.erp-messaging-inbox-list > button.is-active::before,
.erp-messaging-inbox-list > button.has-unread::before {
    background: var(--messaging-accent);
}

.erp-messaging-thread-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--messaging-paper);
}

.erp-messaging-thread-panel > .erp-thread-empty {
    min-height: 0;
    flex: 1 1 auto;
}

.erp-thread-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-height: 4.55rem;
    flex: 0 0 auto;
    padding: .85rem 1.1rem;
    border-bottom: 1px solid var(--messaging-line);
    background: color-mix(in srgb, var(--messaging-paper) 92%, transparent);
}

.erp-thread-identity {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: .7rem;
}

.erp-thread-back {
    display: none;
}

.erp-thread-avatar {
    width: 2.55rem;
    height: 2.55rem;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid rgba(255, 231, 0, .35);
    border-radius: .85rem;
    color: #242128;
    background: #ffe700;
}

.erp-thread-copy {
    min-width: 0;
}

.erp-thread-copy h2,
.erp-thread-copy p {
    overflow: hidden;
    margin: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.erp-thread-copy h2 {
    color: #242128;
    font-size: .92rem;
    font-weight: 800;
}

.dark .erp-thread-copy h2 {
    color: #fff;
}

.erp-thread-copy p {
    margin-top: .2rem;
    color: var(--messaging-muted);
    font-size: .65rem;
}

.erp-thread-copy .cumbre-presence-status {
    display: block;
    margin-top: .18rem;
    color: #159b63;
    font-size: .58rem;
    font-weight: 800;
}

.dark .erp-thread-copy .cumbre-presence-status {
    color: #67e8a5;
}

.erp-thread-copy .cumbre-typing-status {
    display: block;
    min-height: .65rem;
    margin-top: .12rem;
    color: #d7a800;
    font-size: .58rem;
    font-weight: 800;
    opacity: 0;
    transition: opacity .16s ease;
}

.erp-thread-copy .cumbre-typing-status.is-visible {
    opacity: 1;
}

.dark .erp-thread-copy .cumbre-typing-status {
    color: #ffe700;
}

.erp-thread-actions {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex: 0 0 auto;
}

.erp-thread-actions button,
.erp-thread-back {
    width: 2.2rem;
    height: 2.2rem;
    display: grid;
    place-items: center;
    border: 1px solid var(--messaging-line);
    border-radius: .72rem;
    color: var(--messaging-muted);
    background: transparent;
    transition: transform .18s ease, color .18s ease, border-color .18s ease, background .18s ease;
}

.erp-thread-actions button:hover,
.erp-thread-actions button:focus-visible,
.erp-thread-back:hover,
.erp-thread-back:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(255, 231, 0, .55);
    color: #242128;
    background: rgba(255, 231, 0, .12);
}

.dark .erp-thread-actions button:hover,
.dark .erp-thread-actions button:focus-visible,
.dark .erp-thread-back:hover,
.dark .erp-thread-back:focus-visible {
    color: #ffe700;
}

.erp-thread-messages {
    position: relative;
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 1.15rem clamp(1rem, 3vw, 2.1rem);
    background-color: #f8f9fc;
    background-image: radial-gradient(rgba(36, 33, 40, .055) .7px, transparent .7px);
    background-size: 18px 18px;
    scrollbar-gutter: stable;
}

.dark .erp-thread-messages {
    background-color: #242128;
    background-image: radial-gradient(rgba(255, 255, 255, .035) .7px, transparent .7px);
}

.erp-thread-message-row {
    display: flex;
    margin-bottom: .55rem;
}

.erp-thread-message-row.mine {
    justify-content: flex-end;
}

.erp-thread-message-bubble {
    max-width: min(76%, 620px);
    padding: .65rem .8rem .5rem;
    border: 1px solid var(--messaging-line);
    border-radius: 1rem 1rem 1rem .35rem;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 5px 16px rgba(36, 33, 40, .05);
}

.erp-thread-message-row.mine .erp-thread-message-bubble {
    border-color: rgba(255, 231, 0, .38);
    border-radius: 1rem 1rem .35rem 1rem;
    background: rgba(255, 231, 0, .2);
}

.dark .erp-thread-message-bubble {
    background: rgba(255, 255, 255, .07);
    box-shadow: none;
}

.erp-thread-message-bubble p {
    margin: 0;
    color: #242128;
    font-size: .82rem;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.dark .erp-thread-message-bubble p {
    color: #f8f9fc;
}

.erp-thread-message-meta {
    margin-top: .22rem;
    color: var(--messaging-muted);
    font-size: .58rem;
    line-height: 1.2;
    text-align: right;
}

.erp-thread-composer {
    display: flex;
    align-items: flex-end;
    gap: .55rem;
    flex: 0 0 auto;
    padding: .7rem .9rem .85rem;
    border-top: 1px solid var(--messaging-line);
    background: var(--messaging-paper);
}

.erp-thread-composer textarea {
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
    min-height: 2.7rem;
    max-height: 9rem;
    border-color: var(--messaging-line) !important;
    border-radius: .9rem !important;
    background: var(--messaging-soft) !important;
}

.erp-thread-composer button[type="submit"] {
    width: 2.7rem;
    height: 2.7rem;
    flex: 0 0 auto;
    border-radius: .9rem;
}

.erp-thread-readonly {
    flex: 0 0 auto;
    padding: .7rem 1rem;
    border-top: 1px solid var(--messaging-line);
    color: var(--messaging-muted);
    background: var(--messaging-paper);
    font-size: .67rem;
}

.erp-thread-empty {
    display: grid;
    place-items: center;
    padding: 2rem;
    color: var(--messaging-muted);
    text-align: center;
    background: var(--messaging-paper);
}

.erp-thread-empty-mark {
    width: 4.2rem;
    height: 4.2rem;
    display: grid;
    place-items: center;
    margin-bottom: .8rem;
    border: 1px solid rgba(255, 231, 0, .35);
    border-radius: 1.3rem;
    color: #242128;
    background: rgba(255, 231, 0, .75);
    box-shadow: 0 14px 30px rgba(255, 231, 0, .13);
}

@media (max-width: 1023px) {
    .erp-messaging-shell {
        display: block;
        height: calc(100dvh - 146px);
        min-height: 500px;
        position: relative;
    }

    .erp-messaging-inbox-panel,
    .erp-messaging-thread-panel {
        width: 100%;
        height: 100%;
        border: 0;
    }

    .erp-messaging-thread-panel {
        display: none;
    }

    .erp-messaging-shell.has-active .erp-messaging-inbox-panel {
        display: none;
    }

    .erp-messaging-shell.has-active .erp-messaging-thread-panel {
        display: flex;
    }

    .erp-thread-back {
        display: grid;
        margin-right: .1rem;
    }

    .erp-thread-message-bubble {
        max-width: 86%;
    }
}

@media (max-width: 640px) {
    .erp-messaging-pagebar {
        align-items: flex-start;
        flex-direction: column;
        gap: .7rem;
    }

    .erp-messaging-pagebar-actions {
        width: 100%;
        justify-content: stretch;
    }

    .erp-messaging-pagebar-actions button {
        flex: 1 1 0;
        justify-content: center;
    }

    .erp-messaging-shell {
        height: calc(100dvh - 222px);
        min-height: 460px;
        border-radius: 1rem;
    }

    .erp-thread-header {
        padding-left: .75rem;
        padding-right: .75rem;
    }

    .erp-thread-messages {
        padding: 1rem .75rem;
    }

    .erp-thread-composer {
        padding: .55rem .6rem .65rem;
    }
}

.erp-message-action-target { cursor: pointer; }
.erp-message-action-target:active { transform: scale(.99); }
.erp-message-bubble-topline { min-height: .1rem; display: flex; align-items: center; gap: .5rem; }
.erp-message-pinned, .erp-message-edited { color: #a48700; font-size: .56rem; font-weight: 900; }
.erp-message-edited { margin-left: auto; color: var(--messaging-muted); font-weight: 700; }
.erp-message-reactions { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .2rem; }
.erp-message-reaction { display: inline-flex; align-items: center; gap: .2rem; padding: .14rem .35rem; border: 1px solid rgba(36, 33, 40, .12); border-radius: 999px; color: #777b85; background: rgba(255, 255, 255, .7); font-size: .62rem; }
.erp-message-reaction.is-mine { border-color: rgba(255, 231, 0, .55); background: rgba(255, 231, 0, .18); }
.dark .erp-message-reaction { border-color: rgba(255, 255, 255, .12); color: #c7cad2; background: rgba(255, 255, 255, .06); }
.erp-message-action-backdrop { position: fixed; z-index: 160; inset: 0; display: grid; place-items: end center; padding: 1rem; background: rgba(17, 15, 20, .62); backdrop-filter: blur(8px); }
.erp-message-action-sheet { position: relative; width: min(100%, 31rem); max-height: calc(100dvh - 2rem); overflow-y: auto; padding: 1.25rem; border: 1px solid rgba(36, 33, 40, .12); border-radius: 1.25rem; color: #242128; background: #fff; box-shadow: 0 2rem 5rem rgba(0, 0, 0, .28); }
.dark .erp-message-action-sheet { border-color: rgba(255, 255, 255, .12); color: #f8f9fc; background: #2f2b34; }
.erp-message-action-sheet > small { color: #a48700; font-size: .6rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.erp-message-action-sheet h3 { margin: .3rem 0 .8rem; font-size: 1.25rem; letter-spacing: -.04em; }
.erp-message-action-close { position: absolute; top: .75rem; right: .75rem; width: 2.15rem; height: 2.15rem; border: 0; border-radius: .65rem; color: #777b85; background: rgba(36, 33, 40, .06); }
.dark .erp-message-action-close { color: #d7d9df; background: rgba(255, 255, 255, .08); }
.erp-message-action-preview { display: grid; gap: .3rem; margin: .6rem 0 .75rem; padding: .7rem; border: 1px solid rgba(36, 33, 40, .1); border-radius: .8rem; background: #f8f9fc; }
.dark .erp-message-action-preview { border-color: rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .05); }
.erp-message-action-preview p { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: .78rem; line-height: 1.5; }
.erp-message-action-preview time { color: var(--messaging-muted); font-size: .56rem; }
.erp-message-reaction-picker { display: flex; align-items: center; gap: .25rem; margin-bottom: .7rem; padding: .5rem; border: 1px solid rgba(36, 33, 40, .1); border-radius: .8rem; background: #f8f9fc; }
.dark .erp-message-reaction-picker { border-color: rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .05); }
.erp-message-reaction-picker > span { margin-right: auto; color: var(--messaging-muted); font-size: .6rem; font-weight: 800; }
.erp-message-reaction-picker button { width: 2rem; height: 2rem; border: 1px solid transparent; border-radius: .55rem; background: transparent; font-size: 1rem; }
.erp-message-reaction-picker button:hover, .erp-message-reaction-picker button.is-selected { border-color: rgba(255, 231, 0, .5); background: rgba(255, 231, 0, .16); }
.erp-message-action-list { display: grid; gap: .4rem; }
.erp-message-action-list button { display: flex; align-items: center; gap: .7rem; width: 100%; padding: .65rem; border: 1px solid transparent; border-radius: .75rem; color: inherit; background: #f8f9fc; text-align: left; }
.dark .erp-message-action-list button { background: rgba(255, 255, 255, .05); }
.erp-message-action-list button:hover { border-color: rgba(255, 231, 0, .4); }
.erp-message-action-list button > i { width: 1.9rem; height: 1.9rem; display: grid; place-items: center; border-radius: .6rem; color: #242128; background: #ffe700; }
.erp-message-action-list button span { display: grid; gap: .12rem; }
.erp-message-action-list button strong { font-size: .7rem; }
.erp-message-action-list button small { color: var(--messaging-muted); font-size: .58rem; }
.erp-message-action-sheet textarea { width: 100%; min-height: 8rem; resize: vertical; padding: .75rem; border: 1px solid rgba(36, 33, 40, .12); border-radius: .8rem; outline: 0; background: #f8f9fc; }
.dark .erp-message-action-sheet textarea { border-color: rgba(255, 255, 255, .12); color: #fff; background: rgba(255, 255, 255, .06); }
.erp-message-edit-actions { display: flex; justify-content: flex-end; gap: .45rem; margin-top: .65rem; }
@media (max-width: 640px) { .erp-message-action-backdrop { padding: .65rem 0 0; } .erp-message-action-sheet { width: 100%; border-radius: 1.25rem 1.25rem 0 0; } .erp-message-reaction-picker > span { display: none; } .erp-message-reaction-picker button { flex: 1; } }
