/* ============================================================================
   THE CHAT-FIRST SHELL (UI step 3, 2026-10-12) — sidebar.js, chat-look.js
   ----------------------------------------------------------------------------
   The owner's approved Main, Conversation and Motion screens, drawn with this
   app's own tokens: one sidebar of words, a fresh chat that is a greeting over
   a big box, the person's words as dark bubbles on the right and the other
   side's as open text on the left under who said them, the approval as a card
   in the conversation, and the motion pack's durations and curves.

   Loaded after style.css so it wins at equal specificity. Every colour is a
   token or a mix of tokens, so the dark theme follows without a second block:
   the canvas's own greys (#F1F1EE, #E2E2DC…) are the light theme's paper and
   ink mixed, which is what they are.

   **What is new is scoped.** Everything for the sidebar is under `#threads`,
   which is `display: none` unless it is docked; everything for the
   conversation is under `#chat-panel` or `#chat-main`, so the phone's Ask
   sheet — which the same nodes move into — keeps the look it had.
   ============================================================================ */

#app {
  /* The sidebar's ground and its two states, as the canvas draws them: a
     hover a shade darker than the ground, "you are here" a shade darker
     again, and never a colour — red is for the one action per view. */
  --sb-bg: var(--paper);
  --sb-hover: color-mix(in srgb, var(--text) 6%, transparent);
  --sb-on: color-mix(in srgb, var(--text) 9%, transparent);
  --sb-ink: color-mix(in srgb, var(--text) 88%, var(--paper));
  /* The conversation's column: 760px of reading, centred in whatever width
     the chat has, with a gutter on the left for the speaker's tile. */
  --cl-col: 760px;
  --cl-gut: 42px;
  --cl-av: 30px;
}

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

#threads {
  background: var(--sb-bg);
  border-right: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  padding: 0 0 6px;
  font-size: 14px;
}
/* The rail has no column while this one is on screen: its destinations are in
   here (sidebar.js), so the rail is only the sidebar's collapsed state.
   layout.js still counts the rail's 72px when it decides whether a panel
   floats or the list steps aside — deliberately left alone, because its
   thresholds are pinned by the layout tests and were tuned by hand. The cost is
   that every decision is made with 72px less than the window really has, so a
   panel floats a little early and the page gets the spare 72px; never the
   other way round, where something would be given room that is not there.
   The topbar's lockup goes too: the mark is at the top of the sidebar now. */
@media (min-width: 821px) {
  #app.threads-docked:not(.view-welcome) { --col-rail: 0px; }
  #app.threads-docked #sidebar { display: none; }
  #app.threads-docked #topbar .brand { display: none; }
}
/* The chat panel's "Chats" popover button: the chats are in the sidebar while
   it is docked, so the button would open a second copy of a list on screen. */
#app.threads-docked #chat-list-toggle { display: none; }

.th-head { padding: 12px 10px 6px 14px; gap: 2px; }
.sb-mark {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  padding: 4px 6px; margin-left: -6px; border: 0; background: transparent; border-radius: 8px;
  font: inherit; font-size: 17px; font-weight: 600; letter-spacing: -.01em; color: var(--text);
  cursor: pointer; text-align: left;
  transition: background-color var(--dur-instant) var(--ease-snap);
}
.sb-mark:hover { background: var(--sb-hover); }
.sb-mark .sb-logo { flex: none; fill: var(--primary); }
.sb-mark .sb-brand-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#threads .th-head .cp-icon { width: 30px; height: 30px; color: var(--dim); }
#threads .th-head .cp-icon:hover { background: var(--sb-hover); color: var(--text); }

/* The shop switcher, as the canvas's workspace pill. */
.sb-top { padding: 4px 12px 0; }
.sb-top:empty { display: none; }
#threads #brand-switch .side-label { display: none; }
/* A compact "Shop name ▾" row since slice 1, not a bordered card: one row of
   the column like the others, so the column reads as a list, not a form. */
#threads #brand-btn {
  display: flex; flex-direction: row; align-items: center; gap: 9px; width: 100%;
  margin: 0; padding: 6px 10px; text-align: left; min-height: 34px;
  border: 0; border-radius: 8px; background: transparent;
  font-size: 14px; font-weight: 500; color: var(--text); line-height: 1.3;
  transition: background-color var(--dur-instant) var(--ease-snap);
}
#threads #brand-btn:hover { background: var(--sb-hover); }
#threads #brand-btn .s-icon {
  width: 24px; height: 24px; border-radius: 6px; background: var(--wine); color: #fff;
  box-shadow: none; display: grid; place-items: center;
}
#threads #brand-btn .s-icon .ic { width: 14px; height: 14px; stroke-width: 2.2; }
#threads #brand-current { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#threads #brand-btn .badge { position: static; }
/* Shop, under the switcher: a small secondary line, not one of the places —
   it is the shop being worked on, and the switcher above it is which one. */
#threads .sb-top #shop-nav { min-height: 28px; padding: 4px 10px; font-size: 13px; color: var(--dim); }
#threads .sb-top #shop-nav:hover { color: var(--text); }
#threads .sb-top #shop-nav .s-icon, #threads .sb-top #shop-nav .s-icon .ic { width: 15px; height: 15px; }
#threads #brand-btn::after {
  content: ""; width: 7px; height: 7px; flex: none; margin: -3px 2px 0 0;
  border-right: 1.5px solid var(--dim); border-bottom: 1.5px solid var(--dim); transform: rotate(45deg);
}

/* The items. Rail buttons moved in here and the sidebar's own share one look:
   an 18px line glyph and a 14px word in a row, a pill of ground on hover and
   a darker one for "you are here". Specific enough (`#threads …`) to undo
   the rail's column of squircles without touching the rail itself. */
