.mp-chat-page {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr) 300px;
    height: calc(100vh - 25px);
    margin: -15px -30px 0 -15px;
    overflow: hidden;
}

.mp-chat-sidebar,
.mp-chat-main,
.mp-chat-info,
.mp-composer-wrapper,
.mp-composer {
    min-width: 0;
}

.mp-chat-sidebar {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.mp-chat-sidebar-header {
    padding: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mp-channel-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px;
    gap: 8px;
    align-items: center;
}

.mp-channel-row .mp-field { min-width: 0; }
.mp-channel-row .mp-field > * { max-width: 100%; }

.mp-new-conversation-button {
    width: 38px;
    height: 38px;
    border: 1px solid color-mix(in srgb, var(--app-primary-color) 65%, transparent);
    border-radius: 10px;
    background: var(--app-primary-color);
    color: var(--app-primary-contrast-color, #fff);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mp-new-conversation-button:hover { opacity: .92; }
.mp-new-conversation-button:disabled { opacity: .45; cursor: not-allowed; }

.mp-field label {
    display: block;
    font-size: .75rem;
    margin-bottom: 4px;
    opacity: .7;
}

.mp-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-top: 10px;
}

.mp-tab {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 6px 8px;
    font-size: .8rem;
    cursor: pointer;
    background: transparent;
    color: inherit;
}

    .mp-tab.active {
        background: var(--app-primary-color);
        border-color: var(--primary-color);
        color: var(--app-primary-contrast-color, #fff);
    }

.mp-search { margin-top: 10px; }
.mp-conversation-list { overflow-y: auto; min-height: 0; flex: 1; padding: 8px; }
.mp-conversation-item { display: flex; gap: 10px; width: 100%; border: none; background: transparent; color: inherit; text-align: left; border-radius: 12px; padding: 10px; cursor: pointer; }
.mp-conversation-item:hover { background: color-mix(in srgb, currentColor 6%, transparent); }
.mp-conversation-item.active { background: color-mix(in srgb, var(--app-primary-color) 14%, transparent); }
.mp-avatar { flex: 0 0 auto; }
.mp-conversation-info { min-width: 0; flex: 1; }
.mp-conversation-top { display: flex; justify-content: space-between; gap: 8px; }
.mp-conversation-top strong { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-conversation-top span { font-size: .72rem; opacity: .65; }
.mp-conversation-preview { display: flex; justify-content: space-between; gap: 8px; margin-top: 3px; }
.mp-conversation-preview span { font-size: .78rem; opacity: .7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-conversation-preview em { background: var(--app-primary-color); color: var(--app-primary-contrast-color, #fff); border-radius: 999px; min-width: 18px; height: 18px; font-size: .7rem; display: inline-flex; align-items: center; justify-content: center; font-style: normal; }
.mp-chat-main { display: flex; flex-direction: column; min-height: 0; }
.mp-chat-header { height: 64px; padding: 0 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); display: flex; align-items: center; justify-content: space-between; flex: 0 0 auto; }
.mp-chat-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mp-chat-title strong { display: block; font-size: .95rem; }
.mp-chat-title span { display: block; font-size: .75rem; opacity: .7; }
.mp-chat-actions { display: flex; align-items: center; gap: 8px; }
.mp-chip { border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 999px; padding: 5px 10px; font-size: .75rem; display: inline-flex; gap: 6px; align-items: center; opacity: .9; }
.mp-status { border-radius: 999px; padding: 5px 10px; font-size: .72rem; font-weight: 600; border: 1px solid currentColor; }
.mp-status.online { color: var(--app-success-color, #16a34a); }
.mp-status.warning { color: var(--app-warning-color, #d97706); }
.mp-status.offline { color: var(--app-danger-color, #dc2626); }
.mp-message-list { flex: 1; min-height: 0; overflow-y: auto; padding: 18px; }
.mp-date-separator { text-align: center; margin: 14px 0; }
.mp-date-separator span { border: 1px solid rgba(255, 255, 255, 0.1); font-size: .72rem; border-radius: 999px; padding: 4px 10px; opacity: .75; }
.mp-composer-wrapper { border-top: 1px solid rgba(255, 255, 255, 0.1); }
.mp-composer { padding: 12px; display: flex; gap: 1px; align-items: flex-end; }
.mp-composer textarea { flex: 1; resize: none; max-height: 140px; }
.mp-empty { font-size: .85rem; text-align: center; padding: 24px; opacity: .7; }
.mp-chat-empty-state { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; opacity: .75; }
.mp-chat-empty-state i { font-size: 56px; margin-bottom: 16px; opacity: .65; }
.mp-chat-empty-state h3 { margin-bottom: 4px; }
.mp-chat-info { border-left: 1px solid rgba(255, 255, 255, 0.1); padding: 14px; overflow-y: auto; }
.mp-info-empty { font-size: .85rem; text-align: center; padding: 24px 8px; opacity: .7; }
.mp-info-section { border-bottom: 1px solid rgba(255, 255, 255, 0.1); padding-bottom: 14px; margin-bottom: 14px; }
.mp-info-section h4 { font-size: .85rem; margin-bottom: 12px; }
.mp-info-row { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.mp-info-row span { font-size: .72rem; opacity: .65; }
.mp-info-row strong { font-size: .82rem; font-weight: 600; }
.mp-info-action { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; background: rgba(255,255,255,0.06); color: inherit; text-align: left; font-size: 14px; }
.mp-info-action:hover { background: rgba(255,255,255,0.1); }
.mp-info-action.danger { color: #ef4444; }
.mp-info-action.danger:hover { background: rgba(239,68,68,0.12); }
.mp-participant-row { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 8px; align-items: center; padding: 8px 0; position: relative; }
.mp-participant-row i { opacity: .7; }
.mp-participant-row strong { display: block; font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-participant-row span { display: block; font-size: .72rem; opacity: .65; }
.mp-participant-row em { grid-column: 2; justify-self: start; border: 1px solid rgba(34, 197, 94, 0.3); color: var(--success-color, #16a34a); border-radius: 999px; padding: 2px 7px; font-size: .68rem; font-style: normal; margin-top: 3px; }
.mp-attachments-preview { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 12px 0 12px; }
.mp-attachment-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 999px; padding: 5px 9px; font-size: .75rem; }
.mp-attachment-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-attachment-chip button { border: none; background: transparent; padding: 0; cursor: pointer; color: inherit; opacity: .7; }
.mp-typing { display: inline-flex; align-items: center; gap: 8px; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 999px; padding: 6px 12px 6px 6px; margin-top: 8px; font-size: .75rem; }
.mp-typing-dots { display: inline-flex; gap: 4px; }
.mp-typing-dots span { width: 5px; height: 5px; background: currentColor; opacity: .5; border-radius: 50%; display: inline-block; animation: mpTyping 1s infinite ease-in-out; }
.mp-typing-dots span:nth-child(2) { animation-delay: .15s; }
.mp-typing-dots span:nth-child(3) { animation-delay: .3s; }
.mp-typing em { font-style: normal; opacity: .75; }
@keyframes mpTyping { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
.mp-new-messages { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); border: none; border-radius: 999px; padding: 10px 16px; background: var(--app-primary-color); color: var(--app-primary-contrast-color, #fff); cursor: pointer; z-index: 100; box-shadow: 0 2px 10px color-mix(in srgb, currentColor 18%, transparent); }
.mp-new-messages:hover { opacity: .95; }
.mp-message-container { display: flex; margin-bottom: 14px; max-width: 86%; }
.mp-message-container.own { margin-left: auto; justify-content: flex-end; }
.mp-message-container.received { margin-right: auto; justify-content: flex-start; }
.mp-message-container.system { max-width: 100%; margin-left: auto; margin-right: auto; justify-content: center; }
.mp-message-system { display: inline-flex; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 999px; padding: 5px 12px; font-size: .78rem; opacity: .7; }
.mp-message { display: flex; gap: 8px; align-items: flex-end; min-width: 0; }
.mp-message.own { flex-direction: row-reverse; }
.mp-message-avatar { flex: 0 0 auto; }
.mp-message-bubble { padding: 9px 12px; max-width: min(620px, 100%); box-shadow: 0 2px 8px color-mix(in srgb, currentColor 8%, transparent); word-break: break-word; }
.mp-message-bubble.own { border-radius: 14px 14px 4px 14px; background: color-mix(in srgb, var(--app-primary-color) 88%, transparent); color: var(--app-primary-contrast-color, #fff); }
.mp-message-bubble.received { border-radius: 14px 14px 14px 4px; background: rgba(255, 255, 255, 0.1); border: 1px solid var(--app-border-color, color-mix(in srgb, currentColor 18%, transparent)); color: inherit; }
.mp-message-bubble.ai { border-style: dashed; }
.mp-message-bubble.email { min-width: 280px; border-left: 3px solid var(--app-primary-color); }
.mp-message-author { font-size: .76rem; font-weight: 600; margin-bottom: 3px; opacity: .75; }
.mp-message-text { font-size: .86rem; line-height: 1.38; }
.mp-message-reply { border-left: 3px solid var(--app-primary-color); padding: 6px 9px; margin-bottom: 7px; border-radius: 6px; font-size: .78rem; background: color-mix(in srgb, currentColor 7%, transparent); opacity: .9; }
.mp-message-meta { display: flex; align-items: center; justify-content: space-between; gap: 5px; margin-top: 5px; font-size: .68rem; opacity: .65; }
.mp-message-meta-left, .mp-message-meta-right { display: flex; align-items: center; gap: 5px; }
.mp-message-read { color: var(--app-info-color, #38bdf8); opacity: 1; }
.mp-message-error { margin-top: 5px; font-size: .72rem; color: var(--app-danger-color, #dc2626); }
.mp-message-error-icon { color: var(--app-danger-color, #dc2626); opacity: 1; }
.mp-message-attachments { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.mp-message-attachment { display: flex; align-items: center; gap: 9px; border: 1px solid color-mix(in srgb, currentColor 15%, transparent); border-radius: 10px; padding: 7px; background: color-mix(in srgb, currentColor 5%, transparent); }
.mp-message-attachment-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; overflow: hidden; border: 1px solid color-mix(in srgb, currentColor 12%, transparent); }
.mp-message-attachment-icon img { width: 100%; height: 100%; object-fit: cover; }
.mp-message-attachment-info { min-width: 0; flex: 1; }
.mp-message-attachment-name { font-size: .78rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mp-message-attachment-size { font-size: .68rem; opacity: .65; }
.mp-audio-recording-time { font-size: .78rem; color: var(--app-danger-color, #dc2626); min-width: 42px; }
@keyframes mpAudioPulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 35%, transparent); } 50% { box-shadow: 0 0 0 5px color-mix(in srgb, currentColor 0%, transparent); } }
.mp-chat-textarea { flex: 1; min-height: 42px; max-height: 180px; resize: none; overflow-y: auto; border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.2)); border-radius: 10px; padding: 10px 12px; background: rgba(255, 255, 255, 0.1); color: inherit; line-height: 1.4; font-family: inherit; font-size: .9rem; outline: none; }
.mp-chat-textarea::placeholder { color: inherit; opacity: .55; }
.mp-chat-textarea:focus { border-color: var(--app-primary-color); box-shadow: 0 0 0 2px color-mix(in srgb, var(--app-primary-color) 18%, transparent); }
.mp-attachment-chip-image { width: 24px; height: 24px; border-radius: 6px; object-fit: cover; flex: 0 0 auto; }
.mp-file-input-hidden { display: none; }
.mp-composer-icon-button, .mp-audio-button { border: none; background: transparent; color: inherit; width: 34px; height: 34px; min-width: 34px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.mp-composer-icon-button:hover, .mp-audio-button:hover { background: color-mix(in srgb, currentColor 6%, transparent); }
.mp-composer-icon-button:disabled, .mp-audio-button:disabled { opacity: .45; cursor: not-allowed; }
.mp-audio-button.recording { color: var(--app-danger-color, #dc2626); animation: mpAudioPulse 1s infinite; }
.mp-chat-page * { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, currentColor 28%, transparent) transparent; }
.mp-message-list::-webkit-scrollbar, .mp-conversation-list::-webkit-scrollbar, .mp-chat-info::-webkit-scrollbar { width: 8px; height: 8px; }
.mp-message-list::-webkit-scrollbar-track, .mp-conversation-list::-webkit-scrollbar-track, .mp-chat-info::-webkit-scrollbar-track { background: transparent; }
.mp-message-list::-webkit-scrollbar-thumb, .mp-conversation-list::-webkit-scrollbar-thumb, .mp-chat-info::-webkit-scrollbar-thumb { background: color-mix(in srgb, currentColor 24%, transparent); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
.mp-message-list::-webkit-scrollbar-thumb:hover, .mp-conversation-list::-webkit-scrollbar-thumb:hover, .mp-chat-info::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, currentColor 38%, transparent); background-clip: content-box; }
.mp-composer-area { position: relative; }
.mp-emoji-mart-container { position: absolute; bottom: calc(100% + 10px); left: 120px; z-index: 5000; width: 380px; pointer-events: none; }
.mp-emoji-mart-container:not(:empty) { pointer-events: auto; }
.mp-emoji-mart-container:empty { display: none; }
.mp-composer.email-mode { align-items: center; }
.mp-email-compose-button { flex: 1; height: 36px; border: 1px solid var(--app-border-color, currentColor); border-radius: 999px; background: transparent; color: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; max-height: 100px; }
.mp-email-modal-backdrop { position: fixed; inset: 0; z-index: 8000; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; }
.mp-email-modal { width: min(760px, 92vw); max-height: 88vh; display: flex; flex-direction: column; border-radius: 16px; border: 1px solid rgba(255, 255, 255, 0.1); background: var(--app-background-color, Canvas); color: inherit; box-shadow: 0 16px 60px rgba(0,0,0,.35); }
.mp-email-modal-header, .mp-email-modal-footer { padding: 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); display: flex; align-items: center; justify-content: space-between; }
.mp-email-modal-footer { border-bottom: none; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.mp-email-modal-body { padding: 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.mp-template-preview { border: 1px solid var(--app-border-color, currentColor); border-radius: 12px; padding: 12px; margin-bottom: 14px; background: color-mix(in srgb, currentColor 4%, transparent); }
.mp-template-preview-header { font-weight: 700; margin-bottom: 8px; }
.mp-template-preview-body { white-space: pre-wrap; line-height: 1.45; }
.mp-template-preview-footer { margin-top: 8px; font-size: .8rem; opacity: .65; }
.mp-template-section-title { font-size: .85rem; margin: 10px 0 8px 0; opacity: .75; }
.mp-send-blocked-alert { display: flex; align-items: center; gap: 8px; margin: 0 0px 0px 10px; padding: 10px 12px; border-radius: 8px; border-left: 4px solid rgba(255, 193, 7, .35); background: rgba(255, 193, 7, .12); color: #d39e00; font-size: .9rem; line-height: 1.4; min-height: 42px; }
.mp-send-blocked-alert i { font-size: 1rem; flex-shrink: 0; }
.mp-new-conversation-modal { width: min(620px, 92vw); }
.mp-new-conversation-channel { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.mp-new-conversation-channel span { font-size: .72rem; opacity: .65; }
.mp-new-conversation-channel strong { font-size: .9rem; }
.mp-new-conversation-section { margin-top: 16px; }
.mp-new-conversation-section-title { display: block; font-size: .78rem; font-weight: 600; margin-bottom: 8px; }
.mp-selected-participants { display: flex; flex-wrap: wrap; gap: 8px; }
.mp-selected-participant { display: inline-grid; grid-template-columns: 26px minmax(0, auto) 22px; align-items: center; gap: 7px; max-width: 100%; border: 1px solid color-mix(in srgb, currentColor 14%, transparent); border-radius: 999px; padding: 4px 6px 4px 4px; }
.mp-selected-participant > span { font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-selected-participant > button { border: 0; background: transparent; color: inherit; cursor: pointer; width: 22px; height: 22px; padding: 0; opacity: .65; }
.mp-participant-picker { margin-top: 8px; max-height: 260px; overflow-y: auto; border: 1px solid color-mix(in srgb, currentColor 12%, transparent); border-radius: 10px; padding: 4px; }
.mp-participant-option { display: grid; grid-template-columns: 30px minmax(0, 1fr) 24px; gap: 9px; align-items: center; width: 100%; padding: 8px; border: 0; border-radius: 8px; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.mp-participant-option:hover { background: color-mix(in srgb, currentColor 7%, transparent); }
.mp-participant-option > span { min-width: 0; }
.mp-participant-option strong, .mp-participant-option small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-participant-option strong { font-size: .82rem; }
.mp-participant-option small { font-size: .7rem; opacity: .65; }
.mp-participant-option > i { opacity: .7; justify-self: center; }
@media (max-width: 1200px) { .mp-chat-page { grid-template-columns: 320px minmax(0, 1fr); } .mp-chat-info { display: none; } }
@media (max-width: 768px) { .mp-chat-page { grid-template-columns: 1fr; margin: 0; height: calc(100vh - 60px); } .mp-chat-sidebar { display: none; } }
