/* Final layout rules: one viewport and one navigation row, with no fixed overlays. */
.mm-app{min-width:0;width:100%;height:var(--mm-height,100dvh);overflow:hidden}
.mm-app .mm-main,.mm-app .mm-shell,.mm-app .mm-list-pane,.mm-app .mm-conversation-pane{min-width:0;min-height:0}
.mm-app .mm-main{max-height:var(--mm-height,100dvh)}
.mm-app .mm-shell>.mm-bottom-nav{flex-shrink:0}
@media(max-width:760px){
 .mm-app{position:fixed;inset:var(--mm-viewport-top,0px) 0 auto;margin:0;padding:0}
 .mm-app .mm-main{height:var(--mm-height,100dvh);width:100%!important;margin:0!important;overflow:hidden}
 .mm-app .mm-main>.mm-shell{display:flex;flex-direction:column;flex:1 1 0%;min-height:0;max-width:100%;padding-left:env(safe-area-inset-left,0px);padding-right:env(safe-area-inset-right,0px)}
 .mm-app .mm-list-pane,.mm-app .mm-conversation-pane{width:100%;min-width:0;flex:1 1 0%;height:auto;overflow:hidden}
 .mm-app .mm-shell>.mm-bottom-nav,.mm-app.mm-room-open .mm-shell>.mm-bottom-nav{position:relative;inset:auto;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));width:100%;height:auto;min-height:0;flex:0 0 auto;gap:0;padding:6px 2px max(12px,env(safe-area-inset-bottom,0px));background:var(--mm-surface);color:var(--mm-text)}
 .mm-app .mm-shell>.mm-bottom-nav>button,.mm-app .mm-shell>.mm-bottom-nav>a{display:flex;flex-direction:column;align-items:center;justify-content:center;min-width:0;min-height:48px;margin:0;padding:4px 1px;gap:4px;color:var(--mm-text);line-height:1.25}
 .mm-app .mm-bottom-nav>button>span,.mm-app .mm-bottom-nav>a>span{font-size:clamp(10px,2.7vw,12px);white-space:normal;overflow-wrap:anywhere;text-align:center}
 .mm-app.mm-room-open .mm-conversation-pane{padding-bottom:0}
 .mm-app .messages,.mm-app .direct-messages,.mm-app .mm-thread-list{min-height:0;min-width:0;overflow-y:auto;overscroll-behavior:contain}
 .mm-app .mm-chat-heading,.mm-app .mm-row-copy{min-width:0;overflow-wrap:anywhere}
 .mm-app .composer,.mm-app .direct-compose{padding-bottom:8px;flex-shrink:0}
 .mm-app dialog{max-width:100%;max-height:var(--mm-height,100dvh);overflow-y:auto}
}
@media(max-width:380px){
 .mm-app .mm-list-header{padding-left:10px;padding-right:10px}
 .mm-app .mm-list-title{gap:4px;flex-wrap:wrap}
 .mm-app .mm-list-title h1{font-size:23px}
}
@media(max-width:760px) and (max-height:500px){
 .mm-app .pb-product-brand{margin-bottom:8px}
 .mm-app .mm-list-header{padding-top:max(8px,env(safe-area-inset-top,0px));padding-bottom:8px}
 .mm-app .mm-shell>.mm-bottom-nav{padding-top:2px;padding-bottom:max(4px,env(safe-area-inset-bottom,0px))}
}

/* Retired supplier-number UI must stay absent for every role and live refresh. */
#number-form,#number-balloon{display:none!important}
.mm-app .composer>details:not([open])>:not(summary),
.mm-app .direct-compose>details:not([open])>:not(summary){display:none!important}
.mm-app .composer>details,.mm-app .direct-compose>details{clear:both;max-height:140px;overflow:auto;flex:none}
.mm-app .composer>details>summary,.mm-app .direct-compose>details>summary{font-size:12px;line-height:1.5;min-height:28px;padding:5px 8px}
.mm-app #free-form{position:relative;display:flex;align-items:flex-end;flex-wrap:wrap;min-width:0;width:100%;height:auto;gap:4px}
.mm-app #free-text{flex:1 1 80px;width:0;min-width:60px;max-width:100%;margin:0;box-sizing:border-box}
.mm-app #free-form button{flex-shrink:0;max-width:100%;margin:0}
.mm-app .composer,.mm-app .direct-compose{height:auto;min-height:0;max-height:none;flex:0 0 auto}
.mm-app .composer-row{display:flex;flex-wrap:wrap;gap:6px}
.mm-app .composer-row select{flex:1 1 140px;min-width:0;max-width:100%}
@media(max-width:380px){
 .mm-app #free-text{order:-1;flex:1 0 100%;width:100%;min-width:0}
 .mm-app #free-form{justify-content:flex-end}
 .mm-app #mm-emoji-button{margin-right:auto}
}
@media(max-width:760px){
 .mm-app .mm-thread-list{padding-bottom:8px}
 .mm-app .mm-private-actions{flex-wrap:wrap}
 .mm-app .mm-private-actions button{min-width:0;white-space:normal;overflow-wrap:anywhere}
 .mm-app .mm-chat-header{padding-top:calc(8px + env(safe-area-inset-top,0px))}
}