.sb-nav, .sb-setup { display: flex; flex-direction: column; gap: 1px; padding: 2px 8px; }
#threads :is(.side-item, .sb-item) {
  position: relative; display: flex; flex-direction: row; align-items: center; justify-content: flex-start;
  gap: 10px; width: 100%; min-height: 34px; padding: 7px 10px; margin: 0;
  border: 0; border-radius: 8px; background: transparent;
  font: inherit; font-size: 14px; font-weight: 400; line-height: 1.25; text-align: left;
  color: var(--sb-ink); cursor: pointer;
  transition: background-color var(--dur-instant) var(--ease-snap), color var(--dur-instant) var(--ease-snap);
}
#threads :is(.side-item, .sb-item)[hidden] { display: none; }
#threads :is(.side-item, .sb-item):hover { background: var(--sb-hover); color: var(--text); }
#threads :is(.side-item, .sb-item).active,
#threads :is(.side-item, .sb-item).active:hover {
  background: var(--sb-on); color: var(--text); font-weight: 500;
  transition: background-color var(--dur-quick) var(--ease-snap);
}
/* While the chat has the window no page is on screen, so no place in the
   sidebar is "here": Today stayed lit beside a new chat that filled the
   window (desktop QA, 2026-10-14). Its aria-current stays — it is still the
   page under the chat, and the one a click on it brings back. */
#app:is(.chat-wide, .chat-fills-window):not(.view-welcome) #threads :is(.side-item, .sb-item).active {
  background: transparent; color: var(--sb-ink); font-weight: 400;
}
#app:is(.chat-wide, .chat-fills-window):not(.view-welcome) #threads :is(.side-item, .sb-item).active:hover { background: var(--sb-hover); color: var(--text); }
#threads :is(.side-item, .sb-item)::before { content: none; }
#threads :is(.side-item, .sb-item):focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
#threads :is(.side-item, .sb-item) .s-icon,
#threads :is(.side-item, .sb-item):hover .s-icon,
#threads :is(.side-item, .sb-item).active .s-icon {
  width: 18px; height: 18px; border-radius: 0; flex: none;
  background: transparent; box-shadow: none; filter: none; color: currentColor;
  display: grid; place-items: center;
}
#threads :is(.side-item, .sb-item) .s-icon .ic { width: 18px; height: 18px; stroke-width: 1.6; }
#threads :is(.side-item, .sb-item) .s-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Hire a worker is the canvas's one green line: an invitation, not a place. */
#threads .sb-item.sb-accent { color: var(--win); }
#threads .sb-item.sb-accent:hover { color: var(--win); }
/* Counts on the right: needs-you counts as an amber pill (Team, Goals), plain
   numbers in quiet secondary text (Skills, "3 of 11"). The mono face they
   used to wear went on 2026-11-17: a count is a word in the sidebar, not
   output, and figures line up by `tabular-nums` without changing face. */
#threads :is(.side-item, .sb-item) .badge {
  position: static; margin: 0 0 0 auto; padding: 1px 7px; border: 0; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; line-height: 1.5;
  background: var(--honey-tint); color: var(--sun-ink);
}
#threads :is(.side-item, .sb-item) .badge[data-state="working"] { background: var(--sky-tint); color: var(--sky); }
#threads #connections-badge { display: none; }
#threads .sb-count {
  margin-left: auto; flex: none; font: 500 12px/1 var(--f-body); letter-spacing: normal; color: var(--dim); font-variant-numeric: tabular-nums;
}
#threads .sb-count[hidden] { display: none; }
/* `.sb-count` is the sidebar's: the rail keeps its own badge. */
#sidebar .sb-count { display: none; }
/* Home is not in this column since slice 1 (2026-10-28): it appeared three
   times, and the mark at the top (#sb-home) is Home here, Classic home or
   not; #home-nav stays on the rail. */
/* Chat stays in the rail (it toggles the panel, which the sidebar's chats and
   New chat do here), and so does the Privacy link — at the foot of Settings. */

/* Group labels (Team, Today, Setup). They were the canvas's small mono
   capitals until 2026-11-17; spaced capitals in a typewriter face were the
   loudest thing in a column meant to be quiet. Sentence case, as the markup
   already writes them, in the body face and the secondary grey. */
.sb-label, #threads .ci-group, #threads .cs-toggle {
  font: 500 12px/1 var(--f-body); letter-spacing: normal; text-transform: none; color: var(--dim);
}
.sb-label { padding: 14px 18px 6px; }
#threads .ci-group { padding: 14px 10px 6px; }
#threads .ci-group:first-child { padding-top: 8px; }

/* The crew, as the canvas's pinned workers: a lettered tile, the name, and a
   dot for what it is doing. Its own fold and count stay (crew-side.js). */
#threads .crew-side { padding: 4px 8px 0; }
#threads .cs-h { padding: 0; }
#threads .cs-toggle { width: 100%; padding: 12px 10px 6px; background: none; border: 0; display: flex; align-items: center; gap: 6px; cursor: pointer; }
#threads .cs-word::before { content: none; }
#threads .cs-chev { width: 10px; height: 10px; }
#threads .cs-hit { border-radius: 8px; padding: 5px 10px; gap: 10px; }
#threads .cs-row[data-state="working"] .cs-hit,
#threads .cs-row:is([data-state="stuck"], [data-state="needs"], [data-needs]) .cs-hit { background: transparent; }
#threads .cs-hit:hover { background: var(--sb-hover); }
#threads .cs-av { width: 22px; height: 22px; border-radius: 6px; font-size: 11.5px; }
#threads .cs-name { font-size: 13.5px; font-weight: 400; color: var(--sb-ink); }
#threads .crew-side .tm-status { font-size: 11.5px; }

/* The chats. Pinned, then by day (threads.js); one line a chat, with the
   status line only when it says something more than a time — Running, New,
   Live — so the list reads as the canvas's Recent. The search box gives way
   to the sidebar's Search, which looks inside chats too. */
