:root {
    --bg: #0f1117;
    --bg-card: #1a1d27;
    --bg-input: #242734;
    --bg-sidebar: #141620;
    --border: #2a2d3a;
    --text: #e4e6ed;
    --text-muted: #8b8fa3;
    --primary: #6366f1;
    --primary-hover: #5457e5;
    --success: #22c55e;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --info: #3b82f6;
    --radius: 8px;
    --radius-lg: 12px;
}

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

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

/* ===== Login ===== */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(ellipse at top, #1a1d2e 0%, var(--bg) 70%);
}

.login-card {
    width: 100%;
    max-width: 380px;
    padding: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-align: center;
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 24px;
    font-weight: 700;
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius);
    font-weight: 800;
    font-size: 18px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 28px;
}

.login-card form { text-align: left; }

/* ===== Layout ===== */

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

.sidebar {
    width: 220px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 10;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 30px;
    font-size: 18px;
    font-weight: 700;
}

.sidebar-brand .logo-icon {
    width: 32px;
    height: 32px;
    font-size: 16px;
}

.sidebar-nav {
    list-style: none;
    flex: 1;
}

.sidebar-nav li a {
    display: block;
    padding: 10px 20px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}

.sidebar-nav li a:hover {
    color: var(--text);
    background: rgba(255,255,255,0.03);
}

.sidebar-nav li.active a {
    color: var(--primary);
    border-left-color: var(--primary);
    background: rgba(99,102,241,0.08);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
}

.sidebar-footer a {
    color: var(--text-muted);
    text-decoration: none;
}

.sidebar-footer a:hover { color: var(--danger); }

.content {
    flex: 1;
    margin-left: 220px;
    padding: 32px 40px;
}

/* ===== Page Header ===== */

.page-header {
    margin-bottom: 28px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
}

/* ===== Cards ===== */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 15px;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

.card-body.no-padding { padding: 0; }

/* ===== Toast ===== */

.toast {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 20px;
}

.toast.success { background: rgba(34,197,94,0.12); color: var(--success); border: 1px solid rgba(34,197,94,0.2); }
.toast.error   { background: rgba(239,68,68,0.12); color: var(--danger);  border: 1px solid rgba(239,68,68,0.2); }

/* ===== Table ===== */

.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:hover { background: rgba(255,255,255,0.02); }
tbody tr:last-child td { border-bottom: none; }

.mono {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
    color: var(--text-muted);
}

.actions {
    white-space: nowrap;
    display: flex;
    gap: 6px;
}

/* ===== Badges ===== */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: var(--bg-input);
    color: var(--text-muted);
    cursor: default;
}

.badge-success { background: rgba(34,197,94,0.12); color: var(--success); }
.badge-muted   { background: var(--bg-input); color: var(--text-muted); }
.badge-info    { background: rgba(59,130,246,0.12); color: var(--info); }

.campaign-details summary { cursor: pointer; list-style: none; }
.campaign-details summary::-webkit-details-marker { display: none; }
.campaign-details summary .badge { cursor: pointer; }

.id-list {
    list-style: none;
    margin-top: 8px;
    font-family: monospace;
    font-size: 12px;
    color: var(--text-muted);
    max-height: 150px;
    overflow-y: auto;
}

.id-list li { padding: 2px 0; }

/* ===== Empty State ===== */

.empty-state {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state p { margin-bottom: 16px; }

/* ===== Forms ===== */

.input-group {
    margin-bottom: 18px;
}

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

.input-group input[type="text"],
.input-group input[type="password"],
.input-group input[type="date"],
.input-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

.input-group input:focus,
.input-group textarea:focus {
    border-color: var(--primary);
}

.input-group textarea {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    resize: vertical;
}

.input-group small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.input-group small code {
    background: var(--bg-input);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
}

.hint {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 12px;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500 !important;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

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

.form-row .input-group {
    margin-bottom: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-stack { }

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ===== Buttons ===== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}

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

.btn-danger    { background: rgba(239,68,68,0.12); color: var(--danger); }
.btn-danger:hover  { background: rgba(239,68,68,0.2); }

.btn-ghost     { background: transparent; color: var(--text-muted); }
.btn-ghost:hover   { color: var(--text); background: rgba(255,255,255,0.05); }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-full { width: 100%; }

/* ===== Stats ===== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== Pagination ===== */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px;
    border-top: 1px solid var(--border);
}

.pagination-info {
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== Utility ===== */

.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }

/* ===== Responsive ===== */

@media (max-width: 768px) {
    .sidebar { display: none; }
    .content { margin-left: 0; padding: 20px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
