/* GerbOps CRM tab (2026-09-26). Loaded by index.html; same tokens as the rest of the page.
   Brand colours are fixed per business, never the state colours: gold = GERBPRINT, burn = GERBALGO,
   light blue = Whop, blurple = the free Discord community. */
:root{
  --gp:#C9A84C; --gp-life-a:#E45FB5; --gp-life-b:#9B5CFF; --gp-found:#C84C4C;
  --ga-a:#FF9A3C; --ga-b:#8A2408; --ga:#E0601F; --wh:#3CC8D8; --dc:#5865F2;
}
#crm .crm-status{font-size:12px;color:var(--faint);margin:-6px 0 14px}
#crm .crm-kpis{margin-bottom:18px;grid-template-columns:repeat(auto-fit,minmax(140px,1fr))}
#crm .tile .val{font-size:24px}

/* toolbar */
.crm-bar{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:0 0 12px}
.crm-bar input[type=search],.crm-bar select,.crm-drawer input,.crm-drawer select,.crm-drawer textarea{
  font:inherit;font-size:13px;padding:7px 10px;border-radius:8px;border:1px solid var(--edge2);
  background:var(--panel);color:var(--ink);min-width:0}
.crm-bar input[type=search]{flex:1 1 240px}
.crm-bar select{flex:0 1 auto;max-width:170px}
.crm-bar label.crm-chk{display:inline-flex;gap:6px;align-items:center;font-size:12.5px;color:var(--soft);
  padding:6px 10px;border:1px solid var(--edge2);border-radius:8px;cursor:pointer;background:var(--panel)}
.crm-btn{font:inherit;font-size:12.5px;padding:7px 12px;border-radius:8px;cursor:pointer;
  border:1px solid var(--edge2);background:var(--panel);color:var(--soft);white-space:nowrap}
