html.in-app{color:#182033;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;overflow-x:hidden}
html.in-app *,html.in-app *::before,html.in-app *::after{box-sizing:border-box}
html.in-app :is(input,select,textarea,[contenteditable="true"]){font-size:16px}
html.in-app :is(.main,#view,.form-body,.m-body,.ff){min-width:0}
html.in-app :is(button,.btn,.pg-btn,.mini,.m-tab,.la,.fub,.li-edit,.li-del,.fu-del,.m-head .x,.drawer .x,.cal-item,.bd-item,.cust){min-width:44px;min-height:44px}
html.in-app :is(.la,.fub,.li-edit,.li-del,.fu-del,.m-head .x,.drawer .x,.cust){display:inline-flex;align-items:center;justify-content:center}
html.in-app :is(#burger,.topbar .tool.bell,.ac-btn){min-width:44px;min-height:44px}
html.in-app :focus-visible{outline:3px solid #4f46e5;outline-offset:2px}
html.in-app input[type="checkbox"]{accent-color:#4f46e5}
html.in-app label:has(input[type="checkbox"]){min-height:44px}
html.in-app .main,html.in-app #view{overflow-x:hidden}

/* Lead page toolbar */
html.in-app #view .page-head{min-width:0}
html.in-app #view .toolbar{display:flex;flex-wrap:wrap;gap:8px;min-height:44px;align-items:center}
html.in-app #view .toolbar :is(button,.btn,.mini,.pg-btn){width:auto;flex:0 0 auto;min-width:44px}

/* Fullscreen sheet behaviour */
html.in-app .modal-bg{padding:0;overscroll-behavior:contain}
html.in-app :is(.modal,.modal.form-modal){width:100vw;max-width:100vw;height:100vh;height:100dvh;min-height:0;margin:0;border-radius:0;display:flex;flex-direction:column}
html.in-app .m-head,html.in-app .m-tools,html.in-app .m-tabs,html.in-app .modal>.form-foot{flex-shrink:0}
html.in-app :is(.m-body,.form-body){flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
html.in-app .m-head{padding-top:max(12px,env(safe-area-inset-top,0px))}
html.in-app .m-body,html.in-app .form-body{padding-bottom:max(16px,env(safe-area-inset-bottom,0px))}
html.in-app .form-body .form-foot{position:static;display:flex;flex-wrap:wrap;gap:10px;margin-top:18px;padding:14px 0 2px;background:transparent;box-shadow:none}
html.in-app .modal>.form-foot{position:static;display:flex;flex-wrap:wrap;gap:10px;padding:12px 16px max(12px,env(safe-area-inset-bottom,0px));background:#fff;border-top:1px solid #e5e7eb}
html.in-app .form-foot .spacer{display:none}
html.in-app .form-foot .btn{flex:1 1 140px;min-height:46px;justify-content:center}

/* Kanban */
html.in-app #board{display:flex;gap:12px;overflow-x:auto;scroll-snap-type:x proximity;scroll-padding-inline:14px;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain}
html.in-app #board .col{flex:0 0 calc(100% - 34px);min-width:calc(100% - 34px);max-width:calc(100% - 34px);scroll-snap-align:start}
html.in-app #board .col-body{max-height:calc(100dvh - 300px);min-height:240px;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain}
html.in-app .sa-stage-nav{display:flex;flex-wrap:nowrap;gap:8px;overflow-x:auto;padding:4px 0 12px;-webkit-overflow-scrolling:touch;scrollbar-width:none}
html.in-app .sa-stage-nav::-webkit-scrollbar{display:none}
html.in-app .sa-stage-btn{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;min-height:40px;padding:0 14px;border:1px solid #dcdcf4;border-radius:999px;background:#fff;color:#37345f;font:inherit;font-weight:700;white-space:nowrap;overflow:visible;text-overflow:clip;box-shadow:0 2px 8px rgba(32,28,90,.06)}
html.in-app .sa-stage-btn:hover,html.in-app .sa-stage-btn.active,html.in-app .sa-stage-btn:active{border-color:#4f46e5;background:#eeedff;color:#4038c5}
html.in-app .sa-stage-btn .sa-cnt{display:inline-grid;min-width:21px;min-height:21px;place-items:center;margin-left:5px;padding:0 6px;border-radius:999px;background:#eeedff;color:#4f46e5;font-size:12px}
html.in-app .sa-stage-btn:hover .sa-cnt,html.in-app .sa-stage-btn.active .sa-cnt{background:#4f46e5;color:#fff}

/* Tables transformed by the companion script */
html.in-app #docBody table.leads.sa-record-table,html.in-app #view table.leads.sa-lead-table{width:100%;min-width:0;border-collapse:separate;border-spacing:0 10px}
html.in-app #docBody table.leads.sa-record-table thead,html.in-app #view table.leads.sa-lead-table thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}
html.in-app #docBody table.leads.sa-record-table tbody,html.in-app #view table.leads.sa-lead-table tbody{display:block}
html.in-app #docBody table.leads.sa-record-table tbody tr[data-lead],html.in-app #view table.leads.sa-lead-table tbody tr[data-id]{display:grid;gap:8px;padding:13px;border:1px solid #e5e7ef;border-radius:14px;background:#fff;box-shadow:0 3px 12px rgba(24,32,51,.06)}
html.in-app #docBody table.leads.sa-record-table tbody td,html.in-app #view table.leads.sa-lead-table tbody td{display:flex;align-items:center;justify-content:space-between;gap:12px;min-width:0;padding:3px 0;border:0;overflow-wrap:anywhere}
html.in-app #docBody table.leads.sa-record-table tbody td:has(.doc-acts),html.in-app #view table.leads.sa-lead-table tbody td:has(.actions-cell){align-items:flex-start}
html.in-app .sa-cell-label{flex:0 0 39%;color:#687087;font-size:12px;font-weight:800;letter-spacing:.02em;text-transform:uppercase}
html.in-app #docBody .doc-acts{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px;width:100%}
html.in-app #docBody .doc-acts .mini{display:inline-flex;align-items:center;justify-content:center;gap:5px;border-radius:10px}
html.in-app #docBody .doc-acts :is(.dv-view,.dv-edit){display:inline-flex;align-items:center;justify-content:center;gap:5px;min-width:44px;min-height:40px;padding:6px 9px}
html.in-app .sa-lead-table .actions-cell,html.in-app .sa-lead-table .act-row{display:flex;flex-wrap:wrap;gap:8px}
html.in-app .sa-lead-table input[type="checkbox"]{width:20px;height:20px}
html.in-app .pager{gap:10px;padding:14px 0}
html.in-app .pager :is(.pg-btn,button.pg){min-width:44px;min-height:44px}

/* Document editor */
html.in-app .doc-editor table.doc-edit{width:100%;min-width:0;table-layout:fixed}
html.in-app .doc-editor table.doc-edit thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
html.in-app #d_lines{display:block}
html.in-app #d_lines>tr{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:12px 0;padding:14px;border:1px solid #e1e4ed;border-radius:14px;background:#fff;box-shadow:0 3px 12px rgba(24,32,51,.05)}
html.in-app #d_lines>tr>td{min-width:0;padding:0;border:0}
html.in-app #d_lines>tr>td:nth-child(1),html.in-app #d_lines>tr>td:nth-child(2),html.in-app #d_lines>tr>td:nth-child(5),html.in-app #d_lines>tr>td:nth-child(6),html.in-app #d_lines>tr>td:nth-child(7){grid-column:1/-1}
html.in-app #d_lines>tr>td:nth-child(7){display:flex;justify-content:flex-end}
html.in-app #d_lines :is(input,select){width:100%;min-width:0}
html.in-app #d_lines .detail-cell,html.in-app #d_lines .rich-detail{width:100%;min-width:0}
html.in-app #d_lines .rich-detail{min-height:108px;overflow-wrap:anywhere}
html.in-app #d_lines :is(.rt-b,.rt-fs){min-height:44px}
html.in-app #d_lines .detail-cell :is(.rt-tools,.rich-tools){display:flex;flex-wrap:wrap;gap:6px}
html.in-app #d_totbox{width:100%;max-width:none;margin:16px 0;border-radius:14px;padding:13px 15px}
html.in-app #d_totbox .tr.tt{margin-top:9px;padding-top:11px;border-top:2px solid #d9dce7}
html.in-app #d_addline{width:100%;min-height:46px;margin-top:8px;justify-content:center}

/* Document form */
html.in-app #formModal .form-grid{grid-template-columns:minmax(0,1fr)}
html.in-app #formModal :is(.ff,.ff-wide){min-width:0}
html.in-app #formModal .ff :is(input,select,textarea){width:100%}
html.in-app #formModal .ff input[type="checkbox"]{width:auto;flex:0 0 auto}
html.in-app :is(#d_gstdisc_w,#d_mklead_w){display:flex;flex-wrap:nowrap;align-items:flex-start;gap:12px;overflow-wrap:anywhere}
html.in-app :is(#d_gstdisc_w,#d_mklead_w) input[type="checkbox"]{width:22px!important;height:22px;min-width:22px;margin-top:2px;flex:0 0 22px}
html.in-app :is(#d_gstdisc_w,#d_mklead_w)>:not(input[type="checkbox"]){min-width:0;flex:1 1 auto}
html.in-app #af_results{width:100%;max-height:260px;overflow-y:auto;overscroll-behavior:contain}
html.in-app #af_results>*{min-height:44px}
html.in-app #dErr{margin-top:12px;padding:11px 13px;border-radius:10px;color:#b42318;background:#fff1f1;border:1px solid #fecaca;overflow-wrap:anywhere}

/* Lead modal */
html.in-app #modal .m-head{display:grid;grid-template-columns:minmax(0,1fr) 44px;gap:8px 12px;align-items:center}
html.in-app #modal .m-head h3{min-width:0;margin:0;overflow-wrap:anywhere}
html.in-app #modal #mX{grid-column:2;grid-row:1;margin:0}
html.in-app #modal #mStatus{grid-column:1/-1;grid-row:2;width:100%;min-height:44px;margin:0}
html.in-app #formModal .m-head .x{margin-left:auto}
html.in-app #modal .m-tabs{display:flex;flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch}
html.in-app #modal .m-tab{flex:0 0 auto;min-height:46px}
html.in-app #modal .m-tools{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding:12px 14px;overflow:visible}
html.in-app #modal .m-tools :is(span,button){min-width:0;border-radius:10px}
html.in-app #modal .m-tools :is(#mEdit,#mFu,#mTask,#mAssign,#mRem,#mMeet,#mDel,.sa-quote-shortcut){display:flex;align-items:center;justify-content:center;gap:8px;min-height:48px;padding:8px 10px;border:1px solid #e2e5ed;border-radius:10px;color:#454b5f;background:#fff;font:inherit;font-size:15px;font-weight:600;cursor:pointer}
html.in-app #modal .m-tools .sa-tool-label{margin:0;font-size:inherit;font-weight:inherit}
html.in-app #modal .m-tools #mFu{border-color:#c9c5ff;background:#efeeff;color:#4038c5}
html.in-app #modal .m-tools #mDel{color:#b42318;background:#fff1f1;border-color:#fecaca}
html.in-app #modal .m-tools .sa-quote-shortcut{border-color:#4f46e5;color:#4f46e5;background:#fff}

/* Lead cards */
html.in-app .lead-card{border-radius:14px;border:1px solid #e4e6ee;box-shadow:0 3px 12px rgba(24,32,51,.06)}
html.in-app .lead-card .lc-acts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
html.in-app .lead-card .la,html.in-app .lead-card .fub{min-width:0;min-height:44px;padding:8px 10px;border-radius:10px;font-size:13px;font-weight:750}
html.in-app .lead-card .la{border:1px solid #e1e4ed;color:#485166;background:#fff}
html.in-app .lead-card .fub{justify-content:center}
html.in-app .lc-row{display:grid;grid-template-columns:22px 104px minmax(0,1fr);column-gap:8px;align-items:start;min-width:0}
html.in-app .lc-row .ic{grid-column:1}
html.in-app .lc-row .k{grid-column:2;color:#687087;font-size:13px;line-height:1.35;white-space:normal;overflow-wrap:anywhere}
html.in-app .lc-row .v{grid-column:3;min-width:0;font-size:14px;line-height:1.4;overflow-wrap:anywhere}
html.in-app .lc-row.overdue{display:block;padding:7px 8px;border-left:3px solid #dc2626;border-radius:7px;background:#fff5f5;color:#9f1239;font-weight:750}
html.in-app .lc-phone{display:grid;gap:8px}
html.in-app .lc-phone a.call{min-height:48px}
html.in-app .sa-wa{display:inline-flex;align-items:center;justify-content:center;min-width:44px;min-height:44px;padding:8px 13px;border:1px solid #16a34a;border-radius:11px;background:#f0fdf4;color:#15803d;font-size:14px;font-weight:800;text-decoration:none}
html.in-app .det-row .sa-wa{margin-top:6px}

/* Follow-up */
html.in-app .fu-form .ff-row2{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px}
html.in-app .fu-form .ff-row2 label{min-width:0}
html.in-app .fu-form .ff-row2 label:has(#fuNext),html.in-app .fu-form .ff-row2 #fuAdd{grid-column:1/-1}
html.in-app .fu-form .ff-row2 :is(select,input){width:100%}
html.in-app .sa-fu-label{display:block;margin:14px 0 7px;color:#394154;font-size:13px;font-weight:800}
html.in-app #fuComment{width:100%;min-height:122px;resize:vertical}
html.in-app #fuFiles{width:100%;max-width:100%;min-height:44px}
html.in-app #fuFiles::file-selector-button{min-height:44px;margin-right:10px;border:1px solid #c9c5ff;border-radius:9px;background:#f4f3ff;color:#443cc4;font:inherit;font-weight:750}
html.in-app .fu-card{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:10px;border:1px solid #e4e6ee;border-radius:14px;box-shadow:0 3px 12px rgba(24,32,51,.05)}
html.in-app :is(.fu-main,.fu-cmt,.fu-mfile){min-width:0;overflow-wrap:anywhere}
html.in-app .fu-media{display:flex;flex-wrap:wrap;gap:8px}
html.in-app .fu-del{color:#b42318}

/* Notifications, drawer, tools */
html.in-app .bell-drop{width:min(calc(100vw - 20px),360px);max-height:min(60dvh,500px);overflow-y:auto}
html.in-app :is(.bd-item,.cal-item){min-height:44px;align-items:flex-start;overflow-wrap:anywhere}
html.in-app .doc-tools{display:flex;flex-wrap:wrap;gap:10px}
html.in-app #docSearch{flex:1 1 100%;width:100%}
html.in-app :is(#docPer,#docCount){min-height:44px}
html.in-app .drawer{width:min(100%,360px);height:100vh;height:100dvh}
html.in-app .drawer .d-body{min-height:0;overflow:auto}
html.in-app .drawer .d-foot{flex-shrink:0;position:static;display:flex;flex-wrap:wrap;padding-bottom:max(14px,env(safe-area-inset-bottom,0px))}
html.in-app .fld-row{flex-wrap:wrap}
html.in-app #toast{width:min(calc(100vw - 28px),420px);max-width:calc(100vw - 28px);z-index:9999;bottom:calc(82px + env(safe-area-inset-bottom,0px));overflow-wrap:anywhere}

/* Document viewer */
html.in-app #docBody .dv-view,html.in-app #docBody .dv-edit{min-width:44px;min-height:44px}
html.in-app .dv-wrap{width:100%;max-width:100%;overflow:auto;-webkit-overflow-scrolling:touch}
html.in-app .sa-doc-label{margin-left:4px;font-size:13px;font-weight:750}

/* Existing chrome: size only */
html.in-app .topbar{min-height:54px}
html.in-app :is(#botnav,.botnav){padding-bottom:max(6px,env(safe-area-inset-bottom,0px))}
html.in-app :is(#botnav,.botnav) a{min-height:50px}

@media (min-width:821px){
  html.in-app :is(.modal,.modal.form-modal){width:min(1320px,96vw);max-width:96vw;height:min(92dvh,920px);margin:auto;border-radius:16px}
  html.in-app .modal-bg{padding:4vh 16px;align-items:center}
  html.in-app #board .col{flex-basis:min(360px,calc(100% - 34px));min-width:min(360px,calc(100% - 34px));max-width:min(360px,calc(100% - 34px))}
}
@media (max-width:380px){
  html.in-app .fu-form .ff-row2{grid-template-columns:minmax(0,1fr)}
  html.in-app .fu-form .ff-row2 :is(label,#fuAdd){grid-column:auto}
}
@media (max-height:700px){
  html.in-app #modal.modal{overflow-y:auto}
  html.in-app #modal .m-body{flex:0 0 auto;overflow:visible}
}
@media (prefers-reduced-motion:reduce){
  html.in-app *,html.in-app *::before,html.in-app *::after{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}
}

/* Leads toolbar: wrap instead of clipping "+ Add Lead" */
html.in-app #view .page-head .ph-actions{display:flex;flex-wrap:wrap;gap:8px;overflow:visible;width:100%;max-width:100%;-webkit-mask-image:none;mask-image:none}
html.in-app #view .page-head .ph-actions > .btn{flex:1 1 auto;width:auto;min-width:0;min-height:44px;white-space:nowrap}
html.in-app #view .page-head .ph-actions > .seg{flex:0 0 auto}
