/* iPhone and narrow-screen layout: keep the page vertical and safe-area aware. */
@media (max-width: 600px) {
  html, body {
    width: 100%;
    max-width: 100%;
    min-height: 100dvh;
    overflow-x: hidden;
    overscroll-behavior-x: none;
  }

  header {
    position: static;
    width: 100%;
    padding: calc(12px + env(safe-area-inset-top)) 14px 12px;
    align-items: flex-start;
    flex-direction: column;
  }

  .brand,
  .header-actions {
    width: 100%;
    min-width: 0;
  }

  .header-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  nav {
    position: static;
    top: auto;
    width: 100%;
    max-width: 100%;
    padding: 10px 14px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  main {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    padding: 0 14px calc(28px + env(safe-area-inset-bottom));
  }

  .hero {
    padding: 20px 0 14px;
  }

  .stats {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats div,
  .panel,
  .grid,
  .detail,
  .card {
    min-width: 0;
    max-width: 100%;
  }

  .panel {
    overflow: hidden;
    padding: 13px;
  }

  .tablewrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 760px;
  }

  .grid,
  .detail {
    grid-template-columns: 1fr;
  }

  .detail .card strong {
    overflow-wrap: anywhere;
  }

  .panelhead,
  .journal-actions {
    align-items: flex-start;
    flex-direction: column;
  }
}