/* Bottom navigation is the last row of the app, above Android/iOS system controls. */
.mm-app:not(.mm-support)>.mm-main>footer,
.mm-app:not(.mm-support)>footer{display:none!important}
@media(max-width:760px){
 .mm-app{min-height:0!important;max-height:var(--mm-height,100dvh);box-sizing:border-box}
 .mm-app:not(.mm-support) .mm-main{display:flex;flex-direction:column;min-height:0!important;padding:0!important;box-sizing:border-box}
 .mm-app:not(.mm-support) .mm-main>.mm-shell{flex:1 1 0%;min-height:0;margin:0;box-sizing:border-box}
 .mm-app .mm-shell>.mm-bottom-nav{margin-top:auto;margin-bottom:0;flex-shrink:0}
 .mm-app .mm-list-pane #mm-new-chat{position:absolute;bottom:16px;right:max(16px,env(safe-area-inset-right,0px))}
}

/* The contact sheet and keyboard layout are in the inline contacts.css. */

/* Desktop direct-grid inherits align-items:start from the receipt layout.
   Stretch the one bounded row so long chats scroll inside the viewport. */
@media(min-width:761px){
 .mm-app:not(.mm-support) .mm-main>.mm-shell{grid-template-rows:minmax(0,1fr);align-items:stretch}
 .mm-app .mm-shell>.mm-list-pane,.mm-app .mm-shell>.mm-conversation-pane{height:100%;min-height:0;max-height:100%;overflow:hidden}
 .mm-app .mm-shell>.mm-bottom-nav{display:none}
}
/* Override generic receipt-card padding/background in both app themes. */
.mm-app .mm-conversation-pane>#room.card{padding:0;margin:0;background:var(--mm-wall);border:0;border-radius:0;box-shadow:none;min-height:0;overflow:hidden}
.mm-app .mm-conversation-pane>#room>#messages{flex:1 1 0%;min-height:0;overflow-y:auto;overflow-x:hidden}
.mm-app .mm-conversation-pane>#room>.direct-compose{flex-shrink:0}
.mm-app:not([data-mm-theme=light]) #messages{color-scheme:dark;scrollbar-color:#426052 #10231b}


/* The launcher belongs to the list pane, outside the positioned header. */
.mm-app .mm-list-pane{position:relative}
.mm-app .mm-list-pane>#mm-new-chat{position:absolute;inset:auto 20px 20px auto;width:56px;height:56px;min-width:56px;padding:16px;border-radius:18px;display:grid;place-items:center;background:var(--mm-green);color:var(--mm-surface);box-shadow:0 6px 20px #0003;z-index:12}
.mm-app .mm-list-pane>#mm-new-chat svg{width:24px;height:24px}
.mm-app.mm-room-open .mm-list-pane>#mm-new-chat{display:none}
.mm-app .mm-thread-list{padding-bottom:92px}
@media(max-width:760px){.mm-app .mm-list-pane>#mm-new-chat{inset:auto max(16px,env(safe-area-inset-right,0px)) 16px auto}}

/* Keep typing and attachment controls reachable on narrow phones. */
@media(max-width:760px){
 .mm-app #free-text,.mm-app #media-caption,.mm-app .composer input,.mm-app .direct-compose input{font-size:16px}
 .mm-app #free-form button,.mm-app .chat-media-toolbar button{min-width:44px;min-height:44px;touch-action:manipulation}
 .mm-app .bubble,.mm-app .direct-bubble{max-width:100%;min-width:0;overflow-wrap:anywhere}
 .mm-app dialog{box-sizing:border-box;max-width:calc(100vw - 16px);max-height:calc(var(--mm-height,100dvh) - 16px)}
 .mm-app[data-mm-keyboard=true] .mm-shell>.mm-bottom-nav{display:none!important}
 .mm-app[data-mm-keyboard=true] .composer,.mm-app[data-mm-keyboard=true] .direct-compose{padding-bottom:4px}
}
