/* Piko CRM · styles of crm-board.js (drag and drop, board, wall, sortable list), crm-pipeline.js
   (线索 / 商机) and the sales parts of crm-contacts.js and crm-settings.js. Every rule is scoped
   under .crm-root and uses the tokens of crm.css / piko.css; no literal colours. */
.crm-root { --k-meta: max(11px, var(--t-foot)); --kb-min: 272px; }
.crm-root .crm-live { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---- drag and drop ----------------------------------------------------------------------------- */
.crm-root .crm-drag-ghost { position: absolute; left: 0; top: 0; z-index: 30; pointer-events: none; will-change: transform; }
.crm-root .crm-drag-ghost.crm-drag-down { transition: transform .2s var(--m-smooth); }
.crm-root .crm-drag-copy { width: 100%; height: 100%; margin: 0; transform-origin: 50% 40%; transition: transform .28s var(--m-release), box-shadow var(--hover); }
.crm-root .crm-drag-up .crm-drag-copy { transform: rotate(2deg) scale(1.03); box-shadow: 0 0 0 var(--hair) var(--line), var(--shadow-float); }
.crm-root .crm-drag-copy .crm-kcard-more, .crm-root .crm-drag-copy::before { visibility: hidden; }
/* The card left behind is the gap that shows where it will land. */
.crm-root .crm-drag-source, .crm-root .crm-drag-source:hover { background: var(--wash); box-shadow: none; outline: 1.5px dashed var(--tertiary); outline-offset: -1.5px; }
.crm-root .crm-drag-source > * { visibility: hidden; }
.crm-root [data-dragging="true"] :is(.crm-kb-item, .crm-wall-item, .crm-sort-row) { transition: transform var(--layout); }
.crm-root[data-dragging="true"], .crm-root[data-dragging="true"] * { cursor: grabbing !important; -webkit-user-select: none; user-select: none; }
.crm-root [data-lifted="true"] { position: relative; z-index: 1; box-shadow: 0 0 0 2px var(--ink), var(--shadow-float); }

/* ---- board ---------------------------------------------------------------------------------------- */
.crm-root .crm-kb { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.crm-root .crm-kb-track { flex: 1; min-height: 0; display: flex; gap: 12px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  margin: 0 calc(-1 * var(--pad)); padding: 2px var(--pad) max(20px, env(safe-area-inset-bottom)); scroll-padding-inline: var(--pad); }
.crm-root .crm-kb-col { flex: 1 0 var(--kb-min); max-width: 360px; min-width: 0; min-height: 0; display: flex; flex-direction: column; border-radius: 16px; background: var(--wash);
  transition: background-color var(--hover), box-shadow var(--hover); }
/* Won and lost stages are told apart by outline and pictogram, never by colour. */
.crm-root .crm-kb-col[data-type="won"] { box-shadow: inset 0 0 0 1px var(--tertiary); }
.crm-root .crm-kb-col[data-type="lost"] { background: none; outline: 1px dashed var(--tertiary); outline-offset: -1px; }
.crm-root .crm-kb-col[data-type="lost"] .crm-kb-label { color: var(--secondary); }
.crm-root .crm-kb-col[data-drop="true"] { background: var(--elevated); box-shadow: inset 0 0 0 1.5px var(--ink); outline: none; }
.crm-root .crm-kb-head { flex: none; display: flex; align-items: center; gap: 2px; min-height: 54px; padding: 8px 6px 6px 14px; }
.crm-root .crm-kb-heading { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.crm-root .crm-kb-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.crm-root .crm-kb-title .crm-icon { width: 16px; height: 16px; }
.crm-root .crm-kb-label { min-width: 0; font-size: var(--t-headline); font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-root .crm-kb-count { --badge: 20px; --badge-font: var(--k-meta); flex: none; background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--secondary); font-weight: 500; }   /* shape: the shared count badge (crm.css) */
.crm-root .crm-kb-sum { font-size: var(--k-meta); color: var(--secondary); font-variant-numeric: tabular-nums; line-height: 1.3; }
.crm-root .crm-kb-tools { flex: none; display: flex; }
.crm-root .crm-kb-tool { width: 30px; height: 30px; border-radius: 8px; color: var(--secondary); }
.crm-root:not([data-form="desk"]) .crm-kb-tool { width: 44px; height: 44px; border-radius: 12px; }
.crm-root:not([data-form="desk"]) .crm-kb-head { padding-right: 2px; }
.crm-root .crm-kb-body { position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; display: flex; flex-direction: column; padding: 2px 8px 10px; }
.crm-root .crm-kb-list { flex: 1 0 auto; display: flex; flex-direction: column; gap: 8px; min-height: 56px; }
.crm-root .crm-kb-none { position: absolute; left: 8px; right: 8px; top: 2px; padding: 18px 8px; text-align: center; font-size: var(--k-meta); color: var(--tertiary); pointer-events: none; }
.crm-root .crm-kb-col[data-empty="false"] .crm-kb-none, .crm-root .crm-kb-col[data-drop="true"] .crm-kb-none { display: none; }
.crm-root :is(.crm-kb-item, .crm-wall-item) { position: relative; flex: none; min-width: 0; border-radius: 14px; background: var(--surface); box-shadow: 0 0 0 var(--hair) var(--line); cursor: pointer;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; outline: none; transition: box-shadow var(--hover); }
@media (hover: hover) { .crm-root :is(.crm-kb-item, .crm-wall-item):hover { box-shadow: 0 0 0 var(--hair) var(--tertiary), 0 2px 8px color-mix(in srgb, var(--ink) 7%, transparent); } }
.crm-root :is(.crm-kb-item, .crm-wall-item)[aria-current="true"] { box-shadow: 0 0 0 1.5px var(--ink); }
.crm-root :is(.crm-kb-item, .crm-wall-item, .crm-prow, .crm-sort-grip, .crm-fchip, .crm-step, .crm-kb-tab):focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.crm-root .crm-kb-waiting .crm-kb-track { overflow: hidden; animation: crm-pulse 1.4s ease-in-out infinite; }
.crm-root .crm-kb-waiting .crm-kb-head { padding: 8px 14px; }
.crm-root .crm-kb-waiting .crm-kb-body { gap: 8px; overflow: hidden; }
.crm-root .crm-kb-bone { display: flex; flex-direction: column; gap: 10px; padding: 14px 12px; border-radius: 14px; background: var(--surface); box-shadow: 0 0 0 var(--hair) var(--line); }
/* phone: one stage per screen, paged sideways, with the stages as tabs on top */
.crm-root .crm-kb-tabs { display: none; }
.crm-root[data-form="phone"] .crm-kb-tabs { flex: none; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--pad)) 10px; padding: 2px var(--pad); }
/* The tab already names the lane and counts it: the lane head keeps the sum and its tools. */
.crm-root[data-form="phone"] .crm-kb-title { display: none; }
.crm-root[data-form="phone"] .crm-kb-head { min-height: 44px; padding-top: 2px; padding-bottom: 2px; }
.crm-root[data-form="phone"] .crm-kb-head:has(.crm-kb-sum[hidden]):not(:has(.crm-kb-tool)) { display: none; }
.crm-root[data-form="phone"] .crm-kb-head:has(.crm-kb-sum[hidden]):not(:has(.crm-kb-tool)) + .crm-kb-body { padding-top: 10px; }
.crm-root .crm-kb-tabs::-webkit-scrollbar, .crm-root .crm-pipe-chips::-webkit-scrollbar, .crm-root .crm-steps::-webkit-scrollbar, .crm-root .crm-status-row::-webkit-scrollbar { display: none; }
.crm-root .crm-kb-tab { flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; background: var(--elevated);
  color: var(--secondary); font-size: var(--t-sub); font-weight: 500; white-space: nowrap; transition: background-color var(--layout), color var(--layout); }
.crm-root .crm-kb-tab[aria-selected="true"] { background: var(--ink); color: var(--on-ink); font-weight: 600; }
.crm-root .crm-kb-tab-count { font-size: var(--t-cap); font-variant-numeric: tabular-nums; opacity: .7; }
.crm-root[data-form="phone"] .crm-kb-track { scroll-snap-type: x mandatory; }
.crm-root[data-form="phone"] .crm-kb-col { flex: 0 0 100%; max-width: none; scroll-snap-align: start; scroll-snap-stop: always; }
.crm-root[data-form="pad"] { --kb-min: 264px; }

/* the card of a deal or a lead (board and wall) */
.crm-root .crm-kcard { display: flex; flex-direction: column; gap: 8px; min-width: 0; height: 100%; padding: 12px; }
.crm-root .crm-kcard-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.crm-root .crm-kcard-top .crm-badge { background: var(--elevated); }
.crm-root .crm-kcard-names { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.crm-root .crm-kcard-name { font-size: var(--t-body); font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-root .crm-kcard-sub { font-size: var(--k-meta); color: var(--secondary); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-root .crm-kcard-more { flex: none; width: 28px; height: 28px; margin: -2px -6px -2px 0; border-radius: 8px; color: var(--secondary); }
.crm-root:not([data-form="desk"]) .crm-kcard-more { width: 44px; height: 44px; margin: -10px -12px -10px 0; border-radius: 12px; }
@media (hover: hover) { .crm-root[data-form="desk"] .crm-kcard-more { opacity: 0; transition: opacity var(--hover); }
  .crm-root[data-form="desk"] :is(.crm-kb-item, .crm-wall-item):is(:hover, :focus-within) .crm-kcard-more { opacity: 1; } }
.crm-root .crm-kcard .crm-chips { gap: 4px; flex-wrap: nowrap; overflow: hidden; }
.crm-root .crm-kcard .crm-chip, .crm-root .crm-pcell .crm-chip { flex: 0 1 auto; min-width: 0; padding: 3px 8px; font-size: var(--k-meta); }
.crm-root .crm-kcard .crm-chip-text, .crm-root .crm-pcell .crm-chip-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
.crm-root .crm-chip-more { flex: none; color: var(--secondary); }
.crm-root .crm-chip-won { background: var(--ink); color: var(--on-ink); }
.crm-root .crm-chip-lost { background: none; color: var(--secondary); box-shadow: inset 0 0 0 1px var(--tertiary); }
.crm-root .crm-kcard-note { font-size: var(--k-meta); line-height: 1.4; color: var(--secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-root .crm-kcard-foot { display: flex; align-items: center; gap: 8px; min-height: 22px; margin-top: auto; }
.crm-root .crm-kcard-meta { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: var(--k-meta); color: var(--secondary); white-space: nowrap; overflow: hidden; }
.crm-root .crm-kcard-source { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.crm-root .crm-kcard-source span { overflow: hidden; text-overflow: ellipsis; }
.crm-root .crm-kcard-source .crm-icon { width: 14px; height: 14px; color: var(--ink); }
.crm-root .crm-kcard-source + .crm-kcard-when::before { content: "·"; margin-right: 6px; }
.crm-root .crm-kcard-when { flex: none; }
.crm-root .crm-late-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }
.crm-root .crm-kcard-amount { flex: none; font-size: var(--t-body); font-weight: 600; font-variant-numeric: tabular-nums; }
.crm-root .crm-kcard-owner { flex: none; display: inline-flex; }
.crm-root .crm-kcard-owner .crm-who { display: inline-grid; place-items: center; }
.crm-root .crm-kcard-owner .crm-who-none { width: 22px; height: 22px; }
.crm-root .crm-kcard-owner .crm-who-button { position: relative; min-width: 0; min-height: 0; padding: 0; }
.crm-root .crm-kcard-owner .crm-who-button::after { content: ""; position: absolute; inset: -6px; }
.crm-root:not([data-form="desk"]) .crm-kcard-owner .crm-who-button::after { inset: -11px; }
.crm-root .crm-kcard-owner .crm-who-none .crm-icon { width: 13px; height: 13px; }
.crm-root .crm-kcard-owner .crm-badge { width: 22px; height: 22px; font-size: 10px; background: var(--elevated); }
/* a deal was won: the card pulses once and the column's trophy nods */
.crm-root .crm-won-cue { animation: crm-won-pop .6s var(--m-arrival) both; }
.crm-root .crm-won-cue::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 0 0 2px var(--ink); pointer-events: none; animation: crm-won-ring .9s ease-out both; }
.crm-root .crm-won-col .crm-kb-title .crm-icon { animation: crm-won-nod .8s var(--m-arrival) both; }
@keyframes crm-won-pop { 40% { transform: scale(1.035); } }
@keyframes crm-won-ring { from { opacity: .9; } to { opacity: 0; transform: scale(1.07); } }
@keyframes crm-won-nod { 40% { transform: scale(1.5) rotate(-12deg); } }

/* ---- wall -------------------------------------------------------------------------------------------- */
.crm-root .crm-wall-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(var(--wall-min, 264px), 100%), 1fr)); gap: 12px; }
.crm-root .crm-wall-tail { height: 1px; }
.crm-root .crm-wall[data-drag="true"] .crm-wall-item { cursor: grab; }

/* ---- sortable list ------------------------------------------------------------------------------------- */
.crm-root .crm-sort-row { gap: 6px; padding-left: 6px; background: var(--surface); }
.crm-root .crm-sort > .crm-sort-row + .crm-sort-row::before { left: 44px; }
.crm-root .crm-sort-grip { flex: none; width: 32px; height: 36px; display: grid; place-items: center; border-radius: 8px; color: var(--tertiary); cursor: grab; touch-action: none; }
.crm-root:not([data-form="desk"]) .crm-sort-grip { width: 44px; height: 44px; margin-left: -6px; }
.crm-root .crm-sort-grip .crm-icon { width: 18px; height: 18px; }
@media (hover: hover) { .crm-root .crm-sort-grip:hover { color: var(--secondary); background: var(--wash); } }
.crm-root .crm-drag-copy.crm-sort-row { border-radius: 12px; }
.crm-root .crm-drag-copy.crm-sort-row::before, .crm-root .crm-sort-row.crm-drag-source::before { display: none; }
.crm-root .crm-sort-row[data-lifted="true"] { border-radius: 12px; }

/* ---- 线索 / 商机 page ----------------------------------------------------------------------------------- */
.crm-root .crm-pipe { flex: 1; min-width: 0; min-height: 0; display: flex; position: relative; }
.crm-root .crm-pipe > .crm-pane { flex: 1; min-width: 0; }
.crm-root .crm-pipe .crm-lead:not(:empty) { margin-bottom: 14px; }
.crm-root .crm-pipe-stage { gap: 10px; }
/* the board fills the page below the toolbar: its columns scroll, not the page */
.crm-root .crm-scroll.crm-pipe-fill { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 0; }
.crm-root .crm-pipe-fill > .crm-col { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.crm-root .crm-pipe-fill .crm-pipe-stage { flex: 1; min-height: 0; }
.crm-root .crm-pipe-side { flex: none; width: clamp(380px, 36%, 460px); min-height: 0; display: flex; flex-direction: column; border-left: var(--rule); background: var(--canvas); container-type: inline-size;
  animation: crm-side-in var(--enter) both; }
@keyframes crm-side-in { from { opacity: 0; transform: translateX(16px); } }
.crm-root .crm-pipe[data-side="beside"] .crm-pipe-side .crm-back, .crm-root .crm-pipe[data-side="over"] .crm-pipe-close { display: none; }
.crm-root .crm-pipe[data-side="over"] .crm-pipe-side { position: absolute; inset: 0; z-index: 2; width: auto; border-left: 0; animation-name: crm-push; }
.crm-root .crm-pipe[data-side="over"][data-open="true"] > .crm-pane { visibility: hidden; }
.crm-root .crm-pipe-side .crm-head { --pad: 20px; }
.crm-root .crm-pipe-side .crm-head-start { margin-left: -8px; }
.crm-root .crm-pipe[data-side="over"] .crm-pipe-side .crm-head-start { margin-left: calc(var(--toggle-x) - var(--pad)); }
/* toolbar: search · filters · sort and view */
.crm-root .crm-pipe-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; min-width: 0; }
.crm-root .crm-pipe-tools .crm-search { flex: 1 1 200px; max-width: 280px; }
.crm-root .crm-pipe-chips { flex: 1 1 0; display: flex; align-items: center; gap: 6px; min-width: 120px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; }
.crm-root .crm-pipe-end { flex: none; display: flex; align-items: center; gap: 10px; margin-left: auto; }
.crm-root .crm-pipe-sort { display: flex; align-items: center; gap: 4px; color: var(--secondary); }
.crm-root .crm-pipe-sort:empty { display: none; }
.crm-root .crm-pipe-sort > .crm-icon { width: 16px; height: 16px; }
.crm-root .crm-pipe-sort .crm-trigger { background: none; box-shadow: none; padding-left: 4px; }
.crm-root .crm-pipe-switch button { display: grid; place-items: center; min-width: 36px; padding: 0 10px; }
.crm-root .crm-pipe-switch .crm-icon { width: 17px; height: 17px; }
.crm-root:not([data-form="desk"]) .crm-pipe-switch button { min-height: 40px; min-width: 44px; }
.crm-root:not([data-form="desk"]) .crm-pipe-switch .crm-icon { width: 20px; height: 20px; }
/* .crm-fchip itself is in crm.css (shared with contacts and the inbox). */
.crm-root .crm-fchip-clear { background: none; color: var(--secondary); padding: 0 10px 0 8px; }
/* Narrow: search and the view switch share the first row, the filter chips scroll edge to edge on their own row, the sort (list, wall) follows. */
@container col (max-width: 640px) {
  .crm-root .crm-pipe-tools .crm-search { order: 1; flex: 1 1 0; min-width: 0; max-width: none; }
  .crm-root .crm-pipe-end { display: contents; }
  .crm-root .crm-pipe-switch { order: 2; }
  .crm-root .crm-pipe-chips { order: 3; flex: 1 1 100%; margin: -2px calc(-1 * var(--pad)); padding: 2px var(--pad); }
  .crm-root .crm-pipe-sort { order: 4; flex: 1 1 100%; }
}
.crm-root .crm-pipe-total { padding: 0 4px; font-size: var(--k-meta); color: var(--secondary); font-variant-numeric: tabular-nums; }
/* 已筛选 · 清除: a quiet line under the toolbar while filters from the address are on */
.crm-root .crm-pipe-filtered { display: flex; align-items: center; margin: 8px 0 0; padding: 0 4px; font-size: var(--k-meta); color: var(--secondary); }
.crm-root .crm-pipe-filtered[hidden] { display: none; }
.crm-root .crm-pipe-unfilter { padding: 0; border: 0; background: none; font: inherit; color: var(--ink); text-decoration: underline; text-decoration-color: var(--tertiary); text-underline-offset: 3px; cursor: pointer; }
.crm-root:not([data-form="desk"]) .crm-pipe-unfilter { min-height: 44px; }
.crm-root .crm-pipe-unfilter:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
/* the tasks page: the overview's filters as chips under its bar */
.crm-root .crm-task-chips { flex-wrap: wrap; justify-content: center; overflow: visible; margin: 0; }
.crm-root .crm-task-chips[hidden] { display: none; }
/* list view: rows on one column grid */
.crm-root .crm-plist { display: flex; flex-direction: column; gap: 2px; --cols: minmax(0, 2.2fr) minmax(0, 1.7fr) minmax(0, 1.1fr) minmax(0, 1.1fr) 92px minmax(0, 1fr) 84px; }
.crm-root .crm-plist[data-kind="lead"] { --cols: minmax(0, 2.2fr) minmax(0, 1.7fr) minmax(0, 1.1fr) minmax(0, 1.1fr) minmax(0, 1fr) 84px; }
.crm-root .crm-phead, .crm-root .crm-prow { display: grid; grid-template-columns: var(--cols); align-items: center; column-gap: 12px; padding: 0 12px; }
.crm-root .crm-phead { min-height: 28px; font-size: var(--k-meta); color: var(--secondary); }
.crm-root .crm-prow { width: 100%; min-height: var(--row-h); padding-block: 8px; border-radius: var(--row-r); text-align: left; transition: background-color var(--hover), transform .28s var(--m-release); }
.crm-root .crm-prow:active { transform: scale(var(--press)); transition: transform .1s var(--m-smooth); }
@media (hover: hover) { .crm-root .crm-prow:hover { background: var(--wash); } }
.crm-root .crm-prow[aria-current="true"] { background: var(--elevated); box-shadow: inset 0 0 0 1px var(--line); }
.crm-root .crm-pcell { min-width: 0; display: flex; align-items: center; gap: 6px; font-size: var(--t-body); white-space: nowrap; overflow: hidden; }
.crm-root .crm-pcell-main { gap: 12px; }
.crm-root .crm-pcell > .crm-icon { width: 15px; height: 15px; }
.crm-root .crm-pcell-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.crm-root .crm-pcell .crm-chips { flex-wrap: nowrap; gap: 4px; overflow: hidden; }
.crm-root .crm-pcell-num { justify-content: flex-end; font-weight: 500; font-variant-numeric: tabular-nums; }
.crm-root .crm-pcell-quiet { justify-content: flex-end; font-size: var(--k-meta); color: var(--secondary); }
.crm-root .crm-phead .crm-pcell { font-size: inherit; }
.crm-root .crm-prow-stage { display: none; }
@container col (max-width: 860px) {
  .crm-root .crm-plist { --cols: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) 92px 84px; }
  .crm-root .crm-plist[data-kind="lead"] { --cols: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) 84px; }
  .crm-root .crm-pcell[data-col="products"], .crm-root .crm-pcell[data-col="owner"] { display: none; }
}
@container col (max-width: 560px) {
  .crm-root .crm-plist { --cols: minmax(0, 1fr) max-content; }
  .crm-root .crm-plist[data-kind="lead"] { --cols: minmax(0, 1fr); }
  .crm-root .crm-phead, .crm-root .crm-pcell[data-col="source"], .crm-root .crm-pcell[data-col="stage"], .crm-root .crm-pcell[data-col="updated"] { display: none; }
  .crm-root .crm-prow-stage { display: inline; }
  .crm-root .crm-prow-sub:not(:empty)::before { content: " · "; }
}
/* the record: stage stepper, product lines */
.crm-root .crm-steps { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 3px; margin: -3px; }
.crm-root .crm-step { flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: var(--ctl-s); padding: 0 12px; border-radius: 999px; background: var(--elevated);
  color: var(--secondary); font-size: var(--t-sub); font-weight: 500; white-space: nowrap; transition: background-color var(--layout), color var(--layout), transform .28s var(--m-release); }
