/* Communications Pages Shared Styles */
/* Used by Phone Calls, SMS Messages, and Email pages */

.communications-page {
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    flex: 1;
    overflow-y: auto;
}

.comms-page-header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
}

.comms-page-header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Channel Status Badges - right side of header */
.comms-channel-status {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.comms-page-title {
    font-size: 30px;
    font-weight: 700;
    color: #101828;
    line-height: 1.2;
    letter-spacing: 0.01em;
    margin: 0;
}

.comms-page-subtitle {
    font-size: 16px;
    font-weight: 400;
    color: #4A5565;
    line-height: 1.5;
    margin: 0;
}

/* Two Column Layout */
.comms-layout {
    display: flex;
    gap: 24px;
    flex: 1;
    min-height: 0;
}

.comms-list-panel {
    width: 400px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0px 1px 2px -1px rgba(0, 0, 0, 0.1), 0px 1px 3px 0px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.comms-detail-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0px 1px 2px -1px rgba(0, 0, 0, 0.1), 0px 1px 3px 0px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
}

/* Search Bar */
.comms-search {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
}

.comms-search img {
    opacity: 0.5;
}

.comms-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    color: #101828;
    outline: none;
}

.comms-search-input::placeholder {
    color: #9CA3AF;
}

/* Filter Tabs */
.comms-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.comms-filter-btn {
    padding: 6px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    background: #FFFFFF;
    font-size: 13px;
    font-weight: 500;
    color: #4A5565;
    cursor: pointer;
    transition: all 0.15s ease;
}

.comms-filter-btn:hover {
    background: #F9FAFB;
}

.comms-filter-btn.active {
    background: #EFF6FF;
    border-color: #1447E6;
    color: #1447E6;
}

/* Sync Status - positioned below subtitle */
.comms-sync-status {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.comms-sync-time {
    font-size: 12px;
    font-weight: 400;
    color: #6A7282;
}

.comms-sync-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #4A5565;
    cursor: pointer;
    transition: all 0.15s ease;
}

.comms-sync-btn:hover {
    background: #F3F4F6;
    border-color: #D1D5DC;
    color: #101828;
}

.comms-sync-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.comms-sync-btn.syncing svg {
    animation: spin 1s linear infinite;
}

.comms-settings-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: #6A7282;
    transition: all 0.15s ease;
}

.comms-settings-btn:hover {
    background: #F3F4F6;
    color: #101828;
}

/* AI Staff Filter Dropdown */
.comms-ai-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    cursor: pointer;
}

.comms-ai-filter-label {
    font-size: 13px;
    font-weight: 500;
    color: #4A5565;
}

.comms-ai-filter-value {
    font-size: 13px;
    font-weight: 500;
    color: #101828;
    margin-left: auto;
}

/* Item List */
.comms-item-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    flex: 1;
}

.comms-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.comms-item:hover {
    background: #F9FAFB;
}

.comms-item.selected {
    background: #EFF6FF;
    border-color: #1447E6;
}

.comms-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.comms-item-contact {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.comms-item-name {
    font-size: 15px;
    font-weight: 600;
    color: #101828;
}

.comms-item-phone,
.comms-item-email {
    font-size: 13px;
    font-weight: 400;
    color: #6A7282;
}

.comms-item-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.comms-item-time {
    font-size: 12px;
    font-weight: 400;
    color: #6A7282;
}

.comms-item-duration {
    font-size: 12px;
    font-weight: 500;
    color: #4A5565;
}

.comms-item-summary {
    font-size: 13px;
    font-weight: 400;
    color: #4A5565;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.comms-item-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.comms-tag {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.comms-tag-agent {
    background: #F3E8FF;
    color: #7C3AED;
}

.comms-tag-confidence {
    background: #DCFCE7;
    color: #16A34A;
}

.comms-tag-priority-high {
    background: #FEE2E2;
    color: #DC2626;
}

.comms-tag-priority-medium {
    background: #FEF3C7;
    color: #D97706;
}

.comms-tag-priority-low {
    background: #E0F2FE;
    color: #0284C7;
}

.comms-tag-status {
    background: #F3F4F6;
    color: #4A5565;
}

/* Call Direction Icons */
.comms-item-direction {
    display: flex;
    align-items: center;
    gap: 6px;
}

.comms-direction-icon {
    width: 16px;
    height: 16px;
}

.comms-direction-icon.inbound {
    color: #16A34A;
}

.comms-direction-icon.outbound {
    color: #2563EB;
}

.comms-direction-icon.missed {
    color: #DC2626;
}

/* Detail Panel Header */
.comms-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 20px;
    border-bottom: 1px solid #E5E7EB;
}

