:root {
    --px-primary: #4f46e5;
    --px-primary-dark: #4338ca;
    --px-primary-soft: #eef2ff;
    --px-sidebar-bg: #111827;
    --px-sidebar-text: #9ca3af;
    --px-sidebar-active: #4f46e5;
    --px-bg: #f3f4f6;
    --px-card-border: #e5e7eb;
    --px-text: #1f2937;
    --px-muted: #6b7280;
    --px-success: #10b981;
    --px-danger: #ef4444;
    --px-warning: #f59e0b;
    --px-info: #0ea5e9;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--px-bg);
    color: var(--px-text);
    font-size: 14px;
    margin: 0;
}

/* ---------- Layout ---------- */
.px-layout { display: flex; min-height: 100vh; }

.px-sidebar {
    width: 250px;
    background: var(--px-sidebar-bg);
    color: var(--px-sidebar-text);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.px-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 22px;
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: .3px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    text-decoration: none;
}

.px-sidebar-brand .logo {
    width: 34px; height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-size: 17px;
}

.px-nav { padding: 12px 0; flex: 1; }
.px-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 22px;
    color: var(--px-sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    border-left: 3px solid transparent;
    transition: all .15s;
}
.px-nav a:hover { color: #fff; background: rgba(255,255,255,.05); }
.px-nav a.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(79,70,229,.35), transparent);
    border-left-color: #6366f1;
}
.px-nav a .icon { width: 20px; text-align: center; }

.px-sidebar-footer { padding: 14px 22px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #6b7280; }

/* ---------- Main ---------- */
.px-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.px-topbar {
    background: #fff;
    border-bottom: 1px solid var(--px-card-border);
    padding: 12px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.px-topbar h1 { font-size: 18px; font-weight: 700; margin: 0; }

.px-content { padding: 28px; flex: 1; }

/* ---------- Cards ---------- */
.px-card {
    background: #fff;
    border: 1px solid var(--px-card-border);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(16,24,40,.04);
}

.px-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--px-card-border);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.px-card-body { padding: 20px; }

/* ---------- Stat cards ---------- */
.px-stat { padding: 18px 20px; }
.px-stat .label { color: var(--px-muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; }
.px-stat .value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.px-stat .sub { color: var(--px-muted); font-size: 12.5px; margin-top: 2px; }

.px-stat .dot { width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; margin-bottom: 8px; }
.px-stat .dot.indigo { background: var(--px-primary-soft); }
.px-stat .dot.green { background: #d1fae5; }
.px-stat .dot.red { background: #fee2e2; }
.px-stat .dot.amber { background: #fef3c7; }
.px-stat .dot.blue { background: #e0f2fe; }

/* ---------- Tables ---------- */
.table-px { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table-px th { text-align: left; padding: 10px 12px; color: var(--px-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; border-bottom: 1px solid var(--px-card-border); background: #f9fafb; }
.table-px td { padding: 10px 12px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.table-px tr:hover td { background: #fafbff; }

/* ---------- Badges ---------- */
.badge-soft { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-soft.secondary { background: #f3f4f6; color: #374151; }
.badge-soft.info { background: #e0f2fe; color: #0369a1; }
.badge-soft.success { background: #d1fae5; color: #047857; }
.badge-soft.primary { background: var(--px-primary-soft); color: var(--px-primary-dark); }
.badge-soft.warning { background: #fef3c7; color: #b45309; }
.badge-soft.danger { background: #fee2e2; color: #b91c1c; }
.badge-soft.dark { background: #e5e7eb; color: #111827; }

/* ---------- Buttons ---------- */
.btn-px {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px;
    border: 1px solid transparent;
    font-size: 13.5px; font-weight: 600;
    cursor: pointer; text-decoration: none;
    transition: all .15s;
}
.btn-px-primary { background: var(--px-primary); color: #fff; }
.btn-px-primary:hover { background: var(--px-primary-dark); color: #fff; }
.btn-px-outline { background: #fff; border-color: #d1d5db; color: #374151; }
.btn-px-outline:hover { background: #f9fafb; }
.btn-px-danger { background: var(--px-danger); color: #fff; }
.btn-px-danger:hover { background: #dc2626; }
.btn-px-success { background: var(--px-success); color: #fff; }
.btn-px-success:hover { background: #059669; }
.btn-px-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-px-block { width: 100%; justify-content: center; }

/* ---------- Forms ---------- */
.form-control-px {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    color: var(--px-text);
    transition: border-color .15s, box-shadow .15s;
}
.form-control-px:focus { outline: none; border-color: var(--px-primary); box-shadow: 0 0 0 3px rgba(79,70,229,.15); }
.form-label-px { font-size: 13px; font-weight: 600; margin-bottom: 6px; display: block; color: #374151; }
.form-text-px { font-size: 12px; color: var(--px-muted); }
.form-error { font-size: 12.5px; color: var(--px-danger); margin-top: 4px; }

/* ---------- Flash ---------- */
.px-alert { padding: 12px 16px; border-radius: 10px; font-size: 13.5px; margin-bottom: 18px; display: flex; align-items: center; gap: 10px; }
.px-alert.success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.px-alert.error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.px-alert.info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

/* ---------- Auth ---------- */
.px-auth-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
    padding: 20px;
}
.px-auth-card {
    width: 100%; max-width: 420px;
    background: #fff; border-radius: 16px;
    padding: 36px;
    box-shadow: 0 20px 40px rgba(0,0,0,.25);
}
.px-auth-brand { text-align: center; margin-bottom: 24px; }
.px-auth-brand .logo { width: 52px; height: 52px; border-radius: 14px; background: linear-gradient(135deg,#6366f1,#8b5cf6); display: inline-flex; align-items: center; justify-content: center; color:#fff; font-size: 24px; }
.px-auth-brand h1 { font-size: 22px; font-weight: 800; margin: 12px 0 4px; }
.px-auth-brand p { color: var(--px-muted); font-size: 13.5px; margin: 0; }

/* ---------- Misc ---------- */
.text-muted-px { color: var(--px-muted); }
.text-success-px { color: #059669; }
.text-danger-px { color: #dc2626; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 20px; }
.mt-3 { margin-top: 12px; } .mt-4 { margin-top: 20px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.gap-2 { gap: 8px; }
.w-100 { width: 100%; }

.px-empty {
    text-align: center; padding: 48px 20px; color: var(--px-muted);
}
.px-empty .icon { font-size: 40px; margin-bottom: 10px; }

.px-progress { height: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.px-progress > div { height: 100%; background: var(--px-primary); border-radius: 999px; }

.px-email-preview {
    background: #fff;
    border: 1px solid var(--px-card-border);
    border-radius: 12px;
    overflow: hidden;
}
.px-email-preview iframe { width: 100%; min-height: 480px; border: 0; }

.px-search-result {
    padding: 14px 16px; border: 1px solid var(--px-card-border);
    border-radius: 10px; margin-bottom: 10px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: #fff;
}

@media (max-width: 900px) {
    .px-sidebar { position: fixed; left: -260px; transition: left .2s; z-index: 200; }
    .px-sidebar.open { left: 0; }
    .px-content { padding: 16px; }
}
