/* JSV 2.0.370: native mobile dialog geometry, not feed or desktop restyling. */
.jsv-purpose-form > .jsv-purpose-fields-370 { display: contents; }
/* Preserve the original desktop label styling after introducing a scroll wrapper. */
.jsv-purpose-fields-370 > label { display:grid; gap:6px; color:#193c57; font-size:13px; font-weight:800; }

@media (max-width:900px) {
  html body.jsv-dialog370-active { overflow:hidden !important; }
  html body.jsv-dialog370-active :is(.jsv-destination-bar,.jsv-x-bottom,.mobilebar,.jsf-hybrid-mobilebar,.jsf-mobile-tabs,.jsv-mobile-tabs,.jsf-bottom-nav,.bottom-tabs,.jsv-admin-checkin-mobile,.jsv355-edge-dock,.jsv-create-fab) {
    display:none !important;
  }
  html body.jsv-dialog370-active :is(#jsf-mobile-create-sheet,#jsf-mobile-more-sheet,.mobile-drawer-backdrop) { display:none !important; }
  html body.jsv-dialog370-active #jsm-root:not(.jsm-open) { visibility:hidden !important; pointer-events:none !important; }
  /* Top offset is applied exactly once to the root, never again to its children. */
  html body.jsv-dialog370-active :is(#jsf-compose-modal,.jsv-purpose-modal,#jsm-root)[data-jsv370-dialog] {
    position:fixed !important; inset:auto 0 auto 0 !important;
    top:var(--jsv370-top,0px) !important; width:100% !important;
    height:var(--jsv370-height,100dvh) !important; min-height:0 !important; max-height:none !important;
    margin:0 !important; padding:0 !important; transform:none !important;
    box-sizing:border-box !important; z-index:2147483200 !important;
  }
  html body.jsv-dialog370-active :is(#jsf-compose-modal,.jsv-purpose-modal)[data-jsv370-dialog] {
    display:block !important; overflow:hidden !important;
  }
  html body.jsv-dialog370-active :is(#jsf-compose-modal,.jsv-purpose-modal)[data-jsv370-dialog] > :is(.jsf-compose-dialog,.jsv-purpose-dialog) {
    position:relative !important; inset:auto !important; transform:none !important;
    display:flex !important; flex-direction:column !important; box-sizing:border-box !important;
    width:100% !important; max-width:none !important; height:100% !important; min-height:0 !important; max-height:100% !important;
    padding:0 !important; margin:0 !important; border:0 !important; border-radius:0 !important; overflow:hidden !important;
  }
  html body.jsv-dialog370-active .jsv-purpose-modal[data-jsv370-dialog] .jsv-purpose-dialog > header {
    position:relative !important; inset:auto !important; flex:0 0 auto !important;
    display:flex !important; align-items:center !important; gap:10px !important;
    padding:10px 12px !important; margin:0 !important; min-width:0 !important;
  }
  html body.jsv-dialog370-active .jsv-purpose-modal[data-jsv370-dialog] .jsv-purpose-dialog > header > div { min-width:0; }
  html body.jsv-dialog370-active .jsv-purpose-modal[data-jsv370-dialog] header h2 { font-size:20px !important; line-height:1.2 !important; margin:2px 0 !important; }
  html body.jsv-dialog370-active .jsv-purpose-modal[data-jsv370-dialog] header small { font-size:10px !important; line-height:1.3 !important; }
  html body.jsv-dialog370-active .jsv-purpose-modal[data-jsv370-dialog] header p { font-size:12px !important; line-height:1.35 !important; margin:3px 0 0 !important; }
  html body.jsv-dialog370-active .jsv-purpose-modal[data-jsv370-dialog][data-jsv370-short] header :is(small,p) { display:none !important; }
  html body.jsv-dialog370-active .jsv-purpose-modal[data-jsv370-dialog] .jsv-purpose-close {
    flex:0 0 44px !important; min-width:44px !important; width:44px !important; min-height:44px !important; height:44px !important; padding:0 !important;
  }
  html body.jsv-dialog370-active .jsv-purpose-modal[data-jsv370-dialog] .jsv-purpose-form {
    display:flex !important; flex-direction:column !important; flex:1 1 0 !important;
    height:auto !important; min-height:0 !important; max-height:100% !important; overflow:hidden !important; gap:0 !important; padding:0 !important; margin:0 !important;
  }
  html body.jsv-dialog370-active .jsv-purpose-modal[data-jsv370-dialog] .jsv-purpose-fields-370 {
    display:grid !important; align-content:start !important; flex:1 1 0 !important;
    min-height:0 !important; min-width:0 !important; gap:12px !important;
    overflow-x:hidden !important; overflow-y:auto !important; overscroll-behavior-y:contain;
    -webkit-overflow-scrolling:touch; touch-action:pan-y; scroll-padding-block:12px;
    padding:12px 14px 18px !important; box-sizing:border-box !important;
  }
  html body.jsv-dialog370-active .jsv-purpose-modal[data-jsv370-dialog] .jsv-purpose-form > footer {
    position:relative !important; inset:auto !important; flex:0 0 auto !important;
    display:flex !important; flex-wrap:wrap !important; justify-content:flex-end !important; gap:8px !important;
    min-height:60px !important; padding:8px 12px max(8px,env(safe-area-inset-bottom,0px)) !important;
    margin:0 !important; background:#fffdf5 !important; border-top:1px solid #e5dfcf !important;
    box-sizing:border-box !important; z-index:3 !important;
  }
  html body.jsv-dialog370-active .jsv-purpose-modal[data-jsv370-dialog][data-jsv370-short] .jsv-purpose-form > footer { padding-bottom:8px !important; }
  html body.jsv-dialog370-active .jsv-purpose-modal[data-jsv370-dialog] footer .btn { min-height:44px !important; min-width:0 !important; padding:8px 14px !important; font-size:15px !important; line-height:1.25 !important; }
  html body.jsv-dialog370-active .jsv-purpose-modal[data-jsv370-dialog] :is(input:not([type=hidden]):not([type=checkbox]):not([type=radio]),select,textarea) { font-size:16px !important; min-width:0 !important; max-width:100% !important; box-sizing:border-box !important; }
  html body.jsv-dialog370-active .jsv-purpose-modal[data-jsv370-dialog] .jsv-topic-selectors { grid-template-columns:minmax(0,1fr) !important; }
  html body.jsv-dialog370-active .jsv-purpose-modal[data-jsv370-dialog] label { min-width:0 !important; }
  /* Keep the existing Post now action in the top header; scroll ALL form fields. */
  html body.jsv-dialog370-active #jsf-compose-modal[data-jsv370-dialog] .jsf-compose-dialog > header {
    position:static !important; flex:0 0 56px !important; height:56px !important; min-height:56px !important;
    padding:4px 112px 4px 8px !important; gap:8px !important; box-sizing:border-box !important;
  }
  html body.jsv-dialog370-active #jsf-compose-modal[data-jsv370-dialog] .jsf-compose-dialog > header h2 { font-size:18px !important; line-height:1.15 !important; }
  html body.jsv-dialog370-active #jsf-compose-modal[data-jsv370-dialog] .jsf-compose-dialog > header small { display:none !important; }
  html body.jsv-dialog370-active #jsf-compose-modal[data-jsv370-dialog] #jsf-main-composer.jsf-feed-compose-modal {
    position:static !important; display:flex !important; flex-direction:column !important; flex:1 1 0 !important;
    height:auto !important; min-height:0 !important; max-height:100% !important; overflow:hidden !important; padding:0 !important;
  }
  html body.jsv-dialog370-active #jsf-compose-modal[data-jsv370-dialog] #jsf-main-composer > .jsv-compose-body {
    display:flex !important; flex-direction:column !important; flex:1 1 0 !important;
    min-height:0 !important; height:auto !important; max-height:100% !important;
    overflow-x:hidden !important; overflow-y:auto !important; overscroll-behavior-y:contain;
    touch-action:pan-y; -webkit-overflow-scrolling:touch; scroll-padding-block:12px;
    padding:12px 14px 24px !important; gap:12px !important; box-sizing:border-box !important;
  }
  html body.jsv-dialog370-active #jsf-compose-modal[data-jsv370-dialog] #jsf-main-composer > .jsv-compose-body > * { flex-shrink:0 !important; }
  html body.jsv-dialog370-active #jsf-compose-modal[data-jsv370-dialog] #jsf-main-composer > .jsf-compose-submit {
    position:absolute !important; inset:6px 8px auto auto !important; height:44px !important;
    width:auto !important; min-height:0 !important; padding:0 !important; margin:0 !important; border:0 !important; background:transparent !important; box-shadow:none !important;
  }
  html body.jsv-dialog370-active #jsf-compose-modal[data-jsv370-dialog] .jsf-compose-submit small { display:none !important; }
  html body.jsv-dialog370-active #jsf-compose-modal[data-jsv370-dialog] .jsf-compose-submit .btn { min-height:44px !important; height:44px !important; padding:0 12px !important; font-size:14px !important; }
  html body.jsv-dialog370-active #jsf-compose-modal[data-jsv370-dialog] .jsv-topic-fields label { line-height:1.35 !important; }
  html body.jsv-dialog370-active #jsf-compose-modal[data-jsv370-dialog] .jsv-topic-fields :is(input,select) { min-height:44px !important; height:auto !important; padding:8px !important; margin:4px 0 !important; font-size:16px !important; }
  html body.jsv-dialog370-active #jsf-compose-modal[data-jsv370-dialog] .jsv-writing-hint { position:static !important; display:block; margin:4px 0 2px !important; line-height:1.4 !important; font-size:12px !important; }
  html body.jsv-dialog370-active #jsf-compose-modal[data-jsv370-dialog] .jsv-writing-hint:empty { display:none !important; }
  /* Existing Messenger remains the transport/permissions authority. */
  html body.jsv-dialog370-active #jsm-root[data-jsv370-dialog] > .jsm-drawer {
    position:absolute !important; inset:0 !important; width:100% !important; height:100% !important;
    min-height:0 !important; max-height:100% !important; margin:0 !important; padding:0 !important; border:0 !important; border-radius:0 !important;
    transform:none !important; grid-template-columns:minmax(0,1fr) !important; grid-template-rows:minmax(0,1fr) !important; animation:none !important;
  }
  html body.jsv-dialog370-active #jsm-root[data-jsv370-dialog] :is(.jsm-panel,.jsm-chat) { grid-column:1 !important; grid-row:1 !important; height:100% !important; min-height:0 !important; min-width:0 !important; display:flex; overflow:hidden !important; }
  html body.jsv-dialog370-active #jsm-root[data-jsv370-dialog].jsm-in-chat .jsm-panel,
  html body.jsv-dialog370-active #jsm-root[data-jsv370-dialog] .jsm-welcome,
  html body.jsv-dialog370-active #jsm-root[data-jsv370-dialog] [hidden] { display:none !important; }
  html body.jsv-dialog370-active #jsm-root[data-jsv370-dialog] :is(.jsm-head,.jsm-chathead) { min-height:56px !important; padding:6px 10px !important; box-sizing:border-box !important; flex:0 0 auto !important; }
  html body.jsv-dialog370-active #jsm-root[data-jsv370-dialog][data-jsv370-short] :is(.jsm-head small,.jsm-chathead small) { display:none !important; }
  html body.jsv-dialog370-active #jsm-root[data-jsv370-dialog] .jsm-tabs {
    display:flex !important; flex-flow:row nowrap !important; flex:0 0 auto !important; gap:6px !important;
    height:48px !important; min-height:48px !important; max-height:48px !important; padding:6px 10px !important;
    overflow-x:auto !important; overflow-y:hidden !important; scrollbar-width:thin; overscroll-behavior-x:contain;
  }
  html body.jsv-dialog370-active #jsm-root[data-jsv370-dialog] .jsm-tabs > button { flex:0 0 auto !important; }
  html body.jsv-dialog370-active #jsm-root[data-jsv370-dialog] .jsm-search { margin:0 !important; padding:6px 10px !important; }
  html body.jsv-dialog370-active #jsm-root[data-jsv370-dialog] :is(.jsm-search input,.jsm-thread-search input) { font-size:16px !important; min-height:44px !important; padding:8px 10px !important; }
  html body.jsv-dialog370-active #jsm-root[data-jsv370-dialog] :is(.jsm-contacts,.jsm-messages) { flex:1 1 0 !important; min-height:0 !important; overflow-y:auto !important; -webkit-overflow-scrolling:touch; overscroll-behavior-y:contain; }
  html body.jsv-dialog370-active #jsm-root[data-jsv370-dialog] .jsm-inbox-links { flex:0 0 auto !important; flex-flow:row nowrap !important; min-height:40px !important; gap:14px !important; overflow-x:auto !important; margin:0 !important; padding:6px 10px !important; }
  html body.jsv-dialog370-active #jsm-root[data-jsv370-dialog] .jsm-compose { position:relative !important; inset:auto !important; flex:0 0 auto !important; min-height:56px !important; padding:6px 8px !important; }
  html body.jsv-dialog370-active #jsm-root[data-jsv370-dialog] .jsm-compose textarea { font-size:16px !important; min-height:40px !important; max-height:80px !important; }
  html body.jsv-dialog370-active :is(#jsf-compose-modal,.jsv-purpose-modal,#jsm-root)[data-jsv370-dialog] :is(input,select,textarea):focus-visible { outline:2px solid #21699c !important; outline-offset:2px !important; }
}
@media (max-width:900px) {
  /* Keep the required marker on the label line and preserve room for fields. */
  html body.jsv-dialog370-active .jsv-purpose-modal[data-jsv370-dialog] label:not(.jsv-purpose-checkbox) { display:block !important; font-size:13px !important; line-height:1.4 !important; }
  html body.jsv-dialog370-active .jsv-purpose-modal[data-jsv370-dialog] label > span { display:inline !important; }
  html body.jsv-dialog370-active .jsv-purpose-modal[data-jsv370-dialog] label > :is(input:not([type=checkbox]),select,textarea) { display:block !important; margin-top:6px !important; }
  html body.jsv-dialog370-active .jsv-purpose-modal[data-jsv370-dialog] .jsv-purpose-form > footer { flex-wrap:nowrap !important; }
  html body.jsv-dialog370-active .jsv-purpose-modal[data-jsv370-dialog] footer .btn { flex:1 1 0 !important; width:auto !important; max-width:none !important; white-space:normal !important; }
}
