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

:root {
    --bg: #0a0a0f;
    --surface: #12121a;
    --surface-hover: #181824;
    --border: #1e1e2e;
    --text: #e4e4e7;
    --muted: #71717a;
    --accent: #22d3ee;
    --accent-dim: rgba(34, 211, 238, 0.08);
    --warm: #f59e0b;
    --green: #22c55e;
    --green-dim: rgba(34, 197, 94, 0.1);
    --red: #ef4444;
    --red-dim: rgba(239, 68, 68, 0.1);
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; line-height: 1.15; }

/* LAYOUT */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 240px; background: var(--surface); border-right: 1px solid var(--border);
    padding: 1.5rem; display: flex; flex-direction: column; position: fixed;
    height: 100vh; z-index: 50;
}
.sidebar-logo { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1.3rem; letter-spacing: -0.03em; margin-bottom: 2rem; cursor: pointer; }
.sidebar-logo span { color: var(--accent); }
.sidebar-nav { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.sidebar-link {
    padding: 0.6rem 0.75rem; border-radius: 8px; color: var(--muted);
    cursor: pointer; font-size: 0.9rem; display: flex; align-items: center; gap: 0.75rem;
    transition: all 0.15s; text-decoration: none;
}
.sidebar-link:hover { background: var(--accent-dim); color: var(--text); }
.sidebar-link.active { background: var(--accent-dim); color: var(--accent); }
.sidebar-link .icon { width: 18px; text-align: center; }
.sidebar-footer { border-top: 1px solid var(--border); padding-top: 1rem; margin-top: 1rem; }
.sidebar-user { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.5rem; overflow: hidden; text-overflow: ellipsis; }
.sidebar-logout { font-size: 0.8rem; color: var(--red); cursor: pointer; background: none; border: none; padding: 0.4rem 0; }
.sidebar-logout:hover { text-decoration: underline; }

.main-content { margin-left: 240px; flex: 1; padding: 2rem; max-width: 1000px; }

/* AUTH PAGE */
.auth-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 2rem;
}
.auth-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 16px; padding: 2.5rem; width: 100%; max-width: 420px;
}
.auth-card h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
.auth-card p { color: var(--muted); margin-bottom: 2rem; }
.auth-card .logo-big { font-size: 2rem; margin-bottom: 1.5rem; }
.auth-card .logo-big span { color: var(--accent); }

/* ONBOARDING */
.onboarding-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 2rem;
}
.onboarding-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 16px; padding: 2.5rem; width: 100%; max-width: 600px;
}
.onboarding-card h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
.onboarding-card > p { color: var(--muted); margin-bottom: 2rem; }
.step-indicator { display: flex; gap: 0.5rem; margin-bottom: 2rem; }
.step-dot {
    height: 4px; flex: 1; border-radius: 2px; background: var(--border);
    transition: background 0.3s;
}
.step-dot.active { background: var(--accent); }
.step-dot.done { background: var(--green); }

/* FORMS */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.4rem; color: var(--text); }
.form-group .hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.3rem; }
input[type="text"], input[type="email"], textarea, select {
    width: 100%; padding: 0.7rem 0.9rem; border-radius: 8px;
    background: var(--bg); border: 1px solid var(--border); color: var(--text);
    font-family: 'DM Sans', sans-serif; font-size: 0.95rem;
    transition: border-color 0.2s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }
select { cursor: pointer; }
select option { background: var(--bg); color: var(--text); }

.btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.7rem 1.5rem; border-radius: 8px; font-weight: 600;
    font-size: 0.9rem; cursor: pointer; border: none;
    transition: all 0.2s; font-family: 'DM Sans', sans-serif;
}
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { box-shadow: 0 4px 20px rgba(34, 211, 238, 0.3); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--muted); }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; }
.btn-ghost { background: none; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }
.btn-success { background: var(--green-dim); color: var(--green); border: 1px solid rgba(34, 197, 94, 0.3); }
.btn-success:hover { background: rgba(34, 197, 94, 0.2); }
.btn-danger { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239, 68, 68, 0.3); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }
.btn-accent { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(34, 211, 238, 0.3); }
.btn-accent:hover { background: rgba(34, 211, 238, 0.15); }

.btn-row { display: flex; gap: 0.75rem; margin-top: 1.5rem; }

/* DASHBOARD */
.page-title { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 0.5rem; }
.page-subtitle { color: var(--muted); margin-bottom: 2rem; }

.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem; margin-bottom: 2rem;
}
.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 1.25rem;
}
.stat-label { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.3rem; }
.stat-value { font-family: 'Space Grotesk', sans-serif; font-size: 1.8rem; font-weight: 700; }
.stat-accent { color: var(--accent); }
.stat-green { color: var(--green); }
.stat-warm { color: var(--warm); }

/* CAMPAIGN LIST */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.section-header h2 { font-size: 1.3rem; }

