/* Mobile entry screen and drawer. Desktop keeps the existing navigation. */
.mobile-menu-button,
.mobile-menu-view,
.mobile-nav-dialog {
  display: none;
}

@media (max-width: 600px) {
  #app-shell > .sidebar { display: none; }

  .mobile-menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 48px;
    min-height: 44px;
    padding: 8px;
    border: 1px solid #d9e2d6;
    border-radius: 10px;
    background: #f1f5ee;
    color: var(--accent);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
  }
  .mobile-menu-button svg { width: 24px; height: 24px; stroke-width: 1.8; pointer-events: none; }

  #app-shell .topbar {
    height: auto;
    min-height: 66px;
    gap: 10px;
    padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  }
  #app-shell .topbar h1 { flex: 1; font-size: 14px; white-space: nowrap; }
  #app-shell .topbar-actions { gap: 6px; min-width: 0; }
  #app-shell .topbar-actions .button { min-height: 44px; padding: 8px; }
  #app-shell .account-top-button { max-width: 88px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #app-shell .prototype-label { display: none; }
  #new-chat svg { display: none; }

  .mobile-menu-view { display: flex; overflow-y: auto; padding: 24px 20px max(24px, env(safe-area-inset-bottom)); }
  .mobile-menu-content { width: 100%; max-width: 440px; margin: auto; }
  .mobile-menu-intro { margin-bottom: 26px; }
  .mobile-menu-intro p { margin: 0 0 8px; color: #6a7c6f; font-size: 12px; letter-spacing: .08em; }
  .mobile-menu-intro h2 { margin: 0; font-size: 25px; line-height: 1.4; font-weight: 550; letter-spacing: -.03em; }
  .mobile-entry-list { display: grid; gap: 12px; }
  .mobile-entry {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 84px;
    padding: 14px 18px;
    border: 1px solid #dfe6dc;
    border-radius: 16px;
    background: #fff;
    color: var(--ink);
    text-decoration: none;
  }
  .mobile-entry-number { flex-shrink: 0; font-size: 12px; color: #82917f; font-variant-numeric: tabular-nums; }
  .mobile-entry strong { display: block; font-size: 21px; font-weight: 550; line-height: 1.4; }
  .mobile-entry small { display: block; margin-top: 4px; color: #6d7c70; font-size: 12px; line-height: 1.5; }
  .mobile-entry svg { margin-left: auto; width: 18px; height: 18px; transform: rotate(90deg); color: #6b8771; }
  .mobile-entry-primary { background: #326b53; border-color: #326b53; color: #fff; }
  .mobile-entry-primary small, .mobile-entry-primary .mobile-entry-number, .mobile-entry-primary svg { color: #e0ece4; }
  .mobile-entry:active { background: #edf3e9; }
  .mobile-entry-primary:active { background: #285940; }

  .mobile-nav-dialog[open] {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    margin: 0;
    width: 48vw;
    max-width: none;
    height: 100%;
    height: 100dvh;
    max-height: none;
    padding: max(12px, env(safe-area-inset-top)) 10px max(16px, env(safe-area-inset-bottom));
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0;
    background: #f8faf5;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .mobile-nav-dialog::backdrop { background: #1d302b66; }
  .mobile-nav-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 20px; }
  .mobile-nav-heading h2 { font-size: 15px; font-weight: 550; margin: 0; }
  .mobile-nav-heading .button { min-width: 44px; min-height: 44px; padding: 8px; font-size: 13px; }
  .mobile-nav-links { display: grid; gap: 4px; }
  .mobile-nav-links a { display: flex; align-items: center; min-height: 48px; padding: 10px 12px; border-radius: 8px; font-size: 16px; white-space: nowrap; }
  .mobile-nav-links a.active { color: #28583e; background: #e4edde; font-weight: 550; }
  .mobile-nav-links a:active { background: #e4edde; }
  .mobile-nav-overview { margin-top: auto; padding: 22px 12px 10px; color: var(--accent); font-size: 13px; white-space: nowrap; }
  .mobile-entry:focus-visible, .mobile-menu-button:focus-visible, .mobile-nav-dialog a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

  .landing-nav { flex-wrap: wrap; }
  .landing-nav nav { gap: 10px; }
}
