:root {
  --color-accent: #6659e8;
  --color-accent-hover: #5548d9;
  --color-accent-light: rgba(102,89,232,.11);
  --bg-primary: #f3f5fb;
  --bg-tertiary: #edf0f8;
  --bg-hover: #e9edfa;
  --border-color: #e2e7f2;
  --border-color-strong: #cdd5e7;
  --border-radius-sm: 7px;
  --border-radius: 10px;
  --border-radius-lg: 14px;
  --border-radius-xl: 20px;
  --shadow-sm: 0 2px 7px rgba(39,46,89,.05);
  --shadow: 0 10px 32px rgba(39,46,89,.07);
  --shadow-lg: 0 20px 60px rgba(39,46,89,.11);
  --sidebar-bg: #171c3b;
  --sidebar-active: #a99bff;
  --sidebar-hover-bg: rgba(255,255,255,.09);
  --topbar-height: 64px;
}
[data-theme="dark"] {
  --color-accent: #a99bff;
  --color-accent-hover: #b9aeff;
  --color-accent-light: rgba(169,155,255,.15);
  --bg-primary: #111529;
  --bg-secondary: #1a203a;
  --bg-tertiary: #222944;
  --bg-hover: #2b3454;
  --border-color: #343d5d;
  --border-color-strong: #495476;
  --text-primary: #edf0ff;
  --text-secondary: #b2bdd8;
  --shadow: 0 10px 32px rgba(0,0,0,.16);
  --sidebar-bg: #10152c;
}
body { background-image: radial-gradient(circle at 85% -20%, rgba(123,109,244,.12), transparent 38%); }
.sidebar { background-image: radial-gradient(circle at 4% 0%, rgba(113,104,236,.22), transparent 45%), linear-gradient(180deg,#1c2348,var(--sidebar-bg) 45%); box-shadow: 6px 0 28px rgba(18,24,53,.10); }
.sidebar-logo { min-height: 76px; padding: 20px 18px; font-size: 1.12rem; letter-spacing: -.025em; border-color: rgba(255,255,255,.1); }
.sidebar-logo svg, .crm-brand-image { width: 26px; height: 26px; object-fit: contain; flex-shrink: 0; filter: drop-shadow(0 0 9px rgba(169,155,255,.42)); }
.sidebar-nav { padding: 15px 9px; }
.sidebar-nav a { margin: 3px 0; border-radius: 10px; padding: 10px 12px; transition: color .2s, background .2s, transform .2s; }
.sidebar-nav a:hover { transform: translateX(2px); }
.sidebar-nav a.active { padding-left: 12px; border-left: 0; background: linear-gradient(105deg,rgba(144,125,255,.32),rgba(74,115,222,.15)); box-shadow: inset 0 0 0 1px rgba(173,160,255,.16),0 5px 16px rgba(0,0,0,.11); }
.sidebar-nav a.active svg { color: #c1b7ff; }
.topbar { background: color-mix(in srgb,var(--bg-secondary) 91%,transparent); backdrop-filter: blur(14px); box-shadow: 0 3px 20px rgba(30,36,72,.035); }
.topbar-title { font-size: 1.08rem; font-weight: 700; letter-spacing: -.02em; }
.page-content { animation: page-fade .36s ease-out both; }
.card, .admin-card, .login-card { box-shadow: var(--shadow); border-radius: var(--border-radius-lg); }
.btn { border-radius: 8px; transition: transform .18s, background .18s, border-color .18s, box-shadow .18s; }
.btn:not(:disabled):hover { transform: translateY(-1px); }
.btn-primary { color: #fff; border-color: transparent; background: linear-gradient(120deg,#6958ed,#5479e7); box-shadow: 0 5px 15px rgba(91,93,223,.22); }
.btn-primary:hover { color: #fff; border-color: transparent; background: linear-gradient(120deg,#7768f4,#6085ed); box-shadow: 0 8px 22px rgba(91,93,223,.3); }
.form-control { border-radius: 9px; }
.form-control:focus { border-color: var(--color-accent); box-shadow: 0 0 0 4px var(--color-accent-light); }
button:focus-visible, a:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.table-wrap { border-radius: var(--border-radius-lg); }
tr { transition: background-color .18s; }

/* Keep lead controls available while the table scrolls under them. */
.leads-filters {
  position: sticky;
  top: var(--topbar-height);
  z-index: 45;
  border: 1px solid var(--border-color);
  border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
  box-shadow: 0 10px 28px rgba(27, 35, 79, .10);
  background: var(--bg-secondary);
}

.leads-filters .filter-group-select {
  width: 180px;
  max-width: 100%;
}
.leads-filters .filter-group-select select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Slow ambient glow behind the Leads title. */
.leads-topbar { isolation: isolate; overflow: hidden; }
.leads-topbar::before {
  content: "";
  position: absolute;
  inset: -90% 30% -90% -20%;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(109, 91, 231, .19) 0%, rgba(66, 185, 216, .08) 36%, transparent 70%);
  filter: blur(15px);
  animation: leads-glow 18s ease-in-out infinite alternate;
}
.leads-topbar > * { position: relative; z-index: 1; }
[data-theme="dark"] .leads-topbar::before {
  background: radial-gradient(ellipse at center, rgba(148, 130, 255, .24) 0%, rgba(63, 177, 215, .13) 36%, transparent 70%);
}
.bulk-bar-float {
  width: max-content;
  max-width: calc(100vw - 32px);
  flex-wrap: wrap;
  justify-content: center;
  border-radius: 16px;
  background: var(--bg-secondary);
  animation: bulk-bar-in .28s ease-out both;
}

body:has(.login-wrap) { background: radial-gradient(circle at 15% 18%,rgba(141,122,255,.24),transparent 33%),radial-gradient(circle at 86% 78%,rgba(53,183,225,.18),transparent 30%),var(--bg-primary); overflow-x: hidden; }
body:has(.login-wrap)::before, body:has(.login-wrap)::after { content:""; position:fixed; width:34vw; height:34vw; border:1px solid rgba(117,110,221,.09); border-radius:50%; pointer-events:none; }
body:has(.login-wrap)::before { top:-18vw; left:-12vw; }
body:has(.login-wrap)::after { bottom:-23vw; right:-9vw; width:46vw; height:46vw; }
.login-wrap { position:relative; z-index:1; max-width: 450px; animation: page-arrive .55s ease-out both; }
.login-logo-icon { background: linear-gradient(135deg,#6756e9,#43b4da); box-shadow: 0 13px 35px rgba(91,93,223,.25); border-radius: 16px; }
.login-logo-icon img { width:36px; height:36px; object-fit:contain; }
.login-logo h1 { font-size: 1.65rem; letter-spacing: -.04em; }
.login-card { border:1px solid rgba(159,170,207,.29); padding: 32px; box-shadow: 0 22px 65px rgba(34,45,91,.13); }
[data-theme="dark"] .login-card { border-color: rgba(169,155,255,.16); }
.login-card h2 { font-size: 1.2rem; letter-spacing: -.025em; }

.entry-transition { position:fixed; inset:0; z-index:1000; display:grid; place-items:center; background:radial-gradient(circle at 50% 42%,#313b79,#161c3d 68%); color:#fff; opacity:0; pointer-events:none; transition:opacity .25s; }
.entry-transition.is-visible { opacity:1; pointer-events:auto; }
.entry-transition-inner { display:flex; flex-direction:column; align-items:center; gap:18px; text-align:center; animation:page-arrive .4s ease-out both; }
.entry-mark { width:78px; height:78px; display:grid; place-items:center; border-radius:23px; background:linear-gradient(135deg,#7665ff,#42c1df); box-shadow:0 0 0 12px rgba(139,135,255,.1),0 0 45px rgba(119,117,255,.43); animation:entry-pulse 1.2s ease-in-out infinite alternate; }
.entry-mark svg { width:35px; height:35px; }
.entry-mark img { width:52px; height:52px; object-fit:contain; }
.entry-title { font-size:1.3rem; font-weight:700; letter-spacing:-.02em; }
.entry-subtitle { font-size:.85rem; color:#bcc5ec; }
.entry-progress { width:170px; height:4px; overflow:hidden; border-radius:9px; background:rgba(255,255,255,.18); }
.entry-progress::before { content:""; display:block; width:42%; height:100%; border-radius:inherit; background:linear-gradient(90deg,#9a8fff,#55d0e7); animation:entry-load 1.1s ease-in-out infinite; }
@keyframes page-arrive { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
@keyframes page-fade { from { opacity:0; } to { opacity:1; } }
@keyframes leads-glow { from { transform:translateX(0); } to { transform:translateX(65vw); } }
@keyframes bulk-bar-in { from { opacity:0; transform:translate(-50%,16px); } to { opacity:1; transform:translate(-50%,0); } }
@keyframes entry-pulse { to { box-shadow:0 0 0 18px rgba(139,135,255,.04),0 0 60px rgba(119,117,255,.55); transform:scale(1.04); } }
@keyframes entry-load { from { transform:translateX(-100%); } to { transform:translateX(340%); } }
@media (prefers-reduced-motion:reduce) { .page-content,.login-wrap,.entry-transition-inner,.entry-mark,.entry-progress::before,.leads-topbar::before,.bulk-bar-float { animation:none!important; } .btn,.sidebar-nav a,.entry-transition { transition:none!important; } }

/* Custom logo: large, name hidden */
.sidebar-logo.has-logo, .sidebar-logo:has(> .crm-brand-image) { justify-content: center; padding: 18px 20px; min-height: 96px; font-size: 0; }
.sidebar-logo.has-logo .crm-brand-image, .sidebar-logo .crm-brand-image { width: auto; height: auto; max-width: 100%; max-height: 72px; filter: none; }
.sidebar-logo:not(.has-logo):not(:has(> .crm-brand-image)) .crm-brand-image { width: 26px; height: 26px; }
.login-logo-icon:has(img), .login-logo.has-logo .login-logo-icon { width: auto; height: auto; background: none; box-shadow: none; border-radius: 0; }
.login-logo-icon:has(img) img, .login-logo.has-logo .login-logo-icon img { width: auto; height: auto; max-width: 240px; max-height: 110px; }
.login-logo.has-logo h1, .login-logo:has(.login-logo-icon img) h1 { display: none; }
