/* Jamia Mahmoodia Core v61 — public + portal responsive safety authority */
html,body{max-width:100%;}
body{overflow-x:hidden;}
*,*::before,*::after{box-sizing:border-box;}
img,video,iframe,svg{max-width:100%;height:auto;}

/* Public pages */
body:not(.jm-portal-workspace-page) [data-jm-premium-page],
body:not(.jm-portal-workspace-page) .jm-core-section,
body:not(.jm-portal-workspace-page) .jm-page-hero{max-width:100%!important;overflow-x:hidden!important;}
body:not(.jm-portal-workspace-page) .jm-core-wrap{max-width:100%!important;}
body:not(.jm-portal-workspace-page) [data-jm-premium-page] :where(h1,h2,h3,h4,p,li,a,span,strong){min-width:0;}
body:not(.jm-portal-workspace-page) [data-jm-premium-page] :where(h1,h2,h3,h4){word-break:normal!important;overflow-wrap:break-word!important;hyphens:none!important;}
body:not(.jm-portal-workspace-page) [data-jm-premium-page] :where(input,select,textarea,button){min-width:0!important;max-width:100%!important;}

@media(max-width:900px){
  body:not(.jm-portal-workspace-page) .jm-core-wrap{width:calc(100% - 34px)!important;margin-inline:auto!important;}

  body:not(.jm-portal-workspace-page) :where(
    .jm66-about-hero-grid,.jm66-departments-hero-grid,.jm66-admissions-hero-grid,.jm66-ifta-hero-grid,.jm66-research-hero-grid,.jm66-khanqah-hero-grid,
    .jm66-foundation-grid,.jm66-admission-layout,.jm66-khanqah-journey-grid,.jm66-section-head,.jm66-legacy-grid,.jm66-academic-note-grid,
    .jm66-department-grid,.jm66-signature-grid,.jm66-category-grid,.jm66-research-area-grid,.jm66-service-card-grid,.jm66-research-steps,.jm66-research-paths,
    .jm66-khanqah-pillars,.jm66-objective-grid,.jm66-leader-grid,.jm66-ifta-services,.jm66-ifta-steps,.jm66-fatwa-grid,
    .jm-contact-main,.jm-contact-cards,.jm-info-grid,.jm-core-grid,.jm-core-split,.jm-core-feature,.jm-core-sitemap,.jm-library-overview,.jm-library-grid,
    .jm-donation-grid,.jm-prospectus-grid,.jm-prospectus-features,.jm-dashboard-lower
  ){grid-template-columns:minmax(0,1fr)!important;}

  body:not(.jm-portal-workspace-page) .jm66-admission-aside{position:static!important;top:auto!important;order:2!important;}
  body:not(.jm-portal-workspace-page) .jm66-admission-form{order:1!important;}
  body:not(.jm-portal-workspace-page) .jm66-page-jump{position:relative!important;top:auto!important;}
  body:not(.jm-portal-workspace-page) :where(.jm66-about-hero-card,.jm66-departments-hero aside,.jm66-admission-trust,.jm66-ifta-seal,.jm66-research-hero aside,.jm66-khanqah-hero aside){width:100%!important;max-width:100%!important;}
}

