/* CRM Messages Styling - iPhone Messages UI */

/* Contact Me Confirmed Styling */
.conversation-name.contact-me-confirmed {
    color: #28a745 !important;
    font-weight: 700 !important;
}

/* iOS Safari Fixed Height Fixes */
/* Use fixed pixel height from bottom to account for Safari toolbar (50px) */
@media screen and (max-width: 768px) {
    .crm-container {
        height: calc(100vh - 50px); /* 50px for Safari toolbar */
        max-height: calc(100vh - 50px);
    }
    
    .conversations-list {
        max-height: calc(100vh - 250px); /* 50px toolbar + 200px for other elements */
        min-height: calc(100vh - 250px);
    }
    
    .messages-container {
        max-height: calc(100vh - 200px); /* Account for header and input areas */
        flex: 1; /* Take up remaining space */
    }
    
    .chat-container {
        height: calc(100vh - 50px) !important; /* Same height as crm-container */
        max-height: calc(100vh - 50px) !important;
    }
    
    .chat-placeholder {
        min-height: calc(100vh - 300px); /* 50px toolbar + 250px for other elements */
    }
    
    .template-management-modal {
        height: calc(100vh - 50px); /* 50px for Safari toolbar */
        max-height: calc(100vh - 50px);
    }
    
    .template-form {
        max-height: calc(100vh - 250px); /* 50px toolbar + 200px for other elements */
    }
    
    .templates-list {
        max-height: calc(100vh - 500px); /* 50px toolbar + 450px for other elements */
    }
    
    /* Message input container - ensure it's always above the toolbar */
    .message-input-container {
        padding-bottom: calc(16px + 50px); /* 50px for Safari toolbar */
        margin-bottom: 0;
    }
}

/* Ensure parent containers don't clip dropdowns */
.main-content {
    overflow: visible !important;
}

/* Header */
.crm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: white;
    border-bottom: 1px solid #e1e5e9;
    margin-bottom: 0;
    position: relative;
    z-index: 99997;
    overflow: visible;
}

.header-left h1 {
    margin: 0 0 0.25rem 0;
    font-size: 1.75rem;
    color: #2c3e50;
    font-weight: 600;
}

.header-left p {
    margin: 0;
    color: #7f8c8d;
    font-size: 0.9rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: visible;
    position: relative;
    z-index: 99998;
}

/* Folder Tabs */
.folder-tabs-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-left: auto;
    margin-right: 1rem;
}

.folder-tab {
    padding: 0.5rem 1rem;
    border: 1px solid #e1e5e9;
    background: white;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #2c3e50;
}

.folder-tab:hover {
    background: #f8f9fa;
    border-color: #007aff;
    transform: translateY(-1px);
}

.folder-tab.active {
    background: #007aff;
    color: white;
    border-color: #007aff;
    box-shadow: 0 2px 4px rgba(0, 122, 255, 0.2);
}

.folder-tab.active:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.folder-tab i {
    font-size: 0.85rem;
}

.followup-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.folder-tab {
    position: relative;
}

/* Today's Follow-ups Modal */
.todays-followups-modal {
    max-width: 700px;
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.todays-followups-modal .modal-header {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 12px 12px 0 0;
    border-bottom: none;
    box-shadow: 0 4px 12px rgba(238, 90, 111, 0.3);
}

.todays-followups-modal .modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.todays-followups-modal .modal-header h2 i {
    font-size: 1.3rem;
}

.todays-followups-modal .modal-header .close-modal {
    color: white;
    font-size: 1.5rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
}

.todays-followups-modal .modal-header .close-modal:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.todays-followups-modal .modal-body {
    padding: 2rem;
    flex: 1;
    overflow-y: auto;
}

.todays-followups-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.todays-followups-list::-webkit-scrollbar {
    width: 8px;
}

.todays-followups-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.todays-followups-list::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

.todays-followups-list::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.todays-followup-item {
    background: linear-gradient(135deg, #fff5e6 0%, #ffe8cc 100%);
    border: 2px solid #ffc107;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.15);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.todays-followup-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #ff6b6b 0%, #ffc107 100%);
}

.todays-followup-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 193, 7, 0.25);
    border-color: #ff9800;
}

.todays-followup-item-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid rgba(255, 193, 7, 0.3);
}

.todays-followup-item-client {
    font-weight: 700;
    color: #d97706;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.todays-followup-item-client::before {
    content: '👤';
    font-size: 1.1rem;
}

.todays-followup-item-note {
    color: #92400e;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    border-left: 3px solid #ffc107;
}

.todays-followup-item-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.todays-followup-item-actions button {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #d97706;
    background: white;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #d97706;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.todays-followup-item-actions button:hover {
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

.todays-followup-item-actions button:active {
    transform: translateY(0);
}

.todays-followup-item-actions button i {
    font-size: 0.85rem;
}

/* Animation for modal appearance */
@keyframes todaysFollowUpsModalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.todays-followups-modal {
    animation: todaysFollowUpsModalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Pulse animation for urgent items */
@keyframes pulseUrgent {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(255, 193, 7, 0.15);
    }
    50% {
        box-shadow: 0 4px 20px rgba(255, 107, 107, 0.3);
    }
}

.todays-followup-item {
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger animation for multiple items */
.todays-followup-item:nth-child(1) { animation-delay: 0.1s; }
.todays-followup-item:nth-child(2) { animation-delay: 0.2s; }
.todays-followup-item:nth-child(3) { animation-delay: 0.3s; }
.todays-followup-item:nth-child(4) { animation-delay: 0.4s; }
.todays-followup-item:nth-child(n+5) { animation-delay: 0.5s; }

/* Ensure modal displays correctly */
#todays-followups-modal {
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#todays-followups-modal[style*="display: flex"] {
    display: flex !important;
}

.todays-followups-modal .modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding: 1.5rem 2rem;
    border-top: 2px solid #f3f4f6;
    background: #fafafa;
    border-radius: 0 0 12px 12px;
}

.todays-followups-modal .modal-actions .btn-primary {
    background: linear-gradient(135deg, #007aff 0%, #0051d5 100%);
    color: white;
    border: none;
    padding: 0.875rem 1.75rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
    transition: all 0.3s ease;
}

.todays-followups-modal .modal-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.4);
}

.todays-followups-modal .modal-actions .btn-secondary {
    background: white;
    color: #6b7280;
    border: 2px solid #e5e7eb;
    padding: 0.875rem 1.75rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.todays-followups-modal .modal-actions .btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-2px);
}

/* Empty state for today's follow-ups */
.todays-followups-empty {
    text-align: center;
    padding: 3rem 2rem;
    color: #6b7280;
}

.todays-followups-empty i {
    font-size: 4rem;
    color: #d1d5db;
    margin-bottom: 1rem;
}

.todays-followups-empty h3 {
    margin: 0 0 0.5rem 0;
    color: #374151;
    font-size: 1.25rem;
}

.todays-followups-empty p {
    margin: 0;
    font-size: 0.95rem;
}

/* Follow Up Section */
.followup-section {
    flex: 1;
    display: none;
    flex-direction: column;
    padding: 2rem;
    background: white;
    overflow-y: auto;
    height: 100%;
    min-height: 0;
}

.followup-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e1e5e9;
}

.followup-header h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    color: #2c3e50;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.followup-header p {
    margin: 0;
    color: #7f8c8d;
    font-size: 0.9rem;
}

.followup-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.followup-form-container {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #e1e5e9;
}

.followup-form .form-group {
    margin-bottom: 1.5rem;
}

.followup-form .form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

.followup-form .form-group label i {
    color: #007aff;
}

.followup-form select,
.followup-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.followup-form select:focus,
.followup-form textarea:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

/* Follow Up Calendar Picker */
.followup-calendar-picker {
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    background: white;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e5e9;
}

.calendar-title {
    font-weight: 600;
    font-size: 1rem;
    color: #2c3e50;
    flex: 1;
    text-align: center;
}

.calendar-nav-btn {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #5a6c7d;
}

.calendar-nav-btn:hover {
    background: #007aff;
    border-color: #007aff;
    color: white;
    transform: translateY(-1px);
}

.calendar-nav-btn:active {
    transform: translateY(0);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f8f9fa;
    border-bottom: 1px solid #e1e5e9;
}

.calendar-weekday {
    padding: 0.75rem 0.5rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #5a6c7d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    padding: 0.5rem;
    background: #f8f9fa;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #2c3e50;
    transition: all 0.2s ease;
    background: white;
    position: relative;
}

.calendar-day:hover:not(.disabled):not(.other-month) {
    background: #e3f2fd;
    color: #007aff;
    transform: scale(1.05);
}

.calendar-day.selected {
    background: #007aff;
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 122, 255, 0.3);
}

.calendar-day.today {
    background: #fff3cd;
    color: #856404;
    font-weight: 600;
}

.calendar-day.today.selected {
    background: #007aff;
    color: white;
}

.calendar-day.other-month {
    color: #bdc3c7;
    cursor: not-allowed;
}

.calendar-day.disabled {
    color: #e1e5e9;
    cursor: not-allowed;
    background: #f8f9fa;
}

.calendar-day.past {
    color: #bdc3c7;
}

.followup-form textarea {
    resize: vertical;
    min-height: 100px;
}

.followup-form .form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.followup-list-container {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #e1e5e9;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
}

.followup-list-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e1e5e9;
}

.followup-list-header h3 {
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
    color: #2c3e50;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.followup-filter-tabs {
    display: flex;
    gap: 0.5rem;
}

.followup-filter-tab {
    padding: 0.4rem 0.8rem;
    border: 1px solid #e1e5e9;
    background: white;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    color: #2c3e50;
}

.followup-filter-tab:hover {
    background: #f8f9fa;
    border-color: #007aff;
}

.followup-filter-tab.active {
    background: #007aff;
    color: white;
    border-color: #007aff;
}

.followup-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.followup-item {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
    transition: all 0.2s ease;
}

.followup-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.followup-item.completed {
    opacity: 0.7;
    background: #f8f9fa;
}

.followup-item-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.75rem;
}

.followup-item-client {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1rem;
}

.followup-item-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #007aff;
    font-size: 0.85rem;
    font-weight: 500;
}

.followup-item-date.overdue {
    color: #dc3545;
}

.followup-item-date.completed {
    color: #28a745;
}

.followup-item-note {
    color: #5a6c7d;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.followup-item-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e1e5e9;
}

.followup-item-action-btn {
    padding: 0.4rem 0.8rem;
    border: 1px solid #e1e5e9;
    background: white;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.followup-item-action-btn:hover {
    background: #f8f9fa;
    border-color: #007aff;
}

.followup-item-action-btn.complete-btn {
    color: #28a745;
    border-color: #28a745;
}

.followup-item-action-btn.complete-btn:hover {
    background: #28a745;
    color: white;
}

.followup-item-action-btn.delete-btn {
    color: #dc3545;
    border-color: #dc3545;
}

.followup-item-action-btn.delete-btn:hover {
    background: #dc3545;
    color: white;
}

.followup-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #7f8c8d;
}

.followup-empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.followup-empty-state h4 {
    margin: 0 0 0.5rem 0;
    color: #5a6c7d;
}

.followup-empty-state p {
    margin: 0;
    font-size: 0.9rem;
}

/* Responsive Design for Follow Up Section */
@media screen and (max-width: 1024px) {
    .followup-content {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 768px) {
    .folder-tabs-container {
        margin-right: 0.5rem;
    }
    
    .folder-tab {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .followup-section {
        padding: 1rem;
    }
    
    .followup-content {
        gap: 1.5rem;
    }
}

/* Action Buttons */
.btn-action {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

.btn-action.refresh-btn {
    background: #f8f9fa;
    color: #007aff;
    border: 2px solid #e9ecef;
}

.btn-action.refresh-btn:hover {
    background: #e9ecef;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-action.refresh-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.btn-action.refresh-btn i {
    transition: transform 0.3s ease;
}

.btn-action.refresh-btn:hover i {
    transform: rotate(90deg);
}

.btn-action.primary {
    background: linear-gradient(135deg, #007aff 0%, #0056b3 100%);
    color: white;
    border: none;
}

.btn-action.primary:hover {
    background: linear-gradient(135deg, #0056b3 0%, #004494 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.btn-action.primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 122, 255, 0.2);
}

/* Stats Button */
.btn-action.stats-btn {
    background: #f8f9fa;
    color: #28a745;
    border: 2px solid #e9ecef;
}

.btn-action.stats-btn:hover {
    background: #e9ecef;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.2);
}

.btn-action.stats-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(40, 167, 69, 0.15);
}

/* Stats Dropdown */
.stats-dropdown {
    position: relative;
    display: inline-block;
}

.stats-dropdown .dropdown-content {
    width: 360px;
    position: fixed !important;
    z-index: 999999 !important;
}

.stats-dropdown .dropdown-content::before {
    display: none !important;
}

.stats-content {
    padding: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
}

.stat-item:last-child {
    margin-bottom: 0;
}

.stat-item:hover {
    background: #e9ecef;
    transform: translateX(4px);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    font-size: 1.4rem;
}

.stat-icon.quote-sent-icon {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
}

.stat-icon.appointment-icon {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    color: white;
}

.stat-icon.followup-icon {
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: white;
}

.stat-icon.conversion-icon {
    background: linear-gradient(135deg, #6f42c1, #5a32a3);
    color: white;
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2c3e50;
}

.stat-value.conversion-value {
    color: #6f42c1;
    font-size: 2rem;
}

.stat-item.conversion-stat {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 2px solid #6f42c1;
}

.stat-item.conversion-stat:hover {
    background: linear-gradient(135deg, #e9ecef, #dee2e6);
    border-color: #5a32a3;
}

/* New Message Dropdown */
.new-message-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid #e1e5e9;
    width: 320px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    margin-top: 8px;
}

.dropdown-content::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid white;
    filter: drop-shadow(0 -2px 4px rgba(0, 0, 0, 0.1));
}

.dropdown-content.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.dropdown-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
}

.close-dropdown {
    background: none;
    border: none;
    color: #7f8c8d;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-dropdown:hover {
    background: #e9ecef;
    color: #495057;
}

.dropdown-form {
    padding: 1.25rem;
}

.dropdown-form .form-group {
    margin-bottom: 1rem;
}

.dropdown-form .form-group:last-of-type {
    margin-bottom: 1.25rem;
}

.dropdown-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

.dropdown-form select,
.dropdown-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background: white;
}

.dropdown-form select:focus,
.dropdown-form textarea:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.dropdown-form textarea {
    resize: vertical;
    min-height: 60px;
}

.dropdown-form .form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.dropdown-form .btn-secondary,
.dropdown-form .btn-primary {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-form .btn-secondary {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #e9ecef;
}

.dropdown-form .btn-secondary:hover {
    background: #e9ecef;
    color: #495057;
}

.dropdown-form .btn-primary {
    background: #007aff;
    color: white;
}

.dropdown-form .btn-primary:hover {
    background: #0056b3;
}

/* Recipient Tabs */
.recipient-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.recipient-tab {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e1e5e9;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6c757d;
}

.recipient-tab.active {
    background: #007aff;
    color: white;
    border-color: #007aff;
}

.recipient-tab:hover:not(.active) {
    background: #e9ecef;
    color: #495057;
}

#recipient-phone {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background: white;
}

#recipient-phone:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

/* CRM Container */
.crm-container {
    display: flex;
    height: calc(100vh - 180px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin: 0 2rem 2rem 2rem;
    position: relative;
    z-index: 1;
}

/* Conversations Sidebar */
.conversations-sidebar {
    width: 350px;
    background: #f8f9fa;
    border-right: 1px solid #e1e5e9;
    display: flex;
    flex-direction: column;
    min-width: 300px;
}

.conversations-header {
    padding: 0;
    background: white;
    border-bottom: 1px solid #e1e5e9;
}

.search-box {
    position: relative;
    margin: 0;
    padding: 1px 1rem 0 1rem;
}

.search-box i {
    position: absolute;
    left: 1.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #7f8c8d;
    font-size: 0.9rem;
    z-index: 2;
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 10px 15px 10px 35px;
    border: 1px solid #e1e5e9;
    border-radius: 25px;
    font-size: 0.9rem;
    background: #f8f9fa;
    transition: all 0.2s ease;
    height: 40px;
    box-sizing: border-box;
}

.search-box input:focus {
    outline: none;
    border-color: #007aff;
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.filter-tabs {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
    align-items: center;
    margin: 0;
    padding: 0 1rem 1px 1rem;
}

.filter-tab {
    padding: 0.375rem 0.75rem;
    border: none;
    background: #f8f9fa;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
    border: 1px solid transparent;
}

.filter-tab:hover {
    background: #e9ecef;
    border-color: #dee2e6;
    transform: translateY(-1px);
}

.filter-tab.active {
    background: #007aff;
    color: white;
    border-color: #007aff;
    box-shadow: 0 2px 4px rgba(0, 122, 255, 0.2);
}

.filter-tab.active:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.filter-tab i {
    font-size: 0.75rem;
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

/* Conversation Item */
.conversation-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}

.conversation-item:hover {
    background: #e8f4fd;
}

.conversation-item.active {
    background: #007aff;
    color: white;
}

.conversation-item.unread {
    background: #fff3cd;
}

.conversation-item.unread.active {
    background: #007aff;
}

.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.conversation-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: inherit;
}

.conversation-time {
    font-size: 0.8rem;
    opacity: 0.7;
}

.conversation-preview {
    font-size: 0.85rem;
    opacity: 0.8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 250px;
}

.conversation-item.unread .conversation-preview {
    font-weight: 500;
    opacity: 1;
}

.unread-badge {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: #007aff;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    position: relative;
    height: 100%;
    min-height: 0; /* Allow flex child to shrink */
    overflow: hidden; /* Prevent overflow issues */
}

/* Chat Placeholder */
.chat-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.placeholder-content {
    text-align: center;
    color: #7f8c8d;
}

.placeholder-content i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.placeholder-content h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 500;
}

.placeholder-content p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Chat Header */
.chat-header {
    padding: 1rem 1.5rem;
    background: white;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow: visible;
    position: relative;
    z-index: 10 !important;
}

.client-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    overflow: visible;
}

.client-avatar {
    width: 40px;
    height: 40px;
    background: #007aff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}

.client-details {
    flex: 1;
    min-width: 0;
    position: relative;
}

.client-details h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
}

.client-details span {
    font-size: 0.85rem;
    color: #7f8c8d;
}

.chat-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    padding: 8px;
    border: none;
    background: #f8f9fa;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #7f8c8d;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: #e9ecef;
    color: #495057;
}