.crm-root .crm-step:not(:disabled):active { transform: scale(var(--press)); }
.crm-root .crm-step .crm-icon { width: 14px; height: 14px; }
.crm-root .crm-step[data-type="lost"] { background: none; box-shadow: inset 0 0 0 1px var(--tertiary); }
.crm-root .crm-step[aria-checked="true"] { background: var(--ink); color: var(--on-ink); font-weight: 600; box-shadow: none; }
.crm-root .crm-step:disabled { cursor: default; }
.crm-root .crm-step:disabled:not([aria-checked="true"]) { opacity: .55; }
@media (hover: hover) { .crm-root .crm-step:not(:disabled):not([aria-checked="true"]):hover { color: var(--ink); } }
.crm-root .crm-source-value .crm-icon { width: 16px; height: 16px; }
.crm-root .crm-product-qty { flex: none; color: var(--secondary); font-variant-numeric: tabular-nums; }
.crm-root .crm-convert { display: flex; }
.crm-root .crm-convert .crm-btn { flex: 1; }
.crm-root .crm-deal-amount { flex: none; font-weight: 500; font-variant-numeric: tabular-nums; }
.crm-root .crm-deals-note { padding: 0 4px; }
/* forms: two fields a row, the picker, product lines */
.crm-root .crm-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; align-items: start; }
@media (max-width: 359px) { .crm-root .crm-form-grid { grid-template-columns: minmax(0, 1fr); } }
.crm-root .crm-match { margin-top: -8px; color: var(--ink); font-weight: 500; }
.crm-root .crm-combo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.crm-root .crm-combo-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.crm-root .crm-combo-chip { gap: 2px; padding: 3px 4px 3px 10px; font-size: var(--t-sub); }
.crm-root .crm-combo-x { flex: none; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; color: var(--secondary); }
.crm-root:not([data-form="desk"]) .crm-combo-x { width: 32px; height: 32px; }
.crm-root .crm-combo-x .crm-icon { width: 11px; height: 11px; }
@media (hover: hover) { .crm-root .crm-combo-x:hover { background: color-mix(in srgb, var(--ink) 9%, transparent); color: var(--ink); } }
.crm-root .crm-combo-list { display: flex; flex-direction: column; max-height: 212px; overflow-y: auto; overscroll-behavior: contain; padding: 4px; border-radius: 12px; background: var(--canvas); box-shadow: inset 0 0 0 var(--hair) var(--line); }
.crm-root .crm-combo-option { flex: none; display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 10px; border-radius: 8px; text-align: left; font-size: var(--t-body); }
.crm-root:not([data-form="desk"]) .crm-combo-option { min-height: 44px; }
.crm-root .crm-combo-option[aria-selected="true"] { background: var(--elevated); }
@media (hover: hover) { .crm-root .crm-combo-option:hover { background: var(--elevated); } }
.crm-root .crm-combo-option .crm-icon { width: 15px; height: 15px; }
.crm-root .crm-combo-option[data-fresh="true"] { font-weight: 500; }
.crm-root .crm-combo-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-root .crm-combo-sub { flex: none; max-width: 45%; font-size: var(--k-meta); color: var(--secondary); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-root .crm-combo-none { padding: 9px 10px; font-size: var(--t-sub); color: var(--secondary); }
.crm-root .crm-chip-button { min-height: var(--ctl-s); padding: 0 12px; font-size: var(--t-sub); transition: background-color var(--hover); }
@media (hover: hover) { .crm-root .crm-chip-button:hover { background: color-mix(in srgb, var(--ink) 9%, var(--elevated)); } }
.crm-root .crm-lines { display: flex; flex-direction: column; gap: 6px; }
.crm-root .crm-line-row { display: grid; grid-template-columns: minmax(0, 1fr) max-content 56px 84px max-content; align-items: center; gap: 6px; padding-left: 4px; }
.crm-root .crm-line-name { min-width: 0; font-size: var(--t-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-root .crm-line-x { color: var(--secondary); }
.crm-root[data-form] .pk-sheet .crm-line-row .pk-field.crm-field { padding: 0 8px; text-align: right; font-variant-numeric: tabular-nums; }
.crm-root .crm-line-row .pk-iconbtn { color: var(--secondary); }
.crm-root[data-form="desk"] .crm-line-row .pk-iconbtn .crm-icon { width: 13px; height: 13px; }
.crm-root .crm-use-sum { align-self: flex-start; margin-top: -8px; min-height: var(--ctl-s); font-size: var(--t-sub); color: var(--secondary); }

/* ---- contacts: customer status, products, channel ---------------------------------------------------------- */
.crm-root .crm-status-row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-top: 8px; padding: 2px; }
.crm-root .crm-row-end { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.crm-root .crm-status { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 999px; background: var(--elevated); font-size: var(--k-meta); font-weight: 500; line-height: 1.45; white-space: nowrap; }
.crm-root .crm-status .crm-icon { width: 11px; height: 11px; }
.crm-root .crm-status[data-status="won"] { background: var(--ink); color: var(--on-ink); }
.crm-root .crm-status[data-status="lost"] { background: none; color: var(--secondary); box-shadow: inset 0 0 0 1px var(--tertiary); }
.crm-root .crm-row[aria-current="true"] .crm-status[data-status="open"] { background: var(--canvas); }
.crm-root .crm-row-won { font-size: var(--k-meta); color: var(--secondary); font-variant-numeric: tabular-nums; }
.crm-root .crm-minis { display: flex; gap: 4px; min-width: 0; overflow: hidden; }
/* No taller than a line of the row's subtitle: a contact row keeps the shared 56 height on every form. */
.crm-root .crm-mini { flex: 0 1 auto; min-width: 0; display: inline-flex; align-items: center; gap: 3px; padding: 0 7px; border-radius: 999px; font-size: var(--k-meta); line-height: 1.45; color: var(--ink);
  box-shadow: inset 0 0 0 var(--hair) var(--tertiary); white-space: nowrap; overflow: hidden; }
.crm-root .crm-mini span { overflow: hidden; text-overflow: ellipsis; }
.crm-root .crm-mini .crm-icon { flex: none; width: 10px; height: 10px; }
.crm-root .crm-mini[data-kind="bought"] { background: var(--elevated); box-shadow: none; }
.crm-root .crm-row[aria-current="true"] .crm-mini[data-kind="bought"] { background: var(--canvas); }
.crm-root .crm-hero-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.crm-root .crm-exists { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px 10px 14px; border-radius: 14px; background: var(--elevated); font-size: var(--t-sub); }
.crm-root .crm-exists span { flex: 1 1 160px; min-width: 0; }

/* ---- settings: stages, channels, products ------------------------------------------------------------------ */
.crm-root .crm-sales-row .crm-line-text { cursor: default; }
.crm-root .crm-sales-meta { flex: none; display: inline-flex; align-items: center; gap: 4px; color: var(--secondary); font-size: var(--t-sub); font-variant-numeric: tabular-nums; white-space: nowrap; }
.crm-root .crm-sales-meta .crm-icon { width: 14px; height: 14px; }
/* The last control's glyph sits on the row's text edge; two controls touch but never share a target. */
.crm-root .crm-sales-row .pk-iconbtn, .crm-root .crm-sort-row .pk-iconbtn { color: var(--secondary); }
.crm-root .crm-sales-row .pk-iconbtn:last-child, .crm-root .crm-sort-row .pk-iconbtn:last-child { margin-right: -6px; }
.crm-root .crm-sort-row .pk-iconbtn + .pk-iconbtn { margin-left: -6px; }
.crm-root .crm-sales-add { justify-content: flex-start; }
.crm-root .crm-group .crm-sort + .crm-card { margin-top: -2px; }
.crm-root .crm-archived .crm-line-title { color: var(--secondary); text-decoration: line-through; text-decoration-color: var(--tertiary); }
.crm-root .crm-import-pick { align-self: stretch; }

@media (prefers-reduced-motion: reduce) {
  .crm-root .crm-drag-copy, .crm-root .crm-drag-ghost.crm-drag-down, .crm-root [data-dragging="true"] :is(.crm-kb-item, .crm-wall-item, .crm-sort-row), .crm-root .crm-fchip, .crm-root .crm-step, .crm-root .crm-prow { transition: none !important; }
  .crm-root .crm-drag-up .crm-drag-copy { transform: none; }
  .crm-root .crm-won-cue, .crm-root .crm-won-cue::after, .crm-root .crm-won-col .crm-kb-title .crm-icon, .crm-root .crm-pipe-side, .crm-root .crm-kb-waiting .crm-kb-track { animation: none !important; }
  .crm-root .crm-fchip:active, .crm-root .crm-step:active, .crm-root .crm-prow:active { transform: none; }
}
/* the shared assignment control (crm-collab.js) inside a key-value row: on the value's edge, not stretched */
.crm-root .crm-pipe-side .crm-fact-value > .crm-who { align-self: flex-end; }
@container col (max-width: 479px) { .crm-root .crm-pipe-side .crm-fact-value > .crm-who { align-self: flex-start; margin-left: -2px; } }
