.pj-language-nav {
  /* Stay outside React's managed #root so route re-renders cannot remove it. */
  position: fixed !important;
  top: max(16px, env(safe-area-inset-top)) !important;
  /* Leave the profile/logout cluster clear; this is the empty header area
     shown in the desktop layout. */
  right: clamp(12rem, 16vw, 20rem) !important;
  z-index: 1000 !important;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  width: auto;
  min-height: 0;
  box-sizing: border-box;
  flex-shrink: 0;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  color: #fff;
  background: rgba(11, 29, 36, 0.88);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  backdrop-filter: blur(24px) saturate(150%);
  transform: translateZ(0);
  font-family: Inter, "Noto Sans Bengali", "Hind Siliguri", system-ui, sans-serif;
}

.pj-language-nav[hidden] { display: none !important; }

/* Keep the application header present while the dashboard content scrolls.
   The language control is fixed to this same top-header band. */
#root .top-glass {
  position: fixed !important;
  top: 0;
  left: 18rem;
  right: 0;
  z-index: 900 !important;
}

#root .top-glass + .mobile-app-main {
  padding-top: 5rem;
}

/* The guest portal owns a normal sticky header. Keep the authenticated
   desktop shell override above from turning that header into an overlay. */
#root .top-glass:has(+ main) {
  position: sticky !important;
  left: auto !important;
  right: auto !important;
  width: auto !important;
  z-index: 20 !important;
}

@media (max-width: 1023px) {
  #root .top-glass {
    left: 0;
  }
}

@media (max-width: 1023px) {
  /* Guest Portal itself must remain a single-column mobile layout. */
  #root .top-glass:has(+ main) + main {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  /* Keep the four Guest Portal summary cards on one row on mobile. */
  #root .top-glass:has(+ main) + main > section:has(> .dashboard-stat-card) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .4rem;
  }
  #root .top-glass:has(+ main) + main > section:has(> .dashboard-stat-card) > .dashboard-stat-card {
    padding: .55rem .4rem;
  }
  #root .top-glass:has(+ main) + main > section:has(> .dashboard-stat-card) > .dashboard-stat-card p:first-child {
    font-size: .5rem;
    letter-spacing: .03em;
  }
  #root .top-glass:has(+ main) + main > section:has(> .dashboard-stat-card) > .dashboard-stat-card p:last-child {
    font-size: .75rem;
  }
}

/* Use a clean, locally available Bengali UI face on the authenticated Bangla page. */
html[lang="bn"] body,
html[lang="bn"] button,
html[lang="bn"] input,
html[lang="bn"] select,
html[lang="bn"] textarea {
  font-family: "Nirmala UI", "Nirmala Text", "SolaimanLipi", sans-serif;
}

html[lang="bn"] h1,
html[lang="bn"] h2,
html[lang="bn"] h3,
html[lang="bn"] h4,
html[lang="bn"] h5,
html[lang="bn"] h6 {
  font-family: "Nirmala UI", "Nirmala Text", "SolaimanLipi", sans-serif !important;
  letter-spacing: 0;
}

.pj-language-nav a {
  min-width: 56px;
  min-height: 32px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
}

.pj-language-nav a:hover { color: #fff; border-color: rgba(255, 255, 255, 0.55); background: rgba(255, 255, 255, 0.1); }
.pj-language-nav a:focus-visible { outline: 2px solid #fbbf24; outline-offset: 2px; }
.pj-language-nav a[aria-current="page"] { color: #073b35; border-color: #5eead4; background: #5eead4; }

@media (max-width: 640px) {
  .pj-language-nav {
    top: max(12px, env(safe-area-inset-top)) !important;
    right: max(8rem, env(safe-area-inset-right)) !important;
  }
  .pj-language-nav a { min-width: 54px; padding-inline: 9px; }
}

@media print { .pj-language-nav { display: none !important; } }