/* Messages Container */
.messages-container {
    flex: 1;
    background: #f8f9fa;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    /* iPhone Messages gradient background */
    background: linear-gradient(to bottom, #f8f9fa 0%, #ffffff 100%);
    max-height: calc(100vh - 200px); /* Ensure it doesn't exceed viewport */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    min-height: 0; /* Allow flex shrinking */
}

.messages-list {
    padding: 1rem;
    min-height: calc(100% - 2rem);
    width: 100%;
    box-sizing: border-box;
    /* Remove overflow hidden to allow scrolling */
}

.messages-list::after {
    content: "";
    display: table;
    clear: both;
    height: 20px; /* Add some bottom spacing */
}

/* Scrollbar Styling */
.messages-container::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Message bubble spacing and width fixes */

/* Message Bubble Styles - iPhone like */
.message-bubble {
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
    max-width: 70%;
    clear: both;
    position: relative;
}

.message-bubble.outbound {
    /* YOUR messages - RIGHT side */
    float: right;
    margin-left: 100px;
    margin-right: 16px;
    align-items: flex-end;
}

.message-bubble.inbound {
    /* THEIR messages - LEFT side */
    float: left;
    margin-right: 100px;
    margin-left: 16px;
    align-items: flex-start;
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
    display: inline-block;
    min-width: 60px;
    max-width: 100%;
    width: fit-content;
}

.message-bubble.outbound .message-content {
    background: #007aff;
    color: white;
    border-bottom-right-radius: 5px;
}

.message-bubble.inbound .message-content {
    background: #e5e5ea;
    color: #000000;
    border-bottom-left-radius: 5px;
}

.message-meta {
    margin-top: 2px;
    padding: 0 6px;
}

.message-time {
    font-size: 0.7rem;
    opacity: 0.7;
    color: #8e8e93;
}

/* Message Status */
.message-status-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
    font-size: 0.7rem;
    color: #7f8c8d;
}

.message-bubble.outbound .message-status-indicator {
    justify-content: flex-end;
}

.status-icon {
    width: 12px;
    height: 12px;
}

.status-delivered .status-icon {
    color: #28a745;
}

.status-failed .status-icon {
    color: #dc3545;
}

.status-sending .status-icon {
    animation: spin 1s linear infinite;
}

/* Message Attachments */
.message-attachments {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e9ecef;
}

.message-attachment {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.message-attachment:last-child {
    margin-bottom: 0;
}

.message-attachment:hover {
    border-color: #007aff;
    background: #e3f2fd;
}

.message-attachment .attachment-icon {
    width: 24px;
    height: 24px;
    background: #e9ecef;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 0.8rem;
}

.message-attachment .attachment-icon i {
    color: #007aff;
}

.message-attachment .attachment-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.message-attachment .attachment-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: #2c3e50;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-attachment .attachment-size {
    font-size: 0.7rem;
    color: #6c757d;
}

.btn-view-attachment {
    background: #007aff;
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    text-decoration: none;
}

.btn-view-attachment:hover {
    background: #0056b3;
    transform: scale(1.05);
}

/* Date Divider */
.date-divider {
    align-self: center;
    background: rgba(0, 0, 0, 0.05);
    color: #7f8c8d;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    margin: 12px 0;
    font-weight: 500;
}

/* Message Input */
.message-input-container {
    padding: 1rem 1.5rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); /* Add safe area for mobile Safari */
    background: white;
    border-top: 1px solid #e1e5e9;
    flex-shrink: 0; /* Prevent shrinking */
    position: relative; /* Ensure proper positioning */
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: #f8f9fa;
    border-radius: 20px;
    padding: 8px;
    border: 1px solid #e1e5e9;
    transition: all 0.2s ease;
}

.input-wrapper:focus-within {
    border-color: #007aff;
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.attachment-btn {
    background: transparent;
    color: #7f8c8d;
    margin-bottom: 2px;
}

.attachment-btn:hover {
    background: #e9ecef;
    color: #495057;
}

/* Attachments Preview */
.attachments-preview {
    padding: 0.75rem;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
}

.attachment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.attachment-item:last-child {
    margin-bottom: 0;
}

.attachment-item:hover {
    border-color: #007aff;
    box-shadow: 0 2px 4px rgba(0, 122, 255, 0.1);
}

.attachment-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.attachment-icon {
    width: 32px;
    height: 32px;
    background: #e9ecef;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 0.9rem;
}

.attachment-icon i {
    color: #007aff;
}

.attachment-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.attachment-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: #2c3e50;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-size {
    font-size: 0.75rem;
    color: #6c757d;
}

.btn-remove-attachment {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
}

.btn-remove-attachment:hover {
    background: #c82333;
    transform: scale(1.05);
}

#message-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 12px;
    font-size: 16px; /* 16px prevents iOS Safari zoom */
    line-height: 1.4;
    resize: none;
    outline: none;
    font-family: inherit;
    max-height: 120px;
    min-height: 20px;
}

.send-btn {
    background: #007aff;
    color: white;
    margin-bottom: 2px;
}

.send-btn:hover {
    background: #0056b3;
}

.send-btn:disabled {
    background: #e9ecef;
    color: #adb5bd;
    cursor: not-allowed;
}

.message-status {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-top: 4px;
    padding: 0 12px;
    min-height: 16px;
}

/* Modal Styles */
.client-info-modal {
    max-width: 500px;
}

.client-info-modal .modal-header {
    background: #007aff;
    color: white;
    border-radius: 8px 8px 0 0;
}

.client-info-modal .modal-header h2 {
    color: white;
}

.client-info-modal .close-modal {
    color: white;
    opacity: 0.8;
}

.client-info-modal .close-modal:hover {
    opacity: 1;
}

/* Client Info Content */
.client-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.info-item {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #007aff;
}

.info-label {
    font-size: 0.8rem;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.info-value {
    font-size: 0.95rem;
    color: #2c3e50;
    font-weight: 500;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.loading-spinner {
    text-align: center;
    color: #007aff;
}

.loading-spinner i {
    font-size: 2rem;
    margin-bottom: 1rem;
}

/* Create Contact Dropdown */
.create-contact-dropdown {
    position: relative;
}

.create-contact-dropdown .dropdown-content {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 400px;
    max-width: 500px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.create-contact-dropdown .dropdown-content.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.create-contact-dropdown .dropdown-content::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid white;
    filter: drop-shadow(0 -2px 4px rgba(0, 0, 0, 0.1));
}

.create-contact-dropdown .dropdown-header {
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid #f1f3f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.create-contact-dropdown .dropdown-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
}

.create-contact-dropdown .close-dropdown {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #6c757d;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.create-contact-dropdown .close-dropdown:hover {
    color: #495057;
    background: #f8f9fa;
}

.create-contact-dropdown .dropdown-form {
    padding: 1.25rem;
}

.create-contact-dropdown .form-section {
    margin-bottom: 1rem;
}

.create-contact-dropdown .form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.create-contact-dropdown .form-group {
    flex: 1;
    margin-bottom: 1rem;
}

.create-contact-dropdown .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #374151;
    font-weight: 500;
    font-size: 0.875rem;
}

.create-contact-dropdown .form-group input,
.create-contact-dropdown .form-group select,
.create-contact-dropdown .form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.create-contact-dropdown .form-group input:focus,
.create-contact-dropdown .form-group select:focus,
.create-contact-dropdown .form-group textarea:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.create-contact-dropdown .form-group input[readonly] {
    background-color: #f9fafb;
    cursor: not-allowed;
    color: #6b7280;
}

.create-contact-dropdown .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #f1f3f5;
}

