:root{
  color-scheme:light;
  --ink:#1b1930;--muted:#5a5775;--forest:#4f3fd6;--forest-2:#6d5cf5;--amber:#e6b86a;
  --blue:#2f6df0;--red:#e5484d;--green:#7c5cff;--violet:#8a5cf6;--cyan:#0aa5e0;
  --glass:rgba(255,255,255,.64);--glass-strong:rgba(255,255,255,.82);--glass-soft:rgba(255,255,255,.44);
  --glass-line:rgba(255,255,255,.7);--hair:rgba(27,25,48,.07);
  --shadow:0 14px 40px rgba(20,14,50,.24);--shadow-sm:0 6px 18px rgba(20,14,50,.16);
  --radius:22px;--radius-sm:16px;
  --blur:blur(24px) saturate(160%);
  --glass-hi:inset 0 1px 0 rgba(255,255,255,.55);
}
*{box-sizing:border-box}
body{margin:0;color:var(--ink);font:16px/1.5 system-ui,-apple-system,"Segoe UI",sans-serif;
  background:
    radial-gradient(1100px 720px at 84% -10%,#7b5cff 0%,transparent 55%),
    radial-gradient(940px 640px at 4% 110%,#3a2b8c 0%,transparent 52%),
    radial-gradient(700px 520px at 62% 48%,#2a2360 0%,transparent 60%),
    linear-gradient(150deg,#151132 0%,#241a4e 45%,#191436 100%),#141130;
  background-attachment:fixed;min-height:100vh}
button,input,textarea,select{font:inherit;color:inherit}
.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.muted{color:var(--muted)}

/* Floating colour orbs behind the glass */
.glass-orbs{position:fixed;inset:0;overflow:hidden;z-index:0;pointer-events:none}
.glass-orbs span{position:absolute;border-radius:50%;filter:blur(80px);opacity:.5;animation:float 20s ease-in-out infinite}
.glass-orbs span:nth-child(1){width:440px;height:440px;background:#8b6cff;top:-100px;left:-70px}
.glass-orbs span:nth-child(2){width:360px;height:360px;background:#e6b86a;bottom:-90px;right:8%;animation-delay:-7s}
.glass-orbs span:nth-child(3){width:320px;height:320px;background:#4f9dff;top:38%;right:-80px;animation-delay:-13s}
@keyframes float{0%,100%{transform:translate(0,0)}50%{transform:translate(24px,-30px)}}
@media(prefers-reduced-motion:reduce){.glass-orbs span{animation:none}}

/* Glass surfaces */
.glass{background:var(--glass);-webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur);
  border:1px solid var(--glass-line);border-radius:var(--radius);box-shadow:var(--shadow),var(--glass-hi);
  transition:box-shadow .25s ease,transform .25s ease}
.glass-soft{background:var(--glass-soft);border:1px solid rgba(255,255,255,.5);border-radius:var(--radius-sm);box-shadow:var(--glass-hi)}

/* Buttons */
button{min-height:42px;border:0;border-radius:12px;padding:9px 16px;font-weight:700;cursor:pointer;
  transition:transform .25s ease,box-shadow .25s ease,background .25s ease}
button:active{transform:translateY(1px)}
.primary:active{filter:brightness(1.08)}
.secondary:active{background:#fff}
button:disabled{opacity:.55;cursor:progress}
:focus-visible{outline:3px solid var(--amber);outline-offset:2px}
.primary{background:linear-gradient(180deg,var(--forest-2),var(--forest));color:#fff;box-shadow:0 6px 16px rgba(79,63,214,.35)}
.primary:hover{box-shadow:0 8px 22px rgba(79,63,214,.45)}
.secondary{background:var(--glass-strong);color:var(--forest);border:1px solid rgba(255,255,255,.6);
  -webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}
.secondary:hover{background:#fff}
.ghost{background:rgba(255,255,255,.14);color:#fff;border:1px solid rgba(255,255,255,.3);min-height:36px;padding:6px 12px;font-size:.85rem}
.ghost:hover{background:rgba(255,255,255,.26)}
.button{display:inline-grid;place-items:center;min-height:42px;text-decoration:none;border-radius:11px;padding:9px 16px;font-weight:700}

/* Icons (inline SVG) */
.ic{width:1.15em;height:1.15em;display:inline-block;vertical-align:-.18em;flex:0 0 auto}
.add-cta,#sync,.head-tools .button{display:inline-flex;align-items:center;justify-content:center;gap:8px}
.add-cta .ic,#sync .ic,.head-tools .button .ic{width:17px;height:17px}
.close{display:grid;place-items:center}
.close .ic{width:20px;height:20px}
.search-ico .ic{width:18px;height:18px}
.nav-ico .ic{width:15px;height:15px}
.menu-toggle .ic{width:20px;height:20px}
.comm-btn .ic{width:16px;height:16px}
.comm.bar .comm-btn .ic{width:18px;height:18px}

/* Inputs */
input,select,textarea{width:100%;padding:11px 13px;border:1px solid rgba(19,43,36,.16);border-radius:11px;
  background:rgba(255,255,255,.72);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}
input:focus,select:focus,textarea:focus{outline:none;border-color:var(--forest-2);box-shadow:0 0 0 3px rgba(109,92,245,.18)}
label{display:grid;gap:6px;font-weight:650}

/* ---------- Login ---------- */
.login-page{min-height:100vh;display:grid;place-items:center;padding:24px;position:relative;z-index:1}
.login-card{width:min(430px,100%);padding:44px;background:var(--glass-strong);
  -webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur);
  border:1px solid var(--glass-line);border-radius:26px;box-shadow:var(--shadow)}
.eyebrow{text-transform:uppercase;letter-spacing:.16em;font-size:.72rem;font-weight:800;color:var(--forest-2);margin:0}
.login-card h1{font:700 2.8rem/1.05 Georgia,serif;margin:.3rem 0}
.lede{color:var(--muted);margin-bottom:26px}
.login-card label{margin:16px 0}
.login-card button{width:100%;margin-top:12px;min-height:46px}
.alert{padding:12px;border-radius:10px}
.alert.error{background:rgba(192,67,47,.14);color:#8a2417;border:1px solid rgba(192,67,47,.3)}

/* ---------- App shell ---------- */
.app-shell{position:relative;z-index:1;display:grid;grid-template-columns:290px minmax(0,1fr);gap:20px;
  padding:20px;max-width:1520px;margin:auto;min-height:100vh}

/* Sidebar */
.sidebar{position:sticky;top:20px;height:calc(100vh - 40px);display:flex;flex-direction:column;gap:18px;padding:22px}
.brand{display:flex;align-items:center;gap:12px}
.brand-mark{display:grid;place-items:center;width:46px;height:46px;border-radius:14px;flex:0 0 auto;
  background:linear-gradient(180deg,var(--forest-2),var(--forest));color:#fff;font:800 1rem/1 Georgia,serif;box-shadow:var(--shadow-sm)}
.brand h1{font:700 1.3rem/1 Georgia,serif;margin:.2rem 0 0}
.add-cta{min-height:46px;font-size:.98rem}
.nav{display:flex;flex-direction:column;gap:6px}
.nav-item{display:flex;align-items:center;gap:11px;width:100%;justify-content:flex-start;text-align:left;
  background:transparent;color:var(--ink);font-weight:650;min-height:44px;padding:10px 12px;border-radius:12px}
.nav-item:hover{background:rgba(255,255,255,.4)}
.nav-item.active{background:linear-gradient(180deg,rgba(109,92,245,.16),rgba(109,92,245,.1));
  color:var(--forest);box-shadow:inset 0 0 0 1px rgba(109,92,245,.25)}
.nav-ico{display:grid;place-items:center;width:26px;height:26px;border-radius:8px;background:rgba(255,255,255,.55);font-size:.8rem;flex:0 0 auto}
.nav-item.active .nav-ico{background:rgba(109,92,245,.2)}
.nav-count{margin-left:auto;font-size:.78rem;font-weight:800;color:var(--muted);
  background:rgba(255,255,255,.5);border-radius:999px;padding:2px 9px;min-width:26px;text-align:center}
.nav-item.active .nav-count{color:var(--forest);background:rgba(109,92,245,.15)}
.sidebar-foot{margin-top:auto;display:flex;flex-direction:column;gap:12px}
.sync-chip{display:flex;align-items:center;gap:11px;padding:11px 13px}
.sync-chip small{display:block;font-size:.7rem;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);font-weight:700}
.sync-chip strong{font-size:.86rem;font-weight:650}
.sync-dot{width:10px;height:10px;border-radius:50%;background:var(--green);box-shadow:0 0 0 4px rgba(124,92,255,.22);flex:0 0 auto}
.user-card{display:flex;align-items:center;gap:10px;padding:10px 12px}
.user-name{font-weight:750;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.user-card form{margin:0}

/* Main column */
.main{min-width:0;display:flex;flex-direction:column;gap:18px}
.page-head{position:sticky;top:20px;z-index:5;display:flex;flex-direction:column;gap:12px;padding:12px 18px}
.menu-toggle{display:none;background:transparent;color:var(--ink);font-size:1.3rem;min-height:40px;width:42px;padding:0}
.head-top{display:flex;align-items:center;gap:14px}
.page-title{min-width:0;margin-right:auto}
.page-title h2{margin:0;font:700 1.4rem/1.1 Georgia,serif;color:var(--ink)}
.page-title p{margin:1px 0 0;font-size:.84rem;color:#4c4968}
/* Right action group + second-row filters: consistent 40px pills */
.head-actions{display:flex;align-items:center;gap:10px;flex:0 0 auto}
.head-filters{display:flex;align-items:center;gap:10px;flex-wrap:nowrap;min-width:0}
.head-actions .secondary,.head-actions .button,.save-view{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:40px;border-radius:12px;white-space:nowrap}
.head-actions .ic,.save-view .ic{width:16px;height:16px}
.head-filters .field-label{margin:0;flex:0 0 auto}
.head-filters select{min-height:40px;border-radius:12px;cursor:pointer}
.head-filters #stage-filter,.head-filters #sort{min-width:150px}
.head-filters #views-select{min-width:150px}
.save-view{flex:0 0 auto;padding:0 16px}
.search-label{position:relative;margin:0;flex:1 1 auto;min-width:220px}
.search-label input{padding-left:36px;min-height:40px;border-radius:12px}
.search-ico{position:absolute;left:12px;top:50%;transform:translateY(-50%);color:var(--muted);font-size:1.1rem;pointer-events:none}
.sort-label,.field-label{margin:0}
.field-label select{cursor:pointer}

/* Stats */
.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:16px}
.stat{padding:17px 20px}
.stat-label{font-size:.71rem;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);font-weight:800}
.stat strong{display:block;font:700 2.05rem/1.1 Georgia,serif;margin:6px 0 2px}
.stat small{color:var(--muted)}

.status{min-height:20px;color:#e9f5ee;font-size:.9rem;text-shadow:0 1px 8px rgba(0,0,0,.25);padding:0 4px}

/* List / table */
.list-wrap{overflow:hidden}
.contacts{width:100%;border-collapse:collapse;font-size:.93rem}
.contacts thead th{text-align:left;padding:14px 20px;background:rgba(255,255,255,.32);color:var(--muted);
  font-size:.72rem;text-transform:uppercase;letter-spacing:.07em;font-weight:800;border-bottom:1px solid var(--hair)}
.contacts .col-right{text-align:right}
.contacts tbody tr{border-bottom:1px solid var(--hair);cursor:pointer;transition:background .25s ease}
.contacts tbody tr:last-child{border-bottom:0}
.contacts tbody tr:hover,.contacts tbody tr:focus{background:rgba(255,255,255,.62);outline:none}
.contacts td{padding:13px 20px;vertical-align:middle;color:var(--ink)}
.contacts td.col-right{text-align:right;color:#5b5875;white-space:nowrap}
.contacts thead th{border-bottom:1px solid var(--hair)}
.lead-cell{display:flex;align-items:center;gap:12px}
.lead-cell>div{min-width:0}
.lead-cell strong{display:block;line-height:1.25}
/* Truncate long emails/phones with ellipsis on desktop (full value in the title tooltip) */
.lead-cell small{color:var(--muted);display:block;max-width:230px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.reach{color:var(--ink)}
.contacts td.reach{max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.empty{text-align:center;padding:52px 18px!important;color:var(--muted)}

.avatar{display:grid;place-items:center;width:44px;height:44px;border-radius:50%;flex:0 0 auto;
  background:linear-gradient(180deg,var(--forest-2),var(--forest));color:#fff;font-weight:800;box-shadow:var(--shadow-sm)}
.avatar.sm{width:34px;height:34px;font-size:.8rem}
.avatar.lg{width:64px;height:64px;font-size:1.35rem}

/* ---------- Full-page contact detail (CRM style) ---------- */
#detail-page{display:none}
.main.detail-open > *{display:none}
.main.detail-open > #detail-page{display:block}
.dp-topbar{margin-bottom:14px}
.dp-back{display:inline-flex;align-items:center;gap:6px;min-height:40px}
.dp-back .ic{width:18px;height:18px}
.dp-header{display:flex;align-items:center;gap:18px;padding:20px 24px;margin-bottom:18px}
.dp-id{min-width:0;flex:1 1 auto}
.dp-title-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.dp-title-row h2{margin:0;font:700 1.6rem/1.15 Georgia,serif;color:var(--ink)}
.dp-sub{margin:4px 0 0;font-size:.9rem;color:#4c4968}
.dp-header-actions{display:flex;align-items:center;gap:14px;flex-wrap:wrap;justify-content:flex-end}
.dp-header-actions .comm.bar{width:auto}
.dp-grid{display:grid;grid-template-columns:340px minmax(0,1fr);gap:18px;align-items:start}
.dp-col{display:flex;flex-direction:column;gap:16px}
/* Each section becomes a translucent glass card */
.dp-col .detail-section{background:var(--glass);-webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur);
  border:1px solid var(--glass-line);border-radius:var(--radius-sm);box-shadow:var(--shadow-sm),var(--glass-hi);
  padding:18px 20px;margin:0}
.dp-col .detail-section:last-child{border-bottom:1px solid var(--glass-line)}
.dp-col .attention-card{border-color:rgba(229,72,77,.3)}
@media(max-width:900px){.dp-grid{grid-template-columns:1fr}}

/* Pills */
.pill{display:inline-block;padding:4px 12px;border-radius:999px;font-size:.75rem;font-weight:800;
  background:rgba(255,255,255,.5);color:var(--muted);border:1px solid rgba(255,255,255,.5)}
.pill.new{background:linear-gradient(180deg,rgba(47,109,240,.22),rgba(47,109,240,.1));color:#2560d8;border-color:rgba(47,109,240,.3)}
.pill.done{background:rgba(124,92,255,.16);color:#6a4ee0;border-color:rgba(124,92,255,.3)}
.pill.connected{background:rgba(10,165,224,.14);color:#0a7fb0;border-color:rgba(10,165,224,.26)}
.pill.pending{background:linear-gradient(180deg,rgba(217,154,43,.3),rgba(217,154,43,.14));color:#9a6a12;border-color:rgba(217,154,43,.42)}
.pill.failed{background:rgba(229,72,77,.15);color:#cf3b40;border-color:rgba(229,72,77,.3)}

/* Pipeline stage badges */
.pill.s-new{background:rgba(90,87,117,.14);color:#5a5775;border-color:rgba(90,87,117,.24)}
.pill.s-attempted{background:rgba(47,109,240,.14);color:#2560d8;border-color:rgba(47,109,240,.26)}
.pill.s-connected{background:linear-gradient(180deg,rgba(10,165,224,.24),rgba(10,165,224,.11));color:#0a7fb0;border-color:rgba(10,165,224,.32)}
.pill.s-qualified{background:rgba(138,92,246,.16);color:#7a4fe0;border-color:rgba(138,92,246,.3)}
.pill.s-followup{background:rgba(217,154,43,.2);color:#9a6a12;border-color:rgba(217,154,43,.38)}
.pill.s-booked{background:rgba(79,63,214,.16);color:#4536c4;border-color:rgba(79,63,214,.3)}
.pill.s-won{background:rgba(214,168,79,.24);color:#8a6413;border-color:rgba(214,168,79,.44)}
.pill.s-lost{background:rgba(229,72,77,.14);color:#cf3b40;border-color:rgba(229,72,77,.28)}

/* Attention flag + chips */
.status-cell{display:flex;align-items:center;gap:8px}
.attn-dot{display:inline-grid;place-items:center;width:20px;height:20px;border-radius:50%;background:linear-gradient(180deg,rgba(229,72,77,.26),rgba(229,72,77,.14));color:#cf3b40;font-weight:900;font-size:.72rem;cursor:help;border:1px solid rgba(229,72,77,.34);flex:0 0 auto}
.attn-chips{display:flex;flex-wrap:wrap;gap:8px}
.attn-chip{display:inline-block;padding:5px 11px;border-radius:999px;font-size:.78rem;font-weight:700;background:rgba(229,72,77,.12);color:#cf3b40;border:1px solid rgba(229,72,77,.26)}

/* Pipeline editor + lead actions in the drawer */
.pipeline-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px 14px}
.pipeline-field{display:grid;gap:5px;font-size:.75rem;font-weight:750;color:var(--muted);text-transform:uppercase;letter-spacing:.04em}
.pipeline-field select,.pipeline-field input{font-weight:500;text-transform:none;letter-spacing:0}
.pipeline-actions{margin-top:14px}
.lead-actions{display:flex;flex-wrap:wrap;gap:10px;margin-top:14px}
.btn-like{display:inline-grid;place-items:center;min-height:42px;padding:9px 16px;border-radius:11px;text-decoration:none;font-weight:750}
.secondary.danger{color:#cf3b40;border-color:rgba(229,72,77,.4)}
.secondary.danger:hover{background:rgba(229,72,77,.08)}

/* Clickable stat cards (rendered as buttons) */
.stat{display:block;width:100%;text-align:left;cursor:pointer;font:inherit;color:inherit}
.stat.stat-click:hover{box-shadow:var(--shadow);transform:translateY(-1px)}

/* Selection + bulk actions */
.check-col,.check-cell{width:40px;text-align:center}
.check-cell input,.check-col input{width:17px;height:17px;cursor:pointer;accent-color:var(--forest-2)}
.contacts tbody tr.selected{background:rgba(109,92,245,.12)}
.bulk-bar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:12px;padding:11px 16px;
  background:var(--glass-strong);-webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur);
  border:1px solid var(--glass-line);border-radius:var(--radius-sm);box-shadow:var(--shadow-sm)}
.bulk-count{font-weight:800}
.bulk-bar[hidden]{display:none}
.bulk-bar select,.bulk-bar input{width:auto;min-width:150px}
.bulk-bar button{min-height:38px;padding:7px 14px}

/* Sticky header inside a scrollable list (no horizontal scrollbar) */
.list-wrap{max-height:calc(100vh - 240px);overflow-y:auto;overflow-x:hidden;background:rgba(255,255,255,.8)}
.contacts thead th{position:sticky;top:0;z-index:2;color:#413d5e;
  background:rgba(240,239,251,.82);-webkit-backdrop-filter:blur(24px) saturate(160%);backdrop-filter:blur(24px) saturate(160%)}
.company-cell,.source-cell{max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* Activity timeline */
.activity{display:flex;flex-direction:column;gap:10px}
.activity-item{padding:10px 12px;border-radius:10px;background:rgba(255,255,255,.5);border:1px solid var(--hair)}
.activity-item.inbound{border-left:3px solid var(--cyan)}
.activity-item.outbound{border-left:3px solid var(--forest-2)}
.activity-head{display:flex;justify-content:space-between;gap:10px;font-size:.75rem;margin-bottom:3px}
.act-tag{font-weight:800;text-transform:capitalize;color:var(--forest)}
.activity-body{white-space:pre-wrap;overflow-wrap:anywhere}

/* Duplicates */
.dupes{display:flex;flex-direction:column;gap:10px}
.dupe-item{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 12px;border-radius:10px;background:rgba(255,255,255,.5);border:1px solid var(--hair)}
.dupe-item strong{display:block}
.dupe-item button{min-height:36px;padding:6px 12px;flex:0 0 auto}

/* Change history (audit) */
.audit{display:flex;flex-direction:column;gap:8px}
.audit-item{padding:9px 12px;border-radius:10px;background:rgba(255,255,255,.45);border:1px solid var(--hair)}
.audit-head{display:flex;justify-content:space-between;gap:10px;font-size:.8rem;flex-wrap:wrap}
.audit-act{font-weight:800;color:var(--forest)}
.audit-detail{font-size:.78rem;margin-top:3px;overflow-wrap:anywhere}

/* Tag editor */
.tag-chips{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:10px}
.tag-chip{display:inline-flex;align-items:center;gap:6px;padding:5px 6px 5px 12px;border-radius:999px;font-size:.8rem;font-weight:700;background:rgba(109,92,245,.14);color:#5646d6;border:1px solid rgba(109,92,245,.28)}
.tag-x{min-height:0;width:18px;height:18px;padding:0;border-radius:50%;background:rgba(109,92,245,.2);color:#4536c4;font-size:1rem;line-height:1;display:grid;place-items:center}
.tag-add{width:100%}

/* Reports */
.reports-inner{padding:24px 26px 28px;width:min(680px,94vw);max-height:88vh;overflow:auto}
.report-tiles{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-bottom:8px}
.report-tile{padding:14px 16px;display:grid;gap:2px}
.report-tile strong{font:700 1.55rem/1.1 Georgia,serif}
.report-label{font-size:.68rem;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);font-weight:800}
.report-h{margin:20px 0 10px;font-size:.78rem;text-transform:uppercase;letter-spacing:.06em;color:var(--muted)}
.report-bars{display:flex;flex-direction:column;gap:8px}
.report-bar-row{display:grid;grid-template-columns:120px 1fr auto;align-items:center;gap:12px}
.report-bar-name{font-size:.85rem;font-weight:650;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.report-bar-track{height:12px;border-radius:999px;background:rgba(27,25,48,.08);overflow:hidden}
.report-bar-fill{height:100%;border-radius:999px;background:linear-gradient(90deg,var(--forest-2),var(--forest));min-width:3px}
.report-bar-fill.src{background:linear-gradient(90deg,#3ec6f0,var(--cyan))}
.report-bar-val{font-size:.8rem;font-weight:750;color:var(--muted);white-space:nowrap}
.sync-runs{display:flex;flex-direction:column;gap:8px}
.sync-run{padding:9px 12px;border-radius:10px;background:rgba(255,255,255,.45);border:1px solid var(--hair)}
.sync-run-top{display:flex;justify-content:space-between;gap:10px;align-items:center;font-size:.8rem;flex-wrap:wrap}
.sync-counts{font-size:.78rem;margin-top:3px}
.sync-err{font-size:.78rem;margin-top:3px;color:#cf3b40}
.pill.sync-success{background:rgba(124,92,255,.16);color:#6a4ee0}
.pill.sync-partial{background:rgba(217,154,43,.2);color:#9a6a12}
.pill.sync-failed{background:rgba(229,72,77,.15);color:#cf3b40}
.pill.sync-running{background:rgba(47,109,240,.14);color:#2560d8}
.pill.sync-locked{background:rgba(90,87,117,.14);color:#5a5775}
@media(max-width:640px){.report-tiles{grid-template-columns:1fr 1fr}.report-bar-row{grid-template-columns:92px 1fr auto}}

/* Pager */
.pager{display:flex;justify-content:flex-end;align-items:center;gap:14px;padding:0 4px 6px}
.pager .muted{color:#e7e3f6;text-shadow:0 1px 8px rgba(0,0,0,.3)}

/* ---------- Dialogs ---------- */
dialog{border:0;padding:0;color:var(--ink);box-shadow:0 40px 120px rgba(0,0,0,.4)}
dialog::backdrop{background:rgba(8,30,23,.5);-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}
.close{background:rgba(255,255,255,.4);color:var(--ink);font-size:1.4rem;line-height:1;padding:0;min-height:34px;width:34px;border-radius:10px}
.close:hover{background:rgba(255,255,255,.7)}
.dialog-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:4px}
.dialog-actions{display:flex;justify-content:flex-end;gap:12px;margin-top:22px}
.form-error{background:rgba(192,67,47,.14);color:#8a2417;padding:10px 12px;border-radius:10px;margin-top:14px;border:1px solid rgba(192,67,47,.3)}

/* Detail drawer */
.drawer{margin:0 0 0 auto;height:100vh;max-height:100vh;width:min(560px,100%);border-radius:0;background:var(--glass-strong)}
.drawer-inner{display:flex;flex-direction:column;height:100vh}
.drawer-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:22px 26px;
  border-bottom:1px solid var(--hair);position:sticky;top:0;background:rgba(255,255,255,.4)}
.drawer-title{display:flex;gap:14px;align-items:center}
.drawer-title h2{margin:0;font:700 1.4rem/1.2 Georgia,serif}
.drawer-title p{margin:2px 0 0;font-size:.85rem}
.drawer-body{padding:8px 26px 40px;overflow:auto}
.detail-section{padding:18px 0;border-bottom:1px solid var(--hair)}
.detail-section:last-child{border-bottom:0}
.detail-section h3{margin:0 0 12px;font-size:.75rem;text-transform:uppercase;letter-spacing:.07em;color:var(--muted);font-weight:800}
.def-grid{display:grid;grid-template-columns:1fr 1fr;gap:13px 20px}
.def{display:grid;gap:2px}
.def-label{font-size:.7rem;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);font-weight:750}
.def-value{overflow-wrap:anywhere}
.notes-pre{white-space:pre-wrap;font:inherit;background:rgba(255,255,255,.45);padding:14px;border-radius:12px;max-height:280px;overflow:auto;margin:0;border:1px solid var(--hair)}

/* Follow-up editor */
.followup .followup-field{display:grid;gap:6px;margin-bottom:14px;font-weight:700;font-size:.85rem}
.followup textarea{background:rgba(255,251,240,.85);border-color:rgba(198,155,89,.55)}
.followup-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.delivery-state{font-weight:800;font-size:.8rem;text-transform:capitalize}
.delivery-state.synced{color:var(--green)}
.delivery-state.pending{color:#8a6517}
.delivery-state.failed{color:var(--red)}

/* Add lead form */
.lead-form{padding:24px 26px 26px;width:min(680px,92vw);border-radius:var(--radius)}
.lead-form h2{margin:0;font:700 1.5rem/1.1 Georgia,serif}
.field-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px 16px;margin-top:16px}
.field-grid label{font-size:.85rem;gap:6px}
.field-grid .span-2{grid-column:1/-1}

/* Compose message dialog */
.compose-form{padding:24px 26px 26px;width:min(560px,92vw);border-radius:var(--radius)}
.compose-form h2{margin:0;font:700 1.4rem/1.1 Georgia,serif}
.compose-form>label{display:grid;gap:6px;margin-top:14px;font-size:.85rem;font-weight:650}
.compose-form>label[hidden]{display:none}
.compose-form textarea{resize:vertical}

/* Communication actions (Call / Text / Email) */
.comm{display:flex;gap:6px;align-items:center}
.comm.row{justify-content:flex-end;flex-wrap:nowrap}
.comm-btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;text-decoration:none;
  border-radius:10px;padding:8px 10px;font-weight:750;font-size:.8rem;cursor:pointer;
  border:1px solid rgba(19,43,36,.12);background:rgba(255,255,255,.62);color:var(--forest);
  transition:transform .1s ease,background .12s ease,box-shadow .12s ease}
.comm-btn:hover{background:#fff;box-shadow:var(--shadow-sm)}
.comm-btn:active{transform:translateY(1px)}
.comm-btn .comm-ico{font-size:1rem;line-height:1}
.comm-btn.call{color:var(--forest-2)}
.comm-btn.text{color:var(--violet)}
.comm-btn.email{color:var(--blue)}
.comm-btn.disabled{opacity:.32;pointer-events:none;filter:grayscale(1)}
.comm.row .comm-label{display:none}
.actions-cell{white-space:nowrap}
.reach-bar{padding-top:16px!important}
.comm.bar{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;width:100%}
.comm.bar .comm-btn{padding:13px 10px;font-size:.9rem;min-height:48px;background:var(--glass-soft)}

/* ---------- Responsive ---------- */
@media(max-width:1080px){.stats{grid-template-columns:repeat(2,1fr)}}
@media(max-width:900px){
  .app-shell{grid-template-columns:1fr;padding:14px;gap:14px}
  .menu-toggle{display:grid;place-items:center}
  .sidebar{position:fixed;top:0;left:0;bottom:0;height:100vh;width:min(300px,84vw);z-index:40;border-radius:0 22px 22px 0;
    transform:translateX(-104%);transition:transform .25s ease}
  .app-shell.nav-open .sidebar{transform:translateX(0)}
  .page-head{position:static}
  /* Tablet: let the toolbar rows wrap neatly instead of clipping */
  .head-top{flex-wrap:wrap}
  .head-filters{flex-wrap:wrap}
  .head-actions{flex-wrap:wrap;justify-content:flex-start}
  .head-filters #stage-filter,.head-filters #sort,.head-filters #views-select{min-width:130px}
}
@media(max-width:760px){
  .stats{grid-template-columns:1fr 1fr;gap:10px}
  .stat{padding:14px 16px}
  .stat strong{font-size:1.7rem}
  .head-top{display:none}
  .head-filters{width:100%;gap:8px}
  .head-filters .field-label,.head-filters #save-view{display:none}
  .search-label{flex:1 1 auto;min-width:0}

  /* Lead list becomes stacked cards */
  .list-wrap{background:transparent;border:0;box-shadow:none;overflow:visible;max-height:none;-webkit-backdrop-filter:none;backdrop-filter:none}
  .contacts thead{display:none}
  .check-cell{display:none}
  .bulk-bar select,.bulk-bar input{flex:1;min-width:0}
  .contacts,.contacts tbody{display:block}
  .contacts tr{display:flex;flex-direction:column;gap:9px;margin-bottom:14px;padding:16px;
    background:var(--glass-strong);-webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur);
    border:1px solid var(--glass-line);border-radius:var(--radius-sm);box-shadow:var(--shadow-sm)}
  .contacts tr:hover,.contacts tr:focus{background:var(--glass-strong)}
  .contacts td{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:0;border:0;
    text-align:right;max-width:none;white-space:normal;overflow:visible;overflow-wrap:anywhere;word-break:break-word;min-width:0}
  .contacts td[data-label]::before{content:attr(data-label);font-size:.68rem;text-transform:uppercase;
    letter-spacing:.05em;color:var(--muted);font-weight:800;text-align:left;flex:0 0 auto}
  .contacts td.col-right{text-align:right}
  .contacts td.is-empty{display:none}
  .company-cell,.source-cell{max-width:none;overflow:visible;white-space:normal;text-overflow:clip}
  /* Long emails/phones wrap inside the card on mobile instead of overflowing */
  .contacts td.reach{max-width:none;overflow:visible;text-overflow:clip;white-space:normal;text-align:right}
  .lead-cell{justify-content:flex-start;gap:12px;padding-bottom:11px;border-bottom:1px solid var(--hair)}
  .lead-cell .avatar.sm{width:42px;height:42px;font-size:.9rem}
  .lead-cell strong{font-size:1.05rem}
  .lead-cell small{max-width:none;overflow:visible;text-overflow:clip;white-space:normal;overflow-wrap:anywhere;word-break:break-word}
  .contacts td.actions-cell{padding-top:11px;border-top:1px solid var(--hair)}
  .comm.row{width:100%;gap:8px}
  .comm.row .comm-btn{flex:1;padding:11px 8px;font-size:.82rem}
  .comm.row .comm-label{display:inline}

  .field-grid,.def-grid{grid-template-columns:1fr}
  .drawer{width:100%}
  .comm.bar .comm-btn{min-height:52px}
}

/* ================= Native mobile app layer ================= */
.mobile-nav{display:none}
.m-filter-btn{display:none}
.m-only{display:none}
@media(max-width:760px){
  :root{--safe-b:env(safe-area-inset-bottom,0px);--safe-t:env(safe-area-inset-top,0px)}
  body{background-attachment:scroll}
  .app-shell{padding:0;gap:0}
  .main{gap:0}
  .page-head{position:sticky;top:0;z-index:20;border-radius:0;margin:0;padding:calc(10px + var(--safe-t)) 12px 10px;box-shadow:0 4px 18px rgba(20,14,50,.16)}
  .menu-toggle{display:none}
  .head-top{display:none}
  .head-filters{width:100%;gap:8px;flex-wrap:nowrap}
  .head-filters .field-label,.head-filters #save-view{display:none}
  .search-label{flex:1 1 auto;order:0;min-width:0}
  .m-filter-btn{display:inline-grid;place-items:center;min-width:46px;min-height:46px;flex:0 0 auto}
  .m-filter-btn .ic{width:20px;height:20px}
  .main{padding:12px 12px calc(112px + var(--safe-b))}
  .stats{display:flex;gap:12px;overflow-x:auto;scroll-snap-type:x mandatory;-webkit-overflow-scrolling:touch;padding-bottom:4px;margin-bottom:14px}
  .stats::-webkit-scrollbar{display:none}
  .stat{flex:0 0 46%;scroll-snap-align:start;min-height:86px}
  .bulk-bar{position:sticky;top:64px;z-index:15}
  .mobile-nav{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:60;align-items:center;justify-content:space-around;padding:8px 6px calc(8px + var(--safe-b));background:var(--glass-strong);-webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur);border-top:1px solid var(--glass-line);box-shadow:0 -6px 24px rgba(20,14,50,.16)}
  .mnav-item{display:flex;flex-direction:column;align-items:center;gap:3px;background:transparent;color:var(--muted);min-height:48px;min-width:54px;padding:4px;font-size:.64rem;font-weight:750;border-radius:12px}
  .mnav-item .ic{width:22px;height:22px}
  .mnav-item.active{color:var(--forest-2)}
  .mnav-fab{width:58px;height:58px;margin-top:-24px;border-radius:50%;background:linear-gradient(180deg,var(--forest-2),var(--forest));color:#fff;display:grid;place-items:center;box-shadow:0 10px 24px rgba(79,63,214,.5);flex:0 0 auto;border:3px solid rgba(255,255,255,.5)}
  .mnav-fab svg{width:26px;height:26px}
  .sheet{margin:0;position:fixed;inset:auto 0 0 0;width:100%;max-width:100%;border-radius:22px 22px 0 0;background:var(--glass-strong);animation:sheetUp .25s ease}
  .sheet::backdrop{background:rgba(8,30,23,.5)}
  .sheet-inner{padding:6px 18px calc(20px + var(--safe-b));max-height:82vh;overflow:auto}
  .sheet-handle{width:40px;height:4px;border-radius:2px;background:rgba(27,25,48,.2);margin:8px auto 12px}
  .sheet h3{margin:0 0 8px;font:700 1.2rem/1.1 Georgia,serif}
  .sheet-label{font-size:.72rem;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);font-weight:800;margin:14px 0 8px}
  .chip-row{display:flex;flex-wrap:wrap;gap:8px}
  .chip{min-height:40px;padding:8px 14px;border-radius:999px;background:rgba(255,255,255,.55);border:1px solid var(--hair);font-weight:700;font-size:.85rem;color:var(--ink)}
  .chip.active{background:linear-gradient(180deg,var(--forest-2),var(--forest));color:#fff;border-color:transparent}
  .sheet-done{width:100%;margin-top:18px;min-height:48px}
  .settings-row{display:flex;justify-content:space-between;padding:12px 0;border-bottom:1px solid var(--hair)}
  .settings-btn{width:100%;margin-top:10px;min-height:46px}
  #settings-sheet form{margin:0}
  #lead-dialog,#compose-dialog,#reports-dialog{margin:0;position:fixed;inset:auto 0 0 0;width:100%;max-width:100%;border-radius:22px 22px 0 0;animation:sheetUp .25s ease}
  .lead-form,.compose-form,.reports-inner{width:100%;max-height:86vh;padding-bottom:calc(24px + var(--safe-b))}
  .drawer{width:100%;height:100vh;height:100dvh;inset:0;margin:0;border-radius:0;animation:slideUp .28s ease}
  .drawer-head{padding-top:calc(18px + var(--safe-t))}
  .drawer-body{padding-bottom:calc(44px + var(--safe-b))}
  .comm.row .comm-btn{min-height:46px;font-size:.85rem}
  .m-only{display:flex}
  .ptr{position:fixed;top:calc(var(--safe-t) + 6px);left:50%;transform:translateX(-50%);z-index:70;width:34px;height:34px;border-radius:50%;display:grid;place-items:center;background:var(--glass-strong);box-shadow:var(--shadow-sm);opacity:0;transition:opacity .15s;color:var(--forest-2)}
  .ptr.show{opacity:1}
  .ptr.spin svg{animation:ptrspin .8s linear infinite}
  .skeleton-card{height:104px;border-radius:var(--radius-sm);margin-bottom:14px;background:linear-gradient(100deg,rgba(255,255,255,.5) 30%,rgba(255,255,255,.78) 50%,rgba(255,255,255,.5) 70%);background-size:200% 100%;animation:shimmer 1.3s infinite;border:1px solid var(--glass-line)}
}
@keyframes sheetUp{from{transform:translateY(100%)}to{transform:translateY(0)}}
@keyframes slideUp{from{transform:translateY(6%);opacity:.7}to{transform:translateY(0);opacity:1}}
@keyframes shimmer{from{background-position:200% 0}to{background-position:-200% 0}}
@keyframes ptrspin{to{transform:rotate(360deg)}}
/* Fallback: devices without backdrop-filter get more opaque (still light) panels */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))){
  .glass,.glass-soft,.list-wrap,.stat,.page-head,.sidebar,.drawer,.sheet,.mobile-nav,.report-tile,#lead-dialog,#compose-dialog,#reports-dialog{background:rgba(255,255,255,.94)}
  .contacts thead th{background:#eae8f7}
}
/* Respect OS "reduce transparency" preference */
@media (prefers-reduced-transparency: reduce){
  .glass,.glass-soft,.list-wrap,.stat,.page-head,.sidebar,.drawer,.sheet,.mobile-nav,.report-tile,#lead-dialog,#compose-dialog,#reports-dialog{-webkit-backdrop-filter:none;backdrop-filter:none;background:#f3f2fb}
  .contacts thead th{-webkit-backdrop-filter:none;backdrop-filter:none;background:#e9e7f6}
  .glass-orbs{display:none}
  body{background:linear-gradient(150deg,#1c1746,#241a4e)}
}

/* ================= Mobile liquid-glass refinement ================= */
@media(max-width:760px){
  /* Lead cards: translucent glass so the gradient shows through */
  .contacts tr{background:rgba(255,255,255,.5);gap:7px;padding:14px 15px;box-shadow:0 8px 22px rgba(20,14,50,.16),var(--glass-hi)}
  .contacts tr:hover,.contacts tr:focus{background:rgba(255,255,255,.56)}
  .lead-cell strong{font-weight:800;color:var(--ink)}
  .contacts td{color:var(--ink)}
  .contacts td[data-label]::before{color:#5a5775}
  /* Call / Text / Email as floating glass pills */
  .comm.row{gap:9px}
  .comm.row .comm-btn{background:rgba(255,255,255,.5);border:1px solid var(--glass-line);border-radius:14px;box-shadow:0 4px 12px rgba(20,14,50,.14),var(--glass-hi);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);min-height:48px}
  /* Swipeable translucent stat cards */
  .stats{gap:14px}
  .stat{flex:0 0 58%;background:rgba(255,255,255,.5)}
  .bulk-bar{background:rgba(255,255,255,.55)}
  .search-label input{background:rgba(255,255,255,.5)}
  /* Floating, blurred, transparent bottom navigation */
  .mobile-nav{left:12px;right:12px;bottom:calc(10px + var(--safe-b));border-radius:26px;background:rgba(255,255,255,.56);border:1px solid var(--glass-line);box-shadow:0 12px 34px rgba(20,14,50,.3),var(--glass-hi);padding:8px}
  .mnav-fab{box-shadow:0 0 0 4px rgba(140,108,255,.3),0 10px 26px rgba(79,63,214,.6);border:3px solid rgba(255,255,255,.6)}
  /* Contact page cards translucent, clear of the floating nav */
  #detail-page{padding-bottom:calc(112px + var(--safe-b))}
  .dp-header,.dp-col .detail-section{background:rgba(255,255,255,.5)}
  .dp-header{padding:16px 18px;gap:14px}
  .avatar.lg{width:54px;height:54px;font-size:1.15rem}
}