#threads .cl-search { display: none; }
#threads #chat-items { padding: 0 8px 8px; }
#threads .chat-item {
  padding: 6px 30px 6px 10px; border-radius: 8px; color: var(--sb-ink);
  transition: background-color var(--dur-instant) var(--ease-snap);
}
#threads .chat-item:hover { background: var(--sb-hover); }
#threads .chat-item.current, #threads .chat-item.current:hover { background: var(--sb-on); box-shadow: none; }
#threads .chat-item .ci-title { font-size: 13.5px; font-weight: 400; color: var(--sb-ink); }
#threads .chat-item.current .ci-title { font-weight: 500; color: var(--text); }
#threads .chat-item .ci-meta:not(:has(.ci-state)) { display: none; }
#threads .cl-foot { margin: 0 16px 4px; border-top: 0; }
#threads .th-all { padding: 6px 2px; font-size: 12.5px; font-weight: 500; color: var(--dim); }
#threads .th-all:hover { color: var(--text); text-decoration: none; }

/* The middle — places, team, chats — scrolls inside itself, so the head and
   the Setup foot are always on screen and nothing in the middle can be drawn
   over SETUP (desktop QA, 2026-10-14: eight teammates made the column 969px in
   an 884px window and the document itself scrolled). `contain`, so a wheel at
   the end of the middle does not go on to scroll the page behind it. */
.sb-mid { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
#threads .sb-nav { flex: none; }
/* The chats take what the middle has left, and never less than room for a few
   rows and "All chats": below that the middle scrolls instead, rather than
   squeezing the list to 0px, which is what hid it under SETUP. */
#threads #threads-slot { flex: 1 0 0; min-height: 168px; }

/* Setup, and who is signed in, at the foot. */
.sb-foot { flex: none; border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent); margin-top: 4px; padding-top: 2px; }
.sb-foot .sb-label { padding-top: 12px; }
/* The user row opens the account menu (slice 1): a button the width of the
   column, the row's look unchanged, a chevron saying it opens upward. */
.sb-user-wrap { position: relative; margin: 6px 8px 6px; padding-top: 6px; border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent); }
.sb-user {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; min-width: 0;
  border: 0; border-radius: 8px; background: transparent; cursor: pointer; text-align: left;
  font: inherit; font-size: 14px; color: var(--text);
  transition: background-color var(--dur-instant) var(--ease-snap);
}
.sb-user:hover, .sb-user[aria-expanded="true"] { background: var(--sb-hover); }
.sb-user:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.sb-user[hidden] { display: none; }
.sb-user-av:empty { display: none; }
.sb-user-name { flex: 1; }
.sb-user .sb-user-chev { width: 14px; height: 14px; flex: none; color: var(--dim); }
/* The menu itself is styled in style.css, beside `.th-prefs`, the card it
   matches. */

.sb-user-av { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--text) 10%, var(--paper)); font-size: 12.5px; font-weight: 600; }
.sb-user-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- the conversation ----------------------------------------------- */

/* The chat as the page has the lighter ground; beside a page it keeps the
   paper, so the two read as two things. */
#app:is(.chat-wide, .chat-fills-window) #chat-panel { background: var(--window-2); }
/* One reading column, centred, whatever width the chat has: the stream, the
   card waiting on the person and the box all start and end on the same
   lines, as the canvas draws them. */
#chat-panel :is(.stream, #needs-dock, #dock) { --cl-pad: max(16px, calc((100% - var(--cl-col)) / 2)); }
#chat-panel .stream { padding-left: var(--cl-pad); padding-right: var(--cl-pad); gap: 12px; }
#chat-panel #needs-dock { padding-left: var(--cl-pad); padding-right: var(--cl-pad); }
#chat-panel #dock { padding-left: var(--cl-pad); padding-right: var(--cl-pad); }
#chat-panel #dock .composer { max-width: none; }
/* In a 420px column the tile and its gutter are smaller. */
#app.chat-open:not(.chat-fills-window) #chat-panel { --cl-gut: 34px; --cl-av: 24px; }

/* The person's words: a dark bubble on the right. */
#chat-panel .stream .msg.user {
  background: var(--btn-ink); color: var(--on-btn-ink); border: 0;
  border-radius: 18px; padding: 10px 15px; max-width: min(80%, 620px);
  font-size: 15px; line-height: 1.5;
}
/* The other side's: open text on the left, under who said it. */
#chat-panel .stream .msg.agent {
  background: transparent; border: 0; border-radius: 0; padding: 0;
  font-size: 15px; line-height: 1.6; width: auto; max-width: none; align-self: stretch;
}
/* Everything the other side shows sits in the column right of the speaker's
   tile: the answer, its steps, files, cards, the turn's line. The person's own
   bubble, its row, the centred notes and the name line itself do not. */
#chat-panel .stream > :not(.msg.user, .msg-actions.for-question, .turnbar, .brief, .who) {
  margin-left: var(--cl-gut);
}
#chat-panel .stream > :is(.steps, .coworker-card, .devy-card, .delegation, .approval, .failbar) { max-width: none; width: auto; align-self: stretch; }

/* Who is speaking: the name above the first line, the tile hanging beside
   it in the gutter (chat-look.js draws one per turn). */
/* `.stream > .who`, not `.who`: the Task center's cards have a `<b class="who">`
   of their own (coworkers.js), and the bare class pushed "Writer" 42px right
   and 6px down on every simple card and wrapped the advanced card's meta line
   (desktop QA, 2026-10-14). chat-look.js only ever puts this one straight
   into a stream. */