.crm-btn:hover{color:var(--ink);border-color:var(--accent)}
.crm-btn[aria-pressed="true"]{background:var(--accent);border-color:var(--accent);color:#fff;font-weight:600}
.crm-btn.primary{background:var(--accent);border-color:var(--accent);color:#fff;font-weight:600}
.crm-btn[disabled]{opacity:.55;cursor:default}
.crm-seg{display:inline-flex;gap:0}
.crm-seg .crm-btn{border-radius:0}
.crm-seg .crm-btn:first-child{border-radius:8px 0 0 8px}
.crm-seg .crm-btn:last-child{border-radius:0 8px 8px 0}
.crm-count{font-size:12px;color:var(--faint);margin:0 0 8px}
.crm-count b{color:var(--soft);font-weight:600}
.crm-btn.crm-inline{padding:2px 8px;font-size:12px;margin-left:4px}

/* business badges */
.bz{display:inline-flex;align-items:center;gap:4px;font-size:10.5px;font-weight:700;letter-spacing:.03em;
  padding:2px 8px;border-radius:100px;color:#fff;white-space:nowrap;line-height:1.5;margin:1px 3px 1px 0}
.bz i{font-style:normal;font-weight:500;opacity:.9}
.bz.gerbprint{background:var(--gp);color:#1b1608}
.bz.gerbprint.life{background:linear-gradient(90deg,var(--gp-life-a),var(--gp-life-b));color:#fff}
.bz.gerbprint.found{background:var(--gp-found);color:#fff}
.bz.gerbalgo{background:linear-gradient(90deg,var(--ga-a),var(--ga-b))}
.bz.whop{background:var(--wh);color:#07262a}
.bz.community{background:var(--dc)}
.bz.other{background:var(--panel2);color:var(--soft);border:1px solid var(--edge2)}
.bz.off{background:transparent!important;color:var(--faint)!important;border:1px dashed var(--edge2)}
.bz.warn{box-shadow:0 0 0 2px var(--warn)}

/* stage pills */
.st{display:inline-block;font-size:10.5px;font-weight:600;padding:2px 8px;border-radius:100px;
  background:var(--panel2);color:var(--soft);white-space:nowrap}
.st.customer,.st.won_back{background:var(--good-bg);color:var(--good)}
.st.at_risk{background:var(--warn-bg);color:var(--warn)}
.st.churned,.st.do_not_contact{background:var(--bad-bg);color:var(--bad)}
.st.win_back_sent,.st.applicant{background:var(--info-bg);color:var(--info)}
.st b{font-weight:800;margin-left:3px}

/* list */
#crm table.crm-list{min-width:0}
#crm table.crm-list td{vertical-align:top}
#crm table.crm-list tbody tr{cursor:pointer}
#crm table.crm-list tbody tr:hover td{background:var(--panel2)}
.crm-name{font-weight:600;white-space:normal}
.crm-sub{display:block;font-size:11.5px;color:var(--faint);font-weight:400;overflow-wrap:anywhere}
.crm-due{font-size:11.5px;color:var(--faint)}
.crm-due.late{color:var(--bad);font-weight:600}
.crm-biz{white-space:normal!important;max-width:320px}
.crm-more{display:flex;justify-content:center;padding:12px}
.crm-empty{padding:28px 20px;text-align:center;color:var(--soft);font-size:13.5px}
.crm-empty b{display:block;font-family:var(--font-display);font-size:17px;color:var(--ink);margin-bottom:4px}
.crm-skel{height:14px;border-radius:6px;background:linear-gradient(90deg,var(--panel2),var(--edge),var(--panel2));
  background-size:200% 100%;animation:crmsk 1.2s linear infinite;margin:10px 16px}
@keyframes crmsk{to{background-position:-200% 0}}
@media (prefers-reduced-motion:reduce){.crm-skel{animation:none}}

@media (max-width:820px){
  #crm table.crm-list thead{display:none}
  #crm table.crm-list,#crm table.crm-list tbody,#crm table.crm-list tr,#crm table.crm-list td{display:block;width:100%}
  #crm table.crm-list tr{border-bottom:1px solid var(--edge);padding:10px 14px}
  #crm table.crm-list td{border:0;padding:2px 0;white-space:normal;text-align:left}
  #crm table.crm-list td[data-l]{display:inline-block;width:auto;margin:4px 14px 0 0;text-align:left}
  #crm table.crm-list td.crm-na:empty,#crm table.crm-list td.crm-na.none{display:none}
  #crm table.crm-list td[data-l]::before{content:attr(data-l) " ";color:var(--faint);font-size:11px}
  .crm-bar select{max-width:none;flex:1 1 40%}
}

/* board */
.crm-board{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(230px,1fr);gap:10px;
  overflow-x:auto;padding-bottom:8px;scroll-snap-type:x proximity}
.crm-col{background:var(--bg2);border:1px solid var(--edge);border-radius:10px;padding:8px;min-height:120px;
  scroll-snap-align:start;display:flex;flex-direction:column;gap:7px}
.crm-col.drop{outline:2px dashed var(--accent);outline-offset:-4px}
.crm-col h3{font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--soft);margin:2px 4px 2px;
  display:flex;justify-content:space-between;font-weight:700}
.crm-card{background:var(--panel);border:1px solid var(--edge);border-radius:8px;padding:9px 10px;cursor:grab;
  display:flex;flex-direction:column;gap:5px}
.crm-card:hover{border-color:var(--accent)}
.crm-card .crm-name{font-size:13px}
.crm-card .row{display:flex;justify-content:space-between;align-items:center;gap:6px;font-size:11.5px;color:var(--faint)}
.crm-card select{font:inherit;font-size:11.5px;padding:3px 5px;border-radius:6px;border:1px solid var(--edge2);
  background:var(--panel2);color:var(--soft);max-width:130px}
.crm-colmore{font-size:11.5px;color:var(--faint);text-align:center;padding:4px}
@media (max-width:820px){.crm-board{grid-auto-columns:82vw}}

/* drawer */
.crm-back{position:fixed;inset:0;background:rgba(0,0,0,.42);z-index:30}
.crm-drawer{position:fixed;top:0;right:0;bottom:0;width:min(560px,100vw);background:var(--bg);z-index:31;
  border-left:1px solid var(--edge2);box-shadow:var(--shadow);overflow-y:auto;overscroll-behavior:contain;
  padding:18px 20px 60px}
.crm-drawer h2{font-size:22px;margin:0;overflow-wrap:anywhere}
.crm-dhead{display:flex;justify-content:space-between;align-items:flex-start;gap:10px;margin-bottom:8px}
.crm-drawer section{margin-top:18px}
.crm-drawer h4{font-size:10.5px;letter-spacing:.09em;text-transform:uppercase;color:var(--faint);margin:0 0 7px;font-weight:700}
.crm-kv{display:grid;grid-template-columns:auto 1fr;gap:4px 12px;font-size:13px}
.crm-kv dt{color:var(--faint)} .crm-kv dd{margin:0;overflow-wrap:anywhere}
.crm-money{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.crm-money .tile{padding:10px 12px}
.crm-bzrow{display:flex;justify-content:space-between;gap:8px;align-items:center;padding:7px 0;
  border-bottom:1px solid var(--edge);font-size:12.5px;color:var(--soft)}
.crm-tl{list-style:none;margin:0;padding:0}
.crm-tl li{display:grid;grid-template-columns:24px 1fr;gap:8px;padding:7px 0;border-bottom:1px solid var(--edge);font-size:13px}
.crm-tl svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;color:var(--soft);margin-top:2px}
.crm-tl .k-payment svg,.crm-tl .k-offer_redeemed svg{color:var(--good)}
.crm-tl .k-refund svg,.crm-tl .k-membership_end svg{color:var(--bad)}
.crm-tl .when{display:block;font-size:11.5px;color:var(--faint)}
.crm-tags{display:flex;flex-wrap:wrap;gap:5px;align-items:center}
.crm-tag{display:inline-flex;align-items:center;gap:3px;font-size:11.5px;padding:2px 4px 2px 9px;border-radius:100px;
  background:var(--panel2);border:1px solid var(--edge2)}
.crm-tag button{font:inherit;border:0;background:none;color:var(--faint);cursor:pointer;padding:0 5px;font-size:13px;line-height:1}
.crm-tag button:hover{color:var(--bad)}
.crm-form{display:flex;gap:6px;flex-wrap:wrap;margin-top:7px}
.crm-form input,.crm-form textarea{flex:1 1 160px}
.crm-form textarea{width:100%;min-height:62px;resize:vertical}
.crm-notes{list-style:none;margin:0;padding:0}
.crm-notes li{padding:8px 0;border-bottom:1px solid var(--edge);font-size:13px;white-space:pre-wrap;overflow-wrap:anywhere}
.crm-notes .when{display:flex;justify-content:space-between;font-size:11.5px;color:var(--faint);white-space:normal}
.crm-links{display:flex;flex-wrap:wrap;gap:6px}
.crm-links a{font-size:12.5px;color:var(--soft);border:1px solid var(--edge2);border-radius:8px;padding:5px 10px;text-decoration:none}
.crm-links a:hover{color:var(--accent);border-color:var(--accent)}
.crm-msg{font-size:12px;margin-top:6px}
.crm-msg.err{color:var(--bad)} .crm-msg.ok{color:var(--good)}
.crm-flags{display:flex;flex-wrap:wrap;gap:4px}
body.hidenums .crm-money .val,body.hidenums .crm-card .ltv,body.hidenums .crm-tl .amt{filter:blur(8px)}

/* 09-29 at-risk: clickable KPI tile + the reason under the pill */
#crm .crm-kpibtn{font:inherit;color:inherit;text-align:left;cursor:pointer;display:flex;flex-direction:column}
#crm .crm-kpibtn:hover,#crm .crm-kpibtn:focus-visible{border-color:var(--warn)}
.crm-why{color:var(--warn)}

/* phone pass 2 (09-30): KPI strip swipes in one row, 16px/44px controls, drawer respects the safe areas */
@media (max-width:820px){
  #crm .crm-kpis{display:flex;overflow-x:auto;gap:10px;scroll-snap-type:x proximity;scroll-padding-inline:16px;margin-inline:-16px;padding:0 16px 4px;scrollbar-width:none;overscroll-behavior-x:contain}
  #crm .crm-kpis::-webkit-scrollbar{display:none}
  #crm .crm-kpis .tile{flex:0 0 148px;scroll-snap-align:start;scroll-margin-inline:16px}
  .crm-bar input[type=search],.crm-bar select,.crm-drawer input,.crm-drawer select,.crm-drawer textarea{font-size:16px;min-height:44px}
  .crm-bar input[type=search]{flex:1 1 100%}
  .crm-bar select{flex:1 1 40%;max-width:none}
  .crm-bar label.crm-chk{min-height:44px}
  .crm-bar input[type=checkbox],.crm-drawer input[type=checkbox]{width:22px;height:22px}
  .crm-btn{min-height:44px}
  .crm-btn.crm-inline{min-height:36px}
  .crm-drawer{width:100vw;border-left:0;padding:0 16px calc(60px + env(safe-area-inset-bottom,0px))}
  .crm-dhead{position:sticky;top:0;z-index:2;background:var(--bg);margin:0 -16px 8px;padding:calc(env(safe-area-inset-top,0px) + 10px) 16px 10px;border-bottom:1px solid var(--edge)}
  .crm-drawer .crm-btn{min-height:44px}
  .crm-back{z-index:60}.crm-drawer{z-index:61}
}
