/* responsive.css — shared mobile / tablet foundation.  (v2, 26 Nov 2026)
   Scoped inside @media so the desktop layout is NOT changed. Loaded last so it can override. */

/* ---- global: media never exceeds the screen ---- */
img, svg, video, canvas, iframe { max-width: 100%; }
input, select, textarea { max-width: 100%; }

/* ======================= TABLET and below (<=1024px) ======================= */
@media (max-width: 1024px) {
  .container { max-width: 100%; border-radius: 0; }
  .form-section { padding: 18px 16px; }
  .dsh-grid2, .dsh-grid3 { grid-template-columns: 1fr !important; }
}

/* ======================= PHONES (<=600px) ======================= */
@media (max-width: 600px) {
  /* nothing may be wider than the screen */
  html, body { max-width: 100%; overflow-x: hidden; }
  .container { width: 100%; max-width: 100%; border-radius: 0; box-shadow: none; }
  .form-section { padding: 14px 12px; margin-bottom: 16px; border-radius: 12px; max-width: 100%; }
  h1 { font-size: 1.3em; } h2 { font-size: 1.12em; } h3 { font-size: 1em; }

  /* every multi-column grid collapses to ONE column */
  .form-grid, .dsh-kpis, .dsh-grid2, .dsh-grid3, .dsh-fu, .vs-grid, .pv-form .form-grid {
    grid-template-columns: 1fr !important; gap: 12px; min-width: 0;
  }
  /* inline 2-column grids (Risk calculators, Syndrome Finder, etc.) collapse to one column */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:repeat(2"],
  [style*="grid-template-columns: repeat(2"] { grid-template-columns: 1fr !important; }
  .form-group { min-width: 0; }

  /* form fields always fit inside their box (not checkboxes/radios) */
  .form-group input:not([type="checkbox"]):not([type="radio"]),
  .form-group select, .form-group textarea { width: 100%; max-width: 100%; }

  /* the app header must stack, not force the page wider */
  .header > div { flex-wrap: wrap; }
  .header [style*="min-width:220px"], .header [style*="min-width: 220px"] { min-width: 0 !important; }

  /* nav tabs WRAP (don't use overflow here — it would clip the dropdown menus) */
  .nav-tabs { flex-wrap: wrap; overflow: visible; }
  .nav-tab { padding: 9px 11px; font-size: .78em; min-width: 72px; }
  /* dropdown menus (Clinical Analytics / Patient Work-Up) must fit the screen and not be clipped */
  .nav-workup-wrap { position: relative; }
  .nav-workup-menu { min-width: 190px; max-width: 92vw; }

  /* data tables scroll sideways inside their own box */
  table { display: block; width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* comfortable touch targets; 16px inputs stop iOS auto-zoom on focus */
  .btn { padding: 12px 16px; font-size: .95em; }
  .form-group input, .form-group select, .form-group textarea,
  input[type="text"], input[type="number"], input[type="date"], input[type="tel"], input[type="email"], select, textarea { font-size: 16px; }

  /* the two-pane Visit Log must not force horizontal scroll on phones */
  .vs-col-brief, .vs-col-main { max-height: none; overflow: visible; }
}