.stream > .who { position: relative; display: flex; align-items: center; min-height: 18px; padding-left: var(--cl-gut); margin-top: 6px; margin-bottom: -6px; }
.who-name { font-size: 13px; color: var(--dim); line-height: 1.4; }
.who-av {
  position: absolute; left: 0; top: 24px;
  width: var(--cl-av, 30px); height: var(--cl-av, 30px); border-radius: 8px;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 600; color: #fff; background: var(--fill-graphite);
}
.who-av[data-scout] { background: var(--btn-ink); color: var(--on-btn-ink); }
.who-av[data-tint="denim"] { background: var(--fill-denim); }
.who-av[data-tint="sage"] { background: var(--fill-sage); }
.who-av[data-tint="honey"] { background: var(--fill-honey); }
.who-av[data-tint="blush"] { background: var(--wine); }
/* Outside the panel (the phone's sheet keeps its own look) the tile has no
   gutter to hang in, so it sits beside the name. */
#sheet .who { padding-left: 0; gap: 8px; margin-bottom: 0; }
#sheet .who-av { position: static; width: 22px; height: 22px; border-radius: 6px; font-size: 11px; }

/* Tables inside answers: the canvas's quiet grid — a hairline frame, the
   head in the secondary grey, figures in tabular numerals so columns line up.
   The head was mono capitals until 2026-11-17, and turned the model's own
   column names into shouting; it keeps the case it was written in now. */
/* The frame is `.md-table`'s (markdown.js wraps every table so a wide one
   scrolls inside the message); a border on the table too drew a box in a box. */
#chat-panel .msg.agent .md-table { margin: 10px 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
#chat-panel .msg.agent table { border-collapse: separate; border-spacing: 0; width: 100%; margin: 0; border: 0; border-radius: 0; background: transparent; font-size: 14px; font-variant-numeric: tabular-nums; }
#chat-panel .msg.agent th { font: 500 12.5px/1.3 var(--f-body); letter-spacing: normal; text-transform: none; color: var(--dim); text-align: left; padding: 10px 13px; background: var(--card-2); border-bottom: 1px solid var(--line); }
#chat-panel .msg.agent td { padding: 10px 13px; border-bottom: 1px solid var(--line); }
#chat-panel .msg.agent tr:last-child td { border-bottom: 0; }

/* The turn's own line — how long, what it cost — quiet, under the answer it
   belongs to. Never animated with the spring: it carries money. */
#chat-panel .turn-foot { margin-top: -6px; font-size: 12.5px; }

/* ---------- the approval, as a card in the conversation -------------------- */

/* While it waits it is the last thing in the conversation, directly above the
   box (needs-dock.js keeps it there, and Today's Inbox reads it there), so it
   is drawn as the canvas's in-chat card — the column's width, flush with the
   answers, no floating shadow — rather than as a sheet over the chat. */
#chat-panel #needs-dock { padding-top: 2px; padding-bottom: 8px; gap: 8px; }
#chat-panel #needs-dock > :is(.approval, .goal-ask, .nd-head) { margin-left: var(--cl-gut); width: auto; max-width: none; align-self: stretch; box-shadow: none; }
.approval {
  background: var(--honey-tint);
  border: 1px solid color-mix(in srgb, var(--fill-honey) 45%, var(--line));
  border-left-width: 1px;
  border-radius: 12px; padding: 14px 16px;
}
.approval .ap-head { font-size: 12px; color: var(--sun-ink); }
.approval .ap-intent { font-size: 15px; font-weight: 600; line-height: 1.45; color: var(--text); }
.approval .ap-warn { font-weight: 400; font-size: 13.5px; color: var(--sun-ink); }
.approval .ap-actions { gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.approval .ap-yes {
  background: var(--btn-ink); color: var(--on-btn-ink); border: 0;
  border-radius: 9px; min-height: 36px; padding: 8px 16px; font-weight: 500;
}
.approval .ap-yes:hover { background: color-mix(in srgb, var(--btn-ink) 86%, var(--paper)); }
.approval .ap-no {
  background: var(--card); color: var(--text); border: 1px solid var(--line-2);
  border-radius: 9px; min-height: 36px; padding: 8px 14px; font-weight: 500;
}
.approval .ap-detail summary { color: var(--win); font-weight: 500; font-size: 13.5px; }
/* Settled, it reads as the record: plain ground, no buttons. */
.approval:is(.approved, .rejected, .expired) {
  background: var(--card); border-color: var(--line);
  transition: background-color calc(var(--dur-base) * var(--dur-exit-scale)) var(--ease-exit), border-color calc(var(--dur-base) * var(--dur-exit-scale)) var(--ease-exit);
}

/* ---------- the composer --------------------------------------------------- */

.at-worker { flex: none; }
.at-worker[hidden] { display: none; }
/* Not on a phone. The bar's five controls were measured to fit 360px with Send
   inside (chat-dom.test.ts pins the arithmetic); a sixth would push Send off
   under a thumb. Typing @ in the box opens the same list there. */
@media (max-width: 720px) { .composer-bar .at-worker { display: none; } }
#chat-panel .composer { border-radius: 16px; border-color: var(--line); box-shadow: 0 1px 2px rgba(60, 40, 20, .05); }
#chat-panel .composer:focus-within { border-color: var(--line-2); }

/* ---------- the fresh chat ------------------------------------------------- */

/* A chat with nothing in it is a greeting over a big box, with the chips under
   it (the canvas's Main screen). The box is the ONE composer, still in #dock
   where every test and handler expects it; the greeting and the chips are
   laid out round it by flex `order`, with #chat-body and #chat-empty taken
   out of the box tree (`display: contents`) while the chat is idle. Only in
   the panel: on a phone #chat-body moves into the Ask sheet, which keeps its
   own layout. */
#chat-main:has(> #chat-body.idle) { justify-content: center; overflow-y: auto; padding: 24px 0 9vh; }
#chat-main > #chat-body.idle { display: contents; }
#chat-main > #chat-body.idle > #chat-empty { display: contents; }
#chat-main > #chat-body.idle > #chat-empty::before { content: none; display: none; }
#chat-main > #chat-body.idle > #chat-empty > * { order: 1; }
#chat-main > #chat-body.idle > :is(#send-notice, #coworker-finish, #goal-notice, #needs-dock) { order: 2; }
#chat-main:has(> #chat-body.idle) > #dock { order: 3; flex: none; padding-top: 8px; padding-bottom: 12px; }
#chat-main > #chat-body.idle > #chat-empty > .starters { order: 4; }
#chat-main > #chat-body.idle > #chat-empty > .ce-live { order: 5; }

.ce-greet {
  margin: 0 auto 6px; padding: 0 20px; text-align: center;
  font-size: clamp(26px, 3vw, 34px); font-weight: 600; letter-spacing: -.02em; line-height: 1.15; color: var(--text);
}
#chat-empty .ce-head {
  margin: 0 auto 10px; padding: 0 20px; max-width: 40ch; text-align: center;
  font-size: 15px; font-weight: 400; letter-spacing: 0; color: var(--dim);
}
#chat-main .starters {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  max-width: calc(var(--cl-col) + 32px); margin: 4px auto 0; padding: 0 16px;
}
#chat-main .starter {
  display: inline-flex; align-items: center; gap: 8px; width: auto; min-height: 0;
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card);
  font: inherit; font-size: 14px; color: var(--sb-ink); text-align: left; box-shadow: none;
  transition: border-color var(--dur-instant) var(--ease-snap), background-color var(--dur-instant) var(--ease-snap);
}
#chat-main .starter:hover { border-color: var(--line-2); background: var(--card); transform: none; }
#chat-main .starter .sq { width: 16px; height: 16px; background: transparent; box-shadow: none; color: var(--sq, var(--dim)); }
#chat-main .starter .sq .ic { width: 15px; height: 15px; stroke-width: 2; }
#chat-main .starter .sc-text { display: inline-flex; flex-direction: row; align-items: baseline; gap: 6px; min-width: 0; }
#chat-main .starter .sc-title { font-weight: 400; }
#chat-main .starter .sc-sub { max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); font-size: 13px; }
/* `#chat-empty p` (style.css) caps a paragraph at 30ch for the old empty
   state's sentence; this line is one row under the chips, so it has the
   column's width. */