@media(max-width:700px){
  body:not(.jm-portal-workspace-page) .jm-core-wrap{width:calc(100% - 24px)!important;}
  body:not(.jm-portal-workspace-page) [data-jm-premium-page]{font-size:15px!important;}
  body:not(.jm-portal-workspace-page) [data-jm-premium-page] :where(h1){font-size:clamp(38px,11vw,50px)!important;line-height:1.02!important;}
  body:not(.jm-portal-workspace-page) [data-jm-premium-page] :where(h2){font-size:clamp(30px,8.7vw,40px)!important;line-height:1.07!important;}
  body:not(.jm-portal-workspace-page) [data-jm-premium-page] :where(h3){line-height:1.15!important;}
  body:not(.jm-portal-workspace-page) [data-jm-premium-page] p{font-size:14px!important;line-height:1.76!important;}
  body:not(.jm-portal-workspace-page) .jm66-section{padding:58px 0!important;}

  /* Hero blocks */
  body:not(.jm-portal-workspace-page) :where(.jm66-about-hero,.jm66-departments-hero,.jm66-admissions-hero,.jm66-ifta-hero,.jm66-research-hero,.jm66-khanqah-hero){min-height:0!important;height:auto!important;padding:42px 0!important;}
  body:not(.jm-portal-workspace-page) :where(.jm66-about-hero-grid,.jm66-departments-hero-grid,.jm66-admissions-hero-grid,.jm66-ifta-hero-grid,.jm66-research-hero-grid,.jm66-khanqah-hero-grid){padding:0!important;gap:18px!important;}
  body:not(.jm-portal-workspace-page) :where(.jm66-about-hero h1,.jm66-departments-hero h1,.jm66-admissions-hero h1,.jm66-ifta-copy h1,.jm66-research-hero h1,.jm66-khanqah-hero h1){font-size:clamp(39px,11vw,50px)!important;line-height:1!important;margin:8px 0 14px!important;}
  body:not(.jm-portal-workspace-page) .jm66-hero-actions{display:grid!important;grid-template-columns:1fr 1fr!important;gap:8px!important;width:100%!important;}
  body:not(.jm-portal-workspace-page) .jm66-hero-actions>a{width:100%!important;min-height:47px!important;display:flex!important;justify-content:center!important;text-align:center!important;}
  body:not(.jm-portal-workspace-page) :where(.jm66-about-hero-card,.jm66-departments-hero aside,.jm66-ifta-seal,.jm66-research-hero aside,.jm66-khanqah-hero aside){padding:18px!important;border-radius:18px!important;}

  /* Common section heads/cards */
  body:not(.jm-portal-workspace-page) .jm66-section-head{display:block!important;margin-bottom:22px!important;}
  body:not(.jm-portal-workspace-page) .jm66-section-head>p{margin-top:12px!important;max-width:100%!important;}
  body:not(.jm-portal-workspace-page) :where(.jm66-principle-grid,.jm66-department-grid,.jm66-signature-grid,.jm66-category-grid,.jm66-research-area-grid,.jm66-service-card-grid,.jm66-khanqah-pillars,.jm66-objective-grid,.jm66-leader-grid,.jm66-fatwa-grid){display:grid!important;grid-template-columns:1fr!important;gap:10px!important;}
  body:not(.jm-portal-workspace-page) :where(.jm66-principle-card,.jm66-department-card,.jm66-fatwa-card,.jm66-objective-grid article,.jm66-research-area-grid article,.jm66-khanqah-pillars article,.jm66-leader-grid article){min-height:0!important;padding:18px!important;border-radius:17px!important;}
  body:not(.jm-portal-workspace-page) .jm66-principle-card h3{margin:22px 0 9px!important;font-size:24px!important;}
  body:not(.jm-portal-workspace-page) .jm66-lineage-track{display:grid!important;grid-template-columns:1fr!important;}
  body:not(.jm-portal-workspace-page) .jm66-lineage-track>*{min-height:0!important;padding:18px!important;}

  /* Jump / tab navigation */
  body:not(.jm-portal-workspace-page) .jm66-page-jump{overflow-x:auto!important;overscroll-behavior-inline:contain!important;scrollbar-width:none!important;}
  body:not(.jm-portal-workspace-page) .jm66-page-jump::-webkit-scrollbar{display:none!important;}
  body:not(.jm-portal-workspace-page) .jm66-page-jump .jm-core-wrap{width:max-content!important;min-width:100%!important;padding-inline:12px!important;gap:4px!important;}
  body:not(.jm-portal-workspace-page) .jm66-page-jump a{white-space:nowrap!important;}

  /* Admissions */
  body:not(.jm-portal-workspace-page) .jm66-admissions-page .jm66-admissions-hero{min-height:0!important;padding:42px 0!important;}
  body:not(.jm-portal-workspace-page) .jm66-admissions-page .jm66-admissions-hero-grid{padding:0!important;gap:18px!important;}
  body:not(.jm-portal-workspace-page) .jm66-admissions-page .jm66-admission-trust{grid-template-columns:1fr!important;gap:7px!important;margin-top:18px!important;}
  body:not(.jm-portal-workspace-page) .jm66-admissions-page .jm66-admissions-hero aside{min-height:0!important;padding:18px!important;border-radius:18px!important;}
  body:not(.jm-portal-workspace-page) .jm66-admission-form-section{padding:54px 0!important;}
  body:not(.jm-portal-workspace-page) .jm66-admission-layout{display:flex!important;flex-direction:column!important;gap:16px!important;}
  body:not(.jm-portal-workspace-page) .jm66-admission-form{width:100%!important;padding:12px!important;border-radius:18px!important;}
  body:not(.jm-portal-workspace-page) .jm66-admission-form fieldset{padding:16px 12px!important;margin:0 0 12px!important;border-radius:15px!important;}
  body:not(.jm-portal-workspace-page) .jm66-admission-form legend{font-size:21px!important;line-height:1.15!important;}
  body:not(.jm-portal-workspace-page) .jm66-admission-form .jm-form-grid{display:grid!important;grid-template-columns:1fr!important;gap:13px!important;}
  body:not(.jm-portal-workspace-page) .jm66-admission-form .jm-field-wide{grid-column:auto!important;}
  body:not(.jm-portal-workspace-page) .jm66-admission-form input:not([type=checkbox]),body:not(.jm-portal-workspace-page) .jm66-admission-form select,body:not(.jm-portal-workspace-page) .jm66-admission-form textarea{width:100%!important;min-width:0!important;font-size:16px!important;}
  body:not(.jm-portal-workspace-page) .jm66-admission-form input:not([type=checkbox]),body:not(.jm-portal-workspace-page) .jm66-admission-form select{min-height:50px!important;}
  body:not(.jm-portal-workspace-page) .jm66-admission-aside{width:100%!important;padding:20px!important;border-radius:18px!important;}
  body:not(.jm-portal-workspace-page) .jm66-admission-next-grid{grid-template-columns:1fr!important;}

  /* Dar-ul-Ifta / research search controls */
  body:not(.jm-portal-workspace-page) :where(.jm66-ifta-search,.jm-fatwa-advanced-search,.jm-library-search,.jm-scholar-filters){display:grid!important;grid-template-columns:1fr!important;gap:8px!important;}
  body:not(.jm-portal-workspace-page) :where(.jm66-ifta-search input,.jm66-ifta-search select,.jm66-ifta-search button,.jm-fatwa-advanced-search input,.jm-fatwa-advanced-search select,.jm-fatwa-advanced-search button,.jm-library-search input,.jm-library-search button){width:100%!important;min-width:0!important;}

  /* Library / donation / contact / prospectus */
  body:not(.jm-portal-workspace-page) :where(.jm-library-overview,.jm-library-grid,.jm-donation-grid,.jm-contact-main,.jm-contact-cards,.jm-prospectus-grid,.jm-prospectus-features){grid-template-columns:1fr!important;gap:12px!important;}
  body:not(.jm-portal-workspace-page) .jm-contact-form{padding:18px!important;}
  body:not(.jm-portal-workspace-page) .jm-contact-map iframe{width:100%!important;height:300px!important;}
  body:not(.jm-portal-workspace-page) .jm-prospectus-lead{display:grid!important;grid-template-columns:1fr!important;gap:10px!important;padding:18px!important;}
  body:not(.jm-portal-workspace-page) .jm-prospectus-card{min-height:0!important;padding:20px 16px 18px 54px!important;}
  body:not(.jm-portal-workspace-page) .jm-prospectus-card>span{left:16px!important;top:20px!important;}

  /* Facilities/gallery classes emitted by the core/theme shared stack */
  body:not(.jm-portal-workspace-page) :where(.jm77-facilities-hero-grid,.jm77-gallery-hero){grid-template-columns:1fr!important;gap:18px!important;}
  body:not(.jm-portal-workspace-page) .jm77-facilities-photo{min-height:0!important;height:auto!important;}
  body:not(.jm-portal-workspace-page) .jm77-facilities-photo img{height:auto!important;aspect-ratio:16/10!important;object-fit:cover!important;}
  body:not(.jm-portal-workspace-page) .jm77-photo-grid{grid-template-columns:1fr!important;}
  body:not(.jm-portal-workspace-page) :where(.jm77-photo,.jm77-photo.is-wide,.jm77-photo.is-tall,.jm77-photo.is-panorama){grid-column:1!important;grid-row:auto!important;}

  /* Generic content / tables */
  body:not(.jm-portal-workspace-page) :where(.jm-core-prose,.jm-core-card,.jm-info-card,.jm-contact-page,.jm-library-page,.jm-donation-page,.jm-prospectus-page){min-width:0!important;max-width:100%!important;}
  body:not(.jm-portal-workspace-page) :where(.jm-core-prose,.jm-core-card,.jm-info-card) table{display:block!important;width:100%!important;max-width:100%!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch!important;}
  body:not(.jm-portal-workspace-page) :where(pre,code){max-width:100%!important;overflow-wrap:anywhere!important;}
}

