@import url('https://fonts.googleapis.com/css2?family=Segoe+UI:wght@400;600;700&display=swap');

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --text-dark: #1a1a2e;
    --text-light: #f8f8f8;
    --border-radius: 16px;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--primary-gradient);
    min-height: 100vh;
}

body.front-standalone {
    min-height: 100vh;
    background: var(--primary-gradient);
    display: flex;
    justify-content: center;
    padding: 60px 24px;
}

body.front-standalone .fragment-standalone-wrapper {
    width: min(1100px, 100%);
}

body:not(.front-standalone) .fragment-standalone-wrapper {
    width: 100%;
}

.hidden {
    display: none !important;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    padding: 80px 0 100px;
    transition: transform 0.3s ease;
    z-index: 1000;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    transform: translateX(-280px);
}

.sidebar.collapsed .sidebar-toggle {
    display: none;
}

.sidebar-header {
    text-align: center;
    padding: 0 25px 30px;
    margin-top: -60px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    display: block;
    width: 60px;
    margin: 0 auto 20px;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

.sidebar-header h2 {
    font-size: 24px;
    margin-bottom: 5px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.sidebar-header p {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.sidebar-menu {
    margin-top: 30px;
    flex: 1;
    overflow-y: auto;
}

.menu-item {
    padding: 15px 25px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 15px;
    color: rgba(255, 255, 255, 0.8);
    border-left: 3px solid transparent;
}

.menu-item:hover,
.menu-item.active {
    background: rgba(102, 126, 234, 0.2);
    color: white;
    border-left-color: #667eea;
}

.menu-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px 0;
    background: rgba(0, 0, 0, 0.2);
}

.menu-item-logout {
    color: rgba(255, 200, 200, 0.9);
}

.menu-item-logout:hover {
    background: rgba(244, 67, 54, 0.2);
    color: #ff6b6b;
    border-left-color: #f44336;
}

.sidebar-toggle,
.floating-toggle {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: white;
    font-size: 20px;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.sidebar-toggle {
    position: absolute;
    right: -18px;
    top: 30px;
    font-size: 16px;
}

.floating-toggle {
    position: fixed;
    left: 5px;
    top: 15px;
    display: none;
    border-color: rgba(255, 255, 255, 0.9);
    background: transparent;
    backdrop-filter: blur(10px);
}

.floating-toggle:hover,
.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.floating-toggle:active,
.sidebar-toggle:active {
    transform: scale(0.9);
}

.sidebar.collapsed ~ .main-content .floating-toggle {
    display: flex;
}

/* Main Content */
.main-content {
    margin-left: 280px;
    padding: 30px;
    transition: margin-left 0.3s ease;
    min-height: 100vh;
}

.sidebar.collapsed ~ .main-content {
    margin-left: 0;
}

.dashboard-module {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    background: white;
    padding: 28px 32px;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
}

.dashboard-heading {
    max-width: 620px;
}

.section-eyebrow {
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--primary-color);
    margin-bottom: 6px;
}

.dashboard-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.dashboard-subtitle {
    color: #555;
    font-size: 15px;
    line-height: 1.6;
}

.dashboard-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.btn-icon {
    font-size: 18px;
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.stat-card-header .stat-label {
    font-size: 14px;
    font-weight: 600;
    color: #555;
    margin-bottom: 0;
}

.stat-card-header .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: rgba(102, 126, 234, 0.12);
    color: var(--primary-color);
}

.stat-helper {
    font-size: 12px;
    color: #888;
    letter-spacing: 0.02em;
}

.card-subtitle {
    margin-top: 6px;
    color: #616161;
    font-size: 14px;
    max-width: 580px;
}

.table-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.table-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.table-summary {
    font-weight: 600;
    color: var(--text-dark);
}

.table-helper {
    font-size: 13px;
    color: #757575;
    margin-top: 6px;
}

.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 14px 18px;
}

/* Cards & Stats */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    margin-top: 10px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.stat-label {
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.content-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--card-shadow);
    margin-bottom: 30px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.card-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
}

.card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* Filters */
.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

.filter-input,
.filter-select,
.form-input,
.form-textarea {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    background: white;
    font-family: inherit;
}

.filter-input:focus,
.filter-select:focus,
.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-actions {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #555;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-danger {
    background: #f44336;
    color: #fff;
}

.btn-danger:hover {
    background: #e53935;
}

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

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #f5f6fa;
    border: 1px solid #d6d9e6;
    color: #333;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-icon:hover,
.btn-icon.active {
    background: #ebedf5;
    border-color: #c3c7da;
}

.actions-menu {
    position: relative;
    display: inline-flex;
}