#chat-empty .ce-live {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px;
  max-width: var(--cl-col); margin: 18px auto 0; padding: 0 16px; font-size: 13px; color: var(--dim); text-align: center;
}
.ce-live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--st-done); flex: none; animation: cl-breathe 2.4s ease-in-out infinite; }
.ce-live-open { color: var(--win); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- motion (the motion pack) --------------------------------------- */

/* Things arrive, they don't travel: 4px and a fade over 200ms on the snap
   curve, for what a turn this browser is watching adds (`cl-enter`, app.js
   `add`). The speaker's tile pops on the spring — the pack's one licensed
   use besides the + bloom and the check — and nothing that carries a figure
   ever does: the turn's line and the approval card use the snap. */
@keyframes cl-rise { from { opacity: 0; transform: translateY(4px); } }
@keyframes cl-pop { from { opacity: 0; transform: scale(.96); } }
@keyframes cl-fade { from { opacity: 0; } }
@keyframes cl-breathe { 50% { opacity: .35; } }
#chat-panel .stream > .cl-enter { animation: cl-rise var(--dur-base) var(--ease-snap) both; }
#chat-panel .stream > .who.cl-enter .who-av { animation: cl-pop var(--dur-base) var(--ease-spring) both; }
#chat-panel .stream > .turn-foot.cl-enter { animation: cl-fade var(--dur-base) var(--ease-snap) both; }
#chat-panel #needs-dock > .approval { animation: cl-rise var(--dur-base) var(--ease-snap) both; }
#chat-main .starter, .ce-greet, #chat-empty .ce-head { animation: cl-rise var(--dur-panel) var(--ease-snap) both; }
#chat-main .starter { animation-delay: calc(60ms + var(--i, 0) * 18ms); }
/* Reduced motion: every move becomes an 80ms fade (the pack's rule six), and
   the one ambient loop — the working dot — holds still. */
@media (prefers-reduced-motion: reduce) {
  #chat-panel .stream > .cl-enter,
  #chat-panel .stream > .who.cl-enter .who-av,
  #chat-panel .stream > .turn-foot.cl-enter,
  #chat-panel #needs-dock > .approval,
  #chat-main .starter, .ce-greet, #chat-empty .ce-head { animation: cl-fade 80ms linear both; animation-delay: 0s; }
  .ce-live-dot { animation: none; }
  #threads :is(.side-item, .sb-item), #threads .chat-item, .sb-mark, #threads #brand-btn, .approval { transition: none; }
}

/* ---------- Scout's browser, live in the chat (item 63 b, live-browser.js) -- */

/* A card the width of the column, like the steps and the coworker cards: a
   picture is read at the size it is drawn, and a narrow one is a thumbnail
   nobody can sign in through. */
#chat-panel .stream > .lb, #chat-panel .stream > .lb-slot { max-width: none; width: auto; align-self: stretch; }
/* `flex: none`: the stream is a flex column, and a child that clips
   (`overflow: hidden`) may otherwise be shrunk to its border — the card was
   2px tall in Chromium until this said so. */
.lb {
  flex: none; align-self: stretch; display: flex; flex-direction: column; min-width: 0;
  background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-2); overflow: hidden;
  /* The UA's popover box (`[popover]`: a border, padding, auto margins and
     fit-content) must never show: the card is the card in the top layer too. */
  margin: 0; padding: 0; inset: auto;
}
/* A container, so the head can drop the long words where the card is narrow
   (the chat column beside an open page is ~490px). */
