/* ========================================================
   LeadFlow CRM — Modern Design System
   ======================================================== */

/* ── CSS Variables ──────────────────────────────────────── */
:root {
  --primary:       #6366f1;
  --primary-dark:  #4f46e5;
  --primary-light: #eef2ff;
  --secondary:     #8b5cf6;
  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --info:          #3b82f6;
  --dark:          #0f172a;
  --text:          #1e293b;
  --text-muted:    #64748b;
  --border:        #e2e8f0;
  --bg:            #f8fafc;
  --bg-card:       #ffffff;
  --sidebar-w:     260px;
  --topbar-h:      64px;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
  --shadow-md:     0 4px 24px rgba(0,0,0,.10);
  --shadow-lg:     0 8px 40px rgba(0,0,0,.14);
  --transition:    .2s ease;
  --font:          'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button, input, select, textarea { font-family: var(--font); }
ul { list-style: none; }

/* ── Layout ─────────────────────────────────────────────── */
.app-body { display: flex; min-height: 100vh; }
.main-wrapper { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; transition: margin-left var(--transition); }
.main-wrapper.sidebar-collapsed { margin-left: 72px; }
.page-content { flex: 1; padding: 28px 32px; max-width: 1400px; width: 100%; }

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w); background: var(--dark);
  display: flex; flex-direction: column;
  z-index: 100; transition: width var(--transition);
  overflow: hidden;
}
.sidebar.collapsed { width: 72px; }
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; overflow: hidden; }
.brand-logo { width: 36px; height: 36px; flex-shrink: 0; }
.brand-logo svg { width: 36px; height: 36px; }
.brand-name { font-weight: 700; font-size: .95rem; color: #fff; white-space: nowrap; }
.sidebar.collapsed .brand-name { display: none; }
.sidebar-toggle {
  background: transparent; border: none; color: rgba(255,255,255,.5);
  cursor: pointer; padding: 6px; border-radius: 6px; display: flex;
  transition: color var(--transition), background var(--transition);
}
.sidebar-toggle:hover { color: #fff; background: rgba(255,255,255,.1); }
.sidebar-toggle svg { width: 18px; height: 18px; }

/* Sidebar Nav */
.sidebar-nav { flex: 1; overflow-y: auto; padding: 16px 10px; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }
.nav-section { margin-bottom: 24px; }
.nav-label {
  font-size: .68rem; font-weight: 600; letter-spacing: .08em;
  color: rgba(255,255,255,.35); text-transform: uppercase;
  padding: 0 10px; margin-bottom: 6px; display: block;
  white-space: nowrap; overflow: hidden;
}
.sidebar.collapsed .nav-label { opacity: 0; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px; color: rgba(255,255,255,.65);
  font-size: .875rem; font-weight: 500; transition: all var(--transition);
  position: relative; white-space: nowrap; overflow: hidden;
  text-decoration: none; margin-bottom: 2px;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.09); text-decoration: none; }
.nav-item.active { color: #fff; background: linear-gradient(135deg, var(--primary), var(--secondary)); }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar.collapsed .nav-item span:not(.nav-badge) { display: none; }
.nav-badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: .65rem; font-weight: 700; min-width: 18px; height: 18px;
  border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 5px;
}
.sidebar.collapsed .nav-badge { position: absolute; top: 6px; right: 6px; }

/* Sidebar User */
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0; overflow: hidden;
}
.su-avatar {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; color: #fff; position: relative;
}
.su-online {
  position: absolute; bottom: -2px; right: -2px; width: 10px; height: 10px;
  background: var(--success); border-radius: 50%; border: 2px solid var(--dark);
}
.su-info { flex: 1; min-width: 0; }
.su-info strong { display: block; color: #fff; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.su-info span { color: rgba(255,255,255,.45); font-size: .72rem; }
.sidebar.collapsed .su-info, .sidebar.collapsed .su-logout { display: none; }
.su-logout {
  width: 28px; height: 28px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.35); transition: all var(--transition);
  flex-shrink: 0; border: none; background: transparent; cursor: pointer;
  text-decoration: none;
}
.su-logout:hover { color: var(--danger); background: rgba(239,68,68,.15); }
.su-logout svg { width: 14px; height: 14px; }

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h); display: flex; align-items: center;
  justify-content: space-between; padding: 0 32px;
  background: var(--bg-card); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 16px; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-menu-btn {
  display: none; background: none; border: none; cursor: pointer;
  padding: 8px; border-radius: 8px; color: var(--text-muted);
}
.topbar-menu-btn svg { width: 20px; height: 20px; }
.topbar-search {
  position: relative; display: flex; align-items: center;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 10px; width: 320px; padding: 0 12px;
}
.topbar-search svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.topbar-search input {
  border: none; background: transparent; padding: 10px 10px;
  font-size: .875rem; color: var(--text); outline: none; width: 100%;
}
.topbar-search input::placeholder { color: var(--text-muted); }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  max-height: 360px; overflow-y: auto; display: none; z-index: 200;
}
.search-results.show { display: block; }
.sr-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  transition: background var(--transition); text-decoration: none; color: var(--text);
}
.sr-item:hover { background: var(--bg); }
.sri-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sri-info { flex: 1; min-width: 0; }
.sri-info strong { display: block; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sri-info span { font-size: .75rem; color: var(--text-muted); }
.sr-empty { padding: 16px; text-align: center; color: var(--text-muted); font-size: .875rem; }

/* Topbar Buttons */
.topbar-btn-wrap { position: relative; }
.topbar-btn {
  position: relative; background: none; border: none; cursor: pointer;
  width: 40px; height: 40px; border-radius: 10px; display: flex;
  align-items: center; justify-content: center; color: var(--text-muted);
  transition: all var(--transition);
}
.topbar-btn:hover { background: var(--bg); color: var(--text); }
.topbar-btn svg { width: 20px; height: 20px; }
.topbar-badge {
  position: absolute; top: 4px; right: 4px; background: var(--danger);
  color: #fff; font-size: .6rem; font-weight: 700; min-width: 16px; height: 16px;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  padding: 0 4px; border: 2px solid var(--bg-card);
}
.topbar-user-btn {
  display: flex; align-items: center; gap: 8px; background: none; border: none;
  cursor: pointer; padding: 6px 10px; border-radius: 10px;
  transition: background var(--transition);
}
.topbar-user-btn:hover { background: var(--bg); }
.tu-avatar {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.tu-info { text-align: left; }
.tu-info strong { display: block; font-size: .82rem; color: var(--text); line-height: 1.2; }
.tu-info span { font-size: .72rem; color: var(--text-muted); }
.tu-caret { width: 14px; height: 14px; color: var(--text-muted); }

/* Dropdown Panels */
.dropdown-panel {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  min-width: 320px; display: none; z-index: 300;
}
.dropdown-panel.show { display: block; animation: fadeSlideDown .15s ease; }
@keyframes fadeSlideDown { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }
.dp-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--border);
}
.dp-header h4 { font-size: .9rem; font-weight: 600; }
.dp-action { font-size: .78rem; color: var(--primary); }
.dp-body { max-height: 320px; overflow-y: auto; }
.dp-footer { padding: 10px 16px; border-top: 1px solid var(--border); text-align: center; }
.dp-footer a { font-size: .8rem; color: var(--primary); font-weight: 500; }
.dp-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: .875rem; }

