/* ==========================================================================
   ProxWide Messagerie View — Dashboard Full Responsive Theme-Aware Styles
   ========================================================================== */

.messagerie-view-container {
    position: relative;
    width: 100%;
    min-height: calc(100vh - 45px);
    background: var(--bg-body, #f8fafc);
    color: var(--text-main, #0f172a);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    padding: 12px 1.5rem 3rem 1.5rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

[data-theme="dark"] .messagerie-view-container {
    background: var(--bg-body, #0b1120);
    color: var(--text-main, #f8fafc);
}

.messagerie-wrapper {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    flex: 1;
}

/* === Top Navigation Bar (Clean & Compact) === */
.messagerie-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background: var(--bg-card, #ffffff);
    padding: 0.75rem 1.25rem;
    border-radius: 16px;
    border: 1px solid var(--border-color, rgba(226, 232, 240, 0.8));
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .messagerie-topbar {
    background: var(--bg-card, #111827);
    border-color: var(--border-color, rgba(255, 255, 255, 0.08));
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.messagerie-nav-tabs {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.msg-tab-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.15rem;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text-muted, #64748b);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.msg-tab-btn:hover {
    color: var(--text-main, #0f172a);
    background: var(--bg-hover, rgba(0, 0, 0, 0.04));
}

[data-theme="dark"] .msg-tab-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
}

.msg-tab-btn.is-active {
    background: #3b82f6;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.msg-tab-badge {
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.25);
    font-size: 0.72rem;
    font-weight: 800;
}

.msg-tab-btn:not(.is-active) .msg-tab-badge {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.messagerie-user-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.msg-role-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.25);
    color: #8b5cf6;
    font-size: 0.78rem;
    font-weight: 700;
}

/* === Filters & Search Toolbar === */
.msg-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.msg-chips-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.msg-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    border-radius: 9px;
    border: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-card, #ffffff);
    color: var(--text-muted, #64748b);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

[data-theme="dark"] .msg-chip {
    background: var(--bg-card, #111827);
    border-color: var(--border-color, rgba(255, 255, 255, 0.08));
}

.msg-chip:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.msg-chip.is-active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
}

.msg-actions-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.msg-search-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    padding: 0.45rem 0.85rem;
    font-size: 0.85rem;
    min-width: 240px;
}

[data-theme="dark"] .msg-search-box {
    background: var(--bg-card, #111827);
    border-color: var(--border-color, rgba(255, 255, 255, 0.08));
}

.msg-search-box input {
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-main, inherit);
    width: 100%;
}

.msg-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    border-radius: 10px;
    border: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-card, #ffffff);
    color: var(--text-main, #0f172a);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

[data-theme="dark"] .msg-action-btn {
    background: var(--bg-card, #111827);
    border-color: var(--border-color, rgba(255, 255, 255, 0.08));
    color: #f8fafc;
}

.msg-action-btn:hover {
    background: var(--bg-hover, #f1f5f9);
    border-color: #94a3b8;
}

/* === Message Cards List (Inbox) === */
.msg-cards-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.msg-card {
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border-color, rgba(226, 232, 240, 0.8));
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: flex;
    gap: 1.25rem;
    cursor: pointer;
}

[data-theme="dark"] .msg-card {
    background: var(--bg-card, #111827);
    border-color: var(--border-color, rgba(255, 255, 255, 0.08));
}

.msg-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .msg-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

.msg-card.is-unread {
    border-left: 4px solid #3b82f6;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.04), transparent);
}

.msg-card.is-urgent {
    border-left: 4px solid #ef4444;
}

.msg-icon-box {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.msg-icon-box.is-info {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
}

.msg-icon-box.is-important {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.msg-icon-box.is-urgent {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    animation: msgPulse 2s infinite;
}

.msg-icon-box.is-luma {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(99, 102, 241, 0.15));
    border: 1px solid rgba(56, 189, 248, 0.3);
    padding: 2px;
    overflow: hidden;
}

@keyframes msgPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.msg-content-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
}

.msg-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.msg-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.msg-title-text {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-main, #0f172a);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

[data-theme="dark"] .msg-title-text {
    color: #f8fafc;
}

.msg-level-tag {
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    flex-shrink: 0;
}

.msg-level-tag.is-info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.msg-level-tag.is-important {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.msg-level-tag.is-urgent {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.msg-meta-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.78rem;
    color: var(--text-muted, #64748b);
}

/* === Luma Author Badge === */
.msg-author-luma {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #0284c7;
    font-weight: 700;
}

[data-theme="dark"] .msg-author-luma {
    color: #38bdf8;
}

.msg-author-luma strong {
    font-size: 0.8rem;
    letter-spacing: 0.03em;
}

.msg-luma-tag {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.1rem 0.45rem;
    border-radius: 6px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(99, 102, 241, 0.15));
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #0284c7;
    text-transform: uppercase;
}

[data-theme="dark"] .msg-luma-tag {
    color: #38bdf8;
}

.msg-body-text {
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--text-muted, #475569);
    white-space: pre-line;
    margin: 0.2rem 0;
}

[data-theme="dark"] .msg-body-text {
    color: #94a3b8;
}

.msg-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color, rgba(226, 232, 240, 0.5));
}

[data-theme="dark"] .msg-card-footer {
    border-top-color: rgba(255, 255, 255, 0.05);
}

.msg-action-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    border-radius: 8px;
    background: #3b82f6;
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
}

.msg-action-link-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.msg-quick-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.msg-icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted, #64748b);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.35rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.msg-icon-btn:hover {
    background: var(--bg-hover, rgba(0, 0, 0, 0.05));
    color: var(--text-main, #0f172a);
}

[data-theme="dark"] .msg-icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

/* ==========================================================================
   HISTORIQUE & SUIVI DES DIFFUSIONS
   ========================================================================== */

.msg-history-card {
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border-color, rgba(226, 232, 240, 0.8));
    border-radius: 18px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: all 0.2s;
}

[data-theme="dark"] .msg-history-card {
    background: var(--bg-card, #111827);
    border-color: var(--border-color, rgba(255, 255, 255, 0.08));
}

.msg-history-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
}

.msg-history-topline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.msg-history-title-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.msg-history-header-tags {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.msg-history-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main, #0f172a);
    margin: 0;
}

[data-theme="dark"] .msg-history-title {
    color: #f8fafc;
}

.msg-history-meta {
    font-size: 0.78rem;
    color: var(--text-muted, #64748b);
}

.msg-history-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.msg-history-btn-detail {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    border: 1px solid #3b82f6;
    background: rgba(59, 130, 246, 0.08);
    color: #3b82f6;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.msg-history-btn-detail:hover {
    background: #3b82f6;
    color: #ffffff;
}

.msg-history-btn-revoke {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.85rem;
    border-radius: 10px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.06);
    color: #ef4444;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.msg-history-btn-revoke:hover {
    background: #ef4444;
    color: #ffffff;
}

.msg-history-body-snippet {
    background: var(--bg-hover, rgba(0, 0, 0, 0.02));
    border-left: 3px solid #3b82f6;
    border-radius: 0 10px 10px 0;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: var(--text-muted, #475569);
    white-space: pre-line;
}

[data-theme="dark"] .msg-history-body-snippet {
    background: rgba(255, 255, 255, 0.03);
    color: #cbd5e1;
}

.msg-history-stats-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    background: var(--bg-hover, rgba(0, 0, 0, 0.02));
    border: 1px solid var(--border-color, rgba(226, 232, 240, 0.8));
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    flex-wrap: wrap;
}

[data-theme="dark"] .msg-history-stats-bar {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.msg-history-pills {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.msg-stat-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-muted, #64748b);
}

.msg-stat-item strong {
    color: var(--text-main, #0f172a);
    font-size: 0.92rem;
    font-weight: 800;
}

[data-theme="dark"] .msg-stat-item strong {
    color: #f8fafc;
}

.msg-stat-item.is-read strong { color: #10b981; }
.msg-stat-item.is-pending strong { color: #f59e0b; }

.msg-history-gauge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 180px;
}

.msg-progress-track {
    flex: 1;
    height: 8px;
    background: var(--border-color, #e2e8f0);
    border-radius: 999px;
    overflow: hidden;
}

[data-theme="dark"] .msg-progress-track {
    background: rgba(255, 255, 255, 0.1);
}

.msg-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #059669);
    border-radius: 999px;
    transition: width 0.4s ease;
}

.msg-gauge-pct {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--text-main, #0f172a);
    min-width: 40px;
    text-align: right;
}

[data-theme="dark"] .msg-gauge-pct {
    color: #f8fafc;
}

/* ==========================================================================
   MODAL : DÉTAIL DES LECTEURS (Accusés de lecture)
   ========================================================================== */

.msg-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 1rem;
    box-sizing: border-box;
    animation: msgFadeIn 0.2s ease;
}

.msg-modal {
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border-color, rgba(226, 232, 240, 0.8));
    border-radius: 20px;
    width: 100%;
    max-width: 580px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
    animation: msgSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] .msg-modal {
    background: #111827;
    border-color: rgba(255, 255, 255, 0.1);
}

@keyframes msgFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes msgSlideUp {
    from { transform: translateY(20px) scale(0.97); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.msg-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color, rgba(226, 232, 240, 0.8));
}

[data-theme="dark"] .msg-modal-header {
    border-color: rgba(255, 255, 255, 0.08);
}

.msg-modal-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main, #0f172a);
}

[data-theme="dark"] .msg-modal-header h3 {
    color: #f8fafc;
}

.msg-modal-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: var(--bg-hover, #f1f5f9);
    color: var(--text-muted, #64748b);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

[data-theme="dark"] .msg-modal-close-btn {
    background: rgba(255, 255, 255, 0.06);
    color: #cbd5e1;
}

.msg-modal-close-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.msg-modal-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    max-height: calc(85vh - 80px);
}

.msg-reader-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    background: var(--bg-hover, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    gap: 1rem;
    transition: all 0.2s;
}

[data-theme="dark"] .msg-reader-row {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.06);
}

.msg-reader-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.msg-reader-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.msg-reader-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main, #0f172a);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

[data-theme="dark"] .msg-reader-name {
    color: #f8fafc;
}

.msg-reader-hub {
    font-size: 0.72rem;
    color: var(--text-muted, #64748b);
}

.msg-reader-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.msg-reader-status.is-read {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #10b981;
}

.msg-reader-status.is-unread {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

/* === Studio de Diffusion (Formulaire Manager) === */
.msg-compose-grid {
    display: grid;
    grid-template-columns: 1.55fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 1100px) {
    .msg-compose-grid {
        grid-template-columns: 1fr;
    }
}

.msg-form-card {
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border-color, rgba(226, 232, 240, 0.8));
    border-radius: 18px;
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

[data-theme="dark"] .msg-form-card {
    background: var(--bg-card, #111827);
    border-color: var(--border-color, rgba(255, 255, 255, 0.08));
}

.msg-template-presets {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.msg-preset-btn {
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-hover, #f8fafc);
    color: var(--text-main, #334155);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

[data-theme="dark"] .msg-preset-btn {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
}

.msg-preset-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.msg-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.msg-form-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main, #0f172a);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

[data-theme="dark"] .msg-form-label {
    color: #f8fafc;
}

.msg-form-input,
.msg-form-textarea,
.msg-form-select {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border-radius: 10px;
    border: 1px solid var(--border-color, #cbd5e1);
    background: var(--bg-body, #ffffff);
    color: var(--text-main, inherit);
    font-size: 0.88rem;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

[data-theme="dark"] .msg-form-input,
[data-theme="dark"] .msg-form-textarea,
[data-theme="dark"] .msg-form-select {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.12);
}

.msg-form-input:focus,
.msg-form-textarea:focus,
.msg-form-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.msg-level-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
}

.msg-level-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem;
    border-radius: 10px;
    border: 1px solid var(--border-color, #cbd5e1);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
    transition: all 0.2s;
}

.msg-level-btn.is-selected-info {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.msg-level-btn.is-selected-important {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.msg-level-btn.is-selected-urgent {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.msg-action-config-card {
    background: var(--bg-hover, rgba(0, 0, 0, 0.02));
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 14px;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

[data-theme="dark"] .msg-action-config-card {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.08);
}

.msg-action-presets {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.msg-action-chip {
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    border: 1px solid var(--border-color, #cbd5e1);
    background: var(--bg-card, #ffffff);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    cursor: pointer;
    transition: all 0.15s;
}

[data-theme="dark"] .msg-action-chip {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
}

.msg-action-chip:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

/* ==========================================================================
   AUDIENCE SELECTOR — Ultra-Modern Redesign
   ========================================================================== */

.msg-audience-box {
    border: 1px solid var(--border-color, #cbd5e1);
    border-radius: 14px;
    padding: 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--bg-hover, rgba(0, 0, 0, 0.02));
}

[data-theme="dark"] .msg-audience-box {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
}

.msg-audience-counter {
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.msg-target-segments {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.4rem;
    background: var(--bg-card, #ffffff);
    padding: 0.35rem;
    border-radius: 12px;
    border: 1px solid var(--border-color, #e2e8f0);
}

[data-theme="dark"] .msg-target-segments {
    background: rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.08);
}

.msg-segment-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted, #64748b);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.msg-segment-btn:hover {
    color: var(--text-main, #0f172a);
    background: var(--bg-hover, rgba(0, 0, 0, 0.04));
}

[data-theme="dark"] .msg-segment-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
}

.msg-segment-btn.is-active {
    background: #3b82f6;
    color: #ffffff !important;
    box-shadow: 0 3px 10px rgba(59, 130, 246, 0.3);
}

.msg-target-all-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(99, 102, 241, 0.05));
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.msg-target-all-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #3b82f6;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.msg-target-all-card strong {
    display: block;
    font-size: 0.88rem;
    color: var(--text-main, #0f172a);
}

[data-theme="dark"] .msg-target-all-card strong {
    color: #f8fafc;
}

.msg-target-all-card p {
    margin: 0.15rem 0 0 0;
    font-size: 0.78rem;
    color: var(--text-muted, #64748b);
}

.msg-audience-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.msg-audience-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted, #64748b);
}

.msg-link-btn {
    background: transparent;
    border: none;
    color: #3b82f6;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    transition: opacity 0.2s;
}

.msg-link-btn:hover {
    text-decoration: underline;
}

.msg-hubs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.6rem;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.msg-hub-card {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    border: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-card, #ffffff);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

[data-theme="dark"] .msg-hub-card {
    background: var(--bg-card, #111827);
    border-color: var(--border-color, rgba(255, 255, 255, 0.08));
}

.msg-hub-card:hover {
    border-color: #3b82f6;
    transform: translateY(-1px);
}

.msg-hub-card.is-selected {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

.msg-hub-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-main, #0f172a);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

[data-theme="dark"] .msg-hub-name {
    color: #f8fafc;
}

.msg-hub-count {
    font-size: 0.7rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: var(--bg-hover, #f1f5f9);
    color: var(--text-muted, #64748b);
    font-weight: 700;
}

[data-theme="dark"] .msg-hub-count {
    background: rgba(255, 255, 255, 0.06);
    color: #94a3b8;
}

.msg-user-filter-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.msg-user-search-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border-color, #cbd5e1);
    border-radius: 9px;
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
}

[data-theme="dark"] .msg-user-search-input {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

.msg-user-search-input input {
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-main, inherit);
    width: 100%;
    font-size: 0.8rem;
}

.msg-hub-filter-pills {
    display: flex;
    gap: 0.3rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.msg-hub-filter-pill {
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--border-color, #cbd5e1);
    background: var(--bg-card, #ffffff);
    color: var(--text-muted, #64748b);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

[data-theme="dark"] .msg-hub-filter-pill {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
}

.msg-hub-filter-pill:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.msg-hub-filter-pill.is-active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
}

.msg-users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 0.55rem;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.msg-user-card {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-card, #ffffff);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    position: relative;
}

[data-theme="dark"] .msg-user-card {
    background: var(--bg-card, #111827);
    border-color: var(--border-color, rgba(255, 255, 255, 0.08));
}

.msg-user-card:hover {
    border-color: #3b82f6;
    transform: translateY(-1px);
}

.msg-user-card.is-selected {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

.msg-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    flex-shrink: 0;
}

.msg-user-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.msg-user-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-main, #0f172a);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

[data-theme="dark"] .msg-user-name {
    color: #f8fafc;
}

.msg-user-hub {
    font-size: 0.7rem;
    color: var(--text-muted, #64748b);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.msg-user-check {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1.5px solid var(--border-color, #cbd5e1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: transparent;
    transition: all 0.15s;
    flex-shrink: 0;
}

.msg-user-card.is-selected .msg-user-check {
    border-color: #3b82f6;
    background: #3b82f6;
    color: #ffffff;
}

/* === Preview Card in Compose Panel === */
.msg-preview-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.msg-preview-header {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted, #64748b);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* === Empty State === */
.msg-empty-state {
    padding: 4rem 2rem;
    text-align: center;
    background: var(--bg-card, #ffffff);
    border: 1px dashed var(--border-color, #cbd5e1);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

[data-theme="dark"] .msg-empty-state {
    background: var(--bg-card, #111827);
    border-color: rgba(255, 255, 255, 0.1);
}

.msg-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}
