@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');
:root{
  --bg:#F7F8FA;
  --card:#ffffff;
  --border:#E4E7EC;
  --text:#16181D;
  --muted:#5A6274;
  --muted-2:#8A92A1;
  --accent:#4F46E5;
  --accent-2:#EA580C;
  --accent-3:#db2777;
  --danger:#EF4444;
  --grad: linear-gradient(90deg,#2F6BFF 0%,#7C3AED 100%);
  --surface-1: rgba(20,20,30,0.025);
  --surface-2: rgba(20,20,30,0.035);
  --surface-hover: rgba(20,20,30,0.05);
  --glow-1: rgba(47,107,255,0.06);
  --glow-2: rgba(124,58,237,0.05);
  --danger-text: #B91C1C;
  --accent-soft-text: #4F46E5;
  /* Solid dark CTA buttons (Pipeline "New deal", Leads "Add lead", etc.) — the
     mockups reserve --accent (indigo) for branding/links/active pills only;
     every primary action button is this near-black instead. */
  --cta-bg:#16181D;
  --cta-text:#F7F8FA;
}
:root[data-theme="dark"]{
  --bg:#07080d;
  --card:#12141f;
  --border:rgba(255,255,255,0.08);
  --text:#f2f3f7;
  --muted:#9498ab;
  --muted-2:#7B8296;
  --accent:#6366f1;
  --accent-2:#fb923c;
  --accent-3:#ff5cad;
  --danger:#ff5c7a;
  --surface-1: rgba(255,255,255,0.02);
  --surface-2: rgba(255,255,255,0.03);
  --surface-hover: rgba(255,255,255,0.05);
  --glow-1: rgba(99,102,241,0.12);
  --glow-2: rgba(124,58,237,0.08);
  --danger-text: #ffb3c1;
  --accent-soft-text: #a5b4fc;
  --cta-bg:#f2f3f7;
  --cta-text:#16181D;
}
*{box-sizing:border-box; margin:0; padding:0;}
html, body{height:100%;}
body{
  font-family:'Plus Jakarta Sans', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  background:var(--bg); color:var(--text);
  height:100vh; overflow:hidden;
}
a{text-decoration:none; color:inherit;}

/* Native <option> dropdown popups are rendered by the OS/browser with a light
   background regardless of our theme, so force dark text there or it becomes
   unreadable in dark mode where the <select> itself uses light text. */
select option{color:#111827; background:#ffffff;}

.bg-glow{
  position:fixed; inset:0; z-index:0; pointer-events:none;
  background:
    radial-gradient(600px circle at 10% 0%, var(--glow-1), transparent 60%),
    radial-gradient(600px circle at 90% 100%, var(--glow-2), transparent 60%);
}

.shell{display:flex; height:100vh; position:relative; z-index:1;}

/* Sidebar */
.sidebar{
  width:240px; flex-shrink:0; background:var(--card); border-right:1px solid var(--border);
  display:flex; flex-direction:column; padding:20px 16px;
  height:100vh; overflow-y:auto;
}
.sidebar .logo{display:flex; align-items:center; gap:10px; padding:6px 8px 20px;}
.logo-mark{
  width:30px; height:30px; border-radius:8px; background:#16181D;
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.logo-mark svg{width:16px; height:16px;}
.logo-text{display:flex; flex-direction:column; line-height:1.25;}
.logo-text .name{
  font-size:14px; font-weight:800; background:var(--grad); -webkit-background-clip:text;
  background-clip:text; color:transparent;
}
.logo-text .sub{font-size:10px; color:var(--muted-2); font-weight:600;}

.nav-group{display:flex; flex-direction:column; gap:2px; flex:1;}
.nav-group-label{
  font-size:10.5px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--muted);
  padding:16px 12px 6px;
}
.nav-group-label:first-child{padding-top:4px;}
.nav-link{
  display:flex; align-items:center; gap:11px; padding:10px 12px; border-radius:9px;
  font-size:14px; color:var(--muted); transition:background .18s, color .18s;
}
.nav-link:hover{background:var(--surface-hover); color:var(--text);}
.nav-link.active{background:rgba(79,70,229,0.10); color:var(--accent); font-weight:600;}
.nav-link svg{width:17px; height:17px; flex-shrink:0;}
.nav-link .soon-pill{
  margin-left:auto; font-size:9px; font-weight:700; letter-spacing:.04em; text-transform:uppercase;
  color:var(--muted); background:var(--surface-hover); border:1px solid var(--border);
  padding:2px 6px; border-radius:99px;
}

.sidebar-footer{border-top:1px solid var(--border); padding-top:14px; margin-top:10px;}
.user-row{display:flex; align-items:center; gap:10px; padding:6px 8px;}
.user-avatar{
  width:30px; height:30px; border-radius:50%; background:var(--accent); flex-shrink:0;
  display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:800; color:#fff;
}
.user-info{overflow:hidden;}
.user-info .name{font-size:13px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.user-info .plan{font-size:11px; color:var(--accent-2);}
.logout-btn{
  width:100%; margin-top:10px; padding:9px; border-radius:8px; font-size:13px;
  background:transparent; border:1px solid var(--border); color:var(--muted); cursor:pointer;
  transition:background .18s, color .18s;
}
.logout-btn:hover{background:rgba(224,64,95,0.08); color:var(--danger); border-color:rgba(224,64,95,0.3);}

/* Main content */
.main{flex:1; min-width:0; height:100vh; display:flex; flex-direction:column; min-width:0;}

/* Mobile (PRD cross-cutting rule: "Mobile-usable at 390 px for anything a rep touches
   daily") — the sidebar was a fixed 240px with no breakpoint at all, which broke every
   page at phone width, not just one screen. Below 768px it becomes an off-canvas drawer:
   hidden by default, toggled by the hamburger button shell.js injects into .main. */
.mobile-menu-btn{display:none;}
.mobile-backdrop{display:none;}
@media (max-width:768px){
  .mobile-menu-btn{
    display:flex; align-items:center; justify-content:center; position:fixed; top:14px; left:14px; z-index:60;
    width:38px; height:38px; border-radius:9px; background:var(--card); border:1px solid var(--border);
    color:var(--text); cursor:pointer; box-shadow:0 2px 8px rgba(0,0,0,0.12);
  }
  .mobile-menu-btn svg{width:18px; height:18px;}
  .sidebar{
    position:fixed; top:0; left:0; z-index:70; transform:translateX(-100%); transition:transform .22s ease;
    box-shadow:0 0 40px rgba(0,0,0,0.25);
  }
  .sidebar.open{transform:translateX(0);}
  .mobile-backdrop.open{
    display:block; position:fixed; inset:0; background:rgba(0,0,0,0.45); z-index:65;
  }
  .main{width:100%;}
  .content{padding:56px 16px 24px;}
}
/* Hidden everywhere by default — every page renders its own <h1> in .content, so the
   title here stays hidden too. Per explicit request (22 Sep 2026), the top-right bar
   (notification bell + plan chip) is visible on the Dashboard only, not every screen —
   see body[data-page="dashboard"] below. Notifications are still reachable everywhere
   via the sidebar's own "Notifications" nav item. */
.topbar{
  display:none; align-items:center; justify-content:flex-end; gap:14px;
  padding:14px 32px 0; flex-shrink:0;
}
body[data-page="dashboard"] .topbar{display:flex;}
.topbar h1{display:none;}
.topbar-right{display:flex; align-items:center; gap:12px;}
.topbar .plan-chip{
  font-size:12px; font-weight:700; color:var(--accent-2); background:rgba(194,65,12,0.1);
  border:1px solid rgba(194,65,12,0.3); padding:5px 12px; border-radius:99px;
}
@media (max-width:768px){ body[data-page="dashboard"] .topbar{padding:14px 16px 0 60px;} }

/* Notification bell */
.notif-bell-wrap{position:relative;}
.notif-bell-btn{
  position:relative; width:36px; height:36px; border-radius:10px; border:1px solid var(--border);
  background:var(--card); color:var(--muted); cursor:pointer; display:flex; align-items:center; justify-content:center;
  transition:background .15s, color .15s;
}
.notif-bell-btn:hover{background:var(--surface-hover); color:var(--text);}
.notif-bell-btn svg{width:18px; height:18px;}
.notif-badge{
  position:absolute; top:-4px; right:-4px; min-width:16px; height:16px; padding:0 4px; border-radius:99px;
  background:var(--danger); color:#fff; font-size:10px; font-weight:800; line-height:16px; text-align:center;
}
.notif-dropdown{
  position:absolute; top:calc(100% + 10px); right:0; width:340px; max-width:calc(100vw - 32px);
  background:var(--card); border:1px solid var(--border); border-radius:14px; box-shadow:0 12px 32px rgba(0,0,0,0.18);
  opacity:0; visibility:hidden; transform:translateY(-6px); transition:opacity .15s, transform .15s; z-index:80;
}
.notif-bell-wrap.open .notif-dropdown{opacity:1; visibility:visible; transform:translateY(0);}
.notif-dropdown-head{
  display:flex; align-items:center; justify-content:space-between; padding:12px 16px;
  border-bottom:1px solid var(--border); font-size:13px; font-weight:700;
}
.notif-dropdown-head a{font-size:12px; font-weight:600; color:var(--accent); text-decoration:none;}
.notif-dropdown-list{max-height:340px; overflow-y:auto;}
.notif-empty{padding:24px 16px; text-align:center; font-size:12.5px; color:var(--muted);}
.notif-item{
  display:block; padding:11px 16px; border-bottom:1px solid var(--border); text-decoration:none; color:var(--text);
  transition:background .12s;
}
.notif-item:last-child{border-bottom:none;}
.notif-item:hover{background:var(--surface-hover);}
.notif-item.unread{background:rgba(79,70,229,0.05);}
.notif-item.unread .notif-item-title::before{content:''; display:inline-block; width:6px; height:6px; border-radius:50%; background:var(--accent); margin-right:6px;}
.notif-item-title{font-size:12.5px; font-weight:700;}
.notif-item-body{font-size:12px; color:var(--muted); margin-top:2px;}
.notif-item-time{font-size:11px; color:var(--muted-2); margin-top:4px;}
.notif-dropdown-footer{
  display:block; text-align:center; padding:10px; font-size:12px; font-weight:700; color:var(--accent);
  text-decoration:none; border-top:1px solid var(--border);
}

/* "I'm online" status, next to the user's name in the sidebar footer */
.user-row{position:relative;}
.online-dot{
  display:inline-block; width:7px; height:7px; border-radius:50%; background:var(--muted-2); margin-right:6px; flex-shrink:0;
}
.online-dot.live{background:#22C55E; box-shadow:0 0 0 2px rgba(34,197,94,0.2);}
.online-toggle-btn{
  flex-shrink:0; font-size:10.5px; font-weight:700; padding:4px 8px; border-radius:7px;
  background:var(--surface-2); border:1px solid var(--border); color:var(--muted); cursor:pointer;
}
.online-toggle-btn.live{background:rgba(34,197,94,0.12); border-color:rgba(34,197,94,0.35); color:#16A34A;}
.online-nudge{
  font-size:11px; color:var(--accent-2); background:rgba(234,88,12,0.08); border:1px solid rgba(234,88,12,0.25);
  border-radius:8px; padding:6px 9px; margin:8px 0 0;
}
.online-nudge a{color:inherit; font-weight:700; text-decoration:underline;}
.content{padding:36px 32px; flex:1; overflow-y:auto;}

/* Empty state */
.empty-state{
  display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center;
  padding:80px 20px; border:1px dashed var(--border); border-radius:18px; background:var(--surface-1);
  opacity:0; animation:fadeIn .5s ease forwards;
}
@keyframes fadeIn{ to{opacity:1;} }
.empty-icon{
  width:64px; height:64px; border-radius:16px; background:rgba(37,99,235,0.1);
  border:1px solid rgba(37,99,235,0.25); display:flex; align-items:center; justify-content:center; margin-bottom:22px;
}
.empty-icon svg{width:30px; height:30px; stroke:var(--accent-2);}
.empty-state h2{font-size:18px; font-weight:700; margin-bottom:8px;}
.empty-state p{color:var(--muted); font-size:14px; max-width:380px; margin-bottom:24px;}
.empty-cta{
  display:inline-flex; align-items:center; gap:8px; padding:11px 22px; border-radius:10px;
  font-size:14px; font-weight:700; background:var(--accent); color:#fff; border:none; cursor:pointer;
  transition:transform .2s, box-shadow .2s;
}
.empty-cta:hover{transform:translateY(-2px); box-shadow:0 10px 30px rgba(37,99,235,0.35);}
.empty-cta:disabled{opacity:0.5; cursor:not-allowed; transform:none; box-shadow:none;}
.empty-note{margin-top:14px; font-size:12px; color:var(--muted);}

/* Stat cards row (dashboard) */
.stat-row{display:grid; grid-template-columns:repeat(auto-fit, minmax(180px,1fr)); gap:16px; margin-bottom:32px;}
.stat-card{background:var(--card); border:1px solid var(--border); border-radius:14px; padding:20px; box-shadow:0 1px 2px rgba(20,20,30,0.03);}
.stat-card .label{font-size:12px; color:var(--muted); margin-bottom:8px;}
.stat-card .value{font-size:26px; font-weight:800;}
.stat-card .value.grad{background:var(--grad); -webkit-background-clip:text; background-clip:text; color:transparent;}

/* Bold solid-color tiles for headline stats (dashboard-style) */
.stat-card.tile{
  border:none; color:#fff; display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
  box-shadow:0 8px 20px -8px rgba(0,0,0,0.25);
}
.stat-card.tile .label{color:rgba(255,255,255,0.85);}
.stat-card.tile .value{color:#fff;}
.stat-card.tile .tile-icon{
  width:34px; height:34px; border-radius:9px; background:rgba(255,255,255,0.18); flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
}
.stat-card.tile .tile-icon svg{width:18px; height:18px; stroke:#fff;}
.stat-card.tile-blue{background:linear-gradient(135deg,#2563eb,#1d4ed8);}
.stat-card.tile-green{background:linear-gradient(135deg,#16a34a,#15803d);}
.stat-card.tile-purple{background:linear-gradient(135deg,#7c3aed,#6d28d9);}
.stat-card.tile-orange{background:linear-gradient(135deg,#f97316,#ea580c);}

#loading{padding:60px; text-align:center; color:var(--muted); position:relative; z-index:1;}

/* Global in-app toast stack (replaces browser alert()) */
.toast-stack{
  position:fixed; top:20px; right:20px; z-index:2000; display:flex; flex-direction:column; gap:10px;
  pointer-events:none;
}
.toast-item{
  background:var(--card); border:1px solid var(--border); border-left:3px solid var(--accent);
  color:var(--text); padding:12px 18px; border-radius:10px; font-size:13.5px; font-weight:500;
  box-shadow:0 12px 30px rgba(0,0,0,0.18); max-width:360px; opacity:0; transform:translateX(16px);
  transition:opacity .2s, transform .2s; pointer-events:auto;
}
.toast-item.show{opacity:1; transform:translateX(0);}
.toast-item.success{border-left-color:#16a34a;}
.toast-item.error{border-left-color:var(--danger);}

/* ---- Support chat widget: a floating, draggable composer (every page) ---- */
/* Default position: centered on screen (right/bottom are what the drag logic moves —
   centering via calc() against those same anchors keeps first-drag math consistent). */
.support-widget{
  position:fixed; right:calc(50% - 300px); bottom:calc(50% - 350px); z-index:500;
  width:600px; max-width:calc(100vw - 32px);
  display:flex; flex-direction:column; align-items:stretch;
}
.support-panel{
  background:var(--card); border:1px solid var(--border); border-radius:18px;
  box-shadow:0 20px 60px rgba(0,0,0,0.22); display:none; flex-direction:column; overflow:hidden;
  height:680px; max-height:calc(100vh - 120px); margin-bottom:10px;
}
.support-panel.open{display:flex;}
.support-header{
  background:var(--accent); padding:14px 16px; display:flex; align-items:center; gap:10px; flex-shrink:0;
  cursor:grab;
}
.support-header:active{cursor:grabbing;}
.support-header .support-avatar{
  width:32px; height:32px; border-radius:50%; background:rgba(255,255,255,0.18); flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
}
.support-header .support-avatar svg{width:17px; height:17px; stroke:#fff; fill:none; stroke-width:2; stroke-linecap:round; stroke-linejoin:round;}
.support-header .title{color:#fff; font-weight:800; font-size:14px;}
.support-header .subtitle{color:rgba(255,255,255,0.75); font-size:11px;}
.support-collapse{
  margin-left:auto; width:24px; height:24px; border-radius:6px; border:none; background:rgba(255,255,255,0.15);
  color:#fff; font-size:16px; line-height:1; cursor:pointer; flex-shrink:0;
}
.support-collapse:hover{background:rgba(255,255,255,0.25);}
.support-messages{flex:1; overflow-y:auto; padding:16px; display:flex; flex-direction:column; gap:10px;}
.support-msg{max-width:82%; padding:10px 13px; border-radius:14px; font-size:13px; line-height:1.45; white-space:pre-wrap;}
.support-msg.bot{background:var(--surface-1); border:1px solid var(--border); align-self:flex-start; border-bottom-left-radius:4px;}
.support-msg.user{background:var(--accent); color:#fff; align-self:flex-end; border-bottom-right-radius:4px; font-weight:600;}
.support-msg.typing{display:flex; gap:4px; align-items:center; padding:12px 14px;}
.support-msg.typing span{width:6px; height:6px; border-radius:50%; background:var(--muted); animation:supportTypingBounce 1.2s infinite ease-in-out;}
.support-msg.typing span:nth-child(2){animation-delay:.15s;}
.support-msg.typing span:nth-child(3){animation-delay:.3s;}
@keyframes supportTypingBounce{0%,60%,100%{transform:translateY(0); opacity:.5;} 30%{transform:translateY(-4px); opacity:1;}}

.support-msg.support-confirm{max-width:88%;}
.support-confirm-summary{margin-bottom:10px;}
.support-confirm-actions{display:flex; gap:8px;}
.support-confirm-btn{
  padding:7px 14px; border-radius:8px; font-size:12.5px; font-weight:700; cursor:pointer; border:1px solid var(--border);
}
.support-confirm-btn.confirm{background:var(--cta-bg); color:var(--cta-text); border-color:transparent;}
.support-confirm-btn.cancel{background:transparent; color:var(--muted);}
.support-confirm-btn:disabled{opacity:0.5; cursor:not-allowed;}

/* The always-visible floating composer — the widget's "closed" resting state */
.support-composer{
  display:flex; align-items:center; gap:8px; background:var(--card); border:1px solid var(--border);
  border-radius:26px; padding:8px 8px 8px 10px; box-shadow:0 12px 34px rgba(0,0,0,0.18);
}
.composer-grip{
  color:var(--muted); font-size:14px; line-height:1; cursor:grab; flex-shrink:0; padding:4px 2px;
  user-select:none;
}
.composer-grip:active{cursor:grabbing;}
.composer-plus{
  width:26px; height:26px; border-radius:50%; border:1px solid var(--border); background:var(--surface-1);
  color:var(--muted); font-size:16px; line-height:1; cursor:pointer; flex-shrink:0;
}
.composer-plus:hover{background:var(--surface-hover); color:var(--text);}
.support-composer input{
  flex:1; min-width:0; border:none; background:transparent; color:var(--text); font-size:13.5px; outline:none;
}
.composer-right{display:flex; align-items:center; gap:8px; flex-shrink:0;}
.composer-model{font-size:11px; color:var(--muted); white-space:nowrap;}
.composer-icon-btn{
  width:30px; height:30px; border-radius:50%; border:none; background:transparent; color:var(--muted);
  cursor:pointer; display:flex; align-items:center; justify-content:center; flex-shrink:0; transition:background .15s, color .15s;
}
.composer-icon-btn svg{width:16px; height:16px;}
.composer-icon-btn:hover{background:var(--surface-hover); color:var(--text);}
.composer-icon-btn.primary{background:var(--accent); color:#fff;}
.composer-icon-btn.primary:hover{background:var(--accent); opacity:0.9;}
.composer-icon-btn:disabled{opacity:0.5; cursor:not-allowed;}

/* Global base for .modal-overlay — most pages redeclare their own (harmless, same rules
   win), but shell.js now injects one modal (#quickCallModal) on every page regardless of
   whether that page defines this class itself, so it needs a real global default. */
.modal-overlay{position:fixed; inset:0; background:rgba(0,0,0,0.6); display:none; align-items:center; justify-content:center; z-index:100;}
.modal-overlay.open{display:flex;}

/* In-app confirm / input dialog (replaces browser confirm() and prompt()) */
.app-dialog-bg{position:fixed; inset:0; z-index:3000; background:rgba(10,12,20,.45); display:flex; align-items:center; justify-content:center; padding:16px; animation:appDlgIn .12s ease;}
.app-dialog{width:100%; max-width:420px; background:var(--card); color:var(--text); border:1px solid var(--border); border-radius:14px; padding:20px; box-shadow:0 20px 50px rgba(0,0,0,.25);}
.app-dialog-msg{font-size:14px; line-height:1.5; white-space:pre-wrap;}
.app-dialog-input{width:100%; margin-top:12px; padding:10px 12px; border-radius:9px; border:1px solid var(--border); background:var(--surface-2); color:var(--text); font-size:14px; box-sizing:border-box;}
.app-dialog-input:focus{outline:none; border-color:var(--accent);}
.app-dialog-actions{display:flex; justify-content:flex-end; gap:8px; margin-top:18px;}
.app-dialog-actions button{padding:9px 16px; border-radius:9px; font-size:13px; font-weight:700; cursor:pointer; border:1px solid var(--border); background:transparent; color:var(--text);}
.app-dialog-ok{background:var(--cta-bg) !important; color:var(--cta-text) !important; border-color:transparent !important;}
.app-dialog-ok.danger{background:#DC2626 !important; color:#fff !important;}
@keyframes appDlgIn{from{opacity:0} to{opacity:1}}
