/**
 * Sales/CRM Tab Specific Styling for AMD Construction Pro
 * CLEANED VERSION - Removed all duplicates and conflicts
 *
 * THREE SECTION LAYOUT:
 * |---------------------------|-------------------------------|
 * |   leads list (left)       |   lead details (top right)    |
 * |   - filters               |   - action buttons            |
 * |   - leads list            |   - file upload               |
 * |---------------------------|-------------------------------|
 * |                           |   sales pipeline (bottom rt)  |
 * |                           |   - status columns            |
 * |---------------------------|-------------------------------|
 */

/* =============================
   SALES TAB SPECIFIC STYLES  
   ============================= */

/* ========================================
   MAIN LAYOUT STRUCTURE
   ======================================== */

#sales-tab {
    height: 100%;
    width: 100%;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

#sales-tab .sales-three-section-layout {
    display: grid;
    grid-template-columns: 260px 1fr 260px; /* Leads | Details/Pipeline/Analytics | Customers */
    /* Keep middle stack roomy enough for funnel columns while preserving analytics visibility */
    grid-template-rows: 1fr 210px 170px; /* Lead Details | Pipeline | Analytics */
    height: calc(100vh - 120px);
    width: 100%;
    gap: 12px;
    background: linear-gradient(120deg, #f5f7fa 0%, #e0eafc 100%);
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(44,62,80,0.06);
    padding: 12px;
    box-sizing: border-box;
}

#sales-tab .leads-section {
    grid-column: 1;
    grid-row: 1 / 4; /* Span all three conceptual rows */
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 6px rgba(44,62,80,0.04);
    overflow: hidden;
    box-sizing: border-box;
}

#sales-tab .lead-details-section {
    grid-column: 2;
    grid-row: 1; /* First row in the middle column */
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 6px rgba(44,62,80,0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden clip;
    box-sizing: border-box;
    min-height: 220px;
}

#sales-tab .sales-pipeline-section {
    grid-column: 2;
    grid-row: 2; /* Second row in the middle column */
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 6px rgba(44,62,80,0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden clip;
    box-sizing: border-box;
    min-height: 180px;
    margin-top: 0;
}

#sales-tab .sales-pipeline-content {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    overflow: hidden;
}

#sales-tab .sales-analytics-section {
    grid-column: 2;
    grid-row: 3; /* Third row in the middle column */
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 6px rgba(44,62,80,0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden; 
    box-sizing: border-box;
    min-height: 170px; /* Increased by 20px (150px + 20px) */
}

#sales-tab .customers-section {
    grid-column: 3;
    grid-row: 1 / 4; /* Span all three conceptual rows */
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 1px 5px rgba(44,62,80,0.04);
    overflow: hidden;
    box-sizing: border-box;
}

/* ========================================
   SECTION CONTENT AREAS
   ======================================== */

#sales-tab .leads-list {
    flex: 1 1 auto;
    overflow-y: auto;
    max-height: calc(100vh - 220px); /* Adjust as needed for your layout */
    padding: 0 0 0 0;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #bdc3c7 #f1f1f1;
}

/* ========================================
   HEADERS NOW HANDLED BY UNIFIED SYSTEM
   See: src/renderer/css/headers.css
   ======================================== */

/* ========================================
   BUTTON STYLING - CONSISTENT THEME
   ======================================== */

#sales-tab .btn {
    background-color: #2c5aa0;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    line-height: 1.4;
}

#sales-tab .btn:hover {
    background-color: #1e3c72;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#sales-tab .btn.primary {
    background-color: #2c5aa0;
}

#sales-tab .btn.primary:hover {
    background-color: #1e3c72;
}

#sales-tab .btn.secondary {
    background-color: #6c757d;
    color: white;
}

#sales-tab .btn.secondary:hover {
    background-color: #545b62;
}

#sales-tab .btn.success {
    background-color: #28a745;
}

#sales-tab .btn.success:hover {
    background-color: #218838;
}

#sales-tab .btn.danger {
    background-color: #dc3545;
}

#sales-tab .btn.danger:hover {
    background-color: #c82333;
}

#sales-tab .btn.small {
    padding: 6px 12px;
    font-size: 12px;
}

#sales-tab .btn.compact {
    padding: 6px 10px;
    font-size: 11px;
}

#sales-tab .btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

#sales-tab .btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* ========================================
   LEADS SECTION (LEFT COLUMN) - CONDENSED
   ======================================== */

/* Individual header customizations removed - now using unified system */

/* Lead Filters */
#sales-tab .leads-filters {
    padding: 12px 14px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#sales-tab .leads-filters input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d7dc;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

#sales-tab .leads-filters input[type="text"]:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

#sales-tab .leads-filters select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d7dc;
    border-radius: 6px;
    font-size: 14px;
    background-color: #fff;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

#sales-tab .leads-filters select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Lead List */
#sales-tab .leads-list {
    flex: 1 1 auto;
    overflow-y: auto;
    max-height: calc(100vh - 220px); /* Adjust as needed for your layout */
    padding: 0 0 0 0;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #bdc3c7 #f1f1f1;
}

/* ========================================
   LEAD DETAILS HEADERS (MATCHING PROJECTS)
   ======================================== */

#sales-tab .lead-details-layout {
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

#sales-tab .lead-header-info {
    padding: 16px 20px;
    border-bottom: 1px solid #e9ecef;
}

#sales-tab .lead-name-company .lead-name {
    display: block;
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 6px;
}

#sales-tab .lead-name-company .lead-company {
    display: block;
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 4px;
}

#sales-tab .lead-name-company .lead-project-type {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%);
    color: #2e7d32;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

#sales-tab .customer-information,
#sales-tab .salesperson-information {
    padding: 12px 20px;
    border-bottom: 1px solid #e9ecef;
}

#sales-tab .customer-information h4,
#sales-tab .salesperson-information h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#sales-tab .contact-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #f8f9fa;
}

#sales-tab .contact-item:last-child {
    border-bottom: none;
}

#sales-tab .contact-item label {
    font-weight: 500;
    color: #495057;
    min-width: 100px;
}

#sales-tab .contact-item span {
    color: #2c3e50;
    text-align: right;
}

#sales-tab .no-lead-selected {
    text-align: center;
    color: #7f8c8d;
    padding: 40px 20px;
    font-style: italic;
}

#sales-tab .lead-status-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#sales-tab .lead-status-badge.new {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: #fff;
}

#sales-tab .lead-status-badge.contacted {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: #fff;
}

#sales-tab .lead-status-badge.estimate-sent {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: #fff;
}

#sales-tab .lead-status-badge.negotiating {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: #fff;
}

#sales-tab .lead-status-badge.sold {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: #fff;
}

#sales-tab .lead-status-badge.lost {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: #fff;
}

/* ========================================
   FILE UPLOAD AREA
   ======================================== */

#sales-tab .file-upload-section {
    margin: 16px 0;
    padding: 16px;
    border: 2px dashed #bdc3c7;
    border-radius: 8px;
    background: #f8f9fa;
}

#sales-tab .file-upload-section h5 {
    margin: 0 0 12px 0;
    color: #2c3e50;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

#sales-tab .file-upload-area {
    background: #fff;
    border: 2px dashed #95a5a6;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

#sales-tab .file-upload-area:hover {
    border-color: #3498db;
    background: #f8f9fa;
}

#sales-tab .file-upload-area.dragover {
    border-color: #27ae60;
    background: #d5f4e6;
}

#sales-tab .file-upload-area i {
    font-size: 32px;
    color: #b0b8c1;
    margin-bottom: 10px;
    transition: color 0.3s ease;
}

#sales-tab .file-upload-area:hover i,
#sales-tab .file-upload-area.dragover i {
    color: #3498db;
}

#sales-tab .upload-prompt {
    color: #7f8c8d;
}

#sales-tab .upload-prompt i {
    font-size: 24px;
    color: #95a5a6;
    margin-bottom: 8px;
    display: block;
}

#sales-tab .upload-prompt p {
    margin: 8px 0;
    font-weight: 500;
}

#sales-tab .file-types {
    font-size: 12px;
    color: #95a5a6;
}

#sales-tab .uploaded-files-list {
    margin-top: 12px;
}

#sales-tab .uploaded-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    margin-bottom: 8px;
}

#sales-tab .file-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

#sales-tab .file-icon {
    color: #3498db;
}

#sales-tab .file-name {
    font-weight: 500;
    color: #2c3e50;
}

#sales-tab .file-size {
    color: #7f8c8d;
    font-size: 12px;
}

#sales-tab .file-remove {
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
}

#sales-tab .file-remove:hover {
    background: #c0392b;
}

