/* =====================================================================
   Kanban (kanban.js): the CRM Deals and Leads boards and the transaction
   pipeline's Board view. Every colour is a Money token (money.css), so
   light and dark come with the rest of the agent side.
   ===================================================================== */
.kb-board {
  display: flex; align-items: flex-start; gap: 12px;
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  padding: 2px 2px 14px; margin: 0 -2px;
  scrollbar-width: thin; scrollbar-color: var(--m-line) transparent;
  outline: none;
}
.kb-board::-webkit-scrollbar { height: 10px; }
.kb-board::-webkit-scrollbar-thumb { background: var(--m-line); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
.kb-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* A column is a tinted header panel, clear space, then its cards sitting
   straight on the page (the look of Zoho's kanban). It is as tall as its
   cards, up to the window; past that the cards scroll inside it and the
   header stays put. */
.kb-board { --kb-gap: 16px; --kb-tint: var(--m-accent-soft); --kb-edge: var(--m-accent); }
.kb-col {
  flex: 0 0 300px; width: 300px; display: flex; flex-direction: column;
  max-height: calc(100vh - 210px); min-height: 168px;
  border-radius: 12px;
  transition: background-color .12s ease, box-shadow .12s ease;
}
.kb-col-head {
  position: sticky; top: 0; z-index: 1; flex: 0 0 auto;
  margin: 0 4px var(--kb-gap); padding: 12px 14px 12px;
  background: var(--kb-tint); border-top: 3px solid var(--kb-edge); border-radius: 8px;
}
.kb-col.tone-won { --kb-tint: var(--m-pos-soft); --kb-edge: var(--m-pos); }
.kb-col.tone-lost { --kb-tint: var(--m-surface-2); --kb-edge: var(--m-faint); }
.kb-col.tone-hot { --kb-tint: var(--m-neg-soft); --kb-edge: var(--m-neg); }
.kb-col.tone-warm { --kb-tint: var(--m-warn-soft); --kb-edge: var(--m-warn); }
.kb-col.tone-plain { --kb-tint: var(--m-surface-2); --kb-edge: var(--m-line); }
.kb-col.tone-parked .kb-col-head { border-top-style: dashed; }
.kb-col-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.kb-col-title b { font-size: 13.5px; font-weight: 650; color: var(--m-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .005em; }
.kb-count { flex: 0 0 auto; min-width: 26px; padding: 2px 9px; border-radius: 999px; background: var(--m-surface); border: 1px solid var(--m-line); font-size: 11.5px; font-weight: 650; color: var(--m-ink); text-align: center; font-variant-numeric: tabular-nums; }
.kb-col-sum { margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--m-muted); font-variant-numeric: tabular-nums; }
.kb-col-hint { margin-top: 3px; font-size: 11.5px; color: var(--m-muted); }
.kb-cards {
  flex: 1 1 auto; min-height: 96px; overflow-y: auto; overscroll-behavior-y: contain;
  display: flex; flex-direction: column; gap: var(--kb-gap); padding: 2px 4px 14px;
  scrollbar-width: thin; scrollbar-color: var(--m-line) transparent;
}
.kb-col.is-over { background: var(--m-accent-soft); box-shadow: 0 0 0 1.5px var(--m-accent) inset; }

.kb-empty { display: none; padding: 26px 8px; border: 1px dashed var(--m-line); border-radius: 12px; font-size: 11.5px; color: var(--m-faint); text-align: center; }
.kb-col.is-empty .kb-empty { display: block; }
.kb-board.is-dragging .kb-col.is-over .kb-empty { display: none; }

/* ---- cards ---- */
.kb-card {
  position: relative; flex: 0 0 auto;
  background: #e9ecf1; color: var(--m-ink);
  border: 1px solid #d9dee6; border-radius: 12px; padding: 14px 14px 12px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 2px 8px rgba(16, 24, 40, .05);
  cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
  transition: box-shadow .12s ease, border-color .12s ease, transform .12s ease, opacity .15s ease;
}
.kb-card:hover { border-color: var(--m-line); box-shadow: 0 2px 4px rgba(16, 24, 40, .06), 0 8px 20px rgba(16, 24, 40, .09); }
.money-app[data-theme="dark"] .kb-card { background: var(--m-surface); border-color: var(--m-line); box-shadow: none; }
.money-app[data-theme="dark"] .kb-card:hover { border-color: var(--m-faint); }
.kb-card:focus-visible { outline: 2px solid var(--m-accent); outline-offset: 1px; }
.kb-card a, .kb-card img { -webkit-user-drag: none; }
.kb-card-top { display: flex; align-items: flex-start; gap: 6px; }
.kb-card-title { flex: 1 1 auto; min-width: 0; display: block; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.kb-card-title b { display: block; font-size: 14px; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.kb-card-title em { display: block; margin-top: 2px; font-style: normal; font-size: 12.5px; color: var(--m-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-card-title:hover b, .kb-card-title:focus-visible b { color: var(--m-accent-ink, var(--m-accent)); text-decoration: underline; text-underline-offset: 2px; }
.kb-card-title:focus-visible { outline: none; }
.kb-menu-btn { flex: 0 0 auto; width: 24px; height: 24px; margin: -3px -5px 0 0; display: grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--m-faint); cursor: pointer; }
.kb-menu-btn:hover, .kb-menu-btn[aria-expanded="true"] { background: var(--m-surface-2); color: var(--m-ink); }
.kb-menu-btn:focus-visible { outline: 2px solid var(--m-accent); }
.kb-menu-btn svg { width: 16px; height: 16px; fill: currentColor; }
.kb-amt { margin-top: 7px; font-size: 13.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.kb-line { display: flex; align-items: center; gap: 7px; margin-top: 7px; font-size: 12.5px; color: var(--m-muted); min-width: 0; }
.kb-line svg { flex: 0 0 auto; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.kb-line span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-line a { color: inherit; text-decoration: none; }
.kb-line a:hover { color: var(--m-ink); text-decoration: underline; }
/* Phone and email read in dark blue on the grey card (Eshu, 9/26). */
.kb-line:not(.neg):not(.warn) { color: #1f3f78; font-weight: 500; }
.kb-line:not(.neg):not(.warn) a:hover { color: #142a52; }
.money-app[data-theme="dark"] .kb-line:not(.neg):not(.warn) { color: #8fb3ef; }
.money-app[data-theme="dark"] .kb-line:not(.neg):not(.warn) a:hover { color: #b9d0f6; }
.kb-line.neg { color: var(--m-neg); }
.kb-line.warn { color: var(--m-warn); }
.kb-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
/* The open-task mark at the bottom right of a person card: green when the
   next task is still ahead, red when it is overdue. */
.kb-task { margin-left: auto; width: 28px; height: 28px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 8px; background: var(--m-pos-soft); color: var(--m-pos); cursor: pointer; text-decoration: none; }
.kb-task.neg { background: var(--m-neg-soft); color: var(--m-neg); }
.kb-task svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.kb-task:hover { filter: brightness(.95); }
.kb-task:focus-visible { outline: 2px solid var(--m-accent); outline-offset: 1px; }
.kb-right + .kb-task { margin-left: 6px; }
/* A foot that holds only the mark tucks up beside the card's last line
   instead of taking a row of its own; that line gives it room. */
.kb-foot:has(> .kb-task:only-child) { margin-top: -20px; pointer-events: none; }
.kb-foot:has(> .kb-task:only-child) .kb-task { pointer-events: auto; }
.kb-card:has(.kb-foot > .kb-task:only-child) .kb-line:last-of-type { padding-right: 38px; }
.kb-chip { padding: 1px 7px; border-radius: 999px; background: var(--m-surface-2); border: 1px solid var(--m-line-soft); font-size: 10.5px; font-weight: 600; color: var(--m-muted); letter-spacing: .02em; white-space: nowrap; }
.kb-chip.buyer { background: var(--m-accent-soft); color: var(--m-accent-ink, var(--m-accent)); border-color: transparent; }
.kb-chip.seller { background: var(--m-warn-soft); color: var(--m-warn); border-color: transparent; }
.kb-chip.rental { background: var(--m-pos-soft); color: var(--m-pos); border-color: transparent; }
.kb-chip.neg { background: var(--m-neg-soft); color: var(--m-neg); border-color: transparent; }
.kb-chip.pos { background: var(--m-pos-soft); color: var(--m-pos); border-color: transparent; }
.kb-right { margin-left: auto; font-size: 10.5px; color: var(--m-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.kb-card .kb-acts { display: flex; gap: 6px; margin-top: 10px; }

/* ---- a card in the air ---- */
.kb-card.kb-src { display: none; }
.kb-hole { flex: 0 0 auto; border-radius: 12px; border: 1.5px dashed var(--m-accent); background: var(--m-accent-soft); opacity: .75; }
.kb-ghost {
  position: fixed; z-index: 9000; margin: 0; pointer-events: none; cursor: grabbing;
  box-shadow: 0 14px 34px rgba(16, 24, 40, .22), 0 2px 6px rgba(16, 24, 40, .12);
  border-color: var(--m-accent); will-change: transform; transition: none;
}
.kb-ghost.kb-settling { transition: transform .16s cubic-bezier(.2, .8, .2, 1), box-shadow .16s ease; box-shadow: 0 3px 10px rgba(16, 24, 40, .12); }
body.kb-dragging, body.kb-dragging * { cursor: grabbing !important; user-select: none !important; -webkit-user-select: none !important; }
.kb-board.is-dragging { scroll-behavior: auto; }
.kb-board.is-dragging .kb-card:hover { border-color: var(--m-line-soft); box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 2px 8px rgba(16, 24, 40, .05); }
.kb-card.kb-saving { opacity: .72; }
.kb-card.kb-saved { border-color: var(--m-pos); }
.kb-card.kb-back { border-color: var(--m-neg); animation: kb-shake .3s ease; }
@keyframes kb-shake { 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }

/* ---- the Move menu ---- */
.kb-menu {
  position: fixed; z-index: 9100; width: 232px; max-height: min(420px, calc(100vh - 24px)); display: flex; flex-direction: column; padding: 5px;
  background: var(--m-surface); color: var(--m-ink); border: 1px solid var(--m-line); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, .18);
}
/* With eighteen columns the list is long: it scrolls, the menu does not. */
.kb-menu-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--m-line) transparent; }
.kb-menu-sep { flex: 0 0 auto; height: 1px; margin: 5px 3px; background: var(--m-line-soft); }
.kb-menu-act { flex: 0 0 auto; font-weight: 600; }
.kb-menu-h { flex: 0 0 auto; padding: 5px 8px 4px; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--m-faint); }
.kb-menu-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 7px 8px; border: 0; border-radius: 6px; background: none; font: inherit; font-size: 12.5px; color: inherit; text-align: left; cursor: pointer; }
.kb-menu-item:hover, .kb-menu-item:focus-visible { background: var(--m-surface-2); outline: none; }
.kb-menu-item.here { color: var(--m-faint); cursor: default; }
.kb-menu-item.here:hover { background: none; }
.kb-menu-item em { font-style: normal; font-size: 10.5px; color: var(--m-faint); }

/* ---- the toolbar above a board ---- */
.kb-filters { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.kb-filter { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--m-line); background: var(--m-surface); font: inherit; font-size: 11.5px; color: var(--m-muted); cursor: pointer; }
.kb-filter:hover { color: var(--m-ink); }
.kb-filter.on { background: var(--m-accent); border-color: var(--m-accent); color: #fff; }
.money-app[data-theme="dark"] .kb-filter.on { color: #0d1117; }

/* ---- phone ---- */
@media (max-width: 700px) {
  .kb-board { --kb-gap: 16px; gap: 10px; scroll-snap-type: x proximity; scroll-padding-left: 2px; padding-bottom: 12px; }
  .kb-col { flex-basis: 84vw; width: 84vw; max-width: 330px; max-height: calc(100vh - 250px); scroll-snap-align: start; }
  .kb-menu-btn { width: 32px; height: 32px; margin: -6px -7px 0 0; }
  .kb-menu-item { padding: 10px 8px; font-size: 13.5px; }
  .kb-task { width: 34px; height: 34px; }
  .kb-foot:has(> .kb-task:only-child) { margin-top: -24px; }
  .kb-card:has(.kb-foot > .kb-task:only-child) .kb-line:last-of-type { padding-right: 44px; }
  .kb-board.is-dragging { scroll-snap-type: none; }
}
@media (prefers-reduced-motion: reduce) {
  .kb-card, .kb-col, .kb-ghost.kb-settling { transition: none; }
  .kb-card.kb-back { animation: none; }
}
