/* ============================================================================
   THE BETA SHELL (beta UI, step 2, 2026-11-17)
   ----------------------------------------------------------------------------
   The desktop shell of the owner's approved Main.dc.html and Home.dc.html: a
   quiet tinted sidebar of plain rows, one 56px header, a 720px conversation,
   the composer as one rounded box with Ask / Do and a round Send, and the
   side panel (side-panel.js) on the right. "Lines flow together": the
   sidebar's first row, the chat's header and the panel's header are all
   56px, so their bottoms are one line, and whitespace does the work borders
   used to.

   Two kinds of rule, and only two:
   - TOKENS, for every width and both themes. The shell's greys were warm
     (#f5f5f2 paper over #252823 ink); they are neutral now, the Apple greys
     the mock is drawn in, so every page — Settings, Library, the phone —
     moves with the shell rather than a desk that disagrees with its own
     dialogs. The hues (sky, sage, honey…) are left exactly as they were.
   - LAYOUT AND LOOK, under `min-width: 821px` (the width at which the rail
     is a column and not the phone's drawer). The phone keeps phone.css.

   Nothing here hides a feature without a second door to it. Each `display:
   none` below says where the thing went.
   ============================================================================ */

/* ---------- tokens ---------------------------------------------------------- */

/* The shell's greys (`--shell-*`) and its own few (`--b-*`) moved to tokens.css
   on 2026-11-20 (UI/UX PR 4), with the same values: they were what every page
   painted, so they became the colour roles (`--color-bg`, `--color-ink` …) and
   these names are aliases of them. Stated here, light and both darks, they
   had to be kept in step by hand with revamp-shell.css's copy, which they
   silently overrode. */
/* The sidebar's states, re-pointed at the shell's (chat-shell.css names them). */
#app {
  --sb-hover: var(--b-hover);
  --sb-on: var(--b-on);
  --sb-ink: var(--text);
  /* The conversation's column: the mock's 720px, with no gutter for a tile. */
  --cl-col: 720px;
  --cl-gut: 0px;
}

/* ---------- the side panel: everywhere it can be drawn ----------------------- */

/* Names: #app carries `side-open`, and the panel's head, rows' open button,
   actions, bar, empty line and More are `spn-*`. They were `sp-*` until the
   same day, and spaces.css styles `.sp-head`, `.sp-open` (with `all: unset`),
   `.sp-act`, `.sp-bar`, `.sp-empty` and `.sp-more` for the Spaces page: the
   panel's head rule wrapped the Spaces header over its own list at 1024px, so
   no space could be opened, and the Spaces rules reached into the panel. */

/* It shares the grid's fifth track (style.css: `#workbench`, `#companion`).
   A phone never draws it; side-panel.js never opens it there either. */
#side-panel { grid-column: 5; grid-row: 1; display: none; }
/* The phone's grabber and title are the sheet's (step 3); a desk's head is
   the tabs and the close. */
.spn-grab, .spn-title { display: none; }
/* A Reject's "Why not?" (ask-in-page.js) opens right after the row's own
   Reject, inside its actions (side-panel.js `actionsFor`): a line of its own
   under the buttons, at every width, rather than squeezed beside them. */
.sp-acts .ask-inline { flex-basis: 100%; margin-left: 0; }
/* Rename from the chat's title (threads.js `renameAt`): the field takes the
   title's place in the header, as wide as a long name needs and no wider. */
.ci-rename.title-rename { flex: 0 1 360px; min-width: 0; padding: 0; }
.ci-rename.title-rename input { font-size: 15px; padding: 5px 10px; }
@media (max-width: 820px) {
  /* No column under 821px. There the panel is a sheet (`.is-sheet`, the
     foot of this file), and the drawer's Tickets row keeps its count, beside
     the row that opens it. From 721 to 820px the count was hidden until
     2026-11-17's review, because the row opened nothing there; it opens the
     sheet now, so the number is a promise the row keeps. */
  #side-panel:not(.is-sheet), .sp-toggle { display: none !important; }
}

