/* Layout: reel-style CRM. Fixed left sidebar on laptop, bottom tab bar on phone.
   Every view: title + subtitle, a row of number cards, then one big panel. */
:root {
  --bg-0: #070f24;
  --bg-1: #0b1a3d;
  --bg-2: #123068;
  --panel: rgba(17, 36, 82, 0.72);
  --panel-solid: #11244f;
  --panel-2: #0f1f47;
  --line: rgba(120, 160, 255, 0.16);
  --line-2: rgba(120, 160, 255, 0.28);
  --fg: #eef3ff;
  --muted: #9fb0d6;
  --faint: #6f81ad;
  --blue: #2f7bff;
  --blue-2: #1b5fe6;
  --cyan: #4cc9ff;
  --green: #22c55e;
  --green-2: #16a34a;
  --amber: #f5b53d;
  --red: #f0566b;
  --violet: #9b7bff;
  --grey: #7d8bb0;
  --radius: 16px;
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --side: 248px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.45 var(--font);
  color: var(--fg);
  background: radial-gradient(1200px 700px at 85% -10%, #1d4fb0 0%, transparent 60%),
              linear-gradient(160deg, var(--bg-1) 0%, var(--bg-0) 55%, #081536 100%);
  background-attachment: fixed;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
a { color: var(--cyan); }
button, select, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100%; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 22px 16px; display: flex; flex-direction: column; gap: 14px;
  background: linear-gradient(180deg, rgba(8, 20, 50, .92), rgba(6, 15, 38, .96));
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .08em; line-height: 1.05; font-size: 13px; padding: 0 6px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: conic-gradient(from 200deg, var(--cyan), var(--blue), var(--violet), var(--cyan)); box-shadow: 0 0 18px rgba(76, 201, 255, .45); }
.search input {
  width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04); outline: none;
}
.search input::placeholder { color: var(--faint); }
.nav-label { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); padding: 4px 8px 0; }
.nav { display: grid; gap: 4px; }
.nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; border-radius: 11px; color: var(--muted); text-decoration: none; font-weight: 600;
}
.nav a:hover { background: rgba(255, 255, 255, .05); color: var(--fg); }
.nav a.active {
  color: #fff; background: linear-gradient(90deg, var(--blue-2), var(--blue));
  box-shadow: 0 6px 22px rgba(47, 123, 255, .45), inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.count { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: rgba(255, 255, 255, .08); color: var(--muted); }
.count:empty { display: none; }
.count.hot { background: rgba(76, 201, 255, .16); color: var(--cyan); }
.nav a.active .count { background: rgba(255, 255, 255, .2); color: #fff; }
.today {
  margin-top: auto; padding: 14px; border-radius: var(--radius); border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(27, 63, 140, .6), rgba(12, 27, 64, .8));
  display: grid; gap: 10px;
}
.today .top { display: flex; align-items: center; gap: 12px; }
.today .lbl { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.today .big { font-size: 26px; font-weight: 800; line-height: 1; }
.today .row { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.today .row b { color: var(--fg); }

.main { min-width: 0; padding-inline: 28px; padding-block: 26px 120px; }
.tabbar { display: none; }

/* ---------- headings ---------- */
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.head h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.02em; text-wrap: balance; }
.head p { margin: 2px 0 0; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, .05); color: var(--fg);
  padding: 9px 14px; border-radius: 11px; font-weight: 600; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, .09); }
