:root{
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #eef2f7;

  --primary: #155dfc;
  --sidebar: #0f172b;
  --sidebar2: #0b1220;
  --sideText: #cbd5e1;

  --r: 18px;
  --shadow: 0 10px 28px rgba(15, 23, 42, .08);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color: var(--text);
  background: var(--bg);
}

.app{
  min-height:100vh;
  display:flex;
}

.sidebar{
  width:320px;
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar2));
  color: var(--sideText);
  padding:26px 20px;
  display:flex;
  flex-direction:column;
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
  padding:8px 8px 18px;
}

.brand-icon{
  width:44px;height:44px;
  border-radius:14px;
  display:grid;
  place-items:center;
  background: rgba(21,93,252,.18);
  color:#fff;
  font-weight:800;
}

.brand-name{
  font-weight:700;
  letter-spacing:.3px;
}

.nav{margin-top:10px; display:flex; flex-direction:column; gap:8px;}

.nav-link{
  display:flex;
  align-items:center;
  gap:12px;
  padding:14px 14px;
  border-radius:14px;
  color: var(--sideText);
  text-decoration:none;
  transition: .15s ease;
  position:relative;
}

.nav-link:hover{ background: rgba(255,255,255,.05); }

.nav-link.active{
  background: var(--primary);
  color:#fff;
  box-shadow: 0 10px 20px rgba(21,93,252,.25);
}

.nav-ic{
  width:22px;height:22px;
  display:grid; place-items:center;
}
.nav-ic svg{ width:22px;height:22px; opacity:.9; }

.nav-arrow{
  margin-left:auto;
  font-size:20px;
  opacity:.9;
}

.sidebar-footer{ margin-top:auto; padding-top:18px; }
.profile{
  background: rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.06);
  border-radius: 18px;
  padding:14px;
  display:flex;
  align-items:center;
  gap:12px;
}

.avatar{
  width:46px;height:46px;
  border-radius:999px;
  background: rgba(255,255,255,.12);
  color:#fff;
  display:grid; place-items:center;
  font-weight:700;
}

.profile-meta{ flex:1; min-width:0; }
.profile-name{ color:#fff; font-weight:600; }
.profile-email{
  font-size:12px;
  opacity:.75;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.logout-btn{
  border:none;
  background: transparent;
  color: rgba(255,255,255,.8);
  cursor:pointer;
  width:38px;height:38px;
  border-radius:12px;
  display:grid; place-items:center;
}
.logout-btn:hover{ background: rgba(255,255,255,.06); }
.logout-btn svg{ width:22px;height:22px; }

.content{
  flex:1;
  padding:34px 44px;
}

.page-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom:22px;
}

.h1{ margin:0; font-size:40px; letter-spacing:-.6px; }
.sub{ margin:6px 0 0; color: var(--muted); }

.btn-primary{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding:12px 18px;
  border-radius: 12px;
  background: var(--primary);
  color:#fff;
  text-decoration:none;
  font-weight:600;
  box-shadow: 0 12px 22px rgba(21,93,252,.22);
  border:none;
  cursor:pointer;
}
.btn-primary:hover{ filter: brightness(1.03); }
.btn-primary.full{ width:100%; justify-content:center; padding:12px 18px; }

.btn-ic{
  width:26px;height:26px;
  border-radius:10px;
  background: rgba(255,255,255,.16);
  display:grid; place-items:center;
  font-weight:800;
  line-height:1;
}

.stats{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:18px;
  margin-bottom:22px;
}

.stat-card{
  background: var(--card);
  border:1px solid var(--line);
  border-radius: var(--r);
  padding:20px 20px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .05);
}

.stat-label{ color: var(--muted); font-weight:500; }
.stat-value{ font-size:34px; font-weight:700; margin-top:8px; }

.stat-icon{
  width:54px;height:54px;
  border-radius: 14px;
  display:grid; place-items:center;
  color:#fff;
}
.stat-icon svg{ width:26px;height:26px; }