@media (min-width: 821px) {
  #app.side-open:not(.view-welcome):not(.open-screen) { --col-wb: 360px; }
  #app.side-open:not(.view-welcome):not(.open-screen) #side-panel:not([hidden]) { display: flex; }
  /* The open screen is the chat and nothing else, so the panel is never drawn
     there; its toggle would be a press with nothing to show, and it sat as a
     second identical icon beside the file panel's own. */
  #app.open-screen .sp-toggle { display: none; }
  /* A pinned Ask Scout and the panel share the track, and side-panel.js keeps
     them apart: the panel steps aside while the companion is pinned, and
     opening the panel puts the pinned pane back to its card. (This rule hid
     the whole companion while the panel was open until the same day, which
     left Ctrl+J opening a card that was never drawn.)
     The floating Ask Scout pill must never sit over the panel or the composer:
     beside an open panel it is not drawn (Ctrl+J still opens the card, which
     the person asked for and may cover the panel's foot), and on a page it
     rises clear of the docked composer. */
  #app.side-open:not(.open-screen) #companion[data-shape="pill"] { display: none; }
  #app:not(.side-open) #companion[data-shape="pill"] { bottom: 128px; }

  /* One inner padding for the whole panel, 16px (UI/UX PR 2, audit item 8):
     the head's tabs, every row's words and the Activity lines all start and
     end 16px in. A row carries 8px of its own so its hover pill has room, so
     the content box gives the other 8. What ran into the right edge was a
     word with no place to break — a raw `tkt_…` id, a path — in an Activity
     line or a ticket's said line, which wrap rather than cut: those break
     anywhere now, and the ids are gone from the rows (ticket-words.js). A
     reserved scrollbar gutter was tried and dropped: on a classic scrollbar
     it made the right inset 31px against the left's 16 on every list, long
     or short (Chromium, 1440px, 2026-11-19). The bar is thin instead. */
  .side-panel {
    --sp-pad: 16px;
    flex-direction: column; min-width: 0; height: 100vh; overflow: hidden;
    background: var(--surface); border-left: 1px solid var(--b-hair);
    color: var(--text);
  }
  .spn-head {
    flex: 0 0 56px; height: 56px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 12px 0 var(--sp-pad);
  }
  .sp-seg { display: flex; padding: 2px; border-radius: 10px; background: var(--card-2); font-size: 13px; line-height: 18px; }
  .sp-seg [role="tab"] {
    height: 28px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent;
    font: inherit; font-weight: 500; color: var(--dim); cursor: pointer;
  }
  .sp-seg [role="tab"]:hover { color: var(--text); }
  .sp-seg [role="tab"][aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
  .sp-seg [role="tab"]:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
  #side-panel #sp-close { width: 32px; height: 32px; border-radius: 8px; color: var(--dim); }
  #side-panel #sp-close .ic { width: 16px; height: 16px; stroke-width: 1.8; }
  .sp-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .sp-content { display: flex; flex-direction: column; gap: 18px; padding: 4px calc(var(--sp-pad) - 8px) var(--sp-pad); }
  .sp-group { display: flex; flex-direction: column; gap: 2px; }
  /* Similar rows opened out (side-panel.js `similarRows`): under their
     gathered row, on a hairline from its icon, each a row of its own. */
  .sp-similar { display: flex; flex-direction: column; gap: 2px; margin: 0 0 4px 15px; padding-left: 8px; border-left: 1px solid var(--b-hair); }
  .sp-group-h { margin: 0; padding: 0 8px 4px; display: flex; align-items: center; gap: 8px; font-size: 13px; line-height: 18px; font-weight: 600; letter-spacing: normal; }
  .sp-count { font-weight: 500; color: var(--dim); }
  .sp-row { display: flex; gap: 12px; padding: 10px 8px; border-radius: 12px; align-items: flex-start; }
  .sp-row:hover, .sp-row:focus-within { background: var(--card-2); }
  .sp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
  .spn-open {
    display: flex; flex-direction: column; align-items: stretch; gap: 0; width: 100%; min-width: 0;
    padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
  }
  .spn-open:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 4px; border-radius: 6px; }
  .sp-title { font-size: 14px; line-height: 20px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sp-meta { font-size: 13px; line-height: 18px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sp-acts { display: flex; gap: 8px; flex-wrap: wrap; }
  .spn-act {
    height: 30px; padding: 0 14px; border: 0; border-radius: 15px; background: var(--card-2); color: var(--text);
    font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
  }
  .sp-row:hover .spn-act:not(.sp-primary), .sp-row:focus-within .spn-act:not(.sp-primary) { background: var(--b-on); }
  .spn-act.sp-primary { background: var(--b-send); color: var(--b-on-send); }
  .spn-act:hover { filter: brightness(0.96); }
  .spn-act:disabled { opacity: .5; cursor: default; }
  .spn-act:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
  .spn-bar { display: block; height: 4px; border-radius: 2px; background: var(--b-blue-track); overflow: hidden; }
  .sp-fill { display: block; height: 4px; border-radius: 2px; background: var(--b-blue); }
  .spn-empty { margin: 0; padding: 12px 8px; color: var(--dim); font-size: 14px; line-height: 20px; }
  .spn-more {
    align-self: flex-start; margin: 4px 0 0; height: 30px; padding: 0 8px; border: 0; border-radius: 8px;
    background: none; color: var(--dim); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
  }
  .spn-more:hover { color: var(--text); background: var(--b-hover); }
  .sp-file {
    display: flex; gap: 12px; align-items: center; width: 100%; padding: 10px 8px; border: 0; border-radius: 12px;
    background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
  }
  .sp-file:hover { background: var(--card-2); }
  .sp-file:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
  .sp-file .sp-main { gap: 0; }
  .sp-tag {
    flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--card-2);
    display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--dim);
  }
  /* Activity is a trail (trail-line.js, trail-line.css); this is its inset only. */
  .sp-activity { margin: 0; padding: 4px 8px; }

  /* The 16px status glyphs. */
  .sp-ic { flex: 0 0 16px; width: 16px; height: 16px; margin-top: 2px; }
  .sp-ic svg { display: block; }
  .sp-ic .spi-ring { stroke: var(--primary); stroke-width: 1.6; }
  .sp-ic .spi-dot { fill: var(--primary); }
  .sp-ic .spi-track { stroke: var(--b-blue-track); stroke-width: 1.6; }
  .sp-ic .spi-arc { stroke: var(--b-blue); stroke-width: 1.6; stroke-linecap: round; transform-origin: 8px 8px; animation: sp-spin 1.6s linear infinite; }
  .sp-ic .spi-dash { stroke: var(--b-dash); stroke-width: 1.6; stroke-dasharray: 2.5 2.5; }
  .sp-ic[data-state="checking"] .spi-ring { stroke: var(--b-amber); }
  .sp-ic .spi-half { fill: var(--b-amber); }
  .sp-ic .spi-fill { fill: var(--b-green); }
  .sp-ic .spi-tick { stroke: var(--shell-on-accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
  @keyframes sp-spin { to { transform: rotate(360deg); } }
  @media (prefers-reduced-motion: reduce) { .sp-ic .spi-arc { animation: none; } }

  /* The toggles: the chat header's and the page bar's, one look. */
  .sp-toggle { width: 36px; height: 36px; padding: 0; border-radius: 10px; display: inline-grid; place-items: center; color: var(--text); }
  .sp-toggle .ic { width: 18px; height: 18px; stroke-width: 1.6; }
  .sp-toggle.on { background: var(--b-on); }
}

/* ---------- the sidebar ------------------------------------------------------ */

@media (min-width: 821px) {
  /* 208px by default; a dragged width (resize.js, 196–260) still wins. */
  #app.threads-docked { --col-threads: var(--threads-w, 208px); }
  /* `:not(.view-welcome)` matches style.css's own `--window-2` rule, which
     otherwise wins on specificity and paints the sidebar white. */
  #app:not(.view-welcome) #threads, #app #threads.docked {
    background: var(--paper);
    border-right: 0;
    padding: 0 10px 12px;
    font-size: 15px;
    letter-spacing: -0.006em;
  }
  /* Row 1: the mark and the collapse, 56px, the header's height. */
  #threads .th-head { height: 56px; flex: 0 0 56px; padding: 0 0 0 6px; gap: 2px; align-items: center; }
  #threads .sb-mark { gap: 10px; padding: 4px; margin-left: -4px; font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
  #threads .sb-mark .sb-logo { width: 22px; height: 22px; }
  #threads .th-head .cp-icon { width: 32px; height: 32px; border-radius: 8px; color: var(--dim); }
  #threads .th-head .cp-icon .ic { width: 18px; height: 18px; stroke-width: 1.6; }
  /* Sidebar options: still here, quiet until the head is hovered or the
     keyboard reaches it — the mock's row is the mark and the collapse. */
  #threads #threads-customize { opacity: 0; transition: opacity .12s; }
  #threads .th-head:hover #threads-customize,
  #threads #threads-customize:focus-visible,
  #threads #threads-customize[aria-expanded="true"] { opacity: 1; }

  #threads .sb-top { padding: 0 0 8px; }
  #threads .sb-mid { margin: 0 -10px; padding: 0 10px; }
  #threads .sb-nav { padding: 0; gap: 2px; }
  #threads :is(.side-item, .sb-item) {
    min-height: 36px; height: 36px; padding: 0 10px; gap: 10px; border-radius: 10px;
    font-size: 15px; font-weight: 400; color: var(--text);
  }
  #threads :is(.side-item, .sb-item):hover { background: var(--b-hover); color: var(--text); }
  #threads :is(.side-item, .sb-item).active,
  #threads :is(.side-item, .sb-item).active:hover,
  #app:is(.chat-wide, .chat-fills-window):not(.view-welcome) #threads :is(.side-item, .sb-item).active { background: var(--b-on); color: var(--text); font-weight: 500; }
  #threads :is(.side-item, .sb-item) .s-icon,
  #threads :is(.side-item, .sb-item).active .s-icon { width: 18px; height: 18px; background: transparent; box-shadow: none; color: currentColor; border-radius: 0; }
  #threads :is(.side-item, .sb-item) .s-icon .ic { width: 18px; height: 18px; stroke-width: 1.6; color: currentColor; }
  /* The squircles' colours are the rail's; the sidebar's rows are ink. */
  #threads :is(.side-item, .sb-item)[data-hue] .s-icon { --sq: currentColor; background: transparent; }
  #threads .sb-item.sb-accent, #threads .sb-item.sb-accent:hover { color: var(--text); }
  /* The places start 16px under the actions, the mock's one gap. */
  #threads #sb-search { margin-bottom: 16px; }
  #threads #sb-hire:not([hidden]) { margin-top: -16px; margin-bottom: 16px; }
  .sb-kbd { margin-left: auto; font-size: 12px; color: var(--dim); font-feature-settings: normal; }
  #sidebar .sb-kbd { display: none; }
  /* Tickets carries the waiting count, in the accent; Home's copy of the
     same number would be the same thing said twice. Home still says it to
     a screen reader (its label, app.js `paintScoutCount`). */
  #threads #scout-count, #threads #today-count { display: none; }
  #threads #tickets-count:not([hidden]) {
    position: static; display: inline-block; margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; box-sizing: border-box;
    border-radius: 10px; background: var(--primary); color: var(--on-primary); font-size: 12px; font-weight: 600; line-height: 20px; text-align: center;
  }
  #sidebar #tickets-count:not([hidden]) { background: var(--primary); color: var(--on-primary); }
  /* More: a row like the others, its chevron turning as it opens. */
  .sb-more-btn .sb-more-chev { width: 14px; height: 14px; margin-left: auto; color: var(--dim); transition: transform .14s var(--ease-snap, ease); }
  .sb-more-btn[aria-expanded="true"] .sb-more-chev { transform: rotate(90deg); }
  .sb-more-btn.holds-current { font-weight: 500; }
  .sb-more { display: flex; flex-direction: column; gap: 2px; }
  .sb-more[hidden] { display: none; }
  #threads .sb-more :is(.side-item, .sb-item) { padding-left: 38px; }
  #threads .sb-more :is(.side-item, .sb-item) .s-icon { display: none; }
  #sidebar .sb-more-btn, #sidebar #sb-more { display: none; }
  @media (prefers-reduced-motion: reduce) { .sb-more-btn .sb-more-chev { transition: none; } }

  /* The team leaves the sidebar: teammates are the Team page's and the
     side panel's (side-panel.js lists what each is doing). */
  #threads #crew-side, #sidebar #crew-side { display: none; }

  /* The chats: one line each, 34px, the mock's "Recent" look for the list's
     own headings (Pinned, Today…, or Recent). */
  #threads #chat-items { padding: 0; }
  #threads .ci-group, #threads .ci-group:first-child {
    padding: 20px 10px 6px; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--dim);
    letter-spacing: normal; text-transform: none;
  }
  #threads .chat-item { min-height: 34px; padding: 0 10px; border-radius: 10px; display: flex; align-items: center; }
  #threads .chat-item:hover { background: var(--b-hover); }
  #threads .chat-item.current, #threads .chat-item.current:hover { background: var(--b-on); }
  #threads .chat-item .ci-title { font-size: 14.5px; line-height: 20px; color: var(--text); min-width: 0; flex: 1; }
  #threads .chat-item.current .ci-title { font-weight: 500; }
  /* No status line under a chat; a small dot says which one is running. */
  #threads .chat-item .ci-meta { display: none; }
  #threads .chat-item:has(.ci-state.run) .ci-title::after {
    content: ""; flex: none; width: 6px; height: 6px; margin-left: 8px; border-radius: 3px; background: var(--b-blue);
    animation: cl-breathe 2.4s ease-in-out infinite;
  }
  #threads .chat-item .ci-more { opacity: 0; }
  #threads .chat-item:is(:hover, :focus-visible, .current) .ci-more, #threads .chat-item .ci-more[aria-expanded="true"] { opacity: 1; }
  #threads .cl-foot { margin: 2px 0 0; }
  #threads .th-all { padding: 6px 10px; font-size: 13px; color: var(--dim); }

  /* The foot: one account row. Customize is the account menu's first item
     now (sidebar.js MENU_ORDER), with its "N of M" beside it. */
  #threads .sb-foot { border-top: 0; margin-top: 8px; padding-top: 0; }
  #threads .sb-foot > .sb-label, #threads #sb-setup:empty { display: none; }
  #threads .sb-user-wrap { margin: 0; padding-top: 0; border-top: 0; }
  #threads .sb-user { height: 52px; padding: 0 8px; gap: 10px; border-radius: 12px; }
  #threads .sb-user:hover, #threads .sb-user[aria-expanded="true"] { background: var(--b-hover); }
  #threads .sb-user-av { width: 32px; height: 32px; border-radius: 16px; background: var(--b-chip); font-size: 13px; }
  #threads .sb-user-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 18px; text-align: left; }
  #threads .sb-user-name { font-weight: 500; }
  #threads .sb-user-plan { font-size: 12px; line-height: 16px; color: var(--dim); }
  #threads .sb-user .sb-user-chev { width: 18px; height: 18px; color: var(--dim); stroke-width: 1.6; }
  #threads .sb-user .sb-user-chev circle { fill: var(--paper); }
  #threads .sb-menu { border-radius: 14px; border: 1px solid var(--b-hair); box-shadow: var(--b-lift); }
  #threads .sb-menu .sb-count { display: inline; margin-left: auto; color: var(--dim); font-size: 12px; }
}
/* The plan line is the docked row's; the rail and the drawer have no room. */
.sb-user-text { display: contents; }
.sb-user-plan { display: none; }
@media (min-width: 821px) { #threads .sb-user-plan { display: block; } }

/* ---------- the chat: header, conversation, composer ------------------------- */

@media (min-width: 821px) {
  #app #chat-panel { position: relative; background: var(--surface); border-right: 0; }
  #app:not(.view-welcome) #chat-panel .cp-head {
    height: 56px; min-height: 56px; flex: 0 0 56px; padding: 0 16px 0 20px; gap: 4px;
    border-bottom: 0; background: var(--surface);
  }
  /* Gone from the header, each with its other door:
     New chat — the sidebar's first row (and the rail's);
     the Chats popover — the sidebar's list, ⌘K, and New chat's peek;
     Work — the title's menu; status and Stop — Send becomes Stop while a
     turn runs, and the running chat has its dot in the list; ⋯ — Team and
     Search are sidebar rows; Open screen — the title's menu and ⌘⇧F;
     Close — Home in the sidebar. */
  #chat-panel .cp-head :is(#new-thread, .work-assistant-open, #status, #mb-more, #interrupt, #chat-close, #chat-list-toggle, #chat-expand) { display: none; }
  /* Inside the open screen there is no sidebar to go Home from: there, the
     way back to the layout is drawn, as before. */
  #app.open-screen #chat-panel .cp-head #chat-expand { display: inline-grid; }
  /* The title, in the header row: left, 600, with the menu's chevron. */
  #chat-panel .cp-ident {
    position: absolute; top: 0; left: 20px; right: 140px; height: 56px; z-index: 3;
    display: flex; align-items: center; gap: 8px; padding: 0; margin: 0; border: 0; background: none;
    pointer-events: none;
  }
  #chat-panel .cp-ident > * { pointer-events: auto; }
  #chat-panel .cp-ident #status-mascot, #chat-panel .cp-ident #chat-to-side { display: none; }
  .cp-title-btn {
    display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; height: 34px; padding: 0 8px; margin-left: -8px;
    border: 0; border-radius: 10px; background: none; color: var(--text); cursor: pointer;
    font: inherit; font-size: 15px; font-weight: 600; letter-spacing: -0.01em;
  }
  .cp-title-btn:hover, .cp-title-btn[aria-expanded="true"] { background: var(--b-hover); }
  .cp-title-btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 0; }
  .cp-title-btn #chat-panel-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: inherit; color: inherit; }
  .cp-title-chev { width: 16px; height: 16px; flex: none; color: var(--dim); stroke-width: 1.8; }
  /* A fresh chat has no name to show: the mock's Home header is the panel's
     toggle alone. */
  #chat-panel:has(#chat-body.idle) .cp-title-btn { visibility: hidden; }
  /* The menu the title opens, in the list menu's look. */
  .title-menu { position: fixed; z-index: 80; min-width: 220px; padding: 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--b-hair); box-shadow: var(--b-lift); }
  .title-menu[hidden] { display: none; }
  #chat-panel .cp-head .sp-toggle { margin-left: 0; }
  #chat-panel .cp-head .cp-icon { width: 36px; height: 36px; border-radius: 10px; color: var(--text); }
  #chat-panel .cp-head .cp-icon:hover { background: var(--b-hover); }

  /* The page's bar: the same 56px, and only what is the page's. Team and
     Search are sidebar rows; status and Stop are the composer's. */
  #app #topbar { height: 56px; min-height: 56px; border-bottom: 0; padding: 0 16px 0 20px; }
  #topbar :is(#open-team, #open-search, #mb-more, #interrupt, #status) { display: none; }
  /* One panel toggle in the page's bar, at its right edge (step 3). The left
     one was Show / Hide chat, drawn as the same window-with-a-divider: two
     look-alike icons at the two ends of one bar. The chat beside a page is
     still ⌘/ (shortcuts.js) and every chat row in the sidebar. */
  #app #topbar > #chat-toggle { display: none; }
  /* What stays in the bar (the workbench's and the side panel's toggles) is
     drawn as the chat header's quiet icons, not as outlined buttons. Show chat
     is not in this list: `:is()` takes its most specific argument, so naming
     #chat-toggle here tied with the hide rule above and, coming later, drew
     the icon back (seen in the step-3 screenshots). */
  #app #topbar > :is(#wb-toggle, .sp-toggle) {
    width: 36px; height: 36px; min-height: 36px; padding: 0; border: 0; border-radius: 10px;
    background: transparent; box-shadow: none; color: var(--text); display: inline-grid; place-items: center;
  }
  #app #topbar > :is(#wb-toggle, .sp-toggle):hover { background: var(--b-hover); color: var(--text); }
  #app #topbar > .sp-toggle.on { background: var(--b-on); color: var(--text); }

  /* The conversation. */
  #chat-panel .stream { gap: 28px; padding-top: 24px; font-size: 15px; line-height: 24px; letter-spacing: -0.006em; }
  #chat-panel .stream .msg.user {
    max-width: 72%; padding: 10px 16px; border-radius: 20px;
    background: var(--card-2); color: var(--text); border: 0; box-shadow: none;
  }
  #chat-panel .stream .msg.agent { padding-left: 0; margin-left: 0; }
  /* No tile and no name over each of Scout's turns: it is Scout's chat. A
     teammate speaking in it keeps its name, as a quiet label. */
  #chat-panel .stream > .who .who-av { display: none; }
  #chat-panel .stream > .who:has(.who-av[data-scout]) { display: none; }
  #chat-panel .stream > .who { padding-left: 0; margin-bottom: -20px; }
  /* The fold: one secondary line. */
  #chat-panel .stream .steps > details > summary { padding: 0 8px; margin-left: -8px; min-height: 28px; border-radius: 8px; color: var(--dim); font-size: 13px; }
  #chat-panel .stream .steps > details > summary:hover { background: var(--b-hover); }
  #chat-panel .stream .steps .st-word { font-weight: 400; color: var(--dim); }
  #chat-panel .stream > .steps { margin-bottom: -16px; }
  /* The route ("Running Stub model on Anthropic") is the model picker's
     news, said again at the top of every chat: not drawn when it carries no
     caveat. A route with one — uncertified, read-only tools, costs that are
     estimates — keeps its line, because that is a thing the person should
     be told (app.js marks the two kinds). */
  #chat-panel .stream > .turnbar.tb-route:not(.tb-caveat) { display: none; }
  /* Quiet one-line notes, where a pill was: the route, "Remembering…",
     "Stopped." — said in the thread, in the secondary colour. */
  #chat-panel .stream > .turnbar {
    align-self: flex-start; max-width: none; padding: 0; margin: -14px 0; border: 0; border-radius: 0; background: none; box-shadow: none;
    font-size: 12.5px; line-height: 18px; color: var(--dim);
  }
  /* The reply's actions and its numbers, quietly: under the latest answer
     the actions stay; under the rest, and the numbers everywhere, they come
     with the pointer or the keyboard. The numbers are kept — time, this
     chat's cost, the month — and only wait to be asked for. */
  /* ONE RHYTHM (step 3): 28px between turns, 12px inside one. The rows that
     wait for the pointer — the actions under an answer, Edit as new and
     Thread under a question, and the turn's numbers — take no room of their
     own: each is 28px tall, starts 4px under its message and gives back its
     whole height, so it is drawn IN the 28px gap rather than adding to it.
     They took room until the same day, and a hidden 28px row plus two gaps
     was the ~70px of blank under every question and above every answer.
     The numbers share the actions' line, at its right end. */
  #chat-panel .stream > :is(.msg-actions, .turn-foot) {
    height: 28px; margin-top: -24px; margin-bottom: -32px; transition: opacity .14s;
    position: relative; z-index: 1;
  }
  #chat-panel .stream > .msg-actions { opacity: 0; }
  #chat-panel .stream > .msg:hover + .msg-actions,
  #chat-panel .stream > .msg-actions:hover,
  #chat-panel .stream > .msg-actions:focus-within { opacity: 1; }
  #chat-panel .stream > .msg-actions .act { color: var(--dim); border-radius: 8px; }
  #chat-panel .stream > .msg-actions .act:hover { color: var(--text); background: var(--b-hover); }
  #chat-panel .stream > .turn-foot {
    align-self: flex-end; display: flex; align-items: center; line-height: 28px;
    opacity: 0; font-size: 12px; color: var(--dim);
  }
  /* A sources pill is always drawn (style.css), so its row keeps its line:
     the pill is the one thing on it that is not waiting for the pointer. */
  #chat-panel .stream > .msg-actions:has(.act-sources) { opacity: 1; margin-bottom: -4px; }
  #chat-panel .stream > .msg:hover + .msg-actions + .turn-foot,
  #chat-panel .stream > .msg-actions:hover + .turn-foot,
  #chat-panel .stream > .msg-actions:focus-within + .turn-foot,
  #chat-panel .stream > .turn-foot:hover,
  #chat-panel .stream > .turn-foot:focus-within { opacity: 1; }
  @media (prefers-reduced-motion: reduce) { #chat-panel .stream > :is(.msg-actions, .turn-foot) { transition: none; } }

  /* The composer: one rounded box, a hairline and a soft lift. */
  #chat-panel #dock { padding-top: 8px; padding-bottom: 20px; }
  #app #chat-panel .composer, #app #main .composer {
    position: relative; border: 1px solid var(--b-ring); border-radius: 26px; background: var(--surface);
    box-shadow: var(--b-lift); padding: 14px 12px 10px 18px; gap: 10px;
  }
  /* Focused: ONE ring, the hairline itself turning the focus colour, over the
     same lift. style.css's doubled border and halo and revamp-shell's 2px
     outline stacked into two blue rings around a box the cursor was already
     visibly in (step 3). The hairline's change against the page is the
     focus colour against white, well over 3:1. */
  #app :is(#chat-panel, #main) .composer:focus-within {
    border-color: color-mix(in srgb, var(--focus-ring) 70%, var(--b-ring));
    outline: none; box-shadow: var(--b-lift);
  }
  #app :is(#chat-panel, #main) .composer #input { font-size: 15px; line-height: 24px; min-height: 24px; padding: 0; color: var(--text); }
  #app :is(#chat-panel, #main) .composer-bar { gap: 6px; margin-left: -6px; align-items: center; min-height: 34px; }
  #app :is(#chat-panel, #main) .composer-bar .cm-plus {
    width: 32px; height: 32px; border-radius: 16px; border: 0; background: transparent; color: var(--text);
  }
  #app :is(#chat-panel, #main) .composer-bar .cm-plus:hover { background: var(--b-hover); }
  #app :is(#chat-panel, #main) .composer-bar .cm-plus .ic { width: 18px; height: 18px; stroke-width: 1.7; }
  /* Ask / Do: a small segmented control. */
  #app :is(#chat-panel, #main) .cm-mode { padding: 2px; border: 0; border-radius: 16px; background: var(--card-2); gap: 0; }
  #app :is(#chat-panel, #main) .cm-mode-opt {
    height: 28px; padding: 0 12px; border: 0; border-radius: 14px; background: transparent;
    font-size: 13px; line-height: 18px; font-weight: 400; color: var(--dim); box-shadow: none;
  }
  #app :is(#chat-panel, #main) .cm-mode-opt:hover { color: var(--text); }
  #app :is(#chat-panel, #main) .cm-mode-opt[aria-checked="true"] { background: var(--surface); color: var(--text); font-weight: 500; box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
  /* @ Teammate is the + menu's "Bring in a teammate"; "?" is its "What
     these settings mean". */
  #app :is(#chat-panel, #main) .composer-bar :is(#at-worker, #modes-btn) { display: none; }
  /* The model: a quiet "Auto ⌄". */
  #app :is(#chat-panel, #main) #model-pill {
    height: 32px; padding: 0 10px; border: 0; border-radius: 16px; background: transparent; box-shadow: none;
    font-size: 13px; color: var(--dim); gap: 4px;
  }
  #app :is(#chat-panel, #main) #model-pill:hover, #app :is(#chat-panel, #main) #model-pill[aria-expanded="true"] { background: var(--b-hover); color: var(--text); }
  #app :is(#chat-panel, #main) #model-pill .p-dot { display: none; }
  /* Send: round and dark; Stop in its place while a turn runs. */
  #app :is(#chat-panel, #main) .composer .send {
    width: 34px; height: 34px; min-width: 34px; border-radius: 17px; border: 0; margin-left: auto;
    background: var(--b-send); color: var(--b-on-send); box-shadow: none;
  }
  #app :is(#chat-panel, #main) .composer:has(#input:placeholder-shown) .send[data-mode="send"] { background: var(--b-send-off); color: var(--b-on-send); }
  #app :is(#chat-panel, #main) .composer .send svg { width: 18px; height: 18px; stroke-width: 2; }
  /* The context meter: a small ring beside Send, the reading and its
     breakdown one click away (and its words still in the button's name). */
  #app :is(#chat-panel, #main) .composer #ctx-meter {
    position: absolute; right: 54px; bottom: 13px; width: 28px; height: 28px; min-width: 0; padding: 0;
    border: 0; border-radius: 50%; background: transparent; box-shadow: none; margin: 0;
    display: grid; place-items: center;
  }
  #app :is(#chat-panel, #main) .composer #ctx-meter[hidden] { display: none; }
  /* Under half full it is not drawn (app.js `data-level`, step 3): a 1% ring
     read as a stray grey circle beside Send. From half full it is the ring,
     its fill in the ink, with its reading as the tip. */
  #app :is(#chat-panel, #main) .composer #ctx-meter[data-level="low"] { display: none; }
  #app :is(#chat-panel, #main) .composer #ctx-meter:hover { background: var(--b-hover); }
  #app :is(#chat-panel, #main) .composer #ctx-meter :is(.ctx-caption, #ctx-label) {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  #app :is(#chat-panel, #main) .composer #ctx-meter .ctx-track {
    width: 16px; height: 16px; border-radius: 50%; margin: 0; border: 0;
    background: conic-gradient(var(--text) calc(var(--ctx-pct, 0) * 1%), var(--b-chip) 0);
    -webkit-mask: radial-gradient(circle, transparent 4.6px, var(--color-ink) 5px);
    mask: radial-gradient(circle, transparent 4.6px, var(--color-ink) 5px);
  }
  #app :is(#chat-panel, #main) .composer #ctx-meter .ctx-fill { display: none; }
  /* The ring stands in the flexible gap just left of Send. The gap is kept at
     least the ring's width by the model control's margin: padding the bar
     instead moved Send itself left, under the ring. */
  #app :is(#chat-panel, #main) .composer:has(#ctx-meter:not([hidden]):not([data-level="low"])) #model-pill { margin-right: 36px; }

  /* ---------- the fresh chat (Home.dc.html) ---------------------------------- */
  #chat-main:has(> #chat-body.idle) { padding: 0 24px 120px; }
  #chat-main:has(> #chat-body.idle) > #dock { width: 100%; max-width: 728px; margin: 0 auto; padding: 0 0 4px; }
  #chat-panel .ce-greet { margin: 0 0 20px; font-size: 30px; line-height: 36px; font-weight: 600; letter-spacing: -0.025em; text-align: center; }
  #chat-empty .ce-head { display: none; }
  #chat-main .starters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 680px; margin: 20px auto 0; }
  #chat-main .starter {
    height: 36px; min-height: 36px; padding: 0 14px; border: 1px solid var(--b-chip); border-radius: 18px;
    background: transparent; box-shadow: none; font-size: 14px; color: var(--text); gap: 0;
  }
  #chat-main .starter:hover { background: var(--b-hover); border-color: var(--b-chip); }
  #chat-main .starter .sq { display: none; }
  /* "Continue" into the last chat is the sidebar's first recent row. */
  #chat-main .starter[data-card^="continue:"] { display: none; }
  #chat-main > #chat-body.idle > #chat-empty > .ce-tickets { order: 5; }

  /* ---------- notes that float: clear of the composer and the panel ----------- */
  /* The receipt ("Rejected … Undo", "Opened Scout with this chat"): one compact
     line under the header's right end, never over the composer. */
  #receipt-toast { top: 64px; bottom: auto; right: 16px; left: auto; }
  #app.side-open ~ #receipt-toast, body:has(#app.side-open) #receipt-toast { right: 376px; }
  body:has(#companion[data-shape="pill"]) #receipt-toast { bottom: auto; }
  /* "First chat finished. 3 of 8 done." sits at the foot of the sidebar,
     just over the account row (step 3): under the header's right end it
     covered the chat's title row and the first message. Beside the rail
     when the sidebar is folded to its icons. */
  #quest-toast { top: auto; right: auto; left: 12px; bottom: 72px; width: 232px; max-width: 232px; }
  body:has(#app:not(.threads-docked)) #quest-toast { left: 68px; bottom: 16px; }
  body:has(#app.chat-fills-window:not(.view-welcome):not(.wb-open)) #quest-toast { top: auto; bottom: 72px; }
  body:has(#app.chat-fills-window:not(.view-welcome):not(.wb-open):not(.threads-docked)) #quest-toast { bottom: 16px; }
  /* Sized for the sidebar's width: at style.css's 15px padding and 24px tick
     "First chat finished." broke onto a second line inside 232px. */
  #quest-toast .qt-card { padding: 10px 10px 10px 12px; gap: 10px; border-radius: 12px; }
  #quest-toast .qt-check { width: 20px; height: 20px; font-size: 11px; }
  #quest-toast .qt-fact { font-size: 13.5px; line-height: 20px; }
  #quest-toast .qt-count { margin-top: 0; font-size: 12.5px; line-height: 18px; }
}

/* ---------- one surface, no cards -------------------------------------------- */
/* style.css draws the chat and the page as lifted cards with an 8px margin and
   rounded corners (its "windows"); the mock is one flat surface where only the
   sidebar's tint and the panel's hairline divide it. `#app#app` because the
   card rules it undoes go as far as `#app.chat-open.chat-fills-window
   :not(.view-welcome) #chat-panel`. */
@media (min-width: 821px) {
  #app#app:not(.view-welcome) :is(#chat-panel, #main) {
    margin: 0; border-radius: 0; box-shadow: none; border-right: 0;
  }
}

/* ---------- the collapsed rail ---------------------------------------------- */
/* chat-shell.css orders the rail's icons with `order`, and an id it does not
   list (Tickets, new) went to the top of the rail, above New chat. Tickets
   shares Today's number, so the DOM decides between them — Tickets right
   after Home, where the sidebar has it, and where Tab reaches it. The other
   icons keep chat-shell's order: re-ordering more of them by CSS would part
   what is seen from what Tab walks through further than it already is. */
@media (min-width: 821px) {
  #app:not(.rail-expanded) #sidebar #tickets-nav { order: 4; }
  /* One Home on the rail (step 3). Scout's row is the sidebar's "Home"; the
     classic Home's house under it was a second Home icon a few rows down.
     Where Scout's row is not stamped (Classic home), the house stays — it
     is then the only Home. style.css hid it only beside Today's row, which
     the Scout layout hides. */
  #app:not(.rail-expanded) #sidebar #scout-nav:not([hidden]) ~ #home-nav { display: none; }
  #app:not(.rail-expanded) #sidebar #tickets-count:not([hidden]) { background: var(--primary); color: var(--on-primary); border: 0; }
}

/* ---------- the Stopped note's Continue, at every width --------------------- */
/* "Stopped." is one quiet line in the stream (style.css `.turnbar.stopped`);
   its Continue sits on the same line as a text button, not a toast. */
.turnbar.stopped { display: flex; align-items: center; gap: 10px; }
.turnbar.stopped .ts-continue {
  /* 28px tall: a press target, not a word — at 23px it was under the 24px
     minimum on a phone (ui:flows tap-target). The negative margin keeps the
     line the same height as the plain "Stopped." beside it. */
  display: inline-flex; align-items: center; min-height: 28px;
  border: 0; background: transparent; padding: 0 8px; margin: -6px 0; border-radius: 8px;
  font: inherit; font-weight: 500; color: var(--text); cursor: pointer;
}
.turnbar.stopped .ts-continue:hover { background: var(--b-hover); }
.turnbar.stopped .ts-continue:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.turnbar.stopped .ts-continue:disabled { color: var(--dim); cursor: default; }

/* ---------- the empty chat's tickets line, at every width ------------------- */
/* "2 tickets need you · 1 running ›" (side-panel.js paintSummary). Its look sat
   inside the desk's media block, so on a phone the button fell back to the
   browser's: a grey box the height of the screen with the chevron drawn as a
   200px black triangle (seen in the step-3 phone screenshots). */
.ce-tickets {
  align-self: center; display: inline-flex; align-items: center; gap: 10px; height: 40px; margin: 20px auto 0; padding: 0 14px 0 12px;
  border: 0; border-radius: 20px; background: transparent; color: var(--text); font: inherit; font-size: 14px; cursor: pointer;
}
.ce-tickets[hidden] { display: none; }
.ce-tickets:hover { background: var(--b-hover); }
.ce-tickets:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.ce-t-dot { width: 8px; height: 8px; border-radius: 4px; background: var(--primary); }
.ce-t-rest { color: var(--dim); margin-left: -6px; }
.ce-t-chev { width: 14px; height: 14px; fill: none; stroke: var(--dim); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 720px) {
  .ce-tickets { min-height: 44px; height: 44px; font-size: 15px; margin-top: 8px; }
}

/* ---------- Today (Scout's page), quieter --------------------------------------- */

@media (min-width: 821px) {
  /* The Agent pane on Today's right is the side panel now: its Team is the
     Team page, its Goals is More › Goals, its Activity, Files and jobs are
     the panel's tabs. Today is one column. */
  #today-view #today-panel, #today-view #today-panel-toggle { display: none; }
  #today-view .td-inner { max-width: 760px; margin: 0 auto; }
  #today-view .td-cols, #today-view.td-panel-on .td-frame { grid-template-columns: minmax(0, 1fr); }
  /* The composer under Today is the conversation's: 720px, centred on the
     page's column, with no strip kept for a pane that is not drawn. */
  #today-view #today-composer-slot, #today-view.td-panel-on #today-composer-slot {
    width: min(760px, 100%); padding: 16px 20px 18px; background-size: auto; pointer-events: auto;
  }
  /* The sticky composer over a page that scrolls under it: the fade is the
     24px over the box and no more, so a heading going under it fades out
     whole instead of showing its top half above the box (step 3: "Spend"
     sat clipped behind it). The slot is the page's last child, so at the
     end of the page nothing is under it at all. */
  #today-view #today-composer-slot, #today-view.td-panel-on #today-composer-slot {
    padding-top: 24px; background: linear-gradient(to bottom, transparent 0, var(--window) 24px);
  }
  /* With the side panel open, its Needs you is Home's Inbox said again:
     the Inbox folds to its head, "2 waiting · in the panel", and keeps what
     the panel does not list (approved and not yet made, new results). */
  #app.side-open #today-inbox ul.td-body,
  #app.side-open #today-inbox .td-body > ul.td-list:first-child { display: none; }
  #app.side-open #today-inbox-count:not(:empty)::after { content: " · in the panel"; }
  #today-view .td-card { border: 0; box-shadow: none; background: transparent; padding: 0; border-radius: 0; }
  #today-view .td-sec-head { padding: 0 0 6px; }
  #today-view .td-item {
    border: 0; box-shadow: none; background: transparent; border-radius: 12px; padding: 10px 8px;
    display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap;
  }
  #today-view .td-item:hover, #today-view .td-item:focus-within { background: var(--card-2); }
  #today-view .td-item-title { font-size: 14.5px; line-height: 20px; font-weight: 500; }
  #today-view .td-item-meta { font-size: 13px; line-height: 18px; color: var(--dim); }
  #today-view .td-item-acts { gap: 8px; margin-top: 8px; }
  #today-view .td-item-acts :is(button, .btn-play, .ghost) {
    height: 30px; min-height: 30px; padding: 0 14px; border: 0; border-radius: 15px; font-size: 13px; font-weight: 500;
    background: var(--card-2); color: var(--text); box-shadow: none;
  }
  #today-view .td-item:hover .td-item-acts :is(button, .ghost):not(.btn-play) { background: var(--b-on); }
  #today-view .td-item-acts .btn-play { background: var(--b-send); color: var(--b-on-send); }
  /* The J/K/A/N keys still work (today.js); their keycap badges are not
     drawn on every button. The keys are in each button's aria-keyshortcuts. */
  #today-view :is(.td-kbd, .td-keys) { display: none; }
}

