/* ============================================================
   Montar CRM — pipeline board, lead cards, detail panel
   ============================================================ */

.board {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  gap: 12px;
  padding: 14px clamp(0.9rem, 0.4rem + 1.6vw, 1.9rem) 18px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

/* ------------------------------------------------------------ column */
.column {
  flex: 0 0 268px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: var(--radius);
  background: var(--card-2);
  border: 1px solid var(--hair);
  scroll-snap-align: start;
  transition: background var(--duration) var(--ease),
              border-color var(--duration) var(--ease);
}

/* Drop target. Only the border and tint move — no layout property is
   touched, so dragging across seven columns stays on the compositor. */
.column.is-drop-target {
  background: var(--accent-tint);
  border-color: var(--accent);
}

.column-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px 9px;
  border-bottom: 1px solid var(--hair);
}

.column-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex: none;
  background: var(--ink-faint);
}
.column[data-tone="action"]  .column-dot { background: var(--action); }
.column[data-tone="trust"]   .column-dot { background: var(--accent); }
.column[data-tone="gold"]    .column-dot { background: var(--gold); }
.column[data-tone="go"]      .column-dot { background: var(--go); }
.column[data-tone="muted"]   .column-dot { background: var(--hair-2); }

.column-title {
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: -0.005em;
}

.column-count {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink-soft);
  font-size: var(--text-micro);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.column-sum {
  padding: 0 13px 9px;
  font-size: var(--text-micro);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--hair);
}

.column-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  scrollbar-width: thin;
}

.column-empty {
  padding: 18px 8px;
  text-align: center;
  color: var(--ink-faint);
  font-size: var(--text-sm);
}

/* -------------------------------------------------------------- card */
.lead-card {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 12px 10px;
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: var(--radius-sm);
  cursor: grab;
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease),
              border-color var(--duration) var(--ease);
}
.lead-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
  border-color: var(--hair-2);
}
.lead-card:active { cursor: grabbing; }
.lead-card.is-dragging { opacity: 0.4; }

/* A lead that has sat untouched past the config's threshold. The left
   edge is the tell — visible while scanning, not shouting. */
.lead-card.is-stale { border-left: 3px solid var(--action); }

.lead-name {
  display: block;
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-vehicle {
  display: block;
  margin-top: 1px;
  font-size: var(--text-sm);
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 9px;
  font-size: var(--text-micro);
  color: var(--ink-faint);
}

.lead-amount {
  margin-left: auto;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink-soft);
  font-size: var(--text-micro);
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.tag.is-ads { background: var(--accent-tint); color: var(--accent-ink); }

/* -------------------------------------------------------- lead panel */
.panel-scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: color-mix(in oklab, var(--ink) 42%, transparent);
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
}
.panel-scrim.is-open { opacity: 1; }

.panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 41;
  width: min(430px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-left: 1px solid var(--hair);
  box-shadow: var(--shadow);
  translate: 100% 0;
  transition: translate var(--duration) var(--ease);
}
.panel.is-open { translate: 0 0; }

.panel-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 16px 16px 13px;
  border-bottom: 1px solid var(--hair);
}

.panel-head h2 {
  font-size: var(--text-h2);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.panel-head .lead-vehicle { font-size: var(--text-base); }

.panel-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
  scrollbar-width: thin;
}

.panel-section + .panel-section {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--hair);
}

.panel-section h3 {
  font-size: var(--text-micro);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 9px;
}

/* Call and text are the actions that matter on a shop floor, so they
   are full-width targets rather than small links. */
.contact-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.contact-actions .btn { justify-content: center; text-decoration: none; }

.detail-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  font-size: var(--text-sm);
}
.detail-grid dt { color: var(--ink-faint); }
.detail-grid dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

.money-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.note-quote {
  /* Customers write in paragraphs, and the colour picker joins its
     chips to the typed message with a blank line. Collapsing that
     turns two thoughts into one run-on sentence. */
  white-space: pre-wrap;
  padding: 11px 13px;
  background: var(--paper);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--hair-2);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------- timeline */
.timeline { list-style: none; margin: 0; padding: 0; }

.timeline li {
  position: relative;
  padding: 0 0 14px 18px;
  font-size: var(--text-sm);
}
.timeline li::before {
  content: "";
  position: absolute;
  left: 0; top: 6px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--hair-2);
}
.timeline li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 3px; top: 15px; bottom: 2px;
  width: 1px;
  background: var(--hair);
}
.timeline .event-when {
  display: block;
  font-size: var(--text-micro);
  color: var(--ink-faint);
  margin-top: 1px;
}

.panel-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--hair);
  display: flex;
  gap: 8px;
}
.panel-foot .btn-primary { flex: 1 1 auto; justify-content: center; }

@media (max-width: 560px) {
  .board { gap: 10px; padding-inline: 0.9rem; }
  .column { flex-basis: 84vw; }
  .contact-actions { grid-template-columns: 1fr; }
}

.panel-foot-inline { display: flex; justify-content: flex-end; margin-top: 10px; }
