/* ============================================================
   SFBK Inter-Portal Communications & Departmental Dispatch Hub
   Unified styling for all 17 portals (Desktop, Laptop, Tablet & Mobile)
   ============================================================ */

.comm-desk-card {
    background: #FFFFFF;
    border: 1px solid #E8ECF0;
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 22px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 14px rgba(0,0,0,0.05);
}

.comm-desk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #E8ECF0;
}

.comm-desk-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.comm-desk-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #EEF2FF;
    color: #1E1B4B;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border: 1px solid #C7D2FE;
    flex-shrink: 0;
}

.comm-desk-title {
    font-size: 15px;
    font-weight: 800;
    color: #111827;
    font-family: 'Montserrat', system-ui, sans-serif;
    line-height: 1.2;
}

.comm-desk-subtitle {
    font-size: 11.5px;
    color: #6B7280;
    margin-top: 2px;
}

.comm-desk-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-comm-primary {
    background: #118B3A;
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all .18s ease;
    box-shadow: 0 2px 6px rgba(17,139,58,0.25);
}

.btn-comm-primary:hover {
    background: #064E3B;
    transform: translateY(-1px);
}

.btn-comm-secondary {
    background: #F3F4F6;
    color: #374151;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all .18s ease;
}

.btn-comm-secondary:hover {
    background: #E5E7EB;
    color: #111827;
}

.comm-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    background: #F9FAFB;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #E8ECF0;
}

.comm-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.comm-filter-btn {
    border: none;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    color: #4B5563;
    padding: 5px 11px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
}

.comm-filter-btn:hover {
    background: #F3F4F6;
    color: #111827;
}

.comm-filter-btn.active {
    background: #118B3A;
    color: #FFFFFF;
    border-color: #118B3A;
    font-weight: 700;
}

.comm-search-input {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #D1D5DB;
    font-size: 12px;
    outline: none;
    min-width: 220px;
    transition: border-color .15s;
    background: #FFFFFF;
}

.comm-search-input:focus {
    border-color: #118B3A;
    box-shadow: 0 0 0 2px rgba(17,139,58,0.15);
}

.comm-messages-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comm-message-item {
    background: #FFFFFF;
    border: 1px solid #E8ECF0;
    border-radius: 10px;
    padding: 14px 16px;
    transition: all .18s ease;
    cursor: pointer;
    position: relative;
}

.comm-message-item:hover {
    border-color: #CBD5E1;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    transform: translateY(-1px);
}

.comm-message-item.unread {
    border-left: 4px solid #118B3A;
    background: #FCFDFD;
}

.comm-message-item.priority-urgent {
    border-left: 4px solid #DC2626 !important;
}

.comm-message-item.priority-high {
    border-left: 4px solid #D97706 !important;
}

.comm-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.comm-item-sender {
    display: flex;
    align-items: center;
    gap: 8px;
}

.comm-sender-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #EEF2FF;
    color: #1E1B4B;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
}

.comm-sender-name {
    font-size: 12.5px;
    font-weight: 700;
    color: #111827;
}

.comm-to-badge {
    font-size: 10.5px;
    color: #6B7280;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: #F3F4F6;
    padding: 2px 7px;
    border-radius: 12px;
}

.comm-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.comm-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 12px;
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.comm-badge-urgent {
    background: #FEF2F2;
    color: #DC2626;
    border: 1px solid #FCA5A5;
}

.comm-badge-high {
    background: #FFFBEB;
    color: #D97706;
    border: 1px solid #FCD34D;
}

.comm-badge-normal {
    background: #F3F4F6;
    color: #4B5563;
    border: 1px solid #E5E7EB;
}

.comm-badge-resolved {
    background: #F0FDF4;
    color: #16A34A;
    border: 1px solid #86EFAC;
}

.comm-badge-unread {
    background: #EFF6FF;
    color: #2563EB;
    border: 1px solid #BFDBFE;
}

.comm-item-time {
    font-size: 10.5px;
    color: #9CA3AF;
    white-space: nowrap;
}

.comm-item-subject {
    font-size: 13px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 4px;
}

.comm-item-snippet {
    font-size: 12px;
    color: #4B5563;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    /* stylelint-disable-next-line property-no-unknown */
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.comm-item-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed #F1F5F9;
}

.comm-replies-pill {
    font-size: 10.5px;
    color: #6B7280;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.comm-item-btn {
    font-size: 11px;
    font-weight: 700;
    color: #118B3A;
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.comm-item-btn:hover {
    text-decoration: underline;
}

/* MODALS */
.comm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: all .2s ease;
}

.comm-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.comm-modal-card {
    background: #FFFFFF;
    border-radius: 14px;
    width: 100%;
    max-width: 620px;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    transform: scale(0.96);
    transition: transform .2s ease;
}

.comm-modal-overlay.active .comm-modal-card {
    transform: scale(1);
}

.comm-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #E8ECF0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #FAFBFC;
}

.comm-modal-title {
    font-size: 14.5px;
    font-weight: 800;
    color: #111827;
    font-family: 'Montserrat', system-ui, sans-serif;
    display: flex;
    align-items: center;
    gap: 8px;
}

.comm-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #9CA3AF;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
}

.comm-modal-close:hover {
    color: #111827;
    background: #F3F4F6;
}

.comm-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.comm-modal-footer {
    padding: 14px 20px;
    border-top: 1px solid #E8ECF0;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    background: #FAFBFC;
}

.comm-field {
    margin-bottom: 14px;
}

.comm-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: 5px;
}

.comm-input, .comm-select, .comm-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #E5E7EB;
    border-radius: 8px;
    font-size: 12.5px;
    color: #111827;
    outline: none;
    transition: border-color .15s;
    background: #FFFFFF;
    font-family: 'Inter', system-ui, sans-serif;
}

.comm-input:focus, .comm-select:focus, .comm-textarea:focus {
    border-color: #118B3A;
    box-shadow: 0 0 0 2px rgba(17,139,58,0.15);
}

.comm-textarea {
    resize: vertical;
    min-height: 90px;
}

/* THREAD VIEW */
.comm-thread-msg {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 14px;
}

.comm-thread-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 11.5px;
}

.comm-thread-content {
    font-size: 12.5px;
    color: #1E293B;
    line-height: 1.6;
    white-space: pre-wrap;
}

.comm-replies-stream {
    margin-left: 18px;
    padding-left: 14px;
    border-left: 2px solid #E2E8F0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}

.comm-reply-bubble {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 10px 12px;
}

.comm-reply-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 11px;
    color: #64748B;
}

.comm-reply-author {
    font-weight: 700;
    color: #0F172A;
}

.comm-reply-text {
    font-size: 12px;
    color: #334155;
    line-height: 1.5;
}

.comm-empty-state {
    text-align: center;
    padding: 36px 20px;
    color: #64748B;
}

.comm-empty-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

/* RESPONSIVE BREAKPOINTS (Laptop, Desktop, Tablet, Mobile) */
@media (max-width: 768px) {
    .comm-desk-card {
        padding: 14px;
    }
    .comm-desk-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .comm-desk-actions {
        width: 100%;
        justify-content: space-between;
    }
    .btn-comm-primary, .btn-comm-secondary {
        flex: 1;
        justify-content: center;
    }
    .comm-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .comm-search-input {
        width: 100%;
        min-width: 0;
    }
    .comm-filters {
        overflow-x: auto;
        padding-bottom: 4px;
    }
    .comm-modal-card {
        max-width: 95%;
        max-height: calc(100vh - 20px);
    }
    .comm-replies-stream {
        margin-left: 8px;
        padding-left: 10px;
    }
}

