.mobile-app-header,
.mobile-menu-toggle,
.mobile-menu-backdrop,
.mobile-menu-drawer { display: none; }

@media (max-width: 900px) {
  .layout {
    align-content: start;
    grid-auto-rows: max-content;
  }

  .mobile-app-header {
    position: sticky;
    top: 0;
    z-index: 45;
    display: flex;
    width: 100%;
    height: calc(56px + env(safe-area-inset-top));
    min-height: calc(56px + env(safe-area-inset-top));
    max-height: calc(56px + env(safe-area-inset-top));
    align-self: start;
    padding: calc(7px + env(safe-area-inset-top)) 16px 7px;
    border-bottom: 1px solid #d8dee6;
    background: rgba(255,255,255,.97);
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    backdrop-filter: blur(10px);
  }

  .mobile-app-brand {
    display: inline-flex;
    min-height: 36px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #1f3347;
    align-items: center;
    gap: 9px;
  }

  .mobile-app-brand:hover { background: transparent; }

  .richhome-mark {
    display: grid;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    place-items: center;
    border-radius: 8px;
    background: #173650;
    color: #fff;
  }

  .richhome-mark svg {
    width: 18px;
    height: 18px;
    display: block;
  }

  .richhome-wordmark {
    color: #1f3347;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -.4px;
    line-height: 1;
  }

  .top {
    position: relative;
    align-items: flex-start;
    min-height: 0;
    padding-right: 0;
  }

  .top > div:first-child { min-width: 0; }
  .top .top-actions { display: none; }

  .mobile-menu-toggle {
    position: static;
    z-index: 46;
    display: grid;
    width: 40px;
    height: 40px;
    min-height: 40px;
    flex: 0 0 40px;
    place-content: center;
    gap: 5px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #1f3347;
  }

  .mobile-menu-toggle:hover { background: transparent; }
  .mobile-menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: currentColor;
  }

  .mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 98;
    display: block;
    background: rgba(16, 30, 43, .45);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
  }

  .mobile-menu-drawer {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 99;
    display: flex;
    width: min(320px, 86vw);
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0;
    flex-direction: column;
    padding: calc(18px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: #fff;
    box-shadow: -12px 0 30px rgba(20, 39, 56, .18);
    transform: translateX(102%);
    transition: transform .18s ease;
  }

  .mobile-menu-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-menu-drawer.is-open { transform: translateX(0); }

  .mobile-menu-fixed-top {
    position: sticky;
    top: calc(-18px - env(safe-area-inset-top));
    z-index: 2;
    flex: 0 0 auto;
    margin: calc(-18px - env(safe-area-inset-top)) 0 0;
    padding: calc(18px + env(safe-area-inset-top)) 0 0;
    background: #fff;
  }

  .mobile-menu-heading {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid #d9e0e6;
  }

  .mobile-menu-brand {
    display: flex;
    min-width: 0;
    color: #1f3347;
    align-items: center;
    gap: 10px;
  }

  .mobile-menu-brand .richhome-mark {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
    border-radius: 8px;
  }

  .mobile-menu-brand .richhome-wordmark { font-size: 18px; }

  .mobile-menu-close {
    min-width: 38px;
    min-height: 38px;
    padding: 0 8px;
    border: 0;
    background: transparent;
    color: #536474;
    font-size: 28px;
    line-height: 1;
  }

  .mobile-menu-user {
    flex: 0 0 auto;
    padding: 16px 2px 14px;
    border-bottom: 1px solid #e2e7ec;
  }

  .mobile-menu-user strong {
    display: block;
    color: #1f3347;
    font-size: 16px;
    font-weight: 600;
  }

  .mobile-menu-user span {
    display: block;
    margin-top: 4px;
    color: #718096;
    font-size: 12px;
    overflow-wrap: anywhere;
  }

  .mobile-menu-nav {
    flex: 0 0 auto;
    display: grid;
    gap: 4px;
    padding: 14px 0;
  }

  .mobile-menu-nav button,
  .mobile-menu-account button {
    width: 100%;
    min-height: 44px;
    border: 0;
    background: transparent;
    color: #2d4053;
    text-align: left;
  }

  .mobile-menu-nav button:hover,
  .mobile-menu-account button:hover { background: #edf1f4; }
  .mobile-menu-nav button:disabled { color: #95a1ad; opacity: 1; }

  .mobile-menu-account {
    flex: 0 0 auto;
    display: grid;
    gap: 4px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #e2e7ec;
  }

  .mobile-menu-account .mobile-menu-logout {
    color: #a23b32;
    font-weight: 600;
  }

  body.mobile-menu-open { overflow: hidden; }
}