.actions-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    box-shadow: 0 14px 32px -8px rgba(15, 23, 42, 0.25);
    min-width: 180px;
    padding: 6px 0;
    z-index: 50;
    display: none;
}

.actions-dropdown.show {
    display: block;
}

.actions-dropdown button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: transparent;
    border: none;
    font-size: 14px;
    color: #1f2937;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.actions-dropdown button:hover {
    background: rgba(99, 102, 241, 0.08);
    color: #4338ca;
}

.actions-dropdown button .icon {
    width: 18px;
    text-align: center;
    font-size: 16px;
    color: #4b5563;
}

.actions-dropdown button.delete-action {
    color: #d32f2f;
}

.actions-dropdown button.delete-action .icon {
    color: #d32f2f;
}

.btn-large {
    padding: 14px 32px;
    font-size: 16px;
}

/* Table */
.table-container {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

thead {
    background: var(--primary-gradient);
}

th,
td {
    padding: 14px 16px;
    font-size: 14px;
}

.col-last-sent {
    min-width: 160px;
    white-space: nowrap;
}

.col-campaign {
    min-width: 150px;
    white-space: nowrap;
}

.col-actions {
    min-width: 120px;
}
th {
    text-align: left;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    border-bottom: 1px solid #f0f0f0;
    color: #333;
}

tbody tr:hover {
    background: #f8f9fa;
}

.checkbox-cell {
    text-align: center;
}

.checkbox-cell input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.owner-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(102, 126, 234, 0.12);
    color: #3843a4;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 12px;
}

.owner-empty {
    color: #999;
    font-style: italic;
}

.actions-menu {
    position: relative;
    display: inline-flex;
}

.actions-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    box-shadow: 0 14px 32px -8px rgba(15, 23, 42, 0.25);
    min-width: 180px;
    padding: 6px 0;
    z-index: 50;
    display: none;
}

.actions-dropdown.show {
    display: block;
}

.actions-dropdown button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: transparent;
    border: none;
    font-size: 14px;
    color: #1f2937;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.actions-dropdown button:hover {
    background: rgba(99, 102, 241, 0.08);
    color: #4338ca;
}

.actions-dropdown button .icon {
    width: 18px;
    text-align: center;
    font-size: 16px;
    color: #4b5563;
}

.actions-dropdown button.delete-action {
    color: #d32f2f;
}

.actions-dropdown button.delete-action .icon {
    color: #d32f2f;
}

