* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

/* Header */
.dashboard-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative;
    /* Ensure it's above content */
    z-index: 100;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header-top h1 {
    font-size: 28px;
    color: #1a202c;
    display: flex;
    align-items: center;
    gap: 12px;
}

.view-toggle {
    display: flex;
    gap: 8px;
}

.view-toggle button {
    padding: 8px 16px;
    border: 2px solid #667eea;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.view-toggle button.active {
    background: #667eea;
    color: white;
}

/* Filters */
.filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.search-box {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 14px;
    transition: all 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-box::before {
    content: '🔍';
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
}

select {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 14px;
    cursor: pointer;
    background: white;
    transition: all 0.3s;
}

select:focus {
    outline: none;
    border-color: #667eea;
}

/* Quick Stats - Pastel Gradients & Larger */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 24px;
}

.stat-card {
    background: white;
    color: #1a202c;
    padding: 28px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.stat-card:nth-child(1) {
    background: linear-gradient(135deg, #a8e6cf 0%, #7fd8be 100%);
    color: white;
}

.stat-card:nth-child(2) {
    background: linear-gradient(135deg, #ffd3b6 0%, #ffaaa5 100%);
    color: white;
}

.stat-card:nth-child(3) {
    background: linear-gradient(135deg, #c5a3ff 0%, #a8b5ff 100%);
    color: white;
}

.stat-card:nth-child(4) {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: white;
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.stat-card .label {
    font-size: 15px;
    opacity: 0.95;
    margin-bottom: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-card .value {
    font-size: 44px;
    font-weight: 800;
}

/* Kanban Board */
/* SWIMLANES LAYOUT */
.kanban-board {
    display: flex;
    flex-direction: column;
    /* Stages Stack Vertically */
    gap: 24px;
    overflow-x: hidden;
    /* No horizontal scroll on board */
    padding-bottom: 40px;
    height: auto;
    min-height: 0;
}

.kanban-column {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 20px;
    min-height: auto;
    width: 100%;
    /* Full width */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

/* Add horizontal scroll for cards */
.cards-container {
    display: flex;
    flex-direction: row;
    gap: 16px;
    overflow-x: auto;
    padding: 4px 4px 16px 4px;
    /* Padding for scrollbar */
    min-height: 150px;
    align-items: flex-start;
}

/* Custom Scrollbar for Cards - Visible & Styled */
.cards-container::-webkit-scrollbar {
    height: 10px;
    /* Slightly thicker */
}

.cards-container::-webkit-scrollbar-thumb {
    background: #c7d2fe;
    /* Light Indigo */
    border-radius: 5px;
    border: 2px solid transparent;
    /* Padding around thumb */
    background-clip: content-box;
}

.cards-container::-webkit-scrollbar-thumb:hover {
    background: #6366f1;
    /* Indigo 500 on hover */
}

.cards-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 5px;
}

/* Kanban Column Headers - Much Larger */
.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 3px solid #e2e8f0;
}

.column-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1a202c;
    display: flex;
    align-items: center;
    gap: 12px;
}

.count-badge {
    background: linear-gradient(135deg, #a8b5ff 0%, #c5a3ff 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 800;
}

.cards-container.drag-over {
    background: rgba(102, 126, 234, 0.1);
    border: 2px dashed #667eea;
    border-radius: 12px;
}

/* Lead Card - Fixed Width for Swimlanes */
.lead-card {
    flex: 0 0 300px;
    /* Fixed Width */
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 0;
    /* No bottom margin needed in row */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    cursor: grab;
    transition: all 0.3s;
    border-left: 5px solid transparent;
    font-size: 14px;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.lead-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.lead-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
    transform: rotate(5deg);
}

.lead-card.priority-high {
    border-left-color: #ff9a9e;
}

.lead-card.priority-medium {
    border-left-color: #ffd3b6;
}

.lead-card.priority-low {
    border-left-color: #a8e6cf;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 18px;
    gap: 12px;
}

.card-header>div:first-child {
    flex: 1;
    min-width: 0;
    /* Allows text truncation if needed */
}

.card-header h4 {
    font-size: 24px;
    font-weight: 800;
    color: #1a202c;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.priority-badge {
    padding: 7px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.priority-high {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: white;
}

.priority-medium {
    background: linear-gradient(135deg, #ffd3b6 0%, #ffaaa5 100%);
    color: white;
}

.priority-low {
    background: linear-gradient(135deg, #a8e6cf 0%, #7fd8be 100%);
    color: white;
}

.score-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.score-badge.hot {
    background: #ffc107;
    color: #000;
}

.score-badge.warm {
    background: #17a2b8;
    color: #fff;
}

.score-badge.cold {
    background: #6c757d;
    color: #fff;
}

.card-body {
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    /* Slightly wider second column for emails */
    gap: 12px 16px;
    padding: 4px;
}

.card-body p {
    margin: 0;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #4a5568;
    font-weight: 500;
    word-break: break-all;
    line-height: 1.2;
}

.card-body i {
    font-size: 16px;
    width: 20px;
    /* Fixed width for alignment */
    display: flex;
    justify-content: center;
}

.card-body i.ri-phone-fill {
    color: #6366f1;
}

.card-body i.ri-mail-fill {
    color: #3b82f6;
}

.card-body i.ri-graduation-cap-fill {
    color: #7c3aed;
}

.card-body i.ri-building-fill {
    color: #475569;
}

.card-footer {
    border-top: 1px solid #edf2f7;
    padding-top: 12px;
    /* Compact Padding */
    margin-top: 12px;
    /* Compact Margin */
}

.next-action {
    font-size: 16px;
    font-weight: 700;
    color: #a8b5ff;
    margin-bottom: 14px;
    padding: 8px 12px;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 4px solid #a8b5ff;
}

.next-action.overdue {
    color: #f56565;
    font-weight: 600;
}

.followup-pill {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    background: #ffffff;
    border-radius: 6px;
    font-size: 12px;
    color: #4a5568;
    margin-bottom: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

.followup-pill:last-child {
    margin-bottom: 0;
}

.followup-pill i {
    font-size: 14px;
    margin-right: 8px;
}

.followup-pill.call i {
    color: #e11d48;
}

.followup-pill.whatsapp i {
    color: #25d366;
}

.followup-pill.email i {
    color: #3b82f6;
}

.followup-pill.fallback i {
    color: #8b5cf6;
}

.followup-pill.overdue {
    background: #fff5f5;
    color: #c53030;
    border: 1px solid #feb2b2;
}

.followup-pill.empty {
    background: transparent;
    box-shadow: none;
    color: #a0aec0;
    justify-content: center;
}

.stage-selector-container {
    margin-top: 10px;
    grid-column: span 2;
}

.card-stage-select {
    width: 100%;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    background-color: #f8fafc;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
}

.card-stage-select:hover {
    border-color: #667eea;
    background-color: #fff;
}

.quick-actions {
    display: flex;
    gap: 10px;
}

.quick-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    background: #f7fafc;
    border-radius: 10px;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s;
}

.quick-actions button:hover {
    background: linear-gradient(135deg, #a8b5ff 0%, #c5a3ff 100%);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(168, 181, 255, 0.3);
}

.conversion-meter {
    margin-top: 8px;
    background: #e2e8f0;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
}

.conversion-fill {
    height: 100%;
    background: linear-gradient(90deg, #48bb78, #38a169);
    transition: width 0.5s;
}

/* Detail Panel */
.detail-panel {
    position: fixed;
    right: -600px;
    top: 0;
    width: 600px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.2);
    transition: right 0.3s;
    z-index: 1000;
    overflow-y: auto;
}

.detail-panel.active {
    right: 0;
}

.panel-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    font-size: 24px;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.panel-content {
    padding: 24px;
}

.profile-section {
    margin-bottom: 24px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.info-item {
    background: #f7fafc;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
}

.metrics {
    margin-top: 16px;
}

.metric {
    margin-bottom: 16px;
}

.metric-label {
    font-size: 12px;
    color: #718096;
    margin-bottom: 8px;
}

.score-bar {
    background: #e2e8f0;
    height: 32px;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
}

.score-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    transition: width 0.5s;
}

.probability {
    font-size: 32px;
    font-weight: bold;
    color: #667eea;
    text-align: center;
}

/* Timeline */
.timeline-section {
    margin-bottom: 24px;
}

.timeline-section h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #1a202c;
}

.timeline {
    position: relative;
    padding-left: 32px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e2e8f0;
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -28px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #667eea;
    border: 3px solid white;
    box-shadow: 0 0 0 2px #667eea;
}

.timeline-time {
    font-size: 12px;
    color: #a0aec0;
    margin-bottom: 4px;
}

.timeline-activity {
    background: #f7fafc;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
}

/* Quick Log */
.quick-log {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.quick-log button {
    flex: 1;
    padding: 12px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.quick-log button:hover {
    background: #667eea;
    color: white;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    font-size: 20px;
    margin-bottom: 20px;
    color: #1a202c;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: #4a5568;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #48bb78;
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 3000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.error {
    background: #f56565;
}

/* Analytics Dashboard */
.analytics-dashboard {
    display: none;
}

.analytics-dashboard.active {
    display: block;
}

.analytics-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.analytics-header h2 {
    margin: 0;
    color: #1a202c;
}

.analytics-filters {
    display: flex;
    gap: 12px;
}

.analytics-filters select,
.analytics-filters input,
.analytics-filters button {
    padding: 10px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
}

.analytics-filters button {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    font-weight: 500;
}

.analytics-filters button:hover {
    background: #5a67d8;
}

/* Priority Backgrounds */
.lead-card[data-priority="High"] {
    background-color: #fff1f2;
    /* Light Red */
}

.lead-card[data-priority="Medium"] {
    background-color: #fff7ed;
    /* Light Orange */
}

.lead-card[data-priority="Low"] {
    background-color: #ffffff;
}

/* Stage Colors */
.stage-new-lead {
    border-left: 5px solid #3b82f6;
}

/* Blue */
.stage-contacted {
    border-left: 5px solid #8b5cf6;
}

/* Purple */
.stage-follow-up {
    border-left: 5px solid #f59e0b;
}

/* Amber */
.stage-qualified {
    border-left: 5px solid #10b981;
}

/* Emerald */
.stage-closed-won {
    border-left: 5px solid #059669;
}

/* Dark Green */
.stage-closed-lost {
    border-left: 5px solid #ef4444;
}

.info-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    margin-left: 10px;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s;
}

.info-btn:hover {
    transform: scale(1.1);
    background: rgba(0, 0, 0, 0.05);
}

/* Red */

.load-more-btn {
    width: 100%;
    padding: 12px;
    background: #e2e8f0;
    color: #4a5568;
    border: none;
    border-radius: 8px;
    margin-top: 12px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.load-more-btn:hover {
    background: #cbd5e0;
}

/* HIGH PRIORITY / HOT LEAD OVERRIDE */
.lead-card[data-priority="High"] {
    border-left-color: #ef4444 !important;
    /* Force Red Border */
    background-color: #fef2f2;
    /* Ensure Red Tint */
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
    /* Red Shadow */
}

.lead-card[data-priority="High"] .score-badge {
    background: #fee2e2;
    color: #ef4444;
    border: 1px solid #fecaca;
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.kpi-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 24px;
    color: white;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
}

.kpi-icon {
    font-size: 48px;
    opacity: 0.9;
}

.kpi-content {
    flex: 1;
}

.kpi-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 4px;
}

.kpi-change {
    font-size: 14px;
    opacity: 0.8;
}

.kpi-change.positive {
    color: #48bb78;
}

/* Analytics Dashboard - Professional Pastel Design */
.analytics-dashboard {
    display: none;
    padding: 40px;
    background: linear-gradient(135deg, #f0f4f8 0%, #e8eef5 100%);
    min-height: 100vh;
}

.analytics-dashboard.active {
    display: block;
}

/* Analytics Header - Larger & Cleaner */
.analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 36px;
    padding: 28px 36px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.analytics-header h2 {
    margin: 0;
    font-size: 34px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.analytics-filters {
    display: flex;
    gap: 16px;
    align-items: center;
}

.analytics-filters select {
    padding: 12px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

.analytics-filters select:hover {
    border-color: #a8b5ff;
    box-shadow: 0 0 0 3px rgba(168, 181, 255, 0.1);
}

.analytics-filters button {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #a8b5ff 0%, #c5a3ff 100%);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(168, 181, 255, 0.3);
}

.analytics-filters button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(168, 181, 255, 0.4);
}

/* KPI Cards - Pastel Gradients & Larger Text */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 36px;
}

.kpi-card {
    background: white;
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.kpi-card:nth-child(1)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #a8e6cf 0%, #7fd8be 100%);
}

.kpi-card:nth-child(2)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #ffd3b6 0%, #ffaaa5 100%);
}

.kpi-card:nth-child(3)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #c5a3ff 0%, #a8b5ff 100%);
}

.kpi-card:nth-child(4)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #ff9a9e 0%, #fecfef 100%);
}

.kpi-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.kpi-icon {
    font-size: 42px;
    margin-bottom: 16px;
}

.kpi-label {
    font-size: 15px;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    font-weight: 600;
}

.kpi-value {
    font-size: 44px;
    font-weight: 800;
    color: #1a202c;
    margin-bottom: 10px;
}

.kpi-change {
    font-size: 15px;
    color: #718096;
    font-weight: 500;
}

.kpi-change.positive {
    color: #48bb78;
}

.kpi-change.negative {
    color: #f56565;
}

/* Chart Tabs - Glowing Active State */
.chart-tabs {
    background: white;
    border-radius: 16px;
    padding: 20px 28px;
    margin-bottom: 28px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.chart-tab {
    padding: 14px 24px;
    border: 2px solid transparent;
    border-radius: 12px;
    background: #f7fafc;
    color: #4a5568;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.chart-tab:hover {
    background: #edf2f7;
    color: #2d3748;
    transform: translateY(-2px);
}

.chart-tab.active {
    background: linear-gradient(135deg, #a8b5ff 0%, #c5a3ff 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 0 20px rgba(168, 181, 255, 0.6), 0 0 40px rgba(197, 163, 255, 0.4);
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(168, 181, 255, 0.6), 0 0 40px rgba(197, 163, 255, 0.4);
    }

    50% {
        box-shadow: 0 0 30px rgba(168, 181, 255, 0.8), 0 0 60px rgba(197, 163, 255, 0.6);
    }
}

/* Charts Grid - Larger Text */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 28px;
    margin-bottom: 36px;
}

.chart-card {
    background: white;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transition: all 0.3s;
}

.chart-card:hover {
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
}

.chart-card.hidden {
    display: none;
}

.chart-card h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1a202c;
    margin: 0 0 24px 0;
}

canvas {
    max-height: 360px;
}

/* Analytics Table */
.analytics-table-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.analytics-table-card h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #1a202c;
}

.analytics-table {
    width: 100%;
    border-collapse: collapse;
}

.analytics-table th,
.analytics-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.analytics-table th {
    background: #f7fafc;
    font-weight: 600;
    color: #4a5568;
}

.analytics-table tr:hover {
    background: #f7fafc;
}

/* Responsive */
@media (max-width: 768px) {
    .kanban-board {
        grid-template-columns: 1fr;
    }

    .detail-panel {
        width: 100%;
        right: -100%;
    }

    .quick-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Analytics Mobile Refinements */
    .analytics-dashboard {
        padding: 16px !important;
    }

    .analytics-header {
        flex-direction: column;
        padding: 20px;
        gap: 16px;
        text-align: center;
    }

    .analytics-header h2 {
        font-size: 24px;
    }

    .analytics-filters {
        flex-direction: column;
        width: 100%;
    }

    .analytics-filters select,
    .analytics-filters button {
        width: 100%;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .analytics-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .chart-tabs {
        padding: 12px;
        justify-content: center;
    }

    .chart-tab {
        padding: 10px 16px;
        font-size: 14px;
        flex: 1 1 calc(50% - 12px);
        min-width: 120px;
    }

    .analytics-table-card {
        padding: 16px;
        overflow-x: auto;
    }

    .analytics-table {
        min-width: 600px;
    }
}

@media (max-width: 480px) {
    .quick-stats {
        grid-template-columns: 1fr;
    }

    .chart-tab {
        flex: 1 1 100%;
    }
}

/* Modern Timeline Styles */
.timeline-header-actions {
    display: flex;
    gap: 8px;
}

.action-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #f1f5f9;
    color: #64748b;
}

.action-icon-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.action-icon-btn.call:hover {
    background: #ffe4e6;
    color: #e11d48;
}

.action-icon-btn.whatsapp:hover {
    background: #dcfce7;
    color: #16a34a;
}

.action-icon-btn.email:hover {
    background: #dbeafe;
    color: #2563eb;
}

.timeline {
    position: relative;
    padding-left: 10px;
}

.timeline-item {
    position: relative;
    padding-left: 35px;
    margin-bottom: 24px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 0;
    bottom: -24px;
    width: 2px;
    background: #e2e8f0;
}

.timeline-item:last-child::before {
    display: none;
}

.timeline-icon {
    position: absolute;
    left: 0;
    top: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: white;
    border: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.timeline-icon.call {
    color: #e11d48;
    border-color: #fecdd3;
}

.timeline-icon.whatsapp {
    color: #16a34a;
    border-color: #bbf7d0;
}

.timeline-icon.email {
    color: #2563eb;
    border-color: #bfdbfe;
}

.timeline-icon.stage_change {
    color: #8b5cf6;
    border-color: #ddd6fe;
}

.timeline-content {
    background: #f8fafc;
    padding: 12px 16px;
    border-radius: 12px;
    border-left: 3px solid #cbd5e1;
}

.timeline-content.call {
    border-left-color: #e11d48;
}

.timeline-content.whatsapp {
    border-left-color: #16a34a;
}

.timeline-content.email {
    border-left-color: #2563eb;
}

.timeline-content.stage_change {
    border-left-color: #8b5cf6;
}

.timeline-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.timeline-salesperson {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}


.timeline-title {
    font-weight: 700;
    color: #1e293b;
    font-size: 14px;
}

.timeline-time {
    font-size: 11px;
    color: #94a3b8;
}

.timeline-body {
    font-size: 13px;
    color: #475569;
    line-height: 1.5;
}

.timeline-next-f {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #e2e8f0;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #6366f1;
    font-weight: 600;
    font-size: 12px;
}

/* Custom Status Dropdown */
/* Custom Status Dropdown */
.status-dropdown {
    display: block;
    width: 100%;
    height: 48px;
    /* Fixed height for robust touch target */
    padding: 0 16px;
    margin-top: 12px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' d='M0 0h24v24H0z'/%3E%3Cpath d='M12 13.172l4.95-4.95 1.414 1.414L12 16 5.636 9.636 7.05 8.222z' fill='%2364748b'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.status-dropdown:hover {
    background-color: #e2e8f0;
    border-color: #94a3b8;
}

.status-dropdown:focus {
    outline: none;
    background-color: #ffffff;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Attempt to style options */
.status-dropdown option {
    padding: 12px;
    font-size: 15px;
    color: #334155;
}

/* Comprehensive Mobile Optimization */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .dashboard-header {
        padding: 16px;
        margin-bottom: 16px;
        border-radius: 12px;
    }

    .header-top {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .header-top h1 {
        font-size: 22px;
        justify-content: space-between;
    }

    .view-toggle {
        display: flex;
        width: 100%;
    }

    .view-toggle button {
        flex: 1;
        padding: 10px;
        font-size: 14px;
    }

    .filters {
        flex-direction: column;
        gap: 10px;
    }

    .search-box,
    .search-box input,
    select {
        width: 100%;
    }

    .quick-stats {
        grid-template-columns: 1fr 1fr;
        /* 2 columns on mobile */
        gap: 10px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card .label {
        font-size: 12px;
        margin-bottom: 4px;
    }

    .stat-card .value {
        font-size: 24px;
    }

    /* Kanban Mobile Tweaks */
    .kanban-column {
        padding: 12px;
        border-radius: 12px;
    }

    .column-header {
        margin-bottom: 16px;
    }

    .cards-container {
        gap: 12px;
    }

    .lead-card {
        flex: 0 0 280px;
        /* Better fit for small screens */
        padding: 12px;
    }

    /* Dropdown Mobile Tweaks */
    .status-dropdown {
        font-size: 16px;
        /* Reset for iOS zoom prevention */
        height: 52px;
        /* Very comfortable touch target */
        margin-top: 10px;
    }
}

/* FORCE PRIORITY COLORS - AUTO-INJECTED */
.lead-card[data-priority="High"] {
    background-color: #fee2e2 !important;
    border-left-color: #ef4444 !important;
}

.lead-card[data-priority="High"] .priority-badge {
    background: #ef4444 !important;
    color: white !important;
}

.lead-card[data-priority="Medium"] {
    background-color: #ffedd5 !important;
    border-left-color: #f97316 !important;
}

.lead-card[data-priority="Medium"] .priority-badge {
    background: #f97316 !important;
    color: white !important;
}

.lead-card[data-priority="Low"] {
    background-color: #f0fdf4 !important;
    border-left-color: #22c55e !important;
}

.lead-card[data-priority="Low"] .priority-badge {
    background: #22c55e !important;
    color: white !important;
}

/* Ensure text visibility */
.lead-card h4,
.lead-card p {
    color: #1f2937 !important;
}

/* Responsive Trash View */
.trash-card {
    flex: 0 0 320px;
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    #cards-trash {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .trash-card {
        flex: unset !important;
        width: 100% !important;
        max-width: none !important;
    }
}