:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --border: #334155;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1.5rem 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar .logo {
    padding: 0 1.5rem 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.15s;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    color: var(--text);
    background: var(--surface-hover);
}

.sidebar nav a.active {
    border-right: 2px solid var(--primary);
}

/* Main content */
.main {
    margin-left: 240px;
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

/* Stat cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.25rem;
}

.stat-card .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-card .value {
    font-size: 1.75rem;
    font-weight: 700;
}

.stat-card .value.success { color: var(--success); }
.stat-card .value.warning { color: var(--warning); }
.stat-card .value.danger { color: var(--danger); }
.stat-card .value.info { color: var(--info); }
.stat-card .value.primary { color: var(--primary); }

/* Tables */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

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

th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-hover); }

/* Badges */
.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-draft { background: #374151; color: #9ca3af; }
.badge-active { background: #065f46; color: #6ee7b7; }
.badge-paused { background: #78350f; color: #fcd34d; }
.badge-completed { background: #1e3a5f; color: #93c5fd; }
.badge-sent { background: #065f46; color: #6ee7b7; }
.badge-failed { background: #7f1d1d; color: #fca5a5; }
.badge-queued { background: #374151; color: #9ca3af; }
.badge-bounced { background: #7f1d1d; color: #fca5a5; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}

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

.btn-success {
    background: #065f46;
    color: #6ee7b7;
}
.btn-success:hover { background: #047857; }

.btn-warning {
    background: #78350f;
    color: #fcd34d;
}
.btn-warning:hover { background: #92400e; }

.btn-danger {
    background: #7f1d1d;
    color: #fca5a5;
}
.btn-danger:hover { background: #991b1b; }

.btn-sm {
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
    color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text);
    font-size: 0.875rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.form-group textarea {
    min-height: 200px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8125rem;
}

.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    max-width: 640px;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Checkbox group */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text);
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    accent-color: var(--primary);
}

/* Alert */
.alert {
    padding: 0.875rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-success {
    background: #065f46;
    color: #6ee7b7;
    border: 1px solid #047857;
}

.alert-error {
    background: #7f1d1d;
    color: #fca5a5;
    border: 1px solid #991b1b;
}

/* Flex utilities */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.mb-4 { margin-bottom: 1rem; }

/* Unsubscribe page */
.unsub-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    text-align: center;
}

.unsub-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 3rem;
    max-width: 480px;
}

.unsub-card h1 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.unsub-card p {
    color: var(--text-muted);
}