/* ---------- the daily brief, at every width (2026-11-19) ------------------------ */
/* daily-brief.js: one hairline card at the top of Home. Sentence-case heads in
   the page's own face, a quiet line of counts, and rows that are doors — a
   label over a dimmer why, the Next row's and the side panel's grammar rather
   than a dashboard's tiles. Outside the desk's media block on purpose, so the
   phone gets the same card and not the browser's buttons (the tickets line's
   lesson, above). */
.td-brief { margin: 0 0 20px; padding: 14px 16px 10px; border: 1px solid var(--b-hair); border-radius: 14px; background: var(--card); }
.td-brief[hidden] { display: none; }
.db-head { display: flex; align-items: flex-start; gap: 12px; }
.db-head-words { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.db-title { margin: 0; font-size: 15px; line-height: 20px; font-weight: 600; color: var(--text); }
.db-headline { margin: 0; font-size: 14px; line-height: 20px; color: var(--dim); overflow-wrap: anywhere; }
.td-brief .db-dismiss { flex: none; height: 30px; padding: 0 12px; border: 0; border-radius: 15px; background: transparent; color: var(--dim); font: inherit; font-size: 13px; cursor: pointer; }
.td-brief .db-dismiss:hover { background: var(--b-hover); color: var(--text); }
.db-sec { margin-top: 10px; }
.db-sec + .db-sec { border-top: 1px solid var(--b-hair); padding-top: 8px; }
.db-sec-title { margin: 0 0 2px; font-size: 13px; line-height: 18px; font-weight: 500; color: var(--dim); }
.db-list { list-style: none; margin: 0 -8px; padding: 0; }
.db-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; padding: 7px 8px;
  border: 0; border-radius: 10px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.db-item:hover { background: var(--b-hover); }
.db-item:focus-visible, .td-brief .db-dismiss:focus-visible, .db-spent-go:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.db-label { font-size: 14px; line-height: 20px; font-weight: 500; overflow-wrap: anywhere; }
.db-detail { font-size: 13px; line-height: 18px; color: var(--dim); overflow-wrap: anywhere; }
.db-more { margin: 2px 0 0; font-size: 13px; color: var(--dim); }
.db-spent-go { font-size: 14px; color: var(--text); text-align: left; text-decoration: none; overflow-wrap: anywhere; }
.db-spent-go:hover { text-decoration: underline; }
.db-note { margin: 10px 0 2px; font-size: 13px; color: var(--dim); }
.db-err { color: var(--err, var(--dim)); }
@media (max-width: 720px) {
  .td-brief { margin-bottom: 16px; padding: 12px 12px 8px; }
  /* 44px targets on a phone, the shell's floor (ui:flows tap-target). */
  .db-item { min-height: 44px; justify-content: center; }
  .td-brief .db-dismiss { height: 44px; min-height: 44px; }
  .db-spent-go { min-height: 44px; display: inline-flex; align-items: center; }
}

/* ============================================================================
   THE PHONE (beta UI, step 3, 2026-11-17) — Phone.dc.html and
   PhoneTickets.dc.html, at the phone width (≤720px, `isPhone` in app.js).
   ----------------------------------------------------------------------------
   The Ask sheet is the chat. Its top bar is three things: Menu (the drawer,
   which is also the way back), the chat's name as its menu, and Tickets with
   the needs-you count (the side panel, as a sheet). The thread reads at 17px
   with no tile and no name over each of Scout's turns; an answer's actions
   are a row of icons; the composer is one row. What left the screen, and
   where each went:
   - Close (⌄) — the grabber still takes the drag down, Escape still closes,
     the title's menu has "Close the chat", and Menu puts the chat away.
   - The faces over the title ("S") — the conversation names a teammate
     where one speaks; Scout's own chat needs no tile.
   - Work — the title's menu ("Work assistant").
   - The pencil (New chat) — the title's menu and the drawer's first row.
   - The chips over the composer: Back (Menu, the drawer's Home), Ask (the
     chat is what the sheet shows), Chats (the drawer's Chats), Search (the
     drawer's Search), and a run or file tab's chip, which is drawn only
     while one of those is in front, as the way back to the chat.
   - Ask / Do and the model — the + menu's first group.
   - The Context row — not drawn on a phone; its reading is the desk's.
   ============================================================================ */
@media (max-width: 720px) {
  /* ---- the sheet: one white page, its top bar 52px under a grabber ---- */
  #sheet { background: var(--surface); --cl-gut: 0px; --cl-av: 0px; }
  #sheet-head {
    position: relative; padding: 6px 4px 0; min-height: 0; border-bottom: 0;
  }
  #sheet-grab {
    position: absolute; top: 5px; left: 50%; width: 36px; height: 5px; margin: 0 0 0 -18px;
    border-radius: 3px; background: var(--line-2);
  }
  #sheet .sheet-bar {
    display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 4px;
    height: 52px; padding: 0 4px;
  }
  #sheet .sheet-bar > :is(#sheet-close, .work-assistant-open, #sheet-new) { display: none; }
  #sheet #sheet-faces { display: none; }
  #sheet .sheet-who { flex-direction: row; justify-content: center; min-width: 0; }
  .sheet-title-btn {
    display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; height: 44px; padding: 0 8px;
    border: 0; border-radius: 12px; background: none; color: var(--text); cursor: pointer; font: inherit;
    -webkit-tap-highlight-color: transparent;
  }
  .sheet-title-btn:active { background: var(--b-hover); }
  .sheet-title-btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 0; }
  #sheet .sheet-title { font-size: 16px; line-height: 22px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
  .sheet-title-chev { flex: none; width: 14px; height: 14px; color: var(--dim); stroke-width: 1.8; }
  .sheet-tickets { position: relative; }
  .sheet-badge {
    position: absolute; top: 6px; right: 5px; min-width: 16px; height: 16px; padding: 0 4px; box-sizing: border-box;
    border-radius: 8px; background: var(--primary); color: var(--on-primary);
    font-size: 11px; font-weight: 600; line-height: 16px; text-align: center; pointer-events: none;
  }
  .sheet-badge[hidden] { display: none; }

  /* ---- the thread: 17 on 25, 24px between turns, 12 inside one ---- */
  #sheet #sheet-chat .stream {
    padding: 12px 20px 16px; gap: 24px;
    font-size: 17px; line-height: 25px; letter-spacing: -0.01em;
  }
  #sheet .stream .msg.user {
    max-width: 80%; padding: 10px 16px; border-radius: 20px;
    background: var(--card-2); color: var(--text);
    font-size: 17px; line-height: 25px;
  }
  #sheet .stream .msg.agent {
    max-width: 100%; padding: 0; border-radius: 0; background: none;
    font-size: 17px; line-height: 25px;
  }
  #sheet .stream > :not(.msg.user, .msg-actions.for-question, .turnbar, .brief, .who) { margin-left: 0; }
  /* No tile and no name over Scout's turns; a teammate speaking keeps its
     name, as a quiet label (the desk's rule). */
  #sheet .stream > .who .who-av { display: none; }
  #sheet .stream > .who:has(.who-av[data-scout]) { display: none; }
  #sheet .stream > .who { padding-left: 0; margin: 0 0 -16px; min-height: 0; }
  /* The fold: one secondary line, not bold. */
  #sheet .stream > .steps { margin-bottom: -12px; }
  #sheet .stream .steps > details > summary { padding: 0; min-height: 44px; font-size: 14px; line-height: 20px; color: var(--dim); }
  #sheet .stream .steps :is(.st-word, .st-sum, summary b, summary strong) { font-weight: 400; color: var(--dim); }
  #sheet .stream > .turnbar.tb-route:not(.tb-caveat) { display: none; }
  /* "Stopped. Continue", "Remembering…": a quiet line at the left, as on the
     desk — style.css draws a turnbar as a centred pill, which on a phone read
     as a button in the middle of the thread. */
  #sheet .stream > .turnbar {
    align-self: flex-start; max-width: none; padding: 0; margin: -12px 0; border: 0; border-radius: 0; background: none; box-shadow: none;
    font-size: 14px; line-height: 20px; color: var(--dim);
  }
  /* The fold's line stays a line when opened: no grey bar behind it (the
     keyboard still gets its ring). */
  #sheet .stream .steps > details > summary { background: none; border-radius: 8px; }
  #sheet .stream .steps > details > summary:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

  /* An answer's actions: one row of 44px icons, named for a reader (their
     words are their names, clipped out of sight). */
  #sheet .stream > .msg-actions { opacity: 1; gap: 0; margin: -16px 0 -12px -12px; }
  #sheet .stream > .msg-actions .act {
    width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 0; justify-content: center;
    border-radius: 22px; color: var(--dim);
  }
  #sheet .stream > .msg-actions .act .ic { width: 20px; height: 20px; }
  #sheet .stream > .msg-actions .act-word {
    position: absolute; width: 1px; height: 1px; max-width: none; margin: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
  #sheet .stream > .msg-actions .act:active { background: var(--b-hover); }
  #sheet .stream > .msg-actions.for-answer .act-note { margin-left: 8px; font-size: 13px; }
  /* Under a question: only once its bubble is tapped (app.js, `show-acts`),
     or while the keyboard is in it — never a standing row under every
     message. Clipped rather than `display: none`, so Tab still reaches it. */
  #sheet .stream > .msg-actions.for-question { margin: -16px -12px -12px 0; }
  #sheet .stream > .msg-actions.for-question:not(.show-acts):not(:focus-within) {
    position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  }
  /* The turn's numbers — time, this chat, the month — are behind the fold:
     drawn under the answer once its "Worked for…" line is opened. */
  #sheet .stream > .turn-foot { display: none; }
  #sheet .stream > .steps:has(> details[open]) + .msg + .msg-actions + .turn-foot,
  #sheet .stream > .steps:has(> details[open]) + .msg + .turn-foot { display: block; margin: -16px 0 0; font-size: 13px; line-height: 18px; color: var(--dim); }

  /* ---- the foot: the chips go; a tab in front keeps the way back ---- */
  #sheet-foot { background: var(--surface); border-top: 0; }
  #sheet-tabs { display: none; }
  #sheet:has(#sheet-wb:not([hidden])) #sheet-tabs { display: flex; }
  #sheet-tabs > :is(#sheet-back, #sheet-chats, #sheet-search) { display: none; }
  #sheet-dock { padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); }

  /* ---- the composer: one row, [+] [words] [send / stop], 40px each ---- */
  #app .composer, #sheet .composer, #composer, .composer {
    display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; column-gap: 4px; row-gap: 0; align-items: end;
    padding: 8px; border: 1px solid var(--color-line); border-radius: var(--radius-xl); background: var(--color-surface);
    box-shadow: var(--elevation-2);
    transition: border-color var(--dur-tap) var(--ease-standard), box-shadow var(--dur-tap) var(--ease-standard);
  }
  #sheet-dock .composer:focus-within, #composer:focus-within, .composer:focus-within {
    border-color: var(--color-focus); outline: none;
    box-shadow: var(--elevation-2);
  }
  .composer > :is(#composer-note, #composer-chips, #composer-pick) { grid-column: 1 / -1; }
  .composer > #composer-note { grid-row: 1; }
  .composer > #composer-chips { grid-row: 2; margin: 2px 4px 6px; }
  .composer > #composer-pick { grid-row: 3; }
  .composer > .composer-bar { display: contents; }
  .composer #input {
    grid-column: 2; grid-row: 4; align-self: center;
    min-height: 40px; max-height: 40vh; padding: 8px 4px; box-sizing: border-box;
    font-size: 17px; line-height: 24px;
  }
  /* One row means one row: the hint never wraps to a second line the 40px
     box would clip (app.js paintComposerHint gives a phone shorter words). */
  .composer #input:placeholder-shown { white-space: nowrap; overflow: hidden; }
  .composer .composer-bar #plus-btn,
  .composer .composer-bar .send { grid-row: 4; width: 40px; height: 40px; min-width: 40px; min-height: 40px; margin: 0; border-radius: 20px; }
  .composer .composer-bar #plus-btn { grid-column: 1; border: 0; background: transparent; color: var(--text); }
  .composer .composer-bar #plus-btn .ic { width: 20px; height: 20px; }
  .composer .composer-bar .send { grid-column: 3; border: 0; background: var(--b-send); color: var(--b-on-send); box-shadow: none; }
  .composer:has(#input:placeholder-shown) .composer-bar .send[data-mode="send"] { background: var(--b-send-off); color: var(--b-on-send); }
  .composer .composer-bar .send svg { width: 20px; height: 20px; }
  .composer .composer-bar :is(#composer-mode, #model-pill, #modes-btn, #at-worker) { display: none; }
  .composer #ctx-meter { display: none; }
  /* A 44px press around each 40px control: the box's own 6px pads them. */
  .composer .composer-bar :is(#plus-btn, .send) { position: relative; }
  .composer .composer-bar :is(#plus-btn, .send)::after { content: ""; position: absolute; inset: -2px; border-radius: 22px; }

  /* The + menu's first group on a phone: Ask / Do across, then Model. */
  .pm-settings { display: flex; flex-direction: column; gap: 4px; }
  .pm-mode { display: flex; padding: 2px; margin: 4px 6px; border-radius: 12px; background: var(--card-2); }
  .pm-mode-opt {
    flex: 1; min-height: 40px; border: 0; border-radius: 10px; background: transparent;
    font: inherit; font-size: 15px; font-weight: 500; color: var(--dim); cursor: pointer;
  }
  .pm-mode-opt[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
  .pm-mode-opt:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }

  /* ---- the drawer: the desk's rows ---- */
  /* New chat and Search first, then Home, Tickets, Spaces, Library, Team and
     Chats, then the places the desk keeps under More. Today's and the classic
     Home's rows are Home's (Scout's row), so they are not drawn twice.
     `#app` in front of each: phone.css hides every row but Results, Calendar
     and Spaces with a selector worth two ids, and these must win it. */
  #app #sidebar .side-group { display: flex; flex-direction: column; }
  #app #sidebar .side-group > :is(#threads-new, #sb-search, #scout-nav, #tickets-nav, #spaces-nav, #library-nav, #coworkers-nav, #drawer-chats, #goals-nav, #results-nav, #calendar-nav) { display: flex; }
  #app #sidebar .side-group > :is(#threads-new, #sb-search, #scout-nav, #tickets-nav, #spaces-nav, #library-nav, #coworkers-nav, #drawer-chats, #goals-nav, #results-nav, #calendar-nav)[hidden] { display: none; }
  #app #sidebar .side-group > :is(#chat-nav, #home-nav, #today-nav) { display: none; }
  #app #sidebar .side-group:has(> #scout-nav) > #today-nav { display: none; }
  #app #sidebar .side-group:not(:has(> #scout-nav)) > #today-nav:not([hidden]) { display: flex; }
  #app #sidebar .side-group > #threads-new { order: 1; }
  #app #sidebar .side-group > #sb-search { order: 2; margin-bottom: 12px; }
  #app #sidebar .side-group > #scout-nav, #app #sidebar .side-group > #today-nav { order: 3; }
  #app #sidebar .side-group > #tickets-nav { order: 4; }
  #app #sidebar .side-group > #spaces-nav { order: 5; }
  #app #sidebar .side-group > #library-nav { order: 6; }
  #app #sidebar .side-group > #coworkers-nav { order: 7; }
  #app #sidebar .side-group > #drawer-chats { order: 8; }
  #app #sidebar .side-group > #goals-nav { order: 9; margin-top: 12px; }
  #app #sidebar .side-group > #results-nav { order: 10; }
  #app #sidebar .side-group > #calendar-nav { order: 11; }
  #app #sidebar .side-group, #app #sidebar .side-group:has(> #results-nav:not([hidden]), > #calendar-nav:not([hidden]), > #spaces-nav:not([hidden])) {
    padding-bottom: 8px; margin-bottom: 4px; border-bottom: 0;
  }
  #app #sidebar :is(.side-item, .sb-item) { min-height: 44px; gap: 12px; padding: 0 12px; border-radius: 12px; font-size: 16px; }
  #app #sidebar :is(.side-item, .sb-item) > .s-icon { flex: none; width: 22px; height: 22px; }
  #app #sidebar #tickets-count:not([hidden]) {
    position: static; display: inline-block; margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; box-sizing: border-box;
    border-radius: 10px; background: var(--primary); color: var(--on-primary); font-size: 12px; font-weight: 600; line-height: 20px; text-align: center; border: 0;
  }
  #app #sidebar #crew-side { display: none; }
  /* Search and Customize are the docked column's `.sb-item`s, styled only
     under #threads; in the drawer they fell back to a browser button (an
     outlined box, the label centred under its icon). Drawn as rows, and the
     ⌘K hint goes — a phone has no keyboard to press it on. */
  #app #sidebar .sb-item {
    display: flex; align-items: center; justify-content: flex-start; width: 100%; padding: 0 12px; margin: 0;
    border: 0; background: transparent; box-shadow: none; color: var(--text); font: inherit; font-size: 16px; text-align: left; cursor: pointer;
  }
  #app #sidebar .sb-item[hidden] { display: none; }
  #app #sidebar .sb-item .s-icon { display: grid; place-items: center; background: transparent; color: currentColor; }
  #app #sidebar .sb-item :is(.sb-kbd, .sb-count) { display: none; }
  #app #sidebar .sb-item:active { background: var(--b-hover); }
  /* The current page is a quiet fill, as on the desk — not a raised white
     card with an outline. */
  #app #sidebar .side-item.active { background: var(--b-on); border: 0; box-shadow: none; font-weight: 500; }
  #app #sidebar .side-item.active::before { display: none; }
}
/* ---------- the tickets sheet: 820px and under (side-panel.js `is-sheet`) ----------
   Through 820px, not only the phone's 720: the desk's 360px column starts at
   821px (the top of this file), and until 2026-11-17's review (Devin, Qodo)
   the sheet stopped at 720, so a tablet at 721-820px had a Tickets row that
   opened nothing at all. A sheet, not the column from 721: at 768px a 360px
   column beside a drawer rail leaves the conversation 408px, under the
   chat's own floor, and the drawer is already this width's way of keeping
   things off the page until asked for. */
