/* Kokonut interaction rhythm, adapted to the existing CRM token system. */
html[data-lab-v="2"] :is(.view,.modal-win) details>summary{box-sizing:border-box;min-height:44px;padding:11px 14px;display:flex;align-items:center;justify-content:space-between;gap:12px;border:1px solid var(--line);border-radius:10px;background:var(--panel);color:var(--ink);font:500 13px/1.5 Inter,system-ui,sans-serif;cursor:pointer;list-style:none;transition:background .16s,border-color .16s}
html[data-lab-v="2"] :is(.view,.modal-win) details>summary::-webkit-details-marker{display:none}
html[data-lab-v="2"] :is(.view,.modal-win) details>summary:hover{background:var(--hover)}
html[data-lab-v="2"] :is(.view,.modal-win) details>summary:focus-visible{outline:2px solid var(--green-fill);outline-offset:3px}
html[data-lab-v="2"] :is(.view,.modal-win) details[open]>summary{border-color:var(--green-fill);background:var(--soft-green)}
html[data-lab-v="2"] :is(.view,.modal-win) details>summary:not(:has(svg))::after{content:'';flex:none;width:9px;height:9px;border-right:1.75px solid currentColor;border-bottom:1.75px solid currentColor;transform:rotate(-45deg);margin:0 6px;transition:transform .16s;color:var(--muted)}
html[data-lab-v="2"] :is(.view,.modal-win) details[open]>summary:not(:has(svg))::after{transform:rotate(45deg)}
html[data-lab-v="2"] :is(.tk-ft-expand,.dz6-x,.dz6-rs-tog,.rd-ad-edit,.clp-icon,.dp-nav){width:38px;min-width:38px;height:38px;min-height:38px;border-radius:9px;display:inline-grid;place-items:center;cursor:pointer;transition:background .16s,color .16s}
html[data-lab-v="2"] :is(.tk-ft-expand,.dz6-x,.dz6-rs-tog,.rd-ad-edit,.clp-icon,.dp-nav):hover{background:var(--hover);color:var(--ink)}
html[data-lab-v="2"] .tk-ft-expand svg{width:18px;height:18px}
html[data-lab-v="2"] .rd-dd-o{min-height:40px;padding:10px 12px;font-size:13px;line-height:1.5;border-radius:8px}
html[data-lab-v="2"] .ch-toolbar :is(button,.ch-chip),html[data-lab-v="2"] :is(.ch-chip,.ch-kf button){min-height:36px;line-height:1.4}
html[data-lab-v="2"] .clp-icon.sm{opacity:1;background:var(--panel2);border:1px solid var(--line)}
@media(max-width:700px){html[data-lab-v="2"] :is(.tk-ft-expand,.dz6-x,.dz6-rs-tog,.rd-ad-edit,.clp-icon,.dp-nav){width:44px;min-width:44px;height:44px;min-height:44px}html[data-lab-v="2"] :is(.ch-toolbar button,.ch-chip,.ch-kf button,.rd-dd-o){min-height:44px}}
@media(prefers-reduced-motion:reduce){html[data-lab-v="2"] :is(.view,.modal-win) details>summary,html[data-lab-v="2"] :is(.view,.modal-win) details>summary::after,html[data-lab-v="2"] :is(.tk-ft-expand,.dz6-x,.dz6-rs-tog,.rd-ad-edit,.clp-icon,.dp-nav){transition:none}}

