/* ZMG Dashboard — phone layout rules.
   Loaded last from index.html. Every rule sits inside a phone-width media query,
   so the desktop layout and the Salesforce embed at normal widths are unchanged.
   !important is used only where the app's own (runtime-injected) styles would
   otherwise win. */

@media (max-width: 760px) {
  /* Never let the whole page slide sideways. Wide tables keep their own
     scroll boxes (.prscroll, .dt wrappers) and still scroll inside them. */
  html, body { overflow-x: clip; max-width: 100%; }

  /* Grid and flex children may shrink below their content width, so one long
     name (e.g. a RedZone candidate with a full street address) truncates
     instead of stretching its card past the screen edge. */
  .card, .lpcard, [class*="grid"] > *, .g2 > *, .g3 > *, .g4 > * { min-width: 0 !important; }
  .lpcard .lprow, .lprow { min-width: 0; }
  .lpcard .lpnm, .lpnm { min-width: 0; flex: 1 1 auto; }

  /* Media never wider than the screen. */
  img, canvas, video, iframe { max-width: 100%; }

  /* 16px text in boxes stops iPhone Safari from zooming in when a box is tapped. */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  select,
  textarea { font-size: 16px !important; }

  /* Bigger tap targets for buttons, pills and boxes. */
  button, .btn, .addbtn, select,
  input[type="text"], input[type="search"], input[type="date"], input[type="email"], input[type="tel"], input[type="number"] {
    min-height: 38px;
  }
  input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }

  /* Pop-up windows (drill-downs, recaps, ZinPoint): use the whole phone width,
     keep the header with the Close button reachable, and scroll inside. */
  #modal .panel {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - 24px) !important;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  #modal .mhead { position: sticky; top: 0; z-index: 2; background: inherit; flex-wrap: wrap; gap: 8px; }

  /* Room for the iPhone home bar when opened from the home screen. */
  body { padding-bottom: env(safe-area-inset-bottom); }
}