@media (max-width: 820px) {
  /* The quest note is a page's news; over the Tickets sheet it covered the
     sheet's last rows. It waits under the sheet like the chat does. */
  body:has(#side-panel.is-sheet:not([hidden])) #quest-toast { visibility: hidden; }

  /* ---- the tickets sheet (side-panel.js `is-sheet`) ---- */
  .sp-scrim { z-index: 48; }
  /* phone.css positions the sheets' scrim only at 720px and under; from 721
     to 820px this sheet is the only one, so its dim says where it is. */
  #sp-scrim:not([hidden]) { display: block; position: fixed; inset: 0; background: rgb(28 22 16 / .28); }
  #side-panel.is-sheet:not([hidden]) {
    display: flex; flex-direction: column; position: fixed; left: 0; right: 0; bottom: 0; top: calc(64px + env(safe-area-inset-top));
    z-index: 49; height: auto; overflow: hidden;
    background: var(--surface); color: var(--text); border-radius: 22px 22px 0 0; border: 0;
    box-shadow: 0 -4px 24px rgb(0 0 0 / .12);
    font-size: 17px; line-height: 25px; letter-spacing: -0.01em;
    animation: ph-sheet-up var(--dur-sheet) var(--ease-sheet);
  }
  #side-panel.is-sheet.is-dragging { transition: none; animation: none; }
  #side-panel.is-sheet .spn-head {
    flex: none; height: auto; display: grid; grid-template-columns: minmax(0, 1fr) 44px; grid-template-areas: "grab grab" "title close" "seg seg";
    align-items: center; padding: 8px 12px 12px 20px; row-gap: 0; touch-action: none;
  }
  #side-panel.is-sheet .spn-grab { display: block; grid-area: grab; justify-self: center; width: 36px; height: 5px; margin-bottom: 8px; border-radius: 3px; background: var(--line-2); }
  #side-panel.is-sheet .spn-title { display: block; grid-area: title; margin: 0; font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -0.02em; }
  #side-panel.is-sheet #sp-close { grid-area: close; width: 44px; height: 44px; border-radius: 22px; display: grid; place-items: center; color: var(--dim); background: none; border: 0; }
  #side-panel.is-sheet #sp-close::before { content: ""; position: absolute; width: 30px; height: 30px; border-radius: 15px; background: var(--card-2); }
  #side-panel.is-sheet #sp-close { position: relative; }
  #side-panel.is-sheet #sp-close .ic { position: relative; width: 14px; height: 14px; stroke-width: 2.2; }
  #side-panel.is-sheet .sp-seg {
    grid-area: seg; display: flex; margin: 12px 0 0 -8px; padding: 2px; border-radius: 10px; background: var(--card-2); font-size: 14px; line-height: 20px;
  }
  #side-panel.is-sheet .sp-seg [role="tab"] {
    flex: 1; height: 32px; min-height: 32px; border: 0; border-radius: 8px; background: transparent;
    font: inherit; font-weight: 500; color: var(--dim); cursor: pointer;
  }
  #side-panel.is-sheet .sp-seg [role="tab"][aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
  #side-panel.is-sheet .sp-seg [role="tab"]:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
  #side-panel.is-sheet .sp-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: env(safe-area-inset-bottom); }
  #side-panel.is-sheet .sp-content { display: flex; flex-direction: column; gap: 18px; padding: 0 12px 24px; }
  #side-panel.is-sheet .sp-group { display: flex; flex-direction: column; }
  #side-panel.is-sheet .sp-similar { display: flex; flex-direction: column; margin: 0 0 4px 16px; padding-left: 8px; border-left: 1px solid var(--b-hair); }
  #side-panel.is-sheet .sp-group-h { margin: 0; padding: 0 8px 4px; display: flex; gap: 8px; font-size: 14px; line-height: 20px; font-weight: 600; }
  #side-panel.is-sheet .sp-count { font-weight: 500; color: var(--dim); }
  #side-panel.is-sheet .sp-row { display: flex; gap: 12px; padding: 10px 8px; border-radius: 14px; align-items: flex-start; }
  #side-panel.is-sheet .sp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
  #side-panel.is-sheet .spn-open {
    display: flex; flex-direction: column; width: 100%; min-width: 0; min-height: 44px; padding: 0; border: 0; background: none;
    color: inherit; font: inherit; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  #side-panel.is-sheet .spn-open:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 4px; border-radius: 6px; }
  #side-panel.is-sheet .sp-title { font-size: 16px; line-height: 22px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #side-panel.is-sheet .sp-meta { font-size: 14px; line-height: 20px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #side-panel.is-sheet .sp-acts { display: flex; gap: 8px; flex-wrap: wrap; }
  #side-panel.is-sheet .spn-act {
    height: 44px; min-height: 44px; padding: 0 18px; border: 0; border-radius: 22px; background: var(--card-2); color: var(--text);
    font: inherit; font-size: 15px; font-weight: 500; cursor: pointer;
  }
  #side-panel.is-sheet .spn-act.sp-primary { background: var(--b-send); color: var(--b-on-send); }
  #side-panel.is-sheet .spn-act:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
  #side-panel.is-sheet .sp-ic { flex: 0 0 18px; width: 18px; height: 18px; margin-top: 2px; }
  #side-panel.is-sheet .sp-ic svg { width: 18px; height: 18px; }
  #side-panel.is-sheet .spn-bar { display: block; height: 4px; border-radius: 2px; background: var(--b-blue-track); overflow: hidden; }
  #side-panel.is-sheet .sp-fill { display: block; height: 4px; border-radius: 2px; background: var(--b-blue); }
  #side-panel.is-sheet .spn-empty { margin: 0; padding: 12px 8px; color: var(--dim); font-size: 15px; line-height: 22px; }
  #side-panel.is-sheet .spn-more { min-height: 44px; padding: 0 8px; border: 0; background: none; color: var(--dim); font: inherit; font-size: 15px; font-weight: 500; text-align: left; }
  #side-panel.is-sheet .sp-file { display: flex; gap: 12px; align-items: center; width: 100%; min-height: 56px; padding: 8px; border: 0; border-radius: 14px; background: none; color: inherit; font: inherit; text-align: left; }
  #side-panel.is-sheet .sp-tag { flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--card-2); display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--dim); }
  #side-panel.is-sheet .sp-activity { margin: 0; padding: 4px 8px; }
  #side-panel.is-sheet .sp-ic .spi-ring { stroke: var(--primary); stroke-width: 1.6; }
  #side-panel.is-sheet .sp-ic .spi-dot { fill: var(--primary); }
  #side-panel.is-sheet .sp-ic .spi-track { stroke: var(--b-blue-track); stroke-width: 1.6; }
  #side-panel.is-sheet .sp-ic .spi-arc { stroke: var(--b-blue); stroke-width: 1.6; stroke-linecap: round; }
  #side-panel.is-sheet .sp-ic .spi-dash { stroke: var(--b-dash); stroke-width: 1.6; stroke-dasharray: 2.5 2.5; }
  #side-panel.is-sheet .sp-ic[data-state="checking"] .spi-ring { stroke: var(--b-amber); }
  #side-panel.is-sheet .sp-ic .spi-half { fill: var(--b-amber); }
  #side-panel.is-sheet .sp-ic .spi-fill { fill: var(--b-green); }
  #side-panel.is-sheet .sp-ic .spi-tick { stroke: var(--shell-on-accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
}
@media (max-width: 820px) and (prefers-reduced-motion: reduce) {
  #side-panel.is-sheet:not([hidden]) { animation: ph-fade-in 80ms linear; }
}
/* The drawer's Chats row is the drawer's alone: a desk has the list. */
@media (min-width: 821px) {
  #app #sidebar #drawer-chats { display: none; }
}

