/* Mobile stabilisation — override inline styles for touch & readability */

@media (max-width: 768px) {
  /* Touch targets: minimum 40px height for all interactive elements */
  button[style*="height:20px"],
  button[style*="height:28px"],
  button[style*="height:34px"] {
    min-height: 36px !important;
    padding: 0.4rem 0.6rem !important;
  }

  input[style*="height:20px"] {
    min-height: 36px !important;
    padding: 0.4rem 0.5rem !important;
  }

  /* Readable font sizes */
  [style*="font-size:0.62rem"],
  [style*="font-size:0.65rem"] {
    font-size: 0.75rem !important;
  }

  [style*="font-size:0.68rem"],
  [style*="font-size:0.7rem"] {
    font-size: 0.78rem !important;
  }

  /* Containers: never exceed viewport */
  [style*="max-width:1200px"],
  [style*="max-width:900px"] {
    max-width: 100% !important;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }

  /* Tables: allow scroll but don't force huge min-widths */
  table[style*="min-width:900px"],
  table[style*="min-width:800px"] {
    min-width: 600px !important;
  }

  /* Fixed-width inputs: make flexible */
  input[style*="width:170px"],
  input[style*="width:105px"],
  input[style*="width:80px"] {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  /* Dropdowns: don't overflow */
  [style*="min-width:250px"],
  [style*="min-width:200px"] {
    min-width: auto !important;
    max-width: 90vw !important;
  }

  /* Select dropdowns: readable size */
  select {
    min-height: 36px;
    font-size: 0.85rem !important;
  }

  /* Grid forms: single column on mobile */
  [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Header action bars: wrap properly */
  [style*="display:flex"][style*="gap:0.3rem"] {
    flex-wrap: wrap !important;
  }
}

@media (max-width: 480px) {
  /* Extra small: even more compact */
  button[style*="height:20px"],
  button[style*="height:28px"] {
    font-size: 0.72rem !important;
    padding: 0.3rem 0.5rem !important;
  }

  th, td {
    padding: 0.25rem 0.35rem !important;
    font-size: 0.78rem !important;
  }

  h2[style*="font-size:1.2rem"],
  h2[style*="font-size:1.3rem"] {
    font-size: 1rem !important;
  }
}
