/* THE MUNSIF: Step 73B — correct mobile bottom-sheet bounds and place thumbnails above paper. */
@media (max-width:650px) {
  /* When JavaScript moves the EXISTING thumbnail aside inside the viewer,
     it becomes the slim horizontal strip immediately below the toolbar. */
  body.munsif-edition-body .mn-viewer > .mn-page-list.mn-mobile-thumbs-top {
    display:block !important;
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
    box-sizing:border-box !important;
    margin:0 !important;
    padding:9px 10px 7px !important;
    border:0 !important;
    border-bottom:1px solid #e6e0d7 !important;
    border-radius:0 !important;
    box-shadow:none !important;
    background:#fffdfa;
  }
  body.munsif-edition-body .mn-viewer > .mn-page-list.mn-mobile-thumbs-top h2 {
    font-size:12px !important;
    font-family:Arial,Helvetica,sans-serif;
    font-weight:700;
    line-height:1.4;
    letter-spacing:.025em;
    margin:0 0 6px !important;
    color:#24374c;
  }
  body.munsif-edition-body .mn-viewer > .mn-page-list.mn-mobile-thumbs-top .mn-page-grid {
    max-width:100% !important;
    min-width:0 !important;
    box-sizing:border-box;
    grid-auto-columns:76px;
    padding:1px 1px 7px !important;
    gap:8px;
    scroll-padding-inline:8px;
  }
  body.munsif-edition-body .mn-viewer > .mn-page-list.mn-mobile-thumbs-top .mn-page-choice {
    min-width:0;
    box-sizing:border-box;
  }
  /* The original clipping sheet used width:100% PLUS horizontal padding,
     producing a box wider than the phone's viewport. Constrain its BORDER box. */
  body.munsif-edition-body .mn-clip-panel.mn-clip73-sheet {
    box-sizing:border-box !important;
    position:fixed !important;
    inset-inline:0 !important;
    left:0 !important;
    right:0 !important;
    bottom:0 !important;
    width:100vw !important;
    max-width:100vw !important;
    min-width:0 !important;
    margin:0 !important;
    padding:24px 12px max(12px,env(safe-area-inset-bottom,0px)) !important;
    max-height:calc(100vh - 8px) !important;
    max-height:calc(100dvh - 8px) !important;
    overflow-x:hidden !important;
    overflow-y:auto !important;
    overscroll-behavior:contain;
  }
  body.munsif-edition-body .mn-clip-panel.mn-clip73-sheet,
  body.munsif-edition-body .mn-clip-panel.mn-clip73-sheet * {
    box-sizing:border-box;
  }
  body.munsif-edition-body .mn-clip73-sheet .mn-clip-info,
  body.munsif-edition-body .mn-clip73-sheet .mn-clip-result,
  body.munsif-edition-body .mn-clip73-sheet .mn-clip-actions {
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
  }
  body.munsif-edition-body .mn-clip73-sheet .mn-clip-info {
    padding-right:58px !important;
    overflow-wrap:anywhere;
  }
  body.munsif-edition-body .mn-clip73-sheet .mn-clip-close {
    right:10px !important;
    max-width:58px;
  }
  body.munsif-edition-body .mn-clip73-sheet .mn-clip-actions {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:8px;
  }
  body.munsif-edition-body .mn-clip73-sheet .mn-clip-actions button {
    min-width:0 !important;
    max-width:100%;
    overflow-wrap:anywhere;
    padding:10px 5px !important;
  }
  body.munsif-edition-body .mn-clip73-sheet #mn-clip-preview {
    max-width:100% !important;
    max-height:min(40dvh,450px) !important;
    height:auto !important;
    object-fit:contain;
  }
  /* Prevent background layout width from leaking into the fixed sheet. */
  body.munsif-edition-body .mn-clip73-backdrop {
    width:100vw;
    max-width:100vw;
    box-sizing:border-box;
  }
}
@media (max-width:360px) {
  body.munsif-edition-body .mn-clip73-sheet .mn-clip-actions button {
    font-size:11px !important;
    gap:5px !important;
  }
  body.munsif-edition-body .mn-viewer > .mn-page-list.mn-mobile-thumbs-top .mn-page-grid {
    grid-auto-columns:69px;
  }
}
@media print {
  body.munsif-edition-body .mn-viewer > .mn-page-list.mn-mobile-thumbs-top { display:none!important; }
}