.lb { container-type: inline-size; }
@container (max-width: 540px) { .lb-open .lb-word { display: none; } }
.lb-head { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 6px 6px 12px; }
.lb-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--dim-2); }
.lb[data-state="live"] .lb-dot { background: var(--st-done); animation: cl-breathe 2.4s ease-in-out infinite; }
.lb[data-state="connecting"] .lb-dot, .lb[data-state="ready"] .lb-dot { background: var(--st-working); }
.lb-title { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-acts { display: flex; align-items: center; gap: 2px; flex: none; }
.lb-acts:empty { display: none; }
.lb-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--dim);
  font: inherit; font-size: 12.5px; font-weight: 550; cursor: pointer;
  transition: background-color var(--dur-instant) var(--ease-snap), color var(--dur-instant) var(--ease-snap);
}
.lb-btn .ic { width: 15px; height: 15px; stroke-width: 1.9; }
.lb-btn:hover { background: var(--surface-2); color: var(--text); }
.lb-btn[hidden] { display: none; }
/* Watch is the card's one action, so it is a button that looks like one. */
.lb-watch { color: var(--text); border: 1px solid var(--line-2); background: var(--card); }
.lb-body { display: flex; flex-direction: column; min-height: 0; }
.lb-said { margin: 0; padding: 0 14px 12px 27px; font-size: 13px; line-height: 1.45; color: var(--dim); }
/* The screen: 16:10 in the transcript, the whole box when expanded. The frame
   sits on a dark ground so a page still loading reads as a screen, not a gap. */