/* ---------- a ticket, worked through in the side panel (2026-11-19) ---------
   side-panel.js and ticket-panel.js: the one-tap row presses and what they
   answered, the list's two quiet top lines, the ticket's own view and its
   folded Details, and the foot notice for a ticket that came back proved.
   Everything here is scoped to #side-panel and drawn with the panel's own
   tokens and classes (`.spn-act`, `.spn-more`, `.sp-ic`); nothing outside
   the panel is touched. Desk and sheet alike, the sheet's larger type
   coming from its own rules above. */
#side-panel .spt-top { margin: 0; padding: 0 8px; font-size: 13px; line-height: 18px; color: var(--dim); }
#side-panel .spt-caught { color: var(--text); }
#side-panel .spt-caught-n { color: var(--dim); }
#side-panel .spt-said { margin: 0; flex-basis: 100%; font-size: 13px; line-height: 18px; color: var(--text); overflow-wrap: anywhere; }
#side-panel .spt-undo-words { flex-basis: auto; align-self: center; color: var(--dim); }
#side-panel .spt-view { gap: 14px; padding-top: 0; }
#side-panel .spt-back { display: inline-flex; align-items: center; gap: 4px; margin: 0; padding: 0 8px 0 4px; }
#side-panel .spt-back svg { flex: none; }
#side-panel .spt-head { padding: 0 8px; display: flex; flex-direction: column; gap: 2px; }
#side-panel .spt-title { margin: 0; font-size: 16px; line-height: 22px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
#side-panel .spt-title:focus { outline: none; }
#side-panel .spt-title:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 4px; }
#side-panel .spt-status { margin: 0; font-size: 13px; line-height: 18px; color: var(--dim); }
#side-panel .spt-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 12px; margin: 0; padding: 0 8px; font-size: 13px; line-height: 18px; }
#side-panel .spt-facts dt { color: var(--dim); }
#side-panel .spt-facts dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
#side-panel .spt-sec { display: flex; flex-direction: column; gap: 6px; padding: 0 8px; }
#side-panel .spt-h { margin: 0; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--text); }
#side-panel .spt-brief { margin: 0; font-size: 13px; line-height: 19px; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
#side-panel .spt-checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
#side-panel .spt-check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 18px; color: var(--text); }
#side-panel .spt-check[data-passed="false"] .spt-line { color: var(--dim); }
#side-panel .spt-check .sp-ic { margin-top: 1px; }
#side-panel .spt-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#side-panel .spt-note { margin: 0; padding: 0 8px; font-size: 13px; line-height: 18px; color: var(--dim); }
#side-panel .spt-view > .spt-acts { padding: 0 8px; }
#side-panel .spt-details { padding: 4px 8px 0; border-top: 1px solid var(--b-hair); }
#side-panel .spt-summary { padding: 8px 0; font-size: 13px; line-height: 18px; font-weight: 500; color: var(--dim); cursor: pointer; }
#side-panel .spt-summary:hover { color: var(--text); }
#side-panel .spt-summary:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 4px; }
#side-panel .spt-audit { display: flex; flex-direction: column; gap: 10px; font-size: 13px; line-height: 18px; color: var(--text); }
#side-panel .spt-audit .pp-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 0; }
#side-panel .spt-audit .pp-facts dt { color: var(--dim); }
#side-panel .spt-audit .pp-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
#side-panel .spt-audit .pt-lane h6 { margin: 0 0 2px; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--dim); }
#side-panel .spt-audit .pp-sublist { margin: 0; padding-left: 1.2em; overflow-wrap: anywhere; }
#side-panel .spt-audit .pp-empty, #side-panel .spt-audit .pt-ledger-quiet { color: var(--dim); }
#side-panel .spt-audit .pt-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#side-panel .spt-settings { margin: 8px 0 0; padding: 0; }
#side-panel .spt-keys { margin: 8px 0 4px; font-size: 12px; line-height: 16px; color: var(--dim); }
/* The foot notice: a flex child under the body, so it covers no row. */
#side-panel .spt-toast { flex: none; display: flex; align-items: center; gap: 10px; margin: 0 12px 12px; padding: 10px 8px 10px 14px; border-radius: 12px; background: var(--card-2); font-size: 13px; line-height: 18px; color: var(--text); }
#side-panel .spt-toast:empty { display: none; }
#side-panel .spt-toast-words { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#side-panel .spt-toast-x { flex: none; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--dim); display: grid; place-items: center; cursor: pointer; }
#side-panel .spt-toast-x:hover { color: var(--text); background: var(--b-hover); }
#side-panel .spt-toast-x:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
/* The tick of a ticket that just came back proved, drawn once. */
#side-panel .sp-ic.is-drawn .spi-tick { stroke-dasharray: 9; stroke-dashoffset: 9; animation: spt-draw 300ms ease-out forwards; }
@keyframes spt-draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  #side-panel .sp-ic.is-drawn .spi-tick { animation: none; stroke-dashoffset: 0; }
}
/* On the sheet the panel reads at the phone's sizes (its rows are 16/14px). */
@media (max-width: 820px) {
  #side-panel.is-sheet .spt-top, #side-panel.is-sheet .spt-said, #side-panel.is-sheet .spt-status,
  #side-panel.is-sheet .spt-facts, #side-panel.is-sheet .spt-h, #side-panel.is-sheet .spt-brief,
  #side-panel.is-sheet .spt-check, #side-panel.is-sheet .spt-note, #side-panel.is-sheet .spt-summary,
  #side-panel.is-sheet .spt-audit, #side-panel.is-sheet .spt-toast { font-size: 15px; line-height: 21px; }
  #side-panel.is-sheet .spt-title { font-size: 19px; line-height: 25px; }
  #side-panel.is-sheet .spt-keys { display: none; }
  #side-panel.is-sheet .spt-summary { min-height: 44px; display: flex; align-items: center; }
  #side-panel.is-sheet .spt-toast { margin: 0 12px calc(12px + env(safe-area-inset-bottom)); }
}