#sales-tab .remove-file {
    color: #e74c3c;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 3px;
    transition: background 0.2s;
}

#sales-tab .uploaded-file .remove-file:hover {
    background: rgba(231, 76, 60, 0.1);
}

/* ========================================
   NEW LEAD PANEL
   ======================================== */

#sales-tab .new-lead-panel {
    padding: 18px 18px 0 18px;
    border-bottom: 1px solid #e0eafc;
    background: #f8f9fa;
}

#sales-tab .new-lead-panel h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #2c3e50;
}

#sales-tab #new-lead-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#sales-tab #new-lead-form input {
    padding: 8px;
    border: 1px solid #b0b8c1;
    border-radius: 4px;
    font-size: 14px;
}

#sales-tab #new-lead-form button {
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 0;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 6px;
    transition: background 0.2s;
}

#sales-tab #new-lead-form button:hover {
    background: #217dbb;
}

/* ========================================
   LEADS FILTERS PANEL (CONDENSED LAYOUT)
   ======================================== */

#sales-tab .leads-filters-panel {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 6px 10px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0eafc;
}

#sales-tab .leads-filters-panel .filter-row {
    display: flex;
    flex-direction: column; /* Stack filters vertically */
    flex-wrap: nowrap;
    gap: 8px;
    align-items: stretch; /* Make all filters take full width */
}

#sales-tab .leads-filters-panel .filter-row.condensed {
    gap: 6px;
}

#sales-tab .leads-filters-panel .filter-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 100%; /* Full width */
    flex: none; /* Don't grow/shrink, just take full width */
    gap: 2px;
}

#sales-tab .leads-filters-panel .filter-group.compact {
    min-width: 0;
    width: 100%; /* Full width */
    flex: none;
}

#sales-tab .leads-filters-panel .filter-group.search-group {
    min-width: 0;
    width: 100%; /* Full width */
    flex: none;
}

#sales-tab .leads-filters-panel .filter-group label {
    font-size: 11px;
    margin-bottom: 1px;
    font-weight: 500;
    color: #555;
}

#sales-tab .leads-filters-panel .filter-group select,
#sales-tab .leads-filters-panel .filter-group input {
    padding: 6px 8px;
    font-size: 12px;
    border: 1px solid #d1d7dc;
    border-radius: 4px;
    background: #fff;
    transition: border-color 0.2s ease;
    width: 100%; /* Full width */
    box-sizing: border-box; /* Include padding in width calculation */
}

#sales-tab .leads-filters-panel .filter-group select:focus,
#sales-tab .leads-filters-panel .filter-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

#sales-tab .leads-filters-panel .filter-actions {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
    width: 100%; /* Full width */
    justify-content: space-between; /* Distribute buttons evenly */
}

#sales-tab .leads-filters-panel .filter-actions.compact {
    gap: 3px;
}

#sales-tab .leads-filters-panel .btn.compact {
    padding: 6px 8px;
    font-size: 11px;
    min-width: 24px;
    border-radius: 3px;
}

#sales-tab .leads-filters-panel .advanced-filters {
    border-top: 1px solid #e0eafc;
    padding-top: 6px;
    margin-top: 2px;
}

#sales-tab .leads-filters-panel .advanced-filters .filter-group label {
    font-size: 10px;
    color: #666;
}

/* Responsive behavior for condensed filters */
@media (max-width: 1200px) {
    #sales-tab .leads-filters-panel .filter-group.compact {
        min-width: 0;
        width: 100%; /* Maintain full width */
        flex: none;
    }
    
    #sales-tab .leads-filters-panel .filter-group.search-group {
        min-width: 0;
        width: 100%; /* Maintain full width */
        flex: none;
    }
}

@media (max-width: 900px) {
    #sales-tab .leads-filters-panel .filter-row {
        flex-direction: column; /* Already set above */
        gap: 6px;
    }
    
    #sales-tab .leads-filters-panel .filter-group {
        min-width: 0;
        width: 100%;
        flex: none; /* Maintain full width */
    }
}

/* ========================================
   SALES PIPELINE STYLES
   ======================================== */

#sales-tab .pipeline-container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px;
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
    width: 100%;
}

#sales-tab .pipeline-stage {
    flex: 1;
    min-width: 160px;
    max-width: none;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    height: 100%;
}

#sales-tab .stage-header {
    padding: 6px 8px;
    background: #f8f9fa;
    color: #fff;
    border-radius: 3px 3px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 28px;
}

#sales-tab .stage-header h4 {
    margin: 0;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1;
}

#sales-tab .stage-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: bold;
    min-width: 16px;
    text-align: center;
    line-height: 1;
}

#sales-tab .stage-leads {
    flex: 1;
    padding: 6px;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

/* Enhanced scrollbar for pipeline stages */
#sales-tab .stage-leads::-webkit-scrollbar {
    width: 6px;
}

#sales-tab .stage-leads::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#sales-tab .stage-leads::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#sales-tab .stage-leads::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

#sales-tab .pipeline-lead-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 6px 8px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    font-size: 11px;
    line-height: 1.3;
}

#sales-tab .pipeline-lead-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    border-color: #3498db;
}

#sales-tab .pipeline-lead-card.selected {
    border-color: #3498db;
    background: #f8fcff;
}

#sales-tab .pipeline-lead-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 2px;
    font-size: 11px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#sales-tab .pipeline-lead-company {
    color: #6c757d;
    font-size: 10px;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#sales-tab .pipeline-lead-value {
    color: #27ae60;
    font-weight: 600;
    font-size: 10px;
}

#sales-tab .pipeline-lead-type {
    color: #8e44ad;
    font-size: 9px;
    background: #f4f0ff;
    padding: 1px 4px;
    border-radius: 8px;
    display: inline-block;
    margin-top: 2px;
    white-space: nowrap;
}

/* Status-specific pipeline stage header colors */
#sales-tab .pipeline-stage[data-status="new"] .stage-header {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: #fff;
}

#sales-tab .pipeline-stage[data-status="contacted"] .stage-header {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: #fff;
}

#sales-tab .pipeline-stage[data-status="estimate-sent"] .stage-header {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: #fff;
}

#sales-tab .pipeline-stage[data-status="negotiating"] .stage-header {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: #fff;
}

#sales-tab .pipeline-stage[data-status="sold"] .stage-header {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: #fff;
}

#sales-tab .pipeline-stage[data-status="lost"] .stage-header {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: #fff;
}

/* ========================================
   ENHANCED LEADS LIST STYLES (MATCHING PROJECTS)
   ======================================== */

#sales-tab .lead-item {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    position: relative;
    overflow: hidden;
}

#sales-tab .lead-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border-color: #3498db;
}

#sales-tab .lead-item.error-item {
    background: #fff5f5;
    border-color: #fed7d7;
    color: #e53e3e;
    cursor: default;
}

#sales-tab .lead-item.error-item:hover {
    transform: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

/* Lead Header */
#sales-tab .lead-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

#sales-tab .lead-name-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#sales-tab .lead-name {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    line-height: 1.2;
}

#sales-tab .lead-status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: capitalize;
    letter-spacing: 0.5px;
    display: inline-block;
    min-width: 60px;
    text-align: center;
}

#sales-tab .lead-status-badge.new {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: #fff;
}

#sales-tab .lead-status-badge.contacted {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: #fff;
}

#sales-tab .lead-status-badge.estimate-sent {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: #fff;
}

#sales-tab .lead-status-badge.proposal {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: #fff;
}

#sales-tab .lead-status-badge.negotiation {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: #fff;
}

#sales-tab .lead-status-badge.won {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: #fff;
}

#sales-tab .lead-status-badge.lost {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    color: #fff;
}

#sales-tab .lead-meta-section {
    display: flex;
    gap: 8px;
    align-items: center;
}

#sales-tab .lead-priority,
#sales-tab .lead-source {
    font-size: 16px;
    cursor: help;
}

/* Project Info */
#sales-tab .lead-project-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

#sales-tab .project-type-badge {
    background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%);
    color: #2e7d32;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

#sales-tab .project-value {
    font-weight: 600;
    font-size: 14px;
}

#sales-tab .project-value.has-value {
    color: #27ae60;
}

#sales-tab .project-value.no-value {
    color: #95a5a6;
    font-style: italic;
}

/* Contact Info */
#sales-tab .lead-contact-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

#sales-tab .contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #6c757d;
}

#sales-tab .contact-item i {
    width: 14px;
    color: #95a5a6;
    font-size: 12px;
}

#sales-tab .contact-item .email-text {
    color: #3498db;
    text-decoration: none;
}

#sales-tab .contact-item .email-text:hover {
    text-decoration: underline;
}