.lb-screen { position: relative; aspect-ratio: 16 / 10; background: #141312; border-top: 1px solid var(--line); }
.lb-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.lb-wait {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 13px; color: rgb(255 255 255 / .72); background: #141312;
  opacity: 0; pointer-events: none; transition: opacity var(--dur-base) var(--ease-snap);
}
.lb-screen.is-loading .lb-wait { opacity: 1; }
.lb-foot { margin: 0; padding: 8px 12px 10px; font-size: 12px; color: var(--dim); border-top: 1px solid var(--line); }
/* Where the card was, while it is at full size: its height, nothing drawn. */
.lb-slot { flex: none; border-radius: var(--r-md); background: color-mix(in srgb, var(--text) 4%, transparent); }

/* Full size. Placed by live-browser.js over the app right of the sidebar —
   the chat and the page together (left/top/width/
   height inline); the top layer when the browser has popovers, `fixed` when it
   has not. The foot goes — the frame takes everything under the head. */
.lb.is-expanded {
  position: fixed; z-index: 70; max-width: none;
  border-radius: 14px; box-shadow: var(--window-sh), 0 24px 60px -28px rgb(0 0 0 / .45);
  transform-origin: 0 0; will-change: transform;
}
.lb.is-expanded:popover-open { display: flex; }
/* The transcript's gutter is for the card in its row; at full size it would
   push the whole window right by the gutter's width. */
#chat-panel .stream > .lb.is-expanded, #sheet .stream > .lb.is-expanded { margin: 0; }
.lb.is-expanded .lb-body { flex: 1; }
.lb.is-expanded .lb-screen { flex: 1; aspect-ratio: auto; }
.lb.is-expanded .lb-foot { display: none; }
.lb.is-expanded::backdrop { background: transparent; }
@media (prefers-reduced-motion: reduce) {
  .lb[data-state="live"] .lb-dot { animation: none; }
  .lb-btn, .lb-wait { transition: none; }
}

/* ---------- the slim rail (item 196, 2026-10-21) -------------------------- */

/* The sidebar's collapsed state, drawn as the sidebar shrunk rather than as a
   different navigation: the same places in the same order (New chat, Search,
   Today — Scout's row in its place with the Scout layout on — Results,
   Calendar, Team, Library, Shop, Goals; Connections and Settings at the foot),
   as icons only, 56px wide. Owner, verbatim: "side bar with icons can be
   collapsed but as you go on each icon you can see more on it". The name of
   each is in its peek (rail-peek.js) and stays its accessible name: the word
   is clipped out of sight, never `display: none`, which would take it out of
   the accessibility tree too and leave a screen reader a column of nameless
   buttons.
   What left the rail, and where it went: the Chat toggle (⌘/ and the top
   bar's own toggle do it), the team's tiles (Team's peek lists them),
   Privacy (a row in Settings' peek). Hire a worker, Skills and Memory are rows
   of Team's and Settings' peeks. All of it at 821px and up, where the rail is
   a column; the ≤820px drawer keeps its rows of words, unchanged.
   The rail's places and its foot are two groups in the markup (the drawer
   needs them so); here they are one column, `display: contents`, so `order`
   can put Goals after Shop as the sidebar does. */
@media (min-width: 821px) {
  #app:not(.rail-expanded) #sidebar { padding: 10px 0 10px; gap: 2px; align-items: center; }
  #app:not(.rail-expanded) #sidebar > :is(.side-group, .side-bottom) { display: contents; }
  #app:not(.rail-expanded) #sidebar .side-top { order: 0; margin-bottom: 8px; }
  #app:not(.rail-expanded) #sidebar #sb-search { order: 2; margin-bottom: 6px; }
  #app:not(.rail-expanded) #sidebar #scout-nav { order: 3; }
  #app:not(.rail-expanded) #sidebar #today-nav { order: 4; }
  #app:not(.rail-expanded) #sidebar #home-nav { order: 5; }
  #app:not(.rail-expanded) #sidebar #results-nav { order: 6; }
  #app:not(.rail-expanded) #sidebar #calendar-nav { order: 7; }
  #app:not(.rail-expanded) #sidebar #coworkers-nav { order: 8; }
  #app:not(.rail-expanded) #sidebar #library-nav { order: 9; }
  #app:not(.rail-expanded) #sidebar #spaces-nav { order: 10; }
  #app:not(.rail-expanded) #sidebar #shop-nav { order: 11; }
  #app:not(.rail-expanded) #sidebar #goals-nav { order: 12; }
  #app:not(.rail-expanded) #sidebar #brand-switch { order: 13; margin-top: auto; }
  #app:not(.rail-expanded) #sidebar #sandbox-pill { order: 14; }
  /* The foot starts where the places end: Customize (which took the
     Connections row's place in slice 4) takes the free space above it,
     unless the shop switcher (above it) already did. */
  #app:not(.rail-expanded) #sidebar #sb-customize { order: 15; margin-top: auto; }
  #app:not(.rail-expanded) #sidebar #brand-switch:not([hidden]) ~ #sb-customize { margin-top: 0; }
  #app:not(.rail-expanded) #sidebar #settings-btn { order: 16; }
  #app:not(.rail-expanded) #sidebar :is(#chat-nav, a.legal-link, .crew-side) { display: none; }

  /* `place-content: center` as well as `place-items`: `.side-item` carries
     `justify-content: flex-start` from the docked sidebar (style.css), and in
     this grid that packs the icon's one auto-sized track against the left
     edge, so every page icon sat 9px left of New chat and Search, which have
     no such rule (owner, 2026-10-28: "when I collapse sidebar icons don't
     align"). `place-items` centres a cell's content inside its track; it is
     `place-content` that centres the track inside the button. */
  #app:not(.rail-expanded) #sidebar :is(.side-item, .sb-item) {
    position: relative; flex: none; display: grid; place-items: center; place-content: center;
    width: 40px; height: 40px; min-height: 0; padding: 0; margin: 0; gap: 0;
    border: 0; border-radius: 10px; background: transparent;
    color: var(--sb-ink); font: inherit; cursor: pointer;
    transition: background-color var(--dur-instant) var(--ease-snap);
  }
  #app:not(.rail-expanded) #sidebar :is(.side-item, .sb-item)[hidden] { display: none; }
  #app:not(.rail-expanded) #sidebar :is(.side-item, .sb-item)::before { content: none; }
  /* The word, out of sight and still the button's name. */
  #app:not(.rail-expanded) #sidebar :is(.side-item, .sb-item) .s-label {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
  }
  /* A pill of ground on hover, a darker one for "you are here" and for the
     icon whose peek is showing — the sidebar's own two states. */
  #app:not(.rail-expanded) #sidebar :is(.side-item, .sb-item):is(:hover, .rp-on) { background: var(--sb-hover); }
  #app:not(.rail-expanded) #sidebar :is(.side-item, .sb-item).active { background: var(--sb-on); color: var(--text); }
  #app:is(.chat-wide, .chat-fills-window):not(.rail-expanded) #sidebar :is(.side-item, .sb-item).active:not(:hover, .rp-on) { background: transparent; }
  #app:not(.rail-expanded) #sidebar :is(.side-item, .sb-item):focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
  /* Colour (Customize › Rail icons, the default): the sidebar's glyph in its
     squircle, which now has no word under it to share a colour with. New
     chat and Search are given theirs here; in the sidebar they are lines. */
  #app:not(.rail-expanded) #sidebar .sb-item .s-icon {
    --sq-top: color-mix(in srgb, var(--sq, var(--fill-graphite)) 92%, #fff);
    display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px;
    background: linear-gradient(to bottom, var(--sq-top), var(--sq, var(--fill-graphite))); color: #fff;
    box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .12), 0 1px 1.5px rgba(40, 20, 10, .18);
  }
  #app:not(.rail-expanded) #sidebar .sb-item .s-icon .ic { width: 14px; height: 14px; stroke-width: 2.5; }
  #app:not(.rail-expanded) #sidebar :is(.side-item, .sb-item) .s-icon { filter: none; }
  /* Mono: the sidebar's own line glyphs, exactly — 18px at 1.6. */
  #app.rail-mono:not(.rail-expanded) #sidebar :is(.side-item, .sb-item) .s-icon {
    width: 18px; height: 18px; border-radius: 0; background: transparent; box-shadow: none; color: currentColor;
  }
  #app.rail-mono:not(.rail-expanded) #sidebar :is(.side-item, .sb-item) .s-icon .ic { width: 18px; height: 18px; stroke-width: 1.6; }
  /* A count rides the icon's corner, as on a phone's home screen. */
  #app:not(.rail-expanded) #sidebar :is(.side-item, .sb-item) .badge {
    position: absolute; top: 1px; right: 0; margin: 0; padding: 0 4px; min-width: 16px; box-sizing: border-box;
    font-size: 10px; line-height: 15px; border: 0; border-radius: 999px; text-align: center;
    background: var(--honey-tint); color: var(--sun-ink);
  }
  #app:not(.rail-expanded) #sidebar :is(.side-item, .sb-item) .badge .tm-dot { display: none; }
  #app:not(.rail-expanded) #sidebar #brand-btn { width: 40px; }
  #app:not(.rail-expanded) #sidebar #brand-switch .side-label { display: none; }
  #app:not(.rail-expanded) #sidebar .rail-mascot { width: 40px; height: 40px; }
  #app:not(.rail-expanded) #sidebar .rail-toggle { width: 40px; height: 30px; }
}

/* ---------- the peek ------------------------------------------------------- */

/* The name, then at most three one-line rows, on the cream card the floating
   panel is drawn on. Fixed beside the rail; placed by rail-peek.js. */
