.message-center-shell {
    height: calc(100vh - 62px);
    min-height: 0;
    overflow: hidden;
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    background:
        radial-gradient(circle at top right, rgba(20, 172, 135, 0.09), transparent 22%),
        linear-gradient(180deg, #f5fbf9 0%, #eef5f3 100%);
}

.message-center-sidebar {
    border-right: 1px solid #d9e7e1;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.message-center-sidebar-head {
    padding: 22px 20px 14px;
    border-bottom: 1px solid #e3ece8;
    display: grid;
    gap: 14px;
}

.message-center-sidebar-head span {
    color: #0f8b6d;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
}

.message-center-sidebar-head h3 {
    margin: 6px 0 4px;
    color: #143c34;
    font-size: 26px;
}

.message-center-sidebar-head small {
    color: #6d8078;
    font-size: 13px;
}

.message-center-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.message-center-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px 20px 2px;
}

.message-center-tabs button {
    min-height: 38px;
    border: 0;
    border-radius: 12px;
    background: #edf4f1;
    color: #647972;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.message-center-tabs button.active {
    background: #15936d;
    color: #fff;
    box-shadow: 0 8px 18px rgba(21, 147, 109, .18);
}

.message-center-tabs em {
    min-width: 19px;
    margin-left: 5px;
    padding: 2px 6px;
    border-radius: 999px;
    background: #fff;
    color: #15936d;
    font-size: 12px;
    font-style: normal;
}

.message-contact-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px 10px;
    color: #70847d;
    font-size:13px;
}