@media(max-width:430px){
  body:not(.jm-portal-workspace-page) .jm-core-wrap{width:calc(100% - 20px)!important;}
  body:not(.jm-portal-workspace-page) .jm66-hero-actions{grid-template-columns:1fr!important;}
  body:not(.jm-portal-workspace-page) .jm66-about-hero-card>b{font-size:44px!important;}
}

/* Portal/workspace safety. Keeps desktop geometry untouched and only normalizes narrow screens. */
@media(max-width:900px){
  body.jm-portal-workspace-page :where(.jm-manager-shell,.jm-scholar-shell,.jm-user-admin,.jm-suite,.jm-subportal-shell,.jm-portal-shell,.jm-auth-shell){width:calc(100% - 20px)!important;max-width:100%!important;margin:12px auto 44px!important;grid-template-columns:1fr!important;}
  body.jm-portal-workspace-page :where(.jm-manager-grid,.jm-scholar-workspace,.jm-dashboard-lower,.jm-portal-grid,.jm-suite-columns,.jm-suite-metrics,.jm-ops-pipeline,.jm-automation-grid,.jm-user-stats,.jm-user-fields,.jm-user-filters){grid-template-columns:1fr!important;}
  body.jm-portal-workspace-page :where(.jm-manager-sidebar,.jm-scholar-sidebar,.jm-user-sidebar,.jm-suite-sidebar,.jm-subportal-sidebar){position:relative!important;top:auto!important;left:auto!important;right:auto!important;width:100%!important;height:auto!important;min-height:0!important;}
  body.jm-portal-workspace-page :where(.jm-manager-table-scroll,.jm-user-table,.jm-scholar-table,.jm-ops-records,.jm-manager-database,.jm-user-database,.jm-scholar-database){display:block!important;max-width:100%!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch!important;}
}