.comms-detail-contact {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.comms-detail-name {
    font-size: 24px;
    font-weight: 700;
    color: #101828;
    margin: 0;
}

.comms-detail-phone,
.comms-detail-email {
    font-size: 14px;
    font-weight: 400;
    color: #6A7282;
}

.comms-detail-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.comms-detail-time {
    font-size: 14px;
    font-weight: 500;
    color: #101828;
}

.comms-detail-duration {
    font-size: 14px;
    font-weight: 400;
    color: #6A7282;
}

.comms-detail-direction {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
}

.comms-detail-direction.inbound {
    color: #16A34A;
}

.comms-detail-direction.outbound {
    color: #2563EB;
}

/* Detail Sections */
.comms-detail-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comms-section-title {
    font-size: 16px;
    font-weight: 600;
    color: #101828;
    margin: 0;
}

.comms-section-content {
    font-size: 14px;
    font-weight: 400;
    color: #4A5565;
    line-height: 1.6;
}

/* AI Summary Card */
.comms-ai-summary {
    background: linear-gradient(135deg, #F5F3FF 0%, #EFF6FF 100%);
    border-radius: 10px;
    padding: 16px;
}

.comms-ai-summary-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.comms-ai-summary-icon {
    width: 20px;
    height: 20px;
}

.comms-ai-summary-label {
    font-size: 14px;
    font-weight: 600;
    color: #7C3AED;
}

.comms-ai-summary-text {
    font-size: 14px;
    font-weight: 400;
    color: #374151;
    line-height: 1.6;
    margin: 0;
}

.comms-ai-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.comms-ai-action-tag {
    padding: 4px 10px;
    background: #FFFFFF;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #6A7282;
}

/* Transcript */
.comms-transcript {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 300px;
    overflow-y: auto;
    padding: 16px;
    background: #F9FAFB;
    border-radius: 10px;
}

.comms-transcript-message {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.comms-transcript-sender {
    font-size: 12px;
    font-weight: 600;
    color: #6A7282;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.comms-transcript-sender.ai {
    color: #7C3AED;
}

.comms-transcript-sender.customer {
    color: #2563EB;
}

.comms-transcript-text {
    font-size: 14px;
    font-weight: 400;
    color: #101828;
    line-height: 1.5;
}

.comms-transcript-time {
    font-size: 11px;
    font-weight: 400;
    color: #9CA3AF;
}

/* Email Specific Styles */
.comms-email-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 16px;
    border-bottom: 1px solid #E5E7EB;
}

.comms-email-subject {
    font-size: 20px;
    font-weight: 600;
    color: #101828;
    margin: 0;
}

.comms-email-meta-row {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #6A7282;
}

.comms-email-meta-label {
    font-weight: 500;
    color: #4A5565;
}

.comms-email-body {
    font-size: 14px;
    font-weight: 400;
    color: #374151;
    line-height: 1.7;
    white-space: pre-wrap;
}

.comms-email-attachments {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.comms-email-attachment {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.comms-email-attachment:hover {
    background: #F3F4F6;
}

.comms-email-attachment-name {
    font-size: 13px;
    font-weight: 500;
    color: #101828;
}

.comms-email-attachment-size {
    font-size: 12px;
    font-weight: 400;
    color: #6A7282;
}

/* SMS Specific Styles */
.comms-sms-thread {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #F9FAFB;
    border-radius: 10px;
}

.comms-sms-message {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.comms-sms-message.incoming {
    align-self: flex-start;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    color: #101828;
    border-bottom-left-radius: 4px;
}

.comms-sms-message.outgoing {
    align-self: flex-end;
    background: linear-gradient(135deg, #7C3AED 0%, #2563EB 100%);
    color: #FFFFFF;
    border-bottom-right-radius: 4px;
}

.comms-sms-message.outgoing.ai {
    background: linear-gradient(135deg, #9810FA 0%, #2B7FFF 100%);
}

.comms-sms-time {
    font-size: 11px;
    color: #9CA3AF;
    text-align: center;
    margin: 8px 0;
}

/* Action Buttons */
.comms-actions {
    display: flex;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid #E5E7EB;
    margin-top: auto;
}

.comms-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.comms-action-btn-primary {
    background: linear-gradient(90deg, #9810FA 0%, #2B7FFF 100%);
    border: none;
    color: #FFFFFF;
}

.comms-action-btn-primary:hover {
    opacity: 0.9;
}

.comms-action-btn-secondary {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    color: #364153;
}

.comms-action-btn-secondary:hover {
    background: #F9FAFB;
}

/* Unread Badge */
.comms-item-unread {
    width: 8px;
    height: 8px;
    background: #2563EB;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Empty State */
.comms-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 48px 24px;
    text-align: center;
}

.comms-empty-icon {
    width: 64px;
    height: 64px;
    opacity: 0.4;
}

.comms-empty-title {
    font-size: 18px;
    font-weight: 600;
    color: #101828;
    margin: 0;
}

.comms-empty-text {
    font-size: 14px;
    font-weight: 400;
    color: #6A7282;
    margin: 0;
}

/* Responsive */
@media (max-width: 1200px) {
    .comms-layout {
        flex-direction: column;
    }

    .comms-list-panel {
        width: 100%;
        max-height: 400px;
    }
}

@media (max-width: 768px) {
    .communications-page {
        padding: 24px 16px;
    }

    .comms-page-header {
        flex-direction: column;
        gap: 12px;
    }

    .comms-channel-status {
        align-items: flex-start;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }

    .comms-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 8px;
    }

    .comms-filter-btn {
        white-space: nowrap;
    }
}

/* ===========================================
   Communications Settings Panel
   =========================================== */

.comm-settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
}

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

.comm-settings-panel {
    position: fixed;
    top: 0;
    right: -600px;
    width: 600px;
    height: 100vh;
    background: #FFFFFF;
    box-shadow: -8px 0 25px -5px rgba(0, 0, 0, 0.1), -20px 0 25px -5px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    z-index: 1001;
}

.comm-settings-panel.active {
    right: 0;
}

/* Settings Header */
.comm-settings-header {
    padding: 24px;
    border-bottom: 1px solid #E5E7EB;
}

.comm-settings-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.comm-settings-title-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.comm-settings-title {
    font-size: 20px;
    font-weight: 500;
    color: #101828;
    margin: 0;
    letter-spacing: -0.02em;
}

.comm-settings-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.comm-settings-close:hover {
    background: #F3F4F6;
}

.comm-settings-subtitle {
    font-size: 14px;
    font-weight: 400;
    color: #4A5565;
    margin: 0;
}

/* Settings Body */
.comm-settings-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Settings Sidebar */
.comm-settings-sidebar {
    width: 192px;
    background: #F9FAFB;
    border-right: 1px solid #E5E7EB;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comm-settings-sidebar-label {
    font-size: 12px;
    font-weight: 500;
    color: #4A5565;
    padding: 0 8px;
    line-height: 1.33;
}

.comm-settings-tabs {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.comm-settings-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 400;
    color: #4A5565;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.comm-settings-tab:hover {
    background: #E5E7EB;
}

.comm-settings-tab.active {
    background: #EFF6FF;
    color: #1447E6;
}

.comm-settings-tab img {
    opacity: 0.6;
}

.comm-settings-tab.active img {
    opacity: 1;
}

/* Settings Content */
.comm-settings-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Staff Card */
.comm-settings-card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    padding: 19px;
}

.comm-settings-staff-card {
    background: #F9FAFB;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.comm-settings-staff-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.comm-settings-staff-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.comm-settings-staff-name {
    font-size: 16px;
    font-weight: 600;
    color: #101828;
}

.comm-settings-staff-role {
    font-size: 14px;
    font-weight: 400;
    color: #6A7282;
}

.comm-settings-staff-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #16A34A;
}

.comm-settings-status-dot {
    width: 8px;
    height: 8px;
    background: #00C950;
    border-radius: 50%;
}

/* Settings Sections */
.comm-settings-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comm-settings-section-title {
    font-size: 14px;
    font-weight: 500;
    color: #101828;
    margin: 0;
}

.comm-settings-section-desc {
    font-size: 13px;
    font-weight: 400;
    color: #6A7282;
    margin: 0;
}

/* Toggle Rows */
.comm-settings-toggles {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comm-settings-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.comm-settings-toggle-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.comm-settings-toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: #101828;
}

.comm-settings-toggle-desc {
    font-size: 13px;
    font-weight: 400;
    color: #6A7282;
}

/* Toggle Switch */
.comm-settings-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.comm-settings-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.comm-settings-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #D1D5DC;
    border-radius: 24px;
    transition: 0.3s;
}

.comm-settings-toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.comm-settings-toggle input:checked + .comm-settings-toggle-slider {
    background-color: #155DFC;
}

.comm-settings-toggle input:checked + .comm-settings-toggle-slider:before {
    transform: translateX(20px);
}

/* Radio Group */
.comm-settings-radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comm-settings-radio {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 400;
    color: #101828;
}

.comm-settings-radio input {
    display: none;
}

.comm-settings-radio-mark {
    width: 18px;
    height: 18px;
    border: 2px solid #D1D5DC;
    border-radius: 50%;
    position: relative;
    transition: border-color 0.2s ease;
}

.comm-settings-radio input:checked + .comm-settings-radio-mark {
    border-color: #155DFC;
}

.comm-settings-radio input:checked + .comm-settings-radio-mark:after {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    background: #155DFC;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.comm-settings-link {
    font-size: 14px;
    font-weight: 500;
    color: #155DFC;
    text-decoration: none;
    margin-top: 4px;
}

.comm-settings-link:hover {
    text-decoration: underline;
}

/* Textarea */
.comm-settings-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid #D1D5DC;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #101828;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s ease;
}

.comm-settings-textarea:focus {
    border-color: #155DFC;
}

.comm-settings-textarea::placeholder {
    color: #9CA3AF;
}

/* Settings Footer */
.comm-settings-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-top: 1px solid #E5E7EB;
}

.comm-settings-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.comm-settings-btn-cancel {
    background: transparent;
    border: none;
    color: #364153;
}

.comm-settings-btn-cancel:hover {
    background: #F3F4F6;
}

.comm-settings-btn-save {
    background: #155DFC;
    border: none;
    color: #FFFFFF;
}

.comm-settings-btn-save:hover {
    background: #1447E6;
}

/* Responsive Settings Panel */
@media (max-width: 768px) {
    .comm-settings-panel {
        width: 100%;
        right: -100%;
    }

    .comm-settings-body {
        flex-direction: column;
    }

    .comm-settings-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #E5E7EB;
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
    }

    .comm-settings-tabs {
        flex-direction: row;
    }

    .comm-settings-sidebar-label {
        display: none;
    }
}

