/* GuardianOS mobile layer (non-destructive): applies only on small screens */
@media (max-width: 900px) {
  :root {
    --mobile-gap: 12px;
    --mobile-radius: 12px;
  }

  html, body {
    width: 100%;
    overflow-x: hidden;
  }

  body {
    font-size: 15px;
    line-height: 1.45;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  #root {
    width: 100%;
    overflow-x: hidden;
  }

  /* Universal spacing safety */
  * {
    box-sizing: border-box;
  }

  /* Common app shells */
  [class*="layout"],
  [class*="container"],
  [class*="content"],
  [class*="page"],
  main {
    max-width: 100% !important;
  }

  /* Sidebar patterns (hide fixed sidebars on mobile) */
  [class*="sidebar"],
  [class*="SideBar"],
  aside[class*="left"],
  aside[class*="nav"] {
    position: static !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
  }

  /* Stack rows into columns where possible */
  [class*="row"],
  [class*="Row"],
  [class*="grid"],
  [class*="Grid"],
  [class*="cards"],
  [class*="Cards"] {
    grid-template-columns: 1fr !important;
    flex-direction: column !important;
    gap: var(--mobile-gap) !important;
  }

  /* Cards / panels */
  [class*="card"],
  [class*="panel"],
  [class*="widget"],
  section {
    border-radius: var(--mobile-radius);
  }

  /* Buttons and controls */
  button,
  [role="button"],
  input,
  select,
  textarea,
  a[class*="btn"],
  [class*="button"] {
    min-height: 44px;
    font-size: 16px;
  }

  /* Inputs should not zoom on iOS */
  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Tables -> horizontal scroll, not broken layout */
  table {
    display: block;
    width: 100% !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  /* Images/charts */
  img,
  svg,
  canvas {
    max-width: 100% !important;
    height: auto;
  }

  /* Sticky bottom action bar (if app has nav/actions) */
  nav[class*="bottom"],
  [class*="mobile-nav"],
  [class*="MobileNav"] {
    position: sticky;
    bottom: 0;
    z-index: 50;
    backdrop-filter: blur(8px);
  }
}

/* Very small phones */
@media (max-width: 420px) {
  body {
    font-size: 14px;
  }
}
