/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'DM Sans', sans-serif; background: #F8FAFC; color: #0F172A; font-size: 15px; }
.hidden { display: none !important; }

/* ── Auth ────────────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 60%, #0F172A 100%);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.auth-card {
  width: 100%; max-width: 460px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 24px; padding: 2rem;
  backdrop-filter: blur(20px);
}
.auth-logo {
  width: 54px; height: 54px; border-radius: 14px;
  background: linear-gradient(135deg,#6366F1,#8B5CF6);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; margin: 0 auto 1rem;
}
.auth-title { color: #F8FAFC; font-size: 26px; font-weight: 700; text-align: center; }
.auth-sub { color: #94A3B8; font-size: 13px; text-align: center; margin: 0.3rem 0 1.5rem; }

.auth-tabs {
  display: flex; background: rgba(255,255,255,0.07);
  border-radius: 12px; padding: 4px; margin-bottom: 1.5rem; gap: 4px;
}
.auth-tab {
  flex: 1; padding: 0.55rem; border-radius: 9px; border: none;
  background: transparent; color: #64748B; font-size: 14px;
  font-weight: 600; cursor: pointer; font-family: inherit; transition: all 0.2s;
}
.auth-tab.active { background: #6366F1; color: #fff; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; color: #CBD5E1; font-size: 13px; font-weight: 500; margin-bottom: 5px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 0.7rem 0.9rem; border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.08);
  color: #F8FAFC; font-size: 14px; font-family: inherit; outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus { border-color: #6366F1; }
.form-group select option { background: #1E293B; color: #F8FAFC; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.field-error { color: #F87171; font-size: 12px; display: block; margin-top: 3px; }
.field-hint { color: #64748B; font-size: 12px; display: block; margin-top: 3px; }
.field-hint code { color: #A5B4FC; }

.auth-error {
  background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3);
  border-radius: 8px; padding: 0.6rem 0.9rem;
  color: #FCA5A5; font-size: 13px; margin-bottom: 0.9rem;
}
.auth-success {
  background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.3);
  border-radius: 8px; padding: 0.6rem 0.9rem;
  color: #6EE7B7; font-size: 13px; margin-bottom: 0.9rem;
}

.demo-accounts {
  margin-top: 1.25rem; padding: 0.9rem 1rem;
  background: rgba(255,255,255,0.05); border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
}
.demo-title { color: #64748B; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.5rem; }
.demo-row { display: flex; align-items: center; gap: 0.5rem; font-size: 13px; color: #94A3B8; margin-bottom: 0.35rem; }
.demo-row code { color: #C4B5FD; background: rgba(99,102,241,0.15); padding: 1px 6px; border-radius: 4px; }
.demo-badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.admin-badge { background: rgba(99,102,241,0.25); color: #A5B4FC; }
.sales-badge { background: rgba(16,185,129,0.2); color: #6EE7B7; }

/* ── App Layout ──────────────────────────────────────────── */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar { width: 230px; background: #0F172A; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-brand { display: flex; align-items: center; gap: 0.6rem; padding: 1.4rem 1.25rem 0.75rem; }
.brand-icon { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg,#6366F1,#8B5CF6); display: flex; align-items: center; justify-content: center; font-size: 16px; }
.brand-name { color: #F8FAFC; font-weight: 700; font-size: 15px; line-height: 1; }
.brand-sub { color: #334155; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
.sidebar-nav { padding: 0.5rem 0.75rem; flex: 1; }
.nav-item {
  width: 100%; display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0.75rem; border-radius: 10px; border: none;
  background: transparent; color: #475569; font-size: 13.5px; font-weight: 500;
  cursor: pointer; text-align: left; margin-bottom: 2px; font-family: inherit;
  transition: all 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: #94A3B8; }
.nav-item.active { background: rgba(99,102,241,0.18); color: #A5B4FC; }
.sidebar-footer { padding: 1rem 0.75rem; border-top: 1px solid #1E293B; }
.sidebar-user { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.75rem; }
.sidebar-avatar { width: 34px; height: 34px; border-radius: 50%; background: #6366F1; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.sidebar-user-name { color: #E2E8F0; font-size: 13px; font-weight: 500; }
.sidebar-user-role { color: #475569; font-size: 11px; text-transform: capitalize; }
.sidebar-role-dot { width: 8px; height: 8px; border-radius: 50%; margin-left: auto; flex-shrink: 0; }
.btn-logout { width: 100%; margin-top: 0.5rem; padding: 0.5rem; border-radius: 8px; border: 1px solid #1E293B; background: transparent; color: #475569; font-size: 13px; cursor: pointer; font-family: inherit; transition: all 0.15s; }
.btn-logout:hover { background: #1E293B; color: #94A3B8; }

/* ── Main Content ────────────────────────────────────────── */
.main-content { flex: 1; overflow: auto; display: flex; flex-direction: column; }
.topbar { background: #fff; border-bottom: 1px solid #E2E8F0; padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 10; }
.topbar h1 { font-size: 19px; font-weight: 700; color: #0F172A; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; }
.topbar-role-badge { font-size: 11px; font-weight: 700; padding: 4px 12px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.05em; }
.content-area { padding: 1.5rem 2rem; flex: 1; }

/* ── Stats ───────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: #fff; border: 1px solid #E2E8F0; border-radius: 14px; padding: 1.1rem 1.4rem; border-top: 3px solid; }
.stat-label { font-size: 12px; color: #64748B; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 30px; font-weight: 700; color: #0F172A; margin: 0.3rem 0 0.15rem; }
.stat-sub { font-size: 12px; color: #94A3B8; }

/* ── Filters ─────────────────────────────────────────────── */
.filters-bar { background: #fff; border: 1px solid #E2E8F0; border-radius: 12px; padding: 0.9rem 1.1rem; margin-bottom: 0.75rem; display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.search-input { flex: 1; min-width: 180px; padding: 0.55rem 0.85rem; border-radius: 8px; border: 1px solid #E2E8F0; font-size: 14px; color: #111827; outline: none; font-family: inherit; }
.search-input:focus { border-color: #6366F1; }
.filters-bar select { padding: 0.55rem 0.85rem; border-radius: 8px; border: 1px solid #E2E8F0; font-size: 13px; color: #374151; background: #fff; font-family: inherit; }
.btn-clear { padding: 0.55rem 0.85rem; border-radius: 8px; border: 1px solid #FECACA; background: #FEF2F2; color: #DC2626; font-size: 13px; cursor: pointer; font-family: inherit; }
.leads-count { font-size: 13px; color: #64748B; margin-bottom: 0.5rem; }

/* ── Table ───────────────────────────────────────────────── */
.table-wrapper { background: #fff; border: 1px solid #E2E8F0; border-radius: 12px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: #F8FAFC; border-bottom: 1px solid #E2E8F0; }
th { padding: 0.7rem 1rem; text-align: left; font-size: 11px; font-weight: 600; color: #64748B; text-transform: uppercase; letter-spacing: 0.05em; }
tbody tr { border-bottom: 1px solid #F1F5F9; transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #F8FAFC; }
td { padding: 0.8rem 1rem; font-size: 13.5px; }
.lead-cell { display: flex; align-items: center; gap: 0.65rem; }
.lead-avatar { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.lead-name { font-weight: 600; font-size: 13.5px; color: #0F172A; }
.lead-email { font-size: 12px; color: #64748B; }
.source-tag { background: #F1F5F9; color: #475569; border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 500; }
.assignee-tag { background: #EEF2FF; color: #4338CA; border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 500; }
.unassigned-tag { background: #F1F5F9; color: #94A3B8; border-radius: 6px; padding: 2px 8px; font-size: 12px; }
.status-badge { border-radius: 20px; padding: 3px 10px; font-size: 11px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.status-new { background: #EFF6FF; color: #1D4ED8; border-color: rgba(59,130,246,0.25); }
.status-contacted { background: #FFFBEB; color: #B45309; border-color: rgba(245,158,11,0.25); }
.status-converted { background: #ECFDF5; color: #065F46; border-color: rgba(16,185,129,0.25); }
.row-actions { display: flex; gap: 0.35rem; }
.btn-view, .btn-edit { padding: 4px 10px; border-radius: 6px; border: 1px solid #E2E8F0; background: #fff; font-size: 12px; cursor: pointer; font-family: inherit; transition: background 0.1s; }
.btn-view { color: #6366F1; font-weight: 500; }
.btn-view:hover { background: #EEF2FF; }
.btn-edit:hover { background: #F8FAFC; }
.empty-row td { text-align: center; padding: 3rem; color: #94A3B8; font-size: 14px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn-primary { padding: 0.6rem 1.2rem; border-radius: 10px; border: none; background: linear-gradient(135deg,#6366F1,#8B5CF6); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; transition: opacity 0.15s; }
.btn-primary:hover { opacity: 0.88; }
.btn-primary.full-width { width: 100%; padding: 0.8rem; font-size: 15px; margin-top: 0.25rem; }
.btn-secondary { padding: 0.6rem 1.2rem; border-radius: 10px; border: 1px solid #E2E8F0; background: #fff; color: #64748B; font-size: 14px; cursor: pointer; font-family: inherit; }
.btn-secondary:hover { background: #F8FAFC; }
.btn-danger { background: #DC2626; color: #fff; border: none; border-radius: 8px; cursor: pointer; font-family: inherit; }
.btn-danger-outline { padding: 0.55rem 1rem; border-radius: 8px; border: 1px solid #FECACA; background: #FEF2F2; color: #DC2626; font-size: 13px; cursor: pointer; font-family: inherit; }
.btn-danger-outline:hover { background: #FEE2E2; }
.btn-sm-primary { padding: 0.45rem 0.9rem; border-radius: 8px; border: none; background: #6366F1; color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; white-space: nowrap; }
.sm { padding: 0.45rem 0.85rem; font-size: 13px; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.65); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-box { background: #fff; border-radius: 18px; width: 100%; max-width: 520px; padding: 1.6rem; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.modal-header h2 { font-size: 19px; font-weight: 700; color: #0F172A; }
.modal-close { background: #F1F5F9; border: none; border-radius: 8px; width: 30px; height: 30px; cursor: pointer; font-size: 16px; color: #64748B; }
.modal-close.light { background: rgba(255,255,255,0.12); color: #94A3B8; position: absolute; top: 1.25rem; right: 1.25rem; }
.modal-close:hover { background: #E2E8F0; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.modal-grid .form-group { margin-bottom: 0.85rem; }
.modal-grid .form-group label { color: #374151; }
.modal-grid .form-group input,
.modal-grid .form-group select { border: 1px solid #D1D5DB; background: #fff; color: #111827; border-radius: 8px; }
.modal-grid .form-group input:focus,
.modal-grid .form-group select:focus { border-color: #6366F1; }
.modal-footer { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1rem; }

/* ── Detail Panel ────────────────────────────────────────── */
.detail-panel { background: #fff; width: 100%; max-width: 460px; height: 100%; display: flex; flex-direction: column; overflow-y: auto; }
.detail-header { background: linear-gradient(135deg,#0F172A,#1E293B); padding: 1.4rem; position: sticky; top: 0; z-index: 1; }
.detail-top-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1rem; position: relative; }
.detail-avatar-row { display: flex; gap: 0.85rem; align-items: center; }
.detail-avatar { width: 48px; height: 48px; border-radius: 50%; background: #6366F1; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 17px; flex-shrink: 0; }
.detail-header h2 { color: #F8FAFC; font-size: 17px; font-weight: 700; }
.detail-header p { color: #94A3B8; font-size: 12px; margin-top: 2px; }
.status-toggle-row { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.status-toggle { padding: 4px 13px; border-radius: 20px; border: 2px solid transparent; background: rgba(255,255,255,0.09); color: #64748B; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all 0.15s; }
.status-toggle.active-new { border-color: #3B82F6; background: #EFF6FF; color: #1D4ED8; }
.status-toggle.active-contacted { border-color: #F59E0B; background: #FFFBEB; color: #B45309; }
.status-toggle.active-converted { border-color: #10B981; background: #ECFDF5; color: #065F46; }
.detail-body { padding: 1.25rem; flex: 1; }
.detail-info-box { background: #F8FAFC; border-radius: 10px; padding: 0.9rem 1.1rem; margin-bottom: 1.1rem; }
.detail-info-box h4, .notes-section h4, .assign-box h4 { font-size: 11px; font-weight: 600; color: #64748B; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.65rem; }
.info-row { display: flex; gap: 0.5rem; font-size: 13.5px; margin-bottom: 0.35rem; }
.info-icon { font-size: 15px; }
.info-label { color: #64748B; min-width: 58px; }
.info-value { color: #0F172A; font-weight: 500; flex: 1; word-break: break-all; }
.assign-box { background: #EEF2FF; border-radius: 10px; padding: 0.9rem 1.1rem; margin-bottom: 1.1rem; }
.assign-row { display: flex; gap: 0.5rem; align-items: center; }
.assign-row select { flex: 1; padding: 0.5rem 0.75rem; border-radius: 8px; border: 1px solid #C7D2FE; font-size: 13px; color: #1E1B4B; font-family: inherit; }
.note-input-row { display: flex; gap: 0.5rem; margin-bottom: 0.9rem; }
.note-input-row textarea { flex: 1; padding: 0.6rem 0.85rem; border-radius: 10px; border: 1px solid #E2E8F0; font-size: 13.5px; resize: none; color: #111827; font-family: inherit; outline: none; }
.note-input-row textarea:focus { border-color: #6366F1; }
.note-add-btn { padding: 0 0.9rem; border-radius: 10px; align-self: stretch; font-size: 20px; }
#notes-list { display: flex; flex-direction: column; gap: 0.55rem; }
.note-item { background: #FFFBEB; border: 1px solid #FDE68A; border-radius: 10px; padding: 0.7rem 0.9rem; }
.note-author { font-size: 11px; font-weight: 600; color: #92400E; margin-bottom: 3px; }
.note-text { font-size: 13.5px; color: #0F172A; line-height: 1.5; margin-bottom: 0.35rem; }
.note-meta { display: flex; justify-content: space-between; align-items: center; }
.note-time { font-size: 11px; color: #92400E; }
.note-delete { background: none; border: none; color: #EF4444; cursor: pointer; font-size: 11px; padding: 2px 6px; border-radius: 4px; font-family: inherit; }
.note-delete:hover { background: #FEE2E2; }
.notes-empty { color: #94A3B8; font-size: 13px; text-align: center; padding: 1rem 0; }
.detail-footer { padding: 0.9rem 1.25rem; border-top: 1px solid #E2E8F0; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.confirm-row { display: flex; gap: 0.4rem; align-items: center; }
.confirm-row span { font-size: 13px; color: #64748B; }

/* ── Analytics ───────────────────────────────────────────── */
.analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.analytics-card { background: #fff; border: 1px solid #E2E8F0; border-radius: 12px; padding: 1.1rem 1.25rem; }
.analytics-card.full-width { grid-column: 1 / -1; }
.analytics-card h3 { font-size: 14px; font-weight: 600; color: #0F172A; margin-bottom: 0.9rem; }
.funnel-label-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 3px; }
.funnel-track { background: #F1F5F9; border-radius: 5px; height: 9px; margin-bottom: 0.65rem; }
.funnel-fill { border-radius: 5px; height: 100%; transition: width 0.5s; }
.conv-rate-box { margin-top: 1rem; padding: 0.7rem; background: #ECFDF5; border-radius: 10px; text-align: center; }
.conv-rate-box span { font-size: 26px; font-weight: 700; color: #065F46; }
.conv-rate-box p { font-size: 12px; color: #10B981; margin-top: 2px; }
.source-bar-row { margin-bottom: 0.55rem; }
.source-label-row { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 2px; }
.source-track { background: #F1F5F9; border-radius: 5px; height: 7px; }
.source-fill { border-radius: 5px; height: 100%; transition: width 0.5s; }
.activity-item { display: flex; gap: 0.65rem; align-items: flex-start; padding: 0.55rem 0.85rem; background: #FAFAFA; border-radius: 8px; margin-bottom: 0.5rem; }
.activity-dot { width: 7px; height: 7px; border-radius: 50%; background: #6366F1; margin-top: 5px; flex-shrink: 0; }
.activity-text { flex: 1; font-size: 13px; color: #64748B; }
.activity-text strong { color: #0F172A; }
.activity-time { font-size: 11px; color: #94A3B8; white-space: nowrap; }
.activity-empty { color: #94A3B8; font-size: 13px; }

/* ── Users View ──────────────────────────────────────────── */
.section-intro { margin-bottom: 1rem; }
.section-intro p { font-size: 13px; color: #64748B; }
.role-chip { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.04em; }
.role-admin { background: #EEF2FF; color: #4338CA; }
.role-sales { background: #ECFDF5; color: #065F46; }
.btn-remove { padding: 4px 10px; border-radius: 6px; border: 1px solid #FECACA; background: #FEF2F2; color: #DC2626; font-size: 12px; cursor: pointer; font-family: inherit; }
.btn-remove:hover { background: #FEE2E2; }
.you-tag { font-size: 11px; color: #6366F1; font-weight: 600; background: #EEF2FF; padding: 2px 7px; border-radius: 6px; }