/* Sales board. Columns scroll inside the page. List, and a phone board, scroll the document. */

main.sales-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  min-height: 0;
  padding-bottom: 12px;
}

.sales-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

@media (max-width: 720px) {
  html:has(main.sales-main),
  body:has(main.sales-main) {
    height: auto;
    min-height: 100%;
  }
  body:has(main.sales-main) { overflow: visible; }
  .shell:has(main.sales-main) {
    flex: 1 0 auto;
    height: auto;
    min-height: calc(100vh - var(--top));
  }
  main.sales-main { overflow: visible; min-height: auto; }
  .sales-page { flex: 0 0 auto; min-height: auto; overflow: visible; }
}

@media (min-width: 721px) {
  html:has(main.sales-main .sales-list),
  body:has(main.sales-main .sales-list) {
    height: auto;
    min-height: 100%;
  }
  body:has(main.sales-main .sales-list) { overflow: visible; }
  .shell:has(main.sales-main .sales-list) {
    flex: 1 0 auto;
    height: auto;
    min-height: calc(100vh - var(--top));
  }
  main.sales-main:has(.sales-list) { overflow: visible; min-height: auto; }
  .sales-page:has(.sales-list) { flex: 0 0 auto; min-height: auto; overflow: visible; }
}

.sales-lede { margin: 0; max-width: 42rem; color: var(--muted); font-size: 13px; }
.sales-note { margin: 0; color: var(--muted); font-size: 13px; }

