:root {
  --navy:       #0d1f3c;
  --navy-mid:   #1a3666;
  --navy-light: #2a4a7f;
  --gold:       #c4a24d;
  --gold-light: #e8d5a0;
  --bg:         #f0f3f8;
  --surface:    #ffffff;
  --border:     #dde2ec;
  --text:       #1a2744;
  --muted:      #6b7a99;
  --danger:     #dc2626;
  --success:    #16a34a;
  --warn:       #d97706;

  --stage-identified:     #6b7a99;
  --stage-screening:      #3b82f6;
  --stage-verified:       #8b5cf6;
  --stage-outreach:       #f59e0b;
  --stage-contacted:      #f97316;
  --stage-conversation:   #10b981;
  --stage-passed:         #ef4444;
  --stage-loi:            #c4a24d;
}

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

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

/* ── SIDEBAR ── */
#sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo .logo-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.05em;
}
.sidebar-logo .logo-sub {
  font-size: 10px;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-section {
  padding: 12px 0 4px;
}
.sidebar-section-label {
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  padding: 0 20px;
  margin-bottom: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  font-size: 13.5px;
  user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-item.active {
  background: rgba(196,162,77,0.12);
  color: var(--gold);
  border-left-color: var(--gold);
}
.nav-item svg { opacity: 0.75; flex-shrink: 0; }
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 20px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 11px;
  color: rgba(255,255,255,0.3);
}

/* ── MAIN CONTENT ── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.page-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
}
.page-header .spacer { flex: 1; }

.page-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary   { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-primary:hover { background: var(--navy-mid); }
.btn-gold      { background: var(--gold); color: var(--navy); border-color: var(--gold); }
.btn-gold:hover { background: #b8973e; }
.btn-outline   { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-danger    { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

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

/* ── FORM ELEMENTS ── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.form-control {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--navy-light);
  box-shadow: 0 0 0 2px rgba(26,54,102,0.12);
}
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { appearance: none; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

/* ── TAG PILL ── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(13,31,60,0.08);
  color: var(--navy);
}
.tag-gold   { background: rgba(196,162,77,0.15); color: #8a6c1a; }
.tag-green  { background: rgba(22,163,74,0.12); color: #166534; }
.tag-blue   { background: rgba(59,130,246,0.12); color: #1d4ed8; }
.tag-red    { background: rgba(220,38,38,0.1); color: #991b1b; }

/* ── SCORE BADGE ── */
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.score-high   { background: rgba(22,163,74,0.12); color: #166534; }
.score-mid    { background: rgba(245,158,11,0.15); color: #92400e; }
.score-low    { background: rgba(220,38,38,0.1); color: #991b1b; }
.score-none   { background: var(--bg); color: var(--muted); }

/* ── STAGE BADGE ── */
.stage-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* ── PIPELINE KANBAN ── */
#pipeline-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: flex-start;
  height: 100%;
}

.pipeline-col {
  min-width: 240px;
  max-width: 240px;
  background: #e8ecf3;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 130px);
}
.pipeline-col-header {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 8px 8px 0 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--surface);
  flex-shrink: 0;
}
.pipeline-col-header .col-count {
  margin-left: auto;
  background: rgba(255,255,255,0.25);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
}
.pipeline-col-body {
  padding: 8px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.pipeline-col-body.drag-over {
  background: rgba(196,162,77,0.1);
  border-radius: 0 0 8px 8px;
}

.pipeline-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 11px 12px;
  cursor: pointer;
  transition: all 0.12s;
  draggable: true;
}
.pipeline-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); transform: translateY(-1px); }
.pipeline-card.dragging { opacity: 0.4; }
.pipeline-card-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pipeline-card-meta {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}
.pipeline-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 6px;
}

