/* /features/crm/ only: the body of the hero's live instrument, a miniature of the client
   pipeline board (js/pages/crm.js). Like the real board it is a strip of stage columns that
   scrolls sideways, one card per client. The instrument's shell (stage, board header, activity
   footer) is .site-instrument in css/public-site.css. */

.crm-pipe { --crm-col: 168px; }

.crm-pipe__strip {
    position: relative;   /* columns' offsetLeft is measured from here */
    height: 318px;
    padding-bottom: 6px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--site-line) transparent;
}

/* ---------- Stage columns (colours are the app's STAGE_COLOUR, crm/payloads.py) ---------- */
.crm-col {
    --stage: #ADB5BD;
    flex: 0 0 var(--crm-col);
    min-width: 0;   /* the cards' one-line text must not widen the column */
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    background: #F4F3F7;
}
.crm-col--le { --stage: #667EEA; }
.crm-col--ql { --stage: #10B981; }
.crm-col--pr { --stage: #FA709A; }
.crm-col--ng { --stage: #4FACFE; }
.crm-col--ct { --stage: #FFC107; }
.crm-col--pc { --stage: #8B5CF6; }
.crm-col--cn { --stage: #764BA2; }
.crm-col--ho { --stage: #3B82F6; }
.crm-col--wa { --stage: #6C757D; }
.crm-col--lo { --stage: #DC3545; }

.crm-col__head {
    flex: none;
    padding: 8px 10px 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    border-top: 3px solid var(--stage);
    border-radius: 8px 8px 0 0;
}
.crm-col__title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; color: var(--site-text); }
.crm-col__count {
    flex: none;
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--stage) 16%, transparent);
    color: color-mix(in srgb, var(--stage) 55%, #17141F);
    font-size: 11px;
    font-weight: 600;
    text-align: center;
}
.crm-col__body {
    flex: 1;
    min-height: 0;
    padding: 4px 6px 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    /* No clipping here: a card gliding between stages must stay visible on its way. The strip
       clips; a column with more cards than fit runs off its bottom, as a long one would scroll. */
    border-radius: 0 0 8px 8px;
    transition: background-color .15s ease;
}
.crm-col.is-over .crm-col__body { background: color-mix(in srgb, var(--site-accent) 9%, transparent); }
.crm-col__empty { padding: 18px 4px; font-size: 11.5px; line-height: 1.4; color: var(--site-subtle); text-align: center; }

/* ---------- Client cards (the real card: name, contact and region, when added, budget) ---------- */
.crm-card {
    flex: none;
    padding: 8px 10px;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(23, 20, 31, .08), 0 0 0 1px rgba(23, 20, 31, .05);
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;   /* a sideways drag moves the card; an up-down swipe still scrolls the page */
}
.crm-card__name { font-size: 12.5px; font-weight: 600; line-height: 1.3; color: var(--site-text); }
.crm-card__meta { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--site-muted); }
.crm-card__foot { margin-top: 6px; display: flex; justify-content: space-between; gap: 6px; font-size: 10.5px; color: var(--site-subtle); white-space: nowrap; }
.crm-card__budget { font-weight: 600; color: var(--site-text); }
.crm-card.is-arriving { animation: crm-arrive .45s cubic-bezier(.34, 1.3, .64, 1) backwards; }
@keyframes crm-arrive { from { opacity: 0; transform: translateY(-10px) scale(.96); } }
.crm-card.is-touched { animation: crm-touched 1.1s ease; }
@keyframes crm-touched { from { box-shadow: 0 0 0 2px var(--site-accent); } }
.crm-card.is-source { opacity: .35; }
.crm-card.is-flying { position: relative; z-index: 5; }   /* above the columns it passes over */

/* The card under the pointer while dragging: appended to <body> so the tilting stage doesn't
   carry it, wrapped in .crm-pipe so the card styles above still apply. */
.crm-ghost { position: fixed; z-index: 3000; margin: 0; pointer-events: none; font-family: var(--site-font-body); transform: rotate(2deg); }
.crm-ghost .crm-card { cursor: grabbing; box-shadow: 0 14px 30px -8px rgba(23, 20, 31, .35); }

/* ---------- Narrow: narrower columns; the strip follows the action (crm.js) ---------- */
@media (max-width: 760px) {
    .crm-pipe { --crm-col: 150px; }
}

@media (prefers-reduced-motion: reduce) {
    .crm-col__body { transition: none; }
}
