/* ── Reset + Base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d0f1a;
  --surface:   #13162a;
  --border:    #1e2240;
  --border2:   #1e293b;
  --text:      #dde2f0;
  --muted:     #64748b;
  --dim:       #4b5563;
  --accent:    #38bdf8;
  --purple:    #a78bfa;
  --purple-d:  #6d28d9;
  --green:     #22c55e;
  --yellow:    #eab308;
  --red:       #ef4444;
  --orange:    #f97316;
  --spark-bg:  #1a3456;
  --spark-fg:  #60a5fa;
  --solar-bg:  #3b2900;
  --solar-fg:  #fcd34d;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Topbar ─────────────────────────────────────────────────────────────────── */
.topbar {
  background: var(--surface);
  border-bottom: 2px solid var(--accent);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 48px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-weight: 700;
  font-size: 15px;
  color: var(--accent);
  white-space: nowrap;
}

.nav-links { display: flex; gap: 4px; flex: 1; }

.nav-link {
  padding: 7px 14px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: all .15s;
  cursor: pointer;
}
.nav-link:hover { color: var(--text); background: var(--border); text-decoration: none; }
.nav-link.active { color: var(--accent); background: var(--border); }

.nav-meta { font-size: 11px; color: var(--dim); white-space: nowrap; }

/* ── Layout ─────────────────────────────────────────────────────────────────── */
main { max-width: 1400px; margin: 0 auto; padding: 16px 24px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.wide { grid-column: 1 / -1; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border2);
}

.card-purple .card-title { color: var(--purple); border-color: var(--purple-d); }
.card-green .card-title { color: var(--green); }

/* ── Section headers inside cards ──────────────────────────────────────────── */
.sub-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--dim);
  letter-spacing: .5px;
  margin: 12px 0 6px;
}
.sub-header:first-child { margin-top: 0; }