/* Notification Items */
.notif-item {
  display: flex; gap: 12px; padding: 12px 16px;
  transition: background var(--transition); text-decoration: none; color: var(--text);
  border-bottom: 1px solid var(--border);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: #f0f4ff; }
.ni-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.ni-info    { background: #eff6ff; }
.ni-success { background: #f0fdf4; }
.ni-warning { background: #fffbeb; }
.ni-danger  { background: #fef2f2; }
.ni-content strong { display: block; font-size: .82rem; font-weight: 600; }
.ni-content p { font-size: .78rem; color: var(--text-muted); margin: 2px 0; }
.ni-content time { font-size: .72rem; color: var(--text-muted); }

/* Message Items in dropdown */
.msg-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  transition: background var(--transition); text-decoration: none; color: var(--text);
  border-bottom: 1px solid var(--border); position: relative;
}
.msg-item:hover { background: var(--bg); }
.msg-item.unread { background: #f0f4ff; }
.mi-avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.mi-content { flex: 1; min-width: 0; }
.mi-top { display: flex; justify-content: space-between; align-items: baseline; }
.mi-top strong { font-size: .82rem; }
.mi-top time { font-size: .7rem; color: var(--text-muted); }
.mi-content p { font-size: .78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mi-badge { background: var(--primary); color: #fff; font-size: .65rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }

/* User Panel */
.user-panel { min-width: 220px; }
.up-header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.up-avatar { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: .85rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.up-header div strong { display: block; font-size: .85rem; }
.up-header div span { font-size: .75rem; color: var(--text-muted); }
.up-body a, .up-footer a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; font-size: .85rem; color: var(--text);
  transition: background var(--transition); text-decoration: none;
}
.up-body a:hover { background: var(--bg); }
.up-body a svg { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }
.up-footer { border-top: 1px solid var(--border); }
.logout-link { color: var(--danger) !important; }
.logout-link svg { width: 15px; height: 15px; color: var(--danger) !important; flex-shrink: 0; }

/* ── Toast Notification System ──────────────────────────── */
.toast-container {
  position: fixed; top: 76px; right: 20px;
  z-index: 9999; display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.14), 0 2px 8px rgba(0,0,0,.08);
  min-width: 300px; max-width: 400px; pointer-events: all;
  transform: translateX(120%); opacity: 0;
  transition: transform .35s cubic-bezier(.34,1.56,.64,1), opacity .3s ease;
  position: relative; overflow: hidden; border: 1px solid transparent;
}
.toast.toast-show {
  transform: translateX(0); opacity: 1;
}
.toast.toast-hide {
  transform: translateX(120%); opacity: 0;
}
.toast-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.toast-danger  { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.toast-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.toast-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.toast-icon    { font-size: 1.2rem; flex-shrink: 0; line-height: 1.4; }
.toast-body    { flex: 1; min-width: 0; }
.toast-title   { display: block; font-size: .875rem; font-weight: 700; line-height: 1.3; }
.toast-msg     { font-size: .8rem; margin-top: 2px; opacity: .85; line-height: 1.4; }
.toast-close   {
  background: none; border: none; cursor: pointer; padding: 2px;
  opacity: .6; flex-shrink: 0; display: flex; align-items: center;
  color: inherit; transition: opacity .15s; margin-top: 1px;
}
.toast-close:hover { opacity: 1; }
.toast-close svg   { width: 14px; height: 14px; }
.toast-progress {
  position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  border-radius: 0 0 var(--radius) var(--radius);
  animation: toastProgress 4s linear forwards;
  transform-origin: left;
}
.toast-success .toast-progress { background: #22c55e; }
.toast-danger  .toast-progress { background: var(--danger); }
.toast-warning .toast-progress { background: var(--warning); }
.toast-info    .toast-progress { background: var(--info); }
@keyframes toastProgress {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* Legacy flash-toast still supported */
.flash-toast {
  position: fixed; top: 78px; right: 24px; z-index: 9999;
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 500; display: flex; align-items: center;
  gap: 12px; box-shadow: var(--shadow-md); transition: opacity .4s; max-width: 400px;
}
.flash-toast button { background: none; border: none; cursor: pointer; margin-left: auto; opacity: .7; font-size: 1rem; }
.flash-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.flash-danger  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.flash-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── Page Header ────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 28px; gap: 16px;
}
.page-title { font-size: 1.6rem; font-weight: 800; color: var(--dark); line-height: 1.2; }
.page-subtitle { color: var(--text-muted); font-size: .9rem; margin-top: 4px; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.ph-breadcrumb { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: .875rem; margin-bottom: 6px; }
.ph-breadcrumb a { color: var(--primary); }

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 20px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: .95rem; font-weight: 700; color: var(--dark); display: flex; align-items: center; gap: 8px; }
.card-title-icon { font-size: 1rem; }
.card-subtitle { font-size: .78rem; color: var(--text-muted); }
.card-link { font-size: .8rem; color: var(--primary); font-weight: 500; }
.card-body { padding: 20px; }
.card-body.p0 { padding: 0; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-sm); font-size: .875rem;
  font-weight: 600; cursor: pointer; border: 1.5px solid transparent;
  transition: all var(--transition); text-decoration: none; white-space: nowrap; line-height: 1;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; text-decoration: none; }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-full { width: 100%; justify-content: center; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn-xs { padding: 4px 10px; font-size: .75rem; border-radius: 6px; }

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 999px; font-size: .72rem; font-weight: 600;
}
.badge-new         { background: #eff6ff; color: #1d4ed8; }
.badge-contacted   { background: #f0f9ff; color: #0369a1; }
.badge-qualified   { background: #ecfdf5; color: #065f46; }
.badge-proposal    { background: #fffbeb; color: #92400e; }
.badge-negotiation { background: #fff7ed; color: #9a3412; }
.badge-won         { background: #f0fdf4; color: #166534; }
.badge-lost        { background: #fef2f2; color: #991b1b; }
.badge-danger  { background: #fef2f2; color: var(--danger); }
.badge-warning { background: #fffbeb; color: var(--warning); }
.badge-secondary { background: var(--bg); color: var(--text-muted); }

/* ── Stats Grid ─────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; display: flex; align-items: center;
  gap: 16px; box-shadow: var(--shadow); transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.sc-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sc-icon svg { width: 24px; height: 24px; }
.stat-blue   .sc-icon { background: #eff6ff; color: #2563eb; }
.stat-amber  .sc-icon { background: #fffbeb; color: #d97706; }
.stat-green  .sc-icon { background: #f0fdf4; color: #059669; }
.stat-purple .sc-icon { background: #faf5ff; color: #7c3aed; }
.stat-indigo .sc-icon { background: #eef2ff; color: #4f46e5; }
.stat-red    .sc-icon { background: #fef2f2; color: #dc2626; }
.sc-content { display: flex; flex-direction: column; min-width: 0; }
.sc-label { font-size: .75rem; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.sc-value { font-size: 1.6rem; font-weight: 800; color: var(--dark); line-height: 1; }
.sc-change { font-size: .72rem; margin-top: 4px; font-weight: 500; }
.sc-change.up { color: var(--success); }
.sc-change.down { color: var(--danger); }
.sc-change.neutral { color: var(--text-muted); }

/* ── Grid Layouts ───────────────────────────────────────── */
.grid-2-1 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 1100px) { .grid-2-1 { grid-template-columns: 1fr; } }

/* ── Data Table ─────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 11px 16px; font-size: .72rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em; background: var(--bg);
  border-bottom: 1px solid var(--border); text-align: left;
}
.data-table td { padding: 14px 16px; font-size: .85rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg); }
.empty-row { text-align: center; padding: 48px !important; color: var(--text-muted); }

/* Lead Name Cell */
.lead-name-cell { display: flex; align-items: center; gap: 10px; }
.ln-avatar {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700; color: #fff;
}
.lead-name-cell div strong { display: block; font-size: .85rem; font-weight: 600; }
.lead-name-cell div span { font-size: .75rem; color: var(--text-muted); }
.lead-link { color: var(--text); font-weight: 600; text-decoration: none; }
.lead-link:hover { color: var(--primary); }
.source-tag {
  display: inline-block; padding: 2px 8px; background: var(--bg);
  border-radius: 6px; font-size: .72rem; color: var(--text-muted); font-weight: 500;
}

/* Row Actions */
.row-actions { display: flex; gap: 4px; align-items: center; }
.ra-btn {
  width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--bg-card); display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: all var(--transition); cursor: pointer;
  text-decoration: none;
}
.ra-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.ra-btn.ra-danger:hover { background: var(--danger); border-color: var(--danger); }
.ra-btn svg { width: 13px; height: 13px; }

/* Deal info in table */
.deal-info strong { display: block; font-size: .85rem; }
.deal-info span { font-size: .75rem; color: var(--text-muted); }

/* Stage badge */
.stage-badge {
  display: inline-block; padding: 3px 10px; border-radius: 6px;
  font-size: .72rem; font-weight: 600;
}
.stage-prospect    { background: #f1f5f9; color: #64748b; }
.stage-qualified   { background: #eff6ff; color: #1d4ed8; }
.stage-proposal    { background: #fffbeb; color: #92400e; }
.stage-negotiation { background: #fff7ed; color: #9a3412; }
.stage-closed_won  { background: #f0fdf4; color: #166534; }
.stage-closed_lost { background: #fef2f2; color: #991b1b; }

/* Probability bar */
.prob-bar { height: 5px; background: #e2e8f0; border-radius: 99px; overflow: hidden; width: 80px; margin-bottom: 3px; }
.prob-fill { height: 100%; background: var(--primary); border-radius: 99px; }

/* ── Activity Feed ──────────────────────────────────────── */
.activity-feed { padding: 4px 0; }
.activity-item { display: flex; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.ai-icon { width: 32px; height: 32px; border-radius: 8px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: .9rem; flex-shrink: 0; }
.ai-content p { font-size: .83rem; }
.ai-content small { font-size: .75rem; color: var(--text-muted); }
.ai-content time { font-size: .72rem; color: var(--text-muted); display: block; margin-top: 3px; }
.activity-item a { color: var(--primary); }

/* ── Performers ─────────────────────────────────────────── */
.performers-list { display: flex; flex-direction: column; gap: 12px; }
.performer-item { display: flex; align-items: center; gap: 12px; }
.perf-rank {
  width: 24px; height: 24px; border-radius: 6px; display: flex; align-items: center;
  justify-content: center; font-size: .72rem; font-weight: 800; flex-shrink: 0;
}
.rank-1 { background: #fef3c7; color: #d97706; }
.rank-2 { background: #f1f5f9; color: #64748b; }
.rank-3 { background: #fff7ed; color: #9a3412; }
.rank-4 { background: var(--bg); color: var(--text-muted); }
.perf-avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.perf-info { flex: 1; }
.perf-info strong { display: block; font-size: .85rem; }
.perf-info span { font-size: .75rem; color: var(--text-muted); }
.perf-stats { text-align: right; }
.perf-stats strong { display: block; font-size: .85rem; color: var(--success); }
.perf-stats span { font-size: .75rem; color: var(--text-muted); }

/* ── Chart Legend ───────────────────────────────────────── */
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 16px; }
.cl-item { display: flex; align-items: center; gap: 6px; font-size: .78rem; }
.cl-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.cl-item strong { font-weight: 600; margin-left: 4px; }

/* ── Pagination ─────────────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 24px; }
.page-btn {
  padding: 7px 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background: var(--bg-card); color: var(--text); font-size: .85rem; font-weight: 500;
  text-decoration: none; transition: all var(--transition);
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Status Tabs ────────────────────────────────────────── */
.status-tabs {
  display: flex; gap: 4px; margin-bottom: 20px; flex-wrap: wrap;
  background: var(--bg-card); padding: 6px; border-radius: 10px;
  border: 1px solid var(--border); width: fit-content;
}
.status-tab {
  padding: 6px 14px; border-radius: 7px; font-size: .8rem; font-weight: 500;
  color: var(--text-muted); text-decoration: none; transition: all var(--transition);
  display: flex; align-items: center; gap: 5px;
}
.status-tab:hover { color: var(--text); background: var(--bg); }
.status-tab.active { background: var(--primary); color: #fff; }
.status-tab span { font-size: .7rem; opacity: .8; }

/* ── Filter Card ────────────────────────────────────────── */
.filter-card { margin-bottom: 20px; }
.filters-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filter-group { flex: 1; min-width: 160px; }
.filter-group select, .filter-group input { width: 100%; }
.filter-btns { display: flex; gap: 8px; flex: 0 0 auto; }
.search-input-wrap { position: relative; display: flex; align-items: center; }
.search-input-wrap svg { position: absolute; left: 12px; width: 15px; height: 15px; color: var(--text-muted); }
.search-input-wrap input { padding-left: 36px; }

/* ── Leads Page Header ──────────────────────────────────── */
.leads-page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.lph-left .page-title { font-size: 1.6rem; font-weight: 800; }
.lph-left .page-subtitle { color: var(--text-muted); font-size: .875rem; margin-top: 3px; display: flex; align-items: center; gap: 10px; }
.lph-count { font-weight: 700; color: var(--primary); }
.lph-clear-link { font-size: .75rem; color: var(--danger); background: #fef2f2; padding: 2px 8px; border-radius: 999px; font-weight: 500; text-decoration: none; }
.lph-clear-link:hover { background: #fee2e2; }
.lph-right { display: flex; gap: 10px; align-items: center; }

/* ── Filter Bar ─────────────────────────────────────────── */
.leads-filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

/* Search row */
.lfb-search {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}
.lfb-search > svg {
  position: absolute; left: 16px; width: 18px; height: 18px;
  color: var(--text-muted); pointer-events: none; flex-shrink: 0;
}
.lfb-search input {
  width: 100%; padding: 11px 44px 11px 46px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-size: .9rem; color: var(--text); background: var(--bg);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.lfb-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.1);
  background: #fff;
}
.lfb-search input::placeholder { color: #adb5bd; }
.lfb-clear-input {
  position: absolute; right: 14px; background: none; border: none;
  cursor: pointer; color: var(--text-muted); display: flex; padding: 4px;
  border-radius: 6px; transition: all var(--transition);
}
.lfb-clear-input:hover { color: var(--danger); background: #fef2f2; }
.lfb-clear-input svg { width: 15px; height: 15px; }

/* Filters row */
.lfb-filters {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

/* Select wrapper */
.lfb-select-wrap {
  position: relative; flex: 1; min-width: 150px;
}
.lfb-select-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--text-muted); pointer-events: none;
}
.lfb-select {
  width: 100%; padding: 9px 32px 9px 34px;
  border: 1.5px solid var(--border); border-radius: 9px;
  font-size: .82rem; color: var(--text); background: var(--bg);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer; outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.lfb-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.1);
  background-color: #fff;
}

/* Search + Reset buttons */
.lfb-search-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 20px; border-radius: 9px;
  background: var(--primary); color: #fff; border: none;
  font-size: .85rem; font-weight: 600; cursor: pointer;
  transition: background var(--transition); white-space: nowrap; flex-shrink: 0;
}
.lfb-search-btn:hover { background: var(--primary-dark); }
.lfb-search-btn svg { width: 14px; height: 14px; }

.lfb-reset-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 9px;
  border: 1.5px solid var(--border); background: var(--bg-card);
  color: var(--text-muted); font-size: .82rem; font-weight: 500;
  text-decoration: none; transition: all var(--transition); flex-shrink: 0; white-space: nowrap;
}
.lfb-reset-btn:hover { border-color: var(--danger); color: var(--danger); background: #fef2f2; }
.lfb-reset-btn svg { width: 13px; height: 13px; }

/* Active filter chips */
.lfb-chips {
  display: flex; align-items: center; gap: 6px;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px dashed var(--border); flex-wrap: wrap;
}
.lfb-chips-label { font-size: .72rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.lfb-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 12px; border-radius: 999px;
  background: var(--primary-light); color: var(--primary);
  font-size: .75rem; font-weight: 600; text-decoration: none;
  border: 1px solid rgba(99,102,241,.2);
  transition: all var(--transition);
}
.lfb-chip:hover { background: #e0e7ff; border-color: var(--primary); }

/* ── Status Nav ─────────────────────────────────────────── */
.leads-status-nav {
  display: flex; align-items: center; gap: 2px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 5px; margin-bottom: 16px;
  overflow-x: auto; flex-wrap: nowrap;
}
.leads-status-nav::-webkit-scrollbar { height: 0; }
.lsn-tab {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: 8px;
  font-size: .82rem; font-weight: 500; color: var(--text-muted);
  text-decoration: none; white-space: nowrap;
  transition: all var(--transition); flex-shrink: 0;
}
.lsn-tab:hover { color: var(--text); background: var(--bg); text-decoration: none; }
.lsn-tab.active { background: var(--primary); color: #fff; }
.lsn-tab.active .lsn-count { background: rgba(255,255,255,.25); color: #fff; }
.lsn-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.dot-new         { background: #3b82f6; }
.dot-contacted   { background: #0ea5e9; }
.dot-qualified   { background: #10b981; }
.dot-proposal    { background: #f59e0b; }
.dot-negotiation { background: #f97316; }
.dot-won         { background: #22c55e; }
.dot-lost        { background: #ef4444; }
.lsn-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; font-size: .68rem; font-weight: 700;
  background: var(--bg); color: var(--text-muted);
  transition: all var(--transition);
}

/* ── Leads Toolbar ──────────────────────────────────────── */
.leads-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; gap: 12px;
}
.lt-left { display: flex; align-items: center; gap: 12px; }
.lt-select-all-wrap {
  display: flex; align-items: center; gap: 7px;
  font-size: .82rem; color: var(--text-muted); cursor: pointer;
}
.lt-select-all-wrap input { cursor: pointer; width: 15px; height: 15px; }
.lt-divider { width: 1px; height: 16px; background: var(--border); }
.lt-count { font-size: .82rem; color: var(--text-muted); }
.lt-count strong { color: var(--text); }
.lt-right { display: flex; align-items: center; gap: 8px; }
.view-toggle { display: flex; gap: 4px; }
.vt-btn {
  padding: 6px 10px; border: 1.5px solid var(--border); background: var(--bg-card);
  border-radius: 7px; cursor: pointer; color: var(--text-muted); transition: all var(--transition);
}
.vt-btn svg { width: 15px; height: 15px; display: block; }
.vt-btn:hover, .vt-btn.active { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* ── Grid View ──────────────────────────────────────────── */
.leads-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 24px; }
.lead-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: transform var(--transition), box-shadow var(--transition); }
.lead-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.lc-header { padding: 16px 16px 12px; display: flex; align-items: center; justify-content: space-between; }
.lc-avatar { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: .82rem; font-weight: 700; color: #fff; }
.lc-badges { display: flex; gap: 4px; flex-wrap: wrap; }
.lc-body { padding: 0 16px 12px; }
.lc-body h4 a { color: var(--dark); font-size: .92rem; font-weight: 700; text-decoration: none; }
.lc-body h4 a:hover { color: var(--primary); }
.lc-company, .lc-detail { font-size: .78rem; color: var(--text-muted); margin-top: 4px; }
.lc-budget { font-size: .82rem; color: var(--success); font-weight: 600; margin-top: 6px; }
.lc-footer { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--bg); }
.lc-assigned { font-size: .75rem; color: var(--text-muted); }
.lc-actions { display: flex; gap: 6px; }

/* ── Empty States ───────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; }
.es-icon { font-size: 2.5rem; display: block; margin-bottom: 12px; }
.empty-state p { color: var(--text-muted); margin-bottom: 16px; }
.empty-state-sm { padding: 32px; text-align: center; color: var(--text-muted); font-size: .875rem; }
.empty-page-state { text-align: center; padding: 80px 24px; }
.eps-icon { font-size: 3.5rem; margin-bottom: 16px; }
.eps-icon + h3 { font-size: 1.1rem; margin-bottom: 8px; }
.eps-icon ~ p { color: var(--text-muted); }

/* ── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: none; align-items: center; justify-content: center; z-index: 1000;
  backdrop-filter: blur(2px);
}
.modal-overlay.show { display: flex; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.modal {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 32px; max-width: 440px; width: 90%; box-shadow: var(--shadow-lg);
  text-align: center; animation: scaleIn .2s ease;
}
@keyframes scaleIn { from { opacity:0; transform:scale(.93); } to { opacity:1; transform:scale(1); } }
.modal-icon { font-size: 2.5rem; margin-bottom: 16px; }
.modal-icon.danger { }
.modal h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.modal p { color: var(--text-muted); font-size: .9rem; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-header h3 { margin: 0; }
.modal-close { background: none; border: none; font-size: 1.1rem; cursor: pointer; color: var(--text-muted); }
.modal-body { text-align: left; margin-bottom: 16px; }

/* ── Forms ──────────────────────────────────────────────── */
.form-layout { display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start; }
@media (max-width: 960px) { .form-layout { grid-template-columns: 1fr; } }
.form-card { margin-bottom: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }
.form-group label { font-size: .82rem; font-weight: 600; color: var(--text); display: flex; justify-content: space-between; }
.form-group.required label::after { content: '*'; color: var(--danger); margin-left: 2px; }
.form-group input, .form-group select, .form-group textarea {
  padding: 9px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: .875rem; color: var(--text); background: var(--bg-card);
  transition: border-color var(--transition), box-shadow var(--transition); outline: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.input-icon-wrap { position: relative; }
.input-icon-wrap .input-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-muted); pointer-events: none; }
.input-icon-wrap input { padding-left: 38px; width: 100%; }
.toggle-password { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--text-muted); display: flex; }
.toggle-password svg { width: 16px; height: 16px; }
.select-styled { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px !important; cursor: pointer; }

/* Priority Selector */
.priority-selector { display: flex; gap: 8px; }
.priority-option { flex: 1; cursor: pointer; }
.priority-option input { display: none; }
.priority-option span {
  display: block; text-align: center; padding: 8px; border-radius: 8px;
  font-size: .8rem; font-weight: 600; border: 2px solid var(--border);
  transition: all var(--transition);
}
.priority-option input:checked + span { border-color: transparent; color: #fff; }
.priority-option.low  input:checked + span { background: var(--text-muted); }
.priority-option.medium input:checked + span { background: var(--warning); }
.priority-option.high input:checked + span { background: var(--danger); }

/* Tags Selector */
.tags-selector { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-option input { display: none; }
.tag-pill {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  font-size: .78rem; font-weight: 600; cursor: pointer;
  background: color-mix(in srgb, var(--tag-color) 15%, white);
  color: var(--tag-color); border: 1.5px solid transparent;
  transition: all var(--transition);
}
.tag-option input:checked + .tag-pill { background: var(--tag-color); color: #fff; }

/* Form Actions Card */
.form-actions-card { display: flex; flex-direction: column; gap: 8px; }

/* Form Check */
.form-check-row { margin-bottom: 20px; }
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: .875rem; color: var(--text-muted); }
.form-check input { display: none; }
.checkmark {
  width: 17px; height: 17px; border: 2px solid var(--border); border-radius: 4px;
  flex-shrink: 0; transition: all var(--transition);
}
.form-check input:checked + .checkmark { background: var(--primary); border-color: var(--primary); }
.forgot-link { font-size: .8rem; color: var(--primary); font-weight: 400; }

/* Form Actions inline */
.form-actions { display: flex; gap: 8px; margin-top: 12px; }

/* Alert */
.alert { padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: .875rem; display: flex; align-items: flex-start; gap: 10px; }
.alert-icon { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert ul { margin: 4px 0 0 16px; }

/* ── Auth Pages ─────────────────────────────────────────── */
.auth-body { background: var(--bg); min-height: 100vh; }
.auth-wrapper { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
@media (max-width: 900px) { .auth-wrapper { grid-template-columns: 1fr; } }
.auth-left {
  background: linear-gradient(150deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
  padding: 48px 48px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.auth-left::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 70%, rgba(99,102,241,.3), transparent 50%),
              radial-gradient(circle at 70% 20%, rgba(139,92,246,.2), transparent 50%);
}
.auth-left > * { position: relative; z-index: 1; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand .brand-icon { width: 40px; height: 40px; }
.auth-brand span { font-size: 1.1rem; font-weight: 800; color: #fff; }
.auth-hero { margin: auto 0; }
.auth-hero h1 { font-size: 2.6rem; font-weight: 900; color: #fff; line-height: 1.15; }
.auth-hero h1 span { background: linear-gradient(90deg,#818cf8,#c084fc); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.auth-hero p { color: rgba(255,255,255,.6); font-size: 1rem; margin-top: 16px; max-width: 380px; }
.auth-features { display: flex; flex-direction: column; gap: 16px; }
.auth-feature { display: flex; align-items: center; gap: 14px; }
.af-icon { width: 40px; height: 40px; border-radius: 10px; background: rgba(255,255,255,.1); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.auth-feature strong { display: block; color: #fff; font-size: .875rem; }
.auth-feature span { color: rgba(255,255,255,.5); font-size: .78rem; }
.auth-stats { display: flex; gap: 32px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,.1); }
.as-item strong { display: block; font-size: 1.4rem; font-weight: 800; color: #fff; }
.as-item span { font-size: .75rem; color: rgba(255,255,255,.5); }

/* Right panel */
.auth-right { display: flex; align-items: center; justify-content: center; padding: 48px; background: #fff; }
@media (max-width: 900px) { .auth-left { display: none; } .auth-right { padding: 32px 24px; } }
.auth-form-wrap { width: 100%; max-width: 420px; }
.auth-form-header { margin-bottom: 32px; }
.auth-form-header h2 { font-size: 1.7rem; font-weight: 800; color: var(--dark); }
.auth-form-header p { color: var(--text-muted); margin-top: 6px; }
.auth-form { display: flex; flex-direction: column; gap: 0; }
.auth-demo-creds { margin-top: 24px; padding: 16px; background: var(--bg); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.auth-demo-creds p { font-size: .78rem; color: var(--text-muted); margin-bottom: 10px; font-weight: 500; }
.demo-creds { display: flex; flex-direction: column; gap: 6px; }
.demo-cred {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; transition: all var(--transition);
}
.demo-cred:hover { border-color: var(--primary); background: var(--primary-light); }
.demo-cred span:last-child { font-size: .8rem; color: var(--text-muted); }
.dc-role { font-size: .68rem; font-weight: 700; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.dc-role.admin   { background: #faf5ff; color: #7c3aed; }
.dc-role.manager { background: #eff6ff; color: #1d4ed8; }
.dc-role.sales   { background: #f0fdf4; color: #166534; }

/* ── Notifications Page ─────────────────────────────────── */
.notifications-list { display: flex; flex-direction: column; gap: 0; }
.notif-day-group { margin-bottom: 24px; }
.ndg-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); padding: 0 0 10px; }
.notif-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px; margin-bottom: 8px; display: flex; gap: 14px; align-items: flex-start; position: relative;
  transition: box-shadow var(--transition);
}
.notif-card.unread { border-left: 3px solid var(--primary); background: #fafbff; }
.notif-card:hover { box-shadow: var(--shadow); }
.nc-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.ni-info    { background: #eff6ff; }
.ni-success { background: #f0fdf4; }
.ni-warning { background: #fffbeb; }
.ni-danger  { background: #fef2f2; }
.nc-body { flex: 1; }
.nc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.nc-top h4 { font-size: .9rem; font-weight: 600; }
.nc-time { font-size: .75rem; color: var(--text-muted); }
.nc-body p { font-size: .85rem; color: var(--text-muted); margin-bottom: 10px; }
.nc-actions { display: flex; gap: 8px; }
.nc-dot { position: absolute; top: 16px; right: 16px; width: 8px; height: 8px; background: var(--primary); border-radius: 50%; }

/* ── Chat ───────────────────────────────────────────────── */
.chat-layout { display: flex; height: calc(100vh - var(--topbar-h) - 56px); margin: -28px -32px; overflow: hidden; }
.chat-sidebar { width: 300px; border-right: 1px solid var(--border); display: flex; flex-direction: column; background: var(--bg-card); flex-shrink: 0; }
.chat-sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--border); }
.chat-sidebar-header h3 { font-size: .95rem; font-weight: 700; }
.chat-search { padding: 10px 12px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.chat-search svg { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }
.chat-search input { border: none; background: transparent; outline: none; font-size: .85rem; width: 100%; color: var(--text); }
.conv-list { flex: 1; overflow-y: auto; }
.conv-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text);
  transition: background var(--transition); position: relative;
}
.conv-item:hover { background: var(--bg); }
.conv-item.active { background: var(--primary-light); }
.conv-item.has-unread { background: #f5f7ff; }
.ci-avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; color: #fff; flex-shrink: 0; position: relative; }
.ci-online { position: absolute; bottom: 0; right: 0; width: 10px; height: 10px; background: var(--success); border-radius: 50%; border: 2px solid var(--bg-card); }
.ci-content { flex: 1; min-width: 0; }
.ci-top { display: flex; justify-content: space-between; align-items: baseline; }
.ci-top strong { font-size: .85rem; font-weight: 600; }
.ci-top time { font-size: .7rem; color: var(--text-muted); }
.ci-content p { font-size: .78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.ci-new-label { color: var(--primary) !important; font-style: italic; }
.ci-badge { background: var(--primary); color: #fff; font-size: .65rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px; flex-shrink: 0; }
.conv-empty { padding: 32px 16px; text-align: center; }
.conv-empty p { color: var(--text-muted); font-size: .875rem; margin-bottom: 12px; }

/* Chat Main */
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--text-muted); }
.ces-icon { font-size: 3rem; }
.chat-empty-state h3 { font-size: 1.1rem; color: var(--dark); }
.chat-empty-state p { font-size: .875rem; }
.chat-header { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; background: var(--bg-card); flex-shrink: 0; }
.ch-user { display: flex; align-items: center; gap: 10px; flex: 1; }
.ch-avatar { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 700; color: #fff; flex-shrink: 0; position: relative; }
.ch-online { position: absolute; bottom: 0; right: 0; width: 10px; height: 10px; background: var(--success); border-radius: 50%; border: 2px solid var(--bg-card); }
.ch-user div strong { display: block; font-size: .9rem; font-weight: 700; }
.ch-user div span { font-size: .75rem; color: var(--text-muted); }
.ch-lead-context { font-size: .8rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.ch-lead-context a { color: var(--primary); }
.ch-actions { display: flex; gap: 6px; }
.ch-btn { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); color: var(--text-muted); transition: all var(--transition); text-decoration: none; }
.ch-btn:hover { background: var(--bg); color: var(--text); }
.ch-btn svg { width: 15px; height: 15px; }

/* Messages */
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 4px; background: #f8f9ff; }
.chat-date-divider { text-align: center; margin: 12px 0; }
.chat-date-divider span { font-size: .72rem; color: var(--text-muted); background: rgba(255,255,255,.9); padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border); }
.chat-start-msg { text-align: center; padding: 48px 24px; }
.csm-avatar { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; font-weight: 700; color: #fff; margin: 0 auto 12px; }
.chat-start-msg h4 { font-size: 1rem; margin-bottom: 6px; }
.chat-start-msg p { font-size: .875rem; color: var(--text-muted); }
.chat-msg { display: flex; gap: 8px; max-width: 72%; margin-bottom: 4px; }
.chat-msg.msg-out { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg.msg-in { align-self: flex-start; }
.cm-avatar { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .65rem; font-weight: 700; color: #fff; flex-shrink: 0; align-self: flex-end; }
.cm-bubble { padding: 10px 14px; border-radius: 18px; max-width: 100%; position: relative; }
.msg-in  .cm-bubble { background: var(--bg-card); border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.msg-out .cm-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.cm-bubble p { font-size: .875rem; line-height: 1.5; word-break: break-word; margin: 0; }
.cm-bubble time { font-size: .65rem; opacity: .7; display: block; margin-top: 4px; text-align: right; }
.cm-status { font-size: .65rem; opacity: .7; margin-left: 4px; }

/* Chat Input */
.chat-input-area { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--bg-card); flex-shrink: 0; }
.chat-input-form { display: flex; flex-direction: column; gap: 6px; }
.chat-input-wrap { display: flex; align-items: flex-end; gap: 8px; background: var(--bg); border: 1.5px solid var(--border); border-radius: 14px; padding: 6px 8px; transition: border-color var(--transition); }
.chat-input-wrap:focus-within { border-color: var(--primary); }
.chat-attach-btn { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 6px; border-radius: 8px; transition: all var(--transition); display: flex; }
.chat-attach-btn:hover { color: var(--primary); background: var(--primary-light); }
.chat-attach-btn svg { width: 18px; height: 18px; }
#messageInput { flex: 1; background: transparent; border: none; outline: none; font-size: .9rem; color: var(--text); resize: none; max-height: 120px; line-height: 1.5; padding: 4px 0; }
.chat-send-btn { width: 36px; height: 36px; border-radius: 10px; background: var(--primary); color: #fff; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background var(--transition); flex-shrink: 0; }
.chat-send-btn:hover { background: var(--primary-dark); }
.chat-send-btn:disabled { opacity: .5; }
.chat-send-btn svg { width: 16px; height: 16px; }
.chat-input-meta { font-size: .72rem; color: var(--text-muted); }
.chat-input-meta kbd { background: var(--bg); border: 1px solid var(--border); border-radius: 3px; padding: 1px 4px; font-size: .7rem; }

/* Chat Context Panel */
.chat-context-panel { width: 260px; border-left: 1px solid var(--border); background: var(--bg-card); display: flex; flex-direction: column; flex-shrink: 0; }
.ccp-header { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.ccp-header h4 { font-size: .875rem; font-weight: 700; }
.ccp-body { flex: 1; overflow-y: auto; padding: 16px; }
.ccp-lead { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.cl-avatar { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.ccp-lead strong { display: block; font-size: .875rem; font-weight: 600; }
.ccp-lead span { font-size: .78rem; color: var(--text-muted); }
.ccp-details { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.ccd-item { display: flex; justify-content: space-between; align-items: center; font-size: .8rem; }
.ccd-item span { color: var(--text-muted); }
.ccd-item strong, .ccd-item a { font-weight: 600; }

/* ── Lead Detail Page ───────────────────────────────────── */
.lead-detail-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .lead-detail-layout { grid-template-columns: 1fr; } }
.lead-profile-card { overflow: visible; }
.lpc-cover { height: 100px; background: linear-gradient(135deg, var(--primary), var(--secondary)); border-radius: var(--radius) var(--radius) 0 0; }
.lpc-body { padding: 0 24px 20px; position: relative; display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.lpc-avatar { width: 72px; height: 72px; border-radius: 18px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; font-weight: 800; color: #fff; border: 4px solid var(--bg-card); margin-top: -36px; flex-shrink: 0; box-shadow: var(--shadow-md); }
.lpc-info { flex: 1; padding-top: 8px; }
.lpc-info h2 { font-size: 1.3rem; font-weight: 800; color: var(--dark); }
.lpc-title { color: var(--text-muted); font-size: .875rem; margin: 4px 0; }
.lpc-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.lpc-quick-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; padding-top: 8px; }
.qa-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px;
  border: 1.5px solid var(--border); border-radius: 8px; font-size: .78rem; font-weight: 600;
  color: var(--text); text-decoration: none; transition: all var(--transition);
}
.qa-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.qa-btn svg { width: 14px; height: 14px; }
.lpc-contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.lcg-item { display: flex; flex-direction: column; gap: 3px; }
.lcg-item span { font-size: .72rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.lcg-item strong, .lcg-item a { font-size: .875rem; font-weight: 600; color: var(--dark); }
.lcg-item a:hover { color: var(--primary); }
.lpc-notes { padding: 20px 24px; }
.lpc-notes h4 { font-size: .875rem; font-weight: 700; margin-bottom: 8px; }
.lpc-notes p { font-size: .875rem; color: var(--text-muted); white-space: pre-wrap; }

/* Timeline */
.timeline { padding: 8px 20px; }
.timeline-item { display: flex; gap: 14px; padding: 14px 0; border-left: 2px solid var(--border); margin-left: 18px; padding-left: 24px; position: relative; }
.timeline-item:last-child { border-left: none; }
.tl-dot { position: absolute; left: -19px; top: 16px; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .9rem; border: 3px solid var(--bg-card); }
.tl-content { flex: 1; min-width: 0; }
.tl-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.tl-header h4 { font-size: .875rem; font-weight: 700; flex: 1; }
.tl-type { font-size: .72rem; padding: 2px 8px; background: var(--bg); border-radius: 6px; color: var(--text-muted); font-weight: 500; }
.tl-content time { font-size: .72rem; color: var(--text-muted); }
.tl-content p { font-size: .85rem; color: var(--text-muted); }
.tl-content small { font-size: .75rem; color: var(--text-muted); }

/* Collapsible panel */
.collapsible-panel { display: none; padding: 20px; border-bottom: 1px solid var(--border); background: var(--bg); }
.collapsible-panel.open { display: block; }
.activity-form .form-group { margin-bottom: 12px; }

/* Deals list */
.deals-list { padding: 8px 0; }
.deal-item { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.deal-item:last-child { border-bottom: none; }
.di-left { flex: 1; }
.di-left h4 { font-size: .9rem; font-weight: 600; margin-bottom: 6px; }
.di-center { flex: 0 0 140px; }
.di-center small { font-size: .72rem; color: var(--text-muted); }
.di-right { text-align: right; }
.di-right strong { display: block; font-size: .9rem; color: var(--success); font-weight: 700; }
.di-right span { font-size: .75rem; color: var(--text-muted); }

/* Status flow */
.status-flow { display: flex; align-items: center; margin-top: 12px; }
.sf-step { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sf-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--border); border: 2px solid var(--border); transition: all var(--transition); }
.sf-step span { font-size: .65rem; color: var(--text-muted); white-space: nowrap; }
.sf-step.done .sf-dot { background: var(--primary); border-color: var(--primary); }
.sf-step.current .sf-dot { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99,102,241,.2); }
.sf-step.current span { color: var(--primary); font-weight: 600; }
.sf-line { flex: 1; height: 2px; background: var(--border); }
.sf-line.done { background: var(--primary); }
.lead-outcome { margin-top: 14px; padding: 10px; border-radius: 8px; text-align: center; font-weight: 700; font-size: .875rem; }
.lead-outcome.won  { background: #f0fdf4; color: #166534; }
.lead-outcome.lost { background: #fef2f2; color: #991b1b; }

/* Score display */
.score-display { display: flex; gap: 16px; align-items: center; }
.score-circle { position: relative; width: 80px; height: 80px; flex-shrink: 0; }
.score-circle svg { width: 80px; height: 80px; transform: rotate(-90deg); }
.sc-inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.sc-inner strong { font-size: 1.2rem; font-weight: 800; line-height: 1; }
.sc-inner span { font-size: .65rem; color: var(--text-muted); margin-top: 2px; }
.score-details { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.sd-item { font-size: .75rem; color: var(--text-muted); padding: 3px 0; }
.sd-item.done { color: var(--success); text-decoration: none; }
.sd-item.done::before { content: '✓ '; }

/* Assigned user */
.assigned-user { display: flex; align-items: center; gap: 10px; }
.au-avatar { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: .82rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.assigned-user strong { display: block; font-size: .9rem; }
.assigned-user span { font-size: .78rem; color: var(--text-muted); }

/* Detail list */
.detail-list { display: flex; flex-direction: column; gap: 12px; }
.dl-item { display: flex; justify-content: space-between; align-items: center; font-size: .85rem; }
.dl-item span { color: var(--text-muted); }
.dl-item strong { font-weight: 600; }
.text-success { color: var(--success) !important; }
.text-muted { color: var(--text-muted); }

/* ── Pipeline / Kanban ──────────────────────────────────── */
.pipeline-summary { display: flex; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.ps-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 20px; flex: 1; min-width: 160px; }
.ps-item span { display: block; font-size: .75rem; color: var(--text-muted); margin-bottom: 4px; }
.ps-item strong { font-size: 1.2rem; font-weight: 800; }
.kanban-board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 16px; min-height: 500px; }
.kanban-board::-webkit-scrollbar { height: 6px; }
.kanban-board::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
.kanban-col { flex: 0 0 240px; display: flex; flex-direction: column; }
.kc-header { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm) var(--radius-sm) 0 0; padding: 12px 14px; border-top: 3px solid; }
.kc-title { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; }
.kc-title h4 { font-size: .82rem; font-weight: 700; flex: 1; }
.kc-count { font-size: .7rem; font-weight: 700; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 1px 6px; }
.kc-total { font-size: .78rem; font-weight: 700; color: var(--text-muted); }
.kc-body {
  flex: 1; background: var(--bg); border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm); padding: 8px;
  min-height: 300px; transition: background var(--transition);
}
.kc-body.drag-over { background: var(--primary-light); border-color: var(--primary); }
.kc-empty { text-align: center; padding: 24px 12px; font-size: .78rem; color: var(--text-muted); }
.deal-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; margin-bottom: 8px; cursor: grab; transition: box-shadow var(--transition), opacity var(--transition);
}
.deal-card:hover { box-shadow: var(--shadow-md); }
.deal-card.dragging { opacity: .5; cursor: grabbing; }
.dc-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; margin-bottom: 4px; }
.dc-header h5 { font-size: .82rem; font-weight: 700; flex: 1; }
.dc-header h5 a { color: var(--dark); text-decoration: none; }
.dc-header h5 a:hover { color: var(--primary); }
.dc-value { font-size: .78rem; font-weight: 700; color: var(--success); white-space: nowrap; }
.dc-company { font-size: .75rem; color: var(--text-muted); margin-bottom: 8px; }
.dc-prob { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.dc-prob span { font-size: .7rem; color: var(--text-muted); }
.dc-footer { display: flex; align-items: center; justify-content: space-between; }
.dc-avatar { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .6rem; font-weight: 700; color: #fff; }
.dc-actions a { font-size: .72rem; color: var(--primary); font-weight: 500; }

/* ── Responsive ─────────────────────────────────────────── */

/* Tablet — 1024px */
@media (max-width: 1024px) {
  :root { --sidebar-w: 220px; }
  .page-content { padding: 20px 24px; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .grid-2-1 { grid-template-columns: 1fr; }
  .lead-detail-layout { grid-template-columns: 1fr 280px; }
  .form-layout { grid-template-columns: 1fr 300px; }
  .topbar-search { width: 240px; }
  .kanban-board { gap: 10px; }
  .kanban-col { flex: 0 0 210px; }
}

/* Large mobile / small tablet — 768px */
@media (max-width: 768px) {
  :root { --sidebar-w: 260px; }

  /* Sidebar slides off-screen, opens as overlay */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: none;
    z-index: 200;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,.35);
  }

  /* Overlay backdrop */
  .sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 199;
    backdrop-filter: blur(2px);
  }
  .sidebar-backdrop.show { display: block; }

  .main-wrapper { margin-left: 0 !important; }

  /* Topbar */
  .topbar { padding: 0 16px; }
  .topbar-menu-btn { display: flex; }
  .topbar-search { width: 180px; }
  .tu-info { display: none; }
  .topbar-btn { width: 36px; height: 36px; }

  /* Page layout */
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { padding: 14px; }
  .sc-value { font-size: 1.3rem; }
  .grid-2-1 { grid-template-columns: 1fr; gap: 14px; }

  /* Page headers */
  .page-header,
  .leads-page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .page-actions,
  .lph-right { width: 100%; justify-content: flex-end; }

  /* Filter bar */
  .lfb-filters { flex-direction: column; align-items: stretch; }
  .lfb-select-wrap { min-width: 100%; }
  .lfb-search-btn,
  .lfb-reset-btn { justify-content: center; }

  /* Status nav — scroll horizontally */
  .leads-status-nav { flex-wrap: nowrap; overflow-x: auto; padding: 4px; }
  .lsn-tab { padding: 6px 10px; font-size: .78rem; }

  /* Table — make scrollable */
  .card .card-body.p0 { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 700px; }

  /* Forms */
  .form-layout { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .lead-detail-layout { grid-template-columns: 1fr; }

  /* Chat */
  .chat-layout { height: calc(100vh - var(--topbar-h)); margin: 0 -16px; }
  .chat-sidebar { display: none; }
  .chat-context-panel { display: none; }
  .chat-messages { padding: 12px; }
  .chat-msg { max-width: 90%; }

  /* Kanban */
  .kanban-board { gap: 10px; padding-bottom: 12px; }
  .kanban-col { flex: 0 0 200px; }

  /* Lead grid */
  .leads-grid { grid-template-columns: 1fr 1fr; gap: 12px; }

  /* Lead detail */
  .lpc-body { flex-direction: column; }
  .lpc-quick-actions { margin-left: 0; flex-wrap: wrap; }
  .lpc-contact-grid { grid-template-columns: 1fr 1fr; }

  /* Auth */
  .auth-wrapper { grid-template-columns: 1fr; }
  .auth-left { display: none; }
  .auth-right { padding: 32px 24px; }

  /* Pipeline summary */
  .pipeline-summary { grid-template-columns: 1fr 1fr; display: grid; }
}

/* Small mobile — 480px */
@media (max-width: 480px) {
  .page-content { padding: 12px; }
  .topbar { padding: 0 12px; }
  .topbar-search { display: none; }

  /* Show search icon only, expand on click */
  .stats-grid { grid-template-columns: 1fr; gap: 10px; }
  .stat-card { flex-direction: row; padding: 14px; }

  .leads-grid { grid-template-columns: 1fr; }

  .page-title { font-size: 1.3rem; }

  .lpc-contact-grid { grid-template-columns: 1fr; }

  .pipeline-summary { grid-template-columns: 1fr 1fr; }
  .kanban-col { flex: 0 0 180px; }

  .modal { padding: 24px 16px; }
  .modal-actions { flex-direction: column; }
  .modal-actions .btn { width: 100%; justify-content: center; }

  /* Table actions — stack more compact */
  .ra-btn { width: 26px; height: 26px; }

  /* Chat */
  .chat-input-area { padding: 8px 12px; }
  .chat-msg { max-width: 95%; }

  /* Flash toast */
  .flash-toast { right: 12px; left: 12px; max-width: none; top: 72px; font-size: .82rem; }

  /* Auth */
  .auth-right { padding: 24px 16px; }
  .auth-form-header h2 { font-size: 1.4rem; }
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ── Utility ────────────────────────────────────────────── */
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.w-full { width: 100%; }