/* Lead Actions Panel - Styled Buttons */
#sales-tab .lead-actions {
    display: flex;
    gap: 4px;
    padding: 4px 8px;
    background: transparent;
    border-radius: 0;
    margin: 8px;
    border: none;
}

#sales-tab .lead-actions .btn {
    flex: 1;
    justify-content: center;
    padding: 4px 8px;
    font-size: 11px;
    min-height: 24px;
}

#sales-tab .lead-actions .upload-dropdown {
    position: relative;
    display: inline-block;
}

#sales-tab .upload-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 100;
    min-width: 120px;
    padding: 8px 0;
}

#sales-tab .upload-dropdown .btn {
    width: 100%;
    margin: 2px 0;
    border-radius: 0;
    justify-content: flex-start;
    padding: 8px 16px;
    background: transparent;
    color: #333;
    border: none;
}

#sales-tab .upload-dropdown .btn:hover {
    background: #f8f9fa;
    transform: none;
    box-shadow: none;
}

/* Ultra-Condensed Lead Item Styling */
#sales-tab .lead-item {
    padding: 8px 10px;
    margin-bottom: 6px;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 11px;
    line-height: 1.3;
}

#sales-tab .lead-item:hover {
    background: #f8f9fa;
    border-color: #3498db;
    transform: translateY(-1px);
    box-shadow: 0 1px 3px rgba(52, 152, 219, 0.1);
}

#sales-tab .lead-item.selected {
    background: #e3f2fd;
    border-color: #3498db;
    box-shadow: 0 1px 4px rgba(52, 152, 219, 0.15);
}

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

#sales-tab .lead-name-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0; /* Allow text truncation */
}

#sales-tab .lead-name {
    font-size: 12px;
    font-weight: 600;
    margin: 0;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#sales-tab .lead-status-badge {
    display: inline-block;
    padding: 1px 4px;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    margin-top: 1px;
    white-space: nowrap;
}

#sales-tab .lead-meta-section {
    display: flex;
    gap: 3px;
    align-items: center;
    font-size: 10px;
}

#sales-tab .lead-project-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    padding: 4px 6px;
    background: #f8f9fa;
    border-radius: 3px;
}

/* Enhanced Pipeline lead items with borders and styling */
#sales-tab .pipeline-lead-item {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 6px 8px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    font-size: 10px;
    line-height: 1.3;
    position: relative;
}

#sales-tab .pipeline-lead-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.12);
    border-color: #3498db;
    background: #f8fcff;
}

#sales-tab .pipeline-lead-item.selected {
    border-color: #3498db;
    background: #e3f2fd;
    box-shadow: 0 2px 5px rgba(52, 152, 219, 0.2);
}

#sales-tab .pipeline-lead-item.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

#sales-tab .pipeline-lead-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 3px;
    font-size: 11px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

#sales-tab .pipeline-lead-value {
    color: #27ae60;
    font-weight: 500;
    font-size: 10px;
    display: block;
    margin-top: 2px;
}

/* Add subtle status indicator on pipeline cards */
#sales-tab .pipeline-stage[data-status="new"] .pipeline-lead-item {
    border-left: 3px solid #3498db;
}

#sales-tab .pipeline-stage[data-status="contacted"] .pipeline-lead-item {
    border-left: 3px solid #f39c12;
}

#sales-tab .pipeline-stage[data-status="estimate-sent"] .pipeline-lead-item {
    border-left: 3px solid #9b59b6;
}

#sales-tab .pipeline-stage[data-status="negotiating"] .pipeline-lead-item {
    border-left: 3px solid #2ecc71;
}

#sales-tab .pipeline-stage[data-status="sold"] .pipeline-lead-item {
    border-left: 3px solid #27ae60;
}

#sales-tab .pipeline-stage[data-status="lost"] .pipeline-lead-item {
    border-left: 3px solid #e74c3c;
}

/* Drag over effect for pipeline stages */
#sales-tab .pipeline-stage.drag-over {
    background: #e3f2fd;
    border-color: #3498db;
}

/* ========================================
   SALES ANALYTICS - SCALED CONTENT
   ======================================== */

#sales-tab .sales-analytics-content.split-layout {
    display: flex;
    flex: 1;
    gap: 10px;
    padding: 10px;
    overflow: hidden;
}

#sales-tab .analytics-left {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#sales-tab .analytics-right {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#sales-tab .analytics-chart-container {
    flex: 1;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    overflow: hidden;
}

#sales-tab .chart-placeholder {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 14px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

#sales-tab .sales-targets-container {
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    padding: 10px;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#sales-tab .sales-targets-container h4 {
    margin: 0 0 8px 0;
    font-size: 12px;
    color: #2c3e50;
    font-weight: 600;
}

#sales-tab .targets-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

#sales-tab .targets-content .metric-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid #e9ecef;
    font-size: 11px;
}

#sales-tab .targets-content .metric-item:last-child {
    border-bottom: none;
    margin-bottom: 8px;
}

#sales-tab .targets-content .metric-label {
    color: #6c757d;
    font-weight: 500;
}

#sales-tab .targets-content .metric-value {
    color: #2c3e50;
    font-weight: 600;
}

#sales-tab .progress-bar {
    width: 100%;
    height: 16px;
    background: #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 6px;
}

#sales-tab .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #27ae60 0%, #2ecc71 100%);
    border-radius: 10px;
    transition: width 0.3s ease;
}

/* Lead Details Split Layout */
#sales-tab .details-split-layout {
    display: flex;
    gap: 12px;
    flex: 1;
    padding: 12px;
    overflow: hidden;
    min-height: 0;
}

#sales-tab .lead-details-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

#sales-tab .lead-header-info {
    width: 100%; /* Full width */
    margin-bottom: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    flex-shrink: 0; /* Don't shrink */
}

#sales-tab .details-split-layout {
    display: flex;
    flex: 1 1 auto; /* Take remaining space above buttons */
    gap: 12px;
    padding: 0 12px; /* Only horizontal padding */
    overflow: hidden; /* Prevent overflow */
    min-height: 0; /* Allow shrinking */
    align-items: flex-start; /* Align items to top */
}

#sales-tab .lead-info-left {
    flex: 1;
    min-height: 0; /* Allow shrinking */
    display: flex;
    flex-direction: column;
}

#sales-tab .sales-manager-right {
    flex: 1;
    min-height: 0; /* Allow shrinking */
    display: flex;
    flex-direction: column;
}

#sales-tab .lead-header-info {
    margin-bottom: 10px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 3px;
    border-left: 3px solid #3498db;
}

#sales-tab .lead-name-company .lead-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 3px;
    line-height: 1.2;
}

#sales-tab .lead-name-company .lead-company {
    display: block;
    font-size: 11px;
    color: #7f8c8d;
    margin-bottom: 3px;
    line-height: 1.2;
}

#sales-tab .lead-name-company .lead-project-type {
    display: inline-block;
    font-size: 9px;
    background: #3498db;
    color: white;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 500;
}

#sales-tab .customer-information,
#sales-tab .salesperson-information {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 3px;
    padding: 8px;
    margin-bottom: 8px;
    flex-shrink: 0; /* Prevent excessive shrinking */
}

#sales-tab .customer-information h4,
#sales-tab .salesperson-information h4 {
    margin: 0 0 6px 0;
    font-size: 11px;
    font-weight: 600;
    color: #2c3e50;
}

#sales-tab .contact-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    border-bottom: 1px solid #f8f9fa;
    font-size: 10px;
    line-height: 1.3;
}

#sales-tab .contact-item:last-child {
    border-bottom: none;
}

#sales-tab .contact-item label {
    font-weight: 500;
    color: #7f8c8d;
    min-width: 50px;
    font-size: 10px;
}

#sales-tab .contact-item span {
    color: #2c3e50;
    text-align: right;
    word-break: break-word;
    font-size: 10px;
}

#sales-tab .customer-information h4,
#sales-tab .salesperson-information h4 {
    margin: 0 0 6px 0;
    font-size: 11px;
    color: #2c3e50;
    font-weight: 600;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 4px;
}

#sales-tab .contact-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    font-size: 10px;
    line-height: 1.3;
}

#sales-tab .contact-item label {
    color: #6c757d;
    font-weight: 500;
    min-width: 50px;
    font-size: 10px;
}

#sales-tab .contact-item span {
    color: #2c3e50;
    text-align: right;
    flex: 1;
    font-size: 10px;
}

#sales-tab .lead-status-badge {
    background: #28a745;
    color: white;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 500;
}

