
/* admin: usable at phone width */
@media (max-width: 900px) {
  .sidebar {
    width: 262px !important;
    left: -262px !important;
    transform: none !important;
    transition: left .25s ease;
    box-shadow: 0 10px 40px rgba(0,0,0,.35);
  }
  body.pnav-open .sidebar { left: 0 !important; }
  /* the user dashboard slides with .open, not body.pnav-open — portal_mobile
     forced transform:none, so the base translate rules no longer apply */
  .sidebar.open { left: 0 !important; }
  .sidebar { z-index: 100; }
  body.pnav-open::after { content: ""; position: fixed; inset: 0; background: rgba(6,42,71,.45); z-index: 90; }
  .main { margin-left: 0 !important; width: 100% !important; max-width: 100vw; overflow-x: hidden; padding: 14px !important; }
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 12px !important; }
  .topbar-date { font-size: 12px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 720px; }
  .sidebar-link { justify-content: flex-start !important; gap: 12px; padding-left: 16px !important; }
  .sidebar-link span { display: inline !important; }
  .sidebar .logo-text, .sidebar .logo-sub { display: block !important; }
  .sidebar .sidebar-nav { overflow-y: auto; }
  .pnav-toggle {
    position: fixed; left: 12px; bottom: 16px; z-index: 95;
    width: 46px; height: 46px; border-radius: 50%; border: 0;
    background: #0A3D62; color: #fff; font-size: 18px;
    box-shadow: 0 8px 22px rgba(0,0,0,.28); cursor: pointer;
  }
  .stat-grid, .stats-grid, .pattention { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
}
@media (min-width: 901px) { .pnav-toggle { display: none; } }

/* user dashboard: phone layout hardening */
@media (max-width: 900px) {
  .main-content { padding-bottom: 92px !important; }
  .main-content .topbar { flex-wrap: nowrap !important; gap: 8px !important; padding: 8px 12px !important; overflow: hidden; }
  .topbar-user { min-width: 0; flex: 1 1 auto; justify-content: flex-end; }
  .topbar-user .user-meta { min-width: 0; text-align: right; }
  .topbar-user .user-meta > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-title { flex: 0 0 auto; }
  .topbar-actions { flex: 0 0 auto; }
  .welcome-banner { padding: 22px 18px !important; }
  .wb-amount { font-size: 34px !important; }
  .stat-card { padding: 16px !important; }
  .quick-actions, .qa-grid { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
  .fx-strip { gap: 14px; }
  /* keep the translate pill off the bottom nav */
  #ctgmc_lang_widget { bottom: 84px !important; }
  .mobile-bottom-nav { padding-bottom: max(6px, env(safe-area-inset-bottom)); }
}


/* very narrow phones: drop the name/account block, keep the avatar */
@media (max-width: 430px) {
  .main-content .topbar { padding-right: 14px !important; }
  .topbar-user .user-meta { display: none !important; }
  .topbar-search { display: none !important; }
}
