/* Mobile responsive overlay for legacy XSitePro table layout (added 2026-07-06).
   Loads last; desktop (>640px) untouched. Stacks table cells into one column. */
@media only screen and (max-width: 640px) {
  html { overflow-x: hidden !important; }
  body { overflow-x: hidden !important; width: 100% !important; max-width: 100% !important; margin: 0 !important; padding: 0 !important; }
  body * { max-width: 100% !important; box-sizing: border-box !important; }

  /* Collapse fixed-width nested tables into a single stacked column */
  table, tbody, thead, tr, td, th { display: block !important; width: 100% !important; max-width: 100% !important;
    height: auto !important; float: none !important; }
  td, th { width: auto !important; padding: 4px 8px !important; text-align: left !important; }

  img { height: auto !important; max-width: 100% !important; }

  /* Milonic DHTML menu: it is JS/absolute positioned and unusable on touch.
     Hide it and expose a simple stacked text menu via the sitemap nav instead. */
  #menu_wrapper, [id^="milonic"], .mmenu, div[style*="position: absolute"] .mm { }

  /* Any absolutely-positioned block -> static so it flows */
  [style*="position:absolute"], [style*="position: absolute"] { position: static !important; left: auto !important; top: auto !important; }

  /* Readability */
  body { font-size: 16px !important; line-height: 1.5 !important; }
  h1 { font-size: 24px !important; } h2 { font-size: 20px !important; }
  p, td, li { word-wrap: break-word !important; overflow-wrap: break-word !important; }

  /* Milonic/XSP menu links: strip speech-bubble bg images, clean stacked text links */
  a[class*="mainlinks"], a[class*="sublinks"] { display: block !important; width: auto !important;
    background-image: none !important; background: #e8f4fb !important; margin: 3px 8px !important; padding: 12px 14px !important;
    border: 1px solid #bfe0f2 !important; border-radius: 4px !important; color: #17607e !important; font-size: 16px !important;
    font-weight: 600 !important; text-align: left !important; height: auto !important; line-height: 1.3 !important;
    text-decoration: none !important; }
  td[class*="MENU"], [class*="xsp1"], [class*="maintd"] { background-image: none !important; background: transparent !important;
    height: auto !important; padding: 0 !important; }
  [class*="space"][class*="MENU"] { display: none !important; }
  a[class*="mainlinks"] span, a[class*="sublinks"] span { display: none !important; }

  /* Milonic DHTML menu: collapse the JS-forced huge item heights into compact links */
  .mmenucontainer, .milonictable, .milonictable tr, .milonictable td, .milonictable div,
  [class*="milonic"], [class*="mmenu"] { height: auto !important; max-height: none !important; min-height: 0 !important; }
  .milonictable td, .mmenucontainer td { padding: 0 !important; }
  .milonictable a, .mmenucontainer a { display: block !important; height: auto !important; min-height: 0 !important;
    padding: 11px 14px !important; line-height: 1.25 !important; background-image: none !important; background: #e8f4fb !important;
    color: #17607e !important; font-size: 15px !important; border-bottom: 1px solid #cfe6f2 !important; text-align: left !important; }

  /* Hide the oversized Milonic DHTML bubble menu on mobile; the static RIGHT_MENU
     text links (styled above) remain as clean navigation. */
  .mmenucontainer, .milonictable, [class*="milonic"] { display: none !important; }

  /* Collapse empty cells left behind by hidden menu / stacked tables */
  td:empty, tr:empty, table:empty { display: none !important; height: 0 !important; padding: 0 !important; margin: 0 !important; }
  img[src*="spacer"], img[width="1"], img[height="1"] { display: none !important; }
}

/* Tablet fix (added 2026-07-07 review): the legacy fixed-width XSitePro layout
   (~1035px) overflowed between 640px and desktop, causing horizontal scroll at
   768px. Reflow the fixed widths to fluid without the full single-column stack. */
@media only screen and (min-width: 641px) and (max-width: 1024px) {
  html, body { overflow-x: hidden !important; max-width: 100% !important; }
  body, table, tbody, tr, td, th { max-width: 100% !important; box-sizing: border-box !important; }
  table { width: 100% !important; table-layout: auto !important; }
  td[width], th[width], table[width], [style*="width"] { max-width: 100% !important; }
  img { max-width: 100% !important; height: auto !important; }
  iframe { max-width: 100% !important; }
}
