:root {
    --bg: #f5f7fa;
    --panel: #ffffff;
    --border: #e5e8ee;
    --text: #22262f;
    --muted: #7c8296;
    --primary: #2f6fed;
    --primary-dark: #2558c4;
    --primary-light: #eaf1ff;
    --success: #16a34a;
    --success-bg: #e8f9ee;
    --danger: #e0342f;
    --danger-bg: #fdecec;
    --warning: #b45309;
    --warning-bg: #fef3c7;
    --sidebar-w: 104px;
    --sidebar-bg: #161a2c;
    --sidebar-text: #9096ae;
    --sidebar-text-active: #5b8dff;
    --sidebar-border: #262b42;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* --- Sidebar: dark, matches Pabbly's actual app (not its light marketing site) --- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    padding: 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 0;
    border-bottom: 1px solid var(--sidebar-border);
    margin-bottom: 8px;
}
.sidebar .brand .logo-dot {
    width: 34px; height: 34px; border-radius: 9px;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 15px;
}

.sidebar nav { padding: 4px 10px; display: flex; flex-direction: column; flex: 1; }
.sidebar .nav-bottom { margin-top: auto; }
.sidebar nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    color: var(--sidebar-text);
    font-size: 11px;
    font-weight: 500;
    border-radius: 8px;
    margin-bottom: 2px;
}
.sidebar nav a:hover { background: #1e2338; text-decoration: none; color: #c7cbde; }
.sidebar nav a.active { color: var(--sidebar-text-active); }
.sidebar nav a .icon { width: 20px; text-align: center; }

.sidebar .nav-section-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #565c78;
    padding: 14px 12px 4px;
    font-weight: 700;
    text-align: center;
}

/* --- Top bar --- */
.topbar {
    height: 56px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 28px;
    gap: 16px;
}
.topbar .user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
}
.topbar .user-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
}

.main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.main { flex: 1; padding: 26px 32px; max-width: 1200px; width: 100%; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}
.page-header h1 { font-size: 21px; margin: 0; font-weight: 700; }
.page-header .subtitle { color: var(--muted); font-size: 13px; margin-top: 4px; }

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}
.panel h3 { font-size: 15px; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.stat-card .value { font-size: 26px; font-weight: 700; }
.stat-card .label { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.stat-card .icon-badge {
    width: 42px; height: 42px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-card .icon-badge.tint-orange { background: #fef3e2; color: #d97706; }
.stat-card .icon-badge.tint-blue { background: #e7f0ff; color: var(--primary); }
.stat-card .icon-badge.tint-green { background: var(--success-bg); color: var(--success); }
.stat-card .icon-badge.tint-pink { background: #fde7f3; color: #db2777; }

/* --- Status tabs: text + count pill, used on list pages (campaigns, workflows) --- */
.status-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.status-tabs a {
    display: flex; align-items: center; gap: 7px;
    padding: 0 0 12px;
    color: var(--muted);
    font-size: 13.5px;
    font-weight: 600;
    border-bottom: 2px solid transparent;
}
.status-tabs a:hover { text-decoration: none; color: var(--text); }
.status-tabs a.active { color: var(--text); border-bottom-color: var(--primary); }
.status-tabs .count {
    background: #eef0f4; color: var(--muted);
    font-size: 11px; font-weight: 700;
    padding: 1px 7px; border-radius: 999px;
}
.status-tabs a.active .count { background: var(--primary-light); color: var(--primary-dark); }

/* --- Empty state --- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state svg { opacity: 0.35; margin-bottom: 12px; }
.empty-state p { font-size: 13.5px; margin: 0; }

/* --- Onboarding stepper (dashboard) --- */
.stepper { display: flex; align-items: center; justify-content: center; padding: 20px 10px; }
.stepper .step { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 140px; }
.stepper .step .dot {
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: #eef0f4; color: var(--muted);
    font-weight: 700;
}
.stepper .step.done .dot { background: var(--primary); color: #fff; }
.stepper .step.current .dot { background: var(--warning); color: #fff; }
.stepper .step .label { font-size: 12.5px; font-weight: 600; text-align: center; }
.stepper .connector { flex: 1; height: 2px; background: var(--border); margin: 0 -10px 28px; max-width: 90px; }
.stepper .connector.done { background: var(--primary); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: #fafbfc; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.badge-subscribed { background: var(--success-bg); color: var(--success); }
.badge-unsubscribed { background: var(--danger-bg); color: var(--danger); }
.badge-draft { background: #f1f2f6; color: var(--muted); }
.badge-scheduled { background: var(--primary-light); color: var(--primary-dark); }
.badge-sending { background: var(--warning-bg); color: var(--warning); }
.badge-sent { background: var(--success-bg); color: var(--success); }
.badge-stopped { background: var(--danger-bg); color: var(--danger); }
.badge-failed { background: var(--danger-bg); color: var(--danger); }

.btn {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 9px 18px;
    border-radius: 7px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: var(--danger); }
.btn-sm { padding: 5px 12px; font-size: 12px; }

input[type=text], input[type=email], input[type=password], input[type=file], textarea, select {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.field { margin-bottom: 16px; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.alert-error { background: var(--danger-bg); color: #a11c17; }
.alert-success { background: var(--success-bg); color: #0f6b32; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tabs a {
    padding: 10px 14px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--muted);
    border-bottom: 2px solid transparent;
}
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }

.folder-list { list-style: none; margin: 0; padding: 0; }
.folder-list li { margin-bottom: 2px; }
.folder-list a {
    display: flex; justify-content: space-between;
    padding: 8px 12px; border-radius: 7px; font-size: 13.5px; color: var(--text);
}
.folder-list a:hover { background: var(--bg); text-decoration: none; }
.folder-list a.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.folder-list .count { color: var(--muted); font-size: 12px; }

.pill-input-group { display: flex; gap: 8px; flex-wrap: wrap; }

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}
.login-box { width: 360px; }
.login-box .panel { padding: 30px; }
.login-box h1 { text-align: center; font-size: 19px; margin-top: 0; }
