/**
 * Bridge AI OS — shared mobile base
 * Link from public/operator HTML: <link rel="stylesheet" href="/css/bridge-mobile.css?v=20261018">
 * Goals: no horizontal overflow, ~44px touch targets, stacking layouts under 820px.
 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  max-width: 100vw;
}

img,
video,
iframe,
canvas,
svg,
table {
  max-width: 100%;
  height: auto;
}

a,
button,
.nav-btn,
.btn,
.dp-btn,
.cc-btn,
.tier-tab,
input[type="submit"],
input[type="button"] {
  touch-action: manipulation;
}

@media (max-width: 820px) {
  body {
    font-size: 15px;
    overflow-x: hidden !important;
  }

  .desktop-only {
    display: none !important;
  }

  a.btn,
  button,
  .nav-btn,
  .btn,
  .dp-btn,
  .pulse-cta {
    min-height: 44px;
  }

  nav {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .nav-links {
    flex-wrap: wrap;
    width: 100%;
    gap: 0.15rem;
  }

  .nav-links a {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }

  .layout {
    grid-template-columns: 1fr !important;
    height: auto !important;
  }

  .detail-panel {
    border-left: none;
    border-top: 1px solid var(--border, #1e293b);
    max-height: 55vh;
  }

  .app {
    grid-template-columns: 1fr !important;
    height: auto !important;
    min-height: 100vh;
    overflow: auto !important;
  }

  .sidebar {
    display: flex !important;
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--b, #1a2d40);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar h2 {
    width: 100%;
  }

  .nav-item {
    white-space: nowrap;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .form-row,
  .row2,
  .grid,
  .contacts-row {
    grid-template-columns: 1fr !important;
  }

  .modal {
    margin: 1rem;
    max-width: calc(100vw - 2rem);
  }

  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 14px;
  }

  h1 {
    font-size: 1.5rem !important;
  }

  h2 {
    font-size: 1.25rem !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