#sales-tab .lead-actions-ribbon {
    display: flex;
    gap: 4px;
    padding: 6px 8px 0 8px; /* Remove bottom padding */
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    margin-top: auto; /* Push to bottom */
    margin-bottom: 0; /* Remove bottom margin */
    flex-shrink: 0; /* Prevent shrinking */
    min-height: 44px; /* Ensure minimum height for buttons */
}

#sales-tab .lead-actions-ribbon .btn.compact {
    font-size: 10px;
    padding: 6px 8px;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========================================
   CUSTOMERS FILTERS PANEL - MATCH LEADS STYLING
   ======================================== */

#sales-tab .customers-filters-panel {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 6px 10px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0eafc;
}

#sales-tab .customers-filters-panel .filter-row {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: stretch;
}

#sales-tab .customers-filters-panel .filter-row.condensed {
    gap: 6px;
}

#sales-tab .customers-filters-panel .filter-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 100%;
    flex: none;
    gap: 2px;
}

#sales-tab .customers-filters-panel .filter-group.compact {
    min-width: 0;
    width: 100%;
    flex: none;
}

#sales-tab .customers-filters-panel .filter-group.search-group {
    min-width: 0;
    width: 100%;
    flex: none;
}

#sales-tab .customers-filters-panel .filter-group select,
#sales-tab .customers-filters-panel .filter-group input {
    padding: 6px 8px;
    font-size: 12px;
    border: 1px solid #d1d7dc;
    border-radius: 4px;
    background: #fff;
    transition: border-color 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

#sales-tab .customers-filters-panel .filter-group select:focus,
#sales-tab .customers-filters-panel .filter-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

#sales-tab .customers-filters-panel .filter-actions {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
    width: 100%;
    justify-content: space-between;
}

#sales-tab .customers-filters-panel .filter-actions.compact {
    gap: 3px;
}

#sales-tab .customers-filters-panel .btn.compact {
    padding: 6px 8px;
    font-size: 11px;
    min-width: 24px;
    border-radius: 3px;
}

#sales-tab .customer-actions {
    display: flex;
    gap: 4px;
    padding: 4px 8px;
    background: transparent;
    border-radius: 0;
    margin: 8px;
    border: none;
}

#sales-tab .customer-actions .btn {
    flex: 1;
    justify-content: center;
    padding: 4px 8px;
    font-size: 11px;
    min-height: 24px;
}

/* ========================================
   CONDENSED LEADS LIST ITEMS ONLY
   ======================================== */

/* Make the leads-list scrollable for overflow */
#sales-tab .leads-list {
    flex: 1 1 auto;
    overflow-y: auto;
    max-height: calc(100vh - 220px); /* Adjust as needed for your layout */
    padding: 0 0 0 0;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #bdc3c7 #f1f1f1;
}
#sales-tab .leads-list::-webkit-scrollbar {
    width: 8px;
}
#sales-tab .leads-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}
#sales-tab .leads-list::-webkit-scrollbar-thumb {
    background: #bdc3c7;
    border-radius: 4px;
}
#sales-tab .leads-list::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}

/* Condensed lead-item style for the list only */
#sales-tab .leads-list .lead-item {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 3px;
    margin-bottom: 2px;
    padding: 4px 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 9px;
    position: relative;
    overflow: hidden;
    line-height: 1.1;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    gap: 1px;
}

#sales-tab .leads-list .lead-item:hover {
    background: #f8f9fa;
    border-color: #3498db;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.10);
}

#sales-tab .leads-list .lead-item.selected {
    background: #e3f2fd;
    border-color: #3498db;
    box-shadow: 0 2px 5px rgba(52, 152, 219, 0.15);
}

#sales-tab .leads-list .lead-item.status-new {
    border-left: 3px solid #3498db;
}
#sales-tab .leads-list .lead-item.status-contacted {
    border-left: 3px solid #f39c12;
}
#sales-tab .leads-list .lead-item.status-estimate-sent {
    border-left: 3px solid #9b59b6;
}
#sales-tab .leads-list .lead-item.status-negotiating {
    border-left: 3px solid #2ecc71;
}
#sales-tab .leads-list .lead-item.status-sold {
    border-left: 3px solid #27ae60;
}
#sales-tab .leads-list .lead-item.status-lost {
    border-left: 3px solid #e74c3c;
}

/* Remove header style for lead name, just bold text */
#sales-tab .leads-list .lead-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    background: none;
    padding: 0;
    box-shadow: none;
}

#sales-tab .leads-list .lead-name-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    gap: 0;
}

#sales-tab .leads-list .lead-name {
    font-size: 10px;
    font-weight: bold;
    margin: 0;
    color: #2c3e50;
    background: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1;
    padding: 0;
}

#sales-tab .leads-list .lead-status-badge {
    display: inline-block;
    padding: 1px 3px;
    border-radius: 6px;
    font-size: 7px;
    font-weight: 500;
    text-transform: uppercase;
    margin-top: 0;
    white-space: nowrap;
}

#sales-tab .leads-list .lead-meta-section {
    display: flex;
    gap: 2px;
    align-items: center;
    font-size: 8px;
}

#sales-tab .leads-list .lead-priority,
#sales-tab .leads-list .lead-source {
    font-size: 10px;
    cursor: help;
}

/* Project Info */
#sales-tab .leads-list .lead-project-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    padding: 1px 3px;
    background: #f8f9fa;
    border-radius: 2px;
    font-size: 8px;
}

#sales-tab .leads-list .project-type-badge {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 1px 3px;
    border-radius: 4px;
    font-size: 7px;
    font-weight: 500;
    text-transform: capitalize;
}

#sales-tab .leads-list .project-value {
    font-weight: 600;
    font-size: 10px;
}

#sales-tab .leads-list .project-value.has-value {
    color: #27ae60;
}
#sales-tab .leads-list .project-value.no-value {
    color: #95a5a6;
}

/* Contact Info */
#sales-tab .leads-list .lead-contact-info {
    display: flex;
    flex-direction: row;
    gap: 8px;
    margin: 2px 0;
    font-size: 9px;
    color: #6c757d;
}

#sales-tab .leads-list .lead-contact-info .contact-item {
    display: flex;
    align-items: center;
    gap: 3px;
}

#sales-tab .leads-list .lead-contact-info .contact-item i {
    width: 10px;
    text-align: center;
    color: #adb5bd;
    font-size: 9px;
}

#sales-tab .leads-list .contact-item .email-text {
    color: #3498db;
    text-decoration: none;
    font-size: 9px;
}

#sales-tab .leads-list .contact-item .email-text:hover {
    text-decoration: underline;
}

/* Hide lead actions in condensed list */
#sales-tab .leads-list .lead-actions {
    display: none !important;
}

/* ========================================
   CUSTOM SCROLLBARS FOR LISTS
   ======================================== */

/* Custom scrollbar for leads list */
#sales-tab .leads-list::-webkit-scrollbar {
    width: 8px;
}

#sales-tab .leads-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#sales-tab .leads-list::-webkit-scrollbar-thumb {
    background: #bdc3c7;
    border-radius: 4px;
}

#sales-tab .leads-list::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}

/* Custom scrollbar for customers list */
#sales-tab .customers-list-container::-webkit-scrollbar {
    width: 8px;
}

#sales-tab .customers-list-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#sales-tab .customers-list-container::-webkit-scrollbar-thumb {
    background: #bdc3c7;
    border-radius: 4px;
}

#sales-tab .customers-list-container::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}

/* Ensure customers list container has proper overflow */
#sales-tab .customers-list-container {
    overflow-y: auto;
    max-height: calc(100vh - 300px);
}

/* ========================================
   CUSTOMERS LIST STYLING - CONDENSED
   ======================================== */

/* Ultra-Condensed Customer List Items */
#sales-tab .customer-item {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    margin-bottom: 4px;
    padding: 6px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 10px;
    position: relative;
    overflow: hidden;
    line-height: 1.2;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

#sales-tab .customer-item:hover {
    background: #f8f9fa;
    border-color: #27ae60;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(39, 174, 96, 0.15);
}

#sales-tab .customer-item.selected {
    background: #e8f5e9;
    border-color: #27ae60;
    box-shadow: 0 2px 5px rgba(39, 174, 96, 0.2);
}

#sales-tab .customer-item.status-active {
    border-left: 3px solid #27ae60;
}

#sales-tab .customer-item.status-inactive {
    border-left: 3px solid #95a5a6;
}

#sales-tab .customer-item.status-prospect {
    border-left: 3px solid #f39c12;
}

#sales-tab .customer-item.status-unknown {
    border-left: 3px solid #bdc3c7;
}

/* Ultra-Condensed Customer Header */
#sales-tab .customer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

#sales-tab .customer-name-section {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0; /* Allow text truncation */
}

