/* KBM Phase02 Rev18.63 — Mobile Essentials Compact Governance + Homepage Filter Suppression */
@media (max-width:768px), (max-device-width:820px){
  html.kbm-touch-mobile,
  html.kbm-mobile-essential-mode{scroll-padding-top:58px!important;}

  body.kbm-mobile-app-ux,
  body.kbm-mobile-app-shell,
  body.kbm-mobile-essential-body{
    --kbm-mobile-essential-w:min(430px,calc(100vw - 16px));
    --kbm-mobile-essential-gap:10px;
    --kbm-mobile-essential-radius:22px;
    background:#f4f7fb!important;
    overflow-x:hidden!important;
  }

  /* Keep only the app identity bar in mobile; remove old header/menu/submenu layer. */
  html.kbm-touch-mobile body :where(.kbm-shell-cleanup-header,.kbm-site-header,.kbm-header),
  body.kbm-mobile-essential-body :where(.kbm-shell-cleanup-header,.kbm-site-header,.kbm-header){
    display:none!important;
    min-height:0!important;
    height:0!important;
    overflow:hidden!important;
    visibility:hidden!important;
    pointer-events:none!important;
  }
  body.kbm-mobile-essential-body .kbm-app-mini-topbar,
  html.kbm-touch-mobile body .kbm-app-mini-topbar{
    width:var(--kbm-mobile-essential-w)!important;
    min-height:46px!important;
    height:46px!important;
    top:6px!important;
    padding:7px 14px!important;
    border-radius:20px!important;
    box-shadow:0 8px 22px rgba(15,23,42,.08)!important;
  }
  body.admin-bar.kbm-mobile-essential-body .kbm-app-mini-topbar,
  html.kbm-touch-mobile body.admin-bar .kbm-app-mini-topbar{top:52px!important;}
  body.kbm-mobile-essential-body .kbm-app-mini-topbar__brand,
  html.kbm-touch-mobile body .kbm-app-mini-topbar__brand{font-size:16px!important;line-height:1.35!important;font-weight:1000!important;}
  body.kbm-mobile-essential-body .kbm-app-mini-topbar__dot,
  html.kbm-touch-mobile body .kbm-app-mini-topbar__dot{width:10px!important;height:10px!important;flex-basis:10px!important;box-shadow:0 0 0 5px rgba(255,205,17,.16)!important;}

  /* Global mobile rails */
  body.kbm-mobile-essential-body :where(.kbm-shell,.kbm-theme-main,.kbm-theme-content,main,.kbm-home-shell,.kbm-screen-shell,.kbm-final-home,.kbm-home02-container,.kbm-vhub,.kbm-adsv2-wrap,.kbm-ads-shell,.kbm-p20p-archive,.kbm-p20-archive,.kbm-provider-archive,.kbm-p23-archive,.kbm-p5r15-archive,.kbm-static1828,.kbm-contact1828,.kbm-about1828){
    max-width:var(--kbm-mobile-essential-w)!important;
    width:var(--kbm-mobile-essential-w)!important;
    margin-left:auto!important;
    margin-right:auto!important;
    padding-left:0!important;
    padding-right:0!important;
    overflow:visible!important;
  }
  body.kbm-mobile-essential-body :where(.kbm-theme-main,.kbm-theme-content,.kbm-shell){padding-top:0!important;}

  /* HOME: remove the duplicated top cluster. The hero already contains the real search and primary CTAs. */
  body.kbm-mobile-route-home :where(.kbm-mobile-home-searchbar,.kbm-screen-sponsor,.kbm-home-sponsor,.kbm-adv-global-wrap--adv04,.kbm-adv-global-card--adv04,.kbm-home-adv-quick,.kbm-screen-quick),
  html.kbm-touch-mobile body.home :where(.kbm-mobile-home-searchbar,.kbm-screen-sponsor,.kbm-home-sponsor,.kbm-adv-global-wrap--adv04,.kbm-adv-global-card--adv04,.kbm-home-adv-quick,.kbm-screen-quick),
  html.kbm-touch-mobile body.front-page :where(.kbm-mobile-home-searchbar,.kbm-screen-sponsor,.kbm-home-sponsor,.kbm-adv-global-wrap--adv04,.kbm-adv-global-card--adv04,.kbm-home-adv-quick,.kbm-screen-quick){
    display:none!important;
    height:0!important;
    min-height:0!important;
    max-height:0!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
    overflow:hidden!important;
    visibility:hidden!important;
    pointer-events:none!important;
  }
  body.kbm-mobile-route-home :where(.kbm-screen-shell,.kbm-home-shell,.kbm-final-home),
  html.kbm-touch-mobile body.home :where(.kbm-screen-shell,.kbm-home-shell,.kbm-final-home),
  html.kbm-touch-mobile body.front-page :where(.kbm-screen-shell,.kbm-home-shell,.kbm-final-home){
    gap:var(--kbm-mobile-essential-gap)!important;
    padding-top:2px!important;
    padding-bottom:calc(92px + env(safe-area-inset-bottom,0px))!important;
  }

  /* Home hero compacting: title, search, two key CTAs and stats stay visible; decorative height is reduced. */
  body.kbm-mobile-route-home .kbm-home02-hero,
  html.kbm-touch-mobile body.home .kbm-home02-hero,
  html.kbm-touch-mobile body.front-page .kbm-home02-hero{
    width:var(--kbm-mobile-essential-w)!important;
    max-width:var(--kbm-mobile-essential-w)!important;
    min-height:0!important;
    margin:8px auto 10px!important;
    border-radius:22px!important;
    box-shadow:0 16px 34px rgba(15,23,42,.14)!important;
  }
  body.kbm-mobile-route-home .kbm-home02-hero__grid,
  html.kbm-touch-mobile body.home .kbm-home02-hero__grid,
  html.kbm-touch-mobile body.front-page .kbm-home02-hero__grid{
    grid-template-columns:1fr!important;
    gap:10px!important;
    padding:18px 12px!important;
  }
  body.kbm-mobile-route-home .kbm-home02-kicker,
  html.kbm-touch-mobile body.home .kbm-home02-kicker,
  html.kbm-touch-mobile body.front-page .kbm-home02-kicker{font-size:10.5px!important;padding:5px 10px!important;}
  body.kbm-mobile-route-home .kbm-home02-title,
  html.kbm-touch-mobile body.home .kbm-home02-title,
  html.kbm-touch-mobile body.front-page .kbm-home02-title{
    font-size:clamp(23px,7vw,30px)!important;
    line-height:1.55!important;
    margin:8px 0 4px!important;
    text-align:right!important;
  }
  body.kbm-mobile-route-home .kbm-home02-sub,
  html.kbm-touch-mobile body.home .kbm-home02-sub,
  html.kbm-touch-mobile body.front-page .kbm-home02-sub{
    font-size:12.5px!important;
    line-height:1.85!important;
    margin:0 0 10px!important;
    display:-webkit-box!important;
    -webkit-line-clamp:2!important;
    -webkit-box-orient:vertical!important;
    overflow:hidden!important;
  }
  body.kbm-mobile-route-home .kbm-home02-search,
  html.kbm-touch-mobile body.home .kbm-home02-search,
  html.kbm-touch-mobile body.front-page .kbm-home02-search{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) 96px!important;
    gap:7px!important;
    padding:8px!important;
    border-radius:17px!important;
  }
  body.kbm-mobile-route-home .kbm-home02-search select,
  html.kbm-touch-mobile body.home .kbm-home02-search select,
  html.kbm-touch-mobile body.front-page .kbm-home02-search select{display:none!important;}
  body.kbm-mobile-route-home .kbm-home02-search input[type="search"],
  html.kbm-touch-mobile body.home .kbm-home02-search input[type="search"],
  html.kbm-touch-mobile body.front-page .kbm-home02-search input[type="search"]{height:42px!important;font-size:12px!important;border-radius:14px!important;padding:0 10px!important;}
  body.kbm-mobile-route-home .kbm-home02-search button,
  html.kbm-touch-mobile body.home .kbm-home02-search button,
  html.kbm-touch-mobile body.front-page .kbm-home02-search button{height:42px!important;border-radius:14px!important;font-size:12px!important;}
  body.kbm-mobile-route-home .kbm-home02-actions,
  html.kbm-touch-mobile body.home .kbm-home02-actions,
  html.kbm-touch-mobile body.front-page .kbm-home02-actions{display:grid!important;grid-template-columns:1fr 1fr!important;gap:8px!important;margin-top:10px!important;}
  body.kbm-mobile-route-home .kbm-home02-btn,
  html.kbm-touch-mobile body.home .kbm-home02-btn,
  html.kbm-touch-mobile body.front-page .kbm-home02-btn{min-height:40px!important;padding:8px 10px!important;border-radius:14px!important;font-size:11.5px!important;text-align:center!important;}
  body.kbm-mobile-route-home .kbm-home02-stats,
  html.kbm-touch-mobile body.home .kbm-home02-stats,
  html.kbm-touch-mobile body.front-page .kbm-home02-stats{grid-template-columns:1fr 1fr!important;gap:6px!important;}
  body.kbm-mobile-route-home .kbm-home02-stat,
  html.kbm-touch-mobile body.home .kbm-home02-stat,
  html.kbm-touch-mobile body.front-page .kbm-home02-stat{border-radius:15px!important;padding:9px 6px!important;min-height:58px!important;}
  body.kbm-mobile-route-home .kbm-home02-stat b,
  html.kbm-touch-mobile body.home .kbm-home02-stat b,
  html.kbm-touch-mobile body.front-page .kbm-home02-stat b{font-size:20px!important;}
  body.kbm-mobile-route-home .kbm-home02-stat span,
  html.kbm-touch-mobile body.home .kbm-home02-stat span,
  html.kbm-touch-mobile body.front-page .kbm-home02-stat span{font-size:10.5px!important;}


  /* HOME: archive filters have no function on the homepage. Hide all known filter rails/FABs/buttons there. */
  body.kbm-mobile-route-home :where(
    .kbm-p3-overlap-filterbar,
    .kbm-p3-mf-filter-btn,
    .kbm-mobile-app-filter-fab,
    .kbm-adsv2-filter-toggle,
    .kbm-filter-toggle,
    .kbm-p3-mf-backdrop,
    [data-kbm-filter-open],
    [data-kbm-filter-toggle],
    [data-kbm-ads-filter-open],
    [aria-label*="فیلتر آگهی"],
    button[class*="filter"],
    .kbm-home-filter,
    .kbm-screen-filter,
    .kbm-uds-filter-bar
  ),
  html.kbm-touch-mobile body.home :where(
    .kbm-p3-overlap-filterbar,
    .kbm-p3-mf-filter-btn,
    .kbm-mobile-app-filter-fab,
    .kbm-adsv2-filter-toggle,
    .kbm-filter-toggle,
    .kbm-p3-mf-backdrop,
    [data-kbm-filter-open],
    [data-kbm-filter-toggle],
    [data-kbm-ads-filter-open],
    [aria-label*="فیلتر آگهی"],
    button[class*="filter"],
    .kbm-home-filter,
    .kbm-screen-filter,
    .kbm-uds-filter-bar
  ),
  html.kbm-touch-mobile body.front-page :where(
    .kbm-p3-overlap-filterbar,
    .kbm-p3-mf-filter-btn,
    .kbm-mobile-app-filter-fab,
    .kbm-adsv2-filter-toggle,
    .kbm-filter-toggle,
    .kbm-p3-mf-backdrop,
    [data-kbm-filter-open],
    [data-kbm-filter-toggle],
    [data-kbm-ads-filter-open],
    [aria-label*="فیلتر آگهی"],
    button[class*="filter"],
    .kbm-home-filter,
    .kbm-screen-filter,
    .kbm-uds-filter-bar
  ){
    display:none!important;
    visibility:hidden!important;
    opacity:0!important;
    height:0!important;
    min-height:0!important;
    max-height:0!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
    overflow:hidden!important;
    pointer-events:none!important;
  }

  /* Home secondary sections: turn tall grids into compact rails/cards to reduce scroll. */
  body.kbm-mobile-route-home .kbm-home02-section,
  html.kbm-touch-mobile body.home .kbm-home02-section,
  html.kbm-touch-mobile body.front-page .kbm-home02-section{margin:12px auto!important;}
  body.kbm-mobile-route-home .kbm-home02-head,
  html.kbm-touch-mobile body.home .kbm-home02-head,
  html.kbm-touch-mobile body.front-page .kbm-home02-head{margin-bottom:8px!important;align-items:center!important;}
  body.kbm-mobile-route-home .kbm-home02-head h2,
  html.kbm-touch-mobile body.home .kbm-home02-head h2,
  html.kbm-touch-mobile body.front-page .kbm-home02-head h2{font-size:16px!important;line-height:1.55!important;}
  body.kbm-mobile-route-home .kbm-home02-head p,
  html.kbm-touch-mobile body.home .kbm-home02-head p,
  html.kbm-touch-mobile body.front-page .kbm-home02-head p{display:none!important;}
  body.kbm-mobile-route-home .kbm-home02-catgrid,
  html.kbm-touch-mobile body.home .kbm-home02-catgrid,
  html.kbm-touch-mobile body.front-page .kbm-home02-catgrid{
    display:flex!important;
    gap:8px!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    padding:2px 2px 8px!important;
    margin:0!important;
    scroll-snap-type:x proximity!important;
    scrollbar-width:none!important;
  }
  body.kbm-mobile-route-home .kbm-home02-catgrid::-webkit-scrollbar{display:none!important;}
  body.kbm-mobile-route-home .kbm-home02-cat,
  html.kbm-touch-mobile body.home .kbm-home02-cat,
  html.kbm-touch-mobile body.front-page .kbm-home02-cat{
    flex:0 0 150px!important;
    min-height:88px!important;
    padding:10px!important;
    border-radius:16px!important;
    scroll-snap-align:start!important;
  }
  body.kbm-mobile-route-home .kbm-home02-cat small,
  html.kbm-touch-mobile body.home .kbm-home02-cat small,
  html.kbm-touch-mobile body.front-page .kbm-home02-cat small{display:none!important;}
  body.kbm-mobile-route-home .kbm-home02-grid,
  html.kbm-touch-mobile body.home .kbm-home02-grid,
  html.kbm-touch-mobile body.front-page .kbm-home02-grid{grid-template-columns:1fr!important;gap:10px!important;}
  body.kbm-mobile-route-home .kbm-home02-grid > *:nth-child(n+3),
  html.kbm-touch-mobile body.home .kbm-home02-grid > *:nth-child(n+3),
  html.kbm-touch-mobile body.front-page .kbm-home02-grid > *:nth-child(n+3){display:none!important;}

  /* Vertical hub: keep the actual choices, remove explanatory strip and oversized hero on mobile. */
  body.kbm-mobile-route-home .kbm-vhub,
  html.kbm-touch-mobile body.home .kbm-vhub,
  html.kbm-touch-mobile body.front-page .kbm-vhub{margin:12px auto!important;}
  body.kbm-mobile-route-home .kbm-vhub-hero,
  html.kbm-touch-mobile body.home .kbm-vhub-hero,
  html.kbm-touch-mobile body.front-page .kbm-vhub-hero,
  body.kbm-mobile-route-home .kbm-vhub-strip,
  html.kbm-touch-mobile body.home .kbm-vhub-strip,
  html.kbm-touch-mobile body.front-page .kbm-vhub-strip{display:none!important;}
  body.kbm-mobile-route-home .kbm-vhub-grid,
  html.kbm-touch-mobile body.home .kbm-vhub-grid,
  html.kbm-touch-mobile body.front-page .kbm-vhub-grid{display:grid!important;grid-template-columns:1fr!important;gap:10px!important;}
  body.kbm-mobile-route-home .kbm-vhub-card,
  html.kbm-touch-mobile body.home .kbm-vhub-card,
  html.kbm-touch-mobile body.front-page .kbm-vhub-card{border-radius:18px!important;}
  body.kbm-mobile-route-home .kbm-vhub-card-head,
  html.kbm-touch-mobile body.home .kbm-vhub-card-head,
  html.kbm-touch-mobile body.front-page .kbm-vhub-card-head{min-height:76px!important;padding:12px!important;display:grid!important;grid-template-columns:46px minmax(0,1fr) auto!important;gap:10px!important;align-items:center!important;}
  body.kbm-mobile-route-home .kbm-vhub-icon,
  html.kbm-touch-mobile body.home .kbm-vhub-icon,
  html.kbm-touch-mobile body.front-page .kbm-vhub-icon{width:42px!important;height:42px!important;border-radius:15px!important;font-size:24px!important;grid-column:1!important;grid-row:1/3!important;}
  body.kbm-mobile-route-home .kbm-vhub-card h3,
  html.kbm-touch-mobile body.home .kbm-vhub-card h3,
  html.kbm-touch-mobile body.front-page .kbm-vhub-card h3{font-size:16px!important;margin:0!important;line-height:1.45!important;grid-column:2!important;}
  body.kbm-mobile-route-home .kbm-vhub-count,
  html.kbm-touch-mobile body.home .kbm-vhub-count,
  html.kbm-touch-mobile body.front-page .kbm-vhub-count{font-size:10px!important;padding:3px 7px!important;grid-column:2!important;width:max-content!important;}
  body.kbm-mobile-route-home .kbm-vhub-body,
  html.kbm-touch-mobile body.home .kbm-vhub-body,
  html.kbm-touch-mobile body.front-page .kbm-vhub-body{padding:10px!important;gap:8px!important;}
  body.kbm-mobile-route-home .kbm-vhub-body p,
  html.kbm-touch-mobile body.home .kbm-vhub-body p,
  html.kbm-touch-mobile body.front-page .kbm-vhub-body p,
  body.kbm-mobile-route-home .kbm-vhub-bullets,
  html.kbm-touch-mobile body.home .kbm-vhub-bullets,
  html.kbm-touch-mobile body.front-page .kbm-vhub-bullets{display:none!important;}
  body.kbm-mobile-route-home .kbm-vhub-card-actions,
  html.kbm-touch-mobile body.home .kbm-vhub-card-actions,
  html.kbm-touch-mobile body.front-page .kbm-vhub-card-actions{display:grid!important;grid-template-columns:1fr 1fr!important;gap:8px!important;}
  body.kbm-mobile-route-home .kbm-vhub-card-actions a,
  html.kbm-touch-mobile body.home .kbm-vhub-card-actions a,
  html.kbm-touch-mobile body.front-page .kbm-vhub-card-actions a{min-height:38px!important;border-radius:13px!important;font-size:11px!important;padding:7px 8px!important;}

  /* Archive/detail pages: compact marketing heroes and hide decorative sponsor blocks; keep filters/cards/single content. */
  body.kbm-mobile-essential-body:not(.kbm-mobile-route-home) :where(.kbm-adv-global-wrap,.kbm-screen-sponsor,.kbm-home-sponsor,.kbm-vhub-sponsored,.kbm-p19-sponsored,.kbm-adv-slot){
    max-height:82px!important;
    overflow:hidden!important;
    margin-top:6px!important;
    margin-bottom:8px!important;
  }
  body.kbm-mobile-essential-body:not(.kbm-mobile-route-home) :where(.kbm-adv-global-cta,.kbm-screen-sponsor__cta){display:none!important;}
  body.kbm-mobile-essential-body :where(.kbm-p5r15-hero,.kbm-p5ui14-hero,.kbm-p5x-hero,.kbm-p20p-hero,.kbm-p20-hero,.kbm-adsv2-hero,.kbm-provider-hero,.kbm-p23-hero,.kbm-prv-hero){
    padding:14px 12px!important;
    margin:8px auto 10px!important;
    border-radius:20px!important;
    min-height:0!important;
  }
  body.kbm-mobile-essential-body :where(.kbm-p5r15-hero p,.kbm-p5ui14-hero p,.kbm-p5x-hero p,.kbm-p20p-hero p,.kbm-p20-hero p,.kbm-adsv2-hero p,.kbm-provider-hero p,.kbm-p23-hero p){
    -webkit-line-clamp:2!important;
    font-size:12px!important;
    line-height:1.8!important;
  }

  /* Static/contact/footer: app mode uses bottom nav, so footer becomes non-critical on mobile. */
  body.kbm-mobile-essential-body :where(.kbm-footer,.kbm-site-footer,.kbm-digiato-footer,footer.kbm-footer,footer.kbm-site-footer){
    display:none!important;
    height:0!important;
    overflow:hidden!important;
  }

  /* Keep bottom navigation visible but compact. */
  body.kbm-mobile-essential-body .kbm-mobile-bottom-nav,
  html.kbm-touch-mobile body .kbm-mobile-bottom-nav{
    bottom:calc(6px + env(safe-area-inset-bottom,0px))!important;
    width:min(430px,calc(100vw - 18px))!important;
    height:64px!important;
    min-height:64px!important;
    border-radius:23px!important;
  }
}