.sales-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0;
}
.sales-stats p { margin: 0; color: var(--muted); font-size: 12px; }
.sales-stats b {
  display: block;
  color: var(--ink);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.sales-tools {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.sales-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sales-chip,
.sales-search {
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--ink);
  border-radius: 999px;
}
.sales-chip { padding: 4px 10px; font-size: 12.5px; }
.sales-chip.is-on {
  background: var(--ink);
  color: var(--chip);
  border-color: var(--ink);
}
.sales-search {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 0 10px;
  min-width: 11rem;
  border-radius: 9px;
}
.sales-search svg { width: 14px; height: 14px; color: var(--soft); flex: 0 0 auto; }
.sales-search input {
  width: 100%;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 7px 0;
}

.sales-tabs {
  display: none;
  flex: 0 0 auto;
}

.sales-board-bar {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  gap: 6px;
}
.sales-board-bar button {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  line-height: 1;
}
.sales-board-bar button:disabled {
  color: var(--muted);
  opacity: 0.45;
}
.sales-board-frame {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  min-width: 0;
  min-height: auto;
}
.sales-fade {
  position: absolute;
  top: 0;
  bottom: 8px;
  width: 28px;
  z-index: 2;
  pointer-events: none;
}
.sales-fade-left {
  left: 0;
  background: linear-gradient(to right, var(--paper), transparent);
}
.sales-fade-right {
  right: 0;
  background: linear-gradient(to left, var(--paper), transparent);
}

.sales-board {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  align-items: flex-start;
  flex: 1 1 auto;
  align-self: stretch;
  min-width: 0;
  min-height: 0;
  height: auto;
  padding-bottom: 4px;
}
.sales-board.is-dragging .sales-col.is-dim { opacity: 0.45; }

.sales-col {
  flex: 1 1 0px;
  min-width: 9.5rem;
  display: flex;
  flex-direction: column;
  overflow: visible;
  border-radius: 12px;
  padding: 10px;
  border-top: 3px solid var(--line);
  background: color-mix(in srgb, var(--line) 8%, var(--card));
}
.sales-col > *,
.sales-card,
.sales-card > *,
.sales-col header,
.sales-col header > *,
.sales-meta,
.sales-meta > * { min-width: 0; }
.sales-col[data-stage="lead"] { border-top-color: var(--line); background: color-mix(in srgb, var(--line) 8%, var(--card)); }
.sales-col[data-stage="contacted"] { border-top-color: var(--soft); background: color-mix(in srgb, var(--soft) 8%, var(--card)); }
.sales-col[data-stage="negotiation"] { border-top-color: var(--soon); background: color-mix(in srgb, var(--soon) 8%, var(--card)); }
.sales-col[data-stage="offer_sent"] { border-top-color: var(--mark); background: color-mix(in srgb, var(--mark) 8%, var(--card)); }
.sales-col[data-stage="won"] { border-top-color: var(--free); background: color-mix(in srgb, var(--free) 8%, var(--card)); }
.sales-col[data-stage="lost"] { border-top-color: var(--sold-ink); background: color-mix(in srgb, var(--sold-ink) 8%, var(--card)); }
.sales-col.is-target {
  background: color-mix(in srgb, var(--mark) 10%, var(--card));
  outline: 1.5px dashed var(--mark);
  outline-offset: -3px;
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--mark) 12%, transparent);
}
.sales-col header {
  display: flex;
  flex: 0 0 auto;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.sales-col h2 { margin: 0; font-size: 12.5px; font-weight: 650; letter-spacing: -0.01em; }
.sales-count {
  color: var(--muted);
  background: var(--card);
  border-radius: 999px;
  padding: 0 6px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}
.sales-lane-value {
  margin-left: auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 500;
}

.sales-empty {
  margin: 8px 0 0;
  min-height: 64px;
  border: 1px dashed color-mix(in srgb, var(--soft) 45%, var(--line));
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-size: 12.5px;
}
button.sales-empty { width: 100%; cursor: pointer; }

.sales-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  margin-top: 8px;
  cursor: grab;
}
.sales-card:hover { box-shadow: 0 8px 20px color-mix(in srgb, var(--ink) 12%, transparent); }
.sales-card.is-won { cursor: pointer; }
.sales-card.is-lost { background: var(--table-head); color: var(--soft); }
.sales-card.is-lost .sales-name,
.sales-card.is-lost .sales-about,
.sales-card.is-lost .sales-value { color: var(--soft); }
.sales-card.is-open { box-shadow: inset 0 0 0 1px var(--ink); }
.sales-handle {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 10px;
  height: 14px;
  opacity: 0;
  background-image: radial-gradient(var(--soft) 1.1px, transparent 1.2px);
  background-size: 5px 4.6px;
  background-repeat: repeat;
}
.sales-card:hover .sales-handle { opacity: 1; }
.sales-name {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.sales-badge {
  width: 16px;
  height: 16px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--free);
  color: var(--brand-ink);
  font-size: 10px;
  font-style: normal;
  display: inline-grid;
  place-items: center;
  vertical-align: -3px;
}
.sales-about {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.sales-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 6px 0 0;
  max-width: 100%;
  color: var(--soft);
  font-size: 11.5px;
  line-height: 1.2;
}
.sales-who,
.sales-age,
.sales-faces { flex: 0 0 auto; max-width: 100%; }
.sales-meta svg { width: 12px; height: 12px; flex: 0 0 auto; }
.sales-age,
.sales-faces { display: inline-flex; align-items: center; gap: 3px; }
.sales-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--chip);
  font-size: 9px;
  font-style: normal;
  display: inline-grid;
  place-items: center;
}
.sales-value {
  margin-left: auto;
  max-width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  text-align: right;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
}
.sales-dates {
  margin: 4px 0 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}
.sales-stale {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 0 6px;
  background: var(--sold-bg);
  color: var(--sold-ink);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.45;
  white-space: nowrap;
}

.sales-drop-hint {
  margin: 8px 0 0;
  color: var(--mark);
  font-size: 12px;
  font-weight: 650;
}
.insert-line,
.sales-insert {
  height: 2px;
  margin-top: 8px;
  background: var(--mark);
  border-radius: 1px;
}
.ghost-slot {
  height: 78px;
  margin-top: 8px;
  border: 1px dashed color-mix(in srgb, var(--soft) 45%, var(--line));
  border-radius: 10px;
}
.drag-float {
  position: fixed;
  z-index: 35;
  width: 196px;
  margin: 0;
  pointer-events: none;
  cursor: grabbing;
  transform: rotate(2deg);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--ink) 18%, transparent);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
}
body.is-sales-grab,
body.is-sales-grab * { cursor: grabbing; }

