/* ── Pipeline layout ── */
.pipeline {
  max-width: 1200px;
  margin: 0 auto;
  padding: 6rem 2rem 4rem;
}

/* ── Stage funnel bar ── */
.stage-bar {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 2rem;
  background: var(--surface);
}

.stage-bar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0.5rem;
  border-right: 1px solid var(--border);
  transition: background 0.15s;
}

.stage-bar__item:last-child { border-right: none; }

.stage-bar__item:hover { background: var(--bg); }

.stage-bar__label {
  font-family: var(--sans);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.stage-bar__count {
  font-family: var(--serif);
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--fg);
  line-height: 1;
}

/* ── Toolbar ── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--fg-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-right: 0.25rem;
}

.filter-btn {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.35rem 0.85rem;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.03em;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Add button ── */
.btn-add {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.55rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: background 0.15s;
  flex-shrink: 0;
}

.btn-add:hover { background: var(--accent-deep); }

/* ── Table ── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
}

.lead-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.lead-table thead tr {
  border-bottom: 1px solid var(--border);
  background: var(--bg-warm);
}

.lead-table th {
  font-family: var(--sans);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 0.75rem 1rem;
  text-align: left;
  white-space: nowrap;
}

.lead-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--fg);
}

.lead-table tbody tr:last-child td { border-bottom: none; }

.lead-table tbody tr:hover { background: var(--bg); }

.empty-row td { padding: 3rem 1rem; }
.empty-msg {
  text-align: center;
  font-family: var(--serif);
  font-size: 1rem;
  font-style: italic;
  color: var(--fg-muted);
}

.td-company { font-weight: 500; }
.td-type   { color: var(--fg-muted); font-size: 0.8rem; }
.td-date   { color: var(--fg-muted); font-size: 0.8rem; white-space: nowrap; }

.notes-preview {
  display: block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg-muted);
  font-size: 0.8rem;
}

.stage-cell { display: flex; align-items: center; gap: 0.5rem; }

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 2px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ── Actions ── */
.td-actions { white-space: nowrap; }

.btn-edit,
.btn-del {
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.25rem 0.6rem;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.03em;
}

.btn-edit { color: var(--fg-muted); }
.btn-edit:hover { border-color: var(--accent); color: var(--accent); }

.btn-del { color: var(--fg-muted); margin-left: 0.25rem; }
.btn-del:hover { border-color: #a04040; color: #a04040; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 22, 18, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 100%;
  max-width: 520px;
  padding: 2rem;
  box-shadow: 0 8px 32px rgba(26, 22, 18, 0.2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--fg);
}

.modal-close {
  font-family: var(--sans);
  font-size: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fg-muted);
  padding: 0.25rem 0.5rem;
}

.modal-close:hover { color: var(--fg); }

.form-row {
  margin-bottom: 1.25rem;
}

.form-row--2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-row label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 0.4rem;
}

.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  font-family: var(--sans);
  font-size: 0.9rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  color: var(--fg);
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg);
}

.form-row textarea { resize: vertical; min-height: 80px; }

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.btn-cancel {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.6rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-cancel:hover { background: var(--bg-warm); }

.btn-save {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-save:hover { background: var(--accent-deep); }

/* ── Nav section label ── */
.nav__section {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .pipeline { padding: 5rem 1rem 3rem; }
  .stage-bar { flex-wrap: wrap; }
  .stage-bar__item { min-width: 50%; border-bottom: 1px solid var(--border); }
  .form-row--2col { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .filter-group { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 0.5rem; }
  .btn-add { align-self: flex-end; }
}