.rail-peek {
  position: fixed; z-index: 75; left: 64px; top: 8px;
  width: max-content; min-width: 168px; max-width: 280px; box-sizing: border-box;
  padding: 7px 6px 6px; border-radius: var(--r-md);
  background: var(--card); color: var(--text);
  box-shadow: var(--elev-2);
  transform-origin: left 18px;
  transition: top var(--dur-instant) var(--ease-move);
}
.rail-peek:not(.is-moving) { transition: none; }
.rail-peek[hidden] { display: none; }
.rp-head { display: flex; align-items: baseline; gap: 10px; padding: 3px 8px 4px; }
.rp-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-key { flex: none; font: 500 11.5px/1 var(--f-body); letter-spacing: normal; color: var(--dim); background: none; border: 0; padding: 0; }
.rail-peek.rp-only-name { min-width: 0; padding: 5px 6px; }
.rail-peek.rp-only-name .rp-head { padding: 2px 6px; }
.rp-note { margin: 0; padding: 0 8px 4px; font-size: 12.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-rows { display: flex; flex-direction: column; gap: 1px; margin-top: 2px; padding-top: 4px; border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent); }
.rp-row {
  display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; min-height: 30px;
  padding: 5px 8px; border: 0; border-radius: 8px; background: transparent;
  font: inherit; font-size: 13px; color: var(--sb-ink); text-align: left; cursor: pointer;
  transition: background-color var(--dur-instant) var(--ease-snap);
}
.rp-row:hover, .rp-row:focus-visible { background: var(--sb-hover); color: var(--text); }
.rp-row:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.rp-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-sub { flex: none; max-width: 40%; font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--dim-2); }
.rp-dot:is([data-state="working"], [data-state="running"]) { background: var(--st-working); }
.rp-dot:is([data-state="needs"], [data-state="stuck"]) { background: var(--fill-honey); }
.rp-dot:is([data-state="done"], [data-state="live"]) { background: var(--st-done); }
/* In from the rail's edge on the enter tokens; out as motion.js's ghost at
   0.7 of that, on the exit curve. */
@keyframes rp-in { from { opacity: 0; transform: translateX(-4px) scale(.96); } }
@keyframes rp-out { to { opacity: 0; transform: translateX(-4px) scale(.96); } }
@keyframes rp-fade { from { opacity: 0; } }
@keyframes rp-fade-out { to { opacity: 0; } }
.rail-peek.is-entering { animation: rp-in var(--dur-quick) var(--ease-snap) both; }
.rail-peek.is-leaving { animation: rp-out calc(var(--dur-quick) * var(--dur-exit-scale)) var(--ease-exit) both; }

/* ---------- the open screen (item 196, open-screen.js) -------------------- */

/* Just the conversation, centred in its 760px column, beside the slim rail:
   no page, no docked list, no side panel unless the person brings it back.
   One quiet line of chrome above it — the chat's name on the left, and on the
   right its running word and Stop, ⋯, the side panel's toggle and the way
   back. What goes: Move to side panel, the chat's ✕ (the way out is the way
   back), the Chats pill and the header's + (the rail's New chat and its peek
   hold both). Desk only; on a phone the class is never written. */
@media (min-width: 721px) {
  #app.open-screen:not(.view-welcome) { --col-threads: 0px; }
  #app.open-screen #chat-panel :is(#chat-to-side, #chat-close, #chat-list-toggle, #new-thread) { display: none; }
  #app.open-screen #chat-panel { position: relative; }
  #app.open-screen #chat-panel .cp-ident {
    position: absolute; top: 10px; left: 16px; z-index: 1;
    height: 32px; max-width: calc(100% - 420px); padding: 0;
    justify-content: flex-start; pointer-events: none;
  }
  #app.open-screen #chat-panel .cp-ident > * { pointer-events: auto; }
  #app.open-screen #chat-panel .cp-ident #status-mascot { display: none; }
  #app.open-screen #chat-panel #chat-panel-title { font-size: 14px; color: var(--sb-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
/* The way in and the way back are one button; its corners point the way it goes. */
#chat-expand .os-in { display: none; }
#chat-expand[aria-pressed="true"] .os-in { display: block; }
#chat-expand[aria-pressed="true"] .os-out { display: none; }

/* The rail's arrow in the open screen floats the full sidebar over the chat
   rather than docking it beside it, which would undo the screen (design.md
   Q6): it takes no column, the rail stays under it so nothing beside it
   moves, and Escape, a click outside or a pick put it away. In on the panel
   tokens; away at once — the person has picked, or clicked elsewhere. */
@media (min-width: 821px) {
  #app.open-screen.threads-docked:not(.view-welcome) { --col-rail: 56px; --col-threads: 0px; }
  #app.open-screen.threads-docked #sidebar { display: flex; }
  #app.open-screen.os-sidebar #threads {
    position: fixed; z-index: 45; left: 8px; top: 8px; bottom: 8px;
    width: var(--threads-w, 272px); border-radius: 14px; border-right: 0;
    background: var(--sb-bg); box-shadow: var(--elev-2);
    animation: os-sb-in var(--dur-panel) var(--ease-snap) both;
  }
  #app.open-screen.os-sidebar #threads-resize { display: none; }
}
@keyframes os-sb-in { from { opacity: 0; transform: translateX(-12px); } }

@media (prefers-reduced-motion: reduce) {
  .rail-peek, .rail-peek.is-moving { transition: none; }
  .rail-peek.is-entering { animation: rp-fade 80ms linear both; }
  .rail-peek.is-leaving { animation: rp-fade-out 80ms linear both; }
  #app.open-screen.os-sidebar #threads { animation: rp-fade 80ms linear both; }
  #app:not(.rail-expanded) #sidebar :is(.side-item, .sb-item), .rp-row { transition: none; }
}

/* The toast in the open screen (design.md, implementation plan). Its rule for
   a chat that has the window puts it top right, under the header, so it is
   not over Send — and there it sat over the first message's right end, which
   in a centred 760px column is exactly where the person's own bubble is
   (`before-1024-chat-wide-sidebar.png`). Where the margin beside the column
   is wide enough to hold it, it goes down into that margin instead, clear of
   both the transcript and Send. Narrower windows keep the rule they had: a
   toast squeezed into a 70px margin would be worse than one over a line. */
@media (min-width: 1440px) {
  body:has(#app.open-screen:not(.view-welcome):not(.wb-open)) #quest-toast {
    top: auto; bottom: 20px; right: 20px;
    max-width: min(370px, calc((100vw - 56px - 760px) / 2 - 36px));
  }
}