@media(min-width:701px){html[data-lab-v="2"] select:not([multiple]){background-size:18px 18px!important;background-position:right 12px center!important;padding-right:38px!important}}
/* Match the existing v2 normalizer so it cannot shrink close controls to 36 px. */
html[data-lab-v="2"]:not(#v):not(#w) :is(.ui-x,.modal-bar .btn.modal-x,.btn.ghost.modal-x){width:40px;min-width:40px;height:40px;min-height:40px;border-radius:10px!important}
@media(max-width:900px){html[data-lab-v="2"]:not(#v):not(#w) :is(.ui-x,.modal-bar .btn.modal-x,.btn.ghost.modal-x){width:44px;min-width:44px;height:44px;min-height:44px}}

/* Shared control rhythm after the full CRM audit. Keep the existing tokens and layout. */
html[data-lab-v="2"] :is(.view,.modal-win) :is(button,input,select,textarea):focus-visible{outline:2px solid var(--gold-fill);outline-offset:3px}
html[data-lab-v="2"] :is(#pfPipeBtn,.pf-view-btn,.dz3o-chip,.dz-fchip,.dz-sel,.dz-btn.dz-sm){min-height:36px}
html[data-lab-v="2"] .view :is(.dz-h h1,.dz-head h1){font-size:28px;line-height:1.2}
html[data-lab-v="2"] .dza-chip{box-sizing:border-box;max-width:100%;height:auto;min-height:24px;white-space:normal;overflow-wrap:anywhere;padding:4px 9px;line-height:1.4}
html[data-lab-v="2"] .dza-chips{min-width:0;max-width:100%}
html[data-lab-v="2"] #clientbase .dz-tw{min-width:0;max-width:100%;width:100%;box-sizing:border-box}
html[data-lab-v="2"] #clientbase :is(.dz-content,.dz-body){min-width:0}
#tktDealButton{flex-shrink:0;white-space:nowrap;gap:6px}
.tkt-calendar-filters{display:none}
@media(max-width:900px){
 html[data-lab-v="2"] #clientbase .dz-tw{overflow-x:auto;overscroll-behavior-x:contain}
}
@media(max-width:700px){
 html[data-lab-v="2"] :is(#pfPipeBtn,.pf-view-btn,.dz3o-chip,.dz-fchip,.dz-sel,.dz-btn.dz-sm){min-height:44px}
 #listingModal .lc-actions{min-width:0;gap:6px;flex-wrap:wrap}
 #tktDealButton{max-width:100%;min-height:40px!important;font-size:12px!important;padding:8px 10px!important}
 #tktDealButton svg{width:16px;height:16px;flex:none}
 #tasks.tk-calendar-mode #dzTkDay{display:none}
 #tasks.tk-calendar-mode .tkt-toolbar{padding:10px 12px}
 #tasks.tk-calendar-mode .tkt-calendar-filters{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:44px;background:var(--panel);color:var(--ink);border:0;font:500 13px Inter,system-ui;cursor:pointer}
 #tasks.tk-calendar-mode .tkt-toolbar:not(.filters-open)>:not(.tkt-calendar-filters){display:none!important}
 #tasks.tk-calendar-mode .tkt-toolbar.filters-open .tkt-calendar-filters{margin-bottom:12px;border-bottom:1px solid var(--line)}
}
.uk-pal-kinds{display:flex;gap:5px;padding:10px 16px;border-bottom:1px solid var(--line);overflow:auto}
.uk-pal-kinds button{min-height:36px;border:0;border-radius:8px;padding:8px 12px;font:500 13px Inter,system-ui;background:transparent;color:var(--muted);cursor:pointer;white-space:nowrap}
.uk-pal-kinds button[aria-pressed=true]{background:var(--soft-gold);color:var(--ink-gold)}
.uk-pal-kinds button:focus-visible{outline:2px solid var(--gold-fill);outline-offset:2px}
@media(max-width:700px){.uk-pal-kinds button{min-height:44px}}
html[data-lab-v="2"] :is(#clientbase,#clientsList){min-width:0;max-width:100%;box-sizing:border-box}
@media(min-width:651px) and (max-width:900px){html[data-lab-v="2"] #clientbase .dz-tw{contain:inline-size}}
/* Match the specificity of the existing ticket layout, including its legacy guards. */
@media(max-width:700px){
 html #tasks.dz-tk.tk-calendar-mode:not(#old):not(#legacy) .dz-day{display:none}
 html[data-lab-v="2"]:not(#v):not(#w) #listingModal .lc-actions #tktDealButton{width:44px!important;min-width:44px!important;max-width:44px!important;height:44px;padding:0!important;overflow:hidden;display:inline-flex;align-items:center;justify-content:center}
 html #listingModal .lc-actions #tktDealButton>span{display:none}
}

/* Help remains readable at viewport edges and never affects document width. */
html[data-lab]:not([data-dz-off]) .dz5-info::after{display:none}
html[data-lab]:not([data-dz-off]) .dz5-info{width:28px;height:28px;display:inline-grid;place-items:center;font-size:12px;cursor:pointer}
.crm-info-tip{position:fixed;z-index:18000;box-sizing:border-box;width:max-content;max-width:min(340px,calc(100vw - 24px));padding:12px 14px;border:1px solid var(--line);border-radius:10px;background:var(--panel);color:var(--ink);box-shadow:var(--sh-pop);font:400 13px/1.6 Inter,system-ui,sans-serif;overflow-wrap:anywhere;pointer-events:none}
.crm-info-tip[hidden]{display:none}
@media(max-width:700px){html[data-lab]:not([data-dz-off]) .dz5-info{width:40px;height:40px}}
/* A compact phone layout keeps content and primary actions ahead of secondary reports. */
@media(max-width:700px){
 html[data-lab-v="2"]:not(#v):not(#w) :is(#calls,#rhythm) .dzc-kpi{min-height:0;padding:12px;gap:5px}
 html[data-lab-v="2"]:not(#v):not(#w) :is(#calls,#rhythm) .dzc-kpi>b{font-size:23px;line-height:1.2}
 html[data-lab-v="2"]:not(#v):not(#w) :is(#calls,#rhythm) .dzc-kpi .l{font-size:12px;line-height:1.4}
 html[data-lab-v="2"]:not(#v):not(#w) #calls .dzc-kpis{gap:8px;margin-bottom:12px}
 html[data-lab-v="2"]:not(#v):not(#w) #calls .crm-mobile-report .dzc-kpi:last-child{grid-column:1/-1}
 .crm-mobile-report{margin:0 0 14px}.crm-mobile-report>summary{margin-bottom:10px}
 .cal-mobile-more{flex-basis:100%;min-width:0}.cal-mobile-more>div{display:flex;flex-wrap:wrap;gap:8px;padding-top:10px}
 html[data-lab-v="2"]:not(#v):not(#w) .cal-mobile-more>summary{min-height:40px;padding:8px 12px;font-size:12px}
 html[data-lab-v="2"]:not(#v):not(#w) #partners .dz-empty{padding:18px 12px;min-height:0;gap:6px}
 html[data-lab-v="2"]:not(#v):not(#w) .view>.head{margin-bottom:14px;gap:10px}
 html[data-lab-v="2"]:not(#v):not(#w) #users .dza-t,html[data-lab-v="2"] #users .dza-t tbody{display:block;width:100%;min-width:0}
 html[data-lab-v="2"] #users .dza-t thead{display:none}
 html[data-lab-v="2"] #users .dza-t tr.dza-click{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;padding:14px;border-bottom:1px solid var(--line)}
 html[data-lab-v="2"] #users .dza-t tr.dza-click:last-child{border-bottom:0}
 html[data-lab-v="2"] #users .dza-t td{display:block;padding:0;border:0;min-width:0}
 html[data-lab-v="2"] #users .dza-t td:first-child{grid-column:1;grid-row:1}
 html[data-lab-v="2"] #users .dza-t td:nth-child(2){grid-column:1/-1;grid-row:2}
 html[data-lab-v="2"] #users .dza-t td:nth-child(2)::before{content:'Роли';display:block;margin-bottom:5px;font-size:11px;color:var(--muted)}
 html[data-lab-v="2"] #users .dza-t td.dza-act-c{grid-column:2;grid-row:1;align-self:start}
 html[data-lab-v="2"] #users .dza-t :is(.dza-hide-m,.dza-hide-s){display:none!important}
 html[data-lab-v="2"] #users .dza-who-t{min-width:0}.dza-who-t b{overflow-wrap:normal;word-break:normal}
 html[data-lab-v="2"] #users .dza-act{opacity:1;display:flex;flex-wrap:wrap;justify-content:flex-end;gap:3px;max-width:86px}
 html[data-lab-v="2"] #users .dza-ib{width:40px;min-width:40px;height:40px}
}
/* Standard deals: client first, grouped fields and persistent actions. */
#cdModal .cd-in{width:min(760px,calc(100vw - 32px));max-height:calc(100dvh - 40px);display:flex;flex-direction:column;padding:0;overflow:hidden;border-radius:16px}
.cd-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:24px;border-bottom:1px solid var(--line)}
.cd-head h2{margin:0;font-size:24px;line-height:1.25}.cd-head p{margin:6px 0 0;color:var(--muted);font-size:14px}.cd-head button{min-width:44px;min-height:44px}
.cd-body{padding:0 24px;overflow-y:auto;min-height:0;overscroll-behavior:contain}.cd-section{padding:22px 0;border-bottom:1px solid var(--line)}.cd-section[hidden]{display:none}.cd-section h3{font-size:16px;margin:0 0 16px}.cd-section h3 small{font-size:13px;color:var(--muted);font-weight:400}.cd-section .fm-grid{gap:14px}.cd-section .fm-fld{margin:0 0 14px}.cd-section input,.cd-section select{width:100%;min-height:44px;box-sizing:border-box}
.cd-clients{display:grid;grid-template-columns:1fr 1fr;gap:8px;max-height:176px;overflow-y:auto;margin-bottom:16px}.cd-client{display:flex;align-items:center;gap:10px;text-align:left;padding:10px 12px;background:var(--panel);border:1px solid var(--line);border-radius:12px;color:var(--ink);cursor:pointer;min-width:0}.cd-client:hover{background:var(--hover)}.cd-client>span:last-child{min-width:0}.cd-client b,.cd-client small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cd-client small{color:var(--muted);margin-top:3px}
.cd-foot{display:flex;justify-content:flex-end;gap:10px;padding:16px 24px;border-top:1px solid var(--line);background:var(--panel)}.cd-foot .btn{min-height:44px}
@media(max-width:600px){#cdModal .cd-in{width:calc(100vw - 16px);max-height:calc(100dvh - 16px)}.cd-head{padding:16px}.cd-head h2{font-size:21px}.cd-body{padding:0 16px}.cd-section{padding:16px 0}.cd-section .fm-grid{grid-template-columns:1fr;gap:0}.cd-clients{grid-template-columns:1fr;max-height:160px}.cd-foot{padding:12px 16px}.cd-foot .btn:last-child{flex:1}}
#cdModal{z-index:16000}
#cdModal .cd-head,#cdModal .cd-foot{flex:0 0 auto}
#cdModal .cd-body{flex:1 1 auto}
@media(max-width:600px){#cdModal .cd-foot{padding-bottom:max(12px,env(safe-area-inset-bottom))}}
@media(max-width:600px){#partners #prScope{min-width:0}#partners .dz2p-call .w .dz-sub{display:block;max-width:100%}#partners .dz2p-call .w b{overflow-wrap:anywhere}}
#listingModal.cd-service-card :is(.lc-note,#lfSaleBox,#lfSaleToggle,#lfDraftBtn,#lfCsiAvitoLink,#lfParsedAtRow,#lfParseHead,#lfParseBox){display:none!important}
