/* V16.05.0026 — Firefox desktop stable proxy rail + latest-message friendly layout. */
@-moz-document url-prefix() {
  @media (min-width:901px) {
    /* Source/decorator action areas stay permanently hidden.
       They keep their real handlers/state; the visible rail is a stable proxy. */
    body #conversation-overlay.mb11026-desktop > .app-topbar,
    #conversation-overlay.mb11026-desktop .conversation-toolbar-actions,
    #conversation-overlay.mb11026-desktop .mb-mobile-conversation-actions,
    #conversation-overlay.mb11026-desktop .mb11026-chat-head > .mb11027-chat-actions,
    #conversation-overlay.mb11026-desktop .mb-v16050024-firefox-actions,
    #conversation-overlay.mb11026-desktop .mb-v16050025-firefox-rail {
      display:none!important;
    }

    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout {
      overflow:hidden!important;
      padding:0!important;
    }

    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout .conversation-wrap {
      width:min(1140px,calc(100% - 24px))!important;
      max-width:1140px!important;
      height:calc(100dvh - 16px)!important;
      max-height:calc(100dvh - 16px)!important;
      min-height:0!important;
      margin:8px auto!important;
      padding:0!important;
      display:grid!important;
      grid-template-columns:minmax(0,1fr) clamp(176px,18vw,210px)!important;
      grid-template-rows:minmax(0,1fr)!important;
      gap:8px!important;
      overflow:hidden!important;
      box-sizing:border-box!important;
    }

    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout .mb-v16050026-firefox-main {
      min-width:0!important;
      min-height:0!important;
      height:100%!important;
      display:flex!important;
      flex-direction:column!important;
      overflow:hidden!important;
    }

    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout .mb11026-chat-shell {
      flex:1 1 0!important;
      min-width:0!important;
      min-height:0!important;
      height:auto!important;
      max-height:none!important;
      display:flex!important;
      flex-direction:column!important;
      overflow:hidden!important;
      border-radius:16px!important;
    }

    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout .mb11026-chat-head {
      flex:0 0 auto!important;
      display:grid!important;
      grid-template-columns:32px minmax(0,1fr)!important;
      grid-template-areas:"avatar info"!important;
      align-items:center!important;
      gap:8px!important;
      padding:7px 10px!important;
      border-bottom:1px solid #e8e9ef!important;
      background:#fff!important;
    }

    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout .mb11026-avatar {
      grid-area:avatar!important;
      width:30px!important;
      height:30px!important;
      min-width:30px!important;
      min-height:30px!important;
      border-radius:8px!important;
      font-size:12px!important;
    }

    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout .mb11027-chat-info {
      grid-area:info!important;
      min-width:0!important;
      width:100%!important;
      flex:none!important;
    }

    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout .mb11026-chat-name {
      font-size:13px!important;
      line-height:1.08!important;
    }

    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout .mb11026-chat-state {
      margin-top:1px!important;
      font-size:9px!important;
      line-height:1.12!important;
    }

    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout #message-thread {
      flex:1 1 0!important;
      min-height:240px!important;
      height:auto!important;
      max-height:none!important;
      overflow-y:auto!important;
      overflow-x:hidden!important;
      padding:10px 16px 8px!important;
      gap:7px!important;
      background:linear-gradient(180deg,#fff 0%,#fbfbfd 100%)!important;
      scroll-behavior:auto!important;
    }

    /* Short conversations sit above the composer, not at the top with empty space below. */
    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout #message-thread > .message-row:first-of-type {
      margin-top:auto!important;
    }

    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout .message-bubble {
      max-width:min(78%,720px)!important;
      padding:8px 11px 7px!important;
      font-size:13px!important;
      line-height:1.36!important;
    }

    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout .message-composer {
      flex:0 0 auto!important;
      position:relative!important;
      display:grid!important;
      grid-template-columns:42px minmax(0,1fr) 86px!important;
      align-items:stretch!important;
      gap:6px!important;
      width:100%!important;
      min-width:0!important;
      margin:4px 0 0!important;
      padding:7px!important;
      border-radius:14px!important;
      box-sizing:border-box!important;
    }

    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout #mb11026-emoji-toggle {
      width:42px!important;
      min-width:42px!important;
      height:46px!important;
      min-height:46px!important;
      max-height:46px!important;
      border-radius:10px!important;
      font-size:20px!important;
    }

    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout .message-composer textarea {
      min-height:46px!important;
      max-height:104px!important;
      padding:11px 12px!important;
      font-size:13px!important;
      line-height:1.35!important;
      border-radius:10px!important;
    }

    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout #message-send-button {
      width:86px!important;
      min-width:86px!important;
      max-width:86px!important;
      height:46px!important;
      min-height:46px!important;
      max-height:46px!important;
      padding:0 9px!important;
      font-size:12px!important;
      border-radius:10px!important;
    }

    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout .mb11026-composer-help {
      grid-column:2/4!important;
      margin:-1px 2px 0!important;
      font-size:9px!important;
      line-height:1.1!important;
    }

    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout .mb-v16050026-firefox-rail {
      min-width:0!important;
      min-height:0!important;
      height:100%!important;
      margin:0!important;
      padding:8px!important;
      display:flex!important;
      flex-direction:column!important;
      align-items:stretch!important;
      justify-content:flex-start!important;
      gap:5px!important;
      overflow-y:auto!important;
      overflow-x:hidden!important;
      border:1px solid #e2e5eb!important;
      border-radius:16px!important;
      background:#fff!important;
      box-shadow:0 8px 24px rgba(28,31,42,.05)!important;
      box-sizing:border-box!important;
      scrollbar-width:thin!important;
    }

    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout .mb-v16050026-firefox-proxy {
      flex:0 0 34px!important;
      width:100%!important;
      min-width:0!important;
      max-width:100%!important;
      height:34px!important;
      min-height:34px!important;
      max-height:34px!important;
      margin:0!important;
      padding:3px 6px!important;
      display:flex!important;
      align-items:center!important;
      justify-content:center!important;
      border-radius:8px!important;
      font-size:10px!important;
      line-height:1.05!important;
      font-weight:800!important;
      white-space:normal!important;
      overflow:hidden!important;
      overflow-wrap:anywhere!important;
      text-align:center!important;
      box-shadow:none!important;
      box-sizing:border-box!important;
    }

    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout .mb-v16050026-firefox-proxy[data-state="allowed"] {
      background:#ecfdf3!important;
      border-color:#86efac!important;
      color:#166534!important;
    }
    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout .mb-v16050026-firefox-proxy[data-state="blocked"],
    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout .mb-v16050026-firefox-proxy[data-state="danger"] {
      background:#fff7f8!important;
      border-color:#fecdd3!important;
      color:#b4234d!important;
    }
  }

  @media (min-width:901px) and (max-width:1080px) {
    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout .conversation-wrap {
      grid-template-columns:minmax(0,1fr) 172px!important;
    }
    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout .mb-v16050026-firefox-rail {
      padding:6px!important;
      gap:4px!important;
    }
    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout .mb-v16050026-firefox-proxy {
      font-size:9.4px!important;
    }
  }

  @media (min-width:901px) and (max-height:650px) {
    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout #message-thread {
      min-height:170px!important;
    }
    #conversation-overlay.mb11026-desktop.mb-v16050026-firefox-layout .mb-v16050026-firefox-proxy {
      flex-basis:30px!important;
      height:30px!important;
      min-height:30px!important;
      max-height:30px!important;
      font-size:9px!important;
    }
  }
}