.message-contact-summary strong { color: #294941; }

.message-contact-groups {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 12px 18px;
}

.message-contact-group h4 {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: 0;
    padding: 10px 8px 8px;
    background: rgba(255, 255, 255, .96);
    color: #647a72;
    font-size:13px;
}

.message-contact-card {
    width: 100%;
    min-height: 68px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px 8px;
    border: 0;
    border-bottom: 1px solid #e6efeb;
    background: #fff;
    text-align: left;
    cursor: pointer;
}

.message-contact-card:hover { background: rgba(22, 167, 126, .07); }

.message-contact-avatar {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #2f78df, #61a6f3);
    color: #fff;
    font-size: 14px;
}

.message-contact-card > span { min-width: 0; }
.message-contact-card strong,
.message-contact-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-contact-card strong { color: #183932; font-size: 14px; }
.message-contact-card small { margin-top: 5px; color: #71847d; font-size: 12px; }
.message-contact-card > em { color: #15936d; font-size: 12px; font-style: normal; }

.message-pill-btn {
    min-height: 34px;
    padding: 0 14px;
    border: 1px solid #d8e5df;
    border-radius: 999px;
    background: #fff;
    color: #294941;
    font-size:13px;
    font-weight: 600;
    cursor: pointer;
}

.message-pill-btn.primary {
    border-color: #15936d;
    background: #15936d;
    color: #fff;
}

.message-center-search {
    padding: 14px 20px 10px;
}

.message-center-search input,
.message-dialog input,
.message-dialog textarea,
.message-dialog select {
    width: 100%;
    border: 1px solid #d6e1dc;
    border-radius: 12px;
    padding: 12px 14px;
    background: #fff;
    color: #1c342f;
    font: inherit;
    box-sizing: border-box;
}

.message-thread-section {
    padding: 4px 12px 12px;
}

.message-thread-section-title {
    padding: 8px 8px 10px;
    color: #70847d;
    font-size:13px;
    font-weight: 700;
}

.message-thread-card {
    width: 100%;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 14px 12px;
    border: 0;
    border-radius: 16px;
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}

.message-thread-card:hover {
    background: rgba(22, 167, 126, 0.08);
    transform: translateY(-1px);
}

.message-thread-card.active {
    background: linear-gradient(135deg, rgba(19, 146, 109, 0.15), rgba(69, 195, 154, 0.08));
    box-shadow: inset 0 0 0 1px rgba(20, 147, 109, 0.18);
}

.message-thread-avatar {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: linear-gradient(135deg, #17a37a, #58d1a1);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
}

.message-thread-avatar.group {
    background: linear-gradient(135deg, #2f6fed, #5ca3ff);
}

.message-thread-avatar.announcement {
    background: linear-gradient(135deg, #dc8a0f, #f6bc52);
}

.message-thread-avatar.large {
    width: 54px;
    height: 54px;
    border-radius: 18px;
}

.message-thread-copy {
    min-width: 0;
}

.message-thread-copy strong,
.message-thread-copy small,
.message-thread-copy p {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-thread-copy strong {
    color: #163a33;
    font-size: 15px;
}

.message-thread-copy small {
    margin-top: 3px;
    color: #6f837d;
    font-size:13px;
}

.message-thread-copy p {
    margin: 6px 0 0;
    color: #536963;
    font-size:13px;
}

.message-thread-meta {
    display: grid;
    justify-items: end;
    gap: 6px;
    color: #7b8b87;
    font-size: 12px;
}

.message-thread-meta em {
    min-width: 22px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f04b67;
    color: #fff;
    font-style: normal;
    text-align: center;
}

.message-center-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.message-center-placeholder {
    min-height: calc(100vh - 62px);
    display: grid;
    place-content: center;
    gap: 12px;
    text-align: center;
    color: #70847d;
}

.message-center-placeholder span {
    width: 74px;
    height: 74px;
    margin: 0 auto;
    display: grid;
    place-items: center;
    border-radius: 24px;
    background: linear-gradient(135deg, #18a67d, #55cea0);
    color: #fff;
    font-size: 28px;
    font-weight: 700;
}

.message-chat-head {
    padding: 18px 24px;
    border-bottom: 1px solid #deebe5;
    background: rgba(255, 255, 255, 0.88);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.message-chat-head-main {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 14px;
}

.message-chat-head-main strong,
.message-chat-head-main small {
    display: block;
}

.message-chat-head-main strong {
    color: #163a33;
    font-size: 18px;
}

.message-chat-head-main small {
    margin-top: 5px;
    color: #6d8079;
    font-size:13px;
}

.message-chat-head-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.message-head-btn {
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid #d9e6df;
    border-radius: 999px;
    background: #fff;
    color: #2b4a42;
    font-size:13px;
    cursor: pointer;
}

.message-mobile-back {
    display: none;
    min-width: 38px;
    height: 38px;
    border: 1px solid #d7e3dd;
    border-radius: 12px;
    background: #fff;
    color: #264740;
}

.message-chat-body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    padding: 16px 24px 0;
}

.message-chat-members {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
}

.message-chat-members > span {
    color: #6f837d;
    font-size:13px;
    font-weight: 700;
}

.message-chat-members > div {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.message-chat-members small {
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(19, 146, 109, 0.08);
    color: #215248;
    font-size:13px;
}

.message-chat-stream {
    overflow-y: auto;
    padding: 4px 2px 18px;
}

.message-bubble-row {
    max-width: min(68%, 760px);
    display: grid;
    gap: 6px;
    margin-bottom: 16px;
}

.message-bubble-row.mine {
    margin-left: auto;
}

.message-bubble-row.system {
    max-width: 100%;
}

.message-bubble-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #738681;
    font-size:13px;
}

.message-bubble {
    width: fit-content;
    max-width: 100%;
    padding: 10px 14px;
    border-radius: 8px 8px 8px 2px;
    background: #fff;
    color: #21342f;
    box-shadow: 0 1px 2px rgba(22, 40, 35, 0.08);
}

.message-bubble-row.mine .message-bubble {
    margin-left: auto;
    border-radius: 8px 8px 2px 8px;
    background: #95ec69;
    color: #19321b;
}

.message-bubble.system .message-bubble,
.message-bubble.announcement {
    border-radius: 18px;
    background: linear-gradient(135deg, #fff5dd, #fff9ef);
    color: #7f5509;
    box-shadow: inset 0 0 0 1px rgba(224, 169, 49, 0.18);
}

.message-bubble.system p,
.message-bubble.announcement p,
.message-bubble p {
    margin: 0;
    white-space: pre-wrap;
    line-height: 1.75;
}

.message-chat-compose {
    padding: 16px 24px 22px;
    border-top: 1px solid #deebe5;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
}

.message-chat-compose textarea {
    width: 100%;
    min-height: 92px;
    resize: vertical;
    border: 1px solid #d7e3dc;
    border-radius: 18px;
    padding: 14px 16px;
    background: #fff;
    color: #1d3430;
    font: inherit;
    box-sizing: border-box;
}

.message-chat-compose-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}

.message-chat-compose-actions small {
    color: #71817b;
    font-size:13px;
}

.message-center-alert {
    margin: 0 20px 12px;
    padding: 12px 14px;
    border: 1px solid #f4d1cf;
    border-radius: 14px;
    background: #fff6f5;
    color: #ba3c2f;
    font-size: 13px;
}

.message-center-alert.inline {
    margin: 0 0 14px;
}

.message-center-empty {
    padding: 42px 24px;
    text-align: center;
    color: #6f837d;
}

.message-center-empty.compact {
    padding: 24px 14px;
}

.message-dialog-mask {
    position: fixed;
    inset: 0;
    z-index: 120;
    background: rgba(19, 30, 27, 0.34);
    display: grid;
    place-items: center;
    padding: 24px;
}

.message-dialog {
    width: min(640px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 20px 48px rgba(19, 34, 29, 0.22);
}

.message-dialog header,
.message-dialog footer {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.message-dialog header {
    border-bottom: 1px solid #e6efeb;
}

.message-dialog header small {
    color: #0f8b6d;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
}

.message-dialog header h3 {
    margin: 6px 0 0;
    color: #173a33;
    font-size: 24px;
}

.message-dialog header button {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 12px;
    background: #f2f6f4;
    color: #38524b;
    font-size: 18px;
}

.message-dialog-body {
    padding: 20px 24px 8px;
    display: grid;
    gap: 16px;
}

.message-dialog label {
    display: grid;
    gap: 8px;
    color: #28443d;
    font-size: 13px;
    font-weight: 600;
}

.message-dialog label small {
    color: #738580;
    font-weight: 400;
}

.message-dialog-user-grid {
    max-height: 260px;
    overflow: auto;
    display: grid;
    gap: 8px;
    padding: 4px;
}

.message-dialog-user-item {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid #e0e9e5;
    border-radius: 14px;
    background: #fbfdfc;
}

.message-dialog-user-item input {
    width: 16px;
    height: 16px;
    margin: 0;
}

.message-dialog-user-item span {
    display: grid;
    gap: 4px;
}

.message-dialog-user-item b {
    color: #183932;
}

.message-dialog-user-item small {
    color: #71837d;
}

.message-dialog footer {
    border-top: 1px solid #e6efeb;
}

@media (max-width: 959px) {
    .message-center-shell {
        grid-template-columns: 1fr;
    }

    .message-center-sidebar.hiddenMobile,
    .message-center-main {
        display: none;
    }

    .message-center-main.showMobile,
    .message-center-sidebar {
        display: flex;
    }

    .message-mobile-back {
        display: inline-grid;
        place-items: center;
    }

    .message-chat-head,
    .message-chat-body,
    .message-chat-compose {
        padding-left: 16px;
        padding-right: 16px;
    }

    .message-bubble-row {
        max-width: 92%;
    }
}

@media (max-width: 640px) {
    .message-center-sidebar-head {
        padding: 18px 16px 12px;
    }

    .message-center-search {
        padding: 12px 16px 8px;
    }

    .message-thread-section {
        padding-left: 8px;
        padding-right: 8px;
    }

    .message-thread-card {
        grid-template-columns: 40px minmax(0, 1fr);
    }

    .message-thread-meta {
        grid-column: 2;
        justify-items: start;
        grid-auto-flow: column;
    }

    .message-chat-head {
        align-items: start;
        flex-direction: column;
    }

    .message-chat-head-actions,
    .message-chat-compose-actions,
    .message-center-quick-actions {
        width: 100%;
    }

    .message-chat-compose-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .message-chat-compose-actions .primary-btn {
        width: 100%;
    }

    .message-dialog-mask {
        padding: 12px;
    }

    .message-dialog header,
    .message-dialog footer,
    .message-dialog-body {
        padding-left: 16px;
        padding-right: 16px;
    }
}