/* ---------- the side panel coming and going (UI/UX PR 3, 2026-11-19) ----------
   It lives on the right edge, so it comes from there: 16px in from the right
   while the grid eases its track open (style.css, `#app`'s transition), on
   the panel token and the calm curve (tokens.css, MOTION). It went on and off
   at once until this day, its contents drawn whole into a track still a few
   pixels wide. Leaving, side-panel.js puts a copy where it stood (motion.js
   `leave`, the way the workbench's column leaves) and the copy slides back
   the way it came, quicker, while the track shuts. The copy has no id, so
   `#side-panel`'s `display: none` is not its: it is drawn as the column was.
   Under reduced motion both are the 80ms fade every other move becomes. */
@keyframes sp-slide-in { from { opacity: 0; transform: translateX(16px); } }
@keyframes sp-slide-out { to { opacity: 0; transform: translateX(16px); } }
@media (min-width: 821px) {
  #app.side-open:not(.view-welcome):not(.open-screen) #side-panel:not([hidden]) {
    animation: sp-slide-in var(--dur-panel) var(--ease-standard) both;
  }
  .side-panel.is-leaving {
    display: flex; z-index: 30;
    animation: sp-slide-out calc(var(--dur-panel) * var(--dur-exit-scale)) var(--ease-exit) both;
  }
}
@media (min-width: 821px) and (prefers-reduced-motion: reduce) {
  #app.side-open:not(.view-welcome):not(.open-screen) #side-panel:not([hidden]) { animation: ph-fade-in 80ms linear both; }
  .side-panel.is-leaving { animation: ph-fade-out 80ms linear both; }
}

