/* ══════════════════════════════════════════════════════
   NEXT Canada · Relationship Intelligence · Dark Theme
   ══════════════════════════════════════════════════════ */

:root {
  --red:      #e4002b;
  --red-dim:  #9e001e;
  --bg:       #0a0a0a;
  --bg1:      #111111;
  --bg2:      #1a1a1a;
  --bg3:      #222222;
  --border:   #2a2a2a;
  --border2:  #333333;
  --text:     #e8e8e8;
  --text2:    #aaaaaa;
  --text3:    #666666;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; min-height: 100vh; }

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg1); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── Typography ────────────────────────────────────────── */
h1,h2,h3,h4 { font-weight: 600; }
a { color: var(--red); text-decoration: none; }
label { font-size: 12px; color: var(--text2); font-weight: 500; letter-spacing: .3px; display: block; margin-bottom: 4px; }

/* ── Buttons ───────────────────────────────────────────── */
button { cursor: pointer; border: none; font-family: inherit; font-size: 13px; border-radius: 6px; transition: background .15s, opacity .15s; }
.btn-primary { background: var(--red); color: #fff; padding: 8px 16px; font-weight: 600; }
.btn-primary:hover { background: #c8001e; }
.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border2); padding: 7px 14px; }
.btn-ghost:hover { border-color: var(--text3); color: var(--text); }
.btn-sync { background: var(--bg2); color: var(--text2); border: 1px solid var(--border2); padding: 7px 14px; font-weight: 500; }
.btn-sync:hover { border-color: var(--text3); color: var(--text); }
.btn-sync.syncing { opacity: .6; pointer-events: none; }
.sm { padding: 5px 11px !important; font-size: 12px !important; }
.btn-lg { padding: 11px 24px !important; font-size: 15px !important; }
button:disabled { opacity: .4; pointer-events: none; }

