/* Окна задач и сделок: действия остаются видимыми, прокручивается только содержимое. */
body [role="dialog"][aria-modal="true"]{
  --mlv-ui-border:#e2e8f0;
  --mlv-ui-surface:#f8fafc;
  --mlv-ui-focus:#8b5cf6;
  --mlv-ui-hit:32px;
}
body [role="dialog"][aria-modal="true"] .mlv-modal-body > .mlv-chat-container{
  min-height:0!important;min-width:0!important;height:auto!important;max-height:none!important;
  margin:12px!important;padding:12px!important;box-sizing:border-box;
  overflow:hidden!important;gap:8px;
  background:var(--mlv-ui-surface)!important;border:1px solid var(--mlv-ui-border);
  border-radius:16px!important;box-shadow:0 2px 8px rgba(15,23,42,.04)!important;
}
body [role="dialog"][aria-modal="true"] .mlv-chat-container > :not(.mlv-chat-messages){flex-shrink:0}
body [role="dialog"][aria-modal="true"] .mlv-chat-container > .mlv-chat-messages{
  min-height:0!important;min-width:0!important;flex:1 1 0!important;
  overflow-y:auto!important;overscroll-behavior:contain;
  margin:0!important;padding:10px!important;background:#fff!important;
  border:1px solid var(--mlv-ui-border);border-radius:12px!important;
}
body [role="dialog"][aria-modal="true"] .mlv-chat-input-row{
  flex-shrink:0!important;min-width:0;box-sizing:border-box;
  border:1px solid var(--mlv-ui-border);box-shadow:none!important;
  border-radius:14px!important;align-items:flex-end!important;
}
body [role="dialog"][aria-modal="true"] .mlv-chat-input{
  min-width:0!important;max-height:120px;box-sizing:border-box;
  resize:none;overflow-y:auto;
}
body [role="dialog"][aria-modal="true"] .mlv-chat-attach-btn,
body [role="dialog"][aria-modal="true"] .mlv-chat-send-btn{flex-shrink:0!important}
body [role="dialog"][aria-modal="true"] :is(button,select){min-height:var(--mlv-ui-hit);min-width:var(--mlv-ui-hit);touch-action:manipulation}
body [role="dialog"][aria-modal="true"] :is(button,a,input,select,textarea,[tabindex]):focus-visible,
body .mlv-assignee-popover :is(button,input):focus-visible{
  outline:2px solid var(--mlv-ui-focus,#8b5cf6)!important;outline-offset:2px!important;
}
body [role="dialog"][aria-modal="true"] .mlv-chat-input-row:focus-within{
  border-color:var(--mlv-ui-focus);box-shadow:0 0 0 3px rgba(139,92,246,.12)!important;
}
body [role="dialog"][aria-modal="true"] button:disabled{opacity:.45;box-shadow:none!important}
body [role="dialog"][aria-modal="true"] .mlv-scroll-light,
body .mlv-assignee-popover{scrollbar-width:thin;scrollbar-color:#94a3b8 transparent;scroll-padding-block:12px}
body .mlv-assignee-popover button{min-height:44px;touch-action:manipulation}
body .mlv-assignee-popover button:not(:disabled):hover{background:#f1f5f9!important}
body .mlv-assignee-popover input{border-radius:10px 10px 0 0}
body .mlv-notif-dropdown{display:flex;flex-direction:column}
body .mlv-notif-dropdown > :first-child{flex-shrink:0}
body .mlv-notif-dropdown > :last-child{min-height:0;overflow-y:auto;overscroll-behavior:contain}
body .mlv-notif-dropdown [role="button"]:focus-visible{outline:2px solid #8b5cf6;outline-offset:-2px}
@media (max-width:820px){
  body [role="dialog"][aria-modal="true"] .mlv-modal-body{grid-template-rows:minmax(0,1fr) minmax(0,1fr)!important}
  body [role="dialog"][aria-modal="true"] .mlv-modal-body > .mlv-chat-container{margin:8px!important;padding:8px!important}
}
@media (pointer:coarse){
  body [role="dialog"][aria-modal="true"]{--mlv-ui-hit:44px}
}
@media (prefers-reduced-motion:reduce){
  body .mlv-notif-dropdown,body .mlv-notif-dropdown *{animation:none!important}
}
/* Длинный заголовок и суммы сделки не перекрывают основные действия. */
body [role="dialog"][aria-modal="true"] .mlv-modal-title{
  min-width:0;max-height:clamp(48px,18dvh,144px)!important;overflow-y:auto!important;
}
body [role="dialog"][aria-modal="true"] .mlv-deal-budget{min-width:0;max-width:100%;flex-wrap:wrap}
body [role="dialog"][aria-modal="true"] .mlv-deal-budget input{min-width:0;flex:1 1 120px}
body [role="dialog"][aria-modal="true"] .mlv-modal-body input{min-width:0;max-width:100%}
body .mlv-notif-dropdown button{min-height:32px;touch-action:manipulation}
@media (max-width:820px){
  body [role="dialog"][aria-modal="true"] .mlv-deal-budget{width:100%}
}
/* Палитра — самостоятельный диалог: плавающие панели не накрывают кнопки. */
body .mlv-bg-picker{padding:16px;box-sizing:border-box;overflow:hidden;overscroll-behavior:contain}
body .mlv-bg-picker > div{display:flex;flex-direction:column;max-height:calc(100dvh - 32px);min-height:0;margin:0!important}
body .mlv-bg-picker > div > :first-child{flex-shrink:0;gap:12px}
body .mlv-bg-picker > div > :last-child{min-height:0;overflow-y:auto;overscroll-behavior:contain}
body .mlv-bg-picker input{min-width:0}
.mlv-profile-heading{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px}
.mlv-profile-logout{min-height:40px;padding:8px 14px;border:1px solid #e2e8f0;border-radius:10px;background:#fff;color:#b91c1c;font-size:14px;font-weight:600;cursor:pointer;touch-action:manipulation}
.mlv-profile-logout:hover{background:#fef2f2;border-color:#fca5a5}
.mlv-profile-logout:focus-visible{outline:2px solid #8b5cf6;outline-offset:2px}
@media(pointer:coarse){.mlv-profile-logout{min-height:44px}}
@media(max-width:767px){
  html.mlv-mobile-clearance main{padding-bottom:var(--mlv-floating-clearance)!important;scroll-padding-bottom:var(--mlv-floating-clearance);box-sizing:border-box}
}
body [role="dialog"][aria-modal="true"] .mlv-chat-messages > p:only-child{
  margin:0!important;min-height:0;flex:1;display:grid;place-items:center;
}
