# Phone layout

At or below 760px the shell is a phone app in one column. The breakpoint is one constant, [`PHONE_MAX_WIDTH`](https://github.com/Fzkuji/OpenProgram/blob/main/apps/web/lib/layout/phone.ts), the same one the [secondary rail](https://fzkuji.github.io/OpenProgram/docs/reference/design/ui/sidebar/secondary-rail.html) already used. Everything else is CSS in [`styles/base/phone.css`](https://github.com/Fzkuji/OpenProgram/blob/main/apps/web/app/styles/base/phone.css), loaded last, plus the gestures in [`phone-shell.tsx`](https://github.com/Fzkuji/OpenProgram/blob/main/apps/web/components/layout/phone-shell.tsx). Above 760px nothing changes.

1. **Conversation** Tab row, one column, composer
2. **Header button or swipe from the left edge** The sidebar slides over
3. **Tap a chat, the scrim or swipe back** The drawer closes on the chosen chat

## Screens

| Part | On a phone |
| --- | --- |
| Sidebar | A drawer, `min(86vw, 320px)` wide, over a `--scrim`. Opened by the button at the start of the tab row or of a page header, or by a swipe from the left 24px; closed by its own toggle, the scrim, a swipe left, or choosing a chat, page or tab. A drag follows the finger and settles by distance or flick speed. It stays mounted, so it reopens where it was scrolled. No icon rail when closed. |
| Conversation | The centre card fills the screen; the transcript keeps a 12px margin and the composer lines up with it. The message rail, which lives in the side margin, is not shown; the view controls keep their narrow column, 8px from the top-right corner. Code blocks and tables scroll inside themselves. |
| Right panel | A full-screen sheet sliding in from the right, opened by the button at the end of the tab row and closed by its toggle or by choosing a tab. Tool details, files, activity and resources use the whole width. |
| Settings, History, Projects, Agents | The secondary rail is the page's section list, full width; a row opens its content. The list page's header has only the sidebar button; the content page's only a back chevron to the list. |
| Management pages | Drawer button, rail toggle and title share the first header row; tabs and the toolbar wrap below. The 62px reserve for the collapsed rail is gone. |
| Composer and question cards | The three-part composer keeps its layout and spans the column; question and approval cards live in it, so they are full width too. |

## Touch and screen edges

| Rule | How |
| --- | --- |
| Keyboard | The shell is `position: fixed` at the visual viewport's top and height (`--phone-viewport-top`, `--phone-viewport-h` from `visualViewport`), falling back to `100dvh`, so the composer rides above the on-screen keyboard in Safari too. |
| Notch and home indicator | The shell pads by `env(safe-area-inset-*)`; the drawer and the sheet pad by at least 8px or the inset. |
| Touch targets | Header buttons, drawer and sheet rows, and section-list rows are 44px. |
| Inputs | At least 16px, so focusing one does not zoom the page. |
| Hover | Hover tips never open from a touch; message actions are already visible without hover. |
| Stored choices | Opening the drawer, the sheet or a section page on a phone stores nothing, and a stored open right panel starts closed: a wider window keeps its own choices. |
| Motion | Drawer and sheet slide in 220ms; a drag follows the finger; reduced motion removes the slides. |

## Taken from dsh-mobile

The design copies [saya-ch/dsh-mobile](https://github.com/saya-ch/dsh-mobile) (Apache-2.0), a touch layout for another harness's web UI, rather than inventing one.

| Decision | Why |
| --- | --- |
| Session list as an overlay drawer with scrim | The conversation keeps the whole width; the list is one swipe away and keeps its scroll position. |
| Right panel as a full-screen sheet | A 300px column leaves no room for text on a phone; a sheet shows details at full width. |
| Settings sections as a list page with a way back | The section list and its content cannot share 390px. |
| Keyboard-following height, safe-area padding, 44px targets, 16px inputs | The checklist from its design system: primary actions above the keyboard, nothing under the notch, no focus zoom. |
| No page-level sideways scroll; wide content scrolls in place | Same. |

Not copied: its folded 56px rail beside the conversation (OpenProgram keeps no rail on a phone) and its tablet docking band (at 761px and up the desktop layout already applies).

## Implementation status

The page's viewport declares `viewport-fit=cover`. `interactive-widget=resizes-content` is not declared yet; the visual-viewport height covers the keyboard without it.

[Secondary rail](https://fzkuji.github.io/OpenProgram/docs/reference/design/ui/sidebar/secondary-rail.html) · [Remote web access](https://fzkuji.github.io/OpenProgram/docs/reference/design/ui/remote-web-access.html)