/* ── Header ────────────────────────────────────────────── */
header {
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px; height: 52px;
  background: var(--bg1); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.logo { font-size: 18px; font-weight: 800; letter-spacing: -.5px; white-space: nowrap; }
.logo .r { color: var(--red); }
.header-title { flex: 1; text-align: center; font-size: 14px; font-weight: 600; color: #ffffff; white-space: nowrap; }
.header-center { font-size: 12px; color: var(--text3); white-space: nowrap; }

.sync-ok   { color: #22c55e; }
.sync-err  { color: var(--red); }
.sync-busy { color: var(--text3); }

/* ── Error banner ──────────────────────────────────────── */
.error-banner {
  background: #1a0507; border-bottom: 1px solid var(--red-dim);
  color: #fca5a5; padding: 10px 20px; font-size: 13px;
}

/* ── Tabs ──────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 0;
  background: var(--bg1); border-bottom: 1px solid var(--border);
  padding: 0 16px;
  position: sticky; top: 52px; z-index: 99;
}
.tab {
  background: none; color: var(--text3); border: none; border-bottom: 2px solid transparent;
  padding: 13px 18px; font-size: 13px; font-weight: 500; margin-bottom: -1px;
}
.tab:hover { color: var(--text2); }
.tab.active { color: var(--text); border-bottom-color: var(--red); }

/* ── Tab panels ────────────────────────────────────────── */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Filter bar ────────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 20px; background: var(--bg1);
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
  position: sticky; top: 96.5px; z-index: 98;
}
.filter-bar input, .filter-bar select:not(.panel-filter) {
  background: var(--bg2); border: 1px solid var(--border2);
  color: var(--text); border-radius: 6px; padding: 7px 10px;
  font-size: 13px; font-family: inherit;
}
.filter-bar input { width: 220px; }
.filter-bar select:not(.panel-filter) { min-width: 130px; }
.filter-bar input:focus, .filter-bar select:not(.panel-filter):focus { outline: none; border-color: var(--text3); }
.filter-spacer { flex: 1; }

/* ── Company Grid ──────────────────────────────────────── */
#company-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px; padding: 20px;
}
.company-card {
  background: var(--bg1); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px; cursor: pointer;
  transition: border-color .15s, transform .1s;
  display: flex; flex-direction: column; gap: 10px;
}
.company-card:hover { border-color: var(--border2); transform: translateY(-1px); }
.company-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.company-name { font-size: 15px; font-weight: 600; line-height: 1.3; }
.company-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 4px; }
.company-industry { font-size: 11px; color: var(--text3); }
.pill { display: inline-flex; align-items: center; font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 100px; letter-spacing: .3px; }
.pill-status-prospect { background: var(--bg3); color: var(--text3); }
.pill-status-active   { background: #14532d; color: #86efac; }
.pill-status-passed   { background: var(--bg3); color: var(--text3); }
.company-coverage { display: flex; gap: 6px; margin-top: 4px; }
.coverage-box { flex: 1; border-radius: 6px; padding: 6px 8px; text-align: center; font-size: 10px; font-weight: 600; letter-spacing: .3px; }
.coverage-green  { background: #052e16; color: #4ade80; }
.coverage-grey   { background: var(--bg2); color: var(--text3); }

/* ── Empty state ───────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px; padding: 80px 20px;
  text-align: center; color: var(--text3); grid-column: 1 / -1;
}
.empty-state-icon { font-size: 48px; opacity: .3; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text2); }
.empty-state-body  { font-size: 13px; max-width: 380px; line-height: 1.6; }

/* ── Detail screen ─────────────────────────────────────── */
.detail-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; background: var(--bg1); border-bottom: 1px solid var(--border);
  position: sticky; top: 96.5px; z-index: 98;
}
.pf-detail-layout { display: flex; gap: 0; min-height: calc(100vh - 160px); }

.detail-left {
  width: 280px; min-width: 280px; padding: 20px;
  border-right: 1px solid var(--border);
  background: var(--bg1); position: sticky; top: 143.5px;
  align-self: flex-start;
  max-height: calc(100vh - 143.5px);
  overflow-y: auto;
}
.detail-company-name { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.detail-meta-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.detail-field { margin-bottom: 10px; }
.detail-field-label { font-size: 11px; color: var(--text3); font-weight: 500; margin-bottom: 2px; }
.detail-field-value { font-size: 13px; color: var(--text); }
.contacts-list { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.contact-row { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.contact-row-name { font-size: 13px; font-weight: 600; color: var(--text); }
.contact-row-title { font-size: 12px; color: var(--text2); margin-top: 1px; }
.contact-row-links { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; font-size: 12px; }
.contact-row-links a { color: var(--accent, #7c9cff); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.coverage-signal-big {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg2); border-radius: 8px; padding: 6px 12px;
  border: 1px solid var(--border);
}
.coverage-signal-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.cov-dot-green  { background: #22c55e; box-shadow: 0 0 6px #22c55e66; }
.cov-dot-grey   { background: var(--text3); }
.coverage-signal-text { font-size: 12px; color: var(--text2); }
.detail-right { flex: 1; padding: 20px; overflow-y: auto; }
.paths-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.paths-header-left { display: flex; align-items: baseline; gap: 8px; }
.paths-title { font-size: 16px; font-weight: 600; }
.paths-count { font-size: 13px; color: var(--text3); }
.paths-list { display: flex; flex-direction: column; gap: 10px; }

/* ── Path card ─────────────────────────────────────────── */
.path-card {
  background: var(--bg1); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.path-card-top { display: flex; align-items: flex-start; gap: 12px; }
.path-card-main { flex: 1; }
.path-bridge-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.path-bridge-name { font-size: 14px; font-weight: 600; }
.bridge-type-tag { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 100px; letter-spacing: .3px; }
.tag-board   { background: #1e1b4b; color: #c7d2fe; }
.tag-advisor { background: #172554; color: #bfdbfe; }
.tag-mentor  { background: #083344; color: #a5f3fc; }
.tag-donor   { background: #052e16; color: #bbf7d0; }
.tag-alumni  { background: #450a0a; color: #fecaca; }
.tag-named   { background: #2e1065; color: #ddd6fe; }
.path-line { font-size: 13px; color: var(--text); line-height: 1.5; }
.path-why { font-size: 12px; color: var(--text3); font-style: italic; }
.path-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  border-top: 1px solid var(--border); padding-top: 8px;
}
.path-actions select {
  background: var(--bg2); border: 1px solid var(--border2); color: var(--text);
  border-radius: 6px; padding: 5px 8px; font-size: 12px; font-family: inherit;
}
.status-select.status-not-started {
  background: #3b0b10; border-color: #7f1d1d; color: #fca5a5;
}
.status-select.status-reached-out {
  background: #3f2d05; border-color: #854d0e; color: #fde047;
}
.status-select.status-in-contact {
  background: #052e16; border-color: #166534; color: #86efac;
}

/* ══════════════════════════════════════════════════════
   QUALIFIER TAB
   ══════════════════════════════════════════════════════ */
.qualifier-empty {
  display: flex; align-items: center; justify-content: center;
  height: calc(100vh - 130px);
}

/* ══════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════ */
.fgroup { margin-bottom: 12px; }
.fgroup input, .fgroup select, .fgroup textarea {
  width: 100%; background: var(--bg2); border: 1px solid var(--border2);
  color: var(--text); border-radius: 6px; padding: 8px 10px;
  font-size: 13px; font-family: inherit; resize: vertical;
}
.fgroup input:focus, .fgroup select:focus, .fgroup textarea:focus { outline: none; border-color: var(--text3); }
.form-row { display: flex; gap: 12px; }
.form-row .fgroup { margin-bottom: 8px; }
.flex1 { flex: 1; }

/* ══════════════════════════════════════════════════════
   PEOPLE PANEL
   ══════════════════════════════════════════════════════ */
.side-panel { position: fixed; inset: 0; z-index: 200; pointer-events: none; }
.side-panel:not(.hidden) { pointer-events: all; }
.panel-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.panel-body {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 360px; background: var(--bg1); border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.panel-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.panel-title { font-size: 16px; font-weight: 600; }
.panel-hdr-right { display: flex; align-items: center; gap: 8px; }
.panel-search {
  background: var(--bg2); border: none; border-bottom: 1px solid var(--border);
  color: var(--text); padding: 10px 16px; font-size: 13px; font-family: inherit; width: 100%;
}
.panel-search:focus { outline: none; border-bottom-color: var(--text3); }
.panel-filter {
  appearance: none; -webkit-appearance: none;
  background: var(--bg2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center;
  border: 1px solid var(--border2); border-radius: 8px;
  color: var(--text); padding: 10px 34px 10px 14px; font-size: 13px; font-family: inherit;
  cursor: pointer; transition: border-color .15s ease;
}
.panel-filter:hover  { border-color: var(--text3); }
.panel-filter:focus  { outline: none; border-color: var(--red); }
#people-type-filter.panel-filter { margin: 10px 16px; width: calc(100% - 32px); }
.filter-bar .panel-filter { min-width: 160px; }
#people-list { flex: 1; overflow-y: auto; }
.person-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .1s;
}
.person-row:hover { background: var(--bg2); }
.person-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg3); display: flex; align-items: center;
  justify-content: center; font-size: 14px; font-weight: 700;
  color: var(--red); flex-shrink: 0;
}
.person-info { flex: 1; }
.person-name-text { font-size: 13px; font-weight: 600; }
.person-sub { font-size: 11px; color: var(--text3); margin-top: 1px; }
.person-tag { flex-shrink: 0; }

/* ══════════════════════════════════════════════════════
   MODALS
   ══════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.75);
  z-index: 300; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--bg1); border: 1px solid var(--border);
  border-radius: 12px; width: 100%; max-width: 500px;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.modal-wide { max-width: 780px; }
.modal-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  font-size: 16px; font-weight: 600; flex-shrink: 0;
}
.modal-close { background: none; border: none; color: var(--text3); font-size: 18px; padding: 4px 8px; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-ftr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-top: 1px solid var(--border); flex-shrink: 0;
}
.profile-section { margin-bottom: 18px; }
.profile-section-title { font-size: 11px; color: var(--text3); font-weight: 700; letter-spacing: .5px; text-transform: uppercase; margin-bottom: 8px; }
.profile-name-big { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.work-entry { padding: 6px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; }
.work-entry:last-child { border-bottom: none; }
.work-years { font-size: 11px; color: var(--text3); min-width: 90px; }
.work-info { flex: 1; }
.work-company { font-size: 13px; font-weight: 600; }
.work-title { font-size: 12px; color: var(--text2); }

/* ══════════════════════════════════════════════════════
   UTILS
   ══════════════════════════════════════════════════════ */
.hidden { display: none !important; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--bg2); border: 1px solid var(--border2); color: var(--text);
  padding: 10px 20px; border-radius: 8px; font-size: 13px;
  z-index: 400; box-shadow: 0 8px 24px rgba(0,0,0,.5);
  pointer-events: none; opacity: 0; transition: opacity .2s;
}
.toast.show { opacity: 1; pointer-events: all; }
.toast.success { border-color: #15803d; color: #4ade80; }
.toast.error   { border-color: var(--red-dim); color: #fca5a5; }