/* ===========================================
   Loading & Error States (v20251225a)
   =========================================== */

.comms-list-loading,
.comms-detail-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 24px;
    color: #6A7282;
    font-size: 14px;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #E5E7EB;
    border-top-color: #1447E6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.comms-list-empty,
.comms-list-error,
.comms-detail-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 24px;
    text-align: center;
    color: #6A7282;
    font-size: 14px;
}

.comms-list-error .error-detail,
.comms-detail-error .error-detail {
    font-size: 12px;
    color: #9CA3AF;
    max-width: 280px;
}

.retry-btn {
    margin-top: 8px;
    padding: 8px 16px;
    background: #1447E6;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.retry-btn:hover {
    background: #0d3ab3;
}

/* Empty State Enhancement */
.comms-empty-state {
    flex: 1;
}

.comms-empty-icon {
    color: #9CA3AF;
}

.comms-empty-help {
    margin-top: 24px;
    padding: 16px;
    background: #F9FAFB;
    border-radius: 8px;
    max-width: 400px;
}

.comms-empty-help p {
    margin: 0;
    font-size: 13px;
    color: #4A5565;
}

/* Reply Input Section */
.comms-reply-section {
    padding: 16px 0;
    border-top: 1px solid #E5E7EB;
}

.comms-reply-input-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.comms-reply-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: #101828;
    resize: none;
    outline: none;
    transition: border-color 0.2s ease;
    min-height: 44px;
    max-height: 120px;
}