#sales-tab .customer-type-icon {
    font-size: 12px;
    cursor: help;
    flex-shrink: 0;
}

#sales-tab .customer-name-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0; /* Allow text truncation */
    gap: 1px;
}

#sales-tab .customer-name {
    font-size: 11px;
    font-weight: 600;
    margin: 0;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

#sales-tab .customer-type-badge {
    display: inline-block;
    padding: 1px 4px;
    border-radius: 6px;
    font-size: 8px;
    font-weight: 500;
    text-transform: uppercase;
    margin-top: 1px;
    white-space: nowrap;
}

#sales-tab .customer-type-badge.commercial {
    background: #e3f2fd;
    color: #1565c0;
}

#sales-tab .customer-type-badge.residential {
    background: #e8f5e9;
    color: #2e7d32;
}

#sales-tab .customer-type-badge.government {
    background: #f3e5f5;
    color: #6a1b9a;
}

#sales-tab .customer-type-badge.individual {
    background: #fff3e0;
    color: #e65100;
}

#sales-tab .customer-status .status-badge {
    padding: 1px 4px;
    border-radius: 8px;
    font-size: 8px;
    font-weight: 500;
    text-transform: uppercase;
}

#sales-tab .status-badge.active {
    background: #d4edda;
    color: #155724;
}

#sales-tab .status-badge.inactive {
    background: #f8d7da;
    color: #721c24;
}

#sales-tab .status-badge.prospect {
    background: #fff3cd;
    color: #856404;
}

/* Simplified Customer Contact Info - Only show primary contact */
#sales-tab .customer-contact-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 0;
    font-size: 9px;
    color: #6c757d;
}

#sales-tab .customer-contact-info .contact-item {
    display: flex;
    align-items: center;
    gap: 3px;
}

#sales-tab .customer-contact-info .contact-item i {
    width: 10px;
    text-align: center;
    color: #adb5bd;
    font-size: 9px;
}

/* Simplified Business Info - Only show key metric */
#sales-tab .customer-business-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 3px;
    font-size: 9px;
    padding-top: 3px;
    border-top: 1px solid #f8f9fa;
}

#sales-tab .business-metric {
    display: flex;
    align-items: center;
    gap: 3px;
}

#sales-tab .business-metric i {
    color: #95a5a6;
    width: 10px;
    font-size: 9px;
}

#sales-tab .metric-label {
    color: #6c757d;
    font-weight: 500;
    font-size: 9px;
}

#sales-tab .metric-value {
    color: #2c3e50;
    font-weight: 600;
    font-size: 10px;
}

#sales-tab .metric-value.has-revenue {
    color: #27ae60;
}

#sales-tab .metric-value.no-revenue {
    color: #95a5a6;
}

/* Remove customer actions from list items - will be in details window */
/* Customer actions - commented out legacy code removed */

/* ========================================================
   SALES CRM SHELL OVERRIDES (PROJECT-TAB STYLE LAYOUT)
   ======================================================== */
#sales-tab #sales-crm-shell {
    display: grid;
    grid-template-columns: minmax(260px, 0.72fr) minmax(0, 2.28fr);
    gap: 12px;
    width: 100%;
    height: calc(100vh - 120px);
    min-height: 0;
}

#sales-tab #sales-crm-shell .sales-sidebar-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.08);
}

#sales-tab #sales-crm-shell .sales-entity-toggle {
    display: flex;
    gap: 1px;
    padding: 0 10px;
    min-height: 44px;
    align-items: center;
    border-bottom: 1px solid #1a252f;
    background: #1e3c72;
}

#sales-tab #sales-crm-shell .sales-entity-btn {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #b0c4de;
    padding: 12px 12px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}

#sales-tab #sales-crm-shell .sales-entity-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

#sales-tab #sales-crm-shell .sales-entity-btn.is-active {
    color: #ffffff;
    border-bottom-color: #66a3ff;
    font-weight: 700;
}

#sales-tab #sales-crm-shell .sales-sidebar-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    padding: 8px;
    background: #f7f9fc;
}

#sales-tab #sales-crm-shell .leads-section,
#sales-tab #sales-crm-shell .customers-section {
    display: none;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 5px rgba(44, 62, 80, 0.07);
}

#sales-tab #sales-crm-shell[data-active-entity="leads"] .leads-section {
    display: flex;
}

#sales-tab #sales-crm-shell[data-active-entity="customers"] .customers-section {
    display: flex;
}

#sales-tab #sales-crm-shell .sales-content-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.08);
}

#sales-tab #sales-crm-shell .sales-sub-ribbon {
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
    padding: 0 12px;
    border-bottom: 1px solid #1a252f;
    background: #1e3c72;
    min-height: 44px;
    align-items: center;
}

#sales-tab #sales-crm-shell .sales-subtab-btn {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #b0c4de;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}

#sales-tab #sales-crm-shell .sales-subtab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

#sales-tab #sales-crm-shell .sales-subtab-btn.is-active {
    color: #ffffff;
    border-bottom-color: #66a3ff;
    font-weight: 700;
}

#sales-tab #sales-crm-shell .sales-panel-container {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    background: #fff;
    display: grid;
    grid-template-rows: minmax(220px, 0.9fr) minmax(260px, 1.1fr);
    gap: 10px;
    padding: 10px;
}

#sales-tab #sales-crm-shell .sales-home-dashboard-section,
#sales-tab #sales-crm-shell .lead-details-section,
#sales-tab #sales-crm-shell .sales-pipeline-section,
#sales-tab #sales-crm-shell .sales-analytics-section,
#sales-tab #sales-crm-shell .sales-manager-section,
#sales-tab #sales-crm-shell .customer-workspace-section,
#sales-tab #sales-crm-shell .sales-marketing-section {
    display: none;
    min-height: 0;
    overflow: hidden;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(44, 62, 80, 0.08);
}

#sales-tab #sales-crm-shell[data-active-view="sales-home"] .sales-home-dashboard-section {
    display: flex;
    flex-direction: column;
    grid-row: 1;
}

#sales-tab #sales-crm-shell[data-active-view="sales-home"] .sales-pipeline-section {
    display: flex;
    flex-direction: column;
    grid-row: 2;
}

#sales-tab #sales-crm-shell[data-active-view="sales-analytics"] .sales-analytics-section,
#sales-tab #sales-crm-shell[data-active-view="lead-details"] .lead-details-section,
#sales-tab #sales-crm-shell[data-active-view="sales-manager"] .sales-manager-section,
#sales-tab #sales-crm-shell[data-active-view="customer"] .customer-workspace-section,
#sales-tab #sales-crm-shell[data-active-view="integration-marketing"] .sales-marketing-section {
    display: flex;
    flex-direction: column;
    grid-row: 1 / 3;
}

#sales-tab #sales-crm-shell .sales-pipeline-content,
#sales-tab #sales-crm-shell .sales-home-dashboard-content,
#sales-tab #sales-crm-shell .sales-analytics-content,
#sales-tab #sales-crm-shell .sales-manager-content,
#sales-tab #sales-crm-shell .customer-workspace-content,
#sales-tab #sales-crm-shell .sales-marketing-content {
    min-height: 0;
    flex: 1 1 auto;
}

#sales-tab #sales-crm-shell .pipeline-container {
    min-height: 0;
}

#sales-tab #sales-crm-shell .sales-targets-container {
    gap: 10px;
}

#sales-tab #sales-crm-shell .sales-goals-form {
    margin-top: 8px;
    border-top: 1px solid #dde4ef;
    padding-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#sales-tab #sales-crm-shell .sales-goals-form h5 {
    margin: 0;
    font-size: 12px;
    color: #334e68;
}

#sales-tab #sales-crm-shell .sales-goals-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

#sales-tab #sales-crm-shell .sales-goals-grid label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 11px;
    color: #486581;
}

#sales-tab #sales-crm-shell .sales-goals-grid input {
    border: 1px solid #c7d3e6;
    border-radius: 5px;
    padding: 6px 8px;
    font-size: 12px;
}

#sales-tab #sales-crm-shell .sales-manager-content,
#sales-tab #sales-crm-shell .sales-marketing-content,
#sales-tab #sales-crm-shell .customer-workspace-content {
    padding: 12px;
    overflow: auto;
}

#sales-tab #sales-crm-shell .sales-manager-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

#sales-tab #sales-crm-shell .manager-metric-card {
    border: 1px solid #d7e1ef;
    border-radius: 8px;
    padding: 10px;
    background: #f8fbff;
}

#sales-tab #sales-crm-shell .manager-metric-card .label {
    display: block;
    font-size: 11px;
    color: #486581;
    margin-bottom: 4px;
}