@media(max-width:700px){
  body.jm-portal-workspace-page :where(.jm-manager-shell,.jm-scholar-shell,.jm-user-admin,.jm-suite,.jm-subportal-shell,.jm-portal-shell,.jm-auth-shell){width:calc(100% - 12px)!important;margin:6px auto 30px!important;border-radius:16px!important;}
  body.jm-portal-workspace-page :where(.jm-manager-main,.jm-scholar-main,.jm-user-admin>main,.jm-suite-main,.jm-subportal-main,.jm-portal-overview,.jm-auth-panel,.jm-auth-intro){padding:14px!important;min-width:0!important;}
  body.jm-portal-workspace-page :where(.jm-manager-main>header,.jm-scholar-main>header,.jm-user-admin>main>header,.jm-suite-top,.jm-module-welcome,.jm-info-cta){align-items:flex-start!important;flex-direction:column!important;gap:10px!important;}
  body.jm-portal-workspace-page :where(.jm-manager-fields,.jm-scholar-two,.jm-auth-shell,.jm-form-grid){grid-template-columns:1fr!important;}
  body.jm-portal-workspace-page :where(input,select,textarea,button){max-width:100%!important;min-width:0!important;}
  body.jm-portal-workspace-page :where(input:not([type=checkbox]):not([type=radio]),select,textarea){font-size:16px!important;}
}
