@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root{
  --ink:#0E1420;
  --panel:#161D2E;
  --panel-raised:#1C2438;
  --line:#2A3348;
  --signal:#3DDC84;
  --amber:#F5A623;
  --red:#FF5C5C;
  --blue:#5B8DEF;
  --text:#E8ECF4;
  --muted:#8B94AC;
  --radius:10px;
}

*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  background:var(--ink);
  color:var(--text);
  font-family:'Inter',system-ui,sans-serif;
  font-size:14px;
  line-height:1.5;
}
h1,h2,h3,.brand{ font-family:'Space Grotesk',sans-serif; }
code,.mono,.num{ font-family:'IBM Plex Mono',monospace; }
a{ color:inherit; }

/* ---------- Shell / Nav ---------- */
.shell{ display:flex; min-height:100vh; }
.sidenav{
  width:220px; flex-shrink:0; background:var(--panel);
  border-right:1px solid var(--line); padding:24px 16px; display:flex; flex-direction:column;
}
.brand{
  font-size:18px; font-weight:700; letter-spacing:.02em; margin-bottom:2px;
}
.brand .dot{ color:var(--signal); }
.brand-sub{ font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.12em; margin-bottom:28px; }
.nav-links{ display:flex; flex-direction:column; gap:2px; }
.nav-links a{
  text-decoration:none; color:var(--muted); padding:9px 12px; border-radius:8px;
  font-size:13.5px; font-weight:500; transition:background .12s, color .12s;
}
.nav-links a:hover{ background:var(--panel-raised); color:var(--text); }
.nav-links a.active{ background:rgba(61,220,132,0.12); color:var(--signal); }
.sidenav .spacer{ flex:1; }
.user-chip{
  border-top:1px solid var(--line); padding-top:14px; font-size:12.5px; color:var(--muted);
}
.user-chip .role-badge{
  display:inline-block; margin-top:4px; font-size:10px; text-transform:uppercase; letter-spacing:.08em;
  background:var(--panel-raised); color:var(--signal); padding:2px 7px; border-radius:5px;
}
.logout-btn{
  margin-top:10px; background:none; border:1px solid var(--line); color:var(--muted);
  padding:6px 10px; border-radius:7px; font-size:12px; cursor:pointer; width:100%;
}
.logout-btn:hover{ border-color:var(--red); color:var(--red); }

.main{ flex:1; padding:32px 40px; max-width:1400px; }
.page-head{ display:flex; justify-content:space-between; align-items:flex-end; margin-bottom:24px; flex-wrap:wrap; gap:12px;}
.page-head h1{ font-size:22px; margin:0 0 4px; }
.page-head .sub{ color:var(--muted); font-size:13px; }

/* ---------- Buttons / Forms ---------- */
.btn{
  display:inline-flex; align-items:center; gap:6px; background:var(--signal); color:#08130B;
  border:none; padding:9px 16px; border-radius:8px; font-weight:600; font-size:13px;
  cursor:pointer; text-decoration:none;
}
.btn:hover{ filter:brightness(1.08); }
.btn.secondary{ background:var(--panel-raised); color:var(--text); border:1px solid var(--line); }
.btn.danger{ background:var(--red); color:#2A0808; }
.btn.small{ padding:5px 10px; font-size:12px; }

label{ display:block; font-size:12px; color:var(--muted); margin:14px 0 5px; text-transform:uppercase; letter-spacing:.06em; }
input, select, textarea{
  width:100%; background:var(--ink); border:1px solid var(--line); color:var(--text);
  padding:10px 12px; border-radius:8px; font-family:inherit; font-size:13.5px;
}
input:focus, select:focus, textarea:focus{ outline:2px solid var(--signal); outline-offset:1px; border-color:var(--signal); }
textarea{ resize:vertical; min-height:70px; }
form .row{ display:flex; gap:14px; }
form .row > div{ flex:1; }

.card{ background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); padding:22px; }