.create-contact-dropdown .btn-primary,
.create-contact-dropdown .btn-secondary {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.create-contact-dropdown .btn-primary {
    background: #007aff;
    color: white;
}

.create-contact-dropdown .btn-primary:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.create-contact-dropdown .btn-secondary {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.create-contact-dropdown .btn-secondary:hover {
    background: #e9ecef;
    color: #495057;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    /* New Message Dropdown Mobile Styles */
    .new-message-dropdown .dropdown-content {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: calc(100vw - 2rem) !important;
        max-width: 400px !important;
        max-height: 80vh !important;
        overflow-y: auto !important;
        z-index: 10000 !important;
        margin: 0 !important;
        opacity: 0 !important;
        visibility: hidden !important;
        background: white !important;
        border-radius: 12px !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15) !important;
        border: 1px solid #e1e5e9 !important;
    }
    
    .new-message-dropdown .dropdown-content::before {
        display: none !important;
    }
    
    .new-message-dropdown .dropdown-content.active {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translate(-50%, -50%) !important;
    }
    
    /* Force mobile styles to override everything */
    body .new-message-dropdown .dropdown-content {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        z-index: 10000 !important;
    }
    
    body .new-message-dropdown .dropdown-content.active {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translate(-50%, -50%) !important;
    }
    
    /* Dropdown backdrop for mobile */
    .dropdown-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        z-index: 9999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
    
    .dropdown-backdrop.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* Mobile Modal Styles */
    .mobile-modal-content {
        background: white;
        border-radius: 12px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
        width: 100%;
        max-width: 400px;
        max-height: 80vh;
        overflow-y: auto;
        animation: modalSlideIn 0.3s ease-out;
    }
    
    .mobile-modal-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px;
        border-bottom: 1px solid #e1e5e9;
    }
    
    .mobile-modal-header h3 {
        margin: 0;
        font-size: 18px;
        font-weight: 600;
        color: #1d1d1f;
    }
    
    .mobile-modal-close {
        width: 32px;
        height: 32px;
        border-radius: 16px;
        background: rgba(142, 142, 147, 0.12);
        border: none;
        color: #8e8e93;
        font-size: 16px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .mobile-modal-close:hover {
        background: rgba(142, 142, 147, 0.2);
        color: #1d1d1f;
    }
    
    .mobile-modal-body {
        padding: 20px;
    }
    
    .mobile-modal-body .form-group {
        margin-bottom: 20px;
    }
    
    .mobile-modal-body .form-group label {
        display: block;
        margin-bottom: 8px;
        font-weight: 500;
        color: #1d1d1f;
    }
    
    .mobile-modal-body select,
    .mobile-modal-body input,
    .mobile-modal-body textarea {
        width: 100%;
        padding: 12px;
        border: 1px solid #e1e5e9;
        border-radius: 8px;
        font-size: 16px;
        box-sizing: border-box;
    }
    
    .mobile-modal-body .recipient-tabs {
        display: flex;
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .mobile-modal-body .recipient-tab {
        flex: 1;
        padding: 8px 16px;
        border: 1px solid #e1e5e9;
        background: white;
        color: #8e8e93;
        border-radius: 6px;
        font-size: 14px;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .mobile-modal-body .recipient-tab.active {
        background: #007aff;
        color: white;
        border-color: #007aff;
    }
    
    .mobile-modal-body .form-actions {
        display: flex;
        gap: 12px;
        margin-top: 24px;
    }
    
    .mobile-modal-body .btn-primary,
    .mobile-modal-body .btn-secondary {
        flex: 1;
        padding: 12px 20px;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .mobile-modal-body .btn-primary {
        background: #007aff;
        color: white;
        border: none;
    }
    
    .mobile-modal-body .btn-primary:hover {
        background: #0056b3;
    }
    
    .mobile-modal-body .btn-secondary {
        background: #f2f2f7;
        color: #1d1d1f;
        border: 1px solid #e1e5e9;
    }
    
    .mobile-modal-body .btn-secondary:hover {
        background: #e5e5ea;
    }
    
    @keyframes modalSlideIn {
        from {
            opacity: 0;
            transform: scale(0.9) translateY(-20px);
        }
        to {
            opacity: 1;
            transform: scale(1) translateY(0);
        }
    }
    
    .create-contact-dropdown .dropdown-content {
        right: -1rem;
        left: -1rem;
        min-width: auto;
        max-width: none;
        margin: 0 1rem;
        width: calc(100vw - 2rem);
    }
    
    .create-contact-dropdown .dropdown-content::before {
        right: 2rem;
    }
    
    .create-contact-dropdown .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .create-contact-dropdown .form-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .create-contact-dropdown .btn-primary,
    .create-contact-dropdown .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}

.loading-spinner p {
    margin: 0;
    font-size: 0.9rem;
    color: #7f8c8d;
}

/* Conversation Tags Dropdown */
.conversation-tags-dropdown {
    position: relative;
    display: inline-block;
}

.tags-dropdown-content {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid #e1e5e9;
    width: 420px;
    max-height: 600px;
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.tags-dropdown-content.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.tags-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.tags-dropdown-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #2c3e50;
    font-weight: 600;
}

.tags-dropdown-header h3 i {
    margin-right: 0.5rem;
    color: #3498db;
}

/* Current Tags Section */
.current-tags-section {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
}

.current-tags-section h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: #7f8c8d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.current-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 32px;
}

.current-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: #3498db;
    color: white !important;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    animation: tagFadeIn 0.3s ease;
}

.current-tag.priority-high {
    background: #e74c3c;
}

.current-tag.priority-medium {
    background: #f39c12;
}

.current-tag.priority-low {
    background: #27ae60;
}

.current-tag.custom-tag {
    background: #ffc107; /* Yellow */
    color: #2c3e50 !important;
}

/* Specific tag colors for current tags */
.current-tag.follow-up-needed {
    background: #e67e22; /* Orange */
}

.current-tag.quote-sent {
    background: #9b59b6; /* Purple */
}

.current-tag.appointment-scheduled {
    background: #28a745; /* Green */
}

.current-tag.website-quote,
.current-tag.quote-requested {
    background: #007bff; /* Blue */
    color: white !important;
}

.current-tag.payment-pending {
    background: #f1c40f;
    color: #2c3e50 !important;
}

.current-tag.service-completed {
    background: #2ecc71;
}

.current-tag.issue-reported {
    background: #e74c3c;
}

.current-tag.new-client {
    background: #3498db;
}

.current-tag.vip-client {
    background: #f39c12;
}

.current-tag.recurring-service {
    background: #1abc9c;
}

.current-tag.needs-callback {
    background: #e91e63;
}

.current-tag .remove-tag {
    background: none;
    border: none;
    color: white;
    font-size: 0.7rem;
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.current-tag .remove-tag:hover {
    background: rgba(255, 255, 255, 0.2);
}

.no-tags-message {
    color: #bdc3c7;
    font-style: italic;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    min-height: 32px;
}

/* Available Tags Section */
.available-tags-section {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
}

.available-tags-section h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: #7f8c8d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quick-tags-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.quick-tag-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #2c3e50;
    text-align: left;
    white-space: nowrap;
}

.quick-tag-btn:hover {
    background: #e9ecef;
    border-color: #3498db;
    transform: translateY(-1px);
}

.quick-tag-btn.selected {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

/* Quick tag button colors based on data-tag */
.quick-tag-btn[data-tag="follow-up-needed"]:hover {
    background: #e67e22;
    color: white;
    border-color: #e67e22;
}

.quick-tag-btn[data-tag="quote-sent"]:hover {
    background: #16a085;
    color: white;
    border-color: #16a085;
}

.quick-tag-btn[data-tag="appointment-scheduled"]:hover {
    background: #8e44ad;
    color: white;
    border-color: #8e44ad;
}

.quick-tag-btn[data-tag="payment-pending"]:hover {
    background: #f1c40f;
    color: #2c3e50;
    border-color: #f1c40f;
}

.quick-tag-btn[data-tag="service-completed"]:hover {
    background: #2ecc71;
    color: white;
    border-color: #2ecc71;
}

.quick-tag-btn[data-tag="issue-reported"]:hover {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

.quick-tag-btn[data-tag="new-client"]:hover {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.quick-tag-btn[data-tag="vip-client"]:hover {
    background: #f39c12;
    color: white;
    border-color: #f39c12;
}

.quick-tag-btn[data-tag="recurring-service"]:hover {
    background: #1abc9c;
    color: white;
    border-color: #1abc9c;
}

.quick-tag-btn[data-tag="needs-callback"]:hover {
    background: #e91e63;
    color: white;
    border-color: #e91e63;
}

.quick-tag-btn i {
    font-size: 0.9rem;
    width: 16px;
    text-align: center;
}

/* Custom Tag Section */
.custom-tag-section {
    padding: 1rem 1.5rem;
}

.custom-tag-section h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: #7f8c8d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.custom-tag-input-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.custom-tag-input-group input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.custom-tag-input-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.add-custom-tag-btn {
    padding: 0.75rem 1rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.add-custom-tag-btn:hover {
    background: #2980b9;
}

.add-custom-tag-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.custom-tag-suggestions h5 {
    margin: 0 0 0.5rem 0;
    font-size: 0.8rem;
    color: #95a5a6;
    font-weight: 600;
}

.recent-custom-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.recent-custom-tag {
    padding: 0.375rem 0.75rem;
    background: #ecf0f1;
    border: 1px solid #bdc3c7;
    border-radius: 16px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #2c3e50;
}

.recent-custom-tag:hover {
    background: #d5dbdb;
    border-color: #95a5a6;
}

/* Tag Filter Dropdown */
.tag-filter-dropdown {
    position: relative;
    display: inline-block;
}

.tag-filter-btn {
    position: relative;
    background: #f8f9fa !important;
    border: 1px solid #e1e5e9 !important;
}

.tag-filter-btn.active {
    background: #3498db !important;
    color: white !important;
    border-color: #3498db !important;
}

.tag-filter-content {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border: 1px solid #e1e5e9;
    width: 280px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.tag-filter-content.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.tag-filter-section {
    padding: 1rem;
}

.tag-filter-section h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: #2c3e50;
    font-weight: 600;
}

.tag-filter-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-bottom: 1rem;
}

.tag-filter-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.tag-filter-item:hover {
    background: #f8f9fa;
}

.tag-filter-item input[type="checkbox"] {
    margin: 0;
}

.tag-filter-item label {
    margin: 0;
    cursor: pointer;
    font-size: 0.85rem;
    color: #2c3e50;
}

.clear-tag-filters {
    width: 100%;
    padding: 0.5rem;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.clear-tag-filters:hover {
    background: #c0392b;
}

/* Conversation Item Tags */
.conversation-item {
    position: relative;
}

.conversation-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.conversation-tag {
    padding: 0.125rem 0.5rem;
    background: #3498db;
    color: white;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
}

.conversation-tag.priority-high {
    background: #e74c3c;
}

.conversation-tag.priority-medium {
    background: #f39c12;
}

.conversation-tag.priority-low {
    background: #27ae60;
}

.conversation-tag.custom-tag {
    background: #ffc107; /* Yellow */
    color: #2c3e50 !important;
}

/* Specific tag colors for conversation tags */
.conversation-tag.follow-up-needed {
    background: #e67e22; /* Orange */
}

.conversation-tag.quote-sent {
    background: #9b59b6; /* Purple */
}

.conversation-tag.appointment-scheduled {
    background: #28a745; /* Green */
}

.conversation-tag.quote-requested {
    background: #007bff; /* Blue */
    color: white !important;
}

.conversation-tag.payment-pending {
    background: #f1c40f;
    color: #2c3e50;
}

.conversation-tag.service-completed {
    background: #2ecc71;
}

.conversation-tag.issue-reported {
    background: #e74c3c;
}

.conversation-tag.new-client {
    background: #3498db;
}

.conversation-tag.vip-client {
    background: #f39c12;
}

.conversation-tag.recurring-service {
    background: #1abc9c;
}

.conversation-tag.needs-callback {
    background: #e91e63;
}

/* Animation for tag addition */
@keyframes tagFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .tags-dropdown-content {
        width: 90vw;
        right: -50px;
        max-width: 350px;
    }
    
    .quick-tags-grid {
        grid-template-columns: 1fr;
    }
    
    .tag-filter-content {
        width: 250px;
        left: -100px;
    }
}

/* Delete Button */
.delete-client-btn {
    background: #dc3545;
    color: white;
    border: none;
}

.delete-client-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* Pipeline Dropdown */
.pipeline-dropdown {
    position: relative;
    display: inline-block;
}

.pipeline-dropdown .dropdown-content {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    min-width: 400px;
    max-width: 500px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    overflow: hidden;
}

.pipeline-dropdown .dropdown-content.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.pipeline-dropdown .dropdown-content::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid white;
    filter: drop-shadow(0 -2px 4px rgba(0, 0, 0, 0.1));
}

.pipeline-stage-selection {
    padding: 20px;
}

.pipeline-stage-selection p {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 14px;
}

.pipeline-stages {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pipeline-stage-option {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}

.pipeline-stage-option:hover {
    border-color: #007bff;
    background: #f8f9ff;
}

.pipeline-stage-option.selected {
    border-color: #007bff;
    background: #e3f2fd;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
}

.pipeline-stage-option:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

.pipeline-stage-option .stage-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    color: #666;
    font-size: 16px;
}

.pipeline-stage-option.selected .stage-icon {
    background: #007bff;
    color: white;
}

.pipeline-stage-option .stage-info h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.pipeline-stage-option .stage-info p {
    margin: 0;
    font-size: 12px;
    color: #666;
}

/* Pipeline Stage Indicator */
.pipeline-stage-indicator {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 8px;
    white-space: nowrap;
}

.pipeline-stage-indicator.interested {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.pipeline-stage-indicator.quote-sent {
    background: #fff3e0;
    color: #f57c00;
    border: 1px solid #ffcc02;
}

.pipeline-stage-indicator.scheduled {
    background: #e8f5e8;
    color: #388e3c;
    border: 1px solid #c8e6c9;
}

.pipeline-stage-indicator.completed {
    background: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid #e1bee7;
}

.pipeline-stage-indicator.paid {
    background: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

/* Delete Client Dropdown */
.delete-client-dropdown {
    position: relative;
}

.delete-client-dropdown .dropdown-content {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 400px;
    max-width: 500px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.delete-client-dropdown .dropdown-content.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.delete-client-dropdown .dropdown-content::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid white;
    filter: drop-shadow(0 -2px 4px rgba(0, 0, 0, 0.1));
}

.delete-client-dropdown .dropdown-header {
    background: #dc3545;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.delete-client-dropdown .dropdown-header h3 {
    color: white;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.delete-client-dropdown .close-dropdown {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.delete-client-dropdown .close-dropdown:hover {
    opacity: 1;
}

.delete-warning {
    text-align: center;
    padding: 1.5rem;
}

.delete-warning p {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.warning-text {
    color: #e74c3c;
    font-weight: 600;
    margin-bottom: 0.5rem !important;
}

.delete-items {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
    text-align: left;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
}

.delete-items li {
    margin: 0.5rem 0;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.delete-items i {
    color: #dc3545;
    width: 16px;
}

.warning-note {
    color: #e74c3c;
    font-weight: 600;
    font-size: 0.95rem;
    margin-top: 1rem !important;
}

.dropdown-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e1e5e9;
    border-radius: 0 0 12px 12px;
    background: #f8f9fa;
}

.btn-danger {
    background: #dc3545;
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

@media (max-width: 768px) {
    .delete-client-dropdown .dropdown-content {
        right: -1rem;
        left: -1rem;
        min-width: auto;
        max-width: none;
        margin: 0 1rem;
        width: calc(100vw - 2rem);
    }
    
    .delete-client-dropdown .dropdown-content::before {
        right: 2rem;
    }
    
    .dropdown-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .btn-danger,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}

/* Schedule Cleaning Button */
.schedule-cleaning-btn {
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: white;
    border: none;
}

.schedule-cleaning-btn:hover {
    background: linear-gradient(135deg, #138496, #117a8b);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
}

.btn-info {
    background: #17a2b8;
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-info:hover {
    background: #138496;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
}

/* Schedule Cleaning Dropdown */
.schedule-cleaning-dropdown {
    position: relative;
}

.schedule-cleaning-dropdown .form-section {
    padding: 0.75rem 1rem;
}

.schedule-cleaning-dropdown .dropdown-content {
    position: fixed;
    top: auto;
    bottom: auto;
    right: 1rem;
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 600px;
    max-width: 750px;
    max-height: 80vh;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.schedule-cleaning-dropdown .dropdown-content.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.schedule-cleaning-dropdown .dropdown-content::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid white;
    filter: drop-shadow(0 -2px 4px rgba(0, 0, 0, 0.1));
}

/* Arrow pointing up when dropdown is below button */
.schedule-cleaning-dropdown .dropdown-content.below::before {
    top: -8px;
    border-bottom: 8px solid white;
    border-top: none;
}

/* Arrow pointing down when dropdown is above button */
.schedule-cleaning-dropdown .dropdown-content.above::before {
    top: auto;
    bottom: -8px;
    border-top: 8px solid white;
    border-bottom: none;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.schedule-cleaning-dropdown .dropdown-header {
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.schedule-cleaning-dropdown .dropdown-header h3 {
    color: white;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.schedule-cleaning-dropdown .close-dropdown {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.schedule-cleaning-dropdown .close-dropdown:hover {
    opacity: 1;
}

/* Compact horizontal layout - minimize scrolling */
.schedule-date-time-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.schedule-date-section {
    flex: 0 0 280px;
    min-width: 280px;
}

.schedule-time-section {
    flex: 0 0 180px;
    display: flex;
    flex-direction: column;
}

.schedule-date-section label,
.schedule-time-section label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 600;
    color: #333;
    font-size: 0.85rem;
}

/* Compact calendar picker */
.schedule-date-section .calendar-picker {
    margin-bottom: 0;
}

.schedule-date-section .calendar-picker .calendar-header {
    padding: 0.5rem 0.75rem;
}

.schedule-date-section .calendar-picker .calendar-ui {
    padding: 0.25rem;
}

.schedule-date-section .calendar-picker .calendar-ui td {
    padding: 0.35rem;
    font-size: 0.85rem;
}

.schedule-date-section .calendar-picker .calendar-ui th {
    padding: 0.35rem;
    font-size: 0.8rem;
}

/* Compact time picker */
.schedule-time-section .time-picker {
    flex: 1;
}

.schedule-time-section .time-picker .time-display {
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
}

.schedule-time-section .time-picker .time-slot {
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
}

/* Horizontal cleaning details layout */
.cleaning-details-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.cleaning-type-group {
    flex: 0 0 160px;
}

.sqft-group {
    flex: 0 0 120px;
}

.notes-group {
    flex: 1;
    min-width: 200px;
}

.cleaning-type-group label,
.sqft-group label,
.notes-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 600;
    color: #333;
    font-size: 0.85rem;
}

.cleaning-type-group select,
.sqft-group input,
.notes-group textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: border-color 0.2s ease;
}

.cleaning-type-group select:focus,
.sqft-group input:focus,
.notes-group textarea:focus {
    outline: none;
    border-color: #17a2b8;
    box-shadow: 0 0 0 2px rgba(23, 162, 184, 0.1);
}

.notes-group textarea {
    resize: vertical;
    min-height: 2.5rem;
    line-height: 1.3;
}

/* Compact pricing display */
.pricing-display {
    margin-top: 0.75rem;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    overflow: hidden;
}

.pricing-header {
    background: #f8f9fa;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e1e5e9;
}

.pricing-header h4 {
    margin: 0;
    color: #495057;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pricing-details {
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
}

.pricing-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    min-width: 120px;
    flex: 0 0 auto;
}

.pricing-row.total {
    flex: 1 1 100%;
    border-top: 1px solid #e1e5e9;
    margin-top: 0.25rem;
    padding-top: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.pricing-row span:last-child {
    color: #28a745;
    font-weight: 500;
    margin-left: 0.5rem;
}

.pricing-row.total span:last-child {
    color: #17a2b8;
    font-weight: 600;
    font-size: 1rem;
}

@media (max-width: 768px) {
    .schedule-cleaning-dropdown .dropdown-content {
        left: 1rem !important;
        right: 1rem !important;
        min-width: auto;
        max-width: none;
        width: calc(100vw - 2rem);
    }
    
    .schedule-cleaning-dropdown .dropdown-content::before,
    .schedule-cleaning-dropdown .dropdown-content.above::before,
    .schedule-cleaning-dropdown .dropdown-content.below::before {
        right: 2rem;
    }
    
    /* Stack date and time sections on mobile */
    .schedule-date-time-row {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .schedule-date-section {
        min-width: auto;
        flex: none;
    }
    
    .schedule-time-section {
        flex: none;
    }
    
    /* Stack cleaning details on mobile */
    .cleaning-details-row {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .cleaning-type-group,
    .sqft-group,
    .notes-group {
        flex: none;
    }
    
    /* Compact pricing on mobile */
    .pricing-details {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .pricing-row {
        min-width: auto;
    }
    
    .dropdown-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .btn-info,
    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }
    
    .pricing-details {
        padding: 0.5rem 0.75rem;
    }
    
    .pricing-header {
        padding: 0.5rem 0.75rem;
    }
}

/* Calendar Picker Styles (from clients page) */
.calendar-picker {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.calendar-picker .calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.calendar-picker .calendar-nav-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.calendar-picker .calendar-nav-btn:hover {
    background: #e9ecef;
}

.calendar-picker .calendar-title {
    font-weight: 600;
    color: #333;
}

.calendar-picker .calendar-ui {
    padding: 0.5rem;
}

.calendar-picker .calendar-ui table {
    width: 100%;
    border-collapse: collapse;
}

.calendar-picker .calendar-ui th {
    padding: 0.5rem;
    text-align: center;
    font-weight: 600;
    color: #666;
    font-size: 0.85rem;
}

.calendar-picker .calendar-ui td {
    padding: 0.5rem;
    text-align: center;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.calendar-picker .calendar-ui td:hover:not(.past):not(.booked) {
    background: #f0f8ff;
    transform: scale(1.05);
}

.calendar-picker .calendar-day.selected {
    background: #17a2b8 !important;
    color: white !important;
    font-weight: bold;
}

.calendar-picker .calendar-day.booked {
    background: #f1f1f1;
    color: #999;
    cursor: not-allowed;
}

.calendar-picker .calendar-day.past {
    color: #ccc;
    cursor: not-allowed;
}

.calendar-picker .calendar-day.other-month {
    color: #ddd;
    cursor: default;
}

/* Time Picker Styles (from clients page) */
.time-picker {
    position: relative;
    width: 100%;
}

.time-picker .time-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.time-picker .time-display:hover {
    border-color: #17a2b8;
    box-shadow: 0 2px 8px rgba(23, 162, 184, 0.15);
}

.time-picker .time-display .time-value {
    font-weight: 500;
}

.time-picker .time-display i {
    color: #666;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.time-picker .time-display:hover i {
    color: #17a2b8;
}

.time-picker .time-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.time-picker .time-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.time-picker .time-slots {
    padding: 0.5rem 0;
}

.time-picker .time-slot {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    color: #333;
    border-bottom: 1px solid #f5f5f5;
}

.time-picker .time-slot:last-child {
    border-bottom: none;
}

.time-picker .time-slot:hover {
    background: #f0f8ff;
    color: #17a2b8;
    font-weight: 500;
}

.time-picker .time-slot:active {
    background: #e8f5e8;
}

.time-picker .time-slot.selected {
    background: #17a2b8;
    color: white;
    font-weight: 600;
}

/* Scrollbar styling for time dropdown */
.time-picker .time-dropdown::-webkit-scrollbar {
    width: 6px;
}

.time-picker .time-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.time-picker .time-dropdown::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.time-picker .time-dropdown::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .calendar-picker .calendar-ui td {
        padding: 0.4rem;
        font-size: 0.8rem;
    }
    
    .calendar-picker .calendar-ui th {
        padding: 0.4rem;
        font-size: 0.75rem;
    }
    
    .calendar-picker .calendar-header {
        padding: 0.5rem;
    }
    
    .calendar-picker .calendar-title {
        font-size: 0.9rem;
    }
    
    .time-picker .time-display {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .time-picker .time-slot {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .time-picker .time-dropdown {
        max-height: 180px;
    }
}

/* Empty State */
.empty-conversations {
    padding: 2rem;
    text-align: center;
    color: #7f8c8d;
}

.empty-conversations i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-conversations h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 500;
}

.empty-conversations p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Mobile-First iMessage-like Design */
@media screen and (max-width: 768px) {
    /* Full-screen mobile layout */
    .crm-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 50px; /* 50px for Safari toolbar */
        height: calc(100vh - 50px); /* 50px for Safari toolbar */
        width: 100vw;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        background: #f2f2f7; /* iOS background color */
        z-index: 1000;
    }
    
    /* Hide sidebar by default on mobile */
    .conversations-sidebar {
        position: absolute !important;
        top: 60px !important; /* Account for mobile nav */
        left: 0 !important;
        width: 100% !important;
        height: calc(100% - 60px - 50px) !important; /* 50px for Safari toolbar */
        background: #f2f2f7 !important;
        border: none !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s ease-in-out !important;
        z-index: 1001 !important;
        display: block !important;
    }
    
    .conversations-sidebar.show {
        transform: translateX(0) !important;
    }
    
    /* Mobile conversation list styling */
    .conversations-header {
        background: #ffffff;
        border-bottom: 1px solid #c6c6c8;
        padding: 1rem;
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    .conversations-list {
        background: #f2f2f7;
        padding: 0 0 50px 0; /* 50px bottom padding for Safari toolbar */
        max-height: none;
        min-height: calc(100vh - 294px); /* 50px toolbar + 200px for other elements */
        display: flex;
        flex-direction: column;
    }
    
    .conversation-item {
        background: #ffffff;
        margin: 0 0 1px 0;
        border-radius: 0;
        border: none;
        padding: 12px 16px;
        transition: background-color 0.1s ease;
        position: relative;
        width: 100%;
        box-sizing: border-box;
    }
    
    .conversation-item:active {
        background: #e5e5ea;
    }
    
    /* Remove active state highlighting on mobile */
    .conversation-item.active {
        background: #ffffff !important;
        color: var(--text-color) !important;
    }
    
    .conversation-item.unread.active {
        background: #ffffff !important;
    }
    
    .conversation-item.unread {
        background: #ffffff;
        border-left: 3px solid #007aff;
    }
    
    /* New conversation layout */
    .conversation-layout {
        display: flex;
        align-items: flex-start;
        gap: 12px;
        width: 100%;
    }
    
    .conversation-date-section {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-width: 60px;
        flex-shrink: 0;
    }
    
    .conversation-content-section {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 4px;
        min-width: 0;
    }
    
    /* When there's no date section, make content section take up more space */
    .conversation-layout:not(:has(.conversation-date-section)) .conversation-content-section {
        margin-left: 0;
    }
    
    .conversation-right-section {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        gap: 8px;
        width: 100px;
        flex-shrink: 0;
        text-align: right;
    }
    
    /* Group tags and time together */
    .conversation-info-group {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 4px;
    }
    
    /* Ensure unread badge flows properly in mobile layout */
    .conversation-right-section .unread-badge {
        position: static !important;
        margin: 0;
        align-self: center;
        flex-shrink: 0;
    }
    
    .conversation-tags {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 2px;
        width: 100%;
    }
    
    .conversation-tag {
        font-size: 0.7rem;
        padding: 2px 6px;
        border-radius: 8px;
        background: #e5e5ea;
        color: #000000;
        white-space: nowrap;
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        text-align: center;
        line-height: 1.2;
    }
    
    /* Allow tags to wrap to multiple lines if needed */
    .conversation-tag.long-tag {
        white-space: normal;
        word-break: break-word;
        max-width: 80px;
        font-size: 0.65rem;
        padding: 3px 4px;
    }
    
    .tag-count {
        background: #6c757d;
        color: white;
        font-size: 0.6rem;
        padding: 2px 4px;
        border-radius: 8px;
        margin-left: 2px;
        font-weight: 500;
        min-width: 16px;
        text-align: center;
        line-height: 1;
    }
    
    /* Fix unread badge positioning on mobile */
    .unread-badge {
        position: static !important;
        margin-top: 4px;
        width: 18px;
        height: 18px;
        font-size: 0.65rem;
        align-self: flex-end;
    }
    
    /* Circular date container */
    .date-circle {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        background: #f8f9fa;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        border: 1px solid #e9ecef;
    }
    
    .cleaning-date {
        font-size: 0.8rem;
        font-weight: 600;
        color: #000000;
        line-height: 1;
        margin: 0;
    }
    
    .days-until {
        font-size: 0.65rem;
        color: #8e8e93;
        line-height: 1;
        margin: 0;
        margin-top: 1px;
    }
    
    .days-until.urgent {
        color: #ff3b30;
        font-weight: 600;
    }
    
    .days-until.soon {
        color: #ff9500;
        font-weight: 500;
    }
    
    .conversation-time {
        font-size: 0.8rem;
        color: #8e8e93;
        line-height: 1.2;
    }
    
    .conversation-time-right {
        font-size: 0.75rem;
        color: #8e8e93;
        text-align: right;
    }
    
    /* Empty conversations state */
    .empty-conversations {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 40px 20px;
        color: #8e8e93;
        flex: 1;
        min-height: calc(100vh - 294px); /* 44px toolbar + 250px for other elements */
    }
    
    .empty-conversations i {
        font-size: 3rem;
        margin-bottom: 16px;
        color: #c6c6c8;
    }
    
    .empty-conversations h3 {
        font-size: 1.2rem;
        font-weight: 600;
        color: #000000;
        margin: 0 0 8px 0;
    }
    
    .empty-conversations p {
        font-size: 0.9rem;
        color: #8e8e93;
        margin: 0;
        line-height: 1.4;
    }
    
    .conversation-avatar {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        background: #007aff;
        color: white;
        font-size: 1.2rem;
    }
    
    .conversation-content {
        margin-left: 12px;
    }
    
    .conversation-name {
        font-size: 1rem;
        font-weight: 600;
        color: #000000;
        margin-bottom: 0;
        line-height: 1.2;
    }
    
    .conversation-preview {
        font-size: 0.9rem;
        color: #8e8e93;
        line-height: 1.3;
        margin-top: 0;
    }
    
    .conversation-meta {
        position: absolute;
        top: 12px;
        right: 16px;
        text-align: right;
    }
    
    .conversation-time {
        font-size: 0.8rem;
        color: #8e8e93;
        margin-bottom: 4px;
    }
    
    .conversation-badge {
        background: #ff3b30;
        color: white;
        border-radius: 10px;
        padding: 2px 6px;
        font-size: 0.7rem;
        font-weight: 600;
        min-width: 18px;
        text-align: center;
    }
    
    /* Chat container - full screen */
    .chat-container {
        position: absolute;
        top: 0; /* Start from top when mobile nav is hidden */
        left: 0;
        width: 100%;
        height: calc(100vh - 50px); /* Same height as crm-container */
        background: #f2f2f7;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
        z-index: 1002;
    }
    
    .chat-container.show {
        transform: translateX(0);
    }
    
    /* Mobile chat header */
    .chat-header {
        background: #ffffff;
        border-bottom: 1px solid #c6c6c8;
        padding: 6px 16px; /* Further reduced from 8px to 6px */
        position: sticky;
        top: 0;
        z-index: 10;
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 44px; /* Further reduced from 50px to 44px */
        box-sizing: border-box;
    }
    
    .client-info {
        display: flex;
        align-items: center;
        flex: 1;
        min-width: 0;
    }
    
    /* Mobile back button in chat header */
    .chat-header .mobile-back-btn {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: transparent;
        border: none;
        color: #007aff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        margin-right: 8px;
        transition: background-color 0.1s ease;
        flex-shrink: 0;
    }
    
    .chat-header .mobile-back-btn:active {
        background: #e5e5ea;
    }
    
    .client-basic-info {
        display: flex;
        align-items: center;
        flex: 1;
        min-width: 0;
    }
    
    .client-avatar {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: #007aff;
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 12px;
        font-size: 1rem;
    }
    
    .client-text-info h3 {
        font-size: 1rem;
        font-weight: 600;
        color: #000000;
        margin: 0 0 2px 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 200px;
    }
    
    .client-text-info span {
        font-size: 0.8rem;
        color: #8e8e93;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 200px;
    }
    
    .chat-actions {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    /* Mobile chat menu */
    .mobile-chat-menu {
        position: relative;
    }
    
    .mobile-chat-menu-btn {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: transparent;
        border: none;
        color: #007aff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        transition: background-color 0.1s ease;
    }
    
    .mobile-chat-menu-btn:active {
        background: #e5e5ea;
    }
    
    .mobile-chat-menu-content {
        position: absolute;
        top: 100%;
        right: 0;
        background: white;
        border: 1px solid #c6c6c8;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        z-index: 1000;
        margin-top: 8px;
        min-width: 160px;
        display: none;
    }
    
    .mobile-chat-menu-content.show {
        display: block;
    }
    
    .mobile-chat-menu-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        cursor: pointer;
        transition: background-color 0.1s ease;
        border-bottom: 1px solid #f2f2f7;
    }
    
    .mobile-chat-menu-item:last-child {
        border-bottom: none;
    }
    
    .mobile-chat-menu-item:active {
        background: #f2f2f7;
    }
    
    .mobile-chat-menu-item i {
        width: 20px;
        color: #007aff;
    }
    
    .mobile-chat-menu-item span {
        font-size: 0.9rem;
        color: #000000;
    }
    
    /* Hide individual dropdown buttons on mobile */
    .chat-header-notes,
    .conversation-tags-dropdown,
    .schedule-cleaning-dropdown,
    .pipeline-dropdown,
    .delete-client-dropdown,
    .create-contact-dropdown {
        display: none !important;
    }
    
    /* Hide mobile nav when chat is visible */
    .chat-container.show ~ .mobile-nav {
        display: none !important;
    }
    
    /* Alternative approach - hide mobile nav when chat is active */
    body:has(.chat-container.show) .mobile-nav {
        display: none !important;
    }
    
    /* Adjust conversations sidebar when mobile nav is hidden */
    body:has(.chat-container.show) .conversations-sidebar {
        top: 0 !important;
        height: calc(100% - 50px) !important; /* 50px for Safari toolbar */
    }
    
    /* Override all mobile nav spacing when chat is shown */
    body:has(.chat-container.show) .chat-container {
        top: 0 !important;
        height: 100% !important;
    }
    
    /* Override safe area spacing when chat is shown */
    body:has(.chat-container.show) .conversations-sidebar {
        top: 0 !important;
        height: calc(100% - 50px) !important; /* 50px for Safari toolbar */
    }
    
    /* Override body.mobile-view rules when chat is shown */
    body:has(.chat-container.show).mobile-view .conversations-sidebar {
        top: 0 !important;
        height: calc(100% - 50px) !important; /* 50px for Safari toolbar */
    }
    
    body:has(.chat-container.show).mobile-view .chat-container {
        top: 0 !important;
        height: 100% !important;
    }
    
    /* Override all possible spacing rules when chat is shown */
    body:has(.chat-container.show) .chat-container {
        top: 0 !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important; /* Make chat container background white */
    }
    
    /* Ensure messages container uses full available space */
    body:has(.chat-container.show) .messages-container {
        height: calc(100% - 120px) !important; /* Account for header and input */
        max-height: none !important;
        background: #ffffff !important; /* Make background white */
        flex: 1 !important; /* Ensure it takes available space */
        overflow-y: auto !important; /* Enable scrolling */
    }
    
    /* Ensure message input container is properly positioned */
    body:has(.chat-container.show) .message-input-container {
        position: relative !important;
        bottom: auto !important;
        flex-shrink: 0 !important;
        margin-top: auto !important;
    }
    
    /* Ensure message bubbles have proper backgrounds */
    body:has(.chat-container.show) .message-bubble.outbound .message-content {
        background: #007aff !important; /* Blue for sent messages */
        color: white !important;
    }
    
    body:has(.chat-container.show) .message-bubble.inbound .message-content {
        background: #e5e5ea !important; /* Light grey for received messages */
        color: #000000 !important;
    }
    
    /* Hide message status indicators */
    body:has(.chat-container.show) .message-status-indicator {
        display: none !important;
    }
    
    /* Reduce spacing in chat header for mobile */
    body:has(.chat-container.show) .client-info-row {
        margin-bottom: 0.25rem !important; /* Reduce from 0.5rem */
        gap: 0.25rem !important; /* Reduce gap */
    }
    
    body:has(.chat-container.show) .client-details h3 {
        margin: 0 !important;
        font-size: 0.9rem !important;
    }
    
    body:has(.chat-container.show) .client-details span {
        font-size: 0.75rem !important;
    }
    
    /* Force override chat header padding with maximum specificity */
    body:has(.chat-container.show) .chat-header {
        padding: 4px 16px !important; /* Even more reduced padding */
        min-height: 40px !important; /* Even smaller height */
    }
    
    /* Override any other padding rules */
    .chat-container.show .chat-header {
        padding: 4px 16px !important;
        min-height: 40px !important;
    }
    
    .btn-icon {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: transparent;
        border: none;
        color: #007aff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        transition: background-color 0.1s ease;
    }
    
    .btn-icon:active {
        background: #e5e5ea;
    }
    
    /* Messages area */
    .messages-container {
        flex: 1;
        padding: 16px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        background: #ffffff; /* Changed from #f2f2f7 to white */
        min-height: 0;
        max-height: calc(100vh - 200px); /* Ensure it doesn't overlap with input */
    }
    
    .messages-list {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 0;
    }
    
    /* iMessage-style message bubbles */
    .message {
        max-width: 85%;
        margin-bottom: 8px;
        display: flex;
        flex-direction: column;
        position: relative;
    }
    
    .message.sent {
        align-self: flex-end;
        align-items: flex-end;
    }
    
    .message.received {
        align-self: flex-start;
        align-items: flex-start;
    }
    
    .message-bubble {
        /* Remove conflicting styles - let .message-content handle the styling */
        position: relative;
        max-width: 100%;
        min-width: 80px;
        touch-action: manipulation;
    }
    
    /* Remove conflicting background styles - let .message-content handle styling */
    
    /* Message tail effects removed to prevent conflicts */
    
    .message-time {
        font-size: 0.7rem;
        color: #8e8e93;
        margin-top: 4px;
        padding: 0 4px;
    }
    
    .message-content {
        min-width: 40px;
        word-break: break-word;
    }
    
    /* Message status indicators */
    .message-status {
        display: flex;
        align-items: center;
        gap: 2px;
        margin-top: 2px;
        font-size: 0.6rem;
        color: #8e8e93;
    }
    
    .message-status.sent {
        justify-content: flex-end;
    }
    
    .message-status.received {
        justify-content: flex-start;
    }
    
    .status-icon {
        width: 12px;
        height: 12px;
    }
    
    /* Message grouping */
    .message-group {
        margin-bottom: 16px;
    }
    
    .message-group .message:not(:last-child) {
        margin-bottom: 2px;
    }
    
    .message-group .message:last-child {
        margin-bottom: 8px;
    }
    
    /* Typing indicator */
    .typing-indicator {
        display: flex;
        align-items: center;
        padding: 12px 16px;
        background: #e5e5ea;
        border-radius: 18px;
        border-bottom-left-radius: 4px;
        max-width: 80px;
        margin-bottom: 8px;
    }
    
    .typing-dots {
        display: flex;
        gap: 3px;
    }
    
    .typing-dot {
        width: 6px;
        height: 6px;
        background: #8e8e93;
        border-radius: 50%;
        animation: typing 1.4s infinite ease-in-out;
    }
    
    .typing-dot:nth-child(1) { animation-delay: -0.32s; }
    .typing-dot:nth-child(2) { animation-delay: -0.16s; }
    
    @keyframes typing {
        0%, 80%, 100% {
            transform: scale(0.8);
            opacity: 0.5;
        }
        40% {
            transform: scale(1);
            opacity: 1;
        }
    }
    
    /* Message input area */
    .message-input-container {
        background: #ffffff;
        border-top: 1px solid #c6c6c8;
        padding: 12px 16px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); /* Add safe area for mobile Safari */
        position: relative; /* Changed from sticky to relative */
        z-index: 10;
        box-sizing: border-box;
        flex-shrink: 0; /* Prevent shrinking */
        margin-top: auto; /* Push to bottom of flex container */
    }
    
    .input-wrapper {
        display: flex;
        align-items: flex-end;
        gap: 8px;
        background: #f2f2f7;
        border-radius: 20px;
        padding: 8px 12px;
        min-height: 40px;
        box-sizing: border-box;
    }
    
    .message-input {
        flex: 1;
        border: none;
        background: transparent;
        font-size: 16px; /* 16px prevents iOS Safari zoom */
        line-height: 1.3;
        resize: none;
        outline: none;
        max-height: 100px;
        min-height: 24px;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    }
    
    .message-input::placeholder {
        color: #8e8e93;
    }
    
    .send-btn {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: #007aff;
        color: white;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.9rem;
        transition: all 0.1s ease;
        touch-action: manipulation;
        flex-shrink: 0;
    }
    
    .send-btn:active {
        background: #0056b3;
        transform: scale(0.95);
    }
    
    .send-btn:disabled {
        background: #c7c7cc;
        color: #8e8e93;
    }
    
    /* Hide desktop header on mobile */
    .crm-header {
        display: none;
    }
    
    /* Mobile navigation */
    .mobile-nav {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: #ffffff;
        border-bottom: 1px solid #c6c6c8;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 16px;
        z-index: 1003;
    }
    
    .mobile-nav-left {
        display: flex;
        align-items: center;
        flex: 1;
    }
    
    .mobile-nav-right {
        display: flex;
        align-items: center;
    }
    
    .mobile-nav-title {
        font-size: 1.1rem;
        font-weight: 600;
        color: #000000;
        margin: 0;
    }
    
    .mobile-nav-btn {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        background: rgba(0, 0, 0, 0.05);
        border: none;
        color: #1d1d1f;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        font-weight: 400;
        cursor: pointer;
        touch-action: manipulation;
    }

    .mobile-nav-btn:hover {
        background: rgba(0, 0, 0, 0.08);
        transform: scale(1.05);
    }

    .mobile-nav-btn:active {
        transform: scale(0.95);
        background: rgba(0, 0, 0, 0.12);
    }

    /* Special styling for the + button */
    #mobile-new-message-btn {
        background: rgba(0, 122, 255, 0.1);
        color: #007aff;
    }

    #mobile-new-message-btn:hover {
        background: rgba(0, 122, 255, 0.15);
        transform: scale(1.05);
    }

    #mobile-new-message-btn:active {
        background: rgba(0, 122, 255, 0.2);
        transform: scale(0.95);
    }
    
    /* Back button for chat view */
    .back-btn {
        margin-right: 8px;
    }
    
    /* Search styling */
    .search-box {
        position: relative;
        background: #f2f2f7;
        border-radius: 12px;
        margin-bottom: 12px;
        padding: 0 1rem;
    }
    
    .search-box i {
        position: absolute;
        left: 1rem;
        top: 50%;
        transform: translateY(-50%);
        color: #8e8e93;
        font-size: 0.9rem;
        z-index: 2;
        pointer-events: none;
    }
    
    .search-box input {
        width: 100%;
        border: none;
        background: transparent;
        font-size: 1rem;
        outline: none;
        padding: 12px 15px 12px 35px;
        box-sizing: border-box;
    }
    
    .search-box input::placeholder {
        color: #8e8e93;
    }
    
    /* Filter tabs */
    .filter-tabs {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        margin: 0;
        padding: 0 1rem 1px 1rem;
    }
    
    .filter-tab {
        background: #ffffff;
        border: 1px solid #c6c6c8;
        border-radius: 16px;
        padding: 8px 12px;
        font-size: 0.8rem;
        color: #007aff;
        white-space: nowrap;
        transition: all 0.1s ease;
        flex-shrink: 0;
        min-width: fit-content;
    }
    
    .filter-tab.active {
        background: #007aff;
        color: white;
        border-color: #007aff;
    }
    
    .filter-tab:active {
        transform: scale(0.95);
    }
    
    /* Tag filter dropdown adjustments for mobile */
    .tag-filter-dropdown {
        position: relative;
    }
    
    .tag-filter-btn {
        display: flex;
        align-items: center;
        gap: 4px;
    }
    
    .tag-filter-content {
        position: fixed !important;
        top: 120px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        background: white !important;
        border: 1px solid #c6c6c8 !important;
        border-radius: 12px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
        z-index: 1000 !important;
        padding: 16px !important;
        max-height: 200px !important;
        width: 90vw !important;
        max-width: 350px !important;
        overflow-y: auto !important;
    }
    
    .tag-filter-content.hidden {
        display: none;
    }
    
    
    /* iOS-style segmented control appearance for filter tabs */
    .filter-tabs {
        background: #f2f2f7;
        border-radius: 10px;
        padding: 4px;
        margin: 0 auto;
        gap: 2px;
        display: flex;
        justify-content: center;
        align-items: center;
        max-width: fit-content;
    }
    
    .filter-tab {
        background: transparent;
        border: none;
        border-radius: 8px;
        padding: 8px 10px;
        font-size: 0.8rem;
        font-weight: 500;
        color: #8e8e93;
        transition: all 0.2s ease;
        flex: 0 1 auto;
        text-align: center;
        min-width: 0;
        white-space: nowrap;
    }
    
    .filter-tab.active {
        background: #ffffff;
        color: #000000;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    .filter-tab:not(.active):active {
        background: rgba(255, 255, 255, 0.5);
        transform: none;
    }
    
    /* Special styling for tag filter button */
    .tag-filter-btn {
        background: transparent;
        border: none;
        border-radius: 8px;
        padding: 8px 10px;
        font-size: 0.8rem;
        font-weight: 500;
        color: #8e8e93;
        transition: all 0.2s ease;
        flex: 0 1 auto;
        text-align: center;
        min-width: 0;
        white-space: nowrap;
    }
    
    .tag-filter-btn.active {
        background: #ffffff;
        color: #000000;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    .tag-filter-btn:not(.active):active {
        background: rgba(255, 255, 255, 0.5);
        transform: none;
    }
    
    /* Hide unread filter on very small screens */
    .filter-tab[data-filter="unread"] {
        display: none;
    }
    
    /* Show unread filter on larger mobile screens */
    @media (min-width: 400px) {
        .filter-tab[data-filter="unread"] {
            display: flex;
        }
    }
    
    /* Adjust filter layout for different screen sizes */
    @media (max-width: 360px) {
        .filter-tabs {
            margin: 0 auto;
            padding: 3px;
            gap: 1px;
        }
        
        .filter-tab {
            padding: 6px 6px;
            font-size: 0.75rem;
        }
        
        .tag-filter-btn {
            padding: 6px 6px;
            font-size: 0.75rem;
        }
    }
    
    @media (min-width: 361px) and (max-width: 400px) {
        .filter-tabs {
            margin: 0 auto;
            padding: 3px;
            gap: 1px;
        }
        
        .filter-tab {
            padding: 7px 8px;
            font-size: 0.78rem;
        }
        
        .tag-filter-btn {
            padding: 7px 8px;
            font-size: 0.78rem;
        }
    }
    
    @media (min-width: 401px) and (max-width: 480px) {
        .filter-tabs {
            gap: 2px;
        }
        
        .filter-tab {
            padding: 8px 10px;
            font-size: 0.8rem;
        }
        
        .tag-filter-btn {
            padding: 8px 10px;
            font-size: 0.8rem;
        }
    }
    
    /* Dropdown adjustments for mobile */
    .dropdown-content {
        width: 90vw;
        max-width: 350px;
        right: 5vw;
        left: 5vw;
    }
    
    .btn-action {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    /* Hide desktop elements on mobile */
    /* Sidebar is handled by main.css for mobile behavior */
    
    /* Ensure main sidebar is visible on mobile when active */
    .sidebar.active {
        left: 0 !important;
        z-index: 1002 !important;
    }
    
    .mobile-menu-toggle {
        display: none;
    }
    
    /* Ensure proper touch targets */
    .conversation-item {
        min-height: 60px;
        display: flex;
        align-items: center;
    }
    
    /* Smooth scrolling for iOS */
    .conversations-list,
    .messages-container {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Prevent text selection on UI elements */
    .conversation-item,
    .btn-icon,
    .mobile-nav-btn,
    .filter-tab {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    /* iOS-style focus states and zoom prevention */
    .message-input:focus {
        outline: none;
        transform: scale(1); /* Prevent zoom */
    }
    
    /* Prevent iOS Safari zoom on input focus */
    .message-input {
        -webkit-text-size-adjust: 100%;
        -webkit-appearance: none;
        appearance: none;
        border-radius: 0;
        font-size: 16px !important; /* Force 16px to prevent zoom */
    }
    
    /* Additional zoom prevention for all inputs */
    input, textarea, select {
        font-size: 16px !important;
        -webkit-text-size-adjust: 100%;
    }
    
    /* Prevent horizontal scrolling on mobile */
    body {
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Ensure viewport doesn't cause horizontal scroll */
    .crm-container,
    .chat-container,
    .conversations-sidebar {
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    /* Safe area handling for newer iPhones */
    .mobile-nav {
        padding-top: env(safe-area-inset-top);
        height: calc(60px + env(safe-area-inset-top));
    }
    
    .conversations-sidebar {
        top: calc(60px + env(safe-area-inset-top));
        height: calc(100% - 60px - env(safe-area-inset-top) - 50px); /* 50px for Safari toolbar */
    }
    
    .chat-container {
        top: calc(60px + env(safe-area-inset-top));
        height: calc(100% - 60px - env(safe-area-inset-top));
    }
    
    /* Additional mobile Safari fixes for chat input */
    .message-input-container {
        padding-bottom: calc(16px + 50px); /* 50px for Safari toolbar */
        min-height: calc(60px + 50px); /* Ensure minimum height with toolbar space */
    }
    
    /* Ensure chat container accounts for safe areas */
    .chat-container {
        padding-bottom: 50px; /* 50px for Safari toolbar */
    }
}

/* Desktop styles - hide mobile nav */
@media (min-width: 769px) {
    .mobile-nav {
        display: none;
    }
    
    /* Hide mobile chat menu on desktop */
    .mobile-chat-menu {
        display: none !important;
    }
    
    .conversations-sidebar {
        transform: none !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        width: 350px !important;
        height: auto !important;
    }
    
    .chat-container {
        transform: none !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        width: auto !important;
        height: auto !important;
    }
    
    .crm-container {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        height: calc(100vh - 120px) !important; /* Account for smaller header */
        width: calc(100% - 240px) !important; /* Full width minus sidebar */
        margin-left: 240px !important; /* Account for sidebar width */
        margin-top: 0 !important; /* No top margin to avoid overlap */
        border-radius: 0 !important; /* No border radius */
        box-shadow: none !important; /* No shadow */
        background: white !important;
        z-index: auto !important;
    }
    
    /* Ensure main content area fills full screen on desktop */
    .main-content {
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .crm-header {
        display: flex !important;
        width: calc(100% - 240px) !important; /* Full width minus sidebar */
        margin-left: 240px !important; /* Account for sidebar width */
        position: relative !important;
        z-index: 10 !important;
        padding: 0.5rem 1rem !important; /* Reduced padding */
        min-height: 50px !important; /* Reduced height */
        justify-content: flex-end !important; /* Align buttons to the right */
    }
    
    /* Hide the header-left section (CRM Messages text) */
    .crm-header .header-left {
        display: none !important;
    }
    
    /* Hide the refresh button */
    .crm-header .refresh-btn {
        display: none !important;
    }
    
    /* Style the header actions to be more compact */
    .crm-header .header-actions {
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
    }
    
    /* Desktop conversation layout */
    .conversation-layout {
        display: flex !important;
        align-items: flex-start !important;
        gap: 12px !important;
        width: 100% !important;
    }
    
    .conversation-content-section {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 4px !important;
        min-width: 0 !important;
    }
    
    .conversation-right-section {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 8px !important;
        width: 100px !important;
        flex-shrink: 0 !important;
        text-align: right !important;
    }
    
    .conversation-info-group {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-end !important;
        gap: 4px !important;
    }
    
    .conversation-right-section .unread-badge {
        position: static !important;
        margin: 0 !important;
        align-self: center !important;
        flex-shrink: 0 !important;
    }
}

/* Additional mobile-specific styles using body class */
body.mobile-view .conversations-sidebar {
    position: absolute !important;
    top: 60px !important;
    left: 0 !important;
    width: 100% !important;
    height: calc(100% - 60px - 50px) !important; /* 50px for Safari toolbar */
    background: #f2f2f7 !important;
    border: none !important;
    transform: translateX(-100%) !important;
    transition: transform 0.3s ease-in-out !important;
    z-index: 1001 !important;
    display: block !important;
}

body.mobile-view .conversations-sidebar.show {
    transform: translateX(0) !important;
}

body.mobile-view .chat-container {
    position: absolute !important;
    top: 60px !important;
    left: 0 !important;
    width: 100% !important;
    height: calc(100% - 60px) !important;
    background: #f2f2f7 !important;
    transform: translateX(100%) !important;
    transition: transform 0.3s ease-in-out !important;
    z-index: 1002 !important;
}

body.mobile-view .chat-container.show {
    transform: translateX(0) !important;
}

@media (max-width: 480px) {
    .conversations-sidebar {
        height: 150px;
    }
    
    .conversations-list {
        max-height: 80px;
    }
    
    .filter-tabs {
        gap: 0.25rem;
    }
    
    .filter-tab {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
        gap: 0.125rem;
    }
    
    .filter-tab i {
        font-size: 0.7rem;
    }
    
    .chat-header {
        padding: 0.75rem 1rem;
    }
    
    .client-details h3 {
        font-size: 0.9rem;
    }
    
    .client-details span {
        font-size: 0.8rem;
    }
}

/* CRM Cleaning Selection Cards */
.crm-cleaning-section {
    margin-bottom: 1.5rem;
}

.section-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.75rem;
}

.crm-cleaning-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.crm-cleaning-option {
    background: white;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.crm-cleaning-option:hover {
    border-color: #17a2b8;
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.15);
    transform: translateY(-2px);
}

.crm-cleaning-option.selected {
    border-color: #17a2b8;
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(23, 162, 184, 0.3);
}

.crm-cleaning-option .icon {
    font-size: 1.4rem;
    margin-bottom: 0.25rem;
    color: #17a2b8;
    transition: color 0.3s ease;
}

.crm-cleaning-option.selected .icon {
    color: white;
}

.crm-cleaning-option h3 {
    margin: 0 0 0.15rem 0;
    font-size: 0.85rem;
    font-weight: 600;
    transition: color 0.3s ease;
}

.crm-cleaning-option .price {
    margin: 0.15rem 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #28a745;
    transition: color 0.3s ease;
}

.crm-cleaning-option.selected .price {
    color: #ffffff;
}

.crm-cleaning-option .description {
    margin: 0;
    font-size: 0.7rem;
    color: #6c757d;
    transition: color 0.3s ease;
}

.crm-cleaning-option.selected .description {
    color: rgba(255, 255, 255, 0.9);
}

/* Recurring Options */
.crm-recurring-options {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.frequency-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.frequency-option {
    background: white;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    padding: 0.6rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.frequency-option:hover {
    border-color: #17a2b8;
    box-shadow: 0 2px 8px rgba(23, 162, 184, 0.15);
}

.frequency-option.selected {
    border-color: #17a2b8;
    background: #17a2b8;
    color: white;
}

.frequency-label {
    display: block;
    font-weight: 600;
    font-size: 0.8rem;
    margin-bottom: 0.2rem;
}

.frequency-desc {
    display: block;
    font-size: 0.65rem;
    opacity: 0.8;
}

.occurrences-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.occurrences-section label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #495057;
}

.occurrences-section select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.85rem;
    background: white;
}

/* Mobile responsiveness for CRM cleaning cards */
@media (max-width: 768px) {
    .crm-cleaning-options {
        grid-template-columns: 1fr 1fr;
        gap: 0.4rem;
    }
    
    .crm-cleaning-option {
        padding: 0.6rem;
        min-height: 85px;
    }
    
    .crm-cleaning-option h3 {
        font-size: 0.75rem;
    }
    
    .crm-cleaning-option .price {
        font-size: 0.85rem;
    }
    
    .crm-cleaning-option .description {
        font-size: 0.65rem;
    }
    
    .crm-cleaning-option .icon {
        font-size: 1.2rem;
        margin-bottom: 0.2rem;
    }
    
    .frequency-options {
        grid-template-columns: 1fr 1fr;
        gap: 0.3rem;
    }
    
    .frequency-option {
        padding: 0.5rem;
    }
    
    .frequency-label {
        font-size: 0.75rem;
    }
    
    .frequency-desc {
        font-size: 0.6rem;
    }
    
    .occurrences-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .crm-cleaning-options {
        grid-template-columns: 1fr;
        gap: 0.3rem;
    }
    
    .frequency-options {
        grid-template-columns: 1fr;
    }
}

/* Quick Reply Dropdown */
.quick-reply-dropdown {
    position: relative;
    display: inline-block;
}

.quick-reply-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
    transition: all 0.2s ease;
}

.quick-reply-btn:hover {
    background: linear-gradient(135deg, #218838, #1ba085);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.quick-reply-content {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid #e1e5e9;
    width: 500px;
    max-height: 600px;
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.quick-reply-content.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.quick-reply-content::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.quick-reply-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e9ecef;
    background: linear-gradient(135deg, #28a745, #20c997);
    border-radius: 12px 12px 0 0;
}

.quick-reply-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quick-reply-header .close-dropdown {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
}

.quick-reply-header .close-dropdown:hover {
    background: rgba(255, 255, 255, 0.2);
    opacity: 1;
}

.quick-reply-templates {
    padding: 0 1.5rem 1.5rem 1.5rem;
    max-height: 450px;
    overflow-y: auto;
}

.template-category {
    margin-bottom: 1.5rem;
}

.template-category:last-child {
    margin-bottom: 0;
}

.template-category h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.85rem;
    color: #495057;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f1f3f5;
}

.template-category h4 i {
    color: #28a745;
    font-size: 0.9rem;
}

.template-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quick-reply-template {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.quick-reply-template:hover {
    background: #e8f5e9;
    border-color: #28a745;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.15);
}

.quick-reply-template:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(40, 167, 69, 0.2);
}

.template-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.template-preview {
    font-size: 0.8rem;
    color: #6c757d;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Scrollbar styling for quick reply content */
.quick-reply-content::-webkit-scrollbar {
    width: 6px;
}

.quick-reply-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.quick-reply-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.quick-reply-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.quick-reply-templates::-webkit-scrollbar {
    width: 6px;
}

.quick-reply-templates::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.quick-reply-templates::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.quick-reply-templates::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Categorized Templates Styles */
.categorized-templates {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.template-category-section {
    background: rgba(248, 249, 250, 0.5);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e9ecef;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    color: #495057;
}

.category-header i {
    font-size: 1.1rem;
    color: #6c757d;
}

.category-name {
    flex: 1;
    font-size: 0.95rem;
    letter-spacing: 0.025em;
}

.category-badge {
    background: #007bff;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    min-width: 1.5rem;
    text-align: center;
}

.category-templates {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.quick-reply-template {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.quick-reply-template:hover {
    background: #f8f9ff;
    border-color: #007bff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

.quick-reply-template:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.2);
}

.template-type-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.template-type-badge.builtin {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.template-type-badge.builtin-modified {
    background: #fff3e0;
    color: #f57c00;
    border: 1px solid #ffcc02;
}

.template-type-badge.custom {
    background: #e8f5e9;
    color: #388e3c;
    border: 1px solid #c8e6c9;
}

.template-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #212529;
    margin-bottom: 0.5rem;
    padding-right: 4rem; /* Space for badge */
}

.template-preview {
    font-size: 0.85rem;
    color: #6c757d;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Quick Reply Header Actions */
.quick-reply-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-template-manage {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    font-size: 0.85rem;
}

.btn-template-manage:hover {
    background: rgba(255, 255, 255, 0.3);
    opacity: 1;
    transform: scale(1.1);
}

/* Template Management Modal */
.template-management-modal {
    max-width: 1200px;
    width: 95vw;
    height: 85vh;
    max-height: 800px;
    margin: 2% auto;
    background: white;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.template-management-modal .modal-body {
    padding: 0;
    height: calc(100% - 60px);
    overflow: hidden;
}

.template-management-container {
    display: flex;
    height: 100%;
    background: #f8f9fa;
    overflow: hidden;
}

/* Template Management Sidebar */
.template-management-sidebar {
    width: 350px;
    background: white;
    border-right: 1px solid #e1e5e9;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.template-categories-header,
.template-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.template-categories-header h3,
.template-list-header h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.template-list-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-add-category,
.btn-add-template,
.btn-restore-templates {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: #28a745;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.btn-restore-templates {
    background: #17a2b8;
}

.btn-add-category:hover,
.btn-add-template:hover {
    background: #218838;
    transform: scale(1.1);
}

.btn-restore-templates:hover {
    background: #138496;
    transform: scale(1.1);
}

.template-categories-list {
    flex: 0 0 200px;
    overflow-y: auto;
    padding: 0.5rem 0;
    max-height: 200px;
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

.template-list-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-top: 1px solid #e9ecef;
    min-height: 0; /* Allow flex shrinking */
}

.templates-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
    max-height: calc(100vh - 450px);
    min-height: 300px;
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

/* Category and Template Items */
.category-item,
.template-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f1f3f5;
    position: relative;
}

.category-item:hover,
.template-item:hover {
    background: #f8f9fa;
}

.category-item.active,
.template-item.active {
    background: #e8f5e9;
    border-left: 3px solid #28a745;
}

.category-item h4,
.template-item h4 {
    margin: 0 0 0.25rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
}

.category-item .category-count {
    font-size: 0.8rem;
    color: #6c757d;
}

.template-item .template-preview {
    font-size: 0.8rem;
    color: #6c757d;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.template-item .template-status {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #28a745;
}

.template-item .template-status.inactive {
    background: #dc3545;
}

/* Template Editor */
.template-editor {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.template-editor-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
}

.template-editor-placeholder .placeholder-content {
    text-align: center;
    color: #7f8c8d;
}

.template-editor-placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.template-editor-placeholder h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 500;
}

.template-editor-placeholder p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.7;
}

.template-editor-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    overflow: hidden;
}

.template-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e1e5e9;
    background: #f8f9fa;
}

.template-editor-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
}

.template-editor-actions {
    display: flex;
    gap: 0.5rem;
}

.template-editor-actions .btn-secondary,
.template-editor-actions .btn-primary,
.template-editor-actions .btn-danger {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.template-editor-actions .btn-secondary {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #e9ecef;
}

.template-editor-actions .btn-secondary:hover {
    background: #e9ecef;
    color: #495057;
}

.template-editor-actions .btn-primary {
    background: #28a745;
    color: white;
}

.template-editor-actions .btn-primary:hover {
    background: #218838;
}

.template-editor-actions .btn-danger {
    background: #dc3545;
    color: white;
}

.template-editor-actions .btn-danger:hover {
    background: #c82333;
}

/* Template Form */
.template-form {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

.template-form .form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.template-form .form-group {
    flex: 1;
    margin-bottom: 1rem;
}

.template-form .form-group:last-child {
    margin-bottom: 0;
}

.template-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
    font-size: 0.9rem;
}

.template-form input,
.template-form select,
.template-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
}

.template-form input:focus,
.template-form select:focus,
.template-form textarea:focus {
    outline: none;
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

.template-form textarea {
    resize: vertical;
    min-height: 150px;
    line-height: 1.5;
}

/* Template Editor Toolbar */
.template-editor-toolbar {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px 8px 0 0;
    padding: 0.75rem;
    margin-bottom: 0;
}

.variable-shortcuts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.toolbar-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #495057;
    margin-right: 0.5rem;
}

.variable-btn {
    padding: 0.25rem 0.5rem;
    background: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #495057;
    font-weight: 500;
}

.variable-btn:hover {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

#template-content {
    border-top: none;
    border-radius: 0 0 8px 8px;
}

.template-help {
    margin-top: 0.5rem;
}

.template-help small {
    color: #6c757d;
    font-size: 0.8rem;
}

/* Template Preview Section */
.template-preview-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e9ecef;
}

.template-preview-section h4 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
}

.template-preview-content {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    color: #495057;
    min-height: 100px;
}

/* No templates message */
.no-templates {
    text-align: center;
    padding: 2rem;
    color: #7f8c8d;
    font-style: italic;
    font-size: 0.9rem;
}

.error-message {
    text-align: center;
    padding: 2rem;
    color: #dc3545;
    font-size: 0.9rem;
    background: #f8d7da;
    border-radius: 8px;
    margin: 1rem;
}

/* Modal header fix */
.template-management-modal .modal-header {
    background: #007aff;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.template-management-modal .modal-header h2 {
    margin: 0;
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
}

.template-management-modal .close-modal {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.template-management-modal .close-modal:hover {
    opacity: 1;
}

/* Enhanced Scrollbar styling */
.template-categories-list::-webkit-scrollbar,
.templates-list::-webkit-scrollbar,
.template-form::-webkit-scrollbar {
    width: 8px;
}

.template-categories-list::-webkit-scrollbar-track,
.templates-list::-webkit-scrollbar-track,
.template-form::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 4px;
    margin: 4px 0;
}

.template-categories-list::-webkit-scrollbar-thumb,
.templates-list::-webkit-scrollbar-thumb,
.template-form::-webkit-scrollbar-thumb {
    background: #007aff;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.template-categories-list::-webkit-scrollbar-thumb:hover,
.templates-list::-webkit-scrollbar-thumb:hover,
.template-form::-webkit-scrollbar-thumb:hover {
    background: #0056b3;
    transform: scaleX(1.2);
}

/* Scroll indicators */
.template-categories-list,
.templates-list {
    position: relative;
}

.template-categories-list::before,
.templates-list::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 8px;
    height: 2px;
    background: linear-gradient(to right, transparent, #007aff);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.template-categories-list:hover::before,
.templates-list:hover::before {
    opacity: 0.5;
}

.template-categories-list::after,
.templates-list::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 8px;
    height: 2px;
    background: linear-gradient(to right, transparent, #007aff);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.template-categories-list:hover::after,
.templates-list:hover::after {
    opacity: 0.5;
}

/* Mobile responsive for quick replies */
@media (max-width: 768px) {
    .quick-reply-content {
        width: 90vw;
        max-width: 350px;
        left: -150px;
    }
    
    .quick-reply-content::after {
        left: 50%;
        transform: translateX(-50%);
    }
    
    .template-category h4 {
        font-size: 0.8rem;
    }
    
    .template-title {
        font-size: 0.85rem;
    }
    
    .template-preview {
        font-size: 0.75rem;
    }
    
    /* Template Management Mobile */
    .template-management-modal {
        width: 100vw;
        height: 100vh;
        max-width: none;
        max-height: none;
        border-radius: 0;
        margin: 0;
    }
    
    .template-management-container {
        flex-direction: column;
        overflow: hidden;
    }
    
    .template-management-sidebar {
        width: 100%;
        height: 250px;
        border-right: none;
        border-bottom: 1px solid #e1e5e9;
        overflow: hidden;
    }
    
    .template-categories-list {
        flex: 0 0 100px;
        max-height: 100px;
    }
    
    .templates-list {
        max-height: calc(250px - 140px);
        min-height: 110px;
    }
    
    .template-form .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .variable-shortcuts {
        gap: 0.25rem;
    }
    
    .variable-btn {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
}

@media (max-width: 480px) {
    .quick-reply-content {
        width: calc(100vw - 2rem);
        left: -50px;
        max-width: none;
    }
}

/* Animation Classes */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

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

.message-bubble.new {
    animation: slideInRight 0.3s ease-out;
}

.message-bubble.inbound.new {
    animation: slideInLeft 0.3s ease-out;
}

.conversation-item.new {
    animation: fadeIn 0.3s ease-out;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #e9ecef;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    max-width: 100px;
    margin-bottom: 8px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #7f8c8d;
    border-radius: 50%;
    animation: typingPulse 1.5s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingPulse {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    30% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Success/Error States */
.message-success {
    color: #28a745;
}

.message-error {
    color: #dc3545;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 10001;
    animation: slideInRight 0.3s ease-out;
}

.notification.success {
    background: #28a745;
}

.notification.error {
    background: #dc3545;
}

.notification.info {
    background: #007aff;
}

/* Chat Header Tags */
.chat-header-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.5rem;
    max-width: 100%;
}

/* Chat Header Layout */
.client-info-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
    width: 100%;
    position: relative;
    overflow: visible;
}

.client-basic-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.5rem 2rem 0.5rem 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
    width: fit-content;
    max-width: 100%;
}

.client-text-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.client-basic-info:hover {
    background: rgba(102, 126, 234, 0.05);
    transform: translateY(-1px);
}

.client-basic-info:active {
    transform: translateY(0);
}

.client-basic-info h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.2;
}

.client-basic-info span {
    font-size: 0.9rem;
    color: #6c757d;
    display: block;
}

/* Client Dropdown Arrow */
.client-dropdown-arrow {
    margin-left: auto;
    color: #667eea;
    font-size: 0.9rem;
    transition: transform 0.3s ease;
}

/* Client Info Dropdown */
.client-info-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: calc(100% - 2rem);
    max-width: 600px;
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    margin-top: 0.5rem;
    margin-left: 1rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    animation: slideDown 0.3s ease;
    z-index: 1000;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.client-info-dropdown-content {
    max-height: 500px;
    overflow-y: auto;
    padding: 1rem;
}

.client-info-dropdown-content::-webkit-scrollbar {
    width: 6px;
}

.client-info-dropdown-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.client-info-dropdown-content::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.client-info-dropdown-content::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.client-info-sections {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.client-info-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
}

.section-header-with-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.client-info-section h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.client-info-section h4 i {
    color: #667eea;
    font-size: 1rem;
}

.btn-add-note {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #667eea;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-add-note:hover {
    background: #5568d3;
    transform: scale(1.1);
}

.btn-add-note:active {
    transform: scale(0.95);
}

.add-note-form {
    background: white;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    border: 2px solid #667eea;
}

.add-note-form textarea {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 0.5rem;
}

.add-note-form textarea:focus {
    outline: none;
    border-color: #667eea;
}

.add-note-form .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.add-note-form .btn-secondary,
.add-note-form .btn-primary {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.add-note-form .btn-secondary {
    background: #e9ecef;
    color: #495057;
}

.add-note-form .btn-secondary:hover {
    background: #dee2e6;
}

.add-note-form .btn-primary {
    background: #667eea;
    color: white;
}

.add-note-form .btn-primary:hover {
    background: #5568d3;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.info-item.full-width {
    grid-column: 1 / -1;
}

.info-item.editable {
    cursor: pointer;
}

.info-item.editable:hover {
    background: rgba(102, 126, 234, 0.05);
}

.info-label {
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 0.9rem;
    color: #2c3e50;
    font-weight: 500;
}

.info-edit-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-edit-form input {
    flex: 1;
    padding: 0.5rem;
    border: 2px solid #667eea;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
}

.info-edit-form input:focus {
    outline: none;
    border-color: #5568d3;
}

.info-edit-actions {
    display: flex;
    gap: 0.25rem;
}

.btn-icon-small.btn-save:hover {
    background: #28a745;
    color: white;
}

/* Tags Container */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tags-container .tag {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.75rem;
    background: #667eea;
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Quote List */
.quote-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.quote-item {
    background: white;
    border-radius: 8px;
    padding: 0.875rem;
    border-left: 3px solid #f59e0b;
}

.quote-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.quote-service-type {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
}

.quote-price {
    font-size: 1rem;
    font-weight: 700;
    color: #f59e0b;
}

.quote-details {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.quote-date,
.quote-sqft {
    font-size: 0.85rem;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.quote-date i,
.quote-sqft i {
    color: #f59e0b;
    font-size: 0.8rem;
}

.quote-special-requests {
    font-size: 0.85rem;
    color: #6c757d;
    background: #fff3cd;
    padding: 0.5rem;
    border-radius: 6px;
    margin-top: 0.5rem;
    line-height: 1.4;
}

.quote-special-requests strong {
    color: #856404;
    display: block;
    margin-bottom: 0.25rem;
}

/* Cleanings List */
.cleanings-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cleaning-item {
    background: white;
    border-radius: 8px;
    padding: 0.875rem;
    border-left: 3px solid #667eea;
    transition: all 0.2s ease;
}

.cleaning-item.upcoming {
    border-left-color: #667eea;
}

.cleaning-item.past {
    border-left-color: #95a5a6;
    opacity: 0.85;
}

.cleaning-main {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.cleaning-date,
.cleaning-time {
    font-size: 0.85rem;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.cleaning-date i,
.cleaning-time i {
    color: #667eea;
    font-size: 0.8rem;
}

.cleaning-days-until {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    margin-left: auto;
}

.cleaning-details {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.cleaning-type {
    font-size: 0.85rem;
    font-weight: 600;
    color: #2c3e50;
}

.cleaning-status {
    padding: 0.25rem 0.65rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-scheduled {
    background: #e3f2fd;
    color: #1976d2;
}

.status-completed {
    background: #e8f5e9;
    color: #388e3c;
}

.status-cancelled {
    background: #ffebee;
    color: #d32f2f;
}

/* Notes List */
.notes-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.note-item {
    background: white;
    border-radius: 8px;
    padding: 0.875rem;
    border-left: 3px solid #ffa726;
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.note-date {
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 500;
}

.note-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

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

.btn-icon-small {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 4px;
    background: #e9ecef;
    color: #495057;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.btn-icon-small:hover {
    background: #667eea;
    color: white;
}

.btn-icon-small.btn-delete:hover {
    background: #dc3545;
    color: white;
}

.note-content {
    font-size: 0.9rem;
    color: #2c3e50;
    line-height: 1.5;
}

.note-edit-form {
    margin-top: 0.5rem;
}

.note-edit-form textarea {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 0.5rem;
}

.note-edit-form textarea:focus {
    outline: none;
    border-color: #667eea;
}

.note-edit-form .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.note-edit-form .btn-secondary,
.note-edit-form .btn-primary {
    padding: 0.4rem 0.875rem;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.note-edit-form .btn-secondary {
    background: #e9ecef;
    color: #495057;
}

.note-edit-form .btn-secondary:hover {
    background: #dee2e6;
}

.note-edit-form .btn-primary {
    background: #667eea;
    color: white;
}

.note-edit-form .btn-primary:hover {
    background: #5568d3;
}

/* No Data Message */
.no-data-message {
    text-align: center;
    padding: 1.5rem;
    color: #95a5a6;
    font-size: 0.9rem;
    font-style: italic;
}

/* Dropdown Footer */
.client-info-dropdown-footer {
    padding: 0.875rem 1rem;
    background: #f8f9fa;
    border-top: 1px solid #e1e5e9;
    display: flex;
    justify-content: center;
}

.btn-view-full-profile {
    padding: 0.625rem 1.25rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-view-full-profile:hover {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-view-full-profile:active {
    transform: translateY(0);
}

/* Chat Header Cleaning Info */
.chat-header-cleaning {
    margin-top: 0.5rem;
}

.chat-header-cleaning-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.75rem;
    color: #495057;
    border: 1px solid #e9ecef;
    max-width: fit-content;
}

/* Chat Header Notes Dropdown */
.chat-header-notes {
    margin-top: 0;
}

.chat-header-notes-dropdown {
    position: relative;
    display: inline-block;
}

.btn-notes-toggle {
    background: #f8f9fa;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    color: #7f8c8d;
    padding: 8px;
}

.btn-notes-toggle:hover {
    background: #e9ecef;
    color: #495057;
    transform: scale(1.05);
}

.btn-notes-toggle i {
    font-size: 1rem;
}

.notes-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #007bff;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    border: 2px solid white;
}

.notes-dropdown-content {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 300px;
    max-width: 400px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    margin-top: 0.5rem;
}

.notes-dropdown-content.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notes-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    border-radius: 8px 8px 0 0;
}

.notes-dropdown-header h4 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.notes-dropdown-header h4 i {
    color: #6c757d;
}

.btn-add-note-dropdown {
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-add-note-dropdown:hover {
    background: #0056b3;
    transform: scale(1.05);
}

.notes-dropdown-list {
    max-height: 250px;
    overflow-y: auto;
}

.note-dropdown-item {
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
}

.note-dropdown-item:last-child {
    border-bottom: none;
}

.note-dropdown-item:hover {
    background: #f8f9fa;
}

.note-dropdown-content {
    padding: 0.75rem;
}

.note-dropdown-content p {
    margin: 0 0 0.5rem 0;
    font-size: 0.8rem;
    line-height: 1.4;
    color: #495057;
}

.note-dropdown-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #6c757d;
}

.note-dropdown-date {
    font-style: italic;
}

.note-dropdown-actions {
    display: flex;
    gap: 0.25rem;
}

.btn-edit-note-dropdown,
.btn-delete-note-dropdown {
    background: none;
    border: none;
    padding: 0.125rem;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.7rem;
}

.btn-edit-note-dropdown {
    color: #007bff;
}

.btn-edit-note-dropdown:hover {
    background: rgba(0, 123, 255, 0.1);
    transform: scale(1.1);
}

.btn-delete-note-dropdown {
    color: #dc3545;
}

.btn-delete-note-dropdown:hover {
    background: rgba(220, 53, 69, 0.1);
    transform: scale(1.1);
}

.no-notes-dropdown {
    padding: 1rem;
    text-align: center;
    color: #6c757d;
    font-size: 0.8rem;
    font-style: italic;
}

/* Add Note Input Section */
.add-note-input-section {
    border-bottom: 1px solid #e9ecef;
    padding: 1rem;
}

.add-note-input-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

#inline-note-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#inline-note-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.add-note-input-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.btn-cancel-note,
.btn-save-note {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-cancel-note {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-cancel-note:hover {
    background: #cbd5e0;
}

.btn-save-note {
    background: #667eea;
    color: white;
}

.btn-save-note:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

/* Note Edit Section */
.note-dropdown-edit {
    border-top: 1px solid #e9ecef;
    padding: 1rem;
}

.note-edit-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.note-edit-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.note-edit-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.note-edit-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.btn-cancel-edit,
.btn-save-edit {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-cancel-edit {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-cancel-edit:hover {
    background: #cbd5e0;
}

.btn-save-edit {
    background: #667eea;
    color: white;
}

.btn-save-edit:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

/* Base Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: modalSlideIn 0.3s ease-out;
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Note Modals */
.add-note-modal-modern,
.edit-note-modal-modern {
    max-width: 600px;
}

.delete-note-modal-modern {
    max-width: 500px;
}

/* Delete Note Modal Specific Styles */
.delete-header {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

.delete-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.delete-warning-modern {
    text-align: center;
    padding: 2rem 0;
}

.warning-icon {
    width: 80px;
    height: 80px;
    background: #f8d7da;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: #721c24;
    font-size: 2rem;
}

.delete-warning-modern h3 {
    color: #2d3748;
    margin: 0 0 0.75rem 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.delete-warning-modern p {
    color: #718096;
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.btn-danger-modern {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-danger-modern:hover {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.btn-secondary-modern {
    background: #e2e8f0;
    color: #4a5568;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-secondary-modern:hover {
    background: #cbd5e0;
    transform: translateY(-1px);
}

.note-preview {
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    margin: 1.5rem 0;
}

.note-preview-header {
    background: #edf2f7;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 1px solid #e2e8f0;
}

.note-preview-header i {
    color: #667eea;
    font-size: 1rem;
}

.note-preview-content {
    padding: 1.5rem;
}

.note-preview-content p {
    margin: 0 0 1rem 0;
    color: #2d3748;
    font-size: 0.95rem;
    line-height: 1.4;
}

.note-preview-content .note-date {
    color: #718096;
    font-size: 0.85rem;
    font-style: italic;
}

.chat-header-cleaning-info i {
    color: #3498db;
    font-size: 0.8rem;
}

.chat-header-cleaning-info .cleaning-type {
    background: #e9ecef;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.7rem;
    text-transform: capitalize;
    font-weight: 500;
}

.chat-header-cleaning-info .cleaning-date {
    font-weight: 600;
    color: #2c3e50;
}

.chat-header-cleaning-info .cleaning-time {
    color: #495057;
    font-size: 0.7rem;
    font-weight: 500;
    background: #fff3cd;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
}

.chat-header-cleaning-info .cleaning-employees {
    color: #667eea;
    font-size: 0.7rem;
    font-weight: 500;
    background: rgba(102, 126, 234, 0.1);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
}

.chat-header-cleaning-info .cleaning-employees i {
    margin-right: 0.25rem;
    font-size: 0.65rem;
}

.chat-header-cleaning-info .days-until {
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.7rem;
    background: #d1ecf1;
    color: #0c5460;
}

.chat-header-cleaning-info.urgent .days-until {
    background: #f8d7da;
    color: #721c24;
}

.cleaning-navigation {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-right: 0.5rem;
}

.btn-nav-cleaning {
    background: transparent;
    border: 1px solid #dee2e6;
    color: #495057;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.7rem;
}

.btn-nav-cleaning:hover:not(.disabled) {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.btn-nav-cleaning:active:not(.disabled) {
    transform: scale(0.95);
}

.btn-nav-cleaning.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.cleaning-counter {
    font-size: 0.65rem;
    color: #6c757d;
    font-weight: 500;
    padding: 0 0.25rem;
    white-space: nowrap;
}

.chat-header-cleaning-info.soon .days-until {
    background: #fff3cd;
    color: #856404;
}

.chat-header-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    background: #3498db;
    color: white !important;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-header-tag.priority-high {
    background: #e74c3c;
    color: white !important;
}

.chat-header-tag.priority-medium {
    background: #f39c12;
    color: white !important;
}

.chat-header-tag.priority-low {
    background: #27ae60;
    color: white !important;
}

.chat-header-tag.custom-tag {
    background: #ffc107; /* Yellow */
    color: #2c3e50 !important;
}

.chat-header-tag.quick-tag {
    background: #3498db;
    color: white !important;
}

/* Specific tag colors for more variety */
.chat-header-tag.follow-up-needed {
    background: #e67e22; /* Orange */
    color: white !important;
}

.chat-header-tag.quote-sent {
    background: #9b59b6; /* Purple */
    color: white !important;
}

.chat-header-tag.appointment-scheduled {
    background: #28a745; /* Green */
    color: white !important;
}

.chat-header-tag.website-quote,
.chat-header-tag.quote-requested {
    background: #007bff; /* Blue */
    color: white !important;
}

.chat-header-tag.payment-pending {
    background: #f1c40f;
    color: #2c3e50 !important;
}

.chat-header-tag.service-completed {
    background: #2ecc71;
    color: white !important;
}

.chat-header-tag.issue-reported {
    background: #e74c3c;
    color: white !important;
}

.chat-header-tag.new-client {
    background: #3498db;
    color: white !important;
}

.chat-header-tag.vip-client {
    background: #f39c12;
    color: white !important;
}

.chat-header-tag.recurring-service {
    background: #1abc9c;
    color: white !important;
}

.chat-header-tag.needs-callback {
    background: #e91e63;
    color: white !important;
}

.no-chat-tags {
    color: #7f8c8d;
    font-style: italic;
    font-size: 0.7rem;
    display: none; /* Hidden by default, only show when explicitly needed */
}

/* Upcoming Cleaning Info */
.upcoming-cleaning-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.75rem;
    color: #495057;
    position: relative;
}

/* Cleaning Actions */
.cleaning-actions {
    display: flex;
    gap: 0.25rem;
    margin-left: auto;
}

.btn-edit-cleaning,
.btn-delete-cleaning {
    background: none;
    border: none;
    padding: 0.25rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

.btn-edit-cleaning {
    color: #007aff;
}

.btn-edit-cleaning:hover {
    background: rgba(0, 122, 255, 0.1);
    transform: scale(1.1);
}

.btn-delete-cleaning {
    color: #dc3545;
}

.btn-delete-cleaning:hover {
    background: rgba(220, 53, 69, 0.1);
    transform: scale(1.1);
}

.upcoming-cleaning-info i {
    color: #3498db;
    font-size: 0.8rem;
}

.cleaning-date {
    font-weight: 600;
    color: #2c3e50;
}

.cleaning-type {
    background: #e9ecef;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.7rem;
    text-transform: capitalize;
}

.days-until {
    margin-left: auto;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.7rem;
    background: #d1ecf1;
    color: #0c5460;
}

.days-until.urgent {
    background: #f8d7da;
    color: #721c24;
}

.days-until.soon {
    background: #fff3cd;
    color: #856404;
}

/* Mobile Responsive for Chat Header Tags */
@media (max-width: 768px) {
    .chat-header-tags {
        max-width: 200px;
    }
    
    .chat-header-tag {
        max-width: 80px;
        font-size: 0.65rem;
        padding: 0.15rem 0.4rem;
        color: white !important;
    }
    
    .chat-header-cleaning-info {
        flex-wrap: wrap;
        gap: 0.25rem;
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
        max-width: 180px;
    }
    
    .chat-header-cleaning-info .cleaning-type {
        font-size: 0.65rem;
    }
    
    .chat-header-cleaning-info .cleaning-time {
        font-size: 0.65rem;
    }
    
    .chat-header-cleaning-info .cleaning-employees {
        font-size: 0.65rem;
    }
    
    .chat-header-cleaning-info .days-until {
        font-size: 0.65rem;
    }
    
    .cleaning-navigation {
        gap: 0.15rem;
        margin-right: 0.25rem;
    }
    
    .btn-nav-cleaning {
        padding: 0.1rem 0.25rem;
        font-size: 0.65rem;
    }
    
    .cleaning-counter {
        font-size: 0.6rem;
        padding: 0 0.15rem;
    }
    
    .upcoming-cleaning-info {
        flex-wrap: wrap;
        gap: 0.25rem;
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }
    
    .cleaning-type {
        font-size: 0.65rem;
    }
    
    .days-until {
        font-size: 0.65rem;
    }
    
    .cleaning-actions {
        margin-left: 0;
        margin-top: 0.25rem;
    }
}

/* Modern Edit Cleaning Modal Styles */
.edit-cleaning-modal-modern {
    max-width: 1200px;
    width: 95vw;
    max-height: 90vh;
    margin: 2vh auto;
    border-radius: 16px;
    background: white;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header-modern {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-title-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.modal-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.modal-title-info h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.2;
}

.modal-subtitle {
    margin: 0.25rem 0 0 0;
    font-size: 0.9rem;
    opacity: 0.9;
    line-height: 1.3;
}

.close-modal-modern {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 1.1rem;
}

.close-modal-modern:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.modal-body-modern {
    padding: 2rem;
    overflow-y: auto;
    max-height: 70vh;
}

.form-modern {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.form-grid-modern {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .form-grid-modern {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
    }
    
    .form-section:last-child {
        grid-column: 1 / -1;
    }
}

.form-section {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #374151;
}

.section-title i {
    color: #667eea;
    font-size: 1rem;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .field-row {
        grid-template-columns: 1fr 1fr;
    }
}

.input-field-modern {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-field-modern label {
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.input-field-modern input,
.input-field-modern select,
.input-field-modern textarea {
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
    background: white;
}

.input-field-modern input:focus,
.input-field-modern select:focus,
.input-field-modern textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-field-modern textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions-modern {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

.btn-primary-modern,
.btn-secondary-modern {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-primary-modern {
    background: #667eea;
    color: white;
}

.btn-primary-modern:hover {
    background: #5a67d8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary-modern {
    background: #e2e8f0;
    color: #374151;
}

.btn-secondary-modern:hover {
    background: #cbd5e0;
    transform: translateY(-1px);
}

/* Modern Delete Cleaning Modal Styles */
.delete-cleaning-modal-modern {
    max-width: 600px;
    width: 95vw;
    max-height: 90vh;
    margin: 2vh auto;
    border-radius: 16px;
    background: white;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

.delete-header {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%) !important;
}

.delete-icon {
    background: rgba(255, 255, 255, 0.2) !important;
}

.delete-warning-modern {
    text-align: center;
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.warning-icon {
    width: 80px;
    height: 80px;
    background: #fff5f5;
    border: 3px solid #fed7d7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem auto;
    color: #e53e3e;
    font-size: 2rem;
}

.delete-warning-modern h3 {
    margin: 0 0 1rem 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: #2d3748;
}

.delete-warning-modern p {
    margin: 0;
    color: #718096;
    font-size: 1rem;
    line-height: 1.5;
}

.cleaning-details-modern {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .cleaning-details-modern {
        grid-template-columns: 1fr 1fr;
    }
}

.detail-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.detail-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.detail-header {
    background: #edf2f7;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 1px solid #e2e8f0;
}

.detail-header i {
    color: #667eea;
    font-size: 1rem;
}

.detail-content {
    padding: 1.5rem;
}

.detail-content p {
    margin: 0.75rem 0;
    color: #2d3748;
    font-size: 0.95rem;
    line-height: 1.4;
}

.detail-content p:first-child {
    margin-top: 0;
}

.detail-content p:last-child {
    margin-bottom: 0;
}

.detail-content strong {
    color: #4a5568;
    font-weight: 600;
}

.btn-danger-modern {
    background: #dc3545;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-danger-modern:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.delete-cleaning-modal .delete-warning {
    text-align: center;
    padding: 1rem 0;
}

.delete-cleaning-modal .delete-warning p {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.delete-cleaning-modal .cleaning-details {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    text-align: left;
}

.delete-cleaning-modal .cleaning-details p {
    margin: 0.5rem 0;
    color: #495057;
}

.delete-cleaning-modal .warning-text {
    color: #dc3545;
    font-weight: 600;
    font-size: 0.95rem;
    margin-top: 1rem !important;
}

.delete-cleaning-modal .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #f1f3f5;
}

/* Mobile responsive for cleaning modals */
@media (max-width: 768px) {
    .edit-cleaning-modal-modern {
        max-width: 95vw;
        margin: 2.5% auto;
        max-height: 95vh;
    }
    
    .modal-header-modern {
        padding: 1.5rem;
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .modal-title-section {
        flex-direction: column;
        text-align: center;
    }
    
    .modal-body-modern {
        padding: 1rem;
    }
    
    .form-grid-modern {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .field-row {
        grid-template-columns: 1fr;
    }
    
    .form-actions-modern {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .btn-primary-modern,
    .btn-secondary-modern {
        width: 100%;
        justify-content: center;
    }
    
    .delete-cleaning-modal-modern {
        max-width: 95vw;
        margin: 2.5% auto;
        max-height: 95vh;
    }
    
    .delete-warning-modern {
        padding: 1.5rem 0;
    }
    
    .warning-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .delete-warning-modern h3 {
        font-size: 1.1rem;
    }
    
    .cleaning-details-modern {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .detail-content {
        padding: 1rem;
    }
    
    .detail-content p {
        font-size: 0.9rem;
        margin: 0.5rem 0;
    }
    
    /* Mobile responsive for chat header layout */
    .client-info-row {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    

    
    .client-basic-info {
        padding: 0.75rem 0.75rem 0.75rem 0.75rem;
        gap: 0.5rem;
    }
    
    .client-text-info h3 {
        font-size: 1rem;
    }
    
    .client-text-info span {
        font-size: 0.85rem;
    }
    
    /* Client Info Dropdown Mobile */
    .client-info-dropdown {
        width: calc(100% - 1rem);
        max-width: none;
        margin-left: 0.5rem;
        margin-right: 0.5rem;
    }
    
    .client-info-dropdown-content {
        max-height: 400px;
        padding: 0.875rem;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
        gap: 0.625rem;
    }
    
    .client-info-section {
        padding: 0.875rem;
    }
    
    .client-info-section h4 {
        font-size: 0.9rem;
    }
    
    .cleaning-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .cleaning-days-until {
        margin-left: 0;
        align-self: flex-start;
    }
    
    .quote-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .quote-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .btn-view-full-profile {
        width: 100%;
        justify-content: center;
    }
    
    /* Mobile responsive for notes dropdown */
    .chat-header-notes-dropdown {
        margin-top: 0;
    }
    
    .btn-notes-toggle {
        width: 36px;
        height: 36px;
    }
    
    .btn-notes-toggle i {
        font-size: 0.9rem;
    }
    
    .notes-count {
        width: 16px;
        height: 16px;
        font-size: 0.65rem;
    }
    
    .notes-dropdown-content {
        min-width: 280px;
        max-width: 320px;
        right: -10px;
    }
    
    .notes-dropdown-header {
        padding: 0.5rem;
    }
    
    .notes-dropdown-header h4 {
        font-size: 0.8rem;
    }
    
    .btn-add-note-dropdown {
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
    }
    
    .note-dropdown-content {
        padding: 0.5rem;
    }
    
    .note-dropdown-content p {
        font-size: 0.75rem;
    }
    
    .note-dropdown-meta {
        font-size: 0.65rem;
    }
    
    .notes-dropdown-list {
        max-height: 200px;
    }
    
    /* Mobile responsive for add note input */
    .add-note-input-section {
        padding: 0.75rem;
    }
    
    #inline-note-input {
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 70px;
    }
    
    .add-note-input-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-cancel-note,
    .btn-save-note {
        width: 100%;
        justify-content: center;
        padding: 0.75rem;
    }
    
    /* Mobile responsive for note edit */
    .note-dropdown-edit {
        padding: 0.75rem;
    }
    
    .note-edit-input {
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 70px;
    }
    
    .note-edit-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-cancel-edit,
    .btn-save-edit {
        width: 100%;
        justify-content: center;
        padding: 0.75rem;
    }
    
    /* Mobile responsive for delete note modal */
    .delete-note-modal-modern {
        max-width: 95vw;
        margin: 1rem;
    }
    
    .delete-warning-modern {
        padding: 1.5rem 0;
    }
    
    .warning-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .note-preview {
        margin: 1rem 0;
    }
    
    .note-preview-content {
        padding: 1rem;
    }
}

/* Pipeline Help Text Styling */
.pipeline-help-text {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    margin-top: 0.5rem;
}

.pipeline-help-text small {
    color: #6c757d;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.pipeline-help-text i {
    color: #007aff;
}

/* Quote Request Details Styling */
.quote-request-details {
    margin-top: 0.75rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.quote-request-details.confirmed {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 2px solid #28a745;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.2);
}

.quote-request-header {
    background: linear-gradient(135deg, #007aff 0%, #0056b3 100%);
    color: white;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quote-request-header.confirmed {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
}

.confirmed-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: auto;
}

.quote-request-header i {
    font-size: 1rem;
}

.quote-request-content {
    padding: 1rem;
}

.quote-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e9ecef;
}

.quote-detail-row:last-child {
    border-bottom: none;
}

.quote-label {
    font-weight: 600;
    color: #495057;
    font-size: 0.85rem;
}

.quote-value {
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.85rem;
    text-align: right;
    max-width: 60%;
    word-wrap: break-word;
}

.quote-value.consent-yes {
    color: #28a745;
    font-weight: 700;
}

.quote-value.consent-no {
    color: #dc3545;
    font-weight: 700;
}

.confirmed-value {
    color: #28a745 !important;
    font-weight: 700 !important;
}

.pending-value {
    color: #dc3545 !important;
    font-weight: 700 !important;
}

/* Mobile responsive for quote request details */
@media (max-width: 768px) {
    .quote-request-details {
        margin-top: 0.5rem;
        border-radius: 8px;
    }
    
    .quote-request-header {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .quote-request-content {
        padding: 0.75rem;
    }
    
    .quote-detail-row {
        padding: 0.375rem 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .quote-label {
        font-size: 0.8rem;
    }
    
    .quote-value {
        font-size: 0.8rem;
        text-align: left;
        max-width: 100%;
    }
}

/* Mobile responsive for attachments */
@media (max-width: 768px) {
    .attachments-preview {
        padding: 0.5rem;
    }
    
    .attachment-item {
        padding: 0.75rem;
    }
    
    .attachment-name {
        max-width: 150px;
        font-size: 0.8rem;
    }
    
    .attachment-icon {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
    
    .btn-remove-attachment {
        width: 28px;
        height: 28px;
    }
    
    /* Mobile responsive for message attachments */
    .message-attachment {
        padding: 0.75rem;
        gap: 0.5rem;
    }
    
    .message-attachment .attachment-name {
        max-width: 120px;
        font-size: 0.75rem;
    }
    
    .message-attachment .attachment-icon {
        width: 20px;
        height: 20px;
        font-size: 0.7rem;
    }
    
    .btn-view-attachment {
        width: 28px;
        height: 28px;
    }
}

/* AI Assistant Styles */
.reply-mode-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.mode-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    background: white;
    color: #6c757d;
    border: 1px solid #e1e5e9;
}

.mode-btn:hover {
    background: #f8f9fa;
    color: #2c3e50;
}

.mode-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.reply-mode-content {
    display: none;
    padding: 0 1.5rem 1.5rem 1.5rem;
}

.reply-mode-content.active {
    display: block;
}

.ai-assistant-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.ai-assistant-header h4 {
    margin: 0 0 0.5rem 0;
    color: #2c3e50;
    font-size: 1.1rem;
    font-weight: 600;
}

.ai-assistant-header p {
    margin: 0;
    color: #6c757d;
    font-size: 0.9rem;
}

.ai-assistant-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.ai-assistant-actions button {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.ai-assistant-actions .btn-secondary {
    background: #f8f9fa;
    color: #2c3e50;
    border: 1px solid #e1e5e9;
}

.ai-assistant-actions .btn-secondary:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.ai-assistant-actions .btn-primary {
    background: #667eea;
    color: white;
}

.ai-assistant-actions .btn-primary:hover {
    background: #5a6fd8;
}

.ai-assistant-actions .btn-primary.loading {
    animation: ai-pulse 1.5s ease-in-out infinite;
}

@keyframes ai-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* AI Response Modal */
.ai-response-modal {
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
}

.ai-response-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.ai-response-header {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.customer-message-preview h4 {
    margin: 0 0 0.5rem 0;
    color: #2c3e50;
    font-size: 0.9rem;
    font-weight: 600;
}

.customer-message-content {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #2c3e50;
}

/* AI Context Preview */
.ai-context-preview {
    margin-top: 1rem;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.ai-context-preview h4 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 0.9rem;
    font-weight: 600;
}

.context-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #e1e5e9;
}

.context-tab {
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: #6c757d;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.context-tab:hover {
    color: #2c3e50;
}

.context-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 600;
}

.context-content {
    min-height: 200px;
    max-height: 300px;
    overflow-y: auto;
}

.context-section {
    display: none;
}

.context-section.active {
    display: block;
}

.conversation-history {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.conversation-message {
    background: white;
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
    position: relative;
}

.conversation-message.customer {
    border-left: 3px solid #28a745;
}

.conversation-message.assistant {
    border-left: 3px solid #667eea;
}

.conversation-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    color: #6c757d;
}

.conversation-message-sender {
    font-weight: 600;
}

.conversation-message-time {
    font-size: 0.75rem;
}

.conversation-message-content {
    font-size: 0.9rem;
    line-height: 1.4;
    color: #2c3e50;
}

.client-info-display {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
}

.client-info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f8f9fa;
}

.client-info-item:last-child {
    border-bottom: none;
}

.client-info-label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

.client-info-value {
    color: #6c757d;
    font-size: 0.9rem;
}

.business-context-display {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
}

.business-context-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f8f9fa;
    font-size: 0.9rem;
    color: #2c3e50;
}

.business-context-item:last-child {
    border-bottom: none;
}

.context-toggle {
    margin-top: 1rem;
    text-align: center;
}

.context-toggle button {
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    color: #2c3e50;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.context-toggle button:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.context-toggle button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.ai-response-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ai-response-option {
    background: white;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.ai-response-option:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.ai-response-option.selected {
    border-color: #667eea;
    background: #f8f9ff;
}

.ai-response-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.ai-response-option-title {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

.ai-response-option-type {
    background: #667eea;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.ai-response-option-content {
    color: #2c3e50;
    line-height: 1.5;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.ai-response-option-hint {
    color: #6c757d;
    font-size: 0.8rem;
    font-style: italic;
    text-align: center;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.ai-response-option-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.ai-response-option-actions button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.ai-edit-btn {
    background: #f8f9fa;
    color: #2c3e50;
    border: 1px solid #e1e5e9;
}

.ai-edit-btn:hover {
    background: #e9ecef;
}

.ai-use-btn {
    background: #667eea;
    color: white;
}

.ai-use-btn:hover {
    background: #5a6fd8;
}

.ai-response-editor {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

.ai-response-editor h4 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 0.9rem;
    font-weight: 600;
}

#ai-response-textarea {
    width: 100%;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    padding: 0.75rem;
    font-size: 0.95rem;
    line-height: 1.5;
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

#ai-response-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ai-response-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    justify-content: flex-end;
}

.ai-response-footer-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    align-items: center;
}

.ai-loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #667eea;
}

.ai-loading-state i {
    font-size: 1.5rem;
    margin-right: 0.75rem;
    animation: spin 1s linear infinite;
}

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

.ai-error-state {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.ai-error-state i {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* Mobile AI Response Modal */
@media (max-width: 768px) {
    .ai-response-modal {
        width: 95%;
        max-height: 90vh;
    }
    
    .ai-response-option-actions {
        flex-direction: column;
    }
    
    .ai-response-option-actions button {
        width: 100%;
    }
    
    .ai-response-actions {
        flex-direction: column;
    }
    
    .ai-response-actions button {
        width: 100%;
    }
    
    .ai-response-footer-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .ai-response-footer-actions button {
        width: 100%;
    }
}

/* ============================================
   CUSTOMER MANAGEMENT MODAL
   ============================================ */

.customer-management-modal-content {
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.customer-management-placeholder {
    padding: 3rem 2rem;
    text-align: center;
}

.customer-management-placeholder .placeholder-content i {
    font-size: 3rem;
    color: #9ca3af;
    margin-bottom: 1rem;
}

.customer-management-placeholder .placeholder-content h3 {
    color: #2d3748;
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
}

.customer-management-placeholder .placeholder-content p {
    color: #718096;
    margin: 0;
}

.customer-management-content {
    padding: 0;
}

.customer-header-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f8f9fa;
}

.customer-avatar-large {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.customer-basic-details h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.25rem;
    color: #2d3748;
    font-weight: 600;
}

.customer-basic-details p {
    margin: 0;
    color: #718096;
    font-size: 0.9rem;
}

.cleaning-history-section,
.notes-section {
    padding: 1.5rem;
}

.cleaning-history-section {
    border-bottom: 1px solid #e5e7eb;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title i {
    color: #3b82f6;
}

.cleaning-list-container {
    max-height: 400px;
    overflow-y: auto;
}

.cleaning-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cleaning-item.past {
    padding: 1rem;
    border-radius: 8px;
    background: #f8f9fa;
    border-left: 3px solid #6b7280;
}

.cleaning-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.cleaning-date-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.cleaning-date,
.cleaning-time {
    font-size: 0.875rem;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cleaning-date i,
.cleaning-time i {
    color: #9ca3af;
    font-size: 0.75rem;
}

.cleaning-type-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    background: #e0e7ff;
    color: #4338ca;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cleaning-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.cleaning-status {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cleaning-status.status-completed {
    background: #d1fae5;
    color: #065f46;
}

.cleaning-status.status-scheduled {
    background: #dbeafe;
    color: #1e40af;
}

.cleaning-status.status-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.cleaning-employees {
    font-size: 0.875rem;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cleaning-employees i {
    color: #9ca3af;
}

.no-cleans {
    text-align: center;
    padding: 2rem;
    color: #9ca3af;
}

.no-cleans i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

.no-cleans p {
    margin: 0;
}

.notes-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.notes-textarea {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    color: #2d3748;
    background: #fff;
}

.notes-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.notes-textarea::placeholder {
    color: #9ca3af;
}

.notes-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Dark theme support */
.main-content[data-theme="dark"] .customer-header-info {
    background: #1f2937;
    border-bottom-color: #374151;
}

.main-content[data-theme="dark"] .customer-basic-details h3 {
    color: #f3f4f6;
}

.main-content[data-theme="dark"] .customer-basic-details p {
    color: #9ca3af;
}

.main-content[data-theme="dark"] .cleaning-history-section,
.main-content[data-theme="dark"] .notes-section {
    border-bottom-color: #374151;
}

.main-content[data-theme="dark"] .section-title {
    color: #f3f4f6;
}

.main-content[data-theme="dark"] .cleaning-item.past {
    background: #1f2937;
    border-left-color: #6b7280;
}

.main-content[data-theme="dark"] .cleaning-date,
.main-content[data-theme="dark"] .cleaning-time {
    color: #d1d5db;
}

.main-content[data-theme="dark"] .notes-textarea {
    background: #1f2937;
    border-color: #374151;
    color: #f3f4f6;
}

/* Mobile responsiveness */
@media screen and (max-width: 768px) {
    .customer-management-modal-content {
        max-width: 100%;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    .customer-header-info {
        flex-direction: column;
        text-align: center;
    }
    
    .cleaning-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .cleaning-details {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .notes-actions {
        flex-direction: column;
    }
    
    .notes-actions button {
        width: 100%;
    }
}

/* Customer Management Modal - Client List Styles */
.cm-search-container {
    position: relative;
    margin-bottom: 1.5rem;
    padding: 0 1.5rem 1.5rem 1.5rem;
}

.cm-search-icon {
    position: absolute;
    left: 1.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 1rem;
    pointer-events: none;
}

.cm-search-input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #2d3748;
    background: #fff;
    transition: all 0.2s ease;
}

.cm-search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.cm-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    color: #9ca3af;
}

.cm-loading-state i {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.cm-empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #9ca3af;
}

.cm-empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.cm-clients-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: calc(90vh - 200px);
    overflow-y: auto;
}

.cm-client-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.cm-client-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.cm-client-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    cursor: pointer;
    user-select: none;
    background: #f8f9fa;
    transition: background 0.2s ease;
}

.cm-client-header:hover {
    background: #f1f3f5;
}

.cm-client-basic {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.cm-client-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
    flex-shrink: 0;
}

.cm-client-info {
    flex: 1;
    min-width: 0;
}

.cm-client-name {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #2d3748;
}

.cm-client-phone,
.cm-client-address {
    margin: 0.125rem 0;
    font-size: 0.875rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cm-client-stats {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cm-stats-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.cm-cleanings-count {
    font-size: 0.875rem;
    font-weight: 600;
    color: #3b82f6;
    padding: 0.25rem 0.75rem;
    background: #dbeafe;
    border-radius: 12px;
    white-space: nowrap;
}

.cm-scheduled-count {
    font-size: 0.875rem;
    font-weight: 600;
    color: #10b981;
    padding: 0.25rem 0.75rem;
    background: #d1fae5;
    border-radius: 12px;
    white-space: nowrap;
}

.cm-expand-icon {
    color: #9ca3af;
    transition: transform 0.2s ease;
}

.cm-client-details {
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.cm-cleanings-section,
.cm-notes-section {
    margin-bottom: 1.5rem;
}

.cm-cleanings-section:last-child,
.cm-notes-section:last-child {
    margin-bottom: 0;
}

.cm-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 0.75rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cm-section-title i {
    color: #3b82f6;
    font-size: 0.75rem;
}

.cm-cleanings-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.cm-cleaning-item {
    padding: 0.75rem;
    border-radius: 6px;
    background: #f8f9fa;
    border-left: 3px solid #6b7280;
}

.cm-cleaning-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.cm-cleaning-date-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.cm-cleaning-date,
.cm-cleaning-time {
    font-size: 0.75rem;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cm-cleaning-date i,
.cm-cleaning-time i {
    color: #9ca3af;
    font-size: 0.625rem;
}

.cm-cleaning-type-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    background: #e0e7ff;
    color: #4338ca;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cm-cleaning-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.cm-cleaning-status {
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cm-cleaning-status.status-completed {
    background: #d1fae5;
    color: #065f46;
}

.cm-cleaning-status.status-scheduled {
    background: #dbeafe;
    color: #1e40af;
}

.cm-cleaning-status.status-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.cm-cleaning-employees {
    font-size: 0.75rem;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cm-no-cleans {
    text-align: center;
    padding: 1rem;
    color: #9ca3af;
    font-size: 0.875rem;
}

.cm-client-notes-textarea {
    width: 100%;
    min-height: 100px;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: inherit;
    resize: vertical;
    color: #2d3748;
    background: #fff;
}

.cm-client-notes-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.cm-notes-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Dark theme support for customer management */
.main-content[data-theme="dark"] .cm-client-card {
    background: #1f2937;
    border-color: #374151;
}

.main-content[data-theme="dark"] .cm-client-header {
    background: #111827;
}

.main-content[data-theme="dark"] .cm-client-header:hover {
    background: #1f2937;
}

.main-content[data-theme="dark"] .cm-client-name {
    color: #f3f4f6;
}

.main-content[data-theme="dark"] .cm-client-phone,
.main-content[data-theme="dark"] .cm-client-address {
    color: #9ca3af;
}

.main-content[data-theme="dark"] .cm-client-details {
    border-top-color: #374151;
}

.main-content[data-theme="dark"] .cm-section-title {
    color: #f3f4f6;
}

.main-content[data-theme="dark"] .cm-cleaning-item {
    background: #1f2937;
    border-left-color: #6b7280;
}

.main-content[data-theme="dark"] .cm-cleaning-date,
.main-content[data-theme="dark"] .cm-cleaning-time {
    color: #d1d5db;
}

.main-content[data-theme="dark"] .cm-client-notes-textarea {
    background: #1f2937;
    border-color: #374151;
    color: #f3f4f6;
}

.main-content[data-theme="dark"] .cm-search-input {
    background: #1f2937;
    border-color: #374151;
    color: #f3f4f6;
}

.main-content[data-theme="dark"] .cm-cleanings-count {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.main-content[data-theme="dark"] .cm-scheduled-count {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

/* Mobile responsiveness for customer management */
@media screen and (max-width: 768px) {
    .cm-client-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .cm-client-stats {
        width: 100%;
        justify-content: space-between;
    }
    
    .cm-cleaning-main {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .cm-cleaning-details {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .cm-notes-actions {
        flex-direction: column;
    }
    
    .cm-notes-actions button {
        width: 100%;
    }
}
