:root {
    --primary: #d62828;
    --secondary: #457b9d;
    --success: #2a9d8f;
    --danger: #e63946;
    --info: #457b9d;
    --bg: #f8f9fa;
    --card-bg: #ffffff;
    --border: #dee2e6;
    --text: #212529;
    --muted: #6c757d;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }

/* Navbar */
.navbar {
    background: var(--primary);
    color: white;
    padding: 0.8rem 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.nav-brand { font-size: 1.2rem; font-weight: 700; }
.nav-links { display: flex; gap: 1.5rem; }
.nav-links a { color: rgba(255,255,255,0.9); text-decoration: none; font-size: 0.95rem; }
.nav-links a:hover { color: white; }

/* Container */
.container { max-width: 1280px; margin: 2rem auto; padding: 0 1.5rem; }

h1 { font-size: 1.8rem; margin-bottom: 1.5rem; color: var(--text); }
h2 { font-size: 1.2rem; margin-bottom: 1rem; color: var(--text); }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; padding: 1.2rem; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.stat-number { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.85rem; color: var(--muted); margin-top: 0.3rem; }

/* Last run */
.last-run { background: var(--card-bg); border: 1px solid var(--border); border-radius: 6px; padding: 0.8rem 1rem; margin-bottom: 1.5rem; font-size: 0.9rem; color: var(--muted); }

/* Buttons */
.actions { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.btn { padding: 0.55rem 1.1rem; border: none; border-radius: 6px; cursor: pointer; font-size: 0.9rem; font-weight: 500; text-decoration: none; display: inline-flex; align-items: center; gap: 0.3rem; transition: opacity 0.15s; }
.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-secondary { background: var(--secondary); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-info { background: var(--info); color: white; }

.btn-sm { padding: 0.25rem 0.6rem; border: none; border-radius: 4px; cursor: pointer; font-size: 0.8rem; font-weight: 500; text-decoration: none; }
.btn-sm.btn-success { background: var(--success); color: white; }
.btn-sm.btn-danger { background: var(--danger); color: white; }
.btn-sm.btn-info { background: var(--info); color: white; }

/* Alerts */
.alert { padding: 0.8rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* Filters */
.filters { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters select, .filters input { padding: 0.45rem 0.7rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem; background: white; }

/* Bulk actions */
.bulk-actions { display: flex; align-items: center; gap: 0.8rem; padding: 0.6rem 1rem; background: #fff3cd; border: 1px solid #ffc107; border-radius: 6px; margin-bottom: 1rem; }

/* Table */
.table-wrapper { overflow-x: auto; }
.leads-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.07); }
.leads-table th { background: #f1f3f5; padding: 0.7rem 0.8rem; text-align: left; font-weight: 600; color: var(--muted); border-bottom: 2px solid var(--border); white-space: nowrap; }
.leads-table td { padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.leads-table tr:last-child td { border-bottom: none; }
.leads-table tr:hover { background: #f8f9fa; }
.row-rejected { opacity: 0.5; }

/* Badges */
.badge { display: inline-block; padding: 0.15rem 0.5rem; background: #e9ecef; border-radius: 20px; font-size: 0.78rem; font-weight: 600; }
.status-badge { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 20px; font-size: 0.78rem; font-weight: 600; }
.status-qualified { background: #d4edda; color: #155724; }
.status-pending { background: #fff3cd; color: #856404; }
.status-rejected { background: #f8d7da; color: #721c24; }
.outreach-none { background: #e9ecef; color: #495057; }
.outreach-queued { background: #cce5ff; color: #004085; }
.outreach-sent { background: #d4edda; color: #155724; }
.outreach-replied { background: #d1ecf1; color: #0c5460; }

/* Score */
.score { font-weight: 700; }
.score-high { color: var(--success); }
.score-mid { color: #e07b00; }
.score-low { color: var(--danger); }

/* Detail page */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 768px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-section { background: white; border: 1px solid var(--border); border-radius: 8px; padding: 1.2rem; }
.detail-table { width: 100%; }
.detail-table th { width: 35%; text-align: left; font-weight: 600; color: var(--muted); padding: 0.4rem 0; font-size: 0.88rem; }
.detail-table td { padding: 0.4rem 0; font-size: 0.9rem; }

/* Email preview */
.email-preview { background: #f8f9fa; border: 1px solid var(--border); border-radius: 6px; padding: 1rem; }
.email-subject { margin-bottom: 0.8rem; font-size: 0.95rem; }
.email-body pre { white-space: pre-wrap; font-family: inherit; font-size: 0.9rem; color: var(--text); }

/* Outreach log */
.log-entry { padding: 0.7rem; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 0.5rem; font-size: 0.88rem; background: white; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-content { background: white; border-radius: 10px; padding: 2rem; max-width: 480px; width: 90%; }
.modal-content h2 { margin-bottom: 1rem; }
.modal-content label { display: block; font-weight: 600; margin-bottom: 0.3rem; margin-top: 0.8rem; font-size: 0.9rem; }
.modal-content textarea, .modal-content input[type=number], .modal-content input[type=text] { width: 100%; padding: 0.5rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem; }