/* ── COMPANY LIST TABLE ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 9px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.data-table th:hover { color: var(--navy); }
.data-table th.sorted { color: var(--navy); }
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  background: var(--surface);
}
.data-table tr:hover td { background: #f7f9fc; }
.data-table tr:last-child td { border-bottom: none; }
.data-table .company-name-link {
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  text-decoration: none;
}
.data-table .company-name-link:hover { color: var(--gold); text-decoration: underline; }

/* ── FILTERS BAR ── */
.filters-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filters-bar .filter-select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.filters-bar .search-input {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: 13px;
  color: var(--text);
  min-width: 220px;
}
.filters-bar .search-input:focus {
  outline: none;
  border-color: var(--navy-light);
  box-shadow: 0 0 0 2px rgba(26,54,102,0.1);
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border-radius: 10px;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal.modal-lg { max-width: 960px; }
.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.modal-title { font-size: 17px; font-weight: 700; color: var(--navy); }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.btn-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
}
.btn-close:hover { background: var(--bg); color: var(--text); }

/* ── DETAIL TABS ── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  gap: 0;
  margin-bottom: 20px;
}
.tab {
  padding: 9px 18px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.12s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--navy); border-bottom-color: var(--navy); font-weight: 700; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── INFO GRID ── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.info-item {}
.info-item-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 3px;
}
.info-item-value {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

/* ── CHECKLIST ── */
.checklist { display: flex; flex-direction: column; gap: 10px; }
.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
}
.checklist-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--navy);
  cursor: pointer;
}
.checklist-item label {
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
}
.checklist-item.checked { background: rgba(22,163,74,0.05); border-color: rgba(22,163,74,0.3); }
.checklist-item.checked label { color: var(--success); }

/* ── NOTES ── */
.notes-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.note-entry {
  background: #fffdf5;
  border: 1px solid rgba(196,162,77,0.25);
  border-radius: 7px;
  padding: 10px 14px;
}
.note-meta {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.note-text { font-size: 13.5px; }

/* ── ACTIVITY LOG ── */
.activity-list { display: flex; flex-direction: column; gap: 6px; }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--bg);
  font-size: 12.5px;
}
.activity-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--navy-light);
  margin-top: 5px;
  flex-shrink: 0;
}
.activity-item-time { color: var(--muted); font-size: 11px; white-space: nowrap; }

/* ── DASHBOARD ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
}
.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}
.stat-value { font-size: 28px; font-weight: 700; color: var(--navy); }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.stage-bar-chart { margin-bottom: 24px; }
.stage-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 12.5px;
}
.stage-bar-label { min-width: 130px; color: var(--text); }
.stage-bar-track {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.stage-bar-fill { height: 100%; border-radius: 999px; transition: width 0.4s; }
.stage-bar-count { min-width: 24px; text-align: right; color: var(--muted); font-size: 12px; }

/* ── CREDENTIAL STATUS ── */
.cred-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
}
.cred-status.active   { background: rgba(22,163,74,0.1); color: #166534; }
.cred-status.configured { background: rgba(59,130,246,0.1); color: #1e40af; }
.cred-status.error    { background: rgba(220,38,38,0.1); color: #991b1b; }
.cred-status.unconfigured { background: var(--bg); color: var(--muted); }

/* ── IMPORT DROP ZONE ── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--navy-light);
  background: rgba(26,54,102,0.03);
}
.drop-zone-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }
.drop-zone-text { font-size: 15px; color: var(--muted); }
.drop-zone-sub  { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ── TOAST ── */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 18px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  animation: slideIn 0.2s ease;
  max-width: 320px;
}
.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
.toast-info    { background: var(--navy-mid); }
@keyframes slideIn {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-state-icon { font-size: 42px; margin-bottom: 12px; opacity: 0.35; }
.empty-state-title { font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state-text  { font-size: 13.5px; }

/* ── SPINNER ── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── CONTACT CARD ── */
.contact-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  margin-bottom: 8px;
}
.contact-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}
.contact-name  { font-weight: 600; font-size: 13.5px; }
.contact-title { font-size: 12px; color: var(--muted); }
.contact-links { font-size: 12px; margin-top: 3px; }
.contact-links a { color: var(--navy-light); text-decoration: none; margin-right: 10px; }
.contact-links a:hover { text-decoration: underline; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  #sidebar { width: 56px; min-width: 56px; }
  .sidebar-logo, .sidebar-section-label, .nav-item span, .sidebar-footer { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
}

/* ── PAGINATION ── */
.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  justify-content: flex-end;
}
.page-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text);
}
.page-btn:hover { background: var(--bg); }
.page-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