/* ---------- Scout single-stream timeline, Morning Brief fold, memory popover, and inline OpenUI cards (Tasks 4 & 5) ---------- */
.scout-date-divider {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  margin: var(--space-5) 0 var(--space-2);
  color: var(--color-ink-muted);
  font-size: var(--type-caption);
  line-height: var(--type-caption-lh);
  font-weight: var(--weight-medium);
}
.scout-date-divider::before,
.scout-date-divider::after {
  content: "";
  flex: 1 1 0;
  height: 1px;
  background: var(--color-line);
}
.sdd-pill {
  flex: none;
  padding: 2px var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  background: var(--color-surface-inset);
  color: var(--color-ink-muted);
  font-size: var(--type-caption);
  line-height: var(--type-caption-lh);
  font-weight: var(--weight-medium);
  letter-spacing: 0.01em;
}

.scout-brief {
  flex-shrink: 0;
  margin: var(--space-2) 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: var(--elevation-1);
  overflow: hidden;
}
.scout-brief[hidden] { display: none; }
.scout-brief-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  cursor: pointer;
  padding: var(--space-3) var(--space-4);
  font-size: var(--type-footnote);
  line-height: var(--type-footnote-lh);
  font-weight: var(--weight-semibold);
  color: var(--color-ink);
  background: var(--color-surface-inset);
  list-style: none;
  transition: background-color var(--dur-tap) var(--ease-standard);
}
.scout-brief-summary::-webkit-details-marker { display: none; }
.scout-brief-summary:hover { background: var(--color-fill-hover); }
.scout-brief-summary:focus-visible { outline: 2px solid var(--color-focus); outline-offset: -2px; }
.scout-brief-summary::after {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--color-ink-muted);
  border-bottom: 1.5px solid var(--color-ink-muted);
  transform: rotate(-45deg);
  transition: transform var(--dur-tap) var(--ease-standard);
}
.scout-brief[open] > .scout-brief-summary::after {
  transform: rotate(45deg);
}
.scout-brief > #today-brief {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--color-line);
  border-radius: 0;
  box-shadow: none;
}

.scout-scroll-target {
  scroll-initial-target: nearest;
}

#chat-panel .stream > .scout-load-older,
.scout-load-older {
  flex-shrink: 0;
  margin: var(--space-2) auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-ink-muted);
  font-size: var(--type-caption);
  line-height: var(--type-caption-lh);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: background-color var(--dur-tap) var(--ease-standard), color var(--dur-tap) var(--ease-standard);
}
#chat-panel .stream > .scout-load-older:hover,
.scout-load-older:hover {
  background: var(--color-fill-hover);
  color: var(--color-ink);
}
.scout-load-older[hidden] { display: none; }

