:root{
  --blue:#188BF6;
  --blue-hover:#0F7AE5;
  --headline:#262626;
  --body-text:#525252;
  --bg-alt:#FAFAFA;
  --border:#E5E5E5;
  --dark-bg:#111827;
  --success:#16A34A;
  --success-surface:#F0FDF4;
  --problem:#DC2626;
  --problem-surface:#FEF2F2;
  --amber:#F59E0B;
  --amber-surface:#FFFBEB;
}

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

body{
  font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, sans-serif;
  color:var(--headline);
  background:var(--bg-alt);
  line-height:1.5;
}

a{ color:inherit; text-decoration:none; }

/* ---------- Login ---------- */
.login-body{
  min-height:100vh;
  display:flex; align-items:center; justify-content:center;
  background:var(--dark-bg);
}
.login-card{
  background:#fff;
  width:100%; max-width:380px;
  padding:40px 36px;
  border-radius:6px;
  box-shadow:0 20px 60px rgba(0,0,0,0.3);
}
.login-card h1{ font-size:1.5rem; margin-bottom:6px; }
.login-card .sub{ color:var(--body-text); font-size:0.9rem; margin-bottom:24px; }

/* ---------- Layout ---------- */
.topbar{
  background:var(--dark-bg);
  color:#fff;
  padding:16px 0;
}
.topbar-inner{
  max-width:1200px; margin:0 auto; padding:0 24px;
  display:flex; align-items:center; justify-content:space-between;
}
.topbar h1{ font-size:1.2rem; }
.topbar-user{ display:flex; align-items:center; gap:14px; font-size:0.88rem; color:rgba(255,255,255,0.75); }

.wrap{ max-width:1200px; margin:0 auto; padding:28px 24px 60px; }
.wrap-narrow{ max-width:520px; }

.back-link{ display:inline-block; margin-bottom:18px; color:var(--blue); font-size:0.92rem; }
.back-link:hover{ text-decoration:underline; }

/* ---------- Stats ---------- */
.stats-row{
  display:flex; gap:14px; flex-wrap:wrap;
  margin-bottom:24px;
}
.stat-card{
  background:#fff; border:1px solid var(--border); border-radius:6px;
  padding:16px 20px; min-width:130px;
  display:flex; flex-direction:column; gap:4px;
}
.stat-card.stat-total{ border-color:var(--blue); background:#EFF6FF; }
.stat-num{ font-size:1.6rem; font-weight:700; }
.stat-label{ font-size:0.8rem; color:var(--body-text); }

/* ---------- Filter row ---------- */
.filter-row{
  display:flex; gap:10px; margin-bottom:20px; flex-wrap:wrap;
}
.filter-row input[type=text]{
  flex:1; min-width:220px;
  padding:10px 14px; border:1px solid var(--border); border-radius:4px; font-size:0.92rem;
}
.filter-row select{
  padding:10px 14px; border:1px solid var(--border); border-radius:4px; font-size:0.92rem;
  background:#fff;
}

/* ---------- Buttons ---------- */
.btn-primary{
  display:inline-block;
  background:var(--blue); color:#fff;
  border:none; padding:10px 20px;
  border-radius:4px; font-size:0.9rem; font-weight:600;
  cursor:pointer; transition:background .2s ease;
}
.btn-primary:hover{ background:var(--blue-hover); }
.btn-primary.full{ width:100%; text-align:center; padding:12px; }

.btn-ghost{
  display:inline-block;
  background:transparent; color:#fff;
  border:1px solid rgba(255,255,255,0.3);
  padding:8px 16px; border-radius:4px; font-size:0.85rem;
  cursor:pointer;
}
.topbar .btn-ghost:hover{ border-color:#fff; }
main .btn-ghost{ color:var(--headline); border-color:var(--border); }
main .btn-ghost:hover{ border-color:var(--blue); color:var(--blue); }
.btn-ghost.small{ padding:6px 12px; font-size:0.8rem; }

/* ---------- Table ---------- */
.table-wrap{
  background:#fff; border:1px solid var(--border); border-radius:6px;
  overflow-x:auto;
}
.leads-table{ width:100%; border-collapse:collapse; font-size:0.88rem; }
.leads-table th{
  text-align:left; padding:12px 16px; background:var(--bg-alt);
  border-bottom:1px solid var(--border); font-weight:600; color:var(--body-text);
  white-space:nowrap;
}
.leads-table td{
  padding:12px 16px; border-bottom:1px solid var(--border); white-space:nowrap;
}
.leads-table tr:last-child td{ border-bottom:none; }
.leads-table tr:hover{ background:#FAFBFF; }
.empty-row{ text-align:center; color:var(--body-text); padding:40px !important; }

/* ---------- Badges ---------- */
.badge{
  display:inline-block; padding:4px 10px; border-radius:100px;
  font-size:0.76rem; font-weight:600;
}
.badge-gray{ background:#F3F4F6; color:#6B7280; }
.badge-blue{ background:#EFF6FF; color:var(--blue-hover); }
.badge-amber{ background:var(--amber-surface); color:#B45309; }
.badge-green{ background:var(--success-surface); color:var(--success); }
.badge-red{ background:var(--problem-surface); color:var(--problem); }

/* ---------- Detail page ---------- */
.detail-grid{
  display:grid; grid-template-columns: 1.4fr 1fr; gap:20px;
  align-items:start;
}
.detail-card{
  background:#fff; border:1px solid var(--border); border-radius:6px;
  padding:24px;
}
.detail-card h2{ margin-bottom:8px; }
.detail-card h3{ margin-bottom:16px; }
.detail-section{
  margin-top:16px; padding-top:16px; border-top:1px solid var(--border);
}
.detail-section p{ margin-bottom:6px; font-size:0.92rem; }
.mono{ font-family:ui-monospace, Menlo, monospace; word-break:break-all; }
.mono.small{ font-size:0.78rem; color:var(--body-text); }

@media (max-width:800px){
  .detail-grid{ grid-template-columns:1fr; }
}

/* ---------- Forms ---------- */
.field-group{ margin-bottom:16px; }
.field-group label{
  display:block; font-size:0.85rem; color:var(--body-text); margin-bottom:6px; font-weight:600;
}
.field-group input, .field-group select, .field-group textarea{
  width:100%; padding:10px 12px;
  border:1px solid var(--border); border-radius:4px;
  font-size:0.92rem; font-family:inherit;
}
.field-group textarea{ resize:vertical; }

/* ---------- Alerts ---------- */
.alert-error{
  background:var(--problem-surface); color:var(--problem);
  border:1px solid #FECACA; padding:10px 14px; border-radius:4px;
  font-size:0.88rem; margin-bottom:16px;
}
.alert-success{
  background:var(--success-surface); color:var(--success);
  border:1px solid #BBF7D0; padding:10px 14px; border-radius:4px;
  font-size:0.88rem; margin-bottom:16px;
}
