/* ═══════════════════════════════════════════════════════════════
   HIGH 5 CONNECT CRM — V2 Pipeline (Board + List)
   ═══════════════════════════════════════════════════════════════ */

/* ─── Pipeline Header ───────────────────────────────────────── */
.pipeline-header {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  margin-bottom: var(--s4);
}

.pipeline-header-row {
  display: flex;
  align-items: center;
  gap: var(--s3);
  flex-wrap: wrap;
}

.pipeline-view-toggle {
  display: flex;
  background: var(--bg-input);
  border-radius: var(--r-md);
  padding: 2px;
}

.pipeline-view-btn {
  padding: var(--s1) var(--s3);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  transition: all var(--t-fast);
}

.pipeline-view-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}

.pipeline-filters {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-left: auto;
}

.pipeline-filter-select {
  padding: var(--s1) var(--s3);
  font-size: var(--text-xs);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-card);
  color: var(--text-secondary);
  min-height: 32px;
}

/* ─── Board View ────────────────────────────────────────────── */
.pipeline-board {
  display: flex;
  gap: var(--s3);
  overflow-x: auto;
  padding-bottom: var(--s4);
  -webkit-overflow-scrolling: touch;
  min-height: 400px;
}

.pipeline-board::-webkit-scrollbar {
  height: 6px;
}

/* ─── Board Column ──────────────────────────────────────────── */
.board-col {
  flex-shrink: 0;
  width: 260px;
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 160px);
}

@media (min-width: 1025px) {
  .board-col {
    width: 280px;
  }
}

.board-col-header {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  padding: var(--s3);
  border-radius: var(--r-md) var(--r-md) 0 0;
  position: sticky;
  top: 0;
  z-index: var(--z-base);
}

.board-col-header-top {
  display: flex;
  align-items: center;
  gap: var(--s2);
}

.board-col-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--r-full);
  flex-shrink: 0;
}

.board-col-name {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  flex: 1;
}

.board-col-count {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-label);
}

.board-col-value {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
}

.board-col-cards {
  flex: 1;
  overflow-y: auto;
  padding: var(--s2);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  background: var(--bg-page);
  border-radius: 0 0 var(--r-md) var(--r-md);
  border: 1px solid var(--border);
  border-top: none;
  min-height: 60px;
}

.board-col-cards.drag-over {
  background: var(--accent-bg);
  border-color: var(--accent);
}

/* ─── Pipeline Card ─────────────────────────────────────────── */
.pipeline-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: box-shadow var(--t-fast), transform var(--t-fast);
  display: flex;
  overflow: hidden;
}

.pipeline-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--card-accent, var(--border));
}

.pipeline-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

.pipeline-card-accent {
  width: 4px;
  background: var(--card-accent, var(--accent));
  flex-shrink: 0;
  border-radius: var(--r-md) 0 0 var(--r-md);
}

.pipeline-card-inner {
  flex: 1;
  padding: var(--s3);
  min-width: 0;
}

.pipeline-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  margin-bottom: var(--s1);
}

.pipeline-card-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

.pipeline-card-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.pipeline-card-title {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-bottom: var(--s2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pipeline-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
}

.pipeline-card-value {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
}

.pipeline-card-aging {
  font-size: var(--text-xs);
  color: var(--text-label);
  display: flex;
  align-items: center;
  gap: 3px;
}

.pipeline-card-aging.overdue {
  color: var(--red);
  font-weight: 600;
}

.pipeline-card-meta {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-top: var(--s2);
}

.pipeline-card-source {
  font-size: var(--text-xs);
  color: var(--text-label);
}

.pipeline-card-rep {
  font-size: var(--text-xs);
  color: var(--text-label);
  margin-left: auto;
}

.pipeline-card-indicators {
  display: flex;
  align-items: center;
  gap: var(--s1);
  margin-left: auto;
}

.pipeline-card-indicator {
  font-size: 10px;
  color: var(--text-label);
}

/* ─── List View ─────────────────────────────────────────────── */
.pipeline-list {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.pipeline-list-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 100px 80px;
  padding: var(--s3) var(--s4);
  background: var(--bg-input);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-label);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  border-bottom: 1px solid var(--border);
}

