/* Paper · Editorial — the phone (≤ 700 px, body.focus-ui). Home (greeting, search, the three groups), the four tabs
   Inbox · Bob · Projects · Settings, the New button, the conversation's chips and the details sheet (#focusControls).
   Spec: "Layout › Phone" in docs/superpowers/specs/2026-11-10-ui-redo-paper-design.md; mock: mocks/ui-redo, the phone
   screens of "Editorial". Markup: public/index.html; behaviour: app/phone-ui.js, app/focus-ui.js, app/workspace.js.
   Touch targets are at least 44 px and text at least 13 px. Loaded after workspace.css, before paper.css. */

/* Only the phone shows these. */
.ph-home, .ph-tabs, .ph-fab, .ph-chips, .focus-scrim, .focus-grab, .focus-heading, .focus-panels, .focus-switches, .focus-more-icon { display: none; }

@media (max-width: 700px) {
  body.focus-ui { --ph-tabs-h: calc(64px + env(safe-area-inset-bottom, 0px)); }

  /* ---------- the tabs ---------- */
  body.focus-ui:is(.view-projects, .view-sessions, .view-control) .ph-tabs, #settingsDialog[open] > .ph-tabs { display: grid; }
  #settingsDialog:has(#settingsForm[data-mobile-view="panel"]) > .ph-tabs { display: none; }
  .ph-tabs {
    position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); height: var(--ph-tabs-h);
    padding: 4px max(8px, env(safe-area-inset-right, 0px)) max(4px, env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
    background: var(--bg); box-shadow: 0 -1px 0 var(--line);
  }
  .ph-tabs button {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; min-height: 56px;
    padding: 0; border: 0; border-radius: 14px; background: transparent; box-shadow: none; color: var(--muted); font: 500 13px/1.1 var(--sans);
  }
  .ph-tabs button svg { width: 22px; height: 22px; flex: none; }
  .ph-tabs button.on { color: var(--accent); font-weight: 600; }
  /* The chosen tab is the green one. A ring around it after a tap read as a second selection and was cut by the screen edge. */
  .ph-tabs button:focus-visible { outline: none; background: var(--field); }
  .ph-tab-badge { position: absolute; top: 3px; left: calc(50% + 6px); min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--ws-need-fill); color: #2a1700; font: 700 13px/20px var(--sans); text-align: center; }
  .ph-tab-badge[hidden] { display: none; }
  /* Room for the tabs under the screens that show them. */
  body.focus-ui:is(.view-projects, .view-sessions, .view-control) .shell { padding-bottom: var(--ph-tabs-h); }
  #settingsDialog:has(> .ph-tabs) #settingsForm[data-mobile-view="menu"] .settings-sidebar { padding-bottom: calc(var(--ph-tabs-h) + 8px); }

  /* ---------- Home: the greeting, quiet counts and the hairline groups ---------- */
  body.focus-ui.view-projects.ws-column-inbox .shell { display: flex; flex-direction: column; }
  body.focus-ui.view-projects.ws-column-inbox .shell > #projectsPanel { display: none; }
  body.focus-ui.view-projects.ws-column-inbox .shell > .ph-home { display: block; flex: none; }
  .ph-home { padding-top: env(safe-area-inset-top, 0px); }
  .ph-home-top { display: flex; align-items: center; gap: 2px; height: 52px; padding: 0 8px 0 18px; }
  .ph-mark { display: grid; flex: none; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: transparent; }
  .ph-mark img { width: 26px; height: 26px; }
  .ph-spacer { flex: 1; }
  .ph-icon-button { display: grid; place-items: center; width: 44px; min-width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; box-shadow: none; color: var(--muted); }
  .ph-icon-button svg { width: 21px; height: 21px; }
  /* Leave a clean 48 px slot beside Search for the circular + New button in the top bar. */
  .ph-home-top .ph-search-trigger { margin-right: 48px; }
  .ph-home-top :is(#phoneThemeButton, #phoneAvatar) { display: none; }
  .ph-avatar {
    display: grid; place-items: center; width: 44px; height: 44px; padding: 4px; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--accent) 16%, transparent);
    background-clip: content-box; box-shadow: none; color: var(--heading); font: 700 13px/1 var(--sans);
  }
  .ph-greeting { margin: 4px 20px 0; color: var(--heading); font: 400 clamp(26px, 7.6vw, 32px)/1.12 var(--serif); letter-spacing: -0.015em; overflow-wrap: anywhere; }
  .ph-counts { min-height: 22px; margin: 6px 20px 8px; color: var(--muted); font-size: 14.5px; }
  .ph-counts b { color: var(--ws-need); font-weight: 650; }
  /* Before the board has answered: a quiet bar where the counts will be, and the shape of the list under the greeting. */
  .ph-counts.loading::before, .ws-loading i {
    display: block; border-radius: 8px;
    background: linear-gradient(90deg, var(--field) 0, color-mix(in srgb, var(--text) 10%, var(--field)) 50%, var(--field) 100%) 0 0 / 640px 100%;
    animation: usage-shimmer 1.3s linear infinite;
  }
  .ph-counts.loading::before { content: ""; width: 62%; height: 14px; margin-top: 4px; }
  .ws-loading { display: grid; gap: 10px; padding: 14px 12px 0; }
  .ws-loading .ws-loading-label { width: 34%; height: 14px; margin: 6px 4px 2px; }
  .ws-loading .ws-loading-card { height: 132px; border-radius: 18px; }
  .ws-loading .ws-loading-row { height: 46px; border-radius: 12px; }
  @media (prefers-reduced-motion: reduce) { .ph-counts.loading::before, .ws-loading i { animation: none; } }

  /* The system messages and a running move, on Home above the filters (workspace.js places them here on the phone). */
  body.focus-ui .shell > :is(.inbox-system, .control-moves-job) { display: none; }
  body.focus-ui.view-projects.ws-column-inbox .shell > .inbox-system:not([hidden]) { display: flex; flex: none; margin: 2px 16px 2px; }
  body.focus-ui.view-projects.ws-column-inbox .shell > .control-moves-job:not([hidden]) { display: block; flex: none; margin: 2px 16px 2px; }
  .inbox-system-dialog { box-sizing: border-box; padding: 18px 18px 20px; }
  /* Quiet single-line editorial strip instead of a heavy red box; 44 px target and >= 13 px text. */
  body.focus-ui .inbox-system-line { min-height: 44px; padding: 6px 10px; border-radius: 12px; background: color-mix(in srgb, var(--danger) 9%, transparent); box-shadow: none; font-size: 14px; }
  body.focus-ui :is(.inbox-system-fix, .inbox-system-line .control-sys-icon) { color: var(--heading); font-size: 13px; }
  body.focus-ui .inbox-system-dialog :is(.inbox-system-close, .control-sys-actions button) { box-sizing: border-box; height: 46px; min-height: 46px; font-size: 14px; }
  body.focus-ui .inbox-system-dialog :is(.control-sys-pill, .control-sys-hint, .control-list-meta) { font-size: 13px; }

  /* Home's mode switcher & filters: quiet underline State/Project/Folder tabs, quiet Filter + Select row, and a clean bottom sheet for Filter. */
  body.focus-ui.view-projects.ws-column-inbox .inbox-tools.phone-only[hidden] { display: none; }
  body.focus-ui.view-projects.ws-column-inbox .inbox-tools.phone-only { padding: 0 16px 4px; gap: 2px; margin: 0; }
  .inbox-tools.folded { gap: 2px; }
  body.focus-ui .ws-mode { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; margin: 0; padding: 0; border-radius: 0; background: transparent; border-bottom: 1px solid var(--line); }
  body.focus-ui .ws-mode button { min-height: 44px; padding: 0 8px; border-radius: 0; background: transparent; box-shadow: none; color: var(--muted); font: 550 14px var(--sans); }
  body.focus-ui .ws-mode button[aria-pressed="true"] { background: transparent; color: var(--heading); font-weight: 650; box-shadow: inset 0 -2px 0 var(--accent); }
  .inbox-tools-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0; }
  .inbox-tools-head :is(.inbox-filter-toggle, .inbox-select-toggle) {
    min-height: 44px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; box-shadow: none; color: var(--muted); font: 550 14px var(--sans);
  }
  .inbox-tools-head .inbox-filter-toggle::before { content: ""; display: inline-block; width: 14px; height: 10px; margin-right: 8px; background: linear-gradient(currentColor 0 0) 0 0 / 14px 1.6px, linear-gradient(currentColor 0 0) 50% 50% / 9px 1.6px, linear-gradient(currentColor 0 0) 50% 100% / 4px 1.6px; background-repeat: no-repeat; }
  .inbox-tools-head .inbox-filter-toggle:is(.narrowing, [aria-expanded="true"]) { background: transparent; color: var(--heading); }
  .inbox-tools-head .inbox-filter-toggle.narrowing { color: var(--accent); }
  .inbox-tools-head .inbox-select-toggle[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
  .inbox-filter-scrim:not([hidden]) { position: fixed; inset: 0; z-index: 57; background: color-mix(in srgb, var(--ink) 42%, transparent); }
  .inbox-filter-scrim[hidden] { display: none; }
  .inbox-tools.folded .inbox-tools-filters {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 58;
    display: flex; flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 8px;
    max-height: calc(100dvh - 56px - env(safe-area-inset-top, 0px)); overflow-y: auto; overscroll-behavior: contain;
    padding: 10px 20px calc(18px + env(safe-area-inset-bottom, 0px));
    border-radius: 26px 26px 0 0; background: var(--panel);
    box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.34), inset 0 1px 0 var(--line);
  }
  .inbox-tools.folded .inbox-tools-filters[hidden] { display: none; }
  .inbox-tools.folded .inbox-sheet-grab { display: block; flex: none; width: 36px; height: 4px; margin: 0 auto 2px; border-radius: 99px; background: var(--line-strong); }
  .inbox-tools.folded .inbox-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 4px; }
  .inbox-tools.folded .inbox-sheet-head strong { color: var(--heading); font: 400 22px/1.2 var(--serif); }
  .inbox-tools.folded .inbox-sheet-reset { min-height: 44px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; box-shadow: none; color: var(--accent); font: 600 14px var(--sans); }
  .inbox-tools.folded .inbox-tools-filters > :is(.multi-select, .inbox-automation-toggle, .inbox-range) { flex: none; width: 100%; }
  .inbox-tools.folded .inbox-tools-filters .multi-select-trigger,
  .inbox-tools.folded .inbox-tools-filters .inbox-range {
    min-height: 46px; padding: 0 32px 0 14px; border: 0; border-radius: 12px; background-color: var(--field); box-shadow: none;
    color: var(--text); font: 500 15px var(--sans); text-align: left;
  }
  .inbox-tools.folded .inbox-tools-filters .searchable-select-popover { z-index: 62; }
  .inbox-tools.folded .inbox-tools-filters .inbox-automation-toggle {
    min-height: 46px; border: 0; border-radius: 12px; background: var(--field); box-shadow: none;
    color: var(--text); font: 500 15px var(--sans); text-align: left;
  }
  .inbox-tools.folded .inbox-tools-filters .inbox-automation-toggle[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 16%, var(--field)); color: var(--accent); font-weight: 600; }
  .inbox-tools.folded .inbox-sheet-done { flex: none; width: 100%; min-height: 48px; margin-top: 4px; border: 0; border-radius: 14px; background: var(--btn-bg); color: var(--btn-fg); font: 650 15.5px var(--sans); }
  /* Bob's chat: no empty "Background updates (0)" block under it. */
  body.focus-ui .control-chat-updates:has(> #controlChatUpdates:empty) { display: none; }

  /* The groups scroll cleanly over the tabs, with zero bottom FAB overlap. */
  body.focus-ui.view-projects.ws-column-inbox .shell > .ws-groups {
    --ws-lab-height: 42px; --ws-empty-height: 30px;
    display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; overflow: hidden auto; overscroll-behavior: contain; margin: 0; padding: 0 16px 14px;
  }
  body.focus-ui .ws-groups .ws-group { display: block; flex: none; }
  body.focus-ui .ws-groups .ws-group + .ws-group { margin-top: 8px; }
  body.focus-ui .ws-lab { display: flex; align-items: center; gap: 8px; box-sizing: border-box; height: 42px; padding: 10px 2px 4px; color: var(--heading); font: 400 17px/1.2 var(--serif); }
  body.focus-ui .ws-lab i { color: var(--muted); font: 500 13px/1 var(--sans); font-style: normal; }
  /* Filters hide part of what needs you, runs or waits for review: say so, and clear them in one tap. */
  body.focus-ui .ws-filter-note { display: flex; align-items: center; gap: 12px; margin: 4px 0 8px; padding: 10px 14px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 12%, var(--field)); color: var(--text); font: 500 14px/1.35 var(--sans); }
  body.focus-ui .ws-filter-note span { flex: 1 1 auto; min-width: 0; }
  body.focus-ui .ws-filter-note button { flex: none; min-height: 44px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--btn-bg); box-shadow: none; color: var(--btn-fg); font: 600 14px var(--sans); }
  /* A group's heading folds it away: the whole name is the button, with its chevron after the count. */
  body.focus-ui .ws-lab .ws-section-toggle { flex: 1 1 auto; justify-content: flex-start; gap: 8px; min-height: 44px; margin-left: -4px; padding: 0 4px; border-radius: 10px; color: inherit; font: inherit; white-space: nowrap; }
  body.focus-ui .ws-lab .ws-section-toggle::before { display: none; }
  body.focus-ui .ws-lab .ws-section-toggle:hover > span { text-decoration: none; }
  body.focus-ui .ws-lab .ws-section-toggle::after { margin: -3px 0 0 auto; color: var(--muted); }
  body.focus-ui .ws-lab .ws-section-toggle[aria-expanded="false"]::after { margin-top: 0; }
  body.focus-ui .ws-show-all { min-height: 40px; margin-left: auto; padding: 0 8px; border: 0; border-radius: 12px; background: transparent; box-shadow: none; color: var(--accent); font: 600 14px var(--sans); }
  body.focus-ui .ws-empty { box-sizing: border-box; height: 30px; margin: 0; padding: 4px 2px 0; color: var(--muted); font-size: 14px; }
  body.focus-ui .ws-row {
    display: flex; align-items: flex-start; gap: 12px; width: 100%; min-height: 62px; margin: 0; padding: 12px 4px; border: 0; border-top: 1px solid var(--line); border-radius: 0;
    background: transparent; box-shadow: none; color: var(--text); text-align: left; cursor: pointer;
  }
  body.focus-ui .ws-group > .ws-lab + .ws-row { border-top: 0; }
  body.focus-ui .ws-row:active, body.focus-ui .ws-row.sel { background: color-mix(in srgb, var(--field) 65%, transparent); box-shadow: none; border-radius: 12px; }
  body.focus-ui .ws-dot { flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--muted); }
  body.focus-ui .ws-dot.need { background: var(--ws-need-fill); }
  body.focus-ui .ws-dot.run { background: var(--live, var(--ws-run)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--live, var(--ws-run)) 26%, transparent); animation: ph-ring 1.8s ease-in-out infinite; }
  body.focus-ui .ws-dot.rev { background: var(--ws-rev); }
  body.focus-ui .ws-row-copy { display: grid; flex: 1; gap: 3px; min-width: 0; }
  body.focus-ui .ws-row-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
  body.focus-ui .ws-row-top b { flex: 1; min-width: 0; overflow: hidden; color: var(--heading); font: 550 15.5px/1.3 var(--sans); text-overflow: ellipsis; white-space: nowrap; }
  body.focus-ui .ws-row-top time { flex: none; color: var(--muted); font-size: 13px; }
  body.focus-ui .ws-row-line { overflow: hidden; color: var(--muted); font-size: 13.5px; line-height: 1.38; text-overflow: ellipsis; white-space: nowrap; }

  /* Show all: one group as a screen of its own, one long scroll. */
  body.focus-ui #workspaceGroupPage:not([hidden]) {
    position: fixed; inset: 0; z-index: 52; display: flex; flex-direction: column; gap: 8px; padding: calc(8px + env(safe-area-inset-top, 0px)) 12px calc(12px + env(safe-area-inset-bottom, 0px));
    border: 0; border-radius: 0; background: var(--bg);
  }
  body.focus-ui #workspaceGroupPage :is(button) { min-height: 44px; }
  body.focus-ui #workspaceGroupPage .ws-page-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 0 4px; }
  body.focus-ui #workspaceGroupPage .ws-page-crumb { margin: 0; color: var(--muted); font-size: 13px; }
  body.focus-ui #workspaceGroupPage h1 { margin: 0; color: var(--heading); font: 400 28px/1.2 var(--serif); }
  body.focus-ui #workspaceGroupPage #workspaceGroupClose { grid-column: 2; grid-row: 1; width: 44px; height: 44px; border: 0; background: var(--field); border-radius: 50%; }
  body.focus-ui #workspaceGroupPage .ws-page-tabs { grid-column: 1 / -1; display: flex; flex-wrap: wrap; min-width: 0; gap: 8px; }
  body.focus-ui #workspaceGroupList { flex: 1; min-height: 0; margin: 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; align-content: start; gap: 6px; }
  body.focus-ui #workspaceGroupPage .ws-page-tabs button { flex: 0 1 auto; padding: 0 12px; border: 0; border-radius: 22px; background: var(--field); box-shadow: none; color: var(--text); font: 600 14px var(--sans); white-space: nowrap; }
  body.focus-ui #workspaceGroupPage .ws-page-tabs button[aria-selected="true"] { background: var(--ink); color: var(--on-ink); }
  body.focus-ui #workspaceGroupPage .ws-page-tabs b { margin-left: 6px; opacity: 0.7; }

  /* ---------- Projects: the list, then a project's conversations ---------- */
  body.focus-ui #projectsPanel .ws-picker-title { display: block; flex: 1; min-width: 0; }
  body.focus-ui #projectsPanel .ws-picker-title h1 { font: 400 28px/1.15 var(--serif); }
  body.focus-ui #projectsPanel .brand-copy { display: none; }
  body.focus-ui :is(.panel-bar) { border-bottom: 0; }
  body.focus-ui #chatsPanel .panel-title h1 { font: 400 24px/1.2 var(--serif); }
  body.focus-ui :is(.project-card, .session-card) :is(span, small, p, em, time, b) { font-size: max(13px, 1em); }
  body.focus-ui :is(.project-card, .session-card) .project-sync-status { font-family: var(--sans); }
  body.focus-ui :is(.pin-button, .row-menu-button) { min-width: 44px; min-height: 44px; font-size: 13px; }
  body.focus-ui .project-card .project-sync-status, body.focus-ui .project-group-count { font-size: 13px; }
  body.focus-ui :is(#brandMark, #workspaceDashboardButton, [data-testid="workspace-dashboard-button"], .project-group-toggle) { min-width: 44px; min-height: 44px; }
  body.focus-ui #brandMark { display: grid; place-items: center; }
  body.focus-ui #chatsPanel #projectName { display: flex; align-items: center; min-height: 44px; }
  body.focus-ui #chatsPanel :is([data-testid="context-references-open-button"], [data-testid="worktree-create-button"], .worktree-reference-button, .worktree-add-button) { min-height: 44px; font-size: 13px; }
  body.focus-ui #attachButton { min-width: 44px; min-height: 44px; }
  body.focus-ui #contextUsageText { font-size: 13px; }

  /* ---------- New: compact circular + button in the top bar (nothing floats over list rows) ---------- */
  body.focus-ui.view-projects .ph-fab { display: inline-flex; }
  .ph-fab {
    position: fixed; z-index: 49; top: calc(4px + env(safe-area-inset-top, 0px)); right: calc(54px + env(safe-area-inset-right, 0px)); bottom: auto;
    align-items: center; justify-content: center; width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 5px;
    border: 0; border-radius: 50%; background: var(--btn-bg); background-clip: content-box; box-shadow: none; color: var(--btn-fg); font: 650 14px var(--sans);
  }
  .ph-fab svg { width: 18px; height: 18px; }
  /* Reserve space beside ⋯ on Projects & Sessions top bars so titles never sit behind the circular + button. */
  body.focus-ui #projectsPanel > .panel-bar > .brand { display: none; }
  body.focus-ui :is(#projectsPanel, #chatsPanel) > .panel-bar > .panel-title { flex: 1 1 auto; min-width: 0; padding-right: 52px; }
  body.focus-ui :is(#projectsPanel, #chatsPanel) > .panel-bar > .panel-title > :is(h1, h2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* The menus live in the desktop column; on the phone only they are shown, from their own buttons. */
  body.focus-ui .ws-side { display: contents; }
  body.focus-ui .ws-side > :not(.ws-menu) { display: none !important; }
  body.focus-ui .ws-menu:popover-open {
    position: fixed; inset: auto 0 0 0 !important; display: grid; gap: 2px; width: 100%; max-width: none; max-height: 80dvh; margin: 0; overflow: auto;
    padding: 12px 12px calc(14px + env(safe-area-inset-bottom, 0px)); border: 0; border-radius: 28px 28px 0 0; background: var(--panel); color: var(--text);
    box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.22);
  }
  body.focus-ui .ws-menu::backdrop { background: color-mix(in srgb, var(--ink) 32%, transparent); }
  body.focus-ui .ws-menu-harnesses { display: grid; gap: 2px; }
  body.focus-ui .ws-menu-harnesses[hidden] { display: none; }
  body.focus-ui .ws-menu .ws-menu-item {
    display: flex; align-items: center; gap: 14px; width: 100%; height: auto; min-height: 52px; padding: 6px 14px; border: 0; border-radius: 14px;
    background: transparent; box-shadow: none; color: var(--text); font: 500 16px/1.3 var(--sans); text-align: left;
  }
  body.focus-ui .ws-menu .ws-menu-item:disabled { opacity: 0.45; }
  body.focus-ui .ws-menu .ws-menu-item :is(svg, img) { flex: none; width: 22px; height: 22px; color: var(--muted); }
  body.focus-ui .ws-menu .ws-menu-item small { display: block; color: var(--muted); font-size: 13px; }
  body.focus-ui .ws-menu .ws-item-label { display: inline; }

  /* ---------- the ⋯ handle at the end of every top bar ---------- */
  body.focus-ui #focusControlsButton {
    position: relative; inset: auto; display: grid; flex: none; place-items: center; width: 44px; min-width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%;
    background: transparent; box-shadow: none; color: var(--text); cursor: pointer; touch-action: manipulation; user-select: none;
  }
  body.focus-ui #focusControlsButton[hidden] { display: none; }
  body.focus-ui #focusControlsButton .focus-more-icon { display: block; width: 20px; height: 20px; pointer-events: none; }
  body.focus-ui #focusControlsButton .focus-pending-badge { top: 2px; right: 2px; min-width: 20px; height: 20px; border-width: 1.5px; font-size: 13px; }
  /* Inside a conversation, ⋯ is this conversation's details sheet — never show the global review counter on it. */
  body.focus-ui.view-chat #focusControlsButton .focus-pending-badge { display: none; }
  body.focus-ui #focusControlsButton:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

  /* ---------- the sheet: a conversation's details, or a screen's actions ---------- */
  body.focus-ui .focus-scrim:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 55; background: color-mix(in srgb, var(--ink) 32%, transparent); }
  .focus-controls {
    position: fixed; z-index: 56; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; max-height: calc(var(--focus-height, 100dvh) - 72px - env(safe-area-inset-top, 0px));
    padding: 8px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-radius: 28px 28px 0 0; background: var(--panel); color: var(--text);
    box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.22);
  }
  .focus-controls[hidden], .focus-controls [hidden] { display: none !important; }
  .focus-grab { display: block; flex: none; width: 36px; height: 4px; margin: 0 auto 8px; border-radius: 2px; background: var(--muted); opacity: 0.4; }
  .focus-controls > header { display: flex; flex: none; align-items: flex-start; gap: 8px; padding: 0 0 12px; }
  .focus-head-copy { display: grid; flex: 1; gap: 3px; min-width: 0; padding-top: 6px; }
  #focusContextTitle { overflow: hidden; color: var(--heading); font: 400 22px/1.2 var(--serif); text-overflow: ellipsis; white-space: nowrap; }
  #focusContextMeta { overflow: hidden; color: var(--muted); font-size: 13.5px; text-overflow: ellipsis; white-space: nowrap; }
  .focus-controls button:not(.searchable-select-trigger) {
    appearance: none; display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 48px; padding: 10px 12px; border: 0; border-radius: 14px;
    background: transparent; box-shadow: none; color: var(--text); font: 500 15px/1.3 var(--sans); text-align: left; cursor: pointer;
  }
  .focus-controls button:disabled { opacity: 0.45; cursor: not-allowed; }
  .focus-controls button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  .focus-controls button svg { flex: 0 0 22px; width: 22px; height: 22px; color: var(--muted); }
  .focus-controls > header button { flex: 0 0 44px; justify-content: center; width: 44px; min-height: 44px; padding: 0; border-radius: 50%; background: var(--field); }
  .focus-controls > header button svg { flex-basis: 18px; width: 18px; height: 18px; }
  .focus-context-scroll { flex: 1 1 auto; min-height: 0; margin: 0 -4px; padding: 0 4px 8px; overflow: auto; overscroll-behavior: contain; }
  .focus-heading { display: block; margin: 14px 4px 6px; color: var(--muted); font: 400 15px/1.2 var(--serif); }

  /* Activity / Files / Git / Tasks */
  .focus-panels { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
  .focus-controls .focus-panels button { position: relative; flex-direction: column; justify-content: center; gap: 5px; min-height: 64px; padding: 6px 2px; background: var(--field); font-size: 13px; font-weight: 600; text-align: center; }
  .focus-panel-count { position: absolute; top: 5px; right: 8px; color: var(--ws-rev); font: 700 13px/1 var(--sans); }

  /* The four run settings and the two switches: rows on one filled block. */
  .focus-group { display: grid; margin: 0 0 12px; overflow: hidden; border-radius: 16px; background: var(--field); }
  .focus-setting { display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 52px; margin: 0; padding: 0 4px 0 14px; }
  .focus-setting + .focus-setting { box-shadow: inset 0 1px 0 var(--line); }
  .focus-setting-label { flex: none; margin: 0; color: var(--text); font: 500 16px/1.2 var(--sans); letter-spacing: 0; text-transform: none; }
  .focus-setting > :last-child { display: flex; flex: 1; justify-content: flex-end; min-width: 0; }
  .focus-setting .searchable-select { min-width: 0; max-width: 100%; }
  .focus-controls .focus-setting .searchable-select-trigger {
    min-height: 48px; max-width: 100%; padding: 0 30px 0 8px; border: 0; background-color: transparent; background-position: right 10px center; box-shadow: none;
    color: var(--muted); font: 500 15px/48px var(--sans); text-align: right;
  }
  .focus-controls .searchable-select-option { align-items: flex-start; text-align: left; }
  .focus-controls .focus-switches button { justify-content: flex-start; width: 100%; min-height: 52px; padding: 0 14px; border-radius: 0; font-size: 16px; }
  .focus-switches button + button { box-shadow: inset 0 1px 0 var(--line); }
  .focus-switch-label { flex: 1; min-width: 0; }
  .focus-switches .focus-state { position: relative; flex: none; width: 44px; height: 26px; border-radius: 13px; background: var(--paper-raised); box-shadow: inset 0 0 0 1px var(--line); transition: background 0.2s; }
  .focus-switches .focus-state::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22); transition: left 0.2s; }
  .focus-switches button[aria-checked="true"] .focus-state { background: var(--accent); box-shadow: none; }
  .focus-switches button[aria-checked="true"] .focus-state::after { left: 21px; }

  /* This conversation's other tools, and the places: rows of two, icon then words. */
  .focus-tools-list, .focus-more, #focusContextActions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  #focusContextActions { margin-bottom: 4px; }
  #focusContextActions:empty { display: none; }
  .focus-controls :is(.focus-more, .focus-tools-list, #focusContextActions) button { position: relative; min-height: 52px; padding: 8px 10px; background: var(--field); font-size: 14.5px; }
  .focus-tools-list button[aria-pressed="true"] { color: var(--accent); }
  .focus-tools-list button[aria-pressed="true"] svg { color: var(--accent); }
  .focus-more :is(#focusRunningCount, #focusReviewCount), .focus-tools-list .focus-pending-badge, .focus-more .phone-waiting { position: static; margin-left: auto; min-width: 22px; height: 22px; border: 0; font-size: 13px; }

  /* Mark done stays at the bottom of the sheet. */
  .focus-dock { display: grid; flex: none; padding-top: 10px; }
  /* Mark reviewed and Mark done split the row. */
  .focus-dock { grid-template-columns: 1fr 1fr; gap: 8px; }
  .focus-dock > :not(#focusMarkDone, #focusMarkReviewed) { grid-column: 1 / -1; }
  .focus-controls .focus-dock #focusMarkReviewed { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 12px; border: 0; border-radius: 14px; background: var(--field); color: var(--text); font: 600 16px var(--sans); }
  .focus-controls .focus-dock #focusMarkReviewed:disabled { opacity: 0.45; }
  .focus-controls .focus-dock #focusMarkDone { justify-content: center; min-height: 52px; border-radius: 14px; background: var(--btn-bg); color: var(--btn-fg); font-size: 16px; font-weight: 650; }
  .focus-controls .focus-dock #focusMarkDone svg { color: currentColor; }
  .focus-dock .focus-state, .focus-more .focus-state { display: none; }

  /* ---------- a conversation: back, title and state, quiet inline model bar, messages, pill composer ---------- */
  body.focus-ui .chat-topbar { min-height: 56px; gap: 4px; padding: calc(6px + env(safe-area-inset-top, 0px)) 6px 6px; border-bottom: 1px solid var(--line); background: var(--bg); }
  body.focus-ui .chat-topbar .icon-button, body.focus-ui .chat-topbar .back-button { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
  body.focus-ui .chat-topbar .back-button { font-size: 28px; line-height: 1; }
  /* Two lines at most: the title, then the worktree, project and timer side by side. */
  body.focus-ui .chat-title-block { display: grid; flex: 1; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 1px 8px; min-width: 0; }
  body.focus-ui .chat-topbar .chat-title-block > h2 { grid-column: 1 / 4; grid-row: 1; overflow: hidden; font: 600 16px/1.25 var(--sans); text-overflow: ellipsis; white-space: nowrap; }
  body.focus-ui .chat-title-meta { display: contents; }
  body.focus-ui .chat-title-block > #conversationWorktreeIndicator { grid-column: 1; grid-row: 2; max-width: 42vw; padding: 0 6px; border: 0; border-radius: 6px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
  body.focus-ui .chat-title-meta > .chat-project-name { display: block; grid-column: 2; grid-row: 2; max-width: none; overflow: hidden; color: var(--muted); font: 400 13px/1.3 var(--sans); letter-spacing: 0; text-overflow: ellipsis; text-transform: none; white-space: nowrap; }
  body.focus-ui .chat-title-meta > .turn-timer { grid-column: 3; grid-row: 2; font-size: 13px; color: var(--muted); }
  body.focus-ui .chat-title-meta > .chat-actions { grid-column: 4; grid-row: 1 / span 2; }
  /* Minimalist borderless inline context bar (replaces 4 bulky 44 px outlined oval pills). */
  body.focus-ui.view-chat .ph-chips { display: flex; flex: none; align-items: center; gap: 0; min-width: 0; padding: 0 10px; border-bottom: 1px solid var(--line); background: var(--bg); overflow-x: auto; scrollbar-width: none; }
  body.focus-ui.view-chat .ph-chips::-webkit-scrollbar { display: none; }
  .ph-chips .searchable-select { flex: none; max-width: 56vw; display: inline-flex; align-items: center; }
  .ph-chips .searchable-select + .searchable-select::before { content: "·"; color: var(--muted); opacity: 0.6; font-size: 14px; padding: 0 1px; }
  .ph-chips .searchable-select-trigger {
    min-width: 44px; min-height: 44px; height: 44px; max-width: 100%; overflow: hidden; padding: 0 22px 0 8px; border: 0; border-radius: 10px; text-overflow: ellipsis; white-space: nowrap; background-color: transparent; background-position: right 6px center;
    box-shadow: none; color: var(--muted); font: 500 13.5px/44px var(--sans);
  }
  /* Minimalist single-line pill composer: one cohesive Paper surface. */
  body.focus-ui.view-chat #chatPanel .composer { border-top: 0; background: var(--bg); padding: 8px 12px max(12px, env(safe-area-inset-bottom, 0px)); }
  body.focus-ui.view-chat #chatPanel .composer-row {
    align-items: center; gap: 2px; padding: 3px 4px; border-radius: 26px;
    background: var(--panel); box-shadow: 0 0 0 1px var(--line-strong);
  }
  body.focus-ui.view-chat #chatPanel .composer-row:focus-within { box-shadow: 0 0 0 1.5px var(--accent); }
  body.focus-ui.view-chat #chatPanel #attachButton:focus-visible { outline: none; }
  body.focus-ui.view-chat #chatPanel :is(#attachButton, #savedCommandsButton) {
    flex: 0 0 44px; width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0;
    border: 0; border-radius: 50%; background: transparent; box-shadow: none; color: var(--muted);
  }
  body.focus-ui.view-chat #chatPanel :is(#messageInput, .composer-measure) {
    min-height: 44px; padding: 10px 6px; border: 0; border-radius: 0; background: transparent; box-shadow: none; font-size: 16px;
  }
  body.focus-ui.view-chat #chatPanel #sendButton {
    flex: 0 0 44px; width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0;
    border-radius: 50%; box-shadow: none;
  }
  /* Quiet skills chip instead of a harsh green terminal box. */
  body.focus-ui .message-skills { border: 0; border-radius: 10px; background: var(--field); padding: 4px 10px; font-family: var(--sans); font-size: 12px; color: var(--muted); }

  /* ---------- Bob: the control center as a phone page, over the tabs ---------- */
  body.focus-ui.view-control .shell > #controlCenterPanel { height: 100%; }
  body.focus-ui #controlCenterPanel :is(.phone-back, .control-bell, #controlChatMonitor, #controlChatSettingsButton, .team-phone-entry, .phone-chip, .control-chip, #controlChatAttach, #controlChatFilterProject, #controlChatProject, .phone-view-bar button) {
    min-width: 44px; min-height: 44px; font-size: 14px;
  }
  body.focus-ui #controlCenterPanel .phone-back { font-size: 28px; }
  body.focus-ui #controlCenterPanel .control-chip { padding-inline: 12px; }

  /* Phone-native Bob: a compact head (his name and state, then the ⋯ that holds Monitoring, Settings, Dashboards and
     the shared team), one scrolling row of filters, the chat, and the composer over the tabs. Bob's settings are a
     screen of their own with full-width rows. Bob is a tab, so his head has no Back. */
  body.focus-ui #controlCenterPanel > .team-context-label { display: none; }
  body.focus-ui .control-chat-head { gap: 4px; min-height: 56px; padding: 6px 6px 6px 18px; border: 0; }
  body.focus-ui .control-chat-head > :is(.phone-back, #controlChatMonitor, #controlChatSettingsButton, #controlChatSide, .team-phone-entry) { display: none; }
  body.focus-ui .control-chat-head > div > b { font: 400 24px/1.15 var(--serif); color: var(--heading); }
  body.focus-ui .control-chat-head > div > small { font-size: 13px; }
  body.focus-ui #controlCenterPanel .phone-strip { flex: none; flex-wrap: nowrap; overflow-x: auto; gap: 8px; padding: 3px 16px 8px; scrollbar-width: none; }
  body.focus-ui #controlCenterPanel .phone-strip::-webkit-scrollbar, body.focus-ui #controlChatFilters::-webkit-scrollbar { display: none; }
  body.focus-ui #controlCenterPanel .phone-strip > * { flex: none; }
  body.focus-ui #controlCenterPanel .phone-strip > [data-testid="control-phone-chip-dashboards"] { display: none; }
  body.focus-ui #controlCenterPanel .phone-strip:not(:has(> :not([data-testid="control-phone-chip-dashboards"]))) { display: none; }
  body.focus-ui #controlCenterPanel .phone-control-shortcuts { display: flex; flex: none; flex-wrap: wrap; gap: 6px; padding: 6px 12px; }
  body.focus-ui #controlCenterPanel .phone-control-shortcuts .phone-chip { flex: 1 0 auto; justify-content: center; }
  /* The filters wrap: the project picker takes the first line, the chips follow, and nothing is cut at the edge. */
  body.focus-ui #controlChatFilters { flex-wrap: wrap; gap: 8px; overflow: visible; padding: 4px 16px 10px; border: 0; }
  body.focus-ui #controlChatFilters > * { flex: none; }
  /* Five chips share the second line (a lone "Cleared" used to wrap onto a third at 360 px). */
  body.focus-ui #controlChatFilters { gap: 6px; padding-inline: 12px; }
  body.focus-ui #controlChatFilters > .control-chip { flex: 1 1 auto; min-width: 44px; min-height: 44px; padding: 0 8px; font-size: 13px; white-space: nowrap; }
  body.focus-ui #controlChatFilters > :is(label, .searchable-select, select):first-child { flex: 1 1 100%; max-width: none; }
  body.focus-ui #controlChatFilters select, body.focus-ui #controlChatFilters .searchable-select-trigger { width: 100%; max-width: none; border-radius: 22px; }
  body.focus-ui #controlChatFilters .control-chip-word { display: inline; }
  body.focus-ui .control-chat-messages { padding: 8px 16px 12px; }
  body.focus-ui #controlChat { min-height: 0; }
  body.focus-ui .control-chat-form { flex: none; padding: 8px 12px 10px; border-top: 1px solid var(--line); background: var(--panel); }

  /* Bob's settings: their own screen over the chat, above the tabs, with a way back. */
  body.focus-ui #controlChat:has(> #controlChatSettings:not([hidden])) > :is(.control-chat-head, .phone-strip, .phone-control-shortcuts, .control-chat-paused, #controlChatFilters, #controlChatMessages, #controlChatForm) { display: none; }
  body.focus-ui #controlChatSettings:not([hidden]) {
    position: static; display: flex; flex: 1 1 auto; flex-direction: column; gap: 0; min-height: 0; max-height: none; overflow-y: auto;
    padding: 0 0 24px; border: 0; background: var(--bg); overscroll-behavior: contain;
  }
  body.focus-ui #controlChatSettings:not([hidden]) > * { flex: none; }
  body.focus-ui #controlChatSettings input[type="checkbox"] { width: 22px; height: 22px; }
  body.focus-ui #controlChatSettings > .bob-settings-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 6px; min-height: 56px; padding: 6px 16px 6px 6px; background: var(--bg); }
  body.focus-ui #controlChatSettings > .bob-settings-head b { font: 400 22px/1.2 var(--serif); color: var(--heading); }
  body.focus-ui #controlChatSettings > .bob-settings-head button { min-width: 44px; min-height: 44px; font-size: 26px; }
  body.focus-ui #controlChatSettings > b { margin: 12px 20px 6px; color: var(--muted); font: 400 15px/1.2 var(--serif); }
  body.focus-ui #controlChatSettings > :is(label, .control-guard, .control-hint, .telegram-settings, section, div:not(.bob-settings-head)) { margin: 0 16px; }
  body.focus-ui #controlChatSettings > label {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 8px 14px; background: var(--field);
    color: var(--text); font-size: 15px; box-shadow: inset 0 -1px 0 var(--line);
  }
  body.focus-ui #controlChatSettings > b + label { border-radius: 16px 16px 0 0; }
  body.focus-ui #controlChatSettings > label:has(+ :not(label)) { border-radius: 0 0 16px 16px; box-shadow: none; margin-bottom: 12px; }
  body.focus-ui #controlChatSettings > label > :is(select, .searchable-select-trigger) { flex: 0 1 auto; max-width: 58%; min-height: 44px; border: 0; background-color: transparent; box-shadow: none; color: var(--muted); font-size: 15px; text-align: right; }
  body.focus-ui #controlChatSettings > label > input[type="number"] { flex: none; width: 72px; max-width: 72px; min-height: 40px; text-align: right; }
  body.focus-ui #controlChatSettings > label.control-check { justify-content: flex-start; flex-direction: row-reverse; }
  body.focus-ui #controlChatSettings > label.control-check input { margin-left: auto; width: 22px; height: 22px; }
  /* The standing instructions: label over a full-width box. */
  body.focus-ui #controlChatSettings > label:has(> textarea) { flex-direction: column; align-items: stretch; gap: 8px; padding: 12px 14px 14px; }
  body.focus-ui #controlChatSettings > label > textarea { width: 100%; min-height: 140px; font-size: 16px; }
  body.focus-ui #controlChatSettings > :is(.control-guard, div:not(.bob-settings-head):not(.control-guard)) { margin-top: 10px; padding: 12px 14px; border: 0; border-radius: 16px; background: var(--field); font-size: 14px; }
  body.focus-ui #controlChatSettings .control-hint { margin-top: 10px; font-size: 13px; }
  /* The open conversation's row keeps the same bare pin and ⋮ as the other rows. */
  body.focus-ui :is(.session-list, .project-list) .list-row.active .row-action-button:not(.pinned) { background: transparent; }
  /* Bob's messages and cards: buttons a thumb can hit (44 px), Answer in the accent on a card about a conversation,
     and the quiet lines (who, labels, when, why) large enough to read. */
  body.focus-ui #controlChatMessages .control-actions { gap: 8px; margin-top: 8px; }
  body.focus-ui #controlChatMessages .control-action { min-height: 44px; padding: 0 16px; border-radius: 12px; font-size: 14.5px; }
  body.focus-ui #controlChatMessages .control-entry.about .control-action[data-testid="control-item-reply"] { order: -1; border-color: transparent; background: var(--accent); color: var(--btn-fg, #fff); }
  /* One filled button per card, as on the desktop: the other ways forward are tinted or plain. */
  body.focus-ui #controlChatMessages .control-entry.about .control-action.primary:not([data-testid]) { border-color: transparent; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
  body.focus-ui #controlChatMessages .control-entry.about .control-action.warn { border-color: var(--line-strong); background: transparent; color: var(--ws-need, #b86e00); }
  body.focus-ui #controlChatMessages .control-source { font-size: 13.5px; }
  body.focus-ui #controlChatMessages .control-label { font-size: 11.5px; }
  body.focus-ui #controlChatMessages .control-time { font-size: 12.5px; }
  body.focus-ui #controlChatMessages .control-via { font-size: 13px; line-height: 1.4; }
  body.focus-ui #controlChatMessages [data-testid="control-chat-about"] { display: inline-flex; align-items: center; min-height: 44px; font: 400 18px/1.25 var(--serif); }

  /* ---------- Teams: the same Paper page as Bob's, a tab of its own ---------- */
  /* The title is Teams (control-phone.js); Teams is a tab, so the head has no Back, and the team picker is one pill under it. */
  body.focus-ui.team-context-active .phone-view-bar { padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 0; border-bottom: 0; background: var(--panel); }
  body.focus-ui.team-context-active .phone-view-bar > button { display: none; }
  body.focus-ui.team-context-active .phone-view-bar > b { font: 400 24px/1.15 var(--serif); color: var(--heading); }
  body.focus-ui .team-phone-context { padding: 8px 16px 4px; background: var(--panel); font-size: 0; }
  body.focus-ui .team-phone-context select { min-height: 44px; padding: 0 36px 0 16px; border-radius: 22px; font-size: 15px; }
  /* The sections of a team are a quiet row of tabs; the way back to Personal Bob is Bob's own tab below. */
  body.focus-ui .team-workspace-tabs { gap: 2px; padding: 0 10px; background: var(--panel); scrollbar-width: none; }
  body.focus-ui .team-workspace-tabs::-webkit-scrollbar { display: none; }
  body.focus-ui .team-ws-tab { min-height: 44px; padding: 0 10px; border-radius: 0; font: 500 13.5px/1.2 var(--sans); }
  body.focus-ui .team-ws-tab.active { color: var(--heading); font-weight: 650; }
  body.focus-ui .team-back-btn { display: none; }
  /* The team's members: one quiet row that opens. */
  body.focus-ui .team-side { max-height: none; padding: 10px 16px 0; border-bottom: 0; }
  body.focus-ui .team-side-summary { align-items: center; min-height: 44px; padding: 0 14px; border-radius: 14px; background: var(--field); font: 600 14px/1.2 var(--sans); color: var(--heading); }
  body.focus-ui .team-side[open] > .team-side-summary { border-radius: 14px 14px 0 0; }
  body.focus-ui .team-side-body { margin-top: 0; padding: 4px 14px 8px; border-radius: 0 0 14px 14px; background: var(--field); }
  /* The conversation: messages from the team over the composer, as in Bob's chat. */
  body.focus-ui .team-thread { padding: 12px 16px; gap: 16px; font-size: 15px; }
  body.focus-ui .team-thread > :first-child { margin-top: auto; }
  body.focus-ui .team-msg-who { font-size: 13px; }
  body.focus-ui .team-turn-actions { flex-wrap: wrap; gap: 8px; }
  body.focus-ui .team-turn-link { min-height: 44px; padding: 0 16px; border-radius: 12px; background: var(--field); color: var(--text); font: 600 14px var(--sans); text-decoration: none; }
  body.focus-ui .team-work-form { padding: 8px 12px 10px; border-top: 0; background: var(--panel); }
  body.focus-ui .team-send-row { align-items: center; gap: 2px; padding: 3px 4px 3px 14px; border-radius: 26px; background: var(--panel); box-shadow: 0 0 0 1px var(--line-strong); }
  body.focus-ui .team-send-row:focus-within { box-shadow: 0 0 0 1.5px var(--accent); }
  body.focus-ui .team-send-row textarea { flex: 1 1 auto; min-height: 44px; padding: 12px 6px; border: 0; border-radius: 0; background: transparent; box-shadow: none; font-size: 16px; }
  /* The row already marks focus; override Paper's generic textarea ring. */
  body.focus-ui .team-work-form .team-send-row > textarea:focus-visible { box-shadow: none; }
  body.focus-ui .team-send-row .primary { flex: none; display: grid; place-items: center; width: 44px; min-height: 44px; height: 44px; padding: 0; border-radius: 50%; border-color: transparent; background: var(--btn-bg); color: var(--btn-fg); font-size: 0; }
  body.focus-ui .team-send-row .primary::before { content: ""; width: 22px; height: 22px; background: currentColor; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5m-6 6 6-6 6 6'/%3E%3C/svg%3E") center / contain no-repeat; }

  /* ---------- dialogs on the phone: a sheet from the bottom, or a page ---------- */
  /* Every dialog is a sheet from the bottom edge, as tall as its content up to the screen; the long ones (a dashboard,
     Git review, a diff, files, issues, tasks, costs, search, a task, a note, a secret) are pages that fill the screen.
     Settings and Bob's side chat have their own full-screen layouts. Buttons and fields are at least 44 px. */
  dialog[open]:not(#settingsDialog, .by-the-way-dialog, .message-image-viewer) { inset: auto 0 0 0; width: 100%; max-width: 100%; height: auto; margin: 0; }
  dialog:not(#settingsDialog, .by-the-way-dialog, .message-image-viewer) > .dialog-card {
    width: 100% !important; max-width: 100% !important; max-height: calc(100dvh - 16px - env(safe-area-inset-top, 0px));
    /* Each card keeps its own padding (Git review, Files and the dashboards lay out their own edges); the home
       indicator's inset is a clear border the card's fill shows through. */
    border: 0 solid transparent; border-bottom-width: env(safe-area-inset-bottom, 0px); border-radius: 24px 24px 0 0;
    box-shadow: 0 -10px 36px color-mix(in srgb, var(--ink) 16%, transparent);
  }
  dialog:is(#dashboardDialog, #gitReviewDialog, #gitDiffDialog, #projectFilesDialog, #projectIssuesDialog, #backgroundTasksDialog, #controlDashboardDialog, #controlAssistantDialog, #usageDialog, #spotlightDialog, #taskDialog, #quickNoteDialog, #secretAccountDialog, #fileActionDialog) > .dialog-card {
    height: 100dvh !important; max-height: 100dvh !important; border-top-width: env(safe-area-inset-top, 0px); border-radius: 0; box-shadow: none;
  }
  /* ---------- Terminal and Browser on the phone: pages over the conversation ---------- */
  /* Both were placed above a bottom bar the phone no longer has in a conversation (a strip of page showed under the
     terminal, the browser floated with margins). Each fills the screen, with Close in its own head. */
  body.focus-ui .terminal-dock:is([data-orientation="horizontal"], [data-orientation="vertical"]) {
    inset: 0; z-index: 54; width: 100%; height: 100dvh; border: 0;
    padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
  }
  body.focus-ui.terminal-open:is([data-terminal-orientation="horizontal"], [data-terminal-orientation="vertical"]) .shell { width: 100vw; height: 100dvh; }
  body.focus-ui .terminal-dock :is(.terminal-resize-handle, .terminal-orientation) { display: none; }
  body.focus-ui .terminal-dock .terminal-heading { flex-wrap: wrap; gap: 8px 10px; padding: 10px 12px 10px 18px; }
  body.focus-ui .terminal-dock .terminal-heading h2 { font: 400 22px/1.2 var(--serif); }
  body.focus-ui .terminal-dock .terminal-actions { margin-left: auto; }
  body.focus-ui .terminal-dock .terminal-actions button { min-height: 44px; padding-inline: 14px; font-size: 14.5px; }
  body.focus-ui.browser-visible #browserPanel { inset: 0; z-index: 53; border: 0; border-radius: 0; box-shadow: none; padding-top: env(safe-area-inset-top, 0px); }
  body.focus-ui #browserPanel :is(.browser-heading-actions > *, button:not(.searchable-select-option)) { min-width: 44px; min-height: 44px; }
  body.focus-ui #browserPanel .browser-heading-actions > a { display: inline-flex; align-items: center; }

  /* ---------- small controls and small print elsewhere on the phone ---------- */
  body.focus-ui #activityPanel :is(button, summary, [role="tab"]) { min-width: 44px; min-height: 44px; }
  body.focus-ui #activityPanel :is(.activity-instructions-name, .activity-instructions-preview, #activitySummaryText, .activity-stat-label) { font-size: 13px; }
  body.focus-ui .session-menu button, body.focus-ui .row-menu button { min-height: 48px; font-size: 15px; }
  /* A row's menu is a sheet from the bottom edge, as tall as its rows up to the screen, and scrolls beyond that. */
  body.focus-ui .row-menu:popover-open {
    inset: auto 0 0 0 !important; width: 100%; max-height: 80dvh; padding: 12px 12px calc(14px + env(safe-area-inset-bottom, 0px)); border: 0; border-radius: 28px 28px 0 0;
    box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.22);
  }
  body.focus-ui .row-menu::backdrop { background: color-mix(in srgb, var(--ink) 32%, transparent); }
  body.focus-ui .row-menu-pair button { font-size: 14.5px; }
  body.focus-ui .messages :is(.connection-note, .assistant-attribution, [data-testid="conversation-started-at"]) { font-size: 11.5px; }
  body.focus-ui .messages .message-time { white-space: nowrap; }
  /* The copy button stays small beside a message; its touch area is 44 px. */
  body.focus-ui .messages .message-copy { position: relative; }
  body.focus-ui .messages .message-copy::after { content: ""; position: absolute; inset: -8px; }
  /* The message box is one line until something is typed: its hint never wraps. */
  body.focus-ui #messageInput::placeholder { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  dialog:not(#settingsDialog) > .dialog-card :is(label, .field-label) { font-size: 13px; }
  dialog:not(#settingsDialog) > .dialog-card .color-swatch, dialog [data-testid$="color-swatch"] { width: 44px; height: 44px; min-height: 44px; padding: 4px; background-clip: content-box; }
  #usageDialog :is(#usageRefresh, [data-testid="usage-close"]) { min-width: 44px; }
  #usageDialog [data-testid="usage-filter-add"] { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 14px; }
  #dashboardClose { min-width: 44px; }
  /* The install card sits above the tabs and the New button; a conversation (no tabs, the message box at the foot)
     does not show it. */
  body.focus-ui .install-banner { bottom: calc(var(--ph-tabs-h) + 84px); width: calc(100% - 24px); border: 0; border-radius: 18px; }
  body.focus-ui.view-chat .install-banner { display: none; }
  body.focus-ui .install-banner-actions button { min-height: 44px; }
  #usageDialog[open] { padding: 0; }
  #usageDialog > .usage-card, .background-tasks-dialog > .background-tasks-card { margin: 0; }
  dialog:not(#settingsDialog) > .dialog-card :is(button:not(.searchable-select-option, .color-swatch, .icon-button), input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"]), select, .searchable-select-trigger) { min-height: 44px; }
  dialog:not(#settingsDialog) > .dialog-card .icon-button { min-width: 44px; min-height: 44px; }
  dialog:not(#settingsDialog) > .dialog-card .dialog-actions { gap: 10px; }
  dialog:not(#settingsDialog) > .dialog-card .dialog-actions > button { flex: 1 1 0; }
}

@keyframes ph-pulse { 50% { opacity: 0.45; } }
@keyframes ph-ring { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--live, var(--ws-run)) 10%, transparent); } }
@media (prefers-reduced-motion: reduce) {
  body.focus-ui .ws-dot.run { animation: none; }
}

/* ---------- New conversation on the phone ---------- */
/* A sheet: the title, the three steps as one segmented line, the step's fields (they scroll; app/dialog-layout.js
   keeps the focused one above the keyboard) and a foot that stays put: Cancel, then Back and Next where there is a
   step to go to, and Start as the one wide button under them. The keyboard-shortcut line is for desks. */
@media (max-width: 700px) {
  /* Any sheet: a field brought into view keeps its focus ring and its label's foot clear of the edge. */
  dialog .dialog-body :is(input, textarea, select, .searchable-select-trigger) { scroll-margin-block: 28px 10px; }
  .wizard-card { min-height: 0; }
  .wizard-card [data-testid="new-session-keyboard-hint"] { display: none; }
  .wizard-card > :first-child h2 { font-size: 22px; line-height: 1.2; }
  .wizard-card .wizard-steps { gap: 2px; padding: 3px; border-radius: 14px; background: var(--field); }
  .wizard-card .wizard-step {
    min-height: 44px; padding: 0 6px; border: 0; border-radius: 11px; background: transparent; color: var(--muted);
    font: 600 13px/1.2 var(--sans); white-space: nowrap;
  }
  .wizard-card .wizard-step.done { color: var(--text); }
  .wizard-card .wizard-step.active { background: var(--panel); color: var(--accent); box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 14%, transparent); }
  .wizard-card .wizard-panel { gap: 14px; }
  .wizard-card .wizard-panel :is(input:not([type="checkbox"], [type="radio"]), select) { font-size: 16px; }
  #newSessionNameDialog > .dialog-card.wizard-card > .dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding-top: 6px; }
  #newSessionNameDialog > .dialog-card.wizard-card > .dialog-actions > button { flex: 1 1 0; min-width: 0; min-height: 46px; }
  /* No step that way: the button leaves the row (step 1 has no Back, the last step no Next). Start stays: it is
     disabled while it works, and its "Creating worktree…" is the only sign that it does. */
  #newSessionNameDialog > .dialog-card.wizard-card > .dialog-actions > :is(#newSessionBackButton, #newSessionNextButton):disabled { display: none; }
  .wizard-card > .dialog-actions > .ghost { background: var(--field); }
  .wizard-card > .dialog-actions > #newSessionNextButton { background: color-mix(in srgb, var(--accent) 14%, var(--field)); color: color-mix(in srgb, var(--accent) 75%, var(--heading)); }
  #newSessionNameDialog > .dialog-card.wizard-card > .dialog-actions > .primary { flex: 1 0 100%; min-height: 50px; font-size: 16.5px; }
}
/* The keyboard is up (the page is as tall as what it leaves): the explanation goes and the sheet tightens, so the
   field being typed in and Start are both on screen. */
@media (max-width: 700px) and (max-height: 560px) {
  #newSessionNameDialog > .dialog-card.wizard-card { gap: 10px; padding: 14px 16px 12px; }
  .wizard-card > :first-child p { display: none; }
  .wizard-card > :first-child h2 { font-size: 19px; }
  #newSessionNameDialog > .dialog-card.wizard-card > .dialog-actions > button { min-height: 44px; }
  #newSessionNameDialog > .dialog-card.wizard-card > .dialog-actions > .primary { min-height: 46px; }
}

/* ---------- Costs on the phone: the filters open in the page ---------- */
/* The filter list hung from its button and ran off the right edge (and under the keyboard). On the phone it opens
   as a full-width block under the bar, so the page scrolls it and every field is reachable. */
@media (max-width: 700px) {
  #usageDialog .usage-filter-menu[open] { flex: 1 0 100%; }
  #usageDialog .usage-filter-menu > summary { width: max-content; }
  #usageDialog .usage-filter-popover { position: static; width: 100%; margin-top: 8px; box-shadow: none; }
}

/* ---------- Choosing one of a few (an agent, a branch) on the phone ---------- */
/* The row is the target (44 px) and shows the choice; its radio keeps a round shape, and the keyboard's focus is
   drawn on the row, not as a box around the dot. */
@media (max-width: 700px) {
  .choice-option { min-height: 48px; align-items: center; }
  .choice-option input[type="radio"] { width: 18px; height: 18px; min-height: 0; margin: 0; }
  dialog .choice-option input[type="radio"]:focus-visible { outline: none; }
  .choice-option:has(input:focus-visible) { box-shadow: 0 0 0 2px var(--accent); }
}

/* ---------- The phone's floor: text at least 13 px, controls at least 44 px, readable greys ---------- */
/* Found by the phone sweep (test/ui/ui-phone-audit.test.ts): screens built for the desktop kept 10 to 12.5 px words and
   28 to 40 px controls behind rules of their own, so the floor is !important. Keyboard hints (1-9 on a list) have no
   keyboard to point at, so they go. */
@media (max-width: 700px) {
  body.focus-ui :is(.list-shortcut-index, .spotlight-option-index) { display: none; }
  body.focus-ui :is(
    .eyebrow, .spotlight-kind, .spotlight-subtitle, .command-autocomplete-name, .command-autocomplete-description,
    #settingsForm .settings-scope, #settingsForm .settings-saved, #settingsForm .settings-saved-retry,
    #settingsForm .settings-panel .engine-defaults:not(:empty), #settingsForm .settings-panel .updates-node-state, .client-log-output,
    .quick-note-queue-toggle, .quick-note-queue-parallel, .quick-note-queue-hint, .quick-note-empty, #quickNotesQueue input,
    #quickNotesHeading span, #terminalStatusText, #backgroundTasksSummary, #usageRowCount, #usageSortNote, #usageStatus, #projectFilesStatus, #gitReviewStatus,
    .file-explorer-crumb, .git-review-tab, .git-review-status, .activity-section-status, .activity-placeholder,
    .usage-trend-label, .usage-trend-value, .usage-source, .usage-stat span, .usage-stat small, .usage-breakdown th, .usage-sort,
    .dashboard-example, .dashboard-eyebrow, #backgroundTasksDialog :is(p, span, .compact), #quickNoteImageButton, .install-banner-copy span, .install-banner-actions button, .usage-progress-count, .usage-progress-waiting,
    :is(#browserPanel, #activityPanel, #usageDialog, #gitReviewDialog) :is(summary, summary > span, small, label, .compact, [class*="browser-"], [class*="activity-"])
  ) { font-size: 13px !important; }
  body.focus-ui { --muted-strong: color-mix(in srgb, var(--muted) 62%, var(--text)); }
  body.focus-ui :is(.command-autocomplete-description, .quick-note-queue-parallel) { color: var(--muted-strong); }
  body.focus-ui #settingsForm .settings-panel .engine-defaults:not(:empty) { color: var(--muted); }
  body.focus-ui #settingsForm .settings-scope { min-height: 28px; color: color-mix(in srgb, var(--accent) 78%, var(--heading)); }
  body.focus-ui #contextUsage:not(.warn):not(.danger) { color: color-mix(in srgb, var(--live) 65%, var(--text)); }
  body.focus-ui #settingsForm .settings-panel .secret-type-toolbar > :is(input, .secret-account-search) { flex: 1 1 140px; min-width: 120px; }
  :root[data-theme="dark"] .phone-chip.ok { color: #1a0d09; }
  body.focus-ui #settingsForm .settings-panel .updates-node-state { color: var(--text); }
  body.focus-ui #usageDialog small { color: color-mix(in srgb, var(--muted) 82%, var(--text)); }

  body.focus-ui .ws-show-all { min-height: 44px; }
  body.focus-ui :is(#quickNotesProjectFilter, #quickNoteButton, #quickNotesQueueParallel, .quick-note-queue-toggle, .usage-sort, #projectFilesUpButton, #secretAccountAddButton, #settingsForm input[type="range"]) { min-height: 44px !important; }
  body.focus-ui :is(#quickNoteButton, .usage-sort, #projectFilesUpButton, #secretAccountAddButton) { min-width: 44px; }
  body.focus-ui #quickNotesQueue { gap: 4px 14px; }
  body.focus-ui :is(dialog, #browserPanel, #settingsForm) summary { box-sizing: border-box; min-height: 44px; padding-block: 12px; }
  body.focus-ui .toast-close { min-width: 44px; min-height: 44px; margin: -11px -15px -11px -8px; font-size: 18px; }
  /* Connections: the profile cards' status pills and detail lines. */
  body.focus-ui .profile-card-meta span, body.focus-ui .profile-status-detail { font-size: 13px; }
  body.focus-ui .profile-pill { height: 26px; font-size: 13px; color: color-mix(in srgb, var(--pill) 62%, var(--ink)); }
}

/* ---------- The Teams page on a phone: a frosted bar of places at the bottom instead of the row of tabs, and larger type ---------- */
@media (max-width: 700px) {
  body.teams-view { --team-bar: calc(62px + env(safe-area-inset-bottom, 0px)); }
  body.teams-view .team-phone-bar {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; inset: auto 0 0; z-index: 40;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid color-mix(in srgb, var(--line-strong) 55%, transparent);
    background: color-mix(in srgb, var(--panel) 68%, transparent); -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px);
  }
  /* The keyboard needs the room while a message is written. */
  body.teams-view:has(.team-work-form textarea:focus) .team-phone-bar { display: none; }
  body.teams-view:has(.team-work-form textarea:focus) { --team-bar: 0px; }
  .team-phone-place {
    display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 50px; padding: 2px 0; border: 0; border-radius: 14px;
    background: none; color: var(--muted); font: 600 12px/1.1 var(--sans); cursor: pointer;
  }
  .team-phone-place:disabled { opacity: .4; }
  .team-phone-place-icon { display: grid; place-items: center; width: 56px; height: 30px; border-radius: 15px; transition: background-color .25s; }
  .team-phone-place-icon::before { content: ""; width: 22px; height: 22px; background: currentColor; mask: var(--icon) center / contain no-repeat; }
  .team-phone-place.active { color: var(--accent); }
  .team-phone-place.active .team-phone-place-icon { background: color-mix(in srgb, var(--accent) 16%, transparent); }
  [data-place="teams"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.5'/%3E%3Cpath d='M2.5 20a6.5 6.5 0 0 1 13 0M16 4.5a3.5 3.5 0 0 1 0 7M18 14.2a6.5 6.5 0 0 1 3.5 5.8'/%3E%3C/svg%3E"); }
  [data-place="threads"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6h12M9 12h12M9 18h12'/%3E%3Ccircle cx='4' cy='6' r='1'/%3E%3Ccircle cx='4' cy='12' r='1'/%3E%3Ccircle cx='4' cy='18' r='1'/%3E%3C/svg%3E"); }
  [data-place="chat"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a8 8 0 0 1-11.6 7.1L4 20.5l1.4-4.6A8 8 0 1 1 21 12z'/%3E%3C/svg%3E"); }
  [data-place="settings"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h10M18 7h2M4 17h4M12 17h8'/%3E%3Ccircle cx='16' cy='7' r='2'/%3E%3Ccircle cx='10' cy='17' r='2'/%3E%3C/svg%3E"); }
  html:is([data-motion="playful"], [data-motion="calm"]) .team-phone-place.active .team-phone-place-icon::before { animation: team-rise .35s var(--m-ease); }

  /* The bar replaces the tabs, and nothing ends under it. */
  body.teams-view .team-workspace-tabs { display: none; }
  body.teams-view .team-control:not([data-testid="team-live-view"]) { padding-bottom: calc(var(--team-bar) + 20px); }
  body.focus-ui.teams-view .team-work-form { padding-bottom: calc(var(--team-bar) + 10px); }
  body.teams-view:not(.team-context-active) .team-sidebar-section { padding-bottom: calc(var(--team-bar) + 24px); }

  /* Type to read on a phone. */
  body.focus-ui.teams-view .team-thread { font-size: 17px; line-height: 1.5; gap: 18px; }
  body.focus-ui.teams-view .team-msg-who { font-size: 14px; }
  body.focus-ui.teams-view .team-msg-time { font-size: 12.5px; }
  body.focus-ui.teams-view .team-muted { font-size: 15px; }
  body.focus-ui.teams-view :is(.team-turn-answers, .team-turn-conversation) { font-size: 13px; }
  body.focus-ui.teams-view .team-turn-link { font-size: 15px; }
  body.focus-ui.teams-view .team-send-row textarea { font-size: 17px; }
  body.focus-ui.teams-view .team-work-form > select { font-size: 15px; }
  body.focus-ui.teams-view .team-side-summary { font-size: 15.5px; }
  body.focus-ui.teams-view .team-control:not([data-testid="team-live-view"]) { font-size: 16px; }
  body.focus-ui.teams-view :is(.team-field > span, .team-check-row, .team-rail-hint) { font-size: 15px; }
  body.focus-ui.teams-view .team-card h3 { font-size: 18px; }
  body.focus-ui.teams-view .team-section-eyebrow { font-size: 12.5px; }
  body.focus-ui.teams-view .team-mic { width: 44px; height: 44px; border: 0; background: none; }
  /* While it records, the microphone is the way to send it. */
  body.focus-ui .team-send-row.is-recording > .primary { display: none; }
  body.focus-ui.teams-view .team-send-row.is-recording > .team-mic { background: var(--danger); color: #fff; }
}
