*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue: #2563EB;
  --blue-light: #EFF6FF;
  --blue-text: #1D4ED8;
  --green: #16A34A;
  --green-light: #F0FDF4;
  --green-text: #15803D;
  --red: #DC2626;
  --red-light: #FEF2F2;
  --red-text: #B91C1C;
  --amber: #D97706;
  --amber-light: #FFFBEB;
  --amber-text: #B45309;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --sidebar-w: 220px;
  --radius: 10px;
  --radius-sm: 6px;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 14px;
  background: var(--gray-100);
  color: var(--gray-900);
  display: flex;
  min-height: 100vh;
  line-height: 1.5;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
  border-bottom: 1px solid var(--gray-100);
}

nav {
  padding: 12px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--gray-500);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.1s, color 0.1s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--gray-50); color: var(--gray-700); }
.nav-item.active { background: var(--blue-light); color: var(--blue-text); }

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--gray-100);
}

.export-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  background: #fff;
  color: var(--gray-500);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.1s;
}
.export-btn svg { width: 16px; height: 16px; }
.export-btn:hover { background: var(--gray-50); color: var(--gray-700); }

/* ── MAIN ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 28px 32px;
  max-width: calc(100vw - var(--sidebar-w));
}

.view { display: none; }
.view.active { display: block; }

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h1 { font-size: 22px; font-weight: 600; color: var(--gray-900); }
.page-sub { font-size: 13px; color: var(--gray-400); margin-top: 2px; }

/* ── BUTTONS ── */
.btn-primary {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.1s;
}
.btn-primary:hover { background: var(--blue-text); }

.btn-ghost {
  background: #fff;
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.1s;
}
.btn-ghost:hover { background: var(--gray-50); }

.btn-danger {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
}
.btn-danger:hover { background: var(--red-text); }

/* ── STAT CARDS ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-label { font-size: 12px; font-weight: 500; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.stat-value { font-size: 32px; font-weight: 600; color: var(--gray-900); line-height: 1; margin-bottom: 6px; }
.stat-hint { font-size: 12px; color: var(--gray-400); }

.stat-card.green .stat-value { color: var(--green); }
.stat-card.red .stat-value { color: var(--red); }
.stat-card.amber .stat-value { color: var(--amber); }

/* ── TABLE ── */
.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 12px;
}

.table-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
}

table { width: 100%; border-collapse: collapse; min-width: 640px; }

thead th {
  background: var(--gray-50);
  padding: 10px 14px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

tbody tr { border-bottom: 1px solid var(--gray-100); transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }

td {
  padding: 12px 14px;
  font-size: 13.5px;
  color: var(--gray-700);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-row {
  text-align: center;
  padding: 48px 0;
  color: var(--gray-400);
  font-size: 14px;
  max-width: none;
}

/* ── STATUS BADGES ── */
.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.badge-interested { background: var(--green-light); color: var(--green-text); }
.badge-not { background: var(--red-light); color: var(--red-text); }
.badge-na { background: var(--amber-light); color: var(--amber-text); }

/* ── STATUS DROPDOWN ── */
select {
  font-size: 12px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  background: #fff;
  color: var(--gray-700);
  cursor: pointer;
  font-family: inherit;
  min-width: 130px;
}
select:focus { outline: 2px solid var(--blue); outline-offset: 1px; }

/* delete icon button */
.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-300);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.1s, background 0.1s;
}
.icon-btn:hover { color: var(--red); background: var(--red-light); }
.icon-btn svg { width: 16px; height: 16px; }

/* ── TOOLBAR ── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-icon {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--gray-400);
}
.search-input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  background: #fff;
  color: var(--gray-900);
}
.search-input:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: transparent; }

.filter-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.filter-tab {
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  background: #fff;
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.1s;
}
.filter-tab:hover { border-color: var(--gray-300); color: var(--gray-700); }
.filter-tab.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ── ADD LEAD VIEW ── */
.add-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.form-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 22px 24px;
}

.form-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--gray-100);
}
.form-card-title svg { width: 18px; height: 18px; color: var(--gray-400); flex-shrink: 0; }

textarea {
  width: 100%;
  min-height: 280px;
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-family: 'Inter', monospace;
  color: var(--gray-700);
  resize: vertical;
  line-height: 1.6;
}
textarea:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: transparent; }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--gray-500);
  margin-bottom: 5px;
}
.field input, .field select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--gray-900);
  background: #fff;
  min-width: 0;
}
.field input:focus, .field select:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: transparent; }

.field-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.field-sm { min-width: 100px; }

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--gray-900);
  color: #fff;
  font-size: 13.5px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 1000;
  max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
}
.modal-overlay.open { display: flex; }

.modal {
  background: #fff;
  border-radius: var(--radius);
  padding: 28px;
  width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
.modal-title { font-size: 16px; font-weight: 600; color: var(--gray-900); margin-bottom: 10px; }
.modal-body { font-size: 13.5px; color: var(--gray-500); margin-bottom: 22px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .add-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .main { padding: 16px; margin-left: 0; max-width: 100vw; }
  .sidebar { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
}