.comms-reply-input:focus {
    border-color: #1447E6;
}

.comms-reply-input::placeholder {
    color: #9CA3AF;
}

.comms-reply-input:disabled {
    background: #F9FAFB;
    color: #6A7282;
}

.comms-reply-send-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #9810FA 0%, #2B7FFF 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 0.15s ease;
    flex-shrink: 0;
}

.comms-reply-send-btn:hover {
    opacity: 0.9;
}

.comms-reply-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.comms-reply-send-btn svg {
    color: white;
}

/* SMS Thread Scroll Improvements */
.comms-sms-thread {
    max-height: 400px;
    min-height: 200px;
}

.comms-sms-empty {
    text-align: center;
    color: #9CA3AF;
    font-size: 14px;
    padding: 24px;
}

/* ===========================================
   Linked Account Header (v20251227a)
   Shows which account is linked to each channel
   =========================================== */

.comms-linked-account {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
}

.comms-linked-account:hover {
    background: #F3F4F6;
    border-color: #D1D5DC;
}

.comms-linked-account-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #6A7282;
}

.comms-linked-account-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.comms-linked-account-label {
    font-size: 11px;
    font-weight: 500;
    color: #6A7282;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.comms-linked-account-value {
    font-size: 13px;
    font-weight: 500;
    color: #101828;
}