#sales-tab #sales-crm-shell .manager-metric-card .value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #102a43;
}

#sales-tab #sales-crm-shell .sales-manager-workload h4,
#sales-tab #sales-crm-shell .marketing-campaign-builder h4,
#sales-tab #sales-crm-shell .marketing-campaign-list-wrapper h4 {
    margin: 0 0 8px;
    color: #243b53;
}

#sales-tab #sales-crm-shell .sales-manager-workload-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#sales-tab #sales-crm-shell .manager-workload-item {
    border: 1px solid #d7e1ef;
    border-radius: 6px;
    background: #ffffff;
    padding: 8px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

#sales-tab #sales-crm-shell .manager-workload-meta {
    color: #486581;
    font-size: 11px;
}

#sales-tab #sales-crm-shell .customer-profile-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

#sales-tab #sales-crm-shell .customer-profile-card {
    border: 1px solid #d7e1ef;
    border-radius: 8px;
    background: #f8fbff;
    padding: 10px;
}

#sales-tab #sales-crm-shell .customer-profile-card h4 {
    margin: 0 0 8px;
    font-size: 13px;
    color: #243b53;
}

#sales-tab #sales-crm-shell .customer-profile-card p {
    margin: 0 0 6px;
    font-size: 12px;
    color: #334e68;
}

#sales-tab #sales-crm-shell .customer-project-list {
    border: 1px solid #d7e1ef;
    border-radius: 8px;
    background: #ffffff;
    padding: 10px;
}

#sales-tab #sales-crm-shell .customer-project-list h4 {
    margin: 0 0 8px;
    font-size: 13px;
    color: #243b53;
}

#sales-tab #sales-crm-shell .customer-project-item {
    border-top: 1px solid #edf2f8;
    padding: 8px 0;
    font-size: 12px;
    color: #334e68;
}

#sales-tab #sales-crm-shell .customer-project-item:first-child {
    border-top: none;
    padding-top: 0;
}

#sales-tab #sales-crm-shell .sales-marketing-content {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(220px, 1fr) minmax(220px, 1fr);
    gap: 12px;
    align-items: start;
}

#sales-tab #sales-crm-shell .marketing-campaign-builder,
#sales-tab #sales-crm-shell .marketing-campaign-list-wrapper {
    border: 1px solid #d7e1ef;
    border-radius: 8px;
    background: #ffffff;
    padding: 10px;
    min-height: 0;
}

#sales-tab #sales-crm-shell .marketing-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

#sales-tab #sales-crm-shell .marketing-form-grid label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    color: #486581;
}

#sales-tab #sales-crm-shell .marketing-form-grid input,
#sales-tab #sales-crm-shell .marketing-form-grid select {
    border: 1px solid #c7d3e6;
    border-radius: 5px;
    padding: 6px 8px;
    font-size: 12px;
}

#sales-tab #sales-crm-shell .marketing-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

#sales-tab #sales-crm-shell .marketing-campaign-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 100%;
    overflow: auto;
}

#sales-tab #sales-crm-shell .campaign-item {
    border: 1px solid #e1e8f2;
    border-radius: 6px;
    padding: 8px;
    background: #f8fbff;
}

#sales-tab #sales-crm-shell .campaign-item h5 {
    margin: 0 0 4px;
    font-size: 13px;
    color: #243b53;
}

#sales-tab #sales-crm-shell .campaign-item p {
    margin: 2px 0;
    font-size: 11px;
    color: #486581;
}

#sales-tab #sales-crm-shell .sales-panel-subheader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #f7f9fc;
    border-bottom: 1px solid #d9e3f1;
    flex-shrink: 0;
}

#sales-tab #sales-crm-shell .sales-home-dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    overflow: auto;
}

#sales-tab #sales-crm-shell .sales-home-kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 8px;
}

#sales-tab #sales-crm-shell .sales-home-grid-panels {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 8px;
}

#sales-tab #sales-crm-shell .sales-home-card {
    border: 1px solid #d7e1ef;
    border-radius: 8px;
    background: #ffffff;
    padding: 8px;
    min-height: 120px;
}

#sales-tab #sales-crm-shell .sales-home-card h4 {
    margin: 0 0 6px;
    font-size: 12px;
    color: #243b53;
}

#sales-tab #sales-crm-shell .sales-home-staff-performance,
#sales-tab #sales-crm-shell .sales-home-source-snapshot,
#sales-tab #sales-crm-shell .sales-home-alerts {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#sales-tab #sales-crm-shell .sales-home-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    border-top: 1px solid #edf2f8;
    padding: 5px 0;
    font-size: 11px;
    color: #334e68;
}

#sales-tab #sales-crm-shell .sales-home-row:first-child {
    border-top: none;
    padding-top: 0;
}

#sales-tab #sales-crm-shell .sales-panel-subheader h3 {
    margin: 0;
    font-size: 13px;
    color: #1f334d;
    font-weight: 700;
}

#sales-tab #sales-crm-shell .sales-panel-subheader span {
    font-size: 11px;
    color: #4a617b;
    text-align: right;
}

#sales-tab #sales-crm-shell .lead-details-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    padding: 8px;
    overflow: auto;
}

#sales-tab #sales-crm-shell .lead-insights-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 8px;
    flex-shrink: 0;
}

#sales-tab #sales-crm-shell .sub-metric-card {
    border: 1px solid #d7e1ef;
    border-radius: 7px;
    background: #f8fbff;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

#sales-tab #sales-crm-shell .sub-metric-card .label {
    font-size: 10px;
    color: #486581;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

#sales-tab #sales-crm-shell .sub-metric-card .value {
    font-size: 14px;
    color: #102a43;
    font-weight: 700;
}

#sales-tab #sales-crm-shell .lead-details-layout {
    min-height: 0;
    flex: 1 1 auto;
}

#sales-tab #sales-crm-shell .lead-production-panels {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 8px;
    padding: 0 8px;
    margin-bottom: 6px;
}

#sales-tab #sales-crm-shell .lead-panel-card {
    border: 1px solid #d7e1ef;
    border-radius: 8px;
    background: #ffffff;
    padding: 8px;
    min-height: 88px;
}

#sales-tab #sales-crm-shell .lead-panel-card h4 {
    margin: 0 0 6px;
    font-size: 12px;
    color: #243b53;
}

#sales-tab #sales-crm-shell .checklist-item,
#sales-tab #sales-crm-shell .readiness-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    border-top: 1px solid #edf2f8;
    padding: 5px 0;
    font-size: 11px;
    color: #334e68;
}

#sales-tab #sales-crm-shell .checklist-item:first-child,
#sales-tab #sales-crm-shell .readiness-row:first-child {
    border-top: none;
    padding-top: 0;
}

#sales-tab #sales-crm-shell .checklist-item .indicator {
    min-width: 32px;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    border-radius: 10px;
    padding: 1px 4px;
}

#sales-tab #sales-crm-shell .checklist-item.done .indicator {
    background: #d9f7e7;
    color: #1b7f42;
}

#sales-tab #sales-crm-shell .checklist-item.pending .indicator {
    background: #fde8e8;
    color: #b42318;
}

#sales-tab #sales-crm-shell .readiness-row .label {
    color: #486581;
}

#sales-tab #sales-crm-shell .readiness-row .value {
    color: #102a43;
    font-weight: 600;
}

#sales-tab #sales-crm-shell .lead-project-snapshot,
#sales-tab #sales-crm-shell .lead-communications-log,
#sales-tab #sales-crm-shell .lead-notes-log,
#sales-tab #sales-crm-shell .lead-files-log {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#sales-tab #sales-crm-shell .lead-log-row {
    border-top: 1px solid #edf2f8;
    padding: 5px 0;
    font-size: 11px;
    color: #334e68;
}

#sales-tab #sales-crm-shell .lead-log-row:first-child {
    border-top: none;
    padding-top: 0;
}

#sales-tab #sales-crm-shell .sales-pipeline-content {
    display: grid;
    grid-template-rows: auto minmax(150px, 1fr) auto;
    gap: 8px;
    padding: 8px;
    overflow: hidden;
}

#sales-tab #sales-crm-shell .pipeline-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 8px;
}

#sales-tab #sales-crm-shell .pipeline-followups {
    border: 1px solid #d7e1ef;
    border-radius: 8px;
    background: #ffffff;
    padding: 8px;
    max-height: 150px;
    overflow: auto;
}

#sales-tab #sales-crm-shell .pipeline-followups h4 {
    margin: 0 0 6px;
    font-size: 12px;
    color: #243b53;
}

#sales-tab #sales-crm-shell .followup-item {
    border-top: 1px solid #edf2f8;
    padding: 6px 0;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

