/* ==========================================
   DEAL PIPELINE — CRM Stylesheet
   ========================================== */

.pipeline-page {
  min-height: 100vh;
  padding: 100px 40px 60px;
  background: var(--bg);
}

/* HEADER */
.pipeline-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto 40px;
}

.pipeline-title-section { flex: 1; }

.pipeline-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 8px;
}

.pipeline-sub {
  font-size: 1rem;
  color: var(--fg-dim);
}

/* ADD DEAL BUTTON */
.btn-add-deal {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--amber);
  color: #000;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 12px 20px;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-add-deal:hover {
  background: #FBBF24;
  transform: translateY(-1px);
}

/* ADD DEAL FORM PANEL */
.add-deal-panel {
  max-width: 1200px;
  margin: 0 auto 32px;
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.add-deal-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.form-row .inp-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.btn-submit {
  background: var(--amber);
  color: #000;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 10px 20px;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-submit:hover { background: #FBBF24; }

.btn-cancel {
  background: transparent;
  color: var(--fg-dim);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-cancel:hover {
  border-color: var(--fg-dim);
  color: var(--fg);
}

/* PIPELINE BOARD */
.pipeline-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

@media (min-width: 1100px) {
  .pipeline-board { grid-template-columns: repeat(6, 1fr); }
}

.column-empty-state {
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.82rem;
  padding: 32px 0;
}

.column-error-state {
  text-align: center;
  color: #F87171;
  font-size: 0.82rem;
  padding: 32px 0;
}

.pipeline-loading {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 0;
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.85rem;
}

/* STAGE COLUMN */
.stage-col {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.stage-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
}

.stage-count {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--amber-dim);
  color: var(--amber);
  padding: 4px 10px;
  border-radius: 100px;
}

/* DEAL LIST */
.deal-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 500px;
  overflow-y: auto;
}

.deal-list:empty::after {
  content: 'No deals yet';
  display: block;
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.82rem;
  padding: 32px 0;
}

/* DEAL CARD */
.deal-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: all 0.2s;
}

.deal-card:hover {
  border-color: var(--amber-border);
}

/* CONTACT CARD */
.contact-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: all 0.2s;
  cursor: pointer;
  outline: none;
}

.contact-card:hover,
.contact-card:focus-visible {
  border-color: var(--amber-border);
}

.contact-card-name {
  padding: 12px 14px 4px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-card-address {
  padding: 0 14px 10px;
  font-size: 0.78rem;
  color: var(--fg-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-card-activity {
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.01);
  gap: 8px;
}

.contact-card-activity-label {
  font-size: 0.68rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.contact-card-activity-time {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--fg);
}

.contact-card-status {
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.01);
}

.deal-card-header {
  padding: 12px 14px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--fg);
  background: rgba(245, 158, 11, 0.08);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deal-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.deal-metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.deal-metric-label {
  font-size: 0.72rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.deal-metric-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
}

.deal-metric-amber {
  color: var(--amber);
}

.deal-card-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.01);
}

/* STAGE BADGE */
.stage-badge {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stage-badge-lead {
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber);
  border: 1px solid var(--amber-border);
}

.stage-badge-qualified {
  background: rgba(168, 85, 247, 0.15);
  color: #A855F7;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.stage-badge-offer_made {
  background: rgba(59, 130, 246, 0.15);
  color: #3B82F6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.stage-badge-under_contract {
  background: rgba(59, 130, 246, 0.15);
  color: #3B82F6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.stage-badge-closed {
  background: rgba(74, 222, 128, 0.15);
  color: #4ADE80;
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.stage-badge-dead {
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg-muted);
  border: 1px solid var(--border);
}

/* DEAL ACTIONS */
.deal-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  color: var(--fg-dim);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  border-color: var(--amber-border);
  color: var(--amber);
  background: var(--amber-dim);
}

/* NOTES PREVIEW */
.deal-notes-preview {
  padding: 8px 14px;
  font-size: 0.72rem;
  color: var(--fg-muted);
  border-top: 1px solid var(--border);
  font-style: italic;
  line-height: 1.4;
}

/* SUMMARY BAR */
.pipeline-summary {
  max-width: 1200px;
  margin: 32px auto 0;
  display: flex;
  gap: 24px;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-label {
  font-size: 0.72rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.summary-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--amber);
}

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  padding: 24px;
  animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.modal-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--fg-dim);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

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

.modal-content .inp-group {
  margin-bottom: 16px;
}

/* ==========================================
   RESPONSIVE — PIPELINE
   ========================================== */
@media (min-width: 1400px) {
  .pipeline-board {
    grid-template-columns: repeat(6, 1fr);
    max-width: 1500px;
  }
}

@media (max-width: 1399px) and (min-width: 900px) {
  .pipeline-board {
    grid-template-columns: repeat(3, 1fr);
    max-width: 1200px;
  }
}

@media (max-width: 899px) {
  .pipeline-board {
    grid-template-columns: repeat(2, 1fr);
  }

  .stage-col {
    max-width: 100%;
  }

  .deal-list {
    max-height: 300px;
  }

  .pipeline-header {
    flex-direction: column;
    gap: 20px;
  }
}

@media (max-width: 640px) {
  .pipeline-board {
    grid-template-columns: 1fr;
  }

  .pipeline-page {
    padding: 88px 20px 40px;
  }
}