/* ---------- Auth ---------- */
.auth-wrap{ min-height:100vh; display:flex; align-items:center; justify-content:center; background:var(--ink); }
.auth-card{ width:360px; }
.auth-card .brand{ font-size:22px; margin-bottom:2px; }
.auth-card .brand-sub{ margin-bottom:26px; }
.error-msg{ background:rgba(255,92,92,0.12); border:1px solid rgba(255,92,92,0.4); color:#FF9E9E; padding:9px 12px; border-radius:8px; font-size:12.5px; margin-top:12px; }

/* ---------- Dashboard stat strip ---------- */
.stat-strip{ display:grid; grid-template-columns:repeat(6,1fr); gap:12px; margin-bottom:28px; }
.stat{
  background:var(--panel); border:1px solid var(--line); border-radius:var(--radius);
  padding:16px; position:relative; overflow:hidden;
}
.stat .n{ font-family:'IBM Plex Mono',monospace; font-size:26px; font-weight:500; }
.stat .l{ font-size:10.5px; color:var(--muted); text-transform:uppercase; letter-spacing:.09em; margin-top:4px; }
.stat.new{ box-shadow:inset 3px 0 0 var(--amber); }
.stat.won{ box-shadow:inset 3px 0 0 var(--signal); }
.stat.lost{ box-shadow:inset 3px 0 0 var(--red); }

.grid-2{ display:grid; grid-template-columns:1.4fr 1fr; gap:20px; align-items:start; }

.source-bar-row{ display:flex; align-items:center; gap:10px; margin-bottom:10px; font-size:12.5px; }
.source-bar-row .lbl{ width:110px; color:var(--muted); text-transform:capitalize; }
.source-bar-track{ flex:1; background:var(--ink); border-radius:5px; height:8px; overflow:hidden; }
.source-bar-fill{ height:100%; background:var(--blue); }
.source-bar-row .cnt{ width:26px; text-align:right; font-family:'IBM Plex Mono',monospace; }

table{ width:100%; border-collapse:collapse; font-size:13px; }
th{ text-align:left; color:var(--muted); font-weight:500; font-size:11px; text-transform:uppercase; letter-spacing:.06em; padding:8px 10px; border-bottom:1px solid var(--line); }
td{ padding:10px; border-bottom:1px solid var(--line); }
tr:last-child td{ border-bottom:none; }
.table-wrap{ overflow-x:auto; }

.badge{ display:inline-block; padding:3px 9px; border-radius:20px; font-size:11px; font-weight:600; text-transform:capitalize; }
.badge.new{ background:rgba(245,166,35,.15); color:var(--amber); }
.badge.contacted{ background:rgba(91,141,239,.15); color:var(--blue); }
.badge.qualified{ background:rgba(91,141,239,.2); color:var(--blue); }
.badge.proposal_sent{ background:rgba(245,166,35,.15); color:var(--amber); }
.badge.won{ background:rgba(61,220,132,.15); color:var(--signal); }
.badge.lost{ background:rgba(255,92,92,.15); color:var(--red); }
.badge.source{ background:var(--panel-raised); color:var(--muted); }

/* ---------- Pipeline board ---------- */
.filters{ display:flex; gap:10px; margin-bottom:20px; flex-wrap:wrap; }
.filters input, .filters select{ width:auto; min-width:160px; }
.board{ display:flex; gap:14px; overflow-x:auto; padding-bottom:12px; }
.col{ background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); width:250px; flex-shrink:0; padding:12px; }
.col-head{ display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; padding:0 2px; }
.col-head .name{ font-size:12px; font-weight:600; text-transform:uppercase; letter-spacing:.06em; }
.col-head .count{ font-family:'IBM Plex Mono',monospace; font-size:12px; color:var(--muted); background:var(--panel-raised); padding:1px 7px; border-radius:10px; }
.lead-card{
  background:var(--panel-raised); border:1px solid var(--line); border-radius:8px; padding:11px;
  margin-bottom:8px; text-decoration:none; color:var(--text); display:block; transition:border-color .12s;
}
.lead-card:hover{ border-color:var(--signal); }
.lead-card .name{ font-weight:600; font-size:13px; margin-bottom:3px; }
.lead-card .meta{ font-size:11px; color:var(--muted); display:flex; justify-content:space-between; align-items:center; }
.signal-bars{ display:flex; gap:2px; align-items:flex-end; height:10px; }
.signal-bars i{ width:3px; background:var(--line); border-radius:1px; display:block; }
.signal-bars i:nth-child(1){ height:4px; } .signal-bars i:nth-child(2){ height:6px; }
.signal-bars i:nth-child(3){ height:8px; } .signal-bars i:nth-child(4){ height:10px; }
.signal-bars.on-1 i:nth-child(1){ background:var(--red); }
.signal-bars.on-2 i:nth-child(-n+2){ background:var(--amber); }
.signal-bars.on-3 i:nth-child(-n+3){ background:var(--blue); }
.signal-bars.on-4 i{ background:var(--signal); }

.empty-col{ color:var(--muted); font-size:11.5px; text-align:center; padding:14px 0; }

/* ---------- Lead detail ---------- */
.detail-head{ display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:20px; }
.detail-head h1{ margin-bottom:6px; }
.field-row{ display:flex; gap:24px; margin-bottom:6px; font-size:13px; color:var(--muted); flex-wrap:wrap; }
.field-row b{ color:var(--text); font-weight:500; }
.status-buttons{ display:flex; gap:6px; flex-wrap:wrap; margin-top:14px; }
.status-buttons button{
  background:var(--panel-raised); border:1px solid var(--line); color:var(--muted);
  padding:6px 12px; border-radius:20px; font-size:11.5px; cursor:pointer; text-transform:capitalize;
}
.status-buttons button.current{ border-color:var(--signal); color:var(--signal); }

.activity-item{ border-left:2px solid var(--line); padding:2px 0 14px 14px; margin-left:4px; position:relative; }
.activity-item::before{ content:''; position:absolute; left:-5px; top:4px; width:8px; height:8px; border-radius:50%; background:var(--signal); }
.activity-item .meta{ font-size:11px; color:var(--muted); margin-bottom:3px; }
.activity-item .content{ font-size:13.5px; white-space:pre-wrap; }
.type-tag{ text-transform:uppercase; letter-spacing:.05em; font-size:9.5px; background:var(--panel-raised); padding:1px 6px; border-radius:4px; margin-right:6px; }

.eyebrow{ font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.1em; margin-bottom:6px; }

@media (max-width: 900px){
  .shell{ flex-direction:column; }
  .sidenav{ width:100%; flex-direction:row; align-items:center; padding:14px 16px; }
  .nav-links{ flex-direction:row; }
  .main{ padding:20px; }
  .stat-strip{ grid-template-columns:repeat(3,1fr); }
  .grid-2{ grid-template-columns:1fr; }
}