.pipeline-list-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 100px 80px;
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--border);
  align-items: center;
  cursor: pointer;
  transition: background var(--t-fast);
}

.pipeline-list-row:hover {
  background: var(--bg-hover);
}

.pipeline-list-row:last-child {
  border-bottom: none;
}

.pipeline-list-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: var(--text-sm);
}

.pipeline-list-sub {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: 2px;
}

.pipeline-list-stage {
  font-size: var(--text-xs);
}

.pipeline-list-value {
  font-weight: 700;
  font-size: var(--text-sm);
}

.pipeline-list-aging {
  font-size: var(--text-xs);
  color: var(--text-label);
  text-align: right;
}

/* Mobile list simplification */
@media (max-width: 640px) {
  .pipeline-list-header {
    display: none;
  }

  .pipeline-list-row {
    display: flex;
    flex-direction: column;
    gap: var(--s1);
    padding: var(--s3) var(--s4);
  }

  .pipeline-list-row > *:not(:first-child) {
    font-size: var(--text-xs);
  }
}

/* ─── Mobile Board: Vertical Scroll ─────────────────────────── */
@media (max-width: 640px) {
  .pipeline-board {
    flex-direction: column;
    overflow-x: visible;
  }

  .board-col {
    width: 100%;
    max-height: none;
  }

  .board-col-cards {
    max-height: 300px;
  }
}

/* ─── Quick Filter Pills ───────────────────────────────────── */
.pipeline-quick-filters {
  display: flex;
  gap: var(--s2);
  overflow-x: auto;
  padding-bottom: var(--s1);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.pipeline-quick-filters::-webkit-scrollbar {
  display: none;
}

.pipeline-quick-filter {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: var(--s1) var(--s3);
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all 150ms ease;
  background: var(--bg-card);
  cursor: pointer;
}

.pipeline-quick-filter:hover {
  background: var(--bg-hover);
  border-color: var(--text-label);
  transform: translateY(-1px);
}

.pipeline-quick-filter.active {
  background: var(--navy-base);
  color: var(--text-inverse);
  border-color: var(--navy-base);
}

.pipeline-quick-filter-count {
  background: rgba(255, 255, 255, 0.2);
  font-size: 10px;
  font-weight: 700;
  padding: 0 4px;
  border-radius: var(--r-full);
  min-width: 16px;
  text-align: center;
}

.pipeline-quick-filter:not(.active) .pipeline-quick-filter-count {
  background: var(--bg-input);
  color: var(--text-label);
}

/* ─── Sort Dropdown ────────────────────────────────────────── */
.pipeline-sort {
  display: flex;
  align-items: center;
  gap: var(--s1);
  font-size: var(--text-xs);
  color: var(--text-label);
}

.pipeline-sort select {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
}

/* ─── Pipeline Card Row (Hero + Content) ───────────────────── */
.pipeline-card-row {
  display: flex;
  gap: var(--s2);
  align-items: flex-start;
}

.pipeline-card-hero {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  object-fit: cover;
  flex-shrink: 0;
}

.pipeline-card-content {
  flex: 1;
  min-width: 0;
}

.pipeline-card-address {
  font-size: 0.7rem;
  color: var(--text-label);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

/* ─── Pipeline Card Tags ───────────────────────────────────── */
.pipeline-card-tags {
  display: flex;
  gap: var(--s1);
  margin-top: var(--s2);
  flex-wrap: wrap;
}

.pipeline-card-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--r-full);
}

/* ─── Pipeline Card Task Count ─────────────────────────────── */
.pipeline-card-tasks {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: var(--text-label);
}

.pipeline-card-tasks.has-overdue {
  color: var(--red);
  font-weight: 600;
}