.actions-cell {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-sent {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-bounced {
    background: #ffebee;
    color: #c62828;
}

.status-failed {
    background: #fff3e0;
    color: #ef6c00;
}

.status-not-sent {
    background: #f5f5f5;
    color: #757575;
}

/* Loading & Results */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.result-box {
    margin-top: 20px;
    padding: 20px;
    border-radius: 10px;
    font-weight: 500;
}

.result-success {
    background: #e8f5e9;
    border: 2px solid #4caf50;
    color: #2e7d32;
}

.result-error {
    background: #ffebee;
    border: 2px solid #f44336;
    color: #c62828;
}

.info-box {
    background: #e3f2fd;
    border: 2px solid #2196f3;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
}

.selected-leads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.selected-lead-chip {
    background: #f0f0f0;
    padding: 10px 12px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.selected-lead-chip .remove-btn {
    cursor: pointer;
    color: #f44336;
    font-weight: bold;
    margin-left: 10px;
}

.progress-bar {
    background: #f0f0f0;
    border-radius: 8px;
    height: 30px;
    margin: 20px 0;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    height: 100%;
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

/* Form sections */
.form-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}

.form-textarea {
    font-family: 'Courier New', monospace;
    resize: vertical;
}

.lead-info-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid var(--primary-color);
    margin-top: 15px;
}

.lead-info-card h4 {
    color: var(--primary-color);
    margin-bottom: 12px;
}

.lead-info-item {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.lead-info-label {
    font-weight: 600;
    color: #666;
    width: 160px;
}

.lead-info-value {
    color: #333;
}

.attachments-box {
    border: 2px dashed #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    background: white;
    max-height: 200px;
    overflow-y: auto;
}

.attachment-item {
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.attachment-item:hover {
    background: #f5f5f5;
}

.attachment-item input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Import/Export Preview Cards */
.preview-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.preview-stat-card {
    text-align: center;
    padding: 20px;
    border-radius: 8px;
}

.preview-stat-total {
    background: #e3f2fd;
    border: 2px solid #2196f3;
}

.preview-stat-valid {
    background: #e8f5e9;
    border: 2px solid #4caf50;
}

.preview-stat-invalid {
    background: #ffebee;
    border: 2px solid #f44336;
}

.preview-stat-number {
    font-size: 36px;
    font-weight: bold;
    margin-bottom: 8px;
}

.preview-stat-label {
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
}

.preview-table {
    max-height: 400px;
    overflow-y: auto;
    margin: 20px 0;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
}

.row-valid {
    background: #f1f8f4;
}

.row-invalid {
    background: #fef1f2;
}

.error-cell {
    color: #c62828;
    font-size: 12px;
}

.helper-text {
    font-size: 13px;
    color: #666;
    margin-bottom: 12px;
    line-height: 1.5;
}

.helper-text strong {
    color: #3843a4;
}

.text-center { text-align: center; }
.text-success { color: #2e7d32; }
.text-danger { color: #c62828; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
    }

    .stats-container {
        grid-template-columns: 1fr;
    }

    .filters,
    .form-grid {
        grid-template-columns: 1fr;
    }
}

* {
    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;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    padding: 30px 0;
    padding-top: 80px;
    transition: transform 0.3s ease;
    z-index: 1000;
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
}

.sidebar.collapsed {
    transform: translateX(-280px);
}

.sidebar.collapsed .sidebar-toggle {
    display: none;
}

.sidebar-header {
    text-align: center;
    padding: 0 25px 30px;
    margin-top: -60px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    display: block;
    width: 60px;
    max-width: 100%;
    margin: 0 auto 20px;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
}

.sidebar-header h2 {
    font-size: 24px;
    margin-bottom: 5px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.sidebar-header p {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
}

.sidebar-menu {
    margin-top: 30px;
}

.menu-item {
    padding: 15px 25px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 15px;
    color: rgba(255,255,255,0.8);
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: rgba(102, 126, 234, 0.2);
    color: white;
    border-left-color: #667eea;
}

.menu-item.active {
    background: rgba(102, 126, 234, 0.3);
    color: white;
    border-left-color: #667eea;
}

.menu-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

/* Toggle Button */
.sidebar-toggle {
    position: absolute;
    right: -18px;
    top: 30px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 16px;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.sidebar-toggle:active {
    transform: scale(0.9);
}

/* Floating toggle when sidebar collapsed */
.floating-toggle {
    position: fixed;
    left: 5px;
    top: 15px;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    color: white;
    font-size: 20px;
    cursor: pointer;
    z-index: 999;
    transition: all 0.3s ease;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.floating-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: white;
    transform: scale(1.05);
}

.sidebar.collapsed ~ .main-content .floating-toggle {
    display: flex;
}

/* Main Content */
.main-content {
    margin-left: 280px;
    padding: 30px;
    transition: margin-left 0.3s ease;
    min-height: 100vh;
}

.sidebar.collapsed ~ .main-content {
    margin-left: 0;
}

/* Stats Cards */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    margin-top: 10px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.stat-label {
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 5px;
}

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Content Card */
.content-card {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.card-title {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a2e;
}

/* Filters */
.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

.filter-input, .filter-select {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    background: white;
}

.filter-input:focus, .filter-select:focus {
    outline: none;
    border-color: #667eea;
}

.filter-actions {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #555;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-danger {
    background: #f44336;
    color: #fff;
}

.btn-danger:hover {
    background: #e53935;
}

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

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #f5f6fa;
    border: 1px solid #d6d9e6;
    color: #333;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-icon:hover,
.btn-icon.active {
    background: #ebedf5;
    border-color: #c3c7da;
}

/* Table */
.table-container {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

th {
    padding: 16px;
    text-align: left;
    color: white;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #333;
}

tbody tr {
    transition: background 0.2s;
}

tbody tr:hover {
    background: #f8f9fa;
}

.owner-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(102, 126, 234, 0.12);
    color: #3843a4;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 12px;
}

.owner-empty {
    color: #999;
    font-style: italic;
}

.actions-cell {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Assign Owner Modal */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.modal.show {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    padding: 28px 32px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.18);
    width: min(420px, 92vw);
    z-index: 1;
}

.modal-content h3 {
    margin-bottom: 12px;
    font-size: 22px;
    color: #1a1a2e;
}

.modal-content p {
    margin-bottom: 18px;
    color: #555;
    font-size: 14px;
}

.modal-checkbox {
    margin-top: 12px;
}

.modal-checkbox .checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: #333;
}

.modal-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    cursor: pointer;
}

.modal-checkbox .checkbox-hint {
    margin: 8px 0 0;
    font-size: 12px;
    color: #666;
    line-height: 1.5;
}

.modal-content.modal-wide {
    width: min(540px, 95vw);
}

.modal-sections {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-section h4 {
    margin-bottom: 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
}

.modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.modal-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-field label {
    font-size: 13px;
    font-weight: 600;
    color: #52525b;
}

.modal-field input {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
}

.modal-field input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.modal-text {
    color: #4b5563;
    font-size: 14px;
}

.modal-actions.single-button {
    justify-content: flex-end;
}

#leadDetailsBody {
    margin-top: 12px;
}

.modal-actions {
    margin-top: 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #333;
}

.owner-select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #ccc;
    font-size: 14px;
}

.owner-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-sent {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-bounced {
    background: #ffebee;
    color: #c62828;
}

.status-failed {
    background: #fff3e0;
    color: #ef6c00;
}

.status-not-sent {
    background: #f5f5f5;
    color: #757575;
}

/* Loading */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Form Styles */
.form-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}

.form-input, .form-textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    font-family: inherit;
}

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

.form-textarea {
    font-family: 'Courier New', monospace;
    resize: vertical;
}

.lead-info-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #667eea;
    margin-top: 15px;
}

.lead-info-card h4 {
    color: #667eea;
    margin-bottom: 12px;
}

.lead-info-item {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.lead-info-label {
    font-weight: 600;
    color: #666;
    width: 140px;
}

.lead-info-value {
    color: #333;
}

.attachments-box {
    border: 2px dashed #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    background: white;
    max-height: 200px;
    overflow-y: auto;
}

.attachment-item {
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.attachment-item:hover {
    background: #f5f5f5;
}

.attachment-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.btn-large {
    padding: 14px 32px;
    font-size: 16px;
}

.result-box {
    margin-top: 20px;
    padding: 20px;
    border-radius: 10px;
    font-weight: 500;
}

.result-success {
    background: #e8f5e9;
    border: 2px solid #4caf50;
    color: #2e7d32;
}

.result-error {
    background: #ffebee;
    border: 2px solid #f44336;
    color: #c62828;
}

.info-box {
    background: #e3f2fd;
    border: 2px solid #2196f3;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
}

.info-box p {
    margin: 8px 0;
    font-size: 14px;
}

.selected-leads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.selected-lead-chip {
    background: #f0f0f0;
    padding: 10px 12px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.selected-lead-chip .remove-btn {
    cursor: pointer;
    color: #f44336;
    font-weight: bold;
    margin-left: 10px;
}

.progress-bar {
    background: #f0f0f0;
    border-radius: 8px;
    height: 30px;
    margin: 20px 0;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    height: 100%;
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.checkbox-cell {
    text-align: center;
}

.checkbox-cell input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.preview-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.preview-stat-card {
    text-align: center;
    padding: 20px;
    border-radius: 8px;
}

.preview-stat-total {
    background: #e3f2fd;
    border: 2px solid #2196f3;
}

.preview-stat-valid {
    background: #e8f5e9;
    border: 2px solid #4caf50;
}

.preview-stat-invalid {
    background: #ffebee;
    border: 2px solid #f44336;
}

.preview-stat-number {
    font-size: 36px;
    font-weight: bold;
    margin-bottom: 8px;
}

.preview-stat-label {
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
}

.preview-table {
    max-height: 400px;
    overflow-y: auto;
    margin: 20px 0;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
}

.row-valid {
    background: #f1f8f4;
}

.row-invalid {
    background: #fef1f2;
}

.error-cell {
    color: #c62828;
    font-size: 12px;
}

.helper-text {
    font-size: 13px;
    color: #666;
    margin-bottom: 12px;
    line-height: 1.5;
}

.helper-text strong {
    color: #3843a4;
}

/* Utility */
.text-center { text-align: center; }
.text-success { color: #2e7d32; }
.text-danger { color: #c62828; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
    }
    .sidebar.collapsed {
        transform: translateX(-100%);
    }
    .main-content {
        margin-left: 0;
    }
    .stats-container {
        grid-template-columns: 1fr;
    }
}

/* Login Page Styles */
.login-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--primary-gradient);
}

.login-container {
    width: 100%;
    max-width: 450px;
}

.login-box {
    background: white;
    border-radius: var(--border-radius);
    padding: 40px;
    box-shadow: var(--card-shadow);
    animation: fadeInUp 0.5s ease;
}

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

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    display: block;
    object-fit: contain;
}

.login-header h2 {
    font-size: 28px;
    margin-bottom: 8px;
    background: var(--primary-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

.login-form {
    margin-top: 30px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: var(--transition);
    font-family: inherit;
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.login-error {
    background: #ffebee;
    color: #c62828;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    border: 1px solid #ffcdd2;
}

.btn-login {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    margin-top: 10px;
}

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