.sales-detail {
  position: fixed;
  z-index: 6;
  top: var(--top);
  right: 0;
  bottom: 0;
  width: 360px;
  max-width: 100%;
  background: var(--card);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 24px color-mix(in srgb, var(--ink) 6%, transparent);
  padding: 16px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--ink) 20%, transparent) transparent;
}
.sales-wash {
  position: fixed;
  top: var(--top);
  left: var(--side);
  right: 0;
  bottom: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--ink) 10%, transparent);
  pointer-events: none;
}
.sales-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.sales-detail h2 { margin: 0; font-size: 16px; letter-spacing: -0.02em; }
.sales-kicker { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.sales-close { border: 0; background: transparent; color: var(--muted); box-shadow: none; }
.sales-steps { display: flex; flex-wrap: wrap; gap: 4px; margin: 12px 0; }
.sales-step {
  border: 0;
  background: transparent;
  color: var(--soft);
  box-shadow: none;
  padding: 4px 0;
  font-size: 12px;
}
.sales-step.is-done { color: var(--ink); }
.sales-step.is-now { color: var(--mark); font-weight: 650; }
.sales-detail label { margin: 10px 0 4px; }
.sales-detail textarea {
  min-height: 2.8rem;
  overflow: hidden;
  resize: none;
}
.sales-client { margin: 0; font-size: 13px; }
.sales-day { position: relative; display: flex; flex-direction: column; gap: 4px; }
.sales-day-face {
  display: block;
  border: 0;
  background: transparent;
  padding: 0;
  min-height: 0;
  color: var(--muted);
  font-size: 12px;
}
.sales-day-input {
  position: static;
  width: 100%;
  height: auto;
  opacity: 1;
  cursor: text;
}
.sales-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sales-reopen { margin-top: 8px; }

.sales-popover {
  position: fixed;
  z-index: 8;
  width: 360px;
  max-width: calc(100vw - 16px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  padding: 12px;
}
.sales-popover h2 { margin: 0 0 8px; font-size: 15px; letter-spacing: -0.02em; }
.sales-popover label { margin: 8px 0 4px; }
.sales-popover textarea { min-height: 2.8rem; overflow: hidden; resize: none; }
.sales-starts { margin: 8px 0 0; color: var(--muted); font-size: 12.5px; }
.client-list { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.client-option,
.client-use {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 8px;
  padding: 6px 8px;
}
.client-option.is-hit { background: var(--chip); }
.client-option mark { background: transparent; font-weight: 700; }
.client-tag {
  color: var(--soft);
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 6px;
}
.client-use { color: var(--ink); font-weight: 650; justify-content: flex-start; }

.sales-scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--ink) 18%, transparent);
}
.sales-dialog {
  width: 340px;
  max-width: calc(100% - 32px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  padding: 16px;
}
.sales-ask { margin: 0; font-size: 14px; line-height: 1.45; }
.sales-dialog-note { margin: 8px 0 0; color: var(--muted); font-size: 12.5px; }

.sales-move {
  position: fixed;
  z-index: 40;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--card);
  border-top: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow-pop);
  padding: 14px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sales-move h2 { margin: 0 0 4px; font-size: 15px; }
.sales-move button { text-align: left; }
.sales-move.is-pop {
  left: auto;
  right: auto;
  bottom: auto;
  width: 220px;
  max-width: calc(100vw - 16px);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
}
.sales-move .sales-note { margin: 4px 0; }

.sales-page > .page-head {
  position: relative;
  padding-right: 9rem;
}
.sales-view {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
}
.sales-view button {
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  border-radius: 0;
  padding: 2px 8px 4px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
}
.sales-view button + button { box-shadow: inset 1px 0 0 var(--line); }
.sales-view button.is-on { font-weight: 650; box-shadow: inset 0 -2px 0 var(--mark); }
.sales-view button + button.is-on {
  box-shadow: inset 1px 0 0 var(--line), inset 0 -2px 0 var(--mark);
}

.sales-list {
  --cols: minmax(0, 1.7fr) 28px minmax(0, 9rem) minmax(0, 4.6rem) minmax(0, 5.4rem) minmax(0, 1fr) minmax(0, 6.4rem) minmax(0, 6.2rem);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  min-width: 0;
}
.sales-list .list-cols {
  gap: 8px;
  padding-left: 12px;
  padding-right: 12px;
}
.sales-section.is-stale { box-shadow: inset 3px 0 0 var(--sold); }
.sales-section-body { min-width: 0; }
.sales-add-row {
  margin: 0;
  min-height: 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  text-align: left;
  padding: 8px 12px;
}

.sales-row {
  display: grid;
  grid-template-columns: var(--cols);
  gap: 8px;
  align-items: center;
  width: 100%;
  margin: 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  padding: 8px 12px;
  text-align: left;
  cursor: pointer;
}
.sales-row.is-open { box-shadow: inset 0 0 0 1px var(--ink); }
.sales-row > * {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sales-row-company { white-space: normal; }
.sales-row-company strong,
.sales-row-quiet {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sales-row-company strong { font-weight: 650; }
.sales-row-quiet { color: var(--muted); font-size: 12px; font-weight: 400; }
.sales-row-avatar { justify-self: center; overflow: visible; }
.sales-row-status {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}
.sales-row-days,
.sales-row-faces,
.sales-row-value,
.sales-row-next {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 500;
}
.sales-row-value { text-align: right; }
.sales-strip {
  display: flex;
  align-items: center;
  overflow: hidden;
}
.sales-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-sizing: border-box;
  flex: 0 0 auto;
}
.sales-dot.is-fill { background: var(--ink); }
.sales-dot.is-now {
  background: transparent;
  border: 1.5px solid var(--mark);
}
.sales-dot.is-later { background: var(--line); }
.sales-dot.is-lost {
  background: transparent;
  border: 1.5px solid var(--sold);
}
.sales-dot-link {
  width: 8px;
  height: 1px;
  background: var(--line);
  flex: 0 0 auto;
}
.sales-move-btn {
  justify-self: end;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  border-radius: 0;
  padding: 2px 0;
  font-size: 12.5px;
  white-space: nowrap;
}

@media (min-width: 721px) {
  .sales-col-body {
    max-height: var(--sales-body-max, calc(100vh - var(--top) - 16rem));
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
  }
}

@media (max-width: 720px) {
  main.sales-main { padding-right: 56px; }
  .sales-lede { display: none; }
  .sales-tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
  }
  .sales-tabs button {
    border: 0;
    background: transparent;
    box-shadow: none;
    color: var(--muted);
    padding: 4px 0;
    white-space: nowrap;
  }
  .sales-tabs button.is-on { color: var(--mark); font-weight: 650; }
  .sales-col {
    flex: 0 0 84%;
    min-width: 84%;
    scroll-snap-align: start;
  }
  .sales-board { scroll-snap-type: x mandatory; }
  .sales-detail { display: none; }
  .sales-search { margin-left: 0; flex: 1 1 100%; }
  .sales-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "company avatar"
      "status move";
  }
  .sales-row-company { grid-area: company; }
  .sales-row-avatar { grid-area: avatar; justify-self: end; }
  .sales-row-status { grid-area: status; }
  .sales-row-move { grid-area: move; justify-self: end; }
  .sales-row-faces,
  .sales-row-value,
  .sales-row-next,
  .sales-strip,
  .sales-row-quiet { display: none; }
}