/* ── Task lists ─────────────────────────────────────────────────────────────── */
.task-list { list-style: none; }
.task-item {
  padding: 4px 0;
  border-bottom: 1px solid var(--border2);
  color: #c4cde0;
  font-size: 13px;
}
.task-item:last-child { border-bottom: none; }
.task-item.overdue { color: #fca5a5; }
.empty { color: var(--dim); font-style: italic; font-size: 13px; }

/* ── Badges ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 4px;
}
.badge-overdue  { background: #7f1d1d; color: #fca5a5; }
.badge-today    { background: #78350f; color: #fcd34d; }
.badge-new      { background: var(--spark-bg); color: var(--spark-fg); }
.badge-contacted{ background: #3b2900; color: #fcd34d; }
.badge-replied  { background: #14532d; color: #4ade80; }
.badge-meeting  { background: #2d1b69; color: var(--purple); }
.badge-closed   { background: #14532d; color: #4ade80; }
.badge-dead     { background: #1f2937; color: var(--dim); }
.badge-p1       { background: #7f1d1d; color: #fca5a5; }
.badge-p2       { background: #78350f; color: #fcd34d; }
.badge-p3       { background: #14532d; color: #4ade80; }

/* Score badges */
.score-high   { background: #7f1d1d; color: #fca5a5; }
.score-good   { background: #78350f; color: #fcd34d; }
.score-viable { background: #14532d; color: #4ade80; }
.score-low    { background: #1f2937; color: var(--dim); }

/* Ads fire badge */
.ads-badge {
  background: #78350f;
  color: #fcd34d;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
}

/* Org tags */
.tag-spark { background: var(--spark-bg); color: var(--spark-fg); padding: 2px 7px; border-radius: 10px; font-size: 11px; font-weight: 700; }
.tag-solar { background: var(--solar-bg); color: var(--solar-fg); padding: 2px 7px; border-radius: 10px; font-size: 11px; font-weight: 700; }

/* ── Tables ─────────────────────────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--dim);
  padding: 3px 10px 8px 0;
  letter-spacing: .4px;
  white-space: nowrap;
}
.tbl td {
  padding: 6px 10px 6px 0;
  border-bottom: 1px solid var(--border2);
  vertical-align: top;
  font-size: 13px;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: rgba(255,255,255,.02); }
.tbl td.dim { color: #94a3b8; font-size: 12px; }
.tbl td.muted { color: var(--dim); font-size: 12px; }

/* ── Status dot ─────────────────────────────────────────────────────────────── */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.dot-green  { background: var(--green); }
.dot-yellow { background: var(--yellow); }
.dot-red    { background: var(--red); }
.dot-grey   { background: var(--dim); }

/* ── Log ────────────────────────────────────────────────────────────────────── */
.log-entry { padding: 3px 0; border-bottom: 1px solid var(--border2); color: #94a3b8; font-size: 13px; }
.log-time  { font-family: monospace; font-weight: 700; color: var(--accent); margin-right: 8px; display: inline-block; min-width: 36px; }
.log-h1    { font-weight: 700; color: #c4cde0; margin: 10px 0 4px; }
.log-h2    { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--accent); margin: 8px 0 4px; }

/* ── Active Lead Cards ──────────────────────────────────────────────────────── */
.lead-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }

.lead-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}
.lead-card-name { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.lead-card-sub  { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.lead-card-row  { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; font-size: 12px; }
.lead-card-label{ color: var(--dim); }
.lead-card-val  { color: #c4cde0; text-align: right; max-width: 200px; }
.lead-card-notes{ margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); font-style: italic; }

/* ── Filters ────────────────────────────────────────────────────────────────── */
.filter-bar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.filter-btn {
  padding: 5px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.filter-btn:hover  { border-color: var(--accent); color: var(--text); }
.filter-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(56,189,248,.1); }
.filter-label { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .5px; }

/* Sort controls */
.sort-bar { display: flex; gap: 8px; align-items: center; }
.sort-select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}

/* ── Software Research tab ──────────────────────────────────────────────────── */
.sw-toggle { display: flex; gap: 0; margin-bottom: 16px; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; width: fit-content; }
.sw-btn {
  padding: 7px 20px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.sw-btn.active { background: var(--border); color: var(--text); }
.sw-btn:hover:not(.active) { color: var(--text); background: rgba(255,255,255,.04); }

/* Detectability badges */
.det-veryhigh { color: #fcd34d; font-weight: 700; }
.det-high     { color: var(--orange); font-weight: 700; }
.det-medhigh  { color: var(--yellow); }
.det-medium   { color: var(--yellow); }
.det-low      { color: #fca5a5; }

.api-yes     { color: var(--green); font-weight: 600; }
.api-no      { color: var(--red); }
.api-gated   { color: var(--yellow); }
.api-limited { color: var(--yellow); }

/* ── Page header ────────────────────────────────────────────────────────────── */
.page-header { margin-bottom: 16px; }
.page-title  { font-size: 20px; font-weight: 700; margin-bottom: 2px; }
.page-sub    { font-size: 13px; color: var(--muted); }

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.footer { text-align: center; padding: 12px 24px 24px; color: var(--border); font-size: 11px; }

/* ── Utilities ──────────────────────────────────────────────────────────────── */
.mt8  { margin-top: 8px; }
.mt14 { margin-top: 14px; }
.mt20 { margin-top: 20px; }
.bold { font-weight: 700; }
.small{ font-size: 12px; }
.mono { font-family: monospace; font-size: 12px; background: var(--border); padding: 1px 5px; border-radius: 3px; }
code  { font-family: monospace; font-size: 12px; background: var(--border); padding: 1px 5px; border-radius: 3px; color: var(--accent); }

/* ── Clickable rows ──────────────────────────────────────────────────────────── */
.clickable-row { cursor: pointer; transition: background 0.1s; }
.clickable-row:hover { background: var(--border) !important; }
.row-selected td { background: rgba(167,139,250,0.08) !important; }
.lead-card { cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.lead-card:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.lead-card-selected { border-color: var(--purple) !important; box-shadow: 0 0 0 1px var(--purple) !important; }
.lead-card-hint { font-size: 11px; color: var(--dim); margin-top: 8px; font-style: italic; }

/* ── Collapsible card titles ─────────────────────────────────────────────────── */
.card-title.collapsible {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}
.card-title.collapsible:hover { color: var(--text); }
.collapse-icon { font-size: 10px; color: var(--dim); flex-shrink: 0; margin-left: 8px; }

/* ── Inline lead detail panel ────────────────────────────────────────────────── */
.detail-panel {
  background: var(--surface);
  border: 1px solid var(--purple);
  border-radius: 8px;
  padding: 20px 24px;
  box-shadow: 0 0 20px rgba(167,139,250,0.12);
}
.detail-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}
.detail-panel-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.detail-panel-sub   { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail-close {
  background: none;
  border: 1px solid var(--border2);
  border-radius: 4px;
  color: var(--muted);
  font-size: 12px;
  padding: 5px 12px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 12px;
}
.detail-close:hover { color: var(--text); border-color: var(--muted); }
.detail-panel-body {
  background: var(--bg);
  border-radius: 6px;
  padding: 14px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
  border-left: 3px solid var(--purple);
}
.detail-panel-body strong { color: var(--accent); }

/* ── Modal ───────────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 10px;
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
}
.modal-close {
  position: absolute; top: 14px; right: 16px;
  background: none; border: none; color: var(--muted);
  font-size: 18px; cursor: pointer; line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-header { margin-bottom: 16px; }
.modal-title  { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.modal-sub    { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.modal-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; margin-bottom: 16px; }
.modal-field  { display: flex; flex-direction: column; gap: 2px; }
.modal-label  { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); }
.modal-notes  { background: var(--bg); border-radius: 6px; padding: 12px; font-size: 13px; color: var(--muted); margin-bottom: 14px; line-height: 1.6; }
.modal-detail { background: var(--bg); border-radius: 6px; padding: 14px; font-size: 13px; color: var(--text); line-height: 1.7; border-left: 3px solid var(--accent); }
.modal-detail strong { color: var(--accent); }

/* ── Bios tab ────────────────────────────────────────────────────────────────── */
.bio-search {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.bio-search:focus { border-color: var(--accent); }
.bio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.bio-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.bio-card:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.bio-card-name    { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.bio-card-company { font-size: 12px; color: var(--accent); margin-bottom: 2px; }
.bio-card-date    { font-size: 11px; color: var(--dim); margin-bottom: 8px; }
.bio-card-who     { font-size: 12px; color: var(--muted); line-height: 1.5; margin-bottom: 8px; }
.bio-card-hint    { font-size: 11px; color: var(--dim); font-style: italic; }
.bio-content      { font-size: 13px; line-height: 1.75; color: var(--text); }
.bio-h1 { font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.bio-h2 { font-size: 15px; font-weight: 700; color: var(--accent); margin: 16px 0 6px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.bio-h3 { font-size: 13px; font-weight: 700; color: var(--purple); margin: 12px 0 4px; }
.bio-content ul { padding-left: 18px; margin: 6px 0; }
.bio-content li  { margin: 3px 0; }
.bio-content code { font-size: 11px; }
.bio-content em { color: var(--muted); }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .grid   { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .wide   { grid-column: 1; }
  main    { padding: 12px 16px; }
  .topbar { padding: 0 16px; gap: 12px; }
  .nav-brand { display: none; }
  .modal-grid { grid-template-columns: 1fr; }
  .bio-grid   { grid-template-columns: 1fr; }
}

/* ── The Hunt (outreach game) ───────────────────────────────────────────────── */
.hunt-err { background:#2a1a1a; color:#fca5a5; border:1px solid var(--red); border-radius:8px; padding:10px 14px; margin:14px 0; font-size:13px; }

.hunt-scoreboard { margin-top:14px; }
.hunt-board-head { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:10px; margin-bottom:14px; }
.hunt-goal { font-size:13px; color:var(--muted); display:flex; align-items:center; gap:8px; }
.hunt-goal strong { color:var(--green); }
.hunt-goal-bar { display:inline-block; width:120px; height:8px; background:var(--border); border-radius:4px; overflow:hidden; }
.hunt-goal-fill { display:block; height:100%; background:var(--green); }

.hunt-players { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:14px; }
.hunt-player { background:var(--bg); border:1px solid var(--border); border-radius:10px; padding:12px 14px; }
.hunt-player-top { display:flex; justify-content:space-between; align-items:baseline; }
.hunt-player-name { font-weight:600; color:var(--text); }
.hunt-player-pts { font-size:22px; font-weight:700; color:var(--accent); }
.hunt-bar { height:6px; background:var(--border); border-radius:3px; overflow:hidden; margin:8px 0; }
.hunt-bar-fill { display:block; height:100%; background:linear-gradient(90deg,var(--purple),var(--accent)); }
.hunt-player-break { font-size:12px; color:var(--muted); }

.hunt-vtabs { display:flex; flex-wrap:wrap; gap:8px; }
.hunt-vtab { background:var(--surface); border:1px solid var(--border); color:var(--muted); border-radius:20px; padding:6px 14px; font-size:13px; cursor:pointer; transition:all .12s; }
.hunt-vtab:hover { border-color:var(--purple-d); color:var(--text); }
.hunt-vtab.active { background:var(--purple-d); border-color:var(--purple-d); color:#fff; }
.hunt-vtab-n { opacity:.7; font-size:11px; margin-left:2px; }

.hunt-acts { display:flex; gap:6px; }
.hunt-act { display:inline-flex; align-items:center; gap:3px; background:var(--bg); border:1px solid var(--border); border-radius:7px; padding:5px 8px; cursor:pointer; font-size:14px; transition:all .12s; }
.hunt-act:hover { border-color:var(--accent); transform:translateY(-1px); }
.hunt-act:active { transform:translateY(0) scale(.95); }
.hunt-act-pts { font-size:10px; color:var(--muted); font-weight:600; }
.hunt-act-closed:hover { border-color:var(--green); }
.hunt-act-meeting:hover { border-color:var(--yellow); }

.hunt-detail-row td { background:var(--bg); padding:0; }
.hunt-detail { padding:16px 18px; border-left:3px solid var(--purple-d); }