.campaign-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 1.25rem; margin-bottom: 0.75rem;
    cursor: pointer; transition: all 0.2s;
}
.campaign-card:hover { border-color: rgba(34, 211, 238, 0.3); transform: translateY(-1px); }
.campaign-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.campaign-name { font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 1.05rem; }
.campaign-status {
    font-size: 0.75rem; padding: 0.2rem 0.6rem; border-radius: 100px;
    font-weight: 500;
}
.status-generating { background: rgba(245, 158, 11, 0.1); color: var(--warm); border: 1px solid rgba(245, 158, 11, 0.3); }
.status-ready { background: var(--green-dim); color: var(--green); border: 1px solid rgba(34, 197, 94, 0.3); }
.status-draft { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(34, 211, 238, 0.3); }
.status-error { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239, 68, 68, 0.3); }
.campaign-meta { display: flex; gap: 1.5rem; font-size: 0.85rem; color: var(--muted); }

/* CAMPAIGN DETAIL */
.back-link { color: var(--muted); font-size: 0.85rem; cursor: pointer; margin-bottom: 1.5rem; display: inline-block; }
.back-link:hover { color: var(--accent); }

.prospect-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 1.5rem; margin-bottom: 1rem;
    transition: all 0.2s;
}
.prospect-card:hover { border-color: rgba(34, 211, 238, 0.15); }
.prospect-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.75rem; }
.prospect-info h3 { font-size: 1rem; margin-bottom: 0.15rem; }
.prospect-info .company { color: var(--muted); font-size: 0.9rem; }
.prospect-info .title { color: var(--muted); font-size: 0.8rem; }
.relevance-badge {
    font-size: 0.75rem; padding: 0.2rem 0.6rem; border-radius: 6px;
    background: var(--accent-dim); color: var(--accent); font-weight: 500;
}
.prospect-research { font-size: 0.9rem; color: var(--muted); margin-bottom: 1rem; padding: 0.75rem; background: var(--bg); border-radius: 8px; }
.email-content { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.email-subject { font-family: 'Space Grotesk', sans-serif; font-size: 0.95rem; font-weight: 600; margin-bottom: 0.75rem; }
.email-body { font-size: 0.9rem; color: var(--muted); line-height: 1.7; white-space: pre-wrap; }
.email-status-bar { display: flex; gap: 0.5rem; margin-top: 1rem; align-items: center; flex-wrap: wrap; }
.email-status-badge {
    font-size: 0.75rem; padding: 0.15rem 0.5rem; border-radius: 4px;
    font-weight: 500;
}

/* NEW CAMPAIGN MODAL */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.7);
    display: flex; align-items: center; justify-content: center;
    z-index: 200; padding: 2rem;
}
.modal {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 16px; padding: 2rem; width: 100%; max-width: 500px;
}
.modal h2 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.modal > p { color: var(--muted); font-size: 0.9rem; margin-bottom: 1.5rem; }

/* EDIT MODAL */
.edit-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.7);
    display: flex; align-items: center; justify-content: center;
    z-index: 200; padding: 2rem;
}
.edit-modal {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 16px; padding: 2rem; width: 100%; max-width: 600px;
}
.edit-modal h2 { font-size: 1.2rem; margin-bottom: 1.5rem; }
.edit-modal textarea { min-height: 150px; }

/* EMPTY STATE */
.empty-state {
    text-align: center; padding: 4rem 2rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 16px;
}
.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.empty-state p { color: var(--muted); margin-bottom: 1.5rem; }

/* LOADING */
.loading { text-align: center; padding: 3rem; color: var(--muted); }
.spinner { display: inline-block; width: 24px; height: 24px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin-right: 0.5rem; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* GENERATING STATE */
.generating-card {
    background: var(--surface); border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 16px; padding: 2rem; text-align: center;
}
.generating-card .spinner-large { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--warm); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 1rem; }
.generating-card h3 { color: var(--warm); margin-bottom: 0.5rem; }
.generating-card p { color: var(--muted); font-size: 0.9rem; }

/* TOAST */
.toast {
    position: fixed; bottom: 2rem; right: 2rem; z-index: 300;
    background: var(--surface); border: 1px solid var(--green);
    color: var(--green); padding: 0.75rem 1.5rem; border-radius: 10px;
    font-size: 0.9rem; font-weight: 500;
    animation: slideUp 0.3s ease;
}
.toast.error { border-color: var(--red); color: var(--red); }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* MAGIC LINK SUCCESS */
.magic-link-box {
    background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
    padding: 1rem; margin-top: 1rem; word-break: break-all;
}
.magic-link-box a { color: var(--accent); text-decoration: none; font-size: 0.85rem; }
.magic-link-box a:hover { text-decoration: underline; }
.magic-link-box .hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.5rem; }

/* RESPONSIVE */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding: 1.5rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .mobile-nav {
        position: fixed; top: 0; width: 100%; z-index: 50;
        padding: 1rem; background: var(--surface); border-bottom: 1px solid var(--border);
        display: flex; justify-content: space-between; align-items: center;
    }
    .main-content { padding-top: 4rem; }
}