.comms-linked-account-chevron {
    width: 14px;
    height: 14px;
    color: #9CA3AF;
    margin-left: 4px;
    flex-shrink: 0;
}

/* Connected state - green indicator */
.comms-linked-account.connected {
    background: #F0FDF4;
    border-color: #BBF7D0;
}

.comms-linked-account.connected:hover {
    background: #DCFCE7;
    border-color: #86EFAC;
}

.comms-linked-account.connected .comms-linked-account-icon {
    color: #16A34A;
}

/* Not configured state - shows prompt to set up */
.comms-linked-account.not-configured {
    background: #FFFBEB;
    border-color: #FDE68A;
}

.comms-linked-account.not-configured:hover {
    background: #FEF3C7;
    border-color: #FCD34D;
}

.comms-linked-account.not-configured .comms-linked-account-icon {
    color: #D97706;
}

.comms-linked-account.not-configured .comms-linked-account-value {
    color: #D97706;
}

/* Loading state */
.comms-linked-account.loading .comms-linked-account-value {
    color: #9CA3AF;
}

/* Responsive */
@media (max-width: 768px) {
    .comms-linked-account {
        padding: 5px 10px;
    }

    .comms-linked-account-label {
        font-size: 10px;
    }

    .comms-linked-account-value {
        font-size: 12px;
    }
}

/* ===========================================
   Unified Message Status Styles (v20251227a)
   needs_attention, stale, archived indicators
   =========================================== */

/* Needs Attention - red left border indicator */
.comms-item.needs-attention {
    position: relative;
    border-left: 3px solid #DC2626;
}

.comms-item.needs-attention::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #DC2626;
    border-radius: 3px 0 0 3px;
}

/* Stale items (1-7 days old) - slightly faded */
.comms-item.stale {
    opacity: 0.75;
}

.comms-item.stale:hover {
    opacity: 1;
}

/* Archived items - muted appearance */
.comms-item.archived {
    background: #F9FAFB;
    border-color: #E5E7EB;
}

.comms-item.archived .comms-item-name,
.comms-item.archived .comms-item-summary {
    color: #6A7282;
}

/* Item footer with tags and actions */
.comms-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

/* Quick action buttons in list items */
.comms-item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.comms-item:hover .comms-item-actions {
    opacity: 1;
}

.comms-item-actions .comms-action-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: #6A7282;
}

.comms-item-actions .comms-action-btn:hover {
    background: #F3F4F6;
    border-color: #D1D5DC;
    color: #101828;
}

.comms-item-actions .comms-action-btn.active {
    background: #FEF2F2;
    border-color: #FECACA;
    color: #DC2626;
}

.comms-item-actions .comms-action-btn.active:hover {
    background: #FEE2E2;
}

/* Filter count badge */
.comms-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #DC2626;
    color: #FFFFFF;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 4px;
}

.comms-filter-btn.active .comms-filter-count {
    background: #1447E6;
}
