/* PaisaNow World Phase 12 — production mobile/app shell + responsive safety. */
html,body{max-width:100%;overflow-x:hidden}
img,video,canvas,svg{max-width:100%}
.app-layout,.content,.card,.post,.composer,.feed,main,section,article{min-width:0}
input,textarea,select,button{max-width:100%;box-sizing:border-box}

/* Hashtags are suggestions, not pill buttons. Keep them readable and non-overlapping. */
body[data-page="home"] .pn-inline-hashtag-suggest{display:flex!important;align-items:flex-start!important;gap:7px!important;min-width:0!important;padding:6px 0 9px!important;margin:0 0 8px!important;border-bottom:1px solid #eef2f6!important;overflow:hidden!important}
body[data-page="home"] .pn-inline-hashtag-suggest>span{flex:0 0 auto!important;font-size:11px!important;line-height:22px!important;color:#64748b!important;white-space:nowrap!important}
body[data-page="home"] .pn-inline-hashtag-suggest>div{display:flex!important;flex:1 1 auto!important;flex-wrap:wrap!important;gap:3px 10px!important;min-width:0!important;overflow:visible!important}
body[data-page="home"] .pn-inline-hashtag-suggest button{display:inline!important;width:auto!important;min-width:0!important;max-width:100%!important;min-height:0!important;margin:0!important;padding:2px 0!important;border:0!important;border-radius:0!important;background:transparent!important;box-shadow:none!important;color:#1769e0!important;font-size:12px!important;font-weight:800!important;line-height:1.45!important;white-space:normal!important;overflow-wrap:anywhere!important;text-align:left!important}
body[data-page="home"] .pn-inline-hashtag-suggest button:hover{text-decoration:underline!important;background:transparent!important}
body[data-page="home"] .pn-inline-hashtag-suggest button.is-used{opacity:.42!important;text-decoration:none!important}

/* Reels: compact action labels; no overflow on small screens. */
body[data-page="reels"] .fb-reel-actions{right:max(8px,env(safe-area-inset-right,0px))!important;left:auto!important;width:58px!important;gap:10px!important}
body[data-page="reels"] .fb-reel-actions .fb-reel-action,
body[data-page="reels"] .fb-reel-actions .fb-reel-view{width:52px!important;min-width:52px!important;max-width:52px!important;min-height:50px!important;padding:3px 1px!important;overflow:hidden!important}
body[data-page="reels"] .fb-reel-actions .fb-reel-action b,
body[data-page="reels"] .fb-reel-actions .fb-reel-view b{display:block!important;width:50px!important;max-width:50px!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;text-align:center!important;font-size:9px!important;line-height:1.1!important}
body[data-page="reels"] .fb-reel-info{left:12px!important;right:76px!important;min-width:0!important;padding-left:0!important;padding-right:0!important}
body[data-page="reels"] .fb-reel-user{min-width:0!important;max-width:100%!important}
body[data-page="reels"] .fb-reel-user>span{min-width:0!important;max-width:calc(100% - 52px)!important}
body[data-page="reels"] .fb-reel-user strong,body[data-page="reels"] .fb-reel-user small,body[data-page="reels"] .fb-reel-caption,body[data-page="reels"] .fb-reel-music span{max-width:100%!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important}

/* Faster mobile menu: transform-only animation, no expensive blur during open. */
@media(max-width:800px){
  body[data-user-id]:not([data-user-id="0"]){width:100%!important;max-width:100%!important}
  .app-layout{width:100%!important;max-width:100%!important;margin-left:0!important;margin-right:0!important;gap:0!important}
  .content{width:100%!important;max-width:100%!important;padding-left:10px!important;padding-right:10px!important;overflow-x:hidden!important}
  .card,.post,.composer,.page-heading,.feed>*{max-width:100%!important;box-sizing:border-box!important}
  .table-scroll,.pn-responsive-table,.chat-shell,.marketplace-grid,.jobs-grid,.product-grid{max-width:100%!important;overflow-x:auto!important}
  button,.button,a.button{overflow-wrap:anywhere}

  /* Mobile header: one compact row — logo, search, create and profile. */
  .topbar.user-header:not(.guest-header){display:flex!important;flex-wrap:nowrap!important;align-items:center!important;width:100%!important;height:58px!important;min-height:58px!important;padding:6px 8px!important;gap:6px!important;overflow:visible!important;background:#fff!important}
  .topbar.user-header:not(.guest-header)>.brand{display:flex!important;flex:0 0 36px!important;width:36px!important;min-width:36px!important;max-width:36px!important;margin:0!important;overflow:hidden!important}
  .topbar.user-header:not(.guest-header)>.brand .brand-copy,.topbar.user-header:not(.guest-header)>.brand .production-label{display:none!important}
  .topbar.user-header:not(.guest-header)>.brand .site-logo,.topbar.user-header:not(.guest-header)>.brand .brand-mark{width:36px!important;height:36px!important;min-width:36px!important;max-width:36px!important;border-radius:10px!important;object-fit:contain!important}
  .topbar.user-header:not(.guest-header)>.desktop-primary-nav,.topbar.user-header:not(.guest-header)>.top-actions{display:none!important}
  .topbar.user-header:not(.guest-header)>.global-search{display:flex!important;position:relative!important;align-items:center!important;flex:1 1 0!important;width:auto!important;max-width:none!important;min-width:0!important;height:38px!important;margin:0!important;padding:0!important;background:transparent!important}
  .topbar.user-header:not(.guest-header)>.global-search>i{position:absolute!important;left:11px!important;top:50%!important;transform:translateY(-50%)!important;width:auto!important;height:auto!important;z-index:2!important;color:#64748b!important;font-size:13px!important}
  .topbar.user-header:not(.guest-header)>.global-search>input[name="q"]{position:static!important;display:block!important;width:100%!important;min-width:0!important;max-width:100%!important;height:38px!important;opacity:1!important;pointer-events:auto!important;padding:0 10px 0 34px!important;border:1px solid #e2e8f0!important;border-radius:12px!important;background:#f5f7fb!important;font-size:16px!important;line-height:38px!important;box-sizing:border-box!important}
  .topbar.user-header:not(.guest-header)>.global-search .search-results{top:42px!important;left:0!important;right:0!important;width:100%!important;max-height:55vh!important;overflow:auto!important}
  .topbar.user-header>.mobile-header-actions.pn-mobile-header-v12{position:static!important;display:flex!important;flex:0 0 76px!important;width:76px!important;min-width:76px!important;max-width:76px!important;height:40px!important;gap:4px!important;align-items:center!important;justify-content:flex-end!important;margin:0!important;transform:none!important}
  .topbar.user-header>.mobile-header-actions.pn-mobile-header-v12 .mobile-header-shortcut{display:grid!important;place-items:center!important;flex:0 0 34px!important;width:34px!important;height:34px!important;min-width:34px!important;max-width:34px!important;padding:0!important;margin:0!important;border:1px solid #e2e8f0!important;border-radius:11px!important;background:#f8fafc!important;color:#334155!important;overflow:hidden!important}
  .topbar.user-header>.mobile-header-actions.pn-mobile-header-v12 .shortcut-create{background:linear-gradient(145deg,#1769e0,#0ea5e9)!important;color:#fff!important;border-color:transparent!important}
  .topbar.user-header>.mobile-header-actions.pn-mobile-header-v12 .shortcut-profile{width:36px!important;height:36px!important;min-width:36px!important;max-width:36px!important;border-radius:50%!important;padding:1px!important;background:#fff!important}
  .pn-mobile-header-avatar,.pn-mobile-header-avatar img{display:block!important;width:32px!important;height:32px!important;min-width:32px!important;max-width:32px!important;border-radius:50%!important;object-fit:cover!important}
  body:not([data-page="chat"]):not([data-page="reels"]):not(.mobile-menu-open):not(.pn-modal-open):not(.pn26-modal-open):not(.pn-media-viewer-open):not(.story-viewer-open):not(.composer-open):not(.create-hub-open){height:auto!important;min-height:100%!important;overflow-y:auto!important;-webkit-overflow-scrolling:touch!important}
  input[type="text"],input[type="search"],input[type="email"],input[type="tel"],input[type="url"],input[type="password"],input[type="number"],textarea,select{font-size:16px!important}

  .mobile-menu-sheet:not([hidden]){display:flex!important;position:fixed!important;inset:0!important;align-items:flex-end!important;padding:0!important;background:rgba(15,23,42,.42)!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important;z-index:99999!important;touch-action:manipulation!important}
  .mobile-menu-sheet>div{width:100%!important;max-width:100%!important;max-height:min(84dvh,720px)!important;overflow:auto!important;overscroll-behavior:contain!important;border-radius:20px 20px 0 0!important;padding:12px 10px calc(16px + env(safe-area-inset-bottom,0px))!important;transform:translate3d(0,0,0)!important;contain:layout paint!important}
  .mobile-category-menu{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:7px!important}
  .mobile-category-menu a,.mobile-category-menu button{min-width:0!important;min-height:44px!important;contain:content!important}

  /* Story controls get reliable tap targets and viewport-safe sheet. */
  .stories .story,.stories .add-story,[data-story-group],[data-toggle="#story-form"]{touch-action:manipulation!important}
  body[data-page="home"] #story-form.pn-story-quick.open{z-index:100000!important;width:100%!important;max-width:100%!important;height:100dvh!important;max-height:100dvh!important;overscroll-behavior:contain!important}

  /* Avoid classic mobile "stretched page" from long labels/data. */
  .post-body,.rich-content,.notification-card,.settings-card,.admin-card,.business-card,.service-card,.stay-card{overflow-wrap:anywhere!important;word-break:break-word!important}
}

/* Installed PWA should feel like an app and respect notches/home indicator. */
body.pn-pwa-standalone{overscroll-behavior-y:none;-webkit-tap-highlight-color:transparent}
body.pn-pwa-standalone .topbar.user-header{padding-top:max(6px,env(safe-area-inset-top,0px))!important}
body.pn-pwa-standalone .bottom-nav{padding-bottom:max(5px,env(safe-area-inset-bottom,0px))!important}
body.pn-pwa-standalone a,body.pn-pwa-standalone button{touch-action:manipulation}

/* Final action feedback for AJAX post/PWA operations. */
.pn12-final-feedback{position:fixed;left:50%;bottom:calc(82px + env(safe-area-inset-bottom,0px));transform:translateX(-50%);z-index:120000;max-width:min(92vw,520px);padding:11px 15px;border-radius:13px;background:#ecfdf3;color:#067647;border:1px solid #abefc6;box-shadow:0 12px 35px rgba(15,23,42,.14);font-size:13px;font-weight:800;text-align:center}
.pn12-final-feedback.error{background:#fff1f3;color:#c01048;border-color:#fecdd6}
.pn12-final-feedback[hidden]{display:none!important}

/* Composer previews support the same media/file types the backend accepts. */
#qbPreview{display:flex;flex-wrap:wrap;gap:8px;min-width:0;max-width:100%;overflow:hidden}
#qbPreview>img,#qbPreview>video{display:block;max-width:100%;max-height:260px;border-radius:12px;object-fit:cover}
#qbPreview>audio{width:100%;max-width:100%}
#qbPreview .pn-file-preview-row{display:flex;align-items:center;gap:8px;min-width:0;max-width:100%;padding:9px 11px;border:1px solid #e2e8f0;border-radius:11px;background:#f8fafc;color:#334155}
#qbPreview .pn-file-preview-row span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* PWA nudge stays above the mobile navigation and never stretches the viewport. */
.pwa-footer-banner{max-width:min(94vw,620px)!important;box-sizing:border-box!important}
@media(max-width:800px){
  .pwa-footer-banner{left:8px!important;right:8px!important;bottom:calc(70px + env(safe-area-inset-bottom,0px))!important;width:auto!important;max-width:none!important;display:grid;grid-template-columns:42px minmax(0,1fr) auto auto;gap:8px;align-items:center}
  .pwa-footer-banner[hidden]{display:none!important}
  .pwa-footer-text{min-width:0!important}.pwa-footer-text strong,.pwa-footer-text span{display:block;overflow:hidden;text-overflow:ellipsis}.pwa-footer-text span{white-space:normal;overflow-wrap:anywhere}
  .pwa-install-btn{white-space:nowrap!important;min-width:auto!important}
  body.pn-pwa-standalone .pwa-footer-banner{display:none!important}
  /* Lower-cost footer rendering on phones: keep it responsive on budget devices. */
  .bottom-nav.pn-mobile-footer-v11{backdrop-filter:none!important;-webkit-backdrop-filter:none!important;background:#fff!important;will-change:transform}
}
@media(max-width:800px){
  body[data-page="reels"] .fb-reels-page,
  body[data-page="reels"] .fb-reel-card,
  body[data-page="reels"] .fb-reel-inner,
  body[data-page="reels"] .fb-reel-video{width:100%!important;max-width:100%!important;min-width:0!important}
}


/* LIVE-FIX-12: single-finger mobile scrolling and low-latency touch controls. */
@media(max-width:800px){
  body:not([data-page="chat"]):not([data-page="reels"]){touch-action:pan-y!important;-ms-touch-action:pan-y!important;overscroll-behavior-y:auto!important}
  body:not([data-page="chat"]):not([data-page="reels"]) #pn-main-content,
  body:not([data-page="chat"]):not([data-page="reels"]) .content,
  body:not([data-page="chat"]):not([data-page="reels"]) main{touch-action:pan-y!important;-webkit-overflow-scrolling:touch!important}
  body.pn-modal-open,body.call-history-lock{touch-action:pan-y!important}
  a,button,[role="button"],input[type="button"],input[type="submit"],label[for],summary{touch-action:manipulation!important;-ms-touch-action:manipulation!important;-webkit-tap-highlight-color:transparent!important}
  .mobile-menu-sheet>div,.search-results,.table-scroll,.pn-responsive-table,[role="dialog"]{ -webkit-overflow-scrolling:touch!important }
}

/* PaisaNow Story Studio V2 — 2026-08-11
   Single responsive upload dialog for Home/Profile. Dedicated controller owns open/close. */
body.story-studio-open{overflow:hidden!important}
html body form[data-story-studio]{display:none!important}
html body form[data-story-studio].open,
html body form[data-story-studio].active{display:flex!important}
html body form[data-story-studio] .pn-story-close::before{content:none!important;display:none!important}
html body form[data-story-studio] .pn-story-close{
  color:#172033!important;font-size:16px!important;line-height:1!important;
  display:grid!important;place-items:center!important;touch-action:manipulation!important
}
html body form[data-story-studio] .pn-story-close i{display:block!important;font-size:17px!important;line-height:1!important;color:inherit!important}

html body[data-page="home"] form#story-form.pn-story-studio.open,
html body[data-page="home"] form#story-form.pn-story-studio.active,
html body[data-page="profile"] form#profile-story-form.pn-story-studio.open,
html body[data-page="profile"] form#profile-story-form.pn-story-studio.active{
  position:fixed!important;inset:0!important;z-index:2147483200!important;
  width:100vw!important;height:100dvh!important;max-width:none!important;max-height:none!important;
  margin:0!important;padding:18px!important;border:0!important;border-radius:0!important;
  align-items:center!important;justify-content:center!important;overflow:hidden!important;
  background:rgba(15,23,42,.58)!important;backdrop-filter:blur(5px)!important;
  -webkit-backdrop-filter:blur(5px)!important;touch-action:manipulation!important
}
html body[data-page="home"] form#story-form>.pn-story-dialog-card,
html body[data-page="profile"] form#profile-story-form>.pn-story-dialog-card{
  width:min(620px,100%)!important;max-width:620px!important;max-height:calc(100dvh - 36px)!important;
  min-height:0!important;display:flex!important;flex-direction:column!important;overflow:hidden!important;
  border:1px solid #dce5ef!important;border-radius:20px!important;background:#fff!important;
  box-shadow:0 28px 80px rgba(15,23,42,.34)!important;color:#172033!important
}
html body form[data-story-studio] .pn-story-studio-head{
  position:relative!important;top:auto!important;flex:0 0 auto!important;display:flex!important;
  align-items:center!important;justify-content:flex-start!important;gap:10px!important;
  min-height:62px!important;margin:0!important;padding:10px 58px 10px 16px!important;
  border-bottom:1px solid #e5e7eb!important;background:#fff!important
}
html body form[data-story-studio] .pn-story-studio-head>div{min-width:0!important;text-align:left!important}
html body form[data-story-studio] .pn-story-studio-head h2{margin:2px 0!important;font-size:19px!important;line-height:1.2!important;color:#172033!important}
html body form[data-story-studio] .pn-story-studio-head p{margin:0!important;font-size:11px!important;color:#64748b!important}
html body form[data-story-studio] .pn-story-live{margin-left:auto!important;flex:0 0 auto!important}
html body form[data-story-studio] .pn-story-close{
  position:absolute!important;right:12px!important;left:auto!important;top:50%!important;transform:translateY(-50%)!important;
  width:36px!important;height:36px!important;min-width:36px!important;margin:0!important;border:0!important;border-radius:50%!important;
  background:#eef2f7!important
}
html body form[data-story-studio] .pn-story-dialog-scroll{
  flex:1 1 auto!important;min-height:0!important;overflow-y:auto!important;overflow-x:hidden!important;
  -webkit-overflow-scrolling:touch!important;overscroll-behavior:contain!important;touch-action:pan-y!important;
  padding:14px 16px 4px!important;background:#fff!important
}
html body form[data-story-studio] .pn-story-dialog-scroll>*{margin-top:0!important;margin-bottom:12px!important}
html body form[data-story-studio] .pn-story-kind-tabs{display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr))!important;gap:7px!important;overflow:visible!important}
html body form[data-story-studio] .pn-story-kind-tabs label{min-width:0!important;min-height:54px!important;padding:7px 4px!important;border-radius:12px!important;touch-action:manipulation!important}
html body form[data-story-studio] .pn-story-kind-tabs label span{font-size:10px!important}
html body form[data-story-studio] .editor-preview{min-height:138px!important;max-height:220px!important;margin-bottom:12px!important}
html body form[data-story-studio] .pn-story-more,
html body form[data-story-studio] .pn-story-more[open]{max-height:none!important;overflow:visible!important;margin-bottom:10px!important}
html body form[data-story-studio] .pn-story-publish{
  position:static!important;inset:auto!important;float:none!important;flex:0 0 auto!important;
  width:calc(100% - 32px)!important;min-height:48px!important;height:48px!important;
  margin:10px 16px 14px!important;padding:0 16px!important;border-radius:12px!important;transform:none!important
}

@media(max-width:640px){
  html body[data-page="home"] form#story-form.pn-story-studio.open,
  html body[data-page="home"] form#story-form.pn-story-studio.active,
  html body[data-page="profile"] form#profile-story-form.pn-story-studio.open,
  html body[data-page="profile"] form#profile-story-form.pn-story-studio.active{
    padding:0!important;align-items:stretch!important;justify-content:stretch!important;background:#fff!important;
    backdrop-filter:none!important;-webkit-backdrop-filter:none!important
  }
  html body[data-page="home"] form#story-form>.pn-story-dialog-card,
  html body[data-page="profile"] form#profile-story-form>.pn-story-dialog-card{
    width:100%!important;max-width:none!important;height:100dvh!important;max-height:100dvh!important;
    border:0!important;border-radius:0!important;box-shadow:none!important
  }
  html body form[data-story-studio] .pn-story-studio-head{
    min-height:calc(56px + env(safe-area-inset-top))!important;
    padding:calc(7px + env(safe-area-inset-top)) 54px 7px 12px!important
  }
  html body form[data-story-studio] .pn-story-studio-head .eyebrow,
  html body form[data-story-studio] .pn-story-studio-head p,
  html body form[data-story-studio] .pn-story-live{display:none!important}
  html body form[data-story-studio] .pn-story-close{right:10px!important;top:calc(50% + env(safe-area-inset-top)/2)!important}
  html body form[data-story-studio] .pn-story-dialog-scroll{padding:10px 12px max(6px,env(safe-area-inset-bottom))!important}
  html body form[data-story-studio] .pn-story-kind-tabs{display:flex!important;gap:6px!important;overflow-x:auto!important;scrollbar-width:none!important;scroll-snap-type:x proximity!important}
  html body form[data-story-studio] .pn-story-kind-tabs::-webkit-scrollbar{display:none!important}
  html body form[data-story-studio] .pn-story-kind-tabs label{flex:0 0 68px!important;min-height:50px!important;scroll-snap-align:start!important}
  html body form[data-story-studio] .pn-story-kind-tabs label span{display:block!important;font-size:9px!important}
  html body form[data-story-studio] .editor-preview{min-height:116px!important;max-height:170px!important}
  html body form[data-story-studio] textarea{min-height:72px!important;max-height:96px!important}
  html body form[data-story-studio] .pn-story-publish{width:calc(100% - 24px)!important;margin:8px 12px max(10px,env(safe-area-inset-bottom))!important;min-height:48px!important}
}
/* Story V2 close-icon contract: outrank older Home inline back-arrow rule. */
html body[data-page="home"] form#story-form[data-story-studio] .pn-story-close::before,
html body[data-page="profile"] form#profile-story-form[data-story-studio] .pn-story-close::before{content:none!important;display:none!important}
html body[data-page="home"] form#story-form[data-story-studio] .pn-story-close,
html body[data-page="profile"] form#profile-story-form[data-story-studio] .pn-story-close{
  color:#172033!important;font-size:16px!important;line-height:1!important;
  display:grid!important;place-items:center!important;background:#eef2f7!important
}
html body[data-page="home"] form#story-form[data-story-studio] .pn-story-close i,
html body[data-page="profile"] form#profile-story-form[data-story-studio] .pn-story-close i{display:block!important;font-size:17px!important;color:#172033!important}


/* 2026-08-11 composer + desktop wheel-scroll correction.
   Desktop uses the document as the primary vertical scroller; sidebars may remain
   independently scrollable only when the pointer is directly over them. */
@media(min-width:801px){
  html{height:auto!important;min-height:100%!important;overflow-x:hidden!important;overflow-y:auto!important}
  body:not([data-page="chat"]):not([data-page="reels"]){height:auto!important;min-height:100vh!important;overflow-x:hidden!important;overflow-y:auto!important}
  body:not([data-page="chat"]):not([data-page="reels"]) .app-layout{height:auto!important;min-height:calc(100vh - 94px)!important;overflow:visible!important;align-items:start!important}
  body:not([data-page="chat"]):not([data-page="reels"]) .app-layout>.content,
  body:not([data-page="chat"]):not([data-page="reels"]) .content{max-height:none!important;height:auto!important;overflow-y:visible!important;overscroll-behavior-y:auto!important}
  body:not([data-page="chat"]):not([data-page="reels"]) .left-sidebar,
  body:not([data-page="chat"]):not([data-page="reels"]) .right-sidebar{position:sticky!important;top:82px!important;max-height:calc(100vh - 96px)!important;overflow-y:auto!important;overscroll-behavior:contain!important}
}
