/* Mobile guard (loaded last): nothing may be wider than the screen, so phones never zoom out or scroll sideways. */
html, body { max-width: 100%; overflow-x: hidden; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
img, svg, video, canvas, iframe { max-width: 100%; }
.app-shell, main, .page-section, .login-card { min-width: 0; max-width: 100%; }
input, select, textarea, button { max-width: 100%; }
table { max-width: 100%; }
[class*="table-wrap"], .table-wrap, .admin-table-wrap, .report-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
h1, h2, h3, p, td, th, label, small, span { overflow-wrap: anywhere; }
.bottom-nav { overflow: hidden; padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }

@media (max-width: 640px) {
  /* bottom bar: every item shares the width instead of each keeping its own padding (that pushed the page wider) */
  .bottom-nav { gap: 0; justify-content: stretch; }
  .nav-item { flex: 1 1 0; min-width: 0; padding: 8px 2px; font-size: 9.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar { padding-left: 12px; padding-right: 12px; gap: 8px; }
  .topbar-actions { gap: 10px; min-width: 0; }
  .brand { min-width: 0; font-size: 18px; }
  main { padding-left: 14px; padding-right: 14px; }
  .welcome-row, .form-header, .page-heading, .admin-page-heading { flex-direction: column; align-items: flex-start; gap: 10px; }
  .welcome-row h1, .form-header h1, .page-heading h1, .admin-page-heading h1 { font-size: 26px; }
  .admin-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-grid { grid-template-columns: minmax(0, 1fr); }
  .login-overlay { padding: 12px; }
  .login-card { width: 100%; padding: 26px 18px; }
}
