.mobile-nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  border: 1px solid #e8caca;
  border-radius: 6px;
  background: #fff;
  color: #9f1117;
  cursor: pointer;
  touch-action: manipulation;
}

.mobile-nav-toggle span {
  width: 20px;
  height: 2px;
  background: currentColor;
  transition: transform .2s ease, opacity .2s ease;
}

.mobile-nav-ready.nav-open .mobile-nav-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.mobile-nav-ready.nav-open .mobile-nav-toggle span:nth-child(2) {
  opacity: 0;
}

.mobile-nav-ready.nav-open .mobile-nav-toggle span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 1100px) {
  body {
    overflow-x: hidden;
  }

  header.mobile-nav-ready,
  .site-header.mobile-nav-ready {
    height: 64px;
    min-height: 64px;
    align-items: center;
    justify-content: space-between;
    padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  }

  .site-header.mobile-nav-ready .inner {
    width: 100%;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0;
  }

  .mobile-nav-ready .logo,
  .mobile-nav-ready .brand {
    position: static;
    min-width: 0;
    margin: 0;
  }

  .mobile-nav-ready .logo img,
  .mobile-nav-ready .brand img {
    width: auto;
    max-width: 154px;
    height: 38px;
    object-fit: contain;
  }

  .mobile-nav-ready .mobile-nav-toggle {
    display: flex;
  }

  .mobile-nav-ready .site-primary-nav {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    z-index: 1000;
    display: none;
    max-width: none;
    max-height: calc(100dvh - 64px);
    overflow-y: auto;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: 8px max(16px, env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    border-bottom: 1px solid #ead7d7;
    background: rgba(255, 255, 255, .99);
    box-shadow: 0 16px 30px rgba(72, 17, 17, .13);
  }

  .mobile-nav-ready.nav-open .site-primary-nav {
    display: grid;
  }

  .mobile-nav-ready .site-primary-nav a {
    display: flex;
    min-height: 48px;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #f2e5e5;
    font-size: 15px;
    white-space: normal;
  }

  .mobile-nav-ready .site-primary-nav a::after {
    display: none;
  }

  .page {
    width: min(100% - 28px, 1200px);
    padding-top: 92px;
  }

  .category-tabs {
    position: static;
    display: flex;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }

  .category-tabs button,
  .category-tabs a {
    min-height: 44px;
    flex: 0 0 auto;
  }
}

@media (max-width: 640px) {
  .mobile-nav-ready .site-primary-nav {
    grid-template-columns: 1fr;
  }

  .section,
  .footer-inner {
    width: min(100% - 28px, 1200px);
  }

  .section-heading,
  .page-heading,
  .summary-strip,
  .admin-toolbar,
  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .auth-card,
  .admin-card,
  .admin-panel {
    padding: 20px;
  }

  .oauth-actions,
  .oauth-bind-row,
  .form-grid,
  .admin-grid,
  .admin-entry-grid,
  .user-admin-row,
  .admin-row,
  .permission-checks {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-grid input,
  .form-grid select,
  .form-grid textarea {
    min-width: 0;
    font-size: 16px;
  }

  .button-row,
  .card-actions,
  .user-actions,
  .admin-row-actions {
    width: 100%;
    align-items: stretch;
  }

  .button-row > .btn,
  .button-row > .btn-secondary,
  .button-row > .btn-danger,
  .card-actions > button,
  .user-actions > button,
  .admin-row-actions > button {
    min-height: 44px;
  }

  .auth-card .button-row > button {
    flex: 1 1 130px;
    justify-content: center;
  }

  .login-refresh-note {
    flex-basis: 100%;
  }

  .auth-footer-link {
    text-align: center;
  }

  .page-heading h1,
  .section-heading h1,
  .section-heading h2 {
    font-size: 26px;
  }
}