.stat-icon.blue{ background: linear-gradient(180deg, #155dfc, #3b82f6); }
.stat-icon.green{ background: linear-gradient(180deg, #00b87a, #00c18c); }
.stat-icon.purple{ background: linear-gradient(180deg, #aa42ff, #7c3aed); }
.stat-icon.orange{ background: linear-gradient(180deg, #ff6500, #ff9f6a); }

.card{
  background: var(--card);
  border:1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding:18px;
}

.card-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:6px 8px 12px;
  border-bottom: 1px solid var(--line);
}

.h2{ margin:0; font-size:18px; }
.link{ color: var(--primary); text-decoration:none; font-weight:600; }
.link span{ margin-left:8px; }

.list{ padding: 6px 0; }
.list-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:16px 8px;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child{ border-bottom:none; }

.lead-left{ display:flex; align-items:center; gap:14px; }
.lead-avatar{
  width:42px;height:42px;
  border-radius:999px;
  background:#f1f5f9;
  display:grid; place-items:center;
  font-weight:700;
  color:#111827;
}
.lead-name{ font-weight:700; }
.lead-phone{ color: var(--muted); margin-top:4px; font-size:14px; }

.lead-badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  border-radius:999px;
  background:#f1f5ff;
  color: var(--primary);
  font-weight:600;
  font-size:13px;
}
.lead-badge .dot{
  width:7px;height:7px;border-radius:999px;
  background: var(--primary);
  display:inline-block;
}

.empty{
  padding:18px 8px;
  color: var(--muted);
}

.toast{
  background:#ecfdf5;
  border:1px solid #a7f3d0;
  color:#065f46;
  padding:12px 14px;
  border-radius:14px;
  margin-bottom:16px;
  font-weight:600;
}

/* Forms */
.form{ padding:10px 8px 6px; }
.field{ margin-bottom:14px; }
.field label{ display:block; font-weight:600; margin-bottom:8px; }
.field input, .field select{
  width:100%;
  padding:12px 12px;
  border:1px solid var(--line);
  border-radius: 12px;
  background:#fff;
  outline:none;
  font-family: inherit;
}
.field input:focus, .field select:focus{
  border-color: rgba(21,93,252,.35);
  box-shadow: 0 0 0 4px rgba(21,93,252,.10);
}
.err{ margin-top:8px; color:#b91c1c; font-size:13px; }

.actions{ display:flex; gap:10px; margin-top:6px; }
.btn-ghost{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:12px 16px;
  border-radius:12px;
  border:1px solid var(--line);
  background:#fff;
  text-decoration:none;
  color: var(--text);
  font-weight:700;
}

/* Table */
.table{ width:100%; }
.t-head, .t-row{
  display:grid;
  grid-template-columns: 1.4fr 1fr .7fr .8fr;
  gap:12px;
  padding:14px 10px;
}
.t-head{
  color: var(--muted);
  font-weight:700;
  border-bottom:1px solid var(--line);
}
.t-row{ border-bottom:1px solid var(--line); }
.t-row:last-child{ border-bottom:none; }
.t-strong{ font-weight:700; }
.t-muted{ color: var(--muted); }
.pill{
  background:#f1f5ff;
  color: var(--primary);
  padding:7px 10px;
  border-radius:999px;
  font-weight:700;
  font-size:12px;
}

/* Pagination */
.pager{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  padding:14px 8px 6px;
}
.pg{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:#fff;
  text-decoration:none;
  color: var(--text);
  font-weight:700;
  font-size:13px;
}
.pg:hover{ border-color: rgba(21,93,252,.30); }
.pg.info{ background:#f8fafc; color: var(--muted); font-weight:700; }
.pg.disabled{ opacity:.5; cursor:not-allowed; }

/* Login */
.login-body{ background: var(--bg); }
.login-wrap{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:24px;
}
.login-card{
  width: 460px;
  max-width: 100%;
  background: var(--card);
  border:1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.login-brand{
  display:flex;
  gap:12px;
  align-items:center;
  margin-bottom:16px;
}
.login-title{ font-weight:800; }
.login-sub{ color: var(--muted); font-size:13px; margin-top:2px; }
.login-h1{ margin:14px 0 6px; font-size:28px; }
.login-p{ margin:0 0 14px; color: var(--muted); }
.row-between{ display:flex; justify-content:space-between; align-items:center; margin:6px 0 12px; }
.check{ display:flex; align-items:center; gap:10px; color: var(--muted); font-weight:600; }
.hint{ margin-top:14px; color: var(--muted); font-size:13px; }

/* Responsive */
@media (max-width: 1100px){
  .stats{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content{ padding:26px 20px; }
  .sidebar{ width:300px; }
}
@media (max-width: 860px){
  .app{ flex-direction:column; }
  .sidebar{ width:100%; }
}