.btn.primary { border-color: transparent; color: #fff; background: linear-gradient(90deg, var(--blue-2), var(--blue) 60%, #3d9bff); box-shadow: 0 8px 24px rgba(47, 123, 255, .45); }
.btn.green { border-color: transparent; color: #fff; background: linear-gradient(90deg, var(--green-2), var(--green)); box-shadow: 0 8px 24px rgba(34, 197, 94, .35); }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- KPI cards ---------- */
.kpis { display: grid; grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpis.five { grid-template-columns: 1.5fr repeat(4, minmax(0, 1fr)); }
.kpi {
  position: relative; overflow: hidden; min-width: 0;
  padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--panel); backdrop-filter: blur(6px);
  display: grid; gap: 4px; align-content: start;
}
.kpi .lbl { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.kpi .num { font-size: 34px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.kpi .cap { color: var(--muted); font-size: 12.5px; }
.kpi.hero {
  border-color: rgba(120, 180, 255, .45);
  background: linear-gradient(135deg, #1b5fe6 0%, #2f7bff 45%, #0f3ea8 100%);
  box-shadow: 0 14px 40px rgba(31, 95, 230, .45), inset 0 0 0 1px rgba(255, 255, 255, .1);
}
.kpi.hero .lbl, .kpi.hero .cap { color: rgba(255, 255, 255, .82); }
.kpi.hero .num { font-size: 46px; }
.kpi .spark { position: absolute; right: 14px; bottom: 12px; width: 46%; height: 52px; }
.kpi .cyan { color: var(--cyan); }
.kpi .green { color: var(--green); }
.stack { display: flex; height: 7px; border-radius: 99px; overflow: hidden; background: rgba(255, 255, 255, .07); margin-top: 8px; }
.stack span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.ringcard { display: flex; align-items: center; gap: 16px; }
.ring { flex: none; }
.ring text { font-family: var(--font); font-weight: 800; fill: var(--fg); }

/* ---------- panel + table ---------- */
.panel { border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(6px); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px; border-bottom: 1px solid var(--line); }
.toolbar .grow { flex: 1 1 200px; }
.toolbar input, .toolbar select, .field input, .field select, .field textarea {
  padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(8, 18, 45, .7); outline: none; min-width: 0;
}
.toolbar input { width: 100%; }
.toolbar .meta { margin-left: auto; color: var(--faint); font-size: 12.5px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab { border: 1px solid var(--line); background: transparent; color: var(--muted); padding: 7px 12px; border-radius: 99px; cursor: pointer; font-weight: 600; }
.tab.active { background: linear-gradient(90deg, var(--blue-2), var(--blue)); color: #fff; border-color: transparent; }
.tab .count { margin-left: 4px; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); font-weight: 600; padding: 10px 14px; white-space: nowrap; }
td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: rgba(47, 123, 255, .08); }
.biz b { display: block; font-weight: 700; }
.sub { color: var(--muted); font-size: 12.5px; }
.star { color: var(--amber); }
.phone { color: var(--cyan); font-weight: 600; white-space: nowrap; text-decoration: none; }
.copy { border: 0; background: none; color: var(--faint); cursor: pointer; padding: 2px 4px; font-size: 12px; }
.copy:hover { color: var(--fg); }
.score { display: flex; align-items: center; gap: 8px; min-width: 90px; }
.score b { width: 26px; }
.bar { flex: 1; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--green-2), var(--green)); border-radius: 99px; }
.grade { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 12px; border: 1.5px solid; }
.grade.A { color: var(--green); border-color: var(--green); } .grade.B { color: var(--cyan); border-color: var(--cyan); }
.grade.C { color: var(--amber); border-color: var(--amber); } .grade.D { color: var(--grey); border-color: var(--grey); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 9px; font-size: 12.5px; font-weight: 600; border: 1px solid; white-space: nowrap; }
select.chip { appearance: none; -webkit-appearance: none; padding-right: 24px; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: right 11px center, right 6px center; background-size: 5px 5px; background-repeat: no-repeat; }
.c-none { color: var(--grey); border-color: rgba(125, 139, 176, .45); background-color: rgba(125, 139, 176, .1); }
.c-amber { color: var(--amber); border-color: rgba(245, 181, 61, .55); background-color: rgba(245, 181, 61, .12); }
.c-red { color: var(--red); border-color: rgba(240, 86, 107, .55); background-color: rgba(240, 86, 107, .12); }
.c-blue { color: var(--cyan); border-color: rgba(76, 201, 255, .5); background-color: rgba(76, 201, 255, .1); }
.c-green { color: var(--green); border-color: rgba(34, 197, 94, .55); background-color: rgba(34, 197, 94, .12); }
.c-violet { color: var(--violet); border-color: rgba(155, 123, 255, .55); background-color: rgba(155, 123, 255, .12); }
select.chip option { background: var(--panel-solid); color: var(--fg); }
.when { white-space: nowrap; }
.when .sub { display: block; }
.callbtn {
  width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, #2fd46b, var(--green-2)); box-shadow: 0 0 0 4px rgba(34, 197, 94, .15), 0 6px 16px rgba(34, 197, 94, .35);
  color: #fff; text-decoration: none;
}
.callbtn svg { width: 18px; height: 18px; }
.callcell { display: flex; align-items: center; gap: 10px; }
.empty { padding: 40px 18px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--fg); font-size: 16px; margin-bottom: 4px; }

/* ---------- dock (Ready to dial) ---------- */
.dock {
  position: sticky; bottom: 14px; margin-top: 16px; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-radius: var(--radius); border: 1px solid var(--line-2);
  background: linear-gradient(90deg, rgba(14, 33, 78, .96), rgba(21, 52, 120, .96));
  box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
}
.dock h3 { margin: 0; font-size: 17px; }
.dock p { margin: 0; color: var(--muted); font-size: 13px; }
.mstart { display: none; }
.notice { margin-bottom: 14px; padding: 11px 14px; border-radius: 12px; border: 1px solid rgba(245, 181, 61, .4); background: rgba(245, 181, 61, .1); color: #ffd98a; }
.banner { margin-bottom: 16px; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(240, 86, 107, .5); background: rgba(240, 86, 107, .12); color: #ffc2cb; }
.banner.info { border-color: rgba(76, 201, 255, .45); background: rgba(76, 201, 255, .1); color: #bfe9ff; }

/* ---------- mobile lead cards ---------- */
.cards { display: none; }
.lcard { padding: 14px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.lcard .r1 { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.lcard .r2 { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* ---------- focus (one lead at a time) ---------- */
.focus { position: fixed; inset: 0; z-index: 50; background: rgba(4, 10, 26, .72); backdrop-filter: blur(8px); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.fcard {
  width: min(560px, 100%); border-radius: 22px; border: 1px solid var(--line-2);
  background: linear-gradient(170deg, #142f6b, #0c1d48 60%); box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  padding: 22px; display: grid; gap: 16px;
}
.fcard .top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; }
.fcard h2 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.01em; text-wrap: balance; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.bigcall {
  display: flex; align-items: center; justify-content: center; gap: 12px; text-decoration: none;
  padding: 18px; border-radius: 16px; color: #fff; font-size: 20px; font-weight: 800;
  background: linear-gradient(90deg, var(--green-2), #2fd46b); box-shadow: 0 14px 34px rgba(34, 197, 94, .4);
}
.bigcall svg { width: 24px; height: 24px; }
.numline { text-align: center; font-size: 22px; font-weight: 700; letter-spacing: .02em; user-select: all; -webkit-user-select: all; }
.facts { display: grid; gap: 6px; color: var(--muted); font-size: 13.5px; }
.facts b { color: var(--fg); font-weight: 600; }
.outs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.out { padding: 13px 8px; border-radius: 12px; font-weight: 700; cursor: pointer; border: 1px solid; }
.field { display: grid; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.field textarea { resize: vertical; min-height: 44px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

/* ---------- analytics ---------- */
.grid2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; }
.panel .ph { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.panel .ph h3 { margin: 0; font-size: 15px; }
.panel .pb { padding: 16px 18px; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.hbar { display: grid; grid-template-columns: 110px 1fr 36px; gap: 10px; align-items: center; margin-bottom: 9px; font-size: 13px; }
.hbar .track { height: 9px; border-radius: 99px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.hbar .track span { display: block; height: 100%; border-radius: 99px; }

/* ---------- scrapes ---------- */
.form { display: grid; gap: 16px; padding: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tchip { border: 1px solid var(--line-2); background: rgba(255, 255, 255, .04); color: var(--muted); padding: 7px 12px; border-radius: 99px; cursor: pointer; font-weight: 600; }
.tchip[aria-pressed="true"] { color: #fff; background: rgba(47, 123, 255, .3); border-color: var(--blue); }
.formgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.costline { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.costline .sub b { color: var(--fg); }
.progress { padding: 18px; display: flex; align-items: center; gap: 12px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--cyan); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 18px; border-radius: 14px;
  background: #0f2456; border: 1px solid var(--line-2); box-shadow: 0 14px 40px rgba(0, 0, 0, .45); max-width: calc(100% - 32px);
}
.toast.err { border-color: rgba(240, 86, 107, .6); }

/* ---------- phone ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .main { padding-inline: 16px; padding-block: 18px 120px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    background: rgba(7, 16, 40, .96); border-top: 1px solid var(--line); backdrop-filter: blur(10px);
  }
  .tabbar a { text-align: center; padding: 10px 4px; border-radius: 11px; color: var(--muted); text-decoration: none; font-weight: 700; font-size: 13px; }
  .tabbar a.active { color: #fff; background: linear-gradient(90deg, var(--blue-2), var(--blue)); }
  .head h1 { font-size: 26px; }
  .kpis, .kpis.five { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpis .kpi.hero, .kpis .kpi.ringcard { grid-column: 1 / -1; }
  .dock { display: none; }
  .mstart { display: flex; width: 100%; justify-content: center; padding: 16px; font-size: 17px; border-radius: 14px; margin-bottom: 14px; }
  .kpi .num { font-size: 28px; }
  .kpi.hero .num { font-size: 40px; }
  .tablewrap.leads table { display: none; }
  .cards { display: block; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .formgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .outs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fcard { padding: 18px; }
  .fcard h2 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } * { scroll-behavior: auto !important; } }