#sales-tab #sales-crm-shell .followup-item:first-child {
    border-top: none;
    padding-top: 0;
}

#sales-tab #sales-crm-shell .followup-item .meta {
    font-size: 11px;
    color: #486581;
}

#sales-tab #sales-crm-shell .followup-item .value {
    font-size: 12px;
    font-weight: 700;
    color: #102a43;
}

#sales-tab #sales-crm-shell .analytics-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    overflow: auto;
}

#sales-tab #sales-crm-shell .analytics-insights-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 8px;
}

#sales-tab #sales-crm-shell .source-performance-panel {
    border: 1px solid #d7e1ef;
    border-radius: 8px;
    background: #ffffff;
    padding: 8px;
}

#sales-tab #sales-crm-shell .source-performance-panel h5 {
    margin: 0 0 6px;
    font-size: 12px;
    color: #243b53;
}

#sales-tab #sales-crm-shell .source-performance-table .header,
#sales-tab #sales-crm-shell .source-performance-table .row {
    display: grid;
    grid-template-columns: 1.2fr 0.6fr 1fr 0.6fr;
    gap: 8px;
    padding: 5px 0;
    border-top: 1px solid #edf2f8;
    font-size: 11px;
}

#sales-tab #sales-crm-shell .source-performance-table .header {
    border-top: none;
    padding-top: 0;
    font-weight: 700;
    color: #243b53;
}

#sales-tab #sales-crm-shell .source-performance-table .row {
    color: #334e68;
}

#sales-tab #sales-crm-shell .analytics-detail-panels {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 8px;
}

#sales-tab #sales-crm-shell .analytics-detail-card {
    border: 1px solid #d7e1ef;
    border-radius: 8px;
    background: #ffffff;
    padding: 8px;
}

#sales-tab #sales-crm-shell .analytics-detail-card h5 {
    margin: 0 0 6px;
    font-size: 12px;
    color: #243b53;
}

#sales-tab #sales-crm-shell .analytics-detail-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    border-top: 1px solid #edf2f8;
    padding: 5px 0;
    font-size: 11px;
    color: #334e68;
}

#sales-tab #sales-crm-shell .analytics-detail-row:first-child {
    border-top: none;
    padding-top: 0;
}

#sales-tab #sales-crm-shell .sales-manager-content {
    display: grid;
    grid-template-rows: auto auto auto auto;
    gap: 10px;
}

#sales-tab #sales-crm-shell .sales-manager-assignments,
#sales-tab #sales-crm-shell .sales-manager-alerts {
    border: 1px solid #d7e1ef;
    border-radius: 8px;
    background: #ffffff;
    padding: 8px;
}

#sales-tab #sales-crm-shell .sales-manager-assignments h4,
#sales-tab #sales-crm-shell .sales-manager-alerts h4 {
    margin: 0 0 6px;
    font-size: 12px;
    color: #243b53;
}

#sales-tab #sales-crm-shell .assignment-row {
    display: grid;
    grid-template-columns: 1.2fr 0.6fr 0.6fr 1fr;
    gap: 8px;
    border-top: 1px solid #edf2f8;
    padding: 5px 0;
    font-size: 11px;
    color: #334e68;
}

#sales-tab #sales-crm-shell .assignment-row.header {
    border-top: none;
    padding-top: 0;
    font-weight: 700;
    color: #243b53;
}

#sales-tab #sales-crm-shell .manager-alert-item {
    border-top: 1px solid #edf2f8;
    padding: 6px 0;
    font-size: 11px;
    color: #9f3a38;
}

#sales-tab #sales-crm-shell .manager-alert-item:first-child {
    border-top: none;
    padding-top: 0;
}

#sales-tab #sales-crm-shell .sales-manager-performance {
    border: 1px solid #d7e1ef;
    border-radius: 8px;
    background: #ffffff;
    padding: 8px;
}

#sales-tab #sales-crm-shell .sales-manager-performance h4 {
    margin: 0 0 6px;
    font-size: 12px;
    color: #243b53;
}

#sales-tab #sales-crm-shell .manager-performance-row {
    display: grid;
    grid-template-columns: 1fr 0.7fr 0.8fr 0.8fr 0.8fr;
    gap: 8px;
    align-items: center;
    border-top: 1px solid #edf2f8;
    padding: 5px 0;
    font-size: 11px;
    color: #334e68;
}

#sales-tab #sales-crm-shell .manager-performance-row.header {
    border-top: none;
    padding-top: 0;
    font-weight: 700;
    color: #243b53;
}

#sales-tab #sales-crm-shell .manager-performance-row input {
    width: 100%;
    border: 1px solid #c7d3e6;
    border-radius: 5px;
    padding: 4px 6px;
    font-size: 11px;
}

#sales-tab #sales-crm-shell .manager-performance-row .status.over {
    color: #1b7f42;
    font-weight: 700;
}

#sales-tab #sales-crm-shell .manager-performance-row .status.under {
    color: #b42318;
    font-weight: 700;
}

#sales-tab #sales-crm-shell .customer-workspace-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#sales-tab #sales-crm-shell .marketing-integrations-panel {
    border: 1px solid #d7e1ef;
    border-radius: 8px;
    background: #ffffff;
    padding: 10px;
    min-height: 0;
}

#sales-tab #sales-crm-shell .marketing-integrations-panel h4 {
    margin: 0 0 6px;
    font-size: 12px;
    color: #243b53;
}

#sales-tab #sales-crm-shell .channel-health-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 6px;
    margin-bottom: 10px;
}

#sales-tab #sales-crm-shell .channel-health-card {
    border: 1px solid #d7e1ef;
    border-radius: 6px;
    padding: 6px;
    background: #f8fbff;
}

#sales-tab #sales-crm-shell .channel-health-card .title {
    font-size: 11px;
    font-weight: 700;
    color: #243b53;
    margin-bottom: 3px;
}

#sales-tab #sales-crm-shell .channel-health-card .meta,
#sales-tab #sales-crm-shell .channel-health-card .state {
    font-size: 10px;
    color: #486581;
}

#sales-tab #sales-crm-shell .channel-health-card.connected {
    border-color: #84d2a4;
}

#sales-tab #sales-crm-shell .channel-health-card.monitor {
    border-color: #f3c969;
}

#sales-tab #sales-crm-shell .channel-health-card.not-connected {
    border-color: #e4b9b9;
}

#sales-tab #sales-crm-shell .attribution-row {
    display: grid;
    grid-template-columns: 1fr 0.8fr 0.8fr;
    gap: 8px;
    border-top: 1px solid #edf2f8;
    padding: 6px 0;
    font-size: 11px;
    color: #334e68;
}

#sales-tab #sales-crm-shell .attribution-row:first-child {
    border-top: none;
    padding-top: 0;
}

#sales-tab #sales-crm-shell .sync-log-row,
#sales-tab #sales-crm-shell .recommendation-row {
    border-top: 1px solid #edf2f8;
    padding: 5px 0;
    font-size: 11px;
    color: #334e68;
}

#sales-tab #sales-crm-shell .sync-log-row:first-child,
#sales-tab #sales-crm-shell .recommendation-row:first-child {
    border-top: none;
    padding-top: 0;
}

@media (max-width: 1350px) {
    #sales-tab #sales-crm-shell {
        grid-template-columns: minmax(240px, 0.78fr) minmax(0, 2.22fr);
    }

    #sales-tab #sales-crm-shell .sales-manager-summary {
        grid-template-columns: repeat(2, minmax(130px, 1fr));
    }

    #sales-tab #sales-crm-shell .customer-profile-grid,
    #sales-tab #sales-crm-shell .marketing-form-grid,
    #sales-tab #sales-crm-shell .sales-marketing-content {
        grid-template-columns: 1fr;
    }

    #sales-tab #sales-crm-shell .sales-home-kpi-grid {
        grid-template-columns: repeat(3, minmax(120px, 1fr));
    }

    #sales-tab #sales-crm-shell .sales-home-grid-panels,
    #sales-tab #sales-crm-shell .analytics-detail-panels,
    #sales-tab #sales-crm-shell .lead-production-panels {
        grid-template-columns: 1fr;
    }

    #sales-tab #sales-crm-shell .lead-insights-grid,
    #sales-tab #sales-crm-shell .pipeline-kpi-row {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }
}

@media (max-width: 1050px) {
    #sales-tab #sales-crm-shell {
        grid-template-columns: 1fr;
        height: auto;
        min-height: calc(100vh - 120px);
    }

    #sales-tab #sales-crm-shell .sales-sidebar-column {
        min-height: 320px;
    }

    #sales-tab #sales-crm-shell .sales-panel-container {
        grid-template-rows: minmax(220px, auto) minmax(320px, auto);
        min-height: 420px;
    }
}

