/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { display: flex; min-height: 100vh; font-family: 'DM Sans', sans-serif; background: #0f1117; color: #e2e8f0; }

/* ── Sidebar ──────────────────────────────────────────────── */
#sidebar { width: 240px; background: #090c14; border-right: 1px solid rgba(255,255,255,0.05); display: flex; flex-direction: column; padding: 32px 0; flex-shrink: 0; }
.logo { padding: 0 24px 40px; }
.logo h1 { font-family: 'Syne', sans-serif; font-size: 22px; font-weight: 800; color: #fff; }
.logo p  { font-size: 11px; color: #4a5568; margin-top: 4px; text-transform: uppercase; letter-spacing: 0.08em; }
nav { flex: 1; }
.nav-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 24px; border: none; background: transparent; color: #94a3b8; font-size: 14px; font-family: 'DM Sans', sans-serif; cursor: pointer; text-align: left; border-left: 3px solid transparent; transition: all 0.15s; margin-bottom: 2px; }
.nav-btn:hover  { color: #e2e8f0; background: rgba(255,255,255,0.03); }
.nav-btn.active { color: #4f8ef7; background: rgba(79,142,247,0.12); border-left-color: #4f8ef7; font-weight: 600; }
.nav-btn.danger { color: #ef4444; }
.sidebar-footer { padding: 20px 24px 0; border-top: 1px solid rgba(255,255,255,0.05); display: flex; align-items: center; gap: 8px; }
#status-dot  { width: 8px; height: 8px; border-radius: 50%; background: #fb923c; flex-shrink: 0; }
#status-text { font-size: 11px; color: #4a5568; }

/* ── Main content ─────────────────────────────────────────── */
#main { flex: 1; overflow-y: auto; padding: 36px 40px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 36px; }
.page-header h2 { font-family: 'Syne', sans-serif; font-size: 28px; font-weight: 800; color: #fff; }
.page-header p  { font-size: 13px; color: #4a5568; margin-top: 6px; }
#live-badge { background: rgba(251,146,60,0.1); border: 1px solid rgba(251,146,60,0.2); border-radius: 10px; padding: 8px 16px; font-size: 12px; color: #fb923c; font-weight: 500; white-space: nowrap; }

/* ── Error banner ─────────────────────────────────────────── */
#error-banner { display: none; background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.2); border-radius: 12px; padding: 16px 20px; margin-bottom: 24px; font-size: 13px; color: #fca5a5; line-height: 1.7; }
#error-banner span { color: #94a3b8; }

/* ── Views ────────────────────────────────────────────────── */
.view { display: none; }
#view-dashboard { display: block; }

/* ── KPI cards ────────────────────────────────────────────── */
.kpi-grid  { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 28px; }
.kpi-card  { background: #141720; border: 1px solid rgba(255,255,255,0.06); border-radius: 14px; padding: 20px 22px; display: flex; justify-content: space-between; align-items: flex-start; }
.kpi-label { font-size: 11px; color: #4a5568; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.kpi-value { font-family: 'Syne', sans-serif; font-size: 30px; font-weight: 700; color: #fff; line-height: 1; }
.kpi-delta { font-size: 11px; margin-top: 6px; }
.kpi-icon  { font-size: 24px; opacity: 0.6; }

/* ── Charts ───────────────────────────────────────────────── */
.charts-row   { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 28px; }
.card         { background: #141720; border: 1px solid rgba(255,255,255,0.06); border-radius: 14px; padding: 22px 24px; }
.card-title   { font-size: 13px; font-weight: 600; color: #e2e8f0; margin-bottom: 4px; }
.card-sub     { font-size: 11px; color: #4a5568; margin-bottom: 20px; }
.chart-wrap   { position: relative; height: 180px; }
.chart-wrap-sm{ position: relative; height: 160px; }

/* ── Recent leads ─────────────────────────────────────────── */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.view-all-btn   { background: none; border: 1px solid rgba(79,142,247,0.3); color: #4f8ef7; font-size: 11px; padding: 5px 12px; border-radius: 6px; cursor: pointer; font-family: 'DM Sans', sans-serif; }
.lead-row  { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.lead-left { display: flex; align-items: center; gap: 12px; }
.lead-right{ display: flex; align-items: center; gap: 10px; }
.lead-name { font-size: 13px; font-weight: 500; color: #e2e8f0; }
.lead-sub  { font-size: 11px; color: #4a5568; margin-top: 2px; }
.lead-date { font-size: 11px; color: #4a5568; }

/* ── Shared components ────────────────────────────────────── */
.avatar    { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.badge     { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px; white-space: nowrap; display: inline-block; }
.empty     { color: #4a5568; font-size: 13px; padding: 20px 0; }
.empty-cell{ padding: 40px; text-align: center; color: #4a5568; }

/* ── Filters ──────────────────────────────────────────────── */
.filters       { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-input  { flex: 1; min-width: 220px; background: #141720; border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; padding: 10px 16px; color: #e2e8f0; font-size: 13px; font-family: 'DM Sans', sans-serif; outline: none; }
.filter-select { background: #141720; border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; padding: 10px 16px; color: #94a3b8; font-size: 12px; font-family: 'DM Sans', sans-serif; outline: none; cursor: pointer; }

/* ── Table ────────────────────────────────────────────────── */
.table-wrap { background: #141720; border: 1px solid rgba(255,255,255,0.06); border-radius: 14px; overflow: hidden; }
table       { width: 100%; border-collapse: collapse; }
thead       { border-bottom: 1px solid rgba(255,255,255,0.06); }
thead th    { padding: 12px 16px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: #4a5568; font-weight: 600; text-align: left; }
tbody td    { padding: 13px 16px; font-size: 13px; color: #94a3b8; border-bottom: 1px solid rgba(255,255,255,0.04); }
#leads-count{ margin-top: 12px; font-size: 12px; color: #4a5568; }

/* ── Expandable rows ──────────────────────────────────────── */
.expand-btn  { cursor: pointer; color: #4a5568; font-size: 12px; padding: 2px 6px; border-radius: 4px; transition: all 0.1s; user-select: none; flex-shrink: 0; }
.expand-btn:hover { color: #4f8ef7; background: rgba(79,142,247,0.1); }
.detail-row td    { padding: 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.detail-grid      { display: grid; grid-template-columns: repeat(4,1fr); gap: 0; padding: 20px 20px 20px 52px; background: rgba(79,142,247,0.03); border-top: 1px solid rgba(79,142,247,0.1); }
.detail-section   { padding: 0 20px 0 0; }
.detail-title     { font-size: 11px; font-weight: 600; color: #4f8ef7; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 12px; }
.detail-item      { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,0.03); font-size: 12px; }
.detail-item span:first-child { color: #4a5568; flex-shrink: 0; }
.detail-item span:last-child  { color: #e2e8f0; text-align: right; }