#chat-panel .stream > .scout-memory-receipt,
.scout-memory-receipt {
  flex-shrink: 0;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  align-self: flex-start;
  gap: var(--space-1);
  margin: 0;
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  background: var(--color-surface-inset);
  color: var(--color-ink-muted);
  font-size: var(--type-caption);
  line-height: var(--type-caption-lh);
}
.scout-memory-receipt.smr-fading { opacity: 0.45; }

#scout-memory-btn {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-ink);
  font-size: var(--type-caption);
  line-height: var(--type-caption-lh);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: background-color var(--dur-tap) var(--ease-standard);
}
#scout-memory-btn:hover { background: var(--color-fill-hover); }
#scout-memory-btn[hidden] { display: none; }
#scout-memory-btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

#scout-memory-pop[popover] {
  display: none;
  position: fixed;
  top: calc(var(--space-12) + var(--space-2));
  right: var(--space-4);
  bottom: auto;
  left: auto;
  z-index: 40;
  width: min(360px, calc(100vw - var(--space-6)));
  max-height: min(440px, 70vh);
  margin: 0;
  padding: var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-xl);
  background: var(--color-surface-raised);
  color: var(--color-ink);
  box-shadow: var(--elevation-3);
  flex-direction: column;
  gap: var(--space-2);
}
#scout-memory-pop[popover]:is(:popover-open, .\:popover-open),
[popover]:is(:popover-open, .\:popover-open) {
  display: flex;
}
.smp-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.smp-title {
  font-size: var(--type-footnote);
  line-height: var(--type-footnote-lh);
  font-weight: var(--weight-semibold);
  color: var(--color-ink);
}
.smp-search {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  background: var(--color-surface-inset);
  color: var(--color-ink);
  font-size: var(--type-body);
  line-height: var(--type-body-lh);
}
.smp-search:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; }
.smp-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  overflow-y: auto;
}
.smp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--color-surface-inset);
  color: var(--color-ink);
  font-size: var(--type-footnote);
  line-height: var(--type-footnote-lh);
  transition: background-color var(--dur-tap) var(--ease-standard);
}
.smp-row:hover { background: var(--color-fill-hover); }
.smp-row.smr-fading { opacity: 0.45; }
.smp-empty {
  padding: var(--space-3);
  text-align: center;
  color: var(--color-ink-muted);
  font-size: var(--type-footnote);
}

/* Inline OpenUI chat cards */
.chat-openui-card {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: var(--elevation-1);
  overflow: visible;
}
.coc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-line);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  background: var(--color-surface-inset);
}
.coc-title-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  flex: 1 1 200px;
}
.coc-badge {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--denim-tint);
  color: var(--denim);
}
.coc-title-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.coc-title {
  font-size: var(--type-body);
  line-height: var(--type-body-lh);
  font-weight: var(--weight-semibold);
  color: var(--color-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.coc-meta {
  font-size: var(--type-caption);
  line-height: var(--type-caption-lh);
  color: var(--color-ink-muted);
}
.coc-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: none;
}
.coc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  min-height: 32px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-ink);
  font: inherit;
  font-size: var(--type-footnote);
  line-height: var(--type-footnote-lh);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: background-color var(--dur-tap) var(--ease-standard), border-color var(--dur-tap) var(--ease-standard), opacity var(--dur-tap) var(--ease-standard);
}
.coc-btn:hover:not(:disabled) {
  background: var(--color-fill-hover);
  border-color: var(--color-line-strong);
}
.coc-btn:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}
.coc-btn[aria-busy="true"],
.coc-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}
.coc-pin-wrap {
  position: relative;
  max-width: 100%;
}
.coc-pin-menu {
  position: absolute;
  top: calc(100% + var(--space-1));
  right: 0;
  inset-inline-end: 0;
  z-index: 35;
  min-width: min(220px, calc(100vw - var(--space-8)));
  max-width: min(320px, calc(100vw - var(--space-8)));
  max-height: 260px;
  overflow-y: auto;
  padding: var(--space-1);
  border-radius: var(--radius-lg);
  background: var(--color-surface-raised);
  box-shadow: var(--elevation-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
@media (max-width: 520px) {
  .coc-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
.coc-pin-menu[hidden] { display: none; }
.coc-pin-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-ink);
  font: inherit;
  font-size: var(--type-footnote);
  line-height: var(--type-footnote-lh);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--dur-tap) var(--ease-standard);
}
.coc-pin-item:hover { background: var(--color-fill-hover); }
.coc-pin-item:focus-visible {
  outline: none;
  background: var(--color-fill-hover);
  box-shadow: inset 0 0 0 2px var(--color-focus);
}
.coc-pin-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.coc-pin-kind {
  flex: none;
  font-size: var(--type-caption);
  line-height: var(--type-caption-lh);
  color: var(--color-ink-muted);
  text-transform: capitalize;
}
.coc-pin-empty {
  padding: var(--space-2) var(--space-3);
  font-size: var(--type-footnote);
  line-height: var(--type-footnote-lh);
  color: var(--color-ink-muted);
}
.coc-notice {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--color-line);
  background: var(--honey-tint);
  color: var(--color-attention-ink);
  font-size: var(--type-footnote);
  line-height: var(--type-footnote-lh);
}
.coc-notice[data-tone="error"] {
  background: var(--blush);
  color: var(--color-danger);
}
.coc-notice[hidden] { display: none; }
.coc-frame-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  background: var(--color-surface);
}
.coc-slept {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  min-height: inherit;
  padding: var(--space-5) var(--space-4);
  background: var(--color-surface-inset);
  color: var(--color-ink-muted);
}
.coc-slept-copy {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
  flex: 1 1 200px;
}
.coc-slept-title {
  font-size: var(--type-body);
  line-height: var(--type-body-lh);
  font-weight: var(--weight-medium);
  color: var(--color-ink);
}
.coc-slept-note {
  font-size: var(--type-caption);
  line-height: var(--type-caption-lh);
  color: var(--color-ink-muted);
}
.coc-slept-wake { flex: none; }

@media (prefers-reduced-motion: reduce) {
  .scout-brief-summary,
  .scout-brief-summary::after,
  .scout-load-older,
  #scout-memory-btn,
  .smp-row,
  .coc-btn,
  .coc-pin-item {
    transition: none;
  }
}

@media (pointer: coarse) {
  #scout-memory-btn,
  .scout-brief-summary,
  .scout-load-older,
  .smr-forget,
  .smp-forget,
  .smp-search,
  .coc-btn,
  .coc-pin-item,
  .coc-slept-wake {
    min-height: var(--tap-min);
  }
}

/* ---------- Single-Stream Scout: empty greeting, palette match & Manus inspector ---------- */
.ce-greeting {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-4);
  width: min(560px, 100%); margin: 0 auto; padding: var(--space-5) var(--space-4);
  border-radius: var(--radius-xl); background: var(--color-surface);
  box-shadow: var(--elevation-1); text-align: center;
}
.ce-greeting-title {
  margin: 0; font-size: var(--type-headline); line-height: var(--type-headline-lh);
  font-weight: var(--weight-semibold); color: var(--color-ink); letter-spacing: -0.015em;
}
.ce-greeting-lead {
  margin: 0; max-width: 44ch; font-size: var(--type-body); line-height: var(--type-body-lh);
  color: var(--color-ink-muted);
}
.ce-starters {
  display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2);
  width: 100%;
}
.ce-starter-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap-min); padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-line); border-radius: var(--radius-pill);
  background: var(--color-surface-inset); color: var(--color-ink);
  font: inherit; font-size: var(--type-footnote); font-weight: var(--weight-medium);
  cursor: pointer;
  transition: background-color var(--dur-tap) var(--ease-standard), border-color var(--dur-tap) var(--ease-standard);
}
.ce-starter-chip:hover { background: var(--color-fill-hover); border-color: var(--color-line-strong); }
.ce-starter-chip:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

.composer-bar .chip, .composer-bar .pill, .composer-bar .composer-mode-pill {
  border-radius: var(--radius-pill);
}

.scout-search-hit {
  background: var(--color-fill-selected);
  outline: 2px solid var(--color-focus);
  outline-offset: 4px;
  border-radius: var(--radius-lg);
}

.cw-inspect-hit {
  display: inline-flex; align-items: center; gap: 9px;
  margin: 0; padding: 0; border: 0; background: transparent;
  color: inherit; font: inherit; text-align: left; cursor: pointer;
  min-width: 0; flex: 1;
}
.cw-inspect-hit .name { font-size: var(--t-md); flex: 1; }
.cw-inspect-hit:hover .name { text-decoration: underline; text-underline-offset: 2px; }
@media (pointer: coarse) { .cw-inspect-hit { min-height: var(--tap-min); } }

.cw-inspector {
  display: flex; flex-direction: column; gap: var(--space-4);
  max-width: 720px; padding: var(--space-5); border-radius: var(--radius-xl);
  background: var(--color-surface); box-shadow: var(--elevation-1);
}
.cw-insp-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.cw-insp-title { margin: 0; font-size: var(--type-headline); font-weight: var(--weight-semibold); color: var(--color-ink); }
.cw-insp-role { margin: 2px 0 0; font-size: var(--type-footnote); color: var(--color-ink-muted); }
.cw-insp-section { display: flex; flex-direction: column; gap: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--color-line); }
.cw-insp-section h4 { margin: 0; font-size: var(--type-footnote); font-weight: var(--weight-semibold); color: var(--color-ink-muted); }
.cw-insp-pills { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.cw-insp-pill { padding: 4px 10px; border-radius: var(--radius-pill); background: var(--color-surface-inset); font-size: var(--type-caption); color: var(--color-ink); }
.cw-insp-trail { display: flex; flex-direction: column; gap: var(--space-2); }
.cw-insp-trail-row { padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); background: var(--color-surface-inset); font-size: var(--type-footnote); color: var(--color-ink); }

@media (max-width: 820px) {
  #tabbar {
    display: flex; align-items: center; justify-content: space-around;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 46;
    border: 0; border-top: 1px solid var(--color-line); border-radius: 0;
    background: color-mix(in srgb, var(--color-surface) 88%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    box-shadow: none;
    padding: var(--space-1) var(--space-2) calc(var(--space-1) + env(safe-area-inset-bottom));
  }
  #tabbar .tabbar-item {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: var(--tap-min);
    border-radius: var(--radius-md);
    padding: var(--space-1) var(--space-2);
    color: var(--color-ink-muted);
    font-weight: var(--weight-medium);
    box-shadow: none;
  }
  #tabbar .tabbar-item > svg.ic {
    width: 22px; height: 22px; padding: 0; border-radius: 0;
    background: none; color: inherit; box-shadow: none; stroke-width: 1.85;
  }
  #tabbar .tabbar-item.active {
    background: var(--color-fill-selected);
    color: var(--color-ink);
    font-weight: var(--weight-semibold);
    box-shadow: none;
  }
  #tabbar .tabbar-item.active > svg.ic { color: inherit; }
  #tabbar #tab-tickets-count:not([hidden]) {
    position: absolute; top: 3px; right: calc(50% - 18px);
    min-width: 16px; height: 16px; padding: 0 4px; box-sizing: border-box;
    border-radius: var(--radius-pill); background: var(--primary); color: var(--on-primary);
    font-size: 11px; line-height: 16px; font-weight: var(--weight-semibold); text-align: center; border: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  #composer, .composer, .ce-starter-chip { transition: none; }
}
