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

:root {
    --iron: #1a1a2e;
    --steel: #16213e;
    --forge: #e94560;
    --spark: #ff6b6b;
    --glow: #ffd93d;
    --light: #f5f5f7;
    --muted: #8892a4;
    --card-bg: rgba(255,255,255,0.04);
    --card-border: rgba(255,255,255,0.08);
    --input-bg: rgba(255,255,255,0.06);
    --success: #10b981;
    --warning: #f59e0b;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--iron);
    color: var(--light);
    overflow-x: hidden;
    min-height: 100vh;
}

/* ─── Typography ─── */
h1 { font-size: 2.5rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
h2 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 16px; }
h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 12px; }
p { line-height: 1.6; }

.text-muted { color: var(--muted); }
.text-gradient {
    background: linear-gradient(135deg, var(--forge), var(--glow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ─── Navigation ─── */
.nav, .app-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(26,26,46,0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--card-border);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    font-weight: 700;
}

.logo-icon { font-size: 1.5rem; }

.app-nav-links {
    display: flex;
    gap: 4px;
}

.nav-link {
    background: none;
    border: none;
    color: var(--muted);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-link:hover { color: var(--light); background: var(--card-bg); }
.nav-link.active { color: var(--light); background: rgba(233,69,96,0.15); }

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 14px;
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--forge);
    color: white;
}
.btn-primary:hover {
    background: #d63b54;
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(233,69,96,0.3);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--light);
    border: 1px solid var(--card-border);
}
.btn-secondary:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
}
.btn-ghost:hover { color: var(--light); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }

.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: 12px; }
.btn-full { width: 100%; justify-content: center; }

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ─── Hero Section ─── */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 80px 24px;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(233,69,96,0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: -20%;
    left: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255,217,61,0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.hero-inner {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.badge {
    display: inline-block;
    padding: 6px 16px;
    border: 1px solid rgba(233,69,96,0.4);
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    color: var(--forge);
    letter-spacing: 0.5px;
    margin-bottom: 32px;
    background: rgba(233,69,96,0.08);
}

.hero h1 {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    margin-bottom: 24px;
}

.hero-sub {
    font-size: 1.15rem;
    color: var(--muted);
    max-width: 600px;
    margin-bottom: 40px;
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    gap: 16px;
    margin-bottom: 60px;
    flex-wrap: wrap;
}

.hero-stats {
    display: flex;
    gap: 48px;
}

.stat { display: flex; flex-direction: column; }
.stat-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'DM Mono', monospace;
    color: var(--forge);
}
.stat-label {
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
}

/* ─── Features Section ─── */
.features-section {
    padding: 100px 24px;
    background: linear-gradient(180deg, var(--iron) 0%, var(--steel) 100%);
}

.features-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.features-inner h2 {
    font-size: 2rem;
    margin-bottom: 48px;
    text-align: center;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
}

.feature-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 32px;
    transition: all 0.3s ease;
}

.feature-card:hover {
    border-color: rgba(233,69,96,0.3);
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.feature-num {
    font-family: 'DM Mono', monospace;
    font-size: 13px;
    color: var(--forge);
    font-weight: 500;
    margin-bottom: 16px;
}

.feature-card h3 { font-size: 1.15rem; margin-bottom: 8px; }
.feature-card p { font-size: 14px; color: var(--muted); line-height: 1.6; }

/* ─── App Layout ─── */
.view {
    max-width: 1200px;
    margin: 0 auto;
    padding: 100px 24px 40px;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 { margin-bottom: 4px; }

.header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ─── Stats Grid ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 24px;
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: rgba(255,255,255,0.12);
}

.stat-card.accent {
    border-color: rgba(233,69,96,0.3);
    background: rgba(233,69,96,0.06);
}

.stat-card-label {
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'DM Mono', monospace;
}

.stat-card.accent .stat-card-value { color: var(--forge); }

/* ─── Campaigns Grid ─── */
.campaigns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 16px;
}

.campaign-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.campaign-card:hover {
    border-color: rgba(233,69,96,0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.campaign-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.campaign-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0;
}

.badge-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-status.draft { background: rgba(136,146,164,0.2); color: var(--muted); }
.badge-status.active { background: rgba(16,185,129,0.15); color: var(--success); }
.badge-status.paused { background: rgba(245,158,11,0.15); color: var(--warning); }

.campaign-card-stats {
    display: flex;
    gap: 24px;
}

.campaign-card-stat {
    display: flex;
    flex-direction: column;
}

.campaign-card-stat-value {
    font-family: 'DM Mono', monospace;
    font-size: 1.2rem;
    font-weight: 600;
}

.campaign-card-stat-label {
    font-size: 12px;
    color: var(--muted);
}

/* ─── Tabs ─── */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0;
}

.tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab:hover { color: var(--light); }
.tab.active {
    color: var(--light);
    border-bottom-color: var(--forge);
}

/* ─── Tables ─── */
.table-container { overflow-x: auto; }

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

th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--card-border);
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 14px;
}

tr:hover td { background: rgba(255,255,255,0.02); }

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

.status-badge.new { background: rgba(136,146,164,0.2); color: var(--muted); }
.status-badge.researched { background: rgba(255,217,61,0.15); color: var(--glow); }
.status-badge.email_drafted { background: rgba(99,102,241,0.15); color: #818cf8; }
.status-badge.emailed { background: rgba(16,185,129,0.15); color: var(--success); }
.status-badge.replied { background: rgba(233,69,96,0.15); color: var(--forge); }
.status-badge.draft { background: rgba(136,146,164,0.2); color: var(--muted); }
.status-badge.sent { background: rgba(16,185,129,0.15); color: var(--success); }
.status-badge.failed { background: rgba(239,68,68,0.15); color: #f87171; }
.status-badge.opened { background: rgba(99,102,241,0.15); color: #818cf8; }

/* ─── Forms ─── */
.form-container {
    max-width: 700px;
}

.form-section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 28px;
    margin-bottom: 20px;
}

.form-section h3 {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--card-border);
}

.form-group {
    margin-bottom: 16px;
    flex: 1;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--light);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--forge);
    box-shadow: 0 0 0 3px rgba(233,69,96,0.15);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(136,146,164,0.6);
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%238892a4' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.form-group select option {
    background: var(--steel);
    color: var(--light);
}

.form-row {
    display: flex;
    gap: 16px;
}

/* ─── Modal ─── */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--steel);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 32px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content.modal-lg { max-width: 700px; }

.modal-content h2 { margin-bottom: 8px; }

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

/* ─── Email Preview ─── */
.email-preview-field {
    margin-bottom: 16px;
}

.email-preview-field label {
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 6px;
}

.email-preview-field .value {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 14px 18px;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* ─── Toast ─── */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--steel);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

.toast.success { border-color: rgba(16,185,129,0.4); }
.toast.error { border-color: rgba(239,68,68,0.4); }
.toast.info { border-color: rgba(99,102,241,0.4); }

@keyframes slideIn {
    from { transform: translateX(100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ─── Loading ─── */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: var(--forge);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ─── Section ─── */
.section {
    margin-top: 40px;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .hero h1 { font-size: 2rem; }
    .hero-stats { gap: 24px; }
    .form-row { flex-direction: column; gap: 0; }
    .header-actions { width: 100%; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .campaigns-grid { grid-template-columns: 1fr; }
    .app-nav-links { display: none; }
    h1 { font-size: 1.75rem; }
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
