﻿.crm-body {
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink-2);
}

.crm-main {
  width: min(1480px, calc(100% - 2rem));
  padding: 2.2rem 0 4rem;
}

.crm-body .brief {
  border: 1px solid var(--line-light);
  box-shadow: none;
}

.crm-gate {
  max-width: 34rem;
}

.crm-gate h1,
#board h1 {
  font-size: clamp(2.4rem, 5vw, 4rem);
}

.crm-head {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: end;
  margin-bottom: 1.2rem;
}

.crm-filter {
  min-width: 14rem;
  margin: 0;
}

.type-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.2rem;
}

.type-counts span,
.pipeline-col header span {
  border: 1px solid var(--line-light);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--muted-light);
}

.crm-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.crm-body .btn-ghost {
  border-color: var(--line-light);
  color: var(--ink-2);
}

.crm-body .btn-ghost:hover {
  border-color: var(--ink-2);
  color: var(--ink-2);
}

.file-btn input {
  display: none;
}

.field-action {
  align-self: end;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(6, minmax(210px, 1fr));
  gap: 0.75rem;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 0.4rem;
}

.pipeline-col {
  min-width: 210px;
  background: #f7f4ee;
  border: 1px solid var(--line-light);
  min-height: 18rem;
}

.pipeline-col header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0.8rem;
  border-top: 4px solid var(--col, var(--amber));
  border-bottom: 1px solid var(--line-light);
}

.pipeline-col header h2 {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.3;
}

.pipeline-col[data-status="New lead"] { --col: #c9852a; }
.pipeline-col[data-status="Contacted"] { --col: #d7a15a; }
.pipeline-col[data-status="Qualified"] { --col: #6f7d6a; }
.pipeline-col[data-status="Negotiation"] { --col: #a15c32; }
.pipeline-col[data-status="Won"] { --col: #3f6b4e; }
.pipeline-col[data-status="Lost"] { --col: #8d4b43; }

.pipeline-col.is-over {
  background: #fffdf8;
  outline: 2px solid var(--amber);
  outline-offset: -2px;
}

.pipeline-stack {
  display: grid;
  gap: 0.65rem;
  padding: 0.75rem;
}

.pipeline-empty {
  margin: 0;
  color: var(--muted-light);
  font-size: 0.92rem;
  font-weight: 300;
}

.lead-card {
  display: grid;
  gap: 0.7rem;
  padding: 0.85rem;
  background: #fffdf8;
  border: 1px solid var(--line-light);
  cursor: grab;
}

.lead-card.is-dragging {
  opacity: 0.45;
}

.lead-card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.2rem;
}

.lead-meta,
.lead-email,
.lead-message {
  color: var(--muted-light);
  font-weight: 300;
}

.lead-meta {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lead-email {
  font-size: 0.92rem;
}

.lead-message {
  margin-top: 0.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lead-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.4rem 0.5rem;
}

.lead-actions select {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
  background: #f7f4ee;
  color: var(--ink-2);
  border: 1px solid rgba(22, 20, 15, 0.18);
  min-height: 2.2rem;
  padding: 0.25rem 0.4rem;
  font: inherit;
}

.lead-actions button {
  background: transparent;
  color: var(--muted-light);
  border: 0;
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

@media (max-width: 900px) {
  .crm-head {
    display: grid;
    grid-template-columns: 1fr;
  }

  .pipeline {
    grid-template-columns: repeat(6, 78vw);
  }
}