/* Sidebar density: top toggle is the only header in left column */
#sales-tab #sales-crm-shell .sales-sidebar-content .section-header {
    display: none !important;
}

#sales-tab #sales-crm-shell .leads-filters-panel,
#sales-tab #sales-crm-shell .customers-filters-panel {
    padding: 4px 8px;
    gap: 2px;
}

#sales-tab #sales-crm-shell .leads-filters-panel .filter-row,
#sales-tab #sales-crm-shell .customers-filters-panel .filter-row {
    gap: 5px;
}

#sales-tab #sales-crm-shell .leads-filters-panel .filter-group select,
#sales-tab #sales-crm-shell .leads-filters-panel .filter-group input,
#sales-tab #sales-crm-shell .customers-filters-panel .filter-group select,
#sales-tab #sales-crm-shell .customers-filters-panel .filter-group input {
    padding: 5px 7px;
    font-size: 11px;
}

#sales-tab #sales-crm-shell .leads-filters-panel .btn.compact,
#sales-tab #sales-crm-shell .customers-filters-panel .btn.compact {
    padding: 5px 7px;
    font-size: 10px;
    min-height: 22px;
}

#sales-tab #sales-crm-shell .lead-actions,
#sales-tab #sales-crm-shell .customer-actions {
    margin: 4px 6px;
    padding: 0;
    gap: 4px;
}

#sales-tab #sales-crm-shell .lead-actions .btn,
#sales-tab #sales-crm-shell .customer-actions .btn {
    padding: 4px 6px;
    font-size: 10px;
    min-height: 22px;
}

#sales-tab #sales-crm-shell .leads-list-container,
#sales-tab #sales-crm-shell .customers-list-container {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

#sales-tab #sales-crm-shell .leads-list,
#sales-tab #sales-crm-shell #customers-list {
    max-height: none;
}

#sales-tab #sales-crm-shell .leads-list .lead-item {
    margin-bottom: 1px;
    padding: 3px 5px;
    border-radius: 2px;
    font-size: 8px;
    gap: 0;
}

#sales-tab #sales-crm-shell .leads-list .lead-name {
    font-size: 9px;
}

#sales-tab #sales-crm-shell .leads-list .lead-status-badge {
    font-size: 7px;
    padding: 1px 3px;
}

#sales-tab #sales-crm-shell .leads-list .lead-project-info {
    margin-bottom: 0;
    padding: 1px 2px;
}

#sales-tab #sales-crm-shell .leads-list .lead-contact-info {
    gap: 5px;
    margin: 1px 0 0;
}

#sales-tab #sales-crm-shell .customer-item {
    margin-bottom: 3px;
    padding: 5px 6px;
    border-radius: 3px;
    font-size: 9px;
}

#sales-tab #sales-crm-shell .customer-name {
    font-size: 10px;
}

#sales-tab #sales-crm-shell .customer-contact-info {
    gap: 6px;
    margin: 1px 0;
    font-size: 8px;
}

#sales-tab #sales-crm-shell .customer-business-info {
    margin-top: 2px;
    gap: 8px;
    font-size: 8px;
}

/* ========================================
   ENHANCED SUBTAB CONTENT DENSITY / SCALE
   ======================================== */

#sales-tab #sales-crm-shell .sales-panel-container {
    grid-template-rows: minmax(250px, 1fr) minmax(320px, 1.15fr);
    gap: 12px;
}

#sales-tab #sales-crm-shell .sales-home-dashboard-content {
    gap: 10px;
    padding: 10px;
}

#sales-tab #sales-crm-shell .sales-home-grid-panels {
    grid-template-columns: repeat(3, minmax(200px, 1fr));
    gap: 10px;
}

#sales-tab #sales-crm-shell .sales-home-card {
    min-height: 148px;
    padding: 10px;
}

#sales-tab #sales-crm-shell .sales-home-activity-snapshot,
#sales-tab #sales-crm-shell .sales-home-funnel-metrics,
#sales-tab #sales-crm-shell .sales-home-upcoming-followups {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#sales-tab #sales-crm-shell .lead-production-panels {
    grid-template-columns: repeat(4, minmax(170px, 1fr));
    gap: 10px;
}

#sales-tab #sales-crm-shell .lead-opportunity-finance,
#sales-tab #sales-crm-shell .lead-next-actions {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#sales-tab #sales-crm-shell .sales-pipeline-content {
    grid-template-rows: auto minmax(150px, 1fr) auto auto;
    gap: 10px;
    padding: 10px;
}

#sales-tab #sales-crm-shell .pipeline-followups {
    max-height: 180px;
}

#sales-tab #sales-crm-shell .pipeline-detail-panels {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 10px;
}

#sales-tab #sales-crm-shell .pipeline-detail-card,
#sales-tab #sales-crm-shell .sales-manager-capacity,
#sales-tab #sales-crm-shell .sales-manager-coaching {
    border: 1px solid #d7e1ef;
    border-radius: 8px;
    background: #ffffff;
    padding: 10px;
}

#sales-tab #sales-crm-shell .pipeline-detail-card h4,
#sales-tab #sales-crm-shell .sales-manager-capacity h4,
#sales-tab #sales-crm-shell .sales-manager-coaching h4 {
    margin: 0 0 6px;
    font-size: 12px;
    color: #243b53;
}

#sales-tab #sales-crm-shell .pipeline-stage-health,
#sales-tab #sales-crm-shell .pipeline-loss-signals {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#sales-tab #sales-crm-shell .analytics-extended-panels {
    margin-top: 2px;
}

#sales-tab #sales-crm-shell .analytics-forecast-scenarios,
#sales-tab #sales-crm-shell .analytics-channel-efficiency {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#sales-tab #sales-crm-shell .sales-manager-content {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    grid-template-rows: auto;
    gap: 10px;
}

#sales-tab #sales-crm-shell .sales-manager-summary,
#sales-tab #sales-crm-shell .sales-manager-performance {
    grid-column: 1 / -1;
}

#sales-tab #sales-crm-shell .sales-manager-capacity-list,
#sales-tab #sales-crm-shell .sales-manager-coaching-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#sales-tab #sales-crm-shell .customer-workspace-content {
    padding: 12px;
    overflow: auto;
}

#sales-tab #sales-crm-shell .sales-marketing-content {
    grid-template-columns: minmax(250px, 1fr) minmax(240px, 1fr) minmax(260px, 1.1fr);
    gap: 12px;
}

#sales-tab #sales-crm-shell .marketing-budget-roi,
#sales-tab #sales-crm-shell .marketing-channel-velocity {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

@media (max-width: 1450px) {
    #sales-tab #sales-crm-shell .sales-home-grid-panels,
    #sales-tab #sales-crm-shell .lead-production-panels {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }

    #sales-tab #sales-crm-shell .sales-manager-content {
        grid-template-columns: 1fr;
    }

    #sales-tab #sales-crm-shell .sales-manager-summary,
    #sales-tab #sales-crm-shell .sales-manager-performance {
        grid-column: 1;
    }

    #sales-tab #sales-crm-shell .sales-marketing-content,
    #sales-tab #sales-crm-shell .pipeline-detail-panels {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   SALES HOME FULL-WIDTH ROW OVERRIDES
   Keeps Sales Home cards/rows readable in the right pane.
   ======================================== */
#sales-tab #sales-crm-shell[data-active-view="sales-home"] .sales-home-dashboard-section,
#sales-tab #sales-crm-shell[data-active-view="sales-home"] .sales-pipeline-section {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
}

#sales-tab #sales-crm-shell[data-active-view="sales-home"] .sales-home-dashboard-content {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

#sales-tab #sales-crm-shell[data-active-view="sales-home"] .sales-home-kpi-grid {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

#sales-tab #sales-crm-shell[data-active-view="sales-home"] .sales-home-grid-panels {
    width: 100%;
    min-width: 0;
    grid-template-columns: 1fr;
}

#sales-tab #sales-crm-shell[data-active-view="sales-home"] .sales-home-card {
    width: 100%;
    min-width: 0;
}

#sales-tab #sales-crm-shell[data-active-view="sales-home"] .sales-home-row {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    column-gap: 10px;
}

#sales-tab #sales-crm-shell[data-active-view="sales-home"] .sales-home-row > span:first-child {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
}

#sales-tab #sales-crm-shell[data-active-view="sales-home"] .sales-home-row > span:nth-child(2),
#sales-tab #sales-crm-shell[data-active-view="sales-home"] .sales-home-row > span:nth-child(3) {
    white-space: nowrap;
    justify-self: end;
    text-align: right;
}
