/* Pipeline Dashboard */

.pipeline-page {
  min-height: 100vh;
  padding: 0;
}

.pipeline-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 3rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
.pipeline-nav-brand {
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--fg);
  text-decoration: none;
}
.pipeline-nav-brand span {
  color: var(--accent);
}
.pipeline-nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}
.pipeline-nav-links a {
  font-size: 0.85rem;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.pipeline-nav-links a:hover,
.pipeline-nav-links a.active {
  color: var(--accent);
}

/* Main content */
.pipeline-content {
  padding: 3rem;
  max-width: 1400px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 3rem;
}
.page-title {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--fg);
}
.page-sub {
  font-size: 0.9rem;
  color: var(--fg-muted);
  margin-top: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: all 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: #080810;
}
.btn-primary:hover {
  filter: brightness(1.1);
}
.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Metrics */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 3rem;
}
.metric-card {
  background: var(--bg-card);
  padding: 2rem 2.5rem;
}
.metric-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 0.75rem;
}
.metric-value {
  font-family: var(--font-head);
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--fg);
}
.metric-value.accent { color: var(--accent); }
.metric-sub {
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin-top: 0.5rem;
}

/* Stage funnel */
.stage-funnel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 3rem;
}
.stage-col {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  min-height: 200px;
}
.stage-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.stage-name {
  font-family: var(--font-head);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.stage-badge {
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}
.stage-value {
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-top: 0.25rem;
}
.stage-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 0.5rem;
}
.dot-prospect { background: #6b7280; }
.dot-evaluation { background: #60a5fa; }
.dot-pilot { background: #a78bfa; }
.dot-closed-won { background: #4ade80; }
.dot-closed-lost { background: #f87171; }

/* Deals table */
.deals-section {
  margin-bottom: 3rem;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.section-title {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
  color: var(--fg);
}

.deals-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.deals-table th {
  text-align: left;
  padding: 0.75rem 1.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.deals-table td {
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
  color: var(--fg);
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.deals-table tr:last-child td {
  border-bottom: none;
}
.deals-table tr:hover td {
  background: var(--bg-2);
}

.stage-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}
.pill-prospect { background: rgba(107,114,128,0.2); color: #9ca3af; }
.pill-evaluation { background: rgba(96,165,250,0.15); color: #60a5fa; }
.pill-pilot { background: rgba(167,139,250,0.15); color: #a78bfa; }
.pill-closed-won { background: rgba(74,222,128,0.15); color: #4ade80; }
.pill-closed-lost { background: rgba(248,113,113,0.15); color: #f87171; }

.value-cell {
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--fg);
}

.stalled-badge {
  background: rgba(248,113,113,0.15);
  color: #f87171;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-left: 0.5rem;
}

.next-step-text {
  font-size: 0.8rem;
  color: var(--fg-muted);
  max-width: 200px;
}

.action-btn {
  font-size: 0.75rem;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0;
  font-weight: 600;
}
.action-btn:hover { text-decoration: underline; }

.company-cell {
  font-weight: 600;
  color: var(--fg);
}
.contact-cell {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

/* Deal detail panel (slide-in) */
.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,8,16,0.7);
  z-index: 100;
  display: none;
}
.panel-overlay.open { display: block; }

.deal-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 480px;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  z-index: 101;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.deal-panel.open { transform: translateX(0); }

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.panel-company {
  font-family: var(--font-head);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.panel-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 0.25rem;
}
.panel-close {
  background: none;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 1.5rem;
  padding: 0.25rem;
  line-height: 1;
}
.panel-close:hover { color: var(--fg); }

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}

.panel-section {
  margin-bottom: 2rem;
}
.panel-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 0.75rem;
}

.stage-selector {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.stage-btn {
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg-muted);
  text-transform: capitalize;
  transition: all 0.15s;
}
.stage-btn:hover { border-color: var(--accent); color: var(--accent); }
.stage-btn.active-prospect { border-color: #6b7280; background: rgba(107,114,128,0.15); color: #9ca3af; }
.stage-btn.active-evaluation { border-color: #60a5fa; background: rgba(96,165,250,0.15); color: #60a5fa; }
.stage-btn.active-pilot { border-color: #a78bfa; background: rgba(167,139,250,0.15); color: #a78bfa; }
.stage-btn.active-closed-won { border-color: #4ade80; background: rgba(74,222,128,0.15); color: #4ade80; }
.stage-btn.active-closed-lost { border-color: #f87171; background: rgba(248,113,113,0.15); color: #f87171; }

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--fg-muted); }
.detail-value { color: var(--fg); font-weight: 500; }

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.activity-item {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
}
.activity-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.icon-note { background: var(--accent-dim); color: var(--accent); }
.icon-stage { background: rgba(96,165,250,0.15); color: #60a5fa; }
.activity-body { flex: 1; }
.activity-text { color: var(--fg); line-height: 1.5; }
.activity-time { color: var(--fg-muted); font-size: 0.7rem; margin-top: 0.2rem; }
.stage-change-text { color: var(--accent); font-weight: 600; }

.note-form {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.note-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.875rem;
  color: var(--fg);
  font-size: 0.875rem;
  font-family: var(--font-body);
  resize: none;
  min-height: 40px;
}
.note-input:focus {
  outline: none;
  border-color: var(--accent);
}
.note-input::placeholder { color: var(--fg-muted); }

/* Stalled alert */
.stalled-alert {
  background: rgba(248,113,113,0.08);
  border: 1px solid rgba(248,113,113,0.25);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stalled-alert-icon { color: #f87171; font-size: 1.2rem; }
.stalled-alert-text { flex: 1; }
.stalled-alert-title {
  font-family: var(--font-head);
  font-size: 0.9rem;
  font-weight: 700;
  color: #f87171;
  margin-bottom: 0.2rem;
}
.stalled-alert-sub { font-size: 0.8rem; color: var(--fg-muted); }

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.5rem;
  font-size: 0.875rem;
  color: var(--fg);
  z-index: 200;
  display: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.toast.show { display: block; }
.toast.error { border-color: rgba(248,113,113,0.4); }

/* Responsive */
@media (max-width: 900px) {
  .pipeline-content { padding: 2rem 1.5rem; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .stage-funnel { grid-template-columns: repeat(2, 1fr); }
  .pipeline-nav { padding: 1rem 1.5rem; }
  .pipeline-nav-links { gap: 1rem; }
}

@media (max-width: 600px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .stage-funnel { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; gap: 1rem; }
  .deals-table { font-size: 0.8rem; }
}