/* Oct 28, 2026: every page fits a phone screen.
   The usual cause of pages wider than the phone: a grid column ("1fr") grows to the width of
   the widest thing inside it — a long table, a long dropdown option — and pushes the whole
   card off the screen. Columns may now shrink, tables scroll inside their own box, and
   two-column forms become one column on phones. */
/* Oct 28, 2026: anything marked hidden stays hidden (some cards set display:flex, which beat it) */
[hidden]{display:none !important}

@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4, .theme-grid, .company-vehicles-layout, .quotes-phase5-grid,
  .quote-form-grid, .dashboard-grid, .payment-grid { grid-template-columns: minmax(0, 1fr); }
  .grid > *, .company-vehicles-layout > *, .quote-form-grid > *, .quote-main-stack, .quote-sidebar-stack,
  .quote-main-stack > *, .quote-sidebar-stack > *, .card, .section-header > * { min-width: 0; }
  .card { max-width: 100%; }
  .section-header > div { max-width: 100%; overflow-wrap: anywhere; }
}
@media (max-width: 640px) {
  /* forms: one field per row (labels and boxes were squeezed off the right edge) */
  form.grid.grid-2, form.grid.grid-3, form .grid.grid-2, form .grid.grid-3, form .grid.grid-4,
  .card > .grid.grid-2:not(.keep-2), .card > .grid.grid-3:not(.keep-2) { grid-template-columns: minmax(0, 1fr) !important; }
  input, select, textarea { max-width: 100%; min-width: 0; box-sizing: border-box; }
  .card table:not(.keep-wide) { max-width: 100%; }
  .table-wrap, .responsive-table, .sa-table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .btnrow { flex-wrap: wrap; }
  .btnrow > .btn, .btnrow > a.btn, .btnrow > button { max-width: 100%; }
  .vehicle-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vehicle-detail-grid > div { overflow-wrap: anywhere; }
  h1, h2, h3 { overflow-wrap: anywhere; }
  img, video, canvas, iframe { max-width: 100%; }
  pre, code { white-space: pre-wrap; overflow-wrap: anywhere; }
  .pr-tabs { flex-wrap: wrap; }
  /* the phone's bottom bar never wider than the phone */
  :root[data-theme] .mobile-quickbar { max-width: 100vw; box-sizing: border-box; overflow: hidden; }
  :root[data-theme] .mobile-quickbar-link { min-width: 0; flex: 1 1 0; }
}
@media (max-width: 900px) {
  /* caller pop-up and "Ring me in the app" sit above the phone's bottom bar, not on it */
  #agtCallPop { bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important; right: 10px !important; width: calc(100% - 20px) !important; }
}

/* Oct 29, 2026: the caller pop-up / "Ring me in the app" button never blocks the page.
   Its empty area lets taps through, and while a pop-up window is open (Notify customer, Send,
   etc.) it moves to the top so the window's Send button can be tapped. */
#agtCallPop { pointer-events: none; }
#agtCallPop > * { pointer-events: auto; }
body.agt-overlay-open #agtCallPop { top: calc(64px + env(safe-area-inset-top, 0px)) !important; bottom: auto !important; }
body.agt-overlay-open #agtCallPop > button[data-act="app"] { display: none !important; }
