/* CRM: pipeline board, record drawers (HubSpot-style three-part layout), lists, tasks. Colors only through tokens. */
.crm-board,.crm-col,.crm-bar,.crm-filters,.crm-composer,.crm-fileform,.crm-map,.crm-maprow,.crm-ps,.crm-dact,.crm-stage,.crm-cfrow,.crm-ttools,.crm-search,.crm-sel{position:relative}
.crm-drawer [hidden],.crm-composer [hidden],.crm-fileform[hidden]{display:none!important}
.sr{position:absolute!important;top:0;left:0;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.crm-a{color:var(--lake);text-decoration:underline;text-underline-offset:2px}
.crm-link{display:inline-flex;align-items:center;gap:6px;border:0;background:none;padding:2px 0;color:var(--lake);font-weight:600;text-align:left;min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis}
.crm-link:hover{text-decoration:underline}
.crm-click{cursor:pointer;border-radius:8px}
.crm-click:hover{background:var(--sunk)}
.crm-late{color:var(--eye);font-weight:600}
.crm-none{margin:0;font-size:.8125rem}
.ico.sm,.crm-warn .ico,.crm-next .ico{width:14px;height:14px}
.check{position:relative}
.check::before{content:"";position:absolute;inset:-13px}

/* toolbars and filters */
.crm-bar{gap:10px}
.crm-sel{display:inline-flex;min-width:0}
.crm-sel select{min-height:38px;max-width:240px}
.crm-search{display:flex;align-items:center;gap:8px;background:var(--surface);border:1px solid var(--line);border-radius:8px;padding:0 10px;min-height:38px;color:var(--muted);min-width:0;flex:0 1 240px}
.crm-search.grow{flex:1 1 260px}
.crm-search input{border:0;background:none;outline:none;color:var(--ink);flex:1;min-width:0;padding:8px 0}
.crm-search:focus-within{outline:2px solid var(--lake);outline-offset:1px}
.crm-totals{margin-left:auto;font-size:.8125rem}
.crm-filters{display:flex;flex-wrap:wrap;gap:8px;align-items:center;padding:10px}
.crm-pager{margin-top:4px}
.crm-narrow{display:none;padding:4px 12px}

/* board */
.crm-board{grid-auto-columns:minmax(260px,1fr);align-items:start;scroll-snap-type:x proximity;overscroll-behavior-x:contain}
.crm-col{min-height:380px;scroll-snap-align:start;transition:background .15s}
.crm-col.over{background:var(--lake-soft)}
.crm-col.k-won .colh b{color:var(--good)}
.crm-col.k-lost .colh b{color:var(--eye)}
.crm-colt{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.crm-cards{display:flex;flex-direction:column;gap:8px;flex:1}
.crm-drop{border:1.5px dashed var(--line);border-radius:9px;padding:18px 10px;text-align:center;font-size:.7813rem;color:var(--muted)}
.crm-more{font-size:.75rem;text-align:center}
.btn.crm-more{justify-content:center;align-self:stretch;min-height:44px;color:var(--muted)}
.btn.crm-more:hover{color:var(--ink);background:var(--surface)}
.crm-quick input{width:100%;border:1px dashed var(--line);background:transparent;border-radius:8px;padding:8px 10px;color:var(--ink);min-height:40px}
.crm-quick input:focus{border-style:solid;background:var(--surface)}
.crm-deal{position:relative;cursor:pointer;user-select:none;-webkit-user-select:none;transition:border-color .15s,box-shadow .15s}
.crm-deal:focus-visible{outline:2px solid var(--lake);outline-offset:2px}
.crm-deal.closed{opacity:.82}
.crm-deal.crm-dragging{opacity:.35}
.crm-dtop{display:flex;align-items:flex-start;gap:6px}
.crm-dtop .dn{flex:1;min-width:0;overflow-wrap:anywhere;line-height:1.3}
.crm-grip{color:var(--muted);cursor:grab;touch-action:none;display:grid;place-items:center;width:22px;height:22px;margin:-2px 0 0 -4px;border-radius:5px;flex:none}
.crm-grip:hover{background:var(--sunk)}
.crm-owner{flex:none}
.crm-owner .av{width:22px;height:22px}
.crm-dsub{font-size:.7813rem;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.crm-warn{display:inline-flex;align-items:center;gap:5px;font-size:.75rem;font-weight:600;color:var(--amber);background:var(--amber-soft);padding:2px 8px;border-radius:99px;align-self:flex-start}
.crm-next{display:flex;align-items:flex-start;gap:5px;font-size:.7813rem;color:var(--ink);min-width:0}
.crm-next span{overflow-wrap:anywhere}
.crm-next.late{color:var(--eye)}
.crm-dact{display:flex;gap:6px;align-items:center;border-top:1px solid var(--line);padding-top:8px;margin-top:2px}
.crm-mvsel{flex:1;min-width:0;border:1px solid var(--line);border-radius:7px;background:var(--surface);color:var(--ink);padding:4px 6px;font-size:.75rem;min-height:30px}
.btn.crm-won{color:var(--good);border-color:var(--good-soft)}
.crm-ghost{position:fixed;left:0;top:0;z-index:70;pointer-events:none;box-shadow:var(--shadow);border-color:var(--lake);opacity:.95;margin:0}

/* record drawer */
.drawer.crm-drawer{width:min(1180px,100%)}
.crm-rec{display:grid;grid-template-columns:minmax(220px,280px) minmax(0,1fr) minmax(220px,280px);gap:18px;align-items:start}
.crm-about,.crm-side{display:flex;flex-direction:column;gap:14px;min-width:0}
.crm-mid{display:flex;flex-direction:column;gap:14px;min-width:0}
.crm-hero{display:flex;gap:12px;align-items:center;margin-bottom:12px}
.crm-hn{font-family:var(--f-display);font-weight:700;font-size:1.125rem;line-height:1.2;overflow-wrap:anywhere}
.crm-hs{font-size:.7813rem;margin:2px 0 6px;overflow-wrap:anywhere}
.crm-coicon{width:44px;height:44px;border-radius:10px;background:var(--lake-soft);color:var(--lake);display:grid;place-items:center;flex:none}
.crm-coicon.sm{width:28px;height:28px;border-radius:7px}
.crm-coicon .ico{width:18px;height:18px}
.crm-about .kv{grid-template-columns:96px minmax(0,1fr)}
.crm-side-sec{border:1px solid var(--line);border-radius:var(--r);padding:10px 12px;background:var(--surface)}
.crm-side-sec .row{padding:7px 4px}
.crm-sh{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px}
.crm-sh h2,.crm-sh h3{margin:0}
.crm-fileform{display:flex;flex-direction:column;gap:6px;margin-top:8px}
.crm-composer{padding:10px;display:flex;flex-direction:column;gap:8px}
.crm-composer .chan{align-self:flex-start;flex-wrap:wrap}
.crm-composer .chan button{min-height:32px}
.crm-cform{display:flex;flex-direction:column;gap:8px}
.crm-cform textarea{min-height:70px;resize:vertical}
.crm-crow{display:flex;gap:8px;align-items:flex-end;justify-content:space-between;flex-wrap:wrap}
.crm-taskopts{display:flex;gap:8px;flex-wrap:wrap}
.crm-taskopts label{display:flex;flex-direction:column;font-size:.75rem;font-weight:600;color:var(--muted);gap:3px}
.crm-taskopts .input{padding:6px 8px}
.crm-tlh{margin:4px 0 8px}
.crm-tl{margin-bottom:6px}
.crm-ev .crm-evh{display:flex;align-items:center;gap:8px;min-width:0}
.crm-evt{flex:1;min-width:0;overflow-wrap:anywhere}
.crm-ev.done .crm-evt{text-decoration:line-through;color:var(--muted)}
.crm-evb{margin:4px 0 2px;font-size:.8438rem;overflow-wrap:anywhere}
.crm-evdel{width:28px;height:28px;opacity:.55}
.crm-ev:hover .crm-evdel,.crm-evdel:focus-visible{opacity:1}
.crm-ev.k-system::before,.crm-ev.k-stage::before{border-color:var(--muted)}
.crm-ev.k-task::before{border-color:var(--amber)}
.crm-ev.k-call::before{border-color:var(--good)}

/* opportunity record */
.crm-path{flex:none;list-style:none;display:flex;gap:3px;padding:0;margin:0;overflow-x:auto;scrollbar-width:thin}
.crm-path li{flex:1 0 auto}
.crm-path button{width:100%;border:0;background:var(--sunk);color:var(--muted);font-weight:600;font-size:.7813rem;padding:9px 16px 9px 20px;min-height:38px;white-space:nowrap;clip-path:polygon(0 0,calc(100% - 10px) 0,100% 50%,calc(100% - 10px) 100%,0 100%,10px 50%)}
.crm-path li:first-child button{clip-path:polygon(0 0,calc(100% - 10px) 0,100% 50%,calc(100% - 10px) 100%,0 100%);border-radius:8px 0 0 8px;padding-left:14px}
.crm-path li:last-child button{clip-path:polygon(0 0,100% 0,100% 100%,0 100%,10px 50%);border-radius:0 8px 8px 0}
.crm-path button.past{background:var(--lake-soft);color:var(--lake)}
.crm-path button.cur{background:var(--lake);color:var(--lake-ink)}
.crm-path button[data-mv]:hover{filter:brightness(.96);color:var(--ink)}
.crm-path button.end.won{background:var(--good);color:var(--surface)}
.crm-path button.end.lost{background:var(--eye);color:var(--surface)}
.crm-path button:disabled{cursor:default}
.crm-banner{border-radius:9px;padding:9px 12px;font-size:.8438rem}
.crm-banner.lost{background:var(--eye-soft);color:var(--eye)}
.crm-banner.won{background:var(--good-soft);color:var(--good)}
.crm-big{font-family:var(--f-display);font-size:1.75rem;font-weight:750;letter-spacing:-.02em}
.crm-nextbox{border:1px solid var(--line);border-radius:var(--r);padding:12px;background:var(--sunk)}
.crm-nextbox.warn{border-color:var(--amber);background:var(--amber-soft)}
.crm-ns{font-weight:600;margin:3px 0 2px;overflow-wrap:anywhere}

/* pipeline settings, custom fields, import */
.crm-ps{display:flex;flex-direction:column;gap:14px}
.crm-stages{display:flex;flex-direction:column;gap:8px}
.crm-stage{display:grid;grid-template-columns:auto minmax(0,1.3fr) 76px minmax(0,.8fr) minmax(0,1.4fr) auto;gap:10px;align-items:end;border:1px solid var(--line);border-radius:var(--r);padding:10px;background:var(--surface)}
.crm-ord{display:flex;gap:4px}
.crm-ord .iconbtn:disabled{opacity:.35}
.crm-cf{display:flex;flex-direction:column;gap:8px;margin-bottom:10px}
.crm-cfrow{display:grid;grid-template-columns:minmax(0,1.2fr) minmax(0,1fr) minmax(0,1.4fr) auto;gap:8px;align-items:end}
.crm-imp{display:flex;flex-direction:column;gap:14px}
.crm-steps{list-style:none;display:flex;gap:6px;padding:0;margin:0;counter-reset:s;flex-wrap:wrap}
.crm-steps li{counter-increment:s;font-size:.7813rem;font-weight:600;color:var(--muted);display:flex;align-items:center;gap:6px}
.crm-steps li::before{content:counter(s);width:22px;height:22px;border-radius:50%;display:grid;place-items:center;background:var(--sunk);font-size:.75rem}
.crm-steps li[aria-current]{color:var(--lake)}
.crm-steps li[aria-current]::before{background:var(--lake);color:var(--lake-ink)}
.crm-steps li+li::after{content:none}
.crm-map{display:flex;flex-direction:column;gap:8px;max-height:46vh;max-height:46dvh;overflow:auto}
.crm-maprow{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px;align-items:center;border-bottom:1px solid var(--line);padding-bottom:8px}
.crm-ex{font-size:.75rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.crm-check{display:flex;gap:8px;align-items:center;font-size:.8438rem}
.crm-check input{width:18px;height:18px}
.crm-errs{margin:6px 0 0;padding-left:18px;font-size:.8125rem;max-height:200px;overflow:auto}
.crm-dup{border:1px solid var(--line);border-radius:var(--r);padding:10px 12px;margin-bottom:10px;display:flex;flex-direction:column;gap:4px}
.crm-dup .btn{align-self:flex-start;margin-top:6px}

/* tasks */
.crm-ttools{justify-content:space-between}
.crm-tstack{display:flex;flex-direction:column;gap:14px}
.crm-task .s{display:flex;gap:4px;align-items:center}
.crm-due{font-size:.7813rem;white-space:nowrap}

@media (max-width:1100px){
  .crm-rec{grid-template-columns:minmax(220px,280px) minmax(0,1fr)}
  .crm-side{grid-column:1/-1;display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr))}
}
@media (max-width:860px){
  .crm-rec{grid-template-columns:1fr}
  .crm-side{display:flex}
  .crm-mid{order:2}.crm-side{order:3}
  .crm-wide{display:none}
  .crm-narrow{display:flex}
  .crm-board{grid-auto-columns:minmax(78vw,1fr)}
  .crm-stage{grid-template-columns:1fr 1fr;align-items:end}
  .crm-stage .crm-ord{grid-column:1/-1;order:-1}
  .crm-stage .crm-ev2{grid-column:1/-1}
  .crm-cfrow{grid-template-columns:1fr 1fr}
  .crm-cfrow .field:nth-child(3){grid-column:1/-1}
  .crm-maprow{grid-template-columns:1fr}
  .crm-totals{margin-left:0;width:100%}
  .crm-search{flex:1 1 160px}
  .crm-sel select{max-width:100%}
  .crm-filters .crm-sel{flex:1 1 40%}
  .crm-filters .crm-sel select{width:100%}
  /* Contacts on a phone: Add contact plus a More button; search plus one Filters button that opens the filters. */
  .crm-khead .acts>.btn:not(#kAdd):not(#kMore){display:none}
  .vhead.crm-khead #kMore{display:inline-flex}
  .crm-khead p{display:none}
  .card.crm-filters .crm-kfilt{display:inline-flex;flex:none}
  .crm-filters .crm-search.grow{flex:1 1 160px}
  .crm-filters:not(.open) .crm-sel{display:none}
}
.crm-khead #kMore,.crm-filters .crm-kfilt{display:none}
.crm-kmore{min-width:44px;justify-content:center}
.crm-actlist{gap:8px}
.crm-actlist .btn{justify-content:flex-start;min-height:48px}
@media (pointer:coarse){
  .crm-rec .btn.sm,.crm-dact .btn.sm,.crm-ps .btn.sm,.crm-dup .btn.sm,.crm-side-sec .btn.sm{min-height:44px}
  .crm-mvsel{min-height:44px}
  .crm-grip{width:44px;height:44px;margin:-11px 0 0 -11px}
  .crm-evdel{width:44px;height:44px;opacity:1}
  .crm-side-sec .iconbtn,.crm-ord .iconbtn,.crm-sdel,.crm-cfrow .iconbtn{width:44px;height:44px}
  .crm-composer .chan button{min-height:44px}
}
@media (prefers-reduced-motion:reduce){.crm-col,.crm-deal{transition:none}}

/* Speed: cards scrolled out of view are not laid out or painted until they come near the screen (big boards). */
.crm-deal{content-visibility:auto;contain-intrinsic-size:auto 